Opened 10 years ago

Last modified 22 months ago

#228 accepted defect


Reported by: Silvan Scherrer Owned by: Yuri Dario
Priority: normal Milestone: libc-0.7
Component: libc Version:
Severity: normal Keywords:


in sys/socket.h the below defie are missing:

#ifndef CMSG_LEN
/* CMSG_LEN and CMSG_SPACE are defined by RFC 2292, but missing on
 * some older platforms.
#define CMSG_LEN(len) ((size_t)CMSG_DATA((struct cmsghdr *)NULL) + (len))

/* CMSG_SPACE must add at least as much padding as CMSG_NXTHDR()
 * adds. We overestimate here.
#define ALIGN_TO_SIZEOF(len, obj) (((len) + sizeof (obj) - 1) & ~(sizeof (obj)
- 1))
#define CMSG_SPACE(len) ALIGN_TO_SIZEOF (CMSG_LEN (len), struct cmsghdr)

Change History (6)

comment:1 Changed 10 years ago by bird

Component: baselayoutlibc
Milestone: libc-0.7

comment:2 Changed 10 years ago by bird

Unless these are present in the OS/2 toolkit, they will have to wait for the next libc version.

comment:3 Changed 6 years ago by Yuri Dario

Milestone: libc-0.7libc-0.6.6

comment:4 Changed 6 years ago by Yuri Dario

Owner: changed from bird to Yuri Dario
Status: newaccepted

comment:5 Changed 6 years ago by bird

Milestone: libc-0.6.6libc-0.7

This will have to wait for libc-0.7 as already stated. It will be part of an effort to resync socket.h and other with BSD.

comment:6 Changed 22 months ago by dmik

BTW, this is the version of these macros I did for chromium (here):

#ifndef CMSG_SPACE
#define CMSG_SPACE(l)           (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l))
#ifndef CMSG_LEN
#define CMSG_LEN(l)             (_ALIGN(sizeof(struct cmsghdr)) + (l))

Looks a bit simpler than the one in the description and uses _ALIGN which is already used by other CMSG defines.

Note: See TracTickets for help on using tickets.