Move function definition to aul header
[platform/core/appfw/aul-1.git] / include / aul_proc.h
1 /*
2  * Copyright (c) 2000 - 2021 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __AUL_PROC_H__
18 #define __AUL_RPOC_H__
19
20 #include <sys/types.h>
21 #include <unistd.h>
22
23 #include <aul.h>
24 #include <bundle.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /**
31  * @brief Gets the user ID of the process from the proc filesystem.
32  * @since_tizen 6.5
33  * @param[in]   pid             The process ID
34  * @param[out]  uid             The user ID
35  * @return @c 0 on success,
36  *         otherwise a negative error value
37  * @remarks This function is only for App Framework internally.
38  */
39 int aul_proc_get_uid(pid_t pid, uid_t *uid);
40
41 /**
42  * @brief Gets the SMACK label of the process from the proc filesystem.
43  * @since_tizen 6.5
44  * @param[in]   pid             The process ID
45  * @param[in]   buf             The buffer
46  * @param[in]   buf_size        The size of the buffer
47  * @return @c 0 on success,
48  *         otherwise a negative error value
49  * @remarks This function is only for App Framework internally.
50  */
51 int aul_proc_get_attr(pid_t pid, char *buf, size_t buf_size);
52
53 /**
54  * @brief Gets the cmdline of the process from the proc filesystem.
55  * @since_tizen 6.5
56  * @param[in]   pid             The process ID
57  * @param[in]   buf             The buffer
58  * @param[in]   buf_size        The size of the buffer
59  * @return @c 0 on success,
60  *         otherwise a negative error value
61  * @remarks This function is only for App Framework internally.
62  */
63 int aul_proc_get_cmdline(pid_t pid, char *buf, size_t buf_size);
64
65 /**
66  * @brief Registers the process information,
67  * @details This function registers the process information to the application manager daemon.
68  *          After calling this function, the other process can get the process information
69  *          using aul_proc_get_name() or aul_proc_get_extra().
70  * @since_tizen 6.5
71  * @param[in]   name            The process name
72  * @param[in]   extra           The extra data
73  * @return @c 0 on success,
74  *         otherwise a negative error value
75  * @remarks This function is only for App Framework internally.
76  */
77 int aul_proc_register(const char *name, bundle *extra);
78
79 /**
80  * @brief Deregister the process information.
81  * @since_tizen 6.5
82  * @return @c 0 on success,
83  *         otherwise a negative error value
84  * @remarks This function is only for App Framework internally.
85  */
86 int aul_proc_deregister(void);
87
88 /**
89  * @brief Gets the process name.
90  * @since_tizen 6.5
91  * @remarks The @a name MUST be released using free().
92  * @param[in]   pid             The process ID
93  * @param[out]  name            The process name
94  * @return @c 0 on success,
95  *         otherwise a negative error value
96  * @remarks This function is only for App Framework internally.
97  */
98 int aul_proc_get_name(pid_t pid, char **name);
99
100 /**
101  * @brief Gets the extra data of the process.
102  * @since_tizen 6.5
103  * @reamrks The @a extra MUST be released using bundle_free().
104  * @param[in]   pid             The process ID
105  * @param[out]  extra           The extra data
106  * @return @c 0 on success,
107  *         otherwise a negative error value
108  * @remarks This function is only for App Framework internally.
109  */
110 int aul_proc_get_extra(pid_t pid, bundle **extra);
111
112 #ifdef __cplusplus
113 }
114 #endif
115
116 #endif /* __AUL_PROC_H__ */