• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
The Linux Programmer\u2019s Guide

Sven Goldt
Sven van der Meer
Scott Burkett
Matt Welsh

Version 0.4
March 1995
0...Our continuing mission: to seek out knowledge of C, to explore strange unix
commands, and to boldly code where no one has man page 4.
2
Contents
1 The Linux operating system
7
2 The Linux kernel
9
3 The Linux libc package
11
4 Systemcalls
13
5 The \u201cswiss army knife\u201d ioctl
15
6 Linux Interprocess Communications
17
6.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17

6.2 Half-duplex UNIX Pipes. . . . . . . . . . . . . . . . . . . . . . . . . . .17 6.2.1 BasicConcepts. . . . . . . . . . . . . . . . . . . . . . . . . . . .17 6.2.2 Creating Pipes in C. . . . . . . . . . . . . . . . . . . . . . . . . .19 6.2.3 Pipes the Easy Way!. . . . . . . . . . . . . . . . . . . . . . . . .23 6.2.4 Atomic Operations with Pipes. . . . . . . . . . . . . . . . . . . .27 6.2.5 Notes on half-duplex pipes:. . . . . . . . . . . . . . . . . . . . .27

6.3 Named Pipes (FIFOs - First In First Out). . . . . . . . . . . . . . . . . . .27 6.3.1 BasicConcepts. . . . . . . . . . . . . . . . . . . . . . . . . . . .27 6.3.2 Creating a FIFO. . . . . . . . . . . . . . . . . . . . . . . . . . .27 6.3.3 FIFOOperations. . . . . . . . . . . . . . . . . . . . . . . . . . .28 6.3.4 Blocking Actions on a FIFO. . . . . . . . . . . . . . . . . . . . .30 6.3.5 The Infamous SIGPIPE Signal. . . . . . . . . . . . . . . . . . . .30

6.4 System V IPC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 6.4.1 FundamentalConcepts. . . . . . . . . . . . . . . . . . . . . . . .30 6.4.2 MessageQueues. . . . . . . . . . . . . . . . . . . . . . . . . . .32 6.4.3 Semaphores. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .46 6.4.4 SharedMemory. . . . . . . . . . . . . . . . . . . . . . . . . . . .62

7 SoundProgramming
69
7.1 Programming the internal speaker. . . . . . . . . . . . . . . . . . . . . .69
7.2 Programming a sound card. . . . . . . . . . . . . . . . . . . . . . . . . .69
8 Character Cell Graphics
71

8.1 I/O Function in libc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 8.1.1 FormattedOutput. . . . . . . . . . . . . . . . . . . . . . . . . . .72 8.1.2 FormattedInput. . . . . . . . . . . . . . . . . . . . . . . . . . . .73

8.2 The Termcap Library. . . . . . . . . . . . . . . . . . . . . . . . . . . . .74 8.2.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74 8.2.2 Find a Terminal Description. . . . . . . . . . . . . . . . . . . . .75 8.2.3 Look at a Terminal Description. . . . . . . . . . . . . . . . . . .75 8.2.4 TermcapCapabilities. . . . . . . . . . . . . . . . . . . . . . . . .76

3
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...