Example #1
0
int luv_fs_futime(lua_State* L) {
  uv_file file = luaL_checkint(L, 1);
  double atime = luaL_checknumber(L, 2);
  double mtime = luaL_checknumber(L, 3);
  uv_fs_t* req = luv_fs_store_callback(L, 4);
  FS_CALL(futime, 4, NULL, file, atime, mtime);
}
Example #2
0
int luv_fs_utime(lua_State* L) {
  const char* path = luaL_checkstring(L, 1);
  double atime = luaL_checknumber(L, 2);
  double mtime = luaL_checknumber(L, 3);
  uv_fs_t* req = luv_fs_store_callback(L, 4);
  FS_CALL(utime, 4, path, path, atime, mtime);
}
Example #3
0
int luv_fs_open(lua_State* L) {
  const char* path = luaL_checkstring(L, 1);
  int flags = luv_string_to_flags(L, luaL_checkstring(L, 2));
  int mode = luaL_checkint(L, 3);
  uv_fs_t* req = luv_fs_store_callback(L, 4);
  FS_CALL(open, 4, path, path, flags, mode);
}
Example #4
0
int luv_fs_symlink(lua_State* L) {
  const char* path = luaL_checkstring(L, 1);
  const char* new_path = luaL_checkstring(L, 2);
  int flags = luv_string_to_flags(L, luaL_checkstring(L, 3));
  uv_fs_t* req = luv_fs_store_callback(L, 4);
  FS_CALL(symlink, 4, new_path, path, new_path, flags);
}
Example #5
0
int luv_fs_chown(lua_State* L) {
  const char* path = luaL_checkstring(L, 1);
  int uid = luaL_checkint(L, 2);
  int gid = luaL_checkint(L, 3);
  uv_fs_t* req = luv_fs_store_callback(L, 4);
  FS_CALL(chown, 4, path, path, uid, gid);
}
Example #6
0
int luv_fs_fchown(lua_State* L) {
  uv_file file = luaL_checkint(L, 1);
  int uid = luaL_checkint(L, 2);
  int gid = luaL_checkint(L, 3);
  uv_fs_t* req = luv_fs_store_callback(L, 4);
  FS_CALL(fchown, 4, NULL, file, uid, gid);
}
Example #7
0
File: luv_fs.c Project: nko/luvit
int luv_fs_write(lua_State* L) {
    uv_file file = luaL_checkint(L, 1);
    off_t offset = luaL_checkint(L, 2);
    size_t length;
    void* chunk = (void*)luaL_checklstring(L, 3, &length);
    uv_fs_t* req = luv_fs_store_callback(L, 4);
    FS_CALL(write, 4, NULL, file, chunk, length, offset);
}
Example #8
0
int luv_fs_sendfile(lua_State* L) {
  uv_file out_fd = luaL_checkint(L, 1);
  uv_file in_fd = luaL_checkint(L, 2);
  off_t in_offset = luaL_checkint(L, 3);
  size_t length = luaL_checkint(L, 4);
  uv_fs_t* req = luv_fs_store_callback(L, 5);
  FS_CALL(sendfile, 5, NULL, out_fd, in_fd, in_offset, length);
}
Example #9
0
File: luv_fs.c Project: nko/luvit
int luv_fs_read(lua_State* L) {
    uv_file file = luaL_checkint(L, 1);
    int offset = luaL_checkint(L, 2);
    int length = luaL_checkint(L, 3);
    uv_fs_t* req = luv_fs_store_callback(L, 4);
    void* buf = malloc(length);
    ((luv_fs_ref_t*)req->data)->buf = buf;
    FS_CALL(read, 4, NULL, file, buf, length, offset);
}
Example #10
0
int luv_fs_read(lua_State* L) {
  uv_file file = luaL_checkint(L, 1);
  int offset = -1;
  int length;
  uv_fs_t* req;
  void* buf;
  if (!lua_isnil(L, 2)) {
    offset = luaL_checkint(L, 2);
  }
  length = luaL_checkint(L, 3);
  req = luv_fs_store_callback(L, 4);
  buf = malloc(length);
  ((luv_fs_ref_t*)req->data)->buf = buf;
  
  uv_buf_t bufs[1];
  bufs[0].base = buf;
  bufs[0].len = length;
  
  FS_CALL(read, 4, NULL, file, bufs, 1, offset);
}
Example #11
0
int luv_fs_chmod(lua_State* L) {
  const char* path = luaL_checkstring(L, 1);
  int mode = strtoul(luaL_checkstring(L, 2), NULL, 8);
  uv_fs_t* req = luv_fs_store_callback(L, 3);
  FS_CALL(chmod, 3, path, path, mode);
}
Example #12
0
int luv_fs_readlink(lua_State* L) {
  const char* path = luaL_checkstring(L, 1);
  uv_fs_t* req = luv_fs_store_callback(L, 2);
  FS_CALL(readlink, 2, path, path);
}
Example #13
0
int luv_fs_fchmod(lua_State* L) {
  uv_file file = luaL_checkint(L, 1);
  int mode = strtoul(luaL_checkstring(L, 2), NULL, 8);
  uv_fs_t* req = luv_fs_store_callback(L, 3);
  FS_CALL(fchmod, 3, NULL, file, mode);
}
Example #14
0
int luv_fs_readdir(lua_State* L) {
  const char* path = luaL_checkstring(L, 1);
  int flags = luaL_checkint(L, 2);
  uv_fs_t* req = luv_fs_store_callback(L, 3);
  FS_CALL(scandir, 2, path, path, flags);
}
Example #15
0
int luv_fs_link(lua_State* L) {
  const char* path = luaL_checkstring(L, 1);
  const char* new_path = luaL_checkstring(L, 2);
  uv_fs_t* req = luv_fs_store_callback(L, 3);
  FS_CALL(link, 3, path, path, new_path);
}
Example #16
0
int luv_fs_close(lua_State* L) {
  uv_file file = luaL_checkint(L, 1);
  uv_fs_t* req = luv_fs_store_callback(L, 2);
  FS_CALL(close, 2, NULL, file);
}
Example #17
0
int luv_fs_fdatasync(lua_State* L) {
  uv_file file = luaL_checkint(L, 1);
  uv_fs_t* req = luv_fs_store_callback(L, 2);
  FS_CALL(fdatasync, 2, NULL, file);
}
Example #18
0
int luv_fs_ftruncate(lua_State* L) {
  uv_file file = luaL_checkint(L, 1);
  off_t offset = luaL_checkint(L, 2);
  uv_fs_t* req = luv_fs_store_callback(L, 3);
  FS_CALL(ftruncate, 3, NULL, file, offset);
}