change get_proc_info to report 'No such process'

This commit is contained in:
Doug MacEachern 2004-08-10 22:24:12 +00:00
parent b85eea0ff9
commit 25887e0f4a
2 changed files with 8 additions and 1 deletions

View File

@ -134,4 +134,6 @@ unsigned int sigar_cpu_count(sigar_t *sigar);
int sigar_cpu_info_get(sigar_t *sigar, sigar_cpu_info_t *info); int sigar_cpu_info_get(sigar_t *sigar, sigar_cpu_info_t *info);
#define SIGAR_NO_SUCH_PROCESS (SIGAR_OS_START_ERROR+1)
#endif /* SIGAR_OS_H */ #endif /* SIGAR_OS_H */

View File

@ -223,6 +223,11 @@ int sigar_os_close(sigar_t *sigar)
char *sigar_os_error_string(int err) char *sigar_os_error_string(int err)
{ {
switch (err) {
case SIGAR_NO_SUCH_PROCESS:
return "No such process";
break;
}
return NULL; return NULL;
} }
@ -772,7 +777,7 @@ static int get_proc_info(sigar_t *sigar, sigar_pid_t pid)
return SIGAR_OK; return SIGAR_OK;
} }
return -1; /*XXX*/ return SIGAR_NO_SUCH_PROCESS;
} }
static int sigar_remote_proc_args_get(sigar_t *sigar, sigar_pid_t pid, static int sigar_remote_proc_args_get(sigar_t *sigar, sigar_pid_t pid,