System Interface Guide

System Interface Guide

System Interface Guide Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, CA 94303 U.S.A. Part No: 805–5141–10 October 1998 Copyright 1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California 94303-4900 U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, SunDocs, Java, the Java Coffee Cup logo, and Solaris are trademarks, registered trademarks, or service marks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and SunTM Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements. RESTRICTED RIGHTS: Use, duplication, or disclosure by the U.S. Government is subject to restrictions of FAR 52.227–14(g)(2)(6/87) and FAR 52.227–19(6/87), or DFAR 252.227–7015(b)(6/95) and DFAR 227.7202–3(a). DOCUMENTATION IS PROVIDED “AS IS” AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. Copyright 1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, Californie 94303-4900 Etats-Unis. Tous droits réservés. Ce produit ou document est protégé par un copyright et distribué avec des licences qui en restreignent l’utilisation, la copie, la distribution, et la décompilation. Aucune partie de ce produit ou document ne peut être reproduite sous aucune forme, par quelque moyen que ce soit, sans l’autorisation préalable et écrite de Sun et de ses bailleurs de licence, s’il y en a. Le logiciel détenu par des tiers, et qui comprend la technologie relative aux polices de caractères, est protégé par un copyright et licencié par des fournisseurs de Sun. Des parties de ce produit pourront être dérivées du système Berkeley BSD licenciés par l’Université de Californie. UNIX est une marque déposée aux Etats-Unis et dans d’autres pays et licenciée exclusivement par X/Open Company, Ltd. Sun, Sun Microsystems, le logo Sun, SunDocs, Java, le logo Java Coffee Cup, et Solaris sont des marques de fabrique ou des marques déposées, ou marques de service, de Sun Microsystems, Inc. aux Etats-Unis et dans d’autres pays. Toutes les marques SPARC sont utilisées sous licence et sont des marques de fabrique ou des marques déposées de SPARC International, Inc. aux Etats-Unis et dans d’autres pays. Les produits portant les marques SPARC sont basés sur une architecture développée par Sun Microsystems, Inc. L’interface d’utilisation graphique OPEN LOOK et SunTM a été développée par Sun Microsystems, Inc. pour ses utilisateurs et licenciés. Sun reconnaît les efforts de pionniers de Xerox pour la recherche et le développement du concept des interfaces d’utilisation visuelle ou graphique pour l’industrie de l’informatique. Sun détient une licence non exclusive de Xerox sur l’interface d’utilisation graphique Xerox, cette licence couvrant également les licenciés de Sun qui mettent en place l’interface d’utilisation graphique OPEN LOOK et qui en outre se conforment aux licences écrites de Sun. CETTE PUBLICATION EST FOURNIE “EN L’ETAT” ET AUCUNE GARANTIE, EXPRESSE OU IMPLICITE, N’EST ACCORDEE, Y COMPRIS DES GARANTIES CONCERNANT LA VALEUR MARCHANDE, L’APTITUDE DE LA PUBLICATION A REPONDRE A UNE UTILISATION PARTICULIERE, OU LE FAIT QU’ELLE NE SOIT PAS CONTREFAISANTE DE PRODUIT DE TIERS. CE DENI DE GARANTIE NE S’APPLIQUERAIT PAS, DANS LA MESURE OU IL SERAIT TENU JURIDIQUEMENT NUL ET NON AVENU. Please Recycle Contents Preface ix 1. Introduction to the API 1 The Programming Interface 1 Interface Functions 2 Libraries 2 Static libraries 2 Dynamic libraries 3 Interface Taxonomy 3 Standard Classification 3 Public Classification 4 Obsolete Classification 4 2. Java Programming 5 What is Java? 5 The Java Programming Environment 6 Java Programs 7 javald and Relocatable Applications 9 Java Threads on Solaris 9 Tuning Multithreaded Applications 10 To Do More With Java 12 Contents iii 3. Processes 15 Overview 15 Functions 16 Spawning New Processes 19 Runtime Linking 21 Process Scheduling 22 Error Handling 23 4. Process Scheduler 25 Overview of the Scheduler 25 Time-Sharing Class 27 System Class 28 Real-time Class 28 Commands and Functions 28 Thepriocntl(1) Command 29 The priocntl(2) Function 31 The priocntlset(2) Function 31 Interaction with Other Functions 32 Kernel Processes 32 fork(2) and exec(2) 32 nice(2) 32 init(1M) 32 Performance 33 Process State Transition 33 Software Latencies 35 5. Signals 37 Overview 37 Signal Processing 38 Blocking 38 iv System Interface Guide ♦ October 1998 Handling 38 6. Input/Output Interfaces 41 Files and I/O 41 Basic File I/O 42 Advanced File I/O 43 File System Control 44 File and Record Locking 44 Supported File Systems 45 Choosing A Lock Type 45 Terminology 45 Opening a File for Locking 46 Setting a File Lock 46 Setting and Removing Record Locks 47 Getting Lock Information 48 Forking and Locks 49 Deadlock Handling 49 Selecting Advisory or Mandatory Locking 50 Cautions about Mandatory Locking 51 Terminal I/O 51 7. Memory Management 53 An Overview of Virtual Memory 53 Address Spaces and Mapping 54 Coherence 54 Memory Management Interfaces 55 Creating and Using Mappings 55 Removing Mappings 56 Cache Control 56 Other Memory Control Functions 57 Contents v 8. Interprocess Communication 59 Pipes 59 Named Pipes 61 Sockets 61 Socket Address Spaces 61 Socket Types 62 Socket Creation and Naming 62 Connecting Stream Sockets 63 Stream Data Transfer and Closing 63 Datagram sockets 64 Socket Options 64 POSIX IPC 64 POSIX Messages 64 POSIX Semaphores 65 POSIX Shared Memory 66 System V IPC 66 Permissions 66 IPC Functions, Key Arguments, and Creation Flags 67 System V Messages 67 System V Semaphores 70 System V Shared Memory 74 9. Realtime Programming and Administration 79 Basic Rules of Realtime Applications 79 Degrading Response Time 80 Runaway Realtime Processes 82 I/O Behavior 82 Scheduling 83 Dispatch Latency 83 vi System Interface Guide ♦ October 1998 Function Calls That Control Scheduling 89 Utilities that Control Scheduling 91 Configuring Scheduling 92 Memory Locking 94 Overview 95 High Performance I/O 96 POSIX Asynchronous I/O 97 Solaris Asynchronous I/O 98 Synchronized I/O 99 Interprocess Communication 101 Overview 101 Signals 101 Pipes 102 Named Pipes 102 Message Queues 102 Semaphores 102 Shared Memory 103 Choice of IPC and Synchronization Mechanisms 104 Asynchronous Networking 104 Modes of Networking 104 Networking Programming Models 105 Asynchronous Connectionless-Mode Service 105 Asynchronous Connection-Mode Service 107 Asynchronous Open 108 Timers 109 Timestamp Functions 110 Interval Timer Functions 110 A. Full Code Examples 113 Contents vii Index 143 viii System Interface Guide ♦ October 1998 Preface Purpose Read this guide for information about system interfaces provided by SunOS libraries. Rather than teaching you to write programs, this guide supplements programming texts by concentrating on other elements that are part of getting programs into operation. Audience and Prerequisite Knowledge This guide addresses programmers. Expert programmers, such as those developing system software, might find that this guide lacks the depth of information they need. Expert programmers should see the Solaris 7 Reference Manual Collection. Knowledge of terminal use, of a UNIX system editor, and of the UNIX system directory and file structure is assumed. Read the Open Windows User\’s Guide to review these basic tools and concepts. Preface ix The C Connection The SunOS system supports many programming languages. Nevertheless, the relationship between this operating system and C has always been and remains very close. Most of the code in the operating system is written in the C language. So, while this guide is intended to be useful to you no matter what language you are using, most of the examples assume you are programming in C. Hardware And Software Dependency Except for hardware-specific information such as addresses, most of the text in this book applies to any computer running the Solaris 7 operating evnironment and compatible versions. If commands work differently in your system environment, your system might be running a different software release. If some commands do not seem to exist, they might be in packages that are not installed on your system—talk to your system administrators to find out what commands you have available. Typeface Conventions The following conventions are used in this guide: Prompts and error messages from the system are printed in listing type like this. Information you type as a command or in response to prompts is shown in boldface listing type like this.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    158 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us