DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

Programming with system calls and libraries



Application programming
        UnixWare tools and languages
        Programming tools and languages in the UnixWare environment
                The C language
                Shell
                awk
                lex
                yacc
                m4
        Character user interfaces
                curses
                FMLI
                ETI
        Graphical user interfaces
                UnixWare X server
                Motif graphical user interface
        System calls and libraries
                File and device input/output
                        STREAMS input/output
                        File and record locking
                        Where to find more information
                Memory management
                        The memory mapping interface
                        Where to find more information
                Process management and scheduling
                        Where to find more information
                Interprocess communication
                        Where to find more information
                Symbolic links
                        Where to find more information

System calls and libraries
        Libraries and header files
                Header files
                How to use library functions
                C library (libc)
                        Subsection 3C routines
                        Subsection 3S routines
                Math library (libm)
                General purpose library (libgen)
                Standard I/O library
                        Three files you always have
                        Named files
                BSD system libraries and header files
                        Accessing BSD libraries and header files
                        BSD library routines
                        BSD header files
                How C programs communicate with the shell
                        Passing command line arguments
        System calls
                File and device I/O
                Terminal device control
                Directory and file system control
                Processes
                Signals
                IPC system calls
                Advanced interprocess communication
                Memory management
                Miscellaneous system calls
                BSD system calls
                System call error handling

File and device input/output
        Input/output system calls
                File descriptors
                Reading and writing files
                Positioning and reading/writing files
                Opening, creating and closing files
                Random access -- lseek
        File and record locking
                Terminology
                File protection
                        Opening a file for record locking
                        Setting a file lock
                        Setting and removing record locks
                        Getting lock information
                        Deadlock handling
                Selecting advisory or mandatory locking
                        Advisory versus mandatory locking
                Record locking and future releases of the UNIX system
        Basic STREAMS operations
        Benefits of STREAMS
                Standardized service interfaces
                Manipulating modules
                        Protocol portability
                        Protocol substitution
                        Protocol migration
                        Module reusability
        STREAMS mechanism
                STREAMS system calls
                        getmsg and putmsg
                        poll
                Opening a STREAMS device file
                Creating a STREAMS-based pipe
                Adding and removing modules
                Closing the stream
                Stream construction example
                        Inserting modules
                        Module and driver control

Process management
        Program execution - exec
        Process creation - fork
        Control of processes - fork and wait
        Process termination
        Timer operations
        Process scheduling
                How the process scheduler works
                        Time-sharing class and fixed class
                        System class
                        Fixed priority class
                Scheduler commands and function calls
                        The priocntl command
                        The priocntl system call
                        The priocntllist system call
                        The priocntlset system call
                Scheduler interaction with other functions
                        fork, exec
                        nice
                        init
                Scheduler performance
                        LWP state transition
                        Software latencies
                Managing processors and processes
                        Taking processors online and offline
                        Binding processes to processors
                        Placing processors in an exclusive binding mode
        Memory management facilities
                Virtual memory, address spaces and mapping
                Networking, heterogeneity and integrity
                Memory management interfaces
                        Creating and using mappings
                        Removing mappings
                        Cache control
                        Other mapping functions
                Address space layout

Terminal device control
        General terminal interface
                Baud rates
                Input modes
                Output modes
                Control modes
                Local modes and line disciplines
                Special control characters
        Opening a terminal device file
        Input processing and reading data
                Canonical mode input processing
                Non-canonical mode input processing
        Writing data and output processing
        Closing a terminal device file
        Special characters
        The controlling-terminal and process-groups
        Session management and job control
        Improving terminal I/O performance
                TTY in canonical mode
                TTY in raw mode
                TTY flow control
        STREAMS-based terminal subsystem
                Line discipline module
                        Default settings
                        Open and close routines
                        EUC handling in ldterm
                Support of termiox
                Hardware emulation module
        STREAMS-based pseudo-terminal subsystem
                Line discipline module
                Pseudo-tty emulation module -- ptem
                Remote mode
                Packet mode
                Pseudo-tty drivers -- ptm and pts
                        grantpt
                        unlockpt
                        ptsname

Internationalization
        Discussion
        Organization
        Locales
        Character representation
                ``8-bit clean''
                Character classification and conversion
                        Sign extension
                        Characters used as indices
                Wide characters
                        Multibyte and wide-character conversion
                        Input/output
                        Character classification and conversion
                        curses support
                        C language features
                System-defined words
        Cultural and language conventions
                Date and time
                Numeric and monetary information
                String collation
        Message handling
                mkmsgs and gettxt (UnixWare-specific)
                exstr and srchtxt (UnixWare-specific)
                catopen and catclose (X/Open)
                gencat and catgets (X/Open)
                %n$ conversion specifications

Directory and file management
        Types of files
                Regular files
                Directory files
                Special files
        Organization of files
        File naming
        Path names
                Full pathnames
                Relative pathnames
        Symbolic links
                Properties of symbolic links
                Using symbolic links
                        Creating symbolic links
                        Removing symbolic links
                        Accessing symbolic links
                        Copying symbolic links
                        Linking symbolic links
                        Moving symbolic links
                        File ownership and permissions
                Using symbolic links with NFS
                Archiving commands
        Summary of UNIX system files & directories
                UNIX system directories
        File access controls
                File protection
                        File permissions
                        Setting default permissions
                        How to determine existing permissions
                        How to change existing permissions
                        A note on permissions and directories
                        An alternative method
        Security considerations
                What security means to programmers
                        What is security?
                        How basic security works
                Privileges
                        Privileges associated with a file
                        Manipulating file privileges
                        Privileges associated with a process
                        Manipulating process privileges

Signals, job control and pipes
        Signals
                Signal types
                Signal actions
                Signal handlers
                Protecting critical sections
                Signal stacks
                Sending signals
        Job control and session management
                Overview of job control
                        Job control terminology
                        Job control signals
                        The controlling terminal and process-groups
                        Terminal access control
                        Modem disconnect
                STREAMS-based job control
                        Allocation and deallocation
                        Hung-up streams
                        Hangup signals
                        Accessing the controlling terminal
        Basic interprocess communication - Pipes
        STREAMS-based pipes and FIFOs
                Creating and opening pipes and FIFOs
                        Accessing pipes and FIFOs
                        Flushing pipes and FIFOs
                        Named streams
                        Unique connections

Threads
        What is concurrent programming?
        What are threads?
                Threads illustrated
        Basic threads management
                Creating a new thread
                Terminating a thread
                        Termination of the process
                Waiting for thread termination
                        Detached threads
                Thread-specific data
                Threads and signals
                        Asynchronously-generated signals
                        Synchronously-generated signals
                        Thread-to-thread signaling
                Lightweight processes and threads concurrency level
                        Multiplexed threads
                        Managing threads concurrency
                        Bound threads
                Thread scheduling
                        Multiplexed thread scheduling
                        Bound thread scheduling
                        Managing thread scheduling
        Synchronizing threads
                Locks
                        Mutual exclusion locks
                        Spin locks
                        Recursive mutual exclusion
                        Reader-writer locks
                Semaphores
                Barriers
                Condition variables
                Awakening threads for synchronization mechanisms
                Further considerations for synchronization mechanisms
                Initialization of synchronization mechanisms
                        Alternative initialization
                Invalidation of synchronization mechanisms
        Compilation environment
                Error returns
                Thread-safe libraries
                System call wrappers
                Timers
        Debugging multithreaded programs
                Tracing multithreaded programs
                        Trace data files
                        Format of the trace data files
                        Merging trace files
                        Using trace file data
        Examples
                hello, world
                Basic threads management example
                Dining philosophers
                Producer/consumer

Interprocess communication
        Messages
                Using messages
                Getting message queues
                        Using msgget
                        Example program
                Controlling message queues
                        Using msgctl
                        Example program
                Operations for messages
                        Using message operations: msgsnd and msgrcv
                        Example program
        Semaphores
                Using semaphores
                Getting semaphores
                        Using semget
                        Example program
                Controlling semaphores
                        Using semctl
                        Example program
                Operations on semaphores
                        Using semop
                        Example program
        Shared memory
                Using shared memory
                Getting shared memory segments
                        Using shmget
                        Example program
                Controlling shared memory
                        Using shmctl
                        Example program
                Operations for shared memory
                        Using shared memory operations: shmat and shmdt
                        Example program
        IPC programming example for liber

STREAMS polling and multiplexing
        STREAMS input/output polling
                Synchronous input/output
                Asynchronous input/output
                Signals
                Extended signals
        STREAMS input/output multiplexing
                STREAMS multiplexors
                Building a multiplexor
                Dismantling a multiplexor
                Routing data through a multiplexor
        Persistent links

Asynchronous I/O
        Notation conventions
        Advantages of asynchronous I/O
                Performance
        Using asynchronous I/O
                Asynchronous I/O control block
                Threads-based Interface
                        Threads-based interface operations
                        Single threaded and multithreaded applications
                Kernel implementation
                        Accessing raw disk slices
                        Using the asynchronous I/O memory lock
                Error handling
                        Error behavior
        Using the interface functions
                aio_read and aio_write
                aio_suspend
                aio_cancel
        Using other system calls with asynchronous I/O
                fork and forkall
                exec and exit
                close
        How to use asynchronous I/O with your application

Guidelines for writing trusted software
        How to use this topic
        Scope of trust
        How trust is achieved
        Trust and security
                Privilege
                Trusted facility management
                Discretionary Access Control
                Discretionary access isolation
        Writing trusted commands
                User documentation
                Parameter and process attribute checking
                Privilege and special access
                        Set-id commands
                Privilege and special access in shared private routines
                Error checking
                Signal handling
                Handling sensitive data
                Executing other commands
                Using library routines
        Trusting shell scripts
                User documentation
                Privilege and special access
                Error checking
        Trusting public library routines
                Documentation
                Privilege and special access
                Reporting errors
                Handling sensitive data
                Executing commands
        Installing trusted commands and data
                Assigning access controls
                Assigning privileges and special permissions
        Summary