@david_chisnall

You've built a argument on the assumption of binary incompatibility, but in fact there was none.

There was no layout change nor symbol name changes.

The struct layout stayed entirely the same. The struct definition merely moved from one header to another and replaced the declarations of some members with external library types rather than their underscored aliases that standard headers use.

The thing that would have introduced binary incompatibility, which #OpenBSD has had to deal with this year, #FreeBSD had already done 7 years earlier back in 2001, and is still the case now.

By 2008, it was just moving struct definitions out of a standard header and removing "inline" macros. The one thing in base that that broke in 2008 (because of *source* incompatibility) went away in 2011, and Jordan Hubbard patched some stuff in ports a decade ago.

It is entirely feasible in 2025 for FreeBSD to regain parity with OpenBSD quite simply.

#stdio #StandardC #OpaqueTypes

Making sure you're not a bot!

stdio(3) change: FILE is now opaque

This, btw, was yet another reminder of the horrible can of worms #stdio's #buffering is.

I created a little tool running as a child process to do the *actual* #PAM 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.

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.

Ok, just set buffering mode to "line buffering" after fdopen'ing the #pipe. 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 #POSIX APIs (read, write), sidestepping any buffering. Worked like a charm. 🙈

#C #coding

I quietly posted a practical deep-dive into #Linux #STDIO.

Please don't share this post anywhere outside of Mastodon yet, but criticise its flow and narrative structure.

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.

https://memorici.de/posts/make-or-break-stdio

All You Wanted to Know About STDIO - memoricide

Memoricide

@lattera
I'm not an OpenBSD developer, so I would be mis-understanding, but if I design the pledge functionality, maybe I would do the same.

close() is basically tied with open(), with some exceptions, stdin, stdout and stderr.
These 3 are opened on process initialization, by default for at least programs by C.

My guess (never actually used, though) with pledge is that it's not initialized on compilation time, but runtime. So the default 3 "files" are already opened when the code initializes pledge. And in some cases, any of there 3 are closed after the process starts. More, these 3 belongs to stdio. So close() should require stdio, or something it belongs to. Just corelated open() is hidden in crt1.o made it overly confusing.

Correct me if I'm mis-understanding.

#OpenBSD #pledge #close #stdio

[Перевод] Оптимизируя неоптимизируемое: ускорение компиляции C++

В этой статье речь пойдёт о повышении скорости компиляции библиотеки {fmt} до уровня библиотеки ввода-вывода Cи stdio . Дня начала немного теории. {fmt} – это популярная открытая библиотека С++, представляющая более эффективную альтернативу С++ библиотеке iostreams и библиотеке Си stdio . Последнюю она обошла по целому ряду аспектов: Безопасность типов с проверками форматирующих строк во время компиляции . Эти проверки включены по умолчанию начиная с С++ 20, и присутствуют в качестве дополнения для С++ 14/17. Форматирующие строки среды выполнения в {fmt} также оказываются безопасными, чего невозможно достичь в printf . Расширяемость . Определяемый пользователем тип можно сделать форматируемым . При этом большинство типов стандартных библиотек, например, контейнеры и пакеты для обработки даты и времени, предлагают возможность форматирования изначально. Производительность . {fmt} намного быстрее любой распространённой реализации printf , порой на несколько порядков (например, в форматировании чисел с плавающей запятой ). Возможность переноса поддержки Unicode . Тем не менее одной из областей, в которой stdio по-прежнему опережала {fmt} , являлось время компиляции.

https://habr.com/ru/companies/ruvds/articles/785420/

#ruvds_перевод ++ #си #fmt #стандартные_библиотеки #оптимизация #компиляция #stdio

Оптимизируя неоптимизируемое: ускорение компиляции C++

В этой статье речь пойдёт о повышении скорости компиляции библиотеки {fmt} до уровня библиотеки ввода-вывода Cи stdio . Дня начала немного теории. {fmt} – это популярная открытая библиотека С++,...

Хабр

Working with data streams on the #Linux command line – David Both #stdio

https://www.both.org/?p=3101

Working with data streams on the Linux command line

Learn to connect data streams from one utility to another using STDIO. Everything in Linux revolves around streams of data—particularly text streams. Data streams are the raw materials upon which t…

David Both
Implement Stdio Channel by schrieveslaach · Pull Request #187 · SonarSource/sonarlint-language-server

This PR adds support for serving the language over stdio channel which is the default communication channel in tools such as Neovim. That use case has been also reported in the forum (see here). Th...

GitHub