Searched refs:fp (Results 1 - 25 of 90) 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 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
59 fp->_r = 0; /* largely a convenience for callers */
62 if (fp->_flags & __SEOF)
66 if ((fp->_flags & __SRD) == 0) {
67 if ((fp->_flags & __SRW) == 0) {
69 fp->_flags |= __SERR;
73 if (fp
[all...]
H A Dclrerr.c39 clearerr(FILE *fp) argument
41 FLOCKFILE(fp);
42 __sclearerr(fp);
43 FUNLOCKFILE(fp);
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 Dfgetc.c37 fgetc(FILE *fp) argument
39 return (getc(fp));
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 Dftell.c43 ftello(FILE *fp) argument
47 if (fp->_seek == NULL) {
57 FLOCKFILE(fp);
58 __sflush(fp); /* may adjust seek offset on append stream */
59 if (fp->_flags & __SOFF)
60 pos = fp->_offset;
62 pos = (*fp->_seek)(fp->_cookie, (fpos_t)0, SEEK_CUR);
66 if (fp->_flags & __SRD) {
72 pos -= fp
88 ftell(FILE *fp) argument
[all...]
H A Dfseek.c49 fseeko(FILE *fp, off_t offset, int whence) argument
64 if ((seekfn = fp->_seek) == NULL) {
73 FLOCKFILE(fp);
82 __sflush(fp); /* may adjust seek offset on append stream */
83 if (fp->_flags & __SOFF)
84 curoff = fp->_offset;
86 curoff = (*seekfn)(fp->_cookie, (fpos_t)0, SEEK_CUR);
88 FUNLOCKFILE(fp);
92 if (fp->_flags & __SRD) {
93 curoff -= fp
248 fseek(FILE *fp, long offset, int whence) 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 Drewind.c38 rewind(FILE *fp) argument
40 (void) fseek(fp, 0L, SEEK_SET);
41 clearerr(fp);
H A Dfgetln.c47 __slbexpand(FILE *fp, size_t newsize) argument
54 if (fp->_lb._size >= newsize)
56 if ((p = realloc(fp->_lb._base, newsize)) == NULL)
58 fp->_lb._base = p;
59 fp->_lb._size = newsize;
71 fgetln(FILE *fp, size_t *lenp) argument
78 FLOCKFILE(fp);
79 _SET_ORIENTATION(fp, -1);
82 if (fp->_r <= 0 && __srefill(fp))
[all...]
H A Dfreopen.c50 freopen(const char *file, const char *mode, FILE *fp) argument
56 (void) fclose(fp);
63 FLOCKFILE(fp);
73 if (fp->_flags == 0) {
74 fp->_flags = __SEOF; /* hold on to it */
79 if (fp->_flags & __SWR)
80 (void) __sflush(fp);
82 isopen = fp->_close != NULL;
83 if ((wantfd = fp->_file) < 0 && isopen) {
84 (void) (*fp
[all...]
H A Dfeof.c43 feof(FILE *fp) argument
47 FLOCKFILE(fp);
48 ret = __sfeof(fp);
49 FUNLOCKFILE(fp);
H A Dferror.c43 ferror(FILE *fp) argument
47 FLOCKFILE(fp);
48 ret = __sferror(fp);
49 FUNLOCKFILE(fp);
H A Dfileno.c43 fileno(FILE *fp) argument
47 FLOCKFILE(fp);
48 ret = __sfileno(fp);
49 FUNLOCKFILE(fp);
H A Dputc.c44 putc_unlocked(int c, FILE *fp) argument
46 if (cantwrite(fp)) {
50 _SET_ORIENTATION(fp, -1);
51 return (__sputc(c, fp));
60 putc(int c, FILE *fp) argument
64 FLOCKFILE(fp);
65 ret = putc_unlocked(c, fp);
66 FUNLOCKFILE(fp);
H A Dgetc.c43 getc_unlocked(FILE *fp) argument
45 return (__sgetc(fp));
54 getc(FILE *fp) argument
58 FLOCKFILE(fp);
59 c = __sgetc(fp);
60 FUNLOCKFILE(fp);
H A Dfunopen.c43 FILE *fp; local
58 if ((fp = __sfp()) == NULL)
60 fp->_flags = flags;
61 fp->_file = -1;
62 fp->_cookie = (void *)cookie; /* SAFE: cookie not modified */
63 fp->_read = readfn;
64 fp->_write = writefn;
65 fp->_seek = seekfn;
66 fp->_close = closefn;
67 return (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
81 __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...]
/bionic/libc/bionic/
H A Dflockfile.cpp38 void flockfile(FILE* fp) { argument
39 if (fp != NULL) {
40 pthread_mutex_lock(&_FLOCK(fp));
44 int ftrylockfile(FILE* fp) { argument
47 if (fp == NULL) {
51 return pthread_mutex_trylock(&_FLOCK(fp));
54 void funlockfile(FILE* fp) { argument
55 if (fp != NULL) {
56 pthread_mutex_unlock(&_FLOCK(fp));
/bionic/libc/upstream-freebsd/lib/libc/stdio/
H A Dfclose.c49 fclose(FILE *fp) argument
53 if (fp->_flags == 0) { /* not open! */
57 FLOCKFILE(fp);
58 r = fp->_flags & __SWR ? __sflush(fp) : 0;
59 if (fp->_close != NULL && (*fp->_close)(fp->_cookie) < 0)
61 if (fp->_flags & __SMBF)
62 free((char *)fp
[all...]
/bionic/libc/stdio/
H A Dfileext.h48 #define _EXT(fp) ((struct __sfileext *)((fp)->_ext._base))
49 #define _UB(fp) _EXT(fp)->_ub
50 #define _FLOCK(fp) _EXT(fp)->_lock
52 #define _FILEEXT_INIT(fp) \
54 _UB(fp)._base = NULL; \
55 _UB(fp)._size = 0; \
56 WCIO_INIT(fp); \
[all...]

Completed in 299 milliseconds

1234