kdosd - KDOS Daemon
The kdosd daemon, inspired
by Dave Kim's Middleman Server, provides across-card access to the KDOS file
system via MEDS mailboxes.
kdosd is structured as follows:
Create a COMMAND mailbox.
DO FOREVER
Read a command message from the COMMAND mailbox.
Decode the message and process the command.
Format a response message.
Attach to the client's RESPONSE mailbox.
Write the response message to the RESPONSE mailbox.
ENDDO
Command messages are ASCII strings with the following format:
"tag responseMailbox operation [argument(s)]"
where
- tag
- is an arbitrary, client-specified
void *
pointer.
- responseMailbox
- is the name of a MEDS mailbox to which kdosd will write a response
message.
- operation
- is a KDOS operation.
- argument(s)
- are optional, operation-specific arguments.
After processing the command, kdosd formats a response message
containing the client's command tag and the completion status:
"tag status value [optionalText]"
where
- tag
- is the command tag supplied by the client.
- status
- is the
errno
status of processing the command.
- value
- is the result of the operation; e.g., the file descriptor for an OPEN
operation, the number of bytes read for a READ operation, etc.
Supported Commands
- CLOSE - closes an open file.
Command:
| "tag responseMailbox CLOSE fd"
|
Response:
| "tag errno status"
|
- DELETE - deletes zero or more files whose names are matched by
fileSpec.
Command:
| "tag responseMailbox DELETE fileSpec"
|
Response:
| "tag errno status"
|
- LIST - returns the name of the index-th file.
Command:
| "tag responseMailbox LIST index buffer maxBytes offset whence"
|
Response:
| "tag errno status"
|
- OPEN - opens a file and returns a file descriptor for the file.
Command:
| "tag responseMailbox OPEN fileName flags"
|
Response:
| "tag errno fd"
|
- READ - reads data from a file.
Command:
| "tag responseMailbox READ fd buffer maxBytes offset whence"
|
Response:
| "tag errno numBytesRead"
|
- RENAME - renames a file.
Command:
| "tag responseMailbox RENAME oldName newName"
|
Response:
| "tag errno status"
|
- STAT - returns information about a file.
Command:
| "tag responseMailbox STAT fileName buffer"
|
Response:
| "tag errno status"
|
- WRITE - writes data to a file.
Command:
| "tag responseMailbox WRITE fd buffer numBytes offset whence"
|
Response:
| "tag errno numBytesWritten"
|
The tag and buffer arguments are decoded using the "%p" format.
The buffer argument should be a VME address accessible by kdosd.
Invocation:
% kdosd [-debug] [-vperror]
where
-debug
- enables debug output (written to stdout).
-vperror
- turns
vperror()
message output on. vperror()
messages are low-level error messages generated by
libgpl functions;
normally, they are disabled. If enabled, the messages are
output to stderr.