segment man page on Plan9

Man page or keyword search:  
man Server   549 pages
apropos Keyword Search (all sections)
Output format
Plan9 logo
[printable version]

SEGMENT(3)							    SEGMENT(3)

NAME
       segment - long lived memory segments

SYNOPSIS
       bind '#g' /mnt/segment

       #g/seg1
       #g/seg1/ctl
       #g/seg1/data
       #g/seg2
       #g/seg2/ctl
       #g/seg2/data
	...

DESCRIPTION
       The  segment  device  provides a 2-level file system representing long-
       lived sharable segments that processes may segattach(2).	 The  name  of
       the directory is the class argument to segattach.

       New  segments  are  created  under  the	top  level  using  create (see
       open(2)).  The DMDIR bit must be set in the permissions.	 Remove(2)'ing
       the  directory  makes  the  segment  no longer available for segattach.
       However, the segment will continue to exist until all  processes	 using
       it either exit or segdetach it.

       Within each segment directory are two files, data and ctl.  Reading and
       writing data affects the contents of the segment.  Reading and  writing
       ctl retrieves and sets the segment's properties.

       There  is  only	one  control message, which sets the segment's virtual
       address and length in bytes:
	    va address length
       Address is automatically rounded down to a page boundary and length  is
       rounded	up  to	end  the segment at a page boundary.  The segment will
       reside at the same virtual address in all processes sharing  it.	  When
       the  segment  is attached using segattach, the address and length argu‐
       ments are ignored in the call; they are defined only by the va  control
       message.	 Once the address and length are set, they cannot be reset.

       Reading	the control file returns a message of the same format with the
       segment's actual start address and length.

       Opening data or reading ctl before setting the virtual  address	yields
       the error ``segment not yet allocated''.

       The  permissions	 check when segattaching is equivalent to the one per‐
       formed when opening data with mode ORDWR.

EXAMPLE
       Create a one megabyte segment at address 0x10000000:
	    % bind '#g' /mnt/segment
	    % mkdir /mnt/segment/example
	    % echo 'va 0x10000000 0x100000' > /mnt/segment/example/ctl

       Put the string ``hi mom'' at the start of the segment:
	    % echo -n hi mom > /mnt/segment/example/data

       Attach the segment to a process:
       {
	    ulong va;

	    va = segattach(0, "example", 0, 0);
       }

SEE ALSO
       segattach(2)

SOURCE
       /sys/src/9/port/devsegment.c

								    SEGMENT(3)
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server Plan9

List of man pages available for Plan9

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net