Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add CAP_BLOCK_SUSPEND to OS constants
Bug: 10901016
Change-Id: I162bde82bce9fca8eabc7168a172d3d8365e1578
  • Loading branch information
Michael Wright authored and Faryaab committed Dec 23, 2013
1 parent 47199dd commit 64f3de6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions luni/src/main/java/libcore/io/OsConstants.java
Expand Up @@ -48,6 +48,7 @@ private OsConstants() { }
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();
Expand Down
8 changes: 8 additions & 0 deletions luni/src/main/native/Portability.h
Expand Up @@ -74,6 +74,14 @@ static inline int mincore(void* addr, size_t length, unsigned char* vec) {
#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
2 changes: 2 additions & 0 deletions luni/src/main/native/libcore_io_OsConstants.cpp
Expand Up @@ -18,6 +18,7 @@

#include "JNIHelp.h"
#include "JniConstants.h"
#include "Portability.h"

#include <errno.h>
#include <fcntl.h>
Expand Down Expand Up @@ -58,6 +59,7 @@ static void OsConstants_initConstants(JNIEnv* env, jclass c) {
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);
Expand Down

0 comments on commit 64f3de6

Please sign in to comment.