cregit-Linux how code gets into the kernel

Release 4.18 tools/testing/selftests/vm/on-fault-limit.c

// SPDX-License-Identifier: GPL-2.0
#include <sys/mman.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#include <sys/resource.h>

#ifndef MCL_ONFAULT

#define MCL_ONFAULT (MCL_FUTURE << 1)
#endif


static int test_limit(void) { int ret = 1; struct rlimit lims; void *map; if (getrlimit(RLIMIT_MEMLOCK, &lims)) { perror("getrlimit"); return ret; } if (mlockall(MCL_ONFAULT | MCL_FUTURE)) { perror("mlockall"); return ret; } map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); if (map != MAP_FAILED) printf("mmap should have failed, but didn't\n"); else { ret = 0; munmap(map, 2 * lims.rlim_max); } munlockall(); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Eric B Munson12198.37%150.00%
SeongJae Park21.63%150.00%
Total123100.00%2100.00%


int main(int argc, char **argv) { int ret = 0; ret += test_limit(); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Eric B Munson26100.00%1100.00%
Total26100.00%1100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Eric B Munson17498.31%133.33%
SeongJae Park21.13%133.33%
Greg Kroah-Hartman10.56%133.33%
Total177100.00%3100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.