1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-10 02:00:17 +00:00

Migrate to POSIX signals. (#190)

This removes SYSVSIGNALS as we're always and only using POSIX
signals now.

Some platform differences have been papered over. We used to
only ignore SIGPIPE when using BSD signals, but we now ignore
it all the time.

While the SIGFPE code will now compile, it hasn't been updated
to work on modern OSes fully yet as it will need to enable
the correct FP exceptions.
This commit is contained in:
Bruce Mitchener
2021-01-09 11:55:39 +07:00
committed by GitHub
parent c83b4879ab
commit 2dcdf14334
20 changed files with 161 additions and 293 deletions

View File

@@ -202,11 +202,12 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li
return (NIL);
}
{ /* Do this without taking IO interrupts */
#ifdef SYSVSIGNALS
sighold(SIGIO);
#else
int oldmask = sigblock(sigmask(SIGIO));
#endif /* SYSVSIGNALS */
sigset_t signals;
sigemptyset(&signals);
sigaddset(&signals, SIGIO);
sigprocmask(SIG_BLOCK, &signals, NULL);
fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_ASYNC | O_NONBLOCK);
fcntl(result, F_SETOWN, getpid());
@@ -214,19 +215,10 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li
if (listen(result, 5) == -1) {
perror("TCP Listen");
close(result);
#ifdef SYSVSIGNALS
sigrelse(SIGIO);
#else
sigsetmask(oldmask);
#endif /* SYSVSIGNALS */
sigprocmask(SIG_UNBLOCK, &signals, NULL);
return (NIL);
}
#ifdef SYSVSIGNALS
sigrelse(SIGIO);
#else
sigsetmask(oldmask);
#endif /* SYSVSIGNALS */
sigprocmask(SIG_UNBLOCK, &signals, NULL);
}
FD_SET(result, &LispIOFds); /* so we get interrupts */
FD_SET(result, &LispReadFds);