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
|
|
|
|
|
|
|
/* errno is typically a macro. These functions set
|
|
|
|
and get errno specific to the libc being used. */
|
|
|
|
|
2011-12-13 00:40:51 +01:00
|
|
|
uintptr_t GetErrno() asm ("libgo_syscall.syscall.GetErrno");
|
|
|
|
void SetErrno(uintptr_t) asm ("libgo_syscall.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
|
|
|
}
|