I have a little issue with the sys/socket.h file under 4.0.  I myself do
not have access to 4.0 myself but am using output others have given me.

Under 3.3 The program source at the bottom compiles fine.  Under 4.0 the 
problem is that in sys/socket.h the macro CMSG_DATA() uses another macro
ALIGN() which itself does not provide and no file included by sys/socket.h
or sys/types.h.  
  I found that the ALIGN() macro seems to be defined in 
machine/param.h.  To me it doesn't seem very portable to include
machine/param.h.  But I wanted to know what is the recommended approach by
the FreeBSD team.

        Thanks, Arnar.

=======================

#ifdef HACK
#include <machine/param.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#define CONTROLLEN      (sizeof(struct cmsghdr) + sizeof(int))

int main(int argc,char *argv[]) {
        struct cmsghdr *cmptr;

        if ( (cmptr = malloc(CONTROLLEN)) == NULL) {
                perror("main malloc()");
                exit(2);
        }

        cmptr->cmsg_level  = SOL_SOCKET;
        cmptr->cmsg_type   = SCM_RIGHTS;
        cmptr->cmsg_len    = CONTROLLEN;
        *(int *)CMSG_DATA(cmptr) = 1;      /* the fd to pass */

        return 0;
}

=========================



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to