|
@ -26,7 +26,7 @@ |
|
|
|
|
|
|
|
|
/* HACK to use pread/pwrite from eio because MINGW32 doesn't have it /*
|
|
|
/* HACK to use pread/pwrite from eio because MINGW32 doesn't have it /*
|
|
|
/* TODO fixme */ |
|
|
/* TODO fixme */ |
|
|
#if __MINGW32__ |
|
|
#ifdef __MINGW32__ |
|
|
# define pread eio__pread |
|
|
# define pread eio__pread |
|
|
# define pwrite eio__pwrite |
|
|
# define pwrite eio__pwrite |
|
|
#endif |
|
|
#endif |
|
@ -109,7 +109,7 @@ static int After(eio_req *req) { |
|
|
case EIO_LSTAT: |
|
|
case EIO_LSTAT: |
|
|
case EIO_FSTAT: |
|
|
case EIO_FSTAT: |
|
|
{ |
|
|
{ |
|
|
struct stat *s = reinterpret_cast<struct stat*>(req->ptr2); |
|
|
NODE_STAT_STRUCT *s = reinterpret_cast<NODE_STAT_STRUCT*>(req->ptr2); |
|
|
argv[1] = BuildStatsObject(s); |
|
|
argv[1] = BuildStatsObject(s); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
@ -207,7 +207,7 @@ static Persistent<String> atime_symbol; |
|
|
static Persistent<String> mtime_symbol; |
|
|
static Persistent<String> mtime_symbol; |
|
|
static Persistent<String> ctime_symbol; |
|
|
static Persistent<String> ctime_symbol; |
|
|
|
|
|
|
|
|
Local<Object> BuildStatsObject(struct stat * s) { |
|
|
Local<Object> BuildStatsObject(NODE_STAT_STRUCT *s) { |
|
|
HandleScope scope; |
|
|
HandleScope scope; |
|
|
|
|
|
|
|
|
if (dev_symbol.IsEmpty()) { |
|
|
if (dev_symbol.IsEmpty()) { |
|
@ -285,8 +285,8 @@ static Handle<Value> Stat(const Arguments& args) { |
|
|
if (args[1]->IsFunction()) { |
|
|
if (args[1]->IsFunction()) { |
|
|
ASYNC_CALL(stat, args[1], *path) |
|
|
ASYNC_CALL(stat, args[1], *path) |
|
|
} else { |
|
|
} else { |
|
|
struct stat s; |
|
|
NODE_STAT_STRUCT s; |
|
|
int ret = stat(*path, &s); |
|
|
int ret = NODE_STAT(*path, &s); |
|
|
if (ret != 0) return ThrowException(ErrnoException(errno, NULL, "", *path)); |
|
|
if (ret != 0) return ThrowException(ErrnoException(errno, NULL, "", *path)); |
|
|
return scope.Close(BuildStatsObject(&s)); |
|
|
return scope.Close(BuildStatsObject(&s)); |
|
|
} |
|
|
} |
|
@ -305,7 +305,7 @@ static Handle<Value> LStat(const Arguments& args) { |
|
|
if (args[1]->IsFunction()) { |
|
|
if (args[1]->IsFunction()) { |
|
|
ASYNC_CALL(lstat, args[1], *path) |
|
|
ASYNC_CALL(lstat, args[1], *path) |
|
|
} else { |
|
|
} else { |
|
|
struct stat s; |
|
|
NODE_STAT_STRUCT s; |
|
|
int ret = lstat(*path, &s); |
|
|
int ret = lstat(*path, &s); |
|
|
if (ret != 0) return ThrowException(ErrnoException(errno, NULL, "", *path)); |
|
|
if (ret != 0) return ThrowException(ErrnoException(errno, NULL, "", *path)); |
|
|
return scope.Close(BuildStatsObject(&s)); |
|
|
return scope.Close(BuildStatsObject(&s)); |
|
@ -325,8 +325,8 @@ static Handle<Value> FStat(const Arguments& args) { |
|
|
if (args[1]->IsFunction()) { |
|
|
if (args[1]->IsFunction()) { |
|
|
ASYNC_CALL(fstat, args[1], fd) |
|
|
ASYNC_CALL(fstat, args[1], fd) |
|
|
} else { |
|
|
} else { |
|
|
struct stat s; |
|
|
NODE_STAT_STRUCT s; |
|
|
int ret = fstat(fd, &s); |
|
|
int ret = NODE_FSTAT(fd, &s); |
|
|
if (ret != 0) return ThrowException(ErrnoException(errno)); |
|
|
if (ret != 0) return ThrowException(ErrnoException(errno)); |
|
|
return scope.Close(BuildStatsObject(&s)); |
|
|
return scope.Close(BuildStatsObject(&s)); |
|
|
} |
|
|
} |
|
|