sysvinit-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] bootlogd: make isconsole() more lenient


From: Matthias Schiffer
Subject: Re: [PATCH] bootlogd: make isconsole() more lenient
Date: Tue, 27 Jul 2021 13:31:43 +0200

Hi Jesse,

for my concrete usecase I'm not interested in devices without a number,
but in serial devices that have additional characters before the number
(for example ttymxc0 for the i.MX UART driver). With my patch, the
"tty" entry in the list of prefixes will now match this device name.

If we go with the alternative solution, how would we prevent accepting
"console=null" for now? I guess checking whether the device is a TTY
(for example using tcgetattr()) would be an option, but I'm not sure if
that would break existing usecases. Maybe only require a TTY when the
device is not found in the list of known console names?

Matthias



> Matthias,
> 
> As I understand it, you're hoping to make it possible to have bootlogd
> work in situations where the kernel "console=" parameter can be used
> even if it doesn't contain a number.  And, with a little modification,
> we can use any "console=" device, even if it's not a normal device name
> like /dev/tty0.
> 
> I am in favour of your first solution, allowing any device name even if
> it doesn't include a number. And allowing "console=X" to map to
> "/dev/X", assuming we have a character device.
> 
> Let's not accept "console=null" yet. Later, if it's supported in the
> kernel I'm okay with trying that, but for now let's wait until Linux
> supports a null console device.
> 
> I'll be happy to accept a patch for this and add it to our next release
> of SysV init tools.
> 
> Jesse
> 
> 
> 
> On 2021-07-22 9:18 a.m., Matthias Schiffer wrote:
> > Do not require a digit after the known prefix. This makes console
> > detection work with various serial drivers, which use device names like
> > ttymxc%d or ttyAPP%d.
> > ---
> >
> > An (even more lenient) alternative solution would be to try opening any
> > device passed as console=X as /dev/X as a last resort when all prefix
> > matches fail. Checking that the file is a chardev might make sense then?
> >
> > The latter should also allow using console=null to disable the console
> > completely (which I consider a desirable feature, although it is
> > currently not working for the Linux kernel console either [1]).
> >
> > Please let me know which solution you prefer, so I can update my patch
> > accordingly.
> >
> >
> > [1] 
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a91bd6223ecd46addc71ee6fcd432206d39365d2
> >
> >
> >  src/bootlogd.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/bootlogd.c b/src/bootlogd.c
> > index 787db87..5fb3939 100644
> > --- a/src/bootlogd.c
> > +++ b/src/bootlogd.c
> > @@ -228,7 +228,7 @@ int isconsole(char *s, char *res, int rlen)
> >               l = strlen(c->cmdline);
> >               if (sl <= l) continue;
> >               p = s + l;
> > -             if (strncmp(s, c->cmdline, l) != 0 || !isdigit(*p))
> > +             if (strncmp(s, c->cmdline, l) != 0)
> >                       continue;
> >               for (i = 0; i < 2; i++) {
> >                       snprintf(res, rlen, i ? c->dev1 : c->dev2, p);
> 




reply via email to

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