标准C函数库和POSIX函数库的关系

转载链接:点击打开链接

POSIX表示可移植操作系统接口(Portable Operating System Interface of UNIX,缩写为 POSIX )

The C POSIX library is a specification of a C standard library for POSIX systems. It was developed at the same time as the ANSI C standard. Some effort was made to make POSIX compatible with standard C; POSIX includes additional functions to those introduced in standard C.

一言以蔽之:POSIX库函数是C标准库函数的超集。

1 标准C库

<assert.h>      Contains the assert macro, used to assist with detecting logical errors and other types of bug in debugging versions of a program.
<complex.h> C99 A set of functions for manipulating complex numbers.
<ctype.h>       Defines set of functions used to classify characters by their types or to convert between upper and lower case in a way that is independent of the used character set (typically ASCII or one of its extensions, although implementations utilizing EBCDIC are also known).
<errno.h>       For testing error codes reported by library functions.
<fenv.h>    C99 Defines a set of functions for controlling floating-point environment.
<float.h>       Defines macro constants specifying the implementation-specific properties of the floating-point library.
<inttypes.h>    C99 Defines exact width integer types.
<iso646.h>  NA1 Defines several macros that implement alternative ways to express several standard tokens. For programming in ISO 646 variant character sets.
<limits.h>      Defines macro constants specifying the implementation-specific properties of the integer types.
<locale.h>      Defines localization functions.
<math.h>        Defines common mathematical functions.
<setjmp.h>      Declares the macros setjmp and longjmp, which are used for non-local exits.
<signal.h>      Defines signal handling functions.
<stdalign.h>    C11 For querying and specifying the alignment of objects.
<stdarg.h>      For accessing a varying number of arguments passed to functions.
<stdatomic.h>   C11 For atomic operations on data shared between threads.
<stdbool.h> C99 Defines a boolean data type.
<stddef.h>      Defines several useful types and macros.
<stdint.h>  C99 Defines exact width integer types.
<stdio.h>       Defines core input and output functions
<stdlib.h>      Defines numeric conversion functions, pseudo-random numbers generation functions, memory allocation, process control functions
<stdnoreturn.h> C11 For specifying non-returning functions.
<string.h>      Defines string handling functions.
<tgmath.h>  C99 Defines type-generic mathematical functions.
<threads.h> C11 Defines functions for managing multiple Threads as well as mutexes and condition variables.
<time.h>        Defines date and time handling functions
<uchar.h>   C11 Types and functions for manipulating Unicode characters.
<wchar.h>   NA1 Defines wide string handling functions.
<wctype.h>  NA1 Defines set of functions used to classify wide characters by their types or to convert between upper and lower case
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

2 POSIX库(标准C库除外)


<aio.h> Asynchronous input and output   Issue 5
<arpa/inet.h>   Functions for manipulating numeric IP addresses (part of Berkeley sockets)  Issue 6
<assert.h>  Verify assumptions   ??
<complex.h> Complex Arithmetic, see C mathematical functions     ??
<cpio.h>    Magic numbers for the cpio archive format   Issue 3
<dirent.h>  Allows the opening and listing of directories   Issue 2
<dlfcn.h>   Dynamic linking Issue 5
<errno.h>   Retrieving Error Number  ??
<fcntl.h>   File opening, locking and other operations  Issue 1
<fenv.h>    Floating-Point Environment (FPE), see C mathematical functions   ??
<float.h>   Floating-point types, see C data types   ??
<fmtmsg.h>  Message display structures  Issue 4
<fnmatch.h> Filename matching   Issue 4
<ftw.h> File tree traversal Issue 1
<glob.h>    Pathname "globbing" (pattern-matching)  Issue 4
<grp.h> User group information and control  Issue 1
<iconv.h>   Codeset conversion facility Issue 4
<inttypes.h>    Fixed sized integer types, see C data types  ??
<iso646.h>  Alternative spellings, see C alternative tokens  ??
<langinfo.h>    Language information constants – builds on C localization functions Issue 2
<libgen.h>  Pathname manipulation   Issue 4
<limits.h>  Implementation-defined constants, see C data types   ??
<locale.h>  Category macros, see C localization functions    ??
<math.h>    Mathematical declarations, see C mathematical functions  ??
<monetary.h>    String formatting of monetary units Issue 4
<mqueue.h>  Message queue   Issue 5
<ndbm.h>    NDBM database operations    Issue 4
<net/if.h>  Listing of local network interfaces Issue 6
<netdb.h>   Translating protocol and host names into numeric addresses (part of Berkeley sockets)   Issue 6
<netinet/in.h>  Defines Internet protocol and address family (part of Berkeley sockets) Issue 6
<netinet/tcp.h> Additional TCP control options (part of Berkeley sockets)   Issue 6
<nl_types.h>    Localization message catalog functions  Issue 2
<poll.h>    Asynchronous file descriptor multiplexing   Issue 4
<pthread.h> Defines an API for creating and manipulating POSIX threads  Issue 5
<pwd.h> passwd (user information) access and control    Issue 1
<regex.h>   Regular expression matching Issue 4
<sched.h>   Execution scheduling    Issue 5
<search.h>  Search tables   Issue 1
<semaphore.h>   POSIX semaphores    Issue 5
<setjmp.h>  Stack environment declarations   ??
<signal.h>  Signals, see C signal handling   ??
<spawn.h>   Process spawning    Issue 6
<stdarg.h>  Handle Variable Argument List    ??
<stdbool.h> Boolean type and values, see C data types    ??
<stddef.h>  Standard type definitions, see C data types  ??
<stdint.h>  Integer types, see C data types  ??
<stdio.h>   Standard buffered input/output, see C file input/output  ??
<stdlib.h>  Standard library definitions, see C standard library     ??
<string.h>  Several String Operations, see C string handling     ??
<strings.h> Case-insensitive string comparisons Issue 4
<stropts.h> Stream manipulation, including ioctl    Issue 4
<sys/ipc.h> Inter-process communication (IPC)   Issue 2
<sys/mman.h>    Memory management, including POSIX shared memory and memory mapped files    Issue 4
<sys/msg.h> POSIX message queues    Issue 2
<sys/resource.h>    Resource usage, priorities, and limiting    Issue 4
<sys/select.h>  Synchronous I/O multiplexing    Issue 6
<sys/sem.h> XSI (SysV style) semaphores Issue 2
<sys/shm.h> XSI (SysV style) shared memory  Issue 2
<sys/socket.h>  Main Berkley sockets header Issue 6
<sys/stat.h>    File information (stat et al.)  Issue 1
<sys/statvfs.h> File System information Issue 4
<sys/time.h>    Time and date functions and structures  Issue 4
<sys/times.h>   File access and modification times  Issue 1
<sys/types.h>   Various data types used elsewhere   Issue 1
<sys/uio.h> Vectored I/O operations Issue 4
<sys/un.h>  Unix domain sockets Issue 6
<sys/utsname.h> Operating system information, including uname   Issue 1
<sys/wait.h>    Status of terminated child processes (see wait) Issue 3
<syslog.h>  System error logging    Issue 4
<tar.h> Magic numbers for the tar archive format    Issue 3
<termios.h> Allows terminal I/O interfaces  Issue 3
<tgmath.h>  Type-Generic Macros, see C mathematical functions    ??
<time.h>    Type-Generic Macros, see C date and time functions   ??
<trace.h>   Tracing of runtime behavior (DEPRECATED)    Issue 6
<ulimit.h>  Resource limiting (DEPRECATED in favor of <sys/resource.h>) Issue 1
<unistd.h>  Various essential POSIX functions and constants Issue 1
<utime.h>   inode access and modification times Issue 3
<utmpx.h>   User accounting database functions  Issue 4
<wchar.h>   Wide-Character Handling, see C string handling   ??
<wctype.h>  Wide-Character Classification and Mapping Utilities, see C character classification  ??
<wordexp.h> Word-expansion like the shell would perform

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
zlog是一个高性能、线程安全、灵活、概念清晰的纯C日志函数库。 事实上,在C的世界里面没有特别好的日志函数库(就像JAVA里面的的log4j,或者C 的log4cxx)。C程序员都喜欢用自己的轮子。printf就是个挺好的轮子,但没办法通过配置改变日志的格式或者输出文件。syslog是个系统级别的轮子,不过速度慢,而且功能比较单调。log4c异常坑爹(有内存泄漏、效率低等等),而且已经停止开发 所以我(难易)写了zlog。  zlog有这些特性:  *  syslog分类模型,基于规则路由过滤,比log4j模型要正确高效,详见为什么log4j的概念模型是错误的。  *  日志格式定制,类似于log4j的pattern layout  *  多种输出,包括动态文件、静态文件、stdout、stderr、syslog、用户自定义输出函数  *  运行时手动或自动刷新配置(同时保证安全)  *  高性能,在我的笔记本上达到338'638条日志每秒, 大概是syslog(3)配合rsyslogd的1000倍速度   *  高可靠性和速度之间的平衡,用户自定义多少条日志后fsync数据到硬盘  *  用户自定义等级  *  多线程和多进程环境下保证安全转档  *  精确到微秒  *  简单调用包装dzlog(一个程序默认只用一个分类)  *  MDC,线程键-值对的表,可以扩展用户自定义的字段  *  自诊断,可以在运行时输出zlog自己的日志和配置状态  *  不依赖其他,只要是个POSIX系统就成(当然还要一个C99兼容的vsnprintf) 网友提供的其他版本,方便其他平台安装 auto tools版本: https://github.com/bmanojlovic/zlog cmake版本:https://github.com/lisongmin/zlog windows版本: https://github.com/lopsd07/WinZlog 标签:zlog

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值