diff options
48 files changed, 2806 insertions, 0 deletions
@@ -0,0 +1,2 @@ +Giyeol Ok <giyeol.ok@samsung.com>
+Suchang Woo <Suchang Woo@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..169ad5a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,50 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(sysman C) + +SET(SRCS + sysnoti.c + sysconf.c + sysman-util.c ) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(EXEC_PREFIX "\${prefix}") +SET(LIBDIR "\${prefix}/lib") +SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") +SET(VERSION_MAJOR 0) +SET(VERSION "${VERSION_MAJOR}.2.0") + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED vconf devman_plugin dlog) + +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -fvisibility=hidden") + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +MESSAGE("FLAGS: ${CMAKE_C_FLAGS}") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") +ADD_DEFINITIONS("-DSLP_DEBUG -DENABLE_DLOG_OUT") + +SET(CMAKE_LDFLAGS "-Wl,zdefs") +ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -ldl) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) + +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/sysman.h DESTINATION include/${PROJECT_NAME}) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/sysman_managed.h DESTINATION include/${PROJECT_NAME}) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/sysman-internal.h DESTINATION include/${PROJECT_NAME}) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/SLP_sysman_PG.h DESTINATION include/${PROJECT_NAME}) +INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) + +ADD_SUBDIRECTORY(set_pmon) + diff --git a/LICENSE.APLv2 b/LICENSE.APLv2 new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE.APLv2 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. @@ -0,0 +1,3 @@ +Copyright (c) Samsung Electronics Co., Ltd. All rights reserved. +Except as noted, This software is licensed under Apache License, Version 2. +Please, see the LICENSE.APLv2 file for Apache License terms and conditions. diff --git a/SLP_sysman_PG.h b/SLP_sysman_PG.h new file mode 100644 index 0000000..1c036ae --- /dev/null +++ b/SLP_sysman_PG.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/** + * + * @ingroup SLP_PG + * @defgroup SLP_PG_SYSMAN System Manager + * @{ + +<h1 class="pg">Introduction</h1> + +<h2 class="pg">Purpose</h2> +The purpose of the document is to describe how applications can use the System Manager APIs. This document gives programming guidelines to application engineers. + +<h2 class="pg">Scope</h2> +The scope of this document is limited to System Manager API usage. + +<br> +<h1 class="pg">System Manager Library Overview</h1> +Sysman library provides convenience functions to get data about processes or to run processes. +It reads the proc file system to check whether a process exists or not, gets a command line and execution path, gets the pid of a process etc. +Some APIs of the sysman library use some device files also. If processes which call APIs of sysman library don't have the correct permission, they will fail. +Most functions return -1 on failure and the errno will be set.<br> +Please refer the manual pages of proc(Linux Programmer's Manual - PROC(5) http://www.kernel.org/doc/man-pages/man5/proc.5.html) +or errno(Linux Programmer's Manual - ERRNO(3) http://www.kernel.org/doc/man-pages/man3/errno.3.html) for more details. + +<h1 class="pg">System Manager Funtions</h1> + +<h2 class="pg">System Manager APIs</h2> +<i><b>API : sysman_get_pid</b></i> +<br><b>Parameter In :</b> const char *execpath +<br><b>Return :</b> int +<br><b>Functionality :</b> This API is used to get the pid of the process which has the specified execpath.<br> +Internally, this API searches /proc/{pid}/cmdline and compares the parameter execpath with 1st argument of cmdline. +If there is no process that has same execpath in /proc/{pid}/cmdline, it will return (-1). +<br><br> +<i><b>API : sysman_get_cmdline_name</b></i> +<br><b>Parameter In :</b> pid_t pid +<br><b>Parameter Out :</b> char *cmdline +<br><b>Parameter In :</b> size_t cmdline_size +<br><b>Return :</b> int +<br><b>Functionality :</b>This API is used to get the file name in the command line.<br> +Caller process MUST allocate enough memory for the cmdline parameter. Its size should be assigned to cmdline_size.<br> +Internally it reads the 1st argument of /proc/{pid}/cmdline and copies it to cmdline.<br> +The function returns 0 on success and a negative value (-1) on failure. +<br><br> +<i><b>API : sysman_get_apppath</b></i> +<br><b>Parameter In :</b> pid_t pid +<br><b>Parameter Out :</b> char *app_path +<br><b>Parameter In :</b> size_t app_path_size +<br><b>Return :</b> int +<br><b>Functionality :</b> This API is used to get the execution path of the process specified by the pid parameter.<br> +Caller process MUST allocate enough memory for the app_path parameter. Its size should be assigned to app_path_size.<br> +Internally it reads a link of /proc/{pid}/exe and copies the path to app_path. <br> +The function returns 0 on success and a negative value (-1) on failure. +<br><br> +<i><b>API : sysconf_set_mempolicy</b></i> +<br><b>Parameter In :</b> enum mem_policy mempol +<br><b>Return :</b> int +<br><b>Functionality :</b> This API is used to set the policy of the caller process for the situation of low available memory.<br> +The function returns 0 on success and a negative value (-1) on failure.<br> +If the caller process has no permission, it will be failed. + +<b>Enumerate values</b> +@code +enum mem_policy { + OOM_LIKELY , // For micelloneous applications + OOM_NORMAL , // For fundamental applications + OOM_IGNORE // For daemon +}; +@endcode + + @} +**/ diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..98ebeff --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +export TET_INSTALL_PATH=/scratchbox/tetware # local tetware path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ +tcc -b -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100755 index 0000000..6720da0 --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,19 @@ +#!/bin/sh +export TET_INSTALL_PATH=/mnt/nfs/tetware +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH + +export TET_ROOT=$TET_TARGET_PATH + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/tet_code b/TC/tet_code new file mode 100644 index 0000000..a2cf6c1 --- /dev/null +++ b/TC/tet_code @@ -0,0 +1,12 @@ +# TET reserved codes +0 "PASS" +1 "FAIL" +2 "UNRESOLVED" +3 "NOTINUSE" +4 "UNSUPPORTED" +5 "UNTESTED" +6 "UNINITIATED" +7 "NORESULT" + +# Test suite additional codes +33 "INSPECT" diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100644 index 0000000..43cbc9b --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/unit/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100644 index 0000000..6192c78 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,3 @@ +TET_OUTPUT_CAPTURE=False +TET_BUILD_TOOL=make +TET_PASS_TC_NAME=True diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100644 index 0000000..c66eda4 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,2 @@ +TET_OUTPUT_CAPTURE=False +TET_CLEAN_TOOL=make clean diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100644 index 0000000..0d9d39a --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1 @@ +TET_OUTPUT_CAPTURE=False diff --git a/TC/unit/Makefile b/TC/unit/Makefile new file mode 100644 index 0000000..7bb6092 --- /dev/null +++ b/TC/unit/Makefile @@ -0,0 +1,31 @@ +CC ?= gcc + +TARGETS = utc_SystemFW_sysconf_is_vip_func \ + utc_SystemFW_sysconf_set_mempolicy_bypid_func \ + utc_SystemFW_sysconf_set_mempolicy_func \ + utc_SystemFW_sysconf_set_permanent_bypid_func \ + utc_SystemFW_sysconf_set_permanent_func \ + utc_SystemFW_sysconf_set_vip_func \ + utc_SystemFW_sysman_get_apppath_func \ + utc_SystemFW_sysman_get_cmdline_name_func \ + utc_SystemFW_sysman_get_pid_func \ + utc_SystemFW_sysman_set_datetime_func \ + +PKGS = sysman + +LDFLAGS = `pkg-config --libs $(PKGS)` +LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s + +CFLAGS = -I. `pkg-config --cflags $(PKGS)` +CFLAGS += -I$(TET_ROOT)/inc/tet3 +CFLAGS += -Wall + +all: $(TARGETS) + +$(TARGETS): %: %.c + $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) + +clean: + rm -f $(TARGETS) diff --git a/TC/unit/tc_gen.sh b/TC/unit/tc_gen.sh new file mode 100755 index 0000000..54f482d --- /dev/null +++ b/TC/unit/tc_gen.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +TMPSTR=$0 +SCRIPT=${TMPSTR##*/} + +if [ $# -lt 2 ]; then + echo "Usage) $SCRIPT module_name api_name" + exit 1 +fi + +MODULE=$1 +API=$2 +TEMPLATE=utc_MODULE_API_func.c.in +TESTCASE=utc_${MODULE}_${API}_func + +sed -e ' + s^@API@^'"$API"'^g + s^@MODULE@^'"$MODULE"'^g + ' $TEMPLATE > $TESTCASE.c + +if [ ! -e "$TESTCASE.c" ]; then + echo "Failed" + exit 1 +fi +echo "Testcase file is $TESTCASE.c" +echo "Done" +echo "please put \"$TESTCASE\" as Target in Makefile" +echo "please put \"/unit/$TESTCASE\" in tslist" diff --git a/TC/unit/tslist b/TC/unit/tslist new file mode 100644 index 0000000..9f6d985 --- /dev/null +++ b/TC/unit/tslist @@ -0,0 +1,8 @@ +/unit/utc_SystemFW_sysconf_is_vip_func +/unit/utc_SystemFW_sysconf_set_permanent_bypid_func +/unit/utc_SystemFW_sysconf_set_permanent_func +/unit/utc_SystemFW_sysman_get_apppath_func +/unit/utc_SystemFW_sysman_get_cmdline_name_func +/unit/utc_SystemFW_sysman_get_pid_func +/unit/utc_SystemFW_sysman_set_datetime_func + diff --git a/TC/unit/utc_MODULE_API_func.c.in b/TC/unit/utc_MODULE_API_func.c.in new file mode 100644 index 0000000..b235fa3 --- /dev/null +++ b/TC/unit/utc_MODULE_API_func.c.in @@ -0,0 +1,64 @@ +#include <tet_api.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_@MODULE@_@API@_func_01(void); +static void utc_@MODULE@_@API@_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX }, + { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of @API@() + */ +static void utc_@MODULE@_@API@_func_01(void) +{ + int r = 0; + +/* + r = @API@(...); +*/ + if (r) { + tet_infoline("@API@() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init @API@() + */ +static void utc_@MODULE@_@API@_func_02(void) +{ + int r = 0; + +/* + r = @API@(...); +*/ + if (r) { + tet_infoline("@API@() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_sysconf_is_vip_func.c b/TC/unit/utc_SystemFW_sysconf_is_vip_func.c new file mode 100644 index 0000000..a57cf0b --- /dev/null +++ b/TC/unit/utc_SystemFW_sysconf_is_vip_func.c @@ -0,0 +1,64 @@ +#include <tet_api.h> +#include <sysman.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_sysconf_is_vip_func_01(void); +static void utc_SystemFW_sysconf_is_vip_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_sysconf_is_vip_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_sysconf_is_vip_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of sysconf_is_vip() + */ +static void utc_SystemFW_sysconf_is_vip_func_01(void) +{ + int ret_val = 0; + int pid = getpid(); + + ret_val = sysconf_is_vip(pid); + if(ret_val < 0) { + tet_infoline("sysconf_is_vip() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init sysconf_is_vip() + */ +static void utc_SystemFW_sysconf_is_vip_func_02(void) +{ + int r = 0; + + r = sysconf_is_vip(-1); + + if (r>=0) { + tet_infoline("sysconf_is_vip() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_sysconf_set_mempolicy_bypid_func.c b/TC/unit/utc_SystemFW_sysconf_set_mempolicy_bypid_func.c new file mode 100644 index 0000000..e1f6fab --- /dev/null +++ b/TC/unit/utc_SystemFW_sysconf_set_mempolicy_bypid_func.c @@ -0,0 +1,66 @@ +#include <tet_api.h> +#include <sysman.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_sysconf_set_mempolicy_bypid_func_01(void); +static void utc_SystemFW_sysconf_set_mempolicy_bypid_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_sysconf_set_mempolicy_bypid_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_sysconf_set_mempolicy_bypid_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of sysconf_set_mempolicy_bypid() + */ +static void utc_SystemFW_sysconf_set_mempolicy_bypid_func_01(void) +{ + int ret_val = 0; + int pid = getpid(); + int mempol = OOM_NORMAL; + + ret_val = sysconf_set_mempolicy_bypid(pid, mempol); + if(ret_val < 0) { + tet_infoline("sysconf_set_mempolicy_bypid() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init sysconf_set_mempolicy_bypid() + */ +static void utc_SystemFW_sysconf_set_mempolicy_bypid_func_02(void) +{ + int r = 0; + int mempol = OOM_NORMAL; + + r = sysconf_set_mempolicy_bypid(-1, mempol); + + if (r>=0) { + tet_infoline("sysconf_set_mempolicy_bypid() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_sysconf_set_mempolicy_func.c b/TC/unit/utc_SystemFW_sysconf_set_mempolicy_func.c new file mode 100644 index 0000000..baf5a4b --- /dev/null +++ b/TC/unit/utc_SystemFW_sysconf_set_mempolicy_func.c @@ -0,0 +1,64 @@ +#include <tet_api.h> +#include <sysman.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_sysconf_set_mempolicy_func_01(void); +static void utc_SystemFW_sysconf_set_mempolicy_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_sysconf_set_mempolicy_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_sysconf_set_mempolicy_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of sysconf_set_mempolicy() + */ +static void utc_SystemFW_sysconf_set_mempolicy_func_01(void) +{ + int ret_val = 0; + int mempol = OOM_NORMAL; + + ret_val = sysconf_set_mempolicy(mempol); + if(ret_val < 0) { + tet_infoline("sysconf_set_mempolicy() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init sysconf_set_mempolicy() + */ +static void utc_SystemFW_sysconf_set_mempolicy_func_02(void) +{ + int r = 0; + + r = sysconf_set_mempolicy(-1); + + if (r>=0) { + tet_infoline("sysconf_set_mempolicy() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_sysconf_set_permanent_bypid_func.c b/TC/unit/utc_SystemFW_sysconf_set_permanent_bypid_func.c new file mode 100644 index 0000000..d44f985 --- /dev/null +++ b/TC/unit/utc_SystemFW_sysconf_set_permanent_bypid_func.c @@ -0,0 +1,64 @@ +#include <tet_api.h> +#include <sysman.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_sysconf_set_permanent_bypid_func_01(void); +static void utc_SystemFW_sysconf_set_permanent_bypid_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_sysconf_set_permanent_bypid_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_sysconf_set_permanent_bypid_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of sysconf_set_permanent_bypid() + */ +static void utc_SystemFW_sysconf_set_permanent_bypid_func_01(void) +{ + int ret_val = 0; + int pid = getpid(); + + ret_val = sysconf_set_permanent_bypid(pid); + if(ret_val < 0) { + tet_infoline("sysconf_set_permanent_bypid() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init sysconf_set_permanent_bypid() + */ +static void utc_SystemFW_sysconf_set_permanent_bypid_func_02(void) +{ + int r = 0; + + r = sysconf_set_permanent_bypid(-1); + + if (r>=0) { + tet_infoline("sysconf_set_permanent_bypid() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_sysconf_set_permanent_func.c b/TC/unit/utc_SystemFW_sysconf_set_permanent_func.c new file mode 100644 index 0000000..0bf38be --- /dev/null +++ b/TC/unit/utc_SystemFW_sysconf_set_permanent_func.c @@ -0,0 +1,65 @@ +#include <tet_api.h> +#include <sysman.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_sysconf_set_permanent_func_01(void); +//static void utc_SystemFW_sysconf_set_permanent_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_sysconf_set_permanent_func_01, POSITIVE_TC_IDX }, +// { utc_SystemFW_sysconf_set_permanent_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of sysconf_set_permanent() + */ +static void utc_SystemFW_sysconf_set_permanent_func_01(void) +{ + + int r = 0; + + r = sysconf_set_permanent(); + + if (r<0) { + tet_infoline("sysconf_set_permanent() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init sysconf_set_permanent() + +static void utc_SystemFW_sysconf_set_permanent_func_02(void) +{ + int r = 0; + + r = sysconf_set_permanent(); + + if (r>=0) { + tet_infoline("sysconf_set_permanent() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +}*/ diff --git a/TC/unit/utc_SystemFW_sysconf_set_vip_func.c b/TC/unit/utc_SystemFW_sysconf_set_vip_func.c new file mode 100644 index 0000000..955e73f --- /dev/null +++ b/TC/unit/utc_SystemFW_sysconf_set_vip_func.c @@ -0,0 +1,65 @@ +#include <tet_api.h> +#include <sysman.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_sysconf_set_vip_func_01(void); +static void utc_SystemFW_sysconf_set_vip_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_sysconf_set_vip_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_sysconf_set_vip_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ + system("mv /usr/bin/restarter /usr/bin/restarter1"); +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of sysconf_set_vip() + */ +static void utc_SystemFW_sysconf_set_vip_func_01(void) +{ + int ret_val = 0; + int pid = getpid(); + + ret_val = sysconf_set_vip(pid); + if(ret_val < 0) { + tet_infoline("sysconf_set_vip() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init sysconf_set_vip() + */ +static void utc_SystemFW_sysconf_set_vip_func_02(void) +{ + int r = 0; + + r = sysconf_set_vip(-1); + + if (r>=0) { + tet_infoline("sysconf_set_vip() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_sysman_get_apppath_func.c b/TC/unit/utc_SystemFW_sysman_get_apppath_func.c new file mode 100644 index 0000000..609c8fa --- /dev/null +++ b/TC/unit/utc_SystemFW_sysman_get_apppath_func.c @@ -0,0 +1,66 @@ +#include <tet_api.h> +#include <sysman.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_sysman_get_apppath_func_01(void); +static void utc_SystemFW_sysman_get_apppath_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_sysman_get_apppath_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_sysman_get_apppath_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of sysman_get_apppath() + */ +static void utc_SystemFW_sysman_get_apppath_func_01(void) +{ + int ret_val = 0; + char* app_path[255] = {'\0',}; + + ret_val = sysman_get_apppath(1, app_path, 100); + if(ret_val <0) { + tet_infoline("sysman_get_apppath() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init sysman_get_apppath() + */ +static void utc_SystemFW_sysman_get_apppath_func_02(void) +{ + int ret_val = 0; + char* app_path[255] = {'\0',}; + + int pid = -1; + + ret_val = sysman_get_apppath(pid, app_path, 100); + if(ret_val >= 0) { + tet_infoline("sysman_get_apppath() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_sysman_get_cmdline_name_func.c b/TC/unit/utc_SystemFW_sysman_get_cmdline_name_func.c new file mode 100644 index 0000000..6ad5f45 --- /dev/null +++ b/TC/unit/utc_SystemFW_sysman_get_cmdline_name_func.c @@ -0,0 +1,64 @@ +#include <tet_api.h> +#include <sysman.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_sysman_get_cmdline_name_func_01(void); +static void utc_SystemFW_sysman_get_cmdline_name_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_sysman_get_cmdline_name_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_sysman_get_cmdline_name_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of sysman_get_cmdline_name() + */ +static void utc_SystemFW_sysman_get_cmdline_name_func_01(void) +{ + char name[50]={'\0',}; + int ret_val = 0; + + ret_val = sysman_get_cmdline_name(1,name,50); + if(ret_val < 0) { + tet_infoline("sysman_get_cmdline_name() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init sysman_get_cmdline_name() + */ +static void utc_SystemFW_sysman_get_cmdline_name_func_02(void) +{ + char name[50]={'\0',}; + int ret_val = 0; + + ret_val = sysman_get_cmdline_name(-1,name,50); + if(ret_val >= 0) { + tet_infoline("sysman_get_cmdline_name() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_sysman_get_pid_func.c b/TC/unit/utc_SystemFW_sysman_get_pid_func.c new file mode 100644 index 0000000..4e4efae --- /dev/null +++ b/TC/unit/utc_SystemFW_sysman_get_pid_func.c @@ -0,0 +1,64 @@ +#include <tet_api.h> +#include <sysman.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_sysman_get_pid_func_01(void); +static void utc_SystemFW_sysman_get_pid_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_sysman_get_pid_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_sysman_get_pid_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of sysman_get_pid() + */ +static void utc_SystemFW_sysman_get_pid_func_01(void) +{ + int ret_val = 0; + char* execpath = "init"; + + ret_val = sysman_get_pid(execpath); + if(ret_val < 0) { + tet_infoline("sysman_get_pid() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init sysman_get_pid() + */ +static void utc_SystemFW_sysman_get_pid_func_02(void) +{ + int ret_val = 0; + char* execpath = "xxxyyyzzz"; + + ret_val = sysman_get_pid(execpath); + if(ret_val >= 0) { + tet_infoline("sysman_get_pid() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_sysman_set_datetime_func.c b/TC/unit/utc_SystemFW_sysman_set_datetime_func.c new file mode 100644 index 0000000..d09f7dc --- /dev/null +++ b/TC/unit/utc_SystemFW_sysman_set_datetime_func.c @@ -0,0 +1,64 @@ +#include <tet_api.h> +#include <sysman.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_sysman_set_datetime_func_01(void); +static void utc_SystemFW_sysman_set_datetime_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_sysman_set_datetime_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_sysman_set_datetime_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of sysman_set_datetime() + */ +static void utc_SystemFW_sysman_set_datetime_func_01(void) +{ + int ret_val = 0; + time_t timet = time(NULL); + + ret_val = sysman_set_datetime(timet); + if(ret_val < 0) { + tet_infoline("sysman_set_datetime() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init sysman_set_datetime() + */ +static void utc_SystemFW_sysman_set_datetime_func_02(void) +{ + int r = 0; + + r = sysman_set_datetime(NULL); + + if (r>=0) { + tet_infoline("sysman_set_datetime() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..5b9b276 --- /dev/null +++ b/debian/control @@ -0,0 +1,33 @@ +Source: libslp-sysman +Section: libs +Priority: extra +Maintainer: Jonghoon Han <jonghoon.han@samsung.com> Jinkun Jang <jinkun.jang@samsung.com> DongGi Jang <dg0402.jang@samsung.com> TAESOO JUN <steve.jun@samsung.com> +Uploaders: Jinkun Jang <jinkun.jang@samsung.com> +Build-Depends: debhelper (>= 5), libslp-setting-dev, dlog-dev, libdevman-plugin-dev +Standards-Version: 0.1.0 + +Package: libslp-sysman-internal-dev +XB-Public-Package: no +Section: libs +Architecture: any +Depends: libslp-sysman-dev (= ${Source-Version}) +Description: system manager internal library (for internal development) + +Package: libslp-sysman-dev +Section: libs +Architecture: any +Depends: libslp-sysman (= ${Source-Version}) +XB-Generate-Docs: yes +Description: system manager base library (for development) + +Package: libslp-sysman +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libslp-setting-0 +Description: system manager base library + +Package: libslp-sysman-dbg +Section: debug +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libslp-sysman (= ${Source-Version}) +Description: system manager base library (unstripped) diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..ca882bb --- /dev/null +++ b/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/sbin diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..a0f0008 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +CMakeLists.txt diff --git a/debian/libslp-sysman-dev.install.in b/debian/libslp-sysman-dev.install.in new file mode 100755 index 0000000..848afa5 --- /dev/null +++ b/debian/libslp-sysman-dev.install.in @@ -0,0 +1,4 @@ +@PREFIX@/include/sysman/sysman.h +@PREFIX@/include/sysman/sysman_managed.h +@PREFIX@/include/sysman/SLP_sysman_PG.h +@PREFIX@/lib/pkgconfig/*.pc diff --git a/debian/libslp-sysman-internal-dev.install.in b/debian/libslp-sysman-internal-dev.install.in new file mode 100644 index 0000000..4ba8fe1 --- /dev/null +++ b/debian/libslp-sysman-internal-dev.install.in @@ -0,0 +1 @@ +@PREFIX@/include/sysman/sysman-internal.h diff --git a/debian/libslp-sysman.install.in b/debian/libslp-sysman.install.in new file mode 100644 index 0000000..79dcdc2 --- /dev/null +++ b/debian/libslp-sysman.install.in @@ -0,0 +1,5 @@ +@PREFIX@/bin/* +@PREFIX@/lib/*.so* +/etc/rc.d/rc3.d/* +/etc/rc.d/rc5.d/* +/etc/rc.d/init.d/* diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..d9e8806 --- /dev/null +++ b/debian/rules @@ -0,0 +1,136 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +CFLAGS ?= -Wall -g +LDFLAGS ?= +PREFIX ?= /usr +DATADIR ?= /opt +LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + LDFLAGS="$(LDFLAGS)" cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX) + + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/wavplayer.sgml > wavplayer.1 + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + cat $$f > $${f%.in}; \ + sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ + sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ + done + + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) clean + rm -rf CMakeCache.txt + rm -rf CMakeFiles + rm -rf cmake_install.cmake + rm -rf Makefile + rm -rf install_manifest.txt + rm -rf *.so + rm -rf *.pc + rm -rf *.desktop + + rm -rf set_pmon/CMakeCache.txt + rm -rf set_pmon/CMakeFiles + rm -rf set_pmon/cmake_install.cmake + rm -rf set_pmon/Makefile + rm -rf set_pmon/install_manifest.txt + rm -rf set_pmon/*.desktop + + rm -rf test/CMakeCache.txt + rm -rf test/CMakeFiles + rm -rf test/cmake_install.cmake + rm -rf test/Makefile + rm -rf test/install_manifest.txt + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + rm -f $${f%.in}; \ + done + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/wavplayer. + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/ + mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/ + ln -s /usr/bin/regpmon.sh $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S99regpmon + ln -s /usr/bin/regpmon.sh $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/S99regpmon + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install --sourcedir=debian/tmp +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link +# dh_strip + dh_strip --dbg-package=libslp-sysman-dbg + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/packaging/sysman.manifest b/packaging/sysman.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/sysman.manifest @@ -0,0 +1,5 @@ +<manifest> + <request> + <domain name="_"/> + </request> +</manifest> diff --git a/packaging/sysman.spec b/packaging/sysman.spec new file mode 100644 index 0000000..7275031 --- /dev/null +++ b/packaging/sysman.spec @@ -0,0 +1,88 @@ +Name: sysman +Summary: System manager interface library +Version: 0.2.29 +Release: 1 +Group: framework-system +License: APLv2 +Source0: %{name}-%{version}.tar.gz +Source1001: packaging/sysman.manifest +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +BuildRequires: cmake +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(devman_plugin) + +%description +system manager internal library + + + +%package devel +Summary: System Manager base (devel) +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +System Manager base library (devel) + +%package internal-devel +Summary: System Manager base (devel) +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: sysman + +%description internal-devel +System Manager base library (devel) + + +%prep +%setup -q + +%build +cp %{SOURCE1001} . +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} + + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +mkdir -p %{buildroot}%{_sysconfdir}/rc.d/ +mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d/ +mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d/ +ln -s %{_bindir}/regpmon.sh %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S99regpmon +ln -s %{_bindir}/regpmon.sh %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S99regpmon + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + +%files +%manifest sysman.manifest +%defattr(-,root,root,-) +%{_libdir}/*.so.* +%{_bindir}/* +%{_sysconfdir}/rc.d/init.d/* +%{_sysconfdir}/rc.d/rc3.d/* +%{_sysconfdir}/rc.d/rc5.d/* + + +%files devel +%manifest sysman.manifest +%defattr(-,root,root,-) +%{_includedir}/sysman/sysman.h +%{_includedir}/sysman/sysman_managed.h +%{_includedir}/sysman/SLP_sysman_PG.h +%{_libdir}/pkgconfig/*.pc +%{_libdir}/*.so + +%files internal-devel +%manifest sysman.manifest +%defattr(-,root,root,-) +%{_includedir}/sysman/sysman-internal.h + diff --git a/set_pmon/CMakeLists.txt b/set_pmon/CMakeLists.txt new file mode 100644 index 0000000..72f3c70 --- /dev/null +++ b/set_pmon/CMakeLists.txt @@ -0,0 +1,13 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +set(SET_PMON set_pmon) + +SET(SRCS set_pmon.c) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +ADD_EXECUTABLE(${SET_PMON} ${SRCS}) +TARGET_LINK_LIBRARIES(${SET_PMON} ${PROJECT_NAME}) +INSTALL(TARGETS ${SET_PMON} DESTINATION bin) +INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/set_pmon/regpmon.sh DESTINATION bin) + +# install rc script +INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/set_pmon/pmon DESTINATION /etc/rc.d/init.d) diff --git a/set_pmon/pmon b/set_pmon/pmon new file mode 100755 index 0000000..f389e5f --- /dev/null +++ b/set_pmon/pmon @@ -0,0 +1,5 @@ +#!/bin/sh + +# clean up vip process history +rm -f /tmp/vip/* + diff --git a/set_pmon/regpmon.sh b/set_pmon/regpmon.sh new file mode 100755 index 0000000..3aa71e8 --- /dev/null +++ b/set_pmon/regpmon.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Don't regist processes on hibernation capturing sequence +if [ -e /opt/etc/.hib_capturing ] ; then + exit 0 +elif [ -e /opt/etc/.hib_capturing_firstboot ]; then + exit 0 +fi + +set_pmon -v Xorg enlightenment dbus-daemon libsqlfs_mount telephony-server pulseaudio +set_pmon -p wifid phonebook-engine voice-calld menu-daemon input_router indicator dlog-daemon ss-server media-server sf_server security-server dnet quickpanel sound_server audio-session-mgr-server launchpad_preloading_preinitializing_daemon voip-daemon drm_server calendar-serviced wrt_launchpad_daemon + diff --git a/set_pmon/set_pmon.c b/set_pmon/set_pmon.c new file mode 100755 index 0000000..ce0725c --- /dev/null +++ b/set_pmon/set_pmon.c @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include <stdio.h> +#include <errno.h> +#include <unistd.h> +#include <dirent.h> +#include <ctype.h> +#include <sysman.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#define BUFF_MAX 255 + +int set_oomadj(int pid, int oomadj_val) +{ + char buf[BUFF_MAX]; + FILE *fp; + + snprintf(buf, BUFF_MAX, "/proc/%d/oom_adj", pid); + fp = fopen(buf, "w"); + if (fp == NULL) + return -1; + fprintf(fp, "%d", oomadj_val); + fclose(fp); + + return 0; +} + +int check_and_setpmon(int pid, int idx, char **argv, char type) +{ + int fd; + char buf[BUFF_MAX]; + char *filename; + + snprintf(buf, BUFF_MAX, "/proc/%d/cmdline", pid); + fd = open(buf, O_RDONLY); + if (fd < 0) + return -1; + + read(fd, buf, BUFF_MAX-1); + close(fd); + + buf[BUFF_MAX-1] = '\0'; + + if (type == 'v') + set_oomadj(pid, -17); + + filename = strrchr(buf, '/'); + if (filename == NULL) + filename = buf; + else + filename = filename + 1; + + while (idx > 1) { /* argv[1] is monitoring type */ + if (!strcmp(argv[idx], filename)) { + switch (type) { + case 'v': + printf("====> found, %s - set vip\n", + argv[idx]); + sysconf_set_vip(pid); + return 0; + case 'p': + printf("====> found, %s - set permanent\n", + argv[idx]); + sysconf_set_permanent_bypid(pid); + return 0; + default: + break; + } + } + idx--; + } + return -1; +} + +int main(int argc, char **argv) +{ + int pid = -1; + char type; + DIR *dp; + struct dirent *dentry; + + if (argc < 3 || + argv[1][0] != '-' || + argv[1][1] == '\0' || (argv[1][1] != 'v' && argv[1][1] != 'p')) { + printf("Usage: %s <monitoring type> <process name>\n", argv[0]); + printf("Monitoring types: -v \t VIP process\n"); + printf(" -p \t Permanent process\n"); + return 1; + } + + dp = opendir("/proc"); + if (!dp) { + printf("open /proc : %s\n", strerror(errno)); + return 1; + } + type = argv[1][1]; + + while ((dentry = readdir(dp)) != NULL) { + if (!isdigit(dentry->d_name[0])) + continue; + + pid = atoi(dentry->d_name); + check_and_setpmon(pid, argc - 1, argv, type); + } + + closedir(dp); + return 0; +} diff --git a/sysconf.c b/sysconf.c new file mode 100644 index 0000000..bee2b80 --- /dev/null +++ b/sysconf.c @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <dlfcn.h> +#include <fcntl.h> +#include <limits.h> +#include <devman_plugin_intf.h> + +#include "sysman.h" +#include "sysman-priv.h" + +#define DEVMAN_PLUGIN_PATH "/usr/lib/libslp_devman_plugin.so" +#define PERMANENT_DIR "/tmp/permanent" +#define VIP_DIR "/tmp/vip" + +#define OOMADJ_SET "oomadj_set" + +static void *dlopen_handle; + +const OEM_sys_devman_plugin_interface *plugin_intf; + +enum mp_entry_type { + MP_VIP, + MP_PERMANENT, + MP_NONE +}; + +int util_oomadj_set(int pid, int oomadj_val) +{ + char buf1[255]; + char buf2[255]; + + snprintf(buf1, sizeof(buf1), "%d", pid); + snprintf(buf2, sizeof(buf2), "%d", oomadj_val); + return sysman_call_predef_action(OOMADJ_SET, 2, buf1, buf2); +} + +API int sysconf_set_mempolicy_bypid(int pid, enum mem_policy mempol) +{ + if (pid < 1) + return -1; + + int oomadj_val = 0; + + switch (mempol) { + case OOM_LIKELY: + oomadj_val = 1; + break; + case OOM_IGNORE: + oomadj_val = -17; + break; + default: + return -1; + } + + return util_oomadj_set(pid, oomadj_val); +} + +API int sysconf_set_mempolicy(enum mem_policy mempol) +{ + return sysconf_set_mempolicy_bypid(getpid(), mempol); +} + +static int already_permanent(int pid) +{ + char buf[BUFF_MAX]; + + snprintf(buf, BUFF_MAX, "%s/%d", PERMANENT_DIR, pid); + + if (access(buf, R_OK) == 0) { + DBG("already_permanent process : %d", pid); + return 1; + } + return 0; +} + +static int copy_cmdline(int pid) +{ + char buf[PATH_MAX]; + char filepath[PATH_MAX]; + int fd; + int cnt; + int r; + + if (access(PERMANENT_DIR, R_OK) < 0) { + DBG("no predefined matrix dir = %s, so created", PERMANENT_DIR); + r = mkdir(PERMANENT_DIR, 0777); + if(r < 0) { + ERR("permanent directory mkdir is failed"); + return -1; + } + } + + snprintf(filepath, PATH_MAX, "/proc/%d/cmdline", pid); + + fd = open(filepath, O_RDONLY); + if (fd == -1) { + DBG("Failed to open"); + return -1; + } + + cnt = read(fd, buf, PATH_MAX); + close(fd); + + if (cnt <= 0) { + /* Read /proc/<pid>/cmdline error */ + DBG("Failed to read"); + return -1; + } + + snprintf(filepath, PATH_MAX, "%s/%d", PERMANENT_DIR, pid); + + fd = open(filepath, O_CREAT | O_WRONLY, 0644); + if (fd == -1) { + DBG("Failed to open"); + return -1; + } + + if (write(fd, buf, cnt) == -1) { + DBG("Failed to write"); + close(fd); + return -1; + } + close(fd); + + return 0; +} + +API int sysconf_set_vip(int pid) +{ + char buf[BUFF_MAX]; + int fd; + int r; + + if (pid < 1) + return -1; + + if (access(VIP_DIR, R_OK) < 0) { + DBG("no predefined matrix dir = %s, so created", VIP_DIR); + r = mkdir(VIP_DIR, 0777); + if(r < 0) { + ERR("sysconf_set_vip vip mkdir is failed"); + return -1; + } + } + + snprintf(buf, BUFF_MAX, "%s/%d", VIP_DIR, pid); + fd = open(buf, O_CREAT | O_RDWR, 0644); + if (fd < 0) { + ERR("sysconf_set_vip fd open failed"); + return -1; + } + close(fd); + + if (0 > plugin_intf->OEM_sys_set_process_monitor_mp_vip(pid)) { + ERR("set vip failed"); + return -1; + } + + return 0; +} + +API int sysconf_is_vip(int pid) +{ + if (pid < 1) + return -1; + + char buf[BUFF_MAX]; + + snprintf(buf, BUFF_MAX, "%s/%d", VIP_DIR, pid); + + if (access(buf, R_OK) == 0) + return 1; + else + return 0; +} + +API int sysconf_set_permanent_bypid(int pid) +{ + int fd; + if (already_permanent(pid)) + goto MEMPOL_SET; + + if (copy_cmdline(pid) < 0) + return -1; + + if (0 > plugin_intf->OEM_sys_set_process_monitor_mp_pnp(pid)) { + ERR("set vip failed"); + return -1; + } + + MEMPOL_SET: + util_oomadj_set(pid, -17); + + return 0; +} + +API int sysconf_set_permanent() +{ + pid_t pid = getpid(); + return sysconf_set_permanent_bypid(pid); +} + +static void __attribute__ ((constructor)) module_init() +{ + char *error; + + dlopen_handle = dlopen(DEVMAN_PLUGIN_PATH, RTLD_NOW); + if (!dlopen_handle) { + ERR("dlopen() failed"); + return; + } + + const OEM_sys_devman_plugin_interface *(*OEM_sys_get_devman_plugin_interface) (); + OEM_sys_get_devman_plugin_interface = dlsym(dlopen_handle, "OEM_sys_get_devman_plugin_interface"); + if ((error = dlerror()) != NULL) { + ERR("dlsym() failed: %s", error); + dlclose(dlopen_handle); + return; + } + + plugin_intf = OEM_sys_get_devman_plugin_interface(); + if (!plugin_intf) { + ERR("get_devman_plugin_interface() failed"); + dlclose(dlopen_handle); + return; + } +} + + +static void __attribute__ ((destructor)) module_fini() +{ + if (dlopen_handle) { + dlclose(dlopen_handle); + } + +} diff --git a/sysman-internal.h b/sysman-internal.h new file mode 100644 index 0000000..4f3130a --- /dev/null +++ b/sysman-internal.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef ___SYSMAN_INTERNAL___ +#define ___SYSMAN_INTERNAL___ +#include <sys/types.h> +#include <sysman.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* This file will be removed */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif /* ___SYSMAN_INTERNAL___ */ diff --git a/sysman-priv.h b/sysman-priv.h new file mode 100644 index 0000000..9815337 --- /dev/null +++ b/sysman-priv.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef ___SYSNMAN_PRIVATE___ +#define ___SYSNMAN_PRIVATE___ + +#include <stdio.h> +#include <stdlib.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define API __attribute__ ((visibility("default"))) + +#define __PRTD(fmt, arg...) \ + do { \ + if (getenv("SLP_DEBUG")) { \ + fprintf(stdout, "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); \ + } \ + } while (0) +#define _NOUT(fmt, arg...) do { } while (0) + +#ifdef SLP_DEBUG +# define DBG _PRTD +#else +# define DBG _NOUT +#endif + +#define ENABLE_DLOG_OUT 1 +#ifdef ENABLE_DLOG_OUT +# define LOG_TAG "LIBSYSMAN" +# include <dlog.h> +# define _PRTD SLOGD +# define ERR SLOGE +# define INFO SLOGI +#else +# define _PRTD __PRTD +# define ERR perror +# define INFO(fmt, arg...) \ + do { fprintf(stdout, "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); } while (0) +#endif + +#define SYSMAN_MAXARG 16 +#define SYSMAN_MAXSTR 100 +#define BUFF_MAX 255 + + struct sysnoti { + int pid; + int cmd; + char *type; + char *path; + int argc; + char *argv[SYSMAN_MAXARG]; + }; + + int util_launch_app_cmd(const char *cmdline); + +#ifdef __cplusplus +} +#endif +#endif /* ___SYSMAN_PRIVATE___ */ diff --git a/sysman-util.c b/sysman-util.c new file mode 100644 index 0000000..fb5f8d1 --- /dev/null +++ b/sysman-util.c @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <signal.h> +#include <dirent.h> +#include <ctype.h> +#include <string.h> +#include <stdarg.h> +#include <errno.h> +#include <poll.h> + +#include <vconf.h> +#include "sysman.h" +#include "sysman-priv.h" + +API int sysman_get_pid(const char *execpath) +{ + DIR *dp; + struct dirent *dentry; + int pid = -1, fd; + char buf[BUFF_MAX]; + char buf2[BUFF_MAX]; + + dp = opendir("/proc"); + if (!dp) { + ERR("open /proc"); + return -1; + } + + while ((dentry = readdir(dp)) != NULL) { + if (!isdigit(dentry->d_name[0])) + continue; + + pid = atoi(dentry->d_name); + + snprintf(buf, BUFF_MAX, "/proc/%d/cmdline", pid); + fd = open(buf, O_RDONLY); + if (fd < 0) + continue; + if (read(fd, buf2, BUFF_MAX) < 0) { + close(fd); + continue; + } + close(fd); + + if (!strcmp(buf2, execpath)) { + closedir(dp); + return pid; + } + } + + errno = ESRCH; + closedir(dp); + return -1; +} + +API int sysman_get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size) +{ + int fd, ret; + char buf[PATH_MAX + 1]; + char *filename; + + snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid); + fd = open(buf, O_RDONLY); + if (fd < 0) { + errno = ESRCH; + return -1; + } + + ret = read(fd, buf, PATH_MAX); + close(fd); + buf[PATH_MAX] = '\0'; + + filename = strrchr(buf, '/'); + if (filename == NULL) + filename = buf; + else + filename = filename + 1; + + if (cmdline_size < strlen(filename) + 1) { + errno = EOVERFLOW; + return -1; + } + + strncpy(cmdline, filename, cmdline_size - 1); + cmdline[cmdline_size - 1] = '\0'; + return 0; +} + +API int sysman_get_apppath(pid_t pid, char *app_path, size_t app_path_size) +{ + char buf[PATH_MAX]; + int ret; + + snprintf(buf, PATH_MAX, "/proc/%d/exe", pid); + if (app_path == NULL + || (ret = readlink(buf, app_path, app_path_size)) == -1) + return -1; + if (app_path_size == ret) { + app_path[ret - 1] = '\0'; + errno = EOVERFLOW; + return -1; + } + + app_path[ret] = '\0'; + return 0; +} + diff --git a/sysman.h b/sysman.h new file mode 100755 index 0000000..54ba0e8 --- /dev/null +++ b/sysman.h @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef ___SYSMAN___ +#define ___SYSMAN___ + +#include <stdlib.h> +#include <string.h> +#include <sys/time.h> +#include <sys/types.h> +#include "sysman_managed.h" + +#ifndef DEPRECATED +#define DEPRECATED __attribute__((deprecated)) +#endif + +/** + * @file sysman.h + * @ingroup libsysman System Manager library + * @brief This library provides APIs related with memory, performance, processes, and so on. + * @author SLP2.0 + * @date 2010-01-24 + * @version 0.1 + */ + +/** + * @defgroup libsysman System Manager library + * @ingroup SYSTEM_FRAMEWORK + * @brief System manager library + * + * This library provides APIs related with memory, performance, processes, and so on. + * <br> Please use libslp-sysman-dev debian package and sysman.pc file for development. + * <br> And include sysman.h file at your source codes as following. + * @addtogroup libsysman System Manager library + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @breif Policy for low memory + */ + enum mem_policy { + OOM_LIKELY, /**< For miscellaneous applications */ + OOM_IGNORE /**< For daemons */ + }; + +/* sysman_util */ + +/** + * @fn int sysman_get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size) + * @brief This API is used to get the file name of command line of the process from the proc fs. + * Caller process MUST allocate enough memory for the cmdline parameter. \n + * Its size should be assigned to cmdline_size. \n + * Internally it reads the 1st argument of /proc/{pid}/cmdline and copies it to cmdline. + * @param[in] pid pid of the process that you want to get the file name of command line + * @param[out] cmdline command line of the process that you want to get the file name <br> + * Callers should allocate memory to this parameter before calling this function. + * The allocated memory size must be large enough to store the file name. + * The result will include the terminating null byte('\0') at the end of the string. + * @return 0 on success, -1 if failed. If the size of cmdline is smaller than the result, + * it will return -1 and errno will be set as EOVERFLOW. + */ + int sysman_get_cmdline_name(pid_t pid, char *cmdline, + size_t cmdline_size); + +/** + * @fn char *sysman_get_apppath(pid_t pid, char *app_path, size_t app_path_size) + * @brief This API is used to get the execution path of the process specified by the pid parameter.\n + * Caller process MUST allocate enough memory for the app_path parameter. \n + * Its size should be assigned to app_path_size. \n + * Internally it reads a link of /proc/{pid}/exe and copies the path to app_path. + * @param[in] pid pid of the process that you want to get the executed path + * @param[out] app_path the executed file path of the process <br> + * Callers should allocate memory to this parameter before calling this function. + * The allocated memory size must be large enough to store the executed file path. + * The result will include the terminating null byte('\0') at the end of the string. + * @param[in] app_path_size allocated memory size of char *app_path + * @return 0 on success, -1 if failed. If the size of app_path is smaller than the result, + * it will return -1 and errno will be set as EOVERFLOW. + */ + int sysman_get_apppath(pid_t pid, char *app_path, size_t app_path_size); + +/* sysconf */ + +/** + * @fn int sysconf_set_mempolicy(enum mem_policy mempol) + * @brief This API is used to set the policy of the caller process when the phone has low available memory. + * @param[in] mempol oom adjust value which you want to set + * @return 0 on success, -1 if failed. + * @see sysconf_set_mempolicy_bypid() + */ + int sysconf_set_mempolicy(enum mem_policy mempol); + +/** + * @fn int sysconf_set_mempolicy_bypid(pid_t pid, enum mem_policy mempol) + * @brief This API is used to set the policy of the process when the phone has low available memory. + * @param[in] pid process id which you want to set + * @param[in] mempol oom adjust value which you want to set + * @return 0 on success, -1 if failed. + */ + int sysconf_set_mempolicy_bypid(pid_t pid, enum mem_policy mempol); + +/** + * @fn int sysconf_set_permanent(void) + * @brief This API is used to set itself as a permanent process.\n + * If the permanent process is dead, system server will relaunch the process automatically. + * @return 0 on success, -1 if failed. + * @see sysconf_set_permanent_bypid() + * @par Example + * @code + * ... + * ret = sysconf_set_permanent(); + * if( ret < 0 ) + * printf("Fail to set a process as permanent\n"); + * ... + * @endcode + */ + int sysconf_set_permanent(void); + +/** + * @fn int sysconf_set_permanent_bypid(pid_t pid) + * @brief This API is used to set a process which has pid as a permanent process.\n + * If the permanent process is dead, system server will relaunch the process automatically. + * @return 0 on success, -1 if failed. + * @see sysconf_set_permanent() + * @par Example + * @code + * ... + * ret = sysconf_set_permanent_bypid(pid); + * if( ret < 0 ) + * printf("Fail to set a process(%d) as permanent\n",pid); + * ... + * @endcode + */ + int sysconf_set_permanent_bypid(pid_t pid); + +/** + * @fn int sysconf_set_vip(pid_t pid) + * @brief This API is used to set a process which has pid as Very Important Process(VIP) .\n + * If the VIP process is dead, restarter program will be run. \n + * Restarter program may kill almost processes and run rc.local scripts again. + * @param[in] pid process id to be vip + * @return 0 on success, -1 if failed. + * @see sysconf_is_vip + * @par Example + * @code + * ... + * ret = sysconf_set_vip(pid); + * if( ret < 0 ) + * printf("Fail to set a process(%d) as VIP\n",pid); + * ... + * @endcode + */ + int sysconf_set_vip(pid_t pid); + +/** + * @fn int sysconf_is_vip(pid_t pid) + * @brief This API is used to verify that process which has pid is Very Important Process(VIP) or not. + * @param[in] pid process id to be vip + * @return 1 on success, 0 if failed. + * @see sysconf_set_vip + * @par Example + * @code + * ... + * ret = sysconf_is_vip(pid); + * if(ret) + * printf("process(%d) is Very Important Process\n",pid); + * ... + * @endcode + */ + int sysconf_is_vip(pid_t pid); + + int sysman_set_timezone(char *tzpath_str); + + int sysman_call_predef_action(const char *type, int num, ...); + + int sysman_inform_foregrd(void); + int sysman_inform_backgrd(void); + int sysman_inform_active(pid_t pid); + int sysman_inform_inactive(pid_t pid); + + int sysman_request_poweroff(void); + int sysman_request_entersleep(void); + int sysman_request_leavesleep(void); + int sysman_request_reboot(void); + + int sysman_request_set_cpu_max_frequency(int val); + int sysman_request_set_cpu_min_frequency(int val); + + int sysman_release_cpu_max_frequency(void); + int sysman_release_cpu_min_frequency(void); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif /* ___SYSMAN___ */ diff --git a/sysman.pc.in b/sysman.pc.in new file mode 100644 index 0000000..a461b64 --- /dev/null +++ b/sysman.pc.in @@ -0,0 +1,15 @@ +# Package Information for pkg-config + +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ + +Name: libsysman +Description: system manager interface library +Version: @VERSION@ +Requires: +Libs: -L${libdir} -lsysman +Cflags: -I${includedir} + + diff --git a/sysman_managed.h b/sysman_managed.h new file mode 100755 index 0000000..77f5970 --- /dev/null +++ b/sysman_managed.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef ___SYSMAN_MANAGED___ +#define ___SYSMAN_MANAGED___ + +#include <sys/time.h> + +/** + * @file sysman_managed.h + * @ingroup libsysman System Manager library + * @brief This library provides APIs related with memory, performance, processes, and so on. + * @author SLP2.0 + * @date 2010-01-24 + * @version 0.1 + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @fn int sysman_get_pid(const char *execpath) + * @brief This API is used to get the pid of the process which has the specified execpath.\n + * Internally, this API searches /proc/{pid}/cmdline and compares the parameter execpath with 1st argument of cmdline. \n + * If there is no process that has same execpath in /proc/{pid}/cmdline, it will return -1. + * @param[in] execpath program path which you want to know whether it is run or not + * @return pid when the program is running, -1 if it is not. + */ + int sysman_get_pid(const char *execpath); + +/** + * @fn int sysman_set_datetime(time_t timet) + * @brief This API is used to set date time.\n + * Internally, this API call predefined action API. That is send a notify message. \n + * @param[in] time_t type of time which you want to set. + * @return pid when the program is running, -1 if param is less than 0 or when failed set datetime. + */ + int sysman_set_datetime(time_t timet); + +/** + * @brief This structure defines the data for receive result of mmc operations(mount/unmount/format) + */ + struct mmc_contents { + void (*mmc_cb) (int result, void* data);/**< user callback function for receive result of mmc operations */ + void* user_data;/**< input data for callback function's second-param(data) */ + }; + +/** + * @fn int sysman_request_mount_mmc(struct mmc_contents *mmc_data) + * @brief This API is used to mount mmc.\n + * Internally, this API call predefined action API. That is send a notify message. \n + * and when mount operation is finished, cb of mmc_content struct is called with cb's param1(result). \n + * means of param1 - 0(mount success) , -1(mount fail) , -2(already mounted) + * @param[in] mmc_data for receive result of mount operation + * @return non-zero on success message sending, -1 if message sending is failed. + */ + int sysman_request_mount_mmc(struct mmc_contents *mmc_data); + +/** + * @fn int sysman_request_unmount_mmc(struct mmc_contents *mmc_data,int option) + * @brief This API is used to unmount mmc.\n + * Internally, this API call predefined action API. That is send a notify message. \n + * and when unmount opeation is finished, cb of mmc_content struct is called with cb's param1(result). \n + * means of param1 - 0(unmount success) , -1(unmount fail) + * @param[in] mmc_data for receive result of unmount operation + * @param[in] option is must be 1(just only support for force unmount) + * @return non-zero on success message sending, -1 if message sending is failed. + */ + int sysman_request_unmount_mmc(struct mmc_contents *mmc_data, int option); +/** + * @fn int sysman_request_format_mmc(struct mmc_contents *mmc_data) + * @brief This API is used to format mmc.\n + * Internally, this API call predefined action API. That is send a notify message. \n + * and when format opeation is finished, cb of mmc_content struct is called with cb's param1(result). \n + * means of param1 - 0(format success) , -1(format fail) + * @param[in] mmc_data for receive result of format operation + * @return non-zero on success message sending, -1 if message sending is failed. + */ + int sysman_request_format_mmc(struct mmc_contents *mmc_data); + +#ifdef __cplusplus +} +#endif +#endif /* ___SYSMAN_MANAGED___ */ diff --git a/sysnoti.c b/sysnoti.c new file mode 100644 index 0000000..106bd55 --- /dev/null +++ b/sysnoti.c @@ -0,0 +1,362 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <stdio.h> +#include <unistd.h> +#include <stdarg.h> +#include <errno.h> +#include <vconf.h> +#include <vconf-keys.h> + +#include "sysman.h" +#include "sysman-priv.h" + +#define PREDEF_PWROFF_POPUP "pwroff-popup" +#define PREDEF_ENTERSLEEP "entersleep" +#define PREDEF_LEAVESLEEP "leavesleep" +#define PREDEF_REBOOT "reboot" +#define PREDEF_BACKGRD "backgrd" +#define PREDEF_FOREGRD "foregrd" +#define PREDEF_ACTIVE "active" +#define PREDEF_INACTIVE "inactive" +#define PREDEF_SET_DATETIME "set_datetime" +#define PREDEF_SET_TIMEZONE "set_timezone" +#define PREDEF_MOUNT_MMC "mountmmc" +#define PREDEF_UNMOUNT_MMC "unmountmmc" +#define PREDEF_FORMAT_MMC "formatmmc" + +#define PREDEF_SET_MAX_FREQUENCY "set_max_frequency" +#define PREDEF_SET_MIN_FREQUENCY "set_min_frequency" +#define PREDEF_RELEASE_MAX_FREQUENCY "release_max_frequency" +#define PREDEF_RELEASE_MIN_FREQUENCY "release_min_frequency" + +enum sysnoti_cmd { + ADD_SYSMAN_ACTION, + CALL_SYSMAN_ACTION +}; + +#define SYSNOTI_SOCKET_PATH "/tmp/sn" + +static inline int send_int(int fd, int val) +{ + return write(fd, &val, sizeof(int)); +} + +static inline int send_str(int fd, char *str) +{ + int len; + int ret; + if (str == NULL) { + len = 0; + ret = write(fd, &len, sizeof(int)); + } else { + len = strlen(str); + if (len > SYSMAN_MAXSTR) + len = SYSMAN_MAXSTR; + write(fd, &len, sizeof(int)); + ret = write(fd, str, len); + } + return ret; +} + +static int sysnoti_send(struct sysnoti *msg) +{ + ERR("--- %s: start", __FUNCTION__); + int client_len; + int client_sockfd; + int result; + struct sockaddr_un clientaddr; + int i; + + client_sockfd = socket(AF_UNIX, SOCK_STREAM, 0); + if (client_sockfd == -1) { + ERR("%s: socket create failed\n", __FUNCTION__); + return -1; + } + bzero(&clientaddr, sizeof(clientaddr)); + clientaddr.sun_family = AF_UNIX; + strncpy(clientaddr.sun_path, SYSNOTI_SOCKET_PATH, sizeof(clientaddr.sun_path) - 1); + client_len = sizeof(clientaddr); + + if (connect(client_sockfd, (struct sockaddr *)&clientaddr, client_len) < + 0) { + ERR("%s: connect failed\n", __FUNCTION__); + close(client_sockfd); + return -1; + } + + send_int(client_sockfd, msg->pid); + send_int(client_sockfd, msg->cmd); + send_str(client_sockfd, msg->type); + send_str(client_sockfd, msg->path); + send_int(client_sockfd, msg->argc); + for (i = 0; i < msg->argc; i++) + send_str(client_sockfd, msg->argv[i]); + + ERR("--- %s: read", __FUNCTION__); + read(client_sockfd, &result, sizeof(int)); + + close(client_sockfd); + ERR("--- %s: end", __FUNCTION__); + return result; +} + +API int sysman_call_predef_action(const char *type, int num, ...) +{ + ERR("--- %s: start", __FUNCTION__); + struct sysnoti *msg; + int ret; + va_list argptr; + + int i; + char *args = NULL; + + if (type == NULL || num > SYSMAN_MAXARG) { + errno = EINVAL; + return -1; + } + + msg = malloc(sizeof(struct sysnoti)); + + if (msg == NULL) { + /* Do something for not enought memory error */ + return -1; + } + + msg->pid = getpid(); + msg->cmd = CALL_SYSMAN_ACTION; + msg->type = (char *)type; + msg->path = NULL; + + msg->argc = num; + va_start(argptr, num); + for (i = 0; i < num; i++) { + args = va_arg(argptr, char *); + msg->argv[i] = args; + } + va_end(argptr); + + ERR("--- %s: send msg", __FUNCTION__); + ret = sysnoti_send(msg); + free(msg); + + ERR("--- %s: end", __FUNCTION__); + return ret; +} + +API int sysman_inform_foregrd(void) +{ + char buf[255]; + snprintf(buf, sizeof(buf), "%d", getpid()); + return sysman_call_predef_action(PREDEF_FOREGRD, 1, buf); +} + +API int sysman_inform_backgrd(void) +{ + char buf[255]; + snprintf(buf, sizeof(buf), "%d", getpid()); + return sysman_call_predef_action(PREDEF_BACKGRD, 1, buf); +} + +API int sysman_inform_active(pid_t pid) +{ + char buf[255]; + snprintf(buf, sizeof(buf), "%d", pid); + return sysman_call_predef_action(PREDEF_ACTIVE, 1, buf); +} + +API int sysman_inform_inactive(pid_t pid) +{ + char buf[255]; + snprintf(buf, sizeof(buf), "%d", pid); + return sysman_call_predef_action(PREDEF_INACTIVE, 1, buf); +} + +API int sysman_request_poweroff(void) +{ + return sysman_call_predef_action(PREDEF_PWROFF_POPUP, 0); +} + +API int sysman_request_entersleep(void) +{ + return sysman_call_predef_action(PREDEF_ENTERSLEEP, 0); +} + +API int sysman_request_leavesleep(void) +{ + return sysman_call_predef_action(PREDEF_LEAVESLEEP, 0); +} + +API int sysman_request_reboot(void) +{ + return sysman_call_predef_action(PREDEF_REBOOT, 0); +} + +API int sysman_set_datetime(time_t timet) +{ + if (timet < 0L) + return -1; + char buf[255] = { 0 }; + snprintf(buf, sizeof(buf), "%ld", timet); + return sysman_call_predef_action(PREDEF_SET_DATETIME, 1, buf); +} + +API int sysman_set_timezone(char *tzpath_str) +{ + if (tzpath_str == NULL) + return -1; + char buf[255]; + snprintf(buf, sizeof(buf), "%s", tzpath_str); + return sysman_call_predef_action(PREDEF_SET_TIMEZONE, 1, buf); +} + +static int sysnoti_mount_mmc_cb(keynode_t *key_nodes, void *data) +{ + struct mmc_contents *mmc_data; + mmc_data = (struct mmc_contents *)data; + DBG("mountmmc_cb called"); + if (vconf_keynode_get_int(key_nodes) == + VCONFKEY_SYSMAN_MMC_MOUNT_COMPLETED) { + DBG("mount ok"); + (mmc_data->mmc_cb)(0, mmc_data->user_data); + } else if (vconf_keynode_get_int(key_nodes) == + VCONFKEY_SYSMAN_MMC_MOUNT_ALREADY) { + DBG("mount already"); + (mmc_data->mmc_cb)(-2, mmc_data->user_data); + } else { + DBG("mount fail"); + (mmc_data->mmc_cb)(-1, mmc_data->user_data); + } + vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_MOUNT, + (void *)sysnoti_mount_mmc_cb); + return 0; +} + +API int sysman_request_mount_mmc(struct mmc_contents *mmc_data) +{ + if (mmc_data != NULL && mmc_data->mmc_cb != NULL) + vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_MOUNT, + (void *)sysnoti_mount_mmc_cb, (void *)mmc_data); + return sysman_call_predef_action(PREDEF_MOUNT_MMC, 0); +} + +static int sysnoti_unmount_mmc_cb(keynode_t *key_nodes, void *data) +{ + struct mmc_contents *mmc_data; + mmc_data = (struct mmc_contents *)data; + DBG("unmountmmc_cb called"); + if (vconf_keynode_get_int(key_nodes) == + VCONFKEY_SYSMAN_MMC_UNMOUNT_COMPLETED) { + DBG("unmount ok"); + (mmc_data->mmc_cb)(0, mmc_data->user_data); + } else { + DBG("unmount fail"); + (mmc_data->mmc_cb)(-1, mmc_data->user_data); + } + vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_UNMOUNT, + (void *)sysnoti_unmount_mmc_cb); + return 0; +} + +API int sysman_request_unmount_mmc(struct mmc_contents *mmc_data, int option) +{ + char buf[255]; + if (option != 1 && option != 2) { + DBG("option is wrong. default option 1 will be used"); + option = 1; + } + snprintf(buf, sizeof(buf), "%d", option); + + if (mmc_data != NULL && mmc_data->mmc_cb != NULL) + vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_UNMOUNT, + (void *)sysnoti_unmount_mmc_cb, + (void *)mmc_data); + return sysman_call_predef_action(PREDEF_UNMOUNT_MMC, 1, buf); +} + +static int sysnoti_format_mmc_cb(keynode_t *key_nodes, void *data) +{ + struct mmc_contents *mmc_data; + mmc_data = (struct mmc_contents *)data; + DBG("format_cb called"); + if (vconf_keynode_get_int(key_nodes) == + VCONFKEY_SYSMAN_MMC_FORMAT_COMPLETED) { + DBG("format ok"); + (mmc_data->mmc_cb)(0, mmc_data->user_data); + + } else { + DBG("format fail"); + (mmc_data->mmc_cb)(-1, mmc_data->user_data); + } + vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_FORMAT, + (void *)sysnoti_format_mmc_cb); + return 0; +} + +API int sysman_request_format_mmc(struct mmc_contents *mmc_data) +{ + if (mmc_data != NULL && mmc_data->mmc_cb != NULL) + vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_FORMAT, + (void *)sysnoti_format_mmc_cb, + (void *)mmc_data); + return sysman_call_predef_action(PREDEF_FORMAT_MMC, 0); +} + +API int sysman_request_set_cpu_max_frequency(int val) +{ + char buf_pid[8]; + char buf_freq[256]; + + // to do - need to check new frequncy is valid + snprintf(buf_pid, sizeof(buf_pid), "%d", getpid()); + snprintf(buf_freq, sizeof(buf_freq), "%d", val * 1000); + + return sysman_call_predef_action(PREDEF_SET_MAX_FREQUENCY, 2, buf_pid, buf_freq); +} + +API int sysman_request_set_cpu_min_frequency(int val) +{ + char buf_pid[8]; + char buf_freq[256]; + + // to do - need to check new frequncy is valid + snprintf(buf_pid, sizeof(buf_pid), "%d", getpid()); + snprintf(buf_freq, sizeof(buf_freq), "%d", val * 1000); + + return sysman_call_predef_action(PREDEF_SET_MIN_FREQUENCY, 2, buf_pid, buf_freq); +} + +API int sysman_release_cpu_max_frequency() +{ + char buf_pid[8]; + + snprintf(buf_pid, sizeof(buf_pid), "%d", getpid()); + + return sysman_call_predef_action(PREDEF_RELEASE_MAX_FREQUENCY, 1, buf_pid); +} + +API int sysman_release_cpu_min_frequency() +{ + char buf_pid[8]; + + snprintf(buf_pid, sizeof(buf_pid), "%d", getpid()); + + return sysman_call_predef_action(PREDEF_RELEASE_MIN_FREQUENCY, 1, buf_pid); +} |