III. System Calls
These are typical system calls which a user process might execute.
We use the notation
SYSCALL (ARG1, ARG2....)
where SYSCALL is the name of the system call and ARGk, etc. are the parameters of the system call.
CONNECT (P, AEN, FS, CR)
- P: specifies a port of the process
- AEN: specifies a local socket; the user number and host are implicit
- FS: specifies a socket with any user number in any hose, and with any AEN
- CR: the condition code returned
CONNECT attempts to attach the local socket specified by AEN to the port P and to initiate a connection with a specific foreign socket, FS. Possible values of CR are:
- CR=OK: The CONNECT was legal and the socket FS is being contacted. When the connection is established or refused the status will be updated.
- CR = BUSY: The local socket is in use (illegal command sequence).
- CR = BADSKT: The socket specification was illegal.
- CR = NOROOM: Local host's resources are exhausted.
- CR = HOMOSEX: Incorrect send/receive pair
- CR = IMP DEAD: Our imp has died
- CR = LINK DEAD: The link to the foreign host is dead because: 1. the foreign Imp is dead, 2. the foreign host is dead, or 3. the foreign NCP does not respond.
LISTEN (P, AEN, CR)
- P: specifies a port of the process
- AEN: specifies a local socket
- CR: the condition code returned
The local socket specified by AEN is attached to port P. If there is a pending call, it is processed; otherwise, no action is taken. When a call comes in, the user will be notified. After examining the call, he may either accept or refuse it. Possible values of CR are:
- CR = OK: Connection begun, listening
- CR = BUSY
- CR = NOROOM
- CR = IMP DEAD
- CR = LINK DEAD
ACCEPT (P, CR)
- P: specifies a port of the process
- CR: the condition code returned
Accept implies that the user process has inspected the foreign socket to determine who is calling and will accept the call. (Note: an interesting alternative defines ACCEPT as the implicit default condition. Thus any incoming RFC automatically satisfies a LISTEN.) Possible values of CR are:
- CR = BADSKT
- CR = NOROOM
- CR = IMP DEAD
- CR = LINK DEAD
- CR = BADCOMM: Illegal command sequence. (E.g., Accept issued before a LISTEN.
- CR = PREMCLS: Foreign user aborted connection after RFC was locally received but before Accept was executed.
TRANSMIT (P, BUFF, BITSRQST, BITSACC, CR)
- P: specifies a port of the process
- BUFF: specifies the text buffer for transmission
- BITSRQST: specifies the length to be transmitted in bits
- BITSACC: returns the number of bits actually transmitted
- CR: the condition code returned
Transmission takes place. Possible values for CR are:
- CR = OK
- CR = IMP DEAD
- CR = LINK DEAD
- CR = NOT OPEN: Connection is not open (illegal command sequence).
- CR = BAD BOUND: BITSRQST out of bounds (e.g., for a receive socket BUFF was shorter than BITSRQST indicated).
INT (P, CR)
- P: specifies the local socket of this process
- CR: the condition code returned
The process on the other (foreign) side of this port is to be interrupted. Possible values of CR are:
- CR = OK
- CR = BADSKT
- CR = BADCOMM
- CR = IMP DEAD
- CR = LINK DEAD
STATUS (P, RTAB, CR)
- P: specifies a port of this process
- RTAB: the returned rendezvous table entry
- CR: the condition code returned
The relevant fields of the rendezvous table entry associated with this port are returned in RTAB. This is the mechanism a user process employs for monitoring the state of a connection. Possible values of CR are:
- CR = OK
- CR = BADSKT
CLOSE (P, CR)
- P: specifies a port of this process
- CR: the condition code returned
Activity on the connection attached to this port stops, the connection is broken and the port becomes free for other use. Possible values of CR are:
- CR = OK
- CR = BADSKT
- CR = BADCOMM
- CR = IMP DEAD
- CR = LINK DEAD