From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2933 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: question: hard-coded file descriptors in stdin/stdout/stderr Date: Sun, 17 Mar 2013 23:26:31 -0400 Message-ID: <20130318032631.GM20323@brightrain.aerifal.cx> References: <51420E17.9030305@eservices.virginia.edu> <1363576440.15703.21@driftwood> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1363577201 13155 80.91.229.3 (18 Mar 2013 03:26:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Mar 2013 03:26:41 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2934-gllmg-musl=m.gmane.org@lists.openwall.com Mon Mar 18 04:27:07 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1UHQj5-0001EP-Ks for gllmg-musl@plane.gmane.org; Mon, 18 Mar 2013 04:27:07 +0100 Original-Received: (qmail 18378 invoked by uid 550); 18 Mar 2013 03:26:44 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 18370 invoked from network); 18 Mar 2013 03:26:44 -0000 Content-Disposition: inline In-Reply-To: <1363576440.15703.21@driftwood> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2933 Archived-At: On Sun, Mar 17, 2013 at 10:14:00PM -0500, Rob Landley wrote: > On 03/14/2013 12:51:19 PM, Zvi Gilboa wrote: > >>> which ones? > > > >... since you are asking... inspired by musl-libc, I am currently > >writing a win32 > >/win64 open-source library that implements/provides POSIX system > >calls (see note > >below). I believe that having a powerful libc with an MIT license > >available on > >Windows would actually be of great value to the open source > >community for all > >possible reasons, but that is of course irrelevant to my question:) > > All possible reasons? I can't think of one. > > I have actually thought about this sort of thing. For example, I did > a talk at the recent emebedded Linux conference explaining _why_ > toybox and musl are important to Android: > > http://www.youtube.com/watch?v=SGmtP5Lg_t0 > > >The main issue here is that the standard file descriptors on > >Windows are -10 > >(STD_INPUT_HANDLE), -11 (STD_OUTPUT_HANDLE), and -12 > >(STD_ERROR_HANDLE). > > In DOS, stdin, stdout, and stderr were 0, 1, and 2. What you just > listed is an explicit violation of posix. This issue was already resolved. There's no need to flame... > > I could of course compensate for that in my code and "translate" > >the POSIX special > >file descriptor numbers to the Windows ones, however it would be > >more elegant if musl > >-libc used the descriptors defined in instead of > >hard-coded numbers. > > You want to introduce non-posix assumptions into musl to make > windows code more elegant. > > Really? No, he just wanted to eliminate some assumptions (guaranteed by POSIX) and use macros instead of hard-coded magic numbers. But this turned out not to be necessary or useful anyway, for reasons connected to the ones you cited. We arrived at this conclusion with no need for flaming. :-) > >* as for psxcalls: this is a C library, that exclusively uses the > >Native API. It > >attaches to ntdll.dll during run-time, and can thus be compiled as > >a "native" static > >library with no external dependencies. > > Doesn't mingw already exist? mingw is not a libc. It uses msvcrt, which is horrible. The reason for getting a real proper libc on windows is not to make windows' users lives easier, or at least that's not my reason for wanting it. Rather, it makes OUR lives easier, because FOSS projects can just target POSIX and keep their cores simple, rather than being full of #ifdef hell or "portable runtime" hell. Rich