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_ocb_calloc.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_ocb_calloc.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_ocb_calloc.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_ocb_calloc.html on line 8
Allocate an iofunc Open Control Block
#include <sys/iofunc.h>
iofunc_ocb_t * iofunc_ocb_calloc(
resmgr_context_t * ctp,
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.
- attr
- A pointer to a
iofunc_attr_t
structure that defines the characteristics of the device that the
resource manager handles.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The iofunc_ocb_calloc() function allocates an iofunc OCB.
It has a number of uses:
- It can be used as a helper function to encapsulate
the allocation of the iofunc OCB, so that your routines don't
have to know the details of the iofunc OCB structure.
- Because it's in the resource manager shared library,
you can override this function with your own, allowing
you to manage an OCB that has additional members, perhaps
specific to your particular resource manager.
If you do this, be sure to place the iofunc OCB structure as
the first element of your extended OCB, and also override
the iofunc_ocb_free() function to release memory.
- Another reason to override iofunc_ocb_calloc() might be
to place limits on the number of OCBs that are in
existence at any one time; the current function simply allocates
OCBs until the free store is exhausted.
|
You should fill in the attribute's mount structure (i.e. the attr->mount pointer)
instead of replacing this function.
If you specify iofunc_ocb_calloc() and iofunc_ocb_free() callouts in the attribute's mount structure,
then you should use the callouts instead of calling the standard
iofunc_ocb_calloc() and iofunc_ocb_free() functions. |
A pointer to an
iofunc_ocb_t
OCB structure.
Override iofunc_ocb_calloc()
and iofunc_ocb_free() to manage an extended OCB:
typedef struct
{
iofunc_ocb_t iofuncOCB; /* the OCB used by iofunc_* */
int myFlags;
char moreOfMyStuff;
} MyOCBT;
MyOCBT *iofunc_ocb_calloc (resmgr_context_t *ctp,
iofunc_attr_t *attr)
{
return ((MyOCBT *) calloc (1, sizeof (MyOCBT));
}
void iofunc_ocb_free (MyOCBT *ocb)
{
free (ocb);
}
QNX Neutrino
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
iofunc_ocb_free(),
iofunc_ocb_t
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_ocb_calloc.html on line 190
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_ocb_calloc.html on line 190