⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uclibc_stdio.h

📁 arm_uclinux_tools用于安装linux的编译器
💻 H
📖 第 1 页 / 共 2 页
字号:
/*  Copyright (C) 2002     Manuel Novoa III *  Header for my stdio library for linux and (soon) elks. * *  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., 675 Mass Ave, Cambridge, MA 02139, USA. *//*  ATTENTION!   ATTENTION!   ATTENTION!   ATTENTION!   ATTENTION! * *  This code is currently under development.  Also, I plan to port *  it to elks which is a 16-bit environment with a fairly limited *  compiler.  Therefore, please refrain from modifying this code *  and, instead, pass any bug-fixes, etc. to me.  Thanks.  Manuel * *  ATTENTION!   ATTENTION!   ATTENTION!   ATTENTION!   ATTENTION! */#ifndef _STDIO_H#error Always include <stdio.h> rather than <bits/uClibc_stdio.h>#endif/**********************************************************************/#ifdef __UCLIBC__#ifdef __UCLIBC_HAS_THREADS__#define __STDIO_THREADSAFE#endif#ifdef __UCLIBC_HAS_LFS__#define __STDIO_LARGE_FILES#endif /* __UCLIBC_HAS_LFS__ */#ifdef __UCLIBC_HAS_WCHAR__#define __STDIO_WIDE#endif#define __STDIO_BUFFERS/* ANSI/ISO mandate at least 256. */#if defined(__UCLIBC_HAS_STDIO_BUFSIZ_NONE__)/* Fake this because some apps use stdio.h BUFSIZ. */#define _STDIO_BUFSIZ			256#undef __STDIO_BUFFERS#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_256__)#define _STDIO_BUFSIZ			256#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_512__)#define _STDIO_BUFSIZ			512#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_1024__)#define _STDIO_BUFSIZ		   1024#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_2048__)#define _STDIO_BUFSIZ		   2048#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_4096__)#define _STDIO_BUFSIZ		   4096#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_8192__)#define _STDIO_BUFSIZ		   8192#else#error config seems to be out of sync regarding bufsiz options#endif#ifdef __UCLIBC_HAS_STDIO_GETC_MACRO__#define __STDIO_GETC_MACRO#endif#ifdef __UCLIBC_HAS_STDIO_PUTC_MACRO__#define __STDIO_PUTC_MACRO#endif#ifdef __UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION__#define __STDIO_AUTO_RW_TRANSITION#endif#ifdef __UCLIBC_HAS_FOPEN_LARGEFILE_MODE__#define __STDIO_FOPEN_LARGEFILE_MODE#endif#ifdef __UCLIBC_HAS_FOPEN_LARGEFILE_MODE__#define __STDIO_FOPEN_EXCLUSIVE_MODE#endif#ifdef __UCLIBC_HAS_PRINTF_M_SPEC__#define __STDIO_PRINTF_M_SUPPORT#endif#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__#define __STDIO_GLIBC_CUSTOM_STREAMS#endif#ifdef __UCLIBC_HAS_STDIO_BUFSIZ_NONE__#define _STDIO_BUILTIN_BUF_SIZE		0#else  /* __UCLIBC_HAS_STDIO_BUFSIZ_NONE__ */#if defined(__UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE__)#define _STDIO_BUILTIN_BUF_SIZE		0#elif defined(__UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4__)#define _STDIO_BUILTIN_BUF_SIZE		4#elif defined(__UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8__)#define _STDIO_BUILTIN_BUF_SIZE		8#else#error config seems to be out of sync regarding builtin buffer size#endif#endif /* __UCLIBC_HAS_STDIO_BUFSIZ_NONE__ */#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__#define __STDIO_GLIBC_CUSTOM_PRINTF#endif/* Currently unimplemented/untested *//* #define __STDIO_FLEXIBLE_SETVBUF *//* Make sure defines related to large files are consistent. */#ifdef _LIBC#ifdef __UCLIBC_HAS_LFS__#undef __USE_LARGEFILE#undef __USE_LARGEFILE64#undef __USE_FILE_OFFSET64/* if we're actually building uClibc with large file support, only define... */#define __USE_LARGEFILE64	1#endif /* __UCLIBC_HAS_LFS__ */#else  /* not _LIBC */#ifndef __UCLIBC_HAS_LFS__#if defined(__LARGEFILE64_SOURCE) || defined(__USE_LARGEFILE64) \    || defined(__USE_FILE_OFFSET64)#error Sorry... uClibc was built without large file support!#endif#endif /* __UCLIBC_HAS_LFS__ */#endif /* _LIBC */#endif /* __UCLIBC__ *//**********************************************************************//* These are the stdio configuration options.  Keep them here until   uClibc's configuration process gets reworked. */#ifdef __STDIO_WIDE#define __need_wchar_t#include <stddef.h>/* Note: we don't really need mbstate for 8-bit locales.  We do for UTF-8. * For now, always use it. */#define __STDIO_MBSTATE#define __need_mbstate_t#include <wchar.h>#endif/* For uClibc, these are currently handled above. *//* #define __STDIO_BUFFERS *//* #define __STDIO_GETC_MACRO *//* #define __STDIO_PUTC_MACRO *//* #define __STDIO_LARGE_FILES *//* #define __STDIO_THREADSAFE *//* ANSI/ISO mandate at least 256. *//* #define _STDIO_BUFSIZ			256 *//* #define __STDIO_AUTO_RW_TRANSITION *//* #define __STDIO_FOPEN_EXCLUSIVE_MODE *//* #define __STDIO_PRINTF_M_SPEC *//* #define __STDIO_GLIBC_CUSTOM_STREAMS *//* L mode extension for fopen. *//* #define __STDIO_FOPEN_LARGEFILE_MODE *//* size of builtin buf -- only tested with 0 *//* #define _STDIO_BUILTIN_BUF_SIZE		0 *//* Currently unimplemented/untested *//* #define __STDIO_FLEXIBLE_SETVBUF *//**********************************************************************//* TODO -- posix or gnu -- belongs in limits.h and >= 9 for sus *//* NOTE: for us it is currently _always_ 9 *//*#define NL_ARGMAX			9*//**********************************************************************//* These are consistency checks on the different options */#ifndef __STDIO_BUFFERS#undef __STDIO_GETC_MACRO#undef __STDIO_PUTC_MACRO#endif#ifdef __BCC__#undef __STDIO_LARGE_FILES#endif#ifndef __STDIO_LARGE_FILES#undef __STDIO_FOPEN_LARGEFILE_MODE#endif/**********************************************************************/#ifdef __STDIO_THREADSAFE/* Need this for pthread_mutex_t. */#include <bits/pthreadtypes.h>#define __STDIO_THREADLOCK(STREAM) \	if ((STREAM)->user_locking == 0) { \		__pthread_mutex_lock(&(STREAM)->lock); \	}#define __STDIO_THREADUNLOCK(STREAM) \	if ((STREAM)->user_locking == 0) { \		__pthread_mutex_unlock(&(STREAM)->lock); \	}#define __STDIO_THREADTRYLOCK(STREAM) \	if ((STREAM)->user_locking == 0) { \		__pthread_mutex_trylock(&(STREAM)->lock); \	}#define __STDIO_SET_USER_LOCKING(STREAM)   	((STREAM)->user_locking = 1)#else  /* __STDIO_THREADSAFE */#define __STDIO_THREADLOCK(STREAM)#define __STDIO_THREADUNLOCK(STREAM)#define __STDIO_THREADTRYLOCK(STREAM)#define __STDIO_SET_USER_LOCKING(STREAM)#endif /* __STDIO_THREADSAFE *//* This file may eventually have two personalities:   1) core stuff (similar to glibc's libio.h)   2) extern inlines (for glibc's bits/stdio.h)   Right now, only (1) is implemented. */#define _STDIO_IOFBF 0	/* Fully buffered.  */#define _STDIO_IOLBF 1	/* Line buffered.  */#define _STDIO_IONBF 2	/* No buffering.  */typedef struct {	__off_t __pos;#ifdef __STDIO_MBSTATE	__mbstate_t __mbstate;#endif#ifdef __STDIO_WIDE	int mblen_pending;#endif} __stdio_fpos_t;#ifdef __STDIO_LARGE_FILEStypedef struct {	__off64_t __pos;#ifdef __STDIO_MBSTATE	__mbstate_t __mbstate;#endif#ifdef __STDIO_WIDE	int mblen_pending;#endif} __stdio_fpos64_t;#endif/**********************************************************************/#ifdef __STDIO_LARGE_FILEStypedef __off64_t __offmax_t;	/* TODO -- rename this? */#elsetypedef __off_t __offmax_t;		/* TODO -- rename this? */#endif/**********************************************************************/#ifdef __STDIO_GLIBC_CUSTOM_STREAMStypedef __ssize_t __io_read_fn(void *cookie,							   char *buf, size_t bufsize);typedef __ssize_t __io_write_fn(void *cookie,								const char *buf, size_t bufsize);/* NOTE: GLIBC difference!!! -- fopencookie seek function * For glibc, the type of pos is always (__off64_t *) but in our case * it is type (__off_t *) when the lib is built without large file support. */typedef int __io_seek_fn(void *cookie,						 __offmax_t *pos, int whence);typedef int __io_close_fn(void *cookie);typedef struct {	__io_read_fn *read;	__io_write_fn *write;	__io_seek_fn *seek;	__io_close_fn *close;} _IO_cookie_io_functions_t;#if defined(_LIBC) || defined(_GNU_SOURCE)typedef __io_read_fn cookie_read_function_t;typedef __io_write_fn cookie_write_function_t;typedef __io_seek_fn cookie_seek_function_t;typedef __io_close_fn cookie_close_function_t;typedef _IO_cookie_io_functions_t cookie_io_functions_t;#endif /* _GNU_SOURCE */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -