Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Jul 2007 20:28:47 -0700
From:      Julian Elischer <julian@elischer.org>
To:        Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: nmdm(4) does not call .l_close
Message-ID:  <46AAB7EF.4020601@elischer.org>
In-Reply-To: <bb4a86c70707271614r1e3b1660nb2b2fcc4262469e6@mail.gmail.com>
References:  <bb4a86c70707261711h38d41b05k183c3fce84ba0b30@mail.gmail.com>	 <46A94194.5010207@elischer.org>	 <bb4a86c70707271204n5595eea6s6865d5d19a4b63da@mail.gmail.com> <bb4a86c70707271614r1e3b1660nb2b2fcc4262469e6@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Maksim Yevmenkin wrote:
> On 7/27/07, Maksim Yevmenkin <maksim.yevmenkin@gmail.com> wrote:
>> On 7/26/07, Julian Elischer <julian@elischer.org> wrote:
>>> Maksim Yevmenkin wrote:
>>>> Dear All,
>>>>
>>>> it seems to me that nmdm(4) is not calling .l_close (i.e. does not
>>>> close whatever line discipline might be installed onto /dev/nmdmXX).
>>>> the problem is easy to reproduce - just open /dev/nmdm0A and install,
>>>> say, ng_tty(4) line discipline onto it. after that, simply close the
>>>> /dev/nmdm0A. in theory, the ng_tty(4) node should disappear when
>>>> device is closed, but it does not.
> 
> [...]
> 
>> i have not tried other disciplines yet, i.e. ppp and slip,
> 
> ok, i changed the patch to
> 
> ===
> 
> diff -u nmdm.c.orig nmdm.c
> --- nmdm.c.orig 2006-11-21 16:59:40.000000000 -0800
> +++ nmdm.c      2007-07-27 15:57:50.000000000 -0700
> @@ -401,8 +401,13 @@
>  static int
>   nmdmclose(struct cdev *dev, int flag, int mode, struct thread *td)
>  {
> +       struct tty *tp = dev->si_tty;
> +       int error;
> 
> -       return (tty_close(dev->si_tty));
> +       error = ttyld_close(tp, flag);
> +       (void) tty_close(tp);
> +
> +       return (error);
>  }

looks fine to me

> 
>  static void
> 
> ===
> 
> and tried it with h4, ppp and slip line disciplines. it seems to work.
> since nmdmopen() calls ttyld_open(), nmdmclose(), imo, should call
> ttyld_close().
> 
> any comments?
> 
> thanks,
> max




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46AAB7EF.4020601>