This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [patch] to gdb: portability fix: <sys/file.h>
- To: gdb-patches at sources dot redhat dot com
- Subject: Re: [patch] to gdb: portability fix: <sys/file.h>
- From: msokolov at ivan dot Harhan dot ORG (Michael Sokolov)
- Date: Wed, 7 Feb 01 17:10:46 PST
Eli Zaretskii <eliz@is.elta.co.il> wrote:
> all we need to do is to create gdb_unistd.h that does something
> like this (untested):
>
> #if HAVE_UNISTD_H
> #include <unistd.h>
> #endif
>
> #ifndef F_OK
> # if HAVE_SYS_FILE_H
> /* 4.3BSD has F_OK in sys/file.h. */
> # include <sys/file.h>
> # endif
> # ifndef F_OK
> # define F_OK 0
> # endif
> #endif
The first three lines of your proposed code are currently in defs.h, included
by everyone. How about if I just add the rest there as well? The patch is
below. It also takes care of the other three access(2) constants.
I don't have the knowledge or resources to move this into a new gdb_unistd.h
header, change all of gdb to use this new header, get it all right, and test it
on every platform in the world. Can you please go with the patch below for now?
--
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-07 Michael Sokolov <msokolov@ivan.Harhan.ORG>
Eli Zaretskii <eliz@is.elta.co.il>
* configure.in (AC_CHECK_HEADERS): Add sys/file.h.
* configure, config.in: Regenerate.
* defs.h (F_OK, X_OK, W_OK, R_OK): Get them from <sys/file.h> or define
them ourselves if they didn't come from <unistd.h>.
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/08 00:51:32
***************
*** 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: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.36
diff -p -r1.36 defs.h
*** defs.h 2001/01/31 03:46:23 1.36
--- defs.h 2001/02/08 00:51:38
***************
*** 38,43 ****
--- 38,62 ----
#include <unistd.h>
#endif
+ #ifndef F_OK
+ # if HAVE_SYS_FILE_H
+ /* 4.3BSD has F_OK in sys/file.h. */
+ # include <sys/file.h>
+ # endif
+ # ifndef F_OK
+ # define F_OK 0
+ # endif
+ # ifndef X_OK
+ # define X_OK 1
+ # endif
+ # ifndef W_OK
+ # define W_OK 2
+ # endif
+ # ifndef R_OK
+ # define R_OK 4
+ # endif
+ #endif
+
/* Just in case they're not defined in stdio.h. */
#ifndef SEEK_SET