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" == Michael Sokolov <msokolov@ivan.Harhan.ORG> writes:
>> However, I am somewhat concerned if any one changes any other file
>> to use one of the access(2) macros (F_OK, R_OK, W_OK, or X_OK) it
>> won't have your fix.

Michael> Anyone needing a define that's in different places on
Michael> different systems should have logic to include different
Michael> headers depending on config.h definitions. This is how it's
Michael> done in the rest of the Cygnus tree.

I'm puzzled what you mean by the Cygnus tree.  While the master GDB
repository was once Cygnus' internal development tree, it was split
out quite some time ago.

If you mean that binutils, etc. add feature tests to each file that
might need a macro definition, I say "great, if it works for them".
GDB used a similar scheme 5 or so years ago.  It was changed to use
the gdb_*.h headers at that time because we constantly encountered
platforms where the #ifdefs that used autoconf feature tests were
missing, or broken, or different, between files.  IMHO, the new scheme
has proven to be robust.

>> One thing we've done is to provide GDB specific wrappers of header
>> files, fixing up nits or deficiencies of different implementations so
>> that the body of GDB code doesn't have to deal with them.  I'm
>> inclined to think that this falls within that category.  We could
>> create a gdb_unistd.h that simply includes unistd.h on systems that
>> have that header, but defines the missing bits on others.  We could
>> fix up those other gdb configs at the same time.

Michael> But this is not a problem of a specific header file being
Michael> broken that can be wrappered around, it's just that the
Michael> definitions of access(2) macros are in different headers on
Michael> different systems. I guess the logic for including these
Michael> headers could be put in defs.h. This is also consistent with
Michael> how the rest of the Cygnus tree handles this.

While one way to interpret the gdb_*.h headers is to fix up broken
headers, a broader (and IMO more useful) interpretation is that the
gdb_*.h headers define a programming interface for the rest of GDB.
So it doesn't matter that a target's unistd.h header (if it even has a
unistd.h header) doesn't define F_OK, etc.  The rest of GDB can depend
on F_OK being defined if gdb_unistd.h is included.

>> Note this isn't a patch rejection.

Michael> So could you then approve my patch as a blanket write priv
Michael> maintainer? Or would you rather have me add the access(2)
Michael> macro logic in defs.h?

I think I'm allowed to approve the patch (I'm kinda new at this role,
so I'm still figuring things out).  But I want to see what Andrew &
others think.  I'm sure within a short time a decision will be made
as to what type of patch will be acceptable.

However, any further involvement by me will have to wait until later.
I've got a head cold and am heading home...

        --jtc

-- 
J.T. Conklin
RedBack Networks

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