-
Notifications
You must be signed in to change notification settings - Fork 12
Description
I am writing a brief description of SysV functions (pending PR on tos.hyp)
I found a mismatch between the constants used in the MiNTLib and those used in the kernel for the semctl()/Psemctl() cmd
parameter.
- MiNTLib uses the same values as glibc and the Linux kernel (11-17)
- FreeMiNT uses the BSD kernel constants (3-9)
The glibc is designed for Linux:
It officially supports the Hurd and Linux kernels
A patch is needed for BSD:
To be compatible with BSD kernel, a lot of patches are applied to the glibc (changes glibc/linux 11-17 to bsd 3-9)
(source: https://en.wikipedia.org/wiki/Glibc#Supported_hardware_and_kernels)
Therefore, when a program includes sys/sem.h, it sends values between 11 and 17 (glibc/MiNTLib) to the kernel (semctl() just calls Psemctl), but the kernel expects values between 3 and 9 (FreeMiNT/BSD).
Two solutions:
- BSD-patch for the glibc: sem.h: values 11-17 (from the glibc) are changed to 3-9 (BSD kernel)
- add glibc/Linux constants 11-17 to the BSD constants 3-9: linux_ipc.h
Of course there is no urgency, but hopefully there are no other such problems in the code.