| 1 |
/* errno.c -- functions for getting and setting errno |
| 2 |
|
| 3 |
Copyright 2010 The Go Authors. All rights reserved. |
| 4 |
Use of this source code is governed by a BSD-style |
| 5 |
license that can be found in the LICENSE file. */ |
| 6 |
#include <errno.h> |
| 7 |
#include <stdint.h> |
| 8 |
|
| 9 |
#include "runtime.h" |
| 10 |
|
| 11 |
/* errno is typically a macro. These functions set |
| 12 |
and get errno specific to the libc being used. */ |
| 13 |
|
| 14 |
uintptr_t GetErrno(void) __asm__ (GOSYM_PREFIX "syscall.GetErrno"); |
| 15 |
void SetErrno(uintptr_t) __asm__ (GOSYM_PREFIX "syscall.SetErrno"); |
| 16 |
|
| 17 |
uintptr_t |
| 18 |
GetErrno(void) |
| 19 |
{ |
| 20 |
return (uintptr_t) errno; |
| 21 |
} |
| 22 |
|
| 23 |
void |
| 24 |
SetErrno(uintptr_t value) |
| 25 |
{ |
| 26 |
errno = (int) value; |
| 27 |
} |