iofunc_stat(), iofunc_stat_format()

Updated: May 06, 2022

Populate a stat structure

Synopsis:

#include <sys/iofunc.h>

int iofunc_stat( resmgr_context_t* ctp,
                 iofunc_attr_t* attr,
                 struct stat* statp );

int iofunc_stat_format( resmgr_context_t *ctp,
                        iofunc_attr_t *attr,
                        unsigned *formatp,
                        struct stat *statp,
                        unsigned *lenp );

Arguments:

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 the iofunc_attr_t structure that describes the characteristics of the device that's associated with your resource manager.
formatp
(iofunc_stat_format() only) A pointer to the required form of the status information; one of:
  • _STAT_FORM_UNSET — unknown; this is assumed to be the same as _STAT_FORM_T32_2001. The function sets *statp to _STAT_FORM_T32_2001.
  • _STAT_FORM_T32_2001 — 32-bit fields, POSIX 2001
  • _STAT_FORM_T32_2008 — 32-bit fields, POSIX 2008
  • _STAT_FORM_T64_2008 — 64-bit fields, POSIX 2008
  • _STAT_FORM_SYS_2008_STAT_FORM_T32_2008 in programs compiled for a 32-bit architecture, or _STAT_FORM_T64_2008 in programs compiled for a 64-bit architecture.
  • _STAT_FORM_PREFERRED — the preferred form: _STAT_FORM_T32_2001 in programs compiled for a 32-bit architecture, or _STAT_FORM_T64_2008 in programs compiled for a 64-bit architecture.

If the function doesn't recognize the form, it uses _STAT_FORM_T64_2008 and sets *statp to that value.

statp
A pointer to the struct stat structure that you want to fill.
lenp
(iofunc_stat_format() only) NULL, or a pointer to a location where the function can store the length of the status structure.

Library:

libc

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

Description:

The iofunc_stat() and iofunc_stat_format() functions populate the passed statp structure based on information from the passed attr structure and the context pointer, ctp.

These functions are typically used when the resource manager is handling the _IO_STAT message, and needs to format the current status information for the resource.

Returns:

EOK on successful completion, or an errno value if an error occurred.

Classification:

QNX Neutrino

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