From owner-svn-src-all@freebsd.org Tue Nov 10 17:29:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BA8CA2C5E9; Tue, 10 Nov 2015 17:29:48 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F43318AF; Tue, 10 Nov 2015 17:29:48 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by iodd200 with SMTP id d200so8348776iod.0; Tue, 10 Nov 2015 09:29:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=zlQS2WLcuN8AL4IyW1EYFjGLVY1PvcMdxtIPAotF/4M=; b=FSgN5S8QrdFBNbEr3aRYWHECqwD8fg1QFmbPnV46luPrRhbb6ZIHqct93xVizZ3yFm OthAeag9gJ+nIC66kSYMZpv/Glq2ONfPiqvauQUV7hIsZTFh4LL51xMSi6eS/WoVoljI 4tSNHlkHyOQym6YaWxWO2fGj2b0MC0S0rd/f1nzzeqaaiYI0XRLjCtSW0M8vKpjbrEoC yUz0AHwUv+96mddHLoCtB6KRnrw/oBV8Me1BwzbcBU8frZo89JtBmZJ+944kZIqJ2KLh n9/B2LE4BTa1kZjG1cKt71odHjHGFMTeYM5LXxnJbC0l/R/L9fYFZm07gl087y7D55R4 /Xiw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni_cwru_edu.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=zlQS2WLcuN8AL4IyW1EYFjGLVY1PvcMdxtIPAotF/4M=; b=Cqcjx0xq0/fHe+StjiVq8Ha0qbedvcFDdvoxFVfOpelS7DOoOZVgd43cjk6MSXFehf wzK50Eb1wK8x430mIA4e55lMzq6D5T3KN1gN7+3QdvGp4l32lUg3ZnYmeV4nDiOkaD/8 efWKVPaB16/wRA0VLUbUjKJyzzPa3JBEok6EXj7tuOrkuBDscY52Usn+y4cOZ/LFsfHn kaZybskvNhHXKYB9boaMqAxWEPsHYeiCaoVjopeT5yOCQdEAn49Cy7+INly6dKYMqtf6 gB947aMLgO6JRxv31cPX9JYwCpYqp8zfBF3Q16hhXq5GKBkM68iqlEaym1s98ClT8P7g TM8g== MIME-Version: 1.0 X-Received: by 10.107.150.196 with SMTP id y187mr5132106iod.13.1447176587146; Tue, 10 Nov 2015 09:29:47 -0800 (PST) Sender: chmeeedalf@gmail.com Received: by 10.36.41.138 with HTTP; Tue, 10 Nov 2015 09:29:47 -0800 (PST) In-Reply-To: References: <201511091650.tA9Gog7d061645@repo.freebsd.org> <20151110080516.M4088@besplex.bde.org> <5641A056.2040805@selasky.org> <1447168083.91061.2.camel@freebsd.org> Date: Tue, 10 Nov 2015 11:29:47 -0600 X-Google-Sender-Auth: U_Nl-hLk2JBAjuD8wvxxpfzGph4 Message-ID: Subject: Re: svn commit: r290613 - head/sys/compat/linuxkpi/common/include/linux From: Justin Hibbits To: cem@freebsd.org Cc: Hans Petter Selasky , Ian Lepore , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2015 17:29:48 -0000 On Tue, Nov 10, 2015 at 9:42 AM, Conrad Meyer wrote: > On Tue, Nov 10, 2015 at 7:08 AM, Ian Lepore wrote: >> On Tue, 2015-11-10 at 08:44 +0100, Hans Petter Selasky wrote: >>> > -sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1, >>> > intptr_t arg2, >>> > +sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1, >>> > intmax_t arg2, >>> > struct sysctl_req *req, struct rm_priotracker *tracker) >>> >>> Given that the second argument is sometimes used for pointers, maybe >>> we >>> should keep it intptr_t. Or add a compile time assert that >>> sizeof(intmax) >=3D sizeof(intptr_t) which I think doesn't hold? >> >> If intmax_t is the "maximum width integer type" and intptr_t is >> "integer type capable of holding a pointer", I think by definition >> sizeof(intmax_t) must be >=3D sizeof(intptr_t). On the other hand, give= n >> the perverse way standards-writers think, I'm not sure "big enough" is >> all it takes to qualify as "capable of holding a pointer". But I think >> in reality it'll work out right anyway. > > +1 to what Ian said. > > In any C99 implementation where intptr_t is defined, I believe > intmax_t must be at least as big. See =C2=A7 7.18.1.5, "Greatest-width > integer types," and =C2=A7 7.18.1.4, "Integer types capable of holding > object pointers." > >> The following type designates a signed integer type with the property th= at any valid pointer to void can be converted to this type, then converted = back to pointer to void, and the result will compare equal to the original = pointer: intptr_t >> >> The following type designates a signed integer type capable of represent= ing any value of any signed integer type: intmax_t > > Given that intptr_t exists in our implementation and is a signed > integer type, I see no reason why intmax_t could possibly not > represent any such value. Same argument for the unsigned variants. > > Best, > Conrad > I may be wrong on this, but I *think* uintptr_t/intptr_t are required to be *precisely* the same size as a pointer, which explains why you can't cast directly from uintmax_t on 32-bit architectures. - Justin