UNIX网络编程第三版英文(第二卷)
bool_tclnt_control(ClIENT*d,unsignedintrequest,char*ptr]:
418
CLIENT*clnt_create(constcharhost,unsigned-ongprognum,
nsignedlongversnum,constchar*protocol)
401
voidclntdestroy(CLIENT*c)
420
Entdoor-bind(intfd);
390
ntdo
1l(intfd,
nt.dboor-create(Docr-serverqroc*proc,void*cookie,uintaffr)
intdoor-cred(door_credt*cred);
intdocr-info(intfd,door_info_t*info):
365
intdoor_return(char*dataptr,size-tdatasize,door_desct*desoptr,size-tndesc):365
nt.doar-revoke(intfay
Docr-createqroc*door_server_create(Door_createproc"proc
intdoorunbind(void)
voiderr_dump(constchar*fmt
512
voiderr-msg《constcrar*fht,…);
512
voiderrquit(constchar+fnt,……):
512
voidarr_rat(const.char*fmt,-.
511
oiderr-sys(constchar*fmt,..
511
intfcrtl(intfa,intcmd,../structflock*ar*/);
199
intfata(intfd,structstat*buf
328
key-tftok(constchar*pathname,intid)
28
inttruncate(intfd,off
327
int
1。·(mqd_tmodes
ntmagetattr(mgatmodes,structmgattr*attr);
79
ntmqnotify(mad_tmodes,const.structsigevent*notification)
mqdtmqopen(constchar*name,intoflag
attr*aftr*/)
intcunlink(constchar*name);
intmagct1(intmsyid,intcmd,structmsqid_ds*ouff
intsaget(key-tkey
FILE*popen(constcharcommand,constchar*type/;
Functionprototype
voidpthreadcleanupgop(intexecute);
187
voidpthread_cleanuppush(void(function)(void*)void*arg);
187
intpthreadcreate(pthread-t*tid,constpthread_attr_t*aHt
oid(*func)(voic*
504
voidrthread●⊥t(voidstatus)
504
intpthreadjoin(pthread_ttid,voids*status);
503
pthreadtpthreadse1fivoid)i
503
intpthr。ad
ttrdestroy(pthreadcondattrt
172
intpthread_condattr_getpshared(constpthread-condattr-t*attr,int*calptr):
int
init(pthreadcondattrt*attr)
172
intpthreadcondattrBetpshared(pthreadcondattrt*attr,intvalue)
173
17
d_destroy(pth
17
intpthread_aond_init(pthrcad_cond_t*cptr,constpthread_condattrt*attr);
intpthread_cond_aignal(pthread_cond_t*cpir)i
int.pthread__cond_timedwait(pthreadcondt*ptr,pthreadmutex_t*mptr
conststructtimespec*abstime);
17
int.pthread_condwait(pthread_cond_t*cpir,pthread_mutex_t*empir)
167
intpthread_mutexattr_destroy(ptrread_mutexattr-t*aftr)
intpthread-mutexattrsetshared(constothread-mutexattr-t*attrintwualptr):173
intpthread_mautexattrinit(pthread-mutexattr-t*attr);
172
intpthread_mutexattr_aetpshared(pthread_mtexattrt*aftr,int.value
173
int
172
intpthrend_mutexlnit(pthre
tex_t*mptr,constpthread-mutexattr-t*attr):172
hze己mutex_1ock(x
160
160
intpthread_mutex_unlock(pthread_mutext*mptr)
160
intpthreads1ockattrde工○yY(上erv1ockt上工ttr)
179
intpthread_rwlockattr_getpshared(constpthread-rwlockattr-t*altr,int*valptr):179
katert*atir)
intpth·axw1ck鼻ctrsetpghared(thread-Y1ockattr一t*ttr;intvalue)
179
intpthr●aw1ockd
d_rwlock_t*rptr);
intpthread-rwlock_init(pthreadrwlock_t.*rupr
¢onstpthread-xw1cckattr一tatr
tpthread_flock_rdlock(
ptr
intpt上x
178
intpthread_rwlocktrywzlock(pthread_rwlock_t*rwptr
178
rlock_unlock(pthread-rwlock_t*rwplr
178
intpthread_Iwlockwrlocklpthread-rwlockt*rwptr
178
UNIXNetworkProgramming
Volume2
Secondedition
InterprocessCommunications
byw,RichardStevens
ISEN0-L3-08L081-5
0000
PrenticehallPtr
UpperSaddleRiver,NJ07458
www.phptr.com
980130g10g1
LibraryofCongressCataloging-in-PublicationData
tevens,
W.Richard
UNIXnetworkprogrammingIbyW.RichardStevens.--2nded
Includesbibliographicalrcfcrcnccsandindex
Contents:v1.NetworkingAPls:socketsandXTI
ISBN0-13-490012-X(v.1
1.UNIX(Computerfile)2.Computernetworks.3.Internet
programming.ITitle
QA76.76.063S7551998
005.712768-DC21
97-3176l
Editorialproductionsupervision:PattiGuerrieri
Coverdesigndirector:Jerryvona
Coverdesigner:scottweiss
Manufacturingmanager:AlexisR.Heydi
Marketingmanager:Mileswilliams
Acquisitionseditor:Maryfranz
Editorialassistant:Noreenregina
@1999byPrenticeHallPTR
rentice-Hall.Inc.
ASimonschusterCompany
UpperSaddlerivcr,NJ07458
PrcnticcHallbooksarewidclyuscdbycorporationsandgovcrnmcntagencics
fortraining,marketing,andresale
Thepublisheroffersdiscountsonthisbookwhenorderedinbulkquantities
Formoreinformation,contact:CorporateSalesDepartment,Phone:80(1-382-3419
Fax:201-236-7141;E-mail:corpsales@prenhall.com;orwrite:PrenticeHallPTR,
CorpSalesDept,OneLakeStreet,UpperSaddleriver,N.07458
allproductsorservicesmentionedinthisbookarethetrademarksorservicemarksoftheir
respectivecompaniesororganizations
AllrightsreservedNopartofthisbookmaybereproduced,inanyformorbyanymeans,without
permissioninwritingfromthepublisher
PrintedintheUnitcdStatcsofamerica
1098765432
IsEN0130810819
Prentice-HallInternational(UK)Limited,London
Prentice-HallofAustraliaPty.Limited,Sydney
Prenticc-HallCanadainctoronto
Prentice-HallHispanoamericana,S.A.,Mexico
Prenticc-HallofIndiaprivateLimited.Newdelhi
Prentice-HallofJapan,Inc,Tokyo
SimonschusterAsiaPte.Ltd,singapore
EditoraPrentice-Halldobrasil.ltda.Riodejaneiro
Totheusenetcommunity
formanyquestionsanswered,
andmanyFAQsprovided.
Abbreviatedtableofcontents
Part1.Introduction
Chapter1.Introduction
Chapter2.PosixIPC
Chapter3.SystemVIPC
Part2.MessagePassing
41
Chapter4.PipesandFIFOs
43
Chapter5.PosixMessageQueues
Chapter6.SystemVMessageQueues
129
Part3.Synchronization
157
Chapter7.MutexesandConditionvariables
159
Chapter8.Read-WriteLocks
17
Chapter9.RecordLocking
193
Chapter10.PosixSemaphores
219
Chapter11.SystemVSemaphores
281
Part4.SharedMemory
301
Chapter12.SharedMemoryIntroduction
303
Chapter13.PosixSharedMemory
325
Chapter14
SystemVSharedMemory
343
Part5.RemoteProcedurecalls
353
Chapter15.Doors
355
Chapter16.SunRPC
399
AppendixAPerformanceMeasurements
457
AppendixB.AThreadsPrimer
501
AppendixC.MiscellaneousSourceCode
505
AppendixD.SolutionstoSelectedExercises
515
Tableofcontents
reface
XIII
Part1.Introduction
Chapter1.Introduction
Introduction
Processes,Threads,andtheSharingofInformation
1.3PersistenceofIPCObjects
Names
1.5Effectoffork,exec,andexitonIPCObjects
1.6
ErrorHandling:WrapperFunctions
1.7UnixStandard
13
18
RoadmaptoIPCExamplesintheText
19
umman
16
Chapter2.PosixIPC
2.1
ntroduction
2.2PCNames19
2.3CreatingandOpeningIPCChannels22
24
IPCPermissions
25
Summary
i
viiiUNIXNetworkProgramming
Contents
Chapter3.SystemVIPC
3.1
Introduction
3.2key-tKeysandfLokFunction28
33
ipagermStructure30
CreatingandOpeningIPCChannels30
3.5
PCPermissions32
36
identifierReuse
34
ipcsandipmPrograms
38
KernelLimits36
3.9
amman
38
Part2.MessagePassing
41
Chapter4.PipesandFIFos
43
4.1
introduction
43
4.2
ASimpleClient-ServerEXample43
43
Pipes
44
Full-DuplexPipes50
45
popenandpcloseFu
46
FIFOS54
4.7
AdditionalPropertiesofPipesandFIFOs58
4.8
OneServer,MultipleClients
49terativeversusconcurentservers66
4.10StreamsandMessages67
4.11PipeandFIFOLimits72
4.12
Summary
73
Chapter5.PosixMessageQueues
75
5.1
5.2mC_open,mg_close,andmg_unlinkFunctions76
5.3
InagetattrandmgsetattrFunctions79
54
mg_sendandmq_receiveFunctions82
55
MessageQueueLimits86
56
tifyfunctio
57
PosixRealtimeSignals
5.8implementationUsingMemory-Mappedto106
5.9
Summar
Chapter6.SystemVMessageQueues
129
6.1Introduction129
6.2msggetFunction
63
msgsndFunction
131
6.4msgrcvFunction132
6.5nsgctFu
134
66
SimplePrograms135
67
Client-ServerExample
140
6.8
MultiplexingMessage
142
用户评论
被骗了,是第二版