1 /*
2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification,
5 * are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific prior written
16 * permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 #include <cstdio>
31 #include <unistd.h>
32 #include <cstdlib>
33 #include <fcntl.h>
34 #include "It_process_plimits.h"
35
ItProcessPlimits006(void)36 void ItProcessPlimits006(void)
37 {
38 int ret;
39 const char *path3 = "/proc/plimits/plimits.procs";
40 ret = remove(path3);
41 ASSERT_EQ(ret, -1);
42
43 const char *path4 = "/proc/plimits/pids.max";
44 ret = remove(path4);
45 ASSERT_EQ(ret, -1);
46
47 const char *path5 = "/proc/plimits/pids.priority";
48 ret = remove(path5);
49 ASSERT_EQ(ret, -1);
50
51 const char *path6 = "/proc/plimits/sched.period";
52 ret = remove(path6);
53 ASSERT_EQ(ret, -1);
54
55 const char *path7 = "/proc/plimits/sched.quota";
56 ret = remove(path7);
57 ASSERT_EQ(ret, -1);
58
59 const char *path8 = "/proc/plimits/sched.stat";
60 ret = remove(path8);
61 ASSERT_EQ(ret, -1);
62
63 const char *path9 = "/proc/plimits/memory.limit";
64 ret = remove(path9);
65 ASSERT_EQ(ret, -1);
66
67 const char *path10 = "/proc/plimits/memory.stat";
68 ret = remove(path10);
69 ASSERT_EQ(ret, -1);
70
71 const char *path11 = "/proc/plimits/ipc.mq_limit";
72 ret = remove(path11);
73 ASSERT_EQ(ret, -1);
74
75 const char *path12 = "/proc/plimits/ipc.shm_limit";
76 ret = remove(path12);
77 ASSERT_EQ(ret, -1);
78
79 const char *path13 = "/proc/plimits/ipc.stat";
80 ret = remove(path13);
81 ASSERT_EQ(ret, -1);
82
83 const char *path14 = "/proc/plimits/devices.list";
84 ret = remove(path14);
85 ASSERT_EQ(ret, -1);
86
87 const char *path15 = "/proc/plimits/devices.deny";
88 ret = remove(path15);
89 ASSERT_EQ(ret, -1);
90
91 const char *path16 = "/proc/plimits/devices.allow";
92 ret = remove(path16);
93 ASSERT_EQ(ret, -1);
94
95 const char *path17 = "/proc/plimits/limiters";
96 ret = remove(path17);
97 ASSERT_EQ(ret, -1);
98 return;
99 }
100