5 ms·
The funny thing is that I was literally just wondering about how shells are implemented right before getting on HN. Thanks for sharing, this should prove most u
by hackeradam17 10y ago
The funny thing is that I was literally just wondering about how shells are implemented right before getting on HN. Thanks for sharing, this should prove most useful :)
- deleted 10y ago[deleted]
- rhinoceraptor 10y agoIt's also shocking how simple pipes and redirection are. You just use the dup2 syscall to arrange file descriptors.
- csl 10y agoIf you often wonder about such things, I highly recommend the book "Advanced programming in the UNIX environment" by Stevens/Rago: https://en.m.wikipedia.org/wiki/Advanced_Programming_in_the_Unix_Environment https://en.m.wikipedia.org/wiki/Advanced_Programming_in_the_... It covers a lot of stuff in an authoritative way. For example, how one should implement a daemon properly (e.g., chdir to root to allow for unmounting the disk the program originally ran from, lots of stuff like that). I'll actually doubly recommend it, because it's so good.
- Nullabillity 10y agoOf course, a lot of the daemon boilerplate no longer really applies in the modern systemd world.
- JdeBP 10y agoIt didn't in fact apply to a sizeable portion of the pre-systemd world, either. systemd doco gives the quite false impression that this stuff is new, for "new-style daemons". Not using this boilerplate has been the right way to write daemons for many systems over the past quarter century, going back to the release of the IBM System Resource Controller at the beginning of the 1990s.