summaryrefslogtreecommitdiff
path: root/defines.h
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2003-08-21 16:49:41 +1000
committerDarren Tucker <dtucker@zip.com.au>2003-08-21 16:49:41 +1000
commit8e3653d2f330a96b4aefaccac3f1031749aebd53 (patch)
tree964bc4cfcf6f155de6c29b87bdc5093ce4926913 /defines.h
parentf4220e6cefdddd30acd0dcaa152dedff84a15c0f (diff)
- (dtucker) [defines.h] Put CMSG_DATA, CMSG_FIRSTHDR with other CMSG* macros,
change CMSG_DATA to use __CMSG_ALIGN (and thus work properly), reformat for consistency.
Diffstat (limited to 'defines.h')
-rw-r--r--defines.h37
1 files changed, 18 insertions, 19 deletions
diff --git a/defines.h b/defines.h
index 3679ea549..b2ea15d9f 100644
--- a/defines.h
+++ b/defines.h
@@ -25,7 +25,7 @@
25#ifndef _DEFINES_H 25#ifndef _DEFINES_H
26#define _DEFINES_H 26#define _DEFINES_H
27 27
28/* $Id: defines.h,v 1.100 2003/08/07 05:58:28 dtucker Exp $ */ 28/* $Id: defines.h,v 1.101 2003/08/21 06:49:41 dtucker Exp $ */
29 29
30 30
31/* Constants */ 31/* Constants */
@@ -437,6 +437,23 @@ struct winsize {
437#define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len)) 437#define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len))
438#endif 438#endif
439 439
440/* given pointer to struct cmsghdr, return pointer to data */
441#ifndef CMSG_DATA
442#define CMSG_DATA(cmsg) ((u_char *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr)))
443#endif /* CMSG_DATA */
444
445/*
446 * RFC 2292 requires to check msg_controllen, in case that the kernel returns
447 * an empty list for some reasons.
448 */
449#ifndef CMSG_FIRSTHDR
450#define CMSG_FIRSTHDR(mhdr) \
451 ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
452 (struct cmsghdr *)(mhdr)->msg_control : \
453 (struct cmsghdr *)NULL)
454#endif /* CMSG_FIRSTHDR */
455
456
440/* Function replacement / compatibility hacks */ 457/* Function replacement / compatibility hacks */
441 458
442#if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO)) 459#if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO))
@@ -577,22 +594,4 @@ struct winsize {
577 594
578/** end of login recorder definitions */ 595/** end of login recorder definitions */
579 596
580#ifndef CMSG_DATA
581/* given pointer to struct cmsghdr, return pointer to data */
582#define CMSG_DATA(cmsg) \
583 ((u_char *)(cmsg) + (((u_int)(sizeof(struct cmsghdr)) \
584 (sizeof(int) - 1)) &~ (sizeof(int) - 1)))
585#endif /* CMSG_DATA */
586
587#ifndef CMSG_FIRSTHDR
588/*
589 * RFC 2292 requires to check msg_controllen, in case that the kernel returns
590 * an empty list for some reasons.
591 */
592# define CMSG_FIRSTHDR(mhdr) \
593 ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
594 (struct cmsghdr *)(mhdr)->msg_control : \
595 (struct cmsghdr *)NULL)
596#endif /* CMSG_FIRSTHDR */
597
598#endif /* _DEFINES_H */ 597#endif /* _DEFINES_H */