| 2500 | /* acl_vstream_fopen - open buffered file fp */ |
| 2501 | |
| 2502 | ACL_VSTREAM *acl_vstream_fopen(const char *path, unsigned int oflags, |
| 2503 | int mode, size_t buflen) |
| 2504 | { |
| 2505 | ACL_VSTREAM *fp; |
| 2506 | ACL_FILE_HANDLE fh; |
| 2507 | |
| 2508 | /* for linux2.6 */ |
| 2509 | #ifdef _LARGEFILE64_SOURCE |
| 2510 | oflags |= O_LARGEFILE; |
| 2511 | #endif |
| 2512 | |
| 2513 | #ifdef ACL_WINDOWS |
| 2514 | oflags |= O_BINARY; |
| 2515 | #endif |
| 2516 | |
| 2517 | fh = acl_file_open(path, oflags, mode); |
| 2518 | if (fh == ACL_FILE_INVALID) { |
| 2519 | return NULL; |
| 2520 | } |
| 2521 | |
| 2522 | fp = acl_vstream_fdopen(ACL_SOCKET_INVALID, oflags, buflen, |
| 2523 | -1, ACL_VSTREAM_TYPE_FILE); |
| 2524 | if (fp == NULL) { |
| 2525 | return NULL; |
| 2526 | } |
| 2527 | |
| 2528 | fp->fd.h_file = fh; |
| 2529 | fp->oflags = oflags; |
| 2530 | fp->omode = mode; |
| 2531 | acl_vstream_set_path(fp, path); |
| 2532 | |
| 2533 | return fp; |
| 2534 | } |
| 2535 | |
| 2536 | char *acl_vstream_loadfile(const char *path) |
| 2537 | { |
searching dependent graphs…