summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/powerpc')
-rw-r--r--libc/sysdeps/linux/powerpc/bits/fcntl.h40
-rw-r--r--libc/sysdeps/linux/powerpc/bits/fenvinline.h8
-rw-r--r--libc/sysdeps/linux/powerpc/bits/ipc.h22
-rw-r--r--libc/sysdeps/linux/powerpc/bits/mathdef.h22
-rw-r--r--libc/sysdeps/linux/powerpc/bits/mathinline.h125
-rw-r--r--libc/sysdeps/linux/powerpc/bits/mman.h2
-rw-r--r--libc/sysdeps/linux/powerpc/bits/stat.h60
7 files changed, 228 insertions, 51 deletions
diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h
index 4e8b61a39..c2ed000af 100644
--- a/libc/sysdeps/linux/powerpc/bits/fcntl.h
+++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h
@@ -22,8 +22,11 @@
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
-
#include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
@@ -180,16 +183,45 @@ struct flock64
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif
-/* Linux-specific operations for posix_fadvise. */
+
#ifdef __USE_GNU
-# define LINUX_FADV_ASYNC_WRITE 32 /* Start writeout on range. */
-# define LINUX_FADV_WRITE_WAIT 33 /* Wait upon writeout to range. */
+# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
+ in the range before performing the
+ write. */
+# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
+ dirty pages in the range which are
+ not presently under writeback. */
+# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
+ the range after performing the
+ write. */
#endif
__BEGIN_DECLS
+#if 0 /*def __USE_GNU*/
+
/* Provide kernel hint to read ahead. */
extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
__THROW;
+
+/* Selective file content synch'ing. */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+ unsigned int __flags);
+
+
+/* Splice address range into a pipe. */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+ unsigned int __flags);
+
+/* Splice two files together. */
+extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+ __THROW;
+
+/* In-kernel implementation of tee for pipe buffers. */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+ __THROW;
+
+#endif
+
__END_DECLS
diff --git a/libc/sysdeps/linux/powerpc/bits/fenvinline.h b/libc/sysdeps/linux/powerpc/bits/fenvinline.h
index 552c8c9db..f7700a49e 100644
--- a/libc/sysdeps/linux/powerpc/bits/fenvinline.h
+++ b/libc/sysdeps/linux/powerpc/bits/fenvinline.h
@@ -1,5 +1,6 @@
/* Inline floating-point environment handling functions for powerpc.
- Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2006
+ 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
@@ -22,8 +23,9 @@
/* Inline definition for fegetround. */
# define fegetround() \
(__extension__ ({ int __fegetround_result; \
- __asm__ ("mcrfs 7,7 ; mfcr %0" \
- : "=r"(__fegetround_result) : : "cr7"); \
+ __asm__ __volatile__ \
+ ("mcrfs 7,7 ; mfcr %0" \
+ : "=r"(__fegetround_result) : : "cr7"); \
__fegetround_result & 3; }))
/* The weird 'i#*X' constraints on the following suppress a gcc
diff --git a/libc/sysdeps/linux/powerpc/bits/ipc.h b/libc/sysdeps/linux/powerpc/bits/ipc.h
index 3cb593a61..4f45aca36 100644
--- a/libc/sysdeps/linux/powerpc/bits/ipc.h
+++ b/libc/sysdeps/linux/powerpc/bits/ipc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2002 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
@@ -38,17 +38,25 @@
/* Special key values. */
#define IPC_PRIVATE ((__key_t) 0) /* Private key. */
+
/* Data structure used to pass permission information to IPC operations. */
struct ipc_perm
{
- __key_t __key; /* Key. */
- __uid_t uid; /* Owner's user ID. */
- __gid_t gid; /* Owner's group ID. */
- __uid_t cuid; /* Creator's user ID. */
- __gid_t cgid; /* Creator's group ID. */
- __mode_t mode; /* Read/write permission. */
+ __key_t __key; /* Key. */
+ __uid_t uid; /* Owner's user ID. */
+ __gid_t gid; /* Owner's group ID. */
+ __uid_t cuid; /* Creator's user ID. */
+ __gid_t cgid; /* Creator's group ID. */
+ __mode_t mode; /* Read/write permission. */
+#if 0
unsigned long __seq; /* Sequence number. */
unsigned int __pad2;
unsigned long long int __unused1;
unsigned long long int __unused2;
+#else
+ __uint32_t __seq; /* Sequence number. */
+ __uint32_t __pad1;
+ __uint64_t __unused1;
+ __uint64_t __unused2;
+#endif
};
diff --git a/libc/sysdeps/linux/powerpc/bits/mathdef.h b/libc/sysdeps/linux/powerpc/bits/mathdef.h
index 5eaf41ea6..a076fb6d7 100644
--- a/libc/sysdeps/linux/powerpc/bits/mathdef.h
+++ b/libc/sysdeps/linux/powerpc/bits/mathdef.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2003,2004,2006
+ 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
@@ -39,12 +40,6 @@ typedef float float_t; /* `float' expressions are evaluated as
typedef double double_t; /* `double' expressions are evaluated as
`double'. */
-/* Signal that types stay as they were declared. */
-# define FLT_EVAL_METHOD 0
-
-/* Define `INFINITY' as value of type `float'. */
-# define INFINITY HUGE_VALF
-
# else
/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
@@ -53,9 +48,6 @@ typedef double float_t; /* `float' expressions are evaluated as
typedef double double_t; /* `double' expressions are evaluated as
`double'. */
-/* Define `INFINITY' as value of type `float'. */
-# define INFINITY HUGE_VALF
-
# endif
# else
@@ -63,9 +55,6 @@ typedef double double_t; /* `double' expressions are evaluated as
typedef double float_t;
typedef double double_t;
-/* Define `INFINITY' as value of type `float'. */
-# define INFINITY HUGE_VALF
-
# endif
/* The values returned by `ilogb' for 0 and NaN respectively. */
@@ -75,7 +64,12 @@ typedef double double_t;
#endif /* ISO C99 */
#ifndef __NO_LONG_DOUBLE_MATH
+#include <bits/wordsize.h>
/* Signal that we do not really have a `long double'. The disables the
declaration of all the `long double' function variants. */
-# define __NO_LONG_DOUBLE_MATH 1
+# if __WORDSIZE == 32
+# define __NO_LONG_DOUBLE_MATH 1
+# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
+# define __NO_LONG_DOUBLE_MATH 1
+# endif
#endif
diff --git a/libc/sysdeps/linux/powerpc/bits/mathinline.h b/libc/sysdeps/linux/powerpc/bits/mathinline.h
index 76f68c1a1..87985a744 100644
--- a/libc/sysdeps/linux/powerpc/bits/mathinline.h
+++ b/libc/sysdeps/linux/powerpc/bits/mathinline.h
@@ -1,5 +1,6 @@
/* Inline math functions for powerpc.
- Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006
+ 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
@@ -17,20 +18,20 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#if defined __GNUC__ && !defined _SOFT_FLOAT
-
-#ifdef __USE_ISOC99
-# if __GNUC_PREREQ (2,96)
+#ifndef _MATH_H
+# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
+#endif
-# define isgreater(x, y) __builtin_isgreater (x, y)
-# define isgreaterequal(x, y) __builtin_isgreaterequal (x, y)
-# define isless(x, y) __builtin_isless (x, y)
-# define islessequal(x, y) __builtin_islessequal (x, y)
-# define islessgreater(x, y) __builtin_islessgreater (x, y)
-# define isunordered(x, y) __builtin_isunordered (x, y)
+#ifdef __cplusplus
+# define __MATH_INLINE __inline
+#else
+# define __MATH_INLINE extern __inline
+#endif /* __cplusplus */
-# else
+#if defined __GNUC__ && !defined _SOFT_FLOAT
+#ifdef __USE_ISOC99
+# if !__GNUC_PREREQ (2,97)
# define __unordered_cmp(x, y) \
(__extension__ \
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
@@ -39,6 +40,13 @@
: "cr7"); \
__r; }))
+# undef isgreater
+# undef isgreaterequal
+# undef isless
+# undef islessequal
+# undef islessgreater
+# undef isunordered
+
# define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1)
# define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0)
# define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1)
@@ -47,24 +55,38 @@
# define isunordered(x, y) (__unordered_cmp (x, y) & 1)
# endif /* __GNUC_PREREQ (2,97) */
+
+/* The gcc, version 2.7 or below, has problems with all this inlining
+ code. So disable it for this version of the compiler. */
+# if __GNUC_PREREQ (2, 8)
+/* Test for negative number. Used in the signbit() macro. */
+__MATH_INLINE int
+__NTH (__signbitf (float __x))
+{
+ __extension__ union { float __f; int __i; } __u = { __f: __x };
+ return __u.__i < 0;
+}
+__MATH_INLINE int
+__NTH (__signbit (double __x))
+{
+ __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
+ return __u.__i[0] < 0;
+}
+# endif
#endif /* __USE_ISOC99 */
#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
-#ifdef __cplusplus
-# define __MATH_INLINE __inline
-#else
-# define __MATH_INLINE extern __inline
-#endif /* __cplusplus */
-
#ifdef __USE_ISOC99
+
+# ifndef __powerpc64__
__MATH_INLINE long int lrint (double __x) __THROW;
__MATH_INLINE long int
__NTH (lrint (double __x))
{
union {
double __d;
- long int __ll[2];
+ int __ll[2];
} __u;
__asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
return __u.__ll[1];
@@ -76,26 +98,85 @@ __NTH (lrintf (float __x))
{
union {
double __d;
- long int __ll[2];
+ int __ll[2];
} __u;
__asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
return __u.__ll[1];
}
+# endif
__MATH_INLINE double fdim (double __x, double __y) __THROW;
__MATH_INLINE double
__NTH (fdim (double __x, double __y))
{
- return __x < __y ? 0 : __x - __y;
+ return __x <= __y ? 0 : __x - __y;
}
__MATH_INLINE float fdimf (float __x, float __y) __THROW;
__MATH_INLINE float
__NTH (fdimf (float __x, float __y))
{
- return __x < __y ? 0 : __x - __y;
+ return __x <= __y ? 0 : __x - __y;
}
#endif /* __USE_ISOC99 */
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
+
+/* This code is used internally in the GNU libc. */
+#if 0 /*def __LIBC_INTERNAL_MATH_INLINES*/
+
+#include <sysdep.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+# if __WORDSIZE == 64 || defined _ARCH_PWR4
+# define __CPU_HAS_FSQRT 1
+# else
+# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
+# endif
+
+extern double __slow_ieee754_sqrt (double);
+__MATH_INLINE double
+__NTH (__ieee754_sqrt (double __x))
+{
+ double __z;
+
+ /* If the CPU is 64-bit we can use the optional FP instructions. */
+ if (__CPU_HAS_FSQRT)
+ {
+ /* Volatile is required to prevent the compiler from moving the
+ fsqrt instruction above the branch. */
+ __asm __volatile (
+ " fsqrt %0,%1\n"
+ : "=f" (__z)
+ : "f" (__x));
+ }
+ else
+ __z = __slow_ieee754_sqrt(__x);
+
+ return __z;
+}
+
+extern float __slow_ieee754_sqrtf (float);
+__MATH_INLINE float
+__NTH (__ieee754_sqrtf (float __x))
+{
+ float __z;
+
+ /* If the CPU is 64-bit we can use the optional FP instructions. */
+ if (__CPU_HAS_FSQRT)
+ {
+ /* Volatile is required to prevent the compiler from moving the
+ fsqrts instruction above the branch. */
+ __asm __volatile (
+ " fsqrts %0,%1\n"
+ : "=f" (__z)
+ : "f" (__x));
+ }
+ else
+ __z = __slow_ieee754_sqrtf(__x);
+
+ return __z;
+}
+#endif /* __LIBC_INTERNAL_MATH_INLINES */
#endif /* __GNUC__ && !_SOFT_FLOAT */
diff --git a/libc/sysdeps/linux/powerpc/bits/mman.h b/libc/sysdeps/linux/powerpc/bits/mman.h
index 580e93886..e03ab7ff8 100644
--- a/libc/sysdeps/linux/powerpc/bits/mman.h
+++ b/libc/sysdeps/linux/powerpc/bits/mman.h
@@ -89,7 +89,7 @@
# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
# define MADV_WILLNEED 3 /* Will need these pages. */
# define MADV_DONTNEED 4 /* Don't need these pages. */
-# define MADV_REMOVE 5 /* Remove these pages and resources. */
+# define MADV_REMOVE 9 /* Remove these pages and resources. */
# define MADV_DONTFORK 10 /* Do not inherit across fork. */
# define MADV_DOFORK 11 /* Do inherit across fork. */
#endif
diff --git a/libc/sysdeps/linux/powerpc/bits/stat.h b/libc/sysdeps/linux/powerpc/bits/stat.h
index af71f275e..f4a8de14b 100644
--- a/libc/sysdeps/linux/powerpc/bits/stat.h
+++ b/libc/sysdeps/linux/powerpc/bits/stat.h
@@ -69,12 +69,27 @@ struct stat
# else
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
# endif
+#if 0 /*def __USE_MISC*/
+ /* Nanosecond resolution timestamps are stored in a format
+ equivalent to 'struct timespec'. This is the type used
+ whenever possible but the Unix namespace rules do not allow the
+ identifier 'timespec' to appear in the <sys/stat.h> header.
+ Therefore we have to handle the use of this header in strictly
+ standard-compliant sources special. */
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+# define st_atime st_atim.tv_sec /* Backward compatibility. */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
+#endif
unsigned long int __unused4;
unsigned long int __unused5;
};
@@ -94,12 +109,27 @@ struct stat64
__off64_t st_size; /* Size of file, in bytes. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+#if 0 /*def __USE_MISC*/
+ /* Nanosecond resolution timestamps are stored in a format
+ equivalent to 'struct timespec'. This is the type used
+ whenever possible but the Unix namespace rules do not allow the
+ identifier 'timespec' to appear in the <sys/stat.h> header.
+ Therefore we have to handle the use of this header in strictly
+ standard-compliant sources special. */
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+# define st_atime st_atim.tv_sec /* Backward compatibility. */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
+#endif
unsigned long int __unused4;
unsigned long int __unused5;
};
@@ -133,12 +163,27 @@ struct stat
# else
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
# endif
+#if 0 /*def __USE_MISC*/
+ /* Nanosecond resolution timestamps are stored in a format
+ equivalent to 'struct timespec'. This is the type used
+ whenever possible but the Unix namespace rules do not allow the
+ identifier 'timespec' to appear in the <sys/stat.h> header.
+ Therefore we have to handle the use of this header in strictly
+ standard-compliant sources special. */
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+# define st_atime st_atim.tv_sec /* Backward compatibility. */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
+#endif
unsigned long int __unused4;
unsigned long int __unused5;
unsigned long int __unused6;
@@ -158,12 +203,27 @@ struct stat64
__off64_t st_size; /* Size of file, in bytes. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+#if 0 /*def __USE_MISC*/
+ /* Nanosecond resolution timestamps are stored in a format
+ equivalent to 'struct timespec'. This is the type used
+ whenever possible but the Unix namespace rules do not allow the
+ identifier 'timespec' to appear in the <sys/stat.h> header.
+ Therefore we have to handle the use of this header in strictly
+ standard-compliant sources special. */
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+# define st_atime st_atim.tv_sec /* Backward compatibility. */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
+#endif
unsigned long int __unused4;
unsigned long int __unused5;
unsigned long int __unused6;