1 commit 42a909bbc8ede5c27e3d40606a98ab1251511dfc
2 Author: Halton Huo <halton.huo@sun.com>
3 Date: Tue Nov 3 11:42:07 2009 +0800
5 Identify major device number for vt rather than hard code as 15.
6 Fixes bug http://defect.opensolaris.org/bz/show_bug.cgi?id=12322
7 This is solaris only bug, won't affect other platform.
9 diff --git a/src/ck-sysdeps-solaris.c b/src/ck-sysdeps-solaris.c
10 index 607a3ae..335ab8b 100644
11 --- a/src/ck-sysdeps-solaris.c
12 +++ b/src/ck-sysdeps-solaris.c
13 @@ -124,6 +124,26 @@ ck_process_stat_get_tty (CkProcessStat *stat)
14 return g_strdup (stat->tty_text);
17 +#define VT0_FILE "/dev/vt/0"
19 +get_system_vt_major ()
28 + res = stat (VT0_FILE, &st);
31 + ret = major (st.st_rdev);
37 /* return 1 if it works, or 0 for failure */
40 @@ -177,7 +197,7 @@ stat2proc (pid_t pid,
42 snprintf (P->tty_text, sizeof P->tty_text, "%3d,%-3d", tty_maj, tty_min);
44 - if (tty_maj == 15) {
45 + if (tty_maj == get_system_vt_major ()) {
46 snprintf (P->tty_text, sizeof P->tty_text, "/dev/vt/%u", tty_min);
48 if (P->tty == NO_TTY_VALUE) {