Date: Sat, 3 Jun 2000 02:10:39 -0400 (EDT) From: Arnar Mar Hrafnkelsson <addi@umich.edu> To: freebsd-hackers@FreeBSD.ORG Subject: Problem in sys/socket.h ? Message-ID: <Pine.LNX.4.21.0006030201070.2410-100000@snjaldra.ast.is>
next in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.21.0006030201070.2410-100000>