S_ISCHR, S_ISFIFO, O_NONBLOCK, O_NOCTTY

Dave Brolley brolley@cygnus.com
Fri Feb 5 11:05:00 GMT 1999


Zack,

Has Melissa adequately addressed your concerns with this patch?

Dave

Melissa O'Neill wrote:

> Recent changes to cpplib.c and cppfiles.c change the mode of opens from
> O_RDONLY to O_RDONLY|O_NONBLOCK|O_NOCTTY. Unfortunately, older Unix
> systems that aren't POSIX-compliant do not understand these additional
> flags.
>
> Similarly, cppfiles.c now tests file types using S_ISFIFO and S_ISCHR.
> Some Unix systems don't have FIFOs, and non-POSIX systems do not have
> these macros.
>
> Enclosed are patches to system.h that attempt to provide reasonable
> definitions for these preprocessor symbols to allow cpplib.c and cppfiles.c
> to compile on non-POSIX systems.
>
> Regards,
>
>     Melissa.
>
> P.S.  I'm not sure what the addition of O_NONBLOCK and O_NOCTTY is supposed
> to achieve, so I don't know whether my substitution of O_NDELAY for
> O_NONBLOCK and 0 for O_NOCTTY is entirely acceptable.
>
> Enc.
>
> --- /Rock/Build/egcs-snapshot/gcc/system.h.orig Wed Feb  3 23:16:17 1999
> +++ /Rock/Build/egcs-snapshot/gcc/system.h      Thu Feb  4 10:23:27 1999
> @@ -410,8 +410,32 @@
>  #ifndef S_ISDIR
>  #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
>  #endif
>
> +/* Test if something is a character special file.  */
> +#ifndef S_ISCHR
> +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
> +#endif
> +
> +/* Test if something is a fifo.  */
> +#ifndef S_ISFIFO
> +# ifdef S_IFIFO
> +#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
> +# else
> +#  define S_ISFIFO(m) 0
> +# endif
> +#endif
> +
> +/* Approximate O_NONBLOCK.  */
> +#ifndef O_NONBLOCK
> +#define O_NONBLOCK O_NDELAY
> +#endif
> +
> +/* Approximate O_NOCTTY.  */
> +#ifndef O_NOCTTY
> +#define O_NOCTTY 0
> +#endif
> +
>  /* Get libiberty declarations. */
>  #include "libiberty.h"
>
>  #if defined (ANSI_PROTOTYPES)





More information about the Gcc-patches mailing list