3 segment \- long lived memory segments
6 .B bind '#g' /mnt/segment
20 device provides a 2-level file system representing
21 long-lived sharable segments that processes may
23 The name of the directory is the
28 New segments are created under the top level
35 bit must be set in the permissions.
37 the directory makes the segment no longer
40 However, the segment will continue to exist until all
41 processes using it either exit or
45 Within each segment directory are two files,
51 affects the contents of the segment.
54 retrieves and sets the segment's properties.
56 There is only one control message, which sets the segment's
57 virtual address and length in bytes:
59 va \fIaddress length\fP
62 is automatically rounded down to a page boundary and
64 is rounded up to end the segment at a page boundary.
65 The segment will reside at the same virtual address in
66 all processes sharing it.
70 the address and length arguments are ignored in the call;
71 they are defined only by the
74 Once the address and length are set, they cannot be reset.
76 Reading the control file
77 returns a message of the same format with the segment's actual
78 start address and length.
84 before setting the virtual address yields the error
85 ``segment not yet allocated''.
87 The permissions check when
89 is equivalent to the one performed when opening
94 Create a one megabyte segment at address 0x10000000:
96 % bind '#g' /mnt/segment
97 % mkdir /mnt/segment/example
98 % echo 'va 0x10000000 0x100000' > /mnt/segment/example/ctl
101 Put the string ``hi mom'' at the start of the segment:
103 % echo -n hi mom > /mnt/segment/example/data
106 Attach the segment to a process:
111 va = segattach(0, "example", 0, 0);
117 .B /sys/src/9/port/devsegment.c