solaris who porting

This commit is contained in:
Doug MacEachern 2005-02-22 02:05:26 +00:00
parent 8131492067
commit 0b5e171b14
1 changed files with 16 additions and 4 deletions

View File

@ -715,14 +715,26 @@ SIGAR_DECLARE(int) sigar_who_list_get(sigar_t *sigar,
return SIGAR_ENOTIMPL; return SIGAR_ENOTIMPL;
} }
#else #else
#include <utmp.h>
#ifdef __sun
# include <utmpx.h>
# define SIGAR_UTMP_FILE _UTMPX_FILE
# define ut_time ut_tv.tv_sec
#else
# include <utmp.h>
# define SIGAR_UTMP_FILE UTMP_FILE
#endif
int sigar_who_list_get(sigar_t *sigar, int sigar_who_list_get(sigar_t *sigar,
sigar_who_list_t *wholist) sigar_who_list_t *wholist)
{ {
FILE *fp; FILE *fp;
#ifdef __sun
struct utmpx ut;
#else
struct utmp ut; struct utmp ut;
#endif
if (!(fp = fopen(UTMP_FILE, "r"))) { if (!(fp = fopen(SIGAR_UTMP_FILE, "r"))) {
return errno; return errno;
} }
@ -735,7 +747,7 @@ int sigar_who_list_get(sigar_t *sigar,
continue; continue;
} }
#ifdef __linux__ #if defined(__linux__) || defined(__sun)
if (ut.ut_type != USER_PROCESS) { if (ut.ut_type != USER_PROCESS) {
continue; continue;
} }