Problems with rewinddir() on RTEMS
Corinna Vinschen
vinschen@redhat.com
Tue Jul 6 04:38:00 GMT 2010
On Jul 5 16:12, Ralf Corsepius wrote:
> On 07/05/2010 01:47 PM, Corinna Vinschen wrote:
> >On Jul 5 11:24, Sebastian Huber wrote:
> >>Hi,
> >>
> >>on some platforms RTEMS uses a 64-bit type for off_t (in particular PowerPC).
> >>The function rewinddir() is implemented (libc/posix/rewinddir.c) in terms of:
> >>
> >>_seekdir((dirp), (off_t)0);
> >>
> >>For _seekdir() no prototype is present. GCC chooses to pass (off_t) 0 as a
> >>64-bit parameter (on PowerPC r5 and r6). On the other hand we have
> >>(libc/posix/telldir.c):
> >>
> >>void
> >>_DEFUN(_seekdir, (dirp, loc),
> >> register DIR *dirp _AND
> >> long loc)
> >>
> >>Which has a different signature compared to above (on PowerPC r4 will contain
> >>loc). We must declare _seekdir() somewhere.
> >
> >Not only _seekdir is wrongly defined taking a long type, seekdir is,
> >too, and telldir is wrongly defined returning a long. Both functions
> >should use off_t per POSIX.
>
> Hmm? Opengroup says otherwise:
>
> void seekdir(DIR *dirp, long loc);
> long telldir(DIR *);
Uh oh, you're right. I scanned the wrong documentation accidentally.
Sorry about that.
So, scratch my patch. That means only a prottype for _seekdir is
missing in libc/sys/rtems/sys/dirent.h. In libc/sys/linux/sys/dirent.h
the function is declared unconditionally. Is that ok for RTEMS as well
or should it be guarded with __COMPILING_NEWLIB?
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
More information about the Newlib
mailing list