Esempio n. 1
0
/// Changes the ownership of the file referred to by the open file descriptor.
///
/// @return `0` on success, a libuv error code on failure.
///
/// @note If the `owner` or `group` is specified as `-1`, then that ID is not
/// changed.
int os_fchown(int file_descriptor, uv_uid_t owner, uv_gid_t group)
{
  uv_fs_t request;
  int result = uv_fs_fchown(uv_default_loop(), &request, file_descriptor,
                            owner, group, NULL);
  uv_fs_req_cleanup(&request);
  return result;
}
Esempio n. 2
0
/*
 * fs.fchown
 */
static int fs_fchown(lua_State* L) {
  FSR__SETUP
  int fd = luaL_checkint(L, 1);
  int uid = luaL_checkint(L, 2);
  int gid = luaL_checkint(L, 3);
  FSR__SET_OPT_CB(4, on_fs_callback)
  uv_fs_fchown(loop, req, fd, uid, gid, cb);
  FSR__TEARDOWN
}
Esempio n. 3
0
static int lluv_file_chown(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;
  uv_uid_t     uid  = (uv_uid_t)lutil_checkint64(L, 2);
  uv_gid_t     gid  = (uv_gid_t)lutil_checkint64(L, 3);
  int         argc  = 3;

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