mirror of
https://github.com/PDP-10/klh10.git
synced 2026-04-13 23:44:36 +00:00
Simplify includes in osdsup.c
by just using configure to find out which headers exist, rather than guessing based on dubious system guesses.
This commit is contained in:
@@ -130,7 +130,8 @@ AC_CHECK_HEADERS([arpa/inet.h errno.h fcntl.h limits.h netinet/in.h sgtty.h \
|
||||
sys/socket.h sys/time.h termios.h unistd.h net/if_tun.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/io.h libvdeplug.h, sys/ioctl_compat.h sys/stream.h \
|
||||
sys/times.h sys/resource.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_INLINE
|
||||
@@ -149,8 +150,8 @@ AC_FUNC_REALLOC
|
||||
AC_CHECK_FUNCS([alarm dup2 gettimeofday localtime_r memset socket strcasecmp \
|
||||
strchr strcspn strerror strncasecmp strpbrk strrchr strtol \
|
||||
getifaddrs if_nameindex sigaction nanosleep \
|
||||
gettimeofday getrusage setitimer tcsetattr mlockall \
|
||||
setpriority])
|
||||
getrusage setitimer tcsetattr mlockall \
|
||||
setpriority times])
|
||||
|
||||
# Check for BSD TTY stuff as fallback for termios.
|
||||
AC_CHECK_MEMBER(struct tchars.t_intrc,
|
||||
|
||||
66
src/osdsup.c
66
src/osdsup.c
@@ -57,6 +57,10 @@
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h> /* read, write, lseek */
|
||||
#endif
|
||||
|
||||
#if CENV_SYS_UNIX
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
@@ -73,37 +77,35 @@
|
||||
# include <sys/resource.h> /* BSD: For getrusage() */
|
||||
# endif
|
||||
|
||||
# if CENV_SYS_SOLARIS
|
||||
# include <sys/stream.h>
|
||||
# if HAVE_SYS_STREAM_H
|
||||
# include <sys/stream.h> /* Solaris, mostly */
|
||||
# include <sys/stropts.h>
|
||||
# endif
|
||||
# if CENV_SYS_SOLARIS || CENV_SYS_XBSD || CENV_SYS_LINUX
|
||||
# if CENV_SYS_LINUX
|
||||
# include <sys/ioctl.h> /* For FIONREAD */
|
||||
# else
|
||||
# include <sys/filio.h> /* For FIONREAD */
|
||||
# endif
|
||||
# include <sys/time.h> /* BSD: For setitimer() */
|
||||
# if HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h> /* For FIONREAD, ioctl, stty, gtty */
|
||||
# endif
|
||||
# if HAVE_SYS_IOCTL_COMPAT_H
|
||||
# include <sys/ioctl_compat.h>
|
||||
# endif
|
||||
# if HAVE_SYS_FILIO_H
|
||||
# include <sys/filio.h> /* For FIONREAD */
|
||||
# endif
|
||||
# if HAVE_SYS_TIME_H
|
||||
# include <sys/time.h> /* For setitimer(), gettimeofday */
|
||||
# endif
|
||||
# if HAVE_SYS_TIMES_H
|
||||
# include <sys/times.h> /* No getrusage(), use times() */
|
||||
# endif
|
||||
# if HAVE_LIMITS_H
|
||||
# include <limits.h> /* For CLK_TCK */
|
||||
# endif
|
||||
|
||||
# if CENV_SYSF_TERMIOS
|
||||
# include <termios.h> /* SV4: For terminal stuff */
|
||||
# else
|
||||
# include <sgtty.h>
|
||||
# include <sgtty.h> /* fallback to BSDTTY */
|
||||
# endif
|
||||
|
||||
/* Declare syscalls used */
|
||||
# if CENV_SYS_UNIX && !CENV_SYS_V7
|
||||
# include <unistd.h> /* read, write, lseek */
|
||||
# include <sys/ioctl.h> /* ioctl, stty, gtty */
|
||||
# if HAVE_SYS_RESOURCE_H
|
||||
# include <sys/resource.h> /* getrusage */
|
||||
/* sys/stat.h: fstat */
|
||||
/* sys/time.h: gettimeofday, setitimer */
|
||||
# else
|
||||
extern int gtty(), stty(), ioctl(), read(), write(), lseek(), fstat();
|
||||
extern int gettimeofday(), setitimer(), getrusage();
|
||||
# endif
|
||||
|
||||
#elif CENV_SYS_MAC
|
||||
@@ -942,17 +944,7 @@ os_rtmget(register osrtm_t *art)
|
||||
int
|
||||
os_vrtmget(register osrtm_t *art)
|
||||
{
|
||||
#if CENV_SYS_SOLARIS /* Precision sucks, but it's all we have */
|
||||
struct tms tms;
|
||||
|
||||
if (times(&tms) == 0) {
|
||||
art->tv_sec = tms.tms_utime / CLK_TCK;
|
||||
art->tv_usec = (tms.tms_utime % CLK_TCK)
|
||||
* (1000000/CLK_TCK); /* Turn into usec */
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
#elif HAVE_GETRUSAGE
|
||||
#if HAVE_GETRUSAGE
|
||||
/* WARNING!!! Some systems turn out not to report getrusage runtime in a
|
||||
** monotonically increasing way! This can result in negative deltas
|
||||
** from one get to the next.
|
||||
@@ -967,6 +959,16 @@ os_vrtmget(register osrtm_t *art)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
#elif HAVE_TIMES /* Precision sucks, but it's all we have */
|
||||
struct tms tms;
|
||||
|
||||
if (times(&tms) == 0) {
|
||||
art->tv_sec = tms.tms_utime / CLK_TCK;
|
||||
art->tv_usec = (tms.tms_utime % CLK_TCK)
|
||||
* (1000000/CLK_TCK); /* Turn into usec */
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
#elif CENV_SYS_MAC
|
||||
Microseconds(art);
|
||||
return TRUE;
|
||||
|
||||
Reference in New Issue
Block a user