From 063d879294ad977c03bbd8633d595c36f0438482 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sat, 18 Dec 2004 01:20:19 +0000 Subject: [PATCH] only map ENOENT to ESRCH for /proc open errors --- src/os/solaris/solaris_sigar.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/os/solaris/solaris_sigar.c b/src/os/solaris/solaris_sigar.c index 7ae30eb8..d6e0de74 100644 --- a/src/os/solaris/solaris_sigar.c +++ b/src/os/solaris/solaris_sigar.c @@ -18,6 +18,8 @@ sigar->ks.dev.name = #dev; \ sigar->ks.dev.nlen = strlen(#dev) +#define PROC_ERRNO ((errno == ENOENT) ? ESRCH : errno) + int sigar_os_open(sigar_t **sig) { kstat_ctl_t *kc; @@ -697,7 +699,7 @@ int sigar_proc_args_get(sigar_t *sigar, sigar_pid_t pid, (void)SIGAR_PROC_FILENAME(buffer, pid, "/as"); if ((fd = open(buffer, O_RDONLY)) < 0) { - return ESRCH; + return PROC_ERRNO; } if (argv_size > sizeof(argvb)) { @@ -759,7 +761,7 @@ int sigar_proc_env_get(sigar_t *sigar, sigar_pid_t pid, (void)SIGAR_PROC_FILENAME(buffer, pid, "/as"); if ((fd = open(buffer, O_RDONLY)) < 0) { - return ESRCH; + return PROC_ERRNO; } if ((nread = pread(fd, offsets, sizeof(offsets),