[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
support for uClibc
From: |
Bruno Haible |
Subject: |
support for uClibc |
Date: |
Sat, 9 Jun 2007 03:29:29 +0200 |
User-agent: |
KMail/1.5.4 |
This ports some stdio primitives to uClibc. With this, the tests pass
in a non-cross i686-linux-uclibc build.
2007-06-08 Bruno Haible <address@hidden>
Port to uClibc.
* lib/fbufmode.c (fbufmode): Add special code for uClibc.
* lib/fpurge.c (fpurge): Likewise.
* lib/freading.c (freading): Likewise.
* lib/fseeko.c (rpl_fseeko): Likewise.
* lib/fseterr.c (fseterr): Likewise.
* lib/fwriting.c (fwriting): Likewise.
* tests/test-fflush.c (main): Avoid a failure on uClibc.
*** lib/fbufmode.c 23 Apr 2007 08:01:35 -0000 1.2
--- lib/fbufmode.c 9 Jun 2007 01:15:39 -0000
***************
*** 62,67 ****
--- 62,73 ----
return _IONBF;
return _IOFBF;
# endif
+ #elif defined __UCLIBC__ /* uClibc */
+ if (fp->__modeflags & __FLAG_LBF)
+ return _IOLBF;
+ if (fp->__modeflags & __FLAG_NBF)
+ return _IONBF;
+ return _IOFBF;
#else
#error "Please port gnulib fbufmode.c to your platform! Look at the setvbuf
implementation."
#endif
*** lib/fpurge.c 29 Apr 2007 12:16:55 -0000 1.5
--- lib/fpurge.c 9 Jun 2007 01:15:39 -0000
***************
*** 96,101 ****
--- 96,109 ----
if (fp->_ptr != NULL)
fp->_cnt = 0;
return 0;
+ # elif defined __UCLIBC__ /* uClibc */
+ # ifdef __STDIO_BUFFERS
+ if (fp->__modeflags & __FLAG_WRITING)
+ fp->__bufpos = fp->__bufstart;
+ else if (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING))
+ fp->__bufpos = fp->__bufread;
+ # endif
+ return 0;
# else
#error "Please port gnulib fpurge.c to your platform! Look at the
definitions of fflush, setvbuf and ungetc on your system, then report this to
bug-gnulib."
# endif
*** lib/freading.c 29 Apr 2007 08:25:15 -0000 1.2
--- lib/freading.c 9 Jun 2007 01:15:39 -0000
***************
*** 38,43 ****
--- 38,45 ----
return (fp->_flags & __SRD) != 0;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
return (fp->_flag & _IOREAD) != 0;
+ #elif defined __UCLIBC__ /* uClibc */
+ return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0;
#else
#error "Please port gnulib freading.c to your platform!"
#endif
*** lib/fseeko.c 28 May 2007 14:44:47 -0000 1.6
--- lib/fseeko.c 9 Jun 2007 01:15:40 -0000
***************
*** 83,88 ****
--- 83,93 ----
if (fp->_ptr == fp->_base
&& (fp->_ptr == NULL || fp->_cnt == 0))
# endif
+ #elif defined __UCLIBC__ /* uClibc */
+ if (((fp->__modeflags & __FLAG_WRITING) == 0
+ || fp->__bufpos == fp->__bufstart)
+ && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
+ || fp->__bufpos == fp->__bufread))
#else
#error "Please port gnulib fseeko.c to your platform! Look at the code in
fpurge.c, then report this to bug-gnulib."
#endif
*** lib/fseterr.c 23 Apr 2007 07:58:06 -0000 1.4
--- lib/fseterr.c 9 Jun 2007 01:15:40 -0000
***************
*** 38,43 ****
--- 38,45 ----
# else
fp->_flag |= _IOERR;
# endif
+ #elif defined __UCLIBC__ /* uClibc */
+ fp->__modeflags |= __FLAG_ERROR;
#elif 0 /* unknown */
/* Portable fallback, based on an idea by Rich Felker.
Wow! 6 system calls for something that is just a bit operation!
*** lib/fwriting.c 26 Apr 2007 13:16:50 -0000 1.1
--- lib/fwriting.c 9 Jun 2007 01:15:40 -0000
***************
*** 32,37 ****
--- 32,39 ----
return (fp->_flags & __SWR) != 0;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
return (fp->_flag & _IOWRT) != 0;
+ #elif defined __UCLIBC__ /* uClibc */
+ return (fp->__modeflags & __FLAG_WRITING) != 0;
#else
#error "Please port gnulib fwriting.c to your platform!"
#endif
*** tests/test-fflush.c 28 May 2007 16:49:43 -0000 1.5
--- tests/test-fflush.c 9 Jun 2007 01:15:40 -0000
***************
*** 49,56 ****
return 1;
}
/* For deterministic results, ensure f read a bigger buffer.
! This is not the case on BeOS. */
! #if !defined __BEOS__
if (lseek (fd, 0, SEEK_CUR) == 5)
{
fputs ("Sample file was not buffered after fread.\n", stderr);
--- 49,56 ----
return 1;
}
/* For deterministic results, ensure f read a bigger buffer.
! This is not the case on BeOS, nor on uClibc. */
! #if !(defined __BEOS__ || defined __UCLIBC__)
if (lseek (fd, 0, SEEK_CUR) == 5)
{
fputs ("Sample file was not buffered after fread.\n", stderr);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- support for uClibc,
Bruno Haible <=