Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-NRF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-NRF
Commits
dae46503
Commit
dae46503
authored
Dec 18, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code cleanup
parent
bae34edf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
203 deletions
+0
-203
src/common/utils/CMakeLists.txt
src/common/utils/CMakeLists.txt
+0
-1
src/common/utils/async_shell_cmd.cpp
src/common/utils/async_shell_cmd.cpp
+0
-142
src/common/utils/async_shell_cmd.hpp
src/common/utils/async_shell_cmd.hpp
+0
-60
No files found.
src/common/utils/CMakeLists.txt
View file @
dae46503
...
...
@@ -27,7 +27,6 @@ include_directories(${SRC_TOP_DIR}/nrf_app)
set
(
CN_UTILS_SRC STATIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/async_shell_cmd.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/conversions.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/api_conversions.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/get_gateway_netlink.cpp
...
...
src/common/utils/async_shell_cmd.cpp
deleted
100644 → 0
View file @
bae34edf
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
*
* 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.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file async_shell_cmd.cpp
\brief
\author Lionel GAUTHIER
\date 2017
\email: lionel.gauthier@eurecom.fr
*/
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <inttypes.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <ctype.h>
#include <fcntl.h>
//#include "itti.hpp"
#include "async_shell_cmd.hpp"
//#include "itti_async_shell_cmd.hpp"
#include "logger.hpp"
//#include "common_defs.h"
#include <stdexcept>
using
namespace
util
;
//extern itti_mw *itti_inst;
void
async_cmd_task
(
void
*
);
//------------------------------------------------------------------------------
void
async_cmd_task
(
void
*
args_p
)
{
// const task_id_t task_id = TASK_ASYNC_SHELL_CMD;
/*
const thread_sched_params *const sched_params =
(const util::thread_sched_params* const ) args_p;
sched_params->apply(task_id, Logger::async_cmd());
itti_inst->notify_task_ready(task_id);
do {
std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id);
auto *msg = shared_msg.get();
switch (msg->msg_type) {
case ASYNC_SHELL_CMD:
if (itti_async_shell_cmd *to = dynamic_cast<itti_async_shell_cmd*>(msg)) {
int rc = system((const char*) to->system_command.c_str());
if (rc) {
Logger::async_cmd().error("Failed cmd from %d: %s ", to->origin,
(const char*) to->system_command.c_str());
if (to->is_abort_on_error) {
Logger::async_cmd().error(
"Terminate cause failed cmd %s at %s:%d",
to->system_command.c_str(), to->src_file.c_str(),
to->src_line);
itti_inst->send_terminate_msg(to->origin);
}
}
}
break;
case TIME_OUT:
if (itti_msg_timeout *to = dynamic_cast<itti_msg_timeout*>(msg)) {
Logger::async_cmd().info("TIME-OUT event timer id %d", to->timer_id);
}
break;
case TERMINATE:
if (itti_msg_terminate *terminate =
dynamic_cast<itti_msg_terminate*>(msg)) {
Logger::async_cmd().info("Received terminate message");
return;
}
break;
case HEALTH_PING:
break;
default:
Logger::smf_app().info("no handler for msg type %d", msg->msg_type);
}
} while (true);
*/
}
//------------------------------------------------------------------------------
async_shell_cmd
::
async_shell_cmd
(
util
::
thread_sched_params
&
sched_params
)
{
Logger
::
async_cmd
().
startup
(
"Starting..."
);
/*
if (itti_inst->create_task(TASK_ASYNC_SHELL_CMD, async_cmd_task,
&sched_params)) {
Logger::async_cmd().error("Cannot create task TASK_ASYNC_SHELL_CMD");
throw std::runtime_error("Cannot create task TASK_ASYNC_SHELL_CMD");
}
*/
Logger
::
async_cmd
().
startup
(
"Started"
);
}
/*
//------------------------------------------------------------------------------
int async_shell_cmd::run_command(const task_id_t sender_itti_task,
const bool is_abort_on_error,
const char *src_file, const int src_line,
const std::string &cmd_str) {
itti_async_shell_cmd cmd(sender_itti_task, TASK_ASYNC_SHELL_CMD, cmd_str,
is_abort_on_error, src_file, src_line);
std::shared_ptr<itti_async_shell_cmd> msg = std::make_shared<
itti_async_shell_cmd>(cmd);
int ret = itti_inst->send_msg(msg);
if (RETURNok != ret) {
Logger::async_cmd().error(
"Could not send ITTI message to task TASK_ASYNC_SHELL_CMD");
return RETURNerror ;
}
return RETURNok ;
}
*/
src/common/utils/async_shell_cmd.hpp
deleted
100755 → 0
View file @
bae34edf
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
*
* 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.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file async_shell_cmd.hpp
\brief We still use some unix commands for convenience, and we did not have to replace them by system calls
\ Instead of calling C system(...) that can take a lot of time (creation of a process, etc), in many cases
\ it doesn't hurt to do this asynchronously, may be we must tweak thread priority, pin it to a CPU, etc (TODO later)
\author Lionel GAUTHIER
\date 2017
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_ASYNC_SHELL_CMD_HPP_SEEN
#define FILE_ASYNC_SHELL_CMD_HPP_SEEN
//#include "itti_msg.hpp"
#include "thread_sched.hpp"
#include <string>
#include <thread>
namespace
util
{
class
async_shell_cmd
{
private:
std
::
thread
::
id
thread_id
;
std
::
thread
thread
;
public:
explicit
async_shell_cmd
(
util
::
thread_sched_params
&
sched_params
);
~
async_shell_cmd
()
{
}
async_shell_cmd
(
async_shell_cmd
const
&
)
=
delete
;
void
operator
=
(
async_shell_cmd
const
&
)
=
delete
;
// int run_command(const task_id_t sender_itti_task,
// const bool is_abort_on_error, const char *src_file,
// const int src_line, const std::string &cmd_str);
};
}
#endif
/* FILE_ASYNC_SHELL_CMD_HPP_SEEN */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment