Sat Nov 18 16:46:01 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* libio/Makefile, libio/cleanup.c, libio/clearerr.c, libio/feof.c,
libio/ferror.c, libio/fgetc.c, libio/filedoalloc.c, libio/fileno.c,
libio/fileops.c, libio/fputc.c, libio/freopen.c, libio/fseek.c,
libio/genops.c, libio/getc.c, libio/getchar.c, libio/iofclose.c,
libio/iofdopen.c, libio/iofflush.c, libio/iofgetpos.c, libio/iofgets.c,
libio/iofopen.c, libio/iofprintf.c, libio/iofputs.c, libio/iofread.c,
libio/iofscanf.c, libio/iofsetpos.c, libio/ioftell.c, libio/iofwrite.c,
libio/iogetdelim.c, libio/iogetline.c, libio/iogets.c, libio/iolibio.h,
libio/iopadn.c, libio/ioprims.c, libio/ioputs.c, libio/ioseekoff.c,
libio/ioseekpos.c, libio/iosetbuffer.c, libio/iosetvbuf.c,
libio/iosprintf.c, libio/ioungetc.c, libio/iovsprintf.c,
libio/iovsscanf.c, libio/libio.h, libio/libioP.h, libio/putc.c,
libio/putchar.c, libio/rewind.c, libio/setbuf.c, libio/setlinebuf.c,
libio/stdfiles.c, libio/stdio.c, libio/stdio.h, libio/strfile.h,
libio/strops.c, libio/vasprintf.c, libio/vscanf.c, libio/vsnprintf.c:
New files. Slightly modified version from Linux libc.
* libio/memstream.c, libio/vdprintf.c: New files for functions not
(yet) part of GNU libio.
* libio/iofopncook.c: Implementation of `fopencookie', mainly written
by Per Bothner.
* stdio-common/getline.c: Adapted to libio.
* stdio-common/snprintf.c: Adapted to libio.
* stdio-common/vfprintf.c: Adapted to libio.
* stdio-common/vfscanf.c: Adapted to libio.
* sysdeps/posix/tempname.c: Adapted to libio.
1995-11-20 03:48:11 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1993 Free Software Foundation
|
|
|
|
|
|
|
|
This file is part of the GNU IO Library. This library is free
|
|
|
|
software; you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU General Public License as published by the
|
|
|
|
Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This 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 General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this library; see the file COPYING. If not, write to the Free
|
|
|
|
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
As a special exception, if you link this library with files
|
|
|
|
compiled with a GNU compiler to produce an executable, this does not cause
|
|
|
|
the resulting executable to be covered by the GNU General Public License.
|
|
|
|
This exception does not however invalidate any other reasons why
|
|
|
|
the executable file might be covered by the GNU General Public License. */
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#ifndef errno
|
|
|
|
extern int errno;
|
|
|
|
#endif
|
update from main archive 960906
Sat Sep 7 05:15:45 1996 Ulrich Drepper <drepper@cygnus.com>
* libio/iofdopen: Initialize _lock field only if _IO_MTSAFE_IO.
* libio/iofopen: Likewise.
* libio/iofopncook.c: Likewise.
* libio/iopopen.c: Likewise.
* libio/iovsprintf.c: Likewise.
* libio/iovsscanf.c: Likewise.
* libio/memstream.c: Likewise.
* libio/vasprintf.c: Likewise.
* libio/vdprintf.c: Likewise.
* libio/vsnprintf.c: Likewise.
Sat Sep 7 03:55:47 1996 Ulrich Drepper <drepper@cygnus.com>
* Makeconfig (soversions.mk): Also use shlib-versions files
in add-on directories.
* config.make.in (config-defines): Remove. Not used anymore.
(defines): New variable. Initiliazed by @DEFINES@.
* configure.in: Add AC_SUBST(DEFINES).
* libio/Makefile (routines): When compiling reentrant libc add
clearerr_u, feof_u, ferror_u, fputc_u, getc_u, getchar_u,
iofflush_u, putc_u, putchar_u, ioflockfile.
(CPPFLAGS): Add -D_IO_MTSAFE_IO for reentrant libc.
* sysdeps/stub/libc-lock.h: Add stubs for __libc_cleanup_region_start
and __libc_cleanup_region_end.
* sysdeps/unix/i386/sysdep.S [_LIBC_REENTRANT]: Set errno
using __errno_location function.
* sysdeps/unix/sysv/linux/i386/sysdep.S [_LIBC_REENTRANT]: Set errno
using __errno_location function.
(__errno_location): New function.
* sysdeps/unix/sysv/linux/i386/sysdep.h [PIC]: Add second
syscall_error handler for reentrant libc.
* sysdeps/unix/opendir.c: Remove unneeded `;'.
* libio.h [_IO_MTSAFE_IO]: Include <pthread.h>.
[!_IO_MTSAFE_IO]: Define _IO_flockfile and _IO_funlockfile
as empty macros.
* libioP.h: Include <libc-lock.h>.
* libio/stdio.h: Add prototypes for *_locked and *_unlocked
functions.
* libio/clearerr.c: Use _IO_ protected versions of flockfile
and funlockfile to be namespace clean.
* libio/genops.c: Use __libc_lock_* macros for handling lock.
* libio/iofdopen: Add initialization of _lock in _IO_FILE.
* libio/iofopen: Likewise.
* libio/iofopncook.c: Likewise.
* libio/iopopen.c: Likewise.
* libio/iovsprintf.c: Likewise.
* libio/iovsscanf.c: Likewise.
* libio/memstream.c: Likewise.
* libio/vasprintf.c: Likewise.
* libio/vdprintf.c: Likewise.
* libio/vsnprintf.c: Likewise.
* libio/fgetc.c: Use __libc_cleanup_region_* macros instead
of flockfile etc.
* libio/fputc.c: Likewise.
* libio/freopen.c: Likewise.
* libio/fseek.c: Likewise.
* libio/getc.c: Likewise.
* libio/getchar.c: Likewise.
* libio/iofclose.c: Likewise.
* libio/iofflush.c: Likewise.
* libio/iofgetpos.c: Likewise.
* libio/iofgets.c: Likewise.
* libio/iofputs.c: Likewise.
* libio/iofread.c: Likewise.
* libio/iofsetpos.c: Likewise.
* libio/ioftell.c: Likewise.
* libio/iofwrite.c: Likewise.
* libio/iogetdelim.c: Likewise.
* libio/iogets.c: Likewise.
* libio/ioputs.c: Likewise.
* libio/iosetbuffer.c: Likewise.
* libio/iosetvbuf.c: Likewise.
* libio/ioungetc.c: Likewise.
* libio/putc.c: Likewise.
* libio/putchar.c: Likewise.
* libio/rewind.c: Likewise.
* stdio-common/vfprintf.c: Likewise.
* stdio-common/vfscanf.c: Likewise.
* libio/clearerr_u.c: Correct alias name.
* libio/ferror_u.c: Likewise.
* libio/fileno.c: Likewise.
* libio/fputc_u.c: Likewise.
* libio/getc.c: Likewise.
* libio/getc_u.c: Likewise.
* libio/getchar.c: Likewise.
* libio/getchar_u.c: Likewise.
* libio/putc.c: Likewise.
* libio/putchar.c: Likewise.
* libio/feof_u.c: Undefine macro with name of function before
definition of function itself.
* libio/ioflockfile.c: New file. Implementation of flockfile and
funlockfile.
* libio/putchar_u.c: Fix typo. Use stdout instead of fp.
* malloc/malloc.h: Don't include <libc-lock.h> and don't declare
_malloc_loc.
* malloc/free.c: Include <libc-lock.h>.
* malloc/realloc.c: Likewise.
* malloc/malloc-find.c: Likewise.
* malloc/malloc-size.c: Likewise.
* malloc/malloc-walk.c: Likewise.
* malloc/memalign.c: Likewise.
* malloc/malloc.c: Likewise.
* sysdeps/i386/dl-machine.h: Correct clearing of _dl_starting_up.
Fri Sep 6 19:38:49 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/stub/libc-lock.h: Define __libc_lock_critical_start
and __libc_lock_critical_end as empty macros.
* malloc/malloc.h: Don't include <libc-lock.h> and don't declare
__libc_malloc_lock.
* malloc/free.c: Include <libc-lock.h>.
* malloc/malloc-find.c: Likewise.
* malloc/malloc-size.c: Likewise.
* malloc/malloc-walk.c: Likewise.
* malloc/malloc.c: Likewise.
* malloc/memalign.c: Likewise.
* malloc/realloc.c: Likewise.
* Makefile: Undo change from Mon Sep 2 22:15:14 1996. No more
extra_solibs pass.
* Rules: Likewise.
* extra-lib.mk: Likewise.
* manual/Makefile: Likewise.
* db/Makefile (makedb): Choose dependecies based on build-shared.
Patch by Andres Schwab.
* sysdeps/posix/sysconf.c: Don't use PTHREAD_DESTRUCTOR_ITERATIONS
but _POSIX_THREAD_DESTRUCTOR_ITERATIONS.
* sysdeps/unix/sysv/linux/errnos.h: New file.
* sysdeps/unix/sysv/linux/schedbits.h: New file.
* sysdeps/unix/sysv/linux/waitflags.h: New file.
* sysdeps/unix/sysv/linux/gnu/types.h: Add definition of `key_t'.
Fri Sep 6 08:26:31 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* rpm/template: Fix typo in %build section.
Fri Sep 6 03:31:07 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/errnos.h: Don't define errno macro when
building libc without thread support.
* resolv/netdb.h: Likewise for h_errno macro.
Thu Sep 5 23:01:48 1996 Ulrich Drepper <drepper@cygnus.com>
* libc-symbols.h: Add new macro weak_const_function. It's like
weak_function, but the function is additionally marked as const.
* features.h: Only include <sys/cdefs.h> if !__ASSEMBLER__.
Thu Sep 5 22:55:49 1996 Richard Henderson <rth@tamu.edu>
* inet/herrno.c (__h_errno_location): New function.
(h_errno): Make strong_alias __h_errno so that we can access
the variable even if `h_errno' is a macro.
* resolv/netdb.h: Define macro h_errno to access thread specific
version of h_errno variable. Declare alias __h_errno for h_errno.
* resolv/res_query (h_errno): Remove definition.
* sysdeps/unix/sysv/linux/errnos.h [!__ASSEMBLER__ && __USE_REENTRANT]:
Add macro `errno' to get thread specific variable.
* sysdeps/unix/alpha/sysdep.S [_LIBC_REENTRANT]: Set errno using
__errno_location function.
(__errno_location): New function.
Thu Sep 5 21:08:44 1996 Ulrich Drepper <drepper@cygnus.com>
* posix/gnu/types.h: Remove definition of key_t.
* sysdeps/generic/gnu/types.h: Move it to here.
* sysdeps/unix/sysv/linux/gnu/types.h: Add Linux specific
definition of key_t.
* sysdeps/unix/sysv/linux/waitflags.h: New file. Linux specific
definitions.
* sysdeps/unix/sysv/linux/schedbits.h: New file. Include
clone prototypes and associated flags.
Thu Sep 5 08:58:47 1996 Richard Henderson <rth@tamu.edu>
* sysdeps/alpha/elf/start.S: Make _start global again.
hertz.
here.
Wed Sep 4 16:16:13 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/mach/hurd/send.c (__send): De-ANSI-fy.
* sysdeps/mach/hurd/sendto.c (sendto): Likewise.
1996-09-07 04:10:57 +00:00
|
|
|
#include <libc-lock.h>
|
Sat Nov 18 16:46:01 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* libio/Makefile, libio/cleanup.c, libio/clearerr.c, libio/feof.c,
libio/ferror.c, libio/fgetc.c, libio/filedoalloc.c, libio/fileno.c,
libio/fileops.c, libio/fputc.c, libio/freopen.c, libio/fseek.c,
libio/genops.c, libio/getc.c, libio/getchar.c, libio/iofclose.c,
libio/iofdopen.c, libio/iofflush.c, libio/iofgetpos.c, libio/iofgets.c,
libio/iofopen.c, libio/iofprintf.c, libio/iofputs.c, libio/iofread.c,
libio/iofscanf.c, libio/iofsetpos.c, libio/ioftell.c, libio/iofwrite.c,
libio/iogetdelim.c, libio/iogetline.c, libio/iogets.c, libio/iolibio.h,
libio/iopadn.c, libio/ioprims.c, libio/ioputs.c, libio/ioseekoff.c,
libio/ioseekpos.c, libio/iosetbuffer.c, libio/iosetvbuf.c,
libio/iosprintf.c, libio/ioungetc.c, libio/iovsprintf.c,
libio/iovsscanf.c, libio/libio.h, libio/libioP.h, libio/putc.c,
libio/putchar.c, libio/rewind.c, libio/setbuf.c, libio/setlinebuf.c,
libio/stdfiles.c, libio/stdio.c, libio/stdio.h, libio/strfile.h,
libio/strops.c, libio/vasprintf.c, libio/vscanf.c, libio/vsnprintf.c:
New files. Slightly modified version from Linux libc.
* libio/memstream.c, libio/vdprintf.c: New files for functions not
(yet) part of GNU libio.
* libio/iofopncook.c: Implementation of `fopencookie', mainly written
by Per Bothner.
* stdio-common/getline.c: Adapted to libio.
* stdio-common/snprintf.c: Adapted to libio.
* stdio-common/vfprintf.c: Adapted to libio.
* stdio-common/vfscanf.c: Adapted to libio.
* sysdeps/posix/tempname.c: Adapted to libio.
1995-11-20 03:48:11 +00:00
|
|
|
|
|
|
|
#include "iolibio.h"
|
|
|
|
|
|
|
|
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__cplusplus)
|
|
|
|
/* All known AIX compilers implement these things (but don't always
|
|
|
|
define __STDC__). The RISC/OS MIPS compiler defines these things
|
|
|
|
in SVR4 mode, but does not define __STDC__. */
|
|
|
|
|
|
|
|
#define AND ,
|
|
|
|
#define DEFUN(name, arglist, args) name(args)
|
|
|
|
#define DEFUN_VOID(name) name(void)
|
|
|
|
|
|
|
|
#else /* Not ANSI C. */
|
|
|
|
|
|
|
|
#define AND ;
|
|
|
|
#ifndef const /* some systems define it in header files for non-ansi mode */
|
|
|
|
#define const
|
|
|
|
#endif
|
|
|
|
#define DEFUN(name, arglist, args) name arglist args;
|
|
|
|
#define DEFUN_VOID(name) name()
|
|
|
|
#endif /* ANSI C. */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define _IO_seek_set 0
|
|
|
|
#define _IO_seek_cur 1
|
|
|
|
#define _IO_seek_end 2
|
|
|
|
|
|
|
|
typedef int (*_IO_overflow_t) __P((_IO_FILE*, int));
|
|
|
|
typedef int (*_IO_underflow_t) __P((_IO_FILE*));
|
|
|
|
typedef _IO_size_t (*_IO_xsputn_t) __P((_IO_FILE*,const void*,_IO_size_t));
|
|
|
|
typedef _IO_size_t (*_IO_xsgetn_t) __P((_IO_FILE*, void*, _IO_size_t));
|
|
|
|
typedef _IO_ssize_t (*_IO_read_t) __P((_IO_FILE*, void*, _IO_ssize_t));
|
|
|
|
typedef _IO_ssize_t (*_IO_write_t) __P((_IO_FILE*,const void*,_IO_ssize_t));
|
|
|
|
typedef int (*_IO_stat_t) __P((_IO_FILE*, void*));
|
|
|
|
typedef _IO_fpos_t (*_IO_seek_t) __P((_IO_FILE*, _IO_off_t, int));
|
|
|
|
typedef int (*_IO_doallocate_t) __P((_IO_FILE*));
|
|
|
|
typedef int (*_IO_pbackfail_t) __P((_IO_FILE*, int));
|
|
|
|
typedef _IO_FILE* (*_IO_setbuf_t) __P((_IO_FILE*, char *, _IO_ssize_t));
|
|
|
|
typedef int (*_IO_sync_t) __P((_IO_FILE*));
|
|
|
|
typedef void (*_IO_finish_t) __P((_IO_FILE*)); /* finalize */
|
|
|
|
typedef int (*_IO_close_t) __P((_IO_FILE*)); /* finalize */
|
|
|
|
typedef _IO_fpos_t (*_IO_seekoff_t) __P((_IO_FILE*, _IO_off_t, int, int));
|
|
|
|
|
|
|
|
/* The _IO_seek_cur and _IO_seek_end options are not allowed. */
|
|
|
|
typedef _IO_fpos_t (*_IO_seekpos_t) __P((_IO_FILE*, _IO_fpos_t, int));
|
|
|
|
|
|
|
|
#if !_IO_UNIFIED_JUMPTABLES
|
|
|
|
#define _IO_JUMPS(THIS) (THIS)->_jumps
|
|
|
|
#else
|
|
|
|
#define _IO_JUMPS(THIS) ((struct _IO_FILE_plus*)(THIS))->vtable
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !_IO_UNIFIED_JUMPTABLES
|
|
|
|
#define JUMP_FIELD(TYPE, NAME) TYPE NAME
|
|
|
|
#define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC(THIS)
|
|
|
|
#define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC(THIS, X1)
|
|
|
|
#define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC(THIS, X1, X2)
|
|
|
|
#define JUMP3(FUNC, THIS, X1, X2, X3) _IO_JUMPS(THIS)->FUNC(THIS, X1, X2, X3)
|
|
|
|
#define JUMP_INIT(NAME, VALUE) VALUE
|
|
|
|
#else
|
|
|
|
#define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME
|
|
|
|
#define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC.pfn(THIS)
|
|
|
|
#define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC.pfn(THIS, X1)
|
|
|
|
#define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC.pfn(THIS, X1, X2)
|
|
|
|
#define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC.pfn(THIS, X1,X2, X3)
|
|
|
|
#define JUMP_INIT(NAME, VALUE) {0, 0, VALUE}
|
|
|
|
#endif
|
|
|
|
#define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0)
|
|
|
|
|
|
|
|
#define _IO_FINISH(FP) JUMP0(__finish, FP)
|
|
|
|
#define _IO_OVERFLOW(FP, CH) JUMP1(__overflow, FP, CH)
|
|
|
|
#define _IO_UNDERFLOW(FP) JUMP0(__underflow, FP)
|
|
|
|
#define _IO_UFLOW(FP) JUMP0(__uflow, FP)
|
|
|
|
#define _IO_PBACKFAIL(FP, CH) JUMP1(__pbackfail, FP, CH)
|
|
|
|
#define _IO_XSPUTN(FP, DATA, N) JUMP2(__xsputn, FP, DATA, N)
|
|
|
|
#define _IO_XSGETN(FP, DATA, N) JUMP2(__xsgetn, FP, DATA, N)
|
|
|
|
#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3(__seekoff, FP, OFF, DIR, MODE)
|
|
|
|
#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2(__seekpos, FP, POS, FLAGS)
|
|
|
|
#define _IO_SETBUF(FP, BUFFER, LENGTH) JUMP2(__setbuf, FP, BUFFER, LENGTH)
|
|
|
|
#define _IO_SYNC(FP) JUMP0(__sync, FP)
|
|
|
|
#define _IO_DOALLOCATE(FP) JUMP0(__doallocate, FP)
|
|
|
|
#define _IO_SYSREAD(FP, DATA, LEN) JUMP2(__read, FP, DATA, LEN)
|
|
|
|
#define _IO_SYSWRITE(FP, DATA, LEN) JUMP2(__write, FP, DATA, LEN)
|
|
|
|
#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2(__seek, FP, OFFSET, MODE)
|
|
|
|
#define _IO_SYSCLOSE(FP) JUMP0(__close, FP)
|
|
|
|
#define _IO_SYSSTAT(FP, BUF) JUMP1(__stat, FP, BUF)
|
|
|
|
|
|
|
|
#define _IO_CHAR_TYPE char /* unsigned char ? */
|
|
|
|
#define _IO_INT_TYPE int
|
|
|
|
|
|
|
|
struct _IO_jump_t {
|
|
|
|
JUMP_FIELD(_G_size_t, __dummy);
|
|
|
|
JUMP_FIELD(_IO_finish_t, __finish);
|
|
|
|
JUMP_FIELD(_IO_overflow_t, __overflow);
|
|
|
|
JUMP_FIELD(_IO_underflow_t, __underflow);
|
|
|
|
JUMP_FIELD(_IO_underflow_t, __uflow);
|
|
|
|
JUMP_FIELD(_IO_pbackfail_t, __pbackfail);
|
|
|
|
/* showmany */
|
|
|
|
JUMP_FIELD(_IO_xsputn_t, __xsputn);
|
|
|
|
JUMP_FIELD(_IO_xsgetn_t, __xsgetn);
|
|
|
|
JUMP_FIELD(_IO_seekoff_t, __seekoff);
|
|
|
|
JUMP_FIELD(_IO_seekpos_t, __seekpos);
|
|
|
|
JUMP_FIELD(_IO_setbuf_t, __setbuf);
|
|
|
|
JUMP_FIELD(_IO_sync_t, __sync);
|
|
|
|
JUMP_FIELD(_IO_doallocate_t, __doallocate);
|
|
|
|
JUMP_FIELD(_IO_read_t, __read);
|
|
|
|
JUMP_FIELD(_IO_write_t, __write);
|
|
|
|
JUMP_FIELD(_IO_seek_t, __seek);
|
|
|
|
JUMP_FIELD(_IO_close_t, __close);
|
|
|
|
JUMP_FIELD(_IO_stat_t, __stat);
|
|
|
|
#if 0
|
|
|
|
get_column;
|
|
|
|
set_column;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/* We always allocate an extra word following an _IO_FILE.
|
|
|
|
This is for compatibility with C++ streambuf; the word can
|
|
|
|
be used to smash to a pointer to a virtual function table. */
|
|
|
|
|
|
|
|
struct _IO_FILE_plus {
|
|
|
|
_IO_FILE file;
|
|
|
|
#if _IO_UNIFIED_JUMPTABLES
|
|
|
|
const struct _IO_jump_t *vtable;
|
|
|
|
#else
|
|
|
|
const void *vtable;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Generic functions */
|
|
|
|
|
|
|
|
extern _IO_fpos_t _IO_seekoff __P((_IO_FILE*, _IO_off_t, int, int));
|
|
|
|
extern _IO_fpos_t _IO_seekpos __P((_IO_FILE*, _IO_fpos_t, int));
|
|
|
|
|
|
|
|
extern int _IO_switch_to_get_mode __P((_IO_FILE*));
|
|
|
|
extern void _IO_init __P((_IO_FILE*, int));
|
|
|
|
extern int _IO_sputbackc __P((_IO_FILE*, int));
|
|
|
|
extern int _IO_sungetc __P((_IO_FILE*));
|
|
|
|
extern void _IO_un_link __P((_IO_FILE*));
|
|
|
|
extern void _IO_link_in __P((_IO_FILE *));
|
|
|
|
extern void _IO_doallocbuf __P((_IO_FILE*));
|
|
|
|
extern void _IO_unsave_markers __P((_IO_FILE*));
|
|
|
|
extern void _IO_setb __P((_IO_FILE*, char*, char*, int));
|
|
|
|
extern unsigned _IO_adjust_column __P((unsigned, const char *, int));
|
|
|
|
#define _IO_sputn(__fp, __s, __n) _IO_XSPUTN(__fp, __s, __n)
|
|
|
|
|
|
|
|
/* Marker-related function. */
|
|
|
|
|
|
|
|
extern void _IO_init_marker __P((struct _IO_marker *, _IO_FILE *));
|
|
|
|
extern void _IO_remove_marker __P((struct _IO_marker*));
|
|
|
|
extern int _IO_marker_difference __P((struct _IO_marker *, struct _IO_marker *));
|
|
|
|
extern int _IO_marker_delta __P((struct _IO_marker *));
|
|
|
|
extern int _IO_seekmark __P((_IO_FILE *, struct _IO_marker *, int));
|
|
|
|
|
|
|
|
/* Default jumptable functions. */
|
|
|
|
|
|
|
|
extern int _IO_default_underflow __P((_IO_FILE*));
|
|
|
|
extern int _IO_default_uflow __P((_IO_FILE*));
|
|
|
|
extern int _IO_default_doallocate __P((_IO_FILE*));
|
|
|
|
extern void _IO_default_finish __P((_IO_FILE *));
|
|
|
|
extern int _IO_default_pbackfail __P((_IO_FILE*, int));
|
|
|
|
extern _IO_FILE* _IO_default_setbuf __P((_IO_FILE *, char*, _IO_ssize_t));
|
|
|
|
extern _IO_size_t _IO_default_xsputn __P((_IO_FILE *, const void*, _IO_size_t));
|
|
|
|
extern _IO_size_t _IO_default_xsgetn __P((_IO_FILE *, void*, _IO_size_t));
|
|
|
|
extern _IO_fpos_t _IO_default_seekoff __P((_IO_FILE*, _IO_off_t, int, int));
|
|
|
|
extern _IO_fpos_t _IO_default_seekpos __P((_IO_FILE*, _IO_fpos_t, int));
|
|
|
|
extern _IO_ssize_t _IO_default_write __P((_IO_FILE*,const void*,_IO_ssize_t));
|
|
|
|
extern _IO_ssize_t _IO_default_read __P((_IO_FILE*, void*, _IO_ssize_t));
|
|
|
|
extern int _IO_default_stat __P((_IO_FILE*, void*));
|
|
|
|
extern _IO_fpos_t _IO_default_seek __P((_IO_FILE*, _IO_off_t, int));
|
|
|
|
extern int _IO_default_sync __P((_IO_FILE*));
|
|
|
|
#define _IO_default_close ((_IO_close_t)_IO_default_sync)
|
|
|
|
|
|
|
|
extern struct _IO_jump_t _IO_file_jumps;
|
|
|
|
extern struct _IO_jump_t _IO_streambuf_jumps;
|
|
|
|
extern struct _IO_jump_t _IO_proc_jumps;
|
|
|
|
extern struct _IO_jump_t _IO_str_jumps;
|
|
|
|
extern int _IO_do_write __P((_IO_FILE*, const char*, _IO_size_t));
|
|
|
|
extern int _IO_flush_all __P((void));
|
|
|
|
extern void _IO_cleanup __P((void));
|
|
|
|
extern void _IO_flush_all_linebuffered __P((void));
|
|
|
|
|
|
|
|
#define _IO_do_flush(_f) \
|
|
|
|
_IO_do_write(_f, (_f)->_IO_write_base, \
|
|
|
|
(_f)->_IO_write_ptr-(_f)->_IO_write_base)
|
|
|
|
#define _IO_in_put_mode(_fp) ((_fp)->_flags & _IO_CURRENTLY_PUTTING)
|
|
|
|
#define _IO_mask_flags(fp, f, mask) \
|
|
|
|
((fp)->_flags = ((fp)->_flags & ~(mask)) | ((f) & (mask)))
|
|
|
|
#define _IO_setg(fp, eb, g, eg) ((fp)->_IO_read_base = (eb),\
|
|
|
|
(fp)->_IO_read_ptr = (g), (fp)->_IO_read_end = (eg))
|
|
|
|
#define _IO_setp(__fp, __p, __ep) \
|
|
|
|
((__fp)->_IO_write_base = (__fp)->_IO_write_ptr = __p, (__fp)->_IO_write_end = (__ep))
|
|
|
|
#define _IO_have_backup(fp) ((fp)->_IO_save_base != NULL)
|
|
|
|
#define _IO_in_backup(fp) ((fp)->_flags & _IO_IN_BACKUP)
|
|
|
|
#define _IO_have_markers(fp) ((fp)->_markers != NULL)
|
|
|
|
#define _IO_blen(p) ((fp)->_IO_buf_end - (fp)->_IO_buf_base)
|
|
|
|
|
|
|
|
/* Jumptable functions for files. */
|
|
|
|
|
|
|
|
extern int _IO_file_doallocate __P((_IO_FILE*));
|
|
|
|
extern _IO_FILE* _IO_file_setbuf __P((_IO_FILE *, char*, _IO_ssize_t));
|
|
|
|
extern _IO_fpos_t _IO_file_seekoff __P((_IO_FILE*, _IO_off_t, int, int));
|
|
|
|
extern _IO_size_t _IO_file_xsputn __P((_IO_FILE*,const void*,_IO_size_t));
|
|
|
|
extern int _IO_file_stat __P((_IO_FILE*, void*));
|
|
|
|
extern int _IO_file_close __P((_IO_FILE*));
|
|
|
|
extern int _IO_file_underflow __P((_IO_FILE *));
|
|
|
|
extern int _IO_file_overflow __P((_IO_FILE *, int));
|
|
|
|
#define _IO_file_is_open(__fp) ((__fp)->_fileno >= 0)
|
|
|
|
extern void _IO_file_init __P((_IO_FILE*));
|
|
|
|
extern _IO_FILE* _IO_file_attach __P((_IO_FILE*, int));
|
|
|
|
extern _IO_FILE* _IO_file_fopen __P((_IO_FILE*, const char*, const char*));
|
|
|
|
extern _IO_ssize_t _IO_file_write __P((_IO_FILE*,const void*,_IO_ssize_t));
|
|
|
|
extern _IO_ssize_t _IO_file_read __P((_IO_FILE*, void*, _IO_ssize_t));
|
|
|
|
extern int _IO_file_sync __P((_IO_FILE*));
|
|
|
|
extern int _IO_file_close_it __P((_IO_FILE*));
|
|
|
|
extern _IO_fpos_t _IO_file_seek __P((_IO_FILE *, _IO_off_t, int));
|
|
|
|
extern void _IO_file_finish __P((_IO_FILE*));
|
|
|
|
|
|
|
|
/* Other file functions. */
|
|
|
|
extern _IO_FILE* _IO_file_attach __P((_IO_FILE *, int));
|
|
|
|
|
|
|
|
/* Jumptable functions for proc_files. */
|
|
|
|
extern _IO_FILE* _IO_proc_open __P((_IO_FILE*, const char*, const char *));
|
|
|
|
extern int _IO_proc_close __P((_IO_FILE*));
|
|
|
|
|
|
|
|
/* Jumptable functions for strfiles. */
|
|
|
|
extern int _IO_str_underflow __P((_IO_FILE*));
|
|
|
|
extern int _IO_str_overflow __P((_IO_FILE *, int));
|
|
|
|
extern int _IO_str_pbackfail __P((_IO_FILE*, int));
|
|
|
|
extern _IO_fpos_t _IO_str_seekoff __P((_IO_FILE*,_IO_off_t,int,int));
|
|
|
|
extern void _IO_str_finish __P ((_IO_FILE*));
|
|
|
|
|
|
|
|
/* Other strfile functions */
|
|
|
|
extern void _IO_str_init_static __P((_IO_FILE *, char*, int, char*));
|
|
|
|
extern void _IO_str_init_readonly __P((_IO_FILE *, const char*, int));
|
|
|
|
extern _IO_ssize_t _IO_str_count __P ((_IO_FILE*));
|
|
|
|
|
Wed May 22 22:10:01 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* stdlib/canonicalize.c: New file.
* stdlib/stdlib.h: Declare canonicalize_file_name, realpath.
* stdlib/Makefile (routines): Add canonicalize.
* posix/unistd.h: Declare __canonicalize_directory_name_internal.
Thu May 23 00:01:10 1996 Ulrich Drepper <drepper@cygnus.com>
* db/recno/rec_seq.c: Prevent `sccsid' definition by using the
same #if condition as in the other db files.
* intl/Makefile: Add -Wno-unused CFLAGS for compilation of
bindtextdom.c, finddomain.c, and localealias.c.
* intl/dcgettext.c: Don't define prototype for getcwd() when
compiling in glibc.
* libio/cleanup.c: Add prototype for _IO_register_cleanup.
* libio/filedoalloc.c, libio/fileops.c, libio/iopopen.c: Don't
define _POSIX_SOURCE unconditionally.
* libio/filedoalloc.c, libio/iopopen.c: Include <unistd.h> if
compiling in glibc.
* libio/fileops.c (_IO_file_close_it): Don't sync file, call
flush instead. This relaxes the rules from POSIX.1 about
changing the active handle a bit.
* libio/iofopncook.c (struct _IO_cookie_file): Move definition
into <libio.h>.
Add prototypes for local functions to prevent warnings.
* libio/iopopen.c: Change prototypes for _IO_fork, _IO_pipe, and
_IO_DUP2 to contain complete parameter list.
* libio/libio.h: Add definition of struct _IO_cookie_file.
* libio/libioP.h: Add prototypes for _IO_vasprintf, _IO_vdprintf,
and _IO_vsnprintf.
* libio/memstream.c: Include <stdio.h>.
* libio/stdio.h: Add prototypes for fopencookie,
__stdio_gen_tempname, __vfscanf, __vsscanf, and __vsnprintf.
* libio/strops.c: Avoid useless expression in `for' initializer.
* locale/findlocale.c: Add some casts to prevent warnings.
* locale/programs/locfile.c (write_locale_data): Don't use
double `/' in locale binary file.
* posix/unistd.h: Remove prototype for `reboot'.
Update from bind-4.9.4-T1A.
* resolv/Makefile (routines): Add inet_ntop and inet_pton.
* resolv/arpa/nameser.h: Add definition of IN6ADDRSZ.
* resolv/gethnamaddr.c, resolv/getnetnamadr.c, resolv/res_comp.c,
resolv/res_debug.c, resolv/res_init.c
* resolv/inet_ntop.c, resolv/inet_pton.c: New files.
* resolv/resolv.h: Add RES_USE_INET6 flag.
(__dn_isvalid): Renamed to __res_dnok.
Add prototypes for __res_ownok and __res_mailok.
* stdio-common/Makefile: Add -Wno-unused to CFLAGS for _itoa.c.
* stdio-common/getline.c, stdio-common/vfscanf.c,
sysdeps/posix/tempname.c: Don't use <ansidecl.h> anymore.
* sysdeps/unix/sysv/linux/Makefile [$subdir == misc]
(sysdep_routines): Add s_reboot.
(install-others): Add $(includedir)/sys/syscall.h.
New rule for $(includedir)/sys/syscall.h to produce from
<asm/unistd.h>.
* sysdeps/unix/sysv/linux/reboot.c: New file. Make single
argument function call 3 argument system call.
* sysdeps/unix/sysv/linux/sys/reboot.h: New file. Linux specific
definition for reboot function.
* sysdeps/unix/sysv/linux/syscall.h: Remove old and obsolete
comment.
* sysdeps/unix/sysv/linux/syscalls.list: Rename function for
reboot syscall to __syscall_reboot.
* wcsmbs/wchar.h: Protect prototypes for wcstof and wcstold by
__USE_GNU, not USE_GNU.
Tue May 21 21:55:49 1996 David Mosberger-Tang <davidm@AZStarNet.com>
* locale/programs/charset.c, locale/programs/ld-collate.c:
Add casts to prevent warnings on 64-bit machines.
* locale/programs/ld-monetary.c: Don't do unnecessary tests for
int_frac_digits and frac_digits which only produce warnings.
Mon May 13 23:45:29 1996 David Mosberger-Tang <davidm@AZStarNet.com>
* inet/arpa/inet.h: Backup return type of inet_addr to u_long.
* resolv/inet_addr.c: Likewise.
* resolv/Makefile (distribute): Add res_hconf.h
(routines): Add res_hconf.
* resolv/gethnamaddr.c: Add support for /etc/host.conf.
* resolv/res_init.c: Initialize /etc/host.conf reader.
* resolv/res_hconf.c, resolv/res_hconf.h: New files.
Implementation of reading /etc/host.conf.
Wed May 22 21:21:15 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* Rules (%.out rules): Prepend $($*-ENV) to the command.
* sysdeps/unix/sysv/linux/i386/brk.c (___brk_addr): Define as weak
alias for __curbrk.
Wed May 22 19:37:27 1996 Miles Bader <miles@gnu.ai.mit.edu>
* hurd/hurdexec.c (_hurd_exec): Pass INIT_TRACEMASK.
* hurd/hurdmsg.c (set_int): Support INIT_TRACEMASK.
Wed May 22 18:47:31 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* sysdeps/mach/hurd/getcwd.c
(_hurd_canonicalize_directory_name_internal): New function, broken out
of __getcwd.
(__getcwd): Use it.
(__canonicalize_directory_name_internal): New function using it.
* sysdeps/posix/getcwd.c (__canonicalize_directory_name_internal): New
function, broken out of __getcwd.
(__getcwd): Use it.
Wed May 22 18:14:05 1996 Miles Bader <miles@gnu.ai.mit.edu>
* string/argz-create.c (__argz_create): Correctly calculate length.
* string/argz-extract.c (__argz_extract): Add terminating 0 entry.
* hurd/hurdstartup.c (_hurd_startup): ... and don't so here.
[HAVE_VMSDIR_H]: Include "vmsdir.h".
(glob) [VMS]: Don't grok ~.
1996-05-23 03:15:42 +00:00
|
|
|
extern int _IO_vasprintf __P ((char **result_ptr, __const char *format,
|
|
|
|
_IO_va_list args));
|
|
|
|
extern int _IO_vdprintf __P ((int d, __const char *format, _IO_va_list arg));
|
|
|
|
extern int _IO_vsnprintf __P ((char *string, _IO_size_t maxlen,
|
|
|
|
__const char *format, _IO_va_list args));
|
|
|
|
|
|
|
|
|
Sat Nov 18 16:46:01 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* libio/Makefile, libio/cleanup.c, libio/clearerr.c, libio/feof.c,
libio/ferror.c, libio/fgetc.c, libio/filedoalloc.c, libio/fileno.c,
libio/fileops.c, libio/fputc.c, libio/freopen.c, libio/fseek.c,
libio/genops.c, libio/getc.c, libio/getchar.c, libio/iofclose.c,
libio/iofdopen.c, libio/iofflush.c, libio/iofgetpos.c, libio/iofgets.c,
libio/iofopen.c, libio/iofprintf.c, libio/iofputs.c, libio/iofread.c,
libio/iofscanf.c, libio/iofsetpos.c, libio/ioftell.c, libio/iofwrite.c,
libio/iogetdelim.c, libio/iogetline.c, libio/iogets.c, libio/iolibio.h,
libio/iopadn.c, libio/ioprims.c, libio/ioputs.c, libio/ioseekoff.c,
libio/ioseekpos.c, libio/iosetbuffer.c, libio/iosetvbuf.c,
libio/iosprintf.c, libio/ioungetc.c, libio/iovsprintf.c,
libio/iovsscanf.c, libio/libio.h, libio/libioP.h, libio/putc.c,
libio/putchar.c, libio/rewind.c, libio/setbuf.c, libio/setlinebuf.c,
libio/stdfiles.c, libio/stdio.c, libio/stdio.h, libio/strfile.h,
libio/strops.c, libio/vasprintf.c, libio/vscanf.c, libio/vsnprintf.c:
New files. Slightly modified version from Linux libc.
* libio/memstream.c, libio/vdprintf.c: New files for functions not
(yet) part of GNU libio.
* libio/iofopncook.c: Implementation of `fopencookie', mainly written
by Per Bothner.
* stdio-common/getline.c: Adapted to libio.
* stdio-common/snprintf.c: Adapted to libio.
* stdio-common/vfprintf.c: Adapted to libio.
* stdio-common/vfscanf.c: Adapted to libio.
* sysdeps/posix/tempname.c: Adapted to libio.
1995-11-20 03:48:11 +00:00
|
|
|
extern _IO_size_t _IO_getline __P((_IO_FILE*,char*,_IO_size_t,int,int));
|
|
|
|
extern _IO_ssize_t _IO_getdelim __P((char**, _IO_size_t*, int, _IO_FILE*));
|
|
|
|
extern double _IO_strtod __P((const char *, char **));
|
|
|
|
extern char * _IO_dtoa __P((double __d, int __mode, int __ndigits,
|
|
|
|
int *__decpt, int *__sign, char **__rve));
|
|
|
|
extern int _IO_outfloat __P((double __value, _IO_FILE *__sb, int __type,
|
|
|
|
int __width, int __precision, int __flags,
|
|
|
|
int __sign_mode, int __fill));
|
|
|
|
|
|
|
|
extern _IO_FILE *_IO_list_all;
|
|
|
|
extern void (*_IO_cleanup_registration_needed) __P ((void));
|
|
|
|
|
|
|
|
#ifndef EOF
|
|
|
|
#define EOF (-1)
|
|
|
|
#endif
|
|
|
|
#ifndef NULL
|
|
|
|
#if !defined(__cplusplus) || defined(__GNUC__)
|
|
|
|
#define NULL ((void*)0)
|
|
|
|
#else
|
|
|
|
#define NULL (0)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FREE_BUF(_B) free(_B)
|
|
|
|
#define ALLOC_BUF(_S) (char*)malloc(_S)
|
|
|
|
|
|
|
|
#ifndef OS_FSTAT
|
|
|
|
#define OS_FSTAT fstat
|
|
|
|
#endif
|
|
|
|
struct stat;
|
|
|
|
extern _IO_ssize_t _IO_read __P((int, void*, _IO_size_t));
|
|
|
|
extern _IO_ssize_t _IO_write __P((int, const void*, _IO_size_t));
|
|
|
|
extern _IO_off_t _IO_lseek __P((int, _IO_off_t, int));
|
|
|
|
extern int _IO_close __P((int));
|
|
|
|
extern int _IO_fstat __P((int, struct stat *));
|
1996-06-23 01:31:00 +00:00
|
|
|
extern int _IO_vscanf __P((const char *, _IO_va_list));
|
Sat Nov 18 16:46:01 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* libio/Makefile, libio/cleanup.c, libio/clearerr.c, libio/feof.c,
libio/ferror.c, libio/fgetc.c, libio/filedoalloc.c, libio/fileno.c,
libio/fileops.c, libio/fputc.c, libio/freopen.c, libio/fseek.c,
libio/genops.c, libio/getc.c, libio/getchar.c, libio/iofclose.c,
libio/iofdopen.c, libio/iofflush.c, libio/iofgetpos.c, libio/iofgets.c,
libio/iofopen.c, libio/iofprintf.c, libio/iofputs.c, libio/iofread.c,
libio/iofscanf.c, libio/iofsetpos.c, libio/ioftell.c, libio/iofwrite.c,
libio/iogetdelim.c, libio/iogetline.c, libio/iogets.c, libio/iolibio.h,
libio/iopadn.c, libio/ioprims.c, libio/ioputs.c, libio/ioseekoff.c,
libio/ioseekpos.c, libio/iosetbuffer.c, libio/iosetvbuf.c,
libio/iosprintf.c, libio/ioungetc.c, libio/iovsprintf.c,
libio/iovsscanf.c, libio/libio.h, libio/libioP.h, libio/putc.c,
libio/putchar.c, libio/rewind.c, libio/setbuf.c, libio/setlinebuf.c,
libio/stdfiles.c, libio/stdio.c, libio/stdio.h, libio/strfile.h,
libio/strops.c, libio/vasprintf.c, libio/vscanf.c, libio/vsnprintf.c:
New files. Slightly modified version from Linux libc.
* libio/memstream.c, libio/vdprintf.c: New files for functions not
(yet) part of GNU libio.
* libio/iofopncook.c: Implementation of `fopencookie', mainly written
by Per Bothner.
* stdio-common/getline.c: Adapted to libio.
* stdio-common/snprintf.c: Adapted to libio.
* stdio-common/vfprintf.c: Adapted to libio.
* stdio-common/vfscanf.c: Adapted to libio.
* sysdeps/posix/tempname.c: Adapted to libio.
1995-11-20 03:48:11 +00:00
|
|
|
|
|
|
|
/* Operations on _IO_fpos_t.
|
|
|
|
Normally, these are trivial, but we provide hooks for configurations
|
|
|
|
where an _IO_fpos_t is a struct.
|
|
|
|
Note that _IO_off_t must be an integral type. */
|
|
|
|
|
|
|
|
/* _IO_pos_BAD is an _IO_fpos_t value indicating error, unknown, or EOF. */
|
|
|
|
#ifndef _IO_pos_BAD
|
|
|
|
#define _IO_pos_BAD ((_IO_fpos_t)(-1))
|
|
|
|
#endif
|
|
|
|
/* _IO_pos_as_off converts an _IO_fpos_t value to an _IO_off_t value. */
|
|
|
|
#ifndef _IO_pos_as_off
|
|
|
|
#define _IO_pos_as_off(__pos) ((_IO_off_t)(__pos))
|
|
|
|
#endif
|
|
|
|
/* _IO_pos_adjust adjust an _IO_fpos_t by some number of bytes. */
|
|
|
|
#ifndef _IO_pos_adjust
|
|
|
|
#define _IO_pos_adjust(__pos, __delta) ((__pos) += (__delta))
|
|
|
|
#endif
|
|
|
|
/* _IO_pos_0 is an _IO_fpos_t value indicating beginning of file. */
|
|
|
|
#ifndef _IO_pos_0
|
|
|
|
#define _IO_pos_0 ((_IO_fpos_t)0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if _IO_UNIFIED_JUMPTABLES
|
|
|
|
#define _IO_FJUMP /* nothing */
|
|
|
|
#else
|
|
|
|
#define _IO_FJUMP &_IO_file_jumps,
|
|
|
|
#endif
|
|
|
|
/* check following! */
|
|
|
|
#define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
|
|
|
|
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, _IO_FJUMP FD}
|
|
|
|
|
|
|
|
/* VTABLE_LABEL defines NAME as of the CLASS class.
|
|
|
|
CNLENGTH is strlen(#CLASS). */
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#if _G_VTABLE_LABEL_HAS_LENGTH
|
|
|
|
#define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
|
|
|
|
extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CNLENGTH #CLASS);
|
|
|
|
#else
|
|
|
|
#define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
|
|
|
|
extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CLASS);
|
|
|
|
#endif
|
|
|
|
#endif /* __GNUC__ */
|
|
|
|
|
|
|
|
#if !defined(builtinbuf_vtable) && defined(__cplusplus)
|
|
|
|
#ifdef __GNUC__
|
|
|
|
VTABLE_LABEL(builtinbuf_vtable, builtinbuf, 10)
|
|
|
|
#else
|
|
|
|
#if _G_VTABLE_LABEL_HAS_LENGTH
|
|
|
|
#define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##10builtinbuf
|
|
|
|
#else
|
|
|
|
#define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##builtinbuf
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif /* !defined(builtinbuf_vtable) && defined(__cplusplus) */
|
|
|
|
|
|
|
|
#if defined(__STDC__) || defined(__cplusplus)
|
|
|
|
#define _IO_va_start(args, last) va_start(args, last)
|
|
|
|
#else
|
|
|
|
#define _IO_va_start(args, last) va_start(args)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
#define COERCE_FILE(FILE) /* Nothing */
|
|
|
|
#else
|
|
|
|
/* This is part of the kludge for binary compatibility with old stdio. */
|
|
|
|
#define COERCE_FILE(FILE) \
|
|
|
|
(((FILE)->_IO_file_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \
|
|
|
|
&& (FILE) = *(FILE**)&((int*)fp)[1])
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef EINVAL
|
|
|
|
#define MAYBE_SET_EINVAL errno = EINVAL
|
|
|
|
#else
|
|
|
|
#define MAYBE_SET_EINVAL /* nothing */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
#define CHECK_FILE(FILE,RET) \
|
|
|
|
if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \
|
|
|
|
else { COERCE_FILE(FILE); \
|
|
|
|
if (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
|
|
|
|
{ errno = EINVAL; return RET; }}
|
|
|
|
#else
|
|
|
|
#define CHECK_FILE(FILE,RET) \
|
|
|
|
COERCE_FILE(FILE)
|
|
|
|
#endif
|