[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4 Files Reference

flock.h File

Purpose

Defines file control options.

Description

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:
F_RDLCK A read lock is requested.
F_WRLCK A write lock is requested.
F_UNLCK Unlock. An existing lock is to be removed.

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:

F_RDLCK A conflicting read lock exists.
F_WRLCK A conflicting write lock exists.
F_UNLCK No conflicting lock exists.
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:
SEEK_SET The relative offset is measured from the start of the file.
SEEK_CUR The relative offset is measured from the current position.
SEEK_END The relative offset is measured from the end of the file.

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 (AIX versions 4.2 and later) 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:
F_RDLCK A read lock is requested.
F_WRLCK A write lock is requested.
F_UNLCK Unlock. An existing lock is to be removed.

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:

F_RDLCK A conflicting read lock exists.
F_WRLCK A conflicting write lock exists.
F_UNLCK No conflicting lock exists.
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:
SEEK_SET The relative offset is measured from the start of the file.
SEEK_CUR The relative offset is measured from the current position.
SEEK_END The relative offset is measured from the end of the file.

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.

Implementation Specifics

This file is part of Base Operating System (BOS) Runtime.

Related Information

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.


[ Previous | Next | Contents | Glossary | Home | Search ]