From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Tue, 27 Jan 2004 22:05:07 +0000 Subject: Re: udevinfo output broken Message-Id: <20040127220506.GA27949@kroah.com> List-Id: References: <20040127200651.GA7974@suse.de> In-Reply-To: <20040127200651.GA7974@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Tue, Jan 27, 2004 at 10:54:31PM +0100, Olaf Hering wrote: > On Tue, Jan 27, Olaf Hering wrote: > > > On Tue, Jan 27, Kay Sievers wrote: > > > > > On Tue, Jan 27, 2004 at 09:06:51PM +0100, Olaf Hering wrote: > > > > udevinfo writes to fd 0, all the output is lost somehow. > > > > > > > > olaf@ibook:~> i="`/sbin/udevinfo -r 2>&1`" > > > > /dev/ > > > > > > Seems like a klibc feature :) > > > libc works as expected. > > > > _fwrite gets 0x1 as f, calls fileno() which decrements it and passes it > > to write(). > > No idea if this is correct: > > --- klibc-0.98/klibc/include/stdio.h 2004-01-22 21:56:49.000000000 +0100 > +++ klibc/klibc/include/stdio.h 2004-01-27 22:50:27.000000000 +0100 > @@ -15,9 +15,9 @@ > struct _IO_file; > typedef struct _IO_file FILE; > > -#define stdin ((FILE *)0) > -#define stdout ((FILE *)1) > -#define stderr ((FILE *)2) > +#define stdin ((FILE *)1) > +#define stdout ((FILE *)2) > +#define stderr ((FILE *)3) > > #ifndef EOF > # define EOF (-1) > I don't know about your change, but I traced the regression down to this recent recent change in klibc: diff -Nru a/klibc/klibc/include/stdio.h b/klibc/klibc/include/stdio.h --- a/klibc/klibc/include/stdio.h Tue Jan 27 14:00:35 2004 +++ b/klibc/klibc/include/stdio.h Tue Jan 27 14:00:35 2004 @@ -31,15 +31,22 @@ #define SEEK_CUR 1 #define SEEK_END 2 +/* + * Convert between a FILE * and a file descriptor. We don't actually + * have any in-memory data, so we just abuse the pointer itself to + * hold the data. Note, however, that for file descriptors, -1 is + * error and 0 is a valid value; for FILE *, NULL (0) is error and + * non-NULL are valid. + */ static __inline__ int fileno(FILE *__f) { /* This should really be intptr_t, but size_t should be the same size */ - return (int)(size_t)__f; + return (int)(size_t)__f - 1; } static __inline__ FILE * __create_file(int __fd) { - return (FILE *)(size_t)__fd; + return (FILE *)(size_t)(__fd + 1); } __extern FILE *fopen(const char *, const char *); Peter, any reason for doing this? It seems to change the way stdout works. thanks, greg k-h ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel