06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

n_getseg pSOS+ <strong>System</strong> <strong>Calls</strong><br />

rn_getseg Allocates a memory segment to the calling task.<br />

#include <br />

unsigned long rn_getseg(<br />

unsigned long rnid, /* region identifier */<br />

unsigned long size, /* requested size, in bytes */<br />

unsigned long flags, /* segment attributes */<br />

unsigned long timeout, /* timeout in clock ticks */<br />

void **seg_addr /* allocated segment address */<br />

)<br />

Description<br />

Arguments<br />

This system call allocates a memory segment of the specified size from the specified<br />

memory region. An allocated segment's size is always the nearest multiple of the<br />

region's unit size, which is an input argument to the rn_create() call.<br />

If the calling task selects the RN_NOWAIT attribute, then rn_getseg() returns<br />

unconditionally (whether or not allocation was successful). If the calling task elects<br />

the RN_WAIT attribute, and a subsequent request cannot be satisfied, the task is<br />

blocked until either a segment is allocated, or a timeout occurs (if the timeout<br />

attribute is elected).<br />

rnid Specifies the region ID from which the memory segment is allocated.<br />

size Specifies the segment size, in bytes.<br />

flags Specifies the segment’s attributes. The flags argument must<br />

assume one of the following values, defined in .<br />

RN_NOWAIT Don't wait for a segment.<br />

RN_WAIT Wait for a segment.<br />

timeout Specifies the timeout, in units of clock ticks. If timeout is 0 and<br />

flags is set to RN_WAIT, then rn_getseg() will wait forever. The<br />

timeout argument is ignored if RN_NOWAIT is used.<br />

seg_addr Points to the variable where rn_getseg() stores the starting<br />

address of the memory segment.<br />

1-112 <strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!