1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-04 23:44:42 +00:00

Revert/update unixfork.c since it is no longer used in emscripten based builds

This commit is contained in:
Nick Briggs
2023-12-22 13:35:33 -08:00
parent bee6a2f33e
commit 0cc8e4d71c

View File

@@ -45,11 +45,6 @@
int flushing = 0;
#endif
#ifdef MAIKO_OS_EMSCRIPTEN
/* We don't have any shell */
#define getusershell() NULL
#endif
/* Used to communicate between Unix subprocesses and LISP */
static long StartTime; /* Time, for creating pipe filenames */
@@ -103,7 +98,7 @@ static int ForkUnixShell(int slot, char *PtySlave, char *termtype, char *shellar
if (SlaveFD == -1) {
perror("Slave Open");
perror(PtySlave);
exit(0);
exit(1);
}
#ifdef OS5
@@ -137,7 +132,7 @@ static int ForkUnixShell(int slot, char *PtySlave, char *termtype, char *shellar
for (userShell = getusershell(); userShell != NULL && strcmp(shell, userShell) != 0; userShell = getusershell());
if (userShell == NULL) {
perror("$(SHELL) not found in /etc/shells");
exit(0);
exit(1);
}
/* argvec entries initialized to NULL */
@@ -151,7 +146,7 @@ static int ForkUnixShell(int slot, char *PtySlave, char *termtype, char *shellar
/* Should never get here */
perror("execv");
exit(0);
exit(1);
}
/* fork_Unix is the secondary process spawned right after LISP is
@@ -269,12 +264,14 @@ int fork_Unix(void) {
while (1) {
ssize_t len;
len = SAFEREAD(LispPipeIn, IOBuf, 6);
if (len == 0)
exit(0);
if (len < 0) {
perror("Error reading packet by slave");
exit(0);
exit(1);
} else if (len != 6) {
DBPRINT(("Input packet wrong length: %zd", len));
exit(0);
exit(1);
}
slot = IOBuf[3];
IOBuf[3] = 1; /* Start by signalling success in return-code */
@@ -350,7 +347,7 @@ int fork_Unix(void) {
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0) {
perror("slave socket");
exit(0);
exit(1);
}
sprintf(PipeName, "/tmp/LPU%ld-%d", StartTime, slot);
memset(&addr, 0, sizeof(struct sockaddr_un));
@@ -362,7 +359,7 @@ int fork_Unix(void) {
perror("slave connect");
printf("Name = %s.\n", PipeName);
fflush(stdout);
exit(0);
exit(1);
} else {
DBPRINT(("Slave connected on %s.\n", PipeName));
}