Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_lock.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_lock.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_lock.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_lock.html on line 8

iofunc_lock()

Lock a resource

Synopsis:

#include <sys/iofunc.h>

int iofunc_lock( resmgr_context_t * ctp,
                 io_lock_t * msg,
                 iofunc_ocb_t * ocb,
                 iofunc_attr_t * attr );

Arguments:

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.
ocb
A pointer to the iofunc_ocb_t structure for the Open Control Block that was created when the client opened the resource.
attr
A pointer to the iofunc_attr_t structure that describes the characteristics of the device that's associated with your resource manager.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The function iofunc_lock() does what is required for POSIX locks. For more information, see lockf().

Returns:

EACCES or EAGAIN
The operation is F_TLOCK or F_TEST, and the section is already locked by another process.
EAGAIN
The operation is F_LOCK or F_TLOCK, and the file is mapped with mmap().
EBADF
The file descripter isn't valid, or the operation is F_LOCK or F_TLOCK, and the file descriptor isn't open for writing.
EDEADLK
The operation is F_LOCK, and a deadlock was detected.
EINTR
A signal was caught during execution of the function.
EINVAL
The operation isn't one of F_LOCK, F_TLOCK, F_TEST, or F_ULOCK, or the size plus the current file offset is less than 0.
ENOMEM
The system can't allocate sufficient memory to store lock resources.
EOPNOTSUPP or EINVAL
The implementation doesn't support the locking of files of the type indicated by the file descriptor.
EOVERFLOW
The offset of the first, or if the size isn't 0 then the last, byte in the requested section can't be represented correctly in an object of type off_t.

Classification:

QNX Neutrino

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

See also:

iofunc_lock_calloc(), iofunc_lock_free(), lockf()

Writing a Resource Manager

Resource Managers chapter of Getting Started with QNX Neutrino


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_lock.html on line 192

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_lock.html on line 192