-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathliblmkd_utils.h
62 lines (52 loc) · 1.72 KB
/
liblmkd_utils.h
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
/*
* Copyright 2018 Google, Inc
*
* 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 _LIBLMKD_UTILS_H_
#define _LIBLMKD_UTILS_H_
#include <sys/cdefs.h>
#include <sys/types.h>
#include <lmkd.h>
__BEGIN_DECLS
/*
* Connects to lmkd process and returns socket handle.
* On success returns socket handle.
* On error, -1 is returned, and errno is set appropriately.
*/
int lmkd_connect();
/*
* Registers a process with lmkd and sets its oomadj score.
* On success returns 0.
* On error, -1 is returned.
* In the case of error errno is set appropriately.
*/
int lmkd_register_proc(int sock, struct lmk_procprio *params);
/*
* Unregisters a process previously registered with lmkd.
* On success returns 0.
* On error, -1 is returned.
* In the case of error errno is set appropriately.
*/
int lmkd_unregister_proc(int sock, struct lmk_procremove *params);
/*
* Creates memcg directory for given process.
* On success returns 0.
* -1 is returned if path creation failed.
* -2 is returned if tasks file open operation failed.
* -3 is returned if tasks file write operation failed.
* In the case of error errno is set appropriately.
*/
int create_memcg(uid_t uid, pid_t pid);
__END_DECLS
#endif /* _LIBLMKD_UTILS_H_ */