diff --git a/bin/pkill/pkill.c b/bin/pkill/pkill.c --- a/bin/pkill/pkill.c +++ b/bin/pkill/pkill.c @@ -66,8 +66,7 @@ #define STATUS_BADUSAGE 2 #define STATUS_ERROR 3 -#define MIN_PID 5 -#define MAX_PID 99999 +#define PID_MIN 5 /* Ignore system-processes (if '-S' flag is not specified) and myself. */ #define PSKIP(kp) ((kp)->ki_pid == mypid || \ @@ -868,7 +867,7 @@ rval = strtol(line, &endp, 10); if (*endp != '\0' && !isspace((unsigned char)*endp)) errx(STATUS_ERROR, "Invalid pid in file `%s'", pidfile); - else if (rval < MIN_PID || rval > MAX_PID) + else if (rval < PID_MIN || rval > PID_MAX) errx(STATUS_ERROR, "Invalid pid in file `%s'", pidfile); return (rval); } diff --git a/bin/ps/ps.c b/bin/ps/ps.c --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -1469,7 +1469,7 @@ intsize = sizeof(pid_max); if (sysctlbyname("kern.pid_max", &pid_max, &intsize, NULL, 0) < 0) { xo_warn("unable to read kern.pid_max"); - pid_max = 99999; + pid_max = PID_MAX; } } diff --git a/sys/sys/proc.h b/sys/sys/proc.h --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -910,6 +910,8 @@ #define P_MAGIC 0xbeefface +#define PID_MAX 99999 + #ifdef _KERNEL /* Types and flags for mi_switch(9). */ @@ -954,8 +956,7 @@ * We use process IDs <= pid_max <= PID_MAX; PID_MAX + 1 must also fit * in a pid_t, as it is used to represent "no process group". */ -#define PID_MAX 99999 -#define NO_PID 100000 +#define NO_PID (PID_MAX + 1) #define THREAD0_TID NO_PID extern pid_t pid_max;