Hacks to get the libio package working:
- all wide character functions have been disabled or removed - ftrylockfile() does not yet work - reformatted code to be readable (sometimes needed for changes) Note, this code is not able to be simply updated with newer glibc releases! Sorry. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5429 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,15 +1,17 @@
|
|||||||
SubDir OBOS_TOP src kernel libroot posix glibc libio ;
|
SubDir OBOS_TOP src kernel libroot posix glibc libio ;
|
||||||
|
|
||||||
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc include arch $(OBOS_ARCH) ;
|
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc include arch $(OBOS_ARCH) ;
|
||||||
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc stdio-common ;
|
#SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc stdio-common ;
|
||||||
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc libio ;
|
#SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc libio ;
|
||||||
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc include ;
|
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc include ;
|
||||||
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc locale ;
|
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc locale ;
|
||||||
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc ;
|
SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc ;
|
||||||
|
|
||||||
SubDirCcFlags -imacrolibc-symbols.h ;
|
SubDirCcFlags -imacrolibc-symbols.h ;
|
||||||
|
|
||||||
# ToDo: for now, all wide character functions are disabled
|
# For now, all wide character functions are disabled,
|
||||||
|
# obprintf() is also disabled, because we don't have
|
||||||
|
# obstack functionality
|
||||||
|
|
||||||
KernelMergeObject posix_gnu_libio.o :
|
KernelMergeObject posix_gnu_libio.o :
|
||||||
<$(SOURCE_GRIST)>clearerr.c
|
<$(SOURCE_GRIST)>clearerr.c
|
||||||
@@ -22,24 +24,19 @@ KernelMergeObject posix_gnu_libio.o :
|
|||||||
<$(SOURCE_GRIST)>fileno.c
|
<$(SOURCE_GRIST)>fileno.c
|
||||||
<$(SOURCE_GRIST)>filedoalloc.c
|
<$(SOURCE_GRIST)>filedoalloc.c
|
||||||
<$(SOURCE_GRIST)>fileops.c
|
<$(SOURCE_GRIST)>fileops.c
|
||||||
|
<$(SOURCE_GRIST)>flockfile.c
|
||||||
<$(SOURCE_GRIST)>fputc.c
|
<$(SOURCE_GRIST)>fputc.c
|
||||||
<$(SOURCE_GRIST)>fputc_u.c
|
<$(SOURCE_GRIST)>fputc_u.c
|
||||||
# <$(SOURCE_GRIST)>fputwc.c
|
|
||||||
# <$(SOURCE_GRIST)>fputwc_u.c
|
|
||||||
# <$(SOURCE_GRIST)>freopen.c
|
# <$(SOURCE_GRIST)>freopen.c
|
||||||
<$(SOURCE_GRIST)>fseek.c
|
<$(SOURCE_GRIST)>fseek.c
|
||||||
<$(SOURCE_GRIST)>fseeko.c
|
<$(SOURCE_GRIST)>fseeko.c
|
||||||
<$(SOURCE_GRIST)>ftello.c
|
<$(SOURCE_GRIST)>ftello.c
|
||||||
<$(SOURCE_GRIST)>fwide.c
|
<$(SOURCE_GRIST)>fwide.c
|
||||||
<$(SOURCE_GRIST)>fwprintf.c
|
|
||||||
# <$(SOURCE_GRIST)>fwscanf.c
|
|
||||||
<$(SOURCE_GRIST)>genops.c
|
<$(SOURCE_GRIST)>genops.c
|
||||||
<$(SOURCE_GRIST)>getc.c
|
<$(SOURCE_GRIST)>getc.c
|
||||||
<$(SOURCE_GRIST)>getc_u.c
|
<$(SOURCE_GRIST)>getc_u.c
|
||||||
<$(SOURCE_GRIST)>getchar.c
|
<$(SOURCE_GRIST)>getchar.c
|
||||||
<$(SOURCE_GRIST)>getchar_u.c
|
<$(SOURCE_GRIST)>getchar_u.c
|
||||||
# <$(SOURCE_GRIST)>getwc.c
|
|
||||||
# <$(SOURCE_GRIST)>getwc_u.c
|
|
||||||
<$(SOURCE_GRIST)>iofclose.c
|
<$(SOURCE_GRIST)>iofclose.c
|
||||||
<$(SOURCE_GRIST)>iofdopen.c
|
<$(SOURCE_GRIST)>iofdopen.c
|
||||||
<$(SOURCE_GRIST)>iofflush.c
|
<$(SOURCE_GRIST)>iofflush.c
|
||||||
@@ -49,18 +46,16 @@ KernelMergeObject posix_gnu_libio.o :
|
|||||||
<$(SOURCE_GRIST)>iofopen.c
|
<$(SOURCE_GRIST)>iofopen.c
|
||||||
<$(SOURCE_GRIST)>iofputs.c
|
<$(SOURCE_GRIST)>iofputs.c
|
||||||
<$(SOURCE_GRIST)>iofputs_u.c
|
<$(SOURCE_GRIST)>iofputs_u.c
|
||||||
# <$(SOURCE_GRIST)>iofputws.c
|
|
||||||
# <$(SOURCE_GRIST)>iofputws_u.c
|
|
||||||
<$(SOURCE_GRIST)>iofread.c
|
<$(SOURCE_GRIST)>iofread.c
|
||||||
<$(SOURCE_GRIST)>iofread_u.c
|
<$(SOURCE_GRIST)>iofread_u.c
|
||||||
# <$(SOURCE_GRIST)>iofsetpos.c
|
# <$(SOURCE_GRIST)>iofsetpos.c
|
||||||
<$(SOURCE_GRIST)>ioftell.c
|
<$(SOURCE_GRIST)>ioftell.c
|
||||||
<$(SOURCE_GRIST)>iofwrite.c
|
<$(SOURCE_GRIST)>iofwrite.c
|
||||||
<$(SOURCE_GRIST)>iofwrite_u.c
|
<$(SOURCE_GRIST)>iofwrite_u.c
|
||||||
# <$(SOURCE_GRIST)>iofwide.c
|
<$(SOURCE_GRIST)>iofwide.c
|
||||||
|
<$(SOURCE_GRIST)>iogetdelim.c
|
||||||
<$(SOURCE_GRIST)>iogetline.c
|
<$(SOURCE_GRIST)>iogetline.c
|
||||||
# <$(SOURCE_GRIST)>iogets.c
|
<$(SOURCE_GRIST)>iogets.c
|
||||||
<$(SOURCE_GRIST)>iogetwline.c
|
|
||||||
<$(SOURCE_GRIST)>iopadn.c
|
<$(SOURCE_GRIST)>iopadn.c
|
||||||
<$(SOURCE_GRIST)>ioputs.c
|
<$(SOURCE_GRIST)>ioputs.c
|
||||||
<$(SOURCE_GRIST)>ioseekoff.c
|
<$(SOURCE_GRIST)>ioseekoff.c
|
||||||
@@ -68,33 +63,46 @@ KernelMergeObject posix_gnu_libio.o :
|
|||||||
<$(SOURCE_GRIST)>iosetbuffer.c
|
<$(SOURCE_GRIST)>iosetbuffer.c
|
||||||
<$(SOURCE_GRIST)>iosetvbuf.c
|
<$(SOURCE_GRIST)>iosetvbuf.c
|
||||||
<$(SOURCE_GRIST)>ioungetc.c
|
<$(SOURCE_GRIST)>ioungetc.c
|
||||||
# <$(SOURCE_GRIST)>ioungetwc.c
|
|
||||||
<$(SOURCE_GRIST)>iovdprintf.c
|
<$(SOURCE_GRIST)>iovdprintf.c
|
||||||
<$(SOURCE_GRIST)>iovsprintf.c
|
<$(SOURCE_GRIST)>iovsprintf.c
|
||||||
<$(SOURCE_GRIST)>iovsscanf.c
|
<$(SOURCE_GRIST)>iovsscanf.c
|
||||||
# <$(SOURCE_GRIST)>iovswscanf.c
|
# <$(SOURCE_GRIST)>obprintf.c
|
||||||
# <$(SOURCE_GRIST)>iowpadn.c
|
|
||||||
<$(SOURCE_GRIST)>obprintf.c
|
|
||||||
<$(SOURCE_GRIST)>peekc.c
|
<$(SOURCE_GRIST)>peekc.c
|
||||||
<$(SOURCE_GRIST)>putc.c
|
<$(SOURCE_GRIST)>putc.c
|
||||||
<$(SOURCE_GRIST)>putc_u.c
|
<$(SOURCE_GRIST)>putc_u.c
|
||||||
<$(SOURCE_GRIST)>putchar.c
|
<$(SOURCE_GRIST)>putchar.c
|
||||||
<$(SOURCE_GRIST)>putchar_u.c
|
<$(SOURCE_GRIST)>putchar_u.c
|
||||||
# <$(SOURCE_GRIST)>putwc.c
|
|
||||||
# <$(SOURCE_GRIST)>putwc_u.c
|
|
||||||
# <$(SOURCE_GRIST)>putwchar.c
|
|
||||||
# <$(SOURCE_GRIST)>putwchar_u.c
|
|
||||||
<$(SOURCE_GRIST)>rewind.c
|
<$(SOURCE_GRIST)>rewind.c
|
||||||
<$(SOURCE_GRIST)>setbuf.c
|
<$(SOURCE_GRIST)>setbuf.c
|
||||||
<$(SOURCE_GRIST)>setlinebuf.c
|
<$(SOURCE_GRIST)>setlinebuf.c
|
||||||
<$(SOURCE_GRIST)>stdfiles.c
|
<$(SOURCE_GRIST)>stdfiles.c
|
||||||
<$(SOURCE_GRIST)>stdio.c
|
<$(SOURCE_GRIST)>stdio.c
|
||||||
<$(SOURCE_GRIST)>strops.c
|
<$(SOURCE_GRIST)>strops.c
|
||||||
# <$(SOURCE_GRIST)>swprintf.c
|
|
||||||
# <$(SOURCE_GRIST)>swscanf.c
|
|
||||||
<$(SOURCE_GRIST)>vasprintf.c
|
<$(SOURCE_GRIST)>vasprintf.c
|
||||||
<$(SOURCE_GRIST)>vscanf.c
|
<$(SOURCE_GRIST)>vscanf.c
|
||||||
<$(SOURCE_GRIST)>vsnprintf.c
|
<$(SOURCE_GRIST)>vsnprintf.c
|
||||||
|
<$(SOURCE_GRIST)>wfile_stubs.c
|
||||||
|
|
||||||
|
# wide character
|
||||||
|
|
||||||
|
# <$(SOURCE_GRIST)>fputwc.c
|
||||||
|
# <$(SOURCE_GRIST)>fputwc_u.c
|
||||||
|
# <$(SOURCE_GRIST)>fwprintf.c
|
||||||
|
# <$(SOURCE_GRIST)>fwscanf.c
|
||||||
|
# <$(SOURCE_GRIST)>getwc.c
|
||||||
|
# <$(SOURCE_GRIST)>getwc_u.c
|
||||||
|
# <$(SOURCE_GRIST)>iofputws.c
|
||||||
|
# <$(SOURCE_GRIST)>iofputws_u.c
|
||||||
|
# <$(SOURCE_GRIST)>iogetwline.c
|
||||||
|
# <$(SOURCE_GRIST)>ioungetwc.c
|
||||||
|
# <$(SOURCE_GRIST)>iovswscanf.c
|
||||||
|
# <$(SOURCE_GRIST)>iowpadn.c
|
||||||
|
# <$(SOURCE_GRIST)>putwc.c
|
||||||
|
# <$(SOURCE_GRIST)>putwc_u.c
|
||||||
|
# <$(SOURCE_GRIST)>putwchar.c
|
||||||
|
# <$(SOURCE_GRIST)>putwchar_u.c
|
||||||
|
# <$(SOURCE_GRIST)>swprintf.c
|
||||||
|
# <$(SOURCE_GRIST)>swscanf.c
|
||||||
# <$(SOURCE_GRIST)>vswprintf.c
|
# <$(SOURCE_GRIST)>vswprintf.c
|
||||||
# <$(SOURCE_GRIST)>vwprintf.c
|
# <$(SOURCE_GRIST)>vwprintf.c
|
||||||
# <$(SOURCE_GRIST)>vwscanf.c
|
# <$(SOURCE_GRIST)>vwscanf.c
|
||||||
|
|||||||
@@ -42,12 +42,14 @@
|
|||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if 0
|
||||||
#if _LIBC
|
#if _LIBC
|
||||||
# include "../wcsmbs/wcsmbsload.h"
|
# include "../wcsmbs/wcsmbsload.h"
|
||||||
# include "../iconv/gconv_charset.h"
|
# include "../iconv/gconv_charset.h"
|
||||||
# include "../iconv/gconv_int.h"
|
# include "../iconv/gconv_int.h"
|
||||||
# include <shlib-compat.h>
|
# include <shlib-compat.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#ifndef errno
|
#ifndef errno
|
||||||
extern int errno;
|
extern int errno;
|
||||||
#endif
|
#endif
|
||||||
@@ -55,13 +57,12 @@ extern int errno;
|
|||||||
# define __set_errno(Val) errno = (Val)
|
# define __set_errno(Val) errno = (Val)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
|
/*# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
|
||||||
# define close(FD) __close (FD)
|
# define close(FD) __close (FD)
|
||||||
# define lseek(FD, Offset, Whence) __lseek (FD, Offset, Whence)
|
# define lseek(FD, Offset, Whence) __lseek (FD, Offset, Whence)
|
||||||
# define read(FD, Buf, NBytes) __read (FD, Buf, NBytes)
|
# define read(FD, Buf, NBytes) __read (FD, Buf, NBytes)
|
||||||
# define write(FD, Buf, NBytes) __write (FD, Buf, NBytes)
|
# define write(FD, Buf, NBytes) __write (FD, Buf, NBytes)*/
|
||||||
# define _IO_do_write _IO_new_do_write /* For macro uses. */
|
# define _IO_do_write _IO_new_do_write /* For macro uses. */
|
||||||
#else
|
#else
|
||||||
# define _IO_new_do_write _IO_do_write
|
# define _IO_new_do_write _IO_do_write
|
||||||
@@ -79,11 +80,11 @@ extern int errno;
|
|||||||
# define _IO_new_file_xsputn _IO_file_xsputn
|
# define _IO_new_file_xsputn _IO_file_xsputn
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
extern struct __gconv_trans_data __libio_translit attribute_hidden;
|
extern struct __gconv_trans_data __libio_translit attribute_hidden;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* An fstream can be in at most one of put mode, get mode, or putback mode.
|
/* An fstream can be in at most one of put mode, get mode, or putback mode.
|
||||||
Putback mode is a variant of get mode.
|
Putback mode is a variant of get mode.
|
||||||
@@ -179,6 +180,7 @@ _IO_new_file_close_it (fp)
|
|||||||
_IO_setg (fp, NULL, NULL, NULL);
|
_IO_setg (fp, NULL, NULL, NULL);
|
||||||
_IO_setp (fp, NULL, NULL);
|
_IO_setp (fp, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -188,6 +190,7 @@ _IO_new_file_close_it (fp)
|
|||||||
_IO_wsetg (fp, NULL, NULL, NULL);
|
_IO_wsetg (fp, NULL, NULL, NULL);
|
||||||
_IO_wsetp (fp, NULL, NULL);
|
_IO_wsetp (fp, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
INTUSE(_IO_un_link) ((struct _IO_FILE_plus *) fp);
|
INTUSE(_IO_un_link) ((struct _IO_FILE_plus *) fp);
|
||||||
@@ -250,12 +253,9 @@ _IO_file_open (fp, filename, posix_mode, prot, read_write, is32not64)
|
|||||||
}
|
}
|
||||||
libc_hidden_def (_IO_file_open)
|
libc_hidden_def (_IO_file_open)
|
||||||
|
|
||||||
|
|
||||||
_IO_FILE *
|
_IO_FILE *
|
||||||
_IO_new_file_fopen (fp, filename, mode, is32not64)
|
_IO_new_file_fopen(_IO_FILE *fp, const char *filename, const char *mode, int is32not64)
|
||||||
_IO_FILE *fp;
|
|
||||||
const char *filename;
|
|
||||||
const char *mode;
|
|
||||||
int is32not64;
|
|
||||||
{
|
{
|
||||||
int oflags = 0, omode;
|
int oflags = 0, omode;
|
||||||
int read_write;
|
int read_write;
|
||||||
@@ -263,7 +263,7 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
|
|||||||
int i;
|
int i;
|
||||||
_IO_FILE *result;
|
_IO_FILE *result;
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
const char *cs;
|
// const char *cs;
|
||||||
const char *last_recognized;
|
const char *last_recognized;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
|
|||||||
result = _IO_file_open (fp, filename, omode|oflags, oprot, read_write,
|
result = _IO_file_open (fp, filename, omode|oflags, oprot, read_write,
|
||||||
is32not64);
|
is32not64);
|
||||||
|
|
||||||
|
#if 0
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
if (result != NULL)
|
if (result != NULL)
|
||||||
{
|
{
|
||||||
@@ -405,6 +405,7 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* GNU libc */
|
#endif /* GNU libc */
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -449,10 +450,7 @@ INTDEF2(_IO_new_file_setbuf, _IO_file_setbuf)
|
|||||||
|
|
||||||
|
|
||||||
_IO_FILE *
|
_IO_FILE *
|
||||||
_IO_file_setbuf_mmap (fp, p, len)
|
_IO_file_setbuf_mmap(_IO_FILE *fp, char *p, _IO_ssize_t len)
|
||||||
_IO_FILE *fp;
|
|
||||||
char *p;
|
|
||||||
_IO_ssize_t len;
|
|
||||||
{
|
{
|
||||||
_IO_FILE *result;
|
_IO_FILE *result;
|
||||||
|
|
||||||
@@ -463,12 +461,13 @@ _IO_file_setbuf_mmap (fp, p, len)
|
|||||||
/* And perform the normal operation. */
|
/* And perform the normal operation. */
|
||||||
result = _IO_new_file_setbuf(fp, p, len);
|
result = _IO_new_file_setbuf(fp, p, len);
|
||||||
|
|
||||||
|
#if HAVE_MMAP
|
||||||
/* If the call failed, restore to using mmap. */
|
/* If the call failed, restore to using mmap. */
|
||||||
if (result == NULL)
|
if (result == NULL) {
|
||||||
{
|
|
||||||
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &_IO_file_jumps_mmap;
|
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &_IO_file_jumps_mmap;
|
||||||
fp->_wide_data->_wide_vtable = &_IO_wfile_jumps_mmap;
|
fp->_wide_data->_wide_vtable = &_IO_wfile_jumps_mmap;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -704,21 +703,24 @@ mmap_remap_check (_IO_FILE *fp)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Life is no longer good for mmap. Punt it. */
|
/* Life is no longer good for mmap. Punt it. */
|
||||||
(void) __munmap (fp->_IO_buf_base,
|
__munmap (fp->_IO_buf_base, fp->_IO_buf_end - fp->_IO_buf_base);
|
||||||
fp->_IO_buf_end - fp->_IO_buf_base);
|
|
||||||
punt:
|
punt:
|
||||||
fp->_IO_buf_base = fp->_IO_buf_end = NULL;
|
fp->_IO_buf_base = fp->_IO_buf_end = NULL;
|
||||||
_IO_setg (fp, NULL, NULL, NULL);
|
_IO_setg (fp, NULL, NULL, NULL);
|
||||||
|
|
||||||
if (fp->_mode <= 0)
|
if (fp->_mode <= 0)
|
||||||
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &INTUSE(_IO_file_jumps);
|
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &INTUSE(_IO_file_jumps);
|
||||||
else
|
else
|
||||||
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &_IO_wfile_jumps;
|
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &_IO_wfile_jumps;
|
||||||
|
|
||||||
fp->_wide_data->_wide_vtable = &_IO_wfile_jumps;
|
fp->_wide_data->_wide_vtable = &_IO_wfile_jumps;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Special callback replacing the underflow callbacks if we mmap the file. */
|
/* Special callback replacing the underflow callbacks if we mmap the file. */
|
||||||
int
|
int
|
||||||
_IO_file_underflow_mmap (_IO_FILE *fp)
|
_IO_file_underflow_mmap (_IO_FILE *fp)
|
||||||
@@ -737,14 +739,16 @@ _IO_file_underflow_mmap (_IO_FILE *fp)
|
|||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
decide_maybe_mmap(_IO_FILE *fp)
|
decide_maybe_mmap(_IO_FILE *fp)
|
||||||
{
|
{
|
||||||
/* We use the file in read-only mode. This could mean we can
|
/* We use the file in read-only mode. This could mean we can
|
||||||
mmap the file and use it without any copying. But not all
|
* mmap the file and use it without any copying. But not all
|
||||||
file descriptors are for mmap-able objects and on 32-bit
|
* file descriptors are for mmap-able objects and on 32-bit
|
||||||
machines we don't want to map files which are too large since
|
* machines we don't want to map files which are too large since
|
||||||
this would require too much virtual memory. */
|
* this would require too much virtual memory.
|
||||||
|
*/
|
||||||
struct _G_stat64 st;
|
struct _G_stat64 st;
|
||||||
|
|
||||||
if (_IO_SYSSTAT(fp, &st) == 0
|
if (_IO_SYSSTAT(fp, &st) == 0
|
||||||
@@ -762,11 +766,12 @@ decide_maybe_mmap (_IO_FILE *fp)
|
|||||||
# else
|
# else
|
||||||
p = __mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fp->_fileno, 0);
|
p = __mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fp->_fileno, 0);
|
||||||
# endif
|
# endif
|
||||||
if (p != MAP_FAILED)
|
|
||||||
{
|
if (p != MAP_FAILED) {
|
||||||
/* OK, we managed to map the file. Set the buffer up and use a
|
/* OK, we managed to map the file. Set the buffer up and use a
|
||||||
special jump table with simplified underflow functions which
|
* special jump table with simplified underflow functions which
|
||||||
never tries to read anything from the file. */
|
* never tries to read anything from the file.
|
||||||
|
*/
|
||||||
|
|
||||||
if (
|
if (
|
||||||
# ifdef _G_LSEEK64
|
# ifdef _G_LSEEK64
|
||||||
@@ -774,13 +779,10 @@ decide_maybe_mmap (_IO_FILE *fp)
|
|||||||
# else
|
# else
|
||||||
__lseek
|
__lseek
|
||||||
# endif
|
# endif
|
||||||
(fp->_fileno, st.st_size, SEEK_SET) != st.st_size)
|
(fp->_fileno, st.st_size, SEEK_SET) != st.st_size) {
|
||||||
{
|
|
||||||
(void) __munmap (p, st.st_size);
|
(void) __munmap (p, st.st_size);
|
||||||
fp->_offset = _IO_pos_BAD;
|
fp->_offset = _IO_pos_BAD;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
INTUSE(_IO_setb) (fp, p, (char *) p + st.st_size, 0);
|
INTUSE(_IO_setb) (fp, p, (char *) p + st.st_size, 0);
|
||||||
|
|
||||||
if (fp->_offset == _IO_pos_BAD)
|
if (fp->_offset == _IO_pos_BAD)
|
||||||
@@ -793,6 +795,7 @@ decide_maybe_mmap (_IO_FILE *fp)
|
|||||||
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &_IO_file_jumps_mmap;
|
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &_IO_file_jumps_mmap;
|
||||||
else
|
else
|
||||||
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &_IO_wfile_jumps_mmap;
|
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &_IO_wfile_jumps_mmap;
|
||||||
|
|
||||||
fp->_wide_data->_wide_vtable = &_IO_wfile_jumps_mmap;
|
fp->_wide_data->_wide_vtable = &_IO_wfile_jumps_mmap;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -806,9 +809,11 @@ decide_maybe_mmap (_IO_FILE *fp)
|
|||||||
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &INTUSE(_IO_file_jumps);
|
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &INTUSE(_IO_file_jumps);
|
||||||
else
|
else
|
||||||
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &_IO_wfile_jumps;
|
_IO_JUMPS((struct _IO_FILE_plus *)fp) = &_IO_wfile_jumps;
|
||||||
|
|
||||||
fp->_wide_data->_wide_vtable = &_IO_wfile_jumps;
|
fp->_wide_data->_wide_vtable = &_IO_wfile_jumps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
_IO_file_underflow_maybe_mmap (_IO_FILE *fp)
|
_IO_file_underflow_maybe_mmap (_IO_FILE *fp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
** Distributed under the terms of the OpenBeOS License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "libioP.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef _IO_flockfile
|
||||||
|
#undef _IO_funlockfile
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
_IO_flockfile(_IO_FILE *stream)
|
||||||
|
{
|
||||||
|
__libc_lock_lock_recursive(*stream->_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
_IO_funlockfile(_IO_FILE *stream)
|
||||||
|
{
|
||||||
|
__libc_lock_unlock_recursive(*stream->_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_IO_ftrylockfile(_IO_FILE *stream)
|
||||||
|
{
|
||||||
|
// ToDo: that code has probably never been tested!
|
||||||
|
//return __libc_lock_trylock_recursive(*stream->_lock);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
@@ -68,8 +68,8 @@ freopen (filename, mode, fp)
|
|||||||
{
|
{
|
||||||
INTUSE(_IO_file_close_it) (fp);
|
INTUSE(_IO_file_close_it) (fp);
|
||||||
_IO_JUMPS ((struct _IO_FILE_plus *) fp) = &INTUSE(_IO_file_jumps);
|
_IO_JUMPS ((struct _IO_FILE_plus *) fp) = &INTUSE(_IO_file_jumps);
|
||||||
if (fp->_vtable_offset == 0 && fp->_wide_data != NULL)
|
// if (fp->_vtable_offset == 0 && fp->_wide_data != NULL)
|
||||||
fp->_wide_data->_wide_vtable = &INTUSE(_IO_wfile_jumps);
|
// fp->_wide_data->_wide_vtable = &INTUSE(_IO_wfile_jumps);
|
||||||
result = INTUSE(_IO_file_fopen) (fp, filename, mode, 1);
|
result = INTUSE(_IO_file_fopen) (fp, filename, mode, 1);
|
||||||
if (result != NULL)
|
if (result != NULL)
|
||||||
result = __fopen_maybe_mmap (result);
|
result = __fopen_maybe_mmap (result);
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ freopen64 (filename, mode, fp)
|
|||||||
}
|
}
|
||||||
INTUSE(_IO_file_close_it) (fp);
|
INTUSE(_IO_file_close_it) (fp);
|
||||||
_IO_JUMPS ((struct _IO_FILE_plus *) fp) = &INTUSE(_IO_file_jumps);
|
_IO_JUMPS ((struct _IO_FILE_plus *) fp) = &INTUSE(_IO_file_jumps);
|
||||||
if (fp->_vtable_offset == 0 && fp->_wide_data != NULL)
|
// if (fp->_vtable_offset == 0 && fp->_wide_data != NULL)
|
||||||
fp->_wide_data->_wide_vtable = &INTUSE(_IO_wfile_jumps);
|
// fp->_wide_data->_wide_vtable = &INTUSE(_IO_wfile_jumps);
|
||||||
result = INTUSE(_IO_file_fopen) (fp, filename, mode, 0);
|
result = INTUSE(_IO_file_fopen) (fp, filename, mode, 0);
|
||||||
if (result != NULL)
|
if (result != NULL)
|
||||||
result = __fopen_maybe_mmap (result);
|
result = __fopen_maybe_mmap (result);
|
||||||
|
|||||||
@@ -23,26 +23,28 @@
|
|||||||
however invalidate any other reasons why the executable file
|
however invalidate any other reasons why the executable file
|
||||||
might be covered by the GNU Lesser General Public License.
|
might be covered by the GNU Lesser General Public License.
|
||||||
This exception applies to code released by its copyright holders
|
This exception applies to code released by its copyright holders
|
||||||
in files containing the exception. */
|
in files containing the exception.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <libioP.h>
|
#include <libioP.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
fwide (fp, mode)
|
fwide(_IO_FILE *fp, int mode)
|
||||||
_IO_FILE *fp;
|
|
||||||
int mode;
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
/* Normalize the value. */
|
/* Normalize the value. */
|
||||||
mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
|
mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
|
||||||
|
|
||||||
if (mode == 0 || fp->_mode != 0)
|
if (mode == 0 || fp->_mode != 0) {
|
||||||
/* The caller simply wants to know about the current orientation
|
// The caller simply wants to know about the current orientation
|
||||||
or the orientation already has been determined. */
|
// or the orientation already has been determined.
|
||||||
return fp->_mode;
|
return fp->_mode;
|
||||||
|
}
|
||||||
|
|
||||||
_IO_cleanup_region_start((void (*) __P ((void *)))_IO_funlockfile, fp);
|
_IO_cleanup_region_start((void (*) __P ((void *)))_IO_funlockfile, fp);
|
||||||
_IO_flockfile(fp);
|
_IO_flockfile(fp);
|
||||||
|
|||||||
@@ -23,16 +23,16 @@
|
|||||||
however invalidate any other reasons why the executable file
|
however invalidate any other reasons why the executable file
|
||||||
might be covered by the GNU Lesser General Public License.
|
might be covered by the GNU Lesser General Public License.
|
||||||
This exception applies to code released by its copyright holders
|
This exception applies to code released by its copyright holders
|
||||||
in files containing the exception. */
|
in files containing the exception.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Generic or default I/O operations. */
|
/* Generic or default I/O operations. */
|
||||||
|
|
||||||
#include "libioP.h"
|
#include "libioP.h"
|
||||||
#ifdef __STDC__
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef _IO_MTSAFE_IO
|
#ifdef _IO_MTSAFE_IO
|
||||||
static _IO_lock_t list_all_lock = _IO_lock_initializer;
|
static _IO_lock_t list_all_lock = _IO_lock_initializer;
|
||||||
#endif
|
#endif
|
||||||
@@ -43,6 +43,7 @@ static int _IO_list_all_stamp;
|
|||||||
|
|
||||||
static _IO_FILE *run_fp;
|
static _IO_FILE *run_fp;
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
flush_cleanup (void *not_used)
|
flush_cleanup (void *not_used)
|
||||||
{
|
{
|
||||||
@@ -52,10 +53,11 @@ flush_cleanup (void *not_used)
|
|||||||
_IO_lock_unlock (list_all_lock);
|
_IO_lock_unlock (list_all_lock);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_IO_un_link (fp)
|
_IO_un_link(struct _IO_FILE_plus *fp)
|
||||||
struct _IO_FILE_plus *fp;
|
|
||||||
{
|
{
|
||||||
if (fp->file._flags & _IO_LINKED)
|
if (fp->file._flags & _IO_LINKED)
|
||||||
{
|
{
|
||||||
@@ -226,18 +228,19 @@ _IO_switch_to_put_mode (fp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
__overflow (f, ch)
|
__overflow(_IO_FILE *file, int character)
|
||||||
_IO_FILE *f;
|
|
||||||
int ch;
|
|
||||||
{
|
{
|
||||||
/* This is a single-byte stream. */
|
/* This is a single-byte stream. */
|
||||||
if (f->_mode == 0)
|
if (file->_mode == 0)
|
||||||
_IO_fwide (f, -1);
|
_IO_fwide(file, -1);
|
||||||
return _IO_OVERFLOW (f, ch);
|
|
||||||
|
return _IO_OVERFLOW(file, character);
|
||||||
}
|
}
|
||||||
libc_hidden_def(__overflow)
|
libc_hidden_def(__overflow)
|
||||||
|
|
||||||
|
|
||||||
static int save_for_backup __P ((_IO_FILE *fp, char *end_p))
|
static int save_for_backup __P ((_IO_FILE *fp, char *end_p))
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
internal_function
|
internal_function
|
||||||
@@ -319,72 +322,76 @@ save_for_backup (fp, end_p)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
__underflow (fp)
|
__underflow(_IO_FILE *file)
|
||||||
_IO_FILE *fp;
|
|
||||||
{
|
{
|
||||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||||
if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
|
if (file->_vtable_offset == 0 && _IO_fwide(file, -1) != -1)
|
||||||
return EOF;
|
return EOF;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fp->_mode == 0)
|
if (file->_mode == 0)
|
||||||
_IO_fwide (fp, -1);
|
_IO_fwide(file, -1);
|
||||||
if (_IO_in_put_mode (fp))
|
|
||||||
if (INTUSE(_IO_switch_to_get_mode) (fp) == EOF)
|
if (_IO_in_put_mode(file) && INTUSE(_IO_switch_to_get_mode)(file) == EOF)
|
||||||
return EOF;
|
return EOF;
|
||||||
if (fp->_IO_read_ptr < fp->_IO_read_end)
|
|
||||||
return *(unsigned char *) fp->_IO_read_ptr;
|
if (file->_IO_read_ptr < file->_IO_read_end)
|
||||||
if (_IO_in_backup (fp))
|
return *(unsigned char *)file->_IO_read_ptr;
|
||||||
{
|
|
||||||
_IO_switch_to_main_get_area (fp);
|
if (_IO_in_backup(file)) {
|
||||||
if (fp->_IO_read_ptr < fp->_IO_read_end)
|
_IO_switch_to_main_get_area(file);
|
||||||
return *(unsigned char *) fp->_IO_read_ptr;
|
|
||||||
|
if (file->_IO_read_ptr < file->_IO_read_end)
|
||||||
|
return *(unsigned char *)file->_IO_read_ptr;
|
||||||
}
|
}
|
||||||
if (_IO_have_markers (fp))
|
if (_IO_have_markers(file)) {
|
||||||
{
|
if (save_for_backup(file, file->_IO_read_end))
|
||||||
if (save_for_backup (fp, fp->_IO_read_end))
|
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
} else if (_IO_have_backup(file))
|
||||||
else if (_IO_have_backup (fp))
|
INTUSE(_IO_free_backup_area)(file);
|
||||||
INTUSE(_IO_free_backup_area) (fp);
|
|
||||||
return _IO_UNDERFLOW (fp);
|
return _IO_UNDERFLOW(file);
|
||||||
}
|
}
|
||||||
libc_hidden_def(__underflow)
|
libc_hidden_def(__underflow)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
__uflow (fp)
|
__uflow(_IO_FILE *file)
|
||||||
_IO_FILE *fp;
|
|
||||||
{
|
{
|
||||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||||
if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
|
if (file->_vtable_offset == 0 && _IO_fwide(file, -1) != -1)
|
||||||
return EOF;
|
return EOF;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fp->_mode == 0)
|
if (file->_mode == 0)
|
||||||
_IO_fwide (fp, -11);
|
_IO_fwide(file, -11);
|
||||||
if (_IO_in_put_mode (fp))
|
|
||||||
if (INTUSE(_IO_switch_to_get_mode) (fp) == EOF)
|
if (_IO_in_put_mode(file) && INTUSE(_IO_switch_to_get_mode)(file) == EOF)
|
||||||
return EOF;
|
return EOF;
|
||||||
if (fp->_IO_read_ptr < fp->_IO_read_end)
|
|
||||||
return *(unsigned char *) fp->_IO_read_ptr++;
|
if (file->_IO_read_ptr < file->_IO_read_end)
|
||||||
if (_IO_in_backup (fp))
|
return *(unsigned char *)file->_IO_read_ptr++;
|
||||||
{
|
|
||||||
_IO_switch_to_main_get_area (fp);
|
if (_IO_in_backup(file)) {
|
||||||
if (fp->_IO_read_ptr < fp->_IO_read_end)
|
_IO_switch_to_main_get_area(file);
|
||||||
return *(unsigned char *) fp->_IO_read_ptr++;
|
|
||||||
|
if (file->_IO_read_ptr < file->_IO_read_end)
|
||||||
|
return *(unsigned char *)file->_IO_read_ptr++;
|
||||||
}
|
}
|
||||||
if (_IO_have_markers (fp))
|
|
||||||
{
|
if (_IO_have_markers(file)) {
|
||||||
if (save_for_backup (fp, fp->_IO_read_end))
|
if (save_for_backup(file, file->_IO_read_end))
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
} else if (_IO_have_backup(file))
|
||||||
else if (_IO_have_backup (fp))
|
INTUSE(_IO_free_backup_area)(file);
|
||||||
INTUSE(_IO_free_backup_area) (fp);
|
|
||||||
return _IO_UFLOW (fp);
|
return _IO_UFLOW(file);
|
||||||
}
|
}
|
||||||
libc_hidden_def(__uflow)
|
libc_hidden_def(__uflow)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_IO_setb (f, b, eb, a)
|
_IO_setb (f, b, eb, a)
|
||||||
_IO_FILE *f;
|
_IO_FILE *f;
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ _IO_new_fclose (fp)
|
|||||||
_IO_cleanup_region_end (0);
|
_IO_cleanup_region_end (0);
|
||||||
if (fp->_mode > 0)
|
if (fp->_mode > 0)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
#if _LIBC
|
#if _LIBC
|
||||||
/* This stream has a wide orientation. This means we have to free
|
/* This stream has a wide orientation. This means we have to free
|
||||||
the conversion functions. */
|
the conversion functions. */
|
||||||
@@ -75,6 +76,7 @@ _IO_new_fclose (fp)
|
|||||||
|
|
||||||
__gconv_release_step (cc->__cd_in.__cd.__steps);
|
__gconv_release_step (cc->__cd_in.__cd.__steps);
|
||||||
__gconv_release_step (cc->__cd_out.__cd.__steps);
|
__gconv_release_step (cc->__cd_out.__cd.__steps);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -23,30 +23,21 @@
|
|||||||
however invalidate any other reasons why the executable file
|
however invalidate any other reasons why the executable file
|
||||||
might be covered by the GNU Lesser General Public License.
|
might be covered by the GNU Lesser General Public License.
|
||||||
This exception applies to code released by its copyright holders
|
This exception applies to code released by its copyright holders
|
||||||
in files containing the exception. */
|
in files containing the exception.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "libioP.h"
|
#include "libioP.h"
|
||||||
#ifdef __STDC__
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
# include <shlib-compat.h>
|
# include <shlib-compat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _IO_fcntl
|
|
||||||
#ifdef _LIBC
|
|
||||||
#define _IO_fcntl __fcntl
|
|
||||||
#else
|
|
||||||
#define _IO_fcntl fcntl
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_IO_FILE *
|
_IO_FILE *
|
||||||
_IO_new_fdopen (fd, mode)
|
_IO_new_fdopen (int fd, const char *mode)
|
||||||
int fd;
|
|
||||||
const char *mode;
|
|
||||||
{
|
{
|
||||||
int read_write;
|
int read_write;
|
||||||
int posix_mode = 0;
|
int posix_mode = 0;
|
||||||
@@ -99,7 +90,7 @@ _IO_new_fdopen (fd, mode)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef F_GETFL
|
#ifdef F_GETFL
|
||||||
fd_flags = _IO_fcntl (fd, F_GETFL);
|
fd_flags = fcntl(fd, F_GETFL);
|
||||||
#ifndef O_ACCMODE
|
#ifndef O_ACCMODE
|
||||||
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
|
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
|
||||||
#endif
|
#endif
|
||||||
@@ -132,7 +123,7 @@ _IO_new_fdopen (fd, mode)
|
|||||||
if ((posix_mode & O_APPEND) && !(fd_flags & O_APPEND))
|
if ((posix_mode & O_APPEND) && !(fd_flags & O_APPEND))
|
||||||
{
|
{
|
||||||
#ifdef F_SETFL
|
#ifdef F_SETFL
|
||||||
if (_IO_fcntl (fd, F_SETFL, fd_flags | O_APPEND) == -1)
|
if (fcntl(fd, F_SETFL, fd_flags | O_APPEND) == -1)
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ _IO_fputs (str, fp)
|
|||||||
{
|
{
|
||||||
_IO_size_t len = strlen (str);
|
_IO_size_t len = strlen (str);
|
||||||
int result = EOF;
|
int result = EOF;
|
||||||
|
|
||||||
CHECK_FILE (fp, EOF);
|
CHECK_FILE (fp, EOF);
|
||||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||||
_IO_flockfile (fp);
|
_IO_flockfile (fp);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
# include <shlib-compat.h>
|
# include <shlib-compat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* Prototypes of libio's codecvt functions. */
|
/* Prototypes of libio's codecvt functions. */
|
||||||
static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
|
static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
|
||||||
__mbstate_t *statep,
|
__mbstate_t *statep,
|
||||||
@@ -87,22 +87,24 @@ struct __gconv_trans_data __libio_translit attribute_hidden =
|
|||||||
.__trans_fct = __gconv_transliterate
|
.__trans_fct = __gconv_transliterate
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Return orientation of stream. If mode is nonzero try to change
|
/* Return orientation of stream. If mode is nonzero try to change
|
||||||
the orientation first. */
|
* the orientation first.
|
||||||
|
*/
|
||||||
|
|
||||||
#undef _IO_fwide
|
#undef _IO_fwide
|
||||||
|
|
||||||
int
|
int
|
||||||
_IO_fwide (fp, mode)
|
_IO_fwide(_IO_FILE *fp, int mode)
|
||||||
_IO_FILE *fp;
|
|
||||||
int mode;
|
|
||||||
{
|
{
|
||||||
/* Normalize the value. */
|
/* Normalize the value. */
|
||||||
mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
|
mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
|
||||||
|
|
||||||
if (mode == 0)
|
if (mode == 0) {
|
||||||
/* The caller simply wants to know about the current orientation. */
|
/* The caller simply wants to know about the current orientation. */
|
||||||
return fp->_mode;
|
return fp->_mode;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined SHARED && defined _LIBC \
|
#if defined SHARED && defined _LIBC \
|
||||||
&& SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
&& SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
||||||
@@ -112,20 +114,25 @@ _IO_fwide (fp, mode)
|
|||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fp->_mode != 0)
|
if (fp->_mode != 0) {
|
||||||
/* The orientation already has been determined. */
|
/* The orientation already has been determined. */
|
||||||
return fp->_mode;
|
return fp->_mode;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the orientation appropriately. */
|
/* Set the orientation appropriately. */
|
||||||
if (mode > 0)
|
if (mode > 0) {
|
||||||
{
|
// wide-orientation is currently disabled!
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
struct _IO_codecvt *cc = fp->_codecvt = &fp->_wide_data->_codecvt;
|
struct _IO_codecvt *cc = fp->_codecvt = &fp->_wide_data->_codecvt;
|
||||||
|
|
||||||
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
|
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
|
||||||
fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_write_base;
|
fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_write_base;
|
||||||
|
|
||||||
/* Get the character conversion functions based on the currently
|
/* Get the character conversion functions based on the currently
|
||||||
selected locale for LC_CTYPE. */
|
* selected locale for LC_CTYPE.
|
||||||
|
*/
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
{
|
{
|
||||||
struct gconv_fcts fcts;
|
struct gconv_fcts fcts;
|
||||||
@@ -208,6 +215,7 @@ _IO_fwide (fp, mode)
|
|||||||
which allows the functions without knowing the position. */
|
which allows the functions without knowing the position. */
|
||||||
fp->_offset = _IO_SYSSEEK (fp, 0, _IO_seek_cur);
|
fp->_offset = _IO_SYSSEEK (fp, 0, _IO_seek_cur);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set the mode now. */
|
/* Set the mode now. */
|
||||||
fp->_mode = mode;
|
fp->_mode = mode;
|
||||||
@@ -215,7 +223,7 @@ _IO_fwide (fp, mode)
|
|||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static enum __codecvt_result
|
static enum __codecvt_result
|
||||||
do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
|
do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
|
||||||
const wchar_t *from_start, const wchar_t *from_end,
|
const wchar_t *from_start, const wchar_t *from_end,
|
||||||
@@ -496,3 +504,4 @@ do_max_length (struct _IO_codecvt *codecvt)
|
|||||||
return MB_CUR_MAX;
|
return MB_CUR_MAX;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -23,12 +23,11 @@
|
|||||||
however invalidate any other reasons why the executable file
|
however invalidate any other reasons why the executable file
|
||||||
might be covered by the GNU Lesser General Public License.
|
might be covered by the GNU Lesser General Public License.
|
||||||
This exception applies to code released by its copyright holders
|
This exception applies to code released by its copyright holders
|
||||||
in files containing the exception. */
|
in files containing the exception.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
#include <stdlib.h>
|
|
||||||
#endif
|
|
||||||
#include "libioP.h"
|
#include "libioP.h"
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
@@ -39,11 +38,7 @@
|
|||||||
null terminator), or -1 on error or EOF. */
|
null terminator), or -1 on error or EOF. */
|
||||||
|
|
||||||
_IO_ssize_t
|
_IO_ssize_t
|
||||||
_IO_getdelim (lineptr, n, delimiter, fp)
|
_IO_getdelim(char **lineptr, _IO_size_t *n, int delimiter, _IO_FILE *fp)
|
||||||
char **lineptr;
|
|
||||||
_IO_size_t *n;
|
|
||||||
int delimiter;
|
|
||||||
_IO_FILE *fp;
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
_IO_ssize_t cur_len = 0;
|
_IO_ssize_t cur_len = 0;
|
||||||
|
|||||||
@@ -77,5 +77,5 @@ weak_alias (_IO_gets, gets)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
link_warning (gets, "the `gets' function is dangerous and should not be used.")
|
//link_warning (gets, "the `gets' function is dangerous and should not be used.")
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,19 +23,21 @@
|
|||||||
however invalidate any other reasons why the executable file
|
however invalidate any other reasons why the executable file
|
||||||
might be covered by the GNU Lesser General Public License.
|
might be covered by the GNU Lesser General Public License.
|
||||||
This exception applies to code released by its copyright holders
|
This exception applies to code released by its copyright holders
|
||||||
in files containing the exception. */
|
in files containing the exception.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "libioP.h"
|
#include "libioP.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
_IO_puts (str)
|
_IO_puts(const char *str)
|
||||||
const char *str;
|
|
||||||
{
|
{
|
||||||
int result = EOF;
|
int result = EOF;
|
||||||
_IO_size_t len = strlen(str);
|
_IO_size_t len = strlen(str);
|
||||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
|
|
||||||
_IO_stdout);
|
_IO_cleanup_region_start((void (*) __P ((void *))) _IO_funlockfile, _IO_stdout);
|
||||||
_IO_flockfile(_IO_stdout);
|
_IO_flockfile(_IO_stdout);
|
||||||
|
|
||||||
if ((_IO_stdout->_vtable_offset != 0 || _IO_fwide(_IO_stdout, -1) == -1)
|
if ((_IO_stdout->_vtable_offset != 0 || _IO_fwide(_IO_stdout, -1) == -1)
|
||||||
@@ -45,6 +47,7 @@ _IO_puts (str)
|
|||||||
|
|
||||||
_IO_funlockfile(_IO_stdout);
|
_IO_funlockfile(_IO_stdout);
|
||||||
_IO_cleanup_region_end(0);
|
_IO_cleanup_region_end(0);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,11 @@ _IO_seekoff_unlocked (fp, offset, dir, mode)
|
|||||||
callback may not know to do the right thing about it.
|
callback may not know to do the right thing about it.
|
||||||
This may be over-kill, but it'll do for now. TODO */
|
This may be over-kill, but it'll do for now. TODO */
|
||||||
if (mode != 0 && ((_IO_fwide (fp, 0) < 0 && _IO_have_backup (fp))
|
if (mode != 0 && ((_IO_fwide (fp, 0) < 0 && _IO_have_backup (fp))
|
||||||
|
#if 0
|
||||||
|| (_IO_fwide (fp, 0) > 0 && _IO_have_wbackup (fp))))
|
|| (_IO_fwide (fp, 0) > 0 && _IO_have_wbackup (fp))))
|
||||||
|
#else
|
||||||
|
))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (dir == _IO_seek_cur && _IO_in_backup (fp))
|
if (dir == _IO_seek_cur && _IO_in_backup (fp))
|
||||||
{
|
{
|
||||||
@@ -63,8 +67,10 @@ _IO_seekoff_unlocked (fp, offset, dir, mode)
|
|||||||
}
|
}
|
||||||
if (_IO_fwide (fp, 0) < 0)
|
if (_IO_fwide (fp, 0) < 0)
|
||||||
INTUSE(_IO_free_backup_area) (fp);
|
INTUSE(_IO_free_backup_area) (fp);
|
||||||
|
#if 0
|
||||||
else
|
else
|
||||||
INTUSE(_IO_free_wbackup_area) (fp);
|
INTUSE(_IO_free_wbackup_area) (fp);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return _IO_SEEKOFF (fp, offset, dir, mode);
|
return _IO_SEEKOFF (fp, offset, dir, mode);
|
||||||
|
|||||||
@@ -23,28 +23,29 @@
|
|||||||
however invalidate any other reasons why the executable file
|
however invalidate any other reasons why the executable file
|
||||||
might be covered by the GNU Lesser General Public License.
|
might be covered by the GNU Lesser General Public License.
|
||||||
This exception applies to code released by its copyright holders
|
This exception applies to code released by its copyright holders
|
||||||
in files containing the exception. */
|
in files containing the exception.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <libioP.h>
|
#include <libioP.h>
|
||||||
|
|
||||||
|
|
||||||
_IO_off64_t
|
_IO_off64_t
|
||||||
_IO_seekpos_unlocked (fp, pos, mode)
|
_IO_seekpos_unlocked(_IO_FILE *fp, _IO_off64_t pos, int mode)
|
||||||
_IO_FILE *fp;
|
|
||||||
_IO_off64_t pos;
|
|
||||||
int mode;
|
|
||||||
{
|
{
|
||||||
/* If we have a backup buffer, get rid of it, since the __seekoff
|
/* If we have a backup buffer, get rid of it, since the __seekoff
|
||||||
callback may not know to do the right thing about it.
|
* callback may not know to do the right thing about it.
|
||||||
This may be over-kill, but it'll do for now. TODO */
|
* This may be over-kill, but it'll do for now. TODO
|
||||||
if (_IO_fwide (fp, 0) <= 0)
|
*/
|
||||||
{
|
|
||||||
|
if (_IO_fwide(fp, 0) <= 0) {
|
||||||
if (_IO_have_backup(fp))
|
if (_IO_have_backup(fp))
|
||||||
INTUSE(_IO_free_backup_area)(fp);
|
INTUSE(_IO_free_backup_area)(fp);
|
||||||
}
|
} else {
|
||||||
else
|
#if 0
|
||||||
{
|
|
||||||
if (_IO_have_wbackup(fp))
|
if (_IO_have_wbackup(fp))
|
||||||
INTUSE(_IO_free_wbackup_area)(fp);
|
INTUSE(_IO_free_wbackup_area)(fp);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return _IO_SEEKPOS(fp, pos, mode);
|
return _IO_SEEKPOS(fp, pos, mode);
|
||||||
@@ -52,10 +53,7 @@ _IO_seekpos_unlocked (fp, pos, mode)
|
|||||||
|
|
||||||
|
|
||||||
_IO_off64_t
|
_IO_off64_t
|
||||||
_IO_seekpos (fp, pos, mode)
|
_IO_seekpos(_IO_FILE *fp, _IO_off64_t pos, int mode)
|
||||||
_IO_FILE *fp;
|
|
||||||
_IO_off64_t pos;
|
|
||||||
int mode;
|
|
||||||
{
|
{
|
||||||
_IO_off64_t retval;
|
_IO_off64_t retval;
|
||||||
|
|
||||||
|
|||||||
@@ -482,6 +482,7 @@ extern int _IO_new_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
|
|||||||
extern int _IO_old_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
|
extern int _IO_old_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||||
# define _IO_do_flush(_f) \
|
# define _IO_do_flush(_f) \
|
||||||
((_f)->_mode <= 0 \
|
((_f)->_mode <= 0 \
|
||||||
@@ -490,11 +491,13 @@ extern int _IO_old_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
|
|||||||
: INTUSE(_IO_wdo_write)(_f, (_f)->_wide_data->_IO_write_base, \
|
: INTUSE(_IO_wdo_write)(_f, (_f)->_wide_data->_IO_write_base, \
|
||||||
((_f)->_wide_data->_IO_write_ptr \
|
((_f)->_wide_data->_IO_write_ptr \
|
||||||
- (_f)->_wide_data->_IO_write_base)))
|
- (_f)->_wide_data->_IO_write_base)))
|
||||||
#else
|
#endif // was #else
|
||||||
|
#endif
|
||||||
|
|
||||||
# define _IO_do_flush(_f) \
|
# define _IO_do_flush(_f) \
|
||||||
INTUSE(_IO_do_write)(_f, (_f)->_IO_write_base, \
|
INTUSE(_IO_do_write)(_f, (_f)->_IO_write_base, \
|
||||||
(_f)->_IO_write_ptr-(_f)->_IO_write_base)
|
(_f)->_IO_write_ptr-(_f)->_IO_write_base)
|
||||||
#endif
|
|
||||||
#define _IO_old_do_flush(_f) \
|
#define _IO_old_do_flush(_f) \
|
||||||
_IO_old_do_write(_f, (_f)->_IO_write_base, \
|
_IO_old_do_write(_f, (_f)->_IO_write_base, \
|
||||||
(_f)->_IO_write_ptr-(_f)->_IO_write_base)
|
(_f)->_IO_write_ptr-(_f)->_IO_write_base)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
/* This is a compatibility file. If we don't build the libc with
|
/* This is a compatibility file. If we don't build the libc with
|
||||||
versioning don't compile this file. */
|
versioning don't compile this file. */
|
||||||
#include <shlib-compat.h>
|
#include <shlib-compat.h>
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
#if 1 /*SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)*/
|
||||||
|
|
||||||
#ifndef _POSIX_SOURCE
|
#ifndef _POSIX_SOURCE
|
||||||
# define _POSIX_SOURCE
|
# define _POSIX_SOURCE
|
||||||
@@ -53,11 +53,11 @@ extern int errno;
|
|||||||
|
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
|
/*# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
|
||||||
# define close(FD) __close (FD)
|
# define close(FD) __close (FD)
|
||||||
# define lseek(FD, Offset, Whence) __lseek (FD, Offset, Whence)
|
# define lseek(FD, Offset, Whence) __lseek (FD, Offset, Whence)
|
||||||
# define read(FD, Buf, NBytes) __read (FD, Buf, NBytes)
|
# define read(FD, Buf, NBytes) __read (FD, Buf, NBytes)
|
||||||
# define write(FD, Buf, NBytes) __write (FD, Buf, NBytes)
|
# define write(FD, Buf, NBytes) __write (FD, Buf, NBytes)*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* An fstream can be in at most one of put mode, get mode, or putback mode.
|
/* An fstream can be in at most one of put mode, get mode, or putback mode.
|
||||||
@@ -775,7 +775,7 @@ struct _IO_jump_t _IO_old_file_jumps =
|
|||||||
JUMP_INIT(close, INTUSE(_IO_file_close)),
|
JUMP_INIT(close, INTUSE(_IO_file_close)),
|
||||||
JUMP_INIT(stat, INTUSE(_IO_file_stat))
|
JUMP_INIT(stat, INTUSE(_IO_file_stat))
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
compat_symbol (libc, _IO_old_do_write, _IO_do_write, GLIBC_2_0);
|
compat_symbol (libc, _IO_old_do_write, _IO_do_write, GLIBC_2_0);
|
||||||
compat_symbol (libc, _IO_old_file_attach, _IO_file_attach, GLIBC_2_0);
|
compat_symbol (libc, _IO_old_file_attach, _IO_file_attach, GLIBC_2_0);
|
||||||
compat_symbol (libc, _IO_old_file_close_it, _IO_file_close_it, GLIBC_2_0);
|
compat_symbol (libc, _IO_old_file_close_it, _IO_file_close_it, GLIBC_2_0);
|
||||||
@@ -789,5 +789,5 @@ compat_symbol (libc, _IO_old_file_seekoff, _IO_file_seekoff, GLIBC_2_0);
|
|||||||
compat_symbol (libc, _IO_old_file_underflow, _IO_file_underflow, GLIBC_2_0);
|
compat_symbol (libc, _IO_old_file_underflow, _IO_file_underflow, GLIBC_2_0);
|
||||||
compat_symbol (libc, _IO_old_file_write, _IO_file_write, GLIBC_2_0);
|
compat_symbol (libc, _IO_old_file_write, _IO_file_write, GLIBC_2_0);
|
||||||
compat_symbol (libc, _IO_old_file_xsputn, _IO_file_xsputn, GLIBC_2_0);
|
compat_symbol (libc, _IO_old_file_xsputn, _IO_file_xsputn, GLIBC_2_0);
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,21 +23,18 @@
|
|||||||
however invalidate any other reasons why the executable file
|
however invalidate any other reasons why the executable file
|
||||||
might be covered by the GNU Lesser General Public License.
|
might be covered by the GNU Lesser General Public License.
|
||||||
This exception applies to code released by its copyright holders
|
This exception applies to code released by its copyright holders
|
||||||
in files containing the exception. */
|
in files containing the exception.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <shlib-compat.h>
|
#include <shlib-compat.h>
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
||||||
|
|
||||||
#define _IO_USE_OLD_IO_FILE
|
#define _IO_USE_OLD_IO_FILE
|
||||||
#ifdef __STDC__
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
#include "libioP.h"
|
#include "libioP.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifndef _IO_fcntl
|
|
||||||
# define _IO_fcntl __fcntl
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_IO_FILE *
|
_IO_FILE *
|
||||||
_IO_old_fdopen (fd, mode)
|
_IO_old_fdopen (fd, mode)
|
||||||
@@ -74,7 +71,7 @@ _IO_old_fdopen (fd, mode)
|
|||||||
if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))
|
if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))
|
||||||
read_write &= _IO_IS_APPENDING;
|
read_write &= _IO_IS_APPENDING;
|
||||||
#ifdef F_GETFL
|
#ifdef F_GETFL
|
||||||
fd_flags = _IO_fcntl (fd, F_GETFL);
|
fd_flags = fcntl(fd, F_GETFL);
|
||||||
#ifndef O_ACCMODE
|
#ifndef O_ACCMODE
|
||||||
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
|
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
|
||||||
#endif
|
#endif
|
||||||
@@ -102,7 +99,7 @@ _IO_old_fdopen (fd, mode)
|
|||||||
if ((posix_mode & O_APPEND) && !(fd_flags & O_APPEND))
|
if ((posix_mode & O_APPEND) && !(fd_flags & O_APPEND))
|
||||||
{
|
{
|
||||||
#ifdef F_SETFL
|
#ifdef F_SETFL
|
||||||
if (_IO_fcntl (fd, F_SETFL, fd_flags | O_APPEND) == -1)
|
if (fcntl(fd, F_SETFL, fd_flags | O_APPEND) == -1)
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
This exception applies to code released by its copyright holders
|
This exception applies to code released by its copyright holders
|
||||||
in files containing the exception. */
|
in files containing the exception. */
|
||||||
|
|
||||||
#include <shlib-compat.h>
|
//#include <shlib-compat.h>
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
//#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
||||||
|
|
||||||
/* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr
|
/* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr
|
||||||
for C code. Compare stdstreams.cc.
|
for C code. Compare stdstreams.cc.
|
||||||
@@ -56,8 +56,8 @@ DEF_STDFILE(_IO_stderr_, 2, &_IO_stdout_, _IO_NO_READS+_IO_UNBUFFERED);
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
extern const int _IO_stdin_used;
|
//extern const int _IO_stdin_used;
|
||||||
weak_extern (_IO_stdin_used);
|
//weak_extern (_IO_stdin_used);
|
||||||
|
|
||||||
#undef stdin
|
#undef stdin
|
||||||
#undef stdout
|
#undef stdout
|
||||||
@@ -76,7 +76,8 @@ static void _IO_check_libio __P ((void)) __attribute__ ((constructor));
|
|||||||
static void
|
static void
|
||||||
_IO_check_libio ()
|
_IO_check_libio ()
|
||||||
{
|
{
|
||||||
if (&_IO_stdin_used == NULL)
|
_kern_debug_output("Hey dude!\n");
|
||||||
|
//if (&_IO_stdin_used == NULL)
|
||||||
{
|
{
|
||||||
/* We are using the old one. */
|
/* We are using the old one. */
|
||||||
_IO_stdin = stdin = (_IO_FILE *) &_IO_stdin_;
|
_IO_stdin = stdin = (_IO_FILE *) &_IO_stdin_;
|
||||||
@@ -93,4 +94,4 @@ _IO_check_libio ()
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
//#endif
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include "libioP.h"
|
#include "libioP.h"
|
||||||
|
|
||||||
#ifdef _IO_MTSAFE_IO
|
#ifdef _IO_MTSAFE_IO
|
||||||
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
/*# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||||
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
||||||
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
|
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
|
||||||
static struct _IO_wide_data _IO_wide_data_##FD \
|
static struct _IO_wide_data _IO_wide_data_##FD \
|
||||||
@@ -44,13 +44,15 @@
|
|||||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
|
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
|
||||||
&INTUSE(_IO_file_jumps)};
|
&INTUSE(_IO_file_jumps)};
|
||||||
# else
|
# else
|
||||||
|
*/
|
||||||
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
||||||
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
|
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
|
||||||
struct _IO_FILE_plus NAME \
|
struct _IO_FILE_plus NAME \
|
||||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
|
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
|
||||||
&INTUSE(_IO_file_jumps)};
|
&INTUSE(_IO_file_jumps)};
|
||||||
# endif
|
//# endif
|
||||||
#else
|
#else
|
||||||
|
/*
|
||||||
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
||||||
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
||||||
static struct _IO_wide_data _IO_wide_data_##FD \
|
static struct _IO_wide_data _IO_wide_data_##FD \
|
||||||
@@ -59,11 +61,12 @@
|
|||||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
|
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
|
||||||
&INTUSE(_IO_file_jumps)};
|
&INTUSE(_IO_file_jumps)};
|
||||||
# else
|
# else
|
||||||
|
*/
|
||||||
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
||||||
struct _IO_FILE_plus NAME \
|
struct _IO_FILE_plus NAME \
|
||||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
|
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
|
||||||
&INTUSE(_IO_file_jumps)};
|
&INTUSE(_IO_file_jumps)};
|
||||||
# endif
|
//# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEF_STDFILE(_IO_2_1_stdin_, 0, 0, _IO_NO_WRITES);
|
DEF_STDFILE(_IO_2_1_stdin_, 0, 0, _IO_NO_WRITES);
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/* Copyright (C) 1993,95,97,98,99,2000,2001,2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with the GNU C Library; if not, write to the Free
|
||||||
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
|
02111-1307 USA.
|
||||||
|
|
||||||
|
As a special exception, if you link the code in this file with
|
||||||
|
files compiled with a GNU compiler to produce an executable,
|
||||||
|
that does not cause the resulting executable to be covered by
|
||||||
|
the GNU Lesser General Public License. This exception does not
|
||||||
|
however invalidate any other reasons why the executable file
|
||||||
|
might be covered by the GNU Lesser General Public License.
|
||||||
|
This exception applies to code released by its copyright holders
|
||||||
|
in files containing the exception.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <libioP.h>
|
||||||
|
|
||||||
|
|
||||||
|
struct _IO_jump_t _IO_wfile_jumps = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
INTVARDEF(_IO_wfile_jumps)
|
||||||
|
|
||||||
|
struct _IO_jump_t _IO_wfile_jumps_mmap = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _IO_jump_t _IO_wfile_jumps_maybe_mmap = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user