author | schurig <schurig> | 2003-06-02 11:16:28 (UTC) |
---|---|---|
committer | schurig <schurig> | 2003-06-02 11:16:28 (UTC) |
commit | 52292823fc01a87907ce023dbdd7712994d5a51b (patch) (unidiff) | |
tree | 9f3ef2065fc66961274910dff931f80ae05cebeb | |
parent | 2d6bec942d8b9b8b50639cb4ffe58cf24d5a255b (diff) | |
download | opie-52292823fc01a87907ce023dbdd7712994d5a51b.zip opie-52292823fc01a87907ce023dbdd7712994d5a51b.tar.gz opie-52292823fc01a87907ce023dbdd7712994d5a51b.tar.bz2 |
added
-rw-r--r-- | library/custom-ramses.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/library/custom-ramses.h b/library/custom-ramses.h new file mode 100644 index 0000000..b841a66 --- a/dev/null +++ b/library/custom-ramses.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #define QPE_HAVE_TOGGLELIGHT | ||
22 | #define QPE_STARTMENU | ||
23 | |||
24 | #include <unistd.h> | ||
25 | #include <stdio.h> | ||
26 | #include <signal.h> | ||
27 | #include <fcntl.h> | ||
28 | #include <sys/ioctl.h> | ||
29 | |||
30 | #define QPE_HAVE_MEMALERTER | ||
31 | |||
32 | #define QPE_MEMALERTER_IMPL \ | ||
33 | static void sig_handler(int sig) \ | ||
34 | { \ | ||
35 | switch (sig) { \ | ||
36 | case SIGHUP: \ | ||
37 | memstate = VeryLow; \ | ||
38 | break; \ | ||
39 | case SIGUSR1: \ | ||
40 | memstate = Normal; \ | ||
41 | break; \ | ||
42 | case SIGUSR2: \ | ||
43 | memstate = Low; \ | ||
44 | break; \ | ||
45 | } \ | ||
46 | } \ | ||
47 | static void initMemalerter() \ | ||
48 | { \ | ||
49 | struct sigaction sa; \ | ||
50 | memset(&sa, '\0', sizeof sa); \ | ||
51 | sa.sa_handler = sig_handler; \ | ||
52 | sa.sa_flags = SA_RESTART; \ | ||
53 | if (sigaction(SIGHUP, &sa, NULL) < 0) { \ | ||
54 | return; \ | ||
55 | } \ | ||
56 | if (sigaction(SIGUSR1, &sa, NULL) < 0) { \ | ||
57 | return; \ | ||
58 | } \ | ||
59 | if (sigaction(SIGUSR2, &sa, NULL) < 0) { \ | ||
60 | return; \ | ||
61 | } \ | ||
62 | FILE *fo = fopen("/proc/sys/vm/freepg_signal_proc", "w"); \ | ||
63 | \ | ||
64 | if (!fo) \ | ||
65 | return; \ | ||
66 | fprintf(fo, "qpe\n"); \ | ||
67 | fclose(fo); \ | ||
68 | } | ||