bin/60642: dtrace(1): doesn't call preprocessor correctly

"[email protected] via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.bugs
Message-ID <[email protected]>
>Number:         60642
>Category:       bin
>Synopsis:       dtrace(1): doesn't call preprocessor correctly
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 25 12:15:00 +0000 2026
>Originator:     Thomas Klausner
>Release:        NetBSD 11.99.7
>Organization:
	
>Environment:
Architecture: x86_64
Machine: amd64
>Description:
When compiling wip/modular-xorg-server with the (disabled-on-NetBSD)
dtrace option, you'll see

[1/647] Generating 'dix/liblibxserver_dix.a.p/Xserver-dtrace.h'
FAILED: [code=1] dix/liblibxserver_dix.a.p/Xserver-dtrace.h
/usr/sbin/dtrace -h -s ../include/Xserver.d -o dix/liblibxserver_dix.a.p/Xserver-dtrace.h
dtrace: failed to compile script ../include/Xserver.d: "/usr/lib/dtrace/psinfo.d", line 46: syntax error near "u_int"

I've fixed this problem by removing psinfo.d from the NetBSD base system,
since it uses `u_int` and `struct proc` but nothing defines it.

After that removal, the error is now:
[3/647] Generating 'dix/liblibxserver_dix.a.p/Xserver-dtrace.h'
FAILED: [code=1] dix/liblibxserver_dix.a.p/Xserver-dtrace.h
/usr/sbin/dtrace -h -s ../include/Xserver.d -o dix/liblibxserver_dix.a.p/Xserver-dtrace.h
dtrace: failed to compile script ../include/Xserver.d: line 26: invalid control directive: #ifdef

The code is (after some comments):

#ifdef __APPLE__
#define string char *
#define pid_t uint32_t
#define zoneid_t uint32_t
#elif defined(__FreeBSD__)
#define zoneid_t id_t
#else
#include <sys/types.h>
#endif

Changing '#ifdef' to #if' doesn't fix this.

I assume dtrace should call a c preprocessor to handle this, which
is why I chose the subject.

Perhaps the removal of psinfo.d was incorrect and that it should
also work; I'm happy to put it back when this is fixed.
>How-To-Repeat:
Enable the dtrace option in wip/modular-xorg-server and build it.
>Fix:
Please.

>Unformatted:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.