src/os/linux/vm/os_linux.cpp

changeset 7793
915ca3e9d15e
parent 7633
8461d0b03127
child 7808
9a23a160ca57
     1.1 --- a/src/os/linux/vm/os_linux.cpp	Tue Apr 14 18:11:06 2015 +0300
     1.2 +++ b/src/os/linux/vm/os_linux.cpp	Wed Apr 29 19:37:10 2015 -0400
     1.3 @@ -5929,14 +5929,6 @@
     1.4  
     1.5  extern char** environ;
     1.6  
     1.7 -#ifndef __NR_fork
     1.8 -#define __NR_fork IA32_ONLY(2) IA64_ONLY(not defined) AMD64_ONLY(57)
     1.9 -#endif
    1.10 -
    1.11 -#ifndef __NR_execve
    1.12 -#define __NR_execve IA32_ONLY(11) IA64_ONLY(1033) AMD64_ONLY(59)
    1.13 -#endif
    1.14 -
    1.15  // Run the specified command in a separate process. Return its exit value,
    1.16  // or -1 on failure (e.g. can't fork a new process).
    1.17  // Unlike system(), this function can be called from signal handler. It
    1.18 @@ -5944,13 +5936,7 @@
    1.19  int os::fork_and_exec(char* cmd) {
    1.20    const char * argv[4] = {"sh", "-c", cmd, NULL};
    1.21  
    1.22 -  // fork() in LinuxThreads/NPTL is not async-safe. It needs to run
    1.23 -  // pthread_atfork handlers and reset pthread library. All we need is a
    1.24 -  // separate process to execve. Make a direct syscall to fork process.
    1.25 -  // On IA64 there's no fork syscall, we have to use fork() and hope for
    1.26 -  // the best...
    1.27 -  pid_t pid = NOT_IA64(syscall(__NR_fork);)
    1.28 -              IA64_ONLY(fork();)
    1.29 +  pid_t pid = fork();
    1.30  
    1.31    if (pid < 0) {
    1.32      // fork failed
    1.33 @@ -5959,15 +5945,7 @@
    1.34    } else if (pid == 0) {
    1.35      // child process
    1.36  
    1.37 -    // execve() in LinuxThreads will call pthread_kill_other_threads_np()
    1.38 -    // first to kill every thread on the thread list. Because this list is
    1.39 -    // not reset by fork() (see notes above), execve() will instead kill
    1.40 -    // every thread in the parent process. We know this is the only thread
    1.41 -    // in the new process, so make a system call directly.
    1.42 -    // IA64 should use normal execve() from glibc to match the glibc fork()
    1.43 -    // above.
    1.44 -    NOT_IA64(syscall(__NR_execve, "/bin/sh", argv, environ);)
    1.45 -    IA64_ONLY(execve("/bin/sh", (char* const*)argv, environ);)
    1.46 +    execve("/bin/sh", (char* const*)argv, environ);
    1.47  
    1.48      // execve failed
    1.49      _exit(-1);

mercurial