Release Open Control Block resources
#include <sys/iofunc.h> int iofunc_ocb_detach( resmgr_context_t * ctp, iofunc_ocb_t * ocb );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The iofunc_ocb_detach() function releases any resources allocated to the passed ocb, such as any memory map (mmap) entries.
This function doesn't free the memory associated with the OCB itself. |
The iofunc_ocb_detach() function also updates the time structure, by calling iofunc_time_update(), and decrements the read, write, lock, and use counters, according to the mode that was used to open the resource (from ocb->ioflag).
The counters are incremented in iofunc_ocb_attach(), and represent the number of OCBs that are using the managed resource in the respective manners (e.g.: ocb->attr->rcount keeps count of how many OCBs are using the resource specified by attr for read access).
If you're are using iofunc_mmap() or iofunc_mmap_default(), you must call iofunc_ocb_detach() to clean up. This function is called by iofunc_close_ocb().
A bitwise OR of flags describing the state of the managed resource:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
iofunc_close_ocb(), iofunc_close_ocb_default(), iofunc_mmap(), iofunc_mmap_default(), iofunc_ocb_attach(), iofunc_ocb_t, iofunc_time_update(), resmgr_context_t