diff options
author | Scott James Remnant <keybuk@google.com> | 2015-09-28 16:09:48 -0700 |
---|---|---|
committer | Scott James Remnant <keybuk@google.com> | 2015-09-28 16:09:48 -0700 |
commit | c2f4c40ed24d72fde8c26267d12fd6d0e84cdca5 (patch) | |
tree | ce77a15f35ab240ca3ddae138baf7b666b046202 | |
parent | 9a03be71872432e97207ae65ff8b1ef9180018fd (diff) | |
download | libchromeos-c2f4c40ed24d72fde8c26267d12fd6d0e84cdca5.tar.gz |
libchromeos-host: build subset, enabling non-Linux hosts
Adjust the libchromeos-host build so that it doesn't include the
components that rely on Linux-specific signalfd() and openat()
functionality.
For the error number list, don't include Linux-specific errors.
Finally replace setresuid() and setresgid() with setreuid() and
setregid() on non-Linux platforms.
BUG=24073089
TEST=libchromeos-host builds on Mac,
dbus-binding-generator builds and runs on a Mac host,
peerd's build uses dbus-binding-generator on a Mac host.
Change-Id: Ic68a097d9a007c3392fcdb88b48ed8b27563e45a
-rw-r--r-- | Android.mk | 16 | ||||
-rw-r--r-- | chromeos/errors/error_codes.cc | 20 | ||||
-rw-r--r-- | chromeos/process.cc | 5 |
3 files changed, 33 insertions, 8 deletions
@@ -16,13 +16,10 @@ LOCAL_PATH := $(call my-dir) libchromeos_cpp_extension := .cc libchromeos_core_sources := \ - chromeos/asynchronous_signal_handler.cc \ chromeos/backoff_entry.cc \ - chromeos/daemons/daemon.cc \ chromeos/data_encoding.cc \ chromeos/errors/error.cc \ chromeos/errors/error_codes.cc \ - chromeos/file_utils.cc \ chromeos/flag_helper.cc \ chromeos/key_value_store.cc \ chromeos/message_loops/base_message_loop.cc \ @@ -30,7 +27,6 @@ libchromeos_core_sources := \ chromeos/message_loops/message_loop_utils.cc \ chromeos/mime_utils.cc \ chromeos/process.cc \ - chromeos/process_reaper.cc \ chromeos/process_information.cc \ chromeos/secure_blob.cc \ chromeos/strings/string_utils.cc \ @@ -38,6 +34,12 @@ libchromeos_core_sources := \ chromeos/type_name_undecorate.cc \ chromeos/url_utils.cc \ +libchromeos_linux_sources := \ + chromeos/asynchronous_signal_handler.cc \ + chromeos/daemons/daemon.cc \ + chromeos/file_utils.cc \ + chromeos/process_reaper.cc \ + libchromeos_binder_sources := \ chromeos/binder_watcher.cc \ @@ -129,7 +131,7 @@ libchromeos_shared_libraries := libchrome include $(CLEAR_VARS) LOCAL_CPP_EXTENSION := $(libchromeos_cpp_extension) LOCAL_MODULE := libchromeos -LOCAL_SRC_FILES := $(libchromeos_core_sources) +LOCAL_SRC_FILES := $(libchromeos_core_sources) $(libchromeos_linux_sources) LOCAL_C_INCLUDES := $(libchromeos_includes) LOCAL_SHARED_LIBRARIES := $(libchromeos_shared_libraries) LOCAL_STATIC_LIBRARIES := libmodpb64 @@ -241,7 +243,7 @@ include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_CPP_EXTENSION := $(libchromeos_cpp_extension) LOCAL_MODULE := libchromeos -LOCAL_SRC_FILES := $(libchromeos_core_sources) +LOCAL_SRC_FILES := $(libchromeos_core_sources) $(libchromeos_linux_sources) LOCAL_C_INCLUDES := $(libchromeos_includes) LOCAL_SHARED_LIBRARIES := $(libchromeos_shared_libraries) LOCAL_STATIC_LIBRARIES := libmodpb64 @@ -271,7 +273,6 @@ include $(BUILD_STATIC_LIBRARY) # Shared library for host # ======================================================== -ifeq ($(HOST_OS),linux) include $(CLEAR_VARS) LOCAL_CPP_EXTENSION := $(libchromeos_cpp_extension) LOCAL_MODULE := libchromeos-host @@ -285,7 +286,6 @@ LOCAL_RTTI_FLAG := -frtti LOCAL_CLANG := true LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) include $(BUILD_HOST_SHARED_LIBRARY) -endif # Unit tests. # ======================================================== diff --git a/chromeos/errors/error_codes.cc b/chromeos/errors/error_codes.cc index e0c2e8a..14af14b 100644 --- a/chromeos/errors/error_codes.cc +++ b/chromeos/errors/error_codes.cc @@ -74,6 +74,7 @@ const struct ErrorMapEntry { ERROR_ENTRY(ELOOP), // Too many symbolic links encountered ERROR_ENTRY(ENOMSG), // No message of desired type ERROR_ENTRY(EIDRM), // Identifier removed +#ifdef __linux__ ERROR_ENTRY(ECHRNG), // Channel number out of range ERROR_ENTRY(EL2NSYNC), // Level 2 not synchronized ERROR_ENTRY(EL3HLT), // Level 3 halted @@ -89,22 +90,30 @@ const struct ErrorMapEntry { ERROR_ENTRY(EBADRQC), // Invalid request code ERROR_ENTRY(EBADSLT), // Invalid slot ERROR_ENTRY(EBFONT), // Bad font file format +#endif // __linux__ ERROR_ENTRY(ENOSTR), // Device not a stream ERROR_ENTRY(ENODATA), // No data available ERROR_ENTRY(ETIME), // Timer expired ERROR_ENTRY(ENOSR), // Out of streams resources +#ifdef __linux__ ERROR_ENTRY(ENONET), // Machine is not on the network ERROR_ENTRY(ENOPKG), // Package not installed +#endif // __linux__ ERROR_ENTRY(EREMOTE), // Object is remote ERROR_ENTRY(ENOLINK), // Link has been severed +#ifdef __linux__ ERROR_ENTRY(EADV), // Advertise error ERROR_ENTRY(ESRMNT), // Srmount error ERROR_ENTRY(ECOMM), // Communication error on send +#endif // __linux__ ERROR_ENTRY(EPROTO), // Protocol error ERROR_ENTRY(EMULTIHOP), // Multihop attempted +#ifdef __linux__ ERROR_ENTRY(EDOTDOT), // RFS specific error +#endif // __linux__ ERROR_ENTRY(EBADMSG), // Not a data message ERROR_ENTRY(EOVERFLOW), // Value too large for defined data type +#ifdef __linux__ ERROR_ENTRY(ENOTUNIQ), // Name not unique on network ERROR_ENTRY(EBADFD), // File descriptor in bad state ERROR_ENTRY(EREMCHG), // Remote address changed @@ -113,9 +122,12 @@ const struct ErrorMapEntry { ERROR_ENTRY(ELIBSCN), // .lib section in a.out corrupted ERROR_ENTRY(ELIBMAX), // Attempting to link in too many shared libs. ERROR_ENTRY(ELIBEXEC), // Cannot exec a shared library directly +#endif // __linux__ ERROR_ENTRY(EILSEQ), // Illegal byte sequence +#ifdef __linux__ ERROR_ENTRY(ERESTART), // Interrupted system call should be restarted ERROR_ENTRY(ESTRPIPE), // Streams pipe error +#endif // __linux__ ERROR_ENTRY(EUSERS), // Too many users ERROR_ENTRY(ENOTSOCK), // Socket operation on non-socket ERROR_ENTRY(EDESTADDRREQ), // Destination address required @@ -146,23 +158,31 @@ const struct ErrorMapEntry { ERROR_ENTRY(EALREADY), // Operation already in progress ERROR_ENTRY(EINPROGRESS), // Operation now in progress ERROR_ENTRY(ESTALE), // Stale file handle +#ifdef __linux__ ERROR_ENTRY(EUCLEAN), // Structure needs cleaning ERROR_ENTRY(ENOTNAM), // Not a XENIX named type file ERROR_ENTRY(ENAVAIL), // No XENIX semaphores available ERROR_ENTRY(EISNAM), // Is a named type file ERROR_ENTRY(EREMOTEIO), // Remote I/O error +#endif // __linux__ ERROR_ENTRY(EDQUOT), // Quota exceeded +#ifdef __linux__ ERROR_ENTRY(ENOMEDIUM), // No medium found ERROR_ENTRY(EMEDIUMTYPE), // Wrong medium type +#endif // __linux__ ERROR_ENTRY(ECANCELED), // Operation Canceled +#ifdef __linux__ ERROR_ENTRY(ENOKEY), // Required key not available ERROR_ENTRY(EKEYEXPIRED), // Key has expired ERROR_ENTRY(EKEYREVOKED), // Key has been revoked ERROR_ENTRY(EKEYREJECTED), // Key was rejected by service +#endif // __linux__ ERROR_ENTRY(EOWNERDEAD), // Owner died ERROR_ENTRY(ENOTRECOVERABLE), // State not recoverable +#ifdef __linux__ ERROR_ENTRY(ERFKILL), // Operation not possible due to RF-kill ERROR_ENTRY(EHWPOISON), // Memory page has hardware error +#endif // __linux__ #undef ERROR_ENTRY // This list comes from <errno.h> system header. The elements are ordered // by increasing errnum values which is the same order used in the header diff --git a/chromeos/process.cc b/chromeos/process.cc index 4c34ee2..ffe1525 100644 --- a/chromeos/process.cc +++ b/chromeos/process.cc @@ -21,6 +21,11 @@ #include <base/strings/string_util.h> #include <base/time/time.h> +#ifndef __linux__ +#define setresuid(_u1, _u2, _u3) setreuid(_u1, _u2) +#define setresgid(_g1, _g2, _g3) setregid(_g1, _g2) +#endif // !__linux__ + namespace chromeos { bool ReturnTrue() { |