12.07.2015 Views

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

FSETOWN(9) <strong>NetBSD</strong> <strong>Kernel</strong> Developer’s <strong>Manual</strong> FSETOWN(9)<strong>NAME</strong>fsetown, fgetown, fownsignal —file descriptor owner handling functionsSYNOPSIS#include intfsetown(struct lwp ∗l , pid_t ∗pgid , int cmd , const void ∗data);intfgetown(struct lwp ∗l , pid_t pgid , int cmd , void ∗data);voidfownsignal(pid_t pgid , int signo , int code , int band , void ∗fdescdata);DESCRIPTIONThese functions handle file descriptor owner related ioctls and related signal delivery. Device drivers andother parts of the kernel call these functions from ioctl entry functions or I/O notification functions.fsetown() sets the owner of file. cmd is an ioctl command, one of SIOCSPGRP, FIOSETOWN, andTIOCSPGRP. data is interpreted as a pointer to a signed integer, the integer being the ID of the owner.The cmd determines how exactly data should be interpreted. If cmd is TIOCSPGRP, the ID needs to bepositive and is interpreted as process group ID. For SIOCSPGRP and FIOSETOWN, the passed ID is theprocess ID if positive, orthe process group ID if negative.fgetown() returns the current owner of the file. cmd is an ioctl command, one of SIOCGPGRP,FIOGETOWN, and TIOCGPGRP. data is interpreted as a pointer to a signed integer, and the value is setaccording to the passed cmd. For TIOCGPGRP, the returned data value is positive process group ID if theowner is the process group, or negative process ID if the owner is a process. For other ioctls, the returnedvalue is the positive process ID if the owner is a process, or the negative process group ID if the owner is aprocess group.fownsignal() schedules the signo signal to be sent to the current file descriptor owner. The signals typicallyused with this function are SIGIO and SIGURG. The code and band arguments are sent along withthe signal as additional signal specific information if SA_SIGINFO is activated. If the information is notavailable from the context of the fownsignal() call, these should be passed as zero. fdescdata is usedto lookup the file descriptor for signals. If it is specified, the file descriptor number is sent along with the signalas additional signal specific information. If file descriptor data pointer is not available in the context ofthe fownsignal() call, NULL should be used instead.Note that a fcntl(2) F_SETOWN request is translated by the kernel to a FIOSETOWN ioctl, andF_GETOWN is translated to FIOGETOWN. This is done transparently by generic code, before the device- orsubsystem-specific ioctl entry function is called.SEE ALSOfcntl(2), siginfo(2), signal(7), ioctl(9), signal(9)HISTORYThese kernel functions appeared in <strong>NetBSD</strong> 2.0.<strong>NetBSD</strong> 3.0 December 20, 2005 1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!