aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/go-varargs.c
diff options
context:
space:
mode:
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