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
This commit is contained in:
marcel 1999-08-15 13:28:35 +00:00
parent 3b32edfe60
commit 6ba73f21a5
2 changed files with 30 additions and 20 deletions

View File

@ -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 <sys/param.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
@ -60,9 +62,6 @@
#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,
@ -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);
}

View File

@ -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 <sys/param.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
@ -60,9 +62,6 @@
#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,
@ -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);
}