Hello community, here is the log from the commit of package sysvinit checked in at Thu Aug 10 23:02:00 CEST 2006. -------- --- sysvinit/sysvinit.changes 2006-06-09 17:22:02.000000000 +0200 +++ sysvinit/sysvinit.changes 2006-08-10 18:58:30.000000000 +0200 @@ -1,0 +2,6 @@ +Thu Aug 10 18:57:12 CEST 2006 - werner@suse.de + +- Enable showconsole to provide the major and minor device number + instead of the device file name. + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sysvinit.spec ++++++ --- /var/tmp/diff_new_pack.Mugijb/_old 2006-08-10 23:01:43.000000000 +0200 +++ /var/tmp/diff_new_pack.Mugijb/_new 2006-08-10 23:01:43.000000000 +0200 @@ -22,7 +22,7 @@ PreReq: fileutils Autoreqprov: on Version: 2.86 -Release: 23 +Release: 24 Summary: SysV-Style init BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: sysvinit-2.86.tar.bz2 @@ -281,6 +281,9 @@ %doc %{_mandir}/man8/startpar.8.gz %changelog -n sysvinit +* Thu Aug 10 2006 - werner@suse.de +- Enable showconsole to provide the major and minor device number + instead of the device file name. * Fri Jun 09 2006 - werner@suse.de - killproc: Allow relocated binary paths and several hard links on binaries (bug #183251) ++++++ showconsole-1.08.dif ++++++ --- /var/tmp/diff_new_pack.Mugijb/_old 2006-08-10 23:01:44.000000000 +0200 +++ /var/tmp/diff_new_pack.Mugijb/_new 2006-08-10 23:01:44.000000000 +0200 @@ -1,6 +1,6 @@ --- blogd.c -+++ blogd.c 2006-03-16 16:28:40.000000000 +0100 -@@ -155,25 +155,60 @@ ++++ blogd.c 2006-08-10 18:41:55.000000000 +0200 +@@ -155,25 +155,60 @@ static void reset_signal(int sig, struct * To be able to reconnect to real tty on EIO */ static char * tty; @@ -76,7 +76,7 @@ } /* -@@ -181,7 +216,7 @@ +@@ -181,7 +216,7 @@ out: */ int main(int argc, char *argv[]) { @@ -85,7 +85,16 @@ int ptm, pts, cntrtty = 1; pid_t pid, ppid = getppid(); char ptsname[NAME_MAX+1]; -@@ -241,6 +276,38 @@ +@@ -198,7 +233,7 @@ int main(int argc, char *argv[]) + if (argc == 2) + tty = argv[1]; + else +- tty = fetchtty(getpid(), ppid); ++ tty = fetchtty(getpid(), ppid, NULL); + + if (!tty || !*tty) + error("can not discover real system console tty, boot logging disabled.\n"); +@@ -241,6 +276,38 @@ int main(int argc, char *argv[]) if (!w.ws_col) w.ws_row = 80; @@ -124,7 +133,7 @@ if (openpty(&ptm, &pts, ptsname, &t, &w) < 0) error("can not open pty/tty pair: %s\n", strerror(errno)); -@@ -268,12 +335,15 @@ +@@ -268,12 +335,15 @@ int main(int argc, char *argv[]) dup2(fd, 1); dup2(fd, 2); close(ptm); @@ -141,7 +150,7 @@ error("can not fork to become daemon: %s\n", strerror(errno)); break; default: -@@ -282,12 +352,13 @@ +@@ -282,12 +352,13 @@ int main(int argc, char *argv[]) close(pts); close(ptm); close(fd); @@ -157,7 +166,7 @@ while (!signaled) safeIO(); -@@ -297,6 +368,10 @@ +@@ -297,6 +368,10 @@ int main(int argc, char *argv[]) if (!cntrtty) kill(ppid, SIGCONT); @@ -169,8 +178,8 @@ close(1); (void)tcflush(2, TCOFLUSH); --- libconsole.c -+++ libconsole.c 2006-03-16 16:29:04.000000000 +0100 -@@ -158,41 +158,52 @@ ++++ libconsole.c 2006-08-10 18:41:23.000000000 +0200 +@@ -158,41 +158,52 @@ static void (*vc_reconnect)(int fd) = NU static inline void safeout (int fd, const char *ptr, size_t s) { int saveerr = errno; @@ -234,7 +243,7 @@ } repeated = 0; ptr += p; -@@ -267,6 +278,7 @@ +@@ -267,6 +278,7 @@ out: */ static FILE * flog = NULL; static int fdwrite = -1; @@ -242,7 +251,7 @@ static int fdread = -1; static int fdfifo = -1; -@@ -714,12 +726,13 @@ +@@ -714,12 +726,13 @@ static void *action(void *dummy) static void (*rw_connect)(void) = NULL; static const char *fifo_name = _PATH_BLOG_FIFO; @@ -257,7 +266,7 @@ if (fifo_name && fdfifo < 0) { struct stat st; -@@ -729,7 +742,7 @@ +@@ -729,7 +742,7 @@ void prepareIO(void (*rfunc)(int), void (void)mkfifo(fifo_name, 0600); errno = 0; if (!stat(fifo_name, &st) && S_ISFIFO(st.st_mode)) { @@ -266,7 +275,7 @@ warn("can not open named fifo %s: %s\n", fifo_name, STRERR); } } -@@ -769,12 +782,17 @@ +@@ -769,12 +782,17 @@ static void more_input (struct timeval * const ssize_t cnt = safein(fdread, (char*)trans, sizeof(trans)); if (cnt > 0) { @@ -288,7 +297,7 @@ } } -@@ -883,6 +901,8 @@ +@@ -883,6 +901,8 @@ void closeIO(void) } else warn("no message logging because /var file system is not accessible\n"); (void)tcdrain(fdwrite); /* Hold in sync with console */ @@ -297,7 +306,7 @@ do { /* -@@ -926,6 +946,8 @@ +@@ -926,6 +946,8 @@ void closeIO(void) flog = NULL; xout: (void)tcdrain(fdwrite); @@ -306,7 +315,7 @@ return; } -@@ -941,7 +963,7 @@ +@@ -941,7 +963,7 @@ static void ctty(pid_t pid, unsigned int int fd; sprintf(fetched, "/proc/%d/stat", (int)pid); @@ -315,7 +324,7 @@ error("can not open(%s): %s\n", fetched, STRERR); cnt = safein(fd, fetched, sizeof(fetched)); close(fd); -@@ -1034,12 +1056,11 @@ +@@ -1034,12 +1056,11 @@ static int checkdev(char ** retname, uns int found = 0; struct dirent * d; struct stat st; @@ -329,7 +338,7 @@ if (*name == '.') continue; -@@ -1143,6 +1164,14 @@ +@@ -1143,6 +1164,14 @@ static int checkdev(char ** retname, uns } found++; @@ -344,7 +353,16 @@ *retname = name; break; } -@@ -1167,9 +1196,9 @@ +@@ -1151,7 +1180,7 @@ static int checkdev(char ** retname, uns + } + + /* main routine to fetch tty */ +-char * fetchtty(const pid_t pid, const pid_t ppid) ++char * fetchtty(const pid_t pid, const pid_t ppid, unsigned int *mjmi) + { + unsigned int tty = 0, found = 0; + char * name = NULL; +@@ -1167,14 +1196,15 @@ char * fetchtty(const pid_t pid, const p if (!(name = ttyname(0)) || !strcmp(name, "/dev/console")) tty = fallback(pid, ppid); else { @@ -357,7 +375,13 @@ goto out; } #ifdef TIOCGDEV -@@ -1186,8 +1215,131 @@ + } + #endif ++ if (mjmi) *mjmi = tty; + + if (!(dev = opendir("/dev"))) + error("can not opendir(/dev): %s\n", STRERR); +@@ -1186,8 +1216,131 @@ char * fetchtty(const pid_t pid, const p if (!name) goto out; @@ -492,13 +516,84 @@ + return (char*)0; +} --- libconsole.h -+++ libconsole.h 2006-03-16 16:28:40.000000000 +0100 ++++ libconsole.h 2006-08-10 18:41:28.000000000 +0200 @@ -1,6 +1,7 @@ extern void pushd(const char * path); extern void popd(void); - extern char * fetchtty(const pid_t pid, const pid_t ppid); +-extern char * fetchtty(const pid_t pid, const pid_t ppid); -extern void prepareIO(void (*rfunc)(int), void (*cfunc)(void), const int in, const int out); ++extern char * fetchtty(const pid_t pid, const pid_t ppid, unsigned int *mjmi); +extern char * secondtty(char * compare); +extern void prepareIO(void (*rfunc)(int), void (*cfunc)(void), const int in, const int out, const int second); extern void safeIO (void); extern void closeIO(void); +--- showconsole.8 ++++ showconsole.8 2006-08-10 18:55:37.000000000 +0200 +@@ -16,6 +16,7 @@ Setconsole \- sets the underlying tty of + .SH SYNOPSIS + .\" + .B showconsole ++.RI [ -n ] + .PP + .B setconsole /dev/tty<xy> < /dev/console + .SH DESCRIPTION +@@ -38,6 +39,15 @@ with + and exactly one argument, a valid character device + is given. + \." ++.SH OPTIONS ++.TP ++.B \-n ++Return the major and minor device numbers instead of ++the device file name. This can be used to asked the ++kernel for the major and minor device numbers of a not ++existing device file in ++.IR /dev . ++\." + .SH BUGS + .B showconsole + needs a mounted +--- showconsole.c ++++ showconsole.c 2006-08-10 18:51:15.000000000 +0200 +@@ -51,7 +51,7 @@ void warn (const char *fmt, ...) + */ + int main(int argc, char *argv[]) + { +- char * tty = NULL; ++ char * tty = NULL, numeric = 0; + myname = basename(*argv); + + if (!strcmp(myname, "setconsole")) { +@@ -73,8 +73,30 @@ int main(int argc, char *argv[]) + close(fdc); + goto out; + } +- tty = fetchtty(getpid(), getppid()); +- if (tty) ++ ++ if (argc == 2) { ++ const char* opt = argv[1]; ++ if (opt && *opt++ == '-' && *opt++ == 'n' && *opt == '\0') ++ numeric++; ++ else ++ error("Usage: %s [-n]\n", myname); ++ } else if (argc > 2) ++ error("Usage: %s [-n]\n", myname); ++ ++ if (numeric) { ++ unsigned int dev = 0; ++ (void)fetchtty(getpid(), getppid(), &dev); ++ ++ if (dev) ++ printf("%u %u\n", major(dev), minor(dev)); ++ else { ++ error("real tty unknown\n"); ++ fprintf(stderr, "real tty unknown\n"); ++ } ++ goto out; ++ } ++ ++ if ((tty = fetchtty(getpid(), getppid(), NULL))) + printf("%s\n", tty); + else { + error("real tty unknown\n"); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun...