2010-12-03 05:34:57 +01:00
|
|
|
/* 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>
|
2011-12-13 00:40:51 +01:00
|
|
|
#include <stdint.h>
|
2010-12-03 05:34:57 +01:00
|
|
|
|
2013-01-24 20:44:23 +01:00
|
|
|
#include "runtime.h"
|
|
|
|
|
2010-12-03 05:34:57 +01:00
|
|
|
/* errno is typically a macro. These functions set
|
|
|
|
and get errno specific to the libc being used. */
|
|
|
|
|
2013-01-24 20:44:23 +01:00
|
|
|
uintptr_t GetErrno() __asm__ (GOSYM_PREFIX "syscall.GetErrno");
|
|
|
|
void SetErrno(uintptr_t) __asm__ (GOSYM_PREFIX "syscall.SetErrno");
|
2010-12-03 05:34:57 +01:00
|
|
|
|
2011-12-13 00:40:51 +01:00
|
|
|
uintptr_t
|
2010-12-03 05:34:57 +01:00
|
|
|
GetErrno()
|
|
|
|
{
|
2011-12-13 00:40:51 +01:00
|
|
|
return (uintptr_t) errno;
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-12-13 00:40:51 +01:00
|
|
|
SetErrno(uintptr_t value)
|
2010-12-03 05:34:57 +01:00
|
|
|
{
|
2011-12-13 00:40:51 +01:00
|
|
|
errno = (int) value;
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|