summaryrefslogtreecommitdiffstats
path: root/libc/upstream-openbsd
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-09-24 10:27:09 -0700
committerElliott Hughes <enh@google.com>2014-09-24 10:32:30 -0700
commitc08c25b4c9bdd95bfbda56a8c21f51b88c8a692e (patch)
tree815a82fa0236c4f5c068ceb97c058bca1c639c57 /libc/upstream-openbsd
parentfc5a93f7a2ea2be740f2c909e8a6a192fa65adc8 (diff)
downloadbionic-c08c25b4c9bdd95bfbda56a8c21f51b88c8a692e.zip
bionic-c08c25b4c9bdd95bfbda56a8c21f51b88c8a692e.tar.gz
bionic-c08c25b4c9bdd95bfbda56a8c21f51b88c8a692e.tar.bz2
Sync with upstream findfp.c.
Change-Id: Ib298f46de0c4d0fd4ce0a9b456c163e8b8b06342
Diffstat (limited to 'libc/upstream-openbsd')
-rw-r--r--libc/upstream-openbsd/android/include/openbsd-compat.h4
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/findfp.c15
2 files changed, 10 insertions, 9 deletions
diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h
index 630094d..268b3b6 100644
--- a/libc/upstream-openbsd/android/include/openbsd-compat.h
+++ b/libc/upstream-openbsd/android/include/openbsd-compat.h
@@ -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);
diff --git a/libc/upstream-openbsd/lib/libc/stdio/findfp.c b/libc/upstream-openbsd/lib/libc/stdio/findfp.c
index b8c7dc1..3594369 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/findfp.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/findfp.c
@@ -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);
}