• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************/
2 /*                                                                            */
3 /* Copyright (c) 2009 FUJITSU LIMITED                                         */
4 /*                                                                            */
5 /* This program is free software;  you can redistribute it and/or modify      */
6 /* it under the terms of the GNU General Public License as published by       */
7 /* the Free Software Foundation; either version 2 of the License, or          */
8 /* (at your option) any later version.                                        */
9 /*                                                                            */
10 /* This program is distributed in the hope that it will be useful,            */
11 /* but WITHOUT ANY WARRANTY;  without even the implied warranty of            */
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See                  */
13 /* the GNU General Public License for more details.                           */
14 /*                                                                            */
15 /* You should have received a copy of the GNU General Public License          */
16 /* along with this program;  if not, write to the Free Software               */
17 /* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    */
18 /*                                                                            */
19 /* Author: Li Zefan <lizf@cn.fujitsu.com>                                     */
20 /*                                                                            */
21 /******************************************************************************/
22 
23 #include <sys/mman.h>
24 #include <signal.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <unistd.h>
28 
sigusr_handler(int signo)29 void sigusr_handler(int __attribute__ ((unused)) signo)
30 {
31 	char *p;
32 	int size = getpagesize() * 2;
33 
34 	p = mmap(NULL, size, PROT_READ | PROT_WRITE,
35 		 MAP_PRIVATE | MAP_ANONYMOUS | MAP_LOCKED, 0, 0);
36 	if (p == MAP_FAILED)
37 		exit(1);
38 }
39 
main(void)40 int main(void)
41 {
42 	struct sigaction sigusr_action;
43 
44 	memset(&sigusr_action, 0, sizeof(sigusr_action));
45 	sigusr_action.sa_handler = &sigusr_handler;
46 	sigaction(SIGUSR1, &sigusr_action, NULL);
47 
48 	while (1)
49 		sleep(1);
50 
51 	return 0;
52 }
53