Open for shared access a file associated with a given descriptor
#include <unistd.h>
int sopenfd( int fd,
int oflag,
int sflag );
libc
The sopenfd() function opens for shared access the file associated with the file descriptor, fd. The access mode, oflag, must be equal to or more restrictive than the access mode of the source fd.
The oflag argument specifies how the file is to be opened, and is a combination of the following bits:
The sflag argument specifies how the file is to be shared, and is a combination of the following bits:
Note that:
openfd( fd, oflag );
is the same as:
sopenfd( fd, oflag, SH_DENYNO );
The file descriptor, or -1 if an error occurs (errno is set).
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |