1
0
mirror of https://github.com/PDP-10/klh10.git synced 2026-04-13 15:34:25 +00:00

Remove some CENV_SYS_* defines.

I was hoping to remove more of them: at least CENV_SYS_BSD for example which
would allow removing several more.
Unfortunately CENV_SYS_BSD is used in tape control behaviour checks.
There is no way of checking those with configure. Worse, how well tape
worked on various Unixen when the tape code was written may be totally
different in later versions.
For signal handling I could at least remove CENV_SYS_BSD by implementing
the suggestion to use sigvec(2) (now deprecated). Falling back to plain
V7-style signal(2) is probably not good enough, so that is an error case
now. Fortunately that is totally unneeded on any modern Unix.
This commit is contained in:
Olaf Seibert
2021-08-19 20:05:11 +02:00
parent a08599f109
commit ce2cd448af
5 changed files with 36 additions and 23 deletions

View File

@@ -131,7 +131,7 @@ AC_CHECK_HEADERS([arpa/inet.h errno.h fcntl.h limits.h netinet/in.h sgtty.h \
linux/if_tun.h linux/if_packet.h net/if_tap.h sys/mtio.h \
net/nit.h sys/dlpi.h net/if_dl.h net/if_types.h \
sys/io.h libvdeplug.h, sys/ioctl_compat.h sys/stream.h \
sys/times.h sys/resource.h])
sys/times.h sys/resource.h signal.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
@@ -151,7 +151,7 @@ AC_CHECK_FUNCS([alarm dup2 gettimeofday localtime_r memset socket strcasecmp \
strchr strcspn strerror strncasecmp strpbrk strrchr strtol \
getifaddrs if_nameindex sigaction nanosleep \
getrusage setitimer tcsetattr mlockall \
setpriority times])
setpriority times sigvec])
# Check for BSD TTY stuff as fallback for termios.
AC_CHECK_MEMBER(struct tchars.t_intrc,

View File

@@ -109,19 +109,13 @@
#ifndef CENV_SYS_T20 /* DEC TOPS-20 */
# define CENV_SYS_T20 0
#endif
#ifndef CENV_SYS_V7 /* Basic vanilla Unix */
# define CENV_SYS_V7 0
#endif
#ifndef CENV_SYS_W2K /* MS W2K */
# define CENV_SYS_W2K 0
#endif
/* If none of the above were set, try a few semi-standard checks,
* but don't complain if nothing's found.
*/
#if !(CENV_SYS_V7|CENV_SYS_SUN|CENV_SYS_SOLARIS|CENV_SYS_NEXT|CENV_SYS_MAC \
#if !(CENV_SYS_SUN|CENV_SYS_SOLARIS|CENV_SYS_NEXT|CENV_SYS_MAC \
|CENV_SYS_BSDI|CENV_SYS_NETBSD|CENV_SYS_FREEBSD|CENV_SYS_OPENBSD \
|CENV_SYS_DECOSF|CENV_SYS_LINUX|CENV_SYS_W2K)
|CENV_SYS_DECOSF|CENV_SYS_LINUX)
# if defined(__osf__) && defined(__digital__)
# undef CENV_SYS_DECOSF
# define CENV_SYS_DECOSF 1
@@ -164,8 +158,7 @@
|CENV_SYS_XBSD|CENV_SYS_NEXT|CENV_SYS_DECOSF \
|CENV_SYS_LINUX)
#endif
#define CENV_SYS_SVR4 0 /* XXX Later: (CENV_SYS_SOLARIS|CENV_SYS_DECOSF) ? */
#define CENV_SYS_UNIX (CENV_SYS_V7|CENV_SYS_BSD|CENV_SYS_SVR4) /* Any Unix */
#define CENV_SYS_UNIX __unix__ /* Any Unix */
/* Specific OS Feature defs
This only has features of interest for KLH10 software.

View File

@@ -704,11 +704,19 @@ dp_signal(int sig, void (*func)(int))
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask, sig); /* Suspend this sig during handler */
return sigaction(sig, &act, &oact);
#elif CENV_SYS_BSD
/* If really BSD, probably should use sigvec instead */
return (signal(sig, func) == (void (*)())-1) ? -1 : 0;
#elif HAVE_SIGVEC /* untested */
struct sigvec sv, osv;
sv.sv_handler = func;
sv.sv_flags = SV_INTERRUPT; /* not SV_RESETHAND */
sv.sv_mask = sigmask(sig);
if (ossa)
ossa->ossa_sig = sig;
return sigvec(sig, &sv, &osv);
#else
*** ERROR *** need signal support
/* If really BSD, probably should use sigvec instead */
*** ERROR *** need reliable signal support
return (signal(sig, func) == (void (*)())-1) ? -1 : 0;
#endif
}

View File

@@ -1538,7 +1538,17 @@ osux_sigact(int sig, ossighandler_t *func, ossigact_t *ossa)
if (ossa)
ossa->ossa_sig = sig;
return sigaction(sig, &act, (ossa ? &ossa->ossa_sa : NULL));
#elif CENV_SYS_BSD
#elif HAVE_SIGVEC /* untested */
struct sigvec sv;
sv.sv_handler = func;
sv.sv_flags = 0; /* not SV_INTERRUPT, not SV_RESETHAND */
sv.sv_mask = sigmask(sig);
if (ossa)
ossa->ossa_sig = sig;
return sigvec(sig, &act, (ossa ? &ossa->ossa_sv : NULL));
#else
# error "Unimplemented OS routine osux_sigact()"
void (*ret)();
ret = signal(sig, func);
@@ -1547,8 +1557,6 @@ osux_sigact(int sig, ossighandler_t *func, ossigact_t *ossa)
ossa->ossa_handler = func;
}
return (ret == SIG_ERR) ? -1 : 0;
#else
# error "Unimplemented OS routine osux_sigact()"
#endif
}
@@ -1558,11 +1566,13 @@ osux_sigrestore(ossigact_t *ossa)
#if HAVE_SIGACTION
return sigaction(ossa->ossa_sig,
&ossa->ossa_sa, (struct sigaction *)NULL);
#elif CENV_SYS_BSD
return (signal(ossa->ossa_sig, ossa->ossa_handler) == SIG_ERR)
? -1 : 0;
#elif HAVE_SIGVEC /* untested */
return sigvec(ossa->ossa_sig,
&ossa->ossa_sv, (struct sigvec *)NULL);
#else
# error "Unimplemented OS routine osux_sigrestore()"
return (signal(ossa->ossa_sig, ossa->ossa_handler) == SIG_ERR)
? -1 : 0;
#endif
}

View File

@@ -92,7 +92,7 @@ extern int os_fdclose(osfd_t);
/* Signal facilities. Not provided on all environments.
*/
#if CENV_SYS_UNIX || CENV_SYS_MAC
#if HAVE_SIGNAL_H
# include <signal.h>
#endif
@@ -136,6 +136,8 @@ typedef struct {
int ossa_sig;
#if HAVE_SIGACTION
struct sigaction ossa_sa;
#elif HAVE_SIGVEC
struct sigvec ossa_sv;
#else
ossighandler_t *ossa_handler;
#endif