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>


Eli Zaretskii <eliz@is.elta.co.il> wrote:

> You could replace HAVE_SYS_FILE_H with something 4.3BSD defines, for
> example.

But why? Sure, I could use the BSD4_3 define, but what about some system that
is derived from 4.3BSD and still defines BSD4_3, but doesn't have this
property? Or vice-versa, some other system that also has important definitions
in <sys/file.h> but is not directly related to 4.3BSD genetically and doesn't
define BSD4_3? I thought you wanted to move away from hard-coded system-
specific assumptions toward generic feature tests. In this vein I cannot
understand your reluctance to add the check for <sys/file.h> to configure.

Thinking more about it, I just realised that <sys/file.h> might be needed on
some systems for other file-related definitions besides the access(2) macros.
Therefore, I think it would be best to *always* include this header in defs.h
if it is present. Defining F_OK, etc. when they are not defined anywhere then
becomes a separate matter. The patch is below. Now can I *please* get a review
by a *blanket write priv maintainer*?

-- 
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-08  Michael Sokolov  <msokolov@ivan.Harhan.ORG>

	* configure.in (AC_CHECK_HEADERS): Add sys/file.h.
	* configure, config.in: Regenerate.
	* defs.h: Include <sys/file.h> if present.
	(F_OK, X_OK, W_OK, R_OK): Define for systems that don't have them.

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 21:28:55
***************
*** 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.38
diff -p -r1.38 defs.h
*** defs.h	2001/02/08 06:49:19	1.38
--- defs.h	2001/02/08 21:29:02
***************
*** 38,43 ****
--- 38,60 ----
  #include <unistd.h>
  #endif
  
+ #ifdef HAVE_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
+ 
  /* Just in case they're not defined in stdio.h. */
  
  #ifndef SEEK_SET

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