From 054e4a6c71ebaa4397c00d29a1ca481389620b4d Mon Sep 17 00:00:00 2001 From: Kichan Kwon Date: Thu, 11 Aug 2016 18:27:51 +0900 Subject: [PATCH] Remove needless things - Unused definitions - Documents about libresourced - Headers about libproc-stat Change-Id: Ica5a8654bab3795b3d9cbb97475c86a791505ec4 Signed-off-by: Kichan Kwon --- docs/description.txt | 14 -- docs/func.txt | 427 -------------------------------------- docs/traffic_db.txt | 69 ------ include/proc_stat.h | 300 -------------------------- packaging/resourced.spec | 4 - src/CMakeLists.txt | 3 - src/common/proc-common.h | 24 +++ src/common/transmission.h | 53 ----- src/proc-stat/include/proc-info.h | 30 --- src/proc-stat/include/proc-main.h | 1 - src/proc-stat/include/proc-noti.h | 48 ----- src/proc-stat/proc-main.c | 1 - src/proc-stat/proc-process.c | 1 - src/resourced/init.h | 5 - 14 files changed, 24 insertions(+), 956 deletions(-) delete mode 100644 docs/description.txt delete mode 100644 docs/func.txt delete mode 100644 docs/traffic_db.txt delete mode 100644 include/proc_stat.h delete mode 100644 src/common/transmission.h delete mode 100644 src/proc-stat/include/proc-info.h delete mode 100644 src/proc-stat/include/proc-noti.h diff --git a/docs/description.txt b/docs/description.txt deleted file mode 100644 index acecd66..0000000 --- a/docs/description.txt +++ /dev/null @@ -1,14 +0,0 @@ -PCL stands for Performance Control Library. - -The libresourced library is designed for accounting and limiting CPU, memory and bandwidth usage of all installed applications and daemons. It provides interface for setting limits and quotas and reading statistics. - -- CPU and memory usage are tracked and limited using cpu_acct and mem cgroup controllers -- Network traffic is controlled by special kernel module which works in conjunction with user-space daemon - -Network control is performed on 3rd layer of network subsystem using nethooks. To determine which application sent a packet, the netcls cgroup controller is used which tags all outgoing packets. -There is no direct way to determine to which application an incoming packet belongs. This is solved by comparing destination host/port pairs of incoming packets to known host/port pairs of sent packets. -There is also a backup way of determining the packet owner by parsing all the tracked applications' /proc entries. - -The daemon periodically collects the data from kernel module and stores it into sqlite database. - -Communication between daemon and kernel module is done using netlink interface. diff --git a/docs/func.txt b/docs/func.txt deleted file mode 100644 index 1c76d93..0000000 --- a/docs/func.txt +++ /dev/null @@ -1,427 +0,0 @@ -Following is the list of functions that are currently exported in libresourced.so - -Types: -====== - -/** - * @brief Datausage quota - */ -typedef struct { - int time_period; - int64_t snd_quota; - int64_t rcv_quota; - resman_state_t quota_type; -} resman_datausage_quota; - -/** - * @brief return type of the counters callback - */ -typedef enum { - PCL_CANCEL = 0, /**< cancel */ - PCL_CONTINUE = 1, /**< continue */ -} resman_cb_ret; - -/** - * @brief callback for enumerate counters and restrictions - */ -typedef resman_cb_ret(*resman_perf_info_cb) (const resman_perf_info * info, - void *user_data); - -/** - * @brief Selection rule applied for data usage enumeration - */ -typedef struct { - time_t from; - time_t to; - char *iface; - int granularity; -} data_usage_selection_rule; - -typedef struct { - resman_sql_exec exec; -} resman_base_query; - -typedef resman_ret_c(*resman_sql_exec) (const resman_exec_context *context); - -typedef struct { - resman_perf_info_cb info_cb; - void *user_data; - resman_perf_selection_rule *rule; -} resman_exec_context; - -typedef resman_cb_ret(*resman_perf_info_cb) (const resman_perf_info * info, - void *user_data); -/** - * @brief Bundle structure for bringing all together application identification - * and properties. - * app_id - application identification - copy it if you in - * callback function, don't store raw pointer on it - * iface - interface name, NULL means all interfaces, - * don't store raw pointer on it in the callback function, copy it by value - * interval - time interval for given result, NULL means entire interval - * foreground - foreground restrictions and counters - * background - background restrictions and counters - */ -typedef struct { - const char *app_id; - const char *iface; - resman_tm_interval *interval; - resman_common_info foreground; - resman_common_info background; -} resman_perf_info; - -/** - * @brief Commulative structure for holding data usage information - */ -typedef struct { - resman_counters cnt; - resman_restrictions rst; -} resman_common_info; - -typedef struct { - time_t from; - time_t to; -} resman_tm_interval; - -resman_ret_c - return value of most functions. - -typedef enum { - PCL_ERROR_NOTIMPL = -7, - PCL_ERROR_UNINITIALIZED = -6, - PCL_ERROR_NO_DATA = -5, - PCL_ERROR_INVALID_PARAMETER = -4, - PCL_ERROR_OUT_OF_MEMORY = -3, - PCL_ERROR_DB_FAILED = -2, - PCL_ERROR_FAIL = -1, - PCL_ERROR_OK = 0 -} resman_ret_c; - -/* - * cpu_usage: percent of cpu usage - * mem_usage: percent of mem usage - * incomming_rate_limit: rate limit for incomming packets in bytes per second - * outgoing_rate_limit: rate limit for outgoing packets in bytes per second - */ -typedef struct { - int cpu_usage; - int mem_usage; - int incoming_rate_limit; - int outgoing_rate_limit; -} resman_restrictions; - -/** - * @brief Selection rule applied for enumeration - * order - order field resman_order_t - * filter - fiter field resman_filter - * groupping - on what we should groupping our result - */ -typedef struct { - unsigned char version; - u_int32_t order; - resman_filter filter; - u_int32_t groupping; -} resman_perf_selection_rule; - -Functions: -========== - -int apply_net_restriction(u_int32_t classid, int incoming_rate_limit, int outgoing_rate_limit) - -Applies network rate limit to application having the supplied network class ID - -classid - network class ID -incoming_rate_limit - rate limit for incoming traffic -outgoing_rate_limit - rate limit for outgoing traffic - -Return values: -Non-zero values mean errors while communicating with kernel module - -TODO: -- Currently incoming_rate_limit must be 0, otherwise PCL_ERROR_NOTIMPL will be returned - --------------------------------------------------------------------------------- -resman_ret_c apply_restriction(const char *app_id, const resman_restrictions *foreground, const resman_restrictions *background) - -Stores restrictions into database to be applied when application is started again. - -app_id - zero-terminated string containing package name of application to be restricted -foreground - set of restrictions applied to application while in foreground -background - set of restrictions applied to application while in background - -Non-OK return values: -PCL_ERROR_INVALID_PARAMETER - app_id is NULL -PCL_ERROR_INVALID_PARAMETER - both foreground and background are NULL -PCL_ERROR_FAIL - could not determine network class ID for the application -PCL_ERROR_DB_FAILED - error while storing restrictions to database -PCL_ERROR_NOTIMPL - incoming_rate_limit is set -???? - apply_net_restriction can return any non-zero integer value (see above) which will be returned as is - -TODO: -- Does not apply CPU and memory restrictions if application is already running -- Background settings are ignored -- Return meaningful result in case apply_net_restriction fails - --------------------------------------------------------------------------------- -resman_ret_c bind_statement(sqlite3_stmt *stm, const resman_perf_selection_rule *rule) - -Applies selection rule to the statement. - -stm - sqlite statement to bind parameters to -rule - ???? parameters to be bound to statement - -Non-OK return values: -PCL_ERROR_INVALID_PARAMETER - stm is NULL -PCL_ERROR_INVALID_PARAMETER - rule filter type is not PCL_FILTER_UNDEF and rule filter value is NULL -PCL_ERROR_DB_FAILED - database error - -TODO: -The function assumes that bound parameter is always the first parameter to bind. This might break on some statements. - --------------------------------------------------------------------------------- -resman_base_query create_exec(const resman_perf_selection_rule *rule) - -Returns a query to be executed based on rule supplied - --------------------------------------------------------------------------------- -int create_netlink(int protocol, int groups) - -Create netlink socket. - -Results: Created socket on success and -1 on failure. - --------------------------------------------------------------------------------- -resman_ret_c data_usage_details_foreach(const char *app_id, - data_usage_selection_rule *rule, - resman_perf_info_cb info_cb, void *user_data) - -Process data usage details for application on given interval. - -app_id - null-terminated string containing package name of the application or NULL for all applications -rule - parameters of query - - from - start of interval - - to - end of interval - - iface - name of interface or NULL for all interfaces - - granularity - split data usage into granularity-sized chunks -info_cb - pointer to callback to be executed on each record -user_data - pointer to data which will be passed as argument 3 to callback - -Interval is given as a pair of unix timestamps. -If granularity is not supplied the result is the total data usage on the whole interval. Otherwise there will be one record for each chunk. -If iface is not supplied there will be one record for each interface. -If app_id is not supplied then records will contain total amount of data usage by all applications. - -info_cb must return PCL_CONTINUE to keep processing results or PCL_CANCEL to stop processing and discard the rest. - -Notes: -Callbacks are issued synchronously. When data_usage_details_foreach returns, all callbacks are guaranteed to have been executed already. -The function is not thread-safe. -If granularity is supplied, interval is split into chunks and each record contains traffic during that chunk. -If interface or granularity is supplied and a record contains no traffic, the record is omitted. - -Errors: -PCL_ERROR_INVALID_PARAMETER - rule or info_cb is NULL -PCL_ERROR_DB_FAILED - database error - --------------------------------------------------------------------------------- -void data_usage_finalize(void) - -Finalizes queries used in data usage functions - --------------------------------------------------------------------------------- -resman_ret_c data_usage_foreach(const data_usage_selection_rule *rule, - resman_perf_info_cb info_cb, void *user_data) - -Process data usage on given interval. - -rule - parameters of query - - from - start of interval - - to - end of interval - - iface - name of interface or NULL for all interfaces - - granularity - split data usage into granularity-sized chunks -info_cb - pointer to callback to be executed on each record -user_data - pointer to data which will be passed as argument 3 to callback - -Interval is given as a pair of unix timestamps. The result contains records for all applications that used network during that interval. -If granularity is not supplied each record is the total data usage on the whole interval. Otherwise there is a record for each chunk. -If iface is supplied the result is limited to that interface. Otherwise the result is a total of all interfaces. - -info_cb must return PCL_CONTINUE to keep processing results or PCL_CANCEL to stop processing and discard the rest. - -Notes: -Callbacks are issued synchronously. When data_usage_foreach returns, all callbacks are guaranteed to have been executed already. -The function is not thread-safe. -If granularity is supplied, interval is split into chunks and each record contains traffic during that chunk. If any record contains no traffic, the record is omitted. - -Errors: -PCL_ERROR_INVALID_PARAMETER - rule or info_cb is NULL -PCL_ERROR_DB_FAILED - database error - --------------------------------------------------------------------------------- -int data_usage_init(sqlite3 *db) - -Initializes queries used in data usage functions. - --------------------------------------------------------------------------------- -void datausage_quota_finalize(void) - -Finalizes queries used in data usage quota functions. - --------------------------------------------------------------------------------- -int datausage_quota_init(sqlite3 *db) - -Initializes queries used in data usage quota functions. - --------------------------------------------------------------------------------- -u_int32_t get_classid_by_app_id(const char *pkg_name, int create) - -Converts application id to network class. - -pkg_name - zero-terminated string containing the package name -create - if non-zero attempts to create the cgroup for pkg_name before fetching network class ID - -Returns class ID or 0 in case of error. - --------------------------------------------------------------------------------- -sqlite3 *resourced_get_database(void) - -Returns the handler to PCL database containing restrictions and statistics. - --------------------------------------------------------------------------------- -int get_family_id(int sock, pid_t pid) - -Probe the controller in genetlink to find the family id for the TRAF_STAT family. (Helper function) - --------------------------------------------------------------------------------- -void get_in_info(int sock, const pid_t pid, const int family_id, - in_traffic_event_list **list) - -Get list of incoming traffic records from the kernel module. - --------------------------------------------------------------------------------- -void get_out_info(int sock, const pid_t pid, - const int family_id, out_traffic_event_list **list) - -Get list of outgoing traffic records from the kernel module. - --------------------------------------------------------------------------------- -int make_cgroup_with_pid(char *dpg_name, char *app_path) - -Creates a cgroup named dkg_name if needed and place current process to that cgroup. - -dpkg_name - name of cgroup -app_path - used only for debugging - -Returns 0 on success -errno on error - -Notes: -The name is misleading, PID is not even accepted as a parameter. -app_path is used only for debugging and not anywhere in the code - --------------------------------------------------------------------------------- -void notify_daemon(void) - -Sends SIGUSR1 to the daemon. - --------------------------------------------------------------------------------- -resman_ret_c resman_perf_info_foreach(const resman_perf_selection_rule *rule, - resman_perf_info_cb info_cb, void *user_data) - -Processes network usage statistics based on supplied rule. - -rule - the rule used for statistics selection -info_cb - callback performed on each record -user_data - pointer passed as argument 3 to the callback - -Notes: -Actual behavior depends largely on the rule. - --------------------------------------------------------------------------------- -resman_ret_c resman_sql_rules_exec(const resman_exec_context *context) - -Performs the actual query and calls callback on each record. - -context - contains the rule and callback - -Note: -Internal function. - --------------------------------------------------------------------------------- -resman_ret_c resman_sql_simple_exec(const resman_exec_context *context) - -Performs the basic statistics query and calls callback on each record. - -context - contains the rule and callback - -Note: -Internal function. - --------------------------------------------------------------------------------- -void put_attr(rt_param *arg, int type, const void *data, int data_len) - -Write attribute to netlink packet. Helper function. - --------------------------------------------------------------------------------- -int receive_answer(int sock, const int attr_type, char **out_buffer, __u16 *arg_count) - -Read answer from kernel module. Helper function. - --------------------------------------------------------------------------------- -int revert_net_restriction(u_int32_t classid) - -Removes network restrictions set by apply_net_restriction. - -classid - network class ID which will be unrestricted - -Returns 0 on success, non-zero on failure. - -Note: -Name is a bit misleading in that it removes restrictions, not reverts to previous ones. - --------------------------------------------------------------------------------- -resman_ret_c revert_restriction(const char *app_id) - -Removes restrictions set by apply_restriction. - -app_id - zero-terminated string containing package name of application. - -Returns 0 on success -PCL_ERROR_DB_FAILED - database error -???? - any non-zero value could be returned by revert_net_restriction - -Notes: -Does not actually modify CPU or memory limits, only writes new settings to database. -Name is misleading in that the function removes restrictions, not reverts to previous ones. - --------------------------------------------------------------------------------- -int send_command(int sock, const pid_t pid, const int family_id, __u8 cmd) - -Helper function for sending commands to kernel module. - --------------------------------------------------------------------------------- -int send_restriction(int sock, const pid_t pid, const int family_id, - const u_int32_t *classids, const u_int16_t classid_count, - const enum traffic_restriction_type restriction_type) - -Internal function used for setting network restrictions. - --------------------------------------------------------------------------------- -void send_start(int sock, const pid_t pid, const int family_id) - -Helper function used in communicating with kernel module. - --------------------------------------------------------------------------------- -resman_ret_c set_datausage_quota(const char *app_id, - const resman_datausage_quota *quota) - -Sets network traffic quota for application. - -app_id - zero-terminated string containing package name of the application. -quota - network traffic quota to be applied to the application - -Returns: -PCL_ERROR_OK - success -PCL_ERROR_INVALID_PARAMETER - app_id or quota is NULL - -Note: -Currently only writes quota limits to the database. - diff --git a/docs/traffic_db.txt b/docs/traffic_db.txt deleted file mode 100644 index 4b5cd0d..0000000 --- a/docs/traffic_db.txt +++ /dev/null @@ -1,69 +0,0 @@ -Table of context ---------------- - -1. ERD - Entity relation diagram -2. Statistics entity -3. Restrictions entity -4. Quotas entity -5. Effective quota entity - - -1. ERD - - +----------------------------+ +--------------------+ +-------------+ - | restrictions | | statistics | | quotas | - |----------------------------| |--------------------| |-------------| - |binpath: TEXT |<--->|binpath: TEXT |<-->|binpath | - |cpu: INT | | |received: BIGINT | |sent_quota | - |mem: INT | | |sent: BIGINT | |rcv_quota | - |incomming_rate: INT | | |time_stamp: BIGINT | |time_period | - |outgoing_rate: INT | | |ifname: TEXT | |start_time | - | | | |ifmac: TEXT | +-------------+ - | | | | | - | | | | | - +----------------------------+ | +--------------------+ - | - | - | +---------------------------+ - | | effective_quota | - | |---------------------------| - +->|binpath | - |sent_used_quota | - |rcv_used_quota | - |start_time | - |finish_time | - | | - +---------------------------+ - -2. Statistics entity --------------------- -Holds information about counted traffic per time points, time_stamp - it's time -point. Accumulation of the information proceses in main loop of perf-controld. - - -3. Restrictions entity ----------------------- -Holds information about restriction see set_restriction function. Every time we -set restriction we store it in the database, it give us an ability to apply -restriction for example after reboot. -TODO: Possible bug. We don't separate quota based restriction and user based. -User based restriction should be applied without conditions, quota based should -be checked is quota active. - - -4. Quotas entity ----------------- -Holds information about quota. - - -5. Effective quota entity -------------------------- -Holds information about active quota. One enty per quotas time interval. - - - | time period | time period | time period | -------------------------------------------------------------------------------> - ^ ^ ^ - start time finish time finish time - start time start time -time line diff --git a/include/proc_stat.h b/include/proc_stat.h deleted file mode 100644 index 0cd13ab..0000000 --- a/include/proc_stat.h +++ /dev/null @@ -1,300 +0,0 @@ -/* - * resourced - * - * Library for getting process statistics - * - * Copyright (c) 2000 - 2013 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 __LIB_PROC_STAT__ -#define __LIB_PROC_STAT__ - -#ifndef __cplusplus -#include -#endif /* !__cplusplus */ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -typedef struct proc_stat_process_info /** process statistics */ -{ - pid_t pid; /**< the process ID */ - char name[NAME_MAX]; /**< the name of process */ - - bool valid; /** < whether this information is valid (can be used)*/ - bool active; /**< whether this process is active */ - bool fresh; /**< whether this process is newly created */ - unsigned long utime_diff; /**< user mode time this process spent during this measurement interval */ - unsigned long stime_diff; /**< kernel mode time this process spent during this measurement interval */ - unsigned long utime_prev; /**< previous user mode time this process spent during the last measurement interval */ - unsigned long stime_prev; /**< previous kernel mode time this process spent during the last measurement interval */ - - unsigned int rss; /**/stat - * - * This function gets CPU usage of a process by clock ticks unit from /proc//stat - */ - -bool proc_stat_get_cpu_time_by_pid(pid_t pid, unsigned long *utime, unsigned long *stime); - -/** - * @brief get memory usage by pid - * - * @param pid which process to get memory usage - * @param rss a process's memory usage - * @return true on success, false when it doesn't get values from /proc//statm - * - * This function gets memory usage of a process by KB unit from rss of /proc//statm - */ - -bool proc_stat_get_mem_usage_by_pid(pid_t pid, unsigned int *rss); - - - -/** - * @brief Get process name - * - * @param pid which process to get name - * @name name a process's name - * the size of name should be equal or larger than NAME_MAX - * @return true on success, false on failure. - * - * This function gets process name - * - */ -bool proc_stat_get_name_by_pid(pid_t pid, char *name); - - - -/** - * @brief Get pids under /proc file system - * - * @param pids which is filled with pids under /proc file system - * The memory to accommodate pids will be allocated in this fuction - * so the caller has reponsibility to free this memory - * @param cnt which is the count of pids - * @return true on success, false on failure. - * - * This function fills pids(param) with pids under /proc file system. - * - */ -bool proc_stat_get_pids(pid_t **pids, int *cnt); - - -/** - * @brief return whether currently GPU is on or off - * - * @return true on GPU being on, false on GPU being off - * - * This function returns whether currently GPU is on or off - * - */ -bool proc_stat_is_gpu_on(void); - - -/** - * @brief return GPU clock by MHz unit - * - * @return return GPU clock on success , -1 on false - * - * This function returns GPU clock - * - */ - -unsigned int proc_stat_get_gpu_clock(void); - - -enum proc_cgroup_cmd_type { /** cgroup command type **/ - PROC_CGROUP_SET_FOREGRD, - PROC_CGROUP_SET_ACTIVE, - PROC_CGROUP_SET_BACKGRD, - PROC_CGROUP_SET_INACTIVE, - PROC_CGROUP_SET_LAUNCH_REQUEST, - PROC_CGROUP_SET_RESUME_REQUEST, - PROC_CGROUP_SET_TERMINATE_REQUEST, - PROC_CGROUP_SET_SERVICE_REQUEST, - PROC_CGROUP_SET_NOTI_REQUEST, - PROC_CGROUP_SET_PROC_EXCLUDE_REQUEST, - PROC_CGROUP_GET_MEMSWEEP, - PROC_CGROUP_SET_TERMINATED, - PROC_CGROUP_SET_SYSTEM_SERVICE, - PROC_CGROUP_GET_CMDLINE, - PROC_CGROUP_GET_EXE, - PROC_CGROUP_GET_STAT, - PROC_CGROUP_GET_STATUS, - PROC_CGROUP_GET_OOMSCORE, - PROC_CGROUP_GET_PGID_CMDLINE, -}; - - -/** - * @desc Set processes to foreground. - */ -resourced_ret_c proc_cgroup_foregrd(void); - -/** - * @desc Set processes to background. - */ -resourced_ret_c proc_cgroup_backgrd(void); - -/** - * @desc Set process to active - */ -resourced_ret_c proc_cgroup_active(pid_t pid); - -/** - * @desc Set process to inactive - */ -resourced_ret_c proc_cgroup_inactive(pid_t pid); - -/** - * @desc Change process status about cgroup with type - */ -resourced_ret_c proc_group_change_status(int type, pid_t pid, char* app_id); - -/** - * @desc Send process launch request - */ -resourced_ret_c proc_cgroup_launch(int type, pid_t pid, char* app_id, char* pkg_id); - -/** - * @brief get proc filesystem component - * - * @return return get proc filesystem on success , -1 on false - * @param type component of proc filesystem - * @param pid process id - * @param buf data buffer - * @param len read length - * - */ -resourced_ret_c proc_stat_get_pid_entry(int type, pid_t pid, char* buf, int len); - -/** - * @brief sweep memory about background processes - * - * @return return num of swept processes - * - * This function returns GPU clock - * - */ -resourced_ret_c proc_cgroup_sweep_memory(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LIB_PROC_STAT__ */ diff --git a/packaging/resourced.spec b/packaging/resourced.spec index 84f2ec9..5a4388d 100644 --- a/packaging/resourced.spec +++ b/packaging/resourced.spec @@ -145,12 +145,8 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" -DDATAUSAGE_TYPE=NFACCT \ -DRD_SYS_HOME=%{TZ_SYS_HOME} \ -DRD_SYS_ETC=%{TZ_SYS_ETC} \ - -DRD_SYS_STORAGE=%{TZ_SYS_STORAGE} \ -DRD_SYS_DATA=%{TZ_SYS_GLOBALUSER_DATA} \ -DRD_SYS_DB=%{TZ_SYS_GLOBALUSER_DB} \ - -DRD_SYS_SHARE=%{TZ_SYS_SHARE} \ - -DRD_SYS_VAR=%{TZ_SYS_VAR} \ - -DRD_USER_CONTENT=%{TZ_USER_CONTENT} \ -DRD_CONFIG_PATH=%{rd_config_path} make %{?jobs:-j%jobs} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bf2e430..f28b6a9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,11 +6,8 @@ PROJECT(resource_d) ADD_DEFINITIONS("-DRD_SYS_HOME=\"${RD_SYS_HOME}\"") ADD_DEFINITIONS("-DRD_SYS_ETC=\"${RD_SYS_ETC}\"") -ADD_DEFINITIONS("-DRD_SYS_STORAGE=\"${RD_SYS_STORAGE}\"") ADD_DEFINITIONS("-DRD_SYS_DATA=\"${RD_SYS_DATA}\"") ADD_DEFINITIONS("-DRD_SYS_DB=\"${RD_SYS_DB}\"") -ADD_DEFINITIONS("-DRD_SYS_SHARE=\"${RD_SYS_SHARE}\"") -ADD_DEFINITIONS("-DRD_SYS_VAR=\"${RD_SYS_VAR}\"") ADD_DEFINITIONS("-DRD_CONFIG_PATH=\"${RD_CONFIG_PATH}\"") diff --git a/src/common/proc-common.h b/src/common/proc-common.h index c2a8542..0362378 100644 --- a/src/common/proc-common.h +++ b/src/common/proc-common.h @@ -119,6 +119,30 @@ enum proc_lru_state { PROC_FAVORITE_LRU_MAX = 35, }; + +enum cgroup_cmd_type { /** cgroup command type **/ + PROC_CGROUP_SET_FOREGRD, + PROC_CGROUP_SET_ACTIVE, + PROC_CGROUP_SET_BACKGRD, + PROC_CGROUP_SET_INACTIVE, + PROC_CGROUP_SET_LAUNCH_REQUEST, + PROC_CGROUP_SET_RESUME_REQUEST, + PROC_CGROUP_SET_TERMINATE_REQUEST, + PROC_CGROUP_SET_SERVICE_REQUEST, + PROC_CGROUP_SET_NOTI_REQUEST, + PROC_CGROUP_SET_PROC_EXCLUDE_REQUEST, + PROC_CGROUP_GET_MEMSWEEP, + PROC_CGROUP_SET_TERMINATED, + PROC_CGROUP_SET_SYSTEM_SERVICE, + PROC_CGROUP_GET_CMDLINE, + PROC_CGROUP_GET_EXE, + PROC_CGROUP_GET_STAT, + PROC_CGROUP_GET_STATUS, + PROC_CGROUP_GET_OOMSCORE, + PROC_CGROUP_GET_PGID_CMDLINE, +}; + + extern GSList *proc_app_list; struct proc_exclude { diff --git a/src/common/transmission.h b/src/common/transmission.h deleted file mode 100644 index 48c8fa9..0000000 --- a/src/common/transmission.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * @file transmission.h - * @brief Kernel - user space transmition structures - * - */ - -#ifndef _TRAFFIC_CONTROL_TRAFFIC_STAT_TRANSMITION_H_ -#define _TRAFFIC_CONTROL_TRAFFIC_STAT_TRANSMITION_H_ -#ifdef _KERNEL_ -#include -#include -#else -#include -#include -#endif - -/* Used both in kernel module and in control daemon */ - -/* - * @brief Entity for outgoing and incomming packet counter information. - * Used for serialization. - */ -struct traffic_event { - u_int32_t sk_classid; - unsigned long bytes; - int ifindex; -}; - -enum traffic_restriction_type { - RST_UNDEFINDED, - RST_SET, - RST_UNSET, - RST_EXCLUDE, - RST_MAX_VALUE -}; - -/* - * @brief Traffic restriction structure for serialization - * type - traffic_restriction_type - */ -struct traffic_restriction { - u_int32_t sk_classid; - int type; - int ifindex; - int send_limit; - int rcv_limit; - int snd_warning_threshold; - int rcv_warning_threshold; -}; - -#define RESOURCED_ALL_IFINDEX 1 - -#endif /*TRAFFIC_CONTROL_TRAFFIC_STAT_TRANSMITION */ diff --git a/src/proc-stat/include/proc-info.h b/src/proc-stat/include/proc-info.h deleted file mode 100644 index 09fe846..0000000 --- a/src/proc-stat/include/proc-info.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * resourced - * - * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. - * - * 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. - * - */ - -/** - * @file proc-info.h - * @desc communication api with libresourced for system & process information - **/ - -#ifndef __PROC_INFO_H__ -#define __PROC_INFO_H__ - -#define RESOURCED_PROC_INFO_SOCKET_PATH "/tmp/proc_info" - -#endif /*__PROC_HANDLER_H__*/ diff --git a/src/proc-stat/include/proc-main.h b/src/proc-stat/include/proc-main.h index a98cbca..f989809 100644 --- a/src/proc-stat/include/proc-main.h +++ b/src/proc-stat/include/proc-main.h @@ -32,7 +32,6 @@ #include "proc-common.h" #include "resourced.h" #include "const.h" -#include "proc_stat.h" struct proc_module_ops { char *name; diff --git a/src/proc-stat/include/proc-noti.h b/src/proc-stat/include/proc-noti.h deleted file mode 100644 index af39808..0000000 --- a/src/proc-stat/include/proc-noti.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * resourced - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * 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. - * - */ - -/** - * @file proc-noti.h - * @desc communication api with libresourced for grouping process - **/ - -#ifndef __PROC_NOTI_H__ -#define __PROC_NOTI_H__ - -#define RESOURCED_SOCKET_PATH "/tmp/resourced" -#define NOTI_MAXARG 16 -#define NOTI_MAXARGLEN 256 - -struct resourced_noti { /** cgroup notification type **/ - int pid; - int type; - int argc; - char *argv[NOTI_MAXARG]; -}; - -#define SYNC_OPERATION(type) type == PROC_CGROUP_GET_MEMSWEEP || \ - type == PROC_CGROUP_SET_RESUME_REQUEST || \ - type == PROC_CGROUP_SET_TERMINATE_REQUEST || \ - type >= PROC_CGROUP_GET_CMDLINE - -int write_response(int *retval, int fd, char *buf, int len); -int read_message(int fd, struct resourced_noti *msg); -void free_message(struct resourced_noti *msg); - -#endif /*__PROC_HANDLER_H__*/ diff --git a/src/proc-stat/proc-main.c b/src/proc-stat/proc-main.c index bbe6458..9b945a8 100644 --- a/src/proc-stat/proc-main.c +++ b/src/proc-stat/proc-main.c @@ -33,7 +33,6 @@ #include "proc-process.h" #include "proc-main.h" #include "cgroup.h" -#include "proc-noti.h" #include "trace.h" #include "proc-handler.h" #include "proc-monitor.h" diff --git a/src/proc-stat/proc-process.c b/src/proc-stat/proc-process.c index ad0d277..8bfc539 100644 --- a/src/proc-stat/proc-process.c +++ b/src/proc-stat/proc-process.c @@ -36,7 +36,6 @@ #include "procfs.h" #include "lowmem-common.h" #include "macro.h" -#include "proc-noti.h" #include "notifier.h" #include "proc-appusage.h" diff --git a/src/resourced/init.h b/src/resourced/init.h index 28a71a8..dd3a07b 100644 --- a/src/resourced/init.h +++ b/src/resourced/init.h @@ -31,8 +31,6 @@ #include "resourced.h" -#include "transmission.h" - struct daemon_arg { int argc; char **argv; @@ -47,7 +45,4 @@ void resourced_quit_mainloop(void); struct counter_arg; -void set_daemon_net_block_state(const enum traffic_restriction_type rst_type, - const struct counter_arg* carg); - #endif /* _RESOURCED_INIT_H */ -- 2.7.4