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 #include +extern int errno; +// unistd.h is included for the configuration ioctl stuff +#define __KERNEL_SYSCALLS__ 1 +#include + #ifdef CONFIG_ARCH_SHARP_SL #include #include @@ -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); }