|
Message-ID: <5141F86D.8010000@eservices.virginia.edu> Date: Thu, 14 Mar 2013 12:18:53 -0400 From: Zvi Gilboa <zg7s@...rvices.virginia.edu> To: <musl@...ts.openwall.com> Subject: question: hard-coded file descriptors in stdin/stdout/stderr Greetings, 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 whether there was a special reason for that? With POSIX systems this would normally not be an issue, however there are still some systems out there with standard file descriptor numbers which are different... On that same note: wouldn't it make sense to slightly modify unistd.h so that it first checks whether STDIN_FILENO, etc. have already been defined? That would allow a system with different standard file descriptor numbers to define them in one of the /arch headers, yet enable the default for systems that use the "normal" numbers. The relevant section would then read: #ifndef STDIN_FILENO #define STDIN_FILENO 0 #endif #ifndef STDOUT_FILENO #define STDOUT_FILENO 1 #endif #ifndef STDERR_FILENO #define STDERR_FILENO 2 #endif Sincerley, Zvi Gilboa
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.