UNIX环境高级编程(第3版英文版)(上下册)

本书特色

[

本书是被誉为UNIX编程“圣经”的Advanced Programming in the UNIX Environment一书的第3版。在本书第2版出版后的8年中,UNIX发生了巨大的变化,特别是影响UNIX编程接口的有关标准变化很大。本书在保持前一版风格的基础上,根据新的标准对内容进行了修订和增补,反映了新的技术发展。书中除了介绍UNIX文件和目录、标准I/O库、系统数据文件和信息、进程环境、进程控制、进程关系、信号、线程、线程控制、守护进程、各种I/O、进程间通信、网络IPC、伪终端等方面的内容,还在此基础上介绍了众多应用实例,包括如何创建数据库函数库以及如何与网络打印机通信等。此外,还在附录中给出了函数原型和部分习题的答案。 本书内容权威,概念清晰,阐述精辟,对于所有层次UNIX/Linux程序员都是一本不可或缺的参考书。

]

内容简介

[

本书是被誉为UNIX编程“圣经”的Advanced Programming in the UNIX Environment一书的第3版。在本书第2版出版后的8年中,UNIX发生了巨大的变化,特别是影响UNIX编程接口的有关标准变化很大。本书在保持前一版风格的基础上,根据新的标准对内容进行了修订和增补,反映了新的技术发展。书中除了介绍UNIX文件和目录、标准I/O库、系统数据文件和信息、进程环境、进程控制、进程关系、信号、线程、线程控制、守护进程、各种I/O、进程间通信、网络IPC、伪终端等方面的内容,还在此基础上介绍了众多应用实例,包括如何创建数据库函数库以及如何与网络打印机通信等。此外,还在附录中给出了函数原型和部分习题的答案。

本书内容非常不错,概念清晰,阐述精辟,对于所有层次UNIX/Linux程序员都是一本不可或缺的参考书。

]

作者简介

[

W. 理查德·史蒂文斯(W. Richard Stevens),国际知名的UNIX 和网络专家,备受赞誉的技术作家。生前著有多部经典的传世之作,包括《UNIX 网络编程》(两卷本)、《TCP/IP 详解》(三卷本)和本书首版。 史蒂芬·A. 拉戈(Stephen A. Rago),资深UNIX 程序员,目前任NEC 美国实验室存储系统研究组研究员。之前是贝尔实验室的UNIX 系统V 版本4 的开发人员之一。著有《UNIX 系统V 网络编程》,是本书第1版的技术审校和第2 版的共同作者。

]

目录

目录Chapter 1. UNIX System Overview / UNIX基础知识 11.1 Introduction / 引言 11.2 UNIX Architecture / UNIX体系结构 11.3 Logging In / 登录 21.4 Files and Directories / 文件和目录 41.5 Input and Output / 输入和输出 81.6 Programs and Processes / 程序和进程 101.7 Error Handling / 出错处理 141.8 User Identification / 用户标识 161.9 Signals / 信号 181.10 Time Values / 时间值 201.11 System Calls and Library Functions / 系统调用和库函数 211.12 Summary / 小结 23Exercises / 习题 24Chapter 2. UNIX Standardization and Implementations / UNIX标准及实现 252.1 Introduction / 引言 252.2 UNIX Standardization / UNIX标准化 252.2.1 ISO C 252.2.2 IEEE POSIX 262.2.3 The Single UNIX Specification 302.2.4 FIPS 322.3 UNIX System Implementations / UNIX系统实现 332.3.1 UNIX System V Release 4 / SVR4 332.3.2 4.4BSD 342.3.3 FreeBSD 342.3.4 Linux 352.3.5 Mac OS X 352.3.6 Solaris 352.3.7 Other UNIX Systems / 其他UNIX系统 352.4 Relationship of Standards and Implementations / 标准和实现的关系 362.5 Limits / 限制 362.5.1 ISO C Limits / ISO C限制 372.5.2 POSIX Limits / POSIX限制 382.5.3 XSI Limits / XSI限制 412.5.4 sysconf, pathconf, and fpathconf Functions / 函数sysconf、pathconf和fpathconf 422.5.5 Indeterminate Runtime Limits / 不确定的运行时限制 492.6 Options / 选项 532.7 Feature Test Macros / 功能测试宏 572.8 Primitive System Data Types / 基本系统数据类型 582.9 Differences Between Standards / 标准之间的冲突 582.10 Summary / 小结 60Exercises / 习题 60Chapter 3. File I/O / 文件I/O 613.1 Introduction / 引言 613.2 File Descriptors / 文件描述符 613.3 open and openat Functions / 函数open和openat 623.4 creat Function / 函数creat 663.5 close Function / 函数close 663.6 lseek Function / 函数lseek 663.7 read Function / 函数read 713.8 write Function / 函数write 723.9 I/O Efficiency / I/O的效率 723.10 File Sharing / 文件共享 743.11 Atomic Operations / 原子操作 773.12 dup and dup2 Functions / 函数dup和dup2 793.13 sync, fsync, and fdatasync Functions / 函数sync、fsync和fdatasync 813.14 fcntl Function / 函数fcntl 823.15 ioctl Function / 函数ioctl 873.16 /dev/fd 883.17 Summary / 小结 90Exercises / 习题 90Chapter 4. Files and Directories / 文件和目录 934.1 Introduction / 引言 934.2 stat, fstat, fstatat, and lstat Functions / 函数stat、fstat、fstatat和lstat 934.3 File Types / 文件类型 954.4 Set-User-ID and Set-Group-ID / 设置用户ID和设置组ID 984.5 File Access Permissions / 文件访问权限 994.6 Ownership of New Files and Directories / 新文件和目录的所有权 1014.7 access and faccessat Functions / 函数access和faccessat 1024.8 umask Function / 函数umask 1044.9 chmod, fchmod, and fchmodat Functions / 函数chmod、fchmod和fchmodat 1064.10 Sticky Bit / 粘着位 1084.11 chown, fchown, fchownat, and lchown Functions / 函数chown、fchown、fchownat和lchown 1094.12 File Size / 文件长度 1114.13 File Truncation / 文件截断 1124.14 File Systems / 文件系统 1134.15 link, linkat, unlink, unlinkat, and remove Functions / 函数link、linkat、unlink、unlinkat和remove 1164.16 rename and renameat Functions / 函数rename和renameat 1194.17 Symbolic Links / 符号链接 1204.18 Creating and Reading Symbolic Links / 创建和读取符号链接 1234.19 File Times / 文件的时间 1244.20 futimens, utimensat, and utimes Functions / 函数futimens、utimensat和utimes 1264.21 mkdir, mkdirat, and rmdir Functions / 函数mkdir、mkdirat和rmdir 1294.22 Reading Directories / 读目录 1304.23 chdir, fchdir, and getcwd Functions / 函数chdir、fchdir和getcwd 1354.24 Device Special Files / 设备特殊文件 1374.25 Summary of File Access Permission Bits / 文件访问权限位小结 1404.26 Summary / 小结 140Exercises / 习题 141Chapter 5. Standard I/O Library / 标准I/O库 1435.1 Introduction / 引言 1435.2 Streams and FILE Objects / 流和FILE对象 1435.3 Standard Input, Standard Output, and Standard Error / 标准输入、标准输出和标准错误 1455.4 Buffering / 缓冲 1455.5 Opening a Stream / 打开流 1485.6 Reading and Writing a Stream / 读和写流 1505.7 Line-at-a-Time I/O / 每次一行I/O 1525.8 Standard I/O Efficiency / 标准I/O的效率 1535.9 Binary I/O / 二进制I/O 1565.10 Positioning a Stream / 定位流 1575.11 Formatted I/O / 格式化I/O 1595.12 Implementation Details / 实现细节 1645.13 Temporary Files / 临时文件 1675.14 Memory Streams / 内存流 1715.15 Alternatives to Standard I/O / 标准I/O的替代软件 1745.16 Summary / 小结 175Exercises / 习题 175Chapter 6. System Data Files and Information / 系统数据文件和信息 1776.1 Introduction / 引言 1776.2 Password File / 口令文件 1776.3 Shadow Passwords / 阴影口令 1816.4 Group File / 组文件 1826.5 Supplementary Group IDs / 附属组ID 1836.6 Implementation Differences / 实现区别 1846.7 Other Data Files / 其他数据文件 1856.8 Login Accounting / 登录账户记录 1866.9 System Identification / 系统标识 1876.10 Time and Date Routines / 时间和日期例程 1896.11 Summary / 小结 196Exercises / 习题 196Chapter 7. Process Environment / 进程环境 1977.1 Introduction / 引言 1977.2 main Function / main函数 1977.3 Process Termination / 进程终止 1987.4 Command-Line Arguments / 命令行参数 2037.5 Environment List / 环境表 2037.6 Memory Layout of a C Program / C程序的存储空间布局 2047.7 Shared Libraries / 共享库 2067.8 Memory Allocation / 存储空间分配 2077.9 Environment Variables / 环境变量 2107.10 setjmp and longjmp Functions / 函数setjmp和longjmp 2137.11 getrlimit and setrlimit Functions / 函数getrlimit和setrlimit 2207.12 Summary / 小结 225Exercises / 习题 226Chapter 8. Process Control / 进程控制 2278.1 Introduction / 引言 2278.2 Process Identifiers / 进程标识 2278.3 fork Function / 函数fork 2298.4 vfork Function / 函数vfork 2348.5 exit Functions / 函数exit 2368.6 wait and waitpid Functions / 函数wait和waitpid 2388.7 waitid Function / 函数waitid 2448.8 wait3 and wait4 Functions / 函数wait3和wait4 2458.9 Race Conditions / 竞争条件 2458.10 exec Functions / 函数exec 2498.11 Changing User IDs and Group IDs / 更改用户ID和更改组ID 2558.12 Interpreter Files / 解释器文件 2608.13 system Function / 函数system 2648.14 Process Accounting / 进程会计 2698.15 User Identification / 用户标识 2758.16 Process Scheduling / 进程调度 2768.17 Process Times / 进程时间 2808.18 Summary / 小结 282Exercises / 习题 283Chapter 9. Process Relationships / 进程关系 2859.1 Introduction / 引言 2859.2 Terminal Logins / 终端登录 2859.3 Network Logins / 网络登录 2909.4 Process Groups / 进程组 2939.5 Sessions / 会话 2959.6 Controlling Terminal / 控制终端 2969.7 tcgetpgrp, tcsetpgrp, and tcgetsid Functions / 函数tcgetpgrp、tcsetpgrp和tcgetsid 2989.8 Job Control / 作业控制 2999.9 Shell Execution of Programs / Shell执行程序 3039.10 Orphaned Process Groups / 孤儿进程组 3079.11 FreeBSD Implementation / FreeBSD实现 3109.12 Summary / 小结 312Exercises / 习题 312Chapter 10. Signals / 信号 31310.1 Introduction / 引言 31310.2 Signal Concepts / 信号概念 31310.3 signal Function / 函数signal 32310.4 Unreliable Signals / 不可靠的信号 32610.5 Interrupted System Calls / 中断的系统调用 32710.6 Reentrant Functions / 可重入函数 33010.7 SIGCLD Semantics / SIGCLD语义 33210.8 Reliable-Signal Terminology and Semantics / 可靠信号术语和语义 33510.9 kill and raise Functions / 函数kill和raise 33610.10 alarm and pause Functions / 函数alarm和pause 33810.11 Signal Sets / 信号集 34410.12 sigprocmask Function / 函数sigprocmask 34610.13 sigpending Function / 函数sigpending 34710.14 sigaction Function / 函数sigaction 34910.15 sigsetjmp and siglongjmp Functions / 函数sigsetjmp和siglongjmp 35510.16 sigsuspend Function / 函数sigsuspend 35910.17 abort Function / 函数abort 36510.18 system Function / 函数system 36710.19 sleep, nanosleep, and clock_nanosleep Functions / 函数sleep、nanosleep和clock_nanosleep 37310.20 sigqueue Function / 函数sigqueue 37610.21 Job-Control Signals / 作业控制信号 37710.22 Signal Names and Numbers / 信号名和编号 37910.23 Summary / 小结 381Exercises / 习题 381Chapter 11. Threads / 线程 38311.1 Introduction / 引言 38311.2 Thread Concepts / 线程概念 38311.3 Thread Identification / 线程标识 38411.4 Thread Creation / 线程创建 38511.5 Thread Termination / 线程终止 38811.6 Thread Synchronization / 线程同步 39711.6.1 Mutexes / 互斥量 39911.6.2 Deadlock Avoidance / 避免死锁 40211.6.3 pthread_mutex_timedlock Function / 函数pthread_mutex_timedlock 40711.6.4 Reader-Writer Locks / 读写锁 40911.6.5 Reader-Writer Locking with Timeouts / 带有超时的读写锁 41311.6.6 Condition Variables / 条件变量 41311.6.7 Spin Locks / 自旋锁 41711.6.8 Barriers / 屏障 41811.7 Summary / 小结 422Exercises / 习题 422Chapter 12. Thread Control / 线程控制 42512.1 Introduction / 引言 42512.2 Thread Limits / 线程限制 42512.3 Thread Attributes / 线程属性 42612.4 Synchronization Attributes / 同步属性 43012.4.1 Mutex Attributes / 互斥量属性 43012.4.2 Reader-Writer Lock Attributes / 读写锁属性 43912.4.3 Condition Variable Attributes / 条件变量属性 44012.4.4 Barrier Attributes / 屏障属性 44112.5 Reentrancy / 重入 44212.6 Thread-Specific Data / 线程特定数据 44612.7 Cancel Options / 取消选项 45112.8 Threads and Signals / 线程和信号 45312.9 Threads and fork / 线程和fork 45712.10 Threads and I/O / 线程和I/O 46112.11 Summary / 小结 462Exercises / 习题 462Chapter 13. Daemon Processes / 守护进程 46313.1 Introduction / 引言 46313.2 Daemon Characteristics / 守护进程的特征 46313.3 Coding Rules / 编程规则 46613.4 Error Logging / 出错记录 46913.5 Single-Instance Daemons / 单实例守护进程 47313.6 Daemon Conventions / 守护进程的惯例 47413.7 Client-Server Model / 客户进程-服务器进程模型 47913.8 Summary / 小结 480Exercises / 习题 480Chapter 14. Advanced I/O / 高级I/O 48114.1 Introduction / 引言 48114.2 Nonblocking I/O / 非阻塞I/O 48114.3 Record Locking / 记录锁 48514.4 I/O Multiplexing / I/O多路转接 50014.4.1 select and pselect Functions / 函数select和pselect 50214.4.2 poll Function / 函数poll 50614.5 Asynchronous I/O / 异步I/O 50914.5.1 System V Asynchronous I/O / System V异步I/O 51014.5.2 BSD Asynchronous I/O / BSD异步I/O 51014.5.3 POSIX Asynchronous I/O / POSIX异步I/O 51114.6 readv and writev Functions / 函数readv和writev 52114.7 readn and writen Functions / 函数readn和writen 52314.8 Memory-Mapped I/O / 存储映射I/O 52514.9 Summary / 小结 531Exercises / 习题 532Chapter 15. Interprocess Communication / 进程间通信 53315.1 Introduction / 引言 53315.2 Pipes / 管道 53415.3 popen and pclose Functions / 函数popen和pclose 54115.4 Coprocesses / 协同进程 54815.5 FIFOs 55215.6 XSI IPC 55615.6.1 Identifiers and Keys / 标识符和键 55615.6.2 Permission Structure / 权限结构 55815.6.3 Configuration Limits / 结构限制 55915.6.4 Advantages and Disadvantages / 优点和缺点 55915.7 Message Queues / 消息队列 56115.8 Semaphores / 信号量 56515.9 Shared Memory / 共享存储 57115.10 POSIX Semaphores / POSIX信号量 57915.11 Client-Server Properties / 客户进程-服务器进程属性 58515.12 Summary / 小结 587Exercises / 习题 587Chapter 16. Network IPC: Sockets / 网络IPC:套接字 58916.1 Introduction / 引言 58916.2 Socket Descriptors / 套接字描述符 59016.3 Addressing / 寻址 59316.3.1 Byte Ordering / 字节序 59316.3.2 Address Formats / 地址格式 59516.3.3 Address Lookup / 地址查询 59716.3.4 Associating Addresses with Sockets / 将套接字与地址关联 60416.4 Connection Establishment / 建立连接 60516.5 Data Transfer / 数据传输 61016.6 Socket Options / 套接字选项 62316.7 Out-of-Band Data / 带外数据 62616.8 Nonblocking and Asynchronous I/O / 非阻塞和异步I/O 62716.9 Summary / 小结 628Exercises / 习题 628Chapter 17. Advanced IPC / 高级进程间通信 62917.1 Introduction / 引言 62917.2 UNIX Domain Sockets / UNIX域套接字 62917.3 Unique Connections / 唯一连接 63517.4 Passing File Descriptors / 传送文件描述符 64217.5 An Open Server, Version 1 / 打开服务器进程第 1版 65317.6 An Open Server, Version 2 / 打开服务器进程第 2版 65917.7 Summary / 小结 669Exercises / 习题 670Chapter 18. Terminal I/O / 终端I/O 67118.1 Introduction / 引言 67118.2 Overview / 概述 67118.3 Special Input Characters / 特殊输入字符 67818.4 Getting and Setting Terminal Attributes / 获得和设置终端属性 68318.5 Terminal Option Flags / 终端选项标志 68318.6 stty Command / stty命令 69118.7 Baud Rate Functions / 波特率函数 69218.8 Line Control Functions / 行控制函数 69318.9 Terminal Identification / 终端标识 69418.10 Canonical Mode / 规范模式 70018.11 Noncanonical Mode / 非规范模式 70318.12 Terminal Window Size / 终端窗口大小 71018.13 termcap, terminfo, and curses / termcap、terminfo和curses 71218.14 Summary / 小结 713Exercises / 习题 713Chapter 19. Pseudo Terminals / 伪终端 71519.1 Introduction / 引言 71519.2 Overview / 概述 71519.3 Opening Pseudo-Terminal Devices / 打开伪终端设备 72219.4 pty_fork Function / 函数pty_fork 72619.5 pty Program / pty程序 72919.6 Using the pty Program / 使用pty程序 73319.7 Advanced Features / 高级特性 74019.8 Summary / 小结 741Exercises / 习题 742Chapter 20. A Database Library / 数据库函数库 74320.1 Introduction / 引言 74320.2 History / 历史 74320.3 The Library / 函数库 74420.4 Implementation Overview / 实现概述 74620.5 Centralized or Decentralized / 集中式还是非集中式 75020.6 Concurrency / 并发 75220.7 Building the Library / 构造函数库 75320.8 Source Code / 源代码 75320.9 Performance / 性能 78120.10 Summary / 小结 786Exercises / 习题 787Chapter 21. Communicating with a Network Printer / 与网络打印机通信 78921.1 Introduction / 引言 78921.2 The Internet Printing Protocol / 网络打印协议 78921.3 The Hypertext Transfer Protocol / 超文本传输协议HTTP 79221.4 Printer Spooling / 打印假脱机技术 79321.5 Source Code / 源代码 79521.6 Summary / 小结 843Exercises / 习题 843Appendix A. Function Prototypes / 函数原型 845Appendix B. Miscellaneous Source Code / 其他源代码 895B.1 Our Header File / 本书使用的头文件 895B.2 Standard Error Routines / 标准出错例程 898Appendix C. Solutions to Selected Exercises / 部分习题答案 905Bibliography / 参考书目 947

封面

UNIX环境高级编程(第3版英文版)(上下册)

书名:UNIX环境高级编程(第3版英文版)(上下册)

作者:[美] W. 理查德·史蒂文斯(W. R

页数:953

定价:¥169.0

出版社:人民邮电出版社

出版日期:2018-02-01

ISBN:9787115515919

PDF电子书大小:40MB 高清扫描完整版

百度云下载:http://www.chendianrong.com/pdf

发表评论

邮箱地址不会被公开。 必填项已用*标注