mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Add getrlimit(3) and setrlimit(3).
This commit is contained in:
parent
13f09cc515
commit
7a5e549612
4 changed files with 70 additions and 0 deletions
|
@ -309,8 +309,10 @@ sys/mman/mprotect.o \
|
||||||
sys/mman/munmap.o \
|
sys/mman/munmap.o \
|
||||||
sys/readdirents/readdirents.o \
|
sys/readdirents/readdirents.o \
|
||||||
sys/resource/getpriority.o \
|
sys/resource/getpriority.o \
|
||||||
|
sys/resource/getrlimit.o \
|
||||||
sys/resource/prlimit.o \
|
sys/resource/prlimit.o \
|
||||||
sys/resource/setpriority.o \
|
sys/resource/setpriority.o \
|
||||||
|
sys/resource/setrlimit.o \
|
||||||
sys/select/select.o \
|
sys/select/select.o \
|
||||||
sys/socket/accept4.o \
|
sys/socket/accept4.o \
|
||||||
sys/socket/accept.o \
|
sys/socket/accept.o \
|
||||||
|
|
|
@ -34,8 +34,10 @@ __BEGIN_DECLS
|
||||||
@include(pid_t.h)
|
@include(pid_t.h)
|
||||||
|
|
||||||
int getpriority(int, id_t);
|
int getpriority(int, id_t);
|
||||||
|
int getrlimit(int, struct rlimit*);
|
||||||
int prlimit(pid_t, int, const struct rlimit*, struct rlimit*);
|
int prlimit(pid_t, int, const struct rlimit*, struct rlimit*);
|
||||||
int setpriority(int, id_t, int);
|
int setpriority(int, id_t, int);
|
||||||
|
int setrlimit(int, const struct rlimit*);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
33
libc/sys/resource/getrlimit.cpp
Normal file
33
libc/sys/resource/getrlimit.cpp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
sys/resource/getrlimit.cpp
|
||||||
|
Get the resource limits of the current process.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
extern "C" int getrlimit(int resource, struct rlimit* limit)
|
||||||
|
{
|
||||||
|
return prlimit(0, resource, NULL, limit);
|
||||||
|
}
|
33
libc/sys/resource/setrlimit.cpp
Normal file
33
libc/sys/resource/setrlimit.cpp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
sys/resource/setrlimit.cpp
|
||||||
|
Set the resource limits of the current process.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
extern "C" int setrlimit(int resource, const struct rlimit* limit)
|
||||||
|
{
|
||||||
|
return prlimit(0, resource, limit, NULL);
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue