public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* In last setsid/tty locking changes...
@ 2005-01-07 13:37 Marco Cipullo
  2005-01-07 15:45 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Marco Cipullo @ 2005-01-07 13:37 UTC (permalink / raw)
  To: linux-kernel

In last setsid/tty locking changes:

diff -Nru a/kernel/exit.c b/kernel/exit.c
--- a/kernel/exit.c	2005-01-07 05:24:41 -08:00
+++ b/kernel/exit.c	2005-01-07 05:24:41 -08:00
@@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: In last setsid/tty locking changes...
  2005-01-07 13:37 In last setsid/tty locking changes Marco Cipullo
@ 2005-01-07 15:45 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2005-01-07 15:45 UTC (permalink / raw)
  To: Marco Cipullo; +Cc: Linux Kernel Mailing List

On Gwe, 2005-01-07 at 13:37, Marco Cipullo wrote:
> In last setsid/tty locking changes:
> +	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"


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-07 16:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-07 13:37 In last setsid/tty locking changes Marco Cipullo
2005-01-07 15:45 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox