Add CAP_BLOCK_SUSPEND to OS constants

Bug: 10901016
Change-Id: I162bde82bce9fca8eabc7168a172d3d8365e1578
diff --git a/luni/src/main/java/libcore/io/OsConstants.java b/luni/src/main/java/libcore/io/OsConstants.java
index edecdd9..82d4498 100644
--- a/luni/src/main/java/libcore/io/OsConstants.java
+++ b/luni/src/main/java/libcore/io/OsConstants.java
@@ -48,6 +48,7 @@
     public static final int AI_V4MAPPED = placeholder();
     public static final int CAP_AUDIT_CONTROL = placeholder();
     public static final int CAP_AUDIT_WRITE = placeholder();
+    public static final int CAP_BLOCK_SUSPEND = placeholder();
     public static final int CAP_CHOWN = placeholder();
     public static final int CAP_DAC_OVERRIDE = placeholder();
     public static final int CAP_DAC_READ_SEARCH = placeholder();
diff --git a/luni/src/main/native/Portability.h b/luni/src/main/native/Portability.h
index 60b7062..1c64b03 100644
--- a/luni/src/main/native/Portability.h
+++ b/luni/src/main/native/Portability.h
@@ -74,6 +74,14 @@
 #include <sys/sendfile.h>
 #include <sys/statvfs.h>
 
+// The prebuilt toolchains tend to be rather old and don't include the newest
+// kernel headers. CAP_BLOCK_SUSPEND was introduced in 3.5, so until all of
+// headers update to at least that version, we need this hack.
+#ifndef CAP_BLOCK_SUSPEND
+#define CAP_BLOCK_SUSPEND 36
+#define CAP_LAST_CAP CAP_BLOCK_SUSPEND
+#endif // ifndef CAP_BLOCK_SUSPEND
+
 #endif
 
 #endif  // PORTABILITY_H_included
diff --git a/luni/src/main/native/libcore_io_OsConstants.cpp b/luni/src/main/native/libcore_io_OsConstants.cpp
index 8f1f506..e4eaecd 100644
--- a/luni/src/main/native/libcore_io_OsConstants.cpp
+++ b/luni/src/main/native/libcore_io_OsConstants.cpp
@@ -18,6 +18,7 @@
 
 #include "JNIHelp.h"
 #include "JniConstants.h"
+#include "Portability.h"
 
 #include <errno.h>
 #include <fcntl.h>
@@ -58,6 +59,7 @@
     initConstant(env, c, "AI_V4MAPPED", AI_V4MAPPED);
     initConstant(env, c, "CAP_AUDIT_CONTROL", CAP_AUDIT_CONTROL);
     initConstant(env, c, "CAP_AUDIT_WRITE", CAP_AUDIT_WRITE);
+    initConstant(env, c, "CAP_BLOCK_SUSPEND", CAP_BLOCK_SUSPEND);
     initConstant(env, c, "CAP_CHOWN", CAP_CHOWN);
     initConstant(env, c, "CAP_DAC_OVERRIDE", CAP_DAC_OVERRIDE);
     initConstant(env, c, "CAP_DAC_READ_SEARCH", CAP_DAC_READ_SEARCH);