go-varargs.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* go-varargs.c -- functions for calling C varargs functions.
  2. Copyright 2013 The Go Authors. All rights reserved.
  3. Use of this source code is governed by a BSD-style
  4. license that can be found in the LICENSE file. */
  5. #include "config.h"
  6. #include <sys/types.h>
  7. #include <fcntl.h>
  8. /* The syscall package calls C functions. The Go compiler can not
  9. represent a C varargs functions. On some systems it's important
  10. that the declaration of a function match the call. This function
  11. holds non-varargs C functions that the Go code can call. */
  12. int
  13. __go_open (char *path, int mode, mode_t perm)
  14. {
  15. return open (path, mode, perm);
  16. }
  17. int
  18. __go_fcntl (int fd, int cmd, int arg)
  19. {
  20. return fcntl (fd, cmd, arg);
  21. }
  22. int
  23. __go_fcntl_flock (int fd, int cmd, struct flock *arg)
  24. {
  25. return fcntl (fd, cmd, arg);
  26. }
  27. #ifdef HAVE_OPEN64
  28. int
  29. __go_open64 (char *path, int mode, mode_t perm)
  30. {
  31. return open64 (path, mode, perm);
  32. }
  33. #endif
  34. #ifdef HAVE_OPENAT
  35. int
  36. __go_openat (int fd, char *path, int flags, mode_t mode)
  37. {
  38. return openat (fd, path, flags, mode);
  39. }
  40. #endif