Graphviz 13.0.0~dev.20241220.2304
|
wrapper around fopen
for internal library usage
More...
#include <stdio.h>
Go to the source code of this file.
Macros | |
#define | UTIL_API /* nothing */ |
Functions | |
UTIL_API FILE * | gv_fopen (const char *filename, const char *mode) |
#define UTIL_API /* nothing */ |
hide the symbols this header declares by default
The expectation is that users of this header (applications, shared libraries, or static libraries) want to call gv_fopen
but not re-export it to their users. This annotation is only correct while the containing library is built statically. If it were built as a shared library, gv_fopen
would need to have default
visibility (and thus be unavoidably re-exported) in order to be callable.
Definition at line 18 of file gv_fopen.h.
UTIL_API FILE * gv_fopen | ( | const char * | filename, |
const char * | mode | ||
) |
open a file, setting close-on-exec
Generally, library code should set close-on-exec (O_CLOEXEC
) on file descriptors it creates to avoid child processes of concurrent fork
+exec
operations accidentally inheriting copies of the descriptors. It is tricky to achieve this without races. This function attempts to avoid the common problems when trying to do this with fopen
.
filename | A filename, as you would pass to fopen |
mode | A mode, as you would pass to fopen |
NULL
on failure Definition at line 32 of file gv_fopen.c.
References err, flags, fopen_(), NULL, and streq().
Referenced by cat_libfile(), gvconfig(), gvdevice_initialize(), gvevent_read(), gvNextInputGraph(), gvusershape_file_access(), nextFile(), and user_init().