From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 13 14:05:51 2010 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB9891065673; Tue, 13 Jul 2010 14:05:50 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 546A68FC16; Tue, 13 Jul 2010 14:05:49 +0000 (UTC) Received: by wwc33 with SMTP id 33so251365wwc.31 for ; Tue, 13 Jul 2010 07:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=8PVawZ8ZeOEYS26N5WiLQYtj9GlSV8aYt6N0XBEw558=; b=G3Xz4Hsl7gQKPSusBmqAkgS7PbQ+wu83yaMcf2zGpjE62K4F0UB7LeNzgjH4Ufb74K trWm2Y4w9Tsf6Wig4JE4KO4MnhR8+wuSUwrYdcHHNtqcYVEgl4AhdkqcHt6HsG5a4tXU WX8I0XgPQweOreNcHLRhAsTTo2rJwzmumXphk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=J9aexm3lC7y1MSrE1LFW+Mv9g+z0bF0dd1pSNshblT7XH/FfGBLrIIVCNVD4WxEuf7 b6cCUVDKaP7Yix3Q3XC3eAtSmgL4VU1mgwDExLZSMsfrFJC04JlbwBfoiOMZWRrkNHsn ythxZ0sXaNwUyw8f8QrCCyyJH65TJtR+MnQiA= MIME-Version: 1.0 Received: by 10.216.180.131 with SMTP id j3mr10244004wem.107.1279029947831; Tue, 13 Jul 2010 07:05:47 -0700 (PDT) Received: by 10.216.27.13 with HTTP; Tue, 13 Jul 2010 07:05:47 -0700 (PDT) In-Reply-To: <4C3AF87B.3030707@FreeBSD.org> References: <4C39D92F.4050605@FreeBSD.org> <4C39DB09.6010808@andric.com> <4C39DBFF.2000307@FreeBSD.org> <4C3AF87B.3030707@FreeBSD.org> Date: Tue, 13 Jul 2010 18:05:47 +0400 Message-ID: From: pluknet To: Gabor Kovesdan Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Dimitry Andric , FreeBSD Hackers Subject: Re: strange problem with int64_t variables X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2010 14:05:51 -0000 On 12 July 2010 15:11, Gabor Kovesdan 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