diff options
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | manual/charset.texi | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/bits/socket.h (renamed from sysdeps/unix/sysv/linux/sparc/sparc64/bits/socket.h) | 10 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/bits/statvfs.h (renamed from sysdeps/unix/sysv/linux/sparc/sparc64/bits/statvfs.h) | 10 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/bits/time.h (renamed from sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/bits/time.h) | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/get_clockfreq.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/bits/siginfo.h | 306 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/bits/time.h | 73 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c | 240 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S | 16 |
10 files changed, 291 insertions, 392 deletions
diff --git a/ChangeLog b/ChangeLog index 94bf12e0bc..5434eeec1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2001-04-25 Jakub Jelinek <jakub@redhat.com> + + * sysdeps/unix/sysv/linux/sparc/sparc64/bits/time.h: Move to... + * sysdeps/unix/sysv/linux/sparc/bits/time.h: ...here. + * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/bits/time.h: Remove. + * sysdeps/unix/sysv/linux/sparc/sparc64/bits/socket.h: Move to... + * sysdeps/unix/sysv/linux/sparc/bits/socket.h: ...here. Adjust + struct msghdr for __WORDSIZE == 32. + * sysdeps/unix/sysv/linux/sparc/sparc64/bits/statvfs.h: Move to... + * sysdeps/unix/sysv/linux/sparc/bits/statvfs.h: ...here. Adjust + for __WORDSIZE == 32. + * sysdeps/unix/sysv/linux/sparc/sparc64/bits/siginfo.h: Remove. + * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/get_clockfreq.c: New + file. + * sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S (__libc_siglongjmp): + Rename from longjmp, make longjmp weak alias to it. + +2001-04-24 David S. Miller <davem@redhat.com> + + * sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c: New file. + 2001-04-25 Matthew Wilcox <willy@ldl.fc.hp.com> * sysdeps/hppa/stackinfo.h: New file. diff --git a/manual/charset.texi b/manual/charset.texi index d0286afda9..de420ea8a5 100644 --- a/manual/charset.texi +++ b/manual/charset.texi @@ -1821,12 +1821,12 @@ file2wcs (int fd, const char *charset, wchar_t *outbuf, size_t avail) int result = 0; iconv_t cd; - cd = iconv_open ("UCS-4", charset); + cd = iconv_open ("WCHAR_T", charset); if (cd == (iconv_t) -1) @{ /* @r{Something went wrong.} */ if (errno == EINVAL) - error (0, 0, "conversion from '%s' to 'UCS-4' not available", + error (0, 0, "conversion from '%s' to wchar_t not available", charset); else perror ("iconv_open"); diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/socket.h b/sysdeps/unix/sysv/linux/sparc/bits/socket.h index 50074c7885..5d683dcfe6 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/socket.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/socket.h @@ -1,4 +1,4 @@ -/* System-specific socket constants and types. Linux/SPARC64 version. +/* System-specific socket constants and types. Linux/SPARC version. Copyright (C) 1991,1992,1994-1999,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -212,11 +212,17 @@ struct msghdr socklen_t msg_namelen; /* Length of address data. */ struct iovec *msg_iov; /* Vector of data to send/receive into. */ +#if __WORDSIZE == 32 + int msg_iovlen; /* Number of elements in the vector. */ + + void *msg_control; /* Ancillary data (eg BSD filedesc passing). */ + socklen_t msg_controllen; /* Ancillary data buffer length. */ +#else size_t msg_iovlen; /* Number of elements in the vector. */ void *msg_control; /* Ancillary data (eg BSD filedesc passing). */ size_t msg_controllen; /* Ancillary data buffer length. */ - +#endif int msg_flags; /* Flags on received message. */ }; diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/statvfs.h b/sysdeps/unix/sysv/linux/sparc/bits/statvfs.h index 747dc1ba9f..4197149fb7 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/statvfs.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/statvfs.h @@ -22,6 +22,10 @@ #include <bits/types.h> /* For __fsblkcnt_t and __fsfilcnt_t. */ +#if __WORDSIZE == 32 +#define _STATVFSBUF_F_UNUSED +#endif + struct statvfs { unsigned long int f_bsize; @@ -42,6 +46,9 @@ struct statvfs __fsfilcnt64_t f_favail; #endif unsigned long int f_fsid; +#ifdef _STATVFSBUF_F_UNUSED + int __f_unused; +#endif unsigned long int f_flag; unsigned long int f_namemax; int __f_spare[6]; @@ -59,6 +66,9 @@ struct statvfs64 __fsfilcnt64_t f_ffree; __fsfilcnt64_t f_favail; unsigned long int f_fsid; +#ifdef _STATVFSBUF_F_UNUSED + int __f_unused; +#endif unsigned long int f_flag; unsigned long int f_namemax; int __f_spare[6]; diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/bits/time.h b/sysdeps/unix/sysv/linux/sparc/bits/time.h index 26d9b51693..13b4251209 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/bits/time.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/time.h @@ -1,4 +1,4 @@ -/* System-dependent timing definitions. Linux/SPARCv9 version. +/* System-dependent timing definitions. Linux/SPARC version. Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/get_clockfreq.c b/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/get_clockfreq.c new file mode 100644 index 0000000000..4191085d1f --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/get_clockfreq.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/siginfo.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/siginfo.h deleted file mode 100644 index 9e52fbb849..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/siginfo.h +++ /dev/null @@ -1,306 +0,0 @@ -/* siginfo_t, sigevent and constants. Linux/SPARC64 version. - Copyright (C) 1997, 1998, 1999, 2000, 2001 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#if !defined _SIGNAL_H && !defined __need_siginfo_t \ - && !defined __need_sigevent_t -# error "Never include this file directly. Use <signal.h> instead" -#endif - -#include <bits/wordsize.h> - -#if (!defined __have_sigval_t \ - && (defined _SIGNAL_H || defined __need_siginfo_t \ - || defined __need_sigevent_t)) -# define __have_sigval_t 1 - -/* Type for data associated with a signal. */ -typedef union sigval - { - int sival_int; - void *sival_ptr; - } sigval_t; -#endif - -#if (!defined __have_siginfo_t \ - && (defined _SIGNAL_H || defined __need_siginfo_t)) -# define __have_siginfo_t 1 - -# define __SI_MAX_SIZE 128 -# if __WORDSIZE == 64 -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) -# else -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) -# endif - -typedef struct siginfo - { - int si_signo; /* Signal number. */ - int si_errno; /* If non-zero, an errno value associated with - this signal, as defined in <errno.h>. */ - int si_code; /* Signal code. */ - - union - { - int _pad[__SI_PAD_SIZE]; - - /* kill(). */ - struct - { - __pid_t si_pid; /* Sending process ID. */ - __uid_t si_uid; /* Real user ID of sending process. */ - } _kill; - - /* POSIX.1b timers. */ - struct - { - unsigned int _timer1; - unsigned int _timer2; - } _timer; - - /* POSIX.1b signals. */ - struct - { - __pid_t si_pid; /* Sending process ID. */ - __uid_t si_uid; /* Real user ID of sending process. */ - sigval_t si_sigval; /* Signal value. */ - } _rt; - - /* SIGCHLD. */ - struct - { - __pid_t si_pid; /* Which child. */ - __uid_t si_uid; /* Real user ID of sending process. */ - int si_status; /* Exit value or signal. */ - __clock_t si_utime; - __clock_t si_stime; - } _sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ - struct - { - void *si_addr; /* Faulting insn/memory ref. */ - } _sigfault; - - /* SIGPOLL. */ - struct - { - int si_band; /* Band event for SIGPOLL. */ - int si_fd; - } _sigpoll; - } _sifields; - } siginfo_t; - - -/* X/Open requires some more fields with fixed names. */ -# define si_pid _sifields._kill.si_pid -# define si_uid _sifields._kill.si_uid -# define si_timer1 _sifields._timer._timer1 -# define si_timer2 _sifields._timer._timer2 -# define si_status _sifields._sigchld.si_status -# define si_utime _sifields._sigchld.si_utime -# define si_stime _sifields._sigchld.si_stime -# define si_value _sifields._rt.si_sigval -# define si_int _sifields._rt.si_sigval.sival_int -# define si_ptr _sifields._rt.si_sigval.sival_ptr -# define si_addr _sifields._sigfault.si_addr -# define si_band _sifields._sigpoll.si_band -# define si_fd _sifields._sigpoll.si_fd - - -/* Values for `si_code'. Positive values are reserved for kernel-generated - signals. */ -enum -{ - SI_ASYNCNL = -6, /* Sent by asynch name lookup completion. */ -# define SI_ASYNCNL SI_ASYNCNL - SI_SIGIO, /* Sent by queued SIGIO. */ -# define SI_SIGIO SI_SIGIO - SI_ASYNCIO, /* Sent by AIO completion. */ -# define SI_ASYNCIO SI_ASYNCIO - SI_MESGQ, /* Sent by real time mesq state change. */ -# define SI_MESGQ SI_MESGQ - SI_TIMER, /* Sent by timer expiration. */ -# define SI_TIMER SI_TIMER - SI_QUEUE, /* Sent by sigqueue. */ -# define SI_QUEUE SI_QUEUE - SI_USER, /* Sent by kill, sigsend, raise. */ -# define SI_USER SI_USER - SI_KERNEL = 0x80 /* Send by kernel. */ -#define SI_KERNEL SI_KERNEL -}; - - -/* `si_code' values for SIGILL signal. */ -enum -{ - ILL_ILLOPC = 1, /* Illegal opcode. */ -# define ILL_ILLOPC ILL_ILLOPC - ILL_ILLOPN, /* Illegal operand. */ -# define ILL_ILLOPN ILL_ILLOPN - ILL_ILLADR, /* Illegal addressing mode. */ -# define ILL_ILLADR ILL_ILLADR - ILL_ILLTRP, /* Illegal trap. */ -# define ILL_ILLTRP ILL_ILLTRP - ILL_PRVOPC, /* Privileged opcode. */ -# define ILL_PRVOPC ILL_PRVOPC - ILL_PRVREG, /* Privileged register. */ -# define ILL_PRVREG ILL_PRVREG - ILL_COPROC, /* Coprocessor error. */ -# define ILL_COPROC ILL_COPROC - ILL_BADSTK /* Internal stack error. */ -# define ILL_BADSTK ILL_BADSTK -}; - -/* `si_code' values for SIGFPE signal. */ -enum -{ - FPE_INTDIV = 1, /* Integer divide by zero. */ -# define FPE_INTDIV FPE_INTDIV - FPE_INTOVF, /* Integer overflow. */ -# define FPE_INTOVF FPE_INTOVF - FPE_FLTDIV, /* Floating point divide by zero. */ -# define FPE_FLTDIV FPE_FLTDIV - FPE_FLTOVF, /* Floating point overflow. */ -# define FPE_FLTOVF FPE_FLTOVF - FPE_FLTUND, /* Floating point underflow. */ -# define FPE_FLTUND FPE_FLTUND - FPE_FLTRES, /* Floating point inexact result. */ -# define FPE_FLTRES FPE_FLTRES - FPE_FLTINV, /* Floating point invalid operation. */ -# define FPE_FLTINV FPE_FLTINV - FPE_FLTSUB /* Subscript out of range. */ -# define FPE_FLTSUB FPE_FLTSUB -}; - -/* `si_code' values for SIGSEGV signal. */ -enum -{ - SEGV_MAPERR = 1, /* Address not mapped to object. */ -# define SEGV_MAPERR SEGV_MAPERR - SEGV_ACCERR /* Invalid permissions for mapped object. */ -# define SEGV_ACCERR SEGV_ACCERR -}; - -/* `si_code' values for SIGBUS signal. */ -enum -{ - BUS_ADRALN = 1, /* Invalid address alignment. */ -# define BUS_ADRALN BUS_ADRALN - BUS_ADRERR, /* Non-existant physical address. */ -# define BUS_ADRERR BUS_ADRERR - BUS_OBJERR /* Object specific hardware error. */ -# define BUS_OBJERR BUS_OBJERR -}; - -/* `si_code' values for SIGTRAP signal. */ -enum -{ - TRAP_BRKPT = 1, /* Process breakpoint. */ -# define TRAP_BRKPT TRAP_BRKPT - TRAP_TRACE /* Process trace trap. */ -# define TRAP_TRACE TRAP_TRACE -}; - -/* `si_code' values for SIGCHLD signal. */ -enum -{ - CLD_EXITED = 1, /* Child has exited. */ -# define CLD_EXITED CLD_EXITED - CLD_KILLED, /* Child was killed. */ -# define CLD_KILLED CLD_KILLED - CLD_DUMPED, /* Child terminated abnormally. */ -# define CLD_DUMPED CLD_DUMPED - CLD_TRAPPED, /* Traced child has trapped. */ -# define CLD_TRAPPED CLD_TRAPPED - CLD_STOPPED, /* Child has stopped. */ -# define CLD_STOPPED CLD_STOPPED - CLD_CONTINUED /* Stopped child has continued. */ -# define CLD_CONTINUED CLD_CONTINUED -}; - -/* `si_code' values for SIGPOLL signal. */ -enum -{ - POLL_IN = 1, /* Data input available. */ -# define POLL_IN POLL_IN - POLL_OUT, /* Output buffers available. */ -# define POLL_OUT POLL_OUT - POLL_MSG, /* Input message available. */ -# define POLL_MSG POLL_MSG - POLL_ERR, /* I/O error. */ -# define POLL_ERR POLL_ERR - POLL_PRI, /* High priority input available. */ -# define POLL_PRI POLL_PRI - POLL_HUP /* Device disconnected. */ -# define POLL_HUP POLL_HUP -}; - -# undef __need_siginfo_t -#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */ - - -#if (defined _SIGNAL_H || defined __need_sigevent_t) \ - && !defined __have_sigevent_t -# define __have_sigevent_t 1 - -/* Structure to transport application-defined values with signals. */ -# define __SIGEV_MAX_SIZE 64 -# if __WORDSIZE == 64 -# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4) -# else -# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3) -# endif - -/* Forward declaration of the `pthread_attr_t' type. */ -struct __pthread_attr_s; - -typedef struct sigevent - { - sigval_t sigev_value; - int sigev_signo; - int sigev_notify; - - union - { - int _pad[__SIGEV_PAD_SIZE]; - - struct - { - void (*_function) (sigval_t); /* Function to start. */ - struct __pthread_attr_s *_attribute; /* Really pthread_attr_t. */ - } _sigev_thread; - } _sigev_un; - } sigevent_t; - -/* POSIX names to access some of the members. */ -# define sigev_notify_function _sigev_un._sigev_thread._function -# define sigev_notify_attributes _sigev_un._sigev_thread._attribute - -/* `sigev_notify' values. */ -enum -{ - SIGEV_SIGNAL = 0, /* Notify via signal. */ -# define SIGEV_SIGNAL SIGEV_SIGNAL - SIGEV_NONE, /* Other notification: meaningless. */ -# define SIGEV_NONE SIGEV_NONE - SIGEV_THREAD /* Deliver via thread creation. */ -# define SIGEV_THREAD SIGEV_THREAD -}; - -#endif /* have _SIGNAL_H. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/time.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/time.h deleted file mode 100644 index 752b0a03f1..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/time.h +++ /dev/null @@ -1,73 +0,0 @@ -/* System-dependent timing definitions. Linux/SPARC64 version. - Copyright (C) 1996, 1997, 1999, 2000, 2001 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - * Never include this file directly; use <time.h> instead. - */ - -#ifndef __need_timeval -# ifndef _BITS_TIME_H -# define _BITS_TIME_H 1 - -/* ISO/IEC 9899:1990 7.12.1: <time.h> - The macro `CLOCKS_PER_SEC' is the number per second of the value - returned by the `clock' function. */ -/* CAE XSH, Issue 4, Version 2: <time.h> - The value of CLOCKS_PER_SEC is required to be 1 million on all - XSI-conformant systems. */ -# define CLOCKS_PER_SEC 1000000l - -# if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K -/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK - presents the real value for clock ticks per second for the system. */ -# include <bits/types.h> -extern long int __sysconf (int); -# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */ -# endif - -# ifdef __USE_POSIX199309 -/* Identifier for system-wide realtime clock. */ -# define CLOCK_REALTIME 0 -/* High-resolution timer from the CPU. */ -# define CLOCK_PROCESS_CPUTIME_ID 2 -/* Thread-specific CPU-time clock. */ -# define CLOCK_THREAD_CPUTIME_ID 3 - -/* Flag to indicate time is absolute. */ -# define TIMER_ABSTIME 1 -# endif - -# endif /* bits/time.h */ -#endif - -#ifdef __need_timeval -# undef __need_timeval -# ifndef _STRUCT_TIMEVAL -# define _STRUCT_TIMEVAL 1 -# include <bits/types.h> - -/* A time value that is accurate to the nearest - microsecond but also has a range of years. */ -struct timeval - { - __time_t tv_sec; /* Seconds. */ - __suseconds_t tv_usec; /* Microseconds. */ - }; -# endif /* struct timeval */ -#endif /* need timeval */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c b/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c new file mode 100644 index 0000000000..c199163bc2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c @@ -0,0 +1,240 @@ +/* Get frequency of the system processor. sparc64 version. + Copyright (C) 2001 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <ctype.h> +#include <fcntl.h> +#include <string.h> +#include <unistd.h> +#include <dirent.h> +#include <stdlib.h> +#include <sys/ioctl.h> +#include <libc-internal.h> +#include <asm/openpromio.h> + +static hp_timing_t +__get_clockfreq_via_cpuinfo (void) +{ + hp_timing_t result; + int fd; + + result = 0; + + fd = open ("/proc/cpuinfo", O_RDONLY); + if (fd != -1) + { + char buf[8192]; + ssize_t n; + + n = read (fd, buf, sizeof buf); + if (n > 0) + { + char *mhz = memmem (buf, n, "Cpu0ClkTck", 7); + + if (mhz != NULL) + { + char *endp = buf + n; + + /* Search for the beginning of the string. */ + while (mhz < endp + && (*mhz < '0' || *mhz > '9') + && (*mhz < 'a' || *mhz > 'f') + && *mhz != '\n') + ++mhz; + + while (mhz < endp && *mhz != '\n') + { + if ((*mhz >= '0' && *mhz <= '9') || + (*mhz >= 'a' && *mhz <= 'f')) + { + result <<= 4; + if (*mhz >= '0' && *mhz <= '9') + result += *mhz - '0'; + else + result += (*mhz - 'a') + 10; + } + ++mhz; + } + } + } + + close (fd); + } + + return result; +} + +static hp_timing_t +__get_clockfreq_via_proc_openprom (void) +{ + hp_timing_t result; + int obp_fd; + + result = 0; + + obp_fd = open ("/proc/openprom", O_RDONLY); + if (obp_fd != -1) + { + unsigned long buf[4096 / sizeof (unsigned long)]; + struct dirent *dirp = (struct dirent *) buf; + off_t dbase = (off_t) 0; + int len; + + while ((len = getdirentries (obp_fd, (char *) dirp, + sizeof (buf), &dbase)) > 0) + { + struct dirent *this_dirp = dirp; + + while (len > 0) + { + char node_name[strlen ("/proc/openprom/") + + this_dirp->d_reclen + + strlen ("/clock-frequency")]; + int fd; + + strcpy (node_name, "/proc/openprom/"); + strcat (node_name, this_dirp->d_name); + strcat (node_name, "/device_type"); + fd = open (node_name, O_RDONLY); + if (fd != -1) + { + char type_string[128]; + int ret; + + ret = read (fd, type_string, sizeof (type_string)); + if (ret > 0 && !strncmp (type_string, "'cpu'", 5)) + { + int clkfreq_fd; + + strcpy (node_name, "/proc/openprom/"); + strcat (node_name, this_dirp->d_name); + strcat (node_name, "/clock-frequency"); + clkfreq_fd = open (node_name, O_RDONLY); + if (fd != -1) + { + if (read (clkfreq_fd, type_string, + sizeof (type_string)) > 0) + result = (hp_timing_t) + strtol (type_string, (char **)NULL, 16); + close (clkfreq_fd); + } + } + close (fd); + } + + if (result != 0) + break; + + len -= this_dirp->d_reclen; + this_dirp = (struct dirent *) + ((char *)this_dirp + this_dirp->d_reclen); + } + if (result != 0) + break; + } + close (obp_fd); + } + + return result; +} + +static hp_timing_t +__get_clockfreq_via_dev_openprom (void) +{ + hp_timing_t result; + int obp_dev_fd; + + result = 0; + + obp_dev_fd = open ("/dev/openprom", O_RDONLY); + if (obp_dev_fd != -1) + { + char obp_buf[8192]; + struct openpromio *obp_cmd = (struct openpromio *)obp_buf; + int ret; + + obp_cmd->oprom_size = + sizeof (obp_buf) - sizeof (unsigned int); + *(int *)obp_cmd->oprom_array = 0; + ret = ioctl (obp_dev_fd, OPROMCHILD, (char *) obp_cmd); + if (ret == 0) + { + int cur_node = *(int *)obp_cmd->oprom_array; + + while (cur_node != 0 && cur_node != -1) + { + obp_cmd->oprom_size = sizeof (obp_buf) - sizeof (unsigned int); + strcpy (obp_cmd->oprom_array, "device_type"); + ret = ioctl (obp_dev_fd, OPROMGETPROP, (char *) obp_cmd); + if (ret == 0 + && !strncmp (obp_cmd->oprom_array, "cpu", 3)) + { + obp_cmd->oprom_size = sizeof (obp_buf) - sizeof (unsigned int); + strcpy (obp_cmd->oprom_array, "clock-frequency"); + ret = ioctl (obp_dev_fd, OPROMGETPROP, (char *) obp_cmd); + if (ret == 0) + { + result = (hp_timing_t) + *(unsigned int *)obp_cmd->oprom_array; + } + } + obp_cmd->oprom_size = sizeof (obp_buf) - sizeof (unsigned int); + *(int *)obp_cmd->oprom_array = cur_node; + ret = ioctl (obp_dev_fd, OPROMNEXT, (char *) obp_cmd); + if (ret < 0) + break; + cur_node = *(int *)obp_cmd->oprom_array; + } + } + } + + return result; +} + +hp_timing_t +__get_clockfreq (void) +{ + static hp_timing_t result; + + /* If this function was called before, we know the result. */ + if (result != 0) + return result; + + /* We first read the information from the /proc/cpuinfo file. + It contains at least one line like + Cpu0ClkTick : 000000002cb41780 + We search for this line and convert the number in an integer. */ + + result = __get_clockfreq_via_cpuinfo (); + if (result != 0) + return result; + + /* If that did not work, try to find an OpenPROM node + with device_type equal to 'cpu' using /dev/openprom + and fetch the clock-frequency property from there. */ + + result = __get_clockfreq_via_dev_openprom (); + if (result != 0) + return result; + + /* Finally, try the same lookup as above but using /proc/openprom. */ + + result = __get_clockfreq_via_proc_openprom (); + + return result; +} diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S index 963aa6d89d..a0f9216531 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2001 Free Software Foundation, Inc. Contributed by Richard Henderson (rth@tamu.edu). The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ /* void longjmp (sigjmp_buf env, int val) */ -ENTRY(longjmp) +ENTRY(__libc_siglongjmp) /* Modify the context with the value we want to return. */ movre %o1, 1, %o1 @@ -41,10 +41,10 @@ ENTRY(longjmp) /* And bamf back to where we belong! */ ta 0x6f -END(longjmp) +END(__libc_siglongjmp) -strong_alias(longjmp, __longjmp) -strong_alias(longjmp, __libc_longjmp) -strong_alias(longjmp, __libc_siglongjmp) -weak_alias(longjmp, _longjmp) -weak_alias(longjmp, siglongjmp) +strong_alias(__libc_siglongjmp, __longjmp) +strong_alias(__libc_siglongjmp, __libc_longjmp) +weak_alias(__libc_siglongjmp, longjmp) +weak_alias(__libc_siglongjmp, _longjmp) +weak_alias(__libc_siglongjmp, siglongjmp) |