Implement _FILE_OFFSET_BITS (mostly).

I still don't think we can make stdio's fseeko and ftello work, but we can
have everything else, and very few programs use fseeko/ftello (and they can
just refrain from using _FILE_OFFSET_BITS and be no worse off than they are
today).

Bug: 11865851
Change-Id: Ic3cb409aae6713f4b345de954bcc4241fcd969ec
This commit is contained in:
Elliott Hughes
2015-02-06 22:28:49 -08:00
parent d687905f11
commit 68dc20d411
7 changed files with 65 additions and 24 deletions

View File

@@ -57,8 +57,6 @@
__BEGIN_DECLS
#define _FSTDIO /* Define for new stdio with functions. */
typedef off_t fpos_t; /* stdio file position type */
/*
@@ -282,11 +280,22 @@ char* tempnam(const char*, const char*)
extern int rename(const char*, const char*);
extern int renameat(int, const char*, int, const char*);
#if defined(__USE_FILE_OFFSET64)
/* Not possible. */
int fgetpos(FILE * __restrict, fpos_t * __restrict)
__attribute__((__error__("not available with _FILE_OFFSET_BITS=64")));
int fsetpos(FILE *, const fpos_t *)
__attribute__((__error__("not available with _FILE_OFFSET_BITS=64")));
int fseeko(FILE *, off_t, int)
__attribute__((__error__("not available with _FILE_OFFSET_BITS=64")));
off_t ftello(FILE *)
__attribute__((__error__("not available with _FILE_OFFSET_BITS=64")));
#else
int fgetpos(FILE * __restrict, fpos_t * __restrict);
int fsetpos(FILE *, const fpos_t *);
int fseeko(FILE *, off_t, int);
off_t ftello(FILE *);
#endif
#if __ISO_C_VISIBLE >= 1999 || __BSD_VISIBLE
int snprintf(char * __restrict, size_t, const char * __restrict, ...)