Random ideas for 3.7
Corinna Vinschen
corinna-cygwin@cygwin.com
Tue Mar 18 19:50:56 GMT 2025
Fodder for future Cygwin development:
For a start I'd like to add some additions to POSIX-1.2025 which catched
my eye. Whoever wants to take a stab at some of the functionality, feel
free.
I have noticed especially:
- _Fork:
Same as fork() except that "fork handlers established by means of the
pthread_atfork() function shall not be called and _Fork() shall be
async-signal-safe.
- getresgid, getresuid, setresgid, setresuid:
Getting or setting real, effective, and saved ids in a single function.
- posix_devctl:
Theoretically just a marginally standarized replacement API for ioctl.
I wonder if this will ever get traction, though...
- "Close on fork semantics" adding the following new flags:
O_CLOFORK open(), dup3()
SOCK_CLOFORK socket()
FD_CLOFORK fcntl(F_SETFD/F_GETFD)
F_DUPFD_CLOFORK fcntl()
- "Open file description lock", a Linx invention since Linux 3.15,
adding the following fcntl() flags:
F_OFD_SETLK
F_OFD_SETLKW
F_OFD_GETLK
Normal advisory locks created with F_SETLK/F_SETLKW are process-owned
(i.e., the lock excludes other processes), not inherited by child
processes, and released at first close() of *any* descriptor
referencing the file.
This new OFD lock type is descriptor-owned. It's inherited via
fork(), dup(), fcntl(F_DUPFD), etc., so all duplicates of the same
descriptor share and own the same locks. The lock is released
automatically only when the last descriptor referencing it is closed.
That's it for now.
If you have other ideas what could be helpful for Cygwin, don't be shy
to add it to this thread. Ideally with the intention to look into
implementing it by yourself, but at least a certain willingness to look
into the source code and discuss potential ways to implement it given
the current framework.
Corinna
More information about the Cygwin-developers
mailing list