diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/mach/configure | 67 | ||||
-rw-r--r-- | sysdeps/mach/configure.in | 5 | ||||
-rw-r--r-- | sysdeps/mach/hurd/times.c | 23 |
3 files changed, 89 insertions, 6 deletions
diff --git a/sysdeps/mach/configure b/sysdeps/mach/configure index 7a26960237..250a2929e5 100644 --- a/sysdeps/mach/configure +++ b/sysdeps/mach/configure @@ -236,3 +236,70 @@ if test $libc_cv_mach_host_page_size = yes; then EOF fi + +ac_safe=`echo "mach/machine/ndr_def.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for mach/machine/ndr_def.h""... $ac_c" 1>&6 +echo "configure:243: checking for mach/machine/ndr_def.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 248 "configure" +#include "confdefs.h" +#include <mach/machine/ndr_def.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:253: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + DEFINES="$DEFINES -DNDR_DEF_HEADER='<mach/machine/ndr_def.h>'" +else + echo "$ac_t""no" 1>&6 +ac_safe=`echo "machine/ndr_def.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for machine/ndr_def.h""... $ac_c" 1>&6 +echo "configure:274: checking for machine/ndr_def.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 279 "configure" +#include "confdefs.h" +#include <machine/ndr_def.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + DEFINES="$DEFINES -DNDR_DEF_HEADER='<machine/ndr_def.h>'" +else + echo "$ac_t""no" 1>&6 +fi + +fi + diff --git a/sysdeps/mach/configure.in b/sysdeps/mach/configure.in index 05dc45b61d..fc74e9cb7b 100644 --- a/sysdeps/mach/configure.in +++ b/sysdeps/mach/configure.in @@ -68,3 +68,8 @@ AC_EGREP_HEADER(host_page_size, mach/mach_host.defs, if test $libc_cv_mach_host_page_size = yes; then AC_DEFINE([HAVE_HOST_PAGE_SIZE]) fi + +AC_CHECK_HEADER(mach/machine/ndr_def.h, [dnl + DEFINES="$DEFINES -DNDR_DEF_HEADER='<mach/machine/ndr_def.h>'"], [dnl +AC_CHECK_HEADER(machine/ndr_def.h, [dnl + DEFINES="$DEFINES -DNDR_DEF_HEADER='<machine/ndr_def.h>'"])]) diff --git a/sysdeps/mach/hurd/times.c b/sysdeps/mach/hurd/times.c index e232757090..2065aac49a 100644 --- a/sysdeps/mach/hurd/times.c +++ b/sysdeps/mach/hurd/times.c @@ -33,6 +33,17 @@ clock_from_time_value (const time_value_t *t) return t->seconds * 1000000 + t->microseconds; } +#if NO_CREATION_TIME +static time_value_t startup_time; +static void times_init (void) __attribute__ ((unused)); +static void +times_init (void) +{ + __gettimeofday ((struct timeval *) &startup_time, NULL); +} +text_set_element (__libc_subinit, times_init); +#endif + /* Store the CPU time used by this process and all its dead children (and their dead children) in BUFFER. Return the elapsed real time, or (clock_t) -1 for errors. @@ -66,15 +77,15 @@ __times (struct tms *tms) /* XXX This can't be implemented until getrusage(RUSAGE_CHILDREN) can be. */ tms->tms_cutime = tms->tms_cstime = 0; - err = __host_get_time (__mach_host_self (), &now); - if (err) - return __hurd_fail (err); + if (__gettimeofday ((struct timeval *) &now, NULL) < 0) + return -1; #if NO_CREATION_TIME - return 0; /* XXX */ +# define our_creation_time startup_time #else - return (clock_from_time_value (&now) - - clock_from_time_value (&bi.creation_time)); +# define our_creation_time bi.startup_time #endif + return (clock_from_time_value (&now) + - clock_from_time_value (&our_creation_time)); } weak_alias (__times, times) |