diff --git a/examples/20150504/Makefile b/examples/20150504/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..0db34c8b628fad5594dcc293e50222390cfa9096 --- /dev/null +++ b/examples/20150504/Makefile @@ -0,0 +1,7 @@ +obj-m += chardev.o + +all: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules + +clean: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean diff --git a/examples/20150504/chardev.c b/examples/20150504/chardev.c new file mode 100644 index 0000000000000000000000000000000000000000..17a6651a33313322de202fbcb6bbf82333c0b766 --- /dev/null +++ b/examples/20150504/chardev.c @@ -0,0 +1,166 @@ +/* + * chardev.c: Creates a read-only char device that says how many times + * you've read from the dev file + */ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/fs.h> +#include <asm/uaccess.h> /* for put_user */ + +/* + * Prototypes - this would normally go in a .h file + */ +int init_module(void); +void cleanup_module(void); +static int device_open(struct inode *, struct file *); +static int device_release(struct inode *, struct file *); +static ssize_t device_read(struct file *, char *, size_t, loff_t *); +static ssize_t device_write(struct file *, const char *, size_t, loff_t *); + +#define SUCCESS 0 +#define DEVICE_NAME "chardev" /* Dev name as it appears in /proc/devices */ +#define BUF_LEN 80 /* Max length of the message from the device */ + +/* + * Global variables are declared as static, so are global within the file. + */ + +static int Major; /* Major number assigned to our device driver */ +static int Device_Open = 0; /* Is device open? + * Used to prevent multiple access to device */ +static char msg[BUF_LEN]; /* The msg the device will give when asked */ +static char *msg_Ptr; + +static struct file_operations fops = { + .read = device_read, + .write = device_write, + .open = device_open, + .release = device_release +}; + +/* + * This function is called when the module is loaded + */ +int init_module(void) +{ + Major = register_chrdev(0, DEVICE_NAME, &fops); + + if (Major < 0) { + printk(KERN_ALERT "Registering char device failed with %d\n", Major); + return Major; + } + + printk(KERN_INFO "I was assigned major number %d. To talk to\n", Major); + printk(KERN_INFO "the driver, create a dev file with\n"); + printk(KERN_INFO "'mknod /dev/%s c %d 0'.\n", DEVICE_NAME, Major); + printk(KERN_INFO "Try various minor numbers. Try to cat and echo to\n"); + printk(KERN_INFO "the device file.\n"); + printk(KERN_INFO "Remove the device file and module when done.\n"); + + return SUCCESS; +} + +/* + * This function is called when the module is unloaded + */ +void cleanup_module(void) +{ + /* + * Unregister the device + */ + unregister_chrdev(Major, DEVICE_NAME); +} + +/* + * Methods + */ + +/* + * Called when a process tries to open the device file, like + * "cat /dev/mycharfile" + */ +static int device_open(struct inode *inode, struct file *file) +{ + static int counter = 0; + + if (Device_Open) + return -EBUSY; + + Device_Open++; + sprintf(msg, "I already told you %d times Hello world!\n", counter++); + msg_Ptr = msg; + try_module_get(THIS_MODULE); + + return SUCCESS; +} + +/* + * Called when a process closes the device file. + */ +static int device_release(struct inode *inode, struct file *file) +{ + Device_Open--; /* We're now ready for our next caller */ + + /* + * Decrement the usage count, or else once you opened the file, you'll + * never get get rid of the module. + */ + module_put(THIS_MODULE); + + return 0; +} + +/* + * Called when a process, which already opened the dev file, attempts to + * read from it. + */ +static ssize_t device_read(struct file *filp, /* see include/linux/fs.h */ + char *buffer, /* buffer to fill with data */ + size_t length, /* length of the buffer */ + loff_t * offset) +{ + /* + * Number of bytes actually written to the buffer + */ + int bytes_read = 0; + + /* + * If we're at the end of the message, + * return 0 signifying end of file + */ + if (*msg_Ptr == 0) + return 0; + + /* + * Actually put the data into the buffer + */ + while (length && *msg_Ptr) { + + /* + * The buffer is in the user data segment, not the kernel + * segment so "*" assignment won't work. We have to use + * put_user which copies data from the kernel data segment to + * the user data segment. + */ + put_user(*(msg_Ptr++), buffer++); + + length--; + bytes_read++; + } + + /* + * Most read functions return the number of bytes put into the buffer + */ + return bytes_read; +} + +/* + * Called when a process writes to dev file: echo "hi" > /dev/hello + */ +static ssize_t +device_write(struct file *filp, const char *buff, size_t len, loff_t * off) +{ + printk(KERN_ALERT "Sorry, this operation isn't supported.\n"); + return -EINVAL; +} diff --git a/examples/20150504/hello.c b/examples/20150504/hello.c new file mode 100644 index 0000000000000000000000000000000000000000..b19d80e9bd0bd7c5ed8f54b20c6a50d9166f03ac --- /dev/null +++ b/examples/20150504/hello.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main (void) +{ + printf ("Hello, world!\n"); + return 0; +} diff --git a/examples/20150504/modhello-1.c b/examples/20150504/modhello-1.c new file mode 100644 index 0000000000000000000000000000000000000000..03ca857c833083669c88dc58707e4e434fbbc440 --- /dev/null +++ b/examples/20150504/modhello-1.c @@ -0,0 +1,20 @@ +/* + * modhello-1.c - The simplest kernel module. + */ +#include <linux/module.h> /* Needed by all modules */ +#include <linux/kernel.h> /* Needed for KERN_INFO */ + +int init_module(void) +{ + printk(KERN_INFO "Hello, world!\n"); + + /* + * A non 0 return means init_module failed; module can't be loaded. + */ + return 0; +} + +void cleanup_module(void) +{ + printk(KERN_INFO "Goodbye, world!\n"); +} diff --git a/examples/20150504/modhello-2.c b/examples/20150504/modhello-2.c new file mode 100644 index 0000000000000000000000000000000000000000..4014b4a0fc68580b6d949c024a21d5b5a0c4f785 --- /dev/null +++ b/examples/20150504/modhello-2.c @@ -0,0 +1,21 @@ +/* + * modhello-2.c - Demonstrating the module_init() and module_exit() macros. + * This is preferred over using init_module() and cleanup_module(). + */ +#include <linux/module.h> /* Needed by all modules */ +#include <linux/kernel.h> /* Needed for KERN_INFO */ +#include <linux/init.h> /* Needed for the macros */ + +static int __init hello_2_init(void) +{ + printk(KERN_INFO "Hello, world!\n"); + return 0; +} + +static void __exit hello_2_exit(void) +{ + printk(KERN_INFO "Goodbye, world!\n"); +} + +module_init(hello_2_init); +module_exit(hello_2_exit); diff --git a/slides/os-layers-1.jpg b/slides/os-layers-1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0b7d0c119ecd2aa0d9ec454ca9b54f29916b1e87 Binary files /dev/null and b/slides/os-layers-1.jpg differ diff --git a/slides/os-layers-2.jpg b/slides/os-layers-2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..82f62fff548555b1663ed0d631951a2f3b807cd3 Binary files /dev/null and b/slides/os-layers-2.jpg differ diff --git a/slides/os-layers-3.jpg b/slides/os-layers-3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..556a8801ee4aa8b191bf62b19849a793c4f9fc1a Binary files /dev/null and b/slides/os-layers-3.jpg differ diff --git a/slides/os-layers-4.jpg b/slides/os-layers-4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c52f5d2dfbe336d0a1210133f4d89e48f57c3543 Binary files /dev/null and b/slides/os-layers-4.jpg differ diff --git a/slides/os-layers-5.jpg b/slides/os-layers-5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..943592cac6e5f062bc51a37776fc8b807e305506 Binary files /dev/null and b/slides/os-layers-5.jpg differ diff --git a/src/Blender3D_EarthQuarterCut.jpg b/src/Blender3D_EarthQuarterCut.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4579e66dd8ac709b455d17f1bc7672c52057b679 Binary files /dev/null and b/src/Blender3D_EarthQuarterCut.jpg differ diff --git a/src/Operating_system_placement-de.pdf b/src/Operating_system_placement-de.pdf new file mode 100644 index 0000000000000000000000000000000000000000..9c0775140e9c969b19738c884ff22098d2c6bd4d Binary files /dev/null and b/src/Operating_system_placement-de.pdf differ diff --git a/src/logo-hochschule-bochum-cvh-text.pdf b/src/logo-hochschule-bochum-cvh-text.pdf new file mode 100644 index 0000000000000000000000000000000000000000..649b6a8b8f51ddc370a3626310c172fb3f8b0807 Binary files /dev/null and b/src/logo-hochschule-bochum-cvh-text.pdf differ diff --git a/src/os-layers.xcf.gz b/src/os-layers.xcf.gz new file mode 100644 index 0000000000000000000000000000000000000000..33b9c21bb687417dc59909158c89455d386e2d8e Binary files /dev/null and b/src/os-layers.xcf.gz differ diff --git a/src/pgslides.sty b/src/pgslides.sty new file mode 100644 index 0000000000000000000000000000000000000000..ba8c0f9818fbb1467c288a871600b40191e5cc7f --- /dev/null +++ b/src/pgslides.sty @@ -0,0 +1,168 @@ +% pgslides.sty - LaTeX Settings for Lecture Slides +% Copyright (C) 2012, 2013 Peter Gerwinski +% +% This document is free software: you can redistribute it and/or +% modify it either under the terms of the Creative Commons +% Attribution-ShareAlike 3.0 License, or under the terms of the +% GNU General Public License as published by the Free Software +% Foundation, either version 3 of the License, or (at your option) +% any later version. +% +% This document is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this document. If not, see <http://www.gnu.org/licenses/>. +% +% You should have received a copy of the Creative Commons +% Attribution-ShareAlike 3.0 Unported License along with this +% document. If not, see <http://creativecommons.org/licenses/>. + +\usepackage[latin1]{inputenc} +\usepackage[german]{babel} +\usepackage[T1]{fontenc} +\usepackage{helvet} +\renewcommand*\familydefault{\sfdefault} + +\usetheme{default} +\usefonttheme{structurebold} +\setbeamertemplate{navigation symbols}{} +\setbeamersize{text margin left = 0.3cm, text margin right = 0.2cm} +\setbeamertemplate{itemize item}{$\bullet$} +\setbeamertemplate{itemize subitem}{--} +\setbeamerfont{itemize/enumerate subbody}{size=\normalsize} +\setbeamerfont{itemize/enumerate subsubbody}{size=\normalsize} +\setbeamercolor{footline}{fg=gray} + +\newcommand{\sep}{~$\cdot$~} + +\institute[Hochschule Bochum\sep CVH]{% + \makebox(0,0)[tl]{\includegraphics[scale=0.57]{logo-hochschule-bochum-cvh-text.pdf}}\hfill + \makebox(0,0)[tr]{\includegraphics[scale=0.5]{logo-hochschule-bochum.pdf}}% +} + +\iffalse + \setbeamertemplate{footline}{} +\else + \setbeamertemplate{footline}{% + \leavevmode% + \hbox to \textwidth{% + \usebeamercolor{footline}% + \usebeamerfont{footline}% + \iftrue + \strut\hfill + \else + \,\insertshorttitle\sep + \insertshortauthor\sep + \insertshortinstitute\sep + \insertshortdate\hfill + \fi + Folie\,\insertframenumber\sep Seite\,\insertpagenumber\, + }% + \vskip0pt% + } +\fi + +\newcommand{\maketitleframe}{% + \begin{frame}[t,plain] + \insertinstitute + \par\vfill + \begin{center} + {\LARGE\color{structure}\inserttitle}\\[2\bigskipamount] + {\large \insertauthor}\\[1.5\bigskipamount] + \insertdate + \end{center} + \end{frame} +} + +\usepackage{pstricks} +\newrgbcolor{lightyellow}{0.95 0.85 0.0} +\newrgbcolor{lightorange}{1.0 0.7 0.0} +\newrgbcolor{lightgreen}{0.0 0.8 0.0} +\newrgbcolor{medgreen}{0.0 0.5 0.0} +\newrgbcolor{darkgreen}{0.0 0.3 0.0} +\newrgbcolor{lightred}{1.0 0.7 0.7} +\newrgbcolor{lightgray}{0.85 0.85 0.85} +\definecolor{darkgray}{rgb}{0.4,0.4,0.4} + +\newenvironment{experts}{\color{darkgray}}{} +\catcode`\_=13\def_{\kern1pt\rule{0.4em}{0.9pt}\kern1pt}\catcode`\_=8 +\catcode`\/=13\def/#1{\ifx#1/\char`\/\kern-2pt\char`\/\else\char`\/#1\fi}\catcode`\/=12 +\renewcommand{\url}[1]{{\color{structure}\catcode`~=12\catcode`##=12\catcode`_=13\catcode`/=13\textsf{#1}}} + +\usepackage{listings} +\lstset{basicstyle=\color{structure}, + language=C, + captionpos=b, + gobble=4, + columns=fullflexible, + aboveskip=0pt, + belowskip=0pt, + moredelim=**[is][\color{structure}]{�}{�}, + moredelim=**[is][\only<2->{\color{structure}}]{�}{�}, + moredelim=**[is][\only<3->{\color{structure}}]{�}{�}, + moredelim=**[is][\only<4->{\color{structure}}]{�}{�}, + moredelim=**[is][\only<5->{\color{structure}}]{�}{�}, + moredelim=**[is][\only<6->{\color{structure}}]{�}{�}, + moredelim=**[is][\only<7->{\color{structure}}]{�}{�}, + moredelim=**[is][\only<8->{\color{structure}}]{�}{�}} +\lstdefinestyle{terminal}{basicstyle=\ttfamily\color{darkgreen}, + language={}, + columns=fixed, + moredelim=**[is][\color{red}]{�}{�}, + moredelim=**[is][\color{blendedblue}]{�}{�}, + moredelim=**[is][\sffamily\it\lstset{columns=fullflexible}]{�}{�}} +\lstdefinestyle{cmd}{basicstyle=\ttfamily\color{red}, + language={}, + gobble=2, + columns=fixed, + moredelim=**[is][\color{darkgreen}]{�}{�}, + moredelim=**[is][\color{structure}]{�}{�}, + moredelim=**[is][\sffamily\it\lstset{columns=fullflexible}]{�}{�}} +\lstdefinestyle{shy}{basicstyle=\color{lightgray}} + +\setcounter{topnumber}{3} +\renewcommand\topfraction{0.7} +\setcounter{bottomnumber}{3} +\renewcommand\bottomfraction{0.7} +\setcounter{totalnumber}{5} +\renewcommand\textfraction{0.1} +\renewcommand\floatpagefraction{0.9} + +\setlength{\unitlength}{1cm} + +\newcommand{\protectfile}[1]{#1} +\newcommand{\file}[1]{{\color{structure}\protectfile{#1}}} +\newcommand{\textarrow}{{\boldmath $\longrightarrow$}} +\newcommand{\arrowitem}{\item[\textarrow]} +\newcommand{\newterm}[1]{\emph{\color{darkgreen}#1}} +\newcommand{\BIGskip}{\vspace{1cm}} +\newcommand{\shy}{\color{lightgray}} +\newcommand{\hot}{\color{red}} +\newcommand{\shyhot}{\color{lightred}} + +\newcommand{\sectionnonumber}[1]{\section{#1}\addtocounter{section}{-1}} + +\def\showsectionnonumber{{\Large\color{structure}\bf\secname\par}\bigskip} + +\def\showsection{\hbox{\Large\color{structure}\bf + \vtop{\hbox{\arabic{section}}}\kern1em% + \vtop{\secname}\par}\bigskip} + +\newcommand{\subsectionnonumber}[1]{\subsection{#1}\addtocounter{subsection}{-1}} + +\def\showsubsectionnonumber{{\large\color{structure}\bf\subsecname\par}\bigskip} + +\def\showsubsection{\hbox{\large\color{structure}\bf + \vtop{\hbox{\arabic{section}.\arabic{subsection}}}\kern1em% + \vtop{\subsecname}\par}\bigskip} + +\newcommand{\subsubsectionnonumber}[1]{\subsubsection{#1}\addtocounter{subsubsection}{-1}} + +\def\showsubsubsectionnonumber{{\normalsize\color{structure}\bf\subsubsecname\par}\bigskip} + +\def\showsubsubsection{\hbox{\normalsize\color{structure}\bf + \vtop{\hbox{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}}\kern1em% + \vtop{\subsubsecname}\par}\bigskip}