This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: hash.c and _stat variants


On Jan 22 15:38, Joel Sherrill wrote:
> Hi Corinna,
> 
> I was going through my newlib patches and found where
> I had undone your change and used the version without
> the _.
> 
> 2012-08-08  Corinna Vinschen <...>
> 
>        * libc/search/hash.c:  Throughout use underscored variants of
> the stat
>         function family.
> 
> RTEMS doesn't have _stat, _fstat, _stat64, _fstat64 or _mkdir. We do have
> the version without _.  Looking in sys/stat.h, it appears that these
> are part of the libgloss support but we didn't notice needing them
> until you made this change.
> 
> RTEMS provides its own mkdir() so we can ignore _mkdir().
> But to use hash.c, we need to address the four stat calls.
> 
> I see two possibilities:
> 
> + Define _stat -> stat, etc.  This would be a conditional
>    in newlib's sys/stat.h.
> + Implement simple _XXX wrappers for RTEMS.
> 
> Which would be better in your opinion?

I don't have a strong opinion.  Maybe you could simply utilize the
MISSING_SYSCALL_NAMES define, see libc/include/_syslist.h.  You could
also add an RTEMS-specific snippet to that file.

Alternatively, and IMHO most elegant, what about adding alias
definitions to your source files, along the lines of

  int stat() { ... }
  int _stat() __attribute__ ((weak, alias ("stat")));


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


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