Debian Codegraph @

libgo/go/runtime/internal/syscall/errno.c

raw
1 /* errno.c -- functions for getting and setting errno
2
3 Copyright 2022 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 and get errno
12 specific to the libc being used. */
13
14 uintptr_t getErrno(void) __asm__ (GOSYM_PREFIX "runtime_1internal_1syscall.getErrno");
15 void setErrno(uintptr_t) __asm__ (GOSYM_PREFIX "runtime_1internal_1syscall.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 }