explain_filename(3)

explain_filename3

Obtain filename from file descriptor

Usage

#include <libexplain/filename.h>

int explain_filename_from_fildes(int fildes, char *data, size_t data_size);

int explain_filename_from_stream(FILE *stream, char *data, size_t data_size);

Overview

The explain_filename_from_fildes function may be used to obtain the name of the file associated with the file descriptor.

The explain_filename_from_stream function may be used to obtain the name of the file associated with a file stream.

The filename is returned in the array pointed to by data. The filename will always be NUL terminated. If the returned filename is longer than data_size, it will be silently truncated; a size of at least (PATH_MAX + 1) is suggested.

On success, returns zero. If the file name cannot be determined, returns -1 (but does not set errno.)

Releases

Unchanged in 5 releases since Debian 9 (Stretch).

  1. 9–13

Author

Written by Peter Miller <[email protected]>

From libexplain-dev 1.4.D001-16 in Debian 13 (Trixie). Parsed by carta from the page's man source.