strange problem with int64_t variables

pluknet pluknet at gmail.com
Fri Jul 16 10:17:39 UTC 2010


On 16 July 2010 01:42, Gabor Kovesdan <gabor at freebsd.org> wrote:
> Em 2010.07.13. 16:05, pluknet escreveu:
>>
>> #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);
>> }
>>
>
> Thanks for trying this out. I still couldn't find the problem. Is this
> generate code? I mean the prototype of the function. I'm using C99 syntax
> and I manually added the implementation, the generated code what I'm using
> is just what make sysent generated. Besides, the generated code in
> sysproto.h is different from this struct that you have here, there are
> padding members, as well:
>
> +struct setjlimit_args {
> +       char jid_l_[PADL_(__jid_t)]; __jid_t jid; char
> jid_r_[PADR_(__jid_t)];
> +       char resource_l_[PADL_(int)]; int resource; char
> resource_r_[PADR_(int)];
> +       char rlp_l_[PADL_(struct rlimit *)]; struct rlimit * rlp; char
> rlp_r_[PADR_(struct rlimit *)];
> +};
>

>
> And what do you have in syscalls.master? Is it the same as I have?
>
> +527    AUE_NULL        STD     { int setjlimit(__jid_t jid, int resource, \
> +                                   struct rlimit *rlp); }

Almost the same (#__jid_t#jid_t#).

struct setjlimit_args {
        char jid_l_[PADL_(jid_t)]; jid_t jid; char jid_r_[PADR_(jid_t)];
        char resource_l_[PADL_(int)]; int resource; char
resource_r_[PADR_(int)];
        char rlp_l_[PADL_(struct rlimit *)]; struct rlimit * rlp; char
rlp_r_[PADR_(struct rlimit *)];
};

526     AUE_NULL        STD     { int setjlimit(jid_t jid, int resource, \
                                    struct rlimit *rlp); }

The difference (and probably a trigger of bug elsewhere) might be in
that this lives
on amd64 arch (while yours on i386 afair). Just a food for thoughts.

-- 
wbr,
pluknet


More information about the freebsd-hackers mailing list