Lock a resource
#include <sys/iofunc.h> int iofunc_lock( resmgr_context_t * ctp, io_lock_t * msg, iofunc_ocb_t * ocb, iofunc_attr_t * attr );
- A pointer to a resmgr_context_t structure that the resource-manager library uses to pass context information between functions.
- A pointer to the io_lock_t structure that contains the message that the resource manager received.
- A pointer to the iofunc_ocb_t structure for the Open Control Block that was created when the client opened the resource.
- A pointer to the iofunc_attr_t structure that describes the characteristics of the device that's associated with your resource manager.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The function iofunc_lock() does what is required for POSIX locks. For more information, see lockf().
- EACCES or EAGAIN
- The operation is F_TLOCK or F_TEST, and the section is already locked by another process.
- The operation is F_LOCK or F_TLOCK, and the file is mapped with mmap().
- The file descripter isn't valid, or the operation is F_LOCK or F_TLOCK, and the file descriptor isn't open for writing.
- The operation is F_LOCK, and a deadlock was detected.
- A signal was caught during execution of the function.
- 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.
- 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.
- 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.
Last modified: 2013-09-30