Defines file control options.
The flock structure in the /usr/include/sys/flock.h file, which describes a lock, contains the following fields:
l_type | Describes the type of lock. If the value of the Command parameter to the fcntl subroutine is F_SETLK or F_SETLKW, the l_type field indicates the type of lock to be created. Possible values
are:
If the value of the Command parameter to the fcntl subroutine is F_GETLK, the l_type field describes an existing lock. Possible values are:
|
l_whence | Defines the starting offset. The value of this field indicates the
point from which the relative offset, the l_start field, is measured. Possible values are:
These values are defined in the unistd.h file. |
l_start | Defines the relative offset in bytes, measured from the starting point in the l_whence field. |
l_len | Specifies the number of consecutive bytes to be locked. |
l_sysid | Contains the ID of the node that already has a lock placed on the area defined by the fcntl subroutine. This field is returned only when the value of the Command parameter is F_GETLK. |
l_pid | Contains the ID of a process that already has a lock placed on the area defined by the fcntl subroutine. This field is returned only when the value of the Command parameter is F_GETLK. |
l_vfs | Specifies the file system type of the node identified in the l_sysid field. |
Although the flock structure is used by application programs to make file lock requests, the extended flock structure, struct eflock, is used internally by the kernel. The eflock structure is identical to the flock structure in that it has the same fields. The differences are that the l_len and l_start fields are 64 bit integers.
The flock64 structure in the /usr/include/sys/flock.h file, which describes a lock, contains the following fields:
l_type | Describes the type of lock. If the value of the Command parameter to the fcntl subroutine is F_SETLK or F_SETLKW, the l_type field indicates the type of lock to be created. Possible values
are:
If the value of the Command parameter to the fcntl subroutine is F_GETLK, the l_type field describes an existing lock. Possible values are:
|
l_whence | Defines the starting offset. The value of this field indicates the
point from which the relative offset, the l_start field, is measured. Possible values are:
These values are defined in the unistd.h file. |
l_start | Defines the relative offset in bytes, measured from the starting point in the l_whence field. This field is of the type off64_t. |
l_len | Specifies the number of consecutive bytes to be locked. This field is of the type off64_t. |
l_sysid | Contains the ID of the node that already has a lock placed on the area defined by the fcntl subroutine. This field is returned only when the value of the Command parameter is F_GETLK. |
l_pid | Contains the ID of a process that already has a lock placed on the area defined by the fcntl subroutine. This field is returned only when the value of the Command parameter is F_GETLK. |
l_vfs | Specifies the file system type of the node identified in the l_sysid field. |
The unistd.h file.
The fcntl subroutine, lockfx, lock, or flock subroutine, open,openx, or creat subroutine.
Header Files Overview defines header files, describes how they are used, and lists several of the header files for which information is provided in this documentation.