mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: question: hard-coded file descriptors in stdin/stdout/stderr
Date: Thu, 14 Mar 2013 18:17:52 +0100	[thread overview]
Message-ID: <20130314171752.GB19010@port70.net> (raw)
In-Reply-To: <5141F86D.8010000@eservices.virginia.edu>

* Zvi Gilboa <zg7s@eservices.virginia.edu> [2013-03-14 12:18:53 -0400]:
> I just noticed that the file descriptors in stdin.c, stdout.c, and
> stderr.c do not use the #defines from <unistd.h> (namely
> STDIN_FILENO, STDOUT_FILENO, and STDERR_FILENO), but are rather
> hard-coded (as 0, 1, and 2 respectively).  I was therefore wondering

these numbers are fixed on posix (and linux and all historical unices)

the macro definitions are there for conformance reasons

it's like using 0 instead of NULL or -1U instead of UINT_MAX


> this would normally not be an issue, however there are still some
> systems out there with standard file descriptor numbers which are
> different...

which ones?

> On that same note: wouldn't it make sense to slightly modify
> unistd.h so that it first checks whether STDIN_FILENO, etc. have

i dont think it makes sense for a linux libc
to have these numbers configurable


  reply	other threads:[~2013-03-14 17:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14 16:18 Zvi Gilboa
2013-03-14 17:17 ` Szabolcs Nagy [this message]
2013-03-14 17:51   ` Zvi Gilboa
2013-03-14 18:17     ` Szabolcs Nagy
2013-03-14 19:34       ` Zvi Gilboa
     [not found]     ` <CAFipMOE4xkYBYb1rEDtB0T8+Nfgs9cEG_=Va1=PKN4H6CLDHMw@mail.gmail.com>
2013-03-14 19:57       ` Zvi Gilboa
2013-03-15  8:33     ` Rich Felker
2013-03-15 11:43       ` LM
2013-03-15 14:46       ` Zvi Gilboa
2013-03-15 18:43         ` Rich Felker
2013-03-15 18:55           ` Zvi Gilboa
2013-03-15 19:03             ` Rich Felker
2013-03-15 19:20               ` Zvi Gilboa
2013-03-18  3:14     ` Rob Landley
2013-03-18  3:26       ` Rich Felker
2013-03-18  3:50         ` Strake
2013-03-18  4:08           ` Rich Felker
2013-03-18  4:30             ` Rob Landley
2013-03-18  4:09         ` Rob Landley
2013-03-18  3:28       ` Zvi Gilboa
2013-03-18  4:22         ` Rob Landley
2013-03-18  4:38           ` Zvi Gilboa
2013-03-18  3:06 ` Rob Landley

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=20130314171752.GB19010@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).