diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-03-03 22:51:39 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-03-03 23:18:31 +0530 |
commit | 532a60357ef4c5852cc1bf836cfd9d6f093ef204 (patch) | |
tree | aaeea80df876694911a2058beec5a8004acebe78 /nscd/nscd.h | |
parent | d6285c9f0b3972369356554727b1ede5a6eb0731 (diff) | |
download | glibc-532a60357ef4c5852cc1bf836cfd9d6f093ef204.tar.gz glibc-532a60357ef4c5852cc1bf836cfd9d6f093ef204.tar.xz glibc-532a60357ef4c5852cc1bf836cfd9d6f093ef204.zip |
nscd: Improved support for tracking startup failure in nscd service (BZ #16639)
Currently, the nscd parent process parses commandline options and configuration, forks on startup and immediately exits with a success. If the child process encounters some error after this, it goes undetected and any services started up after it may have to repeatedly check to make sure that the nscd service did actually start up and is serving requests. To make this process more reliable, I have added a pipe between the parent and child process, through which the child process sends a notification to the parent informing it of its status. The parent waits for this status and once it receives it, exits with the corresponding exit code. So if the child service sends a success status (0), the parent exits with a success status. Similarly for error conditions, the child sends the non-zero status code, which the parent passes on as the exit code. This, along with setting the nscd service type to forking in its systemd configuration file, allows systemd to be certain that the nscd service is ready and is accepting connections.
Diffstat (limited to 'nscd/nscd.h')
-rw-r--r-- | nscd/nscd.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/nscd/nscd.h b/nscd/nscd.h index 972f4628b9..529b3f5ec0 100644 --- a/nscd/nscd.h +++ b/nscd/nscd.h @@ -205,6 +205,8 @@ extern gid_t old_gid; /* nscd.c */ extern void termination_handler (int signum) __attribute__ ((__noreturn__)); extern int nscd_open_socket (void); +void notify_parent (int child_ret); +void do_exit (int child_ret, int errnum, const char *format, ...); /* connections.c */ extern void nscd_init (void); |