Searched refs:fp (Results 1 - 25 of 85) sorted by relevance

1234

/bionic/libc/upstream-openbsd/lib/libc/stdio/
H A Drget.c43 __srget(FILE *fp) argument
45 _SET_ORIENTATION(fp, -1);
46 if (__srefill(fp) == 0) {
47 fp->_r--;
48 return (*fp->_p++);
H A Dwsetup.c44 __swsetup(FILE *fp) argument
53 if ((fp->_flags & __SWR) == 0) {
54 if ((fp->_flags & __SRW) == 0)
56 if (fp->_flags & __SRD) {
58 if (HASUB(fp))
59 FREEUB(fp);
60 fp->_flags &= ~(__SRD|__SEOF);
61 fp->_r = 0;
62 fp->_p = fp
[all...]
H A Dfpurge.c44 fpurge(FILE *fp) argument
46 FLOCKFILE(fp);
47 if (!fp->_flags) {
48 FUNLOCKFILE(fp);
53 if (HASUB(fp))
54 FREEUB(fp);
55 WCIO_FREE(fp);
56 fp->_p = fp->_bf._base;
57 fp
[all...]
H A Dwbuf.c44 __swbuf(int c, FILE *fp) argument
48 _SET_ORIENTATION(fp, -1);
56 fp->_w = fp->_lbfsize;
57 if (cantwrite(fp)) {
72 n = fp->_p - fp->_bf._base;
73 if (n >= fp->_bf._size) {
74 if (__sflush(fp))
78 fp
[all...]
H A Dungetc.c41 * Expand the ungetc buffer `in place'. That is, adjust fp->_p when
47 __submore(FILE *fp) argument
52 if (_UB(fp)._base == fp->_ubuf) {
58 _UB(fp)._base = p;
59 _UB(fp)._size = BUFSIZ;
60 p += BUFSIZ - sizeof(fp->_ubuf);
61 for (i = sizeof(fp->_ubuf); --i >= 0;)
62 p[i] = fp->_ubuf[i];
63 fp
79 ungetc(int c, FILE *fp) argument
[all...]
H A Dfputws.c40 fputws(ws, fp)
42 FILE * __restrict fp;
44 FLOCKFILE(fp);
45 _SET_ORIENTATION(fp, 1);
48 if (__fputwc_unlock(*ws++, fp) == WEOF) {
49 FUNLOCKFILE(fp);
54 FUNLOCKFILE(fp);
H A Dfgetln.c43 __slbexpand(FILE *fp, size_t newsize) argument
47 if (fp->_lb._size >= newsize)
49 if ((p = realloc(fp->_lb._base, newsize)) == NULL)
51 fp->_lb._base = p;
52 fp->_lb._size = newsize;
64 fgetln(FILE *fp, size_t *lenp) argument
71 FLOCKFILE(fp);
72 _SET_ORIENTATION(fp, -1);
75 if (fp->_r <= 0 && __srefill(fp))
[all...]
H A Dmakebuf.c49 __smakebuf(FILE *fp) argument
56 if (fp->_flags & __SNBF) {
57 fp->_bf._base = fp->_p = fp->_nbuf;
58 fp->_bf._size = 1;
61 flags = __swhatbuf(fp, &size, &couldbetty);
63 fp->_flags |= __SNBF;
64 fp->_bf._base = fp
80 __swhatbuf(FILE *fp, size_t *bufsize, int *couldbetty) argument
[all...]
H A Dsetvbuf.c43 setvbuf(FILE *fp, char *buf, int mode, size_t size) argument
64 FLOCKFILE(fp);
66 (void)__sflush(fp);
67 if (HASUB(fp))
68 FREEUB(fp);
69 WCIO_FREE(fp);
70 fp->_r = fp->_lbfsize = 0;
71 flags = fp->_flags;
73 free((void *)fp
[all...]
H A Dfflush.c38 /* Flush a single file, or (if fp is NULL) all files. */
40 fflush(FILE *fp) argument
44 if (fp == NULL)
46 FLOCKFILE(fp);
47 if ((fp->_flags & (__SWR | __SRW)) == 0) {
51 r = __sflush(fp);
52 FUNLOCKFILE(fp);
57 __sflush(FILE *fp) argument
62 t = fp->_flags;
66 if ((p = fp
89 __sflush_locked(FILE *fp) argument
[all...]
H A Dfwalk.c42 FILE *fp; local
48 for (fp = g->iobs, n = g->niobs; --n >= 0; fp++) {
49 if ((fp->_flags != 0) && ((fp->_flags & __SIGN) == 0))
50 ret |= (*function)(fp);
H A Dungetwc.c38 __ungetwc(wint_t wc, FILE *fp) argument
45 _SET_ORIENTATION(fp, 1);
52 wcio = WCIO_GET(fp);
63 __sclearerr(fp);
69 ungetwc(wint_t wc, FILE *fp) argument
73 FLOCKFILE(fp);
74 r = __ungetwc(wc, fp);
75 FUNLOCKFILE(fp);
H A Dfvwrite.c48 __sfvwrite(FILE *fp, struct __suio *uio) argument
60 if (cantwrite(fp)) {
66 #define COPY(n) (void)memcpy((void *)fp->_p, (void *)p, (size_t)(n))
79 if (fp->_flags & __SNBF) {
85 w = (*fp->_write)(fp->_cookie, p, MIN(len, BUFSIZ));
91 } else if ((fp->_flags & __SLBF) == 0) {
105 if ((fp->_flags & (__SALC | __SSTR)) ==
106 (__SALC | __SSTR) && fp->_w < len) {
107 size_t blen = fp
[all...]
H A Dfwide.c37 fwide(FILE *fp, int mode) argument
52 FLOCKFILE(fp);
53 wcio = WCIO_GET(fp);
61 FUNLOCKFILE(fp);
H A Dfputs.c43 fputs(const char *s, FILE *fp) argument
53 FLOCKFILE(fp);
54 _SET_ORIENTATION(fp, -1);
55 ret = __sfvwrite(fp, &uio);
56 FUNLOCKFILE(fp);
H A Dfgetwc.c38 __fgetwc_unlock(FILE *fp) argument
45 _SET_ORIENTATION(fp, 1);
46 wcio = WCIO_GET(fp);
63 int ch = __sgetc(fp);
72 fp->_flags |= __SERR;
81 fgetwc(FILE *fp) argument
85 FLOCKFILE(fp);
86 r = __fgetwc_unlock(fp);
87 FUNLOCKFILE(fp);
H A Dfgets.c46 fgets(char *buf, int n, FILE *fp) __overloadable
57 FLOCKFILE(fp); variable
58 _SET_ORIENTATION(fp, -1);
65 if (fp->_r <= 0) {
66 if (__srefill(fp)) {
69 FUNLOCKFILE(fp); variable
75 len = fp->_r;
76 p = fp->_p;
89 fp->_r -= len;
90 fp
93 FUNLOCKFILE(fp); variable
103 FUNLOCKFILE(fp); variable
[all...]
/bionic/libc/stdio/
H A Drefill.c40 lflush(FILE *fp) argument
42 if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR))
43 return (__sflush_locked(fp)); /* ignored... */
52 __srefill(FILE *fp) argument
54 fp->_r = 0; /* largely a convenience for callers */
58 if (fp->_flags & __SEOF)
63 if ((fp->_flags & __SRD) == 0) {
64 if ((fp->_flags & __SRW) == 0) {
66 fp->_flags |= __SERR;
70 if (fp
[all...]
H A Dstdio_ext.cpp37 size_t __fbufsize(FILE* fp) { argument
38 return fp->_bf._size;
42 int __freading(FILE* fp) {
43 return (fp->_flags & _SRD) != 0 || ...;
49 return (fp->_flags & _SWR) != 0 || ...;
53 int __freadable(FILE* fp) { argument
54 return (fp->_flags & (__SRD|__SRW)) != 0;
57 int __fwritable(FILE* fp) { argument
58 return (fp->_flags & (__SWR|__SRW)) != 0;
61 int __flbf(FILE* fp) { argument
65 __fpurge(FILE* fp) argument
69 __fpending(FILE* fp) argument
78 __fsetlocking(FILE* fp, int type) argument
[all...]
H A Dfread.c44 fread(void *buf, size_t size, size_t count, FILE *fp) __overloadable
52 fp->_flags |= __SERR;
66 FLOCKFILE(fp); variable
67 _SET_ORIENTATION(fp, -1);
70 if (fp->_r < 0)
71 fp->_r = 0;
76 if (fp->_bf._base == NULL) {
77 __smakebuf(fp); variable
86 size_t buffered_bytes = MIN((size_t) fp->_r, total);
87 memcpy(dst, fp
137 FUNLOCKFILE(fp); variable
[all...]
H A Dwcio.h52 #define WCIO_GET(fp) \
53 (_EXT(fp) ? &(_EXT(fp)->_wcio) : (struct wchar_io_data *)0)
55 #define _SET_ORIENTATION(fp, mode) \
57 struct wchar_io_data *_wcio = WCIO_GET(fp); \
65 #define WCIO_FREE(fp) \
67 struct wchar_io_data *_wcio = WCIO_GET(fp); \
74 #define WCIO_FREEUB(fp) \
76 struct wchar_io_data *_wcio = WCIO_GET(fp); \
82 #define WCIO_INIT(fp) \
[all...]
H A Dstdio.cpp103 explicit ScopedFileLock(FILE* fp) : fp_(fp) { argument
139 FILE *fp; local
145 for (fp = g->iobs, n = g->niobs; --n >= 0; fp++)
146 if (fp->_flags == 0)
157 fp = g->iobs;
159 fp->_flags = 1; /* reserve this slot; caller sets real flags */
161 fp->_p = NULL; /* no current pointer */
162 fp
194 FILE* fp = __sfp(); local
217 FILE* fp = __fopen(fd, flags); local
269 freopen(const char* file, const char* mode, FILE* fp) argument
374 fclose(FILE* fp) argument
400 fileno_unlocked(FILE* fp) argument
409 fileno(FILE* fp) argument
414 clearerr_unlocked(FILE* fp) argument
418 clearerr(FILE* fp) argument
423 feof_unlocked(FILE* fp) argument
427 feof(FILE* fp) argument
432 ferror_unlocked(FILE* fp) argument
436 ferror(FILE* fp) argument
442 FILE* fp = reinterpret_cast<FILE*>(cookie); local
447 FILE* fp = reinterpret_cast<FILE*>(cookie); local
458 FILE* fp = reinterpret_cast<FILE*>(cookie); local
463 FILE* fp = reinterpret_cast<FILE*>(cookie); local
468 FILE* fp = reinterpret_cast<FILE*>(cookie); local
472 __seek_unlocked(FILE* fp, off64_t offset, int whence) argument
489 __ftello64_unlocked(FILE* fp) argument
512 __fseeko64(FILE* fp, off64_t offset, int whence, int off_t_bits) argument
551 fseeko(FILE* fp, off_t offset, int whence) argument
557 fseeko64(FILE* fp, off64_t offset, int whence) argument
561 fsetpos(FILE* fp, const fpos_t* pos) argument
565 fsetpos64(FILE* fp, const fpos64_t* pos) argument
569 ftello(FILE* fp) argument
580 ftello64(FILE* fp) argument
585 fgetpos(FILE* fp, fpos_t* pos) argument
590 fgetpos64(FILE* fp, fpos64_t* pos) argument
604 FILE* fp = __sfp(); local
629 FILE* fp = __funopen(cookie, read_fn, write_fn, close_fn); local
641 FILE* fp = __funopen(cookie, read_fn, write_fn, close_fn); local
660 fprintf(FILE* fp, const char* fmt, ...) argument
664 fgetc(FILE* fp) argument
668 fputc(int c, FILE* fp) argument
672 fscanf(FILE* fp, const char* fmt, ...) argument
676 fwprintf(FILE* fp, const wchar_t* fmt, ...) argument
680 fwscanf(FILE* fp, const wchar_t* fmt, ...) argument
684 getc(FILE* fp) argument
689 getc_unlocked(FILE* fp) argument
701 getline(char** buf, size_t* len, FILE* fp) argument
705 getwc(FILE* fp) argument
717 putc(int c, FILE* fp) argument
722 putc_unlocked(int c, FILE* fp) argument
742 putwc(wchar_t wc, FILE* fp) argument
756 rewind(FILE* fp) argument
766 setbuf(FILE* fp, char* buf) argument
770 setbuffer(FILE* fp, char* buf, int size) argument
774 setlinebuf(FILE* fp) argument
[all...]
/bionic/libc/bionic/
H A Dflockfile.cpp38 void flockfile(FILE* fp) { argument
39 if (fp != nullptr) {
40 pthread_mutex_lock(&_FLOCK(fp));
44 int ftrylockfile(FILE* fp) { argument
47 if (fp == nullptr) {
51 return pthread_mutex_trylock(&_FLOCK(fp));
54 void funlockfile(FILE* fp) { argument
55 if (fp != nullptr) {
56 pthread_mutex_unlock(&_FLOCK(fp));
H A Dmalloc_info.cpp25 explicit Elem(FILE* fp, const char* name, argument
27 this->fp = fp;
30 fprintf(fp, "<%s", name);
34 fputc(' ', fp);
35 vfprintf(fp, attr_fmt, args);
38 fputc('>', fp);
42 fprintf(fp, "</%s>", name);
48 vfprintf(fp, fmt, args);
53 FILE* fp; member in class:Elem
59 malloc_info(int options, FILE* fp) argument
[all...]
/bionic/tests/
H A Dstdio_ext_test.cpp36 FILE* fp = fopen("/proc/version", "r"); local
39 ASSERT_EQ(0U, __fbufsize(fp));
43 fgets(buf, sizeof(buf), fp);
44 ASSERT_EQ(1024U, __fbufsize(fp));
46 ASSERT_EQ(0, setvbuf(fp, buf, _IOFBF, 1));
47 ASSERT_EQ(1U, __fbufsize(fp));
49 ASSERT_EQ(0, setvbuf(fp, buf, _IOFBF, 8));
50 ASSERT_EQ(8U, __fbufsize(fp));
52 fclose(fp);
56 FILE* fp local
69 FILE* fp = fopen("/dev/null", "w"); local
81 FILE* fp = tmpfile(); local
103 FILE* fp = fopen("/dev/null", "w"); local
119 FILE* fp = fopen("/dev/null", "r"); local
136 FILE* fp = fopen("/proc/version", "r"); local
[all...]

Completed in 280 milliseconds

1234