Package one.nio.os

Class Proc


  • public final class Proc
    extends Object
    • Constructor Detail

      • Proc

        public Proc()
    • 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/ directory
        nstype - 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