summaryrefslogtreecommitdiff
path: root/sysman_managed.h
blob: 77f59704871d93d2d840ed1b5bda23126fd12675 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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___ */