explain_open_or_die(3)

explain_open_or_die3

Open file and report errors

Usage

#include <fcntl.h>
#include <libexplain/open.h>

int explain_open_or_die(const char *pathname, int flags, int mode);

Overview

Given a pathname for a file, open() returns a file descriptor, a small, non‐negative integer for use in subsequent system calls (read(2), write(2), lseek(2), fcntl(2), etc.). The file descriptor returned by a successful call will be the lowest‐numbered file descriptor not currently open for the process. See open(2) for more information.

Return value

On success, the new file descriptor is returned.

On error, a description of the error is obtained via explain_open(3), and printed on stderr. The process is the terminated via a call to the exit(EXIT_FAILURE) function.

Releases

6 releases since Debian 7 (Wheezy); the text changed 1 time.

  1. 7
  2. 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.