From: K-mart Cashier on 6 Jul 2010 09:18 On Jul 5, 4:05 pm, Nicolas George <nicolas$geo...(a)salle-s.org> wrote: > pk wrote in message <20100705223107.7c196...(a)scooter.pippo.db>: > > I suppose you're wondering what kind of device a terminal is. The accurate > > answer is *very* complicated; for the purpose of your question, it can be > > seen as a device driver in the OS kernel that knows how to read and > > interpret your keystrokes and to write to the output device, be it a real > > physical terminal (eg connected to a serial port) or a virtual one (for > > example a console or an xterm). > > The ":0.0" in the output seems to indicate the OP is using some kind of X11 > terminal emulator. > > In that case, this is what you called a "virtual one", and the exact term is > a pseudo-terminal. The principle is not very complex: a pseudo-terminal is a > kind of bidirectional pipe with some extra features. What is written on the > pseudo-terminal is read by xterm on its end of the pipe, and xterm displays > it to the window. Yes, I am using a X11 terminal emulator.
From: bsh on 6 Jul 2010 21:18 K-mart Cashier <cdal...(a)gmail.com> wrote: > ... > From my understanding, the output from 'who' goes to the stdout. The > question is, how does this go to my terminal? Does the shell access > the stdout stream? And a few nits: > pk wrote: > > stdout is file descriptor 1 in the shell.... Uh, no. While I have seen some official manpages of shells so egregriously imprecise as to actually use the terms "file descriptor," there simply are no FDs in shells. It is "File Unit Numbers," being the 0..9 (and more in modern shells), which comprise the high-level abstraction of file descriptors. > Rainer Weikusat wrote: > > [The shell access the stdout stream via] the stdout stream > > [which] is an abstract object provided by stdio (part of the > > C-library) ... Well, uh, not _exactly_. Stdio is not even used by ksh93, which implements an enhanced stdio.o emulation library named sfio.o, which is statically linked into that shell. Additionally, the notion of streams exists only from BSD Unix and its many descendents. I cannot exactly recall, but didn't at least SVR2 and earlier utilize round-robin allocated clists for pipes? > Tim Harig wrote: > > The shell inherits its stdout from login. login inherits > > stdout from getty.... Just an aside... _Canonical_ getty has not been used for ages now in modern Unices. Despite the similar naming, Linux agetty is a total rewrite that is aware of modern network protocols. Solaris has even completely abandoned this framework in preference to the ttymon facility. Excuse the nit-picking! =Brian
From: Rainer Weikusat on 7 Jul 2010 06:05 bsh <brian_hiles(a)rocketmail.com> writes: > “K-mart Cashier” <cdal...(a)gmail.com> wrote: [...] >> Rainer Weikusat wrote: >> > [The shell access the stdout stream via] the stdout stream >> > [which] is an abstract object provided by stdio (part of the >> > C-library) ... > > Well, uh, not _exactly_. Theoretically, producing fakes like the one above and wrongly attributing them to others is a felony. Certainly in Germany and probably in the country which has to endure your presence as well.
From: Geoff Clare on 7 Jul 2010 08:56
bsh wrote: >> > stdout is file descriptor 1 in the shell.... > > Uh, no. While I have seen some official manpages of shells so > egregriously imprecise as to actually use the terms "file > descriptor," there simply are no FDs in shells. It is "File Unit > Numbers," > being the 0..9 (and more in modern shells), which comprise the > high-level abstraction of file descriptors. SUSv4/POSIX.1-2008 XCU section 2.7 Redirection: Open files are represented by decimal numbers starting with zero. The largest possible value is implementation-defined; however, all implementations shall support at least 0 to 9, inclusive, for use by the application. These numbers are called "file descriptors". -- Geoff Clare <netnews(a)gclare.org.uk> |