Skip to content

Commit

Permalink
Correct comments in port-sockets.h
Browse files Browse the repository at this point in the history
  • Loading branch information
greghudson committed Jul 12, 2012
1 parent 244bb3f commit 666be8d
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions src/include/port-sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <ws2tcpip.h>
#include <errno.h>

/* Some of our own infrastructure where the WinSock stuff was too hairy
to dump into a clean Unix program... */
/* Some of our own infrastructure where the Winsock stuff was too hairy
* to dump into a clean Unix program */

typedef WSABUF sg_buf;

Expand All @@ -33,9 +33,11 @@ typedef WSABUF sg_buf;
#define SOCKET_CLOSE close /* XXX */
#define SOCKET_EINTR WSAEINTR

/* Return -1 for error or number of bytes written.
TMP is a temporary variable; must be declared by the caller, and
must be used by this macro (to avoid compiler warnings). */
/*
* Return -1 for error or number of bytes written. TMP is a temporary
* variable; must be declared by the caller, and must be used by this macro (to
* avoid compiler warnings).
*/
/* WSASend returns 0 or SOCKET_ERROR. */
#define SOCKET_WRITEV_TEMP DWORD
#define SOCKET_WRITEV(FD, SG, LEN, TMP) \
Expand All @@ -46,8 +48,8 @@ typedef WSABUF sg_buf;
#define SHUTDOWN_BOTH SD_BOTH

/*
* Define any missing Posix socket errors
* This is for compatibiliy with older versions of msvc (pre-2010)
* Define any missing POSIX socket errors. This is for compatibility with
* older versions of MSVC (pre-2010).
*/
#ifndef EINPROGRESS
#define EINPROGRESS WSAEINPROGRESS
Expand All @@ -72,9 +74,8 @@ typedef WSABUF sg_buf;
#endif

/*
* Translate WinSock errors to their Posix counterparts.
* This is necessary for msvc 2010+, where both WinSock and Posix errors
* are defined.
* Translate Winsock errors to their POSIX counterparts. This is necessary for
* MSVC 2010+, where both Winsock and POSIX errors are defined.
*/
static __inline int TranslatedWSAGetLastError()
{
Expand Down Expand Up @@ -102,8 +103,8 @@ static __inline int TranslatedWSAGetLastError()

#elif defined(__palmos__)

/* If this source file requires it, define struct sockaddr_in
(and possibly other things related to network I/O). */
/* If this source file requires it, define struct sockaddr_in (and possibly
* other things related to network I/O). */

#include "autoconf.h"
#include <netdb.h>
Expand Down Expand Up @@ -133,14 +134,15 @@ extern int h_errno; /* In case it's missing, e.g., HP-UX 10.20. */
#include <sys/filio.h> /* For FIONBIO on Solaris. */
#endif

/* Either size_t or int or unsigned int is probably right. Under
SunOS 4, it looks like int is desired, according to the accept man
page. */
/*
* Either size_t or int or unsigned int is probably right. Under
* SunOS 4, it looks like int is desired, according to the accept man
* page.
*/
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif

/* XXX should only be done if sockaddr_storage not found */
#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
struct krb5int_sockaddr_storage {
struct sockaddr_in s;
Expand All @@ -150,9 +152,7 @@ struct krb5int_sockaddr_storage {
#define sockaddr_storage krb5int_sockaddr_storage
#endif

/*
* Compatability with WinSock calls on MS-Windows...
*/
/* Unix equivalents of Winsock calls */
#define SOCKET int
#define INVALID_SOCKET ((SOCKET)~0)
#define closesocket close
Expand All @@ -171,9 +171,6 @@ typedef struct iovec sg_buf;
#define SG_BUF(SG) ((char*)(SG)->iov_base + 0)
#define SG_SET(SG, B, L) ((SG)->iov_base = (char*)(B), (SG)->iov_len = (L))

/* Some of our own infrastructure where the WinSock stuff was too hairy
to dump into a clean Unix program... */

#define SOCKET_INITIALIZE() (0) /* No error (or anything else) */
#define SOCKET_CLEANUP() /* nothing */
#define SOCKET_ERRNO errno
Expand All @@ -187,7 +184,7 @@ typedef struct iovec sg_buf;
#define SOCKET_EINTR EINTR
#define SOCKET_WRITEV_TEMP int
/* Use TMP to avoid compiler warnings and keep things consistent with
Windoze version. */
* Windows version. */
#define SOCKET_WRITEV(FD, SG, LEN, TMP) \
((TMP) = writev((FD), (SG), (LEN)), (TMP))

Expand Down

0 comments on commit 666be8d

Please sign in to comment.