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

Re: Final patch

* Denis Barbier [2004-07-05 00:13:55+0200]
> On Sun, Jul 04, 2004 at 12:13:10PM +0300, Recai Oktas wrote:
> > Hi,
> > 
> > After getting success reports from Christian (French keyboard) and 
> > Eugeniy (Ukrainian keyboard), I prepared a single patch which applies 
> > cleanly to the current kbd-chooser.  (This patch includes some minor 
> > code cleanups.  I've re-tested it here with the French, Ukrainian and 
> > Turkish keymaps.  Everything seems fine. [1])  Here is the changelog:
> > 
> >     * Denis Barbier
> >       - Make kbd-chooser work with keymaps containing unicode chars.
> >     * Recai Oktas
> >       - Set console mode to unicode.  Closes: #251550.
> >       - Prevent too many file descriptors referring to the console.
> > 
> > Could you apply the patch?
> In fact there is no need for kbd-mode, kbd-chooser (or any other program
> run early) should call ioctl to set keyboard in Unicode mode.

I added the kbd-mode because an early ioctl call in loadkeys_wrapper to 
switch to unicode mode simply didn't work (still don't know why), that's 
the only quick solution which I was able to found.  Could you work on an 
alternative solution (if you have enough time :-))?

> I did not notice that getfd() opens a new file descriptor each time it
> is called, 

As I stated in a previous mail, kbd-chooser returns the following error 
when choosing trqu or ut-utf:

  ERROR **: Couldnt get a file descriptor referring to the console

When I inserted a debug code, I had noticed that there were many 'getfd's 
occured in each time calling the ksymtocode or add_number.  Other than 
the efficiency reasons, I thought that this could be the cause, hence I 
changed it.  The result was that the problem was resolved.

> but this can be solved without changing current prototypes,
> e.g. this (untested) patch should do the trick.

I also thought something like this, but hesitated since this could 
produce a side-effect which I hadn't been able to see.  But now I think
it is much better than using a global variable.

> Index: packages/kbd-chooser/getfd.c
> ===================================================================
> --- packages/kbd-chooser/getfd.c	(revision 17443)
> +++ packages/kbd-chooser/getfd.c	(working copy)
> @@ -45,7 +45,9 @@
>  }
>  int getfd() {
> -    int fd;
> +    static int fd = -1;
> +    if (fd >= 0)
> +      return fd;
>      fd = open_a_console("/dev/tty");
>      if (fd >= 0)

Ok, This should be the way to go.  I'll test it and modify the patch.  
Thanks for your time and comments.


Attachment: signature.asc
Description: Digital signature

Reply to: