From: Alexander Viro <viro@math.psu.edu>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Kurt Garloff <garloff@suse.de>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
miquels@cistron.nl,
Linux kernel list <linux-kernel@vger.kernel.org>
Subject: Re: TIOCGDEV ioctl
Date: Fri, 15 Dec 2000 20:54:01 -0500 (EST) [thread overview]
Message-ID: <Pine.GSO.4.21.0012152038560.13037-100000@weyl.math.psu.edu> (raw)
In-Reply-To: <Pine.LNX.4.10.10012151710040.1325-100000@penguin.transmeta.com>
On Fri, 15 Dec 2000, Linus Torvalds wrote:
> Please instead do the same thing /dev/tty does, namely a sane interface
> that shows it as a symlink in /proc (or even in /dev)
There you go... (/proc/tty/console -> /dev/tty<current_VC>; may very well
be dangling, but then you have a current VC even if your /dev consists
of /dev/console and nothing else, so there's nothing to do about that;
doesn't handle TIOCCONS redirects, but IMO that should be a separate
object anyway).
Cheers,
Al
diff -urN rc12-pre8/fs/proc/proc_tty.c rc12-pre8-tty/fs/proc/proc_tty.c
--- rc12-pre8/fs/proc/proc_tty.c Sat Apr 22 02:35:31 2000
+++ rc12-pre8-tty/fs/proc/proc_tty.c Sat Dec 16 00:14:20 2000
@@ -166,6 +166,26 @@
driver->proc_entry = 0;
}
+extern int fg_console;
+static int proc_cons_readlink(struct dentry *dentry, char *buffer, int buflen)
+{
+ char tmp[30];
+ sprintf(tmp, "/dev/tty%d", fg_console);
+ return vfs_readlink(dentry,buffer,buflen,tmp);
+}
+
+static int proc_cons_follow_link(struct dentry *dentry, struct nameidata *nd)
+{
+ char tmp[30];
+ sprintf(tmp, "/dev/tty%d", fg_console);
+ return vfs_follow_link(nd,tmp);
+}
+
+static struct inode_operations proc_cons_operations = {
+ readlink: proc_cons_readlink,
+ follow_link: proc_cons_follow_link,
+};
+
/*
* Called by proc_root_init() to initialize the /proc/tty subtree
*/
@@ -175,6 +195,9 @@
return;
proc_tty_ldisc = proc_mkdir("tty/ldisc", 0);
proc_tty_driver = proc_mkdir("tty/driver", 0);
+
+ proc_tty_console = create_proc_entry("tty/console", S_IFLNK|0777, NULL);
+ proc_tty_console->proc_iops = &proc_console_ops;
create_proc_read_entry("tty/ldiscs", 0, 0, tty_ldiscs_read_proc,NULL);
create_proc_read_entry("tty/drivers", 0, 0, tty_drivers_read_proc,NULL);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2000-12-16 2:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-16 0:55 TIOCGDEV ioctl Kurt Garloff
2000-12-16 1:11 ` Linus Torvalds
2000-12-16 1:54 ` Alexander Viro [this message]
2000-12-16 10:46 ` Miquel van Smoorenburg
2000-12-16 11:15 ` Alexander Viro
2000-12-16 11:40 ` Miquel van Smoorenburg
2000-12-16 11:57 ` Alexander Viro
2000-12-19 11:34 ` Kurt Garloff
2000-12-21 14:22 ` Dr. Werner Fink
2000-12-16 1:18 ` James Simmons
2000-12-16 10:54 ` Miquel van Smoorenburg
2000-12-18 17:07 ` James Simmons
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.GSO.4.21.0012152038560.13037-100000@weyl.math.psu.edu \
--to=viro@math.psu.edu \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=garloff@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=miquels@cistron.nl \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).