summaryrefslogtreecommitdiff
path: root/libgo/syscalls/errno.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/syscalls/errno.c')
-rw-r--r--libgo/syscalls/errno.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libgo/syscalls/errno.c b/libgo/syscalls/errno.c
new file mode 100644
index 000000000..34771a0d8
--- /dev/null
+++ b/libgo/syscalls/errno.c
@@ -0,0 +1,25 @@
+/* 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>
+
+/* errno is typically a macro. These functions set
+ and get errno specific to the libc being used. */
+
+int GetErrno() asm ("libgo_syscalls.syscall.GetErrno");
+void SetErrno(int) asm ("libgo_syscalls.syscall.SetErrno");
+
+int
+GetErrno()
+{
+ return errno;
+}
+
+void
+SetErrno(int value)
+{
+ errno = value;
+}