auto import from //branches/cupcake/...@125939

This commit is contained in:
The Android Open Source Project 2009-01-09 17:50:54 -08:00
parent 4e468ed2eb
commit 6d6c82c7a0
33 changed files with 414 additions and 26 deletions

View File

@ -277,6 +277,7 @@ libc_common_src_files += \
arch-arm/bionic/_setjmp.S \
arch-arm/bionic/atomics_arm.S \
arch-arm/bionic/clone.S \
arch-arm/bionic/ffs.S \
arch-arm/bionic/kill.S \
arch-arm/bionic/tkill.S \
arch-arm/bionic/memcmp.S \
@ -330,7 +331,8 @@ libc_common_cflags := \
-DSOFTFLOAT \
-DFLOATING_POINT \
-DNEED_PSELECT=1 \
-DINET6
-DINET6 \
-I$(LOCAL_PATH)/private \
ifeq ($(TARGET_BUILD_TYPE),debug)
libc_common_cflags += -DDEBUG

View File

@ -0,0 +1,82 @@
/* $NetBSD: ffs.S,v 1.5 2003/04/05 23:08:52 bjh21 Exp $ */
/*
* Copyright (c) 2001 Christopher Gilbert
* 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 company nor the name of the author may 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 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 <machine/asm.h>
/*
* ffs - find first set bit, this algorithm isolates the first set
* bit, then multiplies the number by 0x0450fbaf which leaves the top
* 6 bits as an index into the table. This algorithm should be a win
* over the checking each bit in turn as per the C compiled version.
*
* under ARMv5 there's an instruction called CLZ (count leading Zero's) that
* could be used
*
* This is the ffs algorithm devised by d.seal and posted to comp.sys.arm on
* 16 Feb 1994.
*/
ENTRY(ffs)
/* Standard trick to isolate bottom bit in r0 or 0 if r0 = 0 on entry */
rsb r1, r0, #0
ands r0, r0, r1
#ifndef __ARM_ARCH_5__
/*
* now r0 has at most one set bit, call this X
* if X = 0, all further instructions are skipped
*/
adrne r2, .L_ffs_table
orrne r0, r0, r0, lsl #4 /* r0 = X * 0x11 */
orrne r0, r0, r0, lsl #6 /* r0 = X * 0x451 */
rsbne r0, r0, r0, lsl #16 /* r0 = X * 0x0450fbaf */
/* now lookup in table indexed on top 6 bits of r0 */
ldrneb r0, [ r2, r0, lsr #26 ]
bx lr
.text;
.type .L_ffs_table, _ASM_TYPE_OBJECT;
.L_ffs_table:
/* 0 1 2 3 4 5 6 7 */
.byte 0, 1, 2, 13, 3, 7, 0, 14 /* 0- 7 */
.byte 4, 0, 8, 0, 0, 0, 0, 15 /* 8-15 */
.byte 11, 5, 0, 0, 9, 0, 0, 26 /* 16-23 */
.byte 0, 0, 0, 0, 0, 22, 28, 16 /* 24-31 */
.byte 32, 12, 6, 0, 0, 0, 0, 0 /* 32-39 */
.byte 10, 0, 0, 25, 0, 0, 21, 27 /* 40-47 */
.byte 31, 0, 0, 0, 0, 24, 0, 20 /* 48-55 */
.byte 30, 0, 23, 19, 29, 18, 17, 0 /* 56-63 */
#else
clzne r0, r0
rsbne r0, r0, #32
bx lr
#endif

View File

@ -51,6 +51,10 @@ enum {
extern char *setlocale(int category, const char *locale);
/* Make libstdc++-v3 happy. */
struct lconv { };
struct lconv *localeconv(void);
__END_DECLS
#endif /* _LOCALE_H_ */

View File

@ -73,6 +73,8 @@
#define _PATH_PROTOCOLS "/system/etc/protocols"
#define _PATH_SERVICES "/system/etc/services"
#define MAXHOSTNAMELEN 256
/* BIONIC-BEGIN */
#define h_errno (*__get_h_errno())
extern int* __get_h_errno(void);

View File

@ -43,36 +43,21 @@
#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 */
int setjmp(jmp_buf);
void longjmp(jmp_buf, int);
int sigsetjmp(sigjmp_buf, int);
void siglongjmp(sigjmp_buf, int);
__END_DECLS
#endif /* !_SETJMP_H_ */

View File

@ -160,6 +160,11 @@ extern int mblen(const char *, size_t);
extern size_t mbstowcs(wchar_t *, const char *, size_t);
extern int mbtowc(wchar_t *, const char *, size_t);
/* Likewise, make libstdc++-v3 happy. */
extern int wctomb(char *, wchar_t);
extern size_t wcstombs(char *, const wchar_t *, size_t);
#define MB_CUR_MAX 1
__END_DECLS
#endif /* _STDLIB_H_ */

View File

@ -82,6 +82,10 @@ extern size_t strspn(const char *, const char *);
extern char* strsignal(int sig);
/* Just declared to make libstdc++-v3 happy. */
extern int strcoll (const char *, const char *);
extern size_t strxfrm (char *, const char *, size_t);
__END_DECLS
#endif /* _STRING_H_ */

View File

@ -32,6 +32,17 @@
__BEGIN_DECLS
/** WARNING WARNING WARNING
**
** This header file is *NOT* part of the public Bionic ABI/API
** and should not be used/included by user-serviceable parts of
** the system (e.g. applications).
**
** It is only provided here for the benefit of the system dynamic
** linker and the OpenGL sub-system (which needs to access the
** pre-allocated slot directly for performance reason).
**/
/* maximum number of elements in the TLS array */
#define BIONIC_TLS_SLOTS 64

View File

@ -144,6 +144,11 @@ extern wchar_t *wmemset(wchar_t *, wchar_t, size_t);
extern int wprintf(const wchar_t *, ...);
extern int wscanf(const wchar_t *, ...);
/* No really supported. These are just for making libstdc++-v3 happy. */
typedef void *wctrans_t;
extern wint_t towctrans(wint_t, wctrans_t);
extern wctrans_t wctrans (const char *);
__END_DECLS
#endif /* _WCHAR_H_ */

View File

@ -20,7 +20,6 @@
#define NOGROUP (-1)
#endif
#define MAXHOSTNAMELEN 64
#endif

View File

@ -22,6 +22,5 @@
#define NOGROUP (-1)
#endif
#define MAXHOSTNAMELEN 64
#endif

View File

@ -0,0 +1,146 @@
/****************************************************************************
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
****************************************************************************
****************************************************************************/
#ifndef _LINUX_DM_IOCTL_V4_H
#define _LINUX_DM_IOCTL_V4_H
#include <linux/types.h>
#define DM_DIR "mapper"
#define DM_MAX_TYPE_NAME 16
#define DM_NAME_LEN 128
#define DM_UUID_LEN 129
struct dm_ioctl {
uint32_t version[3];
uint32_t data_size;
uint32_t data_start;
uint32_t target_count;
int32_t open_count;
uint32_t flags;
uint32_t event_nr;
uint32_t padding;
uint64_t dev;
char name[DM_NAME_LEN];
char uuid[DM_UUID_LEN];
char data[7];
};
struct dm_target_spec {
uint64_t sector_start;
uint64_t length;
int32_t status;
uint32_t next;
char target_type[DM_MAX_TYPE_NAME];
};
struct dm_target_deps {
uint32_t count;
uint32_t padding;
uint64_t dev[0];
};
struct dm_name_list {
uint64_t dev;
uint32_t next;
char name[0];
};
struct dm_target_versions {
uint32_t next;
uint32_t version[3];
char name[0];
};
struct dm_target_msg {
uint64_t sector;
char message[0];
};
enum {
DM_VERSION_CMD = 0,
DM_REMOVE_ALL_CMD,
DM_LIST_DEVICES_CMD,
DM_DEV_CREATE_CMD,
DM_DEV_REMOVE_CMD,
DM_DEV_RENAME_CMD,
DM_DEV_SUSPEND_CMD,
DM_DEV_STATUS_CMD,
DM_DEV_WAIT_CMD,
DM_TABLE_LOAD_CMD,
DM_TABLE_CLEAR_CMD,
DM_TABLE_DEPS_CMD,
DM_TABLE_STATUS_CMD,
DM_LIST_VERSIONS_CMD,
DM_TARGET_MSG_CMD,
DM_DEV_SET_GEOMETRY_CMD
};
#define DM_IOCTL 0xfd
#define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl)
#define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl)
#define DM_LIST_DEVICES _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, struct dm_ioctl)
#define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl)
#define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl)
#define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl)
#define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl)
#define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl)
#define DM_DEV_WAIT _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, struct dm_ioctl)
#define DM_TABLE_LOAD _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, struct dm_ioctl)
#define DM_TABLE_CLEAR _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, struct dm_ioctl)
#define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl)
#define DM_TABLE_STATUS _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl)
#define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl)
#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
#define DM_VERSION_MAJOR 4
#define DM_VERSION_MINOR 14
#define DM_VERSION_PATCHLEVEL 0
#define DM_VERSION_EXTRA "-ioctl (2008-04-23)"
#define DM_READONLY_FLAG (1 << 0)
#define DM_SUSPEND_FLAG (1 << 1)
#define DM_PERSISTENT_DEV_FLAG (1 << 3)
#define DM_STATUS_TABLE_FLAG (1 << 4)
#define DM_ACTIVE_PRESENT_FLAG (1 << 5)
#define DM_INACTIVE_PRESENT_FLAG (1 << 6)
#define DM_BUFFER_FULL_FLAG (1 << 8)
#define DM_SKIP_BDGET_FLAG (1 << 9)
#define DM_SKIP_LOCKFS_FLAG (1 << 10)
#define DM_NOFLUSH_FLAG (1 << 11)
#endif

View File

@ -0,0 +1,30 @@
/****************************************************************************
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
****************************************************************************
****************************************************************************/
#ifndef __LINUX_KEYCHORD_H_
#define __LINUX_KEYCHORD_H_
#include <linux/input.h>
#define KEYCHORD_VERSION 1
struct input_keychord {
__u16 version;
__u16 id;
__u16 count;
__u16 keycodes[];
};
#endif

View File

@ -0,0 +1,81 @@
/****************************************************************************
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
****************************************************************************
****************************************************************************/
#ifndef __LINUX_MSM_AUDIO_H
#define __LINUX_MSM_AUDIO_H
#include <linux/types.h>
#include <linux/ioctl.h>
#include <asm/sizes.h>
#define AUDIO_IOCTL_MAGIC 'a'
#define AUDIO_START _IOW(AUDIO_IOCTL_MAGIC, 0, unsigned)
#define AUDIO_STOP _IOW(AUDIO_IOCTL_MAGIC, 1, unsigned)
#define AUDIO_FLUSH _IOW(AUDIO_IOCTL_MAGIC, 2, unsigned)
#define AUDIO_GET_CONFIG _IOR(AUDIO_IOCTL_MAGIC, 3, unsigned)
#define AUDIO_SET_CONFIG _IOW(AUDIO_IOCTL_MAGIC, 4, unsigned)
#define AUDIO_GET_STATS _IOR(AUDIO_IOCTL_MAGIC, 5, unsigned)
#define AUDIO_ENABLE_AUDPP _IOW(AUDIO_IOCTL_MAGIC, 6, unsigned)
#define AUDIO_SET_ADRC _IOW(AUDIO_IOCTL_MAGIC, 7, unsigned)
#define AUDIO_SET_EQ _IOW(AUDIO_IOCTL_MAGIC, 8, unsigned)
#define AUDIO_SET_RX_IIR _IOW(AUDIO_IOCTL_MAGIC, 9, unsigned)
#define AUDIO_SET_VOLUME _IOW(AUDIO_IOCTL_MAGIC, 10, unsigned)
struct msm_audio_config {
uint32_t buffer_size;
uint32_t buffer_count;
uint32_t channel_count;
uint32_t sample_rate;
uint32_t type;
uint32_t unused[3];
};
struct msm_audio_stats {
uint32_t byte_count;
uint32_t sample_count;
uint32_t unused[2];
};
#define SND_IOCTL_MAGIC 's'
#define SND_MUTE_UNMUTED 0
#define SND_MUTE_MUTED 1
struct msm_snd_device_config {
uint32_t device;
uint32_t ear_mute;
uint32_t mic_mute;
};
#define SND_SET_DEVICE _IOW(SND_IOCTL_MAGIC, 2, struct msm_device_config *)
#define SND_METHOD_VOICE 0
struct msm_snd_volume_config {
uint32_t device;
uint32_t method;
uint32_t volume;
};
#define SND_SET_VOLUME _IOW(SND_IOCTL_MAGIC, 3, struct msm_snd_volume_config *)
#define SND_GET_NUM_ENDPOINTS _IOR(SND_IOCTL_MAGIC, 4, unsigned *)
struct msm_snd_endpoint {
int id;
char name[64];
};
#define SND_GET_ENDPOINT _IOWR(SND_IOCTL_MAGIC, 5, struct msm_snd_endpoint *)
#endif

View File

@ -69,6 +69,7 @@ def cleanupFile( path ):
list.removeVarsAndFuncs( statics )
list.removeComments()
list.removeEmptyLines()
list.removeMacroDefines( kernel_ignored_macros )
list.insertDisclaimer( kernel.kernel_disclaimer )
out = StringOutput()

View File

@ -1571,6 +1571,13 @@ class Block:
"""returns True iff this is a conditional directive block"""
return self.directive in ["if","ifdef","ifndef","else","elif","endif"]
def isDefine(self):
"""returns the macro name in a #define directive, or None otherwise"""
if self.directive != "define":
return None
return self.tokens[0].value
def isIf(self):
"""returns True iff this is an #if-like directive block"""
return self.directive in ["if","ifdef","ifndef","elif"]
@ -1678,6 +1685,10 @@ class BlockList:
if b.isIf():
b.expr.optimize(macros)
def removeMacroDefines(self,macros):
"""remove known macro definitions from a BlockList"""
self.blocks = remove_macro_defines(self.blocks,macros)
def removePrefixed(self,prefix,names):
for b in self.blocks:
if b.isIf():
@ -1994,6 +2005,16 @@ def test_BlockParser():
#####################################################################################
#####################################################################################
def remove_macro_defines( blocks, excludedMacros=set() ):
"""remove macro definitions like #define <macroName> ...."""
result = []
for b in blocks:
macroName = b.isDefine()
if macroName == None or not macroName in excludedMacros:
result.append(b)
return result
def find_matching_endif( blocks, i ):
n = len(blocks)
depth = 1

View File

@ -73,6 +73,17 @@ kernel_known_statics = {
"x86" : kernel_known_x86_statics
}
# this is a list of macros which we want to specifically exclude from
# the generated files.
#
kernel_ignored_macros = set(
[ "MAXHOSTNAMELEN", # for some reason, Linux defines it to 64
# while most of the BSD code expects this to be 256
# so ignore the kernel-provided definition and
# define it in the Bionic headers instead
]
)
# this is the standard disclaimer
#
kernel_disclaimer = """\