Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jul 2010 18:05:47 +0400
From:      pluknet <pluknet@gmail.com>
To:        Gabor Kovesdan <gabor@freebsd.org>
Cc:        Dimitry Andric <dimitry@andric.com>, FreeBSD Hackers <hackers@freebsd.org>
Subject:   Re: strange problem with int64_t variables
Message-ID:  <AANLkTinwsNqH19LF7CAc6uC2NZuh2CdCkfEtsv6yM2Bt@mail.gmail.com>
In-Reply-To: <4C3AF87B.3030707@FreeBSD.org>
References:  <4C39D92F.4050605@FreeBSD.org> <4C39DB09.6010808@andric.com> <4C39DBFF.2000307@FreeBSD.org> <AANLkTilqEfe_EL_3ExodMgqfmU-DubIdlRs-5NXXT4dO@mail.gmail.com> <4C3AF87B.3030707@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 12 July 2010 15:11, Gabor Kovesdan <gabor@freebsd.org> wrote:
> Em 2010.07.12. 9:00, pluknet escreveu:
>>
>> Looking at getjid() impl, I see you're trying to put jid_t into the
>> one register_t
>> which are 64-bit vs 32-bit capable respectively.
>> You need to cast so you put 64-bit into two 32-bit as done for e.g.
>> lseek().
>>
>
> Thanks for pointing this out, probably this was the problem, I'll try lat=
er
> because for now, I switched to 32-bit jid_t and that part works but there=
's
> other similar problem now:
>
> +int
> +setjlimit(struct thread *td, struct setjlimit_args *uap)
> +{
> + =A0 =A0 =A0 struct jobentry *jp;
> +
> + =A0 =A0 =A0 /* sanity check */
> + =A0 =A0 =A0 if (uap->resource>=3D JLIMIT_NLIMITS) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 td->td_retval[0] =3D -1;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (EINVAL);
> + =A0 =A0 =A0 }
>
> ...
>
> The rest is just generated code with make sysent.
>
> I call this with resource parameter set to JLIMIT_NUMPROC (whose value is=
 3)
> and then inside the function it is seen as 869787392, so I always get
> EINVAL. In this case resource is just a normal int so I don't know what's
> going wrong.
>

Hmm.. something on your side.

# ./setjlimit_test
setjlimit returns zero

on console:
setjlimit called
resource: 3


#ifndef _SYS_SYSPROTO_H_
struct setjlimit_args {
        jid_t   jid;
        int     resource;
        struct rlimit *rlp;
};
#endif
int
setjlimit(td, uap)
        struct thread *td;
        struct setjlimit_args /* {
                jid_t   jid;
                int     resource;
                struct rlimit *rlp;
        } */ *uap;
{

        printf("%s called\n", __FUNCTION__);

        printf("resource: %d\n", uap->resource);
        if (uap->resource >=3D JLIM_NLIMITS) {
                td->td_retval[0] =3D -1;
                return (EINVAL);
        }
        return (0);
}

--=20
wbr,
pluknet



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinwsNqH19LF7CAc6uC2NZuh2CdCkfEtsv6yM2Bt>