Beispiel #1
0
int sys_sbrk(void) {
	int addr;
	int n;

	if (argint(0, &n) < 0)
		return -1;
	addr = proc->sz;
	if (growproc(n) < 0)
		return -1;
	return addr;
}
Beispiel #2
0
int
sys_sbrk(void)
{
  int addr;
  int n;

  if(argint(0, &n) < 0)
    return -1;
  if((addr = growproc(n)) < 0)
    return -1;
  return addr;
}
Beispiel #3
0
int
sys_sbrk(void)
{
  int addr;
  int n;

  if(argint(0, &n) < 0)
    return -1;
  addr = proc->sz;
	///cprintf("proc->sz = %d\n",proc->sz);
  if(growproc(n) < 0)
    return -1;
  return addr;
}
int
sys_sbrk(void)
{
  int addr;
  int n;

  if(argint(0, &n) < 0)
    return -1;

  if (proc->isThread == 1) {
	  addr = proc->parent->sz;
  } else {
	addr = proc->sz;
  }
  if(growproc(n) < 0)
    return -1;
  return addr;
}
Beispiel #5
0
int
sys_sbrk(void)
{
  int addr;
  int n;

  if(argint(0, &n) < 0)
    return -1;
  addr = proc->sz;
  int i;
  for (i = 3; i >= 0; i--) {
      if (proc->shmem[i] != NULL) {
        if (addr >= proc->shmem[i])
            return -1;
      }
  }
  if(growproc(n) < 0)
    return -1;
  return addr;
}
Beispiel #6
0
int
sys_sbrk(void)
{
  int addr;
  int n;

  if(argint(0, &n) < 0)
    return -1;
  addr = proc->sz;
  if (n > 0){
	if (addr + n >= KERNBASE){
	  return -1;
	}
	proc->sz += n;
  } else {
    if(growproc(n) < 0){
	  return -1;
    }
  }
  return addr;
}