Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

15.1.65. kill()

Prototype

int kill(int pid, int sig)

Commonly Called By

newlib C library

Thread-safe

Yes.

Available from ISR

Yes.

Include

<signal.h>

Description

The kill() function is used by newlib to send signals to processes. The input argument pid is the ID of the process to signal, and sig is the signal to send. As there is only a single process in the HAL, the only valid values for pid are either the current process ID, as returned by getpid(), or the broadcast values, that is, pid must be less than or equal to zero.

The following signals result in an immediate shutdown of the system, without call to exit(): SIGABRT, SIGALRM, SIGFPE, SIGILL, SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGTERM, SIGUSR1, SIGUSR2, SIGBUS, SIGPOLL, SIGPROF, SIGSYS, SIGTRAP, SIGVTALRM, SIGXCPU, and SIGXFSZ.

The following signals are ignored: SIGCHLD and SIGURG.

All the remaining signals are treated as errors.

Return

The return value is zero on success, or –1 otherwise. If the call fails, errno is set to indicate the cause of the error.