This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch] to gdb: portability fix: <sys/file.h>


Michael Sokolov wrote:
> 
> Hi there,
> 
> The patch below is a portability fix for gdb. corelow.c uses F_OK and currently
> fails to compile on 4.3BSD host because it doesn't include <sys/file.h>, where
> this constant is defined on 4.3BSD. The patch below makes it include
> <sys/file.h> if present, and adds the configure check for it. OK to commit?

This is approved.  Can you add a comment (like the ``required by ...''
just below) to indicate that this is being pulled in for F_OK and
friends.

I think the change is consistent with my understanding of how autoconf
is ment to work.  Just keep adding things to each individual .c file on
an as needed basis.  There may be a better autoconf test, however, my
copy of the auto* book (shameless plug for a friend) is sitting in a
steal shipping container somewhere in middle of the pacific :-)

As for adding it to "defs.h".  Please, no.  GDB's trend is mostly away
from the monolythic defs.h and towards each .[ch] file handling its own
problems.

With regard to creating a gdb_unistd.h, if someone wants to do it then,
it doesn't worry me :-).  I'd personally suggest doing nothing until it
becomes really really obvious that we really have a problem, really. As
for file names and guidelines, yes, ISO-C and POSIX.  As for POSIX vs
4.3BSD, while everyone hates it, POSIX is a vendor netural, ``open'',
published standard.  As they say, never invent your own standard when
you can steal someone elses :-)

	Andrew


> 
> --
> Michael Sokolov
> Public Service Agent
> International Engineering and Science Task Force
> 
> 1351 VINE AVE APT 27            Phone: +1-714-738-5409
> FULLERTON CA 92833-4291 USA     (home office)
> 
> E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP)
> 
> 2001-02-06  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
> 
>         * configure.in (AC_CHECK_HEADERS): Add sys/file.h.
>         * configure, config.in: Regenerate.
>         * corelow.c: Include <sys/file.h> if present.
> 
> Index: configure.in
> ===================================================================
> RCS file: /cvs/src/src/gdb/configure.in,v
> retrieving revision 1.55
> diff -p -r1.55 configure.in
> *** configure.in        2001/01/31 02:08:23     1.55
> --- configure.in        2001/02/06 20:26:30
> ***************
> *** 1,5 ****
>   dnl Autoconf configure script for GDB, the GNU debugger.
> ! dnl Copyright 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
>   dnl
>   dnl This file is part of GDB.
>   dnl
> --- 1,6 ----
>   dnl Autoconf configure script for GDB, the GNU debugger.
> ! dnl Copyright 1995, 1996, 1997, 1998, 1999, 2000,
> ! dnl 2001 Free Software Foundation, Inc.
>   dnl
>   dnl This file is part of GDB.
>   dnl
> *************** AC_CHECK_HEADERS(ctype.h endian.h link.h
> *** 122,128 ****
>         string.h sys/procfs.h sys/ptrace.h sys/reg.h stdint.h \
>         term.h termio.h termios.h unistd.h wait.h sys/wait.h \
>         wchar.h wctype.h asm/debugreg.h sys/debugreg.h sys/select.h \
> !       time.h sys/ioctl.h sys/user.h \
>         dirent.h sys/ndir.h sys/dir.h ndir.h \
>         curses.h ncurses.h \
>         poll.h sys/poll.h)
> --- 123,129 ----
>         string.h sys/procfs.h sys/ptrace.h sys/reg.h stdint.h \
>         term.h termio.h termios.h unistd.h wait.h sys/wait.h \
>         wchar.h wctype.h asm/debugreg.h sys/debugreg.h sys/select.h \
> !       time.h sys/file.h sys/ioctl.h sys/user.h \
>         dirent.h sys/ndir.h sys/dir.h ndir.h \
>         curses.h ncurses.h \
>         poll.h sys/poll.h)
> Index: corelow.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/corelow.c,v
> retrieving revision 1.11
> diff -p -r1.11 corelow.c
> *** corelow.c   2000/12/15 01:01:46     1.11
> --- corelow.c   2001/02/06 20:26:32
> ***************
> *** 1,5 ****
>   /* Core dump and executable file functions below target vector, for GDB.
> !    Copyright 1986, 87, 89, 91, 92, 93, 94, 95, 96, 97, 1998, 2000
>      Free Software Foundation, Inc.
> 
>      This file is part of GDB.
> --- 1,5 ----
>   /* Core dump and executable file functions below target vector, for GDB.
> !    Copyright 1986, 87, 89, 91, 92, 93, 94, 95, 96, 97, 1998, 2000, 2001
>      Free Software Foundation, Inc.
> 
>      This file is part of GDB.
> ***************
> *** 24,29 ****
> --- 24,32 ----
>   #include <errno.h>
>   #include <signal.h>
>   #include <fcntl.h>
> + #ifdef HAVE_SYS_FILE_H
> + #include <sys/file.h>
> + #endif
>   #include "frame.h"            /* required by inferior.h */
>   #include "inferior.h"
>   #include "symtab.h"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]