diff options
| -rw-r--r-- | sysdeps/unix/sysv/linux/Makefile | 2 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/adjtime.c | 40 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/adjtimex.c | 40 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/Makefile | 2 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/adjtime.c | 82 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/adjtimex.c | 22 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/osf_adjtime.c | 130 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/osf_getitimer.c | 43 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/osf_getrusage.c | 39 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c | 43 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/osf_setitimer.c | 53 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/osf_settimeofday.c | 40 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/osf_utimes.c | 37 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/osf_wait4.c | 41 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/syscalls.list | 27 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/tv32-compat.h | 112 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/gettimeofday.c | 14 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/syscalls.list | 1 |
18 files changed, 637 insertions, 131 deletions
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index bbab8f8cc3..a7623fb390 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -14,7 +14,7 @@ endif ifeq ($(subdir),misc) include $(firstword $(wildcard $(sysdirs:=/sysctl.mk))) -sysdep_routines += clone umount umount2 readahead \ +sysdep_routines += adjtimex clone umount umount2 readahead \ setfsuid setfsgid epoll_pwait signalfd \ eventfd eventfd_read eventfd_write prlimit \ personality epoll_wait tee vmsplice splice \ diff --git a/sysdeps/unix/sysv/linux/adjtime.c b/sysdeps/unix/sysv/linux/adjtime.c index 6d1e129ccc..6b8021caa3 100644 --- a/sysdeps/unix/sysv/linux/adjtime.c +++ b/sysdeps/unix/sysv/linux/adjtime.c @@ -23,39 +23,14 @@ #define MAX_SEC (INT_MAX / 1000000L - 2) #define MIN_SEC (INT_MIN / 1000000L + 2) -#ifndef MOD_OFFSET -#define modes mode -#endif - -#ifndef TIMEVAL -#define TIMEVAL timeval -#endif - -#ifndef TIMEX -#define TIMEX timex -#endif - -#ifndef ADJTIME -#define ADJTIME __adjtime -#endif - -#ifndef ADJTIMEX -#define NO_LOCAL_ADJTIME -#define ADJTIMEX(x) __adjtimex (x) -#endif - -#ifndef LINKAGE -#define LINKAGE -#endif - -LINKAGE int -ADJTIME (const struct TIMEVAL *itv, struct TIMEVAL *otv) +int +__adjtime (const struct timeval *itv, struct timeval *otv) { - struct TIMEX tntx; + struct timex tntx; if (itv) { - struct TIMEVAL tmp; + struct timeval tmp; /* We will do some check here. */ tmp.tv_sec = itv->tv_sec + itv->tv_usec / 1000000L; @@ -68,7 +43,7 @@ ADJTIME (const struct TIMEVAL *itv, struct TIMEVAL *otv) else tntx.modes = ADJ_OFFSET_SS_READ; - if (__glibc_unlikely (ADJTIMEX (&tntx) < 0)) + if (__glibc_unlikely (__adjtimex (&tntx) < 0)) return -1; if (otv) @@ -87,6 +62,9 @@ ADJTIME (const struct TIMEVAL *itv, struct TIMEVAL *otv) return 0; } -#ifdef NO_LOCAL_ADJTIME +#ifdef VERSION_adjtime +weak_alias (__adjtime, __wadjtime); +default_symbol_version (__wadjtime, adjtime, VERSION_adjtime); +#else weak_alias (__adjtime, adjtime) #endif diff --git a/sysdeps/unix/sysv/linux/adjtimex.c b/sysdeps/unix/sysv/linux/adjtimex.c new file mode 100644 index 0000000000..6d62c72a17 --- /dev/null +++ b/sysdeps/unix/sysv/linux/adjtimex.c @@ -0,0 +1,40 @@ +/* Tune kernel clock. Linux specific syscall. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sys/timex.h> +#include <sysdep.h> + +int +___adjtimex (struct timex *buf) +{ + return INLINE_SYSCALL_CALL (adjtimex, buf); +} + +#ifdef VERSION_adjtimex +weak_alias (___adjtimex, __wadjtimex); +weak_alias (___adjtimex, __wnadjtime); +default_symbol_version (___adjtimex, __adjtimex, VERSION_adjtimex); +default_symbol_version (__wadjtimex, adjtimex, VERSION_adjtimex); +default_symbol_version (__wnadjtime, ntp_adjtime, VERSION_adjtimex); +libc_hidden_ver (___adjtimex, __adjtimex); +#else +strong_alias (___adjtimex, __adjtimex) +weak_alias (___adjtimex, adjtimex) +weak_alias (___adjtimex, ntp_adjtime) +libc_hidden_def (__adjtimex) +#endif diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile index fdd089af71..2e132e474b 100644 --- a/sysdeps/unix/sysv/linux/alpha/Makefile +++ b/sysdeps/unix/sysv/linux/alpha/Makefile @@ -9,7 +9,7 @@ sysdep_routines += ieee_get_fp_control ieee_set_fp_control \ ioperm # Support old timeval32 entry points -sysdep_routines += osf_gettimeofday osf_settimeofday \ +sysdep_routines += osf_adjtime osf_gettimeofday osf_settimeofday \ osf_getitimer osf_setitimer osf_utimes \ osf_getrusage osf_wait4 diff --git a/sysdeps/unix/sysv/linux/alpha/adjtime.c b/sysdeps/unix/sysv/linux/alpha/adjtime.c index 4aede1cc40..9cb058ee55 100644 --- a/sysdeps/unix/sysv/linux/alpha/adjtime.c +++ b/sysdeps/unix/sysv/linux/alpha/adjtime.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1998-2019 Free Software Foundation, Inc. +/* adjtime -- Adjust the current time of day. Linux/Alpha/tv64 version. + Copyright (C) 2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -15,80 +16,7 @@ License along with the GNU C Library. If not, see <https://www.gnu.org/licenses/>. */ -#include <shlib-compat.h> -#include <sysdep.h> -#include <sys/time.h> - - -#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) -struct timeval32 -{ - int tv_sec, tv_usec; -}; - -struct timex32 { - unsigned int modes; /* mode selector */ - long offset; /* time offset (usec) */ - long freq; /* frequency offset (scaled ppm) */ - long maxerror; /* maximum error (usec) */ - long esterror; /* estimated error (usec) */ - int status; /* clock command/status */ - long constant; /* pll time constant */ - long precision; /* clock precision (usec) (read only) */ - long tolerance; /* clock frequency tolerance (ppm) - * (read only) - */ - struct timeval32 time; /* (read only) */ - long tick; /* (modified) usecs between clock ticks */ - - long ppsfreq; /* pps frequency (scaled ppm) (ro) */ - long jitter; /* pps jitter (us) (ro) */ - int shift; /* interval duration (s) (shift) (ro) */ - long stabil; /* pps stability (scaled ppm) (ro) */ - long jitcnt; /* jitter limit exceeded (ro) */ - long calcnt; /* calibration intervals (ro) */ - long errcnt; /* calibration errors (ro) */ - long stbcnt; /* stability limit exceeded (ro) */ - - int :32; int :32; int :32; int :32; - int :32; int :32; int :32; int :32; - int :32; int :32; int :32; int :32; -}; - -#define TIMEVAL timeval32 -#define TIMEX timex32 -#define ADJTIME attribute_compat_text_section __adjtime_tv32 -#define ADJTIMEX(x) INLINE_SYSCALL (old_adjtimex, 1, x) -#define ADJTIMEX32(x) INLINE_SYSCALL (old_adjtimex, 1, x) - +/* We can use the generic Linux implementation, but we have to override its + default symbol version. */ +#define VERSION_adjtime GLIBC_2.1 #include <sysdeps/unix/sysv/linux/adjtime.c> - -int attribute_compat_text_section -__adjtimex_tv32 (struct timex32 *tx) { return ADJTIMEX (tx); } - -strong_alias (__adjtimex_tv32, __adjtimex_tv32_1); -strong_alias (__adjtimex_tv32, __adjtimex_tv32_2); -compat_symbol (libc, __adjtimex_tv32_1, __adjtimex, GLIBC_2_0); -compat_symbol (libc, __adjtimex_tv32_2, adjtimex, GLIBC_2_0); -compat_symbol (libc, __adjtime_tv32, adjtime, GLIBC_2_0); -#endif /* SHLIB_COMPAT */ - -#undef TIMEVAL -#undef TIMEX -#undef ADJTIME -#undef ADJTIMEX -#define TIMEVAL timeval -#define TIMEX timex -#define ADJTIMEX(x) INLINE_SYSCALL (adjtimex, 1, x) - -#include <sysdeps/unix/sysv/linux/adjtime.c> - -int -__adjtimex_tv64 (struct timex *tx) { return ADJTIMEX (tx); } - -libc_hidden_ver (__adjtimex_tv64, __adjtimex) -strong_alias (__adjtimex_tv64, __adjtimex_tv64p); -weak_alias (__adjtimex_tv64, ntp_adjtime); -versioned_symbol (libc, __adjtimex_tv64, __adjtimex, GLIBC_2_1); -versioned_symbol (libc, __adjtimex_tv64p, adjtimex, GLIBC_2_1); -versioned_symbol (libc, __adjtime, adjtime, GLIBC_2_1); diff --git a/sysdeps/unix/sysv/linux/alpha/adjtimex.c b/sysdeps/unix/sysv/linux/alpha/adjtimex.c new file mode 100644 index 0000000000..1a8e0a9529 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/adjtimex.c @@ -0,0 +1,22 @@ +/* adjtimex -- Adjust the current time of day. Linux/Alpha/tv64 version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +/* We can use the generic Linux implementation, but we have to override its + default symbol version. */ +#define VERSION_adjtimex GLIBC_2.1 +#include <sysdeps/unix/sysv/linux/adjtimex.c> diff --git a/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c b/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c new file mode 100644 index 0000000000..91ad8747da --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/osf_adjtime.c @@ -0,0 +1,130 @@ +/* adjtime -- adjust the system clock. Linux/Alpha/tv32 version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <shlib-compat.h> + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) + +#include <sys/time.h> +#include <sys/timex.h> +#include <tv32-compat.h> + +struct timex32 { + unsigned int modes; /* mode selector */ + long offset; /* time offset (usec) */ + long freq; /* frequency offset (scaled ppm) */ + long maxerror; /* maximum error (usec) */ + long esterror; /* estimated error (usec) */ + int status; /* clock command/status */ + long constant; /* pll time constant */ + long precision; /* clock precision (usec) (read only) */ + long tolerance; /* clock frequency tolerance (ppm) + * (read only) + */ + struct timeval32 time; /* (read only) */ + long tick; /* (modified) usecs between clock ticks */ + + long ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + long stabil; /* pps stability (scaled ppm) (ro) */ + long jitcnt; /* jitter limit exceeded (ro) */ + long calcnt; /* calibration intervals (ro) */ + long errcnt; /* calibration errors (ro) */ + long stbcnt; /* stability limit exceeded (ro) */ + + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; +}; + +int +attribute_compat_text_section +__adjtime_tv32 (const struct timeval32 *itv, struct timeval32 *otv) +{ + struct timeval itv64 = valid_timeval_to_timeval64 (*itv); + struct timeval otv64; + + if (__adjtime (&itv64, &otv64) == -1) + return -1; + + *otv = valid_timeval64_to_timeval (otv64); + return 0; +} + +int +attribute_compat_text_section +__adjtimex_tv32 (struct timex32 *tx) +{ + struct timex tx64; + memset (&tx64, 0, sizeof tx64); + tx64.modes = tx->modes; + tx64.offset = tx->offset; + tx64.freq = tx->freq; + tx64.maxerror = tx->maxerror; + tx64.esterror = tx->esterror; + tx64.status = tx->status; + tx64.constant = tx->constant; + tx64.precision = tx->precision; + tx64.tolerance = tx->tolerance; + tx64.tick = tx->tick; + tx64.ppsfreq = tx->ppsfreq; + tx64.jitter = tx->jitter; + tx64.shift = tx->shift; + tx64.stabil = tx->stabil; + tx64.jitcnt = tx->jitcnt; + tx64.calcnt = tx->calcnt; + tx64.errcnt = tx->errcnt; + tx64.stbcnt = tx->stbcnt; + tx64.time = valid_timeval_to_timeval64 (tx->time); + + int status = __adjtimex (&tx64); + if (status < 0) + return status; + + memset (tx, 0, sizeof *tx); + tx->modes = tx64.modes; + tx->offset = tx64.offset; + tx->freq = tx64.freq; + tx->maxerror = tx64.maxerror; + tx->esterror = tx64.esterror; + tx->status = tx64.status; + tx->constant = tx64.constant; + tx->precision = tx64.precision; + tx->tolerance = tx64.tolerance; + tx->tick = tx64.tick; + tx->ppsfreq = tx64.ppsfreq; + tx->jitter = tx64.jitter; + tx->shift = tx64.shift; + tx->stabil = tx64.stabil; + tx->jitcnt = tx64.jitcnt; + tx->calcnt = tx64.calcnt; + tx->errcnt = tx64.errcnt; + tx->stbcnt = tx64.stbcnt; + tx->time = valid_timeval64_to_timeval (tx64.time); + + return status; +} + +strong_alias (__adjtimex_tv32, __adjtimex_tv32_1); +strong_alias (__adjtimex_tv32, __adjtimex_tv32_2); +compat_symbol (libc, __adjtimex_tv32_1, __adjtimex, GLIBC_2_0); +compat_symbol (libc, __adjtimex_tv32_2, adjtimex, GLIBC_2_0); +compat_symbol (libc, __adjtime_tv32, adjtime, GLIBC_2_0); + +#endif /* SHLIB_COMPAT */ diff --git a/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c b/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c new file mode 100644 index 0000000000..8fe63a72a9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/osf_getitimer.c @@ -0,0 +1,43 @@ +/* getitimer -- Get the state of an interval timer. Linux/Alpha/tv32 version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <shlib-compat.h> + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) + +#include <sys/time.h> +#include <tv32-compat.h> + +int +attribute_compat_text_section +__getitimer_tv32 (int which, struct itimerval32 *curr_value) +{ + struct itimerval curr_value_64; + if (__getitimer (which, &curr_value_64) == -1) + return -1; + + /* Write all fields of 'curr_value' regardless of overflow. */ + curr_value->it_interval + = valid_timeval64_to_timeval (curr_value_64.it_interval); + curr_value->it_value + = valid_timeval64_to_timeval (curr_value_64.it_value); + return 0; +} + +compat_symbol (libc, __getitimer_tv32, getitimer, GLIBC_2_0); +#endif diff --git a/sysdeps/unix/sysv/linux/alpha/osf_getrusage.c b/sysdeps/unix/sysv/linux/alpha/osf_getrusage.c new file mode 100644 index 0000000000..918e8445d4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/osf_getrusage.c @@ -0,0 +1,39 @@ +/* utimes -- change file timestamps. Linux/Alpha/tv32 version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <shlib-compat.h> + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) + +#include <sys/time.h> +#include <sys/resource.h> +#include <tv32-compat.h> + +int +__getrusage_tv32 (int who, struct rusage32 *usage32) +{ + struct rusage usage64; + if (__getrusage (who, &usage64) == -1) + return -1; + + rusage64_to_rusage32 (usage32, &usage64); + return 0; +} + +compat_symbol (libc, __getrusage_tv32, getrusage, GLIBC_2_0); +#endif diff --git a/sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c b/sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c new file mode 100644 index 0000000000..59fc614523 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c @@ -0,0 +1,43 @@ +/* gettimeofday -- Get the current time of day. Linux/Alpha/tv32 version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <shlib-compat.h> + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) + +#include <sys/time.h> +#include <tv32-compat.h> + +/* Get the current time of day and timezone information putting it + into *TV and *TZ. */ + +int +attribute_compat_text_section +__gettimeofday_tv32 (struct timeval32 *restrict tv32, void *restrict tz) +{ + struct timeval tv; + __gettimeofday (&tv, tz); + + *tv32 = valid_timeval64_to_timeval (tv); + return 0; +} + +compat_symbol (libc, __gettimeofday_tv32, __gettimeofday, GLIBC_2_0); +strong_alias (__gettimeofday_tv32, __gettimeofday_tv32_1); +compat_symbol (libc, __gettimeofday_tv32_1, gettimeofday, GLIBC_2_0); +#endif diff --git a/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c b/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c new file mode 100644 index 0000000000..9184a88a8f --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/osf_setitimer.c @@ -0,0 +1,53 @@ +/* getitimer -- Get the state of an interval timer. Linux/Alpha/tv32 version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU< |
