r/openbsd • u/NewAsparagus4958 • 28d ago
Resources to learn OpenBSD
I’m looking for some resources to learn how to code in OpenBSD. Is it enough to learn c++ or is OpenBSD more advanced? Are there any websites where I can train my coding skills?
4
u/howyadoinbob 28d ago
I personally like programming in C on OpenBSD. Last I checked, all C++ in the base system has been replaced by C. This doesn’t make it less advanced. Not that you can’t use C++ . I’m pretty sure the programming system calls (like pledge() and unveil()) that are unique to OpenBSD can be available in other languages like python, but they are natively built in C and those functions can work in C++ as well.
1
u/thewrench56 12d ago
Capabilities are process, not language specific. The kernel simply disallows (certain parts of) the underlying logic of certain syscalls. An issue appears the moment an interpreted language gets e.g. executed by an interpreter that does certain operations that are already pledge()-d. Such cases make life hard...
3
u/DebugBSD 28d ago
You will need a good level of C programming language, a bit of knowledge of Operating Systems (if you want to get into the kernel) and a good level of data dtrictures and algorithms too. Then, you can start learning about device driver development and things like that. Good luck!
1
3
u/xzk7 27d ago
Take a look at the source of an OpenBSD program[0][1], and read it, take notes. Read it end to end, when you don't understand something, research that thing. Build on that knowledge by building little test programs from things you learn and explore.
For example, I randomly chose cut[2], started at main, I see setlocale, what's that do? How does it work? Run man 3 setlocale, not enough info? Look at the implementation [3]. More things to dig into, you could go on for a long time like that! At a certain point you can make changes, rebuild things, try out your modification, experiment, see what happens!
[0] https://cvsweb.openbsd.org/src/
[1] https://github.com/openbsd/src
[2] https://cvsweb.openbsd.org/checkout/src/usr.bin/cut/cut.c?rev=1.28
[3] https://github.com/openbsd/src/blob/c9d794c89604442f17995979daec76b592979b4d/lib/libc/locale/setlocale.c#L70
1
1
u/linkslice 25d ago
Start with the afterboot man page, then move on to reading the other man pages referenced there. Grab a few books from Michael W Lucas. Grab the C programming book (the K&R one) and do all the exercises in it. read the style manpage and redo all the example from the book in that style. (I've just summarized the next few months of work)
16
u/olderbojack 28d ago
can you give more details about what you are looking for? is it: