tcllux::signal(n) 0.3 tcllux_signal "tcllux::signal"

Name

tcllux::signal - TclLux signal

Table Of Contents

Synopsis

  • package require Tcl 8.6
  • package require tcllux::signal ?0.3?

Description

The TclLux signal Tcl extension provides signal information. A signal argument can be a number or a signal name. A signal name is case-insensitive and may be prefixed with "sig".

COMMANDS

lux signal signals

Returns a list of 3-element lists. Columns: name, number description.

lux signal set signal ?action? ?send?

Returns signal info if only signal supplied. If action is default then the system default action will be taken upon receipt of the signal. If action is ignore then the signal will be ignored. If action is a Tcl channel then data will be written to the channel upon receipt of the signal. If send is signal then the signal number will be written to the channel as one byte. If send is timestamp then a timestamp (seconds and nanoseconds) of when the signal was received will be written to the channel as two uint64_t (128 bytes). The default for send is signal. Attempting to set signal 0 does nothing. Returns an empty string.

lux signal send signal pid

Send signal signal to process pid. Signal 0 can be used for pid checks. Returns an empty string.

EXAMPLES

proc sigreceiver {chan send} {
	if {$send eq "timestamp"} {
		binary scan [read $chan 16] mm s ns
		puts $s.$ns
	} elseif {$send eq "signal"} {
		binary scan [read $chan 1] c s
		puts $s
	}
}
proc sigsetup {sig} {
	set send signal
	#set send timestamp
	lassign [chan pipe] r w
	chan configure $r -translation binary -blocking 0
	chan configure $w -translation binary -blocking 0
	fileevent $r readable [list sigreceiver $r $send]
	lux signal set $sig $w $send
}
sigsetup hup
lux signal send hup [pid]

See Also

signal(3)

Keywords

signal, unix

Category

UNIX