1 /* go-varargs.c -- functions for calling C varargs functions.
3 Copyright 2013 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. */
12 #include <sys/types.h>
14 #include <sys/ioctl.h>
16 /* The syscall package calls C functions. The Go compiler can not
17 represent a C varargs functions. On some systems it's important
18 that the declaration of a function match the call. This function
19 holds non-varargs C functions that the Go code can call. */
22 __go_open (char *path
, int mode
, mode_t perm
)
24 return open (path
, mode
, perm
);
28 __go_fcntl (int fd
, int cmd
, int arg
)
30 return fcntl (fd
, cmd
, arg
);
34 __go_fcntl_flock (int fd
, int cmd
, struct flock
*arg
)
36 return fcntl (fd
, cmd
, arg
);
39 // This is for the net package. We use uintptr_t to make sure that
40 // the types match, since the Go and C "int" types are not the same.
47 __go_fcntl_uintptr (uintptr_t fd
, uintptr_t cmd
, uintptr_t arg
)
50 struct go_fcntl_ret ret
;
52 r
= fcntl ((int) fd
, (int) cmd
, (int) arg
);
53 ret
.r
= (uintptr_t) r
;
55 ret
.err
= (uintptr_t) errno
;
62 __go_ioctl (int d
, int request
, int arg
)
64 return ioctl (d
, request
, arg
);
68 __go_ioctl_ptr (int d
, int request
, void *arg
)
70 return ioctl (d
, request
, arg
);
76 __go_open64 (char *path
, int mode
, mode_t perm
)
78 return open64 (path
, mode
, perm
);
86 __go_openat (int fd
, char *path
, int flags
, mode_t mode
)
88 return openat (fd
, path
, flags
, mode
);