From f1c4659debabed909bd40be6fdf04f107f285781 Mon Sep 17 00:00:00 2001 From: mouring Date: Tue, 9 Jan 2001 00:50:29 +0000 Subject: [PATCH] - (bal) Detect if clock_t structure exists, if not define it. - (bal) Detect if O_NONBLOCK exists, if not define it. - (bal) removed news4-posix.h (now empty) - (bal) changed bsd-bindresvport.c and bsd-rresvport.c to use 'socklen_t' instead of 'int' --- ChangeLog | 5 +++++ acconfig.h | 1 + bsd-bindresvport.c | 2 +- bsd-rresvport.c | 2 +- configure.in | 14 ++++++++++++++ defines.h | 10 ++++++++++ includes.h | 1 - next-posix.h | 3 --- 8 files changed, 32 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2118033..54b3ac85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,11 @@ - markus@cvs.openbsd.org 2001/01/08 21:48:17 [kex.c] missing free; thanks stevesk@pobox.com + - (bal) Detect if clock_t structure exists, if not define it. + - (bal) Detect if O_NONBLOCK exists, if not define it. + - (bal) removed news4-posix.h (now empty) + - (bal) changed bsd-bindresvport.c and bsd-rresvport.c to use 'socklen_t' + instead of 'int' 20010108 - (bal) Fixed another typo in cli.c diff --git a/acconfig.h b/acconfig.h index 494c06f7..6f56deb0 100644 --- a/acconfig.h +++ b/acconfig.h @@ -236,6 +236,7 @@ #undef HAVE_SOCKLEN_T #undef HAVE_SIZE_T #undef HAVE_SSIZE_T +#undef HAVE_CLOCK_T #undef HAVE_MODE_T #undef HAVE_PID_T #undef HAVE_SA_FAMILY_T diff --git a/bsd-bindresvport.c b/bsd-bindresvport.c index fb3f6f2b..536a5056 100644 --- a/bsd-bindresvport.c +++ b/bsd-bindresvport.c @@ -62,7 +62,7 @@ bindresvport_af(sd, sa, af) struct sockaddr_in6 *sin6; u_int16_t *portp; u_int16_t port; - int salen; + socklen_t salen; int i; if (sa == NULL) { diff --git a/bsd-rresvport.c b/bsd-rresvport.c index e8f822bf..392768c0 100644 --- a/bsd-rresvport.c +++ b/bsd-rresvport.c @@ -59,7 +59,7 @@ rresvport_af(int *alport, sa_family_t af) struct sockaddr *sa; u_int16_t *portp; int s; - int salen; + socklen_t salen; memset(&ss, '\0', sizeof ss); sa = (struct sockaddr *)&ss; diff --git a/configure.in b/configure.in index dd68daeb..4730d3c4 100644 --- a/configure.in +++ b/configure.in @@ -694,6 +694,20 @@ if test "x$ac_cv_have_ssize_t" = "xyes" ; then AC_DEFINE(HAVE_SSIZE_T) fi +AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [ + AC_TRY_COMPILE( + [ +#include + ], + [ clock_t foo; foo = 1235; ], + [ ac_cv_have_clock_t="yes" ], + [ ac_cv_have_clock_t="no" ] + ) +]) +if test "x$ac_cv_have_clock_t" = "xyes" ; then + AC_DEFINE(HAVE_CLOCK_T) +fi + AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [ AC_TRY_COMPILE( [ diff --git a/defines.h b/defines.h index 45a187c1..593fcd64 100644 --- a/defines.h +++ b/defines.h @@ -47,6 +47,7 @@ #include /* For STDIN_FILENO, etc */ #include /* Struct winsize */ +#include /* For O_NONBLOCK */ /* Constants */ @@ -88,6 +89,10 @@ enum # define STDERR_FILENO 2 #endif +#ifndef O_NONBLOCK /* Non Blocking Open */ +# define O_NONBLOCK 00004 +#endif + #ifndef S_ISREG # define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR)) # define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG)) @@ -199,6 +204,11 @@ typedef int ssize_t; # define HAVE_SSIZE_T #endif /* HAVE_SSIZE_T */ +#ifndef HAVE_CLOCK_T +typedef long clock_t; +# define HAVE_CLOCK_T +#endif; /* HAVE_CLOCK_T */ + #ifndef HAVE_SA_FAMILY_T typedef int sa_family_t; # define HAVE_SA_FAMILY_T diff --git a/includes.h b/includes.h index c3309a50..96e97ca5 100644 --- a/includes.h +++ b/includes.h @@ -20,7 +20,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } #include "config.h" #include "next-posix.h" -#include "news4-posix.h" #include #include diff --git a/next-posix.h b/next-posix.h index 92002060..3e16dacb 100644 --- a/next-posix.h +++ b/next-posix.h @@ -30,9 +30,6 @@ /* NeXT's readdir() is BSD (struct direct) not POSIX (struct dirent) */ #define dirent direct -/* FILE */ -#define O_NONBLOCK 00004 /* non-blocking open */ - /* Swap out NeXT's BSD wait() for a more POSIX complient one */ pid_t posix_wait(int *status); #define wait(a) posix_wait(a) -- 2.45.2