$NetBSD: patch-ad,v 1.6 2001/04/24 16:59:35 jlam Exp $ --- src/killall.c.orig Sat Mar 31 05:26:47 2001 +++ src/killall.c @@ -18,10 +18,10 @@ #include #include "comm.h" +#include "procfs.h" #include "signals.h" -#define PROC_BASE "/proc" #define MAX_NAMES (sizeof(unsigned long)*8) @@ -138,11 +138,15 @@ } for (i = 0; i < pids; i++) { - sprintf (path, PROC_BASE "/%d/stat", pid_table[i]); + sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], STATUS_FILE); if (!(file = fopen (path, "r"))) continue; empty = 0; +#ifdef BSD_44_PROCFS + okay = fscanf (file, "%s", comm) == 1; +#else okay = fscanf (file, "%*d (%[^)]", comm) == 1; +#endif (void) fclose (file); if (!okay) continue; @@ -151,7 +155,10 @@ length = strlen (comm); if (length == COMM_LEN - 1) { - sprintf (path, PROC_BASE "/%d/cmdline", pid_table[i]); +#if defined(BSD_44_PROCFS) && !defined(BSD_PROCFS_CMDLINE) + okay = 0; +#else + sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], CMDLINE_FILE); if (!(file = fopen (path, "r"))) continue; while (1) { @@ -180,6 +187,7 @@ } } (void) fclose(file); +#endif if (exact && !okay) { if (verbose) @@ -206,7 +214,7 @@ } else { - sprintf (path, PROC_BASE "/%d/exe", pid_table[i]); + sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], EXE_FILE); if (stat (path, &st) < 0) continue; if (sts[j].st_dev != st.st_dev || sts[j].st_ino != st.st_ino) @@ -369,7 +377,7 @@ sig_num = SIGTERM; opterr = 0; - while ( (optc = getopt_long_only(argc,argv,"egilqs:vwV",options,NULL)) != EOF) { + while ( (optc = getopt_long(argc,argv,"egilqs:vwV",options,NULL)) != EOF) { switch (optc) { case 'e': exact = 1;