dmi_file_stat

Synopsis

#include <opendmi/utils/file.h>

int dmi_file_stat(int fd, dmi_file_stat_t *st);

Description

The dmi_file_stat function is a cross-platform wrapper around fstat(2) that retries automatically if interrupted by a signal (EINTR).

Parameters

fd

Open file descriptor to query.

st

Pointer to a dmi_file_stat_t structure that receives the file status. On POSIX systems this is a typedef for struct stat; on Windows it is struct _stat.

Return value

Returns 0 on success, or -1 on error with errno set accordingly.

A missing argument is not an error of the system: -1 is returned, and errno is left as it was.

Errors

DMI_ERROR_ARGUMENT_NULL

st is nullptr. The error reaches no error queue, since the function takes no context to hold it.