Package one.nio.os
Class Proc
java.lang.Object
one.nio.os.Proc
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final booleanstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 Details
-
IS_SUPPORTED
public static final boolean IS_SUPPORTED -
IOPRIO_CLASS_RT
public static final int IOPRIO_CLASS_RT- See Also:
-
IOPRIO_CLASS_BE
public static final int IOPRIO_CLASS_BE- See Also:
-
IOPRIO_CLASS_IDLE
public static final int IOPRIO_CLASS_IDLE- See Also:
-
SCHED_OTHER
public static final int SCHED_OTHER- See Also:
-
SCHED_BATCH
public static final int SCHED_BATCH- See Also:
-
SCHED_IDLE
public static final int SCHED_IDLE- See Also:
-
CLONE_NEWCGROUP
public static final int CLONE_NEWCGROUP- See Also:
-
CLONE_NEWUTS
public static final int CLONE_NEWUTS- See Also:
-
CLONE_NEWIPC
public static final int CLONE_NEWIPC- See Also:
-
CLONE_NEWUSER
public static final int CLONE_NEWUSER- See Also:
-
CLONE_NEWPID
public static final int CLONE_NEWPID- See Also:
-
CLONE_NEWNET
public static final int CLONE_NEWNET- See Also:
-
-
Constructor Details
-
Proc
public Proc()
-
-
Method Details
-
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
-