group::signal

  • public intkill(pid_t pid,int signo)
  • public pid_twaitpid(pid_t pid,int * stat_loc,int options)
  • public pid_twait(int * stat_loc)
  • public intpthread_kill(pthread_t thread,int signo)
  • public intsigqueue(pid_t pid,int signo,const union sigval value)
  • public intsigwait(const sigset_t * set,int * sig)
  • public intsigtimedwait(const sigset_t * set,siginfo_t * info,const struct timespec * timeout)
  • public intsigwaitinfo(const sigset_t * set,siginfo_t * info)
  • public _sig_func_ptrsignal(int sig,_sig_func_ptr func)
  • public intsigaction(int sig,const struct sigaction * act,struct sigaction * oact)
  • public intpthread_sigmask(int how,const sigset_t * set,sigset_t * oset)
  • public intsigprocmask(int how,const sigset_t * set,sigset_t * oset)
  • public intsigpending(sigset_t * set)
  • public intsigsuspend(const sigset_t * sigmask)

Details

public intkill(pid_t pid,int signo)

This function sends the signal signo to the process pid.

Returns

Zero or -1 with errno (see Errno) set to:

  • EINVAL: signo is not a valid signal number
  • ESRCH: pid is not a valid process id

public pid_twaitpid(pid_t pid,int * stat_loc,int options)


public pid_twait(int * stat_loc)


public intpthread_kill(pthread_t thread,int signo)

This function sends the signal signo to thread. The handler is executed in the context of thread, but the signal effects the entire process. For example,

pthread_kill(8, SIGKILL);

will kill the process that holds thread 8. The exit handler will be executed on thread 8’s stack.

Returns

Zero or -1 with errno (see Errno) set to:

  • EINVAL: signo is not a valid signal number
  • ESRCH: pid is not a valid process id

public intsigqueue(pid_t pid,int signo,const union sigval value)

This function sends the signal signo to the process pid. The signal value is specified by value.

Returns

Zero or -1 with errno (see Errno) set to:

  • EINVAL: signo is not a valid signal number
  • ESRCH: pid is not a valid process id

public intsigwait(const sigset_t * set,int * sig)

This function checks to see if any signals in set are pending. If a signal is pending, it is cleared and the signal number is written to *sig, and the thread is not blocked.

If no signals in set are pending, the thread is blocked until a signal becomes pending.

The signals defined by set should be blocked when this function is called (see pthread_sigmask() and sigprocmask()).

Returns

Zero or -1 with errno (see Errno) set to:

  • EINVAL: set contains an invalid or unsupported signal

public intsigtimedwait(const sigset_t * set,siginfo_t * info,const struct timespec * timeout)

This function checks to see if any signals in the set are pending. If a signal is pending, it is cleared and the signal information is written to info, and the function returns without blocking.

If no signals in set are pending, the task is blocked until a signal becomes pending or until the timeout expires.

Returns

Zero or -1 with errno (see Errno) set to:

  • EINVAL: set contains an invalid or unsupported signal
  • EAGAIN: timeout expired before any signals arrived
  • EINTR: a signal, not in set, was caught

public intsigwaitinfo(const sigset_t * set,siginfo_t * info)

This function checks to see if any signals in set are pending. If a signal is pending, it is cleared and the signal info is written to info, and the function returns without blocking.

If no signals in set are pending, the task is blocked until a signal becomes pending.

Todo: Add error checking

Returns

Zero or -1 with errno (see Errno) set to:

  • EINVAL: set contains an invalid or unsupported signal
  • EINTR: a signal, not in set, was caught

public _sig_func_ptrsignal(int sig,_sig_func_ptr func)

This function sets the handler for sig to func.

Returns

Zero or SIG_ERR with errno (see Errno) set to:

  • EINVAL: sig is not a valid signal or is a signal that cannot be caught.

public intsigaction(int sig,const struct sigaction * act,struct sigaction * oact)

This function sets the action for sig to act. The previous action is written is oact if oact is not NULL. Using this function will override any handler previously set with signal().

Returns

Zero or SIG_ERR with errno (see Errno) set to:

  • EINVAL: sig is not a valid signal or is a signal that cannot be caught.
  • EINTR: a signal, not in set, was caught

public intpthread_sigmask(int how,const sigset_t * set,sigset_t * oset)

This function sets the signal mask for the current thread.

Returns

Zero or SIG_ERR with errno (see Errno) set to:

  • EINVAL: how is not one of SIG_BLOCK, SIG_SETMASK, or SIG_UNBLOCK

public intsigprocmask(int how,const sigset_t * set,sigset_t * oset)

This function sets the signal mask for the current thread. This function should only be called in single threaded applications.

Returns

Zero or SIG_ERR with errno (see Errno) set to:

  • EINVAL: how is not one of SIG_BLOCK, SIG_SETMASK, or SIG_UNBLOCK

public intsigpending(sigset_t * set)

This function writes the calling thread’s current pending set to set. It then waits for a signal to arrive. If the action for the signal is to terminate, then this function never returns. If the action is to execute a signal catching function, the signal catching function is executed and the signal mask for the thread is restored before returning.

Returns

-1 with errno set to EINTR otherwise never returns


public intsigsuspend(const sigset_t * sigmask)


X

Thanks for Coming!

Subscribe to news and updates