File:Termios-script-diagram.svg

Summary

Description
English: Diagram of script(1) using Unix98 pseudo terminals (e.g. on Linux)
Date
Source Own work
Author Krishnavedala
SVG development
InfoField
 The SVG code is valid.
 This vector image was created with dvisvgm 1.14 by Krishnavedala.
Category:Valid SVG created with Other tools code#Termios-script-diagram.svg
 Category:Translation possible - SVGThis file uses embedded text that can be easily translated using a text editor.
Source code
InfoField

SVG code

LaTeX
\documentclass[12pt]{standalone}
\usepackage{times}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows,shapes,patterns,fit}

\begin{document}
\begin{tikzpicture}[thick,>={Stealth[width=2mm,length=3mm]},every node/.style={fill=none,font=\scriptsize},
	box/.style={draw,rectangle, text width=#1, text centered,minimum height=1cm,font=\small},
	box/.default=2.5cm,
	ell/.style={ellipse, text width=#1, text centered,minimum height=1cm,font=\small},
	ell2/.style={ellipse, text width=#1, text centered,minimum height=1cm},
	]
	\node[box] 		at (0,0) 				(script)	{\textit{script} };
	\node[box] 		at ($(script)+(6,0)$) 	(bash)		{\textit{bash} };
	\node[box=2cm] 	at ($(script)-(1,4)$)	(term)		{Terminal};
	\node[box] 		at ($(term)+(3,0)$)		(pseudomas)	{Pseudo terminal master};
	\node[box=3cm] 	at ($(pseudomas)+(4,0)$)	(pseudosla)	{Pseudo terminal slave\\\texttt{(/dev/pts/\ldots)} };
	\node[ell=2cm,draw] at ($(term)+(.5,-2.5)$)	(user) 	{User};
	\node[text width=5cm,font=\small] 	at ($(script)+(3.5,2)$)	(write) 	{Write to file (transcript)};
	\node[draw,very thick,fit={($(script)+(0,1)$) (term) (pseudosla)}, inner sep=.5cm] (f) {};
	\draw[->,dashed] (script) -- node[below] {\textit{fork()} } (bash);
	\draw[dashed,very thick] (f.west) -- node[below,pos=.9] {\textit{Kernel space} }(f.east);
	\node[anchor=north west,font=\small] at (f.north west) {\textit{User space} };
	\draw[<->] (pseudomas) -- (pseudosla);
	\draw[->,dotted] (script.40) .. controls ++(-1.5,.2) and ++(-1,-.2) .. (write.west);
	\draw[->] (term.135) -- node[left,pos=.85] {stdin} (script.-145);
	\draw[<-] (term.120) -- node[right,pos=.15,ell2=.5cm] {stdout\\stderr} (script.-135);
	\draw[->] (pseudomas.145) -- node[left,pos=.7] {\textit{read()} } (script.-55);
	\draw[<-] (pseudomas.130) -- node[right,pos=.3] {\textit{write()} } (script.-40);
	\draw[->] (pseudosla.145) -- node[left,pos=.7] {stdin()} (bash.-145);
	\draw[<-] (pseudosla.135) -- node[right,pos=.15,ell2=.5cm] {stdout\\stderr} (bash.-130);
	\draw[<->] (term) -- node[right,pos=.3] {keyboard input} node[left,pos=.7] {terminal output} (user);
\end{tikzpicture}
\end{document}

Licensing

Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#Termios-script-diagram.svg Category:Unix shells
Category:CC-Zero Category:Translation possible - SVG Category:Unix shells Category:Valid SVG created with Other tools code