Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h

Issue 598223002: Add missing _ASSIGN() macro in NaCl's sys/socket.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h
diff --git a/native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h b/native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h
index b7555faed3eaa3bcfbc6cdd263623fe2f44071ab..86c687e4d5ac3cf5553500c37327332b15c71ffa 100644
--- a/native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h
+++ b/native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h
@@ -59,7 +59,7 @@ typedef _BSD_SA_FAMILY_T_ sa_family_t;
typedef _BSD_SOCKLEN_T_ socklen_t;
#undef _BSD_SOCKLEN_T_
#endif
-
+
/*
* Types
*/
@@ -355,6 +355,18 @@ struct cmsgcred {
gid_t cmcred_groups[CMGROUP_MAX]; /* groups */
};
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value
+ * for all data types (int, long, ...). The result is unsigned int
+ * and must be cast to any desired pointer type.
+ */
+#ifndef _ALIGNBYTES
+#define _ALIGNBYTES (sizeof(int) - 1)
+#endif
+#ifndef _ALIGN
+#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#endif
+
/* given pointer to struct cmsghdr, return pointer to data */
#define CMSG_DATA(cmsg) ((unsigned char *)(cmsg) + \
_ALIGN(sizeof(struct cmsghdr)))
@@ -370,7 +382,7 @@ struct cmsgcred {
#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control)
/* RFC 2292 additions */
-
+
#define CMSG_SPACE(l) (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l))
#define CMSG_LEN(l) (_ALIGN(sizeof(struct cmsghdr)) + (l))
« no previous file with comments | « native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698