VLC 4.0.0-dev
Loading...
Searching...
No Matches
Collaboration diagram for File descriptors:

Functions

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

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  oldfd)

Duplicates a file descriptor.

Parameters
oldfdfile descriptor to duplicate
Note
Contrary to standard dup(), the new file descriptor has the close-on-exec descriptor flag preset.
Returns
a new file descriptor, -1 (see errno)

References likely.

Referenced by vlc_memfd().

◆ vlc_dup2()

int vlc_dup2 ( int  oldfd,
int  newfd 
)

Replaces a file descriptor.

This function duplicates a file descriptor to a specified file descriptor. This is primarily used to atomically replace a described file.

Parameters
oldfdsource file descriptor to copy
newfddestination file descriptor to replace
Note
Contrary to standard dup2(), the new file descriptor has the close-on-exec descriptor flag preset.
Return values
newfdsuccess
-1failure (see errno)

References 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 vlc_dup(), and vlc_mkstemp().

Referenced by picture_Allocate().

◆ vlc_mkstemp()

int vlc_mkstemp ( char *  template)

References ARRAY_SIZE, vlc_open(), and vlc_rand_bytes().

Referenced by GetTmpFile(), and 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 ToLocaleDup, and widen_path().

Referenced by config_SaveConfigFile(), vlc_fopen(), vlc_frame_FilePath(), vlc_mkstemp(), vlc_rand_init(), and vlc_spawn_inner().

◆ vlc_openat()

int vlc_openat ( int  dir,
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.

◆ vlc_pipe()

int vlc_pipe ( int  fds[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  fd,
const void *  buf,
size_t  len 
)

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  fd,
const struct iovec *  iov,
int  count 
)

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, and writev().

Referenced by vlc_write(), and vlc_writev_i11e().