Skip to content

flag parameters

Ulrich Drepper lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest18 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18flag parameters: socket and socketpairinclude/linux/net.h net/9p/trans_fd.c net/sctp/socket.c +1 more+30 -110 replies
2/18flag parameters: pacceptinclude/asm-x86/unistd_64.h include/linux/net.h include/linux/syscalls.h +2 more+118 -127 replies
3/18flag parameters: anon_inode_getfd extensionfs/anon_inodes.c fs/eventfd.c fs/eventpoll.c +3 more+11 -90 replies
4/18flag parameters: signalfdarch/x86/ia32/ia32entry.S arch/x86/kernel/syscall_table_32.S fs/compat.c +5 more+33 -61 reply
5/18flag parameters: eventfdarch/x86/ia32/ia32entry.S arch/x86/kernel/syscall_table_32.S fs/eventfd.c +4 more+23 -20 replies
6/18flag parameters: timerfd_createfs/timerfd.c include/linux/timerfd.h+8 -20 replies
7/18flag parameters: epoll_createarch/x86/ia32/ia32entry.S arch/x86/kernel/syscall_table_32.S fs/eventpoll.c +4 more+21 -20 replies
8/18flag parameters: dup2arch/x86/ia32/ia32entry.S arch/x86/kernel/syscall_table_32.S fs/fcntl.c +3 more+19 -20 replies
9/18flag parameters: pipearch/cris/kernel/sys_cris.c arch/ia64/ia32/sys_ia32.c arch/ia64/kernel/sys_ia64.c +14 more+35 -160 replies
10/18flag parameters: inotify_initarch/x86/ia32/ia32entry.S arch/x86/kernel/syscall_table_32.S fs/inotify_user.c +4 more+21 -20 replies
11/18flag parametersi: NONBLOCK in anon_inode_getfdfs/anon_inodes.c+1 -10 replies
12/18flag parameters: NONBLOCK in socket and socketpairinclude/linux/net.h net/socket.c+12 -110 replies
13/18flag parameters: NONBLOCK in signalfdfs/signalfd.c include/linux/signalfd.h+4 -30 replies
14/18flag parameters: NONBLOCK in eventfdfs/eventfd.c include/linux/eventfd.h+4 -30 replies
15/18flag parameters: NONBLOCK in timerfd_createfs/timerfd.c include/linux/timerfd.h+4 -31 reply
16/18flag parameters: NONBLOCK in pipefs/pipe.c include/linux/fs.h kernel/kmod.c+11 -110 replies
17/18flag parameters: NONBLOCK in inotify_initfs/inotify_user.c include/linux/inotify.h+4 -30 replies
18/18flag parameters: check magic constantsfs/eventfd.c fs/eventpoll.c fs/inotify_user.c +3 more+26 -014 replies

Reviews trailers per patch

1 of 18 patches has a Reviewed-by or Acked-by.

PatchDavide Libenzi
1/18
2/18
3/18
4/18
5/18
6/18
7/18
8/18
9/18
10/18
11/18
12/18
13/18
14/18
15/18A-b
16/18
17/18
18/18

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/18] flag parameters

This is an update for the previous series which should address the comments Andrew had. The controversial function Davide wrote is gone. There is no flag conversion anymore. We still introduce new names for the constants but the values are the same as the O_* constants.

This leads to some strange-looking code where we in one moment check for, say, SOCK_CLOEXEC, and in the next for O_CLOEXEC. But I added in a separate, new patch code which checks for the consistency of the constants.

I modified the headers in <linux/*> to define the new values by include <linux/fcntl.h> and then simply define the new constants based on the O_* constants. That's the safest a nd least troublesome way. Otherwise we would have to create arch-specific headers. None of the modified headers should be used by userlevel code. Therefore the namespace pollution is no issue.

For those who just turn in, these patches add flags to various functions so that new file descriptors can be created with atomically setting the close-on-exec flag. This is critical, in multi-threaded apps we otherwise can have file descriptor leakage or worse. Since it is so either and often needed, I also added code to create new file descriptors with O_NONBLOCK set.

In future there will be other uses. Like a O_* flag to enable the use of non-sequential descriptors.

Some interfaces are not exported at userlevel with enough flexibility to allow extending them. For those we need new userlevel interface. This is the case for:

- paccept
- epoll_create2
- dup3
- pipe2
- inotify_init1

We do /not/ need new interfaces for

- signalfd4
- eventfd2
- timerfd_create
- socket
- socketpair

These either have flags parameters in the interface exported by glibc or (in case of the socket functions) overload a parameter with a bitset.

Each semantic change has a test program. For archs other than x86 and x86-64 you'll have to add the appropriate syscall number.

The patches all apply individually in sequence and the source tree remains compilable and runnable.