Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame^] | 1 | /* go-nosys.c -- functions missing from system. |
| 2 | |
| 3 | Copyright 2012 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. */ |
| 6 | |
| 7 | /* This file exists to provide definitions for functions that are |
| 8 | missing from libc, according to the configure script. This permits |
| 9 | the Go syscall package to not worry about whether the functions |
| 10 | exist or not. */ |
| 11 | |
| 12 | #include "config.h" |
| 13 | |
| 14 | #include <errno.h> |
| 15 | #include <fcntl.h> |
| 16 | #include <stdint.h> |
| 17 | #include <sys/types.h> |
| 18 | #include <sys/stat.h> |
| 19 | #include <sys/time.h> |
| 20 | #include <unistd.h> |
| 21 | |
| 22 | #ifndef HAVE_OFF64_T |
| 23 | typedef signed int off64_t __attribute__ ((mode (DI))); |
| 24 | #endif |
| 25 | |
| 26 | #ifndef HAVE_LOFF_T |
| 27 | typedef off64_t loff_t; |
| 28 | #endif |
| 29 | |
| 30 | #ifndef HAVE_EPOLL_CREATE1 |
| 31 | int |
| 32 | epoll_create1 (int flags __attribute__ ((unused))) |
| 33 | { |
| 34 | return ENOSYS; |
| 35 | } |
| 36 | #endif |
| 37 | |
| 38 | #ifndef HAVE_FACCESSAT |
| 39 | int |
| 40 | faccessat (int fd __attribute__ ((unused)), |
| 41 | const char *pathname __attribute__ ((unused)), |
| 42 | int mode __attribute__ ((unused)), |
| 43 | int flags __attribute__ ((unused))) |
| 44 | { |
| 45 | return ENOSYS; |
| 46 | } |
| 47 | #endif |
| 48 | |
| 49 | #ifndef HAVE_FCHMODAT |
| 50 | int |
| 51 | fchmodat (int dirfd __attribute__ ((unused)), |
| 52 | const char *pathname __attribute__ ((unused)), |
| 53 | mode_t mode __attribute__ ((unused)), |
| 54 | int flags __attribute__ ((unused))) |
| 55 | { |
| 56 | return ENOSYS; |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | #ifndef HAVE_FCHOWNAT |
| 61 | int |
| 62 | fchownat (int dirfd __attribute__ ((unused)), |
| 63 | const char *pathname __attribute__ ((unused)), |
| 64 | uid_t owner __attribute__ ((unused)), |
| 65 | gid_t group __attribute__ ((unused)), |
| 66 | int flags __attribute__ ((unused))) |
| 67 | { |
| 68 | return ENOSYS; |
| 69 | } |
| 70 | #endif |
| 71 | |
| 72 | #ifndef HAVE_FUTIMESAT |
| 73 | int |
| 74 | futimesat (int dirfd __attribute__ ((unused)), |
| 75 | const char *pathname __attribute__ ((unused)), |
| 76 | const struct timeval times[2] __attribute__ ((unused))) |
| 77 | { |
| 78 | return ENOSYS; |
| 79 | } |
| 80 | #endif |
| 81 | |
| 82 | #ifndef HAVE_INOTIFY_ADD_WATCH |
| 83 | int |
| 84 | inotify_add_watch (int fd __attribute__ ((unused)), |
| 85 | const char* pathname __attribute__ ((unused)), |
| 86 | uint32_t mask __attribute__ ((unused))) |
| 87 | { |
| 88 | return ENOSYS; |
| 89 | } |
| 90 | #endif |
| 91 | |
| 92 | #ifndef HAVE_INOTIFY_INIT |
| 93 | int |
| 94 | inotify_init (void) |
| 95 | { |
| 96 | return ENOSYS; |
| 97 | } |
| 98 | #endif |
| 99 | |
| 100 | #ifndef HAVE_INOTIFY_RM_WATCH |
| 101 | int |
| 102 | inotify_rm_watch (int fd __attribute__ ((unused)), |
| 103 | uint32_t wd __attribute__ ((unused))) |
| 104 | { |
| 105 | return ENOSYS; |
| 106 | } |
| 107 | #endif |
| 108 | |
| 109 | #ifndef HAVE_MKDIRAT |
| 110 | int |
| 111 | mkdirat (int dirfd __attribute__ ((unused)), |
| 112 | const char *pathname __attribute__ ((unused)), |
| 113 | mode_t mode __attribute__ ((unused))) |
| 114 | { |
| 115 | return ENOSYS; |
| 116 | } |
| 117 | #endif |
| 118 | |
| 119 | #ifndef HAVE_MKNODAT |
| 120 | int |
| 121 | mknodat (int dirfd __attribute__ ((unused)), |
| 122 | const char *pathname __attribute__ ((unused)), |
| 123 | mode_t mode __attribute__ ((unused)), |
| 124 | dev_t dev __attribute__ ((unused))) |
| 125 | { |
| 126 | return ENOSYS; |
| 127 | } |
| 128 | #endif |
| 129 | |
| 130 | #ifndef HAVE_OPENAT |
| 131 | int |
| 132 | openat (int dirfd __attribute__ ((unused)), |
| 133 | const char *pathname __attribute__ ((unused)), |
| 134 | int oflag __attribute__ ((unused)), |
| 135 | ...) |
| 136 | { |
| 137 | return ENOSYS; |
| 138 | } |
| 139 | #endif |
| 140 | |
| 141 | #ifndef HAVE_RENAMEAT |
| 142 | int |
| 143 | renameat (int olddirfd __attribute__ ((unused)), |
| 144 | const char *oldpath __attribute__ ((unused)), |
| 145 | int newdirfd __attribute__ ((unused)), |
| 146 | const char *newpath __attribute__ ((unused))) |
| 147 | { |
| 148 | return ENOSYS; |
| 149 | } |
| 150 | #endif |
| 151 | |
| 152 | #ifndef HAVE_SPLICE |
| 153 | int |
| 154 | splice (int fd __attribute__ ((unused)), |
| 155 | loff_t *off_in __attribute__ ((unused)), |
| 156 | int fd_out __attribute__ ((unused)), |
| 157 | loff_t *off_out __attribute__ ((unused)), |
| 158 | size_t len __attribute__ ((unused)), |
| 159 | unsigned int flags __attribute__ ((unused))) |
| 160 | { |
| 161 | return ENOSYS; |
| 162 | } |
| 163 | #endif |
| 164 | |
| 165 | #ifndef HAVE_TEE |
| 166 | int |
| 167 | tee (int fd_in __attribute__ ((unused)), |
| 168 | int fd_out __attribute__ ((unused)), |
| 169 | size_t len __attribute__ ((unused)), |
| 170 | unsigned int flags __attribute__ ((unused))) |
| 171 | { |
| 172 | return ENOSYS; |
| 173 | } |
| 174 | #endif |
| 175 | |
| 176 | #ifndef HAVE_UNLINKAT |
| 177 | int |
| 178 | unlinkat (int dirfd __attribute__ ((unused)), |
| 179 | const char *pathname __attribute__ ((unused)), |
| 180 | int flags __attribute__ ((unused))) |
| 181 | { |
| 182 | return ENOSYS; |
| 183 | } |
| 184 | #endif |
| 185 | |
| 186 | #ifndef HAVE_UNSHARE |
| 187 | int |
| 188 | unshare (int flags __attribute__ ((unused))) |
| 189 | { |
| 190 | return ENOSYS; |
| 191 | } |
| 192 | #endif |