UnixSysCallsImpl.mesa
Copyright Ó 1988, 1989, 1991 by Xerox Corporation. All rights reserved.
Christian Jacobi, January 24, 1991 5:30 pm PST
CHauser, November 9, 1988 12:45:15 pm PST
Demers, November 9, 1988 5:41:50 pm PST
Carl Hauser, February 16, 1989 2:08:26 pm PST
Unix(tm) system calls for PCedar.
Commented-out names are unimplemented for good reason, and not to be used, except: "????" means we should implement some version of this eventually.
Michael Plass, September 1, 1992 2:40 pm PDT
DIRECTORY
ProcessorFace USING [GetProcessorType],
UnixSysCalls,
UnixTypes
;
UnixSysCallsImpl: CEDAR PROGRAM
IMPORTS ProcessorFace
EXPORTS UnixSysCalls
~ { OPEN UnixTypes;
Accept: PUBLIC UNSAFE PROC [s: FD, addr: SockAddrPtr, addrLen: INTPtr] RETURNS [FD] ~ UNCHECKED {
accept: UNSAFE PROC [s: FD, addr: SockAddrPtr, addrLen: INTPtr] RETURNS [FD] ~ UNCHECKED MACHINE CODE {
"XR�pt"
};
RETURN[ accept[s, addr, addrLen] ];
};
Access: PUBLIC PROC [path: CHARPtr, mode: Mode] RETURNS [RES] ~ TRUSTED {
access: PROC [path: CHARPtr, mode: Mode] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR�ss"
};
RETURN[ access[path, mode] ];
};
Acct
AdjTime
Audit
AuditOn
AuditSvc
Bind: PUBLIC PROC [s: FD, name: SockAddrPtr, nameLen: INT] RETURNS [RES] ~ {
bind: PROC [s: FD, name: SockAddrPtr, nameLen: INT] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR𡤋ind"
};
RETURN[ bind[s, name, nameLen] ];
};
Brk
SBrk
ChDir
ChMod: PUBLIC PROC [path: CHARPtr, mode: Mode] RETURNS [RES] ~ {
chmod: PROC [path: CHARPtr, mode: Mode] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR𡤌hMod"
};
RETURN[ chmod[path, mode] ];
};
FChMod: PUBLIC PROC [fd: FD, mode: Mode] RETURNS [RES] ~ {
fchmod: PROC [fd: FD, mode: Mode] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR�hMod"
};
RETURN[ fchmod[fd, mode] ];
};
Chown
FChown
Chroot
Close: PUBLIC PROC [fd: FD] RETURNS [RES] ~ {
close: PROC [fd: FD] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR𡤌lose"
};
RETURN[ close[fd] ];
};
Connect: PUBLIC PROC [s: FD, name: SockAddrPtr, nameLen: INT] RETURNS [RES] ~ {
connect: PROC [s: FD, name: SockAddrPtr, nameLen: INT] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR𡤌onnect"
};
RETURN[ connect[s, name, nameLen] ];
};
Creat
Dup
Dup2 ????
ExecVE
Exit
FCntl: PUBLIC PROC [fd: FD, cmd: INT, arg: INT] RETURNS [RES] ~ {
fcntl: PROC [fd: FD, cmd: INT, arg: INT] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR�ntl"
};
RETURN[ fcntl[fd, cmd, arg] ];
};
FCntl4: PUBLIC PROC [fd: FD, cmd: INT, arg: INT, doInIOP: BOOL] RETURNS [RES] ~ {
fcntl4: PROC [fd: FD, cmd: INT, arg: INT, doInIOP: BOOL] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR�ntl4"
};
RETURN[ fcntl4[fd, cmd, arg, doInIOP] ];
};
FLock
Fork
FSync: PUBLIC PROC [fd: FD] RETURNS [RES] ~ {
fsync: PROC [fd: FD] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR𡤏Sync"
};
RETURN[ fsync[fd] ];
};
GetAUID
SetAUID
GetDEnts: PUBLIC UNSAFE PROC [fd: FD, buf: CHARPtr, nBytes: INT] RETURNS [INT] ~ UNCHECKED {
getdents: UNSAFE PROC [fd: FD, buf: CHARPtr, nBytes: INT] RETURNS [INT] ~ UNCHECKED MACHINE CODE {
"XR←GetDEnts"
};
RETURN[ getdents[fd, buf, nBytes] ];
};
GetDirentries
GetDomainName: PUBLIC UNSAFE PROC [name: CHARPtr, nameLen: INT] RETURNS [RES] ~ UNCHECKED {
getdomainname: UNSAFE PROC [name: CHARPtr, nameLen: INT] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←GetDomainName"
};
RETURN[ getdomainname[name, nameLen] ];
};
GetDTableSize: PUBLIC PROC RETURNS [INT] ~ {
getdtablesize: PROC RETURNS [INT] ~ TRUSTED MACHINE CODE {
"XR←GetDTableSize"
};
RETURN[ getdtablesize[] ];
};
GetGID: PUBLIC PROC RETURNS [GID] ~ {
getgid: PROC RETURNS [GID] ~ TRUSTED MACHINE CODE {
"XR←GetGID"
};
RETURN[ getgid[] ];
};
GetEGID: PUBLIC PROC RETURNS [GID] ~ {
getegid: PROC RETURNS [GID] ~ TRUSTED MACHINE CODE {
"XR←GetEGID"
};
RETURN[ getegid[] ];
};
GetGroups: PUBLIC UNSAFE PROC [gidSetLen: INT, gidSet: GIDsPtr] RETURNS [nGroups: INT] ~ UNCHECKED {
getgroups: UNSAFE PROC [gidSetLen: INT, gidSet: GIDsPtr] RETURNS [INT] ~ UNCHECKED MACHINE CODE {
"XR←GetGroups"
};
RETURN[ getgroups[gidSetLen, gidSet] ];
};
SetGroups
GetHostID: PUBLIC PROC RETURNS [INT] ~ {
gethostid: PROC RETURNS [INT] ~ TRUSTED MACHINE CODE {
"XR←GetHostID"
};
RETURN[ gethostid[] ];
};
GetHostName: PUBLIC UNSAFE PROC [name: CHARPtr, nameLen: INT] RETURNS [RES] ~ UNCHECKED {
gethostname: UNSAFE PROC [name: CHARPtr, nameLen: INT] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←GetHostName"
};
RETURN[ gethostname[name, nameLen] ];
};
SetHostName
GetITimer
SetITimer
GetMsg: PUBLIC UNSAFE PROC [fd: FD, ctlPtr, dataPtr: StrBufPtr, flags: POINTER TO RSFlags] RETURNS [GetResult] ~ UNCHECKED {
getmsg: UNSAFE PROC [fd: FD, ctlPtr, dataPtr: StrBufPtr, flags: POINTER TO RSFlags] RETURNS [GetResult] ~ UNCHECKED MACHINE CODE {
"XR←GetMsg"
};
RETURN[ getmsg[fd, ctlPtr, dataPtr, flags] ];
};
GetPageSize: PUBLIC PROC RETURNS [INT] ~ {
getpagesize: PROC RETURNS [INT] ~ TRUSTED MACHINE CODE {
"XR←GetPageSize"
};
RETURN[ getpagesize[] ];
};
GetPeerName: PUBLIC UNSAFE PROC [s: FD, name: SockAddrPtr, nameLen: INTPtr] RETURNS [RES] ~ UNCHECKED {
getpeername: UNSAFE PROC [s: FD, name: SockAddrPtr, nameLen: INTPtr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←GetPeerName"
};
RETURN[ getpeername[s, name, nameLen] ];
};
GetPID: PUBLIC PROC RETURNS [INT] ~ {
getpid: PROC RETURNS [INT] ~ TRUSTED MACHINE CODE {
"XR←GetPID"
};
RETURN[ getpid[] ];
};
GetPPID: PUBLIC PROC RETURNS [INT] ~ {
getppid: PROC RETURNS [INT] ~ TRUSTED MACHINE CODE {
"XR←GetPPID"
};
RETURN[ getppid[] ];
};
GetPriority
SetPriority
GetRLimit
SetRLimit
RUsagePtr: TYPE = LONG POINTER TO RUsage;
GetRUsage: PUBLIC UNSAFE PROC [who: Who, rusage: RUsagePtr] RETURNS [RES] ~ UNCHECKED {
getrusage: UNSAFE PROC [who: Who, rusage: RUsagePtr] RETURNS [RES] ~ MACHINE CODE {
"XR←GetRUsage"};
RETURN[ getrusage[who, rusage] ];
};
GetSockName: PUBLIC UNSAFE PROC [s: FD, name: SockAddrPtr, nameLen: INTPtr] RETURNS [RES] ~ UNCHECKED {
getsockname: UNSAFE PROC [s: FD, name: SockAddrPtr, nameLen: INTPtr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←GetSockName"
};
RETURN[ getsockname[s, name, nameLen] ];
};
GetSockOpt: PUBLIC UNSAFE PROC [s: FD, level: INT, optName: INT, optVal: CHARPtr, optLen: INTPtr] RETURNS [RES] ~ UNCHECKED {
getsockopt: UNSAFE PROC [s: FD, level: INT, optName: INT, optVal: CHARPtr, optLen: INTPtr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←GetSockOpt"
};
RETURN[ getsockopt[s, level, optName, optVal, optLen] ];
};
SetSockOpt: PUBLIC PROC [s: FD, level: INT, optName: INT, optVal: CHARPtr, optLen: INT] RETURNS [RES] ~ {
setsockopt: PROC [s: FD, level: INT, optName: INT, optVal: CHARPtr, optLen: INT] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←SetSockOpt"
};
RETURN[ setsockopt[s, level, optName, optVal, optLen] ];
};
GetTimeOfDay: PUBLIC UNSAFE PROC [tp: TimeValPtr, tzp: TimeZonePtr] RETURNS [RES] ~ UNCHECKED {
gettimeofday: UNSAFE PROC [tp: TimeValPtr, tzp: TimeZonePtr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←GetTimeOfDay"
};
RETURN[ gettimeofday[tp, tzp] ];
};
SetTimeOfDay
GetUID: PUBLIC PROC RETURNS[UID] ~ {
getuid: PROC RETURNS [UID] ~ TRUSTED MACHINE CODE {
"XR←GetUID"
};
RETURN[ getuid[] ];
};
GetEUID: PUBLIC PROC RETURNS[UID] ~ {
geteuid: PROC RETURNS [UID] ~ TRUSTED MACHINE CODE {
"XR←GetEUID"
};
RETURN[ geteuid[] ];
};
IOCtl: PUBLIC UNSAFE PROC [d: FD, request: INT, argp: CHARPtr] RETURNS [RES] ~ UNCHECKED {
... only a subset of the full Unix capability.
ioctl: UNSAFE PROC [d: FD, request: INT, argp: CHARPtr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←IOCtl"
};
RETURN[ ioctl[d, request, argp] ];
};
IOCtl4: PUBLIC UNSAFE PROC [d: FD, request: INT, argp: CHARPtr, doInIOP: BOOL] RETURNS [RES] ~ {
ioctl4: PROC [d: FD, request: INT, argp: CHARPtr, doInIOP: BOOL] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←IOCtl4"
};
RETURN[ ioctl4[d, request, argp, doInIOP] ];
};
Kill: PUBLIC PROC [pid: PID, sig: Signal] RETURNS [RES] ~ {
kill: PROC [pid: PID, sig: Signal] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←Kill"
};
RETURN[ kill[pid, sig] ];
};
KillPG: PUBLIC PROC [pgrp: PGRP, sig: Signal] RETURNS [RES] ~ {
killpg: PROC [pgrp: PGRP, sig: Signal] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←KillPG"
};
RETURN[ killpg[pgrp, sig] ];
};
Link: PUBLIC PROC [name1, name2: CHARPtr] RETURNS [RES] ~ {
link: PROC [name1, name2: CHARPtr] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←Link"
};
RETURN[ link[name1, name2] ];
};
Listen: PUBLIC PROC [s: FD, backlog: INT] RETURNS [RES] ~ {
listen: PROC [s: FD, backlog: INT] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←Listen"
};
RETURN[ listen[s, backlog] ];
};
LSeek: PUBLIC PROC [d: FD, offset: INT, whence: Whence] RETURNS [INT] ~ {
lseek: PROC [d: FD, offset: INT, whence: Whence] RETURNS [INT] ~ TRUSTED MACHINE CODE {
"XR←LSeek"
};
RETURN[ lseek[d, offset, whence] ];
};
MInCore: PUBLIC UNSAFE PROC [addr: CHARPtr, len: INT, vec: CHARPtr] RETURNS [RES] ~ UNCHECKED {
mincore: UNSAFE PROC [addr: CHARPtr, len: INT, vec: CHARPtr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←MInCore"
};
RETURN[ mincore[addr, len, vec] ];
};
MkDir: PUBLIC PROC [path: CHARPtr, mode: Mode] RETURNS [RES] ~ {
mkdir: PROC [path: CHARPtr, mode: Mode] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←MkDir"
};
RETURN[ mkdir[path, mode] ];
};
MkNod: PUBLIC PROC [path: CHARPtr, mode: Mode, dev: INT] RETURNS [RES] ~ {
mknod: PROC [path: CHARPtr, mode: Mode, dev: INT] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←MkNod"
};
RETURN[ mknod[path, mode, dev] ];
};
MMap: PUBLIC UNSAFE PROC [addr: RawVM, nbytes: CARD, prot: Protections, flags: MMapFlags, d: FD, offset: CARD] RETURNS [RES] ~ {
There were two errors in the definition of MMap in the interface; UnixTypes.MMapFlags is wrong, and the mmap call returns the address, not a return code. We fix the first problem by translating the bits (this is really the "right way" to do this anayway, if we were not generally so lazy, since it would track changes in mman.h). The second one we'll ignore for now - clients should check res#failure instead of res=success.
mmap: PROC [addr: RawVM, nbytes: CARD, prot: Protections, flags: INT, d: FD, offset: CARD] RETURNS [RawVM] ~ TRUSTED MACHINE CODE {
"<sys/mman.h>.XR←MMap" -- the proc is really in <xr/UIO.h>, but the constants we need are in <sys/mman.h>
};
ConstructMMapFlags: PROC [shared, private, fixed: BOOL] RETURNS [INT] ~ TRUSTED MACHINE CODE {
"+#define CONSTRUCT←MMAP𡤏LAGS(shared, private, fixed) ( ((word)(shared))*((word)(MAP←SHARED)) + ((word)(private))*((word)(MAP←PRIVATE)) + ((word)(fixed))*((word)(MAP𡤏IXED)))\n";
".CONSTRUCT←MMAP𡤏LAGS";
};
RETURN[ IF mmap[addr, nbytes, prot, ConstructMMapFlags[shared: flags.shared, private: flags.private, fixed: flags.fixed], d, offset] = addr THEN success ELSE failure ];
};
MUnmap: PUBLIC UNSAFE PROC [addr: RawVM, nbytes: CARD] RETURNS [RES] ~ {
munmap: PROC [addr: RawVM, nbytes: CARD] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←MUnmap"
};
RETURN[ munmap[addr, nbytes] ];
};
Mount
MProtect: PUBLIC UNSAFE PROC [addr: RawVM, nbytes: CARD, prot: Protections] RETURNS [RES] ~ {
mprotect: PROC [addr: RawVM, nbytes: CARD, prot: Protections] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←MProtect"
};
RETURN[ mprotect[addr, nbytes, prot] ];
};
MSync: PUBLIC UNSAFE PROC [addr: RawVM, nbytes: CARD, flags: MSyncFlags] RETURNS [RES] ~ {
msync: PROC [addr: RawVM, nbytes: CARD, flags: MSyncFlags] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←MSync"
};
RETURN[ msync[addr, nbytes, flags] ];
};
MsgCtl
MsgGet
MsgOp
NFSSvc
AsyncDaemon
Open: PUBLIC PROC [path: CHARPtr, flags: FileFlags, mode: Mode] RETURNS [FD] ~ {
open: PROC [path: CHARPtr, flags: FileFlags, mode: Mode] RETURNS [FD] ~ TRUSTED MACHINE CODE {
"XR←Open"
};
RETURN[ open[path, flags, mode] ];
};
Pipe
Poll: PUBLIC UNSAFE PROC [fds: POINTER TO PollFD, nfds: CARD, timeout: INT] RETURNS [selected: INT]
~ UNCHECKED {
poll: UNSAFE PROC [fds: POINTER TO PollFD, nfds: CARD, timeout: INT] RETURNS [INT] ~ UNCHECKED MACHINE CODE {
"XR←Poll"
};
RETURN[ poll[fds, nfds, timeout] ];
};
Profil: PUBLIC UNSAFE PROC[buf: CHARPtr, bufSize: INT, offset: INT, scale: INT] RETURNS [RES]
~ UNCHECKED {
profil: UNSAFE PROC [buf: CHARPtr, bufSize: INT, offset: INT, scale: INT] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←Profil"
};
RETURN[ profil[buf, bufSize, offset, scale] ];
};
PTrace
PutMsg: PUBLIC PROC [fd: FD, ctlPtr, dataPtr: StrBufPtr, flags: RSFlags] RETURNS [RES] ~ {
putmsg: PROC [fd: FD, ctlPtr, dataPtr: StrBufPtr, flags: RSFlags] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←PutMsg"
};
RETURN[ putmsg[fd, ctlPtr, dataPtr, flags] ];
};
QuotaCtl
Read: PUBLIC UNSAFE PROC [d: FD, buf: CHARPtr, nBytes: INT] RETURNS [INT] ~ UNCHECKED {
read: UNSAFE PROC [d: FD, buf: CHARPtr, nBytes: INT] RETURNS [INT] ~ UNCHECKED MACHINE CODE {
"XR←Read"
};
RETURN[ read[d, buf, nBytes] ];
};
ReadV: PUBLIC UNSAFE PROC [d: FD, iov: IOVecPtr, iovCnt: INT] RETURNS [INT] ~ UNCHECKED {
readv: UNSAFE PROC [d: FD, iov: IOVecPtr, iovCnt: INT] RETURNS [INT] ~ UNCHECKED MACHINE CODE {
"XR←ReadV"
};
RETURN[ readv[d, iov, iovCnt] ];
};
ReadLink: PUBLIC UNSAFE PROC [path: CHARPtr, buf: CHARPtr, bufSize: INT] RETURNS [INT] ~ UNCHECKED {
readlink: UNSAFE PROC [path: CHARPtr, buf: CHARPtr, bufSize: INT] RETURNS [INT] ~ UNCHECKED MACHINE CODE {
"XR←ReadLink"
};
RETURN[ readlink[path, buf, bufSize] ];
};
Reboot
Recv: PUBLIC UNSAFE PROC [fd: FD, buf: CHARPtr, len: INT, flags: MsgFlags] RETURNS [INT] ~ UNCHECKED {
recv: UNSAFE PROC [fd: FD, buf: CHARPtr, len: INT, flags: MsgFlags] RETURNS [INT] ~ UNCHECKED MACHINE CODE {
"XR←Recv"
};
RETURN[ recv[fd, buf, len, flags] ];
};
RecvFrom: PUBLIC UNSAFE PROC [fd: FD, buf: CHARPtr, len: INT, flags: MsgFlags, from: SockAddrPtr, fromLen: INTPtr] RETURNS [INT] ~ UNCHECKED {
recvfrom: UNSAFE PROC [fd: FD, buf: CHARPtr, len: INT, flags: MsgFlags, from: SockAddrPtr, fromLen: INTPtr] RETURNS [INT] ~ UNCHECKED MACHINE CODE {
"XR←RecvFrom"
};
RETURN[ recvfrom[fd, buf, len, flags, from, fromLen] ];
};
RecvMsg
Rename: PUBLIC PROC [from, to: CHARPtr] RETURNS [RES] ~ {
rename: PROC [from, to: CHARPtr] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←Rename"
};
RETURN[ rename[from, to] ];
};
RmDir: PUBLIC PROC [path: CHARPtr] RETURNS [RES] ~ {
rmdir: PROC [path: CHARPtr] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←RmDir"
};
RETURN[ rmdir[path] ];
};
Select
SemCtl
SemGet
SemOp
Send: PUBLIC PROC [s: FD, msg: CHARPtr, len: INT, flags: MsgFlags] RETURNS [INT] ~ {
send: PROC [s: FD, msg: CHARPtr, len: INT, flags: MsgFlags] RETURNS [INT] ~ TRUSTED MACHINE CODE {
"XR←Send"
};
RETURN[ send[s, msg, len, flags] ];
};
SendTo: PUBLIC PROC [s: FD, msg: CHARPtr, len: INT, flags: MsgFlags, to: SockAddrPtr, toLen: INT] RETURNS [INT] ~ {
sendto: PROC [s: FD, msg: CHARPtr, len: INT, flags: MsgFlags, to: SockAddrPtr, toLen: INT] RETURNS [INT] ~ TRUSTED MACHINE CODE {
"XR←SendTo"
};
RETURN[ sendto[s, msg, len, flags, to, toLen] ];
};
SendMsg
SetPGRP
GetPGrp: PUBLIC PROC [pid: PID] RETURNS [PGRP] ~ {
getpgrp: PROC [pid: PID] RETURNS [PGRP] ~ TRUSTED MACHINE CODE {
"XR←GetPGrp"
};
RETURN[ getpgrp[pid] ];
};
SetREGID
SetREUID
SetUserAudit
ShmGet: PUBLIC PROC [key: SharedMemoryKey, size: INT, shmflg: ShmGetFlags] RETURNS [shmId: SharedMemoryIdentifier] = {
shmget: PROC [key: SharedMemoryKey, size: INT, shmflg: ShmGetFlags] RETURNS [shmId: SharedMemoryIdentifier] = TRUSTED MACHINE CODE {
"XR←ShmGet"
};
RETURN [shmget[key, size, shmflg]]
};
ShmCtl: PUBLIC PROC [shmId: SharedMemoryIdentifier, cmd: IPCCtlCmd, buf: POINTER TO ShmIdDs] RETURNS [SysCallResult] = {
shmctl: PROC [shmId: SharedMemoryIdentifier, cmd: IPCCtlCmd, buf: POINTER TO ShmIdDs] RETURNS [SysCallResult] = TRUSTED MACHINE CODE {
"XR←ShmCtl"
};
RETURN[shmctl[shmId, cmd, buf]]
};
ShmAt: PUBLIC UNSAFE PROC [id: SharedMemoryIdentifier, addr: RawVM, flags: ShmAtFlags] RETURNS [INT] = UNCHECKED {
shmat: UNSAFE PROC [id: SharedMemoryIdentifier, addr: RawVM, flags: ShmAtFlags] RETURNS [INT] = MACHINE CODE {
"XR←ShmAt"
};
IF addr = NIL THEN ERROR; -- caller bug - PCR requires an explicit address
RETURN[shmat[id, addr, flags]]
};
ShmDt: PUBLIC UNSAFE PROC [addr: RawVM] RETURNS [SysCallResult] = UNCHECKED {
shmdt: UNSAFE PROC [addr: RawVM] RETURNS [SysCallResult] = MACHINE CODE {
"XR←ShmDt"
};
RETURN[shmdt[addr]]
};
Shutdown: PUBLIC PROC [s: FD, how: SDHow] RETURNS [RES] ~ {
shutdown: PROC [s: FD, how: SDHow] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←Shutdown"
};
RETURN[ shutdown[s, how] ];
};
SigBlock
SigPause
SigSetMask
SigStack
SigVec
Socket: PUBLIC PROC [af: AddressFamily, type: SocketType, protocol: ProtocolFamily] RETURNS [FD] ~ {
socket: PROC [af: AddressFamily, type: SocketType, protocol: ProtocolFamily] RETURNS [FD] ~ TRUSTED MACHINE CODE {
"XR←Socket"
};
RETURN[ socket[af, type, protocol] ];
};
SocketPair ????
Stat: PUBLIC UNSAFE PROC [path: CHARPtr, buf: StatPtr] RETURNS [RES] ~ UNCHECKED {
stat4: UNSAFE PROC [path: CHARPtr, buf: StatPtr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←Stat"
};
stat3: UNSAFE PROC [path: CHARPtr, buf: Stat3Ptr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←Stat"
};
SELECT ProcessorFace.GetProcessorType[] FROM
sun4 => RETURN[ stat4[path, buf] ];
sun3 => {
buf3: Stat3;
res: RES ¬ stat3[path, @buf3];
AssignStat[buf, @buf3];
RETURN[res];
}
ENDCASE => ERROR;
};
LStat: PUBLIC UNSAFE PROC [path: CHARPtr, buf: StatPtr] RETURNS [RES] ~ UNCHECKED {
lstat4: UNSAFE PROC [path: CHARPtr, buf: StatPtr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←LStat"
};
lstat3: UNSAFE PROC [path: CHARPtr, buf: Stat3Ptr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←LStat"
};
SELECT ProcessorFace.GetProcessorType[] FROM
sun4 => RETURN[ lstat4[path, buf] ];
sun3 => {
buf3: Stat3;
res: RES ¬ lstat3[path, @buf3];
AssignStat[buf, @buf3];
RETURN[res];
}
ENDCASE => ERROR;
};
FStat: PUBLIC UNSAFE PROC [fd: FD, buf: StatPtr] RETURNS [RES] ~ UNCHECKED {
fstat4: UNSAFE PROC [fd: FD, buf: StatPtr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR𡤏Stat"
};
fstat3: UNSAFE PROC [fd: FD, buf: Stat3Ptr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR𡤏Stat"
};
SELECT ProcessorFace.GetProcessorType[] FROM
sun4 => RETURN[ fstat4[fd, buf] ];
sun3 => {
buf3: Stat3;
res: RES ¬ fstat3[fd, @buf3];
AssignStat[buf, @buf3];
RETURN[res];
}
ENDCASE => ERROR;
};
StatFS: PUBLIC UNSAFE PROC [path: CHARPtr, buf: StatFSPtr] RETURNS [RES] ~ UNCHECKED {
statfs: UNSAFE PROC [path: CHARPtr, buf: StatFSPtr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR←StatFS"
};
RETURN[ statfs[path, buf] ];
};
FStatFS: PUBLIC UNSAFE PROC [fd: FD, buf: StatFSPtr] RETURNS [RES] ~ UNCHECKED {
fstatfs: UNSAFE PROC [fd: FD, buf: StatFSPtr] RETURNS [RES] ~ UNCHECKED MACHINE CODE {
"XR𡤏StatFS"
};
RETURN[ fstatfs[fd, buf] ];
};
Swapon
SymLink: PUBLIC PROC [name1, name2: CHARPtr] RETURNS [RES] ~ {
symlink: PROC [name1, name2: CHARPtr] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←SymLink"
};
RETURN[ symlink[name1, name2] ];
};
Sync: PUBLIC PROC RETURNS [RES] ~ {
sync: PROC RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←Sync"
};
RETURN[ sync[] ];
};
Syscall
Truncate: PUBLIC PROC [path: CHARPtr, length: CARD] RETURNS [RES] ~ {
truncate: PROC [path: CHARPtr, length: CARD] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←Truncate"
};
RETURN[ truncate[path, length] ];
};
FTruncate: PUBLIC PROC [fd: FD, length: CARD] RETURNS [RES] ~ {
ftruncate: PROC [fd: FD, length: CARD] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR𡤏Truncate"
};
RETURN[ ftruncate[fd, length] ];
};
UMask
UName
Unlink: PUBLIC PROC [path: CHARPtr] RETURNS [RES] ~ {
unlink: PROC [path: CHARPtr] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←Unlink"
};
RETURN[ unlink[path] ];
};
Unmount
UTimes: PUBLIC PROC [file: CHARPtr, tvp: FileTimesPtr] RETURNS [RES] ~ {
utimes: PROC [file: CHARPtr, tvp: FileTimesPtr] RETURNS [RES] ~ TRUSTED MACHINE CODE {
"XR←UTimes"
};
RETURN[ utimes[file, tvp] ];
};
VAdvise
VFork
VHangup
Wait
Wait3
Wait4
Write: PUBLIC PROC [d: FD, buf: CHARPtr, nBytes: INT] RETURNS [INT] ~ {
write: PROC [d: FD, buf: CHARPtr, nBytes: INT] RETURNS [INT] ~ TRUSTED MACHINE CODE {
"XR←Write"
};
RETURN[ write[d, buf, nBytes] ];
};
WriteV: PUBLIC PROC [d: FD, iov: IOVecPtr, iovCnt: INT] RETURNS [INT] ~ {
writev: PROC [d: FD, iov: IOVecPtr, iovCnt: INT] RETURNS [INT] ~ TRUSTED MACHINE CODE {
"XR←WriteV"
};
RETURN[ writev[d, iov, iovCnt] ];
};
Stat structures are different on Sun3/Sun4. We want Cedar code to always use the same stat structure so we transform Stat3s to Stats here.
Stat3Ptr: TYPE = POINTER TO Stat3;
Stat3: TYPE = WORD16 MACHINE DEPENDENT RECORD [
dev: Dev,  -- device inode resides on
pad0: INT16,  -- no padding on sun3
ino: INum,  -- this inode's number
mode: Mode, -- protection
nlink: INT16, -- number of hard links to the file
uid: UID,  -- user ID of owner
gid: GID,  -- group ID of owner
rdev: Dev,  -- the device type, for inode that is device
pad1: INT16, -- no padding on sun3
size: CARD32, -- total size of file, in bytes
atime: Time,  -- file last access time
spare1: INT32,
mtime: Time, -- file last modify time
spare2: INT32,
ctime: Time,  -- file last status change time
spare3: INT32,
blksize: CARD32, -- optimal blocksize for file system i/o ops
blocks: CARD32, -- actual number of blocks allocated
spare4: ARRAY [0..2) OF INT32
];
AssignStat: PRIVATE UNSAFE PROC [s4: StatPtr, s3: Stat3Ptr] RETURNS [] ~ UNCHECKED {
s4.dev ¬ s3.dev;
s4.ino ¬ s3.ino;
s4.mode ¬ s3.mode;
s4.nlink ¬ s3.nlink;
s4.uid ¬ s3.uid;
s4.gid ¬ s3.gid;
s4.rdev ¬ s3.rdev;
s4.size ¬ s3.size;
s4.atime ¬ s3.atime;
s4.spare1 ¬ s3.spare1;
s4.mtime ¬ s3.mtime;
s4.spare2 ¬ s3.spare2;
s4.ctime ¬ s3.ctime;
s4.spare3 ¬ s3.spare3;
s4.blksize ¬ s3.blksize;
s4.blocks ¬ s3.blocks;
s4.spare4 ¬ s3.spare4;
};
}.
CHauser, February 16, 1989: Remove Dup, add GetSockOpt, SetSockOpt
CHauser, February 22, 1989: Added Poll, GetMsg, PutMsg
Plass, January 29, 1992: Added Access, FCntl, FCntl4, IOCtl4, MMap, MUnmap, MProtect, MSync