source: trunk/kernel/syscalls/sys_sbrk.c @ 366

Last change on this file since 366 was 1, checked in by alain, 8 years ago

First import

File size: 1.1 KB
RevLine 
[1]1/*
2 * sys_sbrk: increase the limit of process's heap
3 *
4 * Copyright (c) 2012 UPMC Sorbonne Universites
5 *
6 * This file is part of ALMOS-kernel.
7 *
8 * ALMOS-kernel is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2.0 of the License.
11 *
12 * ALMOS-kernel is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with ALMOS-kernel; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <errno.h>
23#include <thread.h>
24#include <task.h>
25#include <vmm.h>
26
27int sys_sbrk(uint_t current_heap_ptr, uint_t size)
28{
29        struct task_s *task;
30
31        if(size == 0)
32                return CONFIG_TASK_HEAP_MIN_SIZE;
33
34        size = size * PMM_PAGE_SIZE;
35        task = current_task;
36
37        return vmm_sbrk(&task->vmm, current_heap_ptr, size);
38}
Note: See TracBrowser for help on using the repository browser.