Skip to content
Snippets Groups Projects
Commit d79358f9 authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Notizen zu den Lehrveranstaltungen vom 11. und 18. Mai 2015

parent a1098446
No related branches found
No related tags found
No related merge requests found
Verzeichnis: Linux-Quelltext
$ find . -name "*syscall*"
$ vi -R ./arch/x86/kernel/syscall_64.c
--> Definition von "sys_call_table" über wiederholte Includes
$ find . -name syscalls_64.h
$ vi -R ./arch/sh/include/asm/syscalls_64.h
$ vi -R ./arch/x86/um/shared/sysdep/syscalls_64.h
--> beides nicht sehr erhellend
$ locate syscalls_64.h
$ vi -R /usr/src/linux-headers-3.16.0-4-amd64/arch/x86/include/generated/asm/syscalls_64.h
$ grep -R syscalls_64\.h *
$ vi -R arch/x86/syscalls/Makefile
$ find . -name syscall_64.tbl
$ vi -R ./arch/x86/syscalls/syscall_64.tbl
--> :-)
$ vi -R ./arch/x86/kernel/syscall_64.c
--> Die 2. Spalte ("sym") bezeichnet den Funktionsnamen.
- Wie findet der "syscall"-Befehl die Tabelle?
- Wo wird die Funktion deklariert?
$ grep -R sys_call_table arch/x86/*
$ vi -R arch/x86/kernel/entry_64.S
--> :-)
$ grep -wr write *
--> :-(
# DuckDuckGo --> http://www.usmanacademy.com/2012/07/linux-system-call-implementation.html
$ find . -name "*write*"
$ vi -R ./fs/read_write.c
--> SYSCALL_DEFINE3(write, ...)
struct fd
vfs_write()
$ vi -R include/linux/file.h
--> struct file *file;
$ grep -r "struct file {" $(find . -name "*.h")
$ vi -R ./include/linux/fs.h
--> const struct file_operations *f_op;
--> ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
--> :-)
$ vi -R ./fs/read_write.c
--> vfs_write():
if (file->f_op->write)
ret = file->f_op->write(file, buf, count, pos);
Beim Öffnen der Datei werden die file_operations in der struct file hinterlegt.
Skript, 11.05.2015, 13:58:25
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- \usepackage{hyperref}
- Daemon schreibt in log-Datei: In welche?
sprintf, 11.05.2015, 14:49:56
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
char buf[42];
sprintf (buf, "%s", "Hello");
sprintf (buf + 5, "%s\n", ", world!");
oder besser:
sprintf (buf + strlen (buf), "%s\n", ", world!");
Merlin Klaßen, 18.05.2015, 11:38:37
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
device_write()
cdev_init()
cdev_add()
device_create()
device_destroy()
class_destroy()
cdev_del()
--> Der udev-deamon kümmert sich um das Anlegen und Entfernen der char-Device.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment