74 lines · 1.4 KB · Text
RawDownload
.TH SRV 3 .SH NAMEsrv \- server registry.SH SYNOPSIS.nf.B bind #s /srv .BI #s/ service1.BI #s/ service2 ....fi.SH DESCRIPTIONThe.I srvdevice provides a one-level directory holdingalready-open channels to services.In effect,.I srvis a bulletin board on which processes may post open file descriptorsto make them available to other processes..PPTo install a channel, createa new file such as.B /srv/myservand then write a text string (suitable for.IR strtoul ;see.IR atof (2))giving the file descriptor number of an open file.Any process may then open.B /srv/myservto acquire another reference to the open file that was registered..PPAn entry in.I srvholds a reference to the associated file even if no process has thefile open.  Removing the file from.B /srvreleases that reference..PPIt is an error to write more than one number into a server file,or to create a file with a name that is already being used..SH EXAMPLETo drop one end of a pipe into.BR /srv ,that is, to create a named pipe:.IP.EXint fd, p[2];char buf[32]; pipe(p);fd = create("/srv/namedpipe", OWRITE, 0666);fprint(fd, "%d", p[0]);close(fd);close(p[0]);fprint(p[1], "hello");.EE.PPAt this point, any process may open and read.B /srv/namedpipeto receive the.B hellostring.  Data written to.B /srv/namedpipecan be received by executing.IP.EXread(p[1], buf, sizeof buf);.EE.PPin the above process..SH SOURCE.B /sys/src/9/port/devsrv.c

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t