From 6ba73f21a56c72fd4dcb81ee6371fdff6621de68 Mon Sep 17 00:00:00 2001 From: marcel Date: Sun, 15 Aug 1999 13:28:35 +0000 Subject: [PATCH] Include opt_compat.h so that COMPAT_43 is defined. This gives us the proper prototypes of o{s|g}etrlimit (from sys/sysproto.h). Update linux_{s|g}etrlimit so that the arguments to o{s|g}etrlimit are corresponding the prototypes. Pointed out by: bde --- sys/compat/linux/linux_misc.c | 25 +++++++++++++++---------- sys/i386/linux/linux_misc.c | 25 +++++++++++++++---------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index a822beb341d9..7d88cb10196a 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -25,9 +25,11 @@ * (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.60 1999/08/08 11:26:46 marcel Exp $ + * $Id: linux_misc.c,v 1.61 1999/08/11 13:34:30 marcel Exp $ */ +#include "opt_compat.h" + #include #include #include @@ -60,9 +62,6 @@ #include #include -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, @@ -1213,6 +1212,8 @@ linux_setrlimit(p, uap) struct proc *p; struct linux_setrlimit_args *uap; { + struct osetrlimit_args bsd; + #ifdef DEBUG printf("Linux-emul(%ld): setrlimit(%d, %p)\n", (long)p->p_pid, uap->resource, (void *)uap->rlim); @@ -1221,12 +1222,13 @@ linux_setrlimit(p, uap) if (uap->resource >= LINUX_RLIM_NLIMITS) return EINVAL; - uap->resource = linux_to_bsd_resource[uap->resource]; + bsd.which = linux_to_bsd_resource[uap->resource]; - if (uap->resource == -1) + if (bsd.which == -1) return EINVAL; - return osetrlimit(p, uap); + bsd.rlp = uap->rlim; + return osetrlimit(p, &bsd); } int @@ -1234,6 +1236,8 @@ linux_getrlimit(p, uap) struct proc *p; struct linux_getrlimit_args *uap; { + struct ogetrlimit_args bsd; + #ifdef DEBUG printf("Linux-emul(%ld): getrlimit(%d, %p)\n", (long)p->p_pid, uap->resource, (void *)uap->rlim); @@ -1242,10 +1246,11 @@ linux_getrlimit(p, uap) if (uap->resource >= LINUX_RLIM_NLIMITS) return EINVAL; - uap->resource = linux_to_bsd_resource[uap->resource]; + bsd.which = linux_to_bsd_resource[uap->resource]; - if (uap->resource == -1) + if (bsd.which == -1) return EINVAL; - return ogetrlimit(p, uap); + bsd.rlp = uap->rlim; + return ogetrlimit(p, &bsd); } diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c index a822beb341d9..7d88cb10196a 100644 --- a/sys/i386/linux/linux_misc.c +++ b/sys/i386/linux/linux_misc.c @@ -25,9 +25,11 @@ * (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.60 1999/08/08 11:26:46 marcel Exp $ + * $Id: linux_misc.c,v 1.61 1999/08/11 13:34:30 marcel Exp $ */ +#include "opt_compat.h" + #include #include #include @@ -60,9 +62,6 @@ #include #include -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, @@ -1213,6 +1212,8 @@ linux_setrlimit(p, uap) struct proc *p; struct linux_setrlimit_args *uap; { + struct osetrlimit_args bsd; + #ifdef DEBUG printf("Linux-emul(%ld): setrlimit(%d, %p)\n", (long)p->p_pid, uap->resource, (void *)uap->rlim); @@ -1221,12 +1222,13 @@ linux_setrlimit(p, uap) if (uap->resource >= LINUX_RLIM_NLIMITS) return EINVAL; - uap->resource = linux_to_bsd_resource[uap->resource]; + bsd.which = linux_to_bsd_resource[uap->resource]; - if (uap->resource == -1) + if (bsd.which == -1) return EINVAL; - return osetrlimit(p, uap); + bsd.rlp = uap->rlim; + return osetrlimit(p, &bsd); } int @@ -1234,6 +1236,8 @@ linux_getrlimit(p, uap) struct proc *p; struct linux_getrlimit_args *uap; { + struct ogetrlimit_args bsd; + #ifdef DEBUG printf("Linux-emul(%ld): getrlimit(%d, %p)\n", (long)p->p_pid, uap->resource, (void *)uap->rlim); @@ -1242,10 +1246,11 @@ linux_getrlimit(p, uap) if (uap->resource >= LINUX_RLIM_NLIMITS) return EINVAL; - uap->resource = linux_to_bsd_resource[uap->resource]; + bsd.which = linux_to_bsd_resource[uap->resource]; - if (uap->resource == -1) + if (bsd.which == -1) return EINVAL; - return ogetrlimit(p, uap); + bsd.rlp = uap->rlim; + return ogetrlimit(p, &bsd); }