1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
#include <libioP.h>
#include <stdio.h>
FILE *
fdopen (int fd, const char *mode)
{
FILE *fp;
__libc_lock_lock (__libc_libio_lock);
fp = _IO_fdopen (fd, mode);
__libc_lock_unlock (__libc_libio_lock);
return fp;
}
FILE *
fopen (const char *filename, const char *mode)
{
FILE *fp;
__libc_lock_lock (__libc_libio_lock);
fp = _IO_fopen (filename, mode);
__libc_lock_unlock (__libc_libio_lock);
return fp;
}
FILE *
popen (const char *command, const char *mode)
{
FILE *fp;
__libc_lock_lock (__libc_libio_lock);
fp = _IO_popen (command, mode);
__libc_lock_unlock (__libc_libio_lock);
return fp;
}
int
fgetpos (FILE *fp, fpos_t *posp)
{
int ret;
flockfile (fp);
ret = _IO_fgetpos (fp, posp);
funlockfile (fp);
return ret;
}
int
fsetpos (FILE *fp, const fpos_t *posp)
{
int ret;
flockfile (fp);
ret = _IO_fsetpos (fp, posp);
funlockfile (fp);
return ret;
}
char *
fgets (char *buf, int n, FILE *fp)
{
flockfile (fp);
buf = _IO_fgets (buf, n, fp);
funlockfile (fp);
return buf;
}
int
fputs (const char *buf, FILE *fp)
{
int ret;
flockfile (fp);
ret = _IO_fputs (buf, fp);
funlockfile (fp);
return ret;
}
size_t
fread (void *buf, size_t size, size_t count, FILE *fp)
{
flockfile (fp);
count = _IO_fread (buf, size, count, fp);
funlockfile (fp);
return count;
}
long int
ftell (FILE *fp)
{
long int ret;
flockfile (fp);
ret = _IO_ftell (fp);
funlockfile (fp);
return ret;
}
size_t
fwrite (const void *buf, size_t size, size_t count, FILE *fp)
{
flockfile (fp);
count = _IO_fwrite (buf, size, count, fp);
funlockfile (fp);
return count;
}
ssize_t
getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
{
ssize_t ret;
flockfile (fp);
ret = _IO_getdelim (lineptr, n, delimiter, fp);
funlockfile (fp);
return ret;
}
char *
gets (char *buf)
{
flockfile (_IO_stdin);
buf = _IO_gets (buf);
funlockfile (_IO_stdin);
return buf;
}
int
puts (const char *buf)
{
int ret;
flockfile (_IO_stdout);
ret = _IO_puts (buf);
funlockfile (_IO_stdout);
return ret;
}
void
setbuffer(FILE *fp, char *buf, int size)
{
flockfile (fp);
_IO_setbuffer (fp, buf, size);
funlockfile (fp);
}
int
setvbuf (FILE *fp, char *buf, int mode, size_t size)
{
flockfile (fp);
mode = _IO_setvbuf (fp, buf, mode, size);
funlockfile (fp);
return mode;
}
int
ungetc (int c, FILE *fp)
{
flockfile (fp);
c = _IO_ungetc(c, fp);
funlockfile (fp);
return c;
}
int
vfprintf(FILE *s, const char *format, va_list ap)
{
int ret;
flockfile (s);
ret = _IO_vfprintf (s, format, ap);
funlockfile (s);
return ret;
}
|