gpm-1.19.3-serialconsole.patch
来自「gpm-1.20.0.tar.gz」· PATCH 代码 · 共 41 行
PATCH
41 行
--- gpm-1.19.3/gpm.c.serialconsole Fri Jan 5 14:10:46 2001+++ gpm-1.19.3/gpm.c Fri Jan 5 14:39:28 2001@@ -38,6 +38,7 @@ #include <sys/un.h> /* struct sockaddr_un */ #include <linux/vt.h> /* VT_GETSTATE */+#include <linux/serial.h> /* for serial console check */ #include <sys/kd.h> /* KDGETMODE */ #include <termios.h> /* winsize */ @@ -142,10 +143,25 @@ static inline int open_console(const int mode) { int fd;-- if ((fd=open(consolename, mode)) < 0)- oops(consolename);- return fd;+ struct stat sb;+ int maj, twelve=12;+ struct serial_struct si;++ fd = open(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 (ioctl (fd, TIOCGSERIAL, &si) >= 0) {+ if (si.line > 0)+ oops("we seem to be on a serial console");+ }+ }+ }+ return fd;+ } else+ oops(consolename); } /*-------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?