🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6296

gcc 2.7.0: installs incorrect wait3() prototype on AIX 3.2.5

#6296
From: Jonathan Kamens
Date: Mon, 11 Dec 1995 00:00
39 lines
2389 bytes
When gcc 2.7.0 fixes include files, it puts a prototype for wait3()
into <sys/wait.h> with its first argument type being "union wait *".
This isn't correct on AIX, which uses "int *" as the first argument to
wait3().

I fixed this by doing the following (I don't know whether this is the
"correct" fix, but it worked for me):

--- sys-protos.h        1995/12/11 10:58:50     1.1
+++ sys-protos.h        1995/12/11 11:00:11
@@ -1229,7 +1229,11 @@
 extern int                    waddnstr(WINDOW *, char *, int);
 extern int                    waddstr(WINDOW *, char *);
 extern pid_t                  wait(wait_arg_t *);
+#ifdef _AIX
+extern pid_t                  wait3(int *, int, struct rusage *);
+#else
 extern pid_t                  wait3(union wait *, int, struct rusage *);
+#endif /* _AIX */
 extern int                    waitid(idtype_t, id_t, siginfo_t *, int);
 extern pid_t                  waitpid(pid_t, int *, int);
 extern void *                 wallproc_wall_1(/* ??? */);

Another problem with this prototype is that "struct rusage" isn't
actually defined in AIX's <sys/wait.h>, which means that if the user
doesn't include <sys/resource.h> before <sys/wait.h>, the compiler
prints warnings about "`struct rusage' declared inside parameter
list", which the user doesn't really care about unless he's actually
using wait3() in his program and actually using the contents of the
struct rusage.

I'm not sure whether this means that fix-header.c should be smart
enough to add "#include <sys/resource.h>" to <sys/wait.h> (probably
not), or that fix-header.c shouldn't add a wait3() prototype at all on
AIX, or that users should always include <sys/resource.h> on AIX
before <sys/wait.h> in order to make the warning go away.  Personally,
I chose the last option, which seemed the easiest :-).

Jonathan Kamens  |  OpenVision Technologies, Inc.  |   jik@cam.ov.com
Technical Details
Message-ID: <199512111115.LAA28011@annex-1-slip-jik.cam.ov.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,5cf25781268438ff,start
X-Google-Attributes: gid113d02,public
From: jik@annex-1-slip-jik.cam.ov.com (Jonathan Kamens)
Subject: gcc 2.7.0: installs incorrect wait3() prototype on AIX 3.2.5
Date: 1995/12/11
Message-ID: <199512111115.LAA28011@annex-1-slip-jik.cam.ov.com>
X-Deja-AN: 121609978
distribution: gnu
sender: daemon@cis.ohio-state.edu
organization: GNUs Not Usenet
newsgroups: gnu.gcc.bug