Initial Contribution

This commit is contained in:
The Android Open Source Project
2008-10-21 07:00:00 -07:00
commit a27d2baa0c
1777 changed files with 163452 additions and 0 deletions

34
libc/include/alloca.h Normal file
View File

@@ -0,0 +1,34 @@
/*
* 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 _ALLOCA_H
#define _ALLOCA_H
#define alloca(size) __builtin_alloca(size)
#endif /* _ALLOCA_H */

55
libc/include/arpa/inet.h Normal file
View File

@@ -0,0 +1,55 @@
/*
* 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 _ARPA_INET_H_
#define _ARPA_INET_H_
#include <stdint.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/in6.h>
__BEGIN_DECLS
typedef uint32_t in_addr_t;
extern uint32_t inet_addr(const char *);
extern int inet_aton(const char *, struct in_addr *);
extern char* inet_ntoa(struct in_addr);
extern int inet_pton(int, const char *, void *);
extern const char* inet_ntop(int, const void *, char *, size_t);
extern unsigned int inet_nsap_addr(const char *, unsigned char *, int);
extern char* inet_nsap_ntoa(int, const unsigned char *, char *);
__END_DECLS
#endif /* _ARPA_INET_H_ */

View File

@@ -0,0 +1,41 @@
/*
* 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 _arpa_nameser_h
#define _arpa_nameser_h
#include <sys/types.h>
#include <sys/cdefs.h>
/* this header intentionally blank
*
* the definitions normally found in <arpa/nameser.h> are
* really a bunch of resolver's internal declarations that
* should not be exposed to client code in any way
*/
#endif /* _arpa_nameser_h */

65
libc/include/assert.h Normal file
View File

@@ -0,0 +1,65 @@
/* $OpenBSD: assert.h,v 1.12 2006/01/31 10:53:51 hshoexer Exp $ */
/* $NetBSD: assert.h,v 1.6 1994/10/26 00:55:44 cgd Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)assert.h 8.2 (Berkeley) 1/21/94
*/
/*
* Unlike other ANSI header files, <assert.h> may usefully be included
* multiple times, with and without NDEBUG defined.
*/
#include <sys/cdefs.h>
#undef assert
#undef _assert
#ifdef NDEBUG
# define assert(e) ((void)0)
# define _assert(e) ((void)0)
#else
# define _assert(e) assert(e)
# if __ISO_C_VISIBLE >= 1999
# define assert(e) ((e) ? (void)0 : __assert2(__FILE__, __LINE__, __func__, #e))
# else
# define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e))
# endif
#endif
__BEGIN_DECLS
__dead void __assert(const char *, int, const char *);
__dead void __assert2(const char *, int, const char *, const char *);
__END_DECLS

37
libc/include/byteswap.h Normal file
View File

@@ -0,0 +1,37 @@
/*
* 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 _BYTESWAP_H_
#define _BYTESWAP_H_
#include <sys/endian.h>
#define bswap_16(x) swap16(x)
#define bswap_32(x) swap32(x)
#define bswap_64(x) swap64(x)
#endif /* _BYTESWAP_H_ */

203
libc/include/ctype.h Normal file
View File

@@ -0,0 +1,203 @@
/* $OpenBSD: ctype.h,v 1.19 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)ctype.h 5.3 (Berkeley) 4/3/91
*/
#ifndef _CTYPE_H_
#define _CTYPE_H_
#include <sys/cdefs.h>
#define _U 0x01
#define _L 0x02
#define _N 0x04
#define _S 0x08
#define _P 0x10
#define _C 0x20
#define _X 0x40
#define _B 0x80
__BEGIN_DECLS
extern const char *_ctype_;
extern const short *_tolower_tab_;
extern const short *_toupper_tab_;
/* extern __inline is a GNU C extension */
#ifdef __GNUC__
#define __CTYPE_INLINE extern __inline
#else
#define __CTYPE_INLINE static __inline
#endif
#if defined(__GNUC__) || defined(_ANSI_LIBRARY) || defined(lint)
int isalnum(int);
int isalpha(int);
int iscntrl(int);
int isdigit(int);
int isgraph(int);
int islower(int);
int isprint(int);
int ispunct(int);
int isspace(int);
int isupper(int);
int isxdigit(int);
int tolower(int);
int toupper(int);
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \
|| __XPG_VISIBLE > 600
int isblank(int);
#endif
#if __BSD_VISIBLE || __XPG_VISIBLE
int isascii(int);
int toascii(int);
int _tolower(int);
int _toupper(int);
#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
#endif /* __GNUC__ || _ANSI_LIBRARY || lint */
#if defined(NDEBUG)
__CTYPE_INLINE int isalnum(int c)
{
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L|_N)));
}
__CTYPE_INLINE int isalpha(int c)
{
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L)));
}
__CTYPE_INLINE int iscntrl(int c)
{
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _C));
}
__CTYPE_INLINE int isdigit(int c)
{
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _N));
}
__CTYPE_INLINE int isgraph(int c)
{
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N)));
}
__CTYPE_INLINE int islower(int c)
{
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _L));
}
__CTYPE_INLINE int isprint(int c)
{
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N|_B)));
}
__CTYPE_INLINE int ispunct(int c)
{
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _P));
}
__CTYPE_INLINE int isspace(int c)
{
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _S));
}
__CTYPE_INLINE int isupper(int c)
{
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _U));
}
__CTYPE_INLINE int isxdigit(int c)
{
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_N|_X)));
}
__CTYPE_INLINE int tolower(int c)
{
if ((unsigned int)c > 255)
return (c);
return ((_tolower_tab_ + 1)[c]);
}
__CTYPE_INLINE int toupper(int c)
{
if ((unsigned int)c > 255)
return (c);
return ((_toupper_tab_ + 1)[c]);
}
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \
|| __XPG_VISIBLE > 600
__CTYPE_INLINE int isblank(int c)
{
return (c == ' ' || c == '\t');
}
#endif
#if __BSD_VISIBLE || __XPG_VISIBLE
__CTYPE_INLINE int isascii(int c)
{
return ((unsigned int)c <= 0177);
}
__CTYPE_INLINE int toascii(int c)
{
return (c & 0177);
}
__CTYPE_INLINE int _tolower(int c)
{
return (c - 'A' + 'a');
}
__CTYPE_INLINE int _toupper(int c)
{
return (c - 'a' + 'A');
}
#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
#endif /* NDEBUG */
__END_DECLS
#undef __CTYPE_INLINE
#endif /* !_CTYPE_H_ */

74
libc/include/dirent.h Normal file
View File

@@ -0,0 +1,74 @@
/*
* 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 _DIRENT_H_
#define _DIRENT_H_
#include <stdint.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifndef DT_UNKNOWN
#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LNK 10
#define DT_SOCK 12
#define DT_WHT 14
#endif
/* the following structure is really called dirent64 by the kernel
* headers. They also define a struct dirent, but the latter lack
* the d_type field which is required by some libraries (e.g. hotplug)
* who assume to be able to access it directly. sad...
*/
struct dirent {
uint64_t d_ino;
int64_t d_off;
unsigned short d_reclen;
unsigned char d_type;
char d_name[256];
};
typedef struct DIR DIR;
extern int getdents(unsigned int, struct dirent*, unsigned int);
extern DIR* opendir(const char* dirpath);
extern DIR* fdopendir(int fd);
extern struct dirent* readdir(DIR* dirp);
extern int readdir_r(DIR* dirp, struct dirent *entry, struct dirent **result);
extern int closedir(DIR* dirp);
extern void rewinddir(DIR *dirp);
extern int dirfd(DIR* dirp);
__END_DECLS
#endif /* _DIRENT_H_ */

55
libc/include/dlfcn.h Normal file
View File

@@ -0,0 +1,55 @@
/*
* 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 __DLFCN_H__
#define __DLFCN_H__
#include <sys/cdefs.h>
__BEGIN_DECLS
extern void* dlopen(const char* filename, int flag);
extern int dlclose(void* handle);
extern const char* dlerror(void);
extern void* dlsym(void* handle, const char* symbol);
enum {
RTLD_NOW = 0,
RTLD_LAZY = 1,
RTLD_LOCAL = 0,
RTLD_GLOBAL = 2,
};
#define RTLD_DEFAULT ((void*) 0xffffffff)
#define RTLD_NEXT ((void*) 0xfffffffe)
__END_DECLS
#endif /* __DLFCN_H */

58
libc/include/elf.h Normal file
View File

@@ -0,0 +1,58 @@
/*
* 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 _ELF_H
#define _ELF_H
/* these definitions are missing from the BSD sources */
enum {
AT_NULL = 0,
AT_IGNORE,
AT_EXECFD,
AT_PHDR,
AT_PHENT,
AT_PHNUM,
AT_PAGESZ,
AT_BASE,
AT_FLAGS,
AT_ENTRY,
AT_NOTELF,
AT_UID,
AT_EUID,
AT_GID,
AT_EGID,
AT_PLATFORM,
AT_HWCAP,
AT_CLKTCK,
AT_SECURE = 23
};
#include <sys/exec_elf.h>
#endif /* _ELF_H */

33
libc/include/endian.h Normal file
View File

@@ -0,0 +1,33 @@
/*
* 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_
#include <sys/endian.h>
#endif /* _ENDIAN_H_ */

0
libc/include/err.h Normal file
View File

55
libc/include/errno.h Normal file
View File

@@ -0,0 +1,55 @@
/*
* 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 _ERRNO_H
#define _ERRNO_H
#include <sys/cdefs.h>
#include <linux/errno.h>
__BEGIN_DECLS
/* on Linux, ENOTSUP and EOPNOTSUPP are defined as the same error code
* even if 1000.3 states that they should be different
*/
#ifndef ENOTUP
#define ENOTSUP EOPNOTSUPP
#endif
/* internal function that should *only* be called from system calls */
/* use errno = xxxx instead in C code */
extern int __set_errno(int error);
/* internal function returning the address of the thread-specific errno */
extern volatile int* __errno(void);
/* a macro expanding to the errno l-value */
#define errno (*__errno())
__END_DECLS
#endif /* _ERRNO_H */

50
libc/include/fcntl.h Normal file
View File

@@ -0,0 +1,50 @@
/*
* 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 _FCNTL_H
#define _FCNTL_H
#include <sys/cdefs.h>
#include <sys/types.h>
#include <linux/fcntl.h>
#include <unistd.h> /* this is not required, but makes client code much happier */
__BEGIN_DECLS
#ifndef O_ASYNC
#define O_ASYNC FASYNC
#endif
extern int open(const char* path, int mode, ...);
extern int openat(int fd, const char* path, int mode, ...);
extern int unlinkat(int dirfd, const char *pathname, int flags);
extern int fcntl(int fd, int command, ...);
extern int creat(const char* path, mode_t mode);
__END_DECLS
#endif /* _FCNTL_H */

52
libc/include/fnmatch.h Normal file
View File

@@ -0,0 +1,52 @@
/*
* 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 _FNMATCH_H
#define _FNMATCH_H
#include <sys/cdefs.h>
__BEGIN_DECLS
#define FNM_NOMATCH 1 /* Match failed. */
#define FNM_NOSYS 2 /* Function not supported (unused). */
#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
#define FNM_PERIOD 0x04 /* Period must be matched by period. */
#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
#define FNM_IGNORECASE FNM_CASEFOLD
#define FNM_FILE_NAME FNM_PATHNAME
extern int fnmatch(const char *pattern, const char *string, int flags);
__END_DECLS
#endif /* _FNMATCH_H */

85
libc/include/getopt.h Normal file
View File

@@ -0,0 +1,85 @@
/* $OpenBSD: getopt.h,v 1.1 2002/12/03 20:24:29 millert Exp $ */
/* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Dieter Baron and Thomas Klausner.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _GETOPT_H_
#define _GETOPT_H_
#include <sys/cdefs.h>
/*
* GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions
*/
#define no_argument 0
#define required_argument 1
#define optional_argument 2
struct option {
/* name of long option */
const char *name;
/*
* one of no_argument, required_argument, and optional_argument:
* whether option takes an argument
*/
int has_arg;
/* if not NULL, set *flag to val when option found */
int *flag;
/* if flag not NULL, value to set *flag to; else return value */
int val;
};
__BEGIN_DECLS
int getopt_long(int, char * const *, const char *,
const struct option *, int *);
int getopt_long_only(int, char * const *, const char *,
const struct option *, int *);
#ifndef _GETOPT_DEFINED_
#define _GETOPT_DEFINED_
int getopt(int, char * const *, const char *);
int getsubopt(char **, char * const *, char **);
extern char *optarg; /* getopt(3) external variables */
extern int opterr;
extern int optind;
extern int optopt;
extern int optreset;
extern char *suboptarg; /* getsubopt(3) external variable */
#endif
__END_DECLS
#endif /* !_GETOPT_H_ */

79
libc/include/grp.h Normal file
View File

@@ -0,0 +1,79 @@
/* $OpenBSD: grp.h,v 1.8 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: grp.h,v 1.7 1995/04/29 05:30:40 cgd Exp $ */
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)grp.h 8.2 (Berkeley) 1/21/94
*/
#ifndef _GRP_H_
#define _GRP_H_
#include <sys/cdefs.h>
#include <sys/types.h>
#if __BSD_VISIBLE
#define _PATH_GROUP "/etc/group"
#endif
struct group {
char *gr_name; /* group name */
char *gr_passwd; /* group password */
gid_t gr_gid; /* group id */
char **gr_mem; /* group members */
};
__BEGIN_DECLS
struct group *getgrgid(gid_t);
struct group *getgrnam(const char *);
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE
struct group *getgrent(void);
void setgrent(void);
void endgrent(void);
int getgrgid_r(gid_t, struct group *, char *,
size_t, struct group **);
int getgrnam_r(const char *, struct group *, char *,
size_t, struct group **);
#endif
#if __BSD_VISIBLE
void setgrfile(const char *);
int setgroupent(int);
char *group_from_gid(gid_t, int);
#endif
int getgrouplist (const char *user, gid_t group,
gid_t *groups, int *ngroups);
__END_DECLS
#endif /* !_GRP_H_ */

258
libc/include/inttypes.h Normal file
View File

@@ -0,0 +1,258 @@
/* $OpenBSD: inttypes.h,v 1.9 2006/01/15 00:47:51 millert Exp $ */
/*
* Copyright (c) 1997, 2005 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _INTTYPES_H_
#define _INTTYPES_H_
#include <stdint.h>
#include <sys/cdefs.h>
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
/*
* 7.8.1 Macros for format specifiers
*
* Each of the following object-like macros expands to a string
* literal containing a conversion specifier, possibly modified by
* a prefix such as hh, h, l, or ll, suitable for use within the
* format argument of a formatted input/output function when
* converting the corresponding integer type. These macro names
* have the general form of PRI (character string literals for the
* fprintf family) or SCN (character string literals for the fscanf
* family), followed by the conversion specifier, followed by a
* name corresponding to a similar typedef name. For example,
* PRIdFAST32 can be used in a format string to print the value of
* an integer of type int_fast32_t.
*/
/* fprintf macros for signed integers */
#define PRId8 "d" /* int8_t */
#define PRId16 "d" /* int16_t */
#define PRId32 "d" /* int32_t */
#define PRId64 "lld" /* int64_t */
#define PRIdLEAST8 "d" /* int_least8_t */
#define PRIdLEAST16 "d" /* int_least16_t */
#define PRIdLEAST32 "d" /* int_least32_t */
#define PRIdLEAST64 "lld" /* int_least64_t */
#define PRIdFAST8 "d" /* int_fast8_t */
#define PRIdFAST16 "d" /* int_fast16_t */
#define PRIdFAST32 "d" /* int_fast32_t */
#define PRIdFAST64 "lld" /* int_fast64_t */
#define PRIdMAX "jd" /* intmax_t */
#define PRIdPTR "ld" /* intptr_t */
#define PRIi8 "i" /* int8_t */
#define PRIi16 "i" /* int16_t */
#define PRIi32 "i" /* int32_t */
#define PRIi64 "lli" /* int64_t */
#define PRIiLEAST8 "i" /* int_least8_t */
#define PRIiLEAST16 "i" /* int_least16_t */
#define PRIiLEAST32 "i" /* int_least32_t */
#define PRIiLEAST64 "lli" /* int_least64_t */
#define PRIiFAST8 "i" /* int_fast8_t */
#define PRIiFAST16 "i" /* int_fast16_t */
#define PRIiFAST32 "i" /* int_fast32_t */
#define PRIiFAST64 "lli" /* int_fast64_t */
#define PRIiMAX "ji" /* intmax_t */
#define PRIiPTR "li" /* intptr_t */
/* fprintf macros for unsigned integers */
#define PRIo8 "o" /* int8_t */
#define PRIo16 "o" /* int16_t */
#define PRIo32 "o" /* int32_t */
#define PRIo64 "llo" /* int64_t */
#define PRIoLEAST8 "o" /* int_least8_t */
#define PRIoLEAST16 "o" /* int_least16_t */
#define PRIoLEAST32 "o" /* int_least32_t */
#define PRIoLEAST64 "llo" /* int_least64_t */
#define PRIoFAST8 "o" /* int_fast8_t */
#define PRIoFAST16 "o" /* int_fast16_t */
#define PRIoFAST32 "o" /* int_fast32_t */
#define PRIoFAST64 "llo" /* int_fast64_t */
#define PRIoMAX "jo" /* intmax_t */
#define PRIoPTR "lo" /* intptr_t */
#define PRIu8 "u" /* uint8_t */
#define PRIu16 "u" /* uint16_t */
#define PRIu32 "u" /* uint32_t */
#define PRIu64 "llu" /* uint64_t */
#define PRIuLEAST8 "u" /* uint_least8_t */
#define PRIuLEAST16 "u" /* uint_least16_t */
#define PRIuLEAST32 "u" /* uint_least32_t */
#define PRIuLEAST64 "llu" /* uint_least64_t */
#define PRIuFAST8 "u" /* uint_fast8_t */
#define PRIuFAST16 "u" /* uint_fast16_t */
#define PRIuFAST32 "u" /* uint_fast32_t */
#define PRIuFAST64 "llu" /* uint_fast64_t */
#define PRIuMAX "ju" /* uintmax_t */
#define PRIuPTR "lu" /* uintptr_t */
#define PRIx8 "x" /* uint8_t */
#define PRIx16 "x" /* uint16_t */
#define PRIx32 "x" /* uint32_t */
#define PRIx64 "llx" /* uint64_t */
#define PRIxLEAST8 "x" /* uint_least8_t */
#define PRIxLEAST16 "x" /* uint_least16_t */
#define PRIxLEAST32 "x" /* uint_least32_t */
#define PRIxLEAST64 "llx" /* uint_least64_t */
#define PRIxFAST8 "x" /* uint_fast8_t */
#define PRIxFAST16 "x" /* uint_fast16_t */
#define PRIxFAST32 "x" /* uint_fast32_t */
#define PRIxFAST64 "llx" /* uint_fast64_t */
#define PRIxMAX "jx" /* uintmax_t */
#define PRIxPTR "lx" /* uintptr_t */
#define PRIX8 "X" /* uint8_t */
#define PRIX16 "X" /* uint16_t */
#define PRIX32 "X" /* uint32_t */
#define PRIX64 "llX" /* uint64_t */
#define PRIXLEAST8 "X" /* uint_least8_t */
#define PRIXLEAST16 "X" /* uint_least16_t */
#define PRIXLEAST32 "X" /* uint_least32_t */
#define PRIXLEAST64 "llX" /* uint_least64_t */
#define PRIXFAST8 "X" /* uint_fast8_t */
#define PRIXFAST16 "X" /* uint_fast16_t */
#define PRIXFAST32 "X" /* uint_fast32_t */
#define PRIXFAST64 "llX" /* uint_fast64_t */
#define PRIXMAX "jX" /* uintmax_t */
#define PRIXPTR "lX" /* uintptr_t */
/* fscanf macros for signed integers */
#define SCNd8 "hhd" /* int8_t */
#define SCNd16 "hd" /* int16_t */
#define SCNd32 "d" /* int32_t */
#define SCNd64 "lld" /* int64_t */
#define SCNdLEAST8 "hhd" /* int_least8_t */
#define SCNdLEAST16 "hd" /* int_least16_t */
#define SCNdLEAST32 "d" /* int_least32_t */
#define SCNdLEAST64 "lld" /* int_least64_t */
#define SCNdFAST8 "hhd" /* int_fast8_t */
#define SCNdFAST16 "hd" /* int_fast16_t */
#define SCNdFAST32 "d" /* int_fast32_t */
#define SCNdFAST64 "lld" /* int_fast64_t */
#define SCNdMAX "jd" /* intmax_t */
#define SCNdPTR "ld" /* intptr_t */
#define SCNi8 "hhi" /* int8_t */
#define SCNi16 "hi" /* int16_t */
#define SCNi32 "i" /* int32_t */
#define SCNi64 "lli" /* int64_t */
#define SCNiLEAST8 "hhi" /* int_least8_t */
#define SCNiLEAST16 "hi" /* int_least16_t */
#define SCNiLEAST32 "i" /* int_least32_t */
#define SCNiLEAST64 "lli" /* int_least64_t */
#define SCNiFAST8 "hhi" /* int_fast8_t */
#define SCNiFAST16 "hi" /* int_fast16_t */
#define SCNiFAST32 "i" /* int_fast32_t */
#define SCNiFAST64 "lli" /* int_fast64_t */
#define SCNiMAX "ji" /* intmax_t */
#define SCNiPTR "li" /* intptr_t */
/* fscanf macros for unsigned integers */
#define SCNo8 "hho" /* uint8_t */
#define SCNo16 "ho" /* uint16_t */
#define SCNo32 "o" /* uint32_t */
#define SCNo64 "llo" /* uint64_t */
#define SCNoLEAST8 "hho" /* uint_least8_t */
#define SCNoLEAST16 "ho" /* uint_least16_t */
#define SCNoLEAST32 "o" /* uint_least32_t */
#define SCNoLEAST64 "llo" /* uint_least64_t */
#define SCNoFAST8 "hho" /* uint_fast8_t */
#define SCNoFAST16 "ho" /* uint_fast16_t */
#define SCNoFAST32 "o" /* uint_fast32_t */
#define SCNoFAST64 "llo" /* uint_fast64_t */
#define SCNoMAX "jo" /* uintmax_t */
#define SCNoPTR "lo" /* uintptr_t */
#define SCNu8 "hhu" /* uint8_t */
#define SCNu16 "hu" /* uint16_t */
#define SCNu32 "u" /* uint32_t */
#define SCNu64 "llu" /* uint64_t */
#define SCNuLEAST8 "hhu" /* uint_least8_t */
#define SCNuLEAST16 "hu" /* uint_least16_t */
#define SCNuLEAST32 "u" /* uint_least32_t */
#define SCNuLEAST64 "llu" /* uint_least64_t */
#define SCNuFAST8 "hhu" /* uint_fast8_t */
#define SCNuFAST16 "hu" /* uint_fast16_t */
#define SCNuFAST32 "u" /* uint_fast32_t */
#define SCNuFAST64 "llu" /* uint_fast64_t */
#define SCNuMAX "ju" /* uintmax_t */
#define SCNuPTR "lu" /* uintptr_t */
#define SCNx8 "hhx" /* uint8_t */
#define SCNx16 "hx" /* uint16_t */
#define SCNx32 "x" /* uint32_t */
#define SCNx64 "llx" /* uint64_t */
#define SCNxLEAST8 "hhx" /* uint_least8_t */
#define SCNxLEAST16 "hx" /* uint_least16_t */
#define SCNxLEAST32 "x" /* uint_least32_t */
#define SCNxLEAST64 "llx" /* uint_least64_t */
#define SCNxFAST8 "hhx" /* uint_fast8_t */
#define SCNxFAST16 "hx" /* uint_fast16_t */
#define SCNxFAST32 "x" /* uint_fast32_t */
#define SCNxFAST64 "llx" /* uint_fast64_t */
#define SCNxMAX "jx" /* uintmax_t */
#define SCNxPTR "lx" /* uintptr_t */
#endif /* __cplusplus || __STDC_FORMAT_MACROS */
typedef struct {
intmax_t quot; /* quotient */
intmax_t rem; /* remainder */
} imaxdiv_t;
__BEGIN_DECLS
intmax_t imaxabs(intmax_t);
imaxdiv_t imaxdiv(intmax_t, intmax_t);
intmax_t strtoimax(const char *, char **, int);
uintmax_t strtoumax(const char *, char **, int);
__END_DECLS
#endif /* _INTTYPES_H_ */

View File

@@ -0,0 +1,124 @@
/* $NetBSD: assertions.h,v 1.1.1.1 2004/05/20 19:49:41 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1997-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Id: assertions.h,v 1.1.206.1 2004/03/09 08:33:30 marka Exp
*/
#ifndef ASSERTIONS_H
#define ASSERTIONS_H 1
typedef enum {
assert_require, assert_ensure, assert_insist, assert_invariant
} assertion_type;
typedef void (*assertion_failure_callback)(const char *, int, assertion_type,
const char *, int);
extern assertion_failure_callback __assertion_failed;
void set_assertion_failure_callback(assertion_failure_callback f);
const char *assertion_type_to_text(assertion_type type);
#ifdef CHECK_ALL
#define CHECK_REQUIRE 1
#define CHECK_ENSURE 1
#define CHECK_INSIST 1
#define CHECK_INVARIANT 1
#endif
#ifdef CHECK_NONE
#define CHECK_REQUIRE 0
#define CHECK_ENSURE 0
#define CHECK_INSIST 0
#define CHECK_INVARIANT 0
#endif
#ifndef CHECK_REQUIRE
#define CHECK_REQUIRE 1
#endif
#ifndef CHECK_ENSURE
#define CHECK_ENSURE 1
#endif
#ifndef CHECK_INSIST
#define CHECK_INSIST 1
#endif
#ifndef CHECK_INVARIANT
#define CHECK_INVARIANT 1
#endif
#if CHECK_REQUIRE != 0
#define REQUIRE(cond) \
((void) ((cond) || \
((__assertion_failed)(__FILE__, __LINE__, assert_require, \
#cond, 0), 0)))
#define REQUIRE_ERR(cond) \
((void) ((cond) || \
((__assertion_failed)(__FILE__, __LINE__, assert_require, \
#cond, 1), 0)))
#else
#define REQUIRE(cond) ((void) (cond))
#define REQUIRE_ERR(cond) ((void) (cond))
#endif /* CHECK_REQUIRE */
#if CHECK_ENSURE != 0
#define ENSURE(cond) \
((void) ((cond) || \
((__assertion_failed)(__FILE__, __LINE__, assert_ensure, \
#cond, 0), 0)))
#define ENSURE_ERR(cond) \
((void) ((cond) || \
((__assertion_failed)(__FILE__, __LINE__, assert_ensure, \
#cond, 1), 0)))
#else
#define ENSURE(cond) ((void) (cond))
#define ENSURE_ERR(cond) ((void) (cond))
#endif /* CHECK_ENSURE */
#if CHECK_INSIST != 0
#define INSIST(cond) \
((void) ((cond) || \
((__assertion_failed)(__FILE__, __LINE__, assert_insist, \
#cond, 0), 0)))
#define INSIST_ERR(cond) \
((void) ((cond) || \
((__assertion_failed)(__FILE__, __LINE__, assert_insist, \
#cond, 1), 0)))
#else
#define INSIST(cond) ((void) (cond))
#define INSIST_ERR(cond) ((void) (cond))
#endif /* CHECK_INSIST */
#if CHECK_INVARIANT != 0
#define INVARIANT(cond) \
((void) ((cond) || \
((__assertion_failed)(__FILE__, __LINE__, assert_invariant, \
#cond, 0), 0)))
#define INVARIANT_ERR(cond) \
((void) ((cond) || \
((__assertion_failed)(__FILE__, __LINE__, assert_invariant, \
#cond, 1), 0)))
#else
#define INVARIANT(cond) ((void) (cond))
#define INVARIANT_ERR(cond) ((void) (cond))
#endif /* CHECK_INVARIANT */
#endif /* ASSERTIONS_H */

182
libc/include/isc/dst.h Normal file
View File

@@ -0,0 +1,182 @@
/* $NetBSD: dst.h,v 1.1.1.1 2004/05/20 19:49:41 christos Exp $ */
#ifndef DST_H
#define DST_H
#ifndef HAS_DST_KEY
typedef struct dst_key {
char *dk_key_name; /* name of the key */
int dk_key_size; /* this is the size of the key in bits */
int dk_proto; /* what protocols this key can be used for */
int dk_alg; /* algorithm number from key record */
u_int32_t dk_flags; /* and the flags of the public key */
u_int16_t dk_id; /* identifier of the key */
} DST_KEY;
#endif /* HAS_DST_KEY */
/*
* do not taint namespace
*/
#define dst_bsafe_init __dst_bsafe_init
#define dst_buffer_to_key __dst_buffer_to_key
#define dst_check_algorithm __dst_check_algorithm
#define dst_compare_keys __dst_compare_keys
#define dst_cylink_init __dst_cylink_init
#define dst_dnskey_to_key __dst_dnskey_to_key
#define dst_eay_dss_init __dst_eay_dss_init
#define dst_free_key __dst_free_key
#define dst_generate_key __dst_generate_key
#define dst_hmac_md5_init __dst_hmac_md5_init
#define dst_init __dst_init
#define dst_key_to_buffer __dst_key_to_buffer
#define dst_key_to_dnskey __dst_key_to_dnskey
#define dst_read_key __dst_read_key
#define dst_rsaref_init __dst_rsaref_init
#define dst_s_build_filename __dst_s_build_filename
#define dst_s_calculate_bits __dst_s_calculate_bits
#define dst_s_conv_bignum_b64_to_u8 __dst_s_conv_bignum_b64_to_u8
#define dst_s_conv_bignum_u8_to_b64 __dst_s_conv_bignum_u8_to_b64
#define dst_s_dns_key_id __dst_s_dns_key_id
#define dst_s_dump __dst_s_dump
#define dst_s_filename_length __dst_s_filename_length
#define dst_s_fopen __dst_s_fopen
#define dst_s_get_int16 __dst_s_get_int16
#define dst_s_get_int32 __dst_s_get_int32
#define dst_s_id_calc __dst_s_id_calc
#define dst_s_put_int16 __dst_s_put_int16
#define dst_s_put_int32 __dst_s_put_int32
#define dst_s_quick_random __dst_s_quick_random
#define dst_s_quick_random_set __dst_s_quick_random_set
#define dst_s_random __dst_s_random
#define dst_s_semi_random __dst_s_semi_random
#define dst_s_verify_str __dst_s_verify_str
#define dst_sig_size __dst_sig_size
#define dst_sign_data __dst_sign_data
#define dst_verify_data __dst_verify_data
#define dst_write_key __dst_write_key
/*
* DST Crypto API defintions
*/
void dst_init(void);
int dst_check_algorithm(const int);
int dst_sign_data(const int, /* specifies INIT/UPDATE/FINAL/ALL */
DST_KEY *, /* the key to use */
void **, /* pointer to state structure */
const u_char *, /* data to be signed */
const int, /* length of input data */
u_char *, /* buffer to write signature to */
const int); /* size of output buffer */
int dst_verify_data(const int, /* specifies INIT/UPDATE/FINAL/ALL */
DST_KEY *, /* the key to use */
void **, /* pointer to state structure */
const u_char *, /* data to be verified */
const int, /* length of input data */
const u_char *, /* buffer containing signature */
const int); /* length of signature */
DST_KEY *dst_read_key(const char *, /* name of key */
const u_int16_t, /* key tag identifier */
const int, /* key algorithm */
const int); /* Private/PublicKey wanted*/
int dst_write_key(const DST_KEY *, /* key to write out */
const int); /* Public/Private */
DST_KEY *dst_dnskey_to_key(const char *, /* KEY record name */
const u_char *, /* KEY RDATA */
const int); /* size of input buffer*/
int dst_key_to_dnskey(const DST_KEY *, /* key to translate */
u_char *, /* output buffer */
const int); /* size of out_storage*/
DST_KEY *dst_buffer_to_key(const char *, /* name of the key */
const int, /* algorithm */
const int, /* dns flags */
const int, /* dns protocol */
const u_char *, /* key in dns wire fmt */
const int); /* size of key */
int dst_key_to_buffer(DST_KEY *, u_char *, int);
DST_KEY *dst_generate_key(const char *, /* name of new key */
const int, /* key algorithm to generate */
const int, /* size of new key */
const int, /* alg dependent parameter*/
const int, /* key DNS flags */
const int); /* key DNS protocol */
DST_KEY *dst_free_key(DST_KEY *);
int dst_compare_keys(const DST_KEY *, const DST_KEY *);
int dst_sig_size(DST_KEY *);
/* support for dns key tags/ids */
u_int16_t dst_s_dns_key_id(const u_char *, const int);
u_int16_t dst_s_id_calc(const u_char *, const int);
/* Used by callers as well as by the library. */
#define RAW_KEY_SIZE 8192 /* large enough to store any key */
/* DST_API control flags */
/* These are used used in functions dst_sign_data and dst_verify_data */
#define SIG_MODE_INIT 1 /* initialize digest */
#define SIG_MODE_UPDATE 2 /* add data to digest */
#define SIG_MODE_FINAL 4 /* generate/verify signature */
#define SIG_MODE_ALL (SIG_MODE_INIT|SIG_MODE_UPDATE|SIG_MODE_FINAL)
/* Flags for dst_read_private_key() */
#define DST_FORCE_READ 0x1000000
#define DST_CAN_SIGN 0x010F
#define DST_NO_AUTHEN 0x8000
#define DST_EXTEND_FLAG 0x1000
#define DST_STANDARD 0
#define DST_PRIVATE 0x2000000
#define DST_PUBLIC 0x4000000
#define DST_RAND_SEMI 1
#define DST_RAND_STD 2
#define DST_RAND_KEY 3
#define DST_RAND_DSS 4
/* DST algorithm codes */
#define KEY_RSA 1
#define KEY_DH 2
#define KEY_DSA 3
#define KEY_PRIVATE 254
#define KEY_EXPAND 255
#define KEY_HMAC_MD5 157
#define KEY_HMAC_SHA1 158
#define UNKNOWN_KEYALG 0
#define DST_MAX_ALGS KEY_HMAC_SHA1
/* DST constants to locations in KEY record changes in new KEY record */
#define DST_FLAGS_SIZE 2
#define DST_KEY_PROT 2
#define DST_KEY_ALG 3
#define DST_EXT_FLAG 4
#define DST_KEY_START 4
#ifndef SIGN_F_NOKEY
#define SIGN_F_NOKEY 0xC000
#endif
/* error codes from dst routines */
#define SIGN_INIT_FAILURE (-23)
#define SIGN_UPDATE_FAILURE (-24)
#define SIGN_FINAL_FAILURE (-25)
#define VERIFY_INIT_FAILURE (-26)
#define VERIFY_UPDATE_FAILURE (-27)
#define VERIFY_FINAL_FAILURE (-28)
#define MISSING_KEY_OR_SIGNATURE (-30)
#define UNSUPPORTED_KEYALG (-31)
#endif /* DST_H */

204
libc/include/isc/eventlib.h Normal file
View File

@@ -0,0 +1,204 @@
/* $NetBSD: eventlib.h,v 1.1.1.3 2005/12/21 23:15:22 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-1999 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* eventlib.h - exported interfaces for eventlib
* vix 09sep95 [initial]
*
* Id: eventlib.h,v 1.1.2.1.4.2 2005/07/28 07:43:18 marka Exp
*/
#ifndef _EVENTLIB_H
#define _EVENTLIB_H
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/time.h>
#include <stdio.h>
#ifndef __P
# define __EVENTLIB_P_DEFINED
# ifdef __STDC__
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/* In the absence of branded types... */
typedef struct { void *opaque; } evConnID;
typedef struct { void *opaque; } evFileID;
typedef struct { void *opaque; } evStreamID;
typedef struct { void *opaque; } evTimerID;
typedef struct { void *opaque; } evWaitID;
typedef struct { void *opaque; } evContext;
typedef struct { void *opaque; } evEvent;
#define evInitID(id) ((id)->opaque = NULL)
#define evTestID(id) ((id).opaque != NULL)
typedef void (*evConnFunc)__P((evContext, void *, int, const void *, int,
const void *, int));
typedef void (*evFileFunc)__P((evContext, void *, int, int));
typedef void (*evStreamFunc)__P((evContext, void *, int, int));
typedef void (*evTimerFunc)__P((evContext, void *,
struct timespec, struct timespec));
typedef void (*evWaitFunc)__P((evContext, void *, const void *));
typedef struct { unsigned char mask[256/8]; } evByteMask;
#define EV_BYTEMASK_BYTE(b) ((b) / 8)
#define EV_BYTEMASK_MASK(b) (1 << ((b) % 8))
#define EV_BYTEMASK_SET(bm, b) \
((bm).mask[EV_BYTEMASK_BYTE(b)] |= EV_BYTEMASK_MASK(b))
#define EV_BYTEMASK_CLR(bm, b) \
((bm).mask[EV_BYTEMASK_BYTE(b)] &= ~EV_BYTEMASK_MASK(b))
#define EV_BYTEMASK_TST(bm, b) \
((bm).mask[EV_BYTEMASK_BYTE(b)] & EV_BYTEMASK_MASK(b))
#define EV_POLL 1
#define EV_WAIT 2
#define EV_NULL 4
#define EV_READ 1
#define EV_WRITE 2
#define EV_EXCEPT 4
#define EV_WASNONBLOCKING 8 /* Internal library use. */
/* eventlib.c */
#define evCreate __evCreate
#define evSetDebug __evSetDebug
#define evDestroy __evDestroy
#define evGetNext __evGetNext
#define evDispatch __evDispatch
#define evDrop __evDrop
#define evMainLoop __evMainLoop
#define evHighestFD __evHighestFD
#define evGetOption __evGetOption
#define evSetOption __evSetOption
int evCreate __P((evContext *));
void evSetDebug __P((evContext, int, FILE *));
int evDestroy __P((evContext));
int evGetNext __P((evContext, evEvent *, int));
int evDispatch __P((evContext, evEvent));
void evDrop __P((evContext, evEvent));
int evMainLoop __P((evContext));
int evHighestFD __P((evContext));
int evGetOption __P((evContext *, const char *, int *));
int evSetOption __P((evContext *, const char *, int));
/* ev_connects.c */
#define evListen __evListen
#define evConnect __evConnect
#define evCancelConn __evCancelConn
#define evHold __evHold
#define evUnhold __evUnhold
#define evTryAccept __evTryAccept
int evListen __P((evContext, int, int, evConnFunc, void *, evConnID *));
int evConnect __P((evContext, int, const void *, int,
evConnFunc, void *, evConnID *));
int evCancelConn __P((evContext, evConnID));
int evHold __P((evContext, evConnID));
int evUnhold __P((evContext, evConnID));
int evTryAccept __P((evContext, evConnID, int *));
/* ev_files.c */
#define evSelectFD __evSelectFD
#define evDeselectFD __evDeselectFD
int evSelectFD __P((evContext, int, int, evFileFunc, void *, evFileID *));
int evDeselectFD __P((evContext, evFileID));
/* ev_streams.c */
#define evConsIovec __evConsIovec
#define evWrite __evWrite
#define evRead __evRead
#define evTimeRW __evTimeRW
#define evUntimeRW __evUntimeRW
#define evCancelRW __evCancelRW
struct iovec evConsIovec __P((void *, size_t));
int evWrite __P((evContext, int, const struct iovec *, int,
evStreamFunc func, void *, evStreamID *));
int evRead __P((evContext, int, const struct iovec *, int,
evStreamFunc func, void *, evStreamID *));
int evTimeRW __P((evContext, evStreamID, evTimerID timer));
int evUntimeRW __P((evContext, evStreamID));
int evCancelRW __P((evContext, evStreamID));
/* ev_timers.c */
#define evConsTime __evConsTime
#define evAddTime __evAddTime
#define evSubTime __evSubTime
#define evCmpTime __evCmpTime
#define evTimeSpec __evTimeSpec
#define evTimeVal __evTimeVal
#define evNowTime __evNowTime
#define evUTCTime __evUTCTime
#define evLastEventTime __evLastEventTime
#define evSetTimer __evSetTimer
#define evClearTimer __evClearTimer
#define evConfigTimer __evConfigTimer
#define evResetTimer __evResetTimer
#define evSetIdleTimer __evSetIdleTimer
#define evClearIdleTimer __evClearIdleTimer
#define evResetIdleTimer __evResetIdleTimer
#define evTouchIdleTimer __evTouchIdleTimer
struct timespec evConsTime __P((time_t sec, long nsec));
struct timespec evAddTime __P((struct timespec, struct timespec));
struct timespec evSubTime __P((struct timespec, struct timespec));
struct timespec evNowTime __P((void));
struct timespec evUTCTime __P((void));
struct timespec evLastEventTime __P((evContext));
struct timespec evTimeSpec __P((struct timeval));
struct timeval evTimeVal __P((struct timespec));
int evCmpTime __P((struct timespec, struct timespec));
int evSetTimer __P((evContext, evTimerFunc, void *, struct timespec,
struct timespec, evTimerID *));
int evClearTimer __P((evContext, evTimerID));
int evConfigTimer __P((evContext, evTimerID, const char *param,
int value));
int evResetTimer __P((evContext, evTimerID, evTimerFunc, void *,
struct timespec, struct timespec));
int evSetIdleTimer __P((evContext, evTimerFunc, void *, struct timespec,
evTimerID *));
int evClearIdleTimer __P((evContext, evTimerID));
int evResetIdleTimer __P((evContext, evTimerID, evTimerFunc, void *,
struct timespec));
int evTouchIdleTimer __P((evContext, evTimerID));
/* ev_waits.c */
#define evWaitFor __evWaitFor
#define evDo __evDo
#define evUnwait __evUnwait
#define evDefer __evDefer
int evWaitFor __P((evContext, const void *, evWaitFunc, void *, evWaitID *));
int evDo __P((evContext, const void *));
int evUnwait __P((evContext, evWaitID));
int evDefer __P((evContext, evWaitFunc, void *));
#ifdef __EVENTLIB_P_DEFINED
# undef __P
#endif
#endif /*_EVENTLIB_H*/

49
libc/include/isc/heap.h Normal file
View File

@@ -0,0 +1,49 @@
/* $NetBSD: heap.h,v 1.1.1.1 2004/05/20 19:49:41 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1997,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
typedef int (*heap_higher_priority_func)(void *, void *);
typedef void (*heap_index_func)(void *, int);
typedef void (*heap_for_each_func)(void *, void *);
typedef struct heap_context {
int array_size;
int array_size_increment;
int heap_size;
void **heap;
heap_higher_priority_func higher_priority;
heap_index_func index;
} *heap_context;
#define heap_new __heap_new
#define heap_free __heap_free
#define heap_insert __heap_insert
#define heap_delete __heap_delete
#define heap_increased __heap_increased
#define heap_decreased __heap_decreased
#define heap_element __heap_element
#define heap_for_each __heap_for_each
heap_context heap_new(heap_higher_priority_func, heap_index_func, int);
int heap_free(heap_context);
int heap_insert(heap_context, void *);
int heap_delete(heap_context, int);
int heap_increased(heap_context, int);
int heap_decreased(heap_context, int);
void * heap_element(heap_context, int);
int heap_for_each(heap_context, heap_for_each_func, void *);

114
libc/include/isc/list.h Normal file
View File

@@ -0,0 +1,114 @@
/* $NetBSD: list.h,v 1.2 2004/05/20 19:51:55 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1997,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef LIST_H
#define LIST_H 1
#include <isc/assertions.h>
#define LIST(type) struct { type *head, *tail; }
#define INIT_LIST(list) \
do { (list).head = NULL; (list).tail = NULL; } while (/*CONSTCOND*/0)
#define LINK(type) struct { type *prev, *next; }
#define INIT_LINK_TYPE(elt, link, type) \
do { \
(elt)->link.prev = (type *)(-1); \
(elt)->link.next = (type *)(-1); \
} while (/*CONSTCOND*/0)
#define INIT_LINK(elt, link) \
INIT_LINK_TYPE(elt, link, void)
#define LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1))
#define HEAD(list) ((list).head)
#define TAIL(list) ((list).tail)
#define EMPTY(list) ((list).head == NULL)
#define PREPEND(list, elt, link) \
do { \
INSIST(!LINKED(elt, link));\
if ((list).head != NULL) \
(list).head->link.prev = (elt); \
else \
(list).tail = (elt); \
(elt)->link.prev = NULL; \
(elt)->link.next = (list).head; \
(list).head = (elt); \
} while (/*CONSTCOND*/0)
#define APPEND(list, elt, link) \
do { \
INSIST(!LINKED(elt, link));\
if ((list).tail != NULL) \
(list).tail->link.next = (elt); \
else \
(list).head = (elt); \
(elt)->link.prev = (list).tail; \
(elt)->link.next = NULL; \
(list).tail = (elt); \
} while (/*CONSTCOND*/0)
#define UNLINK_TYPE(list, elt, link, type) \
do { \
INSIST(LINKED(elt, link));\
if ((elt)->link.next != NULL) \
(elt)->link.next->link.prev = (elt)->link.prev; \
else \
(list).tail = (elt)->link.prev; \
if ((elt)->link.prev != NULL) \
(elt)->link.prev->link.next = (elt)->link.next; \
else \
(list).head = (elt)->link.next; \
INIT_LINK_TYPE(elt, link, type); \
} while (/*CONSTCOND*/0)
#define UNLINK(list, elt, link) \
UNLINK_TYPE(list, elt, link, void)
#define PREV(elt, link) ((elt)->link.prev)
#define NEXT(elt, link) ((elt)->link.next)
#define INSERT_BEFORE(list, before, elt, link) \
do { \
INSIST(!LINKED(elt, link));\
if ((before)->link.prev == NULL) \
PREPEND(list, elt, link); \
else { \
(elt)->link.prev = (before)->link.prev; \
(before)->link.prev = (elt); \
(elt)->link.prev->link.next = (elt); \
(elt)->link.next = (before); \
} \
} while (/*CONSTCOND*/0)
#define INSERT_AFTER(list, after, elt, link) \
do { \
INSIST(!LINKED(elt, link));\
if ((after)->link.next == NULL) \
APPEND(list, elt, link); \
else { \
(elt)->link.next = (after)->link.next; \
(after)->link.next = (elt); \
(elt)->link.next->link.prev = (elt); \
(elt)->link.prev = (after); \
} \
} while (/*CONSTCOND*/0)
#define ENQUEUE(list, elt, link) APPEND(list, elt, link)
#define DEQUEUE(list, elt, link) UNLINK(list, elt, link)
#endif /* LIST_H */

View File

@@ -0,0 +1,51 @@
/* $NetBSD: memcluster.h,v 1.1.1.1 2004/05/20 19:49:41 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1997,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef MEMCLUSTER_H
#define MEMCLUSTER_H
#include <stdio.h>
#define meminit __meminit
#ifdef MEMCLUSTER_DEBUG
#define memget(s) __memget_debug(s, __FILE__, __LINE__)
#define memput(p, s) __memput_debug(p, s, __FILE__, __LINE__)
#else /*MEMCLUSTER_DEBUG*/
#ifdef MEMCLUSTER_RECORD
#define memget(s) __memget_record(s, __FILE__, __LINE__)
#define memput(p, s) __memput_record(p, s, __FILE__, __LINE__)
#else /*MEMCLUSTER_RECORD*/
#define memget __memget
#define memput __memput
#endif /*MEMCLUSTER_RECORD*/
#endif /*MEMCLUSTER_DEBUG*/
#define memstats __memstats
#define memactive __memactive
int meminit(size_t, size_t);
void * __memget(size_t);
void __memput(void *, size_t);
void * __memget_debug(size_t, const char *, int);
void __memput_debug(void *, size_t, const char *, int);
void * __memget_record(size_t, const char *, int);
void __memput_record(void *, size_t, const char *, int);
void memstats(FILE *);
int memactive(void);
#endif /* MEMCLUSTER_H */

0
libc/include/lastlog.h Normal file
View File

57
libc/include/libgen.h Normal file
View File

@@ -0,0 +1,57 @@
/*
* 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 _LIBGEN_H
#define _LIBGEN_H
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
/* our version of dirname/basename don't modify the input path */
extern char* dirname (const char* path);
extern char* basename(const char* path);
/* special thread-safe Bionic versions
*
* if 'buffer' is NULL, 'bufflen' is ignored and the length of the result is returned
* otherwise, place result in 'buffer'
*
* at most bufflen-1 characters written, plus a terminating zero
*
* return length of result, or -1 in case of error, with errno set to:
*
* ERANGE: buffer is too short
* ENAMETOOLONG: the result is too long for a valid path
*/
extern int dirname_r(const char* path, char* buffer, size_t bufflen);
extern int basename_r(const char* path, char* buffer, size_t bufflen);
__END_DECLS
#endif /* _LIBGEN_H */

96
libc/include/limits.h Normal file
View File

@@ -0,0 +1,96 @@
/* $OpenBSD: limits.h,v 1.13 2005/12/31 19:29:38 millert Exp $ */
/* $NetBSD: limits.h,v 1.7 1994/10/26 00:56:00 cgd Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)limits.h 5.9 (Berkeley) 4/3/91
*/
#ifndef _LIMITS_H_
#define _LIMITS_H_
#include <sys/cdefs.h>
#if __POSIX_VISIBLE
#define _POSIX_ARG_MAX 4096
#define _POSIX_CHILD_MAX 25
#define _POSIX_LINK_MAX 8
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_NAME_MAX 14
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 256
#define _POSIX_PIPE_BUF 512
#define _POSIX_RE_DUP_MAX 255
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
#define _POSIX_SYMLINK_MAX 255
#define _POSIX_SYMLOOP_MAX 8
#define _POSIX_TZNAME_MAX 3
#define _POSIX2_BC_BASE_MAX 99
#define _POSIX2_BC_DIM_MAX 2048
#define _POSIX2_BC_SCALE_MAX 99
#define _POSIX2_BC_STRING_MAX 1000
#define _POSIX2_COLL_WEIGHTS_MAX 2
#define _POSIX2_EXPR_NEST_MAX 32
#define _POSIX2_LINE_MAX 2048
#define _POSIX2_RE_DUP_MAX _POSIX_RE_DUP_MAX
#if __POSIX_VISIBLE >= 200112
#define _POSIX_TTY_NAME_MAX 9 /* includes trailing NUL */
#define _POSIX_LOGIN_NAME_MAX 9 /* includes trailing NUL */
#endif /* __POSIX_VISIBLE >= 200112 */
#endif /* __POSIX_VISIBLE */
#if __XPG_VISIBLE
#define PASS_MAX 128 /* _PASSWORD_LEN from <pwd.h> */
#define NL_ARGMAX 9
#define NL_LANGMAX 14
#define NL_MSGMAX 32767
#define NL_NMAX 1
#define NL_SETMAX 255
#define NL_TEXTMAX 255
#define TMP_MAX 308915776
#endif /* __XPG_VISIBLE */
#include <sys/limits.h>
#if __POSIX_VISIBLE
#include <arch/syslimits.h>
#endif
#ifndef PAGESIZE
#define PAGESIZE PAGE_SIZE
#endif
#endif /* !_LIMITS_H_ */

56
libc/include/locale.h Normal file
View File

@@ -0,0 +1,56 @@
/*
* 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 _LOCALE_H_
#define _LOCALE_H_
#include <sys/cdefs.h>
__BEGIN_DECLS
enum {
LC_CTYPE = 0,
LC_NUMERIC = 1,
LC_TIME = 2,
LC_COLLATE = 3,
LC_MONETARY = 4,
LC_MESSAGES = 5,
LC_ALL = 6,
LC_PAPER = 7,
LC_NAME = 8,
LC_ADDRESS = 9,
LC_TELEPHONE = 10,
LC_MEASUREMENT = 11,
LC_IDENTIFICATION = 12
};
extern char *setlocale(int category, const char *locale);
__END_DECLS
#endif /* _LOCALE_H_ */

104
libc/include/malloc.h Normal file
View File

@@ -0,0 +1,104 @@
/*
* 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 _MALLOC_H_
#define _MALLOC_H_
#include <sys/cdefs.h>
#include <stddef.h>
__BEGIN_DECLS
extern __mallocfunc void* malloc(size_t);
extern __mallocfunc void* calloc(size_t, size_t);
extern __mallocfunc void* realloc(void *, size_t);
extern void free(void *);
extern void* memalign(size_t alignment, size_t bytesize);
extern void* valloc(size_t bytesize);
extern void* pvalloc(size_t bytesize);
extern int mallopt(int param_number, int param_value);
extern size_t malloc_footprint(void);
extern size_t malloc_max_footprint(void);
struct mallinfo {
size_t arena; /* non-mmapped space allocated from system */
size_t ordblks; /* number of free chunks */
size_t smblks; /* always 0 */
size_t hblks; /* always 0 */
size_t hblkhd; /* space in mmapped regions */
size_t usmblks; /* maximum total allocated space */
size_t fsmblks; /* always 0 */
size_t uordblks; /* total allocated space */
size_t fordblks; /* total free space */
size_t keepcost; /* releasable (via malloc_trim) space */
};
extern struct mallinfo mallinfo(void);
/*
malloc_usable_size(void* p);
Returns the number of bytes you can actually use in
an allocated chunk, which may be more than you requested (although
often not) due to alignment and minimum size constraints.
You can use this many bytes without worrying about
overwriting other allocated objects. This is not a particularly great
programming practice. malloc_usable_size can be more useful in
debugging and assertions, for example:
p = malloc(n);
assert(malloc_usable_size(p) >= 256);
*/
extern size_t malloc_usable_size(void* block);
/*
malloc_stats();
Prints on stderr the amount of space obtained from the system (both
via sbrk and mmap), the maximum amount (which may be more than
current if malloc_trim and/or munmap got called), and the current
number of bytes allocated via malloc (or realloc, etc) but not yet
freed. Note that this is the number of bytes allocated, not the
number requested. It will be larger than the number requested
because of alignment and bookkeeping overhead. Because it includes
alignment wastage as being in use, this figure may be greater than
zero even when no user-level chunks are allocated.
The reported current and maximum system memory can be inaccurate if
a program makes other calls to system memory allocation functions
(normally sbrk) outside of malloc.
malloc_stats prints only the most commonly interesting statistics.
More information can be obtained by calling mallinfo.
*/
extern void malloc_stats(void);
__END_DECLS
#endif /* _MALLOC_H_ */

0
libc/include/memory.h Normal file
View File

52
libc/include/mntent.h Normal file
View File

@@ -0,0 +1,52 @@
/*
* 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 _MNTENT_H_
#define _MNTENT_H_
#define MNTTYPE_IGNORE "ignore"
struct mntent
{
char* mnt_fsname;
char* mnt_dir;
char* mnt_type;
char* mnt_opts;
int mnt_freq;
int mnt_passno;
};
__BEGIN_DECLS
struct mntent* getmntent(FILE*);
__END_DECLS
#endif

View File

@@ -0,0 +1,313 @@
/* $NetBSD: ethertypes.h,v 1.17 2005/12/10 23:21:38 elad Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)if_ether.h 8.1 (Berkeley) 6/10/93
*/
/*
* Ethernet protocol types.
*
* According to "assigned numbers", the Ethernet protocol numbers are also
* used as ARP protocol type numbers.
*
* I factor them out here to avoid pulling all the Ethernet header file
* into the hardware independent ARP code. -is
*
* Additional sources of information:
* http://www.mit.edu/~map/Ethernet/Ethernet.txt
* ftp://venera.isi.edu/in-notes/iana/assignments/ethernet-numbers
*
*/
#ifndef _NET_ETHERTYPES_H_
#define _NET_ETHERTYPES_H_
/*
* NOTE: 0x0000-0x05DC (0..1500) are generally IEEE 802.3 length fields.
* However, there are some conflicts.
*/
#define ETHERTYPE_8023 0x0004 /* IEEE 802.3 packet */
/* 0x0101 .. 0x1FF Experimental */
#define ETHERTYPE_PUP 0x0200 /* Xerox PUP protocol - see 0A00 */
#define ETHERTYPE_PUPAT 0x0200 /* PUP Address Translation - see 0A01 */
#define ETHERTYPE_SPRITE 0x0500 /* ??? */
/* 0x0400 Nixdorf */
#define ETHERTYPE_NS 0x0600 /* XNS */
#define ETHERTYPE_NSAT 0x0601 /* XNS Address Translation (3Mb only) */
#define ETHERTYPE_DLOG1 0x0660 /* DLOG (?) */
#define ETHERTYPE_DLOG2 0x0661 /* DLOG (?) */
#define ETHERTYPE_IP 0x0800 /* IP protocol */
#define ETHERTYPE_X75 0x0801 /* X.75 Internet */
#define ETHERTYPE_NBS 0x0802 /* NBS Internet */
#define ETHERTYPE_ECMA 0x0803 /* ECMA Internet */
#define ETHERTYPE_CHAOS 0x0804 /* CHAOSnet */
#define ETHERTYPE_X25 0x0805 /* X.25 Level 3 */
#define ETHERTYPE_ARP 0x0806 /* Address resolution protocol */
#define ETHERTYPE_NSCOMPAT 0x0807 /* XNS Compatibility */
#define ETHERTYPE_FRARP 0x0808 /* Frame Relay ARP (RFC1701) */
/* 0x081C Symbolics Private */
/* 0x0888 - 0x088A Xyplex */
#define ETHERTYPE_UBDEBUG 0x0900 /* Ungermann-Bass network debugger */
#define ETHERTYPE_IEEEPUP 0x0A00 /* Xerox IEEE802.3 PUP */
#define ETHERTYPE_IEEEPUPAT 0x0A01 /* Xerox IEEE802.3 PUP Address Translation */
#define ETHERTYPE_VINES 0x0BAD /* Banyan VINES */
#define ETHERTYPE_VINESLOOP 0x0BAE /* Banyan VINES Loopback */
#define ETHERTYPE_VINESECHO 0x0BAF /* Banyan VINES Echo */
/* 0x1000 - 0x100F Berkeley Trailer */
/*
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed
* by an ETHER type (as given above) and then the (variable-length) header.
*/
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
#define ETHERTYPE_NTRAILER 16
#define ETHERTYPE_DCA 0x1234 /* DCA - Multicast */
#define ETHERTYPE_VALID 0x1600 /* VALID system protocol */
#define ETHERTYPE_DOGFIGHT 0x1989 /* Artificial Horizons ("Aviator" dogfight simulator [on Sun]) */
#define ETHERTYPE_RCL 0x1995 /* Datapoint Corporation (RCL lan protocol) */
/* The following 3C0x types
are unregistered: */
#define ETHERTYPE_NBPVCD 0x3C00 /* 3Com NBP virtual circuit datagram (like XNS SPP) not registered */
#define ETHERTYPE_NBPSCD 0x3C01 /* 3Com NBP System control datagram not registered */
#define ETHERTYPE_NBPCREQ 0x3C02 /* 3Com NBP Connect request (virtual cct) not registered */
#define ETHERTYPE_NBPCRSP 0x3C03 /* 3Com NBP Connect repsonse not registered */
#define ETHERTYPE_NBPCC 0x3C04 /* 3Com NBP Connect complete not registered */
#define ETHERTYPE_NBPCLREQ 0x3C05 /* 3Com NBP Close request (virtual cct) not registered */
#define ETHERTYPE_NBPCLRSP 0x3C06 /* 3Com NBP Close response not registered */
#define ETHERTYPE_NBPDG 0x3C07 /* 3Com NBP Datagram (like XNS IDP) not registered */
#define ETHERTYPE_NBPDGB 0x3C08 /* 3Com NBP Datagram broadcast not registered */
#define ETHERTYPE_NBPCLAIM 0x3C09 /* 3Com NBP Claim NetBIOS name not registered */
#define ETHERTYPE_NBPDLTE 0x3C0A /* 3Com NBP Delete Netbios name not registered */
#define ETHERTYPE_NBPRAS 0x3C0B /* 3Com NBP Remote adaptor status request not registered */
#define ETHERTYPE_NBPRAR 0x3C0C /* 3Com NBP Remote adaptor response not registered */
#define ETHERTYPE_NBPRST 0x3C0D /* 3Com NBP Reset not registered */
#define ETHERTYPE_PCS 0x4242 /* PCS Basic Block Protocol */
#define ETHERTYPE_IMLBLDIAG 0x424C /* Information Modes Little Big LAN diagnostic */
#define ETHERTYPE_DIDDLE 0x4321 /* THD - Diddle */
#define ETHERTYPE_IMLBL 0x4C42 /* Information Modes Little Big LAN */
#define ETHERTYPE_SIMNET 0x5208 /* BBN Simnet Private */
#define ETHERTYPE_DECEXPER 0x6000 /* DEC Unassigned, experimental */
#define ETHERTYPE_MOPDL 0x6001 /* DEC MOP dump/load */
#define ETHERTYPE_MOPRC 0x6002 /* DEC MOP remote console */
#define ETHERTYPE_DECnet 0x6003 /* DEC DECNET Phase IV route */
#define ETHERTYPE_DN ETHERTYPE_DECnet /* libpcap, tcpdump */
#define ETHERTYPE_LAT 0x6004 /* DEC LAT */
#define ETHERTYPE_DECDIAG 0x6005 /* DEC diagnostic protocol (at interface initialization?) */
#define ETHERTYPE_DECCUST 0x6006 /* DEC customer protocol */
#define ETHERTYPE_SCA 0x6007 /* DEC LAVC, SCA */
#define ETHERTYPE_AMBER 0x6008 /* DEC AMBER */
#define ETHERTYPE_DECMUMPS 0x6009 /* DEC MUMPS */
/* 0x6010 - 0x6014 3Com Corporation */
#define ETHERTYPE_TRANSETHER 0x6558 /* Trans Ether Bridging (RFC1701)*/
#define ETHERTYPE_RAWFR 0x6559 /* Raw Frame Relay (RFC1701) */
#define ETHERTYPE_UBDL 0x7000 /* Ungermann-Bass download */
#define ETHERTYPE_UBNIU 0x7001 /* Ungermann-Bass NIUs */
#define ETHERTYPE_UBDIAGLOOP 0x7002 /* Ungermann-Bass diagnostic/loopback */
#define ETHERTYPE_UBNMC 0x7003 /* Ungermann-Bass ??? (NMC to/from UB Bridge) */
#define ETHERTYPE_UBBST 0x7005 /* Ungermann-Bass Bridge Spanning Tree */
#define ETHERTYPE_OS9 0x7007 /* OS/9 Microware */
#define ETHERTYPE_OS9NET 0x7009 /* OS/9 Net? */
/* 0x7020 - 0x7029 LRT (England) (now Sintrom) */
#define ETHERTYPE_RACAL 0x7030 /* Racal-Interlan */
#define ETHERTYPE_PRIMENTS 0x7031 /* Prime NTS (Network Terminal Service) */
#define ETHERTYPE_CABLETRON 0x7034 /* Cabletron */
#define ETHERTYPE_CRONUSVLN 0x8003 /* Cronus VLN */
#define ETHERTYPE_CRONUS 0x8004 /* Cronus Direct */
#define ETHERTYPE_HP 0x8005 /* HP Probe */
#define ETHERTYPE_NESTAR 0x8006 /* Nestar */
#define ETHERTYPE_ATTSTANFORD 0x8008 /* AT&T/Stanford (local use) */
#define ETHERTYPE_EXCELAN 0x8010 /* Excelan */
#define ETHERTYPE_SG_DIAG 0x8013 /* SGI diagnostic type */
#define ETHERTYPE_SG_NETGAMES 0x8014 /* SGI network games */
#define ETHERTYPE_SG_RESV 0x8015 /* SGI reserved type */
#define ETHERTYPE_SG_BOUNCE 0x8016 /* SGI bounce server */
#define ETHERTYPE_APOLLODOMAIN 0x8019 /* Apollo DOMAIN */
#define ETHERTYPE_TYMSHARE 0x802E /* Tymeshare */
#define ETHERTYPE_TIGAN 0x802F /* Tigan, Inc. */
#define ETHERTYPE_REVARP 0x8035 /* Reverse addr resolution protocol */
#define ETHERTYPE_AEONIC 0x8036 /* Aeonic Systems */
#define ETHERTYPE_IPXNEW 0x8037 /* IPX (Novell Netware?) */
#define ETHERTYPE_LANBRIDGE 0x8038 /* DEC LANBridge */
#define ETHERTYPE_DSMD 0x8039 /* DEC DSM/DDP */
#define ETHERTYPE_ARGONAUT 0x803A /* DEC Argonaut Console */
#define ETHERTYPE_VAXELN 0x803B /* DEC VAXELN */
#define ETHERTYPE_DECDNS 0x803C /* DEC DNS Naming Service */
#define ETHERTYPE_ENCRYPT 0x803D /* DEC Ethernet Encryption */
#define ETHERTYPE_DECDTS 0x803E /* DEC Distributed Time Service */
#define ETHERTYPE_DECLTM 0x803F /* DEC LAN Traffic Monitor */
#define ETHERTYPE_DECNETBIOS 0x8040 /* DEC PATHWORKS DECnet NETBIOS Emulation */
#define ETHERTYPE_DECLAST 0x8041 /* DEC Local Area System Transport */
/* 0x8042 DEC Unassigned */
#define ETHERTYPE_PLANNING 0x8044 /* Planning Research Corp. */
/* 0x8046 - 0x8047 AT&T */
#define ETHERTYPE_DECAM 0x8048 /* DEC Availability Manager for Distributed Systems DECamds (but someone at DEC says not) */
#define ETHERTYPE_EXPERDATA 0x8049 /* ExperData */
#define ETHERTYPE_VEXP 0x805B /* Stanford V Kernel exp. */
#define ETHERTYPE_VPROD 0x805C /* Stanford V Kernel prod. */
#define ETHERTYPE_ES 0x805D /* Evans & Sutherland */
#define ETHERTYPE_LITTLE 0x8060 /* Little Machines */
#define ETHERTYPE_COUNTERPOINT 0x8062 /* Counterpoint Computers */
/* 0x8065 - 0x8066 Univ. of Mass @ Amherst */
#define ETHERTYPE_VEECO 0x8067 /* Veeco Integrated Auto. */
#define ETHERTYPE_GENDYN 0x8068 /* General Dynamics */
#define ETHERTYPE_ATT 0x8069 /* AT&T */
#define ETHERTYPE_AUTOPHON 0x806A /* Autophon */
#define ETHERTYPE_COMDESIGN 0x806C /* ComDesign */
#define ETHERTYPE_COMPUGRAPHIC 0x806D /* Compugraphic Corporation */
/* 0x806E - 0x8077 Landmark Graphics Corp. */
#define ETHERTYPE_MATRA 0x807A /* Matra */
#define ETHERTYPE_DDE 0x807B /* Dansk Data Elektronik */
#define ETHERTYPE_MERIT 0x807C /* Merit Internodal (or Univ of Michigan?) */
/* 0x807D - 0x807F Vitalink Communications */
#define ETHERTYPE_VLTLMAN 0x8080 /* Vitalink TransLAN III Management */
/* 0x8081 - 0x8083 Counterpoint Computers */
/* 0x8088 - 0x808A Xyplex */
#define ETHERTYPE_ATALK 0x809B /* AppleTalk */
#define ETHERTYPE_AT ETHERTYPE_ATALK /* old NetBSD */
#define ETHERTYPE_APPLETALK ETHERTYPE_ATALK /* HP-UX */
/* 0x809C - 0x809E Datability */
#define ETHERTYPE_SPIDER 0x809F /* Spider Systems Ltd. */
/* 0x80A3 Nixdorf */
/* 0x80A4 - 0x80B3 Siemens Gammasonics Inc. */
/* 0x80C0 - 0x80C3 DCA (Digital Comm. Assoc.) Data Exchange Cluster */
/* 0x80C4 - 0x80C5 Banyan Systems */
#define ETHERTYPE_PACER 0x80C6 /* Pacer Software */
#define ETHERTYPE_APPLITEK 0x80C7 /* Applitek Corporation */
/* 0x80C8 - 0x80CC Intergraph Corporation */
/* 0x80CD - 0x80CE Harris Corporation */
/* 0x80CF - 0x80D2 Taylor Instrument */
/* 0x80D3 - 0x80D4 Rosemount Corporation */
#define ETHERTYPE_SNA 0x80D5 /* IBM SNA Services over Ethernet */
#define ETHERTYPE_VARIAN 0x80DD /* Varian Associates */
/* 0x80DE - 0x80DF TRFS (Integrated Solutions Transparent Remote File System) */
/* 0x80E0 - 0x80E3 Allen-Bradley */
/* 0x80E4 - 0x80F0 Datability */
#define ETHERTYPE_RETIX 0x80F2 /* Retix */
#define ETHERTYPE_AARP 0x80F3 /* AppleTalk AARP */
/* 0x80F4 - 0x80F5 Kinetics */
#define ETHERTYPE_APOLLO 0x80F7 /* Apollo Computer */
#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging (XXX conflicts) */
/* 0x80FF - 0x8101 Wellfleet Communications (XXX conflicts) */
#define ETHERTYPE_BOFL 0x8102 /* Wellfleet; BOFL (Breath OF Life) pkts [every 5-10 secs.] */
#define ETHERTYPE_WELLFLEET 0x8103 /* Wellfleet Communications */
/* 0x8107 - 0x8109 Symbolics Private */
#define ETHERTYPE_TALARIS 0x812B /* Talaris */
#define ETHERTYPE_WATERLOO 0x8130 /* Waterloo Microsystems Inc. (XXX which?) */
#define ETHERTYPE_HAYES 0x8130 /* Hayes Microcomputers (XXX which?) */
#define ETHERTYPE_VGLAB 0x8131 /* VG Laboratory Systems */
/* 0x8132 - 0x8137 Bridge Communications */
#define ETHERTYPE_IPX 0x8137 /* Novell (old) NetWare IPX (ECONFIG E option) */
#define ETHERTYPE_NOVELL 0x8138 /* Novell, Inc. */
/* 0x8139 - 0x813D KTI */
#define ETHERTYPE_MUMPS 0x813F /* M/MUMPS data sharing */
#define ETHERTYPE_AMOEBA 0x8145 /* Vrije Universiteit (NL) Amoeba 4 RPC (obsolete) */
#define ETHERTYPE_FLIP 0x8146 /* Vrije Universiteit (NL) FLIP (Fast Local Internet Protocol) */
#define ETHERTYPE_VURESERVED 0x8147 /* Vrije Universiteit (NL) [reserved] */
#define ETHERTYPE_LOGICRAFT 0x8148 /* Logicraft */
#define ETHERTYPE_NCD 0x8149 /* Network Computing Devices */
#define ETHERTYPE_ALPHA 0x814A /* Alpha Micro */
#define ETHERTYPE_SNMP 0x814C /* SNMP over Ethernet (see RFC1089) */
/* 0x814D - 0x814E BIIN */
#define ETHERTYPE_TEC 0x814F /* Technically Elite Concepts */
#define ETHERTYPE_RATIONAL 0x8150 /* Rational Corp */
/* 0x8151 - 0x8153 Qualcomm */
/* 0x815C - 0x815E Computer Protocol Pty Ltd */
/* 0x8164 - 0x8166 Charles River Data Systems */
#define ETHERTYPE_XTP 0x817D /* Protocol Engines XTP */
#define ETHERTYPE_SGITW 0x817E /* SGI/Time Warner prop. */
#define ETHERTYPE_HIPPI_FP 0x8180 /* HIPPI-FP encapsulation */
#define ETHERTYPE_STP 0x8181 /* Scheduled Transfer STP, HIPPI-ST */
/* 0x8182 - 0x8183 Reserved for HIPPI-6400 */
/* 0x8184 - 0x818C SGI prop. */
#define ETHERTYPE_MOTOROLA 0x818D /* Motorola */
#define ETHERTYPE_NETBEUI 0x8191 /* PowerLAN NetBIOS/NetBEUI (PC) */
/* 0x819A - 0x81A3 RAD Network Devices */
/* 0x81B7 - 0x81B9 Xyplex */
/* 0x81CC - 0x81D5 Apricot Computers */
/* 0x81D6 - 0x81DD Artisoft Lantastic */
/* 0x81E6 - 0x81EF Polygon */
/* 0x81F0 - 0x81F2 Comsat Labs */
/* 0x81F3 - 0x81F5 SAIC */
/* 0x81F6 - 0x81F8 VG Analytical */
/* 0x8203 - 0x8205 QNX Software Systems Ltd. */
/* 0x8221 - 0x8222 Ascom Banking Systems */
/* 0x823E - 0x8240 Advanced Encryption Systems */
/* 0x8263 - 0x826A Charles River Data Systems */
/* 0x827F - 0x8282 Athena Programming */
/* 0x829A - 0x829B Inst Ind Info Tech */
/* 0x829C - 0x82AB Taurus Controls */
/* 0x82AC - 0x8693 Walker Richer & Quinn */
#define ETHERTYPE_ACCTON 0x8390 /* Accton Technologies (unregistered) */
#define ETHERTYPE_TALARISMC 0x852B /* Talaris multicast */
#define ETHERTYPE_KALPANA 0x8582 /* Kalpana */
/* 0x8694 - 0x869D Idea Courier */
/* 0x869E - 0x86A1 Computer Network Tech */
/* 0x86A3 - 0x86AC Gateway Communications */
#define ETHERTYPE_SECTRA 0x86DB /* SECTRA */
#define ETHERTYPE_IPV6 0x86DD /* IP protocol version 6 */
#define ETHERTYPE_DELTACON 0x86DE /* Delta Controls */
#define ETHERTYPE_ATOMIC 0x86DF /* ATOMIC */
/* 0x86E0 - 0x86EF Landis & Gyr Powers */
/* 0x8700 - 0x8710 Motorola */
#define ETHERTYPE_RDP 0x8739 /* Control Technology Inc. RDP Without IP */
#define ETHERTYPE_MICP 0x873A /* Control Technology Inc. Mcast Industrial Ctrl Proto. */
/* 0x873B - 0x873C Control Technology Inc. Proprietary */
#define ETHERTYPE_TCPCOMP 0x876B /* TCP/IP Compression (RFC1701) */
#define ETHERTYPE_IPAS 0x876C /* IP Autonomous Systems (RFC1701) */
#define ETHERTYPE_SECUREDATA 0x876D /* Secure Data (RFC1701) */
#define ETHERTYPE_FLOWCONTROL 0x8808 /* 802.3x flow control packet */
#define ETHERTYPE_SLOWPROTOCOLS 0x8809 /* Slow protocols */
#define ETHERTYPE_PPP 0x880B /* PPP (obsolete by PPPOE) */
#define ETHERTYPE_HITACHI 0x8820 /* Hitachi Cable (Optoelectronic Systems Laboratory) */
#define ETHERTYPE_MPLS 0x8847 /* MPLS Unicast */
#define ETHERTYPE_MPLS_MCAST 0x8848 /* MPLS Multicast */
#define ETHERTYPE_AXIS 0x8856 /* Axis Communications AB proprietary bootstrap/config */
#define ETHERTYPE_PPPOEDISC 0x8863 /* PPP Over Ethernet Discovery Stage */
#define ETHERTYPE_PPPOE 0x8864 /* PPP Over Ethernet Session Stage */
#define ETHERTYPE_LANPROBE 0x8888 /* HP LanProbe test? */
#define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
#define ETHERTYPE_LOOPBACK 0x9000 /* Loopback */
#define ETHERTYPE_LBACK ETHERTYPE_LOOPBACK /* DEC MOP loopback */
#define ETHERTYPE_XNSSM 0x9001 /* 3Com (Formerly Bridge Communications), XNS Systems Management */
#define ETHERTYPE_TCPSM 0x9002 /* 3Com (Formerly Bridge Communications), TCP/IP Systems Management */
#define ETHERTYPE_BCLOOP 0x9003 /* 3Com (Formerly Bridge Communications), loopback detection */
#define ETHERTYPE_DEBNI 0xAAAA /* DECNET? Used by VAX 6220 DEBNI */
#define ETHERTYPE_SONIX 0xFAF5 /* Sonix Arpeggio */
#define ETHERTYPE_VITAL 0xFF00 /* BBN VITAL-LanBridge cache wakeups */
/* 0xFF00 - 0xFFOF ISC Bunker Ramo */
#define ETHERTYPE_MAX 0xFFFF /* Maximum valid ethernet type, reserved */
#endif /* !_NET_ETHERTYPES_H_ */

41
libc/include/net/if.h Normal file
View File

@@ -0,0 +1,41 @@
/*
* 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.
*/
#include <linux/if.h>
#include <sys/cdefs.h>
#ifndef IF_NAMESIZE
#define IF_NAMESIZE IFNAMSIZ
#endif
__BEGIN_DECLS
/*
* Map an interface name into its corresponding index.
*/
extern unsigned int if_nametoindex(const char *);
__END_DECLS

View File

@@ -0,0 +1 @@
#include <linux/if_arp.h>

87
libc/include/net/if_dl.h Normal file
View File

@@ -0,0 +1,87 @@
/* $NetBSD: if_dl.h,v 1.18 2005/12/11 23:05:24 thorpej Exp $ */
/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)if_dl.h 8.1 (Berkeley) 6/10/93
*/
/*
* A Link-Level Sockaddr may specify the interface in one of two
* ways: either by means of a system-provided index number (computed
* anew and possibly differently on every reboot), or by a human-readable
* string such as "il0" (for managerial convenience).
*
* Census taking actions, such as something akin to SIOCGCONF would return
* both the index and the human name.
*
* High volume transactions (such as giving a link-level ``from'' address
* in a recvfrom or recvmsg call) may be likely only to provide the indexed
* form, (which requires fewer copy operations and less space).
*
* The form and interpretation of the link-level address is purely a matter
* of convention between the device driver and its consumers; however, it is
* expected that all drivers for an interface of a given if_type will agree.
*/
#ifndef _NET_IF_DL_H_
#define _NET_IF_DL_H_
#include <sys/socket.h>
/*
* Structure of a Link-Level sockaddr:
*/
struct sockaddr_dl {
u_char sdl_len; /* Total length of sockaddr */
sa_family_t sdl_family; /* AF_LINK */
u_int16_t sdl_index; /* if != 0, system given index for interface */
u_char sdl_type; /* interface type */
u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */
u_char sdl_alen; /* link level address length */
u_char sdl_slen; /* link layer selector length */
char sdl_data[12]; /* minimum work area, can be larger;
contains both if name and ll address */
};
/* We do arithmetic directly with these, so keep them char instead of void */
#define LLADDR(s) ((char *)((s)->sdl_data + (s)->sdl_nlen))
#define CLLADDR(s) ((const char *)((s)->sdl_data + (s)->sdl_nlen))
#ifndef _KERNEL
#include <sys/cdefs.h>
__BEGIN_DECLS
void link_addr(const char *, struct sockaddr_dl *);
char *link_ntoa(const struct sockaddr_dl *);
__END_DECLS
#endif /* !_KERNEL */
#endif /* !_NET_IF_DL_H_ */

217
libc/include/net/if_ether.h Normal file
View File

@@ -0,0 +1,217 @@
/* $NetBSD: if_ether.h,v 1.43 2006/11/24 01:04:30 rpaulo Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)if_ether.h 8.1 (Berkeley) 6/10/93
*/
#ifndef _NET_IF_ETHER_H_
#define _NET_IF_ETHER_H_
#ifdef _KERNEL
#ifdef _KERNEL_OPT
#include "opt_mbuftrace.h"
#endif
#include <sys/mbuf.h>
#endif
/*
* Some basic Ethernet constants.
*/
#define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
#define ETHER_TYPE_LEN 2 /* length of the Ethernet type field */
#define ETHER_CRC_LEN 4 /* length of the Ethernet CRC */
#define ETHER_HDR_LEN ((ETHER_ADDR_LEN * 2) + ETHER_TYPE_LEN)
#define ETHER_MIN_LEN 64 /* minimum frame length, including CRC */
#define ETHER_MAX_LEN 1518 /* maximum frame length, including CRC */
#define ETHER_MAX_LEN_JUMBO 9018 /* maximum jumbo frame len, including CRC */
/*
* Some Ethernet extensions.
*/
#define ETHER_VLAN_ENCAP_LEN 4 /* length of 802.1Q VLAN encapsulation */
/*
* Ethernet address - 6 octets
* this is only used by the ethers(3) functions.
*/
struct ether_addr {
u_int8_t ether_addr_octet[ETHER_ADDR_LEN];
} __attribute__((__packed__));
/*
* Structure of a 10Mb/s Ethernet header.
*/
struct ether_header {
u_int8_t ether_dhost[ETHER_ADDR_LEN];
u_int8_t ether_shost[ETHER_ADDR_LEN];
u_int16_t ether_type;
} __attribute__((__packed__));
#include <net/ethertypes.h>
#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
#define ETHERMTU_JUMBO (ETHER_MAX_LEN_JUMBO - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define ETHERMTU (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
/*
* Compute the maximum frame size based on ethertype (i.e. possible
* encapsulation) and whether or not an FCS is present.
*/
#define ETHER_MAX_FRAME(ifp, etype, hasfcs) \
((ifp)->if_mtu + ETHER_HDR_LEN + \
((hasfcs) ? ETHER_CRC_LEN : 0) + \
(((etype) == ETHERTYPE_VLAN) ? ETHER_VLAN_ENCAP_LEN : 0))
/*
* Ethernet CRC32 polynomials (big- and little-endian verions).
*/
#define ETHER_CRC_POLY_LE 0xedb88320
#define ETHER_CRC_POLY_BE 0x04c11db6
#ifndef _STANDALONE
/*
* Ethernet-specific mbuf flags.
*/
#define M_HASFCS M_LINK0 /* FCS included at end of frame */
#define M_PROMISC M_LINK1 /* this packet is not for us */
#ifdef _KERNEL
/*
* Macro to map an IP multicast address to an Ethernet multicast address.
* The high-order 25 bits of the Ethernet address are statically assigned,
* and the low-order 23 bits are taken from the low end of the IP address.
*/
#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
/* struct in_addr *ipaddr; */ \
/* u_int8_t enaddr[ETHER_ADDR_LEN]; */ \
{ \
(enaddr)[0] = 0x01; \
(enaddr)[1] = 0x00; \
(enaddr)[2] = 0x5e; \
(enaddr)[3] = ((u_int8_t *)ipaddr)[1] & 0x7f; \
(enaddr)[4] = ((u_int8_t *)ipaddr)[2]; \
(enaddr)[5] = ((u_int8_t *)ipaddr)[3]; \
}
/*
* Macro to map an IP6 multicast address to an Ethernet multicast address.
* The high-order 16 bits of the Ethernet address are statically assigned,
* and the low-order 32 bits are taken from the low end of the IP6 address.
*/
#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr) \
/* struct in6_addr *ip6addr; */ \
/* u_int8_t enaddr[ETHER_ADDR_LEN]; */ \
{ \
(enaddr)[0] = 0x33; \
(enaddr)[1] = 0x33; \
(enaddr)[2] = ((u_int8_t *)ip6addr)[12]; \
(enaddr)[3] = ((u_int8_t *)ip6addr)[13]; \
(enaddr)[4] = ((u_int8_t *)ip6addr)[14]; \
(enaddr)[5] = ((u_int8_t *)ip6addr)[15]; \
}
#endif
#define ETHERCAP_VLAN_MTU 0x00000001 /* VLAN-compatible MTU */
#define ETHERCAP_VLAN_HWTAGGING 0x00000002 /* hardware VLAN tag support */
#define ETHERCAP_JUMBO_MTU 0x00000004 /* 9000 byte MTU supported */
#ifdef _KERNEL
extern const uint8_t etherbroadcastaddr[ETHER_ADDR_LEN];
extern const uint8_t ethermulticastaddr_slowprotocols[ETHER_ADDR_LEN];
extern const uint8_t ether_ipmulticast_min[ETHER_ADDR_LEN];
extern const uint8_t ether_ipmulticast_max[ETHER_ADDR_LEN];
int ether_ioctl(struct ifnet *, u_long, caddr_t);
int ether_addmulti (struct ifreq *, struct ethercom *);
int ether_delmulti (struct ifreq *, struct ethercom *);
int ether_changeaddr (struct ifreq *, struct ethercom *);
int ether_multiaddr(struct sockaddr *, u_int8_t[], u_int8_t[]);
/*
* Ethernet 802.1Q VLAN structures.
*/
/* add VLAN tag to input/received packet */
#define VLAN_INPUT_TAG(ifp, m, vlanid, _errcase) \
do { \
struct m_tag *mtag = \
m_tag_get(PACKET_TAG_VLAN, sizeof(u_int), M_NOWAIT);\
if (mtag == NULL) { \
ifp->if_ierrors++; \
printf("%s: unable to allocate VLAN tag\n", \
ifp->if_xname); \
m_freem(m); \
_errcase; \
} \
*(u_int *)(mtag + 1) = vlanid; \
m_tag_prepend(m, mtag); \
} while(0)
/* extract VLAN tag from output/trasmit packet */
#define VLAN_OUTPUT_TAG(ec, m0) \
VLAN_ATTACHED(ec) ? m_tag_find((m0), PACKET_TAG_VLAN, NULL) : NULL
/* extract VLAN ID value from a VLAN tag */
#define VLAN_TAG_VALUE(mtag) \
((*(u_int *)(mtag + 1)) & 4095)
/* test if any VLAN is configured for this interface */
#define VLAN_ATTACHED(ec) ((ec)->ec_nvlans > 0)
void ether_ifattach(struct ifnet *, const u_int8_t *);
void ether_ifdetach(struct ifnet *);
char *ether_sprintf(const u_int8_t *);
char *ether_snprintf(char *, size_t, const u_int8_t *);
u_int32_t ether_crc32_le(const u_int8_t *, size_t);
u_int32_t ether_crc32_be(const u_int8_t *, size_t);
int ether_nonstatic_aton(u_char *, char *);
#else
/*
* Prototype ethers(3) functions.
*/
#include <sys/cdefs.h>
__BEGIN_DECLS
char * ether_ntoa __P((const struct ether_addr *));
struct ether_addr *
ether_aton __P((const char *));
int ether_ntohost __P((char *, const struct ether_addr *));
int ether_hostton __P((const char *, struct ether_addr *));
int ether_line __P((const char *, struct ether_addr *, char *));
__END_DECLS
#endif
#endif /* _STANDALONE */
#endif /* !_NET_IF_ETHER_H_ */

View File

@@ -0,0 +1,127 @@
/* $NetBSD: if_ieee1394.h,v 1.6 2005/12/10 23:21:38 elad Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Atsushi Onoe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _NET_IF_IEEE1394_H_
#define _NET_IF_IEEE1394_H_
/* hardware address information for arp / nd */
struct ieee1394_hwaddr {
u_int8_t iha_uid[8]; /* node unique ID */
u_int8_t iha_maxrec; /* max_rec in the config ROM */
u_int8_t iha_speed; /* min of link/PHY speed */
u_int8_t iha_offset[6]; /* unicast FIFO address */
};
/*
* BPF wants to see one of these.
*/
struct ieee1394_bpfhdr {
uint8_t ibh_dhost[8];
uint8_t ibh_shost[8];
uint16_t ibh_type;
};
#ifdef _KERNEL
/* pseudo header */
struct ieee1394_header {
u_int8_t ih_uid[8]; /* dst/src uid */
u_int8_t ih_maxrec; /* dst maxrec for tx */
u_int8_t ih_speed; /* speed */
u_int8_t ih_offset[6]; /* dst offset */
};
/* unfragment encapsulation header */
struct ieee1394_unfraghdr {
u_int16_t iuh_ft; /* fragment type == 0 */
u_int16_t iuh_etype; /* ether_type */
};
/* fragmented encapsulation header */
struct ieee1394_fraghdr {
u_int16_t ifh_ft_size; /* fragment type, data size-1 */
u_int16_t ifh_etype_off; /* etype for first fragment */
/* offset for subseq frag */
u_int16_t ifh_dgl; /* datagram label */
u_int16_t ifh_reserved;
};
#define IEEE1394_FT_SUBSEQ 0x8000
#define IEEE1394_FT_MORE 0x4000
#define IEEE1394MTU 1500
#define IEEE1394_GASP_LEN 8 /* GASP header for Stream */
#define IEEE1394_ADDR_LEN 8
#define IEEE1394_CRC_LEN 4
struct ieee1394_reass_pkt {
LIST_ENTRY(ieee1394_reass_pkt) rp_next;
struct mbuf *rp_m;
u_int16_t rp_size;
u_int16_t rp_etype;
u_int16_t rp_off;
u_int16_t rp_dgl;
u_int16_t rp_len;
u_int16_t rp_ttl;
};
struct ieee1394_reassq {
LIST_ENTRY(ieee1394_reassq) rq_node;
LIST_HEAD(, ieee1394_reass_pkt) rq_pkt;
u_int32_t fr_id;
};
struct ieee1394com {
struct ifnet fc_if;
struct ieee1394_hwaddr ic_hwaddr;
u_int16_t ic_dgl;
LIST_HEAD(, ieee1394_reassq) ic_reassq;
};
const char *ieee1394_sprintf(const u_int8_t *);
void ieee1394_input(struct ifnet *, struct mbuf *, u_int16_t);
void ieee1394_ifattach(struct ifnet *, const struct ieee1394_hwaddr *);
void ieee1394_ifdetach(struct ifnet *);
int ieee1394_ioctl(struct ifnet *, u_long, caddr_t);
struct mbuf * ieee1394_fragment(struct ifnet *, struct mbuf *, int, u_int16_t);
void ieee1394_drain(struct ifnet *);
void ieee1394_watchdog(struct ifnet *);
#endif /* _KERNEL */
#endif /* !_NET_IF_IEEE1394_H_ */

View File

@@ -0,0 +1 @@
#include <linux/if_packet.h>

267
libc/include/net/if_types.h Normal file
View File

@@ -0,0 +1,267 @@
/* $NetBSD: if_types.h,v 1.24 2005/12/10 23:21:38 elad Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)if_types.h 8.3 (Berkeley) 4/28/95
*/
#ifndef _NET_IF_TYPES_H_
#define _NET_IF_TYPES_H_
/*
* Interface types for benefit of parsing media address headers.
* This list is derived from the SNMP list of ifTypes, originally
* documented in RFC1573, now maintained as:
*
* <URL:http://www.iana.org/assignments/smi-numbers>
*/
#define IFT_OTHER 0x1 /* none of the following */
#define IFT_1822 0x2 /* old-style arpanet imp */
#define IFT_HDH1822 0x3 /* HDH arpanet imp */
#define IFT_X25DDN 0x4 /* x25 to imp */
#define IFT_X25 0x5 /* PDN X25 interface (RFC877) */
#define IFT_ETHER 0x6 /* Ethernet CSMA/CD */
#define IFT_ISO88023 0x7 /* CSMA/CD */
#define IFT_ISO88024 0x8 /* Token Bus */
#define IFT_ISO88025 0x9 /* Token Ring */
#define IFT_ISO88026 0xa /* MAN */
#define IFT_STARLAN 0xb
#define IFT_P10 0xc /* Proteon 10MBit ring */
#define IFT_P80 0xd /* Proteon 80MBit ring */
#define IFT_HY 0xe /* Hyperchannel */
#define IFT_FDDI 0xf
#define IFT_LAPB 0x10
#define IFT_SDLC 0x11
#define IFT_T1 0x12
#define IFT_CEPT 0x13 /* E1 - european T1 */
#define IFT_ISDNBASIC 0x14
#define IFT_ISDNPRIMARY 0x15
#define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */
#define IFT_PPP 0x17 /* RFC 1331 */
#define IFT_LOOP 0x18 /* loopback */
#define IFT_EON 0x19 /* ISO over IP */
#define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */
#define IFT_NSIP 0x1b /* XNS over IP */
#define IFT_SLIP 0x1c /* IP over generic TTY */
#define IFT_ULTRA 0x1d /* Ultra Technologies */
#define IFT_DS3 0x1e /* Generic T3 */
#define IFT_SIP 0x1f /* SMDS */
#define IFT_FRELAY 0x20 /* Frame Relay DTE only */
#define IFT_RS232 0x21
#define IFT_PARA 0x22 /* parallel-port */
#define IFT_ARCNET 0x23
#define IFT_ARCNETPLUS 0x24
#define IFT_ATM 0x25 /* ATM cells */
#define IFT_MIOX25 0x26
#define IFT_SONET 0x27 /* SONET or SDH */
#define IFT_X25PLE 0x28
#define IFT_ISO88022LLC 0x29
#define IFT_LOCALTALK 0x2a
#define IFT_SMDSDXI 0x2b
#define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */
#define IFT_V35 0x2d
#define IFT_HSSI 0x2e
#define IFT_HIPPI 0x2f
#define IFT_MODEM 0x30 /* Generic Modem */
#define IFT_AAL5 0x31 /* AAL5 over ATM */
#define IFT_SONETPATH 0x32
#define IFT_SONETVT 0x33
#define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */
#define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */
#define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */
#define IFT_IEEE80212 0x37 /* 100BaseVG */
#define IFT_FIBRECHANNEL 0x38 /* Fibre Channel */
#define IFT_HIPPIINTERFACE 0x39 /* HIPPI interfaces */
#define IFT_FRAMERELAYINTERCONNECT 0x3a /* Obsolete, use either 0x20 or 0x2c */
#define IFT_AFLANE8023 0x3b /* ATM Emulated LAN for 802.3 */
#define IFT_AFLANE8025 0x3c /* ATM Emulated LAN for 802.5 */
#define IFT_CCTEMUL 0x3d /* ATM Emulated circuit */
#define IFT_FASTETHER 0x3e /* Fast Ethernet (100BaseT) */
#define IFT_ISDN 0x3f /* ISDN and X.25 */
#define IFT_V11 0x40 /* CCITT V.11/X.21 */
#define IFT_V36 0x41 /* CCITT V.36 */
#define IFT_G703AT64K 0x42 /* CCITT G703 at 64Kbps */
#define IFT_G703AT2MB 0x43 /* Obsolete see DS1-MIB */
#define IFT_QLLC 0x44 /* SNA QLLC */
#define IFT_FASTETHERFX 0x45 /* Fast Ethernet (100BaseFX) */
#define IFT_CHANNEL 0x46 /* channel */
#define IFT_IEEE80211 0x47 /* radio spread spectrum */
#define IFT_IBM370PARCHAN 0x48 /* IBM System 360/370 OEMI Channel */
#define IFT_ESCON 0x49 /* IBM Enterprise Systems Connection */
#define IFT_DLSW 0x4a /* Data Link Switching */
#define IFT_ISDNS 0x4b /* ISDN S/T interface */
#define IFT_ISDNU 0x4c /* ISDN U interface */
#define IFT_LAPD 0x4d /* Link Access Protocol D */
#define IFT_IPSWITCH 0x4e /* IP Switching Objects */
#define IFT_RSRB 0x4f /* Remote Source Route Bridging */
#define IFT_ATMLOGICAL 0x50 /* ATM Logical Port */
#define IFT_DS0 0x51 /* Digital Signal Level 0 */
#define IFT_DS0BUNDLE 0x52 /* group of ds0s on the same ds1 */
#define IFT_BSC 0x53 /* Bisynchronous Protocol */
#define IFT_ASYNC 0x54 /* Asynchronous Protocol */
#define IFT_CNR 0x55 /* Combat Net Radio */
#define IFT_ISO88025DTR 0x56 /* ISO 802.5r DTR */
#define IFT_EPLRS 0x57 /* Ext Pos Loc Report Sys */
#define IFT_ARAP 0x58 /* Appletalk Remote Access Protocol */
#define IFT_PROPCNLS 0x59 /* Proprietary Connectionless Protocol*/
#define IFT_HOSTPAD 0x5a /* CCITT-ITU X.29 PAD Protocol */
#define IFT_TERMPAD 0x5b /* CCITT-ITU X.3 PAD Facility */
#define IFT_FRAMERELAYMPI 0x5c /* Multiproto Interconnect over FR */
#define IFT_X213 0x5d /* CCITT-ITU X213 */
#define IFT_ADSL 0x5e /* Asymmetric Digital Subscriber Loop */
#define IFT_RADSL 0x5f /* Rate-Adapt. Digital Subscriber Loop*/
#define IFT_SDSL 0x60 /* Symmetric Digital Subscriber Loop */
#define IFT_VDSL 0x61 /* Very H-Speed Digital Subscrib. Loop*/
#define IFT_ISO88025CRFPINT 0x62 /* ISO 802.5 CRFP */
#define IFT_MYRINET 0x63 /* Myricom Myrinet */
#define IFT_VOICEEM 0x64 /* voice recEive and transMit */
#define IFT_VOICEFXO 0x65 /* voice Foreign Exchange Office */
#define IFT_VOICEFXS 0x66 /* voice Foreign Exchange Station */
#define IFT_VOICEENCAP 0x67 /* voice encapsulation */
#define IFT_VOICEOVERIP 0x68 /* voice over IP encapsulation */
#define IFT_ATMDXI 0x69 /* ATM DXI */
#define IFT_ATMFUNI 0x6a /* ATM FUNI */
#define IFT_ATMIMA 0x6b /* ATM IMA */
#define IFT_PPPMULTILINKBUNDLE 0x6c /* PPP Multilink Bundle */
#define IFT_IPOVERCDLC 0x6d /* IBM ipOverCdlc */
#define IFT_IPOVERCLAW 0x6e /* IBM Common Link Access to Workstn */
#define IFT_STACKTOSTACK 0x6f /* IBM stackToStack */
#define IFT_VIRTUALIPADDRESS 0x70 /* IBM VIPA */
#define IFT_MPC 0x71 /* IBM multi-protocol channel support */
#define IFT_IPOVERATM 0x72 /* IBM ipOverAtm */
#define IFT_ISO88025FIBER 0x73 /* ISO 802.5j Fiber Token Ring */
#define IFT_TDLC 0x74 /* IBM twinaxial data link control */
#define IFT_GIGABITETHERNET 0x75 /* Gigabit Ethernet */
#define IFT_HDLC 0x76 /* HDLC */
#define IFT_LAPF 0x77 /* LAP F */
#define IFT_V37 0x78 /* V.37 */
#define IFT_X25MLP 0x79 /* Multi-Link Protocol */
#define IFT_X25HUNTGROUP 0x7a /* X25 Hunt Group */
#define IFT_TRANSPHDLC 0x7b /* Transp HDLC */
#define IFT_INTERLEAVE 0x7c /* Interleave channel */
#define IFT_FAST 0x7d /* Fast channel */
#define IFT_IP 0x7e /* IP (for APPN HPR in IP networks) */
#define IFT_DOCSCABLEMACLAYER 0x7f /* CATV Mac Layer */
#define IFT_DOCSCABLEDOWNSTREAM 0x80 /* CATV Downstream interface */
#define IFT_DOCSCABLEUPSTREAM 0x81 /* CATV Upstream interface */
#define IFT_A12MPPSWITCH 0x82 /* Avalon Parallel Processor */
#define IFT_TUNNEL 0x83 /* Encapsulation interface */
#define IFT_COFFEE 0x84 /* coffee pot */
#define IFT_CES 0x85 /* Circiut Emulation Service */
#define IFT_ATMSUBINTERFACE 0x86 /* (x) ATM Sub Interface */
#define IFT_L2VLAN 0x87 /* Layer 2 Virtual LAN using 802.1Q */
#define IFT_L3IPVLAN 0x88 /* Layer 3 Virtual LAN - IP Protocol */
#define IFT_L3IPXVLAN 0x89 /* Layer 3 Virtual LAN - IPX Prot. */
#define IFT_DIGITALPOWERLINE 0x8a /* IP over Power Lines */
#define IFT_MEDIAMAILOVERIP 0x8b /* (xxx) Multimedia Mail over IP */
#define IFT_DTM 0x8c /* Dynamic synchronous Transfer Mode */
#define IFT_DCN 0x8d /* Data Communications Network */
#define IFT_IPFORWARD 0x8e /* IP Forwarding Interface */
#define IFT_MSDSL 0x8f /* Multi-rate Symmetric DSL */
#define IFT_IEEE1394 0x90 /* IEEE1394 High Performance SerialBus*/
#define IFT_IFGSN 0x91 /* HIPPI-6400 */
#define IFT_DVBRCCMACLAYER 0x92 /* DVB-RCC MAC Layer */
#define IFT_DVBRCCDOWNSTREAM 0x93 /* DVB-RCC Downstream Channel */
#define IFT_DVBRCCUPSTREAM 0x94 /* DVB-RCC Upstream Channel */
#define IFT_ATMVIRTUAL 0x95 /* ATM Virtual Interface */
#define IFT_MPLSTUNNEL 0x96 /* MPLS Tunnel Virtual Interface */
#define IFT_SRP 0x97 /* Spatial Reuse Protocol */
#define IFT_VOICEOVERATM 0x98 /* Voice over ATM */
#define IFT_VOICEOVERFRAMERELAY 0x99 /* Voice Over Frame Relay */
#define IFT_IDSL 0x9a /* Digital Subscriber Loop over ISDN */
#define IFT_COMPOSITELINK 0x9b /* Avici Composite Link Interface */
#define IFT_SS7SIGLINK 0x9c /* SS7 Signaling Link */
#define IFT_PROPWIRELESSP2P 0x9d /* Prop. P2P wireless interface */
#define IFT_FRFORWARD 0x9e /* Frame forward Interface */
#define IFT_RFC1483 0x9f /* Multiprotocol over ATM AAL5 */
#define IFT_USB 0xa0 /* USB Interface */
#define IFT_IEEE8023ADLAG 0xa1 /* IEEE 802.3ad Link Aggregate*/
#define IFT_BGPPOLICYACCOUNTING 0xa2 /* BGP Policy Accounting */
#define IFT_FRF16MFRBUNDLE 0xa3 /* FRF.16 Multilik Frame Relay*/
#define IFT_H323GATEKEEPER 0xa4 /* H323 Gatekeeper */
#define IFT_H323PROXY 0xa5 /* H323 Voice and Video Proxy */
#define IFT_MPLS 0xa6 /* MPLS */
#define IFT_MFSIGLINK 0xa7 /* Multi-frequency signaling link */
#define IFT_HDSL2 0xa8 /* High Bit-Rate DSL, 2nd gen. */
#define IFT_SHDSL 0xa9 /* Multirate HDSL2 */
#define IFT_DS1FDL 0xaa /* Facility Data Link (4Kbps) on a DS1*/
#define IFT_POS 0xab /* Packet over SONET/SDH Interface */
#define IFT_DVBASILN 0xac /* DVB-ASI Input */
#define IFT_DVBASIOUT 0xad /* DVB-ASI Output */
#define IFT_PLC 0xae /* Power Line Communications */
#define IFT_NFAS 0xaf /* Non-Facility Associated Signaling */
#define IFT_TR008 0xb0 /* TROO8 */
#define IFT_GR303RDT 0xb1 /* Remote Digital Terminal */
#define IFT_GR303IDT 0xb2 /* Integrated Digital Terminal */
#define IFT_ISUP 0xb3 /* ISUP */
#define IFT_PROPDOCSWIRELESSMACLAYER 0xb4 /* prop/Wireless MAC Layer */
#define IFT_PROPDOCSWIRELESSDOWNSTREAM 0xb5 /* prop/Wireless Downstream */
#define IFT_PROPDOCSWIRELESSUPSTREAM 0xb6 /* prop/Wireless Upstream */
#define IFT_HIPERLAN2 0xb7 /* HIPERLAN Type 2 Radio Interface */
#define IFT_PROPBWAP2MP 0xb8 /* PropBroadbandWirelessAccess P2MP*/
#define IFT_SONETOVERHEADCHANNEL 0xb9 /* SONET Overhead Channel */
#define IFT_DIGITALWRAPPEROVERHEADCHANNEL 0xba /* Digital Wrapper Overhead */
#define IFT_AAL2 0xbb /* ATM adaptation layer 2 */
#define IFT_RADIOMAC 0xbc /* MAC layer over radio links */
#define IFT_ATMRADIO 0xbd /* ATM over radio links */
#define IFT_IMT 0xbe /* Inter-Machine Trunks */
#define IFT_MVL 0xbf /* Multiple Virtual Lines DSL */
#define IFT_REACHDSL 0xc0 /* Long Reach DSL */
#define IFT_FRDLCIENDPT 0xc1 /* Frame Relay DLCI End Point */
#define IFT_ATMVCIENDPT 0xc2 /* ATM VCI End Point */
#define IFT_OPTICALCHANNEL 0xc3 /* Optical Channel */
#define IFT_OPTICALTRANSPORT 0xc4 /* Optical Transport */
#define IFT_PROPATM 0xc5 /* Proprietary ATM */
#define IFT_VOICEOVERCABLE 0xc6 /* Voice Over Cable Interface */
#define IFT_INFINIBAND 0xc7 /* Infiniband */
#define IFT_TELINK 0xc8 /* TE Link */
#define IFT_Q2931 0xc9 /* Q.2931 */
#define IFT_VIRTUALTG 0xca /* Virtual Trunk Group */
#define IFT_SIPTG 0xcb /* SIP Trunk Group */
#define IFT_SIPSIG 0xcc /* SIP Signaling */
#define IFT_DOCSCABLEUPSTREAMCHANNEL 0xcd /* CATV Upstream Channel */
#define IFT_ECONET 0xce /* Acorn Econet */
#define IFT_PON155 0xcf /* FSAN 155Mb Symetrical PON interface */
#define IFT_PON622 0xd0 /* FSAN 622Mb Symetrical PON interface */*/
#define IFT_BRIDGE 0xd1 /* Transparent bridge interface */
#define IFT_LINEGROUP 0xd2 /* Interface common to multiple lines */
#define IFT_VOICEEMFGD 0xd3 /* voice E&M Feature Group D */
#define IFT_VOICEFGDEANA 0xd4 /* voice FGD Exchange Access North American */
#define IFT_VOICEDID 0xd5 /* voice Direct Inward Dialing */
#define IFT_STF 0xd7 /* 6to4 interface */
/* not based on IANA assignments - how should we treat these? */
#define IFT_GIF 0xf0
#define IFT_PVC 0xf1
#define IFT_FAITH 0xf2
#define IFT_PFLOG 0xf5 /* Packet filter logging */
#define IFT_PFSYNC 0xf6 /* Packet filter state syncing */
#endif /* !_NET_IF_TYPES_H_ */

1
libc/include/net/route.h Normal file
View File

@@ -0,0 +1 @@
#include <linux/route.h>

250
libc/include/netdb.h Normal file
View File

@@ -0,0 +1,250 @@
/*-
* Copyright (c) 1980, 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* @(#)netdb.h 8.1 (Berkeley) 6/2/93
* From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $
* $FreeBSD: /repoman/r/ncvs/src/include/netdb.h,v 1.41 2006/04/15 16:20:26 ume Exp $
*/
#ifndef _NETDB_H_
#define _NETDB_H_
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/socket.h>
#ifndef _PATH_HEQUIV
# define _PATH_HEQUIV "/system/etc/hosts.equiv"
#endif
#define _PATH_HOSTS "/system/etc/hosts"
#define _PATH_NETWORKS "/system/etc/networks"
#define _PATH_PROTOCOLS "/system/etc/protocols"
#define _PATH_SERVICES "/system/etc/services"
/* BIONIC-BEGIN */
#define h_errno (*__get_h_errno())
extern int* __get_h_errno(void);
/* BIONIC-END */
/*
* Structures returned by network data base library. All addresses are
* supplied in host order, and returned in network order (suitable for
* use in system calls).
*/
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatibility */
};
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
uint32_t n_net; /* network # */
};
struct servent {
char *s_name; /* official service name */
char **s_aliases; /* alias list */
int s_port; /* port # */
char *s_proto; /* protocol to use */
};
struct protoent {
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
int p_proto; /* protocol # */
};
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
socklen_t ai_addrlen; /* length of ai_addr */
char *ai_canonname; /* canonical name for hostname */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in h_errno).
*/
#define NETDB_INTERNAL -1 /* see errno */
#define NETDB_SUCCESS 0 /* no problem */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
/*
* Error return codes from getaddrinfo()
*/
#if 0
/* obsoleted */
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
#endif
#define EAI_AGAIN 2 /* temporary failure in name resolution */
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
#define EAI_FAMILY 5 /* ai_family not supported */
#define EAI_MEMORY 6 /* memory allocation failure */
#define EAI_NODATA 7 /* no address associated with hostname */
#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
#define EAI_SYSTEM 11 /* system error returned in errno */
#define EAI_BADHINTS 12
#define EAI_PROTOCOL 13
#define EAI_MAX 14
/*
* Flag values for getaddrinfo()
*/
#define AI_PASSIVE 0x00000001 /* get address to use bind() */
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
#define AI_NUMERICHOST 0x00000004 /* prevent host name resolution */
#define AI_NUMERICSERV 0x00000008 /* prevent service name resolution */
/* valid flags for addrinfo (not a standard def, apps should not use it) */
#define AI_MASK \
(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
AI_ADDRCONFIG)
#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
/* special recommended flags for getipnodebyname */
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
/*
* Constants for getnameinfo()
*/
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
/*
* Flag values for getnameinfo()
*/
#define NI_NOFQDN 0x00000001
#define NI_NUMERICHOST 0x00000002
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
#if 0 /* obsolete */
#define NI_WITHSCOPEID 0x00000020
#endif
/*
* Scope delimit character
*/
#define SCOPE_DELIMITER '%'
__BEGIN_DECLS
void endhostent(void);
void endnetent(void);
void endnetgrent(void);
void endprotoent(void);
void endservent(void);
void freehostent(struct hostent *);
struct hostent *gethostbyaddr(const char *, int, int);
int gethostbyaddr_r(const char *, int, int, struct hostent *, char *, size_t, struct hostent **, int *);
struct hostent *gethostbyname(const char *);
int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
struct hostent *gethostbyname2(const char *, int);
int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
struct hostent *gethostent(void);
int gethostent_r(struct hostent *, char *, size_t, struct hostent **, int *);
struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
struct hostent *getipnodebyname(const char *, int, int, int *);
struct netent *getnetbyaddr(uint32_t, int);
int getnetbyaddr_r(uint32_t, int, struct netent *, char *, size_t, struct netent**, int *);
struct netent *getnetbyname(const char *);
int getnetbyname_r(const char *, struct netent *, char *, size_t, struct netent **, int *);
struct netent *getnetent(void);
int getnetent_r(struct netent *, char *, size_t, struct netent **, int *);
int getnetgrent(char **, char **, char **);
struct protoent *getprotobyname(const char *);
int getprotobyname_r(const char *, struct protoent *, char *, size_t, struct protoent **);
struct protoent *getprotobynumber(int);
int getprotobynumber_r(int, struct protoent *, char *, size_t, struct protoent **);
struct protoent *getprotoent(void);
int getprotoent_r(struct protoent *, char *, size_t, struct protoent **);
struct servent *getservbyname(const char *, const char *);
struct servent *getservbyport(int, const char *);
struct servent *getservent(void);
void herror(const char *);
const char *hstrerror(int);
int innetgr(const char *, const char *, const char *, const char *);
void sethostent(int);
void setnetent(int);
void setprotoent(int);
int getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **);
int getnameinfo(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int);
void freeaddrinfo(struct addrinfo *);
const char *gai_strerror(int);
void setnetgrent(const char *);
void setservent(int);
__END_DECLS
#endif /* !_NETDB_H_ */

View File

@@ -0,0 +1,28 @@
/*
* 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.
*/
#include <net/if_ether.h>

View File

@@ -0,0 +1,33 @@
/*
* 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.
*/
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#ifndef ETHER_ADDR_LEN
#define ETHER_ADDR_LEN ETH_ALEN
#include <net/ethertypes.h>
#endif

43
libc/include/netinet/in.h Normal file
View File

@@ -0,0 +1,43 @@
/*
* 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 _NETINET_IN_H_
#define _NETINET_IN_H_
#include <endian.h>
#include <linux/socket.h>
#include <linux/in.h>
__BEGIN_DECLS
#define IPPORT_RESERVED 1024
extern int bindresvport (int sd, struct sockaddr_in *sin);
__END_DECLS
#endif /* _NETINET_IN_H_ */

View File

@@ -0,0 +1,63 @@
/*
* 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 _NETINET_IN6_H
#define _NETINET_IN6_H
#include <linux/in6.h>
#define IN6_IS_ADDR_UNSPECIFIED(a) \
((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
(*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) == 0))
#define IN6_IS_ADDR_V4COMPAT(a) \
((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
(*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \
(*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1)))
#define IN6_IS_ADDR_V4MAPPED(a) \
((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
#define IN6_IS_ADDR_LINKLOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
#define IN6_IS_ADDR_SITELOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
#define IN6_IS_ADDR_MULTICAST(a) \
(((__const uint8_t *) (a))[0] == 0xff)
#define IN6_ARE_ADDR_EQUAL(a, b) \
(memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
#endif /* _NETINET_IN6_H */

View File

@@ -0,0 +1,59 @@
/* $NetBSD: in_systm.h,v 1.13 2005/12/10 23:36:23 elad Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)in_systm.h 8.1 (Berkeley) 6/10/93
*/
#ifndef _NETINET_IN_SYSTM_H_
#define _NETINET_IN_SYSTM_H_
/*
* Miscellaneous internetwork
* definitions for kernel.
*/
/*
* Network types.
*
* Internally the system keeps counters in the headers with the bytes
* swapped so that VAX instructions will work on them. It reverses
* the bytes before transmission at each protocol level. The n_ types
* represent the types with the bytes in ``high-ender'' order.
*/
typedef u_int16_t n_short; /* short as received from the net */
typedef u_int32_t n_long; /* long as received from the net */
typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */
#ifdef _KERNEL
n_time iptime (void);
#endif
#endif /* !_NETINET_IN_SYSTM_H_ */

275
libc/include/netinet/ip.h Normal file
View File

@@ -0,0 +1,275 @@
/* $OpenBSD: ip.h,v 1.12 2006/04/27 02:19:32 tedu Exp $ */
/* $NetBSD: ip.h,v 1.9 1995/05/15 01:22:44 cgd Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)ip.h 8.1 (Berkeley) 6/10/93
*/
#ifndef _NETINET_IP_H_
#define _NETINET_IP_H_
#include <sys/cdefs.h>
#include <sys/types.h>
#include <endian.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
__BEGIN_DECLS
/*
* Definitions for internet protocol version 4.
* Per RFC 791, September 1981.
*/
#define IPVERSION 4
/*
* Structure of an internet header, naked of options.
*/
struct ip {
#if BYTE_ORDER == LITTLE_ENDIAN
u_int32_t ip_hl:4, /* header length */
ip_v:4; /* version */
#endif
#if BYTE_ORDER == BIG_ENDIAN
u_int32_t ip_v:4, /* version */
ip_hl:4; /* header length */
#endif
u_int8_t ip_tos; /* type of service */
u_int16_t ip_len; /* total length */
u_int16_t ip_id; /* identification */
u_int16_t ip_off; /* fragment offset field */
#define IP_RF 0x8000 /* reserved fragment flag */
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
u_int8_t ip_ttl; /* time to live */
u_int8_t ip_p; /* protocol */
u_int16_t ip_sum; /* checksum */
struct in_addr ip_src, ip_dst; /* source and dest address */
};
#define IP_MAXPACKET 65535 /* maximum packet size */
/*
* Definitions for IP type of service (ip_tos)
*/
#define IPTOS_LOWDELAY 0x10
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
/* IPTOS_LOWCOST 0x02 XXX */
#if 1
/* ECN RFC3168 obsoletes RFC2481, and these will be deprecated soon. */
#define IPTOS_CE 0x01 /* congestion experienced */
#define IPTOS_ECT 0x02 /* ECN-capable transport */
#endif
/*
* Definitions for IP precedence (also in ip_tos) (hopefully unused)
*/
#define IPTOS_PREC_NETCONTROL 0xe0
#define IPTOS_PREC_INTERNETCONTROL 0xc0
#define IPTOS_PREC_CRITIC_ECP 0xa0
#define IPTOS_PREC_FLASHOVERRIDE 0x80
#define IPTOS_PREC_FLASH 0x60
#define IPTOS_PREC_IMMEDIATE 0x40
#define IPTOS_PREC_PRIORITY 0x20
#define IPTOS_PREC_ROUTINE 0x00
/*
* ECN (Explicit Congestion Notification) codepoints in RFC3168
* mapped to the lower 2 bits of the TOS field.
*/
#define IPTOS_ECN_NOTECT 0x00 /* not-ECT */
#define IPTOS_ECN_ECT1 0x01 /* ECN-capable transport (1) */
#define IPTOS_ECN_ECT0 0x02 /* ECN-capable transport (0) */
#define IPTOS_ECN_CE 0x03 /* congestion experienced */
#define IPTOS_ECN_MASK 0x03 /* ECN field mask */
/*
* Definitions for options.
*/
#define IPOPT_COPIED(o) ((o)&0x80)
#define IPOPT_CLASS(o) ((o)&0x60)
#define IPOPT_NUMBER(o) ((o)&0x1f)
#define IPOPT_CONTROL 0x00
#define IPOPT_RESERVED1 0x20
#define IPOPT_DEBMEAS 0x40
#define IPOPT_RESERVED2 0x60
#define IPOPT_EOL 0 /* end of option list */
#define IPOPT_NOP 1 /* no operation */
#define IPOPT_RR 7 /* record packet route */
#define IPOPT_TS 68 /* timestamp */
#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
#define IPOPT_LSRR 131 /* loose source route */
#define IPOPT_SATID 136 /* satnet id */
#define IPOPT_SSRR 137 /* strict source route */
/*
* Offsets to fields in options other than EOL and NOP.
*/
#define IPOPT_OPTVAL 0 /* option ID */
#define IPOPT_OLEN 1 /* option length */
#define IPOPT_OFFSET 2 /* offset within option */
#define IPOPT_MINOFF 4 /* min value of above */
/*
* Time stamp option structure.
*/
struct ip_timestamp {
u_int8_t ipt_code; /* IPOPT_TS */
u_int8_t ipt_len; /* size of structure (variable) */
u_int8_t ipt_ptr; /* index of current entry */
#if _BYTE_ORDER == _LITTLE_ENDIAN
u_int32_t ipt_flg:4, /* flags, see below */
ipt_oflw:4; /* overflow counter */
#endif
#if _BYTE_ORDER == _BIG_ENDIAN
u_int32_t ipt_oflw:4, /* overflow counter */
ipt_flg:4; /* flags, see below */
#endif
union ipt_timestamp {
n_time ipt_time[1];
struct ipt_ta {
struct in_addr ipt_addr;
n_time ipt_time;
} ipt_ta[1];
} ipt_timestamp;
};
/* flag bits for ipt_flg */
#define IPOPT_TS_TSONLY 0 /* timestamps only */
#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
#define IPOPT_TS_PRESPEC 3 /* specified modules only */
/* bits for security (not byte swapped) */
#define IPOPT_SECUR_UNCLASS 0x0000
#define IPOPT_SECUR_CONFID 0xf135
#define IPOPT_SECUR_EFTO 0x789a
#define IPOPT_SECUR_MMMM 0xbc4d
#define IPOPT_SECUR_RESTR 0xaf13
#define IPOPT_SECUR_SECRET 0xd788
#define IPOPT_SECUR_TOPSECRET 0x6bc5
/*
* Internet implementation parameters.
*/
#define MAXTTL 255 /* maximum time to live (seconds) */
#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
#define IPFRAGTTL 60 /* time to live for frags, slowhz */
#define IPTTLDEC 1 /* subtracted when forwarding */
#define IP_MSS 576 /* default maximum segment size */
/*
* This is the real IPv4 pseudo header, used for computing the TCP and UDP
* checksums. For the Internet checksum, struct ipovly can be used instead.
* For stronger checksums, the real thing must be used.
*/
struct ippseudo {
struct in_addr ippseudo_src; /* source internet address */
struct in_addr ippseudo_dst; /* destination internet address */
u_int8_t ippseudo_pad; /* pad, must be zero */
u_int8_t ippseudo_p; /* protocol */
u_int16_t ippseudo_len; /* protocol length */
};
/* BIONIC addition: declarations matching the Linux kernel */
/* some programs expect these... */
#define IPOPT_OPTVAL 0
#define IPOPT_OLEN 1
#define IPOPT_OFFSET 2
#define IPOPT_MINOFF 4
#define MAX_IPOPTLEN 40
#define IPOPT_COPY 0x80
#define IPOPT_CLASS_MASK 0x60
#define IPOPT_NUMBER_MASK 0x1f
#define IPOPT_CONTROL 0x00
#define IPOPT_RESERVED1 0x20
#define IPOPT_MEASUREMENT 0x40
#define IPOPT_RESERVED2 0x60
#define IPOPT_END (0 |IPOPT_CONTROL)
#define IPOPT_NOOP (1 |IPOPT_CONTROL)
#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY)
#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT)
#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY)
#define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY)
struct iphdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
uint8_t ihl :4,
version:4;
#elif defined (__BIG_ENDIAN_BITFIELD)
uint8_t version:4,
ihl :4;
#else
#error "Please fix <asm/byteorder.h>"
#endif
uint8_t tos;
uint16_t tot_len;
uint16_t id;
uint16_t frag_off;
uint8_t ttl;
uint8_t protocol;
uint16_t check;
int32_t saddr;
int32_t daddr;
};
struct ip_auth_hdr {
uint8_t nexthdr;
uint8_t hdrlen;
uint16_t reserved;
uint32_t spi;
uint32_t seq_no;
uint8_t auth_data[0];
};
struct ip_esp_hdr {
uint32_t spi;
uint32_t seq_no;
uint8_t enc_data[0];
};
struct ip_comp_hdr {
uint8_t nexthdr;
uint8_t flags;
uint16_t cpi;
};
__END_DECLS
#endif /* _NETINET_IP_H_ */

View File

@@ -0,0 +1,214 @@
/* $OpenBSD: ip_icmp.h,v 1.21 2005/07/31 03:30:55 pascoe Exp $ */
/* $NetBSD: ip_icmp.h,v 1.10 1996/02/13 23:42:28 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
*/
#ifndef _NETINET_IP_ICMP_H_
#define _NETINET_IP_ICMP_H_
#include <netinet/ip.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
/*
* Interface Control Message Protocol Definitions.
* Per RFC 792, September 1981.
* RFC 950, August 1985. (Address Mask Request / Reply)
* RFC 1256, September 1991. (Router Advertisement and Solicitation)
* RFC 1108, November 1991. (Param Problem, Missing Req. Option)
* RFC 1393, January 1993. (Traceroute)
* RFC 1475, June 1993. (Datagram Conversion Error)
* RFC 1812, June 1995. (adm prohib, host precedence, precedence cutoff)
* RFC 2002, October 1996. (Mobility changes to Router Advertisement)
*/
/*
* ICMP Router Advertisement data
*/
struct icmp_ra_addr {
uint32_t ira_addr;
uint32_t ira_preference;
};
/*
* Structure of an icmp header.
*/
struct icmp {
uint8_t icmp_type; /* type of message, see below */
uint8_t icmp_code; /* type sub code */
uint16_t icmp_cksum; /* ones complement cksum of struct */
union {
uint8_t ih_pptr; /* ICMP_PARAMPROB */
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
struct ih_idseq {
uint16_t icd_id;
uint16_t icd_seq;
} ih_idseq;
int32_t ih_void;
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
struct ih_pmtu {
uint16_t ipm_void;
uint16_t ipm_nextmtu;
} ih_pmtu;
struct ih_rtradv {
uint8_t irt_num_addrs;
uint8_t irt_wpa;
uint16_t irt_lifetime;
} ih_rtradv;
} icmp_hun;
#define icmp_pptr icmp_hun.ih_pptr
#define icmp_gwaddr icmp_hun.ih_gwaddr
#define icmp_id icmp_hun.ih_idseq.icd_id
#define icmp_seq icmp_hun.ih_idseq.icd_seq
#define icmp_void icmp_hun.ih_void
#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
union {
struct id_ts {
uint32_t its_otime;
uint32_t its_rtime;
uint32_t its_ttime;
} id_ts;
struct id_ip {
struct ip idi_ip;
/* options and then 64 bits of data */
} id_ip;
uint32_t id_mask;
int8_t id_data[1];
} icmp_dun;
#define icmp_otime icmp_dun.id_ts.its_otime
#define icmp_rtime icmp_dun.id_ts.its_rtime
#define icmp_ttime icmp_dun.id_ts.its_ttime
#define icmp_ip icmp_dun.id_ip.idi_ip
#define icmp_mask icmp_dun.id_mask
#define icmp_data icmp_dun.id_data
};
/*
* For IPv6 transition related ICMP errors.
*/
#define ICMP_V6ADVLENMIN (8 + sizeof(struct ip) + 40)
#define ICMP_V6ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 40)
/*
* Lower bounds on packet lengths for various types.
* For the error advice packets must first insure that the
* packet is large enough to contain the returned ip header.
* Only then can we do the check to see if 64 bits of packet
* data have been returned, since we need to check the returned
* ip header length.
*/
#define ICMP_MINLEN 8 /* abs minimum */
#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
#define ICMP_MASKLEN 12 /* address mask */
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
/* N.B.: must separately check that ip_hl >= 5 */
/*
* Definition of type and code field values.
* http://www.iana.org/assignments/icmp-parameters
*/
#define ICMP_ECHOREPLY 0 /* echo reply */
#define ICMP_UNREACH 3 /* dest unreachable, codes: */
#define ICMP_UNREACH_NET 0 /* bad net */
#define ICMP_UNREACH_HOST 1 /* bad host */
#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
#define ICMP_UNREACH_PORT 3 /* bad port */
#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */
#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */
#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */
#define ICMP_UNREACH_NET_PROHIB 9 /* for crypto devs */
#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */
#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */
#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */
#define ICMP_UNREACH_FILTER_PROHIB 13 /* prohibited access */
#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* precedence violat'n*/
#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* precedence cutoff */
#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
#define ICMP_REDIRECT 5 /* shorter route, codes: */
#define ICMP_REDIRECT_NET 0 /* for network */
#define ICMP_REDIRECT_HOST 1 /* for host */
#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
#define ICMP_ALTHOSTADDR 6 /* alternate host address */
#define ICMP_ECHO 8 /* echo service */
#define ICMP_ROUTERADVERT 9 /* router advertisement */
#define ICMP_ROUTERADVERT_NORMAL 0 /* normal advertisement */
#define ICMP_ROUTERADVERT_NOROUTE_COMMON 16 /* selective routing */
#define ICMP_ROUTERSOLICIT 10 /* router solicitation */
#define ICMP_TIMXCEED 11 /* time exceeded, code: */
#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
#define ICMP_PARAMPROB 12 /* ip header bad */
#define ICMP_PARAMPROB_ERRATPTR 0 /* req. opt. absent */
#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */
#define ICMP_PARAMPROB_LENGTH 2 /* bad length */
#define ICMP_TSTAMP 13 /* timestamp request */
#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
#define ICMP_IREQ 15 /* information request */
#define ICMP_IREQREPLY 16 /* information reply */
#define ICMP_MASKREQ 17 /* address mask request */
#define ICMP_MASKREPLY 18 /* address mask reply */
#define ICMP_TRACEROUTE 30 /* traceroute */
#define ICMP_DATACONVERR 31 /* data conversion error */
#define ICMP_MOBILE_REDIRECT 32 /* mobile host redirect */
#define ICMP_IPV6_WHEREAREYOU 33 /* IPv6 where-are-you */
#define ICMP_IPV6_IAMHERE 34 /* IPv6 i-am-here */
#define ICMP_MOBILE_REGREQUEST 35 /* mobile registration req */
#define ICMP_MOBILE_REGREPLY 36 /* mobile registration reply */
#define ICMP_SKIP 39 /* SKIP */
#define ICMP_PHOTURIS 40 /* Photuris */
#define ICMP_PHOTURIS_UNKNOWN_INDEX 1 /* unknown sec index */
#define ICMP_PHOTURIS_AUTH_FAILED 2 /* auth failed */
#define ICMP_PHOTURIS_DECRYPT_FAILED 3 /* decrypt failed */
#define ICMP_MAXTYPE 40
#define ICMP_INFOTYPE(type) \
((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
__END_DECLS
#endif /* _NETINET_IP_ICMP_H_ */

View File

@@ -0,0 +1,34 @@
/*
* 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 _NETINET_TCP_H
#define _NETINET_TCP_H
#include <endian.h> /* Include *before* linux/tcp.h */
#include <linux/tcp.h>
#endif /* _NETINET_TCP_H */

View File

@@ -0,0 +1,55 @@
/*
* 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 _NETINET_UDP_H
#define _NETINET_UDP_H
/*
* We would include linux/udp.h, but it brings in too much other stuff
*/
#ifdef __FAVOR_BSD
struct udphdr {
u_int16_t uh_sport; /* source port */
u_int16_t uh_dport; /* destination port */
u_int16_t uh_ulen; /* udp length */
u_int16_t uh_sum; /* udp checksum */
};
#else
struct udphdr {
__u16 source;
__u16 dest;
__u16 len;
__u16 check;
};
#endif /* __FAVOR_BSD */
#endif /* _NETINET_UDP_H */

View File

@@ -0,0 +1 @@
#include <linux/if_packet.h>

236
libc/include/nsswitch.h Normal file
View File

@@ -0,0 +1,236 @@
/* $NetBSD: nsswitch.h,v 1.18 2005/11/29 03:12:58 christos Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Luke Mewburn.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _NSSWITCH_H
#define _NSSWITCH_H 1
#include <sys/types.h>
#include <stdarg.h>
#define NSS_MODULE_INTERFACE_VERSION 0
#ifndef _PATH_NS_CONF
#define _PATH_NS_CONF "/etc/nsswitch.conf"
#endif
#define NS_CONTINUE 0
#define NS_RETURN 1
/*
* Layout of:
* uint32_t ns_src.flags
*/
/* nsswitch.conf status codes and nsdispatch(3) return values */
#define NS_SUCCESS (1<<0) /* entry was found */
#define NS_UNAVAIL (1<<1) /* source not responding, or corrupt */
#define NS_NOTFOUND (1<<2) /* source responded 'no such entry' */
#define NS_TRYAGAIN (1<<3) /* source busy, may respond to retrys */
#define NS_STATUSMASK 0x000000ff /* bitmask to get the status flags */
/* internal nsdispatch(3) flags; not settable in nsswitch.conf(5) */
#define NS_FORCEALL (1<<8) /* force all methods to be invoked; */
/*
* Currently implemented sources.
*/
#define NSSRC_FILES "files" /* local files */
#define NSSRC_DNS "dns" /* DNS; IN for hosts, HS for others */
#define NSSRC_NIS "nis" /* YP/NIS */
#define NSSRC_COMPAT "compat" /* passwd,group in YP compat mode */
/*
* Currently implemented databases.
*/
#define NSDB_HOSTS "hosts"
#define NSDB_GROUP "group"
#define NSDB_GROUP_COMPAT "group_compat"
#define NSDB_NETGROUP "netgroup"
#define NSDB_NETWORKS "networks"
#define NSDB_PASSWD "passwd"
#define NSDB_PASSWD_COMPAT "passwd_compat"
#define NSDB_SHELLS "shells"
/*
* Suggested databases to implement.
*/
#define NSDB_ALIASES "aliases"
#define NSDB_AUTH "auth"
#define NSDB_AUTOMOUNT "automount"
#define NSDB_BOOTPARAMS "bootparams"
#define NSDB_ETHERS "ethers"
#define NSDB_EXPORTS "exports"
#define NSDB_NETMASKS "netmasks"
#define NSDB_PHONES "phones"
#define NSDB_PRINTCAP "printcap"
#define NSDB_PROTOCOLS "protocols"
#define NSDB_REMOTE "remote"
#define NSDB_RPC "rpc"
#define NSDB_SENDMAILVARS "sendmailvars"
#define NSDB_SERVICES "services"
#define NSDB_TERMCAP "termcap"
#define NSDB_TTYS "ttys"
/*
* ns_dtab `callback' function signature.
*/
typedef int (*nss_method)(void *, void *, va_list);
/*
* ns_dtab - `nsswitch dispatch table'
* Contains an entry for each source and the appropriate function to call.
*/
typedef struct {
const char *src;
nss_method callback;
void *cb_data;
} ns_dtab;
/*
* Macros to help build an ns_dtab[]
*/
#define NS_FILES_CB(F,C) { NSSRC_FILES, F, __UNCONST(C) },
#define NS_COMPAT_CB(F,C) { NSSRC_COMPAT, F, __UNCONST(C) },
#ifdef HESIOD
# define NS_DNS_CB(F,C) { NSSRC_DNS, F, __UNCONST(C) },
#else
# define NS_DNS_CB(F,C)
#endif
#ifdef YP
# define NS_NIS_CB(F,C) { NSSRC_NIS, F, __UNCONST(C) },
#else
# define NS_NIS_CB(F,C)
#endif
/*
* ns_src - `nsswitch source'
* Used by the nsparser routines to store a mapping between a source
* and its dispatch control flags for a given database.
*/
typedef struct {
const char *name;
uint32_t flags;
} ns_src;
/*
* Default sourcelists (if nsswitch.conf is missing, corrupt,
* or the requested database doesn't have an entry)
*/
extern const ns_src __nsdefaultsrc[];
extern const ns_src __nsdefaultcompat[];
extern const ns_src __nsdefaultcompat_forceall[];
extern const ns_src __nsdefaultfiles[];
extern const ns_src __nsdefaultfiles_forceall[];
extern const ns_src __nsdefaultnis[];
extern const ns_src __nsdefaultnis_forceall[];
/*
* ns_mtab - `nsswitch method table'
* An nsswitch module provides a mapping from (database name, method name)
* tuples to the nss_method and associated callback data. Effectively,
* ns_dtab, but used for dynamically loaded modules.
*/
typedef struct {
const char *database;
const char *name;
nss_method method;
void *mdata;
} ns_mtab;
/*
* nss_module_register_fn - module registration function
* called at module load
* nss_module_unregister_fn - module un-registration function
* called at module unload
*/
typedef void (*nss_module_unregister_fn)(ns_mtab *, u_int);
typedef ns_mtab *(*nss_module_register_fn)(const char *, u_int *,
nss_module_unregister_fn *);
#ifdef _NS_PRIVATE
/*
* Private data structures for back-end nsswitch implementation.
*/
/*
* ns_dbt - `nsswitch database thang'
* For each database in /etc/nsswitch.conf there is a ns_dbt, with its
* name and a list of ns_src's containing the source information.
*/
typedef struct {
const char *name; /* name of database */
ns_src *srclist; /* list of sources */
u_int srclistsize; /* size of srclist */
} ns_dbt;
/*
* ns_mod - `nsswitch module'
*/
typedef struct {
const char *name; /* module name */
void *handle; /* handle from dlopen() */
ns_mtab *mtab; /* method table */
u_int mtabsize; /* size of mtab */
/* called to unload module */
nss_module_unregister_fn unregister;
} ns_mod;
#endif /* _NS_PRIVATE */
#include <sys/cdefs.h>
__BEGIN_DECLS
int nsdispatch(void *, const ns_dtab [], const char *,
const char *, const ns_src [], ...);
#ifdef _NS_PRIVATE
int _nsdbtaddsrc(ns_dbt *, const ns_src *);
void _nsdbtdump(const ns_dbt *);
int _nsdbtput(const ns_dbt *);
void _nsyyerror(const char *);
int _nsyylex(void);
#endif /* _NS_PRIVATE */
__END_DECLS
#endif /* !_NSSWITCH_H */

58
libc/include/pathconf.h Normal file
View File

@@ -0,0 +1,58 @@
/*
* 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 _PATHCONF_H_
#define _PATHCONF_H_
/* constants to be used for the 'name' paremeter of pathconf/fpathconf */
#define _PC_FILESIZEBITS 0x0000
#define _PC_LINK_MAX 0x0001
#define _PC_MAX_CANON 0x0002
#define _PC_MAX_INPUT 0x0003
#define _PC_NAME_MAX 0x0004
#define _PC_PATH_MAX 0x0005
#define _PC_PIPE_BUF 0x0006
#define _PC_2_SYMLINKS 0x0007
#define _PC_ALLOC_SIZE_MIN 0x0008
#define _PC_REC_INCR_XFER_SIZE 0x0009
#define _PC_REC_MAX_XFER_SIZE 0x000a
#define _PC_REC_MIN_XFER_SIZE 0x000b
#define _PC_REC_XFER_ALIGN 0x000c
#define _PC_SYMLINK_MAX 0x000d
#define _PC_CHOWN_RESTRICTED 0x000e
#define _PC_NO_TRUNC 0x000f
#define _PC_VDISABLE 0x0010
#define _PC_ASYNC_IO 0x0011
#define _PC_PRIO_IO 0x0012
#define _PC_SYNC_IO 0x0013
extern long fpathconf(int fildes, int name);
extern long pathconf(const char *path, int name);
#endif /* _PATHCONF_H_ */

74
libc/include/paths.h Normal file
View File

@@ -0,0 +1,74 @@
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)paths.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _PATHS_H_
#define _PATHS_H_
/* Default search path. */
#define _PATH_DEFPATH "/usr/bin:/bin"
/* All standard utilities path. */
#define _PATH_STDPATH \
"/usr/bin:/bin:/usr/sbin:/sbin"
#define _PATH_BSHELL "/system/bin/sh"
#define _PATH_CONSOLE "/dev/console"
#define _PATH_CSHELL "/bin/csh"
#define _PATH_DEVDB "/var/run/dev.db"
#define _PATH_DEVNULL "/dev/null"
#define _PATH_DRUM "/dev/drum"
#define _PATH_KLOG "/proc/kmsg"
#define _PATH_KMEM "/dev/kmem"
#define _PATH_LASTLOG "/var/log/lastlog"
#define _PATH_MAILDIR "/var/mail"
#define _PATH_MAN "/usr/share/man"
#define _PATH_MEM "/dev/mem"
#define _PATH_MNTTAB "/etc/fstab"
#define _PATH_MOUNTED "/etc/mtab"
#define _PATH_NOLOGIN "/etc/nologin"
#define _PATH_PRESERVE "/var/lib"
#define _PATH_RWHODIR "/var/spool/rwho"
#define _PATH_SENDMAIL "/usr/sbin/sendmail"
#define _PATH_SHADOW "/etc/shadow"
#define _PATH_SHELLS "/etc/shells"
#define _PATH_TTY "/dev/tty"
#define _PATH_UNIX "/boot/vmlinux"
#define _PATH_UTMP "/var/run/utmp"
#define _PATH_VI "/bin/vi"
#define _PATH_WTMP "/var/log/wtmp"
/* Provide trailing slash, since mostly used for building pathnames. */
#define _PATH_DEV "/dev/"
#define _PATH_TMP "/tmp/"
#define _PATH_VARDB "/var/db/"
#define _PATH_VARRUN "/var/run/"
#define _PATH_VARTMP "/var/tmp/"
#endif /* !_PATHS_H_ */

43
libc/include/poll.h Normal file
View File

@@ -0,0 +1,43 @@
/*
* 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 _POLL_H_
#define _POLL_H_
#include <sys/cdefs.h>
#include <linux/poll.h>
__BEGIN_DECLS
typedef unsigned int nfds_t;
/* POSIX specifies "int" for the timeout, Linux seems to use long... */
extern int poll(struct pollfd *, nfds_t, long);
__END_DECLS
#endif /* _POLL_H_ */

235
libc/include/pthread.h Normal file
View File

@@ -0,0 +1,235 @@
/*
* 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 _PTHREAD_H_
#define _PTHREAD_H_
#include <time.h>
#include <signal.h>
#include <sched.h>
#include <limits.h>
#include <sys/types.h>
/*
* Types
*/
typedef struct
{
int volatile value;
} pthread_mutex_t;
#define PTHREAD_MUTEX_INITIALIZER {0}
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER {0x4000}
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER {0x8000}
enum {
PTHREAD_MUTEX_NORMAL = 0,
PTHREAD_MUTEX_RECURSIVE = 1,
PTHREAD_MUTEX_ERRORCHECK = 2,
PTHREAD_MUTEX_ERRORCHECK_NP = PTHREAD_MUTEX_ERRORCHECK,
PTHREAD_MUTEX_RECURSIVE_NP = PTHREAD_MUTEX_RECURSIVE,
PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
};
typedef struct
{
int volatile value;
} pthread_cond_t;
typedef struct
{
uint32_t flags;
void * stack_base;
size_t stack_size;
size_t guard_size;
int32_t sched_policy;
int32_t sched_priority;
} pthread_attr_t;
typedef long pthread_mutexattr_t;
typedef long pthread_condattr_t;
typedef int pthread_key_t;
typedef long pthread_t;
typedef volatile int pthread_once_t;
/*
* Defines
*/
#define PTHREAD_COND_INITIALIZER {0}
#define PTHREAD_STACK_MIN (2 * PAGE_SIZE)
#define PTHREAD_CREATE_DETACHED 0x00000001
#define PTHREAD_CREATE_JOINABLE 0x00000000
#define PTHREAD_ONCE_INIT 0
#define PTHREAD_PROCESS_PRIVATE 0
#define PTHREAD_PROCESS_SHARED 1
/*
* Prototypes
*/
#if __cplusplus
extern "C" {
#endif
int pthread_attr_init(pthread_attr_t * attr);
int pthread_attr_destroy(pthread_attr_t * attr);
int pthread_attr_setdetachstate(pthread_attr_t * attr, int state);
int pthread_attr_getdetachstate(pthread_attr_t const * attr, int * state);
int pthread_attr_setschedpolicy(pthread_attr_t * attr, int policy);
int pthread_attr_getschedpolicy(pthread_attr_t const * attr, int * policy);
int pthread_attr_setschedparam(pthread_attr_t * attr, struct sched_param const * param);
int pthread_attr_getschedparam(pthread_attr_t const * attr, struct sched_param * param);
int pthread_attr_setstacksize(pthread_attr_t * attr, size_t stack_size);
int pthread_attr_getstacksize(pthread_attr_t const * attr, size_t * stack_size);
int pthread_attr_setstackaddr(pthread_attr_t * attr, void * stackaddr);
int pthread_attr_getstackaddr(pthread_attr_t const * attr, void ** stackaddr);
int pthread_attr_setstack(pthread_attr_t * attr, void * stackaddr, size_t stack_size);
int pthread_attr_getstack(pthread_attr_t const * attr, void ** stackaddr, size_t * stack_size);
int pthread_attr_setguardsize(pthread_attr_t * attr, size_t guard_size);
int pthread_attr_getguardsize(pthread_attr_t const * attr, size_t * guard_size);
int pthread_getattr_np(pthread_t thid, pthread_attr_t * attr);
int pthread_create(pthread_t *thread, pthread_attr_t const * attr,
void *(*start_routine)(void *), void * arg);
void pthread_exit(void * retval);
int pthread_join(pthread_t thid, void ** ret_val);
int pthread_detach(pthread_t thid);
pthread_t pthread_self(void);
int pthread_equal(pthread_t one, pthread_t two);
int pthread_getschedparam(pthread_t thid, int * policy,
struct sched_param * param);
int pthread_setschedparam(pthread_t thid, int poilcy,
struct sched_param const * param);
int pthread_mutexattr_init(pthread_mutexattr_t *attr);
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr);
int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type);
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
int pthread_mutex_init(pthread_mutex_t *mutex,
const pthread_mutexattr_t *attr);
int pthread_mutex_destroy(pthread_mutex_t *mutex);
int pthread_mutex_lock(pthread_mutex_t *mutex);
int pthread_mutex_unlock(pthread_mutex_t *mutex);
int pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_mutex_timedlock(pthread_mutex_t *mutex, struct timespec* ts);
int pthread_cond_init(pthread_cond_t *cond,
const pthread_condattr_t *attr);
int pthread_cond_destroy(pthread_cond_t *cond);
int pthread_cond_broadcast(pthread_cond_t *cond);
int pthread_cond_signal(pthread_cond_t *cond);
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
int pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t * mutex,
const struct timespec *abstime);
/* BIONIC: same as pthread_cond_timedwait, except the 'abstime' given refers
* to the CLOCK_MONOTONIC clock instead, to avoid any problems when
* the wall-clock time is changed brutally
*/
int pthread_cond_timedwait_monotonic(pthread_cond_t *cond,
pthread_mutex_t *mutex,
const struct timespec *abstime);
int pthread_cond_timeout_np(pthread_cond_t *cond,
pthread_mutex_t * mutex,
unsigned msecs);
int pthread_key_create(pthread_key_t *key, void (*destructor_function)(void *));
int pthread_key_delete (pthread_key_t);
int pthread_setspecific(pthread_key_t key, const void *value);
void *pthread_getspecific(pthread_key_t key);
int pthread_kill(pthread_t tid, int sig);
int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
int pthread_getcpuclockid(pthread_t tid, clockid_t *clockid);
int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));
typedef void (*__pthread_cleanup_func_t)(void*);
typedef struct __pthread_cleanup_t {
struct __pthread_cleanup_t* __cleanup_prev;
__pthread_cleanup_func_t __cleanup_routine;
void* __cleanup_arg;
} __pthread_cleanup_t;
extern void __pthread_cleanup_push(__pthread_cleanup_t* c,
__pthread_cleanup_func_t routine,
void* arg);
extern void __pthread_cleanup_pop(__pthread_cleanup_t* c,
int execute);
/* Believe or not, the definitions of pthread_cleanup_push and
* pthread_cleanup_pop below are correct. Posix states that these
* can be implemented as macros that might introduce opening and
* closing braces, and that using setjmp/longjmp/return/break/continue
* between them results in undefined behaviour.
*
* And indeed, GLibc and other C libraries use a similar definition
*/
#define pthread_cleanup_push(routine, arg) \
do { \
__pthread_cleanup_t __cleanup; \
__pthread_cleanup_push( &__cleanup, (routine), (arg) ); \
#define pthread_cleanup_pop(execute) \
__pthread_cleanup_pop( &__cleanup, (execute)); \
} while (0);
#if __cplusplus
} /* extern "C" */
#endif
/************ TO FIX ************/
#define LONG_LONG_MAX __LONG_LONG_MAX__
#define LONG_LONG_MIN (-__LONG_LONG_MAX__ - 1)
#endif // _PTHREAD_H_

125
libc/include/pwd.h Normal file
View File

@@ -0,0 +1,125 @@
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)pwd.h 8.2 (Berkeley) 1/21/94
*/
/*-
* Portions Copyright(C) 1995, Jason Downs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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 _PWD_H_
#define _PWD_H_
#include <sys/cdefs.h>
#include <sys/types.h>
#define _PATH_PASSWD "/etc/passwd"
#define _PATH_MASTERPASSWD "/etc/master.passwd"
#define _PATH_MASTERPASSWD_LOCK "/etc/ptmp"
#define _PATH_PASSWD_CONF "/etc/passwd.conf"
#define _PATH_PASSWDCONF _PATH_PASSWD_CONF /* XXX: compat */
#define _PATH_USERMGMT_CONF "/etc/usermgmt.conf"
#define _PATH_MP_DB "/etc/pwd.db"
#define _PATH_SMP_DB "/etc/spwd.db"
#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb"
#define _PW_KEYBYNAME '1' /* stored by name */
#define _PW_KEYBYNUM '2' /* stored by entry in the "file" */
#define _PW_KEYBYUID '3' /* stored by uid */
#define _PASSWORD_EFMT1 '_' /* extended DES encryption format */
#define _PASSWORD_NONDES '$' /* non-DES encryption formats */
#define _PASSWORD_LEN 128 /* max length, not counting NUL */
#define _PASSWORD_NOUID 0x01 /* flag for no specified uid. */
#define _PASSWORD_NOGID 0x02 /* flag for no specified gid. */
#define _PASSWORD_NOCHG 0x04 /* flag for no specified change. */
#define _PASSWORD_NOEXP 0x08 /* flag for no specified expire. */
#define _PASSWORD_OLDFMT 0x10 /* flag to expect an old style entry */
#define _PASSWORD_NOWARN 0x20 /* no warnings for bad entries */
#define _PASSWORD_WARNDAYS 14 /* days to warn about expiry */
#define _PASSWORD_CHGNOW -1 /* special day to force password change at next login */
struct passwd
{
char* pw_name;
char* pw_passwd;
uid_t pw_uid;
gid_t pw_gid;
char* pw_dir;
char* pw_shell;
};
__BEGIN_DECLS
struct passwd* getpwnam(const char*);
struct passwd* getpwuid(uid_t);
int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);
int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);
void endpwent(void);
struct passwd* getpwent(void);
int setpwent(void);
__END_DECLS
#endif

54
libc/include/resolv.h Normal file
View File

@@ -0,0 +1,54 @@
/*
* 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 _RESOLV_H_
#define _RESOLV_H_
#include <sys/param.h>
#include <sys/types.h>
#include <sys/cdefs.h>
#include <sys/socket.h>
#include <stdio.h>
#include <arpa/nameser.h>
__BEGIN_DECLS
struct res_state;
extern struct __res_state *__res_state(void);
#define _res (*__res_state())
/* Base-64 functions - because some code expects it there */
#define b64_ntop __b64_ntop
#define b64_pton __b64_pton
extern int b64_ntop(u_char const *, size_t, char *, size_t);
extern int b64_pton(char const *, u_char *, size_t);
__END_DECLS
#endif /* _RESOLV_H_ */

77
libc/include/sched.h Normal file
View File

@@ -0,0 +1,77 @@
/*
* 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 _SCHED_H_
#define _SCHED_H_
#include <sys/cdefs.h>
#include <sys/time.h>
__BEGIN_DECLS
#define SCHED_NORMAL 0
#define SCHED_OTHER 0
#define SCHED_FIFO 1
#define SCHED_RR 2
struct sched_param {
int sched_priority;
};
extern int sched_setscheduler(pid_t, int, const struct sched_param *);
extern int sched_getscheduler(pid_t);
extern int sched_yield(void);
extern int sched_get_priority_max(int policy);
extern int sched_get_priority_min(int policy);
extern int sched_setparam(pid_t, const struct sched_param *);
extern int sched_getparam(pid_t, struct sched_param *);
extern int sched_rr_get_interval(pid_t pid, struct timespec *tp);
#define CLONE_VM 0x00000100
#define CLONE_FS 0x00000200
#define CLONE_FILES 0x00000400
#define CLONE_SIGHAND 0x00000800
#define CLONE_PTRACE 0x00002000
#define CLONE_VFORK 0x00004000
#define CLONE_PARENT 0x00008000
#define CLONE_THREAD 0x00010000
#define CLONE_NEWNS 0x00020000
#define CLONE_SYSVSEM 0x00040000
#define CLONE_SETTLS 0x00080000
#define CLONE_PARENT_SETTID 0x00100000
#define CLONE_CHILD_CLEARTID 0x00200000
#define CLONE_DETACHED 0x00400000
#define CLONE_UNTRACED 0x00800000
#define CLONE_CHILD_SETTID 0x01000000
#define CLONE_STOPPED 0x02000000
extern int clone(int (*fn)(void*), void *child_stack, int flags, void *arg);
extern pid_t __clone(int, void *);
__END_DECLS
#endif /* _SCHED_H_ */

55
libc/include/semaphore.h Normal file
View File

@@ -0,0 +1,55 @@
/*
* 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 _SEMAPHORE_H
#define _SEMAPHORE_H
#include <sys/cdefs.h>
__BEGIN_DECLS
typedef struct {
volatile unsigned int count;
} sem_t;
#define SEM_FAILED NULL
extern int sem_init(sem_t *sem, int pshared, unsigned int value);
extern int sem_close(sem_t *);
extern int sem_destroy(sem_t *);
extern int sem_getvalue(sem_t *, int *);
extern int sem_init(sem_t *, int, unsigned int);
extern sem_t *sem_open(const char *, int, ...);
extern int sem_post(sem_t *);
extern int sem_trywait(sem_t *);
extern int sem_unlink(const char *);
extern int sem_wait(sem_t *);
__END_DECLS
#endif /* _SEMAPHORE_H */

78
libc/include/setjmp.h Normal file
View File

@@ -0,0 +1,78 @@
/* $OpenBSD: setjmp.h,v 1.5 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: setjmp.h,v 1.11 1994/12/20 10:35:44 cgd Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)setjmp.h 8.2 (Berkeley) 1/21/94
*/
#ifndef _SETJMP_H_
#define _SETJMP_H_
#include <sys/cdefs.h>
#include <machine/setjmp.h>
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
typedef long sigjmp_buf[_JBLEN + 1];
#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
typedef long jmp_buf[_JBLEN];
__BEGIN_DECLS
/* BIONIC SPECIAL: we *don't* save the signal mask in setjmp/longjmp
* this means we comply with ANSI, not with POSIX, and
* our runtime runs well instead of getting stuck
*/
#if 1
#define setjmp(x) _setjmp(x)
#define longjmp(x,y) _longjmp(x,y)
#else
int setjmp(jmp_buf);
void longjmp(jmp_buf, int);
#endif
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
int sigsetjmp(sigjmp_buf, int);
void siglongjmp(sigjmp_buf, int);
#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
#if __BSD_VISIBLE || __XPG_VISIBLE
int _setjmp(jmp_buf);
void _longjmp(jmp_buf, int);
void longjmperror(void);
#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
__END_DECLS
#endif /* !_SETJMP_H_ */

48
libc/include/sgtty.h Normal file
View File

@@ -0,0 +1,48 @@
/* $NetBSD: sgtty.h,v 1.8 2005/02/03 04:39:32 perry Exp $ */
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)sgtty.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _SGTTY_H_
#define _SGTTY_H_
#ifndef USE_OLD_TTY
#define USE_OLD_TTY
#endif
#include <sys/ioctl.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
int gtty(int, struct sgttyb *);
int stty(int, struct sgttyb *);
__END_DECLS
#endif /* _SGTTY_H_ */

31
libc/include/sha1.h Normal file
View File

@@ -0,0 +1,31 @@
/* $NetBSD: sha1.h,v 1.13 2005/12/26 18:41:36 perry Exp $ */
/*
* SHA-1 in C
* By Steve Reid <steve@edmweb.com>
* 100% Public Domain
*/
#ifndef _SYS_SHA1_H_
#define _SYS_SHA1_H_
#include <sys/cdefs.h>
#include <sys/types.h>
#define SHA1_DIGEST_LENGTH 20
#define SHA1_DIGEST_STRING_LENGTH 41
typedef struct {
uint32_t state[5];
uint32_t count[2];
u_char buffer[64];
} SHA1_CTX;
__BEGIN_DECLS
void SHA1Transform(uint32_t[5], const u_char[64]);
void SHA1Init(SHA1_CTX *);
void SHA1Update(SHA1_CTX *, const u_char *, u_int);
void SHA1Final(u_char[SHA1_DIGEST_LENGTH], SHA1_CTX *);
__END_DECLS
#endif /* _SYS_SHA1_H_ */

124
libc/include/signal.h Normal file
View File

@@ -0,0 +1,124 @@
/*
* 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 _SIGNAL_H_
#define _SIGNAL_H_
#include <sys/cdefs.h>
#include <limits.h> /* For LONG_BIT */
#include <string.h> /* For memset() */
#include <sys/types.h>
#include <asm/signal.h>
#define __ARCH_SI_UID_T __kernel_uid32_t
#include <asm/siginfo.h>
#undef __ARCH_SI_UID_T
__BEGIN_DECLS
typedef int sig_atomic_t;
/* crepy NIG / _NSIG handling, just to be safe */
#ifndef NSIG
# define NSIG _NSIG
#endif
#ifndef _NSIG
# define _NSIG NSIG
#endif
extern const char * const sys_siglist[];
static __inline__ int sigismember(sigset_t *set, int signum)
{
unsigned long *local_set = (unsigned long *)set;
signum--;
return (int)((local_set[signum/LONG_BIT] >> (signum%LONG_BIT)) & 1);
}
static __inline__ int sigaddset(sigset_t *set, int signum)
{
unsigned long *local_set = (unsigned long *)set;
signum--;
local_set[signum/LONG_BIT] |= 1UL << (signum%LONG_BIT);
return 0;
}
static __inline__ int sigdelset(sigset_t *set, int signum)
{
unsigned long *local_set = (unsigned long *)set;
signum--;
local_set[signum/LONG_BIT] &= ~(1UL << (signum%LONG_BIT));
return 0;
}
static __inline__ int sigemptyset(sigset_t *set)
{
memset(set, 0, sizeof *set);
return 0;
}
static __inline__ int sigfillset(sigset_t *set)
{
memset(set, ~0, sizeof *set);
return 0;
}
/* compatibility types */
typedef void (*sig_t)(int);
typedef sig_t sighandler_t;
/* differentiater between sysv and bsd behaviour 8*/
extern __sighandler_t sysv_signal(int, __sighandler_t);
extern __sighandler_t bsd_signal(int, __sighandler_t);
/* the default is bsd */
static __inline__ __sighandler_t signal(int s, __sighandler_t f)
{
return bsd_signal(s,f);
}
/* the syscall itself */
extern __sighandler_t __signal(int, __sighandler_t, int);
extern int sigprocmask(int, const sigset_t *, sigset_t *);
extern int sigaction(int, const struct sigaction *, struct sigaction *);
extern int sigpending(sigset_t *);
extern int sigsuspend(const sigset_t *);
extern int sigwait(const sigset_t *set, int *sig);
extern int raise(int);
extern int kill(pid_t, int);
__END_DECLS
#endif /* _SIGNAL_H_ */

257
libc/include/stdint.h Normal file
View File

@@ -0,0 +1,257 @@
/*
* 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 _STDINT_H
#define _STDINT_H
#include <stddef.h>
#include <sys/_types.h>
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
# define __STDINT_LIMITS
#endif
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
# define __STDINT_MACROS
#endif
typedef __int8_t int8_t;
typedef __uint8_t uint8_t;
typedef __int16_t int16_t;
typedef __uint16_t uint16_t;
typedef __int32_t int32_t;
typedef __uint32_t uint32_t;
#if !defined(__STRICT_ANSI__)
typedef __int64_t int64_t;
typedef __uint64_t uint64_t;
#endif
/*
* int8_t & uint8_t
*/
typedef int8_t int_least8_t;
typedef int8_t int_fast8_t;
typedef uint8_t uint_least8_t;
typedef uint8_t uint_fast8_t;
#ifdef __STDINT_LIMITS
# define INT8_MIN (-128)
# define INT8_MAX (127)
# define INT_LEAST8_MIN INT8_MIN
# define INT_LEAST8_MAX INT8_MAX
# define INT_FAST8_MIN INT8_MIN
# define INT_FAST8_MAX INT8_MAX
# define UINT8_MAX (255U)
# define UINT_LEAST8_MAX UINT8_MAX
# define UINT_FAST8_MAX UINT8_MAX
#endif
#ifdef __STDINT_MACROS
# define INT8_C(c) c
# define INT_LEAST8_C(c) INT8_C(c)
# define INT_FAST8_C(c) INT8_C(c)
# define UINT8_C(c) c ## U
# define UINT_LEAST8_C(c) UINT8_C(c)
# define UINT_FAST8_C(c) UINT8_C(c)
#endif
/*
* int16_t & uint16_t
*/
typedef int16_t int_least16_t;
typedef int32_t int_fast16_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_fast16_t;
#ifdef __STDINT_LIMITS
# define INT16_MIN (-32768)
# define INT16_MAX (32767)
# define INT_LEAST16_MIN INT16_MIN
# define INT_LEAST16_MAX INT16_MAX
# define INT_FAST16_MIN INT32_MIN
# define INT_FAST16_MAX INT32_MAX
# define UINT16_MAX (65535U)
# define UINT_LEAST16_MAX UINT16_MAX
# define UINT_FAST16_MAX UINT32_MAX
#endif
#ifdef __STDINT_MACROS
# define INT16_C(c) c
# define INT_LEAST16_C(c) INT16_C(c)
# define INT_FAST16_C(c) INT32_C(c)
# define UINT16_C(c) c ## U
# define UINT_LEAST16_C(c) UINT16_C(c)
# define UINT_FAST16_C(c) UINT32_C(c)
#endif
/*
* int32_t & uint32_t
*/
typedef int32_t int_least32_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_least32_t;
typedef uint32_t uint_fast32_t;
#ifdef __STDINT_LIMITS
# define INT32_MIN (-2147483647-1)
# define INT32_MAX (2147483647)
# define INT_LEAST32_MIN INT32_MIN
# define INT_LEAST32_MAX INT32_MAX
# define INT_FAST32_MIN INT32_MIN
# define INT_FAST32_MAX INT32_MAX
# define UINT32_MAX (4294967295U)
# define UINT_LEAST32_MAX UINT32_MAX
# define UINT_FAST32_MAX UINT32_MAX
#endif
#ifdef __STDINT_MACROS
# define INT32_C(c) c
# define INT_LEAST32_C(c) INT32_C(c)
# define INT_FAST32_C(c) INT32_C(c)
# define UINT32_C(c) c ## U
# define UINT_LEAST32_C(c) UINT32_C(c)
# define UINT_FAST32_C(c) UINT32_C(c)
#endif
#if !defined(__STRICT_ANSI__)
/*
* int64_t
*/
typedef int64_t int_least64_t;
typedef int64_t int_fast64_t;
typedef uint64_t uint_least64_t;
typedef uint64_t uint_fast64_t;
#ifdef __STDINT_LIMITS
# define INT64_MIN (__INT64_C(-9223372036854775807)-1)
# define INT64_MAX (__INT64_C(9223372036854775807))
# define INT_LEAST64_MIN INT64_MIN
# define INT_LEAST64_MAX INT64_MAX
# define INT_FAST64_MIN INT64_MIN
# define INT_FAST64_MAX INT64_MAX
# define UINT64_MAX (__UINT64_C(18446744073709551615))
# define UINT_LEAST64_MAX UINT64_MAX
# define UINT_FAST64_MAX UINT64_MAX
#endif
#ifdef __STDINT_MACROS
# define __INT64_C(c) c ## LL
# define INT64_C(c) __INT64_C(c)
# define INT_LEAST64_C(c) INT64_C(c)
# define INT_FAST64_C(c) INT64_C(c)
# define __UINT64_C(c) c ## ULL
# define UINT64_C(c) __UINT64_C(c)
# define UINT_LEAST64_C(c) UINT64_C(c)
# define UINT_FAST64_C(c) UINT64_C(c)
#endif
# define __PRI64_RANK "ll"
# define __PRIFAST_RANK ""
# define __PRIPTR_RANK ""
#endif /* !__STRICT_ANSI__ */
/*
* intptr_t & uintptr_t
*/
typedef int intptr_t;
typedef unsigned int uintptr_t;
# define INTPTR_MIN INT32_MIN
# define INTPTR_MAX INT32_MAX
# define UINTPTR_MAX UINT32_MAX
# define INTPTR_C(c) INT32_C(c)
# define UINTPTR_C(c) UINT32_C(c)
# define PTRDIFF_C(c) INT32_C(c)
# define PTRDIFF_MIN INT32_MIN
# define PTRDIFF_MAX INT32_MAX
/*
* intmax_t & uintmax_t
*/
#if !defined(__STRICT_ANSI__)
typedef uint64_t uintmax_t;
typedef int64_t intmax_t;
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
#define INTMAX_C(c) INT64_C(c)
#define UINTMAX_C(c) UINT64_C(c)
#else /* __STRICT_ANSI__ */
typedef uint32_t uintmax_t;
typedef int32_t intmax_t;
#define INTMAX_MIN INT32_MIN
#define INTMAX_MAX INT32_MAX
#define UINTMAX_MAX UINT32_MAX
#define INTMAX_C(c) INT32_C(c)
#define UINTMAX_C(c) UINT32_C(c)
#endif /* __STRICT_ANSI__ */
/* size_t is defined by the GCC-specific <stddef.h> */
#ifndef _SSIZE_T_DEFINED_
#define _SSIZE_T_DEFINED_
typedef long int ssize_t;
#endif
#define _BITSIZE 32
/* Keep the kernel from trying to define these types... */
#define __BIT_TYPES_DEFINED__
#endif /* _STDINT_H */

433
libc/include/stdio.h Normal file
View File

@@ -0,0 +1,433 @@
/* $OpenBSD: stdio.h,v 1.35 2006/01/13 18:10:09 miod Exp $ */
/* $NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)stdio.h 5.17 (Berkeley) 6/3/91
*/
#ifndef _STDIO_H_
#define _STDIO_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
#include <sys/types.h> /* XXX should be removed */
#endif
#ifndef _SIZE_T_DEFINED_
#define _SIZE_T_DEFINED_
typedef unsigned long size_t;
#endif
#ifndef _OFF_T_DEFINED_
#define _OFF_T_DEFINED_
typedef long off_t;
#endif
#ifndef NULL
#ifdef __GNUG__
#define NULL __null
#else
#define NULL 0L
#endif
#endif
#define _FSTDIO /* Define for new stdio with functions. */
typedef off_t fpos_t; /* stdio file position type */
/*
* NB: to fit things in six character monocase externals, the stdio
* code uses the prefix `__s' for stdio objects, typically followed
* by a three-character attempt at a mnemonic.
*/
/* stdio buffers */
struct __sbuf {
unsigned char *_base;
int _size;
};
/*
* stdio state variables.
*
* The following always hold:
*
* if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
* _lbfsize is -_bf._size, else _lbfsize is 0
* if _flags&__SRD, _w is 0
* if _flags&__SWR, _r is 0
*
* This ensures that the getc and putc macros (or inline functions) never
* try to write or read from a file that is in `read' or `write' mode.
* (Moreover, they can, and do, automatically switch from read mode to
* write mode, and back, on "r+" and "w+" files.)
*
* _lbfsize is used only to make the inline line-buffered output stream
* code as compact as possible.
*
* _ub, _up, and _ur are used when ungetc() pushes back more characters
* than fit in the current _bf, or when ungetc() pushes back a character
* that does not match the previous one in _bf. When this happens,
* _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
* _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
*/
typedef struct __sFILE {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* 0 or -_bf._size, for inline putc */
/* operations */
void *_cookie; /* cookie passed to io functions */
int (*_close)(void *);
int (*_read)(void *, char *, int);
fpos_t (*_seek)(void *, fpos_t, int);
int (*_write)(void *, const char *, int);
/* extension data, to avoid further ABI breakage */
struct __sbuf _ext;
/* data for long sequences of ungetc() */
unsigned char *_up; /* saved _p when _p is doing ungetc data */
int _ur; /* saved _r when _r is counting ungetc data */
/* tricks to meet minimum requirements even when malloc() fails */
unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
unsigned char _nbuf[1]; /* guarantee a getc() buffer */
/* separate buffer for fgetln() when line crosses buffer boundary */
struct __sbuf _lb; /* buffer for fgetln() */
/* Unix stdio files get aligned to block boundaries on fseek() */
int _blksize; /* stat.st_blksize (may be != _bf._size) */
fpos_t _offset; /* current lseek offset */
} FILE;
__BEGIN_DECLS
extern FILE __sF[];
__END_DECLS
#define __SLBF 0x0001 /* line buffered */
#define __SNBF 0x0002 /* unbuffered */
#define __SRD 0x0004 /* OK to read */
#define __SWR 0x0008 /* OK to write */
/* RD and WR are never simultaneously asserted */
#define __SRW 0x0010 /* open for reading & writing */
#define __SEOF 0x0020 /* found EOF */
#define __SERR 0x0040 /* found error */
#define __SMBF 0x0080 /* _buf is from malloc */
#define __SAPP 0x0100 /* fdopen()ed in append mode */
#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
#define __SOPT 0x0400 /* do fseek() optimisation */
#define __SNPT 0x0800 /* do not do fseek() optimisation */
#define __SOFF 0x1000 /* set iff _offset is in fact correct */
#define __SMOD 0x2000 /* true => fgetln modified _p text */
#define __SALC 0x4000 /* allocate string space dynamically */
/*
* The following three definitions are for ANSI C, which took them
* from System V, which brilliantly took internal interface macros and
* made them official arguments to setvbuf(), without renaming them.
* Hence, these ugly _IOxxx names are *supposed* to appear in user code.
*
* Although numbered as their counterparts above, the implementation
* does not rely on this.
*/
#define _IOFBF 0 /* setvbuf should set fully buffered */
#define _IOLBF 1 /* setvbuf should set line buffered */
#define _IONBF 2 /* setvbuf should set unbuffered */
#define BUFSIZ 1024 /* size of buffer used by setbuf */
#define EOF (-1)
/*
* FOPEN_MAX is a minimum maximum, and should be the number of descriptors
* that the kernel can provide without allocation of a resource that can
* fail without the process sleeping. Do not use this for anything.
*/
#define FOPEN_MAX 20 /* must be <= OPEN_MAX <sys/syslimits.h> */
#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */
/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
#if __BSD_VISIBLE || __XPG_VISIBLE
#define P_tmpdir "/tmp/"
#endif
#define L_tmpnam 1024 /* XXX must be == PATH_MAX */
#define TMP_MAX 308915776
#ifndef SEEK_SET
#define SEEK_SET 0 /* set file offset to offset */
#endif
#ifndef SEEK_CUR
#define SEEK_CUR 1 /* set file offset to current plus offset */
#endif
#ifndef SEEK_END
#define SEEK_END 2 /* set file offset to EOF plus offset */
#endif
#define stdin (&__sF[0])
#define stdout (&__sF[1])
#define stderr (&__sF[2])
/*
* Functions defined in ANSI C standard.
*/
__BEGIN_DECLS
void clearerr(FILE *);
int fclose(FILE *);
int feof(FILE *);
int ferror(FILE *);
int fflush(FILE *);
int fgetc(FILE *);
int fgetpos(FILE *, fpos_t *);
char *fgets(char *, int, FILE *);
FILE *fopen(const char *, const char *);
int fprintf(FILE *, const char *, ...);
int fputc(int, FILE *);
int fputs(const char *, FILE *);
size_t fread(void *, size_t, size_t, FILE *);
FILE *freopen(const char *, const char *, FILE *);
int fscanf(FILE *, const char *, ...);
int fseek(FILE *, long, int);
int fseeko(FILE *, off_t, int);
int fsetpos(FILE *, const fpos_t *);
long ftell(FILE *);
off_t ftello(FILE *);
size_t fwrite(const void *, size_t, size_t, FILE *);
int getc(FILE *);
int getchar(void);
char *gets(char *);
#if __BSD_VISIBLE && !defined(__SYS_ERRLIST)
#define __SYS_ERRLIST
extern int sys_nerr; /* perror(3) external variables */
extern char *sys_errlist[];
#endif
void perror(const char *);
int printf(const char *, ...);
int putc(int, FILE *);
int putchar(int);
int puts(const char *);
int remove(const char *);
int rename(const char *, const char *);
void rewind(FILE *);
int scanf(const char *, ...);
void setbuf(FILE *, char *);
int setvbuf(FILE *, char *, int, size_t);
int sprintf(char *, const char *, ...);
int sscanf(const char *, const char *, ...);
FILE *tmpfile(void);
char *tmpnam(char *);
int ungetc(int, FILE *);
int vfprintf(FILE *, const char *, __va_list);
int vprintf(const char *, __va_list);
int vsprintf(char *, const char *, __va_list);
#if __ISO_C_VISIBLE >= 1999 || __BSD_VISIBLE
int snprintf(char *, size_t, const char *, ...)
__attribute__((__format__ (printf, 3, 4)))
__attribute__((__nonnull__ (3)));
int vfscanf(FILE *, const char *, __va_list)
__attribute__((__format__ (scanf, 2, 0)))
__attribute__((__nonnull__ (2)));
int vscanf(const char *, __va_list)
__attribute__((__format__ (scanf, 1, 0)))
__attribute__((__nonnull__ (1)));
int vsnprintf(char *, size_t, const char *, __va_list)
__attribute__((__format__ (printf, 3, 0)))
__attribute__((__nonnull__ (3)));
int vsscanf(const char *, const char *, __va_list)
__attribute__((__format__ (scanf, 2, 0)))
__attribute__((__nonnull__ (2)));
#endif /* __ISO_C_VISIBLE >= 1999 || __BSD_VISIBLE */
__END_DECLS
/*
* Functions defined in POSIX 1003.1.
*/
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */
#define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */
__BEGIN_DECLS
char *ctermid(char *);
char *cuserid(char *);
FILE *fdopen(int, const char *);
int fileno(FILE *);
#if __POSIX_VISIBLE >= 199209
int pclose(FILE *);
FILE *popen(const char *, const char *);
#endif
#if __POSIX_VISIBLE >= 199506
void flockfile(FILE *);
int ftrylockfile(FILE *);
void funlockfile(FILE *);
/*
* These are normally used through macros as defined below, but POSIX
* requires functions as well.
*/
int getc_unlocked(FILE *);
int getchar_unlocked(void);
int putc_unlocked(int, FILE *);
int putchar_unlocked(int);
#endif /* __POSIX_VISIBLE >= 199506 */
#if __XPG_VISIBLE
char *tempnam(const char *, const char *);
#endif
__END_DECLS
#ifndef _POSIX_THREADS
# define flockfile(fp) /* nothing */
# define ftrylockfile(fp) (0)
# define funlockfile(fp) /* nothing */
#endif
#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
/*
* Routines that are purely local.
*/
#if __BSD_VISIBLE
__BEGIN_DECLS
int asprintf(char **, const char *, ...)
__attribute__((__format__ (printf, 2, 3)))
__attribute__((__nonnull__ (2)));
char *fgetln(FILE *, size_t *);
int fpurge(FILE *);
int getw(FILE *);
int putw(int, FILE *);
void setbuffer(FILE *, char *, int);
int setlinebuf(FILE *);
int vasprintf(char **, const char *, __va_list)
__attribute__((__format__ (printf, 2, 0)))
__attribute__((__nonnull__ (2)));
__END_DECLS
/*
* Stdio function-access interface.
*/
__BEGIN_DECLS
FILE *funopen(const void *,
int (*)(void *, char *, int),
int (*)(void *, const char *, int),
fpos_t (*)(void *, fpos_t, int),
int (*)(void *));
__END_DECLS
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
#endif /* __BSD_VISIBLE */
/*
* Functions internal to the implementation.
*/
__BEGIN_DECLS
int __srget(FILE *);
int __swbuf(int, FILE *);
__END_DECLS
/*
* The __sfoo macros are here so that we can
* define function versions in the C library.
*/
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
#if defined(__GNUC__)
static __inline int __sputc(int _c, FILE *_p) {
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
return (*_p->_p++ = _c);
else
return (__swbuf(_c, _p));
}
#else
/*
* This has been tuned to generate reasonable code on the vax using pcc.
*/
#define __sputc(c, p) \
(--(p)->_w < 0 ? \
(p)->_w >= (p)->_lbfsize ? \
(*(p)->_p = (c)), *(p)->_p != '\n' ? \
(int)*(p)->_p++ : \
__swbuf('\n', p) : \
__swbuf((int)(c), p) : \
(*(p)->_p = (c), (int)*(p)->_p++))
#endif
#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
#define __sferror(p) (((p)->_flags & __SERR) != 0)
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
#define __sfileno(p) ((p)->_file)
#define feof(p) __sfeof(p)
#define ferror(p) __sferror(p)
#ifndef _POSIX_THREADS
#define clearerr(p) __sclearerr(p)
#endif
#if __POSIX_VISIBLE
#define fileno(p) __sfileno(p)
#endif
#ifndef lint
#ifndef _POSIX_THREADS
#define getc(fp) __sgetc(fp)
#endif /* _POSIX_THREADS */
#define getc_unlocked(fp) __sgetc(fp)
/*
* The macro implementations of putc and putc_unlocked are not
* fully POSIX compliant; they do not set errno on failure
*/
#if __BSD_VISIBLE
#ifndef _POSIX_THREADS
#define putc(x, fp) __sputc(x, fp)
#endif /* _POSIX_THREADS */
#define putc_unlocked(x, fp) __sputc(x, fp)
#endif /* __BSD_VISIBLE */
#endif /* lint */
#define getchar() getc(stdin)
#define putchar(x) putc(x, stdout)
#define getchar_unlocked() getc_unlocked(stdin)
#define putchar_unlocked(c) putc_unlocked(c, stdout)
#endif /* _STDIO_H_ */

139
libc/include/stdlib.h Normal file
View File

@@ -0,0 +1,139 @@
/*
* 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 _STDLIB_H_
#define _STDLIB_H_
#include <sys/cdefs.h>
#include <stddef.h>
#include <string.h>
#include <alloca.h>
#include <strings.h>
#include <memory.h>
__BEGIN_DECLS
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
extern __noreturn void exit(int);
extern __noreturn void abort(void);
extern int atexit(void (*)(void));
extern int on_exit(void (*)(int, void *), void *);
extern char *getenv(const char *);
extern int putenv(const char *);
extern int setenv(const char *, const char *, int);
extern int unsetenv(const char *);
extern int clearenv(void);
extern char *mktemp (char *);
extern int mkstemp (char *);
extern long strtol(const char *, char **, int);
extern long long strtoll(const char *, char **, int);
extern unsigned long strtoul(const char *, char **, int);
extern unsigned long long strtoull(const char *, char **, int);
extern double strtod(const char *nptr, char **endptr);
static __inline__ float strtof(const char *nptr, char **endptr)
{
return (float)strtod(nptr, endptr);
}
extern int atoi(const char *);
extern long atol(const char *);
extern long long atoll(const char *);
static __inline__ double atof(const char *nptr)
{
return (strtod(nptr, NULL));
}
static __inline__ int abs(int __n) {
return (__n < 0) ? -__n : __n;
}
static __inline__ long labs(long __n) {
return (__n < 0L) ? -__n : __n;
}
static __inline__ long long llabs(long long __n) {
return (__n < 0LL) ? -__n : __n;
}
extern char * realpath(const char *path, char *resolved);
extern int system(const char * string);
extern void * bsearch(const void *key, const void *base0,
size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
extern long jrand48(unsigned short *);
extern long mrand48(void);
extern long nrand48(unsigned short *);
extern long lrand48(void);
extern unsigned short *seed48(unsigned short*);
extern void srand48(long);
extern unsigned int arc4random(void);
extern void arc4random_stir(void);
extern void arc4random_addrandom(unsigned char *, int);
#define RAND_MAX 0x7fffffff
static __inline__ int rand(void) {
return (int)lrand48();
}
static __inline__ void srand(unsigned int __s) {
srand48(__s);
}
static __inline__ long random(void)
{
return lrand48();
}
static __inline__ void srandom(unsigned int __s)
{
srand48(__s);
}
/* Basic PTY functions. These only work if devpts is mounted! */
extern int unlockpt(int);
extern char* ptsname(int);
extern char* ptsname_r(int, char*, size_t);
extern int getpt(void);
static __inline__ int grantpt(int __fd)
{
(void)__fd;
return 0; /* devpts does this all for us! */
}
__END_DECLS
#endif /* _STDLIB_H_ */

122
libc/include/stl_pair.h Normal file
View File

@@ -0,0 +1,122 @@
/*
* 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.
*/
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
#ifndef __SGI_STL_INTERNAL_PAIR_H
#define __SGI_STL_INTERNAL_PAIR_H
__STL_BEGIN_NAMESPACE
template <class _T1, class _T2>
struct pair {
typedef _T1 first_type;
typedef _T2 second_type;
_T1 first;
_T2 second;
pair() : first(), second() {}
pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
template <class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
};
template <class _T1, class _T2>
inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
{
return __x.first == __y.first && __x.second == __y.second;
}
template <class _T1, class _T2>
inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
{
return __x.first < __y.first ||
(!(__y.first < __x.first) && __x.second < __y.second);
}
template <class _T1, class _T2>
inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return !(__x == __y);
}
template <class _T1, class _T2>
inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return __y < __x;
}
template <class _T1, class _T2>
inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return !(__y < __x);
}
template <class _T1, class _T2>
inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return !(__x < __y);
}
template <class _T1, class _T2>
inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y)
{
return pair<_T1, _T2>(__x, __y);
}
} // namespace std
#endif /* __SGI_STL_INTERNAL_PAIR_H */
// Local Variables:
// mode:C++
// End:

87
libc/include/string.h Normal file
View File

@@ -0,0 +1,87 @@
/*
* 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 _STRING_H_
#define _STRING_H_
#include <sys/cdefs.h>
#include <stddef.h>
#include <malloc.h>
__BEGIN_DECLS
extern void* memccpy(void *, const void *, int, size_t);
extern void* memchr(const void *, int, size_t);
extern void* memrchr(const void *, int, size_t);
extern int memcmp(const void *, const void *, size_t);
extern void* memcpy(void *, const void *, size_t);
extern void* memmove(void *, const void *, size_t);
extern void* memset(void *, int, size_t);
extern void* memmem(const void *, size_t, const void *, size_t);
extern void memswap(void *, void *, size_t);
extern char* index(const char *, int);
extern char* rindex(const char *, int);
extern char* strchr(const char *, int);
extern char* strrchr(const char *, int);
extern size_t strlen(const char *);
extern int strcmp(const char *, const char *);
extern char* strcpy(char *, const char *);
extern char* strcat(char *, const char *);
extern int strcasecmp(const char *, const char *);
extern int strncasecmp(const char *, const char *, size_t);
extern char* strdup(const char *);
extern char* strstr(const char *, const char *);
extern char* strcasestr(const char *haystack, const char *needle);
extern char* strtok(char *, const char *);
extern char* strtok_r(char *, const char *, char**);
extern char* strerror(int);
extern int strerror_r(int errnum, char *buf, size_t n);
extern size_t strnlen(const char *, size_t);
extern char* strncat(char *, const char *, size_t);
extern char* strndup(const char *, size_t);
extern int strncmp(const char *, const char *, size_t);
extern char* strncpy(char *, const char *, size_t);
extern size_t strlcat(char *, const char *, size_t);
extern size_t strlcpy(char *, const char *, size_t);
extern size_t strcspn(const char *, const char *);
extern char* strpbrk(const char *, const char *);
extern char* strsep(char **, const char *);
extern size_t strspn(const char *, const char *);
extern char* strsignal(int sig);
__END_DECLS
#endif /* _STRING_H_ */

55
libc/include/strings.h Normal file
View File

@@ -0,0 +1,55 @@
/* $NetBSD: strings.h,v 1.10 2005/02/03 04:39:32 perry Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _STRINGS_H_
#define _STRINGS_H_
#include <sys/cdefs.h>
__BEGIN_DECLS
int bcmp(const void *, const void *, size_t);
void bcopy(const void *, void *, size_t);
void bzero(void *, size_t);
int ffs(int);
char *index(const char *, int);
char *rindex(const char *, int);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
__END_DECLS
#endif /* !defined(_STRINGS_H_) */

172
libc/include/sys/_errdefs.h Normal file
View File

@@ -0,0 +1,172 @@
/*
* 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.
*/
/* the following corresponds to the error codes of the Linux kernel used by the Android platform
* these are distinct from the OpenBSD ones, which is why we need to redeclare them here
*
* this file may be included several times to define either error constants or their
* string representation
*/
#ifndef __BIONIC_ERRDEF
#error "__BIONIC_ERRDEF must be defined before including this file"
#endif
__BIONIC_ERRDEF( EPERM , 1, "Operation not permitted" )
__BIONIC_ERRDEF( ENOENT , 2, "No such file or directory" )
__BIONIC_ERRDEF( ESRCH , 3, "No such process" )
__BIONIC_ERRDEF( EINTR , 4, "Interrupted system call" )
__BIONIC_ERRDEF( EIO , 5, "I/O error" )
__BIONIC_ERRDEF( ENXIO , 6, "No such device or address" )
__BIONIC_ERRDEF( E2BIG , 7, "Argument list too long" )
__BIONIC_ERRDEF( ENOEXEC , 8, "Exec format error" )
__BIONIC_ERRDEF( EBADF , 9, "Bad file number" )
__BIONIC_ERRDEF( ECHILD , 10, "No child processes" )
__BIONIC_ERRDEF( EAGAIN , 11, "Try again" )
__BIONIC_ERRDEF( ENOMEM , 12, "Out of memory" )
__BIONIC_ERRDEF( EACCES , 13, "Permission denied" )
__BIONIC_ERRDEF( EFAULT , 14, "Bad address" )
__BIONIC_ERRDEF( ENOTBLK , 15, "Block device required" )
__BIONIC_ERRDEF( EBUSY , 16, "Device or resource busy" )
__BIONIC_ERRDEF( EEXIST , 17, "File exists" )
__BIONIC_ERRDEF( EXDEV , 18, "Cross-device link" )
__BIONIC_ERRDEF( ENODEV , 19, "No such device" )
__BIONIC_ERRDEF( ENOTDIR , 20, "Not a directory" )
__BIONIC_ERRDEF( EISDIR , 21, "Is a directory" )
__BIONIC_ERRDEF( EINVAL , 22, "Invalid argument" )
__BIONIC_ERRDEF( ENFILE , 23, "File table overflow" )
__BIONIC_ERRDEF( EMFILE , 24, "Too many open files" )
__BIONIC_ERRDEF( ENOTTY , 25, "Not a typewriter" )
__BIONIC_ERRDEF( ETXTBSY , 26, "Text file busy" )
__BIONIC_ERRDEF( EFBIG , 27, "File too large" )
__BIONIC_ERRDEF( ENOSPC , 28, "No space left on device" )
__BIONIC_ERRDEF( ESPIPE , 29, "Illegal seek" )
__BIONIC_ERRDEF( EROFS , 30, "Read-only file system" )
__BIONIC_ERRDEF( EMLINK , 31, "Too many links" )
__BIONIC_ERRDEF( EPIPE , 32, "Broken pipe" )
__BIONIC_ERRDEF( EDOM , 33, "Math argument out of domain of func" )
__BIONIC_ERRDEF( ERANGE , 34, "Math result not representable" )
__BIONIC_ERRDEF( EDEADLK , 35, "Resource deadlock would occur" )
__BIONIC_ERRDEF( ENAMETOOLONG , 36, "File name too long" )
__BIONIC_ERRDEF( ENOLCK , 37, "No record locks available" )
__BIONIC_ERRDEF( ENOSYS , 38, "Function not implemented" )
__BIONIC_ERRDEF( ENOTEMPTY , 39, "Directory not empty" )
__BIONIC_ERRDEF( ELOOP , 40, "Too many symbolic links encountered" )
__BIONIC_ERRDEF( ENOMSG , 42, "No message of desired type" )
__BIONIC_ERRDEF( EIDRM , 43, "Identifier removed" )
__BIONIC_ERRDEF( ECHRNG , 44, "Channel number out of range" )
__BIONIC_ERRDEF( EL2NSYNC , 45, "Level 2 not synchronized" )
__BIONIC_ERRDEF( EL3HLT , 46, "Level 3 halted" )
__BIONIC_ERRDEF( EL3RST , 47, "Level 3 reset" )
__BIONIC_ERRDEF( ELNRNG , 48, "Link number out of range" )
__BIONIC_ERRDEF( EUNATCH , 49, "Protocol driver not attached" )
__BIONIC_ERRDEF( ENOCSI , 50, "No CSI structure available" )
__BIONIC_ERRDEF( EL2HLT , 51, "Level 2 halted" )
__BIONIC_ERRDEF( EBADE , 52, "Invalid exchange" )
__BIONIC_ERRDEF( EBADR , 53, "Invalid request descriptor" )
__BIONIC_ERRDEF( EXFULL , 54, "Exchange full" )
__BIONIC_ERRDEF( ENOANO , 55, "No anode" )
__BIONIC_ERRDEF( EBADRQC , 56, "Invalid request code" )
__BIONIC_ERRDEF( EBADSLT , 57, "Invalid slot" )
__BIONIC_ERRDEF( EBFONT , 59, "Bad font file format" )
__BIONIC_ERRDEF( ENOSTR , 60, "Device not a stream" )
__BIONIC_ERRDEF( ENODATA , 61, "No data available" )
__BIONIC_ERRDEF( ETIME , 62, "Timer expired" )
__BIONIC_ERRDEF( ENOSR , 63, "Out of streams resources" )
__BIONIC_ERRDEF( ENONET , 64, "Machine is not on the network" )
__BIONIC_ERRDEF( ENOPKG , 65, "Package not installed" )
__BIONIC_ERRDEF( EREMOTE , 66, "Object is remote" )
__BIONIC_ERRDEF( ENOLINK , 67, "Link has been severed" )
__BIONIC_ERRDEF( EADV , 68, "Advertise error" )
__BIONIC_ERRDEF( ESRMNT , 69, "Srmount error" )
__BIONIC_ERRDEF( ECOMM , 70, "Communication error on send" )
__BIONIC_ERRDEF( EPROTO , 71, "Protocol error" )
__BIONIC_ERRDEF( EMULTIHOP , 72, "Multihop attempted" )
__BIONIC_ERRDEF( EDOTDOT , 73, "RFS specific error" )
__BIONIC_ERRDEF( EBADMSG , 74, "Not a data message" )
__BIONIC_ERRDEF( EOVERFLOW , 75, "Value too large for defined data type" )
__BIONIC_ERRDEF( ENOTUNIQ , 76, "Name not unique on network" )
__BIONIC_ERRDEF( EBADFD , 77, "File descriptor in bad state" )
__BIONIC_ERRDEF( EREMCHG , 78, "Remote address changed" )
__BIONIC_ERRDEF( ELIBACC , 79, "Can not access a needed shared library" )
__BIONIC_ERRDEF( ELIBBAD , 80, "Accessing a corrupted shared library" )
__BIONIC_ERRDEF( ELIBSCN , 81, ".lib section in a.out corrupted" )
__BIONIC_ERRDEF( ELIBMAX , 82, "Attempting to link in too many shared libraries" )
__BIONIC_ERRDEF( ELIBEXEC , 83, "Cannot exec a shared library directly" )
__BIONIC_ERRDEF( EILSEQ , 84, "Illegal byte sequence" )
__BIONIC_ERRDEF( ERESTART , 85, "Interrupted system call should be restarted" )
__BIONIC_ERRDEF( ESTRPIPE , 86, "Streams pipe error" )
__BIONIC_ERRDEF( EUSERS , 87, "Too many users" )
__BIONIC_ERRDEF( ENOTSOCK , 88, "Socket operation on non-socket" )
__BIONIC_ERRDEF( EDESTADDRREQ , 89, "Destination address required" )
__BIONIC_ERRDEF( EMSGSIZE , 90, "Message too long" )
__BIONIC_ERRDEF( EPROTOTYPE , 91, "Protocol wrong type for socket" )
__BIONIC_ERRDEF( ENOPROTOOPT , 92, "Protocol not available" )
__BIONIC_ERRDEF( EPROTONOSUPPORT, 93, "Protocol not supported" )
__BIONIC_ERRDEF( ESOCKTNOSUPPORT, 94, "Socket type not supported" )
__BIONIC_ERRDEF( EOPNOTSUPP , 95, "Operation not supported on transport endpoint" )
__BIONIC_ERRDEF( EPFNOSUPPORT , 96, "Protocol family not supported" )
__BIONIC_ERRDEF( EAFNOSUPPORT , 97, "Address family not supported by protocol" )
__BIONIC_ERRDEF( EADDRINUSE , 98, "Address already in use" )
__BIONIC_ERRDEF( EADDRNOTAVAIL , 99, "Cannot assign requested address" )
__BIONIC_ERRDEF( ENETDOWN , 100, "Network is down" )
__BIONIC_ERRDEF( ENETUNREACH , 101, "Network is unreachable" )
__BIONIC_ERRDEF( ENETRESET , 102, "Network dropped connection because of reset" )
__BIONIC_ERRDEF( ECONNABORTED , 103, "Software caused connection abort" )
__BIONIC_ERRDEF( ECONNRESET , 104, "Connection reset by peer" )
__BIONIC_ERRDEF( ENOBUFS , 105, "No buffer space available" )
__BIONIC_ERRDEF( EISCONN , 106, "Transport endpoint is already connected" )
__BIONIC_ERRDEF( ENOTCONN , 107, "Transport endpoint is not connected" )
__BIONIC_ERRDEF( ESHUTDOWN , 108, "Cannot send after transport endpoint shutdown" )
__BIONIC_ERRDEF( ETOOMANYREFS , 109, "Too many references: cannot splice" )
__BIONIC_ERRDEF( ETIMEDOUT , 110, "Connection timed out" )
__BIONIC_ERRDEF( ECONNREFUSED , 111, "Connection refused" )
__BIONIC_ERRDEF( EHOSTDOWN , 112, "Host is down" )
__BIONIC_ERRDEF( EHOSTUNREACH , 113, "No route to host" )
__BIONIC_ERRDEF( EALREADY , 114, "Operation already in progress" )
__BIONIC_ERRDEF( EINPROGRESS , 115, "Operation now in progress" )
__BIONIC_ERRDEF( ESTALE , 116, "Stale NFS file handle" )
__BIONIC_ERRDEF( EUCLEAN , 117, "Structure needs cleaning" )
__BIONIC_ERRDEF( ENOTNAM , 118, "Not a XENIX named type file" )
__BIONIC_ERRDEF( ENAVAIL , 119, "No XENIX semaphores available" )
__BIONIC_ERRDEF( EISNAM , 120, "Is a named type file" )
__BIONIC_ERRDEF( EREMOTEIO , 121, "Remote I/O error" )
__BIONIC_ERRDEF( EDQUOT , 122, "Quota exceeded" )
__BIONIC_ERRDEF( ENOMEDIUM , 123, "No medium found" )
__BIONIC_ERRDEF( EMEDIUMTYPE , 124, "Wrong medium type" )
__BIONIC_ERRDEF( ECANCELED , 125, "Operation Canceled" )
__BIONIC_ERRDEF( ENOKEY , 126, "Required key not available" )
__BIONIC_ERRDEF( EKEYEXPIRED , 127, "Key has expired" )
__BIONIC_ERRDEF( EKEYREVOKED , 128, "Key has been revoked" )
__BIONIC_ERRDEF( EKEYREJECTED , 129, "Key was rejected by service" )
__BIONIC_ERRDEF( EOWNERDEAD , 130, "Owner died" )
__BIONIC_ERRDEF( ENOTRECOVERABLE, 131, "State not recoverable" )
/* the following is not defined by Linux but needed for the BSD portions of the C library */
__BIONIC_ERRDEF( EFTYPE, 1000, "Stupid C library hack !!" )
#undef __BIONIC_ERRDEF

View File

@@ -0,0 +1,65 @@
/*
* 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.
*/
/* this header is used to define signal constants and names; it might be included several times */
#ifndef __BIONIC_SIGDEF
#error __BIONIC_SIGDEF not defined
#endif
__BIONIC_SIGDEF(SIGHUP,1,"Hangup")
__BIONIC_SIGDEF(SIGINT,2,"Interrupt")
__BIONIC_SIGDEF(SIGQUIT,3,"Quit")
__BIONIC_SIGDEF(SIGILL,4,"Illegal instruction")
__BIONIC_SIGDEF(SIGTRAP,5,"Trap")
__BIONIC_SIGDEF(SIGABRT,6,"Aborted")
__BIONIC_SIGDEF(SIGBUS,7,"Bus error")
__BIONIC_SIGDEF(SIGFPE,8,"Floating point exception")
__BIONIC_SIGDEF(SIGKILL,9,"Killed")
__BIONIC_SIGDEF(SIGUSR1,10,"User signal 1")
__BIONIC_SIGDEF(SIGSEGV,11,"Segmentation fault")
__BIONIC_SIGDEF(SIGUSR2,12,"User signal 2")
__BIONIC_SIGDEF(SIGPIPE,13,"Broken pipe")
__BIONIC_SIGDEF(SIGALRM,14,"Alarm clock")
__BIONIC_SIGDEF(SIGTERM,15,"Terminated")
__BIONIC_SIGDEF(SIGSTKFLT,16,"Stack fault")
__BIONIC_SIGDEF(SIGCHLD,17,"Child exited")
__BIONIC_SIGDEF(SIGCONT,18,"Continue")
__BIONIC_SIGDEF(SIGSTOP,19,"Stopped (signal)")
__BIONIC_SIGDEF(SIGTSTP,20,"Stopped")
__BIONIC_SIGDEF(SIGTTIN,21,"Stopped (tty input)")
__BIONIC_SIGDEF(SIGTTOU,22,"Stopper (tty output)")
__BIONIC_SIGDEF(SIGURG,23,"Urgent I/O condition")
__BIONIC_SIGDEF(SIGXCPU,24,"CPU time limit exceeded")
__BIONIC_SIGDEF(SIGXFSZ,25,"File size limit exceeded")
__BIONIC_SIGDEF(SIGVTALRM,26,"Virtual timer expired")
__BIONIC_SIGDEF(SIGPROF,27,"Profiling timer expired")
__BIONIC_SIGDEF(SIGWINCH,28,"Window size changed")
__BIONIC_SIGDEF(SIGIO,29,"I/O possible")
__BIONIC_SIGDEF(SIGPWR,30,"Power failure")
__BIONIC_SIGDEF(SIGSYS,31,"Bad system call")
#undef __BIONIC_SIGDEF

View File

@@ -0,0 +1,108 @@
/*
* 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 _INCLUDE_SYS__SYSTEM_PROPERTIES_H
#define _INCLUDE_SYS__SYSTEM_PROPERTIES_H
#ifndef _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#error you should #include <sys/system_properties.h> instead
#else
#include <sys/system_properties.h>
typedef struct prop_area prop_area;
typedef struct prop_msg prop_msg;
#define PROP_AREA_MAGIC 0x504f5250
#define PROP_AREA_VERSION 0x45434f76
#define PROP_SERVICE_NAME "property_service"
/* #define PROP_MAX_ENTRIES 247 */
/* 247 -> 32620 bytes (<32768) */
#define TOC_NAME_LEN(toc) ((toc) >> 24)
#define TOC_TO_INFO(area, toc) ((prop_info*) (((char*) area) + ((toc) & 0xFFFFFF)))
struct prop_area {
unsigned volatile count;
unsigned volatile serial;
unsigned magic;
unsigned version;
unsigned reserved[4];
unsigned toc[1];
};
#define SERIAL_VALUE_LEN(serial) ((serial) >> 24)
#define SERIAL_DIRTY(serial) ((serial) & 1)
struct prop_info {
unsigned char name[PROP_NAME_MAX];
unsigned volatile serial;
unsigned char value[PROP_VALUE_MAX];
};
struct prop_msg
{
unsigned cmd;
unsigned char name[PROP_NAME_MAX];
unsigned char value[PROP_VALUE_MAX];
};
#define PROP_MSG_SETPROP 1
/*
** Rules:
**
** - there is only one writer, but many readers
** - prop_area.count will never decrease in value
** - once allocated, a prop_info's name will not change
** - once allocated, a prop_info's offset will not change
** - reading a value requires the following steps
** 1. serial = pi->serial
** 2. if SERIAL_DIRTY(serial), wait*, then goto 1
** 3. memcpy(local, pi->value, SERIAL_VALUE_LEN(serial) + 1)
** 4. if pi->serial != serial, goto 2
**
** - writing a value requires the following steps
** 1. pi->serial = pi->serial | 1
** 2. memcpy(pi->value, local_value, value_len)
** 3. pi->serial = (value_len << 24) | ((pi->serial + 1) & 0xffffff)
**
** Improvements:
** - maintain the toc sorted by pi->name to allow lookup
** by binary search
**
*/
#define PROP_PATH_RAMDISK_DEFAULT "/default.prop"
#define PROP_PATH_SYSTEM_BUILD "/system/build.prop"
#define PROP_PATH_SYSTEM_DEFAULT "/system/default.prop"
#define PROP_PATH_LOCAL_OVERRIDE "/data/local.prop"
#endif
#endif

77
libc/include/sys/_types.h Normal file
View File

@@ -0,0 +1,77 @@
/* $OpenBSD: _types.h,v 1.1 2006/01/06 18:53:05 millert Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)types.h 8.3 (Berkeley) 1/5/94
*/
#ifndef _SYS__TYPES_H_
#define _SYS__TYPES_H_
#undef __KERNEL_STRICT_NAMES
#define __KERNEL_STRICT_NAMES 1
#include <machine/_types.h>
typedef unsigned long __cpuid_t; /* CPU id */
typedef __int32_t __dev_t; /* device number */
typedef __uint32_t __fixpt_t; /* fixed point number */
typedef __uint32_t __gid_t; /* group id */
typedef __uint32_t __id_t; /* may contain pid, uid or gid */
typedef __uint32_t __in_addr_t; /* base type for internet address */
typedef __uint16_t __in_port_t; /* IP port type */
typedef __uint32_t __ino_t; /* inode number */
typedef long __key_t; /* IPC key (for Sys V IPC) */
typedef __uint32_t __mode_t; /* permissions */
typedef __uint32_t __nlink_t; /* link count */
typedef __int32_t __pid_t; /* process id */
typedef __uint64_t __rlim_t; /* resource limit */
typedef __uint16_t __sa_family_t; /* sockaddr address family type */
typedef __int32_t __segsz_t; /* segment size */
typedef __uint32_t __socklen_t; /* length type for network syscalls */
typedef __int32_t __swblk_t; /* swap offset */
typedef __uint32_t __uid_t; /* user id */
typedef __uint32_t __useconds_t; /* microseconds */
typedef __int32_t __suseconds_t; /* microseconds (signed) */
/*
* mbstate_t is an opaque object to keep conversion state, during multibyte
* stream conversions. The content must not be referenced by user programs.
*/
typedef union {
char __mbstate8[128];
__int64_t __mbstateL; /* for alignment */
} __mbstate_t;
/* BIONIC: if we're using non-cleaned up user-level kernel headers,
* this will prevent many type declaration conflicts
*/
#define __KERNEL_STRICT_NAMES 1
#endif /* !_SYS__TYPES_H_ */

View File

@@ -0,0 +1 @@
#include <sys/atomics.h>

View File

@@ -0,0 +1 @@
#include <sys/tls.h>

View File

@@ -0,0 +1,45 @@
/*
* 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 _SYS_ATOMICS_H
#define _SYS_ATOMICS_H
#include <sys/cdefs.h>
__BEGIN_DECLS
extern int __atomic_cmpxchg(int old, int _new, volatile int *ptr);
extern int __atomic_swap(int _new, volatile int *ptr);
extern int __atomic_dec(volatile int *ptr);
extern int __atomic_inc(volatile int *ptr);
int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout);
int __futex_wake(volatile void *ftx, int count);
__END_DECLS
#endif /* _SYS_ATOMICS_H */

376
libc/include/sys/cdefs.h Normal file
View File

@@ -0,0 +1,376 @@
/* $NetBSD: cdefs.h,v 1.58 2004/12/11 05:59:00 christos Exp $ */
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Berkeley Software Design, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)cdefs.h 8.8 (Berkeley) 1/9/95
*/
#ifndef _SYS_CDEFS_H_
#define _SYS_CDEFS_H_
/* our implementation of wchar_t is only 8-bit - die die non-portable code */
#undef __WCHAR_TYPE__
#define __WCHAR_TYPE__ unsigned char
/*
* Macro to test if we're using a GNU C compiler of a specific vintage
* or later, for e.g. features that appeared in a particular version
* of GNU C. Usage:
*
* #if __GNUC_PREREQ__(major, minor)
* ...cool feature...
* #else
* ...delete feature...
* #endif
*/
#ifdef __GNUC__
#define __GNUC_PREREQ__(x, y) \
((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
(__GNUC__ > (x)))
#else
#define __GNUC_PREREQ__(x, y) 0
#endif
//XXX #include <machine/cdefs.h>
/* BIONIC: simpler definition */
#define __BSD_VISIBLE 1
#include <sys/cdefs_elf.h>
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#define __static_cast(x,y) static_cast<x>(y)
#else
#define __BEGIN_DECLS
#define __END_DECLS
#define __static_cast(x,y) (x)y
#endif
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky -- make sure you don't put spaces
* in between its arguments. __CONCAT can also concatenate double-quoted
* strings produced by the __STRING macro, but this only works with ANSI C.
*/
#define ___STRING(x) __STRING(x)
#define ___CONCAT(x,y) __CONCAT(x,y)
#if __STDC__ || defined(__cplusplus)
#define __P(protos) protos /* full-blown ANSI C */
#define __CONCAT(x,y) x ## y
#define __STRING(x) #x
#define __const const /* define reserved names to standard */
#define __signed signed
#define __volatile volatile
#if defined(__cplusplus)
#define __inline inline /* convert to C++ keyword */
#else
#if !defined(__GNUC__) && !defined(__lint__)
#define __inline /* delete GCC keyword */
#endif /* !__GNUC__ && !__lint__ */
#endif /* !__cplusplus */
#else /* !(__STDC__ || __cplusplus) */
#define __P(protos) () /* traditional C preprocessor */
#define __CONCAT(x,y) x/**/y
#define __STRING(x) "x"
#ifndef __GNUC__
#define __const /* delete pseudo-ANSI C keywords */
#define __inline
#define __signed
#define __volatile
#endif /* !__GNUC__ */
/*
* In non-ANSI C environments, new programs will want ANSI-only C keywords
* deleted from the program and old programs will want them left alone.
* Programs using the ANSI C keywords const, inline etc. as normal
* identifiers should define -DNO_ANSI_KEYWORDS.
*/
#ifndef NO_ANSI_KEYWORDS
#define const __const /* convert ANSI C keywords */
#define inline __inline
#define signed __signed
#define volatile __volatile
#endif /* !NO_ANSI_KEYWORDS */
#endif /* !(__STDC__ || __cplusplus) */
/*
* Used for internal auditing of the NetBSD source tree.
*/
#ifdef __AUDIT__
#define __aconst __const
#else
#define __aconst
#endif
/*
* The following macro is used to remove const cast-away warnings
* from gcc -Wcast-qual; it should be used with caution because it
* can hide valid errors; in particular most valid uses are in
* situations where the API requires it, not to cast away string
* constants. We don't use *intptr_t on purpose here and we are
* explicit about unsigned long so that we don't have additional
* dependencies.
*/
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
/*
* GCC2 provides __extension__ to suppress warnings for various GNU C
* language extensions under "-ansi -pedantic".
*/
#if !__GNUC_PREREQ__(2, 0)
#define __extension__ /* delete __extension__ if non-gcc or gcc1 */
#endif
/*
* GCC1 and some versions of GCC2 declare dead (non-returning) and
* pure (no side effects) functions using "volatile" and "const";
* unfortunately, these then cause warnings under "-ansi -pedantic".
* GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
* these work for GNU C++ (modulo a slight glitch in the C++ grammar
* in the distribution version of 2.5.5).
*/
#if !__GNUC_PREREQ__(2, 5)
#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define __dead __volatile
#define __pure __const
#endif
#endif
/* Delete pseudo-keywords wherever they are not available or needed. */
#ifndef __dead
#define __dead
#define __pure
#endif
#if __GNUC_PREREQ__(2, 7)
#define __unused __attribute__((__unused__))
#else
#define __unused /* delete */
#endif
#if __GNUC_PREREQ__(3, 1)
#define __used __attribute__((__used__))
#else
#define __used /* delete */
#endif
#if __GNUC_PREREQ__(2, 7)
#define __packed __attribute__((__packed__))
#define __aligned(x) __attribute__((__aligned__(x)))
#define __section(x) __attribute__((__section__(x)))
#elif defined(__lint__)
#define __packed /* delete */
#define __aligned(x) /* delete */
#define __section(x) /* delete */
#else
#define __packed error: no __packed for this compiler
#define __aligned(x) error: no __aligned for this compiler
#define __section(x) error: no __section for this compiler
#endif
#if !__GNUC_PREREQ__(2, 8)
#define __extension__
#endif
#if __GNUC_PREREQ__(2, 8)
#define __statement(x) __extension__(x)
#elif defined(lint)
#define __statement(x) (0)
#else
#define __statement(x) (x)
#endif
/*
* C99 defines the restrict type qualifier keyword, which was made available
* in GCC 2.92.
*/
#if __STDC_VERSION__ >= 199901L
#define __restrict restrict
#else
#if !__GNUC_PREREQ__(2, 92)
#define __restrict /* delete __restrict when not supported */
#endif
#endif
/*
* C99 defines __func__ predefined identifier, which was made available
* in GCC 2.95.
*/
#if !(__STDC_VERSION__ >= 199901L)
#if __GNUC_PREREQ__(2, 6)
#define __func__ __PRETTY_FUNCTION__
#elif __GNUC_PREREQ__(2, 4)
#define __func__ __FUNCTION__
#else
#define __func__ ""
#endif
#endif /* !(__STDC_VERSION__ >= 199901L) */
#if defined(_KERNEL)
#if defined(NO_KERNEL_RCSIDS)
#undef __KERNEL_RCSID
#define __KERNEL_RCSID(_n, _s) /* nothing */
#endif /* NO_KERNEL_RCSIDS */
#endif /* _KERNEL */
#if !defined(_STANDALONE) && !defined(_KERNEL)
#ifdef __GNUC__
#define __RENAME(x) ___RENAME(x)
#else
#ifdef __lint__
#define __RENAME(x) __symbolrename(x)
#else
#error "No function renaming possible"
#endif /* __lint__ */
#endif /* __GNUC__ */
#else /* _STANDALONE || _KERNEL */
#define __RENAME(x) no renaming in kernel or standalone environment
#endif
/*
* A barrier to stop the optimizer from moving code or assume live
* register values. This is gcc specific, the version is more or less
* arbitrary, might work with older compilers.
*/
#if __GNUC_PREREQ__(2, 95)
#define __insn_barrier() __asm __volatile("":::"memory")
#else
#define __insn_barrier() /* */
#endif
/*
* GNU C version 2.96 adds explicit branch prediction so that
* the CPU back-end can hint the processor and also so that
* code blocks can be reordered such that the predicted path
* sees a more linear flow, thus improving cache behavior, etc.
*
* The following two macros provide us with a way to use this
* compiler feature. Use __predict_true() if you expect the expression
* to evaluate to true, and __predict_false() if you expect the
* expression to evaluate to false.
*
* A few notes about usage:
*
* * Generally, __predict_false() error condition checks (unless
* you have some _strong_ reason to do otherwise, in which case
* document it), and/or __predict_true() `no-error' condition
* checks, assuming you want to optimize for the no-error case.
*
* * Other than that, if you don't know the likelihood of a test
* succeeding from empirical or other `hard' evidence, don't
* make predictions.
*
* * These are meant to be used in places that are run `a lot'.
* It is wasteful to make predictions in code that is run
* seldomly (e.g. at subsystem initialization time) as the
* basic block reordering that this affects can often generate
* larger code.
*/
#if __GNUC_PREREQ__(2, 96)
#define __predict_true(exp) __builtin_expect((exp) != 0, 1)
#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
#else
#define __predict_true(exp) (exp)
#define __predict_false(exp) (exp)
#endif
#if __GNUC_PREREQ__(2, 96)
#define __noreturn __attribute__((__noreturn__))
#define __mallocfunc __attribute__((malloc))
#else
#define __noreturn
#define __mallocfunc
#endif
/*
* Macros for manipulating "link sets". Link sets are arrays of pointers
* to objects, which are gathered up by the linker.
*
* Object format-specific code has provided us with the following macros:
*
* __link_set_add_text(set, sym)
* Add a reference to the .text symbol `sym' to `set'.
*
* __link_set_add_rodata(set, sym)
* Add a reference to the .rodata symbol `sym' to `set'.
*
* __link_set_add_data(set, sym)
* Add a reference to the .data symbol `sym' to `set'.
*
* __link_set_add_bss(set, sym)
* Add a reference to the .bss symbol `sym' to `set'.
*
* __link_set_decl(set, ptype)
* Provide an extern declaration of the set `set', which
* contains an array of the pointer type `ptype'. This
* macro must be used by any code which wishes to reference
* the elements of a link set.
*
* __link_set_start(set)
* This points to the first slot in the link set.
*
* __link_set_end(set)
* This points to the (non-existent) slot after the last
* entry in the link set.
*
* __link_set_count(set)
* Count the number of entries in link set `set'.
*
* In addition, we provide the following macros for accessing link sets:
*
* __link_set_foreach(pvar, set)
* Iterate over the link set `set'. Because a link set is
* an array of pointers, pvar must be declared as "type **pvar",
* and the actual entry accessed as "*pvar".
*
* __link_set_entry(set, idx)
* Access the link set entry at index `idx' from set `set'.
*/
#define __link_set_foreach(pvar, set) \
for (pvar = __link_set_start(set); pvar < __link_set_end(set); pvar++)
#define __link_set_entry(set, idx) (__link_set_begin(set)[idx])
#define __BIONIC__ 1
#endif /* !_SYS_CDEFS_H_ */

View File

@@ -0,0 +1,152 @@
/* $NetBSD: cdefs_elf.h,v 1.22 2005/02/26 22:25:34 perry Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#ifndef _SYS_CDEFS_ELF_H_
#define _SYS_CDEFS_ELF_H_
#ifdef __LEADING_UNDERSCORE
#define _C_LABEL(x) __CONCAT(_,x)
#define _C_LABEL_STRING(x) "_"x
#else
#define _C_LABEL(x) x
#define _C_LABEL_STRING(x) x
#endif
#if __STDC__
#define ___RENAME(x) __asm__(___STRING(_C_LABEL(x)))
#else
#ifdef __LEADING_UNDERSCORE
#define ___RENAME(x) ____RENAME(_/**/x)
#define ____RENAME(x) __asm__(___STRING(x))
#else
#define ___RENAME(x) __asm__(___STRING(x))
#endif
#endif
#define __indr_reference(sym,alias) /* nada, since we do weak refs */
#if __STDC__
#define __strong_alias(alias,sym) \
__asm__(".global " _C_LABEL_STRING(#alias) "\n" \
_C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
#define __weak_alias(alias,sym) \
__asm__(".weak " _C_LABEL_STRING(#alias) "\n" \
_C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
#define __weak_extern(sym) \
__asm__(".weak " _C_LABEL_STRING(#sym));
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning." #sym "\n\t.ascii \"" msg "\"\n\t.text");
#else /* !__STDC__ */
#ifdef __LEADING_UNDERSCORE
#define __weak_alias(alias,sym) ___weak_alias(_/**/alias,_/**/sym)
#define ___weak_alias(alias,sym) \
__asm__(".weak alias\nalias = sym");
#else
#define __weak_alias(alias,sym) \
__asm__(".weak alias\nalias = sym");
#endif
#ifdef __LEADING_UNDERSCORE
#define __weak_extern(sym) ___weak_extern(_/**/sym)
#define ___weak_extern(sym) \
__asm__(".weak sym");
#else
#define __weak_extern(sym) \
__asm__(".weak sym");
#endif
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning.sym\n\t.ascii msg ; .text");
#endif /* !__STDC__ */
#if __STDC__
#define __SECTIONSTRING(_sec, _str) \
__asm__(".section " #_sec "\n\t.asciz \"" _str "\"\n\t.previous")
#else
#define __SECTIONSTRING(_sec, _str) \
__asm__(".section _sec\n\t.asciz _str\n\t.previous")
#endif
#define __IDSTRING(_n,_s) __SECTIONSTRING(.ident,_s)
#define __RCSID(_s) __IDSTRING(rcsid,_s)
#define __SCCSID(_s)
#define __SCCSID2(_s)
#if 0 /* XXX userland __COPYRIGHTs have \ns in them */
#define __COPYRIGHT(_s) __SECTIONSTRING(.copyright,_s)
#else
#define __COPYRIGHT(_s) \
static const char copyright[] \
__attribute__((__unused__,__section__(".copyright"))) = _s
#endif
#define __KERNEL_RCSID(_n, _s) __RCSID(_s)
#define __KERNEL_SCCSID(_n, _s)
#if 0 /* XXX see above */
#define __KERNEL_COPYRIGHT(_n, _s) __COPYRIGHT(_s)
#else
#define __KERNEL_COPYRIGHT(_n, _s) __SECTIONSTRING(.copyright, _s)
#endif
#ifndef __lint__
#define __link_set_make_entry(set, sym) \
static void const * const __link_set_##set##_sym_##sym \
__section("link_set_" #set) __used = &sym
#define __link_set_make_entry2(set, sym, n) \
static void const * const __link_set_##set##_sym_##sym##_##n \
__section("link_set_" #set) __used = &sym[n]
#else
#define __link_set_make_entry(set, sym) \
extern void const * const __link_set_##set##_sym_##sym
#define __link_set_make_entry2(set, sym, n) \
extern void const * const __link_set_##set##_sym_##sym##_##n
#endif /* __lint__ */
#define __link_set_add_text(set, sym) __link_set_make_entry(set, sym)
#define __link_set_add_rodata(set, sym) __link_set_make_entry(set, sym)
#define __link_set_add_data(set, sym) __link_set_make_entry(set, sym)
#define __link_set_add_bss(set, sym) __link_set_make_entry(set, sym)
#define __link_set_add_text2(set, sym, n) __link_set_make_entry2(set, sym, n)
#define __link_set_add_rodata2(set, sym, n) __link_set_make_entry2(set, sym, n)
#define __link_set_add_data2(set, sym, n) __link_set_make_entry2(set, sym, n)
#define __link_set_add_bss2(set, sym, n) __link_set_make_entry2(set, sym, n)
#define __link_set_decl(set, ptype) \
extern ptype * const __start_link_set_##set[]; \
extern ptype * const __stop_link_set_##set[] \
#define __link_set_start(set) (__start_link_set_##set)
#define __link_set_end(set) (__stop_link_set_##set)
#define __link_set_count(set) \
(__link_set_end(set) - __link_set_start(set))
#endif /* !_SYS_CDEFS_ELF_H_ */

49
libc/include/sys/dirent.h Normal file
View File

@@ -0,0 +1,49 @@
/*
* 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 _SYS_DIRENT_H_
#define _SYS_DIRENT_H_
#include <stdint.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
/* this corresponds to the kernel dirent64 */
struct dirent {
uint64_t d_ino;
int64_t d_off;
unsigned short d_reclen;
unsigned char d_type;
char d_name[256];
};
extern int getdents(unsigned int, struct dirent *, unsigned int);
__END_DECLS
#endif /* _SYS_DIRENT_H_ */

273
libc/include/sys/endian.h Normal file
View File

@@ -0,0 +1,273 @@
/* $OpenBSD: endian.h,v 1.17 2006/01/06 18:53:05 millert Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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 AUTHOR ``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 AUTHOR 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.
*/
/*
* Generic definitions for little- and big-endian systems. Other endianesses
* has to be dealt with in the specific machine/endian.h file for that port.
*
* This file is meant to be included from a little- or big-endian port's
* machine/endian.h after setting _BYTE_ORDER to either 1234 for little endian
* or 4321 for big..
*/
#ifndef _SYS_ENDIAN_H_
#define _SYS_ENDIAN_H_
#include <sys/cdefs.h>
#include <machine/_types.h>
#define _LITTLE_ENDIAN 1234
#define _BIG_ENDIAN 4321
#define _PDP_ENDIAN 3412
#if __BSD_VISIBLE
#define LITTLE_ENDIAN _LITTLE_ENDIAN
#define BIG_ENDIAN _BIG_ENDIAN
#define PDP_ENDIAN _PDP_ENDIAN
#define BYTE_ORDER _BYTE_ORDER
#endif
#ifdef __GNUC__
#define __swap16gen(x) __statement({ \
__uint16_t __swap16gen_x = (x); \
\
(__uint16_t)((__swap16gen_x & 0xff) << 8 | \
(__swap16gen_x & 0xff00) >> 8); \
})
#define __swap32gen(x) __statement({ \
__uint32_t __swap32gen_x = (x); \
\
(__uint32_t)((__swap32gen_x & 0xff) << 24 | \
(__swap32gen_x & 0xff00) << 8 | \
(__swap32gen_x & 0xff0000) >> 8 | \
(__swap32gen_x & 0xff000000) >> 24); \
})
#define __swap64gen(x) __statement({ \
__uint64_t __swap64gen_x = (x); \
\
(__uint64_t)((__swap64gen_x & 0xff) << 56 | \
(__swap64gen_x & 0xff00ULL) << 40 | \
(__swap64gen_x & 0xff0000ULL) << 24 | \
(__swap64gen_x & 0xff000000ULL) << 8 | \
(__swap64gen_x & 0xff00000000ULL) >> 8 | \
(__swap64gen_x & 0xff0000000000ULL) >> 24 | \
(__swap64gen_x & 0xff000000000000ULL) >> 40 | \
(__swap64gen_x & 0xff00000000000000ULL) >> 56); \
})
#else /* __GNUC__ */
/* Note that these macros evaluate their arguments several times. */
#define __swap16gen(x) \
(__uint16_t)(((__uint16_t)(x) & 0xff) << 8 | ((__uint16_t)(x) & 0xff00) >> 8)
#define __swap32gen(x) \
(__uint32_t)(((__uint32_t)(x) & 0xff) << 24 | \
((__uint32_t)(x) & 0xff00) << 8 | ((__uint32_t)(x) & 0xff0000) >> 8 |\
((__uint32_t)(x) & 0xff000000) >> 24)
#define __swap64gen(x) \
(__uint64_t)((((__uint64_t)(x) & 0xff) << 56) | \
((__uint64_t)(x) & 0xff00ULL) << 40 | \
((__uint64_t)(x) & 0xff0000ULL) << 24 | \
((__uint64_t)(x) & 0xff000000ULL) << 8 | \
((__uint64_t)(x) & 0xff00000000ULL) >> 8 | \
((__uint64_t)(x) & 0xff0000000000ULL) >> 24 | \
((__uint64_t)(x) & 0xff000000000000ULL) >> 40 | \
((__uint64_t)(x) & 0xff00000000000000ULL) >> 56)
#endif /* __GNUC__ */
/*
* Define MD_SWAP if you provide swap{16,32}md functions/macros that are
* optimized for your architecture, These will be used for swap{16,32}
* unless the argument is a constant and we are using GCC, where we can
* take advantage of the CSE phase much better by using the generic version.
*/
#ifdef MD_SWAP
#if __GNUC__
#define __swap16(x) __statement({ \
__uint16_t __swap16_x = (x); \
\
__builtin_constant_p(x) ? __swap16gen(__swap16_x) : \
__swap16md(__swap16_x); \
})
#define __swap32(x) __statement({ \
__uint32_t __swap32_x = (x); \
\
__builtin_constant_p(x) ? __swap32gen(__swap32_x) : \
__swap32md(__swap32_x); \
})
#define __swap64(x) __statement({ \
__uint64_t __swap64_x = (x); \
\
__builtin_constant_p(x) ? __swap64gen(__swap64_x) : \
__swap64md(__swap64_x); \
})
#endif /* __GNUC__ */
#else /* MD_SWAP */
#define __swap16 __swap16gen
#define __swap32 __swap32gen
#define __swap64 __swap64gen
#endif /* MD_SWAP */
#define __swap16_multi(v, n) do { \
__size_t __swap16_multi_n = (n); \
__uint16_t *__swap16_multi_v = (v); \
\
while (__swap16_multi_n) { \
*__swap16_multi_v = swap16(*__swap16_multi_v); \
__swap16_multi_v++; \
__swap16_multi_n--; \
} \
} while (0)
#if __BSD_VISIBLE
#define swap16 __swap16
#define swap32 __swap32
#define swap64 __swap64
#define swap16_multi __swap16_multi
__BEGIN_DECLS
__uint64_t htobe64(__uint64_t);
__uint32_t htobe32(__uint32_t);
__uint16_t htobe16(__uint16_t);
__uint64_t betoh64(__uint64_t);
__uint32_t betoh32(__uint32_t);
__uint16_t betoh16(__uint16_t);
__uint64_t htole64(__uint64_t);
__uint32_t htole32(__uint32_t);
__uint16_t htole16(__uint16_t);
__uint64_t letoh64(__uint64_t);
__uint32_t letoh32(__uint32_t);
__uint16_t letoh16(__uint16_t);
__END_DECLS
#endif /* __BSD_VISIBLE */
#if _BYTE_ORDER == _LITTLE_ENDIAN
/* Can be overridden by machine/endian.h before inclusion of this file. */
#ifndef _QUAD_HIGHWORD
#define _QUAD_HIGHWORD 1
#endif
#ifndef _QUAD_LOWWORD
#define _QUAD_LOWWORD 0
#endif
#if __BSD_VISIBLE
#define htobe16 __swap16
#define htobe32 __swap32
#define htobe64 __swap64
#define betoh16 __swap16
#define betoh32 __swap32
#define betoh64 __swap64
#define htole16(x) (x)
#define htole32(x) (x)
#define htole64(x) (x)
#define letoh16(x) (x)
#define letoh32(x) (x)
#define letoh64(x) (x)
#endif /* __BSD_VISIBLE */
#define htons(x) __swap16(x)
#define htonl(x) __swap32(x)
#define ntohs(x) __swap16(x)
#define ntohl(x) __swap32(x)
/* Bionic additions */
#define ntohq(x) __swap64(x)
#define htonq(x) __swap64(x)
#define __LITTLE_ENDIAN_BITFIELD
#endif /* _BYTE_ORDER */
#if _BYTE_ORDER == _BIG_ENDIAN
/* Can be overridden by machine/endian.h before inclusion of this file. */
#ifndef _QUAD_HIGHWORD
#define _QUAD_HIGHWORD 0
#endif
#ifndef _QUAD_LOWWORD
#define _QUAD_LOWWORD 1
#endif
#if __BSD_VISIBLE
#define htole16 __swap16
#define htole32 __swap32
#define htole64 __swap64
#define letoh16 __swap16
#define letoh32 __swap32
#define letoh64 __swap64
#define htobe16(x) (x)
#define htobe32(x) (x)
#define htobe64(x) (x)
#define betoh16(x) (x)
#define betoh32(x) (x)
#define betoh64(x) (x)
#endif /* __BSD_VISIBLE */
#define htons(x) (x)
#define htonl(x) (x)
#define ntohs(x) (x)
#define ntohl(x) (x)
/* Bionic additions */
#define ntohq(x) (x)
#define htonq(x) (x)
#define __BIG_ENDIAN_BITFIELD
#endif /* _BYTE_ORDER */
#if __BSD_VISIBLE
#define NTOHL(x) (x) = ntohl((u_int32_t)(x))
#define NTOHS(x) (x) = ntohs((u_int16_t)(x))
#define HTONL(x) (x) = htonl((u_int32_t)(x))
#define HTONS(x) (x) = htons((u_int16_t)(x))
#endif
#define __BYTE_ORDER _BYTE_ORDER
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN _LITTLE_ENDIAN
#endif
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN _BIG_ENDIAN
#endif
#endif /* _SYS_ENDIAN_H_ */

66
libc/include/sys/epoll.h Normal file
View File

@@ -0,0 +1,66 @@
/*
* 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 _SYS_EPOLL_H_
#define _SYS_EPOLL_H_
#define EPOLLIN 0x00000001
#define EPOLLPRI 0x00000002
#define EPOLLOUT 0x00000004
#define EPOLLERR 0x00000008
#define EPOLLHUP 0x00000010
#define EPOLLRDNORM 0x00000040
#define EPOLLRDBAND 0x00000080
#define EPOLLWRNORM 0x00000100
#define EPOLLWRBAND 0x00000200
#define EPOLLMSG 0x00000400
#define EPOLLET 0x80000000
#define EPOLL_CTL_ADD 1
#define EPOLL_CTL_DEL 2
#define EPOLL_CTL_MOD 3
typedef union epoll_data
{
void *ptr;
int fd;
unsigned int u32;
unsigned long long u64;
} epoll_data_t;
struct epoll_event
{
unsigned int events;
epoll_data_t data;
};
int epoll_create(int size);
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
int epoll_wait(int epfd, struct epoll_event *events, int max, int timeout);
#endif /* _SYS_EPOLL_H_ */

1
libc/include/sys/errno.h Normal file
View File

@@ -0,0 +1 @@
#include <errno.h>

625
libc/include/sys/exec_elf.h Normal file
View File

@@ -0,0 +1,625 @@
/* $OpenBSD: exec_elf.h,v 1.41 2006/01/06 18:53:05 millert Exp $ */
/*
* Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
/*
* This is the ELF ABI header file
* formerly known as "elf_abi.h".
*/
#ifndef _SYS_EXEC_ELF_H_
#define _SYS_EXEC_ELF_H_
#include <machine/_types.h>
#include <machine/exec.h>
typedef __uint8_t Elf_Byte;
typedef __uint32_t Elf32_Addr; /* Unsigned program address */
typedef __uint32_t Elf32_Off; /* Unsigned file offset */
typedef __int32_t Elf32_Sword; /* Signed large integer */
typedef __uint32_t Elf32_Word; /* Unsigned large integer */
typedef __uint16_t Elf32_Half; /* Unsigned medium integer */
typedef __uint64_t Elf64_Addr;
typedef __uint64_t Elf64_Off;
typedef __int32_t Elf64_Shalf;
#ifdef __alpha__
typedef __int64_t Elf64_Sword;
typedef __uint64_t Elf64_Word;
#else
typedef __int32_t Elf64_Sword;
typedef __uint32_t Elf64_Word;
#endif
typedef __int64_t Elf64_Sxword;
typedef __uint64_t Elf64_Xword;
typedef __uint32_t Elf64_Half;
typedef __uint16_t Elf64_Quarter;
/*
* e_ident[] identification indexes
* See http://www.caldera.com/developers/gabi/2000-07-17/ch4.eheader.html
*/
#define EI_MAG0 0 /* file ID */
#define EI_MAG1 1 /* file ID */
#define EI_MAG2 2 /* file ID */
#define EI_MAG3 3 /* file ID */
#define EI_CLASS 4 /* file class */
#define EI_DATA 5 /* data encoding */
#define EI_VERSION 6 /* ELF header version */
#define EI_OSABI 7 /* OS/ABI ID */
#define EI_ABIVERSION 8 /* ABI version */
#define EI_PAD 9 /* start of pad bytes */
#define EI_NIDENT 16 /* Size of e_ident[] */
/* e_ident[] magic number */
#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */
#define ELFMAG1 'E' /* e_ident[EI_MAG1] */
#define ELFMAG2 'L' /* e_ident[EI_MAG2] */
#define ELFMAG3 'F' /* e_ident[EI_MAG3] */
#define ELFMAG "\177ELF" /* magic */
#define SELFMAG 4 /* size of magic */
/* e_ident[] file class */
#define ELFCLASSNONE 0 /* invalid */
#define ELFCLASS32 1 /* 32-bit objs */
#define ELFCLASS64 2 /* 64-bit objs */
#define ELFCLASSNUM 3 /* number of classes */
/* e_ident[] data encoding */
#define ELFDATANONE 0 /* invalid */
#define ELFDATA2LSB 1 /* Little-Endian */
#define ELFDATA2MSB 2 /* Big-Endian */
#define ELFDATANUM 3 /* number of data encode defines */
/* e_ident[] Operating System/ABI */
#define ELFOSABI_SYSV 0 /* UNIX System V ABI */
#define ELFOSABI_HPUX 1 /* HP-UX operating system */
#define ELFOSABI_NETBSD 2 /* NetBSD */
#define ELFOSABI_LINUX 3 /* GNU/Linux */
#define ELFOSABI_HURD 4 /* GNU/Hurd */
#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */
#define ELFOSABI_SOLARIS 6 /* Solaris */
#define ELFOSABI_MONTEREY 7 /* Monterey */
#define ELFOSABI_IRIX 8 /* IRIX */
#define ELFOSABI_FREEBSD 9 /* FreeBSD */
#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
#define ELFOSABI_MODESTO 11 /* Novell Modesto */
#define ELFOSABI_OPENBSD 12 /* OpenBSD */
#define ELFOSABI_ARM 97 /* ARM */
#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
/* e_ident */
#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
(ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
(ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
(ehdr).e_ident[EI_MAG3] == ELFMAG3)
/* ELF Header */
typedef struct elfhdr {
unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
Elf32_Half e_type; /* object file type */
Elf32_Half e_machine; /* machine */
Elf32_Word e_version; /* object file version */
Elf32_Addr e_entry; /* virtual entry point */
Elf32_Off e_phoff; /* program header table offset */
Elf32_Off e_shoff; /* section header table offset */
Elf32_Word e_flags; /* processor-specific flags */
Elf32_Half e_ehsize; /* ELF header size */
Elf32_Half e_phentsize; /* program header entry size */
Elf32_Half e_phnum; /* number of program header entries */
Elf32_Half e_shentsize; /* section header entry size */
Elf32_Half e_shnum; /* number of section header entries */
Elf32_Half e_shstrndx; /* section header table's "section
header string table" entry offset */
} Elf32_Ehdr;
typedef struct {
unsigned char e_ident[EI_NIDENT]; /* Id bytes */
Elf64_Quarter e_type; /* file type */
Elf64_Quarter e_machine; /* machine type */
Elf64_Half e_version; /* version number */
Elf64_Addr e_entry; /* entry point */
Elf64_Off e_phoff; /* Program hdr offset */
Elf64_Off e_shoff; /* Section hdr offset */
Elf64_Half e_flags; /* Processor flags */
Elf64_Quarter e_ehsize; /* sizeof ehdr */
Elf64_Quarter e_phentsize; /* Program header entry size */
Elf64_Quarter e_phnum; /* Number of program headers */
Elf64_Quarter e_shentsize; /* Section header entry size */
Elf64_Quarter e_shnum; /* Number of section headers */
Elf64_Quarter e_shstrndx; /* String table index */
} Elf64_Ehdr;
/* e_type */
#define ET_NONE 0 /* No file type */
#define ET_REL 1 /* relocatable file */
#define ET_EXEC 2 /* executable file */
#define ET_DYN 3 /* shared object file */
#define ET_CORE 4 /* core file */
#define ET_NUM 5 /* number of types */
#define ET_LOPROC 0xff00 /* reserved range for processor */
#define ET_HIPROC 0xffff /* specific e_type */
/* e_machine */
#define EM_NONE 0 /* No Machine */
#define EM_M32 1 /* AT&T WE 32100 */
#define EM_SPARC 2 /* SPARC */
#define EM_386 3 /* Intel 80386 */
#define EM_68K 4 /* Motorola 68000 */
#define EM_88K 5 /* Motorola 88000 */
#define EM_486 6 /* Intel 80486 - unused? */
#define EM_860 7 /* Intel 80860 */
#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */
/*
* Don't know if EM_MIPS_RS4_BE,
* EM_SPARC64, EM_PARISC,
* or EM_PPC are ABI compliant
*/
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */
#define EM_SPARC64 11 /* SPARC v9 64-bit unoffical */
#define EM_PARISC 15 /* HPPA */
#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
#define EM_PPC 20 /* PowerPC */
#define EM_ARM 40 /* Advanced RISC Machines ARM */
#define EM_ALPHA 41 /* DEC ALPHA */
#define EM_SPARCV9 43 /* SPARC version 9 */
#define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */
#define EM_AMD64 62 /* AMD64 architecture */
#define EM_VAX 75 /* DEC VAX */
#define EM_NUM 15 /* number of machine types */
/* Version */
#define EV_NONE 0 /* Invalid */
#define EV_CURRENT 1 /* Current */
#define EV_NUM 2 /* number of versions */
/* Section Header */
typedef struct {
Elf32_Word sh_name; /* name - index into section header
string table section */
Elf32_Word sh_type; /* type */
Elf32_Word sh_flags; /* flags */
Elf32_Addr sh_addr; /* address */
Elf32_Off sh_offset; /* file offset */
Elf32_Word sh_size; /* section size */
Elf32_Word sh_link; /* section header table index link */
Elf32_Word sh_info; /* extra information */
Elf32_Word sh_addralign; /* address alignment */
Elf32_Word sh_entsize; /* section entry size */
} Elf32_Shdr;
typedef struct {
Elf64_Half sh_name; /* section name */
Elf64_Half sh_type; /* section type */
Elf64_Xword sh_flags; /* section flags */
Elf64_Addr sh_addr; /* virtual address */
Elf64_Off sh_offset; /* file offset */
Elf64_Xword sh_size; /* section size */
Elf64_Half sh_link; /* link to another */
Elf64_Half sh_info; /* misc info */
Elf64_Xword sh_addralign; /* memory alignment */
Elf64_Xword sh_entsize; /* table entry size */
} Elf64_Shdr;
/* Special Section Indexes */
#define SHN_UNDEF 0 /* undefined */
#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */
#define SHN_LOPROC 0xff00 /* reserved range for processor */
#define SHN_HIPROC 0xff1f /* specific section indexes */
#define SHN_ABS 0xfff1 /* absolute value */
#define SHN_COMMON 0xfff2 /* common symbol */
#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */
/* sh_type */
#define SHT_NULL 0 /* inactive */
#define SHT_PROGBITS 1 /* program defined information */
#define SHT_SYMTAB 2 /* symbol table section */
#define SHT_STRTAB 3 /* string table section */
#define SHT_RELA 4 /* relocation section with addends*/
#define SHT_HASH 5 /* symbol hash table section */
#define SHT_DYNAMIC 6 /* dynamic section */
#define SHT_NOTE 7 /* note section */
#define SHT_NOBITS 8 /* no space section */
#define SHT_REL 9 /* relation section without addends */
#define SHT_SHLIB 10 /* reserved - purpose unknown */
#define SHT_DYNSYM 11 /* dynamic symbol table section */
#define SHT_NUM 12 /* number of section types */
#define SHT_LOPROC 0x70000000 /* reserved range for processor */
#define SHT_HIPROC 0x7fffffff /* specific section header types */
#define SHT_LOUSER 0x80000000 /* reserved range for application */
#define SHT_HIUSER 0xffffffff /* specific indexes */
/* Section names */
#define ELF_BSS ".bss" /* uninitialized data */
#define ELF_DATA ".data" /* initialized data */
#define ELF_DEBUG ".debug" /* debug */
#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
#define ELF_DYNSTR ".dynstr" /* dynamic string table */
#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
#define ELF_FINI ".fini" /* termination code */
#define ELF_GOT ".got" /* global offset table */
#define ELF_HASH ".hash" /* symbol hash table */
#define ELF_INIT ".init" /* initialization code */
#define ELF_REL_DATA ".rel.data" /* relocation data */
#define ELF_REL_FINI ".rel.fini" /* relocation termination code */
#define ELF_REL_INIT ".rel.init" /* relocation initialization code */
#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */
#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
#define ELF_REL_TEXT ".rel.text" /* relocation code */
#define ELF_RODATA ".rodata" /* read-only data */
#define ELF_SHSTRTAB ".shstrtab" /* section header string table */
#define ELF_STRTAB ".strtab" /* string table */
#define ELF_SYMTAB ".symtab" /* symbol table */
#define ELF_TEXT ".text" /* code */
/* Section Attribute Flags - sh_flags */
#define SHF_WRITE 0x1 /* Writable */
#define SHF_ALLOC 0x2 /* occupies memory */
#define SHF_EXECINSTR 0x4 /* executable */
#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */
/* specific section attributes */
/* Symbol Table Entry */
typedef struct elf32_sym {
Elf32_Word st_name; /* name - index into string table */
Elf32_Addr st_value; /* symbol value */
Elf32_Word st_size; /* symbol size */
unsigned char st_info; /* type and binding */
unsigned char st_other; /* 0 - no defined meaning */
Elf32_Half st_shndx; /* section header index */
} Elf32_Sym;
typedef struct {
Elf64_Half st_name; /* Symbol name index in str table */
Elf_Byte st_info; /* type / binding attrs */
Elf_Byte st_other; /* unused */
Elf64_Quarter st_shndx; /* section index of symbol */
Elf64_Xword st_value; /* value of symbol */
Elf64_Xword st_size; /* size of symbol */
} Elf64_Sym;
/* Symbol table index */
#define STN_UNDEF 0 /* undefined */
/* Extract symbol info - st_info */
#define ELF32_ST_BIND(x) ((x) >> 4)
#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf)
#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf))
#define ELF64_ST_BIND(x) ((x) >> 4)
#define ELF64_ST_TYPE(x) (((unsigned int) x) & 0xf)
#define ELF64_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf))
/* Symbol Binding - ELF32_ST_BIND - st_info */
#define STB_LOCAL 0 /* Local symbol */
#define STB_GLOBAL 1 /* Global symbol */
#define STB_WEAK 2 /* like global - lower precedence */
#define STB_NUM 3 /* number of symbol bindings */
#define STB_LOPROC 13 /* reserved range for processor */
#define STB_HIPROC 15 /* specific symbol bindings */
/* Symbol type - ELF32_ST_TYPE - st_info */
#define STT_NOTYPE 0 /* not specified */
#define STT_OBJECT 1 /* data object */
#define STT_FUNC 2 /* function */
#define STT_SECTION 3 /* section */
#define STT_FILE 4 /* file */
#define STT_NUM 5 /* number of symbol types */
#define STT_LOPROC 13 /* reserved range for processor */
#define STT_HIPROC 15 /* specific symbol types */
/* Relocation entry with implicit addend */
typedef struct {
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
} Elf32_Rel;
/* Relocation entry with explicit addend */
typedef struct {
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
Elf32_Sword r_addend;
} Elf32_Rela;
/* Extract relocation info - r_info */
#define ELF32_R_SYM(i) ((i) >> 8)
#define ELF32_R_TYPE(i) ((unsigned char) (i))
#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t))
typedef struct {
Elf64_Xword r_offset; /* where to do it */
Elf64_Xword r_info; /* index & type of relocation */
} Elf64_Rel;
typedef struct {
Elf64_Xword r_offset; /* where to do it */
Elf64_Xword r_info; /* index & type of relocation */
Elf64_Sxword r_addend; /* adjustment value */
} Elf64_Rela;
#define ELF64_R_SYM(info) ((info) >> 32)
#define ELF64_R_TYPE(info) ((info) & 0xFFFFFFFF)
#define ELF64_R_INFO(s,t) (((s) << 32) + (__uint32_t)(t))
/* Program Header */
typedef struct {
Elf32_Word p_type; /* segment type */
Elf32_Off p_offset; /* segment offset */
Elf32_Addr p_vaddr; /* virtual address of segment */
Elf32_Addr p_paddr; /* physical address - ignored? */
Elf32_Word p_filesz; /* number of bytes in file for seg. */
Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
Elf32_Word p_flags; /* flags */
Elf32_Word p_align; /* memory alignment */
} Elf32_Phdr;
typedef struct {
Elf64_Half p_type; /* entry type */
Elf64_Half p_flags; /* flags */
Elf64_Off p_offset; /* offset */
Elf64_Addr p_vaddr; /* virtual address */
Elf64_Addr p_paddr; /* physical address */
Elf64_Xword p_filesz; /* file size */
Elf64_Xword p_memsz; /* memory size */
Elf64_Xword p_align; /* memory & file alignment */
} Elf64_Phdr;
/* Segment types - p_type */
#define PT_NULL 0 /* unused */
#define PT_LOAD 1 /* loadable segment */
#define PT_DYNAMIC 2 /* dynamic linking section */
#define PT_INTERP 3 /* the RTLD */
#define PT_NOTE 4 /* auxiliary information */
#define PT_SHLIB 5 /* reserved - purpose undefined */
#define PT_PHDR 6 /* program header */
#define PT_NUM 7 /* Number of segment types */
#define PT_LOOS 0x60000000 /* reserved range for OS */
#define PT_HIOS 0x6fffffff /* specific segment types */
#define PT_LOPROC 0x70000000 /* reserved range for processor */
#define PT_HIPROC 0x7fffffff /* specific segment types */
/* Segment flags - p_flags */
#define PF_X 0x1 /* Executable */
#define PF_W 0x2 /* Writable */
#define PF_R 0x4 /* Readable */
#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
/* specific segment flags */
/* Dynamic structure */
typedef struct {
Elf32_Sword d_tag; /* controls meaning of d_val */
union {
Elf32_Word d_val; /* Multiple meanings - see d_tag */
Elf32_Addr d_ptr; /* program virtual address */
} d_un;
} Elf32_Dyn;
typedef struct {
Elf64_Xword d_tag; /* controls meaning of d_val */
union {
Elf64_Addr d_ptr;
Elf64_Xword d_val;
} d_un;
} Elf64_Dyn;
/* Dynamic Array Tags - d_tag */
#define DT_NULL 0 /* marks end of _DYNAMIC array */
#define DT_NEEDED 1 /* string table offset of needed lib */
#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */
#define DT_PLTGOT 3 /* address PLT/GOT */
#define DT_HASH 4 /* address of symbol hash table */
#define DT_STRTAB 5 /* address of string table */
#define DT_SYMTAB 6 /* address of symbol table */
#define DT_RELA 7 /* address of relocation table */
#define DT_RELASZ 8 /* size of relocation table */
#define DT_RELAENT 9 /* size of relocation entry */
#define DT_STRSZ 10 /* size of string table */
#define DT_SYMENT 11 /* size of symbol table entry */
#define DT_INIT 12 /* address of initialization func. */
#define DT_FINI 13 /* address of termination function */
#define DT_SONAME 14 /* string table offset of shared obj */
#define DT_RPATH 15 /* string table offset of library
search path */
#define DT_SYMBOLIC 16 /* start sym search in shared obj. */
#define DT_REL 17 /* address of rel. tbl. w addends */
#define DT_RELSZ 18 /* size of DT_REL relocation table */
#define DT_RELENT 19 /* size of DT_REL relocation entry */
#define DT_PLTREL 20 /* PLT referenced relocation entry */
#define DT_DEBUG 21 /* bugger */
#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */
#define DT_JMPREL 23 /* add. of PLT's relocation entries */
#define DT_BIND_NOW 24 /* Bind now regardless of env setting */
#define DT_NUM 25 /* Number used. */
#define DT_LOPROC 0x70000000 /* reserved range for processor */
#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */
/* Standard ELF hashing function */
unsigned int elf_hash(const unsigned char *name);
/*
* Note Definitions
*/
typedef struct {
Elf32_Word namesz;
Elf32_Word descsz;
Elf32_Word type;
} Elf32_Note;
typedef struct {
Elf64_Half namesz;
Elf64_Half descsz;
Elf64_Half type;
} Elf64_Note;
/*
* XXX - these _KERNEL items aren't part of the ABI!
*/
#if defined(_KERNEL) || defined(_DYN_LOADER)
#define ELF32_NO_ADDR ((u_long) ~0) /* Indicates addr. not yet filled in */
#define ELF_AUX_ENTRIES 8 /* Size of aux array passed to loader */
typedef struct {
Elf32_Sword au_id; /* 32-bit id */
Elf32_Word au_v; /* 32-bit value */
} Aux32Info;
#define ELF64_NO_ADDR ((__uint64_t) ~0)/* Indicates addr. not yet filled in */
#define ELF64_AUX_ENTRIES 8 /* Size of aux array passed to loader */
typedef struct {
Elf64_Shalf au_id; /* 32-bit id */
Elf64_Xword au_v; /* 64-bit id */
} Aux64Info;
enum AuxID {
AUX_null = 0,
AUX_ignore = 1,
AUX_execfd = 2,
AUX_phdr = 3, /* &phdr[0] */
AUX_phent = 4, /* sizeof(phdr[0]) */
AUX_phnum = 5, /* # phdr entries */
AUX_pagesz = 6, /* PAGESIZE */
AUX_base = 7, /* ld.so base addr */
AUX_flags = 8, /* processor flags */
AUX_entry = 9, /* a.out entry */
AUX_sun_uid = 2000, /* euid */
AUX_sun_ruid = 2001, /* ruid */
AUX_sun_gid = 2002, /* egid */
AUX_sun_rgid = 2003 /* rgid */
};
struct elf_args {
u_long arg_entry; /* program entry point */
u_long arg_interp; /* Interpreter load address */
u_long arg_phaddr; /* program header address */
u_long arg_phentsize; /* Size of program header */
u_long arg_phnum; /* Number of program headers */
u_long arg_os; /* OS tag */
};
#endif
#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
#define ELFSIZE ARCH_ELFSIZE
#endif
#if defined(ELFSIZE)
#define CONCAT(x,y) __CONCAT(x,y)
#define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
#define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
#define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE))
#define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
#endif
#if defined(ELFSIZE) && (ELFSIZE == 32)
#define Elf_Ehdr Elf32_Ehdr
#define Elf_Phdr Elf32_Phdr
#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#define Elf_Rel Elf32_Rel
#define Elf_RelA Elf32_Rela
#define Elf_Dyn Elf32_Dyn
#define Elf_Half Elf32_Half
#define Elf_Word Elf32_Word
#define Elf_Sword Elf32_Sword
#define Elf_Addr Elf32_Addr
#define Elf_Off Elf32_Off
#define Elf_Nhdr Elf32_Nhdr
#define Elf_Note Elf32_Note
#define ELF_R_SYM ELF32_R_SYM
#define ELF_R_TYPE ELF32_R_TYPE
#define ELF_R_INFO ELF32_R_INFO
#define ELFCLASS ELFCLASS32
#define ELF_ST_BIND ELF32_ST_BIND
#define ELF_ST_TYPE ELF32_ST_TYPE
#define ELF_ST_INFO ELF32_ST_INFO
#define AuxInfo Aux32Info
#elif defined(ELFSIZE) && (ELFSIZE == 64)
#define Elf_Ehdr Elf64_Ehdr
#define Elf_Phdr Elf64_Phdr
#define Elf_Shdr Elf64_Shdr
#define Elf_Sym Elf64_Sym
#define Elf_Rel Elf64_Rel
#define Elf_RelA Elf64_Rela
#define Elf_Dyn Elf64_Dyn
#define Elf_Half Elf64_Half
#define Elf_Word Elf64_Word
#define Elf_Sword Elf64_Sword
#define Elf_Addr Elf64_Addr
#define Elf_Off Elf64_Off
#define Elf_Nhdr Elf64_Nhdr
#define Elf_Note Elf64_Note
#define ELF_R_SYM ELF64_R_SYM
#define ELF_R_TYPE ELF64_R_TYPE
#define ELF_R_INFO ELF64_R_INFO
#define ELFCLASS ELFCLASS64
#define ELF_ST_BIND ELF64_ST_BIND
#define ELF_ST_TYPE ELF64_ST_TYPE
#define ELF_ST_INFO ELF64_ST_INFO
#define AuxInfo Aux64Info
#endif
#ifndef _KERNEL
extern Elf_Dyn _DYNAMIC[];
#endif
#ifdef _KERNEL
#ifdef _KERN_DO_ELF64
int exec_elf64_makecmds(struct proc *, struct exec_package *);
void *elf64_copyargs(struct exec_package *, struct ps_strings *,
void *, void *);
int exec_elf64_fixup(struct proc *, struct exec_package *);
char *elf64_check_brand(Elf64_Ehdr *);
int elf64_os_pt_note(struct proc *, struct exec_package *, Elf64_Ehdr *,
char *, size_t, size_t);
#endif
#ifdef _KERN_DO_ELF
int exec_elf32_makecmds(struct proc *, struct exec_package *);
void *elf32_copyargs(struct exec_package *, struct ps_strings *,
void *, void *);
int exec_elf32_fixup(struct proc *, struct exec_package *);
char *elf32_check_brand(Elf32_Ehdr *);
int elf32_os_pt_note(struct proc *, struct exec_package *, Elf32_Ehdr *,
char *, size_t, size_t);
#endif
#endif /* _KERNEL */
#define ELF_TARG_VER 1 /* The ver for which this code is intended */
#endif /* _SYS_EXEC_ELF_H_ */

38
libc/include/sys/file.h Normal file
View File

@@ -0,0 +1,38 @@
/*
* 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 _SYS_FILE_H_
#define _SYS_FILE_H_
#include <sys/cdefs.h>
#include <sys/types.h>
// ANDROID: needed for flock()
#include <unistd.h>
#include <fcntl.h>
#endif /* _SYS_FILE_H_ */

41
libc/include/sys/fsuid.h Normal file
View File

@@ -0,0 +1,41 @@
/*
* 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 _SYS_FSUID_H_
#define _SYS_FSUID_H_
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
extern int setfsuid(uid_t);
extern int setfsgid(gid_t);
__END_DECLS
#endif /* _SYS_FSUID_H_ */

View File

@@ -0,0 +1,43 @@
/*
* 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 _SYS_INOTIFY_H_
#define _SYS_INOTIFY_H_
#include <sys/cdefs.h>
#include <sys/types.h>
#include <linux/inotify.h>
__BEGIN_DECLS
extern int inotify_init(void);
extern int inotify_add_watch(int, const char *, __u32);
extern int inotify_rm_watch(int, __u32);
__END_DECLS
#endif /* _SYS_INOTIFY_H_ */

43
libc/include/sys/ioctl.h Normal file
View File

@@ -0,0 +1,43 @@
/*
* 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 _SYS_IOCTL_H_
#define _SYS_IOCTL_H_
#include <sys/cdefs.h>
#include <linux/ioctl.h>
#include <asm/ioctls.h>
#include <asm/termbits.h>
#include <sys/ioctl_compat.h>
__BEGIN_DECLS
extern int ioctl(int, int, ...);
__END_DECLS
#endif /* _SYS_IOCTL_H_ */

View File

@@ -0,0 +1,168 @@
/* $NetBSD: ioctl_compat.h,v 1.15 2005/12/03 17:10:46 christos Exp $ */
/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)ioctl_compat.h 8.4 (Berkeley) 1/21/94
*/
#ifndef _SYS_IOCTL_COMPAT_H_
#define _SYS_IOCTL_COMPAT_H_
//#include <sys/ttychars.h>
//#include <sys/ttydev.h>
struct tchars {
char t_intrc; /* interrupt */
char t_quitc; /* quit */
char t_startc; /* start output */
char t_stopc; /* stop output */
char t_eofc; /* end-of-file */
char t_brkc; /* input delimiter (like nl) */
};
struct ltchars {
char t_suspc; /* stop process signal */
char t_dsuspc; /* delayed stop process signal */
char t_rprntc; /* reprint line */
char t_flushc; /* flush output (toggles) */
char t_werasc; /* word erase */
char t_lnextc; /* literal next character */
};
/*
* Structure for TIOCGETP and TIOCSETP ioctls.
*/
#ifndef _SGTTYB_
#define _SGTTYB_
struct sgttyb {
char sg_ispeed; /* input speed */
char sg_ospeed; /* output speed */
char sg_erase; /* erase character */
char sg_kill; /* kill character */
short sg_flags; /* mode flags */
};
#endif
#ifdef USE_OLD_TTY
# undef TIOCGETD
# define TIOCGETD _IOR('t', 0, int) /* get line discipline */
# undef TIOCSETD
# define TIOCSETD _IOW('t', 1, int) /* set line discipline */
#else
# define OTIOCGETD _IOR('t', 0, int) /* get line discipline */
# define OTIOCSETD _IOW('t', 1, int) /* set line discipline */
#endif
#define TIOCHPCL _IO('t', 2) /* hang up on last close */
#define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */
#define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */
#define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty*/
#define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */
#define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */
#if 0
/* BUG: a bunch of these conflict with #defines in asm/termbits.h */
#define TANDEM 0x00000001 /* send stopc on out q full */
#define CBREAK 0x00000002 /* half-cooked mode */
#define LCASE 0x00000004 /* simulate lower case */
#define ECHO 0x00000008 /* enable echoing */
#define CRMOD 0x00000010 /* map \r to \r\n on output */
#define RAW 0x00000020 /* no i/o processing */
#define ODDP 0x00000040 /* get/send odd parity */
#define EVENP 0x00000080 /* get/send even parity */
#define ANYP 0x000000c0 /* get any parity/send none */
#define NLDELAY 0x00000300 /* \n delay */
#define NL0 0x00000000
#define NL1 0x00000100 /* tty 37 */
#define NL2 0x00000200 /* vt05 */
#define NL3 0x00000300
#define TBDELAY 0x00000c00 /* horizontal tab delay */
#define TAB0 0x00000000
#define TAB1 0x00000400 /* tty 37 */
#define TAB2 0x00000800
#define XTABS 0x00000c00 /* expand tabs on output */
#define CRDELAY 0x00003000 /* \r delay */
#define CR0 0x00000000
#define CR1 0x00001000 /* tn 300 */
#define CR2 0x00002000 /* tty 37 */
#define CR3 0x00003000 /* concept 100 */
#define VTDELAY 0x00004000 /* vertical tab delay */
#define FF0 0x00000000
#define FF1 0x00004000 /* tty 37 */
#define BSDELAY 0x00008000 /* \b delay */
#define BS0 0x00000000
#define BS1 0x00008000
#define ALLDELAY (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY)
#define CRTBS 0x00010000 /* do backspacing for crt */
#define PRTERA 0x00020000 /* \ ... / erase */
#define CRTERA 0x00040000 /* " \b " to wipe out char */
#define TILDE 0x00080000 /* hazeltine tilde kludge */
#define MDMBUF 0x00100000 /* DTR/DCD hardware flow control */
#define LITOUT 0x00200000 /* literal output */
#define TOSTOP 0x00400000 /* stop background jobs on output */
#define FLUSHO 0x00800000 /* output being flushed (state) */
#define NOHANG 0x01000000 /* (no-op) was no SIGHUP on carrier drop */
#define L001000 0x02000000
#define CRTKIL 0x04000000 /* kill line with " \b " */
#define PASS8 0x08000000
#define CTLECH 0x10000000 /* echo control chars as ^X */
#define PENDIN 0x20000000 /* re-echo input buffer at next read */
#define DECCTQ 0x40000000 /* only ^Q starts after ^S */
#define NOFLSH 0x80000000 /* don't flush output on signal */
#endif
#define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */
#define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */
#define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */
#define TIOCLGET _IOR('t', 124, int) /* get local modes */
#define LCRTBS (CRTBS>>16)
#define LPRTERA (PRTERA>>16)
#define LCRTERA (CRTERA>>16)
#define LTILDE (TILDE>>16)
#define LMDMBUF (MDMBUF>>16)
#define LLITOUT (LITOUT>>16)
#define LTOSTOP (TOSTOP>>16)
#define LFLUSHO (FLUSHO>>16)
#define LNOHANG (NOHANG>>16)
#define LCRTKIL (CRTKIL>>16)
#define LPASS8 (PASS8>>16)
#define LCTLECH (CTLECH>>16)
#define LPENDIN (PENDIN>>16)
#define LDECCTQ (DECCTQ>>16)
#define LNOFLSH (NOFLSH>>16)
#define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars*/
#define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars*/
#define OTIOCCONS _IO('t', 98) /* for hp300 -- sans int arg */
#define OTTYDISC 0
#define NETLDISC 1
#define NTTYDISC 2
#endif /* !_SYS_IOCTL_COMPAT_H_ */

41
libc/include/sys/ipc.h Normal file
View File

@@ -0,0 +1,41 @@
/*
* 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 _SYS_IPC_H
#define _SYS_IPC_H
#include <sys/cdefs.h>
#include <sys/types.h>
#include <linux/ipc.h>
__BEGIN_DECLS
extern key_t ftok(const char* path, int id);
__END_DECLS
#endif /* _SYS_IPC_H */

51
libc/include/sys/klog.h Normal file
View File

@@ -0,0 +1,51 @@
/*
* 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 _SYS_KLOG_H_
#define _SYS_KLOG_H_
#include <sys/cdefs.h>
__BEGIN_DECLS
#define KLOG_CLOSE 0
#define KLOG_OPEN 1
#define KLOG_READ 2
#define KLOG_READ_ALL 3
#define KLOG_READ_CLEAR 4
#define KLOG_CLEAR 5
#define KLOG_DISABLE 6
#define KLOG_ENABLE 7
#define KLOG_SETLEVEL 8
#define KLOG_UNREADSIZE 9
#define KLOG_WRITE 10
extern int klogctl(int, char *, int);
__END_DECLS
#endif /* _SYS_KLOG_H_ */

179
libc/include/sys/limits.h Normal file
View File

@@ -0,0 +1,179 @@
/* $OpenBSD: limits.h,v 1.6 2005/12/13 00:35:23 millert Exp $ */
/*
* Copyright (c) 2002 Marc Espie.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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 OPENBSD PROJECT 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 OPENBSD
* PROJECT 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 _SYS_LIMITS_H_
#define _SYS_LIMITS_H_
#include <sys/cdefs.h>
#include <linux/limits.h>
/* Common definitions for limits.h. */
/*
* <machine/internal_types.h> is meant to describe a specific architecture,
* but to be a safe include, that doesn't ever define anything that is
* user-visible (only typedefs and #define names that stays in the __xxx
* namespace).
*
* __machine_has_unsigned_chars (default is signed chars)
* __FLT_xxx/__DBL_xxx non standard values for floating
* points limits.
*/
#include <machine/internal_types.h>
/* Legacy */
#include <machine/limits.h>
#define CHAR_BIT 8 /* number of bits in a char */
#define SCHAR_MAX 0x7f /* max value for a signed char */
#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
#define UCHAR_MAX 0xffU /* max value for an unsigned char */
#ifdef __machine_has_unsigned_chars
# define CHAR_MIN 0 /* min value for a char */
# define CHAR_MAX 0xff /* max value for a char */
#else
# define CHAR_MAX 0x7f
# define CHAR_MIN (-0x7f-1)
#endif
#define USHRT_MAX 0xffffU /* max value for an unsigned short */
#define SHRT_MAX 0x7fff /* max value for a short */
#define SHRT_MIN (-0x7fff-1) /* min value for a short */
#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
#define INT_MAX 0x7fffffff /* max value for an int */
#define INT_MIN (-0x7fffffff-1) /* min value for an int */
#ifdef __LP64__
# define ULONG_MAX 0xffffffffffffffffUL
/* max value for unsigned long */
# define LONG_MAX 0x7fffffffffffffffL
/* max value for a signed long */
# define LONG_MIN (-0x7fffffffffffffffL-1)
/* min value for a signed long */
#else
# define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
# define LONG_MAX 0x7fffffffL /* max value for a long */
# define LONG_MIN (-0x7fffffffL-1)/* min value for a long */
#endif
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
# define ULLONG_MAX 0xffffffffffffffffULL
/* max value for unsigned long long */
# define LLONG_MAX 0x7fffffffffffffffLL
/* max value for a signed long long */
# define LLONG_MIN (-0x7fffffffffffffffLL-1)
/* min value for a signed long long */
#endif
#if __BSD_VISIBLE
# define UID_MAX UINT_MAX /* max value for a uid_t */
# define GID_MAX UINT_MAX /* max value for a gid_t */
#endif
#ifdef __LP64__
# define LONG_BIT 64
#else
# define LONG_BIT 32
#endif
/* float.h defines these as well */
# if !defined(DBL_DIG)
# if defined(__DBL_DIG)
# define DBL_DIG __DBL_DIG
# define DBL_MAX __DBL_MAX
# define DBL_MIN __DBL_MIN
# define FLT_DIG __FLT_DIG
# define FLT_MAX __FLT_MAX
# define FLT_MIN __FLT_MIN
# else
# define DBL_DIG 15
# define DBL_MAX 1.7976931348623157E+308
# define DBL_MIN 2.2250738585072014E-308
# define FLT_DIG 6
# define FLT_MAX 3.40282347E+38F
# define FLT_MIN 1.17549435E-38F
# endif
# endif
/* Bionic: the following has been optimized out from our processed kernel headers */
#define CHILD_MAX 999
#define OPEN_MAX 256
/* Bionic-specific definitions */
#define _POSIX_VERSION 200112L /* Posix C language bindings version */
#define _POSIX2_VERSION -1 /* we don't support Posix command-line tools */
#define _POSIX2_C_VERSION _POSIX_VERSION
#define _XOPEN_VERSION 500 /* by Posix definition */
#define _XOPEN_XCU_VERSION -1 /* we don't support command-line utilities */
/* tell what we implement legacy stuff when appropriate */
#if _POSIX_VERSION > 0
#define _XOPEN_XPG2 1
#define _XOPEN_XPG3 1
#define _XOPEN_XPG4 1
#define _XOPEN_UNIX 1
#endif
#define _XOPEN_ENH_I18N -1 /* we don't support internationalization in the C library */
#define _XOPEN_CRYPT -1 /* don't support X/Open Encryption */
#define _XOPEN_LEGACY -1 /* don't claim we support these, we have some of them but not all */
#define _XOPEN_REALTIME -1 /* we don't support all these functions */
#define _XOPEN_REALTIME_THREADS -1 /* same here */
#define _POSIX_REALTIME_SIGNALS -1 /* for now, this is not supported */
#define _POSIX_PRIORITY_SCHEDULING 1 /* priority scheduling is a Linux feature */
#define _POSIX_TIMERS 1 /* Posix timers are supported */
#undef _POSIX_ASYNCHRONOUS_IO /* aio_ functions are not supported */
#define _POSIX_SYNCHRONIZED_IO 1 /* synchronized i/o supported */
#define _POSIX_FSYNC 1 /* fdatasync() supported */
#define _POSIX_MAPPED_FILES 1 /* mmap-ed files supported */
/* XXX: TODO: complete and check list here */
#define _POSIX_THREADS 1 /* we support threads */
#define _POSIX_THREAD_STACKADDR 1 /* we support thread stack address */
#define _POSIX_THREAD_STACKSIZE 1 /* we support thread stack size */
#define _POSIX_THREAD_PRIO_INHERIT 200112L /* linux feature */
#define _POSIX_THREAD_PRIO_PROTECT 200112L /* linux feature */
#undef _POSIX_PROCESS_SHARED /* we don't support process-shared synchronization */
#undef _POSIX_THREAD_SAFE_FUNCTIONS /* most functions are, but not everything yet */
#define _POSIX_CHOWN_RESTRICTED 1 /* yes, chown requires appropriate priviledges */
#define _POSIX_NO_TRUNC 1 /* very long pathnames generate an error */
#define _POSIX_SAVED_IDS 1 /* saved user ids is a Linux feature */
#define _POSIX_JOB_CONTROL 1 /* job control is a Linux feature */
#endif

View File

@@ -0,0 +1,230 @@
/* auto-generated by gensyscalls.py, do not touch */
#ifndef _BIONIC_LINUX_SYSCALLS_H_
#if !defined __ASM_ARM_UNISTD_H && !defined __ASM_I386_UNISTD_H
#if defined __arm__ && !defined __ARM_EABI__ && !defined __thumb__
# define __NR_SYSCALL_BASE 0x900000
#else
# define __NR_SYSCALL_BASE 0
#endif
#define __NR_exit (__NR_SYSCALL_BASE + 1)
#define __NR_fork (__NR_SYSCALL_BASE + 2)
#define __NR_clone (__NR_SYSCALL_BASE + 120)
#define __NR_execve (__NR_SYSCALL_BASE + 11)
#define __NR_setuid32 (__NR_SYSCALL_BASE + 213)
#define __NR_getuid32 (__NR_SYSCALL_BASE + 199)
#define __NR_getgid32 (__NR_SYSCALL_BASE + 200)
#define __NR_geteuid32 (__NR_SYSCALL_BASE + 201)
#define __NR_getegid32 (__NR_SYSCALL_BASE + 202)
#define __NR_getresuid32 (__NR_SYSCALL_BASE + 209)
#define __NR_getresgid32 (__NR_SYSCALL_BASE + 211)
#define __NR_gettid (__NR_SYSCALL_BASE + 224)
#define __NR_getgroups32 (__NR_SYSCALL_BASE + 205)
#define __NR_getpgid (__NR_SYSCALL_BASE + 132)
#define __NR_getppid (__NR_SYSCALL_BASE + 64)
#define __NR_setsid (__NR_SYSCALL_BASE + 66)
#define __NR_setgid32 (__NR_SYSCALL_BASE + 214)
#define __NR_setreuid32 (__NR_SYSCALL_BASE + 203)
#define __NR_setresuid32 (__NR_SYSCALL_BASE + 208)
#define __NR_setresgid32 (__NR_SYSCALL_BASE + 210)
#define __NR_brk (__NR_SYSCALL_BASE + 45)
#define __NR_ptrace (__NR_SYSCALL_BASE + 26)
#define __NR_getpriority (__NR_SYSCALL_BASE + 96)
#define __NR_setpriority (__NR_SYSCALL_BASE + 97)
#define __NR_setrlimit (__NR_SYSCALL_BASE + 75)
#define __NR_ugetrlimit (__NR_SYSCALL_BASE + 191)
#define __NR_getrusage (__NR_SYSCALL_BASE + 77)
#define __NR_setgroups32 (__NR_SYSCALL_BASE + 206)
#define __NR_setpgid (__NR_SYSCALL_BASE + 57)
#define __NR_vfork (__NR_SYSCALL_BASE + 190)
#define __NR_setregid32 (__NR_SYSCALL_BASE + 204)
#define __NR_chroot (__NR_SYSCALL_BASE + 61)
#define __NR_prctl (__NR_SYSCALL_BASE + 172)
#define __NR_capget (__NR_SYSCALL_BASE + 184)
#define __NR_capset (__NR_SYSCALL_BASE + 185)
#define __NR_acct (__NR_SYSCALL_BASE + 51)
#define __NR_read (__NR_SYSCALL_BASE + 3)
#define __NR_write (__NR_SYSCALL_BASE + 4)
#define __NR_open (__NR_SYSCALL_BASE + 5)
#define __NR_close (__NR_SYSCALL_BASE + 6)
#define __NR_lseek (__NR_SYSCALL_BASE + 19)
#define __NR__llseek (__NR_SYSCALL_BASE + 140)
#define __NR_getpid (__NR_SYSCALL_BASE + 20)
#define __NR_mmap2 (__NR_SYSCALL_BASE + 192)
#define __NR_munmap (__NR_SYSCALL_BASE + 91)
#define __NR_mremap (__NR_SYSCALL_BASE + 163)
#define __NR_msync (__NR_SYSCALL_BASE + 144)
#define __NR_mprotect (__NR_SYSCALL_BASE + 125)
#define __NR_mlock (__NR_SYSCALL_BASE + 150)
#define __NR_munlock (__NR_SYSCALL_BASE + 151)
#define __NR_ioctl (__NR_SYSCALL_BASE + 54)
#define __NR_readv (__NR_SYSCALL_BASE + 145)
#define __NR_writev (__NR_SYSCALL_BASE + 146)
#define __NR_fcntl (__NR_SYSCALL_BASE + 55)
#define __NR_flock (__NR_SYSCALL_BASE + 143)
#define __NR_fchmod (__NR_SYSCALL_BASE + 94)
#define __NR_dup (__NR_SYSCALL_BASE + 41)
#define __NR_pipe (__NR_SYSCALL_BASE + 42)
#define __NR_dup2 (__NR_SYSCALL_BASE + 63)
#define __NR__newselect (__NR_SYSCALL_BASE + 142)
#define __NR_ftruncate (__NR_SYSCALL_BASE + 93)
#define __NR_fsync (__NR_SYSCALL_BASE + 118)
#define __NR_fchown32 (__NR_SYSCALL_BASE + 207)
#define __NR_sync (__NR_SYSCALL_BASE + 36)
#define __NR_fcntl64 (__NR_SYSCALL_BASE + 221)
#define __NR_sendfile (__NR_SYSCALL_BASE + 187)
#define __NR_link (__NR_SYSCALL_BASE + 9)
#define __NR_unlink (__NR_SYSCALL_BASE + 10)
#define __NR_chdir (__NR_SYSCALL_BASE + 12)
#define __NR_mknod (__NR_SYSCALL_BASE + 14)
#define __NR_chmod (__NR_SYSCALL_BASE + 15)
#define __NR_chown32 (__NR_SYSCALL_BASE + 212)
#define __NR_lchown32 (__NR_SYSCALL_BASE + 198)
#define __NR_mount (__NR_SYSCALL_BASE + 21)
#define __NR_umount2 (__NR_SYSCALL_BASE + 52)
#define __NR_fstat64 (__NR_SYSCALL_BASE + 197)
#define __NR_stat64 (__NR_SYSCALL_BASE + 195)
#define __NR_lstat64 (__NR_SYSCALL_BASE + 196)
#define __NR_mkdir (__NR_SYSCALL_BASE + 39)
#define __NR_readlink (__NR_SYSCALL_BASE + 85)
#define __NR_rmdir (__NR_SYSCALL_BASE + 40)
#define __NR_rename (__NR_SYSCALL_BASE + 38)
#define __NR_getcwd (__NR_SYSCALL_BASE + 183)
#define __NR_access (__NR_SYSCALL_BASE + 33)
#define __NR_symlink (__NR_SYSCALL_BASE + 83)
#define __NR_fchdir (__NR_SYSCALL_BASE + 133)
#define __NR_truncate (__NR_SYSCALL_BASE + 92)
#define __NR_pause (__NR_SYSCALL_BASE + 29)
#define __NR_gettimeofday (__NR_SYSCALL_BASE + 78)
#define __NR_settimeofday (__NR_SYSCALL_BASE + 79)
#define __NR_times (__NR_SYSCALL_BASE + 43)
#define __NR_nanosleep (__NR_SYSCALL_BASE + 162)
#define __NR_setitimer (__NR_SYSCALL_BASE + 104)
#define __NR_sigaction (__NR_SYSCALL_BASE + 67)
#define __NR_sigprocmask (__NR_SYSCALL_BASE + 126)
#define __NR_sigsuspend (__NR_SYSCALL_BASE + 72)
#define __NR_rt_sigaction (__NR_SYSCALL_BASE + 174)
#define __NR_rt_sigprocmask (__NR_SYSCALL_BASE + 175)
#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE + 177)
#define __NR_sigpending (__NR_SYSCALL_BASE + 73)
#define __NR_sched_setscheduler (__NR_SYSCALL_BASE + 156)
#define __NR_sched_getscheduler (__NR_SYSCALL_BASE + 157)
#define __NR_sched_yield (__NR_SYSCALL_BASE + 158)
#define __NR_sched_setparam (__NR_SYSCALL_BASE + 154)
#define __NR_sched_getparam (__NR_SYSCALL_BASE + 155)
#define __NR_sched_get_priority_max (__NR_SYSCALL_BASE + 159)
#define __NR_sched_get_priority_min (__NR_SYSCALL_BASE + 160)
#define __NR_sched_rr_get_interval (__NR_SYSCALL_BASE + 161)
#define __NR_uname (__NR_SYSCALL_BASE + 122)
#define __NR_wait4 (__NR_SYSCALL_BASE + 114)
#define __NR_umask (__NR_SYSCALL_BASE + 60)
#define __NR_reboot (__NR_SYSCALL_BASE + 88)
#define __NR_syslog (__NR_SYSCALL_BASE + 103)
#define __NR_init_module (__NR_SYSCALL_BASE + 128)
#define __NR_delete_module (__NR_SYSCALL_BASE + 129)
#define __NR_syslog (__NR_SYSCALL_BASE + 103)
#define __NR_futex (__NR_SYSCALL_BASE + 240)
#define __NR_poll (__NR_SYSCALL_BASE + 168)
#ifdef __arm__
#define __NR_exit_group (__NR_SYSCALL_BASE + 248)
#define __NR_waitid (__NR_SYSCALL_BASE + 280)
#define __NR_openat (__NR_SYSCALL_BASE + 322)
#define __NR_madvise (__NR_SYSCALL_BASE + 220)
#define __NR_mincore (__NR_SYSCALL_BASE + 219)
#define __NR_getdents64 (__NR_SYSCALL_BASE + 217)
#define __NR_fstatfs64 (__NR_SYSCALL_BASE + 267)
#define __NR_fstatat64 (__NR_SYSCALL_BASE + 327)
#define __NR_mkdirat (__NR_SYSCALL_BASE + 323)
#define __NR_fchownat (__NR_SYSCALL_BASE + 325)
#define __NR_fchmodat (__NR_SYSCALL_BASE + 333)
#define __NR_renameat (__NR_SYSCALL_BASE + 329)
#define __NR_unlinkat (__NR_SYSCALL_BASE + 328)
#define __NR_statfs64 (__NR_SYSCALL_BASE + 266)
#define __NR_clock_gettime (__NR_SYSCALL_BASE + 263)
#define __NR_clock_settime (__NR_SYSCALL_BASE + 262)
#define __NR_clock_getres (__NR_SYSCALL_BASE + 264)
#define __NR_clock_nanosleep (__NR_SYSCALL_BASE + 265)
#define __NR_timer_create (__NR_SYSCALL_BASE + 257)
#define __NR_timer_settime (__NR_SYSCALL_BASE + 258)
#define __NR_timer_gettime (__NR_SYSCALL_BASE + 259)
#define __NR_timer_getoverrun (__NR_SYSCALL_BASE + 260)
#define __NR_timer_delete (__NR_SYSCALL_BASE + 261)
#define __NR_utimes (__NR_SYSCALL_BASE + 269)
#define __NR_socket (__NR_SYSCALL_BASE + 281)
#define __NR_socketpair (__NR_SYSCALL_BASE + 288)
#define __NR_bind (__NR_SYSCALL_BASE + 282)
#define __NR_connect (__NR_SYSCALL_BASE + 283)
#define __NR_listen (__NR_SYSCALL_BASE + 284)
#define __NR_accept (__NR_SYSCALL_BASE + 285)
#define __NR_getsockname (__NR_SYSCALL_BASE + 286)
#define __NR_getpeername (__NR_SYSCALL_BASE + 287)
#define __NR_sendto (__NR_SYSCALL_BASE + 290)
#define __NR_recvfrom (__NR_SYSCALL_BASE + 292)
#define __NR_shutdown (__NR_SYSCALL_BASE + 293)
#define __NR_setsockopt (__NR_SYSCALL_BASE + 294)
#define __NR_getsockopt (__NR_SYSCALL_BASE + 295)
#define __NR_sendmsg (__NR_SYSCALL_BASE + 296)
#define __NR_recvmsg (__NR_SYSCALL_BASE + 297)
#define __NR_semctl (__NR_SYSCALL_BASE + 300)
#define __NR_semget (__NR_SYSCALL_BASE + 299)
#define __NR_semop (__NR_SYSCALL_BASE + 298)
#define __NR_shmat (__NR_SYSCALL_BASE + 305)
#define __NR_shmctl (__NR_SYSCALL_BASE + 308)
#define __NR_shmdt (__NR_SYSCALL_BASE + 306)
#define __NR_shmget (__NR_SYSCALL_BASE + 307)
#define __NR_msgctl (__NR_SYSCALL_BASE + 304)
#define __NR_msgget (__NR_SYSCALL_BASE + 303)
#define __NR_msgrcv (__NR_SYSCALL_BASE + 302)
#define __NR_msgsnd (__NR_SYSCALL_BASE + 301)
#define __NR_epoll_create (__NR_SYSCALL_BASE + 250)
#define __NR_epoll_ctl (__NR_SYSCALL_BASE + 251)
#define __NR_epoll_wait (__NR_SYSCALL_BASE + 252)
#define __NR_inotify_init (__NR_SYSCALL_BASE + 316)
#define __NR_inotify_add_watch (__NR_SYSCALL_BASE + 317)
#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE + 318)
#define __NR_ARM_set_tls (__NR_SYSCALL_BASE + 983045)
#define __NR_ARM_cacheflush (__NR_SYSCALL_BASE + 983042)
#endif
#ifdef __i386__
#define __NR_exit_group (__NR_SYSCALL_BASE + 252)
#define __NR_waitpid (__NR_SYSCALL_BASE + 7)
#define __NR_waitid (__NR_SYSCALL_BASE + 284)
#define __NR_kill (__NR_SYSCALL_BASE + 37)
#define __NR_tkill (__NR_SYSCALL_BASE + 238)
#define __NR_set_thread_area (__NR_SYSCALL_BASE + 243)
#define __NR_openat (__NR_SYSCALL_BASE + 295)
#define __NR_madvise (__NR_SYSCALL_BASE + 219)
#define __NR_mincore (__NR_SYSCALL_BASE + 218)
#define __NR_getdents64 (__NR_SYSCALL_BASE + 220)
#define __NR_fstatfs64 (__NR_SYSCALL_BASE + 269)
#define __NR_fstatat64 (__NR_SYSCALL_BASE + 300)
#define __NR_mkdirat (__NR_SYSCALL_BASE + 296)
#define __NR_fchownat (__NR_SYSCALL_BASE + 298)
#define __NR_fchmodat (__NR_SYSCALL_BASE + 306)
#define __NR_renameat (__NR_SYSCALL_BASE + 302)
#define __NR_unlinkat (__NR_SYSCALL_BASE + 301)
#define __NR_statfs64 (__NR_SYSCALL_BASE + 268)
#define __NR_clock_gettime (__NR_SYSCALL_BASE + 265)
#define __NR_clock_settime (__NR_SYSCALL_BASE + 264)
#define __NR_clock_getres (__NR_SYSCALL_BASE + 266)
#define __NR_clock_nanosleep (__NR_SYSCALL_BASE + 267)
#define __NR_timer_create (__NR_SYSCALL_BASE + 259)
#define __NR_timer_settime (__NR_SYSCALL_BASE + 260)
#define __NR_timer_gettime (__NR_SYSCALL_BASE + 261)
#define __NR_timer_getoverrun (__NR_SYSCALL_BASE + 262)
#define __NR_timer_delete (__NR_SYSCALL_BASE + 263)
#define __NR_utimes (__NR_SYSCALL_BASE + 271)
#define __NR_epoll_create (__NR_SYSCALL_BASE + 254)
#define __NR_epoll_ctl (__NR_SYSCALL_BASE + 255)
#define __NR_epoll_wait (__NR_SYSCALL_BASE + 256)
#define __NR_inotify_init (__NR_SYSCALL_BASE + 291)
#define __NR_inotify_add_watch (__NR_SYSCALL_BASE + 292)
#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE + 293)
#endif
#endif
#endif /* _BIONIC_LINUX_SYSCALLS_H_ */

View File

@@ -0,0 +1,197 @@
/* auto-generated by gensyscalls.py, do not touch */
#ifndef _BIONIC_LINUX_UNISTD_H_
#ifdef __cplusplus
extern "C" {
#endif
void _exit (int);
void _exit_thread (int);
int fork (void);
pid_t _waitpid (pid_t, int*, int, struct rusage*);
int waitid (int, pid_t, struct siginfo_t*, int,void*);
pid_t __clone (int (*fn)(void*), void *child_stack, int flags, void *arg);
int execve (const char*, char* const*, char* const*);
int setuid (uid_t);
uid_t getuid (void);
gid_t getgid (void);
uid_t geteuid (void);
gid_t getegid (void);
uid_t getresuid (void);
gid_t getresgid (void);
pid_t gettid (void);
int getgroups (int, gid_t *);
pid_t getpgid (pid_t);
pid_t getppid (void);
pid_t setsid (void);
int setgid (gid_t);
int seteuid (uid_t);
int setreuid (uid_t, uid_t);
int setresuid (uid_t, uid_t, uid_t);
int setresgid (gid_t, gid_t, gid_t);
void* __brk (void*);
int kill (pid_t, int);
int tkill (pid_t tid, int sig);
int __ptrace (int request, int pid, void* addr, void* data);
int __set_thread_area (void* user_desc);
int __getpriority (int, int);
int setpriority (int, int, int);
int setrlimit (int resource, const struct rlimit *rlp);
int getrlimit (int resource, struct rlimit *rlp);
int getrusage (int who, struct rusage* r_usage);
int setgroups (int, const gid_t *);
pid_t getpgrp (void);
int setpgid (pid_t, pid_t);
pid_t vfork (void);
int setregid (gid_t, gid_t);
int chroot (const char *);
int prctl (int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5);
int capget (cap_user_header_t header, cap_user_data_t data);
int capset (cap_user_header_t header, const cap_user_data_t data);
int acct (const char* filepath);
ssize_t read (int, void*, size_t);
ssize_t write (int, const void*, size_t);
int __open (const char*, int, mode_t);
int __openat (int, const char*, int, mode_t);
int close (int);
int creat (const char*, mode_t);
off_t lseek (int, off_t, int);
int __llseek (int, unsigned long, unsigned long, loff_t*, int);
pid_t getpid (void);
void * mmap (void *, size_t, int, int, int, long);
void * __mmap2 (void*, size_t, int, int, int, long);
int munmap (void *, size_t);
void * mremap (void *, size_t, size_t, unsigned long);
int msync (const void *, size_t, int);
int mprotect (const void *, size_t, int);
int madvise (const void *, size_t, int);
int mlock (const void *addr, size_t len);
int munlock (const void *addr, size_t len);
int mincore (void* start, size_t length, unsigned char* vec);
int __ioctl (int, int, void *);
int readv (int, const struct iovec *, int);
int writev (int, const struct iovec *, int);
int __fcntl (int, int, void*);
int flock (int, int);
int fchmod (int, mode_t);
int dup (int);
int pipe (int *);
int dup2 (int, int);
int select (int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *);
int ftruncate (int, off_t);
int getdents (unsigned int, struct dirent *, unsigned int);
int fsync (int);
int fchown (int, uid_t, gid_t);
void sync (void);
int __fcntl64 (int, int, void *);
int fstatfs (int, size_t, struct statfs *);
ssize_t sendfile (int out_fd, int in_fd, off_t *offset, size_t count);
int fstatat (int dirfd, const char *path, struct stat *buf, int flags);
int mkdirat (int dirfd, const char *pathname, mode_t mode);
int fchownat (int dirfd, const char *path, uid_t owner, gid_t group, int flags);
int fchmodat (int dirfd, const char *path, mode_t mode, int flags);
int renameat (int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
int link (const char*, const char*);
int unlink (const char*);
int unlinkat (int, const char *, int);
int chdir (const char*);
int mknod (const char*, mode_t, dev_t);
int chmod (const char*,mode_t);
int chown (const char *, uid_t, gid_t);
int lchown (const char*, uid_t, gid_t);
int mount (const char*, const char*, const char*, unsigned long, const void*);
int umount (const char*);
int umount2 (const char*, int);
int fstat (int, struct stat*);
int stat (const char *, struct stat *);
int lstat (const char *, struct stat *);
int mkdir (const char *, mode_t);
int readlink (const char *, char *, size_t);
int rmdir (const char *);
int rename (const char *, const char *);
int __getcwd (char * buf, size_t size);
int access (const char *, int);
int symlink (const char *, const char *);
int fchdir (int);
int truncate (const char*, off_t);
int __statfs64 (const char *, size_t, struct statfs *);
int pause (void);
int gettimeofday (struct timeval*, struct timezone*);
int settimeofday (const struct timeval*, const struct timezone*);
clock_t times (struct tms *);
int nanosleep (const struct timespec *, struct timespec *);
int clock_gettime (clockid_t clk_id, struct timespec *tp);
int clock_settime (clockid_t clk_id, const struct timespec *tp);
int clock_getres (clockid_t clk_id, struct timespec *res);
int clock_nanosleep (const struct timespec *req, struct timespec *rem);
int setitimer (int, const struct itimerval *, struct itimerval *);
int timer_create (clockid_t clockid, struct sigevent *evp, timer_t *timerid);
int timer_settime (timer_t, int, const struct itimerspec*, struct itimerspec*);
int timer_gettime (timer_t, struct itimerspec*);
int timer_getoverrun (timer_t);
int timer_delete (timer_t);
int utimes (const char*, const struct timeval tvp[2]);
int sigaction (int, const struct sigaction *, struct sigaction *);
int sigprocmask (int, const sigset_t *, sigset_t *);
int __sigsuspend (int unused1, int unused2, unsigned mask);
int __rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize);
int __rt_sigprocmask (int how, const sigset_t *set, sigset_t *oset, size_t sigsetsize);
int __rt_sigtimedwait (const sigset_t *set, struct siginfo_t *info, struct timespec_t *timeout, size_t sigset_size);
int sigpending (sigset_t *);
int socket (int, int, int);
int socketpair (int, int, int, int*);
int bind (int, struct sockaddr *, int);
int connect (int, struct sockaddr *, socklen_t);
int listen (int, int);
int accept (int, struct sockaddr *, socklen_t *);
int getsockname (int, struct sockaddr *, socklen_t *);
int getpeername (int, struct sockaddr *, socklen_t *);
int sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
int recvfrom (int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *);
int shutdown (int, int);
int setsockopt (int, int, int, const void *, socklen_t);
int getsockopt (int, int, int, void *, socklen_t *);
int sendmsg (int, const struct msghdr *, unsigned int);
int recvmsg (int, struct msghdr *, unsigned int);
int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param);
int sched_getscheduler (pid_t pid);
int sched_yield (void);
int sched_setparam (pid_t pid, const struct sched_param *param);
int sched_getparam (pid_t pid, struct sched_param *param);
int sched_get_priority_max (int policy);
int sched_get_priority_min (int policy);
int sched_rr_get_interval (pid_t pid, struct timespec *interval);
int semctl (int semid, int semnum, int cmd, ...);
int semget (key_t key, int nsems, int semflg);
int semop (int semid, struct sembuf* sops, size_t nsops);
void* shmat (int shmid, const void* shmaddr, int shmflg);
int shmctl (int shmid, int cmd, struct shmid_ds* buf);
int shmdt (const void* shmaddr);
int shmget (key_t key, size_t size, int shmflg);
int msgctl (int msqid, int cmd, struct msqid_ds *buf);
int msgget (key_t key, int msgflg);
int msgrcv (int msqid, void* msgp, size_t msgsz, long int msgtyp, int msgflg);
int msgsnd (int msqid, const void* msgp, size_t msgsz, int msgflg);
int uname (struct utsname *);
pid_t __wait4 (pid_t pid, int *status, int options, struct rusage *rusage);
mode_t umask (mode_t);
int __reboot (int, int, int, void *);
int __syslog (int, char *, int);
int init_module (void *, unsigned long, const char *);
int delete_module (const char*, unsigned int);
int klogctl (int, char *, int);
int futex (void *, int, int, void *, void *, int);
int epoll_create (int size);
int epoll_ctl (int epfd, int op, int fd, struct epoll_event *event);
int epoll_wait (int epfd, struct epoll_event *events, int max, int timeout);
int inotify_init (void);
int inotify_add_watch (int, const char *, unsigned int);
int inotify_rm_watch (int, unsigned int);
int poll (struct pollfd *, unsigned int, long);
int __set_tls (void*);
int cacheflush (long start, long end, long flags);
#ifdef __cplusplus
}
#endif
#endif /* _BIONIC_LINUX_UNISTD_H_ */

66
libc/include/sys/mman.h Normal file
View File

@@ -0,0 +1,66 @@
/*
* 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 _SYS_MMAN_H_
#define _SYS_MMAN_H_
#include <sys/cdefs.h>
#include <sys/types.h>
#include <asm/mman.h>
#include <asm/page.h>
__BEGIN_DECLS
#ifndef MAP_ANON
#define MAP_ANON MAP_ANONYMOUS
#endif
#define MAP_FAILED ((void *)-1)
#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2
extern void* mmap(void *, size_t, int, int, int, off_t);
extern int munmap(void *, size_t);
extern int msync(const void *, size_t, int);
extern int mprotect(const void *, size_t, int);
extern void* mremap(void *, size_t, size_t, unsigned long);
extern int mlockall(int);
extern int munlockall(void);
extern int mlock(const void *, size_t);
extern int munlock(const void *, size_t);
extern int madvise(const void *, size_t, int);
extern int mlock(const void *addr, size_t len);
extern int munlock(const void *addr, size_t len);
extern int mincore(void* start, size_t length, unsigned char* vec);
__END_DECLS
#endif /* _SYS_MMAN_H_ */

99
libc/include/sys/mount.h Normal file
View File

@@ -0,0 +1,99 @@
/*
* 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 _SYS_MOUNT_H
#define _SYS_MOUNT_H
#include <sys/cdefs.h>
#include <sys/ioctl.h>
__BEGIN_DECLS
/*
* These are the fs-independent mount-flags: up to 32 flags are supported
*/
#define MS_RDONLY 1 /* Mount read-only */
#define MS_NOSUID 2 /* Ignore suid and sgid bits */
#define MS_NODEV 4 /* Disallow access to device special files */
#define MS_NOEXEC 8 /* Disallow program execution */
#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
#define MS_DIRSYNC 128 /* Directory modifications are synchronous */
#define MS_NOATIME 1024 /* Do not update access times. */
#define MS_NODIRATIME 2048 /* Do not update directory access times */
#define MS_BIND 4096
#define MS_MOVE 8192
#define MS_REC 16384
#define MS_VERBOSE 32768
#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
#define MS_ONE_SECOND (1<<17) /* fs has 1 sec a/m/ctime resolution */
#define MS_ACTIVE (1<<30)
#define MS_NOUSER (1<<31)
/*
* Superblock flags that can be altered by MS_REMOUNT
*/
#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|MS_NODIRATIME)
/*
* Old magic mount flag and mask
*/
#define MS_MGC_VAL 0xC0ED0000
#define MS_MGC_MSK 0xffff0000
/*
* umount2() flags
*/
#define MNT_FORCE 1 /* Forcibly unmount */
#define MNT_DETACH 2 /* Detach from tree only */
#define MNT_EXPIRE 4 /* Mark for expiry */
/*
* Block device ioctls
*/
#define BLKROSET _IO(0x12, 93) /* Set device read-only (0 = read-write). */
#define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */
#define BLKRRPART _IO(0x12, 95) /* Re-read partition table. */
#define BLKGETSIZE _IO(0x12, 96) /* Return device size. */
#define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */
#define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */
#define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */
/*
* Prototypes
*/
extern int mount(const char *, const char *,
const char *, unsigned long,
const void *);
extern int umount(const char *);
extern int umount2(const char *, int);
extern int pivot_root(const char *, const char *);
__END_DECLS
#endif /* _SYS_MOUNT_H */

43
libc/include/sys/msg.h Normal file
View File

@@ -0,0 +1,43 @@
/*
* 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 _SYS_MSG_H
#define _SYS_MSG_H
#include <sys/ipc.h>
#include <linux/msg.h>
__BEGIN_DECLS
extern int msgctl(int msqid, int cmd, struct msqid_ds *buf);
extern int msgget(key_t key, int msgflg);
extern int msgrcv(int msqid, void* msgp, size_t msgsz, long int msgtyp, int msgflg);
extern int msgsnd(int msqid, const void* msgp, size_t msgsz, int msgflg);
__END_DECLS
#endif /* _SYS_MSG_H */

40
libc/include/sys/param.h Normal file
View File

@@ -0,0 +1,40 @@
/*
* 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 _SYS_PARAM_H_
#define _SYS_PARAM_H_
#include <limits.h>
#include <linux/param.h>
#define MAXPATHLEN PATH_MAX
#define MAXSYMLINKS 8
#define ALIGNBYTES 3
#define ALIGN(p) (((unsigned int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
#endif /* _SYS_PARAM_H_ */

1
libc/include/sys/poll.h Normal file
View File

@@ -0,0 +1 @@
#include <poll.h>

41
libc/include/sys/prctl.h Normal file
View File

@@ -0,0 +1,41 @@
/*
* 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 _SYS_PRCTL_H
#define _SYS_PRCTL_H
#include <linux/prctl.h>
__BEGIN_DECLS
extern int prctl(int option, unsigned long arg2, unsigned long arg3 , unsigned
long arg4, unsigned long arg5);
__END_DECLS
#endif /* _SYS_PRCTL_H */

45
libc/include/sys/ptrace.h Normal file
View File

@@ -0,0 +1,45 @@
/*
* 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 _SYS_PTRACE_H_
#define _SYS_PTRACE_H_
#include <sys/cdefs.h>
#include <sys/types.h>
// For all of the defines
#include <linux/ptrace.h>
__BEGIN_DECLS
#define PTRACE_POKEUSER PTRACE_POKEUSR
#define PTRACE_PEEKUSER PTRACE_PEEKUSR
extern long ptrace(int request, pid_t pid, void *addr, void *data);
__END_DECLS
#endif /* _SYS_PTRACE_H_ */

Some files were not shown because too many files have changed in this diff Show More