WIP getdents/opendir LARGEFILE
This commit is contained in:
parent
9c72c28a06
commit
00096e6c9a
|
@ -36,6 +36,7 @@
|
||||||
// Taken from GNU C Library 2.2.5
|
// Taken from GNU C Library 2.2.5
|
||||||
|
|
||||||
/* Directory stream type. */
|
/* Directory stream type. */
|
||||||
|
#if __SIZEOF_LONG_LONG__ != 8
|
||||||
struct __dirstream
|
struct __dirstream
|
||||||
{
|
{
|
||||||
int fd; /* File descriptor. */
|
int fd; /* File descriptor. */
|
||||||
|
@ -47,6 +48,17 @@ struct __dirstream
|
||||||
|
|
||||||
off_t filepos; /* Position of next entry to read. */
|
off_t filepos; /* Position of next entry to read. */
|
||||||
};
|
};
|
||||||
|
#else // __SIZEOF_LONG_LONG__ == 8
|
||||||
|
struct __dirstream
|
||||||
|
{
|
||||||
|
off_t tell;
|
||||||
|
int fd;
|
||||||
|
int buf_pos;
|
||||||
|
int buf_end;
|
||||||
|
int lock[1];
|
||||||
|
char buf[2048];
|
||||||
|
};
|
||||||
|
#endif // __SIZEOF_LONG_LONG__ == 8
|
||||||
|
|
||||||
typedef struct __dirstream DIR;
|
typedef struct __dirstream DIR;
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,17 @@
|
||||||
#ifdef __arm__
|
#ifdef __arm__
|
||||||
#define O_DIRECTORY 0x4000
|
#define O_DIRECTORY 0x4000
|
||||||
/*#define O_DIRECT 0x10000*/
|
/*#define O_DIRECT 0x10000*/
|
||||||
|
#define O_LARGEFILE 0x20000
|
||||||
#else
|
#else
|
||||||
#define O_DIRECTORY 0x10000
|
#define O_DIRECTORY 0x10000
|
||||||
|
#if __i386__
|
||||||
|
//#define O_LARGEFILE 0x8000
|
||||||
|
#define O_LARGEFILE 0100000
|
||||||
|
#else
|
||||||
|
#define O_LARGEFILE 0
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#elif __GNU__
|
#elif __GNU__
|
||||||
#define O_RDONLY 1
|
#define O_RDONLY 1
|
||||||
|
|
|
@ -71,10 +71,10 @@ typedef unsigned gid_t;
|
||||||
#ifndef __MES_INO_T
|
#ifndef __MES_INO_T
|
||||||
#define __MES_INO_T
|
#define __MES_INO_T
|
||||||
#undef ino_t
|
#undef ino_t
|
||||||
#if __M2__
|
#if __M2__ || __SIZEOF_LONG_LONG__ != 8
|
||||||
typedef unsigned ino_t;
|
typedef unsigned ino_t;
|
||||||
#else
|
#else
|
||||||
typedef unsigned long ino_t;
|
typedef unsigned long long ino_t;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,11 @@ opendir (char const *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open (name, O_RDONLY | O_DIRECTORY);
|
int flags = O_RDONLY | O_DIRECTORY;
|
||||||
|
#if __SIZEOF_LONG_LONG__ == 8
|
||||||
|
flags |= O_LARGEFILE;
|
||||||
|
#endif
|
||||||
|
fd = open (name, flags);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -74,8 +78,10 @@ opendir (char const *name)
|
||||||
errno = save_errno;
|
errno = save_errno;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#if __SIZEOF_LONG_LONG__ != 8
|
||||||
dirp->data = (char *) (dirp + 1);
|
dirp->data = (char *) (dirp + 1);
|
||||||
dirp->allocation = allocation;
|
dirp->allocation = allocation;
|
||||||
|
#endif
|
||||||
dirp->fd = fd;
|
dirp->fd = fd;
|
||||||
|
|
||||||
return dirp;
|
return dirp;
|
||||||
|
|
|
@ -40,6 +40,9 @@ open (char const *file_name, int flags, ...)
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start (ap, flags);
|
va_start (ap, flags);
|
||||||
int mask = va_arg (ap, int);
|
int mask = va_arg (ap, int);
|
||||||
|
#if __SIZEOF_LONG_LONG__ == 8
|
||||||
|
flags |= O_LARGEFILE;
|
||||||
|
#endif
|
||||||
int r = _sys_call3 (SYS_open, (long) file_name, flags, mask);
|
int r = _sys_call3 (SYS_open, (long) file_name, flags, mask);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
if (r > 2)
|
if (r > 2)
|
||||||
|
|
Loading…
Reference in New Issue