Skip to contentSkip to conversation

In last setsid/tty locking changes...

PATCH Marco Cipullo 2 participants 2 messages Jan 7, 2005

lore
Share & tools
lore
#0 lore raw

In last setsid/tty locking changes:

kernel/exit.c +2 -0
diff -Nru a/kernel/exit.c b/kernel/exit.c
@@ -332,7 +332,9 @@
 	exit_mm(current);
 
 	set_special_pids(1, 1);
+	down(&tty_sem);
 	current->signal->tty = NULL;
+	up(&tty_sem);
 
 	/* Block and flush all signals */
 	sigfillset(&blocked);

Sorry for the silly question, but why is needed a semaphore to write just one value without read/write nothing else?

Bye
Marco

#1 lore raw
Quoted 10 lines · Marco Cipullo

In last setsid/tty locking changes:

kernel/exit.c +2 -0
+	down(&tty_sem);
 	current->signal->tty = NULL;
+	up(&tty_sem);
 
 	/* Block and flush all signals */
 	sigfillset(&blocked);

Sorry for the silly question, but why is needed a semaphore to write just one value without read/write nothing else?

Look at the tty init_dev code paths and it might make more sense. It doesn't just say "protect this write" more importantly it says "don't do this in parallel with tty setup"