|
by Jeff Vance, CSY
Enhancements summary:
- The new ABORTPROC command can kill one or more individual processes.
- The INPUT command and input() function have been enhanced to send a prompt to the console and wait for an operator reply.
- The store-to-disk feature of 24 X 7 TurboStore is now available in the basic (FOS) operating system.
Abortproc
Syntax: ABORTPROC [pin=] pinspec | (pinspec, pinspec, ... ,pinspec)
[; SYSTEM ]
where:
pinspec - a list of one or more process ID numbers (PINs) or thread IDs
to be aborted.
SYSTEM - an option needed if the target pinspec is a detached system
process.
The new ABORTPROC command kills one or more individual processes or threads.
Detached system processes can be aborted if the user has SM capability and
specifies the SYSTEM option. -- see below for more information on system
processes. The ABORTPROC commands requires OP or SM capability.
The pinspec parameter is required. The syntax is:
[#P]pin[.tid],
where PIN is the Process ID number and TID is
an optional thread ID number. A leading "#P"
is optional.
To abort more than one process, a list of pinspec's
can be specified. The list is enclosed in
parenthesis and individual pinspec's are separated by
commas. If a list is specified it is processed in
order, from left to right. ABORTPROC stops
processing the list if an error is detected.
Duplicate PINs are not detected.
Although a PIN value of zero has meaning in the
SHOWPROC and ALTPROC commands, it is invalid in
ABORTPROC. To kill yourself use the HPPIN CI variable,
e.g., ABORTPROC !hppin
MPE/iX supports six process types (shown below).
Every process has a process type. Processes
with a process type greater than or equal to
four (4) are considered system processes. System
processes are not abortable unless they have a
process type of six (6), indicating they are
"detached".
Process
Type Abortable Restrictions
-----------------------------------------------
0 User Y SM or OP capability.
1 Son Y SM or OP capability.
2 Usermain Y SM or OP capability.
(CI)
3 reserved n/a n/a
4 System N Not Abortable
5 Detached Y Must specify ;SYSTEM. SM
capability is required.
6 Ucop N Not Abortable
(JSMAIN)
7 reserved n/a n/a
Processes with a process type of 0, 1 or 2 are
considered user processes, and are abortable by any
user with SM or OP capabilities. However, see the
exceptions described below.
The Command Interpreter (CI) process for all jobs
and sessions has a process type of two. Any process
that is an immediate child of a CI process has a
process type of one. Processes which are
descendants of processes with process type 1 or 0,
have a process type of 0.
If a user specifies the SYSTEM option, and the
process is not a system process (process type < 4),
the SYSTEM option is silently ignored.
The ABORTPROC command attempts to abort the specified process(es)
and all of their children processes. MPE/iX currently does not
support a means for children processes to survive the death of
their parent process. If one or more child processes cannot be
aborted, their parent process cannot be terminated either.
There are specific circumstance where a user process is not
abortable. Examples discussed below involve "critical" processes,
session processes in break mode and certain network server
processes.
The MPE/iX Operating System uses a mechanism known as SETCRITICAL
to prevent a process from being aborted. The SETCRITICAL method is
used to protect the integrity of system data structures. A
process that is SETCRITICAL cannot be aborted. It is normal for
all processes to periodically be SETCRITICAL (e.g., when executing
system code), and they will RESETCRITICAL when it is safe for them
to be aborted. The ABORTPROC command works in conjunction with the
SETCRITICAL mechanism. It is designed so that it will never abort
a process which is SETCRITICAL. If a process is critical, ABORTPROC
will notify the process that it should abort as soon as it is
possible to terminate safely.
If the target process, or any of its children processes, are in
break mode they cannot be aborted, and an error is reported. This
is due to the MPE implementation of break, and because all
processes in the same session process tree share the same terminal
LDEV. An exception to this exception is when the target process is
the usermain process, typically the CI. In this case it is
abortable by ABORTPROC, even when it is in break mode.
If the target process is a direct child of JSMAIN and is a user
process type (0 or 1) it also cannot be aborted. The problem here
is that these processes are typically networking server processes
that are associated to a CI (usermain) process. If they are killed
the associated CI is not notified and the CI and its children
processes are not terminated. An example of these kinds of
processes are the NS/VT servers.
The above three cases (critical, break, network server) are
anticipated situations where ABORTPROC displays a CI error message.
In all other cases ABORTPROC attempts to abort the target process.
If ABORTPROC fails to fully kill the process the target process is
marked as having an "abort pending". Processes with aborts pending
are terminated when the condition that prevented the successful
abort is resolved. When ABORTPROC is used on a process that is
already marked as dying, a CI warning is reported.
The ABORTPROC command may be issued from a session, job, program,
or in BREAK. Pressing [Break] aborts the execution of this
command.
Examples
To abort process 133 and its current descendants, enter:
ABORTPROC #P133 or
ABORTPROC 133
To abort processes 122, 133 and 175 and their children processes, enter:
ABORTPROC (122, 133, 175)
To abort process 85 (assuming PIN 85 is a detached system process),
enter:
ABORTPROC 85;SYSTEM
NOTE: SM capability is required to abort system processes.
Input
Syntax: INPUT [NAME=]varname
[[;PROMPT=]prompt ] [[;WAIT=]seconds ]
[[;READCNT=]chars ] [[;DEFAULT=]default_str ]
[;CONSOLE ]
where the new parameters are:
default_str - a string value to be used as a default for varname
if no response is provided by the user.
CONSOLE - an option that causes the prompt to be written to
the system console, and the value for varname to be
read from the console.
The INPUT command assigns a value to a CI variable by reading its
value from the $STDIN file, or from the system console. The $STDIN
file can be redirected to a disk file so that the INPUT command can
be used to read records from a file into a CI variable. CONSOLE
input cannot be redirected.
The varname parameter is any variable that can be set with the
SETVAR command. The input value provided via $STDIN or by a console operator
is stored in this variable. If varname does not already exist,
INPUT creates it.
The prompt parameter is a string that is displayed prior to
receiving input. If prompt is omitted, INPUT displays nothing, but
waits for an input value. If the CONSOLE option is used the prompt is
written to the system console and non-highlighting escape sequences are
removed. Otherwise, the prompt is written to $STDLIST. To include
CI parsing delimiters ("," or ";", etc.) as part of the prompt string, it
must be surrounded with quote marks.
The user may optionally select a timed read by specifying the
WAIT parameter. The read will be cancelled after seconds seconds.
The INPUT command also supports the HPTIMEOUT variable. The
length of the timed read is seconds or HPTIMEOUT (in minutes),
whichever is smaller, as long one or the other is greater than zero.
If a timed read
expires, then the pending read terminates and CIWARN 9003 is
reported. If the CONSOLE option was selected and the INPUT read
times out, the entry in the Reply Information Table (RIT) is
removed. The default seconds is zero (0) meaning no timer
is set for the read from $STDIN or from the console. If the input times out
the variable varname will be set to the default_str
value, if specified. The wait value cannot exceed the positive value of the
HPTIMEOUT variable.
The user may optionally restrict the number of characters to be
read by specifying the READCNT= parameter. For example, if
readcnt=1 is supplied, the read will terminate after the 1st
character is typed by the user. The behavior is slightly
different when the CONSOLE option is used. In this case, the
READCNT value is treated as the maximum number of characters
allowed in the reply.
If the chars value is specified as a negative number, INPUT
uses the absolute value. The maximum character count
allowed (and the default) is the maximum size of a
CI variable, which is currently 1024 characters.
However, if the CONSOLE option is specified, chars
becomes the maximum length of a legal reply. An
operator may be able to type more than chars
characters, but an error will be reported by the
REPLY command if chars is exceeded. Currently,
CONSOLE replies are limited to 31 characters. If
chars is zero no read is done from $STDIN, and if
the CONSOLE option is used, chars will be set to 31.
The default_str parameter is a string value to be used as a default
for varname if no response is provided by the user. No response
is indicated if "enter" is pressed with no other
input, or if the read has expired due to a timeout.
The length of the default_str is not restricted by
the chars value. If default_str is omitted and the user
provides no input response, varname will be created
(if it does not already exist) with a null string
value. On the other hand, if varname does exist,
its value will not be overwritten on null responses
unless default_str is supplied.
The CONSOLE parameter causes INPUT to write the prompt to
the system console, and read the value for varname
from the console. All of the INPUT command
features are available for console input. However,
due to some internal restrictions the maximum input
size is 31 characters, and the maximum prompt size
is approximately 80 characters. Absence of the
CONSOLE option increases the input value to the
maximum size of a CI variable (1024 characters), and
the prompt can be as large as the CI's internal
buffer (less the characters needed for the rest of
the command).
The INPUT command provides a way to establish an interactive dialog
with an executing UDC or command file. The variable varname will
always be created by INPUT if it does not yet exist. Varname's
value is typically the exact value entered as a response by the
user; however, if the user enters no response (either by just
pressing the enter key, or via the INPUT read expiring) varname's
value is determined as follows:
- if a DEFAULT= value is provided that becomes the value for
varname.
- if no DEFAULT= is specified and varname already exists it is
not changed.
- if no DEFAULT= and varname does not exist it is created with a
value of "" (empty string).
The INPUT command can be used with CI IO redirection to read
from a disk file. IO redirection may be specified, but has no
meaning, when the CONSOLE option is used.
This command is available in a session, job, or program or in
BREAK. Pressing [Break] aborts the execution of this command,
without creating or modifying varname. However, break is not
detectable when using the CONSOLE option, so it may be wise to
always use the WAIT= parameter for console requests.
Examples
It is vital to remember that INPUT does not evaluate expressions,
but merely stores all input as a string.
If the input value needs to be evaluated then it should be modified
via the SETVAR command. For example:
:INPUT bleep
# assume a number was entered
:CALC typeof(bleep)
2, $2, %2 # string
:SETVAR bleep !bleep
:CALC typeof(bleep) # integer
1, $1, %1
The above example reads input (no prompt) from $STDIN and stores the
value in a variable named "bleep". Assuming the user enters a number,
the second line shows the value is really treated as a string value.
The third line evaluates the value of bleep, and as seen in the
fourth line, it is now stored as a integer.
INPUT go,"Is the first job ready?";readcnt=1;default=Y;console
The above example writes the prompt "Is the first job ready?" to the
system console, accepts a reply of one character, provides a
default response of "Y", and stores the result in the CI variable
named GO.
INPUT record <*msg
This example reads a single record from the file referred to by the
file equation *MSG into the CI variable named RECORD.
Input function
The INPUT() function provides nearly the same functionality as the
INPUT command. A minor difference exists regarding the value returned
when no input is provided by the user. If no response is provided to
the INPUT command, and a default value is also not supplied, and
varname already exists then varname will not be modified.
If the INPUT() function is used as in:
:setvar myvar INPUT(prompt)
and no response is provided, and a default value is not supplied, then
the INPUT function returns a null string (""). Thus, varname
is also set to null, even if it already exists.
Syntax: INPUT([prompt][,wait][,cnt][,default][,'console'])
All parameters work as described for the INPUT command above.
Store-to-disk
All versions of STORE now fully support the ability to send the STORE
output to disk rather than to tape. This capability is referred to as
"store-to-disk" and used to only be available in the most expensive version
of STORE. The RESTORE command has been able to read store-to-disk files
since release 6.0.
To create a store-to-disk archive file, try the following:
:file storeout;dev=disc
:purge storeout
:store file1, file2, ... ;*storeout ;show ...
Note that the store-to-disk file should be purged before STORE tries
to write to it.
|