summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-22 13:56:33 +0900
committertakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-22 13:56:33 +0900
commit3bb491815394eecd8a7aff7b7d77ec62322f0de4 (patch)
tree3d7696ed318c8f5d0c917953fa52d938a4381c09
parentb7e715753434f3a5ae242b751dd7077448579058 (diff)
ns-commonlibrary branch 0.1sandbox/ToshikazuOhiwa/ns-commonlibrary
-rw-r--r--common_library/Makefile.client2
-rw-r--r--common_library/client/Makefile2
-rw-r--r--common_library/client/include/cl_cgroup.h2
-rw-r--r--common_library/client/include/cl_error.h2
-rw-r--r--common_library/client/include/cl_lock_internal.h2
-rw-r--r--common_library/client/include/cl_monitor_internal.h2
-rw-r--r--common_library/client/include/cl_process_internal.h2
-rw-r--r--common_library/client/include/native_service/cl_lock.h6
-rw-r--r--common_library/client/include/native_service/cl_lockid.h28
-rw-r--r--common_library/client/include/native_service/cl_monitor.h2
-rw-r--r--common_library/client/include/native_service/cl_process.h2
-rw-r--r--common_library/client/include/native_service/cl_region.h2
-rw-r--r--common_library/client/include/native_service/cl_sem.h2
-rw-r--r--common_library/client/include/native_service/common_library.h2
-rw-r--r--common_library/client/libcommon.ver2
-rw-r--r--common_library/client/src/cl_cgroup.c2
-rw-r--r--common_library/client/src/cl_lock.c2
-rw-r--r--common_library/client/src/cl_monitor.c2
-rw-r--r--common_library/client/src/cl_process.c28
-rw-r--r--common_library/client/src/cl_region.c2
-rw-r--r--common_library/client/src/cl_sem.c2
-rw-r--r--native_service.mk2
22 files changed, 72 insertions, 28 deletions
diff --git a/common_library/Makefile.client b/common_library/Makefile.client
index 66f890e6..e6210c45 100644
--- a/common_library/Makefile.client
+++ b/common_library/Makefile.client
@@ -1,5 +1,5 @@
#
-# @copyright Copyright (c) 2017-2019 TOYOTA MOTOR CORPORATION.
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/common_library/client/Makefile b/common_library/client/Makefile
index 9e02324f..4bda2aa2 100644
--- a/common_library/client/Makefile
+++ b/common_library/client/Makefile
@@ -1,5 +1,5 @@
#
-# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/common_library/client/include/cl_cgroup.h b/common_library/client/include/cl_cgroup.h
index 684cd76c..10a71791 100644
--- a/common_library/client/include/cl_cgroup.h
+++ b/common_library/client/include/cl_cgroup.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/include/cl_error.h b/common_library/client/include/cl_error.h
index f4e24c09..84bf64e0 100644
--- a/common_library/client/include/cl_error.h
+++ b/common_library/client/include/cl_error.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/include/cl_lock_internal.h b/common_library/client/include/cl_lock_internal.h
index 8d41be6b..7a2f623c 100644
--- a/common_library/client/include/cl_lock_internal.h
+++ b/common_library/client/include/cl_lock_internal.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/include/cl_monitor_internal.h b/common_library/client/include/cl_monitor_internal.h
index 5d66db4e..0a864a21 100644
--- a/common_library/client/include/cl_monitor_internal.h
+++ b/common_library/client/include/cl_monitor_internal.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/include/cl_process_internal.h b/common_library/client/include/cl_process_internal.h
index 05fd6870..ce001de5 100644
--- a/common_library/client/include/cl_process_internal.h
+++ b/common_library/client/include/cl_process_internal.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/include/native_service/cl_lock.h b/common_library/client/include/native_service/cl_lock.h
index dcf61001..d9745405 100644
--- a/common_library/client/include/native_service/cl_lock.h
+++ b/common_library/client/include/native_service/cl_lock.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -252,4 +252,8 @@ int CL_LockRelease(void *addr); // NOLINT(readability/nolint)
/** @}*/ // end of common_library
/** @}*/ // end of NativeService
/** @}*/ // end of BaseSystem
+#define LOCK_POS_MTX_RSV 40
+#define LOCK_HRDS_RSV 15
+#define LOCK_NSLOG_ACCES_IF_RSV 50
+#define LID_NUM 140
#endif // #ifndef _cl_lock_h_ // NOLINT(build/header_guard)
diff --git a/common_library/client/include/native_service/cl_lockid.h b/common_library/client/include/native_service/cl_lockid.h
index c76be374..a790a4bb 100644
--- a/common_library/client/include/native_service/cl_lockid.h
+++ b/common_library/client/include/native_service/cl_lockid.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,8 @@
#ifndef _cl_lockid_h_ // NOLINT(build/header_guard)
#define _cl_lockid_h_ // NOLINT(build/header_guard)
+#include <native_service/cl_lock.h>
+#include <assert.h>
/**
* @file cl_lockid.h
@@ -44,6 +46,14 @@
* Assign LID corresponding to the Lock name specified when requesting shared memories.
*/
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ENUM_LOCK_ID
+/// \~english @par Brief
+/// ID for Exclusive Control\n
+/// When AGL users add their own definitions, add "_**" to the definitions.\n
+/// ("**" is an aribitrary character string indicating the organization that uses AGL.)
+/////////////////////////////////////////////////////////////////////////////////////
+
typedef enum {
// LID_TEST_1 = 0,
// LID_TEST_2,
@@ -80,7 +90,8 @@ typedef enum {
LOCK_POS_MTX_30, /* Exclusive Control between POSITIONING and others */
LOCK_POS_MTX_31, /* Exclusive Control between POSITIONING and others */
LOCK_POS_MTX_32, /* Exclusive Control between POSITIONING and others */
- LOCK_CLOCK_SEM_TZ, /* Access control to shared memory for TimeZone */
+ LOCK_POS_MTX_MAX, /* Exclusive Control between POSITIONING and others MAX */
+ LOCK_CLOCK_SEM_TZ = (LOCK_POS_MTX_1+LOCK_POS_MTX_RSV), /* Access control to shared memory for TimeZone */
LOCK_SEC_DATA_PROTECT, /* Exclusive control to shared memory for the application that use the security chip. */
LOCK_OS_SEM_ID__CWORD68_, /* Exclusive Control for SSL library. */
LOCK_ROM_ACCESS_IF, /* Exclusive access control for system manager nv area */
@@ -94,7 +105,8 @@ typedef enum {
LOCK_HRDS_6, /* Exclusive Control between DataService and others */
LOCK_HRDS_7, /* Exclusive Control between DataService and others */
LOCK_HRDS_8, /* Exclusive Control between DataService and others */
- LOCK_LOGG_ACCESS_IF, /* Exclusive access control for NsLoggerService nv area */
+ LOCK_HRDS_MAX, /* Exclusive Control between DataService and others MAX */
+ LOCK_LOGG_ACCESS_IF = (LOCK_HRDS_1+LOCK_HRDS_RSV), /* Exclusive access control for NsLoggerService nv area */
LOCK__CWORD76__HMI, /* Exclusive Control between _CWORD76_Service and HMI's */
LOCK__CWORD76___CWORD58_, /* Exclusive Control between _CWORD76_Service and _CWORD58_Service */
LOCK_DIAGCODE_MEM, /* Exclusive Control to diag code memory area */
@@ -148,13 +160,19 @@ typedef enum {
LOCK_NSLOG_ACCES_IF_42, /* Exclusive Control between writing to log file */
LOCK_NSLOG_ACCES_IF_43, /* Exclusive Control between writing to log file */
- LOCK_INFOSETTING_REV, /* Exclusive control revision information for managing the settings */
+ LOCK_NSLOG_ACCES_IF_MAX, /* Exclusive Control between writing to log file MAX */
+ LOCK_INFOSETTING_REV = (LOCK_NSLOG_ACCES_IF_1+LOCK_NSLOG_ACCES_IF_RSV), /* Exclusive control revision information for managing the settings */
LOCK_SUBMENU_SELECT, /* Exclusive control between writing the selection information of the sub-menu*/
LOCK_DIAG_SEM1, /* Exclusive Control between DiagService and others */
LOCK_DIAG_SEM2, /* Exclusive Control between Collect thread and Upload thread */
- LID_NUM /* Number of LockID */
+ LID_NUM_MAX /* Number of LockID */
} ENUM_LOCK_ID;
+static_assert(LOCK_POS_MTX_MAX <= (LOCK_POS_MTX_1+LOCK_POS_MTX_RSV), "LOCK_POS_MTX_RSV resource empty. Please change limit and build AGL.");
+static_assert(LOCK_HRDS_MAX <= (LOCK_HRDS_1+LOCK_HRDS_RSV), "LOCK_HRDS_RSV resource empty. Please change limit and build AGL.");
+static_assert(LOCK_NSLOG_ACCES_IF_MAX <= (LOCK_NSLOG_ACCES_IF_1+LOCK_NSLOG_ACCES_IF_RSV), "LOCK_NSLOG_ACCES_IF_RSV resource empty. Please change limit and build AGL.");
+static_assert(LID_NUM_MAX <= LID_NUM, "LOCK_ID resource empty. Please change limit and build AGL.");
+
/** @}*/ // end of common_library
/** @}*/ // end of NativeService
/** @}*/ // end of BaseSystem
diff --git a/common_library/client/include/native_service/cl_monitor.h b/common_library/client/include/native_service/cl_monitor.h
index d2e3c503..650492cf 100644
--- a/common_library/client/include/native_service/cl_monitor.h
+++ b/common_library/client/include/native_service/cl_monitor.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/include/native_service/cl_process.h b/common_library/client/include/native_service/cl_process.h
index 01dc064b..6a9adbfb 100644
--- a/common_library/client/include/native_service/cl_process.h
+++ b/common_library/client/include/native_service/cl_process.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/include/native_service/cl_region.h b/common_library/client/include/native_service/cl_region.h
index 0c935994..c9eec5f3 100644
--- a/common_library/client/include/native_service/cl_region.h
+++ b/common_library/client/include/native_service/cl_region.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/include/native_service/cl_sem.h b/common_library/client/include/native_service/cl_sem.h
index a42f7ac4..9dbe54e4 100644
--- a/common_library/client/include/native_service/cl_sem.h
+++ b/common_library/client/include/native_service/cl_sem.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/include/native_service/common_library.h b/common_library/client/include/native_service/common_library.h
index 37b5e587..929d04d6 100644
--- a/common_library/client/include/native_service/common_library.h
+++ b/common_library/client/include/native_service/common_library.h
@@ -1,5 +1,5 @@
//
-// @copyright Copyright (c) 2017-2019 TOYOTA MOTOR CORPORATION.
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/common_library/client/libcommon.ver b/common_library/client/libcommon.ver
index 1558e178..f89c9ba3 100644
--- a/common_library/client/libcommon.ver
+++ b/common_library/client/libcommon.ver
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/src/cl_cgroup.c b/common_library/client/src/cl_cgroup.c
index c889187c..812ccaaa 100644
--- a/common_library/client/src/cl_cgroup.c
+++ b/common_library/client/src/cl_cgroup.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/src/cl_lock.c b/common_library/client/src/cl_lock.c
index 6e50d309..6add2a5a 100644
--- a/common_library/client/src/cl_lock.c
+++ b/common_library/client/src/cl_lock.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/src/cl_monitor.c b/common_library/client/src/cl_monitor.c
index 141a0283..26d8e2e5 100644
--- a/common_library/client/src/cl_monitor.c
+++ b/common_library/client/src/cl_monitor.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/src/cl_process.c b/common_library/client/src/cl_process.c
index 5d798966..5c9f5a4b 100644
--- a/common_library/client/src/cl_process.c
+++ b/common_library/client/src/cl_process.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -409,6 +409,7 @@ int CL_ProcessCreate(const char *file, char *const argv[], char *const envp[], c
char **new_env;
int ret;
int retry;
+ int i = 0;
if (file == NULL || argv == NULL || attr == NULL) {
errno = EINVAL;
@@ -436,7 +437,11 @@ int CL_ProcessCreate(const char *file, char *const argv[], char *const envp[], c
if (ia->cpu_assign != 0) {
cpu_set_t set;
CPU_ZERO(&set);
- CPU_SET((size_t)ia->cpu_assign - 1, &set); // LCOV_EXCL_BR_LINE 15:CPU_SET define at sched.h
+ for (i = 0; i < (sizeof(ia->cpu_assign) * 8); i++) {
+ if ((ia->cpu_assign >> i) & 0x1) {
+ CPU_SET(i, &set);
+ }
+ }
// LCOV_EXCL_BR_START 5: fail safe for libc sched_setaffinity
if (sched_setaffinity(childpid, sizeof(set), &set) < 0) {
// LCOV_EXCL_BR_STOP
@@ -607,6 +612,18 @@ int CL_ProcessCreateAttrSetGroup(CL_ProcessAttr_t *attr, int create) {
return 0;
}
+static int32_t CL_CpuAssignMsbCpu(int cpu_assign) {
+ int32_t i;
+ int32_t ret = 0;
+
+ for (i = 0; i < (sizeof(cpu_assign) * 8); i++) {
+ if ((cpu_assign >> i) & 0x1)
+ ret = i;
+ }
+
+ return ret;
+}
+
/**
* Set process attribute (CPU Assign)
*/
@@ -618,7 +635,12 @@ int CL_ProcessCreateAttrSetCpuAssign(CL_ProcessAttr_t *attr, int cpu_assign) {
return -1;
}
- if (cpu_assign < 0 || cpu_assign > 2) {
+ if (cpu_assign < 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (CL_CpuAssignMsbCpu(cpu_assign) >= sysconf(_SC_NPROCESSORS_CONF)) {
errno = EINVAL;
return -1;
}
diff --git a/common_library/client/src/cl_region.c b/common_library/client/src/cl_region.c
index 594e8357..0f6d470c 100644
--- a/common_library/client/src/cl_region.c
+++ b/common_library/client/src/cl_region.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/common_library/client/src/cl_sem.c b/common_library/client/src/cl_sem.c
index e2cd3cb4..911daff4 100644
--- a/common_library/client/src/cl_sem.c
+++ b/common_library/client/src/cl_sem.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/native_service.mk b/native_service.mk
index 5cf73b78..729362ca 100644
--- a/native_service.mk
+++ b/native_service.mk
@@ -1,7 +1,7 @@
#############################################################
#
# Common Makefile for native_service
-# Copyright (C) 2017-2019 TOYOTA MOTOR CORPORATION
+# Copyright (C) 2017-2020 TOYOTA MOTOR CORPORATION
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.