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 );
- 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.
 
libc
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.
 
- 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.
 
QNX Neutrino
| Safety: |  | 
| Cancellation point | 
    No | 
| Interrupt handler | 
    No | 
| Signal handler | 
    Yes | 
| Thread | 
    Yes | 
iofunc_lock_calloc(),
iofunc_lock_free(),
lockf()
Writing a Resource Manager
Resource Managers
chapter of Getting Started with QNX Neutrino