summaryrefslogtreecommitdiffstats
path: root/libgo/runtime
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-24 02:38:28 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-24 02:38:28 +0000
commit9eb89a08a43dd46bf84c80d3e34e59acb85c24ae (patch)
treeb799566fc3e96ceed28ddd0fcb8b09f6d0f4c4de /libgo/runtime
parent7d491656e4cdb7a77ab660c4cb31bb00f385e756 (diff)
downloadppe42-gcc-9eb89a08a43dd46bf84c80d3e34e59acb85c24ae.tar.gz
ppe42-gcc-9eb89a08a43dd46bf84c80d3e34e59acb85c24ae.zip
syscall: Only call varargs libc functions from C code.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205321 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime')
-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 00000000000..682c08d64d4
--- /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
OpenPOWER on IntegriCloud