🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.netbsd.tech.userlevel
Article #1

intptr_t, kqueue: history/rationale of type change

#1
From: Greg Troxel
Date: Thu, 08 Oct 2026 12:54
48 lines
3325 bytes
This message is about type definitions (this list) and kqueue
(tech-kern) but I'm sending it just here.

While updating matrix-synapse to 1.162.0, a rust create "mio" failed to
build with type errors:

     Compiling mio v1.0.4
  error[E0308]: mismatched types
     --> /tmp/work/chat/matrix-synapse/work/vendor/mio-1.0.4/src/sys/unix/selector/kqueue.rs:60:20
      |
   60 |             udata: $data as UData,
      |                    ^^^^^^^^^^^^^^ expected `*mut c_void`, found `isize`
  ...
  132 |             let kevent = kevent!(fd, libc::EVFILT_WRITE, flags, token.0);
      |                          ----------------------------------------------- in this macro invocation

mio had not been bumped in synapse for over a year.  Long story short:

  mio has ifdefs by OS ("#cfg" in rust) to set the type of the udata
  parameter, void* in most places, and intptr_t on NetBSD.

  mio uses the libc create to get the underlying types (seems linuxy to
  have types in libc, but that's how it is :-).

  The libc crate changed from 0.2.174 to 0.2.189 in synapse 1.162.0.

  NetBSD changed kevent.udata type from intptr_t to void* in 2019.

  intptr_t, which I expect to be "int *", isn't.   It is "long" and
  amd64 and "int" on i386.

  If I change mio to expect void* for NetBSD, things build.

I now think that intptr_t is "pointer stored in an int", not a pointer
to an int.

I speculate that in the libc crate, intptr_t used to be the
obvious-but-wrong int*, and they fixed it, and that exposed the latent
bug in mio of not keeping up with our 2019 change.  But really mio just
needs fixing.


I am curious if the assembled group of esteemed C/POSIX pontificators
think my analysis seems right.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <rmijynsuzdb.fsf@s1.lexort.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Greg Troxel <gdt@lexort.com>
Newsgroups: muc.lists.netbsd.tech.userlevel
Subject: intptr_t, kqueue: history/rationale of type change
Date: Thu, 08 Oct 2026 08:54:08 -0400
Organization: Newsgate at muc.de e.V.
Sender: tech-userlevel-owner@NetBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <rmijynsuzdb.fsf@s1.lexort.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="33977"; mail-complaints-to="news-admin@muc.de"
User-Agent: Gnus/5.13 (Gnus v5.13)
Authentication-Results: mail.netbsd.org (amavisd-new);
	dkim=pass (1024-bit key) header.d=lexort.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lexort.com; s=mail;
	t=1791464048; bh=8liZ16pate1Pgki4syQS71Fkkes2oA/+Hbue1OAYgPo=;
	h=From:To:Subject:Date;
	b=apBiYy0RSma2zVJKahLAA5KOX1iI9QcrwnlQqQBrE2XPujSo/dhqnpEkjV48cdc8a
	 vmzamk6n5eDUbWl6xY8itsBgawaOMU4ZHbKfR6RI3i4qAGPyk4aXHxwdbQs1F6pVhX
	 62qHWSdp0xIIinqnFmGsdV8aAzUc8XWKF/XRPNv0=
OpenPGP: id=098ED60E
Precedence: bulk
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes