[Xcb] [PATCH] xcb_disconnect: call shutdown() to force a disconnect

Ulrich Eckhardt doomster at knuut.de
Mon Aug 16 00:47:43 PDT 2010


On Monday 16 August 2010 08:53:03 Aaron Plattner wrote:
> On Sun, Aug 15, 2010 at 11:03:42PM -0700, Ulrich Eckhardt wrote:
> > use the SHUT_{RD,WR,RDWR} macros instead.
> 
> The man page says that those were introduced in glibc-2.1.91.  Is that
> sufficiently ancient?  I thought shutdown(fd, 2) was the canonical way to
> do it in portable code.

Just by going by the timestamps (didn't look at the actual changelogs) on 
GNU's FTP[1], glibc-2.2 was released in 2001. The POSIX docs[2] document these 
macros and claim copyright 1997 even, so I guess it would be okay.

Note: I'd also much rather

  #ifndef SHUT_RDWR
  // workaround for systems that don't define these for shutdown()
  #  define SHUT_RDWR 2
  #endif

somewhere and leave the code self-documenting. Note also that trying to 
understand the magic number using the POSIX docs wouldn't work, since there 
their values aren't documented!

Disclaimer: I can't say how portable that would be. I only use at least 
halfway current Linux systems, so I would never know.

Uli

http://ftp.gnu.org/gnu/glibc/
http://www.opengroup.org/onlinepubs/7990989775/xns/shutdown.html


More information about the Xcb mailing list