more /proc checks

This commit is contained in:
Doug MacEachern 2005-02-13 05:55:27 +00:00
parent 2d375e1f3f
commit 6d6ebf238c
1 changed files with 6 additions and 5 deletions

View File

@ -73,6 +73,10 @@
#ifndef DARWIN #ifndef DARWIN
#define PROCFS_STATUS(status) \
((((status) != SIGAR_OK) && !sigar->proc_mounted) ? \
SIGAR_EPROC_NOENT : status)
static int get_koffsets(sigar_t *sigar) static int get_koffsets(sigar_t *sigar)
{ {
int i; int i;
@ -642,7 +646,7 @@ int sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,
int status = SIGAR_PROC_FILE2STR(buffer, pid, "/status"); int status = SIGAR_PROC_FILE2STR(buffer, pid, "/status");
if (status != SIGAR_OK) { if (status != SIGAR_OK) {
return status; return PROCFS_STATUS(status);
} }
ptr = sigar_skip_multiple_token(ptr, 7); ptr = sigar_skip_multiple_token(ptr, 7);
@ -699,10 +703,7 @@ int sigar_proc_args_get(sigar_t *sigar, sigar_pid_t pid,
#ifdef DARWIN #ifdef DARWIN
return SIGAR_ENOTIMPL; return SIGAR_ENOTIMPL;
#else #else
if (!sigar->proc_mounted) { return PROCFS_STATUS(sigar_procfs_args_get(sigar, pid, procargs));
return SIGAR_EPROC_NOENT;
}
return sigar_procfs_args_get(sigar, pid, procargs);
#endif #endif
} }