aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libgo/go/syscall/errno.c
blob: 5cdc7730445e9ab933dc4b32c4e45cbdfe2f0ede (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* errno.c -- functions for getting and setting errno

   Copyright 2010 The Go Authors. All rights reserved.
   Use of this source code is governed by a BSD-style
   license that can be found in the LICENSE file.  */
#include <errno.h>
#include <stdint.h>

#include "runtime.h"

/* errno is typically a macro. These functions set 
   and get errno specific to the libc being used.  */

uintptr_t GetErrno() __asm__ (GOSYM_PREFIX "syscall.GetErrno");
void SetErrno(uintptr_t) __asm__ (GOSYM_PREFIX "syscall.SetErrno");

uintptr_t
GetErrno()
{
  return (uintptr_t) errno;
}

void
SetErrno(uintptr_t value)
{
  errno = (int) value;
}