Rename validps() to pidfile()

This commit is contained in:
sin 2013-08-16 16:40:29 +01:00
parent e33f5bed23
commit 42b640fa21
3 changed files with 7 additions and 7 deletions

2
proc.h
View File

@ -39,4 +39,4 @@ int parsestat(pid_t pid, struct procstat *ps);
int parsestatus(pid_t pid, struct procstatus *pstatus); int parsestatus(pid_t pid, struct procstatus *pstatus);
int proceuid(pid_t pid, uid_t *euid); int proceuid(pid_t pid, uid_t *euid);
int procuid(pid_t pid, uid_t *euid); int procuid(pid_t pid, uid_t *euid);
int validps(const char *path); int pidfile(const char *file);

8
ps.c
View File

@ -13,7 +13,7 @@
static void usage(void); static void usage(void);
static void psout(struct procstat *ps); static void psout(struct procstat *ps);
static void psr(const char *path); static void psr(const char *file);
enum { enum {
PS_aflag = 1 << 0, PS_aflag = 1 << 0,
@ -155,14 +155,14 @@ psout(struct procstat *ps)
} }
static void static void
psr(const char *path) psr(const char *file)
{ {
struct procstat ps; struct procstat ps;
pid_t pid; pid_t pid;
if (!validps(path)) if (!pidfile(file))
return; return;
pid = estrtol(path, 10); pid = estrtol(file, 10);
parsestat(pid, &ps); parsestat(pid, &ps);
psout(&ps); psout(&ps);
} }

View File

@ -95,12 +95,12 @@ parsestatus(pid_t pid, struct procstatus *pstatus)
} }
int int
validps(const char *path) pidfile(const char *file)
{ {
char *end; char *end;
errno = 0; errno = 0;
strtol(path, &end, 10); strtol(file, &end, 10);
if (*end != '\0') if (*end != '\0')
return 0; return 0;
if (errno != 0) if (errno != 0)