From cb90fdddc481aa9a4a04fc5fd5240f7ad5ff7e68 Mon Sep 17 00:00:00 2001 From: njoly Date: Tue, 16 Jun 2009 23:17:02 +0000 Subject: Add LINUX_CMSG_{SPACE,LEN} macros. Use then when calculating the msg_controllen size, when converting the control message buffer from native (previous version was missing the linux_cmsghdr size). --- sys/compat/linux/common/linux_socket.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sys/compat/linux/common/linux_socket.h') diff --git a/sys/compat/linux/common/linux_socket.h b/sys/compat/linux/common/linux_socket.h index e7ebd15fd90..e59fe712aa1 100644 --- a/sys/compat/linux/common/linux_socket.h +++ b/sys/compat/linux/common/linux_socket.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_socket.h,v 1.16 2008/04/28 20:23:44 martin Exp $ */ +/* $NetBSD: linux_socket.h,v 1.17 2009/06/16 23:17:02 njoly Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -179,6 +179,10 @@ struct linux_cmsghdr { ((mhdr)->msg_controllen >= sizeof(struct linux_cmsghdr) ? \ (struct linux_cmsghdr *)(mhdr)->msg_control : NULL) +#define LINUX_CMSG_SPACE(l) \ + (sizeof(struct linux_cmsghdr) + LINUX_CMSG_ALIGN(l)) +#define LINUX_CMSG_LEN(l) \ + (sizeof(struct linux_cmsghdr) + (l)) /* * Machine specific definitions. -- cgit