_opendir vs opendir

Jeff Johnston jjohnstn@redhat.com
Mon Aug 22 19:43:00 GMT 2005


Shaun Jackman wrote:
> I've been using an arm-elf toolchain with a small patch that compiles
> both the posix and unix directories. This works with little changes
> needed, but one issue is that posix/opendir.c implements opendir
> (since HAVE_OPENDIR is not defined), but unix/getcwd.c calls _opendir,
> which is not defined anywhere. I've been using the following patch
> that uses _syslist.h to redefine _opendir to opendir if HAVE_OPENDIR
> is not defined. Is this a clean solution?
>

This would be ok if the #if checked both !defined (HAVE_OPENDIR) ||
defined (MISSING_SYSCALL_NAMES).  In addition, a comment should be added 
to note that if the opendir syscall is missing, there is a version of 
opendir in the libc/posix directory that can be used.

Do you want me to check such a patch in or do you wish to submit something?

-- Jeff J.

> Cheers,
> Shaun
> 
> Index: newlib/libc/include/_syslist.h
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/include/_syslist.h,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 _syslist.h
> --- newlib/libc/include/_syslist.h	17 Feb 2000 19:39:46 -0000	1.1.1.1
> +++ newlib/libc/include/_syslist.h	19 Aug 2005 22:49:03 -0000
> @@ -21,9 +21,12 @@
>  #define _unlink unlink
>  #define _wait wait
>  #define _write write
> +#endif /* MISSING_SYSCALL_NAMES */
> +
> +#ifndef HAVE_OPENDIR
>   /* functions not yet sysfaked */
>   #define _opendir opendir
>   #define _readdir readdir
>   #define _closedir closedir
> -#endif
> -#endif
> +#endif /* ! HAVE_OPENDIR */
> +#endif /* ! __SYSLIST_H */



More information about the Newlib mailing list