After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 337207 - msg_limits.c build broken in NetBSD
msg_limits.c build broken in NetBSD
Status: RESOLVED FIXED
Product: libgtop
Classification: Core
Component: bsd
2.15.x
Other NetBSD
: Normal major
: ---
Assigned To: libgtop maintainers
libgtop maintainers
Depends on:
Blocks:
 
 
Reported: 2006-04-04 15:02 UTC by Julio Merino
Modified: 2006-04-09 10:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch. (3.20 KB, patch)
2006-04-04 15:03 UTC, Julio Merino
committed Details | Review

Description Julio Merino 2006-04-04 15:02:27 UTC
The msg_limits.c file has this chunk of code in it:

#if (defined(__FreeBSD__) && (__FreeBSD_version < 410000)) || (defined __bsdi__)
#define KERNEL 1
#else
#define _KERNEL 1
#endif

Under NetBSD this conditional obviously falls to the #else part, which defines the _KERNEL macro.  This causes later problems during the inclusion of sys/ipc.h and sys/msg.h because they try to pull in many stuff that is not available in userland -- as the _KERNEL macro name implies, defining it means that you are building the kernel!

As an example, see what the compiler emits based on a simple test case that defines _KERNEL and later includes sys/msg.h:

In file included from test.c:2:
/usr/include/sys/msg.h:193:23: sys/systm.h: No such file or directory
In file included from test.c:2:
/usr/include/sys/msg.h:200: error: parse error before "copyin_t"
/usr/include/sys/msg.h:202: error: parse error before "copyout_t"

One possible fix could be to change the #else line with '#elif !defined(__NetBSD__)', but that is ugly and extremely delicate (e.g. OpenBSD probably has the same problem, but I do not know).  It does not fix the real problem in a clean way.

The best solution to address this problem is to add a check in the configure script that detects if we need to define anything (be it KERNEL or _KERNEL) to get the definition of 'struct msginfo' regarless of the BSD flavour/version.  This can be achieved by using the AC_COMPILE_IFELSE macro.

The attached patch implements the latter solution.
Comment 1 Julio Merino 2006-04-04 15:03:02 UTC
Created attachment 62737 [details] [review]
Proposed patch.