feat: extend ulib with userRmdir and userChmod
This commit is contained in:
1 parent
fa03edc4a5
commit
35e00e4153
1 file changed
+205
+205
@@ -126,6 +126,211 @@ long userUnlink(const char* path)
|
|||||||
return syscall3(sysUnlink, (long)path, 0, 0);
|
return syscall3(sysUnlink, (long)path, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long userRmdir(const char* path)
|
||||||
|
{
|
||||||
|
return syscall3(sysRmdir, (long)path, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userChmod(const char* path, unsigned int mode)
|
||||||
|
{
|
||||||
|
return syscall3(sysChmod, (long)path, (long)mode, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userChown(const char* path, unsigned int uid)
|
||||||
|
{
|
||||||
|
return syscall3(sysChown, (long)path, (long)uid, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userGetuid(void)
|
||||||
|
{
|
||||||
|
return syscall3(sysGetuid, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userSetuid(unsigned int uid)
|
||||||
|
{
|
||||||
|
return syscall3(sysSetuid, (long)uid, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userGetgid(void)
|
||||||
|
{
|
||||||
|
return syscall3(sysGetgid, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userSetgid(unsigned int gid)
|
||||||
|
{
|
||||||
|
return syscall3(sysSetgid, (long)gid, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userChgrp(const char* path, unsigned int gid)
|
||||||
|
{
|
||||||
|
return syscall3(sysChgrp, (long)path, (long)gid, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userChdir(const char* path)
|
||||||
|
{
|
||||||
|
return syscall3(sysChdir, (long)path, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userGetcwd(char* buffer, unsigned long cap)
|
||||||
|
{
|
||||||
|
return syscall3(sysGetcwd, (long)buffer, (long)cap, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userGetEnv(const char* name, char* buffer, unsigned long cap)
|
||||||
|
{
|
||||||
|
return syscall3(sysGetEnv, (long)name, (long)buffer, (long)cap);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userSetEnv(const char* name, const char* value)
|
||||||
|
{
|
||||||
|
return syscall3(sysSetEnv, (long)name, (long)value, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userUnsetEnv(const char* name)
|
||||||
|
{
|
||||||
|
return syscall3(sysUnsetEnv, (long)name, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userPipe(int fds[2])
|
||||||
|
{
|
||||||
|
return syscall3(sysPipe, (long)fds, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userPipeCreate(void)
|
||||||
|
{
|
||||||
|
return syscall3(sysPipeCreate, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userPipeAttach(long handle, int wantWrite)
|
||||||
|
{
|
||||||
|
return syscall3(sysPipeAttach, handle, wantWrite, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userSymlink(const char* target, const char* path)
|
||||||
|
{
|
||||||
|
return syscall3(sysSymlink, (long)target, (long)path, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userReadlink(const char* path, char* buffer, unsigned long cap)
|
||||||
|
{
|
||||||
|
return syscall3(sysReadlink, (long)path, (long)buffer, (long)cap);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userLink(const char* existingPath, const char* newPath)
|
||||||
|
{
|
||||||
|
return syscall3(sysLink, (long)existingPath, (long)newPath, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userMkfifo(const char* path)
|
||||||
|
{
|
||||||
|
return syscall3(sysMkfifo, (long)path, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userExec(const char* path, char* const argv[])
|
||||||
|
{
|
||||||
|
return syscall3(sysExec, (long)path, (long)argv, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userSpawn(const char* path, char* const argv[])
|
||||||
|
{
|
||||||
|
return syscall3(sysSpawn, (long)path, (long)argv, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userWait(long pid)
|
||||||
|
{
|
||||||
|
return syscall3(sysWait, pid, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userWaitAny(long* outPid)
|
||||||
|
{
|
||||||
|
return syscall3(sysWait, (long)waitAnyPid, (long)outPid, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userKill(long pid)
|
||||||
|
{
|
||||||
|
return syscall3(sysKill, pid, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userSigSend(long pid, int signum)
|
||||||
|
{
|
||||||
|
return syscall3(sysSigSend, pid, signum, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userPidfdOpen(long pid)
|
||||||
|
{
|
||||||
|
return syscall3(sysPidfdOpen, pid, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userPidfdSend(long fd, int signum)
|
||||||
|
{
|
||||||
|
return syscall3(sysPidfdSend, fd, signum, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userPidfdWait(long fd)
|
||||||
|
{
|
||||||
|
return syscall3(sysPidfdWait, fd, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void* userMmap(void* addrHint, unsigned long length, int prot, int flags, int fd, long offset)
|
||||||
|
{
|
||||||
|
return (void*)syscall6(sysMmap, (long)addrHint, (long)length, prot, flags, fd, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userMunmap(void* addr, unsigned long length)
|
||||||
|
{
|
||||||
|
return syscall3(sysMunmap, (long)addr, (long)length, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userSigAction(int signum, SigHandler handler, unsigned long mask, unsigned long flags)
|
||||||
|
{
|
||||||
|
return syscall4(sysSigAction, signum, (long)handler, (long)mask, (long)flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userSigActionInfo(int signum, SigInfoHandler handler, unsigned long mask, unsigned long flags)
|
||||||
|
{
|
||||||
|
return syscall4(sysSigAction, signum, (long)handler, (long)mask, (long)flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long userSigProcMask(int how, unsigned long mask)
|
||||||
|
{
|
||||||
|
return (unsigned long)syscall3(sysSigProcMask, how, (long)mask, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userSetpgid(long pid, long pgid)
|
||||||
|
{
|
||||||
|
return syscall3(sysSetpgid, pid, pgid, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userGetpgid(long pid)
|
||||||
|
{
|
||||||
|
return syscall3(sysGetpgid, pid, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userNice(long pid, long weight)
|
||||||
|
{
|
||||||
|
return syscall3(sysNice, pid, weight, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userGetPriority(long pid)
|
||||||
|
{
|
||||||
|
return syscall3(sysGetPriority, pid, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userTime(void)
|
||||||
|
{
|
||||||
|
return syscall3(sysTime, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userSetForegroundPgid(long pgid)
|
||||||
|
{
|
||||||
|
return syscall3(sysSetFgPgrp, pgid, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
long userGetForegroundPgid(void)
|
||||||
|
{
|
||||||
|
return syscall3(sysGetFgPgrp, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned long stringLength(const char* text)
|
unsigned long stringLength(const char* text)
|
||||||
{
|
{
|
||||||
unsigned long length = 0;
|
unsigned long length = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user