3 ms·
Half of this article discusess pipe buffer size, which is an internal implementation detail you should not rely on. In general, the "portable approach to pick t
by theamk 5y ago
Half of this article discusess pipe buffer size, which is an internal implementation detail you should not rely on. In general, the "portable approach to pick the buffer size with guaranteed atomic writes" is to structure your program so you don't need atomic writes.
Pipes are byte-oriented channels and you should treat them as such. If you need to send atomic units of data, use packet-oriented channels, like AF_UNIX sockets in SOCK_DGRAM/SOCK_SEQPACKET mode.
Or use application-level packet delimiter.. a newline character is a traditional choice.
(And the second part shows some very questionable practices.. using static variables for no reason, weird argv[0] mangling)
You should avoid this blog if you are the beginner.