From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.oboj.net ([195.178.185.14]) by ewsd; Sun Mar 8 11:50:32 EDT 2020 Received: from localhost (localhost [127.0.0.1]) by mail.oboj.net (Postfix) with ESMTP id 2D210C56AE1; Sun, 8 Mar 2020 16:50:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.oboj.net Received: from mail.oboj.net ([127.0.0.1]) by localhost (mail.oboj.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IpA-HNs2bO2t; Sun, 8 Mar 2020 16:50:23 +0100 (CET) Received: from www.oboj.net (unknown [195.178.185.23]) by mail.oboj.net (Postfix) with ESMTP id 48AA2C56ADF; Sun, 8 Mar 2020 16:50:23 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 08 Mar 2020 16:50:23 +0100 From: jamos@oboj.net To: 9front@9front.org Cc: Trevor Higgins Subject: Re: [9front] APE stddef.h ptrdiff_t should it be 8? In-Reply-To: <8b63d3cf-0fda-1e69-a40f-32322b400548@qs.co.nz> References: <8b63d3cf-0fda-1e69-a40f-32322b400548@qs.co.nz> Message-ID: <66fdbcee9b4c64c3289c20e5a9379693@oboj.net> X-Sender: jamos@oboj.net User-Agent: Roundcube Webmail/1.3.4 List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: framework configuration framework lifecycle-aware extension Others on this list of course know these things much better than me, but this is my understanding: The header file, as it is different for different architectures should be in /$objtype/inlcude/ape _instead_ of in the current location. You'd have to have one header file each objtype to, but it would probably only be the definition of ptrdiff_t that would differ, depending on 32 or 64 bit addresses for the arch. In Plan 9, include files does in general not include other include files either. And it should be 'long long' in ape, as vlong isn't defined. /Jonas On 2020-03-08 00:14, Trevor Higgins wrote: > On 03/08/2020 04:55 AM, ori@eigenstate.org wrote: I ran into a > fustercluck trying to get tcl to run on amd64. just random memory corruptions as would be expected. >> Can you be more specific? What failed? >> >> Turns out it is due to APE ptrdiff_t being defined as long and not >> long >> long (which it is on *nix). >> >> What is the correct definition of ptrdiff_t on amd64? > The definition should be a vlong, since that's what subtracting > two pointers yields. If you want to submit a patch, the system > dependent location for this is: > > /$objtype/include/ape/stdint.h Not wishing to be picky, but vlong would not be APE , correct or not? it would be typedef long long. Also this change still requires patching /sys/include/ape/stddef.h to prevent attempt to duplicately define the structure and Probably for good measure in both files: #ifndef _PTRDIFF_T #define _PTRDIFF_T typedef ptrdiff_t /*** long long in amd64 and just long in sys/include/ape/stddef.h **/ #endif Or maybe , ptrdiff_t should be removed from stddef.h