diff options
author | marcel <marcel@FreeBSD.org> | 1999-08-11 13:34:31 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 1999-08-11 13:34:31 +0000 |
commit | be49f50ba7be1e1be51185bcb3705faef02d77f6 (patch) | |
tree | a904f328efafcd3524e191098da170b09e3cfbf7 /sys/compat | |
parent | 948efc5df127915f75fbdb4f28bd48a60d0e5e7b (diff) | |
download | FreeBSD-src-be49f50ba7be1e1be51185bcb3705faef02d77f6.zip FreeBSD-src-be49f50ba7be1e1be51185bcb3705faef02d77f6.tar.gz |
Do not map {s|g}etrlimit onto FreeBSD syscalls. The arguments don't match.
The linux syscalls translate the arguments first before invoking the
FreeBSD native syscalls.
PR: kern/9591
Originator: John Plevyak <jplevyak@inktomi.com>
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_misc.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 4efbf2e..a822beb 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.59 1999/07/05 19:18:03 marcel Exp $ + * $Id: linux_misc.c,v 1.60 1999/08/08 11:26:46 marcel Exp $ */ #include <sys/param.h> @@ -60,6 +60,15 @@ #include <i386/linux/linux_proto.h> #include <i386/linux/linux_util.h> +int osetrlimit __P((struct proc*, struct linux_setrlimit_args*)); +int ogetrlimit __P((struct proc*, struct linux_getrlimit_args*)); + +static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = +{ RLIMIT_CPU, RLIMIT_FSIZE, RLIMIT_DATA, RLIMIT_STACK, + RLIMIT_CORE, RLIMIT_RSS, RLIMIT_NPROC, RLIMIT_NOFILE, + RLIMIT_MEMLOCK, -1 +}; + int linux_alarm(struct proc *p, struct linux_alarm_args *args) { @@ -1198,3 +1207,45 @@ linux_getgroups(p, uap) p->p_retval[0] = ngrp; return (0); } + +int +linux_setrlimit(p, uap) + struct proc *p; + struct linux_setrlimit_args *uap; +{ +#ifdef DEBUG + printf("Linux-emul(%ld): setrlimit(%d, %p)\n", + (long)p->p_pid, uap->resource, (void *)uap->rlim); +#endif + + if (uap->resource >= LINUX_RLIM_NLIMITS) + return EINVAL; + + uap->resource = linux_to_bsd_resource[uap->resource]; + + if (uap->resource == -1) + return EINVAL; + + return osetrlimit(p, uap); +} + +int +linux_getrlimit(p, uap) + struct proc *p; + struct linux_getrlimit_args *uap; +{ +#ifdef DEBUG + printf("Linux-emul(%ld): getrlimit(%d, %p)\n", + (long)p->p_pid, uap->resource, (void *)uap->rlim); +#endif + + if (uap->resource >= LINUX_RLIM_NLIMITS) + return EINVAL; + + uap->resource = linux_to_bsd_resource[uap->resource]; + + if (uap->resource == -1) + return EINVAL; + + return ogetrlimit(p, uap); +} |