This blog post is about a Linux mechanism called proc connector that allows you to get asynchronous notifications about different events on a Linux OS. This post is an important milestone for me: My first post to be officially released in my new, self-owned blog trugman-internals, pretty exciting! But that’s not all, this post marks the beginning of a new library: Runtime Collection Interfaces (RCI). An awesome request from a Redditor gave birth to the idea of wrapping additional mechanisms in Linux.
-> Link to the library on Github I’m writing C++ code for Unix environments for almost a decade now. And the funny thing is that in the last five years, while working for three different companies, I had to write a new procfs parsing library every time. All those companies were developing security products monitoring applications running on Linux machines, so using the procfs was inevitable. But over time, necessity became great admiration.
One of the best aspects of my day to day work is that I get to discover many hidden Linux gems, and this case was no different. I was toying around with some ideas when I stumbled upon what seemed to be a relatively insignificant feature, yet another esoteric method some hardcore file-systems developer added when he needed an extra flag to tweak and squeeze some extra mips. I would’ve probably skipped it without looking back and overthinking it, but by now I’ve learned that this is the best way to explore the mysteries of my beloved OS.
The target of the following stream of ASCII characters is to shed some light on an area that is probably not common knowledge even for experienced system developers: loaders, libraries and executables in the ELF Linux ecosystem. First, we’ll try to understand what happens when we run a basic program on our Linux machine. Then we’ll discuss libraries and what they bring to the table. Cover the differences between static and dynamic libraries and executables, and finally dive into the inner-works of the dynamic loader, learning how to control, configure and manipulate it.
In this blog post, I’m going to show a super easy yet incredibly powerful implementation of Go’s defer concept in C++. (Originally published on Medium.com, 06-Feb-2019) Every time I read about a new system-programming language, I’m enthused about the possibility of learning cool concepts. Those languages are designed from scratch by groups of super-capable engineers with an accumulated experience of hundreds of years in order to create the “best” ecosystem possible for this kind of programming.
Have you ever tried to dwell into the mysteries of Unix’s User IDs? Well if you have, I guess you probably found yourself with a headache. Every conversation I recall having in the office about edge cases and weird scenarios related with UIDs concluded with the phrase “Is this even possible?”. Today, we’ll try to make some sense out of it, including some interesting examples & suggestions. But first, we owe ourselves a quick recap to paint a complete picture.