about summary refs log tree commit diff
path: root/third_party/nix/src/libutil/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libutil/util.cc')
-rw-r--r--third_party/nix/src/libutil/util.cc26
1 files changed, 1 insertions, 25 deletions
diff --git a/third_party/nix/src/libutil/util.cc b/third_party/nix/src/libutil/util.cc
index b77fb8ac0a..6076bdc393 100644
--- a/third_party/nix/src/libutil/util.cc
+++ b/third_party/nix/src/libutil/util.cc
@@ -16,6 +16,7 @@
 #include <grp.h>
 #include <pwd.h>
 #include <sys/ioctl.h>
+#include <sys/prctl.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
@@ -27,14 +28,6 @@
 #include "serialise.hh"
 #include "sync.hh"
 
-#ifdef __APPLE__
-#include <sys/syscall.h>
-#endif
-
-#ifdef __linux__
-#include <sys/prctl.h>
-#endif
-
 namespace nix {
 
 const std::string nativeSystem = SYSTEM;
@@ -819,12 +812,6 @@ int Pid::kill() {
      process group, send the signal to every process in the child
      process group (which hopefully includes *all* its children). */
   if (::kill(separatePG ? -pid : pid, killSignal) != 0) {
-    /* On BSDs, killing a process group will return EPERM if all
-       processes in the group are zombies (or something like
-       that). So try to detect and ignore that situation. */
-#if __FreeBSD__ || __APPLE__
-    if (errno != EPERM || ::kill(pid, 0) != 0)
-#endif
       LOG(ERROR) << SysError("killing process %d", pid).msg();
   }
 
@@ -876,20 +863,9 @@ void killUser(uid_t uid) {
         }
 
         while (true) {
-#ifdef __APPLE__
-          /* OSX's kill syscall takes a third parameter that, among
-             other things, determines if kill(-1, signo) affects the
-             calling process. In the OSX libc, it's set to true,
-             which means "follow POSIX", which we don't want here
-               */
-          if (syscall(SYS_kill, -1, SIGKILL, false) == 0) {
-            break;
-          }
-#else
           if (kill(-1, SIGKILL) == 0) {
             break;
           }
-#endif
           if (errno == ESRCH) {
             break;
           } /* no more processes */