图书介绍
Linux程序设计 英文版2025|PDF|Epub|mobi|kindle电子书版本百度云盘下载

- (美)罗宾斯著 著
- 出版社: 北京:机械工业出版社
- ISBN:711116864X
- 出版时间:2005
- 标注页数:689页
- 文件大小:113MB
- 文件页数:725页
- 主题词:Linux操作系统-程序设计-英文
PDF下载
下载说明
Linux程序设计 英文版PDF格式电子书版下载
下载的文件为RAR压缩包。需要使用解压软件进行解压得到PDF格式图书。建议使用BT下载工具Free Download Manager进行下载,简称FDM(免费,没有广告,支持多平台)。本站资源全部打包为BT种子。所以需要使用专业的BT下载软件进行下载。如BitComet qBittorrent uTorrent等BT下载工具。迅雷目前由于本站不是热门资源。不推荐使用!后期资源热门了。安装了迅雷也可以迅雷进行下载!
(文件页数 要大于 标注页数,上中下等多册电子书除外)
注意:本站所有压缩包均有解压码: 点击下载压缩包解压工具
图书目录
PART Ⅰ Files and Users1
Chapter 1 Introduction3
1.1 The Linux/Unix File Model4
1.1.1 Files and Permissions4
1.1.2 Directories and Filenames6
1.1.3 Executable Files7
1.1.4 Devices9
1.2 The Linux/Unix Process Model10
1.2.1 Pipes:Hooking Processes Together12
1.3 Standard C vs.Original C12
1.4 Why GNU Programs Are Better14
1.4.1 Program Design15
1.4.2 Program Behavior16
1.4.3 C Code Programming16
1.4.4 Things That Make a GNU Program Better17
1.4.5 Parting Thoughts about the"GNU Coding Standards"19
1.5 Portability Revisited19
1.6 Suggested Reading20
1.7 Summary21
Exercises22
Chapter 2 Arguments,Options,and the Environment23
2.1 Option and Argument Conventions24
2.1.1 POSIX Conventions25
2.1.2 GNU Long Options27
2.2 Basic Command-Line Processing28
2.2.1 The V7 echo Program29
2.3 Option Parsing:getopt()and getopt_long()30
2.3.1 Single-Letter Options30
2.3.2 GNU getopt()and Option Ordering33
2.3.3 Long Options34
2.3.3.1 Long Options Table34
2.3.3.2 Long Options,POSIX Style37
2.3.3.3 getopt_long()Return Value Summary37
2.3.3.4 GNU getopt()or getopt_long()in User Programs39
2.4 The Environment40
2.4.1 Environment Management Functions41
2.4.2 The Entire Environment:environ43
2.4.3 GNU env44
2.5 Summary49
Exercises50
Chapter 3 User-Level Memory Management51
3.1 Linux/Unix Address Space52
3.2 Memory Allocation56
3.2.1 Library Calls:malloc(),calloc(),realloc(),free()56
3.2.1.1 Examining C Language Details57
3.2.1.2 Initially Allocating Memory:malloc()58
3.2.1.3 Releasing Memory:free()60
3.2.1.4 Changing Size:realloc()62
3.2.1.5 Allocating and Zero-filling:calloc()65
3.2.1.6 Summarizing from the GNU Coding Standards66
3.2.1.7 Using Private Allocators67
3.2.1.8 Example:Reading Arbitrarily Long Lines67
3.2.1.9 GLIBC Only:Reading Entire Lines:getline()and getdelim()73
3.2.2 String Copying:strdup()74
3.2.3 System Calls:brk()and sbrk()75
3.2.4 Lazy Programmer Calls:alloca()76
3.2.5 Address Space Examination78
3.3 Summary80
Exercises81
Chapter 4 Files and File I/O83
4.1 Introducing the Linux/Unix I/O Model84
4.2 Presenting a Basic Program Structure84
4.3 Determining What Went Wrong86
4.3.1 Values for errno87
4.3.2 Error Message Style90
4.4 Doing Input and Output91
4.4.1 Understanding File Descriptors92
4.4.2 Opening and Closing Files93
4.4.2.1 Mapping FILE Variables to File Descriptors95
4.4.2.2 Closing All Open Files96
4.4.3 Reading and Writing96
4.4.4 Example:Unix cat99
4.5 Random Access:Moving Around within a File102
4.6 Creating Files106
4.6.1 Specifying Initial File Permissions106
4.6.2 Creating Files with creat()109
4.6.3 Revisiting open()110
4.7 Forcing Data to Disk113
4.8 Setting File Length114
4.9 Summary115
Exercises115
Chapter 5 Directories and File Metadata117
5.1 Considering Directory Contents118
5.1.1 Definitions118
5.1.2 Directory Contents120
5.1.3 Hard Links122
5.1.3.1 The GNU link Program123
5.1.3.2 Dot and Dot-Dot125
5.1.4 File Renaming125
5.1.5 File Removal126
5.1.5.1 Removing Open Files127
5.1.5.2 Using ISO C:remove()127
5.1.6 Symbolic Links128
5.2 Creating and Removing Directories130
5.3 Reading Directories132
5.3.1 Basic Directory Reading133
5.3.1.1 Portability Considerations136
5.3.1.2 Linux and BSD Directory Entries137
5.3.2 BSD Directory Positioning Functions138
5.4 Obtaining Information about Files139
5.4.1 Linux File Types139
5.4.2 Retrieving File Information141
5.4.3 Linux Only:Specifying Higher-Precision File Times143
5.4.4 Determining File Type144
5.4.4.1 Device Information147
5.4.4.2 The V7 cat Revisited150
5.4.5 Working with Symbolic Links151
5.5 Changing Ownership,Permission,and Modification Times155
5.5.1 Changing File Ownership:chown(),fchown(),and lchown()155
5.5.2 Changing Permissions:chmod()and fchmod()156
5.5.3 Changing Timestamps:utime()157
5.5.3.1 Faking utime(file,NULL)159
5.5.4 Using fchown()and fchmod()for Security161
5.6 Summary162
Exercises163
Chapter 6 General Library Interfaces—Part 1165
6.1 Times and Dates166
6.1.1 Retrieving the Current Time:time()and difftime()167
6.1.2 Breaking Down Times:gmtime()and localtime()168
6.1.3 Formatting Dates and Times170
6.1.3.1 Simple Time Formatting:asctime()and ctime()170
6.1.3.2 Complex Time Formatting:strftime()171
6.1.4 Converting a Broken-Down Time to a time_t176
6.1.5 Getting Time-Zone Information178
6.1.5.1 BSD Systems Gotcha:timezone(),Not timezone179
6.2 Sorting and Searching Functions181
6.2.1 Sorting:qsort()181
6.2.1.1 Example:Sorting Employees183
6.2.1.2 Example:Sorting Directory Contents188
6.2.2 Binary Searching:bsearch()191
6.3 User and Group Names195
6.3.1 User Database196
6.3.2 Group Database199
6.4 Terminals:isatty()202
6.5 Suggested Reading203
6.6 Summary203
Exercises205
Chapter 7 Putting It All Together:ls207
7.1 V7 ls Options208
7.2 V7 ls Code209
7.3 Summary225
Exercises226
Chapter 8 Filesystems and Directory Walks227
8.1 Mounting and Unmounting Filesystems228
8.1.1 Reviewing the Background228
8.1.2 Looking at Different Filesystem Types232
8.1.3 Mounting Filesystems:mount236
8.1.4 Unmounting Filesystems:umount237
8.2 Files for Filesystem Administration238
8.2.1 Using Mount Options239
8.2.2 Working with Mounted Filesystems:getmntent()241
8.3 Retrieving Per-Filesystem Information244
8.3.1 POSIX Style:statvfs()and fstatvfs()244
8.3.2 Linux Style:statfs()and fstatfs()252
8.4 Moving Around in the File Hierarchy256
8.4.1 Changing Directory:chdir()and fchdir()256
8.4.2 Getting the Current Directory:getcwd()258
8.4.3 Walking a Hierarchy:nftw()260
8.4.3.1 The nftw()Interface261
8.4.3.2 The nftw()Callback Function263
8.5 Walking a File Tree:GNU du269
8.6 Changing the Root Directory:chroot()276
8.7 Summary277
Exercises278
PART Ⅱ Processes,IPC,and Internationalization281
Chapter 9 Process Management and Pipes283
9.1 Process Creation and Management284
9.1.1 Creating a Process:fork()284
9.1.1.1 After the fork():Shared and Distinct Attributes285
9.1.1.2 File Descriptor Sharing286
9.1.1.3 File Descriptor Sharing and close()288
9.1.2 Identifying a Process:getpid()and getppid()289
9.1.3 Setting Process Priority:nice()291
9.1.3.1 POSIX vs.Reality293
9.1.4 Starting New Programs:The exec()Family293
9.1.4.1 The execve()System Call294
9.1.4.2 Wrapper Functions:execl()et al295
9.1.4.3 Program Names and argv[0]297
9.1.4.4 Attributes Inherited across exec()298
9.1.5 Terminating a Process300
9.1.5.1 Defining Process Exit Status300
9.1.5.2 Returning from main()301
9.1.5.3 Exiting Functions302
9.1.6 Recovering a Child's Exit Status305
9.1.6.1 Using POSOX Functions:wait()and waitpid()306
9.1.6.2 Using BSD Functions:wait3()and wait4()310
9.2 Process Groups312
9.2.1 Job Control Overview312
9.2.2 Process Group Identification:getpgrp()and getpgid()314
9.2.3 Process Group Setting:setpgid()and setpgrp()314
9.3 Basic Interprocess Communication:Pipes and FIFOs315
9.3.1 Pipes315
9.3.1.1 Creating Pipes316
9.3.1.2 Pipe Buffering318
9.3.2 FIFOs319
9.4 File Descriptor Management320
9.4.1 Duplicating Open Files:dup()and dup2()321
9.4.2 Creating Nonlinear Pipelines:/dev/fd/XX326
9.4.3 Managing File Attributes:fcntl()328
9.4.3.1 The Close-on-exec Flag329
9.4.3.2 File Descriptor Duplication331
9.4.3.3 Manipulation of File Status Flags and Access Modes332
9.4.3.4 Nonblocking I/O for Pipes and FIFOs333
9.4.3.5 fcntl()Summary336
9.5 Example:Two-Way Pipes in gawk337
9.6 Suggested Reading341
9.7 Summary342
Exercises344
Chapter 10 Signals347
10.1 Introduction348
10.2 Signal Actions348
10.3 Standard C Signals:signal()and raise()349
10.3.1 The signal()Function349
10.3.2 Sending Signals Programmatically:raise()353
10.4 Signal Handlers in Action353
10.4.1 Traditional Systems353
10.4.2 BSD and GNU/Linux356
10.4.3 Ignoring Signals356
10.4.4 Restartable System Calls357
10.4.4.1 Example:GNU Coreutils safe_read()and safe_write()359
10.4.4.2 GLIBC Only:TEMP_FAILURE_RETRY()360
10.4.5 Race Conditions and sig_atomic_t(ISO C)361
10.4.6 Additional Caveats363
10.4.7 Our Story So Far,Episode I363
10.5 The System V Release 3 Signal APIs:sigset()et al365
10.6 POSIX Signals367
10.6.1 Uncovering the Problem367
10.6.2 Signal Sets:sigset_t and Related Functions368
10.6.3 Managing the Signal Mask:sigprocmask()et al369
10.6.4 Catching Signals:sigaction()370
10.6.5 Retrieving Pending Signals:sigpending()375
10.6.6 Making Functions Interruptible:siginterrupt()376
10.6.7 Sending Signals:kill()and killpg()376
10.6.8 Our Story So Far.Episode Ⅱ378
10.7 Signals for Interprocess Communication379
10.8 Important Special-Purpose Signals382
10.8.1 Alarm Clocks:sleep(),alarm(),and SIGALRM382
10.8.1.1 Harder but with More Control:alarm()and SIGALRM382
10.8.1.2 Simple and Easy:sleep()383
10.8.2 Job Control Signals383
10.8.3 Parental Supervision:Three Different Strategies385
10.8.3.1 Poor Parenting:Ignoring Children Completely385
10.8.3.2 Permissive Parenting:Supervising Minimally386
10.8.3.3 Strict Parental Control393
10.9 Signals Across fork()and exec()398
10.10 Summary399
Exercises401
Chapter 11 Permissions and User and Group ID Numbers403
11.1 Checking Permissions404
11.1.1 Real and Effective IDs405
11.1.2 Setuid and Setgid Bits406
11.2 Retrieving User and Group IDs407
11.3 Checking As the Real User:access()410
11.4 Checking as the Effective User:euidaccess()(GLIBC)412
11.5 Setting Extra Permission Bits for Directories412
11.5.1 Default Group for New Files and Directories412
11.5.2 Directories and the Sticky Bit414
11.6 Setting Real and Effective IDs415
11.6.1 Changing the Group Set416
11.6.2 Changing the Real and Effective IDs416
11.6.3 Using the Setuid and Setgid Bits419
11.7 Working with All Three IDs:getresuid()and setresuid()(Linux)421
11.8 Crossing a Security Minefield:Setuid root422
11.9 Suggested Reading423
11.10 Summary424
Exercises426
Chapter 12 General Library Interfaces—Part 2427
12.1 Assertion Statements:assert()428
12.2 Low-Level Memory:The memXXX()Functions432
12.2.1 Setting Memory:memset()432
12.2.2 Copying Memory:memcpy(),memmove(),and memccpy()433
12.2.3 Comparing Memory Blocks:memcmp()434
12.2.4 Searching for a Byte Value:memchr()435
12.3 Temporary Files436
12.3.1 Generating Temporary Filenames(Bad)437
12.3.2 Creating and Opening Temporary Files(Good)441
12.3.3 Using the TMPDIR Environment Variable443
12.4 Committing Suicide:abort()445
12.5 Nonlocal Gotos446
12.5.1 Using Standard Functions:setjmp()and longjmp()447
12.5.2 Handling Signal Masks:sigsetjmp()and siglongjmp()449
12.5.3 Observing Important Caveats450
12.6 Pseudorandom Numbers454
12.6.1 Standard C:rand()and srand()455
12.6.2 POSIX Functions:random()and srandom()457
12.6.3 The/dev/random and/dev/urandom Special Files460
12.7 Metacharacter Expansions461
12.7.1 Simple Pattern Matching:fnmatch()462
12.7.2 Filename Expansion:glob()and globfree()464
12.7.3 Shell Word Expansion:wordexp()and wordfree()470
12.8 Regular Expressions471
12.9 Suggested Reading480
12.10 Summary481
Exercises482
Chapter 13 Internationalization and Localization485
13.1 Introduction486
13.2 Locales and the C Library487
13.2.1 Locale Categories and Environment Variables487
13.2.2 Setting the Locale:setlocale()489
13.2.3 String Collation:strcoll()and strxfrm()490
13.2.4 Low-Level Numeric and Monetary Formatting:localeconv()494
13.2.5 High-Level Numeric and Monetary Formatting:strfmon()and printf()498
13.2.6 Example:Formatting Numeric Values in gawk501
13.2.7 Formatting Date and Time Values:ctime()and strftime()503
13.2.8 Other Locale Information:nl_langinfo()504
13.3 Dynamic Translation of Program Messages507
13.3.1 Setting the Text Domain:textdomain()507
13.3.2 Translating Messages:gettext()508
13.3.3 Working with Plurals:ngettext()509
13.3.4 Making gettext()Easy to Use510
13.3.4.1 Portable Programs:"gettext.h:511
13.3.4.2 GLIBC Only:<libintl.h>513
13.3.5 Rearranging Word Order with printf()514
13.3.6 Testing Translations in a Private Directory515
13.3.7 Preparing Internationalized Programs516
13.3.8 Creating Translations517
13.4 Can You Spell That for Me,Please?521
13.4.1 Wide Characters523
13.4.2 Multibyte Character Encodings523
13.4.3 Languages524
13.4.4 Conclusion525
13.5 Suggested Reading526
13.6 Summary526
Exercises527
Chapter 14 Extended Interfaces529
14.1 Allocating Aligned Memory:posix_memalign()and memalign()530
14.2 Locking Files531
14.2.1 File Locking Concepts531
14.2.2 POSIX Locking:fcntl()and lockf()533
14.2.2.1 Describing a Lock533
14.2.2.2 Obtaining and Releasing Locks536
14.2.2.3 Observing Locking Caveats538
14.2.3 BSD Locking:flock()539
14.2.4 Mandatory Locking540
14.3 More Precise Times543
14.3.1 Microsecond Times:gettimeofday()544
14.3.2 Microsecond File Times:utimes()545
14.3.3 Interval Timers:setitimer()and getitimer()546
14.3.4 More Exact Pauses:nanosleep()550
14.4 Advanced Searching with Binary Trees551
14.4.1 Introduction to Binary Trees551
14.4.2 Tree Management Functions554
14.4.3 Tree Insertion:tsearch()554
14.4.4 Tree Lookup and Use of A Returned Pointer:tfind()and tsearch()555
14.4.5 Tree Traversal:twalk()557
14.4.6 Tree Node Removal and Tree Deletion:tdelete()and tdestroy()561
14.5 Summary562
Exercises563
PART Ⅲ Debugging and Final project565
Chapter 15 Debugging567
15.1 First Things First568
15.2 Compilation for Debugging569
15.3 GDB Basics570
15.3.1 Running GDB571
15.3.2 Setting Breakpoints,Single-Stepping,and Setting Watchpoints574
15.4 Programming for Debugging577
15.4.1 Compile-Time Debugging Code577
15.4.1.1 Use Debugging Macros577
15.4.1.2 Avoid Expression Macros If Possible580
15.4.1.3 Reorder Code If Necessary582
15.4.1.4 Use Debugging Helper Functions584
15.4.1.5 Avoid Unions When Possible591
15.4.2 Runtime Debugging Code595
15.4.2.1 Add Debugging Options and Variables595
15.4.2.2 Use Special Environment Variables597
15.4.2.3 Add Logging Code601
15.4.2.4 Runtime Debugging Files602
15.4.2.5 Add Special Hooks for Breakpoints603
15.5 Debugging Tools605
15.5.1 The dbug Library—A Sophisticated printf()606
15.5.2 Memory Allocation Debuggers612
15.5.2.1 GNU/Linux mtrace613
15.5.2.2 Electric Fence614
15.5.2.3 Debugging Malloc:dmalloc619
15.5.2.4 Valgrind:A Versatile Tool623
15.5.2.5 Other Malloc Debuggers629
15.5.3 A Modern lint631
15.6 Software Testing632
15.7 Debugging Rules633
15.8 Suggested Reading637
15.9 Summary638
Exercises639
Chapter 16 A Project That Ties Everything Together641
16.1 Project Description642
16.2 Suggested Reading644
PART Ⅳ Appendixes647
Appendix A Teach Yourself Programming in Ten Years649
Appendix B Caldera Ancient UNIX License655
Appendix C GNU General Public License657
Index667
热门推荐
- 31263.html
- 3117995.html
- 3683406.html
- 271917.html
- 3173659.html
- 473139.html
- 1898768.html
- 976911.html
- 2870460.html
- 3252003.html
- http://www.ickdjs.cc/book_2867594.html
- http://www.ickdjs.cc/book_258556.html
- http://www.ickdjs.cc/book_452535.html
- http://www.ickdjs.cc/book_1812771.html
- http://www.ickdjs.cc/book_1182230.html
- http://www.ickdjs.cc/book_2790930.html
- http://www.ickdjs.cc/book_2600888.html
- http://www.ickdjs.cc/book_2909852.html
- http://www.ickdjs.cc/book_1297469.html
- http://www.ickdjs.cc/book_1478238.html