Commit Graph

16 Commits

Author SHA1 Message Date
Max Kellermann
c476819cb1 fd_util: add function close_socket()
Wrap close(), use closesocket() on WIN32/WinSock.
2011-09-20 08:38:58 +02:00
Max Kellermann
77a56c7c5a fd_util: check HAVE_INOTIFY_INIT in header
Don't provide the prototype if inotify_init() was not detected.
2011-09-20 08:38:17 +02:00
Max Kellermann
46deb7ca82 fd_util: include check.h, verify config.h was included 2011-09-20 08:38:08 +02:00
Max Kellermann
68c02fc95a fd_util: add function dup_cloexec()
Unfortunately, there's no "optimized" implementation here.  We can't
use Linux's proprietary system call dup3(), because it would require
us to specify the new descriptor.
2010-08-03 18:03:55 +02:00
Max Kellermann
d18c1b1a0a fd_util: add function recvmsg_cloexec() 2010-08-03 17:51:35 +02:00
Max Kellermann
c980fc653d fd_util: add function socketpair_cloexec() 2010-08-03 17:51:35 +02:00
Avuton Olrich
9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann
e0e6813a1d fd_util: removed creat_cloexec()
Add a "mode" argument to open_cloexec() instead.
2009-11-10 16:53:24 +01:00
Max Kellermann
3d2a9d3545 fd_util: added function pipe_cloexec()
Same as pipe_cloexec_nonblock(), but doesn't set non-blocking mode.
2009-11-10 16:53:20 +01:00
Max Kellermann
223b0db5bd fd_util: relicense under BSD 2-clause
We'll copy this code to libmpdclient, and that's easier if its license
is BSD.
2009-11-08 22:15:22 +01:00
Max Kellermann
f66edccffd fd_util: added O_NONBLOCK functions
Changed the wrappers for pipe(), socket(), accept().  On WIN32, this
does not work for pipe().
2009-11-08 22:11:35 +01:00
Max Kellermann
b043ade456 fd_util: fixed typo in API documentation 2009-11-08 22:07:14 +01:00
Max Kellermann
5479ed7cfb fd_util: added API documentation 2009-11-08 21:38:52 +01:00
Max Kellermann
cac63bfd21 fd_util: unexport fd_set_cloexec()
This function is used only internally.
2009-11-08 21:38:38 +01:00
Max Kellermann
1573ea1485 inotify: set close-on-exec flag
Added wrapper for inotify_init1() to fd_util.c.
2009-11-07 19:02:53 +01:00
Max Kellermann
e3af0032b2 set the close-on-exec flag on all file descriptors
Added the "fd_util" library, which attempts to use the new thread-safe
Linux system calls pipe2(), accept4() and the options O_CLOEXEC,
SOCK_CLOEXEC.  Without these, it falls back to FD_CLOEXEC, which is
not thread safe.

This is particularly important for the "pipe" output plugin (and
others, such as JACK/PulseAudio), because we were heavily leaking file
descriptors to child processes.
2009-11-07 18:55:16 +01:00