[gpm] [patch] abort running gpm on a serial console

Nico Schottelius nico-gpm@schottelius.org
Sat Oct 15 19:03:35 CEST 2005


Mike Frysinger [Tue, May 03, 2005 at 10:57:49PM -0400]:
> -   if ((fd=open(option.consolename, mode)) < 0)
> -      gpm_report(GPM_PR_OOPS,GPM_MESS_OPEN_CON);
> +   struct stat sb;
> +   int maj, twelve=12;
> +   struct serial_struct si;
> +
> +   fd = open(option.consolename, mode);
> +   if (fd != -1) {
> +      fstat(fd, &sb);
> +      maj = major(sb.st_rdev);
> +      if (maj != 4 && (maj < 136 || maj > 143)) {
> +          if (ioctl (fd, TIOCLINUX, &twelve) < 0) {
> +              if (si.line > 0)
> +                  gpm_report(GPM_PR_OOPS,GPM_MESS_OPEN_SERIALCON);
> +          }
> +      }

Is there no cleaner solution available? Having minor/major numbers
in gpm code is not a really good thing imho.

Nico

-- 
Latest project: cconfig (http://nico.schotteli.us/papers/linux/cconfig/)
Open Source nutures open minds and free, creative developers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://lists.linux.it/pipermail/gpm/attachments/20051015/d47e9e20/attachment.pgp


More information about the gpm mailing list