bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libcons: Opening a vcons multiple times


From: Marcus Brinkmann
Subject: Re: libcons: Opening a vcons multiple times
Date: Wed, 6 Nov 2002 14:18:55 +0100
User-agent: Mutt/1.4i

On Wed, Nov 06, 2002 at 01:26:57PM +0100, Wolfgang Jaehrling wrote:
> Hi!
> 
> `libcons/vcons-close.c:37' says that ``The same virtual console should
> never be opened twice''.  Some part of the code seem to take into
> account that it might be opened multiple times, though:
> 
> - `cons_vcons_open ()' does not set `vcons_entry->vcons' to `*r_vcons'
>   itself, but leaves this to its callers (which are `cons_switch ()'
>   and `console-client/console.c:cons_vcons_add ()').

I guess this could be simplified by having cons_vcons_open set the entry. 
The other possible change is to make the open code unaware of a vcons_entry,
and just supply the id and whatever is needed as function arguments, and
have another helper function cons_vcons_entry_open.  The reason to split it
up is that the technicalities of opening a vc are distinct from integrating
it into the list structure.
 
> - `cons_switch ()' locks `*r_vcons' either with a call to
>   `cons_vcons_open ()', or (in `libcons/cons-switch.c:77') directly.
>   The ``either ... or ...'' is what gives me the impression that it
>   expects that it might be opened more than once.  Hoewever, in any
>   case it gets unlocked at `console-client/console.c:86' indirectly
>   through a call to `cons_vcons_close ()'.

No, that code is written carefully to not assume how many vc's are open at
the same time (with different id's).  Let's imagine you have a more fancy
console client that allows to display two vcs at the same time (split
screen).  Then you need to have both open to display modifications to either
of them.  Then the client code can switch between them with cons_switch but
it wouldn't close anything in that case.
 
> Or are there other reasons for these behaviours?

> PS: The comment at `console-client/console.c:62' ends in the middle of
> a sentence.

Oops.  I also received your other fixes, thanks.  I will apply them and
check them in when I change the code the next time.

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' GNU      http://www.gnu.org    marcus@gnu.org
Marcus Brinkmann              The Hurd http://www.gnu.org/software/hurd/
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]