Package one.nio.os
Class Proc
- java.lang.Object
-
- one.nio.os.Proc
-
public final class Proc extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static intCLONE_NEWCGROUPstatic intCLONE_NEWIPCstatic intCLONE_NEWNETstatic intCLONE_NEWPIDstatic intCLONE_NEWUSERstatic intCLONE_NEWUTSstatic intIOPRIO_CLASS_BEstatic intIOPRIO_CLASS_IDLEstatic intIOPRIO_CLASS_RTstatic booleanIS_SUPPORTEDstatic intSCHED_BATCHstatic intSCHED_IDLEstatic intSCHED_OTHER
-
Constructor Summary
Constructors Constructor Description Proc()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long[]getAffinity(int pid)static intgetpid()static intgetppid()static intgetpriority(int pid)Obtain the nice value of a processstatic intgettid()static intioprio_get(int pid)static intioprio_set(int pid, int ioprio)static longsched_getaffinity(int pid)static intsched_getscheduler(int pid)static intsched_setaffinity(int pid, long mask)static intsched_setscheduler(int pid, int policy)static intsetAffinity(int pid, long[] mask)The same as above, but allows an arbitrary long maskstatic voidsetDedicatedCpu(int pid, int cpu)static intsetns(int fd, int nstype)static intsetpriority(int pid, int value)Set the nice value of a process to value+ {NZERO}.
-
-
-
Field Detail
-
IS_SUPPORTED
public static final boolean IS_SUPPORTED
-
IOPRIO_CLASS_RT
public static final int IOPRIO_CLASS_RT
- See Also:
- Constant Field Values
-
IOPRIO_CLASS_BE
public static final int IOPRIO_CLASS_BE
- See Also:
- Constant Field Values
-
IOPRIO_CLASS_IDLE
public static final int IOPRIO_CLASS_IDLE
- See Also:
- Constant Field Values
-
SCHED_OTHER
public static final int SCHED_OTHER
- See Also:
- Constant Field Values
-
SCHED_BATCH
public static final int SCHED_BATCH
- See Also:
- Constant Field Values
-
SCHED_IDLE
public static final int SCHED_IDLE
- See Also:
- Constant Field Values
-
CLONE_NEWCGROUP
public static final int CLONE_NEWCGROUP
- See Also:
- Constant Field Values
-
CLONE_NEWUTS
public static final int CLONE_NEWUTS
- See Also:
- Constant Field Values
-
CLONE_NEWIPC
public static final int CLONE_NEWIPC
- See Also:
- Constant Field Values
-
CLONE_NEWUSER
public static final int CLONE_NEWUSER
- See Also:
- Constant Field Values
-
CLONE_NEWPID
public static final int CLONE_NEWPID
- See Also:
- Constant Field Values
-
CLONE_NEWNET
public static final int CLONE_NEWNET
- See Also:
- Constant Field Values
-
-
Method Detail
-
gettid
public static int gettid()
-
getpid
public static int getpid()
-
getppid
public static int getppid()
-
sched_setaffinity
public static int sched_setaffinity(int pid, long mask)
-
sched_getaffinity
public static long sched_getaffinity(int pid)
-
setAffinity
public static int setAffinity(int pid, long[] mask)The same as above, but allows an arbitrary long mask
-
getAffinity
public static long[] getAffinity(int pid)
-
setDedicatedCpu
public static void setDedicatedCpu(int pid, int cpu)
-
ioprio_set
public static int ioprio_set(int pid, int ioprio)
-
ioprio_get
public static int ioprio_get(int pid)
-
sched_setscheduler
public static int sched_setscheduler(int pid, int policy)- Parameters:
pid- pid or tid. 0 for current thread- Returns:
- 0 on success or errno on failure
-
sched_getscheduler
public static int sched_getscheduler(int pid)
- Parameters:
pid- pid or tid. 0 for current thread- Returns:
- the policy for the thread (a nonnegative integer)
-
getpriority
public static int getpriority(int pid)
Obtain the nice value of a process- Parameters:
pid- pid or tid. 0 for current thread- Returns:
- an integer in the range -{NZERO} to {NZERO}-1. Otherwise, -1 shall be returned and errno set to indicate the error.
-
setpriority
public static int setpriority(int pid, int value)Set the nice value of a process to value+ {NZERO}. The default nice value is {NZERO}; lower nice values shall cause more favorable scheduling. While the range of valid nice values is [0,{NZERO}*2-1], implementations may enforce more restrictive limits. If value+ {NZERO} is less than the system's lowest supported nice value, setpriority() shall set the nice value to the lowest supported value; if value+ {NZERO} is greater than the system's highest supported nice value, setpriority() shall set the nice value to the highest supported value.- Parameters:
pid- pid or tid. 0 for current thread- Returns:
- 0 on success; otherwise, -1 shall be returned and errno set to indicate the error.
-
setns
public static int setns(int fd, int nstype)- Parameters:
fd- is a file descriptor referring to one of the namespace entries in a /proc/[pid]/ns/ directorynstype- specifies which type of namespace the calling thread may be reassociated with. One of CLONE_* constants or 0 to allow any type of namespace to be joined- Returns:
- 0 on success or errno on failure
-
-