1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
diff -Nur c3000_pre/linux/arch/arm/config.in c3000_work/linux/arch/arm/config.in
--- c3000_pre/linux/arch/arm/config.in 2004-12-05 22:17:18.000000000 +0900
+++ c3000_work/linux/arch/arm/config.in 2004-12-06 01:13:03.000000000 +0900
@@ -481,6 +481,7 @@
if [ "$CONFIG_SL_CCCR_CHANGE" = "y" ]; then
bool 'Core voltage change enable (EXPERIMENTAL)' CONFIG_CHANGE_CORE_VOLT
fi
+ bool 'Fix send SIGSTOP to all tasks at suspend (EXPERIMENTAL)' CONFIG_SL_SIGSTOP_FIX
if [ "$CONFIG_ARCH_SHARP_SL" = "y" ]; then
define_bool CONFIG_BATT y
fi
diff -Nur c3000_pre/linux/arch/arm/mach-pxa/sharpsl_apm.c c3000_work/linux/arch/arm/mach-pxa/sharpsl_apm.c
--- c3000_pre/linux/arch/arm/mach-pxa/sharpsl_apm.c 2004-12-05 22:17:18.000000000 +0900
+++ c3000_work/linux/arch/arm/mach-pxa/sharpsl_apm.c 2004-12-06 23:48:35.000000000 +0900
@@ -75,6 +75,11 @@
#include <asm/system.h>
#include <asm/hardware.h>
+extern int errno;
+// unistd.h is included for the configuration ioctl stuff
+#define __KERNEL_SYSCALLS__ 1
+#include <asm/unistd.h>
+
#ifdef CONFIG_ARCH_SHARP_SL
#include <asm/irq.h>
#include <asm/arch/irqs.h>
@@ -363,6 +368,8 @@
};
#define ERROR_COUNT (sizeof(error_table)/sizeof(lookup_t))
+#define APP_NAME_LIST "/etc/suspend.lst"
+
/*
* Function
*/
@@ -650,14 +657,81 @@
struct task_struct* p = NULL;
struct task_struct* tsk = current;
+#if defined(CONFIG_SL_SIGSTOP_FIX)
+ int fd,x;
+ mm_segment_t old_fs = get_fs ();
+ char line_buffer[256];
+
if (! spin_trylock(&lock))
return;
+
+ // Try opening the send sig application name list
+
+ set_fs(KERNEL_DS);
+ fd = open(APP_NAME_LIST, O_RDONLY, 0);
+ set_fs(old_fs);
/* send signal to all procs except for kernel-threads */
read_lock(&tasklist_lock);
+
+ if(fd < 0){
+ for_each_task(p) {
+ struct siginfo si;
+
+ if (p->pid == 1 || p->pid == tsk->pid || is_kernel_thread(p))
+ continue;
+ if (!strcmp(p->comm,"cardmgr")) { //Send sig to cardmgr
+ si.si_signo = signo;
+ si.si_errno = 0;
+ si.si_code = SI_KERNEL;
+ si.si_pid = tsk->pid;
+ si.si_uid = tsk->uid;
+ send_sig_info(signo, &si, p);
+ }
+ }
+
+ }else {
+ for(;;){
+ memset(line_buffer, '\0', 256);
+ set_fs(KERNEL_DS);
+ for (x = 0; x < 256; x++) {
+ if (!read(fd, &line_buffer[x], 1))
+ goto sig_send_done;
+ if (line_buffer[x] == '\n' || line_buffer[x] == '\r')
+ break;
+ }
+ set_fs(old_fs);
+
+ for_each_task(p) {
+ struct siginfo si;
+
+ if (p->pid == 1 || p->pid == tsk->pid || is_kernel_thread(p))
+ continue;
+ if (!strncmp(p->comm,line_buffer,strlen(p->comm))) { //Send sig to cardmgr
+// printk ("Send SIG to application\n");
+ si.si_signo = signo;
+ si.si_errno = 0;
+ si.si_code = SI_KERNEL;
+ si.si_pid = tsk->pid;
+ si.si_uid = tsk->uid;
+ send_sig_info(signo, &si, p);
+ }
+ }
+ }
+ sig_send_done:
+
+ close(fd);
+
+ }
+#else
+ if (! spin_trylock(&lock))
+ return;
+
+ /* send signal to all procs except for kernel-threads */
+ read_lock(&tasklist_lock);
for_each_task(p) {
struct siginfo si;
-
+
if (p->pid == 1 || p->pid == tsk->pid || is_kernel_thread(p))
continue;
@@ -667,7 +741,8 @@
si.si_pid = tsk->pid;
si.si_uid = tsk->uid;
send_sig_info(signo, &si, p);
- }
+ }
+#endif
read_unlock(&tasklist_lock);
if (signo == SIGSTOP) {
@@ -679,6 +754,58 @@
schedule();
set_current_state(state);
+#if defined(CONFIG_SL_SIGSTOP_FIX)
+ set_fs(KERNEL_DS);
+ fd = open(APP_NAME_LIST, O_RDONLY, 0);
+ set_fs(old_fs);
+
+ read_lock(&tasklist_lock);
+ if(fd < 0){
+ for_each_task(p) {
+ if (p->pid == 1 || p->pid == tsk->pid || is_kernel_thread(p))
+ continue;
+ if (!strcmp(p->comm,"cardmgr")) {
+// printk ("Check application stopped\n");
+
+ if (p->state != TASK_STOPPED) {
+ read_unlock(&tasklist_lock);
+ goto retry;
+ }
+ }
+ }
+ }else {
+
+ for(;;){
+ memset(line_buffer, '\0', 256);
+ old_fs = get_fs();
+ set_fs(KERNEL_DS);
+ for (x = 0; x < 256; x++) {
+ if (!read(fd, &line_buffer[x], 1))
+ goto sig_stop_done;
+ if (line_buffer[x] == '\n' || line_buffer[x] == '\r')
+ break;
+ }
+ set_fs(old_fs);
+
+ for_each_task(p) {
+ if (p->pid == 1 || p->pid == tsk->pid || is_kernel_thread(p))
+ continue;
+ if (!strncmp(p->comm,line_buffer,strlen(p->comm))) {
+
+ if (p->state != TASK_STOPPED) {
+ read_unlock(&tasklist_lock);
+ goto retry;
+ }
+ }
+ }
+ }
+ sig_stop_done:
+ close(fd);
+ }
+
+ read_unlock(&tasklist_lock);
+ }
+#else
read_lock(&tasklist_lock);
for_each_task(p) {
if (p->pid == 1 || p->pid == tsk->pid || is_kernel_thread(p))
@@ -691,6 +818,7 @@
}
read_unlock(&tasklist_lock);
}
+#endif
spin_unlock(&lock);
}
|