syscall(3)

SYNOPSIS

popen syscall <fd> <device> [r|w]

pclose syscall <fd>

sc.<fd>.pioctl <request> <pkt>

sc.ilookup <ioctl-name>

palloc <pkt> <proto> <length> <alignment-value>

DESCRIPTION

popen syscall fd device r|w
    Open the specified <device>. If the optional last argument is the letter 'r', the device is opened for reading, which is the default. Choosing 'w' indicates this device is opened for writing, and previous contents should be truncated.

pclose device fd
    Close the device corresponding to the file descriptor fd provided.

sc.<fd>.pioctl <request> pkt
    Send the ioctl call ioctl(<fd>, <request>, pkt->buf) to the opened device. This command is not available until after a device has been opened.

sc.ilookup <ioctl_name>
    Looks up the given ioctl name and returns it's value.

palloc pkt <proto> <length> <alignment size>
    Initializes the packet using the protocol pdefined of the specified length and adjusts the packet length for the alignment size if necessary.

The syscall protocol supports the use of both transparent and nontransparent ioctl calls. The defined ioctls are contained in /opt/psh/tcllib/syscall.proto, these ioctls are the only ones available for use by simply naming them in the sc.<ep>.pioctl call. To use ioctls not listed in this file the integer value of the ioctl must be used in the pioctl call or the ioctls must be added to the .proto file.

The structures that are necessary for some ioctl calls need to be setup using the pdefine command from psh.

Example:

pdefine "struct strioctl" "ic_cmd" "strioctl.ic_cmd" 0 4 "set4" "get4"

pdefine "struct strioctl" "ic_timout" "strioctl.ic_timout" 4 4 "set4" "get4"

pdefine "struct strioctl" "ic_len" "strioctl.ic_len" 8 4 "set4" "get4"

pdefine "struct strioctl" "ic_dp" "strioctl.ic_dp" 12 4 "set4" "get4"

One this is done the values for each structure field can be set and retrieved by the use of the pset and pget commands from psh. Before these can be used, and an ioctl call made, a device must be opened using the popen command.

Example:

popen syscall ep "/dev/tty" w

The device /dev/ptmx is a special case and is handled sperately from other devices.

Once use of the opened device is complete it must be closed using the pclose command.

Example:

pclose syscall ep

FILES

/opt/psh/tcllib/syscall.proto
    Tcl procedures and ioctl definitions.

SEE ALSO
xpsh(1), psh(1), protolib(3).