aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/go-varargs.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-11-24 02:38:28 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-11-24 02:38:28 +0000
commit6b05faddf0bd5e2639b6090b99d2b0186f5e6e31 (patch)
treeb799566fc3e96ceed28ddd0fcb8b09f6d0f4c4de /libgo/runtime/go-varargs.c
parent473f48333b6f0a6fd348bab83a647a5ef4635246 (diff)
downloadgcc-6b05faddf0bd5e2639b6090b99d2b0186f5e6e31.zip
gcc-6b05faddf0bd5e2639b6090b99d2b0186f5e6e31.tar.gz
gcc-6b05faddf0bd5e2639b6090b99d2b0186f5e6e31.tar.bz2
syscall: Only call varargs libc functions from C code.
From-SVN: r205321
Diffstat (limited to 'libgo/runtime/go-varargs.c')
-rw-r--r--libgo/runtime/go-varargs.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/libgo/runtime/go-varargs.c b/libgo/runtime/go-varargs.c
new file mode 100644
index 0000000..682c08d
--- /dev/null
+++ b/libgo/runtime/go-varargs.c
@@ -0,0 +1,47 @@
+/* go-varargs.c -- functions for calling C varargs functions.
+
+ Copyright 2013 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 "config.h"
+
+#include <sys/types.h>
+#include <fcntl.h>
+
+/* The syscall package calls C functions. The Go compiler can not
+ represent a C varargs functions. On some systems it's important
+ that the declaration of a function match the call. This function
+ holds non-varargs C functions that the Go code can call. */
+
+int
+__go_open (char *path, int mode, mode_t perm)
+{
+ return open (path, mode, perm);
+}
+
+int
+__go_fcntl (int fd, int cmd, int arg)
+{
+ return fcntl (fd, cmd, arg);
+}
+
+#ifdef HAVE_OPEN64
+
+int
+__go_open64 (char *path, int mode, mode_t perm)
+{
+ return open64 (path, mode, perm);
+}
+
+#endif
+
+#ifdef HAVE_OPENAT
+
+int
+__go_openat (int fd, char *path, int flags, mode_t mode)
+{
+ return openat (fd, path, flags, mode);
+}
+
+#endif