Ejemplo n.º 1
0
/*
 * fs.fchmod
 */
static int fs_fchmod(lua_State* L) {
  FSR__SETUP
  int fd = luaL_checkint(L, 1);
  const char *mode_str = luaL_checkstring(L, 2);
  int mode = strtol(mode_str, (char**) NULL, 8);
  FSR__SET_OPT_CB(3, on_fs_callback)
  uv_fs_fchmod(loop, req, fd, mode, cb);
  FSR__TEARDOWN
}
Ejemplo n.º 2
0
static int lluv_file_chmod(lua_State* L) {
  const char  *path = NULL;
  lluv_file_t *f    = lluv_check_file(L, 1, LLUV_FLAG_OPEN);
  lluv_loop_t *loop = f->loop;
  int         mode  = (int)luaL_checkinteger(L, 2);
  int         argc  = 2;

  LLUV_PRE_FILE();
  lua_pushvalue(L, 1);
  req->file_ref = luaL_ref(L, LLUV_LUA_REGISTRY);
  err = uv_fs_fchmod(loop->handle, &req->req, f->handle, mode, cb);
  LLUV_POST_FILE();
}