JL_DLLEXPORT int jl_fs_chmod(char *path, int mode) { uv_fs_t req; int ret = uv_fs_chmod(jl_io_loop, &req, path, mode, NULL); uv_fs_req_cleanup(&req); return ret; }
/* * fs.chmod */ static int fs_chmod(lua_State* L) { FSR__SETUP const char *path = luaL_checkstring(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_chmod(loop, req, path, mode, cb); FSR__TEARDOWN }
void MVM_file_chmod(MVMThreadContext *tc, MVMString *f, MVMint64 flag) { char * const a = MVM_string_utf8_encode_C_string(tc, f); uv_fs_t req; if(uv_fs_chmod(tc->loop, &req, a, flag, NULL) < 0 ) { MVM_free(a); MVM_exception_throw_adhoc(tc, "Failed to set permissions on path: %s", uv_strerror(req.result)); } MVM_free(a); }
int os_setperm(const char_u *name, int perm) { uv_fs_t request; int result = uv_fs_chmod(uv_default_loop(), &request, (const char*)name, perm, NULL); uv_fs_req_cleanup(&request); if (result != 0) { return FAIL; } else { return OK; } }