glibc/libio/stdio.h
Ulrich Drepper edf5b2d716 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

266 lines
8.6 KiB
C

/* This is part of the iostream/stdio library, providing -*- C -*- I/O.
Define ANSI C stdio on top of C++ iostreams.
Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* ANSI Standard: 4.9 INPUT/OUTPUT <stdio.h>
*/
#ifndef _STDIO_H
#define _STDIO_H
#define _STDIO_USES_IOSTREAM
#include <libio.h>
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL (void*)0
#endif
#endif
#ifndef EOF
#define EOF (-1)
#endif
#ifndef BUFSIZ
#define BUFSIZ 1024
#endif
#define _IOFBF 0 /* Fully buffered. */
#define _IOLBF 1 /* Line buffered. */
#define _IONBF 2 /* No buffering. */
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
/* define size_t. Crud in case <sys/types.h> has defined it. */
#if !defined(_SIZE_T) && !defined(_T_SIZE_) && !defined(_T_SIZE)
#if !defined(__SIZE_T) && !defined(_SIZE_T_) && !defined(___int_size_t_h)
#if !defined(_GCC_SIZE_T) && !defined(_SIZET_)
#define _SIZE_T
#define _T_SIZE_
#define _T_SIZE
#define __SIZE_T
#define _SIZE_T_
#define ___int_size_t_h
#define _GCC_SIZE_T
#define _SIZET_
typedef _IO_size_t size_t;
#endif
#endif
#endif
typedef struct _IO_FILE FILE;
typedef _IO_fpos_t fpos_t;
#include <stdio_lim.h>
#define P_tmpdir "/tmp"
/* For use by debuggers. These are linked in if printf or fprintf are used. */
extern FILE *stdin, *stdout, *stderr; /* TODO */
#define stdin _IO_stdin
#define stdout _IO_stdout
#define stderr _IO_stderr
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __P
#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
#define __P(args) args
#else
#define __P(args) ()
#endif
#endif /*!__P*/
extern void clearerr __P ((FILE*));
extern int fclose __P ((FILE*));
extern int feof __P ((FILE*));
extern int ferror __P ((FILE*));
extern int fflush __P ((FILE*));
extern int fgetc __P ((FILE *));
extern int fgetpos __P ((FILE* fp, fpos_t *pos));
extern char* fgets __P ((char*, int, FILE*));
extern FILE* fopen __P ((__const char*, __const char*));
extern FILE* fopencookie __P ((void *cookie, __const char *mode,
_IO_cookie_io_functions_t io_functions));
extern int fprintf __P ((FILE*, __const char* format, ...));
extern int fputc __P ((int, FILE*));
extern int fputs __P ((__const char *str, FILE *fp));
extern size_t fread __P ((void*, size_t, size_t, FILE*));
extern FILE* freopen __P ((__const char*, __const char*, FILE*));
extern int fscanf __P ((FILE *fp, __const char* format, ...));
extern int fseek __P ((FILE* fp, long int offset, int whence));
extern int fsetpos __P ((FILE* fp, __const fpos_t *pos));
extern long int ftell __P ((FILE* fp));
extern size_t fwrite __P ((__const void*, size_t, size_t, FILE*));
extern int getc __P ((FILE *));
extern int getchar __P ((void));
extern char* gets __P ((char*));
extern void perror __P ((__const char *));
extern int printf __P ((__const char* format, ...));
extern int putc __P ((int, FILE *));
extern int putchar __P ((int));
extern int puts __P ((__const char *str));
extern int remove __P ((__const char*));
extern int rename __P ((__const char* _old, __const char* _new));
extern void rewind __P ((FILE*));
extern int scanf __P ((__const char* format, ...));
extern void setbuf __P ((FILE*, char*));
extern void setlinebuf __P ((FILE*));
extern void setbuffer __P ((FILE*, char*, int));
extern int setvbuf __P ((FILE*, char*, int mode, size_t size));
extern int sprintf __P ((char*, __const char* format, ...));
extern int sscanf __P ((__const char* string, __const char* format, ...));
extern FILE* tmpfile __P ((void));
extern char* tmpnam __P ((char*));
#ifdef __USE_SVID
extern char *tempnam __P ((__const char *__dir, __const char *__pfx));
#endif
extern char *__stdio_gen_tempname __P ((__const char *dir, __const char *pfx,
int dir_search, size_t *lenptr,
FILE **streamptr));
extern int ungetc __P ((int c, FILE* fp));
extern int vfprintf __P ((FILE *fp, char __const *fmt0, _G_va_list));
extern int vprintf __P ((char __const *fmt, _G_va_list));
extern int vsprintf __P ((char* string, __const char* format, _G_va_list));
extern void __libc_fatal __P ((__const char *__message))
__attribute__ ((__noreturn__));
#ifndef __STRICT_ANSI__
extern int dprintf __P ((int, __const char *, ...));
extern int vdprintf __P ((int, __const char *, _G_va_list));
extern int vfscanf __P ((FILE*, __const char *, _G_va_list));
extern int __vfscanf __P ((FILE*, __const char *, _G_va_list));
extern int vscanf __P ((__const char *, _G_va_list));
extern int vsscanf __P ((__const char *, __const char *, _G_va_list));
extern int __vsscanf __P ((__const char *, __const char *, _G_va_list));
#endif
#if !defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE)
extern FILE *fdopen __P ((int, __const char *));
extern int fileno __P ((FILE*));
extern FILE* popen __P ((__const char*, __const char*));
extern int pclose __P ((FILE*));
#define L_ctermid 9
#define L_cuserid 9
/* Return the name of the controlling terminal. */
extern char *ctermid __P ((char *__buf));
/* Get character login name of the user. */
extern char *cuserid __P ((char * __buf));
#endif
#ifdef __USE_GNU
extern _IO_ssize_t getdelim __P ((char **, size_t *, int, FILE*));
extern _IO_ssize_t getline __P ((char **, size_t *, FILE *));
extern _IO_ssize_t __getline __P ((char **, size_t *, FILE *));
extern int snprintf __P ((char *, size_t, __const char *, ...));
extern int __snprintf __P ((char *, size_t, __const char *, ...));
extern int vsnprintf __P ((char *, size_t, __const char *, _G_va_list));
extern int __vsnprintf __P ((char *, size_t, __const char *, _G_va_list));
extern int asprintf __P ((char **, const char *, ...));
extern int vasprintf __P ((char **, const char *, _G_va_list));
/* Open a stream that writes into a malloc'd buffer that is expanded as
necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
and the number of characters written on fflush or fclose. */
extern FILE *open_memstream __P ((char **__bufloc, size_t *__sizeloc));
#endif
extern int __underflow __P ((struct _IO_FILE*));
extern int __overflow __P ((struct _IO_FILE*, int));
#ifdef __USE_BSD
extern int sys_nerr;
extern const char *const sys_errlist[];
#endif
#ifdef __USE_GNU
extern int _sys_nerr;
extern const char *const _sys_errlist[];
#endif
/* Handle locking of streams. */
#ifdef __USE_REENTRANT
extern void clearerr_locked __P ((FILE *));
extern void clearerr_unlocked __P ((FILE *));
extern int feof_locked __P ((FILE *));
extern int feof_unlocked __P ((FILE *));
extern int ferror_locked __P ((FILE*));
extern int ferror_unlocked __P ((FILE*));
extern int fileno_locked __P ((FILE *));
extern int fileno_unlocked __P ((FILE *));
extern void flockfile __P ((FILE *));
extern void funlockfile __P ((FILE *));
extern int fclose_unlocked __P ((FILE *));
extern int fflush_locked __P ((FILE *));
extern int fflush_unlocked __P ((FILE *));
extern size_t fread_unlocked __P ((void *, size_t, size_t, FILE *));
extern size_t fwrite_unlocked __P ((const void *, size_t, size_t, FILE *));
extern int fputc_locked __P ((int, FILE*));
extern int fputc_unlocked __P ((int, FILE*));
extern int getc_locked __P ((FILE *));
extern int getc_unlocked __P ((FILE *));
extern int getchar_locked __P ((void));
extern int getchar_unlocked __P ((void));
extern int putc_locked __P ((int, FILE *));
extern int putc_unlocked __P ((int, FILE *));
extern int putchar_locked __P ((int));
extern int putchar_unlocked __P ((int));
# define getc_unlocked(fp) _IO_getc_unlocked (fp)
# define getc_locked(fp) fgetc (fp)
# define getchar_unlocked() getc_unlocked (stdin)
# define getchar_locked() getc_locked (stdin)
# define getc(fp) getc_locked (fp)
# define putc_unlocked(c, fp) putc_unlocked (c, fp)
# define putc_locked(c, fp) putc_locked (c, fp)
# define putchar_unlocked(c) putc_unlocked (c, stdout)
# define putchar_locked(c) putc_locked (c, stdout)
# define putc(c, fp) putc_locked (c, fp)
#else
# define getc(fp) _IO_getc_unlocked (fp)
# define putc(c, fp) _IO_putc_unlocked (c, fp)
#endif /* __USE_REENTRANT */
#define putchar(c) putc (c, stdout)
#define getchar() getc (stdin)
#ifdef __cplusplus
}
#endif
#endif /* !_STDIO_H */