3 segment \- long lived memory segments
6 .B bind -c '#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 type\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.
73 Fixed segments are uncached and physically continuous
74 with a fixed physical base address suitable for hardware
76 Sticky segments are like normal shared segments but
77 preallocated at creation time and never swapped out.
78 Only the hostower is allowed to create
84 When the segment is attached using
86 the address and length arguments are ignored in the call;
87 they are defined only by the
90 Once the address and length are set, they cannot be reset.
92 Reading the control file
93 returns a message of the same format with the segment's actual
94 start address and length. For
96 segments, the type and physical base address are appended.
102 before setting the virtual address yields the error
103 ``segment not yet allocated''.
105 The permissions check when
107 is equivalent to the one performed when opening
112 Create a one megabyte segment at address 0x10000000:
114 % bind -c '#g' /mnt/segment
115 % mkdir /mnt/segment/example
116 % echo 'va 0x10000000 0x100000' > /mnt/segment/example/ctl
119 Put the string ``hi mom'' at the start of the segment:
121 % echo -n hi mom > /mnt/segment/example/data
124 Attach the segment to a process:
129 va = segattach(0, "example", 0, 0);
135 .B /sys/src/9/port/devsegment.c