summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authorsergeyu <sergeyu@chromium.org>2014-09-24 18:55:49 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-25 01:55:59 +0000
commit5912a1fdbadb3176a004e117d4a3ff15567dfa8e (patch)
treecf8b8724d3ca14952e8f7c12acb25b55fd3cfdf8 /native_client_sdk
parent4b6fdb2744017a7de07fd572b760b16292a6eaf2 (diff)
downloadchromium_src-5912a1fdbadb3176a004e117d4a3ff15567dfa8e.zip
chromium_src-5912a1fdbadb3176a004e117d4a3ff15567dfa8e.tar.gz
chromium_src-5912a1fdbadb3176a004e117d4a3ff15567dfa8e.tar.bz2
Add missing _ASSIGN() macro in NaCl's sys/socket.h
Some macros in sys/socket.h were using _ASSING() macro, which wasn't defined anywhere. BUG=402993 Review URL: https://codereview.chromium.org/598223002 Cr-Commit-Position: refs/heads/master@{#296621}
Diffstat (limited to 'native_client_sdk')
-rw-r--r--native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium1
-rw-r--r--native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h16
2 files changed, 15 insertions, 2 deletions
diff --git a/native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium b/native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium
index 87702be..9c527b5 100644
--- a/native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium
+++ b/native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium
@@ -28,3 +28,4 @@ Local Modifications:
* Added SOCK_CLOEXEC and SOCK_NONBLOCK socket type flags.
* Make sure SA_SIGINFO is defined under __native_client__
* Removed ss_len field from sockaddr_storage in sys/socket.h.
+* Added _ALIGNBYTES and _ALIGN() in 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 b7555fa..86c687e 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))