strange problem with int64_t variables
pluknet
pluknet at gmail.com
Tue Jul 13 14:05:51 UTC 2010
On 12 July 2010 15:11, Gabor Kovesdan <gabor at 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 later
> 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)
> +{
> + struct jobentry *jp;
> +
> + /* sanity check */
> + if (uap->resource>= JLIMIT_NLIMITS) {
> + td->td_retval[0] = -1;
> + return (EINVAL);
> + }
>
> ...
>
> 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 >= JLIM_NLIMITS) {
td->td_retval[0] = -1;
return (EINVAL);
}
return (0);
}
--
wbr,
pluknet
More information about the freebsd-hackers
mailing list