Re: [PATCH] pcmcia event thread. (fwd)

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Mon Nov 13 2000 - 10:04:59 EST


David Woodhouse wrote:
> jgarzik@mandrakesoft.com said:
> > Racy. Use waitpid() in the thread killer instead.
>
> Doesn't waitpid() require the thread we're waiting for to be child of the
> rmmod process? I suppose we could arrange that, but it's not particularly
> clean.

Doh, totally forgot about that. Will this work:

        save_current = current;
        current = find_task_by_pid(1);
        waitpid(...);
        current = save_current;

In any case, we -really- need a wait_for_kernel_thread_to_die()
function.

> jgarzik@mandrakesoft.com said:
> > Why are you cloning _FS, _FILES, and _SIGHAND? I don't see why the
> > third arg should not be zero. man clone...
>
> If we don't specify CLONE_FS | CLONE_FILES | CLONE_SIGHAND then new ones
> get allocated just for us to free them again immediately. If we clone them,
> then we just increase and decrease the use counts of the parent's ones. The
> latter is slightly more efficient, and I don't think it really matters. If
> you really care, that can be changed. I've dropped CLONE_SIGHAND because
> daemonize() doesn't free that, but left CLONE_FS and CLONE_FILES.

Cool tip, thanks.

> + spin_lock_irq(&current->sigmask_lock);
> + sigfillset(&current->blocked);
> + recalc_sigpending(current);
> + spin_unlock_irq(&current->sigmask_lock);

what does this do?

> + /* Start the thread for handling queued events for socket drivers */
> + event_thread_pid = kernel_thread (pcmcia_event_thread, NULL, CLONE_FS | CLONE_FILES);
> +
> + if (event_thread_pid < 0) {
> + printk(KERN_ERR "init_pcmcia_cs: fork failed: errno %d\n", -event_thread_pid);
> + return event_thread_pid;
> + }

why do you store the event_thread_pid but never use it?

regards,

        Jeff

-- 
Jeff Garzik             |
Building 1024           | The chief enemy of creativity is "good" sense
MandrakeSoft            |          -- Picasso
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Nov 15 2000 - 21:00:23 EST