VLC  3.0.15
Functions
File descriptors
Collaboration diagram for File descriptors:

Functions

int vlc_open (const char *filename, int flags,...)
 Opens a system file handle. More...
 
int vlc_openat (int fd, const char *filename, int flags,...)
 Opens a system file handle relative to an existing directory handle. More...
 
int vlc_mkstemp (char *)
 
int vlc_dup (int)
 Duplicates a file descriptor. More...
 
int vlc_pipe (int[2])
 Creates a pipe (see "man pipe" for further reference). More...
 
int vlc_memfd (void)
 Creates an anonymous regular file descriptor, i.e. More...
 
ssize_t vlc_write (int, const void *, size_t)
 Writes data to a file descriptor. More...
 
ssize_t vlc_writev (int, const struct iovec *, int)
 Writes data from an iovec structure to a file descriptor. More...
 
int vlc_close (int fd)
 Closes a file descriptor. More...
 

Detailed Description

Function Documentation

◆ vlc_close()

int vlc_close ( int  fd)

Closes a file descriptor.

This closes a file descriptor. If this is a last file descriptor for the underlying open file, the file is closed too; the exact semantics depend on the type of file.

Note
The file descriptor is always closed when the function returns, even if the function returns an error. The sole exception is if the file descriptor was not currently valid, and thus cannot be closed (errno will then be set to EBADF).
Parameters
fdfile descriptor
Returns
Normally, zero is returned. If an I/O error is detected before or while closing, the function may return -1. Such an error is unrecoverable since the descriptor is closed.

A nul return value does not necessarily imply that all pending I/O succeeded, since I/O might still occur asynchronously afterwards.

◆ vlc_dup()

int vlc_dup ( int  )

Duplicates a file descriptor.

The new file descriptor has the close-on-exec descriptor flag preset.

Returns
a new file descriptor, -1 (see errno)

References likely, and vlc_cloexec().

◆ vlc_memfd()

int vlc_memfd ( void  )

Creates an anonymous regular file descriptor, i.e.

a descriptor for a temporary file.

The file is initially empty. The storage space is automatically reclaimed when all file descriptors referencing it are closed.

The new file descriptor has the close-on-exec flag preset.

Returns
a file descriptor on success, -1 on error (see errno)

References O_TMPFILE, vlc_mkstemp(), and vlc_open().

◆ vlc_mkstemp()

int vlc_mkstemp ( char *  )

References vlc_cloexec().

Referenced by vlc_memfd().

◆ vlc_open()

int vlc_open ( const char *  filename,
int  flags,
  ... 
)

Opens a system file handle.

Parameters
filenamefile path to open (with UTF-8 encoding)
flagsopen() flags, see the C library open() documentation
Returns
a file handle on success, -1 on error (see errno).
Note
Contrary to standard open(), this function returns a file handle with the close-on-exec flag preset.

References O_TMPFILE, ToLocaleDup, vlc_cloexec(), and widen_path().

Referenced by block_FilePath(), config_SaveConfigFile(), vlc_fopen(), vlc_memfd(), and vlc_rand_init().

◆ vlc_openat()

int vlc_openat ( int  fd,
const char *  filename,
int  flags,
  ... 
)

Opens a system file handle relative to an existing directory handle.

Parameters
dirdirectory file descriptor
filenamefile path to open (with UTF-8 encoding)
flagsopen() flags, see the C library open() documentation
Returns
a file handle on success, -1 on error (see errno).
Note
Contrary to standard open(), this function returns a file handle with the close-on-exec flag preset.

References O_TMPFILE, and VLC_UNUSED.

◆ vlc_pipe()

int vlc_pipe ( int  [2])

Creates a pipe (see "man pipe" for further reference).

The new file descriptors have the close-on-exec flag preset.

Returns
0 on success, -1 on error (see errno)

References vlc_cloexec(), and vlc_socketpair().

Referenced by vlc_getProxyUrl(), and vlc_poll_i11e_inner().

◆ vlc_write()

ssize_t vlc_write ( int  ,
const void *  ,
size_t   
)

Writes data to a file descriptor.

Unlike write(), if EPIPE error occurs, this function does not generate a SIGPIPE signal.

Note
If the file descriptor is known to be neither a pipe/FIFO nor a connection-oriented socket, the normal write() should be used.

References vlc_writev().

◆ vlc_writev()

ssize_t vlc_writev ( int  ,
const struct iovec *  ,
int   
)

Writes data from an iovec structure to a file descriptor.

Unlike writev(), if EPIPE error occurs, this function does not generate a SIGPIPE signal.

References count.

Referenced by vlc_write().