Fixed building with a bazel with hdrs_check fixed again.
Change-Id: I015f66cd6e02e07efa367b96edd775015ac0abca
diff --git a/aos/linux_code/BUILD b/aos/linux_code/BUILD
index de7f903..6c4d1e0 100644
--- a/aos/linux_code/BUILD
+++ b/aos/linux_code/BUILD
@@ -12,6 +12,14 @@
)
cc_library(
+ name = 'queue',
+ visibility = ['//aos/common:__pkg__'],
+ hdrs = [
+ 'queue-tmpl.h',
+ ],
+)
+
+cc_library(
name = 'complex_thread_local',
srcs = [
'complex_thread_local.cc',
@@ -50,7 +58,7 @@
deps = [
'//aos/linux_code/ipc_lib:shared_mem',
'//aos/common:die',
- '//aos/common/logging',
+ '//aos/linux_code/logging:linux_logging',
],
)
@@ -65,6 +73,7 @@
deps = [
'//aos/common:once',
'//aos/common/logging',
+ '//aos/common:unique_malloc_ptr',
],
)
diff --git a/aos/linux_code/ipc_lib/BUILD b/aos/linux_code/ipc_lib/BUILD
index 077968b..47b9e8e 100644
--- a/aos/linux_code/ipc_lib/BUILD
+++ b/aos/linux_code/ipc_lib/BUILD
@@ -11,6 +11,7 @@
deps = [
'//aos/common/logging:logging_interface',
'//aos/common:once',
+ '//aos/common:macros',
],
)
@@ -24,7 +25,7 @@
],
deps = [
':aos_sync',
- ':shared_mem',
+ ':shared_mem_types',
],
)
@@ -38,7 +39,22 @@
],
deps = [
':aos_sync',
+ ':core_lib',
+ ':shared_mem_types',
'//aos/common/logging:logging_interface',
+ '//debian:librt',
+ ],
+)
+
+cc_library(
+ # TODO(Brian): This should be shared_mem{,.h}, and the other one should be
+ # shared_mem_init{,.cc,.h}.
+ name = 'shared_mem_types',
+ hdrs = [
+ 'shared_mem_types.h',
+ ],
+ deps = [
+ ':aos_sync',
],
)
@@ -54,8 +70,10 @@
'//aos/linux_code/ipc_lib:condition',
'//aos/linux_code/ipc_lib:mutex',
':core_lib',
+ ':shared_mem',
'//aos/common/logging:logging_interface',
'//debian:librt',
+ '//aos/common/util:options',
],
)
@@ -112,6 +130,7 @@
],
deps = [
':mutex',
+ '//aos/common:condition',
':aos_sync',
'//aos/common/logging:logging_interface',
],
@@ -125,6 +144,8 @@
deps = [
':aos_sync',
'//aos/common/logging:logging_interface',
+ '//aos/common:type_traits',
+ '//aos/common:mutex',
],
)
@@ -136,5 +157,6 @@
deps = [
':aos_sync',
'//aos/common/logging:logging_interface',
+ '//aos/common:event',
],
)
diff --git a/aos/linux_code/ipc_lib/core_lib.c b/aos/linux_code/ipc_lib/core_lib.c
index de418a4..ddcd7f5 100644
--- a/aos/linux_code/ipc_lib/core_lib.c
+++ b/aos/linux_code/ipc_lib/core_lib.c
@@ -4,7 +4,7 @@
#include <stdlib.h>
#include <assert.h>
-#include "aos/linux_code/ipc_lib/shared_mem.h"
+#include "aos/linux_code/ipc_lib/shared_mem_types.h"
static uint8_t aos_8max(uint8_t l, uint8_t r) {
return (l > r) ? l : r;
diff --git a/aos/linux_code/ipc_lib/shared_mem.c b/aos/linux_code/ipc_lib/shared_mem.c
index c43bfa2..f0a2aee 100644
--- a/aos/linux_code/ipc_lib/shared_mem.c
+++ b/aos/linux_code/ipc_lib/shared_mem.c
@@ -12,6 +12,7 @@
#include "aos/linux_code/ipc_lib/core_lib.h"
#include "aos/common/logging/logging.h"
+#include "aos/linux_code/ipc_lib/aos_sync.h"
// the path for the shared memory segment. see shm_open(3) for restrictions
#define AOS_SHM_NAME "/aos_shared_mem"
diff --git a/aos/linux_code/ipc_lib/shared_mem.h b/aos/linux_code/ipc_lib/shared_mem.h
index 423fd0c..36acfd0 100644
--- a/aos/linux_code/ipc_lib/shared_mem.h
+++ b/aos/linux_code/ipc_lib/shared_mem.h
@@ -5,60 +5,12 @@
#include <unistd.h>
#include <time.h>
-#include "aos/linux_code/ipc_lib/aos_sync.h"
+#include "aos/linux_code/ipc_lib/shared_mem_types.h"
#ifdef __cplusplus
extern "C" {
#endif
-extern struct aos_core *global_core __attribute__((weak));
-
-// Where the shared memory segment starts in each process's address space.
-// Has to be the same in all of them so that stuff in shared memory
-// can have regular pointers to other stuff in shared memory.
-#define SHM_START 0x20000000
-
-// A structure that represents some kind of global pointer that everything
-// shares.
-typedef struct aos_global_pointer_t {
- struct aos_mutex lock;
- void *pointer;
-} aos_global_pointer;
-
-typedef struct aos_shm_core_t {
- // Gets 0-initialized at the start (as part of shared memory) and
- // the owner sets as soon as it finishes setting stuff up.
- aos_condition creation_condition;
-
- // An offset from CLOCK_REALTIME to times for all the code.
- // This is currently only set to non-zero by the log replay code.
- // There is no synchronization on this to avoid the overhead because it is
- // only updated with proper memory barriers when only a single task is
- // running.
- struct timespec time_offset;
-
- struct aos_mutex msg_alloc_lock;
- void *msg_alloc;
-
- // A pointer to the head of the linked list of queues.
- // pointer points to a ::aos::Queue.
- aos_global_pointer queues;
- // A pointer to the head of the linked list of queue message types.
- // pointer points to a ::aos::type_cache::ShmType.
- aos_global_pointer queue_types;
-} aos_shm_core;
-
-struct aos_core {
- // Non-0 if we "own" shared_mem and should shm_unlink(3) it when we're done.
- int owner;
- void *shared_mem;
- // How large the chunk of shared memory is.
- ptrdiff_t size;
- aos_shm_core *mem_struct;
- // For the owner to store the name of the file to unlink when closing.
- const char *shm_name;
-};
-
void init_shared_mem_core(aos_shm_core *shm_core);
ptrdiff_t aos_core_get_mem_usage(void);
diff --git a/aos/linux_code/ipc_lib/shared_mem_types.h b/aos/linux_code/ipc_lib/shared_mem_types.h
new file mode 100644
index 0000000..81fab60
--- /dev/null
+++ b/aos/linux_code/ipc_lib/shared_mem_types.h
@@ -0,0 +1,64 @@
+#ifndef AOS_LINUX_CODE_IPC_LIB_SHARED_MEM_TYPES_H_
+#define AOS_LINUX_CODE_IPC_LIB_SHARED_MEM_TYPES_H_
+
+#include <stddef.h>
+
+#include "aos/linux_code/ipc_lib/aos_sync.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern struct aos_core *global_core __attribute__((weak));
+
+// Where the shared memory segment starts in each process's address space.
+// Has to be the same in all of them so that stuff in shared memory
+// can have regular pointers to other stuff in shared memory.
+#define SHM_START 0x20000000
+
+// A structure that represents some kind of global pointer that everything
+// shares.
+typedef struct aos_global_pointer_t {
+ struct aos_mutex lock;
+ void *pointer;
+} aos_global_pointer;
+
+typedef struct aos_shm_core_t {
+ // Gets 0-initialized at the start (as part of shared memory) and
+ // the owner sets as soon as it finishes setting stuff up.
+ aos_condition creation_condition;
+
+ // An offset from CLOCK_REALTIME to times for all the code.
+ // This is currently only set to non-zero by the log replay code.
+ // There is no synchronization on this to avoid the overhead because it is
+ // only updated with proper memory barriers when only a single task is
+ // running.
+ struct timespec time_offset;
+
+ struct aos_mutex msg_alloc_lock;
+ void *msg_alloc;
+
+ // A pointer to the head of the linked list of queues.
+ // pointer points to a ::aos::Queue.
+ aos_global_pointer queues;
+ // A pointer to the head of the linked list of queue message types.
+ // pointer points to a ::aos::type_cache::ShmType.
+ aos_global_pointer queue_types;
+} aos_shm_core;
+
+struct aos_core {
+ // Non-0 if we "own" shared_mem and should shm_unlink(3) it when we're done.
+ int owner;
+ void *shared_mem;
+ // How large the chunk of shared memory is.
+ ptrdiff_t size;
+ aos_shm_core *mem_struct;
+ // For the owner to store the name of the file to unlink when closing.
+ const char *shm_name;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AOS_LINUX_CODE_IPC_LIB_SHARED_MEM_TYPES_H_
diff --git a/aos/linux_code/logging/BUILD b/aos/linux_code/logging/BUILD
index 29c6d78..aea10f8 100644
--- a/aos/linux_code/logging/BUILD
+++ b/aos/linux_code/logging/BUILD
@@ -55,6 +55,7 @@
':binary_log_file',
'//aos/common:queue_types',
'//aos/linux_code:configuration',
+ '//aos/common/util:string_to_num',
],
)
@@ -80,17 +81,25 @@
deps = [
'//aos/linux_code:complex_thread_local',
'//aos/common:die',
+ '//aos/common/logging:context',
],
)
cc_library(
name = 'linux_logging',
- visibility = ['//aos/common/logging:__pkg__'],
+ visibility = [
+ '//aos/common/logging:__pkg__',
+ '//aos/linux_code:__subpackages__'
+ ],
+ hdrs = [
+ 'linux_logging.h',
+ ],
srcs = [
'linux_logging.cc',
],
deps = [
'//aos/linux_code/ipc_lib:queue',
'//aos/common:time',
+ '//aos/common/logging:logging',
],
)
diff --git a/aos/linux_code/logging/linux_interface.cc b/aos/linux_code/logging/linux_interface.cc
index b0a5c1b..dff48e1 100644
--- a/aos/linux_code/logging/linux_interface.cc
+++ b/aos/linux_code/logging/linux_interface.cc
@@ -1,6 +1,10 @@
-#include "aos/linux_code/logging/linux_logging.h"
+#include "aos/common/logging/context.h"
+#include <string>
+#include <string.h>
#include <sys/prctl.h>
+#include <sys/types.h>
+#include <unistd.h>
#include "aos/linux_code/complex_thread_local.h"
#include "aos/common/die.h"
diff --git a/aos/linux_code/logging/linux_logging.cc b/aos/linux_code/logging/linux_logging.cc
index b13a740..b73595b 100644
--- a/aos/linux_code/logging/linux_logging.cc
+++ b/aos/linux_code/logging/linux_logging.cc
@@ -13,7 +13,7 @@
#include <algorithm>
#include "aos/common/die.h"
-#include "aos/common/logging/logging_impl.h"
+#include "aos/common/logging/logging_interface.h"
#include "aos/linux_code/ipc_lib/queue.h"
#include "aos/common/time.h"
diff --git a/aos/linux_code/starter/BUILD b/aos/linux_code/starter/BUILD
index bccb7f5..5e3ac38 100644
--- a/aos/linux_code/starter/BUILD
+++ b/aos/linux_code/starter/BUILD
@@ -21,5 +21,6 @@
'//aos/common:time',
'//aos/common/libc:aos_strsignal',
'//aos/common/util:run_command',
+ '//aos/common:unique_malloc_ptr',
],
)