Node.js  v8.x
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine
node_file.cc File Reference
#include "node.h"
#include "node_buffer.h"
#include "node_internals.h"
#include "node_stat_watcher.h"
#include "env.h"
#include "env-inl.h"
#include "req-wrap.h"
#include "req-wrap-inl.h"
#include "string_bytes.h"
#include "util.h"
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <vector>
Include dependency graph for node_file.cc:

Go to the source code of this file.

Namespaces

 node
 

Macros

#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define TYPE_ERROR(msg)   env->ThrowTypeError(msg)
 
#define GET_OFFSET(a)   ((a)->IsNumber() ? (a)->IntegerValue() : -1)
 
#define ASSERT_PATH(path)
 
#define ASYNC_DEST_CALL(func, request, dest, encoding, ...)
 
#define ASYNC_CALL(func, req, encoding, ...)   ASYNC_DEST_CALL(func, req, nullptr, encoding, __VA_ARGS__) \
 
#define SYNC_DEST_CALL(func, path, dest, ...)
 
#define SYNC_CALL(func, path, ...)   SYNC_DEST_CALL(func, path, nullptr, __VA_ARGS__) \
 
#define SYNC_REQ   req_wrap.req
 
#define SYNC_RESULT   err
 
#define X(idx, name)
 

Functions

void FillStatsArray (double *fields, const uv_stat_t *s)
 
void GetStatValues (const FunctionCallbackInfo< Value > &args)
 
void InitFs (Local< Object > target, Local< Value > unused, Local< Context > context, void *priv)
 

Macro Definition Documentation

◆ ASSERT_PATH

#define ASSERT_PATH (   path)
Value:
if (*path == nullptr) \
return TYPE_ERROR( #path " must be a string or Buffer");
#define TYPE_ERROR(msg)
Definition: node_file.cc:70

Definition at line 128 of file node_file.cc.

Referenced by node::FillStatsArray().

◆ ASYNC_CALL

#define ASYNC_CALL (   func,
  req,
  encoding,
  ... 
)    ASYNC_DEST_CALL(func, req, nullptr, encoding, __VA_ARGS__) \

Definition at line 401 of file node_file.cc.

Referenced by node::FillStatsArray().

◆ ASYNC_DEST_CALL

#define ASYNC_DEST_CALL (   func,
  request,
  dest,
  encoding,
  ... 
)
Value:
Environment* env = Environment::GetCurrent(args); \
CHECK(request->IsObject()); \
FSReqWrap* req_wrap = FSReqWrap::New(env, request.As<Object>(), \
#func, dest, encoding); \
int err = uv_fs_ ## func(env->event_loop(), \
req_wrap->req(), \
__VA_ARGS__, \
After); \
req_wrap->Dispatched(); \
if (err < 0) { \
uv_fs_t* uv_req = req_wrap->req(); \
uv_req->result = err; \
uv_req->path = nullptr; \
After(uv_req); \
req_wrap = nullptr; \
} else { \
args.GetReturnValue().Set(req_wrap->persistent()); \
}
this func
Definition: v8ustack.d:371
encoding
Definition: node.h:322
MaybeLocal< Object > New(Isolate *isolate, Local< String > string, enum encoding enc)
Definition: node_buffer.cc:241

Definition at line 381 of file node_file.cc.

Referenced by node::FillStatsArray().

◆ GET_OFFSET

#define GET_OFFSET (   a)    ((a)->IsNumber() ? (a)->IntegerValue() : -1)

Definition at line 72 of file node_file.cc.

Referenced by node::FillStatsArray().

◆ MIN

#define MIN (   a,
 
)    ((a) < (b) ? (a) : (b))

Definition at line 67 of file node_file.cc.

◆ SYNC_CALL

#define SYNC_CALL (   func,
  path,
  ... 
)    SYNC_DEST_CALL(func, path, nullptr, __VA_ARGS__) \

Definition at line 415 of file node_file.cc.

Referenced by node::FillStatsArray().

◆ SYNC_DEST_CALL

#define SYNC_DEST_CALL (   func,
  path,
  dest,
  ... 
)
Value:
fs_req_wrap req_wrap; \
env->PrintSyncTrace(); \
int err = uv_fs_ ## func(env->event_loop(), \
&req_wrap.req, \
__VA_ARGS__, \
nullptr); \
if (err < 0) { \
return env->ThrowUVException(err, #func, nullptr, path, dest); \
} \
this func
Definition: v8ustack.d:371

Definition at line 404 of file node_file.cc.

Referenced by node::FillStatsArray().

◆ SYNC_REQ

#define SYNC_REQ   req_wrap.req

Definition at line 418 of file node_file.cc.

Referenced by node::FillStatsArray().

◆ SYNC_RESULT

#define SYNC_RESULT   err

Definition at line 420 of file node_file.cc.

Referenced by node::FillStatsArray().

◆ TYPE_ERROR

#define TYPE_ERROR (   msg)    env->ThrowTypeError(msg)

Definition at line 70 of file node_file.cc.

Referenced by node::FillStatsArray().

◆ X

#define X (   idx,
  name 
)
Value:
/* NOLINTNEXTLINE(runtime/int) */ \
fields[idx] = ((unsigned long)(s->st_##name.tv_sec) * 1e3) + \
/* NOLINTNEXTLINE(runtime/int) */ \
((unsigned long)(s->st_##name.tv_nsec) / 1e6); \
dtrace s
Definition: v8ustack.d:615

Variable Documentation

◆ encoding_

enum encoding encoding_

Definition at line 96 of file node_file.cc.

◆ req