Fix a warning on alpha (real problem) and make pstat -t work as a bonus.

'struct tty' was out of sync in user and kernel due to dev_t/udev_t
mixups.  This takes advantage of the fact that dev_t changes type in
userland, so it isn't too pretty.
This commit is contained in:
Peter Wemm 2001-09-10 12:05:47 +00:00
parent 7c483fee3f
commit b03a0c9e5e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83300
2 changed files with 7 additions and 2 deletions

View File

@ -2528,7 +2528,7 @@ sysctl_kern_ttys(SYSCTL_HANDLER_ARGS)
SLIST_FOREACH(tp, &tty_list, t_list) {
t = *tp;
if (t.t_dev)
t.t_dev = (dev_t)dev2udev(t.t_dev);
t.ttyu.t_udev = dev2udev(t.t_dev);
error = SYSCTL_OUT(req, (caddr_t)&t, sizeof(t));
if (error)
return (error);

View File

@ -74,7 +74,11 @@ struct tty {
struct clist t_outq; /* Device output queue. */
long t_outcc; /* Output queue statistics. */
int t_line; /* Interface to device drivers. */
dev_t t_dev; /* Device. */
union {
dev_t t_kdev; /* Device. */
udev_t t_udev; /* Userland (sysctl) instance */
void *t_devp; /* Keep user/kernel size in sync */
} ttyu;
int t_state; /* Device and driver (TS*) state. */
int t_flags; /* Tty flags. */
int t_timeout; /* Timeout for ttywait() */
@ -105,6 +109,7 @@ struct tty {
SLIST_ENTRY(tty) t_list; /* Global chain of ttys for pstat(8) */
};
#define t_dev ttyu.t_kdev
#define t_cc t_termios.c_cc
#define t_cflag t_termios.c_cflag
#define t_iflag t_termios.c_iflag