How to Write a Linux Daemon from Start to Finish!

Опубликовано: 24 Март 2025
на канале: hoff._world
91,757
4k

Linux Daemons, Services, whatever you wanna call em. Let's make one! We're going to make a file event watcher with inotify that sends desktop notifications to the user.

Multithreaded socket server tutorial:    • How to Write a Socket Server from Sta...  
Custom network protocol tutorial:    • Implementing a Network Protocol in C ...  

inotify man page: https://man7.org/linux/man-pages/man7...
libnotify docs: https://developer-old.gnome.org/libno...
archwiki notify: https://wiki.archlinux.org/title/Desk...

rolexhound src: https://hoff.industries/files/rolexho...

Editor: Kate (xoxo KDE)
Colours: Dracula
LSP Server: clangd

Chapters:
0:00 - Intro
1:07 - What is our Daemon going to do?
2:02 - Libraries and System Calls
5:25 - Project Naming
6:09 - Including Headers
6:54 - Exit Codes
7:45 - Shell Arguments
9:22 - Sprinkling of Memory Management
13:50 - Daemon Main Loop
14:45 - File Events with Inotify
16:00 - Blocking vs Non-blocking Operations
17:05 - Initialising Inotify
20:00 - Introduction to Bitmasking
21:29 - What Filesystem Events can we monitor?
22:07 - Watching a file with Inotify
24:40 - Handling Inotify Events
37:05 - Wiring it up to Desktop Notifications
44:30 - Testing Desktop Notifications
45:25 - Testing with Accessing an SSH Identity
45:58 - Signal Handling and Shutdown Handling
49:25 - Summary and Outro