DIRECTORY UnixSysCallExtensions, UnixTypes ; UnixSysCallExtensionsImpl: CEDAR PROGRAM EXPORTS UnixSysCallExtensions ~ { OPEN UnixTypes; FDKind: TYPE ~ UnixSysCallExtensions.FDKind; Open4: PUBLIC PROC [path: CHARPtr, flags: FileFlags, mode: Mode, kind: FDKind] RETURNS [FD] ~ { Open4Inner: PROC [path: CHARPtr, flags: FileFlags, mode: Mode, kind: FDKind] RETURNS [FD] ~ TRUSTED MACHINE CODE { "XR_Open4" }; RETURN[ Open4Inner[path, flags, mode, kind] ]; }; GetDescriptorKind: PUBLIC PROC [d: FD] RETURNS [FDKind] ~ { GetDescriptorKindInner: PROC [d: FD] RETURNS [FDKind] ~ TRUSTED MACHINE CODE { "XR_GetDescriptorKind" }; RETURN[ GetDescriptorKindInner[d] ]; }; GetDTableSize1: PUBLIC PROC [kind: FDKind] RETURNS [INT] ~ { GetDTableSize1Inner: PROC [kind: FDKind] RETURNS [INT] ~ TRUSTED MACHINE CODE { "XR_GetDTableSize1" }; RETURN[ GetDTableSize1Inner[kind] ]; }; ExpandPath: PUBLIC PROC [path: CHARPtr] RETURNS [CHARPtr] ~ { ExpandPathInner: PROC [path: CHARPtr] RETURNS [CHARPtr] ~ TRUSTED MACHINE CODE { "XR_ExpandPath" }; RETURN[ ExpandPathInner[path] ]; }; GetNumberOfFreeFDs: PUBLIC PROC [kind: FDKind] RETURNS [INT] ~ { GetNumberOfFreeFDsInner: PROC [kind: FDKind] RETURNS [INT] ~ TRUSTED MACHINE CODE { "XR_GetNumberOfFreeFDs" }; RETURN[ GetNumberOfFreeFDsInner[kind] ]; }; BlockingMode: TYPE ~ UnixSysCallExtensions.BlockingMode; SetGetBlocking: PUBLIC PROC [s: FD, blocking: BlockingMode] RETURNS [RES] ~ { SetGetBlockingInner: PROC [s: FD, blocking: BlockingMode] RETURNS [RES] ~ TRUSTED MACHINE CODE { "XR_SetGetBlocking" }; RETURN[ SetGetBlockingInner[s, blocking] ]; }; GetGetBlocking: PUBLIC PROC [s: FD] RETURNS [BlockingMode] ~ { GetGetBlockingInner: PROC [s: FD] RETURNS [BlockingMode] ~ TRUSTED MACHINE CODE { "XR_GetGetBlocking" }; RETURN[ GetGetBlockingInner[s] ]; }; SetPutBlocking: PUBLIC PROC [s: FD, blocking: BlockingMode] RETURNS [RES] ~ { SetPutBlockingInner: PROC [s: FD, blocking: BlockingMode] RETURNS [RES] ~ TRUSTED MACHINE CODE { "XR_SetPutBlocking" }; RETURN[ SetPutBlockingInner[s, blocking] ]; }; GetPutBlocking: PUBLIC PROC [s: FD] RETURNS [BlockingMode] ~ { GetPutBlockingInner: PROC [s: FD] RETURNS [BlockingMode] ~ TRUSTED MACHINE CODE { "XR_GetPutBlocking" }; RETURN[ GetPutBlockingInner[s] ]; }; SetGetTimeout: PUBLIC PROC [s: FD, timeoutMsec: CARD] RETURNS [RES] ~ { SetGetTimeoutInner: PROC [s: FD, timeoutMsec: CARD] RETURNS [RES] ~ TRUSTED MACHINE CODE { "XR_SetGetTimeout" }; RETURN[ SetGetTimeoutInner[s, timeoutMsec] ]; }; GetGetTimeout: PUBLIC PROC [s: FD] RETURNS [CARD] ~ { GetGetTimeoutInner: PROC [s: FD] RETURNS [CARD] ~ TRUSTED MACHINE CODE { "XR_GetGetTimeout" }; RETURN[ GetGetTimeoutInner[s] ]; }; SetPutTimeout: PUBLIC PROC [s: FD, timeoutMsec: CARD] RETURNS [RES] ~ { SetPutTimeoutInner: PROC [s: FD, timeoutMsec: CARD] RETURNS [RES] ~ TRUSTED MACHINE CODE { "XR_SetPutTimeout" }; RETURN[ SetPutTimeoutInner[s, timeoutMsec] ]; }; GetPutTimeout: PUBLIC PROC [s: FD] RETURNS [CARD] ~ { GetPutTimeoutInner: PROC [s: FD] RETURNS [CARD] ~ TRUSTED MACHINE CODE { "XR_GetPutTimeout" }; RETURN[ GetPutTimeoutInner[s] ]; }; Spawn: PUBLIC PROC [cmd, stdin, stdout, stderr: CHARPtr] RETURNS [INT] ~ { SpawnInner: PROC [cmd, stdin, stdout, stderr: CHARPtr] RETURNS [INT] ~ TRUSTED MACHINE CODE { "XR_Spawn" }; RETURN[ SpawnInner[cmd, stdin, stdout, stderr] ]; }; CDSpawn: PUBLIC PROCEDURE [cmd, wd, stdin, stdout, stderr: UnixTypes.CHARPtr] RETURNS [INT] ~ { CDSpawnInner: PROCEDURE [cmd, wd, stdin, stdout, stderr: UnixTypes.CHARPtr] RETURNS [INT] ~ TRUSTED MACHINE CODE { "XR_CDSpawn" }; RETURN[ CDSpawnInner[cmd, wd, stdin, stdout, stderr] ]; }; PPOpen: PUBLIC PROC [cmd: CHARPtr] RETURNS [FD] ~ { PPOpenInner: PROC [cmd: CHARPtr] RETURNS [FD] ~ TRUSTED MACHINE CODE { "XR_PPOpen" }; RETURN [PPOpenInner[cmd]] }; RExec2: PUBLIC PROC [host: SockAddrPtr, port: CARD, user: CHARPtr, passwd: CHARPtr, cmd: CHARPtr, errbuf: CHARPtr, errbufbytes: INT ¬ 0] RETURNS [FD] ~ { RExec2Inner: PROC [host: SockAddrPtr, port: CARD, user: CHARPtr, passwd: CHARPtr, cmd: CHARPtr, errbuf: CHARPtr, errbufbytes: INT] RETURNS [FD] ~ TRUSTED MACHINE CODE { "XR_RExec2" }; RETURN [RExec2Inner[host, port, user, passwd, cmd, errbuf, errbufbytes]] }; VMReserve: PUBLIC PROC [nbytes: CARD] RETURNS [address: RawVM] ~ { vmreserve: PROC [nbytes: CARD] RETURNS [address: RawVM] ~ TRUSTED MACHINE CODE { ".XR_VMReserve" }; RETURN [vmreserve[nbytes]] }; UNTHREADEDShmCtl: PUBLIC UNSAFE PROC [shmId: SharedMemoryIdentifier, cmd: IPCCtlCmd, buf: POINTER TO ShmIdDs] RETURNS [RES] = UNCHECKED { unthreadedshmctl: PUBLIC UNSAFE PROC [shmId: SharedMemoryIdentifier, cmd: IPCCtlCmd, buf: POINTER TO ShmIdDs] RETURNS [RES] = MACHINE CODE { "*#include \n"; "#include \n"; "#include \n"; ".shmctl" }; RETURN [unthreadedshmctl[shmId, cmd, buf]] }; RegisterUNTHREADEDTerminationCleanupProc: PUBLIC UNSAFE PROC [cleanup: PROC [REF], data: REF ¬ NIL] RETURNS [RES] = UNCHECKED { registerunthreadedterminationcleanupproc: UNSAFE PROC [cleanup: PROC [REF], data: REF] RETURNS [RES] = MACHINE CODE { ".XR_RegisterTerminationCleanupProc" }; RETURN [registerunthreadedterminationcleanupproc[cleanup, data]]; }; }.  UnixSysCallExtensionsImpl.mesa Copyright Σ 1988, 1991, 1992 by Xerox Corporation. All rights reserved. Christian Jacobi, January 24, 1991 5:30 pm PST Peter B. Kessler, January 16, 1990 1:20:35 pm PST Demers, November 11, 1988 1:13:10 pm PST Carl Hauser, December 8, 1988 12:56:07 pm PST Michael Plass, January 29, 1992 2:54 pm PST Non-Unix-like I/O NonBlocking I/O Timeouts Unix command access Virtual memory allocation Shared memory control operations, version NOT to be called from a regular Cedar/Mesa thread. Register a cleanup proc to be called automatically just before PCR terminates. The cleanup proc is called from a Unix process rather than a thread -- it should do native Unix system calls and avoid thread operations such as entering monitors. Κ²–(cedarcode) style•NewlineDelimiter ™codešœ™Kšœ Οeœ=™HJ™.K™1K™(K™-K™+K˜šΟk ˜ Kšœ˜K˜ K˜K˜——šΟnœžœž˜(Kšžœ˜Kšœžœ ˜head™Kšœžœ ˜,K˜š Ÿœžœžœ=žœžœ˜[K˜šŸ œžœ=žœžœ˜YKšœžœžœžœ˜K˜ K˜—Kšžœ(˜.K˜—K˜š Ÿœžœžœžœžœ ˜7K˜šŸœžœžœžœ ˜5Kšœžœžœžœ˜Kšœ˜K˜—Kšžœ˜$K˜—K˜š Ÿœžœžœžœžœ˜8K˜šŸœžœžœžœ˜6Kšœžœžœžœ˜Kšœ˜K˜—Kšžœ˜$K˜K˜—šŸ œžœžœžœ˜=šŸœžœžœ ˜7Kšœžœžœžœ˜K˜K˜—Kšžœ˜ Kšœ˜K˜—š Ÿœžœžœžœžœ˜@šŸœžœžœžœ˜:Kšœžœžœžœ˜K˜K˜—Kšžœ"˜(Kšœ˜——™šœžœ&˜8K˜—š Ÿœžœžœžœžœžœ˜IK˜š Ÿœžœžœžœžœ˜GKšœžœžœžœ˜K˜K˜—Kšžœ%˜+K˜K˜—š Ÿœžœžœžœžœ˜:K˜šŸœžœžœžœ˜8Kšœžœžœžœ˜K˜K˜—Kšžœ˜!K˜K˜—š Ÿœžœžœžœžœžœ˜IK˜š Ÿœžœžœžœžœ˜GKšœžœžœžœ˜K˜K˜—Kšžœ%˜+K˜K˜—š Ÿœžœžœžœžœ˜:K˜šŸœžœžœžœ˜8Kšœžœžœžœ˜K˜K˜—Kšžœ˜!K˜K˜—K˜—™šŸ œžœžœžœžœžœžœ˜CK˜š Ÿœžœžœžœžœžœ˜AKšœžœžœžœ˜Kšœ˜K˜—Kšžœ'˜-K˜K™—š Ÿ œžœžœžœžœžœ˜1K˜š Ÿœžœžœžœžœ˜/Kšœžœžœžœ˜K˜K˜—Kšžœ˜ K˜K™—šŸ œžœžœžœžœžœžœ˜CK˜š Ÿœžœžœžœžœžœ˜AKšœžœžœžœ˜Kšœ˜K˜—Kšžœ'˜-K˜K˜—š Ÿ œžœžœžœžœžœ˜1K˜š Ÿœžœžœžœžœ˜/Kšœžœžœžœ˜K˜K˜—Kšžœ˜ K˜K™—˜K™——™š Ÿœžœžœ'žœžœ˜GKšœ˜šŸ œžœ'žœžœ˜EKšœžœžœžœ˜K˜ K˜—Kšžœ+˜1Kšœ˜K˜—š Ÿœžœž œ6žœžœ˜`šŸ œž œ6žœžœžœžœžœ˜sK˜ K˜—Kšžœ1˜7K˜K™—š Ÿœžœžœžœžœ˜3šŸ œžœžœžœžœžœžœ˜FK˜ K˜—Kšžœ˜Kšœ˜K˜—šŸœžœžœžœNžœžœžœ˜™šŸ œžœžœNžœžœžœžœžœžœ˜¨K˜ K˜—KšžœB˜HKšœ˜—K˜˜K™——™š Ÿ œžœžœ žœžœ˜Bš œ žœ žœžœžœžœžœ˜PKšœ&˜&Kšœ˜—Kšžœ˜Kšœ˜K˜——šŸœžœžœžœ6žœžœ žœžœž œ˜‰Kšœ\™\šœžœžœžœ6žœžœ žœžœžœžœ˜ŒKšœ˜Kšœ˜Kšœ˜Kšœ ˜ K˜—Kšžœ$˜*K˜K˜—šŸ(œžœžœžœ žœžœ žœžœžœžœž œ˜Kšœσ™σšœ*žœžœ žœžœ žœžœžœžœžœ˜uKšœ=˜=K˜—Kšžœ;˜AK˜K˜—K˜——…—n $