strange problem with int64_t variables

Gabor Kovesdan gabor at FreeBSD.org
Mon Jul 12 11:12:03 UTC 2010


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.

Gabor



More information about the freebsd-hackers mailing list