Sync with upstream findfp.c.

Change-Id: Ib298f46de0c4d0fd4ce0a9b456c163e8b8b06342
This commit is contained in:
Elliott Hughes
2014-09-24 10:27:09 -07:00
parent fc5a93f7a2
commit c08c25b4c9
4 changed files with 16 additions and 10 deletions

View File

@@ -39,19 +39,16 @@
#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}
/* p r w flags file _bf z cookie close read seek write
{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 */
/* the usual - (stdin + stdout + stderr) */
@@ -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 */
@@ -176,6 +173,6 @@ __sinit(void)
/* make sure we clean up on exit */
__atexit_register_cleanup(_cleanup); /* conservative */
__sdidinit = 1;
out:
out:
_THREAD_PRIVATE_MUTEX_UNLOCK(__sinit_mutex);
}