Lines Matching +full:max +full:- +full:cur

1 // SPDX-License-Identifier: GPL-2.0
23 #define PAGE_ALIGN(size, ps) (((size) + ((ps) - 1)) & ~((ps) - 1))
25 int set_cap_limits(rlim_t max) in set_cap_limits() argument
30 new.rlim_cur = max; in set_cap_limits()
31 new.rlim_max = max; in set_cap_limits()
34 return -1; in set_cap_limits()
40 return -2; in set_cap_limits()
49 int ret = -1; in get_proc_locked_vm_size()
56 return -1; in get_proc_locked_vm_size()
66 return -1; in get_proc_locked_vm_size()
75 return -1; in get_proc_locked_vm_size()
135 * return value: 0 - success
143 struct rlimit cur; in test_mlock_within_limit() local
146 getrlimit(RLIMIT_MEMLOCK, &cur); in test_mlock_within_limit()
147 if (cur.rlim_cur < alloc_size) { in test_mlock_within_limit()
149 alloc_size, (unsigned int)cur.rlim_cur); in test_mlock_within_limit()
150 return -1; in test_mlock_within_limit()
156 * - choose mlock/mlock2 randomly in test_mlock_within_limit()
157 * - choose lock_size randomly but lock_size < alloc_size in test_mlock_within_limit()
158 * - choose start_offset randomly but p+start_offset+lock_size in test_mlock_within_limit()
163 int start_offset = rand() % (alloc_size - lock_size); in test_mlock_within_limit()
187 return -1; in test_mlock_within_limit()
193 return -1; in test_mlock_within_limit()
212 * return value: 0 - success
220 struct rlimit cur; in test_mlock_outof_limit() local
222 getrlimit(RLIMIT_MEMLOCK, &cur); in test_mlock_outof_limit()
223 if (cur.rlim_cur >= alloc_size) { in test_mlock_outof_limit()
225 alloc_size, (unsigned int)cur.rlim_cur); in test_mlock_outof_limit()
226 return -1; in test_mlock_outof_limit()
233 int lock_size = (rand() % (alloc_size - cur.rlim_cur)) in test_mlock_outof_limit()
234 + cur.rlim_cur; in test_mlock_outof_limit()
235 int start_offset = rand() % (alloc_size - lock_size); in test_mlock_outof_limit()
247 return -1; in test_mlock_outof_limit()
256 return -1; in test_mlock_outof_limit()
268 return -1; in main()
273 return -1; in main()
285 return -1; in main()