Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 May 2000 08:30:31 +0200
From:      Marc van Kempen <marc@bowtie.nl>
To:        hackers@freebsd.org
Subject:   CMSG_DATA and ALIGN macro
Message-ID:  <200005110630.IAA10990@bowtie.nl>

next in thread | raw e-mail | index | archive | help
Hi,

I tried sending this to freebsd-doc, but perhaps this place is better
suited.

The problem is that the ALIGN macro is not being 
picked up even though <sys/types.h> and <sys/socket.h> are included.
The problem arises from the use of the CMSG_DATA macro, which seems to
be related to sendmsg(), and uses the ALIGN macro.

The manual page for sendmsg() or similar states that you only need
<sys/types.h> and <sys/socket.h>, but this fails, it only works if 
you also include <machine/param.h> where the ALIGN macro is defined.

So the question is: is the manual page in error or are the 
include files wrong? If it's the manual page, in which manual
page are you supposed to find information about the use of the 
CMSG_DATA macro? Otherwise I suppose the <sys/socket.h> include file
should include <sys/param.h>?

See the example program, it doesn't compile without the 
<machine/param.h> include.

#include <sys/types.h>
#include <sys/socket.h>
#include <machine/param.h>

int
main(int argc, char **argv)
{
        struct msghdr msg;
        unsigned char *data;

        data = CMSG_DATA(&msg);

        return(0);
}


Marc.

-- 
----------------------------------------------------
Marc van Kempen                 BowTie Technology     
Email: marc@bowtie.nl            WWW & Databases
tel. +31 40 2 43 20 65         
fax. +31 40 2 44 21 86         http://www.bowtie.nl
----------------------------------------------------





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?200005110630.IAA10990>