diff options
Diffstat (limited to 'libc/sysdeps/unix')
24 files changed, 239 insertions, 351 deletions
diff --git a/libc/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h b/libc/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h index 67d82e6e7..0714ed02b 100644 --- a/libc/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h +++ b/libc/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h @@ -51,7 +51,6 @@ #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE #define __DADDR_T_TYPE __S32_TYPE -#define __SWBLK_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE __S32_TYPE diff --git a/libc/sysdeps/unix/bsd/confstr.h b/libc/sysdeps/unix/bsd/confstr.h deleted file mode 100644 index befefb652..000000000 --- a/libc/sysdeps/unix/bsd/confstr.h +++ /dev/null @@ -1 +0,0 @@ -#define CS_PATH "/usr/ucb:/bin:/usr/bin" diff --git a/libc/sysdeps/unix/syscalls.list b/libc/sysdeps/unix/syscalls.list index b38b03e19..46205825c 100644 --- a/libc/sysdeps/unix/syscalls.list +++ b/libc/sysdeps/unix/syscalls.list @@ -41,7 +41,7 @@ kill - kill i:ii __kill kill link - link i:ss __link link listen - listen i:ii __listen listen lseek - lseek i:iii __libc_lseek __lseek lseek -madvise - madvise i:pii madvise +madvise - madvise i:pii __madvise madvise mkdir - mkdir i:si __mkdir mkdir mmap - mmap b:aniiii __mmap mmap mprotect - mprotect i:aii __mprotect mprotect diff --git a/libc/sysdeps/unix/sysv/linux/_G_config.h b/libc/sysdeps/unix/sysv/linux/_G_config.h new file mode 100644 index 000000000..ec2e33317 --- /dev/null +++ b/libc/sysdeps/unix/sysv/linux/_G_config.h @@ -0,0 +1,63 @@ +/* This file is needed by libio to define various configuration parameters. + These are always the same in the GNU C library. */ + +#ifndef _G_config_h +#define _G_config_h 1 + +/* Define types for libio in terms of the standard internal type names. */ + +#include <bits/types.h> +#define __need_size_t +#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T +# define __need_wchar_t +#endif +#define __need_NULL +#include <stddef.h> +#define __need_mbstate_t +#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T +# define __need_wint_t +#endif +#include <wchar.h> +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T +# include <gconv.h> +typedef union +{ + struct __gconv_info __cd; + struct + { + struct __gconv_info __cd; + struct __gconv_step_data __data; + } __combined; +} _G_iconv_t; +#endif + + +/* These library features are always available in the GNU C library. */ +#define _G_va_list __gnuc_va_list + +#define _G_HAVE_MMAP 1 +#define _G_HAVE_MREMAP 1 + +#define _G_IO_IO_FILE_VERSION 0x20001 + +#define _G_OPEN64 __open64 +#define _G_LSEEK64 __lseek64 +#define _G_MMAP64 __mmap64 +#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf) + +/* This is defined by <bits/stat.h> if `st_blksize' exists. */ +#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE) + +#define _G_BUFSIZ 8192 + +#endif /* _G_config.h */ diff --git a/libc/sysdeps/unix/sysv/linux/configure b/libc/sysdeps/unix/sysv/linux/configure index b04f7715f..76cfea1dc 100644 --- a/libc/sysdeps/unix/sysv/linux/configure +++ b/libc/sysdeps/unix/sysv/linux/configure @@ -1,102 +1,3 @@ - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - # This file is generated from configure.in by Autoconf. DO NOT EDIT! # Local configure fragment for sysdeps/unix/sysv/linux. diff --git a/libc/sysdeps/unix/sysv/linux/init-first.c b/libc/sysdeps/unix/sysv/linux/init-first.c deleted file mode 100644 index 00234e689..000000000 --- a/libc/sysdeps/unix/sysv/linux/init-first.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Initialization code run first thing by the ELF startup code. Linux version. - Copyright (C) 1995-2004, 2005, 2007, 2011 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 <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <fcntl.h> -#include <unistd.h> -#include <sysdep.h> -#include <fpu_control.h> -#include <sys/param.h> -#include <sys/types.h> -#include <libc-internal.h> - -#include <ldsodefs.h> - -/* Set nonzero if we have to be prepared for more then one libc being - used in the process. Safe assumption if initializer never runs. */ -int __libc_multiple_libcs attribute_hidden = 1; - -/* Remember the command line argument and enviroment contents for - later calls of initializers for dynamic libraries. */ -int __libc_argc attribute_hidden; -char **__libc_argv attribute_hidden; - - -void -__libc_init_first (int argc, char **argv, char **envp) -{ -#ifdef SHARED - /* For DSOs we do not need __libc_init_first but instead _init. */ -} - -void -attribute_hidden -_init (int argc, char **argv, char **envp) -{ -#endif -#ifdef USE_NONOPTION_FLAGS - extern void __getopt_clean_environment (char **); -#endif - - __libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up; - - /* Make sure we don't initialize twice. */ - if (!__libc_multiple_libcs) - { - /* Set the FPU control word to the proper default value if the - kernel would use a different value. (In a static program we - don't have this information.) */ -#ifdef SHARED - if (__fpu_control != GLRO(dl_fpu_control)) -#endif - __setfpucw (__fpu_control); - } - - /* Save the command-line arguments. */ - __libc_argc = argc; - __libc_argv = argv; - __environ = envp; - -#ifndef SHARED - __libc_init_secure (); - - /* First the initialization which normally would be done by the - dynamic linker. */ - _dl_non_dynamic_init (); -#endif - -#ifdef VDSO_SETUP - VDSO_SETUP (); -#endif - - __init_misc (argc, argv, envp); - -#ifdef USE_NONOPTION_FLAGS - /* This is a hack to make the special getopt in GNU libc working. */ - __getopt_clean_environment (envp); -#endif - - /* Initialize ctype data. */ - __ctype_init (); - -#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS - __libc_global_ctors (); -#endif -} - -/* This function is defined here so that if this file ever gets into - ld.so we will get a link error. Having this file silently included - in ld.so causes disaster, because the _init definition above will - cause ld.so to gain an init function, which is not a cool thing. */ - -extern void _dl_start (void) __attribute__ ((noreturn)); - -void -_dl_start (void) -{ - abort (); -} diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/Makefile b/libc/sysdeps/unix/sysv/linux/powerpc/Makefile index f6dccd9a3..6bdf4dc7f 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/Makefile +++ b/libc/sysdeps/unix/sysv/linux/powerpc/Makefile @@ -16,3 +16,9 @@ endif ifeq ($(subdir),elf) sysdep_routines += dl-vdso endif + +ifeq ($(subdir),misc) +sysdep_headers += bits/ppc.h +sysdep_routines += get_clockfreq get_timebase_freq +tests += test-gettimebasefreq +endif diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h index c984e2bbb..91797b74c 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h +++ b/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/PowerPC. - Copyright (C) 1995-1998, 2000, 2003, 2004, 2006, 2007, 2009, 2010, 2011 + Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -232,6 +232,19 @@ struct f_owner_ex we splice from/to). */ # define SPLICE_F_MORE 4 /* Expect more data. */ # define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ + + +/* File handle structure. */ +struct file_handle +{ + unsigned int handle_bytes; + int handle_type; + /* File identifier. */ + unsigned char f_handle[0]; +}; + +/* Maximum handle size (for now). */ +# define MAX_HANDLE_SZ 128 #endif __BEGIN_DECLS @@ -278,6 +291,19 @@ extern int fallocate64 (int __fd, int __mode, __off64_t __offset, __off64_t __len); # endif + +/* Map file name to file handle. */ +extern int name_to_handle_at (int __dfd, const char *__name, + struct file_handle *__handle, int *__mnt_id, + int __flags) __THROW; + +/* Open file using the file handle. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle, + int __flags); + #endif __END_DECLS diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/bits/ppc.h b/libc/sysdeps/unix/sysv/linux/powerpc/bits/ppc.h new file mode 100644 index 000000000..76542d9d8 --- /dev/null +++ b/libc/sysdeps/unix/sysv/linux/powerpc/bits/ppc.h @@ -0,0 +1,33 @@ +/* Facilities specific to the PowerPC architecture on Linux + Copyright (C) 2012 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/>. */ + +#ifndef _BITS_PPC_H +#define _BITS_PPC_H + +#ifndef _SYS_PLATFORM_PPC_H +# error "Never include this file directly; use <sys/platform/ppc.h> instead." +#endif + +__BEGIN_DECLS + +/* Read the time base frequency. */ +extern uint64_t __ppc_get_timebase_freq (void); + +__END_DECLS + +#endif diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/configure b/libc/sysdeps/unix/sysv/linux/powerpc/configure index 802b37160..7df7e481f 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/configure +++ b/libc/sysdeps/unix/sysv/linux/powerpc/configure @@ -1,123 +1,3 @@ - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile # This file is generated from configure.in by Autoconf. DO NOT EDIT! # Local configure fragment for sysdeps/unix/sysv/linux/powerpc/. diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c b/libc/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c new file mode 100644 index 000000000..5559dd5c0 --- /dev/null +++ b/libc/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c @@ -0,0 +1,27 @@ +/* Get the frequency of the time base. + Copyright (C) 2012 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 <stdint.h> +#include <libc-internal.h> + +uint64_t +__get_timebase_freq (void) +{ + return (uint64_t) __get_clockfreq (); +} +weak_alias (__get_timebase_freq, __ppc_get_timebase_freq) diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c b/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c index 57b36afc4..ba7ae294b 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c +++ b/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* Initialization code run first thing by the ELF startup code. Linux/PowerPC. + Copyright (C) 2007-2012 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 @@ -45,4 +46,4 @@ _libc_vdso_platform_setup (void) # define VDSO_SETUP _libc_vdso_platform_setup #endif -#include "../init-first.c" +#include <csu/init-first.c> diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions index 6fa0119e9..8d1c3a59d 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions @@ -30,4 +30,7 @@ libc { GLIBC_2.11 { fallocate64; } + GLIBC_2.17 { + __ppc_get_timebase_freq; + } } diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist index 75123b9f3..ab96361d4 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist @@ -1775,6 +1775,7 @@ GLIBC_2.16 GLIBC_2.17 GLIBC_2.17 A secure_getenv F + __ppc_get_timebase_freq F GLIBC_2.2 GLIBC_2.2 A _IO_adjust_wcolumn F diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions index 8334741ae..3ff01d1c1 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions @@ -19,4 +19,7 @@ libc { setcontext; swapcontext; } + GLIBC_2.17 { + __ppc_get_timebase_freq; + } } diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist index e2484d3f2..a60b72ad1 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist @@ -81,6 +81,7 @@ GLIBC_2.16 GLIBC_2.17 GLIBC_2.17 A secure_getenv F + __ppc_get_timebase_freq F GLIBC_2.3 GLIBC_2.3 A _Exit F diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/test-gettimebasefreq.c b/libc/sysdeps/unix/sysv/linux/powerpc/test-gettimebasefreq.c new file mode 100644 index 000000000..a3f3bd6f5 --- /dev/null +++ b/libc/sysdeps/unix/sysv/linux/powerpc/test-gettimebasefreq.c @@ -0,0 +1,62 @@ +/* Check __ppc_get_timebase_freq() for architecture changes + Copyright (C) 2012 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/>. */ + +/* Test if __ppc_get_timebase_freq() works and is different from zero. A read + failure might indicate a Linux Kernel change. + This test also use the frequency to compute the real elapsed time. */ + +#include <inttypes.h> +#include <stdio.h> + +#include <sys/platform/ppc.h> + +/* Maximum value of the Time Base Register: 2^60 - 1. */ +#define MAX_TB 0xFFFFFFFFFFFFFFF + +static int +do_test (void) +{ + uint64_t t1, t2, f, diff; + + t1 = __ppc_get_timebase (); + printf ("t1 = %"PRIu64"\n", t1); + + f = __ppc_get_timebase_freq (); + printf ("Time Base frequency = %"PRIu64" Hz\n", f); + + if (f == 0) { + printf ("Fail: The time base frequency can't be zero."); + return 1; + } + + t2 = __ppc_get_timebase (); + printf ("t2 = %"PRIu64"\n", t2); + + if (t2 > t1) { + diff = t2 - t1; + } else { + diff = (MAX_TB - t2) + t1; + } + + printf ("Elapsed time = %1.2f usecs\n", (double) diff * 1000000 / f ); + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/libc/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/libc/sysdeps/unix/sysv/linux/s390/bits/typesizes.h index b63048840..ee7e22b63 100644 --- a/libc/sysdeps/unix/sysv/linux/s390/bits/typesizes.h +++ b/libc/sysdeps/unix/sysv/linux/s390/bits/typesizes.h @@ -51,7 +51,6 @@ #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE #define __DADDR_T_TYPE __S32_TYPE -#define __SWBLK_T_TYPE __SLONGWORD_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * diff --git a/libc/sysdeps/unix/sysv/linux/s390/init-first.c b/libc/sysdeps/unix/sysv/linux/s390/init-first.c index c97138270..a066daefd 100644 --- a/libc/sysdeps/unix/sysv/linux/s390/init-first.c +++ b/libc/sysdeps/unix/sysv/linux/s390/init-first.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2008 Free Software Foundation, Inc. +/* Initialization code run first thing by the ELF startup code. Linux/s390. + Copyright (C) 2008-2012 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 @@ -46,4 +47,4 @@ _libc_vdso_platform_setup (void) # define VDSO_SETUP _libc_vdso_platform_setup #endif -#include "../init-first.c" +#include <csu/init-first.c> diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h index e55d642e7..8be55a8d7 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h +++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h @@ -51,7 +51,6 @@ #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __S32_TYPE #define __DADDR_T_TYPE __S32_TYPE -#define __SWBLK_T_TYPE __SLONGWORD_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * diff --git a/libc/sysdeps/unix/sysv/linux/syscalls.list b/libc/sysdeps/unix/sysv/linux/syscalls.list index 63432725d..2e6cf9c60 100644 --- a/libc/sysdeps/unix/sysv/linux/syscalls.list +++ b/libc/sysdeps/unix/sysv/linux/syscalls.list @@ -36,11 +36,9 @@ ioperm - ioperm i:iii ioperm iopl - iopl i:i iopl klogctl EXTRA syslog i:isi klogctl lchown - lchown i:sii __lchown lchown -madvise - madvise i:pii madvise mincore - mincore i:anV mincore mlock - mlock i:bn mlock mlockall - mlockall i:i mlockall -mmap - mmap b:aniiii __mmap mmap mount EXTRA mount i:sssip __mount mount mremap EXTRA mremap b:ainip __mremap mremap munlock - munlock i:ai munlock diff --git a/libc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h b/libc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h index 397e86724..ebb5bbb64 100644 --- a/libc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h +++ b/libc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h @@ -65,7 +65,6 @@ #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE #define __DADDR_T_TYPE __S32_TYPE -#define __SWBLK_T_TYPE __SYSCALL_SLONG_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c b/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c index e8b52eacb..dd41f0f7a 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c +++ b/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2007, 2011 Free Software Foundation, Inc. +/* Initialization code run first thing by the ELF startup code. Linux/x86-64. + Copyright (C) 2007-2012 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 @@ -54,4 +55,4 @@ _libc_vdso_platform_setup (void) # define VDSO_SETUP _libc_vdso_platform_setup #endif -#include "../init-first.c" +#include <csu/init-first.c> diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c b/libc/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c index c2aea9d4e..5fe472ea2 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c +++ b/libc/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2012 Free Software Foundation, Inc. +/* Initialization code run first thing by the ELF startup code. Linux/x32. + Copyright (C) 2012 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 @@ -37,4 +38,4 @@ _libc_vdso_platform_setup (void) # define VDSO_SETUP _libc_vdso_platform_setup #endif -#include "../../init-first.c" +#include <csu/init-first.c> |