basic.%kill

C Function/BASIC Program, Releases: AP/Unix

Sends signal to process ID.

Syntax

variable=%kill(pid, signal)

Description

sends the signal specified in 'signal' to the process 'pid'.

All Pick processes normally catch signals for their internal use. The built-in '%pgetpid' allows finding the PID of a process by knowing its port.number (pib). Only 'SIGUSR2' should be sent to a Pick process. Other signals are used internally and may cause problems if used out of context.

'SIGTERM' will logoff the Pick process and disconnect it.

'SIGHUP' will logoff the Pick process, but leave it connected to the Pick virtual machine. This behavior can be modified by providing a user writtem signal handler. See the 'trap' command.

'SIGINT' will emulate a <BREAK>, possibly sending the Pick process to the debugger.

Signal numbers are defined in 'dm,bp,unix.h signal.h'.

Example

Get its pid, and send hangup
* (SIGHUP=1) to it.
pib=32
pid=%pgetpid( pib )
if %kill( pid, 1 ) = -1 then
print 'Cannot logoff process ':pib
end

See Also

Command Name Type Description
tcl.trap Verb: Access Maintains %msignals% item in dm account.
tcl.pid Verb: Access Displays selected pid.
basic.cfunc Definition can be called from a Pick/BASIC program or subroutine in AP/DOS and AP/Unix implementations using a syntax similar to that of normal C.
basic.%pgetpid C Function Gets a Pick process PID.
port.number Definition The port number associated with the process.
basic.cfunction Definition Declare a list of C functions.
tcl.kill Verb: Access Front end to Unix 'kill' command.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.