File: qa-siguser

package info (click to toggle)
newlisp 10.7.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 6,248 kB
  • sloc: ansic: 33,280; lisp: 4,181; sh: 609; makefile: 215
file content (35 lines) | stat: -rwxr-xr-x 489 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env newlisp

;; numbers and names may be different on
;; your platform look int:
;; /usr/include/sys/signal.h or
;; /usr/include/signal.h

(define SIGUSR1 30)
(define SIGUSR2 31)

(define (myhandler s)
	(println "signal " s " was fired")
)

; setup the handler
(signal SIGUSR1 myhandler)
(signal SIGUSR2 myhandler)

(set 'mypid (sys-info -3))

(dotimes (i 6)
	(sleep 500)
	(exec (string "kill -" SIGUSR1 " " mypid))
	(exec (string "kill -" SIGUSR2 " " mypid))
)

(exit)