diff options
Diffstat (limited to 'storaged/include/storaged.h')
-rw-r--r-- | storaged/include/storaged.h | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/storaged/include/storaged.h b/storaged/include/storaged.h index d3e6b7140..15d830c39 100644 --- a/storaged/include/storaged.h +++ b/storaged/include/storaged.h | |||
@@ -123,28 +123,6 @@ public: | |||
123 | } | 123 | } |
124 | }; | 124 | }; |
125 | 125 | ||
126 | class tasks_t { | ||
127 | private: | ||
128 | FRIEND_TEST(storaged_test, tasks_t); | ||
129 | sem_t mSem; | ||
130 | // hashmap for all running tasks w/ pid as key | ||
131 | std::unordered_map<uint32_t, struct task_info> mRunning; | ||
132 | // hashmap for all tasks that have been killed (categorized by cmd) w/ cmd as key | ||
133 | std::unordered_map<std::string, struct task_info> mOld; | ||
134 | std::unordered_map<std::uint32_t, struct task_info> get_running_tasks(); | ||
135 | public: | ||
136 | tasks_t() { | ||
137 | sem_init(&mSem, 0, 1); // TODO: constructor don't have a return value, what if sem_init fails | ||
138 | } | ||
139 | |||
140 | ~tasks_t() { | ||
141 | sem_destroy(&mSem); | ||
142 | } | ||
143 | |||
144 | void update_running_tasks(void); | ||
145 | std::vector<struct task_info> get_tasks(void); | ||
146 | }; | ||
147 | |||
148 | class stream_stats { | 126 | class stream_stats { |
149 | private: | 127 | private: |
150 | double mSum; | 128 | double mSum; |
@@ -282,7 +260,6 @@ struct storaged_config { | |||
282 | int periodic_chores_interval_disk_stats_publish; | 260 | int periodic_chores_interval_disk_stats_publish; |
283 | int periodic_chores_interval_emmc_info_publish; | 261 | int periodic_chores_interval_emmc_info_publish; |
284 | int periodic_chores_interval_uid_io; | 262 | int periodic_chores_interval_uid_io; |
285 | bool proc_taskio_readable; // are /proc/[pid]/{io, comm, cmdline, stat} all readable | ||
286 | bool proc_uid_io_available; // whether uid_io is accessible | 263 | bool proc_uid_io_available; // whether uid_io is accessible |
287 | bool emmc_available; // whether eMMC est_csd file is readable | 264 | bool emmc_available; // whether eMMC est_csd file is readable |
288 | bool diskstats_available; // whether diskstats is accessible | 265 | bool diskstats_available; // whether diskstats is accessible |
@@ -296,7 +273,6 @@ private: | |||
296 | disk_stats_publisher mDiskStats; | 273 | disk_stats_publisher mDiskStats; |
297 | disk_stats_monitor mDsm; | 274 | disk_stats_monitor mDsm; |
298 | emmc_info_t mEmmcInfo; | 275 | emmc_info_t mEmmcInfo; |
299 | tasks_t mTasks; | ||
300 | uid_monitor mUidm; | 276 | uid_monitor mUidm; |
301 | time_t mStarttime; | 277 | time_t mStarttime; |
302 | public: | 278 | public: |
@@ -307,15 +283,6 @@ public: | |||
307 | void pause(void) { | 283 | void pause(void) { |
308 | sleep(mConfig.periodic_chores_interval_unit); | 284 | sleep(mConfig.periodic_chores_interval_unit); |
309 | } | 285 | } |
310 | std::vector<struct task_info> get_tasks(void) { | ||
311 | // There could be a race when get_tasks() and the main thread is updating at the same time | ||
312 | // While update_running_tasks() is updating the critical sections at the end of the function | ||
313 | // all together atomically, the final state of task_t can only be either the main thread's | ||
314 | // update or this update. Since the race can only occur when both threads are updating | ||
315 | // "simultaneously", either final state is acceptable. | ||
316 | mTasks.update_running_tasks(); | ||
317 | return mTasks.get_tasks(); | ||
318 | } | ||
319 | 286 | ||
320 | void set_privileged_fds(int fd_emmc) { | 287 | void set_privileged_fds(int fd_emmc) { |
321 | mEmmcInfo.set_emmc_fd(fd_emmc); | 288 | mEmmcInfo.set_emmc_fd(fd_emmc); |