[Previous] [Contents] [Next]

iofunc_lock_default()

Default handler for _IO_LOCK messages

Synopsis:

#include <sys/iofunc.h>

int iofunc_lock_default( resmgr_context_t * ctp,
                         io_lock_t * msg,
                         iofunc_ocb_t * ocb );

Library:

libc

Description:

The iofunc_lock_default() function implements POSIX semantics for the _IO_LOCK message (generated as a result of a client fcntl() call). This function can be placed directly into the io_funcs table passed to resmgr_attach(), at the lock position.

The iofunc_lock_default() function verifies that the client has the necessary permissions to effect a lock on the resource. This includes checking for read and write permissions against the type of lock being effected. If so, the lock is performed, modifying elements of the ocb->attr structure, and updating ocb->attr->locklist to reflect the new lock.

If your resource manager calls iofunc_lock_default() then iofunc_close_dup_default() and iofunc_unblock_default() must be called in both of their respective handlers.

Returns:

EOK
Successful completion.
EINVAL
An invalid range was specified for the lock operation, or an invalid lock operation was attempted.
EBADF
An attempt to perform a read lock on a write-only resource, or a write lock on a read-only resource was attempted.
ENOMEM
Insufficient memory exists to allocate an internal lock structure.

Classification:

QNX 6

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

iofunc_chmod_default(), iofunc_chown_default(), iofunc_close_dup_default(), iofunc_close_ocb_default(), iofunc_devctl_default(), iofunc_lseek_default(), iofunc_mmap_default(), iofunc_open_default(), iofunc_pathconf_default(), iofunc_stat_default(), iofunc_time_update(), iofunc_unblock_default(), iofunc_utime_default(), resmgr_attach()


[Previous] [Contents] [Next]