add restart of thread if killed by accident
This commit is contained in:
parent
a3b6908c6f
commit
bd1c13ae2b
|
@ -44,6 +44,7 @@ extern struct list_head mISDN_instlist;
|
|||
extern void get_stack_info(struct sk_buff *);
|
||||
extern int get_stack_cnt(void);
|
||||
extern mISDNstack_t *get_stack4id(u_int);
|
||||
extern int mISDN_start_stack_thread(mISDNstack_t *);
|
||||
extern mISDNstack_t *new_stack(mISDNstack_t *, mISDNinstance_t *);
|
||||
extern int mISDN_start_stop(mISDNstack_t *, int);
|
||||
extern int release_stack(mISDNstack_t *);
|
||||
|
|
|
@ -571,6 +571,9 @@ mISDNStackd(void *data)
|
|||
#endif
|
||||
printk(KERN_DEBUG "mISDNStackd daemon for id(%08x) killed now\n", st->id);
|
||||
test_and_set_bit(mISDN_STACK_KILLED, &st->status);
|
||||
test_and_clear_bit(mISDN_STACK_RUNNING, &st->status);
|
||||
test_and_clear_bit(mISDN_STACK_ACTIVE, &st->status);
|
||||
test_and_clear_bit(mISDN_STACK_ABORT, &st->status);
|
||||
discard_queue(&st->msgq);
|
||||
st->thread = NULL;
|
||||
if (st->notify != NULL) {
|
||||
|
@ -580,6 +583,19 @@ mISDNStackd(void *data)
|
|||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
mISDN_start_stack_thread(mISDNstack_t *st)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (st->thread == NULL && test_bit(mISDN_STACK_KILLED, &st->status)) {
|
||||
test_and_clear_bit(mISDN_STACK_KILLED, &st->status);
|
||||
kernel_thread(mISDNStackd, (void *)st, 0);
|
||||
} else
|
||||
err = -EBUSY;
|
||||
return(err);
|
||||
}
|
||||
|
||||
mISDNstack_t *
|
||||
new_stack(mISDNstack_t *master, mISDNinstance_t *inst)
|
||||
{
|
||||
|
@ -599,7 +615,6 @@ new_stack(mISDNstack_t *master, mISDNinstance_t *inst)
|
|||
INIT_LIST_HEAD(&newst->prereg);
|
||||
init_waitqueue_head(&newst->workq);
|
||||
skb_queue_head_init(&newst->msgq);
|
||||
test_and_set_bit(mISDN_STACK_INIT, &newst->status);
|
||||
if (!master) {
|
||||
if (inst && inst->st) {
|
||||
master = inst->st;
|
||||
|
|
|
@ -33,7 +33,8 @@ static ssize_t store_st_status(struct class_device *class_dev, const char *buf,
|
|||
|
||||
status = simple_strtol(buf, NULL, 0);
|
||||
printk(KERN_DEBUG "%s: status %08lx\n", __FUNCTION__, status);
|
||||
if (status == (1<<mISDN_STACK_INIT)) { /* we want to make st->new_pid activ */
|
||||
if (status == (1<<mISDN_STACK_INIT)) {
|
||||
/* we want to make st->new_pid activ */
|
||||
err = clear_stack(st, 1);
|
||||
if (err) {
|
||||
int_errtxt("clear_stack:%d", err);
|
||||
|
@ -45,6 +46,14 @@ static ssize_t store_st_status(struct class_device *class_dev, const char *buf,
|
|||
return(err);
|
||||
}
|
||||
return(count);
|
||||
} else if (status == (1<<mISDN_STACK_THREADSTART)) {
|
||||
/* we want to start a new process after abort */
|
||||
err = mISDN_start_stack_thread(st);
|
||||
if (err) {
|
||||
int_errtxt("start_stack_thread:%d", err);
|
||||
return(err);
|
||||
}
|
||||
return(count);
|
||||
}
|
||||
st->status = status;
|
||||
wake_up_interruptible(&st->workq);
|
||||
|
|
Loading…
Reference in New Issue