Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Reason why SIGHUP is 
used to reload files. 
Masato Bito
What is a signal? 
system call 
kill(2), signal(2) 
kill(2): send a signal 
signal(2): register a signal handler
How it works 
kernel 
kill(2) 
process 
execute 
signal handler 
signal(2) 
register 
signal handler
Signals 
SIGTERM: Termination 
kill command without any option 
SIGINT: Interrupt 
terminal device sends when get ctrl+C 
...
Session(UNIX system) 
Group of process groups 
might have one terminal device 
setsid(2)
Session 
session 
process group 
login shell 
process group 
process group 
back.sh & 
find -name ‘*.pyc’ 
xargs rm 
rm a....
SIGHUP 
Hung Up 
Terminal device sends on hunting up 
All process groups in a session
How to be a daemon 
fork(2): background 
setsid(2): no terminal device 
chdir(“/“): for unmount problem 
close stdin, stdo...
SIGHUP for daemons 
have no terminal device 
terminal device sends SIGHUP 
daemons never get SIGHUP
Conclusion 
Why is SIGHUP used to reload files? 
The answer is SIGHUP is not used. 
an undocumented rule
additional topics 
nohup command 
terminal multiplexer(screen, tmux)
Upcoming SlideShare
Loading in …5
×

Sighup

1,109 views

Published on

MTS vol.3

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Sighup

  1. 1. Reason why SIGHUP is used to reload files. Masato Bito
  2. 2. What is a signal? system call kill(2), signal(2) kill(2): send a signal signal(2): register a signal handler
  3. 3. How it works kernel kill(2) process execute signal handler signal(2) register signal handler
  4. 4. Signals SIGTERM: Termination kill command without any option SIGINT: Interrupt terminal device sends when get ctrl+C SIGKILL: Kill kill -KILL, can’t change a signal handler SIGHUP: Hung up terminal device sends
  5. 5. Session(UNIX system) Group of process groups might have one terminal device setsid(2)
  6. 6. Session session process group login shell process group process group back.sh & find -name ‘*.pyc’ xargs rm rm a.pyc b.pyc find -name ‘*.pyc’|xargs rm setpgid(2) setpgid(2) terminal device (tty, pty) key input keyboard key input SIGINT SIGHUP
  7. 7. SIGHUP Hung Up Terminal device sends on hunting up All process groups in a session
  8. 8. How to be a daemon fork(2): background setsid(2): no terminal device chdir(“/“): for unmount problem close stdin, stdout stderr
  9. 9. SIGHUP for daemons have no terminal device terminal device sends SIGHUP daemons never get SIGHUP
  10. 10. Conclusion Why is SIGHUP used to reload files? The answer is SIGHUP is not used. an undocumented rule
  11. 11. additional topics nohup command terminal multiplexer(screen, tmux)

×