What controls the buffering of stdout stderr? Announcing the arrival of Valued Associate #679:...

Kepler's 3rd law: ratios don't fit data

Can gravitational waves pass through a black hole?

Can the van der Waals coefficients be negative in the van der Waals equation for real gases?

Should man-made satellites feature an intelligent inverted "cow catcher"?

Compiling and throwing simple dynamic exceptions at runtime for JVM

Trying to enter the Fox's den

Why does BitLocker not use RSA?

How can I introduce the names of fantasy creatures to the reader?

Etymology of 見舞い

Why is one lightbulb in a string illuminated?

What *exactly* is electrical current, voltage, and resistance?

Why aren't road bike wheels tiny?

Why isn't everyone flabbergasted about Bran's "gift"?

Can I take recommendation from someone I met at a conference?

How was Lagrange appointed professor of mathematics so early?

Knights and Knaves question

How to mute a string and play another at the same time

Proving inequality for positive definite matrix

2 sample t test for sample sizes - 30,000 and 150,000

What's the difference between using dependency injection with a container and using a service locator?

What is the evidence that custom checks in Northern Ireland are going to result in violence?

Why do people think Winterfell crypts is the safest place for women, children & old people?

Like totally amazing interchangeable sister outfit accessory swapping or whatever

Is Bran literally the world's memory?



What controls the buffering of stdout stderr?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionTurn off buffering in pipeHow to control buffering of pipes in bash scripts?Make stdout and stderr be buffered by the same bufferwhat is meant by connecting STDOUT and STDIN?`unbuffer` or `stdbuf` for removing stdout buffering?What is regarded as “ideal” in relation to using stdout/stderr for output in different situations?non-blocking/multi-threaded catPrint stderr only if nothing gets written to stdout, otherwise print just stdout discarding stderrDo progress reports/logging information belong on stderr or stdout?What is the state of the standard I/O stream while issuing a command?What are two caveats of line buffering in Unix?What prevents stdout/stderr from interleaving?Confusion about stdout and stderr on the start-up terminal





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















What part of the system sets up the buffering of the three standard streams when a program is started?



Is this part of linux, or glibc, or maybe bash? Does POSIX define the behaviour, or is it part of C?



Posix has some answers:




https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_05



At program start-up, three streams are predefined and need not be
opened explicitly: standard input (for reading conventional input),
standard output (for writing conventional output), and standard error
(for writing diagnostic output). When opened, the standard error
stream is not fully buffered; the standard input and standard output
streams are fully buffered if and only if the stream can be determined
not to refer to an interactive device.




So if the system can determine that streams are NOT interactive, they CAN be fully buffered (except stderr), but in practice what part of the system does this determining?










share|improve this question

























  • Some similar questions that don't quite touch the right points:

    – Evan Benn
    4 hours ago











  • unix.stackexchange.com/questions/56634 unix.stackexchange.com/questions/25372 unix.stackexchange.com/questions/116453

    – Evan Benn
    4 hours ago






  • 1





    Start here

    – Thomas Dickey
    4 hours ago











  • is your question specifically about the stdio buffering? Then please add the stdio tag. Notice that many programs don't do any userland buffering (eg. cat), and other programs do their own, different from and bypassing stdio (eg. PerlIO in perl).

    – mosvy
    2 hours ago











  • It would be completely different for different types of file. The kernel do have buffer mechanism, but userspace usually have option to open that file with kernel buffer disabled and do its own userspace buffering

    – 炸鱼薯条德里克
    2 hours ago


















0















What part of the system sets up the buffering of the three standard streams when a program is started?



Is this part of linux, or glibc, or maybe bash? Does POSIX define the behaviour, or is it part of C?



Posix has some answers:




https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_05



At program start-up, three streams are predefined and need not be
opened explicitly: standard input (for reading conventional input),
standard output (for writing conventional output), and standard error
(for writing diagnostic output). When opened, the standard error
stream is not fully buffered; the standard input and standard output
streams are fully buffered if and only if the stream can be determined
not to refer to an interactive device.




So if the system can determine that streams are NOT interactive, they CAN be fully buffered (except stderr), but in practice what part of the system does this determining?










share|improve this question

























  • Some similar questions that don't quite touch the right points:

    – Evan Benn
    4 hours ago











  • unix.stackexchange.com/questions/56634 unix.stackexchange.com/questions/25372 unix.stackexchange.com/questions/116453

    – Evan Benn
    4 hours ago






  • 1





    Start here

    – Thomas Dickey
    4 hours ago











  • is your question specifically about the stdio buffering? Then please add the stdio tag. Notice that many programs don't do any userland buffering (eg. cat), and other programs do their own, different from and bypassing stdio (eg. PerlIO in perl).

    – mosvy
    2 hours ago











  • It would be completely different for different types of file. The kernel do have buffer mechanism, but userspace usually have option to open that file with kernel buffer disabled and do its own userspace buffering

    – 炸鱼薯条德里克
    2 hours ago














0












0








0








What part of the system sets up the buffering of the three standard streams when a program is started?



Is this part of linux, or glibc, or maybe bash? Does POSIX define the behaviour, or is it part of C?



Posix has some answers:




https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_05



At program start-up, three streams are predefined and need not be
opened explicitly: standard input (for reading conventional input),
standard output (for writing conventional output), and standard error
(for writing diagnostic output). When opened, the standard error
stream is not fully buffered; the standard input and standard output
streams are fully buffered if and only if the stream can be determined
not to refer to an interactive device.




So if the system can determine that streams are NOT interactive, they CAN be fully buffered (except stderr), but in practice what part of the system does this determining?










share|improve this question
















What part of the system sets up the buffering of the three standard streams when a program is started?



Is this part of linux, or glibc, or maybe bash? Does POSIX define the behaviour, or is it part of C?



Posix has some answers:




https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_05



At program start-up, three streams are predefined and need not be
opened explicitly: standard input (for reading conventional input),
standard output (for writing conventional output), and standard error
(for writing diagnostic output). When opened, the standard error
stream is not fully buffered; the standard input and standard output
streams are fully buffered if and only if the stream can be determined
not to refer to an interactive device.




So if the system can determine that streams are NOT interactive, they CAN be fully buffered (except stderr), but in practice what part of the system does this determining?







linux stdout stderr buffer






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 6 secs ago







Evan Benn

















asked 4 hours ago









Evan BennEvan Benn

1184




1184













  • Some similar questions that don't quite touch the right points:

    – Evan Benn
    4 hours ago











  • unix.stackexchange.com/questions/56634 unix.stackexchange.com/questions/25372 unix.stackexchange.com/questions/116453

    – Evan Benn
    4 hours ago






  • 1





    Start here

    – Thomas Dickey
    4 hours ago











  • is your question specifically about the stdio buffering? Then please add the stdio tag. Notice that many programs don't do any userland buffering (eg. cat), and other programs do their own, different from and bypassing stdio (eg. PerlIO in perl).

    – mosvy
    2 hours ago











  • It would be completely different for different types of file. The kernel do have buffer mechanism, but userspace usually have option to open that file with kernel buffer disabled and do its own userspace buffering

    – 炸鱼薯条德里克
    2 hours ago



















  • Some similar questions that don't quite touch the right points:

    – Evan Benn
    4 hours ago











  • unix.stackexchange.com/questions/56634 unix.stackexchange.com/questions/25372 unix.stackexchange.com/questions/116453

    – Evan Benn
    4 hours ago






  • 1





    Start here

    – Thomas Dickey
    4 hours ago











  • is your question specifically about the stdio buffering? Then please add the stdio tag. Notice that many programs don't do any userland buffering (eg. cat), and other programs do their own, different from and bypassing stdio (eg. PerlIO in perl).

    – mosvy
    2 hours ago











  • It would be completely different for different types of file. The kernel do have buffer mechanism, but userspace usually have option to open that file with kernel buffer disabled and do its own userspace buffering

    – 炸鱼薯条德里克
    2 hours ago

















Some similar questions that don't quite touch the right points:

– Evan Benn
4 hours ago





Some similar questions that don't quite touch the right points:

– Evan Benn
4 hours ago













unix.stackexchange.com/questions/56634 unix.stackexchange.com/questions/25372 unix.stackexchange.com/questions/116453

– Evan Benn
4 hours ago





unix.stackexchange.com/questions/56634 unix.stackexchange.com/questions/25372 unix.stackexchange.com/questions/116453

– Evan Benn
4 hours ago




1




1





Start here

– Thomas Dickey
4 hours ago





Start here

– Thomas Dickey
4 hours ago













is your question specifically about the stdio buffering? Then please add the stdio tag. Notice that many programs don't do any userland buffering (eg. cat), and other programs do their own, different from and bypassing stdio (eg. PerlIO in perl).

– mosvy
2 hours ago





is your question specifically about the stdio buffering? Then please add the stdio tag. Notice that many programs don't do any userland buffering (eg. cat), and other programs do their own, different from and bypassing stdio (eg. PerlIO in perl).

– mosvy
2 hours ago













It would be completely different for different types of file. The kernel do have buffer mechanism, but userspace usually have option to open that file with kernel buffer disabled and do its own userspace buffering

– 炸鱼薯条德里克
2 hours ago





It would be completely different for different types of file. The kernel do have buffer mechanism, but userspace usually have option to open that file with kernel buffer disabled and do its own userspace buffering

– 炸鱼薯条德里克
2 hours ago










0






active

oldest

votes












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f513926%2fwhat-controls-the-buffering-of-stdout-stderr%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f513926%2fwhat-controls-the-buffering-of-stdout-stderr%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...