On 13.08.2019 20:22, Jaromir Dolecek wrote: > I think the rationale was to make it possible to use for integer values and > operations without cast. And make it clear it can hold arbitrary value, not > necessarily pointer. Unfortunately intptr_t has different size in 32 vs 64 > bit same as void *, which I didnt consider. > > Using (void *) would be bad IMO. If we want to change this, please follow the > mac OS and use explicit integer 64bit types instead. This would of course > change ABI so needs versioning. >
Darwin uses void* for udata. The kevent structure is defined as: struct kevent { uintptr_t ident; /* identifier for this event */ short filter; /* filter for event */ u_short flags; /* action flags for kqueue */ u_int fflags; /* filter flag value */ intptr_t data; /* filter data value */ void *udata; /* opaque user data identifier */ }; https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/kqueue.2.html Imho int64_t make things actually worse. 1. Every pointer than can exceed 32bit intptr_t can just be allocated on a heap and we should pass a pointer to it. 2. int64 does not resolve any C++ issues with strict types. 3. ABI brekage void* does not prevent storing inside it numbers. void* (or char*, int*,...) is a typical userdata argument. It can be found in this form in other places such as set_panel_userptr(3), FTSENT.fts_pointer in fts(3) or tss_set(3). > Jaromir > > > >> Le 12 août 2019 à 14:51, Valery Ushakov <u...@stderr.spb.ru> a écrit : >> >>> On Mon, Aug 12, 2019 at 03:43:56 +0000, m...@netbsd.org wrote: >>> >>> So, this is when we changed to intptr_t. We also went through a >>> "int64_t udata" revision at some point, later. >>> >>> Module Name: syssrc >>> Committed By: jdolecek >>> Date: Wed Oct 2 19:09:37 UTC 2002 >>> >>> Modified Files: >>> syssrc/sys/sys [kqueue]: event.h >>> >>> Log Message: >>> make 'udata' field of struct kevent intptr_t (was 'void *') >> [...] >>> jdolecek, do you remember why you wanted to switch? >> >> Could it be related to 64-bit kernel vs. 32-bit userland (one of the >> mips ABIs?) >> >> -uwe
signature.asc
Description: OpenPGP digital signature