• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 // Copyright (c) 2009 FUJITSU LIMITED
3 // Author: Li Zefan <lizf@cn.fujitsu.com>
4 
5 #include <sys/mman.h>
6 #include <signal.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <unistd.h>
10 
sigusr_handler(int signo)11 void sigusr_handler(int __attribute__ ((unused)) signo)
12 {
13 	char *p;
14 	int size = getpagesize() * 2;
15 
16 	p = mmap(NULL, size, PROT_READ | PROT_WRITE,
17 		 MAP_PRIVATE | MAP_ANONYMOUS | MAP_LOCKED, 0, 0);
18 	if (p == MAP_FAILED)
19 		exit(1);
20 }
21 
main(void)22 int main(void)
23 {
24 	struct sigaction sigusr_action;
25 
26 	memset(&sigusr_action, 0, sizeof(sigusr_action));
27 	sigusr_action.sa_handler = &sigusr_handler;
28 	sigaction(SIGUSR1, &sigusr_action, NULL);
29 
30 	while (1)
31 		sleep(1);
32 
33 	return 0;
34 }
35