stat_convert_form()
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.
- 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 into another form. The forms depend on the architecture (32- or 64-bit) and on the version of POSIX (2001 or 2008). The POSIX 2008 forms include st_mtim, st_atim, and st_ctim fields, of type struct timespec, that support nanosecond-resolution timestamps.
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:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | Yes |
| Signal handler | Yes |
| Thread | Yes |
Page updated:
