没有合适的资源?快使用搜索试试~ 我知道了~
Oracle Solaris 10 STREAMS Programming Guide-354
需积分: 5 0 下载量 179 浏览量
2023-06-28
11:53:37
上传
评论
收藏 2.59MB PDF 举报
温馨提示
试读
354页
Oracle Solaris 10 STREAMS Programming Guide-354
资源推荐
资源详情
资源评论
STREAMS Programming Guide
Part No: 816–4855–10
January 2005
Copyright ©2005Sun Microsystems 4150 Network Circle, Santa Clara, CA 95054 U.S.A.
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, docs.sun.com, AnswerBook, AnswerBook2, tags does not print or display in your document. Do not modify any text except the
attributions you type.--> 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 Sun Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering eorts 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.
Federal Acquisitions: Commercial Software–Government Users Subject to Standard License Terms and Conditions.
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 ©2005Sun Microsystems 4150 Network Circle, Santa Clara, CA 95054 U.S.A.
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, docs.sun.com, AnswerBook, AnswerBook2, 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 Sun a été développée par Sun Microsystems, Inc. pour ses utilisateurs et licenciés. Sun reconnaît les eorts 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.
110417@25097
Contents
Preface ...................................................................................................................................................13
Part I Application Programming Interface ................................................................................................ 17
1 Overview of STREAMS .........................................................................................................................19
What Is STREAMS? ............................................................................................................................ 19
STREAMS Denitions ........................................................................................................................ 20
Stream as a Data Path ................................................................................................................... 20
Stream Head ................................................................................................................................. 20
STREAMS Module ....................................................................................................................... 21
STREAMS Device Driver ............................................................................................................ 21
STREAMS Data ............................................................................................................................ 21
Message Queues ........................................................................................................................... 21
Communicating With a STREAMS Device .............................................................................. 22
STREAMS Multiplexing .............................................................................................................22
STREAMS Polling ........................................................................................................................ 23
Message Transfer Flow Control ................................................................................................. 23
When to Use STREAMS ..................................................................................................................... 23
How STREAMS Works—Application Interface ............................................................................. 23
Opening a Stream ......................................................................................................................... 23
Closing a Stream ........................................................................................................................... 24
Controlling Data Flow ................................................................................................................. 24
Simple Stream Example .............................................................................................................. 24
How STREAMS Works at the Kernel Level ..................................................................................... 26
Creating the Stream Head ...........................................................................................................26
Message Processing ...................................................................................................................... 26
Structure of a STREAMS Device Driver .................................................................................... 28
3
Message Components .................................................................................................................. 28
Message Queueing Priority .........................................................................................................29
Structure of a Message Queue ..................................................................................................... 30
Conguring Multiplexed Streams .............................................................................................. 31
Multithreading the Kernel .......................................................................................................... 32
Service Interfaces ................................................................................................................................. 32
Manipulating Modules ....................................................................................................................... 32
Protocol Portability ...................................................................................................................... 33
Protocol Substitution ................................................................................................................... 33
Protocol Migration ...................................................................................................................... 33
Module Reusability ...................................................................................................................... 34
2 STREAMS Application-Level Components ......................................................................................37
STREAMS Interfaces .......................................................................................................................... 37
STREAMS System Calls ..............................................................................................................37
Action Summary .......................................................................................................................... 38
Opening a STREAMS Device File ..................................................................................................... 39
Initializing Details ........................................................................................................................ 39
Queue Allocation ................................................................................................................................. 40
Adding and Removing Modules ........................................................................................................40
Closing the Stream .............................................................................................................................. 40
Stream Construction Example ........................................................................................................... 41
Inserting Modules ........................................................................................................................ 41
Module and Driver Control ........................................................................................................ 43
3 STREAMS Application-Level Mechanisms .......................................................................................47
Message Handling ............................................................................................................................... 47
Modifying Messages .................................................................................................................... 47
Message Types .............................................................................................................................. 48
Control of Stream Head Processing ........................................................................................... 48
Message Queueing and Priorities ...................................................................................................... 49
Controlling Data Flow and Priorities ........................................................................................ 50
Accessing the Service Provider ................................................................................................... 51
Closing the Service Provider .......................................................................................................54
Sending Data to the Service Provider ........................................................................................ 54
Contents
STREAMS Programming Guide • January 20054
Receiving Data .............................................................................................................................. 55
Input and Output Polling ................................................................................................................... 56
Synchronous Input and Output ................................................................................................. 57
Asynchronous Input and Output ............................................................................................... 60
signal Message ............................................................................................................................ 61
Stream as a Controlling Terminal ..................................................................................................... 62
Job Control ................................................................................................................................... 62
Allocation and Deallocation of Streams .................................................................................... 65
Hungup Streams ........................................................................................................................... 65
Hangup Signals ............................................................................................................................. 65
Accessing the Controlling Terminal .......................................................................................... 65
4 Application Access to the STREAMS Driver and Module Interfaces .............................................67
System Calls Used ................................................................................................................................ 67
Module and Driver ioctl Calls ......................................................................................................... 68
General ioctl Processing ........................................................................................................... 69
I_STR ioctl Processing .............................................................................................................. 70
Transparent ioctl Processing ................................................................................................... 70
I_LIST ioctl ................................................................................................................................70
Other ioctl Commands ............................................................................................................. 72
Message Direction ........................................................................................................................ 74
Flush Handling .................................................................................................................................... 74
5 STREAMS Administration ...................................................................................................................77
Administration Tools .......................................................................................................................... 77
Autopush Facility ................................................................................................................................. 78
Application Interface ................................................................................................................... 78
Administration Tool Description ...................................................................................................... 80
strace Command ....................................................................................................................... 80
strlog Command ....................................................................................................................... 81
strqget Command ..................................................................................................................... 81
strqset Command ..................................................................................................................... 81
strerr Daemon ........................................................................................................................... 81
Contents
5
剩余353页未读,继续阅读
资源评论
weixin_40191861_zj
- 粉丝: 64
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功