Subversion Repositories HelenOS-historic

Rev

Rev 1250 | Rev 1330 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1250 Rev 1307
Line 49... Line 49...
49
 *
49
 *
50
 * @param address Virtual address pointing into already existing address space area.
50
 * @param address Virtual address pointing into already existing address space area.
51
 * @param size New requested size of the area.
51
 * @param size New requested size of the area.
52
 * @param flags Currently unused.
52
 * @param flags Currently unused.
53
 *
53
 *
54
 * @return address on success, (void *) -1 otherwise.
54
 * @return Zero on success or a code from @ref errno.h on failure.
55
 */
55
 */
56
void *as_area_resize(void *address, size_t size, int flags)
56
int as_area_resize(void *address, size_t size, int flags)
57
{
57
{
58
    return (void *) __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t ) address, (sysarg_t) size, (sysarg_t) flags);
58
    return __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t ) address, (sysarg_t) size, (sysarg_t) flags);
-
 
59
}
-
 
60
 
-
 
61
/** Destroy address space area.
-
 
62
 *
-
 
63
 * @param address Virtual address pointing into the address space area being destroyed.
-
 
64
 *
-
 
65
 * @return Zero on success or a code from @ref errno.h on failure.
-
 
66
 */
-
 
67
int as_area_destroy(void *address)
-
 
68
{
-
 
69
    return __SYSCALL1(SYS_AS_AREA_DESTROY, (sysarg_t ) address);
59
}
70
}
60
 
71
 
61
/** Prepare to accept address space area.
72
/** Prepare to accept address space area.
62
 *
73
 *
63
 * @param id Task ID of the donor task.
74
 * @param id Task ID of the donor task.
Line 108... Line 119...
108
               if it should be shrinked
119
               if it should be shrinked
109
 * @return Pointer to newly allocated area
120
 * @return Pointer to newly allocated area
110
 */
121
 */
111
void *sbrk(ssize_t incr)
122
void *sbrk(ssize_t incr)
112
{
123
{
-
 
124
    int rc;
113
    void *res;
125
    void *res;
114
    /* Check for invalid values */
126
    /* Check for invalid values */
115
    if (incr < 0 && -incr > heapsize)
127
    if (incr < 0 && -incr > heapsize)
116
        return NULL;
128
        return NULL;
117
    /* Check for too large value */
129
    /* Check for too large value */
Line 119... Line 131...
119
        return NULL;
131
        return NULL;
120
    /* Check for too small values */
132
    /* Check for too small values */
121
    if (incr < 0 && incr+heapsize > heapsize)
133
    if (incr < 0 && incr+heapsize > heapsize)
122
        return NULL;
134
        return NULL;
123
 
135
 
124
    res = as_area_resize(&_heap, heapsize + incr,0);
136
    rc = as_area_resize(&_heap, heapsize + incr,0);
125
    if (!res)
137
    if (rc != 0)
126
        return NULL;
138
        return NULL;
127
   
139
   
128
    /* Compute start of new area */
140
    /* Compute start of new area */
129
    res = (void *)&_heap + heapsize;
141
    res = (void *)&_heap + heapsize;
130
 
142