diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 1999-08-11 13:34:31 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 1999-08-11 13:34:31 +0000 |
commit | 175db64b3ebe740c58607b07c00b819bd67e2073 (patch) | |
tree | 27fdf5b689065d42c7195c05385d5f37ef8c784b /sys/i386/linux/linux_misc.c | |
parent | 10ef1b2aae129e792ba9cf05644ef552ed1eb762 (diff) | |
download | src-175db64b3ebe740c58607b07c00b819bd67e2073.tar.gz src-175db64b3ebe740c58607b07c00b819bd67e2073.zip |
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>
Notes
Notes:
svn path=/head/; revision=49626
Diffstat (limited to 'sys/i386/linux/linux_misc.c')
-rw-r--r-- | sys/i386/linux/linux_misc.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c index 4efbf2eef02b..a822beb341d9 100644 --- a/sys/i386/linux/linux_misc.c +++ b/sys/i386/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); +} |