jtux
Class UProcess

java.lang.Object
  extended by jtux.UProcess

public class UProcess
extends java.lang.Object

UProcess-related POSIX/SUS calls.

        Skipped:
                atexit -- C function, inappropriate for Java
                exec functions other than execvp -- "l" functions not possible; environment can be dealt
                  with separately (need funciton to access environ, though)
                _longjmp, _setjmp, longjmp, setjmp, siglongjmp, sigsetjmp -- not appropriate for Java
                signal functions -- because of interference with the JVM's use of signals. Some of the
                  functionality have been made to work, but others wouldn't faithfully implement
                  POSIX/SUS -- it would not be a good learning vehicle.
                ulimit -- messy; use getrlimit and setrlimit instead
                vfork -- obsolete
ToDo:
        waitid
        


Nested Class Summary
static class UProcess.s_rlimit
          Java version of C struct rlimit.
static class UProcess.s_rusage
          Java version of C struct rusage.
static class UProcess.s_sigaction
          Java version of C struct sigaction.
static class UProcess.s_sigevent
          Java version of C struct sigevent.
static class UProcess.s_timespec
          Java version of C struct timespec.
static class UProcess.s_timeval
          Java version of C struct timeval.
static class UProcess.s_tms
          Java version of C struct tms.
static class UProcess.siginfo_t
          Java version of C type (structure) siginfo_t.
static class UProcess.sigset_t
          Java version of C type sigset_t.
static class UProcess.stack_t
          Java version of C type stack_t.
static class UProcess.u_sigval
          Java version of C union sigval.
static class UProcess.u_sigval_int
           
static class UProcess.u_sigval_ptr
           
 
Constructor Summary
UProcess()
           
 
Method Summary
static void _exit(int status)
          Calls _exit.
static void abort()
          Calls abort.
static void chdir(java.lang.String path)
          Calls chdir.
static void chroot(java.lang.String path)
          Calls chroot.
static long clock()
          Calls clock.
static void execvp(java.lang.String file, java.lang.String[] args)
          Calls execvp.
static void exit(int status)
          Calls exit.
static void fchdir(int fd)
          Calls fchdir.
static long fork()
          Calls fork.
static void getcwd(java.lang.StringBuffer path)
          Calls getcwd.
static long getegid()
          Calls getegid.
static java.lang.String getenv(java.lang.String var)
          Calls getenv.
static long geteuid()
          Calls geteuid.
static long getgid()
          Calls getgid.
static long getpgid(long pid)
          Calls getpgid.
static long getpid()
          Calls getpid.
static long getppid()
          Calls getppid.
static void getrlimit(int resource, UProcess.s_rlimit rl)
          Calls getrlimit.
static void getrusage(int who, UProcess.s_rusage r_usage)
          Calls getrusage.
static long getsid(long pid)
          Calls getsid.
static long getuid()
          Calls getuid.
static void kill(long pid, long signum)
          Calls kill.
static void nice(int incr)
          Calls nice.
static void pause()
          Calls pause.
static void pthread_sigmask(int how, UProcess.sigset_t set, UProcess.sigset_t oset)
          Calls pthread_sigmask.
static void putenv(java.lang.String string)
          Calls putenv.
static void setegid(long gid)
          Calls setegid.
static void setenv(java.lang.String var, java.lang.String val, boolean overwrite)
          Calls setenv.
static void seteuid(long uid)
          Calls seteuid.
static void setgid(long gid)
          Calls setgid.
static void setpgid(long pid, long pgid)
          Calls setpgid.
static void setrlimit(int resource, UProcess.s_rlimit rl)
          Calls setrlimit.
static long setsid()
          Calls setsid.
static void setuid(long uid)
          Calls setuid.
static int sig_get_SIGRTMAX()
          Function to get the (dynamic) value of SIGRTMAX.
static int sig_get_SIGRTMIN()
          Function to get the (dynamic) value of SIGRTMIN.
static void sigaction_x(int signum, UProcess.s_sigaction action, UProcess.s_sigaction oaction)
          Used by the Java-level function sigaction.
static void sigaction(int signum, UProcess.s_sigaction action, UProcess.s_sigaction oaction)
          Calls sigaction.
static void sigaddset(UProcess.sigset_t set, int signum)
          Calls sigaddset.
static void sigaltstack(UProcess.stack_t stack, UProcess.stack_t ostack)
          Calls sigaltstack.
static void sigdelset(UProcess.sigset_t set, int signum)
          Calls sigdelset.
static void sigemptyset(UProcess.sigset_t set)
          Calls sigemptyset.
static void sigfillset(UProcess.sigset_t set)
          Calls sigfillset.
static void siginterrupt(int signum, int on)
          Calls siginterrupt.
static boolean sigismember(UProcess.sigset_t set, int signum)
          Calls sigismember.
static void sigpending(UProcess.sigset_t set)
          Calls sigpending.
static void sigprocmask(int how, UProcess.sigset_t set, UProcess.sigset_t oset)
          Calls sigprocmask.
static void sigqueue(long pid, int signum, UProcess.u_sigval value)
          Calls sigqueue.
static void sigsuspend(UProcess.sigset_t set)
          Calls sigsuspend.
static void sigtimedwait(UProcess.sigset_t set, UProcess.siginfo_t info, UProcess.s_timespec ts)
          Calls sigtimedwait.
static void sigwait(UProcess.sigset_t set, UUtil.IntHolder signum)
          Calls sigwait.
static void sigwaitinfo(UProcess.sigset_t set, UProcess.siginfo_t info)
          Calls sigwaitinfo.
static int system(java.lang.String command)
          Calls system.
static long times(UProcess.s_tms buffer)
          Calls times.
static int umask(int cmask)
          Calls umask.
static void unsetenv(java.lang.String var)
          Calls unsetenv.
static long wait(UExitStatus status)
          Calls wait.
static long waitpid(long pid, UExitStatus status, int options)
          Calls waitpid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UProcess

public UProcess()
Method Detail

sigaction

public static void sigaction(int signum,
                             UProcess.s_sigaction action,
                             UProcess.s_sigaction oaction)
                      throws UErrorException
Calls sigaction.

Problem with receiving a signal value (e.g., from mq_notify or sigqueue) is that Jtux doesn't know whether it's an int or a ptr, so it can't construct the appropriate subclass for the Java class u_sigval. On the theory that pointers aren't that useful with Java and that, even when they're used with Jtux, they're passed as longs, the subclass passed in the siginfo_t structure is always a u_signal_int.

Click here for Posix/SUS C API.

Throws:
UErrorException

abort

public static void abort()
Calls abort.

Click here for Posix/SUS C API.


chdir

public static void chdir(java.lang.String path)
                  throws UErrorException
Calls chdir.

Click here for Posix/SUS C API.

Throws:
UErrorException

chroot

public static void chroot(java.lang.String path)
                   throws UErrorException
Calls chroot.

Click here for Posix/SUS C API.

Throws:
UErrorException

clock

public static long clock()
                  throws UErrorException
Calls clock.

Click here for Posix/SUS C API.

Throws:
UErrorException

execvp

public static void execvp(java.lang.String file,
                          java.lang.String[] args)
                   throws UErrorException
Calls execvp. This is the only one of the exec family implemented for Java. The list forms are unimplementatble, although the vector forms are nearly as easy to use: UProcess.execvp("/usr/bin/echo", new String[] {"echo", "arg1", "arg2"});

Click here for Posix/SUS C API.

Throws:
UErrorException

exit

public static void exit(int status)
Calls exit.

Click here for Posix/SUS C API.


_exit

public static void _exit(int status)
Calls _exit.

Click here for Posix/SUS C API.


fchdir

public static void fchdir(int fd)
                   throws UErrorException
Calls fchdir.

Click here for Posix/SUS C API.

Throws:
UErrorException

fork

public static long fork()
                 throws UErrorException
Calls fork.

Click here for Posix/SUS C API.

Throws:
UErrorException

getcwd

public static void getcwd(java.lang.StringBuffer path)
                   throws UErrorException
Calls getcwd.

Click here for Posix/SUS C API.

Throws:
UErrorException

getegid

public static long getegid()
Calls getegid.

Click here for Posix/SUS C API.


getenv

public static java.lang.String getenv(java.lang.String var)
Calls getenv.

Click here for Posix/SUS C API.


geteuid

public static long geteuid()
Calls geteuid.

Click here for Posix/SUS C API.


getgid

public static long getgid()
Calls getgid.

Click here for Posix/SUS C API.


getpgid

public static long getpgid(long pid)
                    throws UErrorException
Calls getpgid.

Click here for Posix/SUS C API.

Throws:
UErrorException

getpid

public static long getpid()
Calls getpid.

Click here for Posix/SUS C API.


getppid

public static long getppid()
Calls getppid.

Click here for Posix/SUS C API.


getrlimit

public static void getrlimit(int resource,
                             UProcess.s_rlimit rl)
                      throws UErrorException
Calls getrlimit.

Click here for Posix/SUS C API.

Throws:
UErrorException

getrusage

public static void getrusage(int who,
                             UProcess.s_rusage r_usage)
Calls getrusage.

Click here for Posix/SUS C API.


getsid

public static long getsid(long pid)
                   throws UErrorException
Calls getsid.

Click here for Posix/SUS C API.

Throws:
UErrorException

getuid

public static long getuid()
Calls getuid.

Click here for Posix/SUS C API.


kill

public static void kill(long pid,
                        long signum)
Calls kill.

Click here for Posix/SUS C API.


nice

public static void nice(int incr)
Calls nice.

Click here for Posix/SUS C API.


pause

public static void pause()
                  throws UErrorException
Calls pause.

Click here for Posix/SUS C API.

Throws:
UErrorException

pthread_sigmask

public static void pthread_sigmask(int how,
                                   UProcess.sigset_t set,
                                   UProcess.sigset_t oset)
Calls pthread_sigmask.

Click here for Posix/SUS C API.


putenv

public static void putenv(java.lang.String string)
                   throws UErrorException
Calls putenv.

Click here for Posix/SUS C API.

Throws:
UErrorException

setenv

public static void setenv(java.lang.String var,
                          java.lang.String val,
                          boolean overwrite)
                   throws UErrorException
Calls setenv. May not be on all systems. Throws ENOSYS if not.

Click here for Posix/SUS C API.

Throws:
UErrorException

setegid

public static void setegid(long gid)
                    throws UErrorException
Calls setegid.

Click here for Posix/SUS C API.

Throws:
UErrorException

seteuid

public static void seteuid(long uid)
                    throws UErrorException
Calls seteuid.

Click here for Posix/SUS C API.

Throws:
UErrorException

setgid

public static void setgid(long gid)
                   throws UErrorException
Calls setgid.

Click here for Posix/SUS C API.

Throws:
UErrorException

setpgid

public static void setpgid(long pid,
                           long pgid)
                    throws UErrorException
Calls setpgid.

Click here for Posix/SUS C API.

Throws:
UErrorException

setrlimit

public static void setrlimit(int resource,
                             UProcess.s_rlimit rl)
                      throws UErrorException
Calls setrlimit.

Click here for Posix/SUS C API.

Throws:
UErrorException

setsid

public static long setsid()
                   throws UErrorException
Calls setsid.

Click here for Posix/SUS C API.

Throws:
UErrorException

setuid

public static void setuid(long uid)
                   throws UErrorException
Calls setuid.

Click here for Posix/SUS C API.

Throws:
UErrorException

sig_get_SIGRTMIN

public static int sig_get_SIGRTMIN()
                            throws UErrorException
Function to get the (dynamic) value of SIGRTMIN.

sig_get_SIGRTMIN and sig_get_SIGRTMAX are not fields of UConstant because SIGRTMIN and SIGRTMAX are not necessarily integer constants.

Throws:
UErrorException

sig_get_SIGRTMAX

public static int sig_get_SIGRTMAX()
                            throws UErrorException
Function to get the (dynamic) value of SIGRTMAX.

sig_get_SIGRTMIN and sig_get_SIGRTMAX are not fields of UConstant because SIGRTMIN and SIGRTMAX are not necessarily integer constants.

Throws:
UErrorException

sigaction_x

public static void sigaction_x(int signum,
                               UProcess.s_sigaction action,
                               UProcess.s_sigaction oaction)
                        throws UErrorException
Used by the Java-level function sigaction.

Throws:
UErrorException

sigaddset

public static void sigaddset(UProcess.sigset_t set,
                             int signum)
                      throws UErrorException
Calls sigaddset.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigaltstack

public static void sigaltstack(UProcess.stack_t stack,
                               UProcess.stack_t ostack)
                        throws UErrorException
Calls sigaltstack.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigdelset

public static void sigdelset(UProcess.sigset_t set,
                             int signum)
                      throws UErrorException
Calls sigdelset.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigemptyset

public static void sigemptyset(UProcess.sigset_t set)
                        throws UErrorException
Calls sigemptyset.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigfillset

public static void sigfillset(UProcess.sigset_t set)
                       throws UErrorException
Calls sigfillset.

Click here for Posix/SUS C API.

Throws:
UErrorException

siginterrupt

public static void siginterrupt(int signum,
                                int on)
                         throws UErrorException
Calls siginterrupt.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigismember

public static boolean sigismember(UProcess.sigset_t set,
                                  int signum)
                           throws UErrorException
Calls sigismember.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigpending

public static void sigpending(UProcess.sigset_t set)
                       throws UErrorException
Calls sigpending.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigprocmask

public static void sigprocmask(int how,
                               UProcess.sigset_t set,
                               UProcess.sigset_t oset)
                        throws UErrorException
Calls sigprocmask.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigqueue

public static void sigqueue(long pid,
                            int signum,
                            UProcess.u_sigval value)
                     throws UErrorException
Calls sigqueue.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigsuspend

public static void sigsuspend(UProcess.sigset_t set)
                       throws UErrorException
Calls sigsuspend.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigtimedwait

public static void sigtimedwait(UProcess.sigset_t set,
                                UProcess.siginfo_t info,
                                UProcess.s_timespec ts)
                         throws UErrorException
Calls sigtimedwait.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigwait

public static void sigwait(UProcess.sigset_t set,
                           UUtil.IntHolder signum)
                    throws UErrorException
Calls sigwait.

Click here for Posix/SUS C API.

Throws:
UErrorException

sigwaitinfo

public static void sigwaitinfo(UProcess.sigset_t set,
                               UProcess.siginfo_t info)
                        throws UErrorException
Calls sigwaitinfo.

Click here for Posix/SUS C API.

Throws:
UErrorException

system

public static int system(java.lang.String command)
                  throws UErrorException
Calls system.

Click here for Posix/SUS C API.

Throws:
UErrorException

times

public static long times(UProcess.s_tms buffer)
                  throws UErrorException
Calls times.

Click here for Posix/SUS C API.

Throws:
UErrorException

umask

public static int umask(int cmask)
Calls umask.

Click here for Posix/SUS C API.


unsetenv

public static void unsetenv(java.lang.String var)
                     throws UErrorException
Calls unsetenv.

May not be on all systems. Throws ENOSYS if not. Click here for Posix/SUS C API.

Throws:
UErrorException

wait

public static long wait(UExitStatus status)
                 throws UErrorException
Calls wait.

Click here for Posix/SUS C API.

Throws:
UErrorException

waitpid

public static long waitpid(long pid,
                           UExitStatus status,
                           int options)
                    throws UErrorException
Calls waitpid.

On Linux, waiting for an exited process doesn't work. If System.exit (the Java method) is called, waitpid stays blocked, as though the process doesn't really exit. If UProcess.exit is called, something inside the system waits, and waitpid returns an error because the process doesn't exist. This is probably due to the way threads are implemented. On Solaris, all works as it should.

Click here for Posix/SUS C API.

Throws:
UErrorException