diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:50:54 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:50:54 -0800 |
commit | 6d6c82c7a0a6b9a89f61b61c66f9b90d9c7177dc (patch) | |
tree | 8de86895228b63728c3a134c8b1fcab003db467d | |
parent | 4e468ed2eb86a2406e14f1eca82072ee501d05fd (diff) | |
download | bionic-6d6c82c7a0a6b9a89f61b61c66f9b90d9c7177dc.zip bionic-6d6c82c7a0a6b9a89f61b61c66f9b90d9c7177dc.tar.gz bionic-6d6c82c7a0a6b9a89f61b61c66f9b90d9c7177dc.tar.bz2 |
auto import from //branches/cupcake/...@125939
-rw-r--r-- | libc/Android.mk | 4 | ||||
-rw-r--r-- | libc/arch-arm/bionic/ffs.S | 82 | ||||
-rw-r--r-- | libc/include/locale.h | 4 | ||||
-rw-r--r-- | libc/include/netdb.h | 2 | ||||
-rw-r--r-- | libc/include/setjmp.h | 31 | ||||
-rw-r--r-- | libc/include/stdlib.h | 5 | ||||
-rw-r--r-- | libc/include/string.h | 4 | ||||
-rw-r--r-- | libc/include/sys/tls.h | 11 | ||||
-rw-r--r-- | libc/include/wchar.h | 5 | ||||
-rw-r--r-- | libc/kernel/arch-arm/asm/param.h | 1 | ||||
-rw-r--r-- | libc/kernel/arch-x86/asm/param.h | 1 | ||||
-rw-r--r-- | libc/kernel/common/linux/dm-ioctl.h | 146 | ||||
-rw-r--r-- | libc/kernel/common/linux/keychord.h | 30 | ||||
-rw-r--r-- | libc/kernel/common/linux/msm_audio.h | 81 | ||||
-rwxr-xr-x | libc/kernel/tools/clean_header.py | 1 | ||||
-rw-r--r-- | libc/kernel/tools/cpp.py | 21 | ||||
-rw-r--r-- | libc/kernel/tools/defaults.py | 11 | ||||
-rw-r--r-- | libc/private/arpa_nameser.h (renamed from libc/arpa_nameser.h) | 0 | ||||
-rw-r--r-- | libc/private/arpa_nameser_compat.h (renamed from libc/arpa_nameser_compat.h) | 0 | ||||
-rw-r--r-- | libc/private/ctype_private.h (renamed from libc/ctype_private.h) | 0 | ||||
-rw-r--r-- | libc/private/isc/assertions.h (renamed from libc/include/isc/assertions.h) | 0 | ||||
-rw-r--r-- | libc/private/isc/dst.h (renamed from libc/include/isc/dst.h) | 0 | ||||
-rw-r--r-- | libc/private/isc/eventlib.h (renamed from libc/include/isc/eventlib.h) | 0 | ||||
-rw-r--r-- | libc/private/isc/heap.h (renamed from libc/include/isc/heap.h) | 0 | ||||
-rw-r--r-- | libc/private/isc/list.h (renamed from libc/include/isc/list.h) | 0 | ||||
-rw-r--r-- | libc/private/isc/memcluster.h (renamed from libc/include/isc/memcluster.h) | 0 | ||||
-rw-r--r-- | libc/private/nsswitch.h (renamed from libc/nsswitch.h) | 0 | ||||
-rw-r--r-- | libc/private/rand48.h (renamed from libc/rand48.h) | 0 | ||||
-rw-r--r-- | libc/private/resolv_cache.h (renamed from libc/resolv_cache.h) | 0 | ||||
-rw-r--r-- | libc/private/resolv_private.h (renamed from libc/resolv_private.h) | 0 | ||||
-rw-r--r-- | libc/private/resolv_static.h (renamed from libc/resolv_static.h) | 0 | ||||
-rw-r--r-- | libc/private/syscommon.h (renamed from libc/syscommon.h) | 0 | ||||
-rw-r--r-- | libc/private/thread_private.h (renamed from libc/thread_private.h) | 0 |
33 files changed, 414 insertions, 26 deletions
diff --git a/libc/Android.mk b/libc/Android.mk index 57919ad..f950c7e 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -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 diff --git a/libc/arch-arm/bionic/ffs.S b/libc/arch-arm/bionic/ffs.S new file mode 100644 index 0000000..f11141c --- /dev/null +++ b/libc/arch-arm/bionic/ffs.S @@ -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 + diff --git a/libc/include/locale.h b/libc/include/locale.h index 2a11b04..65b5c7d 100644 --- a/libc/include/locale.h +++ b/libc/include/locale.h @@ -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_ */ diff --git a/libc/include/netdb.h b/libc/include/netdb.h index e824a3a..b0c3b72 100644 --- a/libc/include/netdb.h +++ b/libc/include/netdb.h @@ -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); diff --git a/libc/include/setjmp.h b/libc/include/setjmp.h index c3a197e..68fdcef 100644 --- a/libc/include/setjmp.h +++ b/libc/include/setjmp.h @@ -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 +int _setjmp(jmp_buf); +void _longjmp(jmp_buf, int); +void longjmperror(void); + +int setjmp(jmp_buf); +void longjmp(jmp_buf, int); -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE -int sigsetjmp(sigjmp_buf, int); -void siglongjmp(sigjmp_buf, int); -#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */ +int sigsetjmp(sigjmp_buf, int); +void siglongjmp(sigjmp_buf, int); -#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_ */ diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h index 15925e3..a821e03 100644 --- a/libc/include/stdlib.h +++ b/libc/include/stdlib.h @@ -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_ */ diff --git a/libc/include/string.h b/libc/include/string.h index b46100a..435923b 100644 --- a/libc/include/string.h +++ b/libc/include/string.h @@ -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_ */ diff --git a/libc/include/sys/tls.h b/libc/include/sys/tls.h index d59f1c3..da34344 100644 --- a/libc/include/sys/tls.h +++ b/libc/include/sys/tls.h @@ -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 diff --git a/libc/include/wchar.h b/libc/include/wchar.h index d2d022a..3dadc98 100644 --- a/libc/include/wchar.h +++ b/libc/include/wchar.h @@ -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_ */ diff --git a/libc/kernel/arch-arm/asm/param.h b/libc/kernel/arch-arm/asm/param.h index 23d45c7..6814fe3 100644 --- a/libc/kernel/arch-arm/asm/param.h +++ b/libc/kernel/arch-arm/asm/param.h @@ -20,7 +20,6 @@ #define NOGROUP (-1) #endif -#define MAXHOSTNAMELEN 64 #endif diff --git a/libc/kernel/arch-x86/asm/param.h b/libc/kernel/arch-x86/asm/param.h index 0825173..3fafd55 100644 --- a/libc/kernel/arch-x86/asm/param.h +++ b/libc/kernel/arch-x86/asm/param.h @@ -22,6 +22,5 @@ #define NOGROUP (-1) #endif -#define MAXHOSTNAMELEN 64 #endif diff --git a/libc/kernel/common/linux/dm-ioctl.h b/libc/kernel/common/linux/dm-ioctl.h new file mode 100644 index 0000000..ead7744 --- /dev/null +++ b/libc/kernel/common/linux/dm-ioctl.h @@ -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 diff --git a/libc/kernel/common/linux/keychord.h b/libc/kernel/common/linux/keychord.h new file mode 100644 index 0000000..9148431 --- /dev/null +++ b/libc/kernel/common/linux/keychord.h @@ -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 diff --git a/libc/kernel/common/linux/msm_audio.h b/libc/kernel/common/linux/msm_audio.h new file mode 100644 index 0000000..58dc6f3 --- /dev/null +++ b/libc/kernel/common/linux/msm_audio.h @@ -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 + diff --git a/libc/kernel/tools/clean_header.py b/libc/kernel/tools/clean_header.py index bed9926..de4bf85 100755 --- a/libc/kernel/tools/clean_header.py +++ b/libc/kernel/tools/clean_header.py @@ -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() diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py index 54ebaf4..4b4bd38 100644 --- a/libc/kernel/tools/cpp.py +++ b/libc/kernel/tools/cpp.py @@ -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 diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py index da78b87..aad0092 100644 --- a/libc/kernel/tools/defaults.py +++ b/libc/kernel/tools/defaults.py @@ -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 = """\ diff --git a/libc/arpa_nameser.h b/libc/private/arpa_nameser.h index 2d2a739..2d2a739 100644 --- a/libc/arpa_nameser.h +++ b/libc/private/arpa_nameser.h diff --git a/libc/arpa_nameser_compat.h b/libc/private/arpa_nameser_compat.h index 79bdfd0..79bdfd0 100644 --- a/libc/arpa_nameser_compat.h +++ b/libc/private/arpa_nameser_compat.h diff --git a/libc/ctype_private.h b/libc/private/ctype_private.h index 39cc792..39cc792 100644 --- a/libc/ctype_private.h +++ b/libc/private/ctype_private.h diff --git a/libc/include/isc/assertions.h b/libc/private/isc/assertions.h index 921d18f..921d18f 100644 --- a/libc/include/isc/assertions.h +++ b/libc/private/isc/assertions.h diff --git a/libc/include/isc/dst.h b/libc/private/isc/dst.h index afb0710..afb0710 100644 --- a/libc/include/isc/dst.h +++ b/libc/private/isc/dst.h diff --git a/libc/include/isc/eventlib.h b/libc/private/isc/eventlib.h index 9185f67..9185f67 100644 --- a/libc/include/isc/eventlib.h +++ b/libc/private/isc/eventlib.h diff --git a/libc/include/isc/heap.h b/libc/private/isc/heap.h index ea5a6e9..ea5a6e9 100644 --- a/libc/include/isc/heap.h +++ b/libc/private/isc/heap.h diff --git a/libc/include/isc/list.h b/libc/private/isc/list.h index 489766a..489766a 100644 --- a/libc/include/isc/list.h +++ b/libc/private/isc/list.h diff --git a/libc/include/isc/memcluster.h b/libc/private/isc/memcluster.h index edaaf20..edaaf20 100644 --- a/libc/include/isc/memcluster.h +++ b/libc/private/isc/memcluster.h diff --git a/libc/nsswitch.h b/libc/private/nsswitch.h index e03844b..e03844b 100644 --- a/libc/nsswitch.h +++ b/libc/private/nsswitch.h diff --git a/libc/rand48.h b/libc/private/rand48.h index afa49f6..afa49f6 100644 --- a/libc/rand48.h +++ b/libc/private/rand48.h diff --git a/libc/resolv_cache.h b/libc/private/resolv_cache.h index 8c25583..8c25583 100644 --- a/libc/resolv_cache.h +++ b/libc/private/resolv_cache.h diff --git a/libc/resolv_private.h b/libc/private/resolv_private.h index 0f3c6c0..0f3c6c0 100644 --- a/libc/resolv_private.h +++ b/libc/private/resolv_private.h diff --git a/libc/resolv_static.h b/libc/private/resolv_static.h index 8f2a095..8f2a095 100644 --- a/libc/resolv_static.h +++ b/libc/private/resolv_static.h diff --git a/libc/syscommon.h b/libc/private/syscommon.h index 4290252..4290252 100644 --- a/libc/syscommon.h +++ b/libc/private/syscommon.h diff --git a/libc/thread_private.h b/libc/private/thread_private.h index c03f0ab..c03f0ab 100644 --- a/libc/thread_private.h +++ b/libc/private/thread_private.h |