veganism.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Veganism Social is a welcoming space on the internet for vegans to connect and engage with the broader decentralized social media community.

Administered by:

Server stats:

233
active users

#stdio

0 posts0 participants0 posts today
Felix Palmen :freebsd: :c64:<p>This, btw, was yet another reminder of the horrible can of worms <a href="https://mastodon.bsd.cafe/tags/stdio" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>stdio</span></a>'s <a href="https://mastodon.bsd.cafe/tags/buffering" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>buffering</span></a> is.</p><p>I created a little tool running as a child process to do the *actual* <a href="https://mastodon.bsd.cafe/tags/PAM" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>PAM</span></a> authentication, so it will be possible to have this run as root while the real service drops all privileges. This little tool uses a simple line-based protocol for communication on stdin/stdout. It worked well when testing directly on the terminal.</p><p>On the first real test though, my service just went hanging. 🙄 I suspected a deadlock caused by pthread mutexes. Wasted quite some time looking into that. Then I finally realized communication over the pipes was stalled.</p><p>Ok, just set buffering mode to "line buffering" after fdopen'ing the <a href="https://mastodon.bsd.cafe/tags/pipe" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>pipe</span></a>. Turned out that didn't help either. I *assume* that even in the child process, the stdio streams automatically created on the pipes were somehow fully buffered. But at that point, I was really fed up with trial and error and rewrote the whole mess to do I/O using plain <a href="https://mastodon.bsd.cafe/tags/POSIX" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>POSIX</span></a> APIs (read, write), sidestepping any buffering. Worked like a charm. 🙈 </p><p><a href="https://mastodon.bsd.cafe/tags/C" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>C</span></a> <a href="https://mastodon.bsd.cafe/tags/coding" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>coding</span></a></p>
Jons Mostovojs<p>I quietly posted a practical deep-dive into <a href="https://social.doma.dev/tags/Linux" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Linux</span></a> <a href="https://social.doma.dev/tags/STDIO" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>STDIO</span></a>.</p><p>Please don't share this post anywhere outside of Mastodon yet, but criticise its flow and narrative structure.</p><p>It's a loaded topic, so I had to choose the things that are the most important for complete understanding of STDIO and its behaviour, with the aim of demystifying the concept.</p><p><a href="https://memorici.de/posts/make-or-break-stdio" rel="nofollow noopener" target="_blank"><span class="invisible">https://</span><span class="ellipsis">memorici.de/posts/make-or-brea</span><span class="invisible">k-stdio</span></a></p>