Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
c5ce5f3c
Commit
c5ce5f3c
authored
Nov 03, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new setSigHandlersForDecoder() function, and be sure player/decode processes ignore SIGHUP signals
git-svn-id:
https://svn.musicpd.org/mpd/trunk@2492
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
118acc58
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
13 deletions
+19
-13
TODO
TODO
+0
-4
player.c
src/player.c
+1
-9
sig_handlers.c
src/sig_handlers.c
+16
-0
sig_handlers.h
src/sig_handlers.h
+2
-0
No files found.
TODO
View file @
c5ce5f3c
...
...
@@ -11,10 +11,6 @@
*) command for displaying playlist contents
*) command for appending to playlist
*) use getaddrinfo instead of gethostbyname (check libshout)
*) have children ignore SIGHUP
*) put more debugging info when failing to read/write db and other similar
errors
...
...
src/player.c
View file @
c5ce5f3c
...
...
@@ -105,20 +105,12 @@ int playerInit() {
player_pid
=
fork
();
if
(
player_pid
==
0
)
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
struct
sigaction
sa
;
clearUpdatePid
();
unblockSignals
();
sa
.
sa_flags
=
0
;
sigemptyset
(
&
sa
.
sa_mask
);
finishSigHandlers
();
sa
.
sa_handler
=
decodeSigHandler
;
while
(
sigaction
(
SIGCHLD
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
while
(
sigaction
(
SIGTERM
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
while
(
sigaction
(
SIGINT
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
setSigHandlersForDecoder
();
while
(
close
(
listenSocket
)
<
0
&&
errno
==
EINTR
);
freeAllInterfaces
();
...
...
src/sig_handlers.c
View file @
c5ce5f3c
...
...
@@ -25,6 +25,7 @@
#include "signal_check.h"
#include "log.h"
#include "player.h"
#include "decode.h"
#include <signal.h>
#include <sys/types.h>
...
...
@@ -89,6 +90,21 @@ void finishSigHandlers() {
signal_unhandle
(
SIGHUP
);
}
void
setSigHandlersForDecoder
()
{
struct
sigaction
sa
;
finishSigHandlers
();
sa
.
sa_flags
=
0
;
sigemptyset
(
&
sa
.
sa_mask
);
sa
.
sa_handler
=
SIG_IGN
;
while
(
sigaction
(
SIGHUP
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
sa
.
sa_handler
=
decodeSigHandler
;
while
(
sigaction
(
SIGCHLD
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
while
(
sigaction
(
SIGTERM
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
while
(
sigaction
(
SIGINT
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
}
void
ignoreSignals
()
{
struct
sigaction
sa
;
...
...
src/sig_handlers.h
View file @
c5ce5f3c
...
...
@@ -27,6 +27,8 @@ void initSigHandlers();
void
finishSigHandlers
();
void
setSigHandlersForDecoder
();
void
ignoreSignals
();
void
blockSignals
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment