Source file src/runtime/mem_plan9.go

     1  // Copyright 2010 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package runtime
     6  
     7  import "unsafe"
     8  
     9  func sbrk(n uintptr) unsafe.Pointer {
    10  	// Plan 9 sbrk from /sys/src/libc/9sys/sbrk.c
    11  	bl := bloc
    12  	n = memRound(n)
    13  	if bl+n > blocMax {
    14  		if brk_(unsafe.Pointer(bl+n)) < 0 {
    15  			return nil
    16  		}
    17  		blocMax = bl + n
    18  	}
    19  	bloc += n
    20  	return unsafe.Pointer(bl)
    21  }
    22  

View as plain text