ILOCK(3)
HP-UX
NAME
ilock, iunlock − will lock/unlock the driver specified
SYNOPSIS
#include <sicl.h>
int ilock(INST id);
int iunlock(INST id);
DESCRIPTION
ilock locks a device or interface and prevents others from accessing it. This is useful in a multiprocess environment where many people may be simultaneously trying to access a device. The device specified by id must refer to either an interface or a device. If id refers to an interface, then the entire interface is locked and no one other than the caller may access any device on the interface. If id refers to a device, then only that device is locked and no one other than the caller may access that device, however other devices may be accessed.
iunlock unlocks a device or interface previously locked by Ilock.
Locks are implemented as per-process. Any session in a given process may lock or unlock a given driver. When a session locks a driver, any session in the current process that specifies the given driver may still access the driver. However, other processes will be unable to access the driver.
Locks can be nested and a lock count for each driver is maintained. The lock count starts at (0) and is incremented by a call to ilock and decremented by a call to iunlock.
RETURN VALUE
ilock, iunlock return (0) if successful, or a non-zero error code if an error was encountered.
ERRORS
ilock fails under the following circumstances, and sets the return value to one of the following:
[I_ERR_LOCKED] Locked by another user
[I_ERR_NORSRC] Out of system resources
[I_ERR_NOINTF] Interface is not active
[I_ERR_NODEV] Device is not active
The iunlock fails under the following circumstances, and sets the return value to one of the following:
[I_ERR_NOLOCK] An iunlock was specified when device wasn’t locked
[I_ERR_BADID] The INST id is invalid
SEE ALSO
igeterrno(3), igeterrstr(3), isetlock(3)
AUTHOR
ilock, iunlock were developed by HP.
Hewlett-Packard Company — May 05, 1994