stat() implementation support
This commit is contained in:
manojampalam 2016-03-06 21:39:33 -08:00
parent 43c3d105c3
commit 2a87a620ce
4 changed files with 14 additions and 0 deletions

View File

@ -499,6 +499,11 @@ fileio_fstat(struct w32_io* pio, struct _stat64 *buf) {
return _fstat64(fd, buf);
}
int
fileio_stat(const char *path, struct _stat64 *buf) {
return _stat64(path, buf);
}
/* isatty() implementation */
int
fileio_isatty(struct w32_io* pio) {

View File

@ -40,12 +40,15 @@ int w32_socketpair(int domain, int type, int sv[2]);
/*non-network (file) i/o*/
#define fdopen(a,b) w32_fdopen((a), (b))
#define fstat(a,b) w32_fstat((a), (b))
//#define stat(a,b) w32_stat((a), (b))
struct w32_stat;
int w32_pipe(int *pfds);
int w32_open(const char *pathname, int flags, ...);
int w32_read(int fd, void *dst, unsigned int max);
int w32_write(int fd, const void *buf, unsigned int max);
int w32_fstat(int fd, struct w32_stat *buf);
int w32_stat(const char *path, struct w32_stat *buf);
int w32_isatty(int fd);
FILE* w32_fdopen(int fd, const char *mode);

View File

@ -349,6 +349,11 @@ w32_fstat(int fd, struct w32_stat *buf) {
return fileio_fstat(fd_table.w32_ios[fd], (struct _stat64*)buf);
}
int
w32_stat(const char *path, struct w32_stat *buf) {
return fileio_stat(path, (struct _stat64*)buf);
}
int
w32_isatty(int fd) {
if ((fd < 0) || (fd > MAX_FDS - 1) || fd_table.w32_ios[fd] == NULL) {

View File

@ -114,6 +114,7 @@ struct w32_io* fileio_open(const char *pathname, int flags, int mode);
int fileio_read(struct w32_io* pio, void *dst, unsigned int max);
int fileio_write(struct w32_io* pio, const void *buf, unsigned int max);
int fileio_fstat(struct w32_io* pio, struct _stat64 *buf);
int fileio_stat(const char *path, struct _stat64 *buf);
int fileio_isatty(struct w32_io* pio);
FILE* fileio_fdopen(struct w32_io* pio, const char *mode);