iofunc_lock_default()

Обработчик по умолчанию для сообщений _IO_LOCK

Прототип:

#include <sys/iofunc.h>
int iofunc_lock_default( resmgr_context_t *ctp,
io_lock_t *msg,
iofunc_ocb_t *ocb );

Аргументы:

ctp
A pointer to a resmgr_context_t structure that the resource-manager library uses to pass context information between functions.
msg
A pointer to the io_lock_t structure that contains the message that the resource manager received; see iofunc_lock().
ocb
A pointer to the iofunc_ocb_t structure for the Open Control Block that was created when the client opened the resource.

Библиотека:

libc

Описание:

The iofunc_lock_default() function implements POSIX semantics for the _IO_LOCK message (generated as a result of a client fcntl() call).

You can place this function directly into the io_funcs table passed to resmgr_attach(), at the lock position, or you can call iofunc_func_init() to initialize all of the functions to their default values.

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. This function calls iofunc_lock() to do the actual work.


Note: If your resource manager calls iofunc_lock_default(), it must call iofunc_close_dup_default() and iofunc_unblock_default() in their respective handlers.

Возвращаемое значение:

EOK
Успешное завершение.
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.

Классификация:

ЗОСРВ «Нейтрино»

Точка остановки потока
Нет
Обработчик прерываний
Нет
Обработчик сигналов
Да
В потоке
Да

Тематические ссылки:

iofunc_func_init(), iofunc_lock(), iofunc_ocb_t, iofunc_time_update(), resmgr_attach(), resmgr_context_t, resmgr_io_funcs_t




Предыдущий раздел: Описание API системной библиотеки