Next: 1 The Linux operating Up: e Previous: e

## Contents

- 1 The Linux operating system
- 2 The Linux kernel
- 3 The Linux libc package
- 4 System calls
- 5 The ``swiss army knife'' ioctl
- 6 Linux Interprocess Communications
  - 6.1 Introduction
  - 6.2 Half-duplex UNIX Pipes
    - 6.2.1 Basic Concepts
    - 6.2.2 Creating Pipes in C
    - 6.2.3 Pipes the Easy Way!
    - 6.2.4 Atomic Operations with Pipes
    - 6.2.5 Notes on half-duplex pipes:
  - 6.3 Named Pipes (FIFOs - First In First Out)
    - 6.3.1 Basic Concepts
    - 6.3.2 Creating a FIFO
    - 6.3.3 FIFO Operations
    - 6.3.4 Blocking Actions on a FIFO
    - 6.3.5 The Infamous SIGPIPE Signal
  - 6.4 System V IPC
    - 6.4.1 Fundamental Concepts
      - IPC Identifiers
      - IPC Keys
      - The `ipcs` Command
      - The `ipcrm` Command
    - 6.4.2 Message Queues
      - Basic Concepts
      - Internal and User Data Structures
        - Message buffer
        - Kernel `msg` structure
        - Kernel `msqid_ds` structure
        - Kernel `ipc_perm` structure
      - SYSTEM CALL: msgget()
      - SYSTEM CALL: msgsnd()
      - SYSTEM CALL: msgctl()
      - msgtool: An interactive message queue manipulator
        - Background
        - Command Line Syntax
          - Sending Messages
          - Retrieving Messages
          - Changing the Permissions (mode)
          - Deleting a Queue
        - Examples
        - The Source
    - 6.4.3 Semaphores
      - Basic Concepts
      - Internal Data Structures
        - Kernel `semid_ds` structure
        - Kernel `sem` structure
      - SYSTEM CALL: semget()
      - SYSTEM CALL: semop()
      - SYSTEM CALL: semctl()
      - semtool: An interactive semaphore manipulator
        - Background
        - Command Line Syntax
          - Creating a Semaphore Set
          - Locking a Semaphore
          - Unlocking a Semaphore
          - Changing the Permissions (mode)
          - Deleting a Semaphore Set
        - Examples
        - The Source
      - semstat: A semtool companion program
    - 6.4.4 Shared Memory
      - Basic Concepts
      - Internal and User Data Structures
        - Kernel `shmid_ds` structure
      - SYSTEM CALL: shmget()
      - SYSTEM CALL: shmat()
      - SYSTEM CALL: shmctl()
      - SYSTEM CALL: shmdt()
      - shmtool: An interactive shared memory manipulator
        - Background
        - Command Line Syntax
          - Writing strings to the segment
          - Retrieving strings from the segment
          - Changing the Permissions (mode)
          - Deleting the segment
        - Examples
        - The Source
- 7 Sound Programming
  - 7.1 Programming the internal speaker
  - 7.2 Programming a sound card
- 8 Character Cell Graphics
  - 8.1 I/O Function in libc
    - 8.1.1 Formatted Output
    - 8.1.2 Formatted Input
  - 8.2 The Termcap Library
    - 8.2.1 Introduction
    - 8.2.2 Find a Terminal Description
    - 8.2.3 Look at a Terminal Description
    - 8.2.4 Termcap Capabilities
      - Boolean Capabilities
      - Numeric Capabilities
      - String Capabilities
  - 8.3 Ncurses - Introduction
  - 8.4 Initializing
  - 8.5 Windows
  - 8.6 Output
    - 8.6.1 Formatted Output
    - 8.6.2 Insert Characters/Lines
    - 8.6.3 Delete Characters/Lines
    - 8.6.4 Boxes and Lines
    - 8.6.5 Background Character
  - 8.7 Input
    - 8.7.1 Formated Input
  - 8.8 Options
    - Output Options
    - 8.8.1 Input Options
    - 8.8.2 Terminal Attributes
    - 8.8.3 Use Options
  - 8.9 Clear Window and Lines
  - 8.10 Updating the Terminal
  - 8.11 Video Attributes and Color
  - 8.12 Cursor and Window Coordinates
  - 8.13 Scrolling
  - 8.14 Pads
  - 8.15 Soft-labels
  - 8.16 Miscellaneous
  - 8.17 Low-level Access
  - 8.18 Screen Dump
  - 8.19 Termcap Emulation
  - 8.20 Terminfo Functions
  - 8.21 Debug Function
  - 8.22 Terminfo Capabilities
    - 8.22.1 Boolean Capabilities
    - 8.22.2 Numbers
    - 8.22.3 Strings
  - 8.23 [N]Curses Function Overview
- 9 Programming I/O ports
  - 9.1 Mouse Programming
  - 9.2 Modem Programming
  - 9.3 Printer Programming
  - 9.4 Joystick Programming
- 10 Porting Applications to Linux
  - 10.1 Introduction
  - 10.2 Signal handling
    - 10.2.1 Signals under SVR4, BSD, and POSIX.1
    - 10.2.2 Linux signal options
    - 10.2.3 signal under Linux
    - 10.2.4 Signals supported by Linux
  - 10.3 Terminal I/O
  - 10.4 Process information and control
    - 10.4.1 kvm routines
    - 10.4.2 ptrace and the /proc filesystem
    - 10.4.3 Process control under Linux
  - 10.5 Portable conditional compilation
  - 10.6 Additional Comments
- 11 Systemcalls in alphabetical order
- 12 Abbreviations
- About this document ...

- Copyright
  The Linux Programmer's Guide is © 1994, 1995 by Sven Goldt
  Sven Goldt, Sachsendamm 47b, 10829 Berlin, Germany
  <goldt@math.tu-berlin.de>.
  Chapter 8 is © 1994, 1995 by Sven van der Meer <vdmeer@cs.tu-berlin.de>.
  Chapter 6 is © 1995 Scott Burkett <scottb@IntNet.net>.
  Chapter 10 is © 1994, 1995 Matt Welsh <mdw@cs.cornell.edu>.
  Special thanks goes to John D. Harper <jharper@uiuc.edu> for proofreading this guide.
  Permission to reproduce this document in whole or in part is subject to the following conditions:
  1. The copyright notice remains intact and is included.
  2. If you make money with it the authors want a share.
  3. The authors are not responsible for any harm that might arise by the use of it.
- Preface
  This guide is far from being complete.
  The first release started at version 0.1 in September 1994. It concentrated on system calls because of lack of manpower and information. Planned are the description of library functions and major kernel changes as well as excursions into important areas like networking, sound, graphics and asynchronous I/O. Maybe some hints about how to build shared libraries and pointers to useful toolkits will later be included.
  This guide will only be a success with generous help in the form of information or perhaps even submission of whole chapters.
- Introduction
  Once upon a time I installed Linux on my PC to learn more about system administration. I tried to install a slip server but it didn't work with shadow and mgetty. I had to patch sliplogin and it worked until the new Linux 1.1 releases. No one could tell me what had happened. There was no documentation about changes since the 0.99 kernel except the kernel change summaries from Russ Nelson, but they didn't help me very much in solving problems.

  The Linux Programmer's Guide is meant to do what the name implies-- It is to help Linux programmers understand the peculiarities of Linux. By its nature, this also means that it should be useful when porting programs from other operating systems to Linux. Therefore, this guide must describe the system calls and the major kernel changes which have effects on older programs like serial I/O and networking.

Next: 1 The Linux operating Up: e Previous: e