From: Corinna Vinschen <vinschen@redhat.com>
To: newlib@sourceware.org
Subject: Re: [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init()
Date: Fri, 23 Jun 2017 14:02:00 -0000 [thread overview]
Message-ID: <20170623140231.GE18863@calimero.vinschen.de> (raw)
In-Reply-To: <20170623092259.29325-2-sebastian.huber@embedded-brains.de>
[-- Attachment #1: Type: text/plain, Size: 1588 bytes --]
Hi Sebastian,
On Jun 23 11:22, Sebastian Huber wrote:
> This simplifies further changes in this area.
>
> Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
> ---
> newlib/libc/stdio/findfp.c | 50 ++++++++++++++++++++++++++++++----------------
> 1 file changed, 33 insertions(+), 17 deletions(-)
>
> diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
> index ecc65d6d3..601795098 100644
> --- a/newlib/libc/stdio/findfp.c
> +++ b/newlib/libc/stdio/findfp.c
> @@ -84,6 +84,36 @@ _DEFUN(std, (ptr, flags, file),
> #endif
> }
>
> +static void
> +stdin_init(FILE *ptr)
> +{
> + std (ptr, __SRD, 0);
> +}
> +
> +static void
> +stdout_init(FILE *ptr)
> +{
> + /* On platforms that have true file system I/O, we can verify
> + whether stdout is an interactive terminal or not, as part of
> + __smakebuf on first use of the stream. For all other platforms,
> + we will default to line buffered mode here. Technically, POSIX
> + requires both stdin and stdout to be line-buffered, but tradition
> + leaves stdin alone on systems without fcntl. */
> +#ifdef HAVE_FCNTL
> + std (ptr, __SWR, 1);
> +#else
> + std (ptr, __SWR | __SLBF, 1);
> +#endif
> +}
> +
> +static void
> +stderr_init(FILE *ptr)
> +{
> + /* POSIX requires stderr to be opened for reading and writing, even
> + when the underlying fd 2 is write-only. */
> + std (ptr, __SRW | __SNBF, 2);
> +}
>. +
Perhaps these func should be inline?
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2017-06-23 14:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-23 9:23 [PATCH 1/3] Remove superfluous parameter from std() Sebastian Huber
2017-06-23 9:23 ` [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init() Sebastian Huber
2017-06-23 14:02 ` Corinna Vinschen [this message]
2017-06-26 6:15 ` Sebastian Huber
2017-06-26 6:24 ` Sebastian Huber
2017-06-26 8:22 ` Corinna Vinschen
2017-06-23 9:23 ` [PATCH 3/3] Introduce _REENT_GLOBAL_STDIO_STREAMS Sebastian Huber
2017-06-23 21:53 ` Freddie Chopin
2017-06-26 5:59 ` Sebastian Huber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170623140231.GE18863@calimero.vinschen.de \
--to=vinschen@redhat.com \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).