Changeset 2552 for zzuf/trunk/src
- Timestamp:
- Jul 16, 2008, 11:24:09 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/src/lib-stream.c
r2542 r2552 63 63 static FILE * (*ORIG(freopen)) (const char *path, const char *mode, 64 64 FILE *stream); 65 #if defined HAVE_FREOPEN64 66 static FILE * (*ORIG(freopen64))(const char *path, const char *mode, 67 FILE *stream); 68 #endif 65 69 #if defined HAVE___FREOPEN64 66 70 static FILE * (*ORIG(__freopen64)) (const char *path, const char *mode, … … 71 75 static int (*ORIG(fseeko)) (FILE *stream, off_t offset, int whence); 72 76 #endif 77 #if defined HAVE_FSEEKO64 78 static int (*ORIG(fseeko64)) (FILE *stream, off_t offset, int whence); 79 #endif 73 80 #if defined HAVE___FSEEKO64 74 81 static int (*ORIG(__fseeko64)) (FILE *stream, off_t offset, int whence); 82 #endif 83 #if defined HAVE_FSETPOS64 84 static int (*ORIG(fsetpos64))(FILE *stream, const fpos64_t *pos); 75 85 #endif 76 86 #if defined HAVE___FSETPOS64 … … 206 216 } 207 217 218 #if defined HAVE_FREOPEN64 219 FILE *NEW(freopen64)(const char *path, const char *mode, FILE *stream) 220 { 221 FILE *ret; FREOPEN(freopen64); return ret; 222 } 223 #endif 224 208 225 #if defined HAVE___FREOPEN64 209 226 FILE *NEW(__freopen64)(const char *path, const char *mode, FILE *stream) … … 263 280 #endif 264 281 282 #if defined HAVE_FSEEKO64 283 int NEW(fseeko64)(FILE *stream, off64_t offset, int whence) 284 { 285 int ret; FSEEK(fseeko64, ftello); return ret; 286 } 287 #endif 288 265 289 #if defined HAVE___FSEEKO64 266 290 int NEW(__fseeko64)(FILE *stream, off64_t offset, int whence) … … 270 294 #endif 271 295 296 #define FSETPOS(fn) \ 297 do \ 298 { \ 299 int fd; \ 300 LOADSYM(fn); \ 301 fd = fileno(stream); \ 302 if(!_zz_ready || !_zz_iswatched(fd) || !_zz_isactive(fd)) \ 303 return ORIG(fn)(stream, pos); \ 304 _zz_lock(fd); \ 305 ret = ORIG(fn)(stream, pos); \ 306 _zz_unlock(fd); \ 307 debug("%s([%i], %lli) = %i", __func__, \ 308 fd, (long long int)*pos, ret); \ 309 /* On HP-UX at least, fpos64_t == int64_t */ \ 310 _zz_setpos(fd, (int64_t)*pos); \ 311 } \ 312 while(0) 313 314 #if defined HAVE_FSETPOS64 315 int NEW(fsetpos64)(FILE *stream, const fpos64_t *pos) 316 { 317 int ret; FSETPOS(fsetpos64); return ret; 318 } 319 #endif 320 272 321 #if defined HAVE___FSETPOS64 273 322 int NEW(__fsetpos64)(FILE *stream, const fpos64_t *pos) 274 323 { 275 int ret, fd; 276 277 LOADSYM(__fsetpos64); 278 fd = fileno(stream); 279 if(!_zz_ready || !_zz_iswatched(fd) || !_zz_isactive(fd)) 280 return ORIG(__fsetpos64)(stream, pos); 281 _zz_lock(fd); 282 ret = ORIG(__fsetpos64)(stream, pos); 283 _zz_unlock(fd); 284 debug("%s([%i], %lli) = %i", __func__, 285 fd, (long long int)*pos, ret); 286 /* On HP-UX at least, fpos64_t == int64_t */ 287 _zz_setpos(fd, (int64_t)*pos); 288 289 return ret; 324 int ret; FSETPOS(__fsetpos64); return ret; 290 325 } 291 326 #endif
Note: See TracChangeset
for help on using the changeset viewer.