Re: Patch: Fix serial module use count (2.4.16 _and_ 2.5)

Jeff Randall (randall@sword.damocles.com)
Thu, 29 Nov 2001 12:03:07 -0600 (CST)


Balbir Singh wrote:
> >Err,
> > close(-ENOMEM);
>
> >What's that going to close? Hint: you _can't_ close
> a descriptor that
> >failed to open, since you don't have a descriptor to
> close. You can
> >only try to close an error code, but that's not going
> to make it anywhere
> >near the kernel driver level.
>
> Let me make it clearer to you,
>
> lets say I call rs_open() on /dev/ttyS0 and if it
> fails then I should not call rs_close() after a failed
> rs_open().
>
> I hope this is clear now.

All of the other UNIX variants I've dealth with behave that way.
However, you cannot just make that change without having some means
of identifying that behavior change because all of the linux
serial drivers have been written to assume that their close()
will be called even after their open() has failed.

I'm not opposed to such a change in behavior, but at least be
sure that it's somehow identifiable (kernel version, a define
set in a header, etc) so that the 3rd party drivers have a means
to identify the change.

Redhat 7.1 included that behavior change in the kernel they shipped
and it caused no end of problems for those of us that were doing
serial drivers since there was no way to easily identify that the
patch had been included.

-- 
randall+lkml@uph.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/