diff options
author | Martijn Coenen <maco@google.com> | 2019-01-04 10:53:26 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-01-04 10:53:26 -0800 |
commit | 08ba9b1412f0bbf381b7069bf15e536ef5c4ba64 (patch) | |
tree | c47a435264644d13299fa7def58170d8a1218b46 | |
parent | 883a07d7202b2e4a1bd6f7a6ea08c8d13814e020 (diff) | |
parent | 5fa5708025843fe24566401025d830f05a3a39e2 (diff) | |
download | core-08ba9b1412f0bbf381b7069bf15e536ef5c4ba64.tar.gz |
Export maximum number of fds/ints in a native_handle. am: 02debfa2df
am: 5fa5708025
Change-Id: I7812acbfd43811e332513b9945432d23fba94187
-rw-r--r-- | libcutils/include/cutils/native_handle.h | 3 | ||||
-rw-r--r-- | libcutils/native_handle.cpp | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/libcutils/include/cutils/native_handle.h b/libcutils/include/cutils/native_handle.h index 10f5bc094..f6cae360f 100644 --- a/libcutils/include/cutils/native_handle.h +++ b/libcutils/include/cutils/native_handle.h @@ -23,6 +23,9 @@ extern "C" { #endif +#define NATIVE_HANDLE_MAX_FDS 1024 +#define NATIVE_HANDLE_MAX_INTS 1024 + /* Declare a char array for use with native_handle_init */ #define NATIVE_HANDLE_DECLARE_STORAGE(name, maxFds, maxInts) \ alignas(native_handle_t) char (name)[ \ diff --git a/libcutils/native_handle.cpp b/libcutils/native_handle.cpp index 66f7a3d59..b409e5b9d 100644 --- a/libcutils/native_handle.cpp +++ b/libcutils/native_handle.cpp @@ -22,9 +22,6 @@ #include <string.h> #include <unistd.h> -static const int kMaxNativeFds = 1024; -static const int kMaxNativeInts = 1024; - native_handle_t* native_handle_init(char* storage, int numFds, int numInts) { if ((uintptr_t) storage % alignof(native_handle_t)) { errno = EINVAL; @@ -39,7 +36,8 @@ native_handle_t* native_handle_init(char* storage, int numFds, int numInts) { } native_handle_t* native_handle_create(int numFds, int numInts) { - if (numFds < 0 || numInts < 0 || numFds > kMaxNativeFds || numInts > kMaxNativeInts) { + if (numFds < 0 || numInts < 0 || numFds > NATIVE_HANDLE_MAX_FDS || + numInts > NATIVE_HANDLE_MAX_INTS) { errno = EINVAL; return NULL; } |