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 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.
71 to create a physically continuous segment with a fixed
72 physical base address suitable for hardware DMA access.
76 the address and length arguments are ignored in the call;
77 they are defined only by the
80 Once the address and length are set, they cannot be reset.
82 Reading the control file
83 returns a message of the same format with the segment's actual
84 start address and length. For
86 segments, the type and physical base address are appended.
92 before setting the virtual address yields the error
93 ``segment not yet allocated''.
95 The permissions check when
97 is equivalent to the one performed when opening
102 Create a one megabyte segment at address 0x10000000:
104 % bind '#g' /mnt/segment
105 % mkdir /mnt/segment/example
106 % echo 'va 0x10000000 0x100000' > /mnt/segment/example/ctl
109 Put the string ``hi mom'' at the start of the segment:
111 % echo -n hi mom > /mnt/segment/example/data
114 Attach the segment to a process:
119 va = segattach(0, "example", 0, 0);
125 .B /sys/src/9/port/devsegment.c