-/* $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 $ */
/*
/* 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) */