From bbeb5403be5330b145ad01ccdbfa305d3bf8a76d Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 26 Jun 2011 16:42:39 +0000 Subject: * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html). - Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK. * Fix the system calls that take socklen_t arguments to actually do so. * Don't include userland header files (signal.h) from system header files (rump_syscallargs.h). * Bump libc version for the new syscalls. --- lib/libc/sys/kqueue.2 | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'lib/libc/sys/kqueue.2') diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index 37e263bd11b..cbda791346d 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: kqueue.2,v 1.30 2011/05/24 02:31:11 ryo Exp $ +.\" $NetBSD: kqueue.2,v 1.31 2011/06/26 16:42:41 christos Exp $ .\" .\" Copyright (c) 2000 Jonathan Lemon .\" All rights reserved. @@ -32,11 +32,12 @@ .\" .\" $FreeBSD: src/lib/libc/sys/kqueue.2,v 1.22 2001/06/27 19:55:57 dd Exp $ .\" -.Dd April 13, 2010 +.Dd June 24, 2011 .Dt KQUEUE 2 .Os .Sh NAME .Nm kqueue , +.Nm kqueue1 , .Nm kevent .Nd kernel event notification mechanism .Sh LIBRARY @@ -47,6 +48,8 @@ .Ft int .Fn kqueue "void" .Ft int +.Fn kqueue1 "int flags" +.Ft int .Fn kevent "int kq" "const struct kevent *changelist" "size_t nchanges" "struct kevent *eventlist" "size_t nevents" "const struct timespec *timeout" .Fn EV_SET "\*[Am]kev" ident filter flags fflags data udata .Sh DESCRIPTION @@ -78,6 +81,18 @@ on a file descriptor will remove any kevents that reference the descriptor. .Pp .Fn kqueue creates a new kernel event queue and returns a descriptor. +.Pp +The +.Fn kqueue1 +also allows to set the following +.Fa flags +on the returned file descriptor: +.Bl -column O_NONBLOCK -offset indent +.It Dv O_CLOEXEC +Set the close on exec property. +.It Dv O_NONBLOCK +Sets non-blocking I/O. +.El The queue is not inherited by a child created with .Xr fork 2 . .\" However, if @@ -617,3 +632,7 @@ functions first appeared in .Fx 4.1 , and then in .Nx 2.0 . +The +.Fn kqueue1 +function first appeared in +.Nx 6.0 . -- cgit