Conversation
|
Just a quick glance over this PR... Where did the memory alloc+touch+locking go? Some of that code does not make sense only at first glance, but has an important function in conjunction with how pages are mapped in the process. You have moved code and afaics without attribution (didn't look in all details). Regardless, you need to have the GPL header in place too. |
That was here: https://github.com/LinuxCNC/linuxcnc/blob/master/src/rtapi/uspace_rtapi_app.cc#L814 I tried to change nothing there. The only change was this to avoid having an instance pointer: c8af827 It was added here but I don't understand the description, so I left it (nearly) as it was: cbbd8e5
Sure, I will do that. |
|
So, the lost GPL headers are restored and I added them where missing by tracking the author/date in git. I hope that is fine to. |
Right, didn't see that. Good. If you please also get rid of the I'm not sure I would have done While you are at it, you moved quite a bit of code to a different file (without renaming so git doesn't track that as nicely; no prob). You might also want to run it through clang-format. Now that all lines are changes anyway... Better make that indent thingy consistent too (see also #2760 as a starting point). There may still be some things afterwards you'd want to reformat manually, but it does give a better starting point.
This I need to evaluate in more detail. I'll get back to you on that one...
Well, you are also falling into the "it was added I don't know why and don't understand" trap. That seems to be a more regular feeling than I'd like it to be. ;-)
Great! |
Done, I replaced also another snprintf.
Sure, done. I will look into clang-format. That random tab/space mix annoys me anyway... ;-)
That's why I tried to not change anything I don't understand. The locking in PosixApp seam to have the following target: |
|
So, clang-format of the moved files and the thread implementations where it is nice to be able to compare them.
Not formatted but small changes in this MR:
I can do them also if desired. |
Readability is always a priority. When it bothers (you), then it is wrong and you fix it :-)
Please do. [I'm using a 132 column terminal ever since I can remember from the old VT320 (132x24) and later 132x43 on the PC terminal emulation. And now using 20+ terminal windows of that size as a default and gvim also starts at that size.]
Only is you already changed about the whole file. Otherwise we get a discontinuity in the blame diffs. |
|
So, changes from original clang-format file:
Looks nicer now and I had to do only a few manual changes which are now not changed back anymore by format. |
|
And a funny rebase due to changes on master in the files I moved. It's always the same hassle, when refactoring or formatting, you break git blame and generate merge conflicts but you have to do it from time to time if you don't want to be stuck with hard to manage code. I checked it using: |
Always the same problem. Using
The next thing you might find is the warning about unused vars/args #3910. |
Would be nice to merge mine first... ;-) It's ready from my side. |
|
From my side, I reviewed the changes and the only might be functional changes are the once mentioned in the PR. |
|
Ok, rebased again, now i have the notes how to do it without to much effort... |
|
Wouldn't it make sense to activate -Werror so you can not build with warnings? |
|
For context the "UBC3" referenced in cbbd8e5 was "Unified Build Candidate 3" which was a refactoring of some of the massive amounts of work that mhaberler did, which did not get merged, and led to the schism that became Machinekit. |
Thanks for the info! What do you mean by "all platforms"? Machinekit seams to be dead now, no new commit since 4 years. |
I was looking into that. I created some infrastructure for that move quite some time ago (like cleaning up all the warnings). Not sure we should enable it on the distro builds. At least the gcc and clang rip-and-test targets should run with -Werror. |
Looking at: https://github.com/LinuxCNC/linuxcnc/actions/runs/24134037596/job/70417430040?pr=3908 I did not find -Werror and I think #3910 would not have been necessary if that had worked. I think just activate it for all and track back if there are too many issues, like a with configure --no-werror for specific builds. Also the build pipelines are really slow due to a ton of packages are installed. Wouldn't it make more sense to create bookworm-linuxcnc-2.9 / bookworm-linuxcnc-master ... containers in the linuxcnc docker registry with all the dependency's preinstalled and update them only like once a week? I could do that easily in gitlab but sadly, I don't know github that well. I found: |
|
As I said, I already made the infrastructure. The following is all that is needed to add it to diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 15b68b8dee..7c75fe4326 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -35,7 +35,7 @@ jobs:
sudo eatmydata apt --yes --quiet -o Acquire::Retries=5 upgrade
cd src
eatmydata ./autogen.sh
- eatmydata ./configure --disable-check-runtime-deps
+ eatmydata ./configure --disable-check-runtime-deps --enable-werror
eatmydata make -O -j$((1+$(nproc))) default pycheck V=1
# Note that the package build covers html docs
eatmydata ../scripts/rip-environment runtests -p
@@ -61,7 +61,7 @@ jobs:
sudo eatmydata apt --yes --quiet -o Acquire::Retries=5 upgrade
cd src
eatmydata ./autogen.sh
- CC=clang CXX=clang++ eatmydata ./configure --disable-check-runtime-deps
+ CC=clang CXX=clang++ eatmydata ./configure --disable-check-runtime-deps --enable-werror
eatmydata make -O -j$((1+$(nproc))) default pycheck V=1
# Note that the package build covers html docs
eatmydata ../scripts/rip-environment runtests -p |
Ah just made but not yet activated. Thanks for the info! |
It was a long time ago, and I was pretty much just a normal user at the time, but I think we ran separate branches for preempt-rt and rtai. |
|
In the Submakefile it reads: $(call TOOBJSDEPS, $(USPACE_POSIX_SRCS)): EXTRAFLAGS += -pthread -fPICShouldn't that be (not adding to EXTRAFLAGS): $(call TOOBJSDEPS, $(USPACE_POSIX_SRCS)): EXTRAFLAGS = -pthread -fPIC |
|
it seems this introduces a new shared library Something like librtapi-uspace-posix or even liblinuxcnc-rtapi-uspace-posix would be more appropriate IMHO. |
|
I don't want to split hairs here but librtapi-uspace-posix seems better and not too long. The issue is that if you specify |
Doesn't this happen for all |
Those work with --libdir=/usr/lib64, no lingering files in /usr/lib. I think the issue is: Yup! If I change everything to |
|
Sorry, I forgot to mention: 62e5ea6 |
|
So, I have some time to look into it. The reason behind 62e5ea6 is that posix and all the other real time implementations are equal in structure and usage which makes maintaining easier. |
I used the existing naming scheme. But yes, it's not that nice. Files in the lib folder: Any sugestions? I can change it, no big deal. |
|
I was a bit harsh and premature with my comment given that all those other libraries also pollute /usr/lib, apologies. It would make sense to prefix everything with linuxcnc or lcnc or name it like liblinuxcnc-rtapi-posix or something like that. uspace doesn't give that much information. libnml and libposemath could be a real problem because there is also the "real" (slightly incompatible) libnml from NIST, I guess nobody is using that alongside linuxcnc... |
Hmm, I don't understand makefiles in depth. I just copied what was already there a few lines below and edited it to match my lib. As much as I understand this, it just adds this flags to the global EXTRAFLAGS in Makefile for one compile command only. I did not see any duplicated flags. |
Still WIP, i have to review and refine the changes if there are fine for the admin's.Target: Move some classes out of the huge uspace_rtapi_app.cc
uspace_rtapi_main: Contains the main function and helpers
uspace_rtapi_app: Contains the RtapiApp class
uspace_posix: Contains the PosixApp class
Other fixes:
All real time implementations are now library's and handled the same way.
Sadly, rename tracking broke due to the amount of moved code, so it is a crap to review.
The following commands make it easier:
Do you think this is fine? So I will finalize it.
Advantage:
Disadvantage: