Refresh NDK C library headers for all platforms

This commit is contained in:
David 'Digit' Turner
2009-10-20 15:25:40 -07:00
parent 302e013b6a
commit 898b43fedc
11 changed files with 113 additions and 30 deletions

View File

@@ -1,10 +1,33 @@
/* $OpenBSD: endian.h,v 1.3 2005/12/13 00:35:23 millert Exp $ */ /*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _ENDIAN_H_
#define _ENDIAN_H_
#ifdef __ARMEB__
#define _BYTE_ORDER _BIG_ENDIAN
#else
#define _BYTE_ORDER _LITTLE_ENDIAN
#endif
#define __STRICT_ALIGNMENT
#include <sys/types.h>
#include <sys/endian.h> #include <sys/endian.h>
#endif /* _ENDIAN_H_ */

View File

@@ -46,13 +46,17 @@
# define __STDINT_MACROS # define __STDINT_MACROS
#endif #endif
#if !defined __STRICT_ANSI__ || __STDC_VERSION__ >= 199901L
# define __STDC_INT64__
#endif
typedef __int8_t int8_t; typedef __int8_t int8_t;
typedef __uint8_t uint8_t; typedef __uint8_t uint8_t;
typedef __int16_t int16_t; typedef __int16_t int16_t;
typedef __uint16_t uint16_t; typedef __uint16_t uint16_t;
typedef __int32_t int32_t; typedef __int32_t int32_t;
typedef __uint32_t uint32_t; typedef __uint32_t uint32_t;
#if !defined(__STRICT_ANSI__) #if defined(__STDC_INT64__)
typedef __int64_t int64_t; typedef __int64_t int64_t;
typedef __uint64_t uint64_t; typedef __uint64_t uint64_t;
#endif #endif
@@ -157,7 +161,7 @@ typedef uint32_t uint_fast32_t;
# define UINT_FAST32_C(c) UINT32_C(c) # define UINT_FAST32_C(c) UINT32_C(c)
#endif #endif
#if !defined(__STRICT_ANSI__) #if defined(__STDC_INT64__)
/* /*
* int64_t * int64_t
*/ */
@@ -198,7 +202,7 @@ typedef uint64_t uint_fast64_t;
# define __PRIFAST_RANK "" # define __PRIFAST_RANK ""
# define __PRIPTR_RANK "" # define __PRIPTR_RANK ""
#endif /* !__STRICT_ANSI__ */ #endif /* __STDC_INT64__ */
/* /*
* intptr_t & uintptr_t * intptr_t & uintptr_t
@@ -221,7 +225,7 @@ typedef unsigned int uintptr_t;
* intmax_t & uintmax_t * intmax_t & uintmax_t
*/ */
#if !defined(__STRICT_ANSI__) #if defined(__STDC_INT64__)
typedef uint64_t uintmax_t; typedef uint64_t uintmax_t;
typedef int64_t intmax_t; typedef int64_t intmax_t;
@@ -233,7 +237,7 @@ typedef int64_t intmax_t;
#define INTMAX_C(c) INT64_C(c) #define INTMAX_C(c) INT64_C(c)
#define UINTMAX_C(c) UINT64_C(c) #define UINTMAX_C(c) UINT64_C(c)
#else /* __STRICT_ANSI__ */ #else /* !__STDC_INT64__ */
typedef uint32_t uintmax_t; typedef uint32_t uintmax_t;
typedef int32_t intmax_t; typedef int32_t intmax_t;
@@ -245,7 +249,7 @@ typedef int32_t intmax_t;
#define INTMAX_C(c) INT32_C(c) #define INTMAX_C(c) INT32_C(c)
#define UINTMAX_C(c) UINT32_C(c) #define UINTMAX_C(c) UINT32_C(c)
#endif /* __STRICT_ANSI__ */ #endif /* !__STDC_INT64__ */
/* size_t is defined by the GCC-specific <stddef.h> */ /* size_t is defined by the GCC-specific <stddef.h> */

View File

@@ -39,6 +39,7 @@
#ifndef _STRINGS_H_ #ifndef _STRINGS_H_
#define _STRINGS_H_ #define _STRINGS_H_
#include <sys/types.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
__BEGIN_DECLS __BEGIN_DECLS

View File

@@ -71,6 +71,13 @@ struct stat {
unsigned long long st_ino; unsigned long long st_ino;
}; };
/* For compatibility with GLibc, we provide macro aliases
* for the non-Posix nano-seconds accessors.
*/
#define st_atimensec st_atime_nsec
#define st_mtimensec st_mtime_nsec
#define st_ctimensec st_ctime_nsec
extern int chmod(const char *, mode_t); extern int chmod(const char *, mode_t);
extern int fchmod(int, mode_t); extern int fchmod(int, mode_t);
extern int mkdir(const char *, mode_t); extern int mkdir(const char *, mode_t);

View File

@@ -82,6 +82,8 @@ extern size_t strftime(char *s, size_t max, const char *format, const struc
extern char *ctime(const time_t *timep); extern char *ctime(const time_t *timep);
extern char *ctime_r(const time_t *timep, char *buf); extern char *ctime_r(const time_t *timep, char *buf);
extern void tzset(void);
/* global includes */ /* global includes */
extern char* tzname[]; extern char* tzname[];
extern int daylight; extern int daylight;
@@ -89,7 +91,7 @@ extern long int timezone;
#define CLOCKS_PER_SEC 1000000 #define CLOCKS_PER_SEC 1000000
extern clock_t clock(); extern clock_t clock(void);
/* BIONIC: extra linux clock goodies */ /* BIONIC: extra linux clock goodies */
extern int clock_getres(int, struct timespec *); extern int clock_getres(int, struct timespec *);

View File

@@ -1,10 +1,33 @@
/* $OpenBSD: endian.h,v 1.3 2005/12/13 00:35:23 millert Exp $ */ /*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _ENDIAN_H_
#define _ENDIAN_H_
#ifdef __ARMEB__
#define _BYTE_ORDER _BIG_ENDIAN
#else
#define _BYTE_ORDER _LITTLE_ENDIAN
#endif
#define __STRICT_ALIGNMENT
#include <sys/types.h>
#include <sys/endian.h> #include <sys/endian.h>
#endif /* _ENDIAN_H_ */

View File

@@ -46,13 +46,17 @@
# define __STDINT_MACROS # define __STDINT_MACROS
#endif #endif
#if !defined __STRICT_ANSI__ || __STDC_VERSION__ >= 199901L
# define __STDC_INT64__
#endif
typedef __int8_t int8_t; typedef __int8_t int8_t;
typedef __uint8_t uint8_t; typedef __uint8_t uint8_t;
typedef __int16_t int16_t; typedef __int16_t int16_t;
typedef __uint16_t uint16_t; typedef __uint16_t uint16_t;
typedef __int32_t int32_t; typedef __int32_t int32_t;
typedef __uint32_t uint32_t; typedef __uint32_t uint32_t;
#if !defined(__STRICT_ANSI__) #if defined(__STDC_INT64__)
typedef __int64_t int64_t; typedef __int64_t int64_t;
typedef __uint64_t uint64_t; typedef __uint64_t uint64_t;
#endif #endif
@@ -157,7 +161,7 @@ typedef uint32_t uint_fast32_t;
# define UINT_FAST32_C(c) UINT32_C(c) # define UINT_FAST32_C(c) UINT32_C(c)
#endif #endif
#if !defined(__STRICT_ANSI__) #if defined(__STDC_INT64__)
/* /*
* int64_t * int64_t
*/ */
@@ -198,7 +202,7 @@ typedef uint64_t uint_fast64_t;
# define __PRIFAST_RANK "" # define __PRIFAST_RANK ""
# define __PRIPTR_RANK "" # define __PRIPTR_RANK ""
#endif /* !__STRICT_ANSI__ */ #endif /* __STDC_INT64__ */
/* /*
* intptr_t & uintptr_t * intptr_t & uintptr_t
@@ -221,7 +225,7 @@ typedef unsigned int uintptr_t;
* intmax_t & uintmax_t * intmax_t & uintmax_t
*/ */
#if !defined(__STRICT_ANSI__) #if defined(__STDC_INT64__)
typedef uint64_t uintmax_t; typedef uint64_t uintmax_t;
typedef int64_t intmax_t; typedef int64_t intmax_t;
@@ -233,7 +237,7 @@ typedef int64_t intmax_t;
#define INTMAX_C(c) INT64_C(c) #define INTMAX_C(c) INT64_C(c)
#define UINTMAX_C(c) UINT64_C(c) #define UINTMAX_C(c) UINT64_C(c)
#else /* __STRICT_ANSI__ */ #else /* !__STDC_INT64__ */
typedef uint32_t uintmax_t; typedef uint32_t uintmax_t;
typedef int32_t intmax_t; typedef int32_t intmax_t;
@@ -245,7 +249,7 @@ typedef int32_t intmax_t;
#define INTMAX_C(c) INT32_C(c) #define INTMAX_C(c) INT32_C(c)
#define UINTMAX_C(c) UINT32_C(c) #define UINTMAX_C(c) UINT32_C(c)
#endif /* __STRICT_ANSI__ */ #endif /* !__STDC_INT64__ */
/* size_t is defined by the GCC-specific <stddef.h> */ /* size_t is defined by the GCC-specific <stddef.h> */

View File

@@ -39,6 +39,7 @@
#ifndef _STRINGS_H_ #ifndef _STRINGS_H_
#define _STRINGS_H_ #define _STRINGS_H_
#include <sys/types.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
__BEGIN_DECLS __BEGIN_DECLS

View File

@@ -71,6 +71,13 @@ struct stat {
unsigned long long st_ino; unsigned long long st_ino;
}; };
/* For compatibility with GLibc, we provide macro aliases
* for the non-Posix nano-seconds accessors.
*/
#define st_atimensec st_atime_nsec
#define st_mtimensec st_mtime_nsec
#define st_ctimensec st_ctime_nsec
extern int chmod(const char *, mode_t); extern int chmod(const char *, mode_t);
extern int fchmod(int, mode_t); extern int fchmod(int, mode_t);
extern int mkdir(const char *, mode_t); extern int mkdir(const char *, mode_t);

View File

@@ -82,6 +82,8 @@ extern size_t strftime(char *s, size_t max, const char *format, const struc
extern char *ctime(const time_t *timep); extern char *ctime(const time_t *timep);
extern char *ctime_r(const time_t *timep, char *buf); extern char *ctime_r(const time_t *timep, char *buf);
extern void tzset(void);
/* global includes */ /* global includes */
extern char* tzname[]; extern char* tzname[];
extern int daylight; extern int daylight;
@@ -89,7 +91,7 @@ extern long int timezone;
#define CLOCKS_PER_SEC 1000000 #define CLOCKS_PER_SEC 1000000
extern clock_t clock(); extern clock_t clock(void);
/* BIONIC: extra linux clock goodies */ /* BIONIC: extra linux clock goodies */
extern int clock_getres(int, struct timespec *); extern int clock_getres(int, struct timespec *);

View File

@@ -36,6 +36,15 @@ OTHER FIXES & CHANGES:
- Remove bash-isms from build/tools/build-toolchain.sh. Now it's possible to - Remove bash-isms from build/tools/build-toolchain.sh. Now it's possible to
build it with the 'dash' shell on Debian-based systems (tested on Ubuntu 8.04) build it with the 'dash' shell on Debian-based systems (tested on Ubuntu 8.04)
- Refresh C library headers for all platforms:
- make <endian.h> simply include <sys/endian.h>
- make <stdint.h> properly declare 64-bit integer types with a C99 compiler
- add missing <sys/types.h> to <strings.h>
- add GLibc-compatible macro aliases (st_atimensec, st_mtimensec and
st_ctimensec) to <stat.h>
- add missing declaration for tzset() in <time.h>
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
android-ndk-1.6_r1 android-ndk-1.6_r1