Switch over to building with unified headers
[termux-packages] / ndk-patches / bits-struct_file.h.patch
1 diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/bits/struct_file.h ./usr/include/bits/struct_file.h
2 --- /home/fornwall/lib/android-ndk/sysroot/usr/include/bits/struct_file.h 2017-06-20 17:41:56.000000000 +0200
3 +++ ./usr/include/bits/struct_file.h 2017-06-26 13:35:19.040117023 +0200
4 @@ -33,13 +33,74 @@
5
6 __BEGIN_DECLS
7
8 +#if defined(__LP64__)
9 +struct __sbuf {
10 + unsigned char* _base;
11 + size_t _size;
12 +};
13 +#else
14 +struct __sbuf {
15 + unsigned char *_base;
16 + int _size;
17 +};
18 +#endif
19 +
20 struct __sFILE {
21 + unsigned char *_p; /* current position in (some) buffer */
22 + int _r; /* read space left for getc() */
23 + int _w; /* write space left for putc() */
24 #if defined(__LP64__)
25 - char __private[152];
26 + int _flags; /* flags, below; this FILE is free if 0 */
27 + int _file; /* fileno, if Unix descriptor, else -1 */
28 #else
29 - char __private[84];
30 + short _flags; /* flags, below; this FILE is free if 0 */
31 + short _file; /* fileno, if Unix descriptor, else -1 */
32 #endif
33 -} __attribute__((aligned(sizeof(void*))));
34 + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
35 + int _lbfsize; /* 0 or -_bf._size, for inline putc */
36 +
37 + /* operations */
38 + void *_cookie; /* cookie passed to io functions */
39 + int (*_close)(void *);
40 + int (*_read)(void *, char *, int);
41 + off_t (*_seek)(void *, off_t, int);
42 + int (*_write)(void *, const char *, int);
43 +
44 + /* extension data, to avoid further ABI breakage */
45 + struct __sbuf _ext;
46 + /* data for long sequences of ungetc() */
47 + unsigned char *_up; /* saved _p when _p is doing ungetc data */
48 + int _ur; /* saved _r when _r is counting ungetc data */
49 +
50 + /* tricks to meet minimum requirements even when malloc() fails */
51 + unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
52 + unsigned char _nbuf[1]; /* guarantee a getc() buffer */
53 +
54 + /* separate buffer for fgetln() when line crosses buffer boundary */
55 + struct __sbuf _lb; /* buffer for fgetln() */
56 +
57 + /* Unix stdio files get aligned to block boundaries on fseek() */
58 + int _blksize; /* stat.st_blksize (may be != _bf._size) */
59 + off_t _offset; /* current lseek offset */
60 +};
61 +
62 +#define __SLBF 0x0001 /* line buffered */
63 +#define __SNBF 0x0002 /* unbuffered */
64 +#define __SRD 0x0004 /* OK to read */
65 +#define __SWR 0x0008 /* OK to write */
66 + /* RD and WR are never simultaneously asserted */
67 +#define __SRW 0x0010 /* open for reading & writing */
68 +#define __SEOF 0x0020 /* found EOF */
69 +#define __SERR 0x0040 /* found error */
70 +#define __SMBF 0x0080 /* _buf is from malloc */
71 +#define __SAPP 0x0100 /* fdopen()ed in append mode */
72 +#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
73 +#define __SOPT 0x0400 /* do fseek() optimization */
74 +#define __SNPT 0x0800 /* do not do fseek() optimization */
75 +#define __SOFF 0x1000 /* set iff _offset is in fact correct */
76 +#define __SMOD 0x2000 /* true => fgetln modified _p text */
77 +#define __SALC 0x4000 /* allocate string space dynamically */
78 +#define __SIGN 0x8000 /* ignore this file in _fwalk */
79
80 __END_DECLS
81