Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/lib/ape/man/0/fcntl.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "<fcntl.h>" 0P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" <fcntl.h> 
.SH NAME
fcntl.h \- file control options
.SH SYNOPSIS
.LP
\fB#include <fcntl.h>\fP
.SH DESCRIPTION
.LP
The \fI<fcntl.h>\fP header shall define the following requests and
arguments for use by the functions \fIfcntl\fP() and \fIopen\fP().
.LP
Values for \fIcmd\fP used by \fIfcntl\fP() (the following values are
unique) are as
follows:
.TP 7
F_DUPFD
Duplicate file descriptor.
.TP 7
F_GETFD
Get file descriptor flags.
.TP 7
F_SETFD
Set file descriptor flags.
.TP 7
F_GETFL
Get file status flags and file access modes.
.TP 7
F_SETFL
Set file status flags.
.TP 7
F_GETLK
Get record locking information.
.TP 7
F_SETLK
Set record locking information.
.TP 7
F_SETLKW
Set record locking information; wait if blocked.
.TP 7
F_GETOWN
Get process or process group ID to receive SIGURG signals.
.TP 7
F_SETOWN
Set process or process group ID to receive SIGURG signals.
.sp
.LP
File descriptor flags used for \fIfcntl\fP() are as follows:
.TP 7
FD_CLOEXEC
Close the file descriptor upon execution of an \fIexec\fP family function.
.sp
.LP
Values for \fIl_type\fP used for record locking with \fIfcntl\fP()
(the following values
are unique) are as follows:
.TP 7
F_RDLCK
Shared or read lock.
.TP 7
F_UNLCK
Unlock.
.TP 7
F_WRLCK
Exclusive or write lock.
.sp
.LP
The values used for \fIl_whence\fP, SEEK_SET, SEEK_CUR, and SEEK_END
shall be defined as described in \fI<unistd.h>\fP . 
.LP
The following values are file creation flags and are used in the \fIoflag\fP
value to \fIopen\fP(). They shall be bitwise-distinct.
.TP 7
O_CREAT
Create file if it does not exist.
.TP 7
O_EXCL
Exclusive use flag.
.TP 7
O_NOCTTY
Do not assign controlling terminal.
.TP 7
O_TRUNC
Truncate flag.
.sp
.LP
File status flags used for \fIopen\fP() and \fIfcntl\fP() are as follows:
.TP 7
O_APPEND
Set append mode.
.TP 7
O_DSYNC
Write according to synchronized I/O data integrity completion. 
.TP 7
O_NONBLOCK
Non-blocking mode.
.TP 7
O_RSYNC
Synchronized read I/O operations. 
.TP 7
O_SYNC
Write according to synchronized I/O file integrity completion.
.sp
.LP
Mask for use with file access modes is as follows:
.TP 7
O_ACCMODE
Mask for file access modes.
.sp
.LP
File access modes used for \fIopen\fP() and \fIfcntl\fP() are as follows:
.TP 7
O_RDONLY
Open for reading only.
.TP 7
O_RDWR
Open for reading and writing.
.TP 7
O_WRONLY
Open for writing only.
.sp
.LP
The symbolic names for file modes for use as values of \fBmode_t\fP
shall be defined as described in \fI<sys/stat.h>\fP . 
.LP
Values for \fIadvice\fP used by \fIposix_fadvise\fP() are as follows:
.TP 7
POSIX_FADV_NORMAL
.sp
The application has no advice to give on its behavior with respect
to the specified data. It is the default characteristic if no
advice is given for an open file.
.TP 7
POSIX_FADV_SEQUENTIAL
.sp
The application expects to access the specified data sequentially
from lower offsets to higher offsets.
.TP 7
POSIX_FADV_RANDOM
.sp
The application expects to access the specified data in a random order.
.TP 7
POSIX_FADV_WILLNEED
.sp
The application expects to access the specified data in the near future.
.TP 7
POSIX_FADV_DONTNEED
.sp
The application expects that it will not access the specified data
in the near future.
.TP 7
POSIX_FADV_NOREUSE
.sp
The application expects to access the specified data once and then
not reuse it thereafter.
.sp
.LP
The structure \fBflock\fP describes a file lock. It shall include
the following members:
.sp
.RS
.nf

\fBshort  l_type  \fP Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. \fB
short  l_whence\fP Flag for starting offset. \fB
off_t  l_start \fP Relative offset in bytes. \fB
off_t  l_len   \fP Size; if 0 then until EOF. \fB
pid_t  l_pid   \fP Process ID of the process holding the lock; returned with F_GETLK. \fB
\fP
.fi
.RE
.LP
The \fBmode_t\fP, \fBoff_t\fP, and \fBpid_t\fP types shall be defined
as described in \fI<sys/types.h>\fP .
.LP
The following shall be declared as functions and may also be defined
as macros. Function prototypes shall be provided.
.sp
.RS
.nf

\fBint  creat(const char *, mode_t);
int  fcntl(int, int, ...);
int  open(const char *, int, ...);

int  posix_fadvise(int, off_t, size_t, int);
int  posix_fallocate(int, off_t, size_t);

\fP
.fi
.RE
.LP
Inclusion of the \fI<fcntl.h>\fP header may also make visible all
symbols from \fI<sys/stat.h>\fP and \fI<unistd.h>\fP.
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fI<sys/stat.h>\fP, \fI<sys/types.h>\fP, \fI<unistd.h>\fP, the
System Interfaces volume of IEEE\ Std\ 1003.1-2001, \fIcreat\fP(),
\fIexec\fP, \fIfcntl\fP(), \fIopen\fP(), \fIposix_fadvise\fP(), \fIposix_fallocate\fP(),
\fIposix_madvise\fP()
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.