Skip to content

Instantly share code, notes, and snippets.

@tuxillo
Created November 14, 2014 21:38
Show Gist options
  • Save tuxillo/bdf0842d6e2be33948ad to your computer and use it in GitHub Desktop.
Save tuxillo/bdf0842d6e2be33948ad to your computer and use it in GitHub Desktop.
diff --git a/usr.bin/pkill/pkill.c b/usr.bin/pkill/pkill.c
index d102fab..a185db3 100644
--- a/usr.bin/pkill/pkill.c
+++ b/usr.bin/pkill/pkill.c
@@ -68,8 +68,10 @@
#define MAX_PID PID_MAX
/* Ignore system-processes (if '-S' flag is not specified) and myself. */
-#define PSKIP(kp) ((kp)->kp_pid == mypid || \
- (!kthreads && ((kp)->kp_flags & P_KTHREADP) != 0))
+#define IS_KTHREAD(kp) ((kp)->kp_pid <= 0 || ((kp)->kp_flags & P_SYSTEM) != 0)
+#define PSKIP(kp) ((kp)->kp_pid == mypid || \
+ (!kthreads && (IS_KTHREAD(kp)))) || \
+ ((!pgrep && kthreads) && IS_KTHREAD(kp))
enum listtype {
LT_GENERIC,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment