am f05410ed: Merge "Sync with upstream findfp.c."

* commit 'f05410edc634040f96643b8f378320faddfef423':
  Sync with upstream findfp.c.
This commit is contained in:
Elliott Hughes 2014-09-24 18:09:37 +00:00 committed by Android Git Automerger
commit 7a2a1a8b6c
4 changed files with 16 additions and 10 deletions

View File

@ -778,7 +778,10 @@ endif
LOCAL_CFLAGS := \
$(libc_common_cflags) \
-Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \
-Wno-missing-field-initializers \
-Wno-sign-compare \
-Wno-uninitialized \
-Wno-unused-parameter \
-I$(LOCAL_PATH)/private \
-I$(LOCAL_PATH)/upstream-openbsd/android/include \
-I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \

View File

@ -43,6 +43,8 @@ struct __sfileext {
pthread_mutex_t _lock; /* file lock */
};
__LIBC_HIDDEN__ extern struct __sfileext __sFext[3];
#define _FILEEXT_INITIALIZER {{NULL,0},{0},PTHREAD_RECURSIVE_MUTEX_INITIALIZER}
#define _EXT(fp) ((struct __sfileext *)((fp)->_ext._base))

View File

@ -52,6 +52,10 @@
#define explicit_bzero(p, s) memset(p, 0, s)
/* OpenBSD has these in <sys/param.h>, but "ALIGN" isn't something we want to reserve. */
#define ALIGNBYTES (sizeof(uintptr_t) - 1)
#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
/* We have OpenBSD's getentropy_linux.c, but we don't mention getentropy in any header. */
__LIBC_HIDDEN__ extern int getentropy(void*, size_t);

View File

@ -39,18 +39,15 @@
#include <string.h>
#include "local.h"
#include "glue.h"
#include "private/thread_private.h"
#define ALIGNBYTES (sizeof(uintptr_t) - 1)
#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
#include "thread_private.h"
int __sdidinit;
#define NDYNAMIC 10 /* add ten more whenever necessary */
#define std(flags, file) \
{0,0,0,flags,file,{0,0},0,__sF+file,__sclose,__sread,__sseek,__swrite, \
{(unsigned char *)(__sFext+file), 0},NULL,0,{0,0,0},{0},{0,0},0,0}
{0,0,0,flags,file,{0},0,__sF+file,__sclose,__sread,__sseek,__swrite, \
{(unsigned char *)(__sFext+file), 0}}
/* p r w flags file _bf z cookie close read seek write
ext */
@ -61,7 +58,7 @@ static struct glue uglue = { 0, FOPEN_MAX - 3, usual };
static struct glue *lastglue = &uglue;
_THREAD_PRIVATE_MUTEX(__sfp_mutex);
static struct __sfileext __sFext[3];
struct __sfileext __sFext[3];
FILE __sF[3] = {
std(__SRD, STDIN_FILENO), /* stdin */
std(__SWR, STDOUT_FILENO), /* stdout */