• Austin Clements's avatar
    runtime: separate error result for mmap · 193088b2
    Austin Clements authored
    Currently mmap returns an unsafe.Pointer that encodes OS errors as
    values less than 4096. In practice this is okay, but it borders on
    being really unsafe: for example, the value has to be checked
    immediately after return and if stack copying were ever to observe
    such a value, it would panic. It's also not remotely idiomatic.
    
    Fix this by making mmap return a separate pointer value and error,
    like a normal Go function.
    
    Updates #22218.
    
    Change-Id: Iefd965095ffc82cc91118872753a5d39d785c3a6
    Reviewed-on: https://go-review.googlesource.com/71270
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    193088b2
sys_openbsd_386.s 8.4 KB