added LaTeX code
This commit is contained in:
parent
196ed7c71c
commit
0b07be0d42
2
.gitignore
vendored
2
.gitignore
vendored
@ -74,7 +74,7 @@ dkms.conf
|
|||||||
# these rules might exclude image files for figures etc.
|
# these rules might exclude image files for figures etc.
|
||||||
# *.ps
|
# *.ps
|
||||||
# *.eps
|
# *.eps
|
||||||
# *.pdf
|
*.pdf
|
||||||
|
|
||||||
## Generated if empty string is given at "Please type another file name for output:"
|
## Generated if empty string is given at "Please type another file name for output:"
|
||||||
.pdf
|
.pdf
|
||||||
|
179
LaTeX/Homework_Lesson_4.tex
Normal file
179
LaTeX/Homework_Lesson_4.tex
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
\documentclass[a4paper, 12pt, english]{article}
|
||||||
|
|
||||||
|
\usepackage[utf8]{inputenc}
|
||||||
|
\usepackage[T1]{fontenc}
|
||||||
|
\usepackage{listings}
|
||||||
|
\usepackage{xcolor}
|
||||||
|
\usepackage{hyperref}
|
||||||
|
\usepackage{multicol}
|
||||||
|
\usepackage{setspace}
|
||||||
|
|
||||||
|
|
||||||
|
\title{Advanced Operating Systems\\Assignment Week 4}
|
||||||
|
\author{Paul Lödige \\ Student ID: 37-229753}
|
||||||
|
|
||||||
|
\makeatletter
|
||||||
|
\newcommand*{\toccontents}{\@starttoc{toc}}
|
||||||
|
\makeatother
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\maketitle
|
||||||
|
\toccontents
|
||||||
|
|
||||||
|
\section{Assignment}%
|
||||||
|
\label{sec:Assignment}
|
||||||
|
Modify the kernel module you created in the \#3 Homework to introduce the ioctl mechanism that sets and gets messages.
|
||||||
|
Compile and run the program.
|
||||||
|
You should also write a user-space program that calls ioctl().
|
||||||
|
Submit the source code and the screen shot of the result of execution displayed by the dmesg command.
|
||||||
|
|
||||||
|
\clearpage
|
||||||
|
|
||||||
|
\section{Code}%
|
||||||
|
\label{sec:Code}
|
||||||
|
|
||||||
|
\definecolor{mGreen}{rgb}{0,0.6,0}
|
||||||
|
\definecolor{mGray}{rgb}{0.5,0.5,0.5}
|
||||||
|
\definecolor{mPurple}{rgb}{0.58,0,0.82}
|
||||||
|
\definecolor{backgroundColour}{rgb}{0.95,0.95,0.92}
|
||||||
|
\lstset{
|
||||||
|
language=C,
|
||||||
|
backgroundcolor=\color{backgroundColour},
|
||||||
|
commentstyle=\color{mGreen},
|
||||||
|
keywordstyle=\color{magenta},
|
||||||
|
numberstyle=\tiny\color{mGray},
|
||||||
|
stringstyle=\color{mPurple},
|
||||||
|
basicstyle=\ttfamily\scriptsize,
|
||||||
|
breakatwhitespace=false,
|
||||||
|
breaklines=true,
|
||||||
|
captionpos=b,
|
||||||
|
keepspaces=true,
|
||||||
|
numbers=left,
|
||||||
|
firstnumber=0,
|
||||||
|
stepnumber=1,
|
||||||
|
numbersep=5pt,
|
||||||
|
showspaces=false,
|
||||||
|
showstringspaces=false,
|
||||||
|
showtabs=false,
|
||||||
|
tabsize=2,
|
||||||
|
literate={~}{{$\mathtt{\sim}$}}1
|
||||||
|
}
|
||||||
|
\lstset{literate=%
|
||||||
|
{Ö}{{\"O}}1
|
||||||
|
{Ä}{{\"A}}1
|
||||||
|
{Ü}{{\"U}}1
|
||||||
|
{ß}{{\ss}}2
|
||||||
|
{ü}{{\"u}}1
|
||||||
|
{ä}{{\"a}}1
|
||||||
|
{ö}{{\"o}}1
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Kernel Module Code}%
|
||||||
|
\label{sub:Kernel Module Code}
|
||||||
|
|
||||||
|
\subsubsection{\texttt{chardev2.c}}%
|
||||||
|
\label{ssub:chardev2}
|
||||||
|
\lstinputlisting{../Code/Kernel_Module/chardev2.c}
|
||||||
|
\clearpage
|
||||||
|
|
||||||
|
\subsubsection{\texttt{chardev.h}}%
|
||||||
|
\label{ssub:chardev}
|
||||||
|
\lstinputlisting{../Code/Kernel_Module/chardev.h}
|
||||||
|
\clearpage
|
||||||
|
|
||||||
|
\subsection{IOCTL Client Code}%
|
||||||
|
\label{sub:IOCTL Client Code}
|
||||||
|
|
||||||
|
\subsubsection{\texttt{userspace\_ioctl.c}}%
|
||||||
|
\label{ssub:userspaceioctl}
|
||||||
|
\lstinputlisting{../Code/IOCTL_Client/userspace_ioctl.c}
|
||||||
|
\clearpage
|
||||||
|
|
||||||
|
\subsubsection{\texttt{chardev.h}}%
|
||||||
|
\label{ssub:chardev h}
|
||||||
|
\lstinputlisting{../Code/IOCTL_Client/chardev.h}
|
||||||
|
\clearpage
|
||||||
|
|
||||||
|
\section{Output of \texttt{sudo cat /proc/devices}}%
|
||||||
|
\label{sec:Output of proc devices}
|
||||||
|
\begin{multicols}{2}
|
||||||
|
\begin{spacing}{.9}
|
||||||
|
\texttt{
|
||||||
|
Character devices:\\
|
||||||
|
1 mem\\
|
||||||
|
4 /dev/vc/0\\
|
||||||
|
4 tty\\
|
||||||
|
4 ttyS\\
|
||||||
|
5 /dev/tty\\
|
||||||
|
5 /dev/console\\
|
||||||
|
5 /dev/ptmx\\
|
||||||
|
7 vcs\\
|
||||||
|
10 misc\\
|
||||||
|
13 input\\
|
||||||
|
29 fb\\
|
||||||
|
100 char\_dev\\
|
||||||
|
116 alsa\\
|
||||||
|
128 ptm\\
|
||||||
|
136 pts\\
|
||||||
|
180 usb\\
|
||||||
|
188 ttyUSB\\
|
||||||
|
189 usb\_device\\
|
||||||
|
202 cpu/msr\\
|
||||||
|
203 cpu/cpuid\\
|
||||||
|
226 drm\\
|
||||||
|
236 binder\\
|
||||||
|
237 hidraw\\
|
||||||
|
238 wwan\_port\\
|
||||||
|
239 nvme-generic\\
|
||||||
|
240 nvme\\
|
||||||
|
241 aux\\
|
||||||
|
242 bsg\\
|
||||||
|
243 watchdog\\
|
||||||
|
244 remoteproc\\
|
||||||
|
245 ptp\\
|
||||||
|
246 pps\\
|
||||||
|
247 cec\\
|
||||||
|
248 lirc\\
|
||||||
|
249 rtc\\
|
||||||
|
250 dma\_heap\\
|
||||||
|
251 dax\\
|
||||||
|
252 dimmctl\\
|
||||||
|
253 ndctl\\
|
||||||
|
254 gpiochip\\
|
||||||
|
\columnbreak\\\\
|
||||||
|
Block devices:\\
|
||||||
|
8 sd\\
|
||||||
|
65 sd\\
|
||||||
|
66 sd\\
|
||||||
|
67 sd\\
|
||||||
|
68 sd\\
|
||||||
|
69 sd\\
|
||||||
|
70 sd\\
|
||||||
|
71 sd\\
|
||||||
|
128 sd\\
|
||||||
|
129 sd\\
|
||||||
|
130 sd\\
|
||||||
|
131 sd\\
|
||||||
|
132 sd\\
|
||||||
|
133 sd\\
|
||||||
|
134 sd\\
|
||||||
|
135 sd\\
|
||||||
|
259 blkext\\
|
||||||
|
}
|
||||||
|
\end{spacing}
|
||||||
|
\end{multicols}
|
||||||
|
|
||||||
|
\section{Output of running the \texttt{userspace\_ioctl.c} code}%
|
||||||
|
\label{sec:Output of running the userspaceioctl code}
|
||||||
|
\texttt{get\_nth\_byte message:Message passed by ioctl}\\
|
||||||
|
\texttt{get\_msg message:Message passed by ioctl}
|
||||||
|
|
||||||
|
\section{Output of \texttt{sudo dmesg -T -l info | tail -5}}%
|
||||||
|
\label{sec:Output of dmesg}
|
||||||
|
\texttt{[Mon Oct 31 11:57:15 2022] Device created on /dev/char\_dev}\\
|
||||||
|
\texttt{[Mon Oct 31 11:57:16 2022] device\_open(00000000d7150407)}\\
|
||||||
|
\texttt{[Mon Oct 31 11:57:16 2022] device\_write(00000000d7150407,000000001ed918c3,25)}\\
|
||||||
|
\texttt{[Mon Oct 31 11:57:16 2022] Read 24 bytes, 75 left}\\
|
||||||
|
\texttt{[Mon Oct 31 11:57:16 2022] device\_release(0000000005e64dfb,00000000d7150407)}
|
||||||
|
|
||||||
|
\end{document}
|
Loading…
x
Reference in New Issue
Block a user