From owner-freebsd-hackers Fri Jun 2 23: 8:24 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from changeofhabit.mr.itd.umich.edu (changeofhabit.mr.itd.umich.edu [141.211.144.17]) by hub.freebsd.org (Postfix) with ESMTP id DE80637BAE4 for ; Fri, 2 Jun 2000 23:08:19 -0700 (PDT) (envelope-from addi@umich.edu) Received: from nic-163-c208-218.mw.mediaone.net (nic-163-c208-218.mw.mediaone.net [24.163.208.218]) by changeofhabit.mr.itd.umich.edu (8.9.3/3.2r) with ESMTP id CAA02009 for ; Sat, 3 Jun 2000 02:08:17 -0400 (EDT) Date: Sat, 3 Jun 2000 02:10:39 -0400 (EDT) From: Arnar Mar Hrafnkelsson X-Sender: addi@snjaldra.ast.is To: freebsd-hackers@FreeBSD.ORG Subject: Problem in sys/socket.h ? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 #endif #include #include #include #include #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