# perrpt command

The perrpt command displays, clears,
restarts or suppresses the D3 error log maintained on UNIX. The system
automatically logs every boot, shut down, and incident or abnormal
procedure related to a D3 virtual machine.

## Syntax

```
perrpt {-e {code}} {-h} {-f file.name} {-p pib} [-a|-k key|-x key|-c|-s]
```

## Parameter(s)

Options are specified by these
flags:

| -e {code} | Displays errors only. Boots and shut downs are not displayed. If the code is specified, only the log entries with this error code are displayed. |
| --- | --- |
| -h | Displays only the header of the log entries in short form. The information below displays: Virtual machine key Monitor version Error code Error description Port number (PIB) |
| -f file.name | Uses the file name as the log file instead of the default. |
| -p pib | Displays all entries logged by the D3 port PIB, expressed in decimal. |
| -a | Displays logs for all virtual machines. |
| -k key | Displays error log for the virtual machine specified by the key. The virtual machine key is specified using the standard C syntax: 0xNNNN for a hexadecimal number, NNNN for a decimal number, and 0NNNN for an octal number. |
| -x key | Displays error log for all virtual machines except the one specified by the key. The virtual machine key is specified using the standard C syntax: 0xNNNN for a hexadecimal number, NNNN for a decimal number, and 0NNNN for an octal number. |
| -c | Clears the error log and restarts the error logging. Requires the root privilege. |
| -s | Clears the error log and stops the logging process. Requires the root privilege. After this command is issued, no error logging takes place. Error logging is restarted by using the -c flag. The trace is reactivated automatically every time D3 is installed or reinstalled on the system. |
The log is kept in the file /usr/tmp/ap.log. Each log entry has the UNIX time and date of the incident, the
key in hexadecimal of the D3 virtual machine, an error code, the process
port (PIB) number of the process that logged the error (not necessarily
the process that had a problem), and the optional information in the
form of a hexadecimal dump. The table below describes each error and
the syntax of the additional data:

| 1 | Boot. |
| --- | --- |
| 2 | Shut down. |
| 3 | Line 0 or the flusher received a SIGTERM. When the flusher receives this signal, it shuts the virtual machine down. There should be two shut entries when the system is shut down properly (that is, there is a log entry for a shut down). If not, the system was shut down abnormally. |
| 4 | Process killed. When a D3 process does not respond, logoff escalates and sends a signal SIGKILL to the D3 process. The additional information is (in hexadecimal): ```
<pib+1 of killed process> <pib+1 of killer>
``` |
| 5 | Process abort. When a process receives a serious abort signal (for example, SIGSEGV, SIGBUS, SIGTRAP, and so on), the machine registers are dumped in the additional data (in a format implementation dependent). |
| 6 | Security failure. Wrong activation code. |
| 7 | |
| 8 | Tape error. The additional information contains: ```
<cmd> <devnum> <errno>
``` where |
| | 0 Read 1 Write |
| | Tape device number in hexadecimal. |
| | UNIX error code in hexadecimal. |
| 9 | Tape buffer allocation failed. The internal tape buffer is allocated dynamically. If this fails because UNIX is temporary out of memory, the set-device command may appear to hang. |
| 10 | Keyboard read error. A process attempted to read from stdin (normally a keyboard) and received an error. The process is disconnected. The additional information is (in hexadecimal): ```
<pib> <errno>
``` |
| 11 | Terminal write error. A process attempted to write to stdout (normally to a terminal) and received an error. The additional information is (in hexadecimal): ```
<pib> <errno>
``` |

## Example(s)

Displays an all errors log, stopping
at each page.

```
perrpt -a | pg
```
Displays only errors relative to the virtual machine with
the key `0x29733` (hexadecimal), and pipes the result
to the UNIX spooler.

```
perrpt -e -k 0x29733 | lp
```
Clears the error log, but leaves it active (or restarts
it if it was stopped).

```
perrpt -c
```
Stops error logging.

```
perrpt -s
```
Displays all entries with an error code=4 in short form:

```
perrpt -e 4 -h
```
Saves the current error log in the file usr/tmp/ap.log.monday
and lists it.

```
mv/usr/tmp/ap.log/usr/tmp/ap.log.monday
perrpt -a -f /usr/tmp/ap.log.monday
```

## See also

- [ap.log file](https://d3codex.com/unix/ap-log-file/)
- [Halt error codes](https://d3codex.com/unix/halt-error-codes/)

---
Source: https://d3codex.com/unix/perrpt-command/ - part of the D3Codex reference.
