在linux下进行开发,调用系统的API接口,需要包含相应的头文件。下面对于所有的头文件包含情况做一个总结,便于后面查阅。
//linux 常用头文件:
// POSIX 标准定义的头文件
#includ <dirent.h> // 目录项
#includ <fcntl.h> // 文件控制
#includ <fnmatch.h> // 文件名匹配类型
#includ <glob.h> // 路径名模式匹配类型
#includ <grp.h> // 组文件
#includ <netdb.h> // 网络数据库操作
#includ <pwd.h> // 口令文件
#includ <regex.h> // 正则表达式
#includ <tar.h> // TAR归档值
#includ <termios.h> // 终端I/O
#includ <unistd.h> // 符号常量
#includ <utime.h> // 文件时间
#includ <wordexp.h> // 字符扩展类型
// ------------------------------------------------
#includ <arpa/inet.h> // INTERNET定义
#includ <net/if.h> // 套接字本地接口
#includ <netinet/in.h> // INTERNET地址族
#includ <netinet/tcp.h> // 传输控制协议定义
// ------------------------------------------------
#includ <sys/mman.h> // 内存管理声明
#includ <sys/select.h> // Select函数
#includ <sys/socket.h> // 套接字借口
#includ <sys/stat.h> // 文件状态
#includ <sys/times.h> // 进程时间
#includ <sys/types.h> // 基本系统数据类型
#includ <sys/un.h> // UNIX域套接字定义
#includ <sys/utsname.h> // 系统名
#includ <sys/wait.h> // 进程控制
// -------------------------------------------------
// POSIX定义的XSI扩展头文件
#includ <cpio.h> // cpio归档值
#includ <dlfcn.h> // 动态链接
#includ <fmtmsg.h> // 消息显示结构
#includ <ftw.h> // 文件树漫游
#includ <iconv.h> // 代码集转换使用程序
#includ <langinfo.h> // 语言信息常量
#includ <libgen.h> // 模式匹配函数定义
#includ <monetary.h> // 货币类型
#includ <ndbm.h> // 数据库操作
#includ <nl_types.h> // 消息类别
#includ <poll.h> // 轮询函数
#includ <search.h> // 搜索表
#includ <strings.h> // 字符串操作
#includ <syslog.h> // 系统出错日志记录
#includ <ucontext.h> // 用户上下文
#includ <ulimit.h> // 用户限制
#includ <utmpx.h> // 用户帐户数据库
// -------------------------------------------------
#includ <sys/ipc.h> // IPC(命名管道)
#includ <sys/msg.h> // 消息队列
#includ <sys/resource.h> // 资源操作
#includ <sys/sem.h> // 信号量
#includ <sys/shm.h> // 共享存储
#includ <sys/statvfs.h> // 文件系统信息
#includ <sys/time.h> // 时间类型
#includ <sys/timeb.h> // 附加的日期和时间定义
#includ <sys/uio.h> // 矢量I/O操作
// -------------------------------------------------
// POSIX定义的可选头文件
#includ <aio.h> // 异步I/O
#includ <mqueue.h> // 消息队列
#includ <pthread.h> // 线程
#includ <sched.h> // 执行调度
#includ <semaphore.h> // 信号量
#includ <spawn.h> // 实时spawn接口
#includ <stropts.h> // XSI STREAMS接口
#includ <trace.h> // 事件跟踪