MPD  0.20.18
Functions
fd_util.h File Reference
#include "check.h"
#include <stdbool.h>
#include <stddef.h>
#include <sys/types.h>
Include dependency graph for fd_util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int fd_set_cloexec (int fd, bool enable)
 
int open_cloexec (const char *path_fs, int flags, int mode)
 Wrapper for open(), which sets the CLOEXEC flag (atomically if supported by the OS). More...
 
int pipe_cloexec_nonblock (int fd[2])
 Wrapper for pipe(), which sets the CLOEXEC flag (atomically if supported by the OS). More...
 
int socket_cloexec_nonblock (int domain, int type, int protocol)
 Wrapper for socket(), which sets the CLOEXEC and the NONBLOCK flag (atomically if supported by the OS). More...
 
int accept_cloexec_nonblock (int fd, struct sockaddr *address, size_t *address_length_r)
 Wrapper for accept(), which sets the CLOEXEC and the NONBLOCK flags (atomically if supported by the OS). More...
 
int close_socket (int fd)
 Portable wrapper for close(); use closesocket() on WIN32/WinSock. More...
 

Function Documentation

◆ accept_cloexec_nonblock()

int accept_cloexec_nonblock ( int  fd,
struct sockaddr *  address,
size_t *  address_length_r 
)

Wrapper for accept(), which sets the CLOEXEC and the NONBLOCK flags (atomically if supported by the OS).

◆ close_socket()

int close_socket ( int  fd)

Portable wrapper for close(); use closesocket() on WIN32/WinSock.

◆ fd_set_cloexec()

int fd_set_cloexec ( int  fd,
bool  enable 
)

◆ open_cloexec()

int open_cloexec ( const char *  path_fs,
int  flags,
int  mode 
)

Wrapper for open(), which sets the CLOEXEC flag (atomically if supported by the OS).

◆ pipe_cloexec_nonblock()

int pipe_cloexec_nonblock ( int  fd[2])

Wrapper for pipe(), which sets the CLOEXEC flag (atomically if supported by the OS).

On systems that supports it (everybody except for Windows), it also sets the NONBLOCK flag.

◆ socket_cloexec_nonblock()

int socket_cloexec_nonblock ( int  domain,
int  type,
int  protocol 
)

Wrapper for socket(), which sets the CLOEXEC and the NONBLOCK flag (atomically if supported by the OS).