From 7beb19f3fb57070fefe38ee1b7609a1e289c4572 Mon Sep 17 00:00:00 2001 From: itojun Date: Mon, 3 Apr 2000 06:00:29 +0000 Subject: [PATCH] hide CMSG_ALIGN from userland, it is not part of RFC2292/Posix.1g. --- sys/sys/socket.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/sys/sys/socket.h b/sys/sys/socket.h index 6e2c892c1e7..c8524ac9ed7 100644 --- a/sys/sys/socket.h +++ b/sys/sys/socket.h @@ -1,4 +1,4 @@ -/* $OpenBSD: socket.h,v 1.32 2000/03/04 02:34:23 itojun Exp $ */ +/* $OpenBSD: socket.h,v 1.33 2000/04/03 06:00:29 itojun Exp $ */ /* $NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $ */ /* @@ -348,26 +348,29 @@ struct cmsghdr { /* given pointer to struct cmsghdr, return pointer to data */ #define CMSG_DATA(cmsg) \ - ((u_char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))) + ((u_char *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr))) /* given pointer to struct cmsghdr, return pointer to next cmsghdr */ #define CMSG_NXTHDR(mhdr, cmsg) \ - (((caddr_t)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len) + \ - CMSG_ALIGN(sizeof(struct cmsghdr)) > \ + (((caddr_t)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len) + \ + __CMSG_ALIGN(sizeof(struct cmsghdr)) > \ (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ (struct cmsghdr *)NULL : \ - (struct cmsghdr *)((caddr_t)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len))) + (struct cmsghdr *)((caddr_t)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len))) #define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) /* Round len up to next alignment boundary */ -#define CMSG_ALIGN(len) ALIGN(len) +#define __CMSG_ALIGN(len) ALIGN(len) +#ifdef _KERNEL +#define CMSG_ALIGN(n) __CMSG_ALIGN(n) +#endif /* Length of the contents of a control message of length len */ -#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) +#define CMSG_LEN(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) /* Length of the space taken up by a padded control message of length len */ -#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) +#define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len)) /* "Socket"-level control message types: */ #define SCM_RIGHTS 0x01 /* access rights (array of int) */ -- 2.20.1