* commit 'def2d26a5dcb0436fe133c7dbd9008b01982083d': Sync with upstream findfp.c.
This commit is contained in:
		@@ -778,7 +778,10 @@ endif
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
LOCAL_CFLAGS := \
 | 
					LOCAL_CFLAGS := \
 | 
				
			||||||
    $(libc_common_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)/private \
 | 
				
			||||||
    -I$(LOCAL_PATH)/upstream-openbsd/android/include \
 | 
					    -I$(LOCAL_PATH)/upstream-openbsd/android/include \
 | 
				
			||||||
    -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
 | 
					    -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,6 +43,8 @@ struct __sfileext {
 | 
				
			|||||||
	pthread_mutex_t _lock; /* file lock */
 | 
						pthread_mutex_t _lock; /* file lock */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__LIBC_HIDDEN__ extern struct __sfileext __sFext[3];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define _FILEEXT_INITIALIZER  {{NULL,0},{0},PTHREAD_RECURSIVE_MUTEX_INITIALIZER}
 | 
					#define _FILEEXT_INITIALIZER  {{NULL,0},{0},PTHREAD_RECURSIVE_MUTEX_INITIALIZER}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define _EXT(fp) ((struct __sfileext *)((fp)->_ext._base))
 | 
					#define _EXT(fp) ((struct __sfileext *)((fp)->_ext._base))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,6 +52,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define explicit_bzero(p, s) memset(p, 0, s)
 | 
					#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. */
 | 
					/* We have OpenBSD's getentropy_linux.c, but we don't mention getentropy in any header. */
 | 
				
			||||||
__LIBC_HIDDEN__ extern int getentropy(void*, size_t);
 | 
					__LIBC_HIDDEN__ extern int getentropy(void*, size_t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,19 +39,16 @@
 | 
				
			|||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include "local.h"
 | 
					#include "local.h"
 | 
				
			||||||
#include "glue.h"
 | 
					#include "glue.h"
 | 
				
			||||||
#include "private/thread_private.h"
 | 
					#include "thread_private.h"
 | 
				
			||||||
 | 
					 | 
				
			||||||
#define ALIGNBYTES (sizeof(uintptr_t) - 1)
 | 
					 | 
				
			||||||
#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
int	__sdidinit;
 | 
					int	__sdidinit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define	NDYNAMIC 10		/* add ten more whenever necessary */
 | 
					#define	NDYNAMIC 10		/* add ten more whenever necessary */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define	std(flags, file) \
 | 
					#define	std(flags, file) \
 | 
				
			||||||
	{0,0,0,flags,file,{0,0},0,__sF+file,__sclose,__sread,__sseek,__swrite, \
 | 
						{0,0,0,flags,file,{0},0,__sF+file,__sclose,__sread,__sseek,__swrite, \
 | 
				
			||||||
	 {(unsigned char *)(__sFext+file), 0},NULL,0,{0,0,0},{0},{0,0},0,0}
 | 
						 {(unsigned char *)(__sFext+file), 0}}
 | 
				
			||||||
/*	 p r w flags file _bf z  cookie      close    read    seek    write
 | 
					/*	 p r w flags file _bf z  cookie      close    read    seek    write 
 | 
				
			||||||
	 ext */
 | 
						 ext */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				/* the usual - (stdin + stdout + stderr) */
 | 
									/* the usual - (stdin + stdout + stderr) */
 | 
				
			||||||
@@ -61,7 +58,7 @@ static struct glue uglue = { 0, FOPEN_MAX - 3, usual };
 | 
				
			|||||||
static struct glue *lastglue = &uglue;
 | 
					static struct glue *lastglue = &uglue;
 | 
				
			||||||
_THREAD_PRIVATE_MUTEX(__sfp_mutex);
 | 
					_THREAD_PRIVATE_MUTEX(__sfp_mutex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct __sfileext __sFext[3];
 | 
					struct __sfileext __sFext[3];
 | 
				
			||||||
FILE __sF[3] = {
 | 
					FILE __sF[3] = {
 | 
				
			||||||
	std(__SRD, STDIN_FILENO),		/* stdin */
 | 
						std(__SRD, STDIN_FILENO),		/* stdin */
 | 
				
			||||||
	std(__SWR, STDOUT_FILENO),		/* stdout */
 | 
						std(__SWR, STDOUT_FILENO),		/* stdout */
 | 
				
			||||||
@@ -176,6 +173,6 @@ __sinit(void)
 | 
				
			|||||||
	/* make sure we clean up on exit */
 | 
						/* make sure we clean up on exit */
 | 
				
			||||||
	__atexit_register_cleanup(_cleanup); /* conservative */
 | 
						__atexit_register_cleanup(_cleanup); /* conservative */
 | 
				
			||||||
	__sdidinit = 1;
 | 
						__sdidinit = 1;
 | 
				
			||||||
out:
 | 
					out: 
 | 
				
			||||||
	_THREAD_PRIVATE_MUTEX_UNLOCK(__sinit_mutex);
 | 
						_THREAD_PRIVATE_MUTEX_UNLOCK(__sinit_mutex);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user