Commit Graph

19 Commits

Author SHA1 Message Date
Max Kellermann
5b82ffc291 include config.h in all sources
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
2009-11-12 09:17:03 +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
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
Max Kellermann
8ce2ec7aed client, event_pipe: explicitly ignore the write() result
On both locations, the result of write() can be ignored safely.  In
event_pipe_emit_fast(), that can only be "EAGAIN", which means that
the pipe buffer is full - no further notification required.  In
client_init(), that would be a fatal connection error, which would be
caught by the next event.

This patch fixes gcc warnings.
2009-04-01 17:14:25 +02:00
Sean McNamara
94479ca40f event_pipe can only be non-blocking if !WIN32 2009-03-27 18:03:46 +01:00
Avuton Olrich
0aee49bdf8 all: Update copyright header.
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
2009-03-13 11:51:55 -07:00
Max Kellermann
eac2da635d added G_LOG_DOMAIN macros to several libraries
Define the GLib logging domain in the following libraries: conf,
daemon, event_pipe, log.
2009-02-19 09:24:59 +01:00
Max Kellermann
e3c6ad515d event_pipe: remove the GLib source from the main context
Free memory before exiting.
2009-01-10 18:55:36 +01:00
Max Kellermann
21173ea4a9 event_pipe: removed the unused function event_pipe_wait() 2009-01-04 20:32:45 +01:00
Max Kellermann
38bf81285f utils: removed unused functions
Removed all allocation functions, xwrite(), xread(), ARRAY_SIZE().
Those have been superseded by GLib.
2009-01-03 14:53:42 +01:00
Max Kellermann
b42e10b839 event_pipe: use GLib logging 2009-01-03 14:53:39 +01:00
Max Kellermann
d1c4f261c8 event_pipe: use close() instead of xclose()
xclose() aims to be the signal safe version of close(). However during
cleanup, this isn't important.
2009-01-03 14:53:36 +01:00
Max Kellermann
fa9b5fd10b event_pipe: use _pipe() on WIN32
Windows has no pipe(), it only has _pipe() with two additional
parameters.
2009-01-03 13:22:55 +01:00
Max Kellermann
48aace1859 event_pipe: moved variable "main_task" to main.c 2009-01-03 13:19:01 +01:00
Max Kellermann
272ee5f7d2 event_pipe: replaced PIPE_EVENT_SIGNAL with main_notify
There is only one location using PIPE_EVENT_SIGNAL: to synchronize
player_command() with player_command_finished().  Use the "notify"
library instead of the event_pipe here.
2009-01-02 11:20:41 +01:00
Max Kellermann
e93136ef0f event_pipe: added event_pipe_emit_fast()
event_pipe_emit_fast() is aimed for use in signal handlers: it doesn't
lock the mutex, and doesn't log on error.  That makes it potentially
lossy, but for its intended use, that does not matter.
2009-01-01 18:47:25 +01:00
Max Kellermann
b3e2635ac1 event_pipe: added pipe_event enum and callbacks
Make the event_pipe (formerly main_notify) send/receive a set of
events, with a callback for each one.

The default event PIPE_EVENT_SIGNAL does not have a callback.  It
is still there for waking up the main thread, when it is waiting for
the player thread.
2009-01-01 18:22:11 +01:00
Max Kellermann
22bb5a5856 event_pipe: renamed functions from main_notify_* to event_pipe_*
Continuing the previous patch.
2009-01-01 18:12:14 +01:00
Max Kellermann
9f5934d95b main_notify: renamed source to event_pipe.c
We are going to migrate away from the concept of notifying the main
thread.  There should be events sent to it instead.  This patch starts
a series to implement that.
2009-01-01 18:12:00 +01:00