This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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]

[PATCH] Re: S_IFSOCK should be defined if _XOPEN_SOURCE=500


On Mon, May 03, 2004 at 12:48:20PM +0200, Michael T Kerrisk wrote:
> In <sys/stat.h> there is:
> 
> # if (defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN2K) \
>      && defined __S_IFSOCK
> #  define S_IFSOCK	__S_IFSOCK
> # endif
> 
> This means that S_IFSOCK is only defined if _XOPEN_SOURCE 
> is 600.
> 
> In SUSv2 sockets were defined in the Networking Services 
> volume (XNS5) along.  Compliance with XNS5 is mandatory for 
> UNIX98 branding.  In other words, UNIX98 systems must 
> define S_IFSOCK in <sys/stat.h> when _XOPEN_SOURCE is 500, 
> and glibc should do this too.  Thus, the first line above 
> should read:
> 
> # if (defined __USE_BSD || defined __USE_MISC || defined
> __USE_XOPEN_EXTENDED) \

S_ISSOCK () is not defined with -D_XOPEN_SOURCE=600 either, which is clearly
a bug.
I have attached two alternative patches, one just adds S_ISSOCK ()
definition if -D_XOPEN_SOURCE=600, the other also moves S_I[FS]SOCK
and F_[SG]ETOWN from __USE_XOPEN2K to __USE_UNIX98 (all these
are XNS5 additions).  gethostname () is also a XNS5 addition
and <unistd.h> has
#if defined __USE_BSD || defined __USE_UNIX98
/* Put the name of the current host in no more than LEN bytes of NAME.
   The result is null-terminated if LEN is large enough for the full
   name and the terminator.  */
extern int gethostname (char *__name, size_t __len) __THROW;
#endif
so there is at least some precedent.

BTW: S_IFSOCK is also defined for __USE_MISC, wonder if S_ISSOCK
shouldn't be guarded by the same macros.

	Jakub

Attachment: P1
Description: Text document

Attachment: P2
Description: Text document


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