diff --git a/services/BUILD.gn b/services/BUILD.gn index 23e3e310998ba0eb46891f01a358e817fcf41835..6823523567708a3a8a9c11dd63455f5a5f17da1b 100755 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -81,6 +81,7 @@ if (defined(ohos_lite)) { } if (ohos_kernel_type == "linux") { defines += [ "NEED_EXEC_RCS_LINUX" ] + defines += [ "_GNU_SOURCE" ] ldflags += [ "-lm", "-lpthread", diff --git a/services/init/adapter/init_adapter.c b/services/init/adapter/init_adapter.c index 78361c59a913b28c65ecb328a1d0949144380f36..b63278db4d7b318c0f433392de2efd784457742e 100755 --- a/services/init/adapter/init_adapter.c +++ b/services/init/adapter/init_adapter.c @@ -60,7 +60,7 @@ int SetAmbientCapability(int cap) return 0; } -#ifdef __LINUX__ +#if (defined __LINUX__) && (defined NEED_EXEC_RCS_LINUX) static pid_t g_waitPid = -1; static sem_t *g_waitSem = NULL; static void SignalRegWaitSem(pid_t waitPid, sem_t *waitSem) diff --git a/services/loopevent/socket/le_socket.c b/services/loopevent/socket/le_socket.c index 0f8c9bbca1e1558b1dc39a8ffe302afc69e9f6bc..80a039f3ee0dcc974bcd87e0675e22fd4646c11f 100755 --- a/services/loopevent/socket/le_socket.c +++ b/services/loopevent/socket/le_socket.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/services/param/BUILD.gn b/services/param/BUILD.gn index 7d1be933966aa9099398e8c1d47f9c8ba3acf398..0094d5e6e34f04a479417cc2080b5c02ef135f8f 100755 --- a/services/param/BUILD.gn +++ b/services/param/BUILD.gn @@ -90,6 +90,8 @@ ohos_shared_library("param_client") { defines = [ "INIT_AGENT" ] + defines += [ "_GNU_SOURCE" ] + if (param_security == "selinux") { sources += [ "adapter/param_selinux.c" ] defines += [ "PARAM_SUPPORT_SELINUX" ] diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 5b99f0a4d176e08faa64afadc66a2d86d7fae3b1..aa24882c38c9168744adf1a2d7ce567d901fcf81 100755 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -184,6 +184,7 @@ ohos_unittest("init_ut") { "PARAM_SUPPORT_SAVE_PERSIST", "PARAM_SUPPORT_DAC", ] + defines += [ "_GNU_SOURCE" ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] diff --git a/test/unittest/common/BUILD.gn b/test/unittest/common/BUILD.gn index fde1f4c1f55f465154ce6ae9dd071c7bfd5f3139..3e1625a2bc774e172884ef3270586322ce0dc031 100755 --- a/test/unittest/common/BUILD.gn +++ b/test/unittest/common/BUILD.gn @@ -26,6 +26,7 @@ if (defined(ohos_lite)) { if (storage_type == "emmc") { defines += [ "USE_EMMC_STORAGE" ] } + defines += [ "_GNU_SOURCE" ] include_dirs = [ "//base/startup/init_lite/services/include",