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

Eli Zaretskii eliz@is.elta.co.il
Wed Feb 7 03:57:00 GMT 2001


On Tue, 6 Feb 2001, Michael Sokolov wrote:

> Then why have many gdb_*.h files rather than one system.h file? How would this
> goo be divided between different gdb_*.h files? Why should the F_OK logic be in
> gdb_unistd.h and not gdb_sys_file.h?

Because F_OK belongs to unistd.h according to Posix.

> If that's the route you want to take, someone else will have to do the work, as
> I won't be qualified for this.

I think you exaggerate the amount of work to some degree.  Until now, all 
the systems supported by GDB were able to build GDB, which means that they 
all define F_OK in the headers that are already included.  I will not be 
surprised to learn that they all define F_OK in unistd.h.  If that's 
true, 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

Or something along these lines.  It is hardly worth starting a political
flame war over this. 


More information about the Gdb-patches mailing list