stat_convert_form()

QNX SDP8.0C Library ReferenceAPIDeveloper

Convert a stat structure from one form to another

Synopsis:

#include <sys/stat.h>

int stat_convert_form( int src_form,
                       const void *src_stat,
                       int dst_form,
                       void *dst_stat,
                       unsigned max_dst );

Arguments:

src_form
The form of the source stat structure; one of:
  • _STAT_FORM_UNSET — unknown; this is assumed to be the same as _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.
Note:
The _STAT_FORM_UNSET, _STAT_FORM_T32_2001, and _STAT_FORM_T32_2008 values are legacy values for 32-bit targets and shouldn't be used in this release. Also, _STAT_FORM_SYS_2008 and _STAT_FORM_PREFERRED are always the same as _STAT_FORM_T64_2008 because only 64-bit targets are supported.
src_stat
A pointer to the stat structure that you want to convert.
dst_form
The form of stat structure that you want. This must be one of the _STAT_FORM_* types listed above, except that you can't specify it to be _STAT_FORM_UNSET.
dst_stat
A pointer to a stat structure where the function can store the information.
max_dst
The size of the area that dst_stat points to.

Library:

libc

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

Description:

The stat_convert_form() function converts a given struct stat structure from one form indicated by the src_form argument into another form indicated by the dst_form argument.

Note:
In this release struct stat is always the same as struct __stat_t64_2008 because only 64-bit targets are supported, so it shouldn't be necessary to call this function. Legacy code that uses another form for 32-bit targets (e.g., struct __stat_t32_2008) must be ported to use struct stat.

Returns:

The size of the converted structure, or a negative error code:

-EINVAL
The source or destination form is invalid.
-EOPNOTSUP
The conversion from src_form to dst_form isn't supported.
-EOVERFLOW
The converted structure is larger than max_dst, or the tv_sec member of the st_mtim, st_atim, or st_ctim field is greater than will fit in the 32-bit version of struct timespec.

Classification:

QNX OS

Safety:
Cancellation pointNo
Signal handlerYes
ThreadYes
Page updated: