logo资料库

posix_users.RTEMS_POSIX_API用户指南.双语.V20131224.pdf

第1页 / 共449页
第2页 / 共449页
第3页 / 共449页
第4页 / 共449页
第5页 / 共449页
第6页 / 共449页
第7页 / 共449页
第8页 / 共449页
资料共449页,剩余部分请下载后查看
目录
前言
致谢
1 进程创建和执行管理器
1.1 简介
1.2 背景知识
1.3 操作
1.4 指令
1.4.1 fork - 创建进程
1.4.2 execl - 执行一个文件
1.4.3 execv - 执行一个文件
1.4.4 execle - 执行一个文件
1.4.5 execve - 执行一个文件
1.4.6 execlp - 执行一个文件
1.4.7 execvp - 执行一个文件
1.4.8 pthread_atfork - 寄存器分叉处理程序
1.4.9 wait - 等待进程终止
1.4.10 waitpid - 等待进程终止
1.4.11 _exit - 终止进程
2 信号管理器
2.1 简介
2.2 背景知识
2.2.1 信号
2.2.2 信号传送
2.3 操作
2.3.1 信号集管理
2.3.2 阻塞直到信号产生
2.3.3 发送信号
2.4 指令
2.4.1 sigaddset - 添加信号到信号集
2.4.2 sigdelset - 从信号集删除信号
2.4.3 sigfillset - 填充信号集
2.4.4 sigismember - 信号是信号集的成员吗?
2.4.5 sigemptyset - 清空信号集
2.4.6 sigaction - 检查和更改信号的操作
2.4.7 pthread_kill - 发送信号到线程
2.4.8 sigprocmask - 检查和更改进程阻塞的信号
2.4.9 pthread_sigmask - 检查和更改线程阻塞的信号
2.4.10 kill - 发送信号到进程
2.4.11 sigpending - 检查挂起的信号
2.4.12 sigsuspend - 等待一个信号
2.4.13 pause - 推迟进程执行
2.4.14 sigwait - 同步接受信号
2.4.15 sigwaitinfo - 同步接受信号
2.4.16 sigtimedwait - 同步接受具有超时的信号
2.4.17 sigqueue - 排队信号到进程
2.4.18 alarm - 调度警报
2.4.19 ualarm - 以微秒为单位的警报
3 进程环境管理器
3.1 简介
3.2 背景知识
3.2.1 用户和组
3.2.2 用户和组的名称
3.2.3 环境变量
3.3 操作
3.3.1 访问用户和组id
3.2.2 访问环境变量
3.4 指令
3.4.1 getpid - 获得进程ID
3.4.2 getppid - 获得父进程ID
3.4.3 getuid - 获得用户ID
3.4.4 geteuid - 获得有效用户ID
3.4.5 getgid - 获得真实组ID
3.4.6 getegid - 获得有效组ID
3.4.7 setuid - 设置用户ID
3.4.8 setgid - 设置组ID
3.4.9 getgroups - 获得补充组ID
3.4.10 getlogin - 获得用户名
3.4.11 getlogin_r - 可重入地获得用户名
3.4.12 getpgrp - 获得进程组ID
3.4.13 setsid - 创建会话和进程组ID
3.4.14 setpgid - 设置作业控制的进程组ID
3.4.15 uname - 获得系统名称
3.4.16 times - 获得进程时间
3.4.17 getenv - 获得环境变量
3.4.18 setenv -设置环境变量
3.4.19 ctermid - 生成终端路径名
3.4.20 ttyname - 确定终端设备名称
3.4.21 ttyname_r - 可重入地确定终端设备名称
3.4.22 isatty - 确定文件描述符是否是终端
3.4.23 sysconf - 获得可配置的系统变量
4 文件和目录管理器
4.1 简介
4.2 背景知识
4.2.1 路径名评估
4.3 操作
4.4 指令
4.4.1 opendir - 打开目录
4.4.2 readdir - 读取目录
4.4.3 rewinddir - 复位readdir()指针
4.4.4 scandir - 扫描匹配项的目录
4.4.5 telldir - 返回目录流中的当前位置
4.4.6 closedir - 结束目录读取操作
4.4.7 chdir - 更改当前工作目录
4.4.8 fchdir - 更改当前工作目录
4.4.9 getcwd - 获得当前工作目录
4.4.10 open - 打开文件
4.4.11 creat - 创建新文件或重写存在的文件
4.4.12 umask - 设置文件创建掩码
4.4.13 link - 创建指向文件的链接
4.4.14 symlink - 创建指向文件的符号连接
4.4.15 readlink - 获取符号链接目标的名称
4.4.16 mkdir - 创建目录
4.4.17 mkfifo - 创建FIFO特殊文件
4.4.18 unlink - 移除目录项
4.4.19 rmdir - 删除目录
4.4.20 rename - 重命名文件
4.4.21 stat - 获得关于文件的信息
4.4.22 fstat - 获得文件状态
4.4.23 lstat - 获得文件状态
4.4.24 access - 检查文件权限
4.4.25 chmod - 更改文件模式
4.4.26 fchmod - 更改文件权限
4.4.27 getdents - 获得目录项
4.4.28 chown - 更改文件所有者和/或组
4.4.29 utime - 更改inode的访问和/或修改时间
4.4.30 ftruncate - 截断文件到指定的长度
4.4.31 truncate - 截断文件到指定的权限
4.4.32 pathconf - 获得文件的配置值
4.4.33 fpathconf - 获得文件的配置值
4.4.34 mknod - 创建目录
5 输入和输出原始管理器
5.1 简介
5.2 背景知识
5.3 操作
5.4 指令
5.4.1 pipe - 创建进程间通道
5.4.2 dup - 复制打开文件描述符
5.4.3 dup2 - 复制打开文件描述符
5.4.4 close - 关闭文件
5.4.5 read - 从文件读取
5.4.6 write - 写入到文件
5.4.7 fcntl - 操纵打开文件描述符
5.4.8 lseek - 重定位读/写文件偏移量
5.4.9 fsync - 将文件的完整核心内状态与磁盘上的状态同步
5.4.10 fdatasync - 将文件的核心内数据与磁盘上的数据同步
5.4.11 sync - 安排文件系统更新
5.4.12 mount - 挂载文件系统
5.4.13 unmount - 卸载文件系统
5.4.14 readv - 从文件定向读取
5.4.15 writev - 定向写入到文件
5.4.16 aio_read - 异步读取
5.4.17 aio_write - 异步写入
5.4.18 lio_listio - I/O所指向的列表
5.4.19 aio_error - 检索异步I/O操作的错误状态
5.4.20 aio_return - 检索异步I/O操作的返回状态
5.4.21 aio_cancel - 取消异步I/O请求
5.4.22 aio_suspend - 等待异步I/O请求
5.4.23 aio_fsync - 异步文件同步化
6 设备特定的和类特定的功能管理器
6.1 简介
6.2 背景知识
6.3 操作
6.4 指令
6.4.1 cfgetispeed - 读取终端输入波特率
6.4.2 cfgetospeed - 读取终端输出波特率
6.4.3 cfsetispeed - 设置终端输入波特率
6.4.4 cfsetospeed - 设置终端输出波特率
6.4.5 tcgetattr - 获得终端属性
6.4.6 tcsetattr - 设置终端属性
6.4.7 tcsendbreak - 发送暂停到终端
6.4.8 tcdrain - 等待所有输出被传输到终端
6.4.9 tcflush - 丢弃终端数据
6.4.10 tcflow - 挂起/重启终端输出
6.4.11 tcgetpgrp - 获得前台进程组ID
6.4.12 tcsetpgrp - 设置前台进程组ID
7 适用于C编程语言管理器的语言特定的服务
7.1 简介
7.2 背景知识
7.3 操作
7.4 指令
7.4.1 setlocale - 设置当前的位置
7.4.2 fileno - 获取此文件的文件描述符编号
7.4.3 fdopen - 将流与文件描述符关联
7.4.4 flockfile - 获得文件流的所有权
7.4.5 ftrylockfile - 轮询获得文件流的所有权
7.4.6 funlockfile - 释放文件流的所有权
7.4.7 getc_unlocked - 在未锁定的情况下获得字符
7.4.8 getchar_unlocked - 在未锁定的情况下从stdin获得字符
7.4.9 putc_unlocked - 在未锁定的情况下放置字符
7.4.10 putchar_unlocked - 在未锁定的情况下放置字符到stdin
7.4.11 setjmp - 保存非本地跳转的上下文
7.4.12 longjmp - 非本地跳转到保存的上下文
7.4.13 sigsetjmp - 保存非本地跳转的具有信号状态的上下文
7.4.14 siglongjmp - 使用信号状态非本地跳转到保存的上下文
7.4.15 tzset - 初始化时间转换信息
7.4.16 strtok_r - 可重入地提取来自字符串的令牌
7.4.17 asctime_r - 可重入的struct tm到ASCII时间的转换
7.4.18 ctime_r - 可重入的time_t到ASCII时间的转换
7.4.19 gmtime_r - 可重入的UTC时间转换
7.4.20 localtime_r - 可重入的本地时间转换
7.4.21 rand_r - 可重入的随机数发生器
8 系统数据库管理器
8.1 简介
8.2 背景知识
8.3 操作
8.4 指令
8.4.1 getgrgid - 获得组文件的ID项
8.4.2 getgrgid_r - 可重入地获得组文件的ID项
8.4.3 getgrnam - 获得组文件的名称项
8.4.4 getgrnam_r - 可重入地获得组文件的名称项
8.4.5 getpwuid - 获得密码文件的UID项
8.4.6 getpwuid_r - 可重入地获得密码文件的UID项
8.4.7 getpwnam - 获得密码文件的名称项
8.4.8 getpwnam_r - 可重入地获得密码文件的名称项
9 信号量管理器
9.1 简介
9.2 背景知识
9.2.1 理论
9.2.2 "sem_t"结构
9.2.3 建立信号量属性集
9.3 操作
9.3.1 用作二进制信号量
9.4 指令
9.4.1 sem_init - 初始化未指定名称的信号量
9.4.2 sem_destroy - 销毁未指定名称的信号量
9.4.3 sem_open - 打开指定名称的信号量
9.4.4 sem_close - 关闭指定名称的信号量
9.4.5 sem_unlink - 断开已命名信号量
9.4.6 sem_wait - 等待信号量
9.4.7 sem_trywait - 非阻塞等待信号量
9.4.8 sem_timedwait - 等待信号量指定的时间
9.4.9 sem_post - 解锁信号量
9.4.10 sem_getvalue - 获得信号量的值
10 互斥体管理器
10.1 简介
10.2 背景知识
10.2.1 互斥体属性
10.2.2 PTHREAD_MUTEX_INITIALIZER
10.3 操作
10.4 服务
10.4.1 pthread_mutexattr_init - 初始化互斥体属性集
10.4.2 pthread_mutexattr_destroy - 销毁互斥体属性集
10.4.3 pthread_mutexattr_setprotocol - 设置阻塞协议
10.4.4 pthread_mutexattr_getprotocol - 获得阻塞协议
10.4.5 pthread_mutexattr_setprioceiling - 设置优先级上限
10.4.6 pthread_mutexattr_getprioceiling - 获得优先级上限
10.4.7 pthread_mutexattr_setpshared - 设置可见性
10.4.8 pthread_mutexattr_getpshared - 获得可见性
10.4.9 pthread_mutex_init - 初始化互斥体
10.4.10 pthread_mutex_destroy - 销毁互斥体
10.4.11 pthread_mutex_lock - 锁定互斥体
10.4.12 pthread_mutex_trylock - 轮询锁定互斥体
10.4.13 pthread_mutex_timedlock - 锁定具有超时的互斥体
10.4.14 pthread_mutex_unlock - 解锁互斥体
10.4.15 pthread_mutex_setprioceiling - 动态设置优先级上限
10.4.16 pthread_mutex_getprioceiling - 动态获得优先级上限
11 条件变量管理器
11.1 简介
11.2 背景知识
11.3 操作
11.4 指令
11.4.1 pthread_condattr_init -初始化条件变量属性集
11.4.2 pthread_condattr_destroy - 销毁条件变量属性集
11.4.3 pthread_condattr_setpshared - 设置进程共享属性
11.4.4 pthread_condattr_getpshared - 获得进程共享属性
11.4.5 pthread_cond_init - 初始化条件变量
11.4.6 pthread_cond_destroy - 销毁条件变量
11.4.7 pthread_cond_signal - 用信号发送条件变量
11.4.8 pthread_cond_broadcast - 广播条件变量
11.4.9 pthread_cond_wait - 等待条件变量
11.4.10 pthread_cond_timedwait - 超时等待条件变量
12 内存管理管理器
12.1 简介
12.2 背景知识
12.3 操作
12.4 指令
12.4.1 mlockall - 锁定进程的地址空间
12.4.2 munlockall - 解锁进程的地址空间
12.4.3 mlock - 锁定一系列进程地址空间
12.4.4 munlock - 解锁一系列进程地址空间
12.4.5 mmap - 映射进程地址到内存对象
12.4.6 munmap - 取消映射先前映射的地址
12.4.7 mprotect - 更改内存保护
12.4.8 msync - 内存对象同步
12.4.9 shm_open - 打开共享的内存对象
12.4.10 shm_unlink - 移除共享的内存对象
13 调度器管理器
13.1 简介
13.2 背景
13.2.1 优先级
13.2.2 调度策略
13.3 操作
13.4 指令
13.4.1 schedget_priority_min - 获得最低优先级值
13.4.2 sched_get_priority_max - 获得最高优先级值
13.4.3 sched_rr_get_interval - 获得时间片轮转量子
13.4.4 sched_yield - 让出处理器
14 时钟管理器
14.1 简介
14.2 背景知识
14.3 操作
14.4 指令
14.4.1 clock_gettime - 获取日历时间
14.4.2 clock_settime - 设置日历时间
14.4.3 clock_getres - 获得时钟分辨率
14.4.4 sleep - 延迟进程执行
14.4.5 usleep - 以微秒为单位延迟进程执行
14.4.6 nanosleep - 具有高分辨率的延迟
14.4.7 gettimeofday - 获得日历时间
14.4.8 time - 获得以秒为单位的时间
15 定时器管理器
15.1 简介
15.2 背景知识
15.3 操作
15.4 系统调用
15.4.1 timer_create - 创建每进程定时器
15.4.2 timer_delete - 删除每进程定时器
15.4.3 timer_settime - 设置下一个定时器到期时间
15.4.4 timer_gettime - 获得定时器上的剩余时间
15.4.5 timer_getoverrun - 获得定时器溢出计数
16 消息传递管理器
16.1 简介
16.2 背景知识
16.2.1 理论
16.2.2 消息
16.2.3 消息队列
16.2.4 建立消息队列属性集
16.2.5 队列上的消息通知
16.2.6 POSIX解释问题
16.3 操作
16.3.1 打开或创建消息队列
16.3.2 关闭消息队列
16.3.3 移除消息队列
16.3.4 发送消息到消息队列
16.3.5 从消息队列接收消息
16.3.6 在空队列上收到消息的通知
16.3.7 设置消息队列属性
16.3.8 获得消息队列属性
16.4 指令
16.4.1 mq_open - 打开消息队列
16.4.2 mq_close - 关闭消息队列
16.4.3 mq_unlink - 移除消息队列
16.4.4 mq_send - 发送消息到消息队列
16.4.5 mq_receive - 从消息队列接收消息
16.4.6 mq_notify - 通知进程消息可用
16.4.7 mq_setattr - 设置消息队列属性
16.4.8 mq_getattr - 获得消息队列属性
17 线程管理器
17.1 简介
17.2 背景知识
17.2.1 线程属性
17.3 操作
17.4 服务
17.4.1 pthread_attr_init - 初始化线程属性集
17.4.2 pthread_attr_destroy - 销毁线程属性集
17.4.3 pthread_attr_setdetachstate - 设置分离状态
17.4.4 pthread_attr_getdetachstate - 获得分离状态
17.4.5 pthread_attr_setstacksize - 设置线程栈大小
17.4.6 pthread_attr_getstacksize - 获得线程栈大小
17.4.7 pthread_attr_setstackaddr - 设置线程栈地址
17.4.8 pthread_attr_getstackaddr - 获得线程栈地址
17.4.9 pthread_attr_setscope - 设置线程调度作用域
17.4.10 pthread_attr_getscope - 获得线程调度作用域
17.4.11 pthread_attr_setinheritsched - 设置继承调度器标志
17.4.12 pthread_attr_getinheritsched - 获得继承调度器标志
17.4.13 pthread_attr_setschedpolicy - 设置调度策略
17.4.14 pthread_attr_getschedpolicy - 获得调度策略
17.4.15 pthread_attr_setschedparam - 设置调度参数
17.4.16 pthread_attr_getschedparam - 获得调度参数
17.4.17 pthread_create - 创建线程
17.4.18 pthread_exit - 终止当前线程
17.4.19 pthread_detach - 分离线程
17.4.20 pthread_join - 等待线程终止
17.4.21 pthread_self - 获得线程ID
17.4.22 pthread_equal - 比较线程ID
17.4.23 pthread_once - 动态包初始化
17.4.24 pthread_setschedparam - 设置线程调度参数
17.4.25 pthread_getschedparam - 获得线程调度参数
18 键管理器
18.1 简介
18.2 背景知识
18.3 操作
18.4 指令
18.4.1 pthread_key_create - 创建线程特定的数据键
18.4.2 pthread_key_delete - 删除线程特定的数据键
18.4.3 pthread_setspecific - 设置线程特定的键值
18.4.4 pthread_getspecific - 获得线程特定的键值
19 线程取消管理器
19.1 简介
19.2 背景知识
19.3 操作
19.4 指令
19.4.1 pthread_cancel -取消线程的执行
19.4.2 pthread_setcancelstate - 设置可取消性状态
19.4.3 pthread_setcanceltype - 设置可取消性类型
19.4.4 pthread_testcancel - 创建取消点
19.4.5 pthread_cleanup_push - 建立取消处理程序
19.4.6 pthread_cleanup_pop - 移除取消处理程序
20 由C库(libc)提供的服务
20.1 简介
20.2 标准工具函数(stdlib.h)
20.3 字符类型的宏和函数(ctype.h)
20.4 输入和输出(stdio.h)
20.5 字符串和内存(string.h)
20.6 信号处理(signal.h)
20.7 时间函数(time.h)
20.8 区域设置(locale.h)
20.9 可重入版本的函数
20.10 杂项宏和函数
20.11 可变参数列表
20.12 可重入的系统调用
21 由数学库(libm)提供的服务
21.1 简介
21.2 标准数学函数(math.h)
22 实现状态
命令和变量索引
概念索引
RTEMS POSIX API User’s Guide Edition 4.10.99.0, for RTEMS 4.10.99.0 24 February 2013 RTEMS POSIX API 用户指南 版本:4.10.99.0,适用于 RTEMS 4.10.99.0 2013 年 2 月 24 日 (译注:本文档的英文原版经常更新,但本页上所注的日期并不更新,本次翻译 所依据的英文原版是 20130610 版。) 翻译:Tony Zhu bizasia@126.com On-Line Applications Research Corporation 在线应用研究公司
On-Line Applications Research Corporation TEXinfo 2012-11-08.11 在线应用研究公司 TEXinfo 2012-11-08.11 COPYRIGHT c 1988 - 2013. On-Line Applications Research Corporation (OAR). 版权所有 c 1988 - 2013 在线应用研究公司 The authors have used their best efforts in preparing this material. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. No warranty of any kind, expressed or implied, with regard to the software or the material contained in this document is provided. No liability arising out of the application or use of any product described in this document is assumed. The authors reserve the right to revise this material and to make changes from time to time in the content hereof without obligation to notify anyone of such revision or changes. 作者已经尽最大努力编制本材料。这些努力包括理论和程序的开发、研究与测试 以确定它们的有效性。对于软件或包含在本文档中的材料,我们不提供任何类型 的明示或暗示的保证。我们不承担本文档所描述的在应用程序或产品的使用中所 产生的责任。作者保留修改本材料和不定期改变内容的权利,对这些修改没有义 务通知任何人。 The RTEMS Project is hosted at http: / /www .rtems .com. Any inquiries concerning RTEMS, its related support components, its documentation, or any custom services for RTEMS should be directed to the contacts listed on that site. A current list of RTEMS Support Providers is at http://www.rtems.com/oarsupport. RTEMS 项目托管在 http://www .rtems .com。任何涉及 RTEMS 的查询、相关的支 持组件、文档或任何定制服务,可以通过在该网站上的通讯录联系。一个当前的 RTEMS 支持提供者列表在 http://www.rtems.com/oarsupport。
3 Table of Contents Preface ················································································· 27 Acknowledgements ······························································································· 27 1 Process Creation and Execution Manager ······················· 29 1.1 Introduction ································································································· 29 1.2 Background ·································································································· 30 1.3 Operations ··································································································· 30 1.4 Directives ····································································································· 30 1.4.1 fork - Create a Process ······································································· 31 1.4.2 execl - Execute a File ·········································································· 32 1.4.3 execv - Execute a File ········································································· 33 1.4.4 execle - Execute a File ········································································ 34 1.4.5 execve - Execute a File ······································································· 35 1.4.6 execlp - Execute a File ········································································ 36 1.4.7 execvp - Execute a File ······································································· 37 1.4.8 pthread_atfork - Register Fork Handlers ··········································· 38 1.4.9 wait - Wait for Process Termination ··················································· 39 1.4.10 waitpid - Wait for Process Termination ··········································· 40 1.4.11 _exit - Terminate a Process ······························································ 41 2 Signal Manager ······························································· 43 2.1 Introduction ································································································· 43 2.2 Background ·································································································· 44 2.2.1 Signals ································································································ 44 2.2.2 Signal Delivery ···················································································· 45 2.3 Operations ··································································································· 46 2.3.1 Signal Set Management ····································································· 46 2.3.2 Blocking Until Signal Generation ······················································· 46 2.3.3 Sending a Signal ················································································· 47 2.4 Directives ····································································································· 47 2.4.1 sigaddset - Add a Signal to a Signal Set ·············································· 48 2.4.2 sigdelset - Delete a Signal from a Signal Set ······································ 49 2.4.3 sigfillset - Fill a Signal Set ··································································· 50
4 2.4.4 sigismember - Is Signal a Member of a Signal Set ····························· 51 2.4.5 sigemptyset - Empty a Signal Set ······················································· 52 2.4.6 sigaction - Examine and Change Signal Action ·································· 53 2.4.7 pthread_kill - Send a Signal to a Thread ············································ 56 2.4.8 sigprocmask - Examine and Change Process Blocked Signals ············ 57 2.4.9 pthread_sigmask - Examine and Change Thread Blocked Signals ····· 59 2.4.10 kill - Send a Signal to a Process ························································ 61 2.4.11 sigpending - Examine Pending Signals ············································· 62 2.4.12 sigsuspend - Wait for a Signal ·························································· 63 2.4.13 pause - Suspend Process Execution ················································· 64 2.4.14 sigwait - Synchronously Accept a Signal ·········································· 65 2.4.15 sigwaitinfo - Synchronously Accept a Signal ···································· 66 2.4.16 sigtimedwait - Synchronously Accept a Signal with Timeout ·········· 68 2.4.17 sigqueue - Queue a Signal to a Process ··········································· 70 2.4.18 alarm - Schedule Alarm ···································································· 72 2.4.19 ualarm - Schedule Alarm in Microseconds ······································ 73 3 Process Environment Manager ······································· 75 3.1 Introduction ································································································· 75 3.2 Background ·································································································· 76 3.2.1 Users and Groups ··············································································· 76 3.2.2 User and Group Names ······································································ 77 3.2.3 Environment Variables ······································································· 78 3.3 Operations ··································································································· 78 3.3.1 Accessing User and Group Ids ···························································· 78 3.3.2 Accessing Environment Variables ······················································ 78 3.4 Directives ····································································································· 79 3.4.1 getpid - Get Process ID ······································································· 80 3.4.2 getppid - Get Parent Process ID ························································· 81 3.4.3 getuid - Get User ID ··········································································· 82 3.4.4 geteuid - Get Effective User ID ··························································· 83 3.4.5 getgid - Get Real Group ID ································································· 84 3.4.6 getegid - Get Effective Group ID ························································ 85 3.4.7 setuid - Set User ID ············································································ 86 3.4.8 setgid - Set Group ID ·········································································· 87 3.4.9 getgroups - Get Supplementary Group IDs ········································ 88 3.4.10 getlogin - Get User Name ································································ 89 3.4.11 getlogin_r - Reentrant Get User Name ············································ 90
5 3.4.12 getpgrp - Get Process Group ID ······················································· 91 3.4.13 setsid - Create Session and Set Process Group ID···························· 92 3.4.14 setpgid - Set Process Group ID for Job Control ································ 93 3.4.15 uname - Get System Name ······························································ 94 3.4.16 times - Get process times ································································ 95 3.4.17 getenv - Get Environment Variables ················································ 96 3.4.18 setenv - Set Environment Variables ················································· 97 3.4.19 ctermid - Generate Terminal Pathname ·········································· 98 3.4.20 ttyname - Determine Terminal Device Name ·································· 99 3.4.21 ttyname_r - Reentrant Determine Terminal Device Name ············ 100 3.4.22 isatty - Determine if File Descriptor is Terminal ···························· 101 3.4.23 sysconf - Get Configurable System Variables ································· 102 4 Files and Directories Manager ······································ 103 4.1 Introduction ······························································································· 103 4.2 Background ································································································ 105 4.2.1 Path Name Evaluation ······································································ 105 4.3 Operations ································································································· 105 4.4 Directives ··································································································· 106 4.4.1 opendir - Open a Directory ······························································ 107 4.4.2 readdir - Reads a directory ······························································· 109 4.4.3 rewinddir - Resets the readdir() pointer ·········································· 111 4.4.4 scandir - Scan a directory for matching entries ······························· 112 4.4.5 telldir - Return current location in directory stream ······················· 113 4.4.6 closedir - Ends directory read operation ········································· 114 4.4.7 chdir - Changes the current working directory ································ 115 4.4.8 fchdir - Changes the current working directory ······························· 117 4.4.9 getcwd - Gets current working directory ········································· 119 4.4.10 open - Opens a file ········································································· 121 4.4.11 creat - Create a new file or rewrite an existing one······················· 125 4.4.12 umask - Sets a file creation mask. ·················································· 127 4.4.13 link - Creates a link to a file ···························································· 128 4.4.14 symlink - Creates a symbolic link to a file ······································ 130 4.4.15 readlink - Obtain the name of a symbolic link destination ············ 132 4.4.16 mkdir - Makes a directory ······························································ 134 4.4.17 mkfifo - Makes a FIFO special file ·················································· 136 4.4.18 unlink - Removes a directory entry ················································ 138 4.4.19 rmdir - Delete a directory ······························································ 140
6 4.4.20 rename - Renames a file ································································ 142 4.4.21 stat - Gets information about a file ················································ 145 4.4.22 fstat - Gets file status ····································································· 147 4.4.23 lstat - Gets file status ····································································· 148 4.4.24 access - Check permissions for a file ·············································· 149 4.4.25 chmod - Changes file mode. ·························································· 151 4.4.26 fchmod - Changes permissions of a file ········································· 153 4.4.27 getdents - Get directory entries ····················································· 155 4.4.28 chown - Changes the owner and/or group of a file. ······················ 157 4.4.29 utime - Change access and/or modification times of an inode ····· 159 4.4.30 ftruncate - truncate a file to a specified length ····························· 160 4.4.31 truncate - truncate a file to a specified length ······························ 162 4.4.32 pathconf - Gets configuration values for files ································ 164 4.4.33 fpathconf - Gets configuration values for files ······························· 167 4.4.34 mknod - create a directory ···························································· 170 5 Input and Output Primitives Manager ·························· 173 5.1 Introduction ······························································································· 173 5.2 Background ································································································ 174 5.3 Operations ································································································· 174 5.4 Directives ··································································································· 175 5.4.1 pipe - Create an Inter-Process Channel ··········································· 176 5.4.2 dup - Duplicates an open file descriptor ·········································· 177 5.4.3 dup2 - Duplicates an open file descriptor ········································ 178 5.4.4 close - Closes a file ··········································································· 180 5.4.5 read - Reads from a file ···································································· 181 5.4.6 write - Writes to a file ······································································ 184 5.4.7 fcntl - Manipulates an open file descriptor ····································· 186 5.4.8 lseek - Reposition read/write file offset ·········································· 190 5.4.9 fsync - Synchronize file complete in-core state with that on disk ··· 192 5.4.10 fdatasync - Synchronize file in-core data with that on disk ··········· 193 5.4.11 sync - Schedule file system updates ·············································· 195 5.4.12 mount - Mount a file system ·························································· 196 5.4.13 unmount - Unmount file systems ·················································· 197 5.4.14 readv - Vectored read from a file ··················································· 198 5.4.15 writev - Vectored write to a file ····················································· 200 5.4.16 aio_read - Asynchronous Read ······················································ 202 5.4.17 aio_write - Asynchronous Write ···················································· 203
7 5.4.18 lio_listio - List Directed I/O ···························································· 204 5.4.19 aio_error - Retrieve Error Status of Asynchronous I/O Operation 205 5.4.20 aio_return - Retrieve Return Status Asynchronous I/O Operation 206 5.4.21 aio_cancel - Cancel Asynchronous I/O Request····························· 207 5.4.22 aio_suspend - Wait for Asynchronous I/O Request ······················· 208 5.4.23 aio_fsync - Asynchronous File Synchronization ····························· 209 6 Device- and Class- Specific Functions Manager ············· 211 6.1 Introduction ······························································································· 211 6.2 Background ································································································ 212 6.3 Operations ································································································· 212 6.4 Directives ··································································································· 212 6.4.1 cfgetispeed - Reads terminal input baud rate ································· 213 6.4.2 cfgetospeed - Reads terminal output baud rate ······························ 214 6.4.3 cfsetispeed - Sets terminal input baud rate ····································· 215 6.4.4 cfsetospeed - Sets terminal output baud rate ································· 216 6.4.5 tcgetattr - Gets terminal attributes ·················································· 217 6.4.6 tcsetattr - Set terminal attributes ···················································· 218 6.4.7 tcsendbreak - Sends a break to a terminal ······································ 219 6.4.8 tcdrain - Waits for all output to be transmitted to the terminal. ···· 220 6.4.9 tcflush - Discards terminal data ······················································· 221 6.4.10 tcflow - Suspends/restarts terminal output. ································· 222 6.4.11 tcgetpgrp - Gets foreground process group ID ······························ 223 6.4.12 tcsetpgrp - Sets foreground process group ID ······························· 224 7 Language-Specific Services for the C Programming Language Manager ····················································· 225 7.1 Introduction ······························································································· 225 7.2 Background ································································································ 226 7.3 Operations ································································································· 226 7.4 Directives ··································································································· 227 7.4.1 setlocale - Set the Current Locale ···················································· 228 7.4.2 fileno - Obtain File Descriptor Number for this File ························· 229 7.4.3 fdopen - Associate Stream with File Descriptor ······························ 230 7.4.4 flockfile - Acquire Ownership of File Stream ··································· 231 7.4.5 ftrylockfile - Poll to Acquire Ownership of File Stream ···················· 232 7.4.6 funlockfile - Release Ownership of File Stream ······························· 233
8 7.4.7 getc_unlocked - Get Character without Locking ······························ 234 7.4.8 getchar_unlocked - Get Character from stdin without Locking ······· 235 7.4.9 putc_unlocked - Put Character without Locking ······························ 236 7.4.10 putchar_unlocked - Put Character to stdin without Locking ········· 237 7.4.11 setjmp - Save Context for Non-Local Goto ····································· 238 7.4.12 longjmp - Non-Local Jump to a Saved Context ······························ 239 7.4.13 sigsetjmp - Save Context with Signal Status for Non-Local Goto ··· 240 7.4.14 siglongjmp - Non-Local Jump with Signal Status to a Saved Context ·········································································································· 241 7.4.15 tzset - Initialize Time Conversion Information ······························· 242 7.4.16 strtok_r - Reentrant Extract Token from String ······························ 243 7.4.17 asctime_r - Reentrant struct tm to ASCII Time Conversion ··········· 244 7.4.18 ctime_r - Reentrant time_t to ASCII Time Conversion ··················· 245 7.4.19 gmtime_r - Reentrant UTC Time Conversion ································· 246 7.4.20 localtime_r - Reentrant Local Time Conversion ····························· 247 7.4.21 rand_r - Reentrant Random Number Generation ························· 248 8 System Databases Manager ·········································· 249 8.1 Introduction ······························································································· 249 8.2 Background ································································································ 249 8.3 Operations ································································································· 250 8.4 Directives ··································································································· 250 8.4.1 getgrgid - Get Group File Entry for ID ·············································· 251 8.4.2 getgrgid_r - Reentrant Get Group File Entry for ID ·························· 252 8.4.3 getgrnam - Get Group File Entry for Name ······································ 253 8.4.4 getgrnam_r - Reentrant Get Group File Entry for Name ················· 254 8.4.5 getpwuid - Get Password File Entry for UID ····································· 255 8.4.6 getpwuid_r - Reentrant Get Password File Entry for UID ················ 256 8.4.7 getpwnam - Password File Entry for Name ····································· 257 8.4.8 getpwnam_r - Reentrant Get Password File Entry for Name ·········· 258 9 Semaphore Manager ···················································· 259 9.1 Introduction ······························································································· 259 9.2 Background ································································································ 260 9.2.1 Theory ······························································································ 260 9.2.2 "sem_t" Structure ············································································ 260 9.2.3 Building a Semaphore Attribute Set ················································ 260
分享到:
收藏