diff options
author | Alexandre Chartre <Alexandre.Chartre@Sun.COM> | 2009-11-10 14:23:17 -0800 |
---|---|---|
committer | Alexandre Chartre <Alexandre.Chartre@Sun.COM> | 2009-11-10 14:23:17 -0800 |
commit | 6b8303caf3c5c70ae1c1d362bf6de0c55eb622bb (patch) | |
tree | 47baecba3edda5af755ab94f49eeeac0e79b01eb /usr/src | |
parent | 1fed81b7d6398e02041bdbf68362dc5c143bafc9 (diff) | |
download | illumos-gate-6b8303caf3c5c70ae1c1d362bf6de0c55eb622bb.tar.gz |
6892130 ldmad can fail to daemonize
6898423 misc minor errors in ldmad
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/ldmad/ldma.h | 8 | ||||
-rw-r--r-- | usr/src/cmd/ldmad/ldma_device.c | 2 | ||||
-rw-r--r-- | usr/src/cmd/ldmad/ldmad.c | 14 |
3 files changed, 15 insertions, 9 deletions
diff --git a/usr/src/cmd/ldmad/ldma.h b/usr/src/cmd/ldmad/ldma.h index 92abc954ee..0ddf65a5dd 100644 --- a/usr/src/cmd/ldmad/ldma.h +++ b/usr/src/cmd/ldmad/ldma.h @@ -27,14 +27,14 @@ #ifndef _LDMA_H #define _LDMA_H -#ifdef __cplusplus -extern "C" { -#endif - #include <libds.h> #include <sys/sysmacros.h> #include <sys/types.h> +#ifdef __cplusplus +extern "C" { +#endif + /* * The following definitions are part of the LDoms Agent specification. */ diff --git a/usr/src/cmd/ldmad/ldma_device.c b/usr/src/cmd/ldmad/ldma_device.c index 94e4831262..1a73d7743d 100644 --- a/usr/src/cmd/ldmad/ldma_device.c +++ b/usr/src/cmd/ldmad/ldma_device.c @@ -140,7 +140,7 @@ ldma_dev_validate_path(ds_ver_t *ver, ldma_message_header_t *request, reply->msg_info |= LDMA_DEVPATH_EXIST; - LDMA_DBG("VALIDATE_PATH(%s): file mode = 0x%x", path, st.st_mode); + LDMA_DBG("VALIDATE_PATH(%s): file mode = 0x%lx", path, st.st_mode); switch (st.st_mode & S_IFMT) { diff --git a/usr/src/cmd/ldmad/ldmad.c b/usr/src/cmd/ldmad/ldmad.c index 2403cd2cd7..8b5ccf41bf 100644 --- a/usr/src/cmd/ldmad/ldmad.c +++ b/usr/src/cmd/ldmad/ldmad.c @@ -88,7 +88,7 @@ static ldma_agent_info_t *ldma_agent_infos[] = { }; static char *cmdname; -static pid_t daemon_pid; +static pid_t daemon_pid = 0; /* * Allocate a new message with the specified message number (msg_num), @@ -377,8 +377,14 @@ ldma_register_agents() static void ldma_sigusr_handler(int sig, siginfo_t *sinfo, void *ucontext) { - if (daemon_pid <= 0 || sig != SIGUSR1 || sinfo->si_code != SI_USER || - sinfo->si_pid != daemon_pid) + /* + * The child process can send the signal before the fork() + * call has returned in the parent process. So daemon_pid + * may not be set yet, and we don't check the pid in that + * case. + */ + if (sig != SIGUSR1 || sinfo->si_code != SI_USER || + (daemon_pid > 0 && sinfo->si_pid != daemon_pid)) return; /* @@ -499,7 +505,7 @@ ldma_start(boolean_t standalone) */ if (ldma_register_agents() == 0) { /* no agent registered */ - LDMA_ERR("Unable to register any agent", cmdname); + LDMA_ERR("Unable to register any agent"); exit(1); } |