Patchwork [RFA/PING] include sys/types.h before sys/prctl.h (for mips-irix).

login
register
mail settings
Submitter Joel Brobecker
Date Dec. 15, 2010, 6:07 a.m.
Message ID <20101215060727.GC2618@adacore.com>
Download mbox | patch
Permalink /patch/75606/
State New
Headers show

Comments

Joel Brobecker - Dec. 15, 2010, 6:07 a.m.
A friendly request for a small patch posted about 3 weeks ago...
Thank you!

On Tue, Nov 23, 2010 at 08:54:18AM -0800, Joel Brobecker wrote:
> On mips-irix, sys/prctl.h depends on various types such as ptid_t being
> declared.  Otherwise, the build fails as follow:
> 
>     /usr/include/sys/prctl.h:45:9: error: expected specifier-qualifier-list before 'pid_t'
>     /usr/include/sys/prctl.h:91:17: error: expected specifier-qualifier-list before 'uint32_t'
>     [...]


libiberty/ChangeLog:

        * setproctitle.c: If <sys/types.h> exists, include it before including
        <sys/prctl.h>.

Tested on x86_64-linux, where both HAVE_SYS_PRCTL_H and HAVE_SYS_TYPES_H
are defined (I used the gdb-testsuite).  OK to commit?

Thanks,
Ralf Wildenhues - Dec. 15, 2010, 7:55 a.m.
Hello Joel,

* Joel Brobecker wrote on Wed, Dec 15, 2010 at 07:07:27AM CET:
> A friendly request for a small patch posted about 3 weeks ago...
> Thank you!

I think your patch has already been obsoleted by this one in trunk:

2010-11-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

        * setproctitle.c [HAVE_SYS_PRCTL_H]: Include <sys/types.h>.

> On Tue, Nov 23, 2010 at 08:54:18AM -0800, Joel Brobecker wrote:
> libiberty/ChangeLog:
> 
>         * setproctitle.c: If <sys/types.h> exists, include it before including
>         <sys/prctl.h>.

Cheers,
Ralf
Joel Brobecker - Dec. 15, 2010, 9:13 a.m.
> I think your patch has already been obsoleted by this one in trunk:
> 
> 2010-11-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 
>         * setproctitle.c [HAVE_SYS_PRCTL_H]: Include <sys/types.h>.

Indeed! I was a little surprised to see that it's included
unconditionally, but I suppose that <sys/types.h> is expected to
always be present on platforms that have <sys/prctl.h>.

Thank you!
Rainer Orth - Dec. 15, 2010, 11:18 a.m.
Joel Brobecker <brobecker@adacore.com> writes:

>> I think your patch has already been obsoleted by this one in trunk:
>> 
>> 2010-11-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>> 
>>         * setproctitle.c [HAVE_SYS_PRCTL_H]: Include <sys/types.h>.
>
> Indeed! I was a little surprised to see that it's included
> unconditionally, but I suppose that <sys/types.h> is expected to
> always be present on platforms that have <sys/prctl.h>.

Not only that, it's included in all libiberty sources unconditionally,
so I concluded there's no problem doing so here :-)

	Rainer

Patch

diff --git a/libiberty/setproctitle.c b/libiberty/setproctitle.c
index ceb0a38..dfcf000 100644
--- a/libiberty/setproctitle.c
+++ b/libiberty/setproctitle.c
@@ -21,6 +21,9 @@  Boston, MA 02110-1301, USA.  */
 #include "config.h"
 #endif
 #ifdef HAVE_SYS_PRCTL_H
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
 #include <sys/prctl.h>
 #endif
 #include "ansidecl.h"