Re: RE: scgi 1.11 on Solaris 8
"James C. McDonald" <[email protected]>
| Newsgroups | gmane.comp.web.quixote.user |
|---|---|
| Message-ID | <[email protected]> |
On Aug 22, 2006, at 9:55 AM, David Binger wrote: > On OS X, sys/socket.h has > > #define CMSG_LEN(l) (ALIGN(sizeof(struct cmsghdr)) + > (l)) > > and > > #define CMSG_SPACE(l) (ALIGN(sizeof(struct cmsghdr)) + > ALIGN(l)) > > where i386/param.h has > > #define ALIGNBYTES 3 > #define ALIGN(p) (((unsigned int)(p) + ALIGNBYTES) &~ > ALIGNBYTES) > > Should the Solaris 8 versions of CMSG_* also use some kind of ALIGN > macro? > First, thank you David for your response. Second, after a bit more digging, and looking at how other open source software packages solved this problem I'm now using the following patch, which is from the portable version of OpenSSH <http://www.openssh.com/portable.html> . As with the previous patch I can't say that this is the proper fix but initial testing looks OK. - Jim C. McDonald --- passfd.c.orig 2006-08-21 14:42:03.000000000 -0400 +++ passfd.c 2006-08-22 14:06:23.000000000 -0400 @@ -21,6 +21,22 @@ #include <sys/uio.h> #include <stddef.h> +#ifndef OSSH_ALIGNBYTES +#define OSSH_ALIGNBYTES (sizeof(int) - 1) +#endif +#ifndef __CMSG_ALIGN +#define __CMSG_ALIGN(p) (((u_int)(p) + OSSH_ALIGNBYTES) &~ OSSH_ALIGNBYTES) +#endif + +/* Length of the contents of a control message of length len */ +#ifndef CMSG_LEN +#define CMSG_LEN(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) +#endif + +/* Length of the space taken up by a padded control message of length len */ +#ifndef CMSG_SPACE +#define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len)) +#endif static int recv_fd(int sockfd)