Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does linux allow any system call to be made from signal handlers?

Tags:

People also ask

What system call is used to send a signal Linux?

The kill(pid,sig) system call is commonly used to send signals; its corresponding service routine is the sys_kill( ) function. The integer pid parameter has several meanings, depending on its numerical value: pid > 0. The sig signal is sent to the process whose PID is equal to pid.

What are signal handlers in Linux?

Signal Handlers. A signal handler is special function (defined in the software program code and registered with the kernel) that gets executed when a particular signal arrives. This causes the interruption of current executing process and all the current registers are also saved.

How does Linux implement system calls?

On Linux, the arguments are passed using ebx , ecx , edx , esi , and edi . On Windows, the arguments are copied from the stack. The handler then performs some sort of lookup (to find the address of the function) and executes the system call. After the system call is completed, the iret instruction returns to user-mode.

Which of the following functions can be safely called from within the signal handler?

An async-signal-safe function is one that can be safely called from within a signal handler. Many functions are not async- signal-safe.


My understanding is that, in general, the behavior is undefined if you call a non-async signal safe function from a signal handler, but I've heard that linux allows you to call any system call safely. Is this true? Also, the only portable behavior for a SIGSEGV handler is to abort or exit, but I understand linux will actually resume execution if you return, true?