]> git.neil.brown.name Git - history.git/commitdiff
Sanitize kernel daemon signal handling and process naming.
authorLinus Torvalds <torvalds@penguin.transmeta.com>
Tue, 11 Feb 2003 06:58:04 +0000 (22:58 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 11 Feb 2003 06:58:04 +0000 (22:58 -0800)
Add a name argument to daemonize() (va_arg) to avoid all the
kernel threads having to duplicate the name setting over and
over again.

Make daemonize() disable all signals by default, and add a
"allow_signal()" function to let daemons say they explicitly
want to support a signal.

Make flush_signal() take the signal lock, so that callers do
not need to.

66 files changed:
arch/arm/kernel/ecard.c
arch/i386/kernel/apm.c
arch/i386/kernel/io_apic.c
arch/i386/mach-voyager/voyager_thread.c
arch/ppc64/kernel/rtasd.c
arch/sparc64/kernel/power.c
drivers/block/loop.c
drivers/char/hvc_console.c
drivers/hotplug/cpci_hotplug_core.c
drivers/hotplug/cpqphp_ctrl.c
drivers/hotplug/ibmphp_hpc.c
drivers/ieee1394/nodemgr.c
drivers/input/serio/serio.c
drivers/isdn/hardware/eicon/i4lididrv.c
drivers/macintosh/adb.c
drivers/md/md.c
drivers/media/dvb/av7110/av7110.c
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/video/msp3400.c
drivers/media/video/saa7134/saa7134-tvaudio.c
drivers/media/video/tvaudio.c
drivers/message/i2o/i2o_block.c
drivers/message/i2o/i2o_core.c
drivers/mtd/devices/blkmtd.c
drivers/mtd/mtdblock.c
drivers/net/8139too.c
drivers/net/irda/sir_kthread.c
drivers/pnp/pnpbios/core.c
drivers/s390/net/lcs.c
drivers/sbus/char/bbc_envctrl.c
drivers/sbus/char/envctrl.c
drivers/scsi/aacraid/commsup.c
drivers/scsi/aic7xxx/aic79xx_osm.c
drivers/scsi/aic7xxx/aic7xxx_osm.c
drivers/scsi/cpqfcTSworker.c
drivers/scsi/scsi_error.c
drivers/usb/core/hub.c
drivers/usb/storage/usb.c
fs/afs/cmservice.c
fs/afs/kafsasyncd.c
fs/afs/kafstimod.c
fs/cifs/connect.c
fs/jbd/journal.c
fs/jffs2/background.c
fs/jfs/jfs_logmgr.c
fs/jfs/jfs_txnmgr.c
fs/lockd/clntlock.c
fs/lockd/svc.c
fs/nfsd/nfssvc.c
fs/smbfs/smbiod.c
fs/xfs/pagebuf/page_buf.c
include/linux/sched.h
kernel/exit.c
kernel/kmod.c
kernel/sched.c
kernel/signal.c
kernel/softirq.c
kernel/workqueue.c
mm/pdflush.c
mm/vmscan.c
net/bluetooth/bnep/core.c
net/bluetooth/rfcomm/core.c
net/rxrpc/krxiod.c
net/rxrpc/krxsecd.c
net/rxrpc/krxtimod.c
net/sunrpc/sched.c

index 2ce63481432bfb60ae2dd7f96e17d05626af26a5..6028ec3cf6704a0909d67f9e52f18f736176207d 100644 (file)
@@ -290,14 +290,7 @@ ecard_task(void * unused)
 {
        struct task_struct *tsk = current;
 
-       /*
-        * We don't want /any/ signals, not even SIGKILL
-        */
-       sigfillset(&tsk->blocked);
-       sigemptyset(&tsk->pending.signal);
-       recalc_sigpending();
-       strcpy(tsk->comm, "kecardd");
-       daemonize();
+       daemonize("kecardd");
 
        /*
         * Allocate a mm.  We're not a lazy-TLB kernel task since we need
index 1f5a243376b7e112186f6b3ce79fc0c983638a3f..86a426bbb9ac30e0f745bc5e39ec705fd11d601e 100644 (file)
@@ -1742,9 +1742,8 @@ static int apm(void *unused)
 
        kapmd_running = 1;
 
-       daemonize();
+       daemonize("kapmd");
 
-       strcpy(current->comm, "kapmd");
        current->flags |= PF_IOTHREAD;
        sigfillset(&current->blocked);
 
index 0e32adb7b0d66b16ed1f75c7c06eef81448a6e0f..319b80d13be3108f33f8d8533443fca1555784f7 100644 (file)
@@ -510,9 +510,8 @@ int balanced_irq(void *unused)
        int i;
        unsigned long prev_balance_time = jiffies;
        long time_remaining = balanced_irq_interval;
-       daemonize();
-       sigfillset(&current->blocked);
-       sprintf(current->comm, "kirqd");
+
+       daemonize("kirqd");
        
        /* push everything to CPU 0 to give us a starting point.  */
        for (i = 0 ; i < NR_IRQS ; i++)
index 70fdedf6cd373fcf4dd6fcb7f7a67424de6e1381..c82afd309f4ba00f5b91b62e334b87ba58bafe7f 100644 (file)
@@ -137,13 +137,12 @@ thread(void *unused)
        kvoyagerd_running = 1;
 
        reparent_to_init();
-       daemonize();
+       daemonize(THREAD_NAME);
 
        set_timeout = 0;
 
        init_timer(&wakeup_timer);
 
-       strcpy(current->comm, THREAD_NAME);
        sigfillset(&current->blocked);
        current->tty = NULL;    /* get rid of controlling tty */
 
index 8edbb142d1c5d41e8de10ca48db3f6ee40023c89..106620bc27d1266d147f28d6b9a231ebae6a9076 100644 (file)
@@ -211,9 +211,7 @@ static int rtasd(void *unused)
 
        DEBUG("will sleep for %d jiffies\n", (HZ*60/rtas_event_scan_rate) / 2);
 
-       daemonize();
-       sigfillset(&current->blocked);
-       sprintf(current->comm, "rtasd");
+       daemonize("rtasd");
 
 #if 0
        /* Rusty unreal time task */
index 042bb08bbb212630605a64a4dd846c62f6ccac09..390e7ef191496af661bfca0edea07744a83d17af 100644 (file)
@@ -65,14 +65,11 @@ static int powerd(void *__unused)
        static char *envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
        char *argv[] = { "/sbin/shutdown", "-h", "now", NULL };
 
-       daemonize();
-       sprintf(current->comm, "powerd");
+       daemonize("powerd");
 
 again:
        while (button_pressed == 0) {
-               spin_lock_irq(&current->sighand->siglock);
                flush_signals(current);
-               spin_unlock_irq(&current->sighand->siglock);
                interruptible_sleep_on(&powerd_wait);
        }
 
index 71ae15a0c6fd32904adad0835cc297937a648f02..85636a00c3c69b45dee1c98cad79b19f492d98c0 100644 (file)
@@ -577,18 +577,12 @@ static int loop_thread(void *data)
        struct loop_device *lo = data;
        struct bio *bio;
 
-       daemonize();
+       daemonize("loop%d", lo->lo_number);
 
-       sprintf(current->comm, "loop%d", lo->lo_number);
        current->flags |= PF_IOTHREAD;  /* loop can be used in an encrypted device
                                           hence, it mustn't be stopped at all because it could
                                           be indirectly used during suspension */
 
-       spin_lock_irq(&current->sighand->siglock);
-       sigfillset(&current->blocked);
-       flush_signals(current);
-       spin_unlock_irq(&current->sighand->siglock);
-
        set_user_nice(current, -20);
 
        lo->lo_state = Lo_bound;
index b3fe12431691ea8834c794100d2dcb7eb13bf5c8..fb2ee72e6db25fe7005c35bc14a90899fd264d4b 100644 (file)
@@ -233,9 +233,7 @@ int khvcd(void *unused)
 {
        int i;
 
-       daemonize();
-       strcpy(current->comm, "khvcd");
-       sigfillset(&current->blocked);
+       daemonize("khvcd");
 
        for (;;) {
                if (!cpus_in_xmon) {
index 0b109d2aa9cce5611528222cd5079d5ffeaa4de5..e8981f780b629112dc704063420e4dab52932195 100644 (file)
@@ -622,8 +622,7 @@ event_thread(void *data)
        struct list_head *tmp;
 
        lock_kernel();
-       daemonize();
-       strcpy(current->comm, "cpci_hp_eventd");
+       daemonize("cpci_hp_eventd");
        unlock_kernel();
 
        dbg("%s - event thread started", __FUNCTION__);
@@ -682,8 +681,7 @@ poll_thread(void *data)
        struct list_head *tmp;
 
        lock_kernel();
-       daemonize();
-       strcpy(current->comm, "cpci_hp_polld");
+       daemonize("cpci_hp_polld");
        unlock_kernel();
 
        while(1) {
index deb2295391659c8dcd7f86ce359b982c7cf7f8df..b9a8432487f448c54b1588d844825562371c1b70 100644 (file)
@@ -1709,10 +1709,7 @@ static int event_thread(void* data)
 {
        struct controller *ctrl;
        lock_kernel();
-       daemonize();
-       
-       //  New name
-       strcpy(current->comm, "phpd_event");
+       daemonize("phpd_event");
        
        unlock_kernel();
 
index ae959809e8a8b4dccd8371cc38ec4350f547c7dc..0bc95c57056b8d88d394f5e2f649ffc162ea8a9d 100644 (file)
@@ -1125,13 +1125,9 @@ static int process_changeinlatch (u8 old, u8 new, struct controller *ctrl)
 static int hpc_poll_thread (void *data)
 {
        debug ("%s - Entry\n", __FUNCTION__);
-       lock_kernel ();
-       daemonize ();
 
-       //  New name
-       strcpy (current->comm, "hpc_poll");
-
-       unlock_kernel ();
+       daemonize("hpc_poll");
+       allow_signal(SIGKILL);
 
        poll_hpc ();
 
index 0f5440f9966bc16b5cbce3be86d88cab6e9a0858..b0ad6ca47ec1acb6a88fdd85a2efd3e1e3fff7eb 100644 (file)
@@ -1216,10 +1216,9 @@ static int nodemgr_host_thread(void *__hi)
        struct host_info *hi = (struct host_info *)__hi;
 
        /* No userlevel access needed */
-       daemonize();
+       daemonize("knodemgrd");
+       allow_signal(SIGTERM);
 
-       strcpy(current->comm, "knodemgrd");
-       
        /* Sit and wait for a signal to probe the nodes on the bus. This
         * happens when we get a bus reset. */
        while (!down_interruptible(&hi->reset_sem) &&
index da245d5c13ab6b51c54eddc158e9e36fa29e3446..bf29f0becf6178a8d428b87d17ec97ee1feb3973 100644 (file)
@@ -105,8 +105,8 @@ void serio_handle_events(void)
 static int serio_thread(void *nothing)
 {
        lock_kernel();
-       daemonize();
-       strcpy(current->comm, "kseriod");
+       daemonize("kseriod");
+       allow_signal(SIGTERM);
 
        do {
                serio_handle_events();
index 38cf7c98460760318de87793b614d1abf40a4e93..b3be96a6d6257d75bac93107f94ac862a8b02309 100644 (file)
@@ -326,10 +326,7 @@ divad_thread(void * data)
     if(!(atomic_read(&thread_running)))
       break;
     if(signal_pending(current)) {
-         /* we may want to do something on signals here */
-         spin_lock_irq(&current->sigmask_lock);
          flush_signals(current);
-         spin_unlock_irq(&current->sigmask_lock);
     } else {
          run_task_queue(&tq_divad);
     }
index 6e994acf13b6f6fbb57271a0a9fa2e07bbe25e53..a5a983fdbeded56d74f6ce7262993ec7036f9567 100644 (file)
@@ -244,12 +244,13 @@ static int adb_scan_bus(void)
 static int
 adb_probe_task(void *x)
 {
+       sigset_t blocked;
+
        strcpy(current->comm, "kadbprobe");
-       
-       spin_lock_irq(&current->sighand->siglock);
-       sigfillset(&current->blocked);
+
+       sigfillset(&blocked);
+       sicprocmask(SIG_BLOCK, &blocked, NULL); 
        flush_signals(current);
-       spin_unlock_irq(&current->sighand->siglock);
 
        printk(KERN_INFO "adb: starting probe task...\n");
        do_adb_reset_bus();
index 9f1d5d0878e56534f9b6e5fdc8cbbd6e7c68ba63..3f4f379b0bc3451ea468eb22f1c0b315a2024796 100644 (file)
@@ -2444,9 +2444,7 @@ static struct block_device_operations md_fops =
 
 static inline void flush_curr_signals(void)
 {
-       spin_lock(&current->sighand->siglock);
        flush_signals(current);
-       spin_unlock(&current->sighand->siglock);
 }
 
 int md_thread(void * arg)
@@ -2459,12 +2457,10 @@ int md_thread(void * arg)
         * Detach thread
         */
 
-       daemonize();
+       daemonize(thread->name);
 
-       sprintf(current->comm, thread->name);
        current->exit_signal = SIGCHLD;
-       siginitsetinv(&current->blocked, sigmask(SIGKILL));
-       flush_curr_signals();
+       allow_signal(SIGKILL);
        thread->tsk = current;
 
        /*
index f0178c18e0e5080fd7ca9128cbec5293943b4441..9a1dc9f5ea7dfee1ff1237129597772dec486ccf 100644 (file)
@@ -349,13 +349,13 @@ static int arm_thread(void *data)
     
        lock_kernel();
 #if 0
-       daemonize();
+       daemonize("arm_mon");
 #else
         exit_mm(current);
         current->session=current->pgrp=1;
-#endif
        sigfillset(&current->blocked);
        strcpy(current->comm, "arm_mon");
+#endif
        av7110->arm_thread = current;
        unlock_kernel();
 
index 344621653fea3d64087e1f527ee6ab647faaced2..2c18162a66658468524f78deabf54470799409b7 100644 (file)
@@ -482,9 +482,7 @@ int dvb_frontend_thread (void *data)
        dprintk ("%s\n", __FUNCTION__);
 
        lock_kernel ();
-       daemonize ();
-       sigfillset (&current->blocked);
-       strncpy (current->comm, "kdvb-fe", sizeof (current->comm));
+       daemonize("kdvb-fe");
        fe->thread = current;
        unlock_kernel ();
 
index bdae961c265b02f7f5550befb9062c0d471e2602..d91d04f97f4f011a69896c0d1dfe9c07c1987295 100644 (file)
@@ -755,9 +755,7 @@ static int msp3400c_thread(void *data)
        lock_kernel();
 #endif
        
-       daemonize();
-       sigfillset(&current->blocked);
-       strcpy(current->comm,"msp3400");
+       daemonize("msp3400");
 
        msp->thread = current;
 
@@ -1011,9 +1009,7 @@ static int msp3410d_thread(void *data)
        lock_kernel();
 #endif
     
-       daemonize();
-       sigfillset(&current->blocked);
-       strcpy(current->comm,"msp3410 [auto]");
+       daemonize("msp3410 [auto]");
 
        msp->thread = current;
 
index 89e53cc5ace57a73ca3cc2a99316c1626914f6b3..11949b018afcb424f0bdbc35913beb7d67ed595d 100644 (file)
@@ -393,9 +393,7 @@ static int tvaudio_thread(void *data)
        int i,max,carrier,audio;
 
        lock_kernel();
-       daemonize();
-       sigfillset(&current->blocked);
-       sprintf(current->comm, "%s", dev->name);
+       daemonize("%s", dev->name);
        dev->thread.task = current;
        unlock_kernel();
        if (dev->thread.notify != NULL)
index b46752742a608388b085d2ac39d5b8bad507231b..b077e42ef792787cd8d6f924a93dcc20c733c2cd 100644 (file)
@@ -272,9 +272,7 @@ static int chip_thread(void *data)
 #ifdef CONFIG_SMP
        lock_kernel();
 #endif
-       daemonize();
-       sigfillset(&current->blocked);
-       strcpy(current->comm,chip->c.name);
+       daemonize("%s", chip->c.name);
        chip->thread = current;
 #ifdef CONFIG_SMP
        unlock_kernel();
index 05406290dde80113dbea149b9e11a5bb5251c5a6..61fe2369e8f40dc375c882e39eafc257ec162a69 100644 (file)
@@ -629,11 +629,9 @@ static int i2ob_evt(void *dummy)
                u8 data[16];
                } *evt_local;
 
-       lock_kernel();
-       daemonize();
-       unlock_kernel();
+       daemonize("i2oblock");
+       allow_signal(SIGKILL);
 
-       strcpy(current->comm, "i2oblock");
        evt_running = 1;
 
        while(1)
index d4f15436a380e38da3f1f99c4806eba7c012536b..93ce837e421c1b70f7d323620759c0d2a224ab56 100644 (file)
@@ -879,11 +879,9 @@ static int i2o_core_evt(void *reply_data)
        struct i2o_controller *c = NULL;
        unsigned long flags;
 
-       lock_kernel();
-       daemonize();
-       unlock_kernel();
+       daemonize("i2oevtd");
+       allow_signal(SIGKILL);
 
-       strcpy(current->comm, "i2oevtd");
        evt_running = 1;
 
        while(1)
@@ -1047,15 +1045,10 @@ static int i2o_dyn_lct(void *foo)
        int found = 0;
        int entries;
        void *tmp;
-       char name[16];
 
-       lock_kernel();
-       daemonize();
-       unlock_kernel();
+       daemonize("iop%d_lctd", c->unit);
+       allow_signal(SIGKILL);
 
-       sprintf(name, "iop%d_lctd", c->unit);
-       strcpy(current->comm, name);    
-       
        c->lct_running = 1;
 
        while(1)
index 7d738397f667d5ca1921292f54b6a4237612961a..9b2438f01e5e3becb53f3ffe51153bdd047d3356 100644 (file)
@@ -303,12 +303,7 @@ static int write_queue_task(void *data)
 
   DECLARE_WAITQUEUE(wait, tsk);
   DEBUG(1, "blkmtd: writetask: starting (pid = %d)\n", tsk->pid);
-  daemonize();
-  strcpy(tsk->comm, "blkmtdd");
-  spin_lock_irq(&tsk->sighand->siglock);
-  sigfillset(&tsk->blocked);
-  recalc_sigpending();
-  spin_unlock_irq(&tsk->sighand->siglock);
+  daemonize("blkmtdd");
 
   if(alloc_kiovec(1, &iobuf)) {
     printk("blkmtd: write_queue_task cant allocate kiobuf\n");
index 0aec2e6709e73b741167a706f371e4f412a769f1..af065e4af4cff931cb4e043b623157ed3fac5492 100644 (file)
@@ -452,12 +452,7 @@ int mtdblock_thread(void *dummy)
 
        /* we might get involved when memory gets low, so use PF_MEMALLOC */
        tsk->flags |= PF_MEMALLOC;
-       strcpy(tsk->comm, "mtdblockd");
-       spin_lock_irq(&tsk->sighand->siglock);
-       sigfillset(&tsk->blocked);
-       recalc_sigpending();
-       spin_unlock_irq(&tsk->sighand->siglock);
-       daemonize();
+       daemonize("mtdblockd");
 
        while (!leaving) {
                add_wait_queue(&thr_wq, &wait);
index e1e8d997983e332e1756a655aad20ad3d1ae2507..084ff5219678e7e807b840fc79f53c379147b021 100644 (file)
@@ -1588,14 +1588,8 @@ static int rtl8139_thread (void *data)
        struct rtl8139_private *tp = dev->priv;
        unsigned long timeout;
 
-       daemonize();
-       spin_lock_irq(&current->sighand->siglock);
-       sigemptyset(&current->blocked);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
-       strncpy (current->comm, dev->name, sizeof(current->comm) - 1);
-       current->comm[sizeof(current->comm) - 1] = '\0';
+       daemonize("%s", dev->name);
+       allow_signal(SIGKILL);
 
        while (1) {
                timeout = next_tick;
@@ -1604,9 +1598,7 @@ static int rtl8139_thread (void *data)
                } while (!signal_pending (current) && (timeout > 0));
 
                if (signal_pending (current)) {
-                       spin_lock_irq(&current->sighand->siglock);
                        flush_signals(current);
-                       spin_unlock_irq(&current->sighand->siglock);
                }
 
                if (tp->time_to_die)
index 3f2a538981d904549d87eaec9251671cd1ebdff0..cf292968b241d754d1fa645bd16cdf7244afead9 100644 (file)
@@ -113,13 +113,7 @@ static int irda_thread(void *startup)
 {
        DECLARE_WAITQUEUE(wait, current);
 
-       daemonize();
-       strcpy(current->comm, "kIrDAd");
-
-       spin_lock_irq(&current->sighand->siglock);
-       sigfillset(&current->blocked);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       daemonize("kIrDAd");
 
        set_fs(KERNEL_DS);
 
index d9e2092dbbb9aef9730e3b19465380f9aedf8b45..82944c33a021a14e93960c6ce5ce6cbd78a35ed9 100644 (file)
@@ -615,8 +615,8 @@ static int pnp_dock_thread(void * unused)
 {
        static struct pnp_docking_station_info now;
        int docked = -1, d = 0;
-       daemonize();
-       strcpy(current->comm, "kpnpbiosd");
+       daemonize("kpnpbiosd");
+       allow_signal(SIGKILL);
        while(!unloading && !signal_pending(current))
        {
                int status;
index 97e4bb6a40ff08087562d58b022b705c0f690b28..3386baf5f604282cdc548eb4d29ded9bb2042b2c 100644 (file)
@@ -908,7 +908,7 @@ lcs_fix_multicast_list(void *data)
 
        card = (struct lcs_card *) data;
 
-       daemonize();
+       daemonize("fixipm");
        LCS_DBF_TEXT(5, trace, "fixipm");
        spin_lock(&card->lock);
        list_for_each_safe(l, n, &card->ipm_list) {
@@ -1370,7 +1370,7 @@ lcs_lgw_startlan_thread(void *data)
        struct lcs_card *card;
 
        card = (struct lcs_card *) data;
-       daemonize();
+       daemonize("lgwstpln");
        LCS_DBF_TEXT(4, trace, "lgwstpln");
        if (card->dev)
                netif_stop_queue(card->dev);
@@ -1397,7 +1397,7 @@ lcs_lgw_startup_thread(void *data)
        struct lcs_card *card;
 
        card = (struct lcs_card *) data;
-       daemonize();
+       daemonize("lgwstpln");
        LCS_DBF_TEXT(4, trace, "lgwstpln");
        if (card->dev)
                netif_stop_queue(card->dev);
@@ -1436,7 +1436,7 @@ lcs_lgw_stoplan_thread(void *data)
        struct lcs_card *card;
 
        card = (struct lcs_card *) data;
-       daemonize();
+       daemonize("lgwstop");
        LCS_DBF_TEXT(4, trace, "lgwstop");
        if (card->dev)
                netif_stop_queue(card->dev);
index a5ac67cc498f54ad66c5fcc25838f399a723ba62..d0a545010b1e4376cbe99edf9ae0492089d2165d 100644 (file)
@@ -457,8 +457,8 @@ static struct task_struct *kenvctrld_task;
 
 static int kenvctrld(void *__unused)
 {
-       daemonize();
-       strcpy(current->comm, "kenvctrld");
+       daemonize("kenvctrld");
+       allow_signal(SIGKILL);
        kenvctrld_task = current;
 
        printk(KERN_INFO "bbc_envctrl: kenvctrld starting...\n");
index f953eaf73d321e5ff62af9ef20007c47773811a0..bf97d2efafa5a629e41d498b6b53f4b57e7b894d 100644 (file)
@@ -1016,8 +1016,9 @@ static int kenvctrld(void *__unused)
 
        poll_interval = 5 * HZ; /* TODO env_mon_interval */
 
-       daemonize();
-       strcpy(current->comm, "kenvctrld");
+       daemonize("kenvctrld");
+       allow_signal(SIGKILL);
+
        kenvctrld_task = current;
 
        printk(KERN_INFO "envctrl: %s starting...\n", current->comm);
index 55c36b8bed90a874a07e7ac6f4b42c9882e2dc0b..d5e9408cebd7bde68bbd011e27b42208c5146f2a 100644 (file)
@@ -816,8 +816,8 @@ int aac_command_thread(struct aac_dev * dev)
         *      Set up the name that will appear in 'ps'
         *      stored in  task_struct.comm[16].
         */
-       sprintf(current->comm, "aacraid");
-       daemonize();
+       daemonize("aacraid");
+       allow_signal(SIGKILL);
        /*
         *      Let the DPC know it has a place to send the AIF's to.
         */
index a397ed69b47ab6efe6e101affdb2d05c14743974..7b03b6e1f15a1201f2bbf4411453ccd178fd7e75 100644 (file)
@@ -2854,8 +2854,7 @@ ahd_linux_dv_thread(void *data)
         * Complete thread creation.
         */
        lock_kernel();
-       daemonize();
-       sprintf(current->comm, "ahd_dv_%d", ahd->unit);
+       daemonize("ahd_dv_%d", ahd->unit);
        unlock_kernel();
 
        while (1) {
index a12ad53ec28905b54a041e90ef9769ccf0b0504b..bff5a2eabb1b43b09e38ccda4ec3791e65c38995 100644 (file)
@@ -2354,17 +2354,11 @@ ahc_linux_dv_thread(void *data)
                printf("Launching DV Thread\n");
 #endif
 
-       /*
-        * Don't care about any signals.
-        */
-       siginitsetinv(&current->blocked, 0);
-
        /*
         * Complete thread creation.
         */
        lock_kernel();
-       daemonize();
-       sprintf(current->comm, "ahc_dv_%d", ahc->unit);
+       daemonize("ahc_dv_%d", ahc->unit);
        unlock_kernel();
 
        while (1) {
index 7bec5d1091f78230a7ebe405c55f0fd113b93de9..a45c448dc40b28d8704a7cbce69c194bb65c67ac 100644 (file)
@@ -165,15 +165,10 @@ void cpqfcTSWorkerThread( void *host)
   ENTER("WorkerThread");
 
   lock_kernel();
-  daemonize();
+  daemonize("cpqfcTS_wt_%d", HostAdapter->host_no);
   siginitsetinv(&current->blocked, SHUTDOWN_SIGS);
 
 
-  /*
-   * Set the name of this process.
-   */
-  sprintf(current->comm, "cpqfcTS_wt_%d", HostAdapter->host_no);
-
   cpqfcHBAdata->fcQueReady = &fcQueReady;  // primary wait point
   cpqfcHBAdata->TYOBcomplete = &fcTYOBcomplete;
   cpqfcHBAdata->TachFrozen = &TachFrozen;
index c0bb52aaa3bd79ad3427e17464e2de80805b2f31..7f8d47677aff071a29cabbc1ed6749527aef0935 100644 (file)
@@ -1579,24 +1579,14 @@ void scsi_error_handler(void *data)
        int rtn;
        DECLARE_MUTEX_LOCKED(sem);
 
-       spin_lock_irq(&current->sighand->siglock);
-       sigfillset(&current->blocked);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
        lock_kernel();
 
        /*
         *    Flush resources
         */
 
-       daemonize();
-
-       /*
-        * Set the name of this process.
-        */
+       daemonize("scsi_eh_%d", shost->host_no);
 
-       sprintf(current->comm, "scsi_eh_%d", shost->host_no);
        current->flags |= PF_IOTHREAD;
 
        shost->eh_wait = &sem;
index f23744d8749b06b11c574e389e9713c3c46225b0..ba2713a23e24e5e0d6130a41117519245ef00588 100644 (file)
@@ -1083,10 +1083,8 @@ static int usb_hub_thread(void *__hub)
         * so get rid of all our resources
         */
 
-       daemonize();
-
-       /* Setup a nice name */
-       strcpy(current->comm, "khubd");
+       daemonize("khubd");
+       allow_signal(SIGKILL);
 
        /* Send me a signal to get me die (for debugging) */
        do {
index e4a98569d058d8b6d0cc48160cf25527be83d128..4c2b6de50c913665524749e9012a3efe42782317 100644 (file)
@@ -298,18 +298,9 @@ static int usb_stor_control_thread(void * __us)
         * This thread doesn't need any user-level access,
         * so get rid of all our resources..
         */
-       daemonize();
+       daemonize("usb-storage");
 
-       /* avoid getting signals */
-       spin_lock_irq(&current->sighand->siglock);
-       flush_signals(current);
        current->flags |= PF_IOTHREAD;
-       sigfillset(&current->blocked);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
-       /* set our name for identification purposes */
-       sprintf(current->comm, "usb-storage");
 
        unlock_kernel();
 
index 99960d0020260f1b34fdfb4059ef6490b91807ea..e5e83974180378f0ed3ac56d4b92c88445baed86 100644 (file)
@@ -120,18 +120,10 @@ static int kafscmd(void *arg)
        int die;
 
        printk("kAFS: Started kafscmd %d\n",current->pid);
-       strcpy(current->comm,"kafscmd");
-
-       daemonize();
+       daemonize("kafscmd");
 
        complete(&kafscmd_alive);
 
-       /* only certain signals are of interest */
-       spin_lock_irq(&current->sighand->siglock);
-       siginitsetinv(&current->blocked,0);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
        /* loop around looking for things to attend to */
        do {
                if (list_empty(&kafscmd_attention_list)) {
index e546a6da501531a806eeaa79d8136fcb6824865c..9ac95adeff33ba5a600e7e3fa1e5bd483a0c9ae3 100644 (file)
@@ -94,18 +94,11 @@ static int kafsasyncd(void *arg)
        kafsasyncd_task = current;
 
        printk("kAFS: Started kafsasyncd %d\n",current->pid);
-       strcpy(current->comm,"kafsasyncd");
 
-       daemonize();
+       daemonize("kafsasyncd");
 
        complete(&kafsasyncd_alive);
 
-       /* only certain signals are of interest */
-       spin_lock_irq(&current->sighand->siglock);
-       siginitsetinv(&current->blocked,0);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
        /* loop around looking for things to attend to */
        do {
                set_current_state(TASK_INTERRUPTIBLE);
index 2b0f5a9d84e9e5fe697a2b5918c543248a9cbf4a..d2f66184eb08c8a579b971c9fbabbf7d9897ddb8 100644 (file)
@@ -71,18 +71,11 @@ static int kafstimod(void *arg)
        afs_timer_t *timer;
 
        printk("kAFS: Started kafstimod %d\n",current->pid);
-       strcpy(current->comm,"kafstimod");
 
-       daemonize();
+       daemonize("kafstimod");
 
        complete(&kafstimod_alive);
 
-       /* only certain signals are of interest */
-       spin_lock_irq(&current->sighand->siglock);
-       siginitsetinv(&current->blocked,0);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
        /* loop around looking for things to attend to */
  loop:
        set_current_state(TASK_INTERRUPTIBLE);
index afb2c3844b0589731200c886e8495e8ad5c98a63..64327cc0e0544855ead6c47539078ee211e97a47 100644 (file)
@@ -95,7 +95,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
        struct mid_q_entry *mid_entry;
        char *temp;
 
-       daemonize();
+       daemonize("cifsd");
+       allow_signal(SIGKILL);
 
        server->tsk = current;  /* save process info to wake at shutdown */
        cFYI(1, ("\nDemultiplex PID: %d", current->pid));
index 3a8be07f8c7e2cc525d47cd86fb360ca32a17230..eb23953d725186844f35bbe37383f143a3156a81 100644 (file)
@@ -202,14 +202,9 @@ int kjournald(void *arg)
 
        current_journal = journal;
 
-       lock_kernel();
-       daemonize();
-       spin_lock_irq(&current->sighand->siglock);
-       sigfillset(&current->blocked);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       daemonize("kjournald");
 
-       sprintf(current->comm, "kjournald");
+       lock_kernel();
 
        /* Set up an interval timer which can be used to trigger a
            commit wakeup after the commit interval expires */
index 9d3df991fca0118be317573198119d09343865fd..c63568931e15874206e7872a5d8dc2840f6f8be8 100644 (file)
@@ -82,13 +82,11 @@ static int jffs2_garbage_collect_thread(void *_c)
 {
        struct jffs2_sb_info *c = _c;
 
-       daemonize();
+       daemonize("jffs2_gcd_mtd%d", c->mtd->index);
 
        c->gc_task = current;
        up(&c->gc_thread_start);
 
-       sprintf(current->comm, "jffs2_gcd_mtd%d", c->mtd->index);
-
        set_user_nice(current, 10);
 
        for (;;) {
index 360139794557c6c91fd89d9c7f81b92490f32746..b76e1f3ff16db8f41f870277e6b6f1a7fdac792a 100644 (file)
@@ -2132,17 +2132,7 @@ int jfsIOWait(void *arg)
 {
        struct lbuf *bp;
 
-       lock_kernel();
-
-       daemonize();
-       strcpy(current->comm, "jfsIO");
-
-       unlock_kernel();
-
-       spin_lock_irq(&current->sighand->siglock);
-       sigfillset(&current->blocked);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       daemonize("jfsIO");
 
        complete(&jfsIOwait);
 
index 6af148d0387ca39f64d98f8ae37461963ac2f926..f86efd5f14c7e853d2792bc2bdb95304cf2f3ff5 100644 (file)
@@ -2771,20 +2771,10 @@ int jfs_lazycommit(void *arg)
        struct tblock *tblk;
        unsigned long flags;
 
-       lock_kernel();
-
-       daemonize();
-       strcpy(current->comm, "jfsCommit");
-
-       unlock_kernel();
+       daemonize("jfsCommit");
 
        jfsCommitTask = current;
 
-       spin_lock_irq(&current->sighand->siglock);
-       sigfillset(&current->blocked);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
        LAZY_LOCK_INIT();
        TxAnchor.unlock_queue = TxAnchor.unlock_tail = 0;
 
@@ -2978,17 +2968,7 @@ int jfs_sync(void *arg)
        int rc;
        tid_t tid;
 
-       lock_kernel();
-
-       daemonize();
-       strcpy(current->comm, "jfsSync");
-
-       unlock_kernel();
-
-       spin_lock_irq(&current->sighand->siglock);
-       sigfillset(&current->blocked);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       daemonize("jfsSync");
 
        complete(&jfsIOwait);
 
index c5110c48422ba113d7dec720cb31af4d4133a03d..6f3f77110eadf8f23b05253ff0d1d8880180dee0 100644 (file)
@@ -201,10 +201,8 @@ reclaimer(void *ptr)
        struct file_lock *fl;
        struct inode *inode;
 
-       daemonize();
-       snprintf(current->comm, sizeof(current->comm),
-                "%s-reclaim",
-                host->h_name);
+       daemonize("%s-reclaim", host->h_name);
+       allow_signal(SIGKILL);
 
        /* This one ensures that our parent doesn't terminate while the
         * reclaim is in progress */
index a0cafbdfbb0a670e557d48dfcaafe5bee087d8c5..052e5518a7e33c5f65008a56204df0ab5552d0c3 100644 (file)
@@ -97,14 +97,10 @@ lockd(struct svc_rqst *rqstp)
        nlmsvc_pid = current->pid;
        up(&lockd_start);
 
-       daemonize();
-       sprintf(current->comm, "lockd");
+       daemonize("lockd");
 
-       /* Process request with signals blocked.  */
-       spin_lock_irq(&current->sighand->siglock);
-       siginitsetinv(&current->blocked, sigmask(SIGKILL));
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       /* Process request with signals blocked, but allow SIGKILL.  */
+       allow_signal(SIGKILL);
 
        /* kick rpciod */
        rpciod_up();
@@ -126,9 +122,7 @@ lockd(struct svc_rqst *rqstp)
        {
                long timeout = MAX_SCHEDULE_TIMEOUT;
                if (signalled()) {
-                       spin_lock_irq(&current->sighand->siglock);
                        flush_signals(current);
-                       spin_unlock_irq(&current->sighand->siglock);
                        if (nlmsvc_ops) {
                                nlmsvc_invalidate_all();
                                grace_period_expire = set_grace_period();
index 369c2ce897f4320b43cbb13c9be79ddd35226664..3678715c34f1a137c3b51c707e0a619a914166b6 100644 (file)
@@ -173,8 +173,7 @@ nfsd(struct svc_rqst *rqstp)
        /* Lock module and set up kernel thread */
        MOD_INC_USE_COUNT;
        lock_kernel();
-       daemonize();
-       sprintf(current->comm, "nfsd");
+       daemonize("nfsd");
        current->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
 
        siginitsetinv(&shutdown_mask, SHUTDOWN_SIGS);
index 41d5bbd8a3347b7ccf6e3c199f45843c5269fadc..f09ce74b8763404439887e2d630d88ae7063d5ef 100644 (file)
@@ -283,14 +283,9 @@ out:
 static int smbiod(void *unused)
 {
        MOD_INC_USE_COUNT;
-       daemonize();
+       daemonize("smbiod");
 
-       spin_lock_irq(&current->sighand->siglock);
-       siginitsetinv(&current->blocked, sigmask(SIGKILL));
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
-       strcpy(current->comm, "smbiod");
+       allow_signal(SIGKILL);
 
        VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid);
 
index d6b027eb202211817613f05260f825c4452f5058..5663f6d4b430df12fe9b53e5c2c575c4086160ef 100644 (file)
@@ -1578,15 +1578,8 @@ pagebuf_daemon(
                TIMER_INITIALIZER((timeout_fn)pagebuf_daemon_wakeup, 0, 0);
 
        /*  Set up the thread  */
-       daemonize();
+       daemonize("pagebufd");
 
-       /* Avoid signals */
-       spin_lock_irq(&current->sighand->siglock);
-       sigfillset(&current->blocked);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
-       strcpy(current->comm, "pagebufd");
        current->flags |= PF_MEMALLOC;
 
        INIT_LIST_HEAD(&tmp);
index b99d2eb57a825336721635164c931a91dba6a5c6..5432eb4765fcbf2441b4485a0b5cd62f5c307ea1 100644 (file)
@@ -616,7 +616,8 @@ extern void __exit_sighand(struct task_struct *);
 extern NORET_TYPE void do_group_exit(int);
 
 extern void reparent_to_init(void);
-extern void daemonize(void);
+extern void daemonize(const char *, ...);
+extern int allow_signal(int);
 extern task_t *child_reaper;
 
 extern int do_execve(char *, char **, char **, struct pt_regs *);
index de34ed9091f57997f5326ae9e01c4e07f83a6721..acab23a650cce0357b571eb1f62108bd9465683b 100644 (file)
@@ -277,15 +277,37 @@ void set_special_pids(pid_t session, pid_t pgrp)
        write_unlock_irq(&tasklist_lock);
 }
 
+/*
+ * Let kernel threads use this to say that they
+ * allow a certain signal (since daemonize() will
+ * have disabled all of them by default).
+ */
+int allow_signal(int sig)
+{
+       if (sig < 1 || sig > _NSIG)
+               return -EINVAL;
+
+       spin_lock_irq(&current->sighand->siglock);
+       sigdelset(&current->blocked, sig);
+       recalc_sigpending();
+       spin_unlock_irq(&current->sighand->siglock);
+       return 0;
+}
+       
+
 /*
  *     Put all the gunge required to become a kernel thread without
  *     attached user resources in one place where it belongs.
  */
 
-void daemonize(void)
+void daemonize(const char *name, ...)
 {
+       va_list args;
        struct fs_struct *fs;
+       sigset_t blocked;
 
+       va_start(args, name);
+       vsnprintf(current->comm, sizeof(current->comm), name, args);
 
        /*
         * If we were started as result of loading a module, close all of the
@@ -297,6 +319,11 @@ void daemonize(void)
        set_special_pids(1, 1);
        current->tty = NULL;
 
+       /* Block and flush all signals */
+       sigfillset(&blocked);
+       sigprocmask(SIG_BLOCK, &blocked, NULL);
+       flush_signals(current);
+
        /* Become as one with the init task */
 
        exit_fs(current);       /* current->fs->count--; */
index 257634f9465256bb85938d03cebe53a837013c67..15dacc2e6bd8f8f0530bef526e3a7ab2c67f1892 100644 (file)
@@ -110,10 +110,10 @@ int exec_usermodehelper(char *program_path, char *argv[], char *envp[])
           as the super user right after the execve fails if you time
           the signal just right.
        */
-       spin_lock_irq(&curtask->sighand->siglock);
-       sigemptyset(&curtask->blocked);
        flush_signals(curtask);
        flush_signal_handlers(curtask);
+       spin_lock_irq(&curtask->sighand->siglock);
+       sigemptyset(&curtask->blocked);
        recalc_sigpending();
        spin_unlock_irq(&curtask->sighand->siglock);
 
index a501326ed2dc16622dc638f59acf129b8f57ce97..1981a92ab129eab42dc7259b134dd8eecb30494b 100644 (file)
@@ -2246,8 +2246,7 @@ static int migration_thread(void * data)
        runqueue_t *rq;
        int ret;
 
-       daemonize();
-       sigfillset(&current->blocked);
+       daemonize("migration/%d", cpu);
        set_fs(KERNEL_DS);
 
        /*
@@ -2261,8 +2260,6 @@ static int migration_thread(void * data)
        rq = this_rq();
        rq->migration_thread = current;
 
-       sprintf(current->comm, "migration/%d", smp_processor_id());
-
        for (;;) {
                runqueue_t *rq_src, *rq_dest;
                struct list_head *head;
index b43102e63a8d54858c9e31a75fe75ade35bd8847..abd41adee495237fd194c336460cb53800b4eac2 100644 (file)
@@ -256,8 +256,13 @@ static void flush_sigqueue(struct sigpending *queue)
 void
 flush_signals(struct task_struct *t)
 {
+       unsigned long flags;
+
+       spin_lock_irqsave(&t->sighand->siglock, flags);
        clear_tsk_thread_flag(t,TIF_SIGPENDING);
        flush_sigqueue(&t->pending);
+       flush_sigqueue(&t->signal->shared_pending);
+       spin_unlock_irqrestore(&t->sighand->siglock, flags);
 }
 
 /*
@@ -1580,7 +1585,6 @@ long do_no_restart_syscall(struct restart_block *param)
        return -EINTR;
 }
 
-
 /*
  * We don't need to get the kernel lock - this is all local to this
  * particular thread.. (and that's good, because this is _heavily_
index 59fb7acb0ee18e723257ced1efe6a3e7e9056c67..57048481e7f3d7fbc6f340235e3250ea8f6e0cb4 100644 (file)
@@ -300,18 +300,15 @@ static int ksoftirqd(void * __bind_cpu)
 {
        int cpu = (int) (long) __bind_cpu;
 
-       daemonize();
+       daemonize("ksoftirqd/%d", cpu);
        set_user_nice(current, 19);
        current->flags |= PF_IOTHREAD;
-       sigfillset(&current->blocked);
 
        /* Migrate to the right CPU */
        set_cpus_allowed(current, 1UL << cpu);
        if (smp_processor_id() != cpu)
                BUG();
 
-       sprintf(current->comm, "ksoftirqd/%d", cpu);
-
        __set_current_state(TASK_INTERRUPTIBLE);
        mb();
 
index 8fd97c6764a4e388a9191262813de1a6ffbe556d..5e9a520cfd770c23a5e098b6aec991a150145706 100644 (file)
@@ -172,19 +172,14 @@ static int worker_thread(void *__startup)
        DECLARE_WAITQUEUE(wait, current);
        struct k_sigaction sa;
 
-       daemonize();
-       sprintf(current->comm, "%s/%d", startup->name, cpu);
+       daemonize("%s/%d", startup->name, cpu);
+       allow_signal(SIGCHLD);
        current->flags |= PF_IOTHREAD;
        cwq->thread = current;
 
        set_user_nice(current, -10);
        set_cpus_allowed(current, 1UL << cpu);
 
-       spin_lock_irq(&current->sighand->siglock);
-       siginitsetinv(&current->blocked, sigmask(SIGCHLD));
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
        complete(&startup->done);
 
        /* Install a handler so SIGCLD is delivered */
@@ -213,10 +208,7 @@ static int worker_thread(void *__startup)
                                /* SIGCHLD - auto-reaping */ ;
 
                        /* zap all other signals */
-                       spin_lock_irq(&current->sighand->siglock);
                        flush_signals(current);
-                       recalc_sigpending();
-                       spin_unlock_irq(&current->sighand->siglock);
                }
        }
        remove_wait_queue(&cwq->more_work, &wait);
index c38ad46c58c74a719bcb988085dd0e4902a6e457..b1375644c5196f46cd1ed38d40c16f911e73600c 100644 (file)
@@ -86,14 +86,7 @@ struct pdflush_work {
 
 static int __pdflush(struct pdflush_work *my_work)
 {
-       daemonize();
-       strcpy(current->comm, "pdflush");
-
-       /* interruptible sleep, so block all signals */
-       spin_lock_irq(&current->sighand->siglock);
-       siginitsetinv(&current->blocked, 0);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       daemonize("pdflush");
 
        current->flags |= PF_FLUSHER;
        my_work->fn = NULL;
index 4b40c5483268987cc9d427aee4ff5bcb5b4a0b73..995ea273b5dfdbd5de7a8848ec889514a7a61064 100644 (file)
@@ -928,10 +928,8 @@ int kswapd(void *p)
        struct task_struct *tsk = current;
        DEFINE_WAIT(wait);
 
-       daemonize();
+       daemonize("kswapd%d", pgdat->node_id);
        set_cpus_allowed(tsk, node_to_cpumask(pgdat->node_id));
-       sprintf(tsk->comm, "kswapd%d", pgdat->node_id);
-       sigfillset(&tsk->blocked);
        
        /*
         * Tell the memory management that we're a "memory allocator",
index e15d2603b59fb87cde16bebb6f0810e1655340f1..e72ccd2a69bd62e4311292a795660feab76473b5 100644 (file)
@@ -478,13 +478,9 @@ static int bnep_session(void *arg)
 
        BT_DBG("");
 
-        daemonize();
+        daemonize("kbnepd %s", dev->name);
        set_user_nice(current, -15);
        current->flags |= PF_IOTHREAD;
-        sigfillset(&current->blocked);
-       flush_signals(current);
-
-        sprintf(current->comm, "kbnepd %s", dev->name);
 
         set_fs(KERNEL_DS);
 
index ca4d8295078cd887d960e2b4b3f168125f8d49ba..9798603a4e617671362c4ae700e549c1e1dcb2c2 100644 (file)
@@ -1705,13 +1705,9 @@ static int rfcomm_run(void *unused)
 
        atomic_inc(&running);
 
-       daemonize();
+       daemonize("krfcommd");
        set_user_nice(current, -10);
        current->flags |= PF_IOTHREAD;
-       sigfillset(&current->blocked);
-       flush_signals(current);
-
-       sprintf(current->comm, "krfcommd");
 
        set_fs(KERNEL_DS);
 
index ae9987d6155fa6031cf6a2c629374933030fc5a8..3eba905e00e48e1a0967b0ecb5b6c80c732339e7 100644 (file)
@@ -42,15 +42,8 @@ static int rxrpc_krxiod(void *arg)
        DECLARE_WAITQUEUE(krxiod,current);
 
        printk("Started krxiod %d\n",current->pid);
-       strcpy(current->comm,"krxiod");
 
-       daemonize();
-
-       /* only certain signals are of interest */
-       spin_lock_irq(&current->sighand->siglock);
-       siginitsetinv(&current->blocked,0);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       daemonize("krxiod");
 
        /* loop around waiting for work to do */
        do {
index 39f4eac9f224b6577a4414f8f8a490e57e812f61..e5498ab73c8eef30f1060f1ec6749918b3d52df3 100644 (file)
@@ -54,15 +54,8 @@ static int rxrpc_krxsecd(void *arg)
        int die;
 
        printk("Started krxsecd %d\n",current->pid);
-       strcpy(current->comm,"krxsecd");
 
-       daemonize();
-
-       /* only certain signals are of interest */
-       spin_lock_irq(&current->sighand->siglock);
-       siginitsetinv(&current->blocked,0);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       daemonize("krxsecd");
 
        /* loop around waiting for work to do */
        do {
index c6df1edf38fffd120615baeea6779fbaae465cf5..415366ed7983ab6013ea3a82cccf62e37eca90ca 100644 (file)
@@ -70,18 +70,11 @@ static int krxtimod(void *arg)
        rxrpc_timer_t *timer;
 
        printk("Started krxtimod %d\n",current->pid);
-       strcpy(current->comm,"krxtimod");
 
-       daemonize();
+       daemonize("krxtimod");
 
        complete(&krxtimod_alive);
 
-       /* only certain signals are of interest */
-       spin_lock_irq(&current->sighand->siglock);
-       siginitsetinv(&current->blocked,0);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
        /* loop around looking for things to attend to */
  loop:
        set_current_state(TASK_INTERRUPTIBLE);
index c8e5364ed1ea3aea5dbbb124f1cd39beee86621f..b36d08d5e71f0d46c12fef9c545b21f4de765c4c 100644 (file)
@@ -962,14 +962,8 @@ rpciod(void *ptr)
        rpciod_pid = current->pid;
        up(&rpciod_running);
 
-       daemonize();
-
-       spin_lock_irq(&current->sighand->siglock);
-       siginitsetinv(&current->blocked, sigmask(SIGKILL));
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
-       strcpy(current->comm, "rpciod");
+       daemonize("rpciod");
+       allow_signal(SIGKILL);
 
        dprintk("RPC: rpciod starting (pid %d)\n", rpciod_pid);
        while (rpciod_users) {