jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java
changeset 37593 824750ada3d6
parent 33826 a9e5f1b8ea57
child 37781 71ed5645f17c
equal deleted inserted replaced
37592:c80f098887f4 37593:824750ada3d6
    44 import java.security.AccessController;
    44 import java.security.AccessController;
    45 import static java.security.AccessController.doPrivileged;
    45 import static java.security.AccessController.doPrivileged;
    46 import java.security.PrivilegedAction;
    46 import java.security.PrivilegedAction;
    47 import java.security.PrivilegedActionException;
    47 import java.security.PrivilegedActionException;
    48 import java.security.PrivilegedExceptionAction;
    48 import java.security.PrivilegedExceptionAction;
       
    49 import java.util.Properties;
    49 import jdk.internal.misc.JavaIOFileDescriptorAccess;
    50 import jdk.internal.misc.JavaIOFileDescriptorAccess;
    50 import jdk.internal.misc.SharedSecrets;
    51 import jdk.internal.misc.SharedSecrets;
       
    52 import sun.security.action.GetPropertyAction;
    51 
    53 
    52 /**
    54 /**
    53  * java.lang.Process subclass in the UNIX environment.
    55  * java.lang.Process subclass in the UNIX environment.
    54  *
    56  *
    55  * @author Mario Wolczko and Ross Knippel.
    57  * @author Mario Wolczko and Ross Knippel.
   121                     throw new AssertionError("Unsupported platform: " + this);
   123                     throw new AssertionError("Unsupported platform: " + this);
   122             }
   124             }
   123         }
   125         }
   124 
   126 
   125         String helperPath() {
   127         String helperPath() {
   126             return AccessController.doPrivileged(
   128             Properties props = GetPropertyAction.getProperties();
   127                 (PrivilegedAction<String>) () ->
   129             return helperPath(props.getProperty("java.home"),
   128                     helperPath(System.getProperty("java.home"),
   130                               props.getProperty("os.arch"));
   129                                System.getProperty("os.arch"))
       
   130             );
       
   131         }
   131         }
   132 
   132 
   133         LaunchMechanism launchMechanism() {
   133         LaunchMechanism launchMechanism() {
   134             return AccessController.doPrivileged(
   134             return AccessController.doPrivileged(
   135                 (PrivilegedAction<LaunchMechanism>) () -> {
   135                 (PrivilegedAction<LaunchMechanism>) () -> {
   157                 }
   157                 }
   158             );
   158             );
   159         }
   159         }
   160 
   160 
   161         static Platform get() {
   161         static Platform get() {
   162             String osName = AccessController.doPrivileged(
   162             String osName = GetPropertyAction.getProperty("os.name");
   163                 (PrivilegedAction<String>) () -> System.getProperty("os.name")
       
   164             );
       
   165 
   163 
   166             if (osName.equals("Linux")) { return LINUX; }
   164             if (osName.equals("Linux")) { return LINUX; }
   167             if (osName.contains("OS X")) { return BSD; }
   165             if (osName.contains("OS X")) { return BSD; }
   168             if (osName.equals("SunOS")) { return SOLARIS; }
   166             if (osName.equals("SunOS")) { return SOLARIS; }
   169             if (osName.equals("AIX")) { return AIX; }
   167             if (osName.equals("AIX")) { return AIX; }