Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/fcntl.2
Show All 22 Lines | |||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" @(#)fcntl.2 8.2 (Berkeley) 1/12/94 | .\" @(#)fcntl.2 8.2 (Berkeley) 1/12/94 | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd Nov 15, 2018 | .Dd August 24, 2019 | ||||
.Dt FCNTL 2 | .Dt FCNTL 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm fcntl | .Nm fcntl | ||||
.Nd file control | .Nd file control | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libc | .Lb libc | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | |||||
.It Dv F_RDAHEAD | .It Dv F_RDAHEAD | ||||
Equivalent to Darwin counterpart which sets read ahead amount of 128KB | Equivalent to Darwin counterpart which sets read ahead amount of 128KB | ||||
when the third argument, | when the third argument, | ||||
.Fa arg | .Fa arg | ||||
is non-zero. | is non-zero. | ||||
A zero value in | A zero value in | ||||
.Fa arg | .Fa arg | ||||
turns off read ahead. | turns off read ahead. | ||||
.It Dv F_ADD_SEALS | |||||
Add seals to the file as described below, if the underlying filesystem supports | |||||
seals. | |||||
.It Dv F_GET_SEALS | |||||
Get seals associated with descriptor | |||||
markj: It looks like they are now associated with the backing file description, rather than the… | |||||
.Fa fd , | |||||
if the underlying filesystem supports seals. | |||||
.El | .El | ||||
.Pp | .Pp | ||||
The flags for the | The flags for the | ||||
.Dv F_GETFL | .Dv F_GETFL | ||||
and | and | ||||
.Dv F_SETFL | .Dv F_SETFL | ||||
flags are as follows: | flags are as follows: | ||||
.Bl -tag -width O_NONBLOCKX | .Bl -tag -width O_NONBLOCKX | ||||
Show All 21 Lines | |||||
.It Dv O_ASYNC | .It Dv O_ASYNC | ||||
Enable the | Enable the | ||||
.Dv SIGIO | .Dv SIGIO | ||||
signal to be sent to the process group | signal to be sent to the process group | ||||
when I/O is possible, e.g., | when I/O is possible, e.g., | ||||
upon availability of data to be read. | upon availability of data to be read. | ||||
.El | .El | ||||
.Pp | .Pp | ||||
The seals that may be applied with | |||||
.Dv F_ADD_SEALS | |||||
are as follows: | |||||
.Bl -tag -width F_SEAL_SHRINK | |||||
.It Dv F_SEAL_SEAL | |||||
Prevent any further seals from being applied to the file. | |||||
.It Dv F_SEAL_SHRINK | |||||
Prevent the file from being shrunk with | |||||
.Xr ftruncate 2 . | |||||
.It Dv F_SEAL_GROW | |||||
Prevent the file from being enlarged with | |||||
.Xr ftruncate 2 . | |||||
.It Dv F_SEAL_WRITE | |||||
Prevent any further | |||||
.Xr write 2 | |||||
calls to the file. | |||||
.El | |||||
.Pp | |||||
Seals are on a per-inode basis and require support by the underlying filesystem. | |||||
If the underlying filesystem does not support seals, | |||||
.Dv F_ADD_SEALS | |||||
and | |||||
.Dv F_GET_SEALS | |||||
will error out with | |||||
.Dv EINVAL . | |||||
.Pp | |||||
Several commands are available for doing advisory file locking; | Several commands are available for doing advisory file locking; | ||||
they all operate on the following structure: | they all operate on the following structure: | ||||
.Bd -literal | .Bd -literal | ||||
struct flock { | struct flock { | ||||
off_t l_start; /* starting offset */ | off_t l_start; /* starting offset */ | ||||
off_t l_len; /* len = 0 means until end of file */ | off_t l_len; /* len = 0 means until end of file */ | ||||
pid_t l_pid; /* lock owner */ | pid_t l_pid; /* lock owner */ | ||||
short l_type; /* lock type: read/write, etc. */ | short l_type; /* lock type: read/write, etc. */ | ||||
▲ Show 20 Lines • Show All 302 Lines • ▼ Show 20 Lines | |||||
is not a valid file descriptor open for writing. | is not a valid file descriptor open for writing. | ||||
.It Bq Er EDEADLK | .It Bq Er EDEADLK | ||||
The argument | The argument | ||||
.Fa cmd | .Fa cmd | ||||
is | is | ||||
.Dv F_SETLKW , | .Dv F_SETLKW , | ||||
and a deadlock condition was detected. | and a deadlock condition was detected. | ||||
.It Bq Er EINTR | .It Bq Er EINTR | ||||
The argument | The argument | ||||
Done Inline Actionsmappings *of* the file ? kib: mappings *of* the file ? | |||||
.Fa cmd | .Fa cmd | ||||
is | is | ||||
.Dv F_SETLKW , | .Dv F_SETLKW , | ||||
and the system call was interrupted by a signal. | and the system call was interrupted by a signal. | ||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||
The | The | ||||
.Fa cmd | .Fa cmd | ||||
argument | argument | ||||
Show All 10 Lines | |||||
is | is | ||||
.Dv F_GETLK , | .Dv F_GETLK , | ||||
.Dv F_SETLK | .Dv F_SETLK | ||||
or | or | ||||
.Dv F_SETLKW | .Dv F_SETLKW | ||||
and the data to which | and the data to which | ||||
.Fa arg | .Fa arg | ||||
points is not valid. | points is not valid. | ||||
.Pp | |||||
The argument | |||||
.Fa cmd | |||||
is | |||||
.Dv F_ADD_SEALS | |||||
or | |||||
.Dv F_GET_SEALS , | |||||
and the underlying filesystem does not support sealing. | |||||
.Pp | .Pp | ||||
The argument | The argument | ||||
.Fa cmd | .Fa cmd | ||||
is invalid. | is invalid. | ||||
.It Bq Er EMFILE | .It Bq Er EMFILE | ||||
The argument | The argument | ||||
.Fa cmd | .Fa cmd | ||||
is | is | ||||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |
It looks like they are now associated with the backing file description, rather than the descriptor.