mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:37:43 +00:00
LibC: Move shbuf_* implementations to serenity.cpp
This commit is contained in:
parent
dcd619bd46
commit
6321b6ecc0
2 changed files with 40 additions and 40 deletions
|
@ -84,4 +84,44 @@ int perf_event(int type, uintptr_t arg1, uintptr_t arg2)
|
||||||
int rc = syscall(SC_perf_event, type, arg1, arg2);
|
int rc = syscall(SC_perf_event, type, arg1, arg2);
|
||||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* shbuf_get(int shbuf_id, size_t* size)
|
||||||
|
{
|
||||||
|
int rc = syscall(SC_shbuf_get, shbuf_id, size);
|
||||||
|
if (rc < 0 && -rc < EMAXERRNO) {
|
||||||
|
errno = -rc;
|
||||||
|
return (void*)-1;
|
||||||
|
}
|
||||||
|
return (void*)rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int shbuf_release(int shbuf_id)
|
||||||
|
{
|
||||||
|
int rc = syscall(SC_shbuf_release, shbuf_id);
|
||||||
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int shbuf_seal(int shbuf_id)
|
||||||
|
{
|
||||||
|
int rc = syscall(SC_shbuf_seal, shbuf_id);
|
||||||
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int shbuf_create(int size, void** buffer)
|
||||||
|
{
|
||||||
|
int rc = syscall(SC_shbuf_create, size, buffer);
|
||||||
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int shbuf_allow_pid(int shbuf_id, pid_t peer_pid)
|
||||||
|
{
|
||||||
|
int rc = syscall(SC_shbuf_allow_pid, shbuf_id, peer_pid);
|
||||||
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int shbuf_allow_all(int shbuf_id)
|
||||||
|
{
|
||||||
|
int rc = syscall(SC_shbuf_allow_all, shbuf_id);
|
||||||
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -529,52 +529,12 @@ void sync()
|
||||||
syscall(SC_sync);
|
syscall(SC_sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
int shbuf_create(int size, void** buffer)
|
|
||||||
{
|
|
||||||
int rc = syscall(SC_shbuf_create, size, buffer);
|
|
||||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int shbuf_allow_pid(int shbuf_id, pid_t peer_pid)
|
|
||||||
{
|
|
||||||
int rc = syscall(SC_shbuf_allow_pid, shbuf_id, peer_pid);
|
|
||||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int shbuf_allow_all(int shbuf_id)
|
|
||||||
{
|
|
||||||
int rc = syscall(SC_shbuf_allow_all, shbuf_id);
|
|
||||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int set_process_icon(int icon_id)
|
int set_process_icon(int icon_id)
|
||||||
{
|
{
|
||||||
int rc = syscall(SC_set_process_icon, icon_id);
|
int rc = syscall(SC_set_process_icon, icon_id);
|
||||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* shbuf_get(int shbuf_id, size_t* size)
|
|
||||||
{
|
|
||||||
int rc = syscall(SC_shbuf_get, shbuf_id, size);
|
|
||||||
if (rc < 0 && -rc < EMAXERRNO) {
|
|
||||||
errno = -rc;
|
|
||||||
return (void*)-1;
|
|
||||||
}
|
|
||||||
return (void*)rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
int shbuf_release(int shbuf_id)
|
|
||||||
{
|
|
||||||
int rc = syscall(SC_shbuf_release, shbuf_id);
|
|
||||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int shbuf_seal(int shbuf_id)
|
|
||||||
{
|
|
||||||
int rc = syscall(SC_shbuf_seal, shbuf_id);
|
|
||||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
char* getlogin()
|
char* getlogin()
|
||||||
{
|
{
|
||||||
static char __getlogin_buffer[256];
|
static char __getlogin_buffer[256];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue