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 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 34 | errno = ENOSYS; |
| 35 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 36 | } |
| 37 | #endif |
| 38 | |
| 39 | #ifndef HAVE_FACCESSAT |
| 40 | int |
| 41 | faccessat (int fd __attribute__ ((unused)), |
| 42 | const char *pathname __attribute__ ((unused)), |
| 43 | int mode __attribute__ ((unused)), |
| 44 | int flags __attribute__ ((unused))) |
| 45 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 46 | errno = ENOSYS; |
| 47 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 48 | } |
| 49 | #endif |
| 50 | |
Ian Lance Taylor | 5d46bf0 | 2012-02-18 01:22:02 +0000 | [diff] [blame] | 51 | #ifndef HAVE_FALLOCATE |
| 52 | int |
| 53 | fallocate (int fd __attribute__ ((unused)), |
| 54 | int mode __attribute__ ((unused)), |
Ian Lance Taylor | 2ef7cdf | 2012-02-25 02:11:29 +0000 | [diff] [blame^] | 55 | off_t offset __attribute__ ((unused)), |
Ian Lance Taylor | 5d46bf0 | 2012-02-18 01:22:02 +0000 | [diff] [blame] | 56 | off_t len __attribute__ ((unused))) |
| 57 | { |
| 58 | errno = ENOSYS; |
| 59 | return -1; |
| 60 | } |
| 61 | #endif |
| 62 | |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 63 | #ifndef HAVE_FCHMODAT |
| 64 | int |
| 65 | fchmodat (int dirfd __attribute__ ((unused)), |
| 66 | const char *pathname __attribute__ ((unused)), |
| 67 | mode_t mode __attribute__ ((unused)), |
| 68 | int flags __attribute__ ((unused))) |
| 69 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 70 | errno = ENOSYS; |
| 71 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 72 | } |
| 73 | #endif |
| 74 | |
| 75 | #ifndef HAVE_FCHOWNAT |
| 76 | int |
| 77 | fchownat (int dirfd __attribute__ ((unused)), |
| 78 | const char *pathname __attribute__ ((unused)), |
| 79 | uid_t owner __attribute__ ((unused)), |
| 80 | gid_t group __attribute__ ((unused)), |
| 81 | int flags __attribute__ ((unused))) |
| 82 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 83 | errno = ENOSYS; |
| 84 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 85 | } |
| 86 | #endif |
| 87 | |
| 88 | #ifndef HAVE_FUTIMESAT |
| 89 | int |
| 90 | futimesat (int dirfd __attribute__ ((unused)), |
| 91 | const char *pathname __attribute__ ((unused)), |
| 92 | const struct timeval times[2] __attribute__ ((unused))) |
| 93 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 94 | errno = ENOSYS; |
| 95 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 96 | } |
| 97 | #endif |
| 98 | |
| 99 | #ifndef HAVE_INOTIFY_ADD_WATCH |
| 100 | int |
| 101 | inotify_add_watch (int fd __attribute__ ((unused)), |
| 102 | const char* pathname __attribute__ ((unused)), |
| 103 | uint32_t mask __attribute__ ((unused))) |
| 104 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 105 | errno = ENOSYS; |
| 106 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 107 | } |
| 108 | #endif |
| 109 | |
| 110 | #ifndef HAVE_INOTIFY_INIT |
| 111 | int |
| 112 | inotify_init (void) |
| 113 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 114 | errno = ENOSYS; |
| 115 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 116 | } |
| 117 | #endif |
| 118 | |
| 119 | #ifndef HAVE_INOTIFY_RM_WATCH |
| 120 | int |
| 121 | inotify_rm_watch (int fd __attribute__ ((unused)), |
| 122 | uint32_t wd __attribute__ ((unused))) |
| 123 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 124 | errno = ENOSYS; |
| 125 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 126 | } |
| 127 | #endif |
| 128 | |
| 129 | #ifndef HAVE_MKDIRAT |
| 130 | int |
| 131 | mkdirat (int dirfd __attribute__ ((unused)), |
| 132 | const char *pathname __attribute__ ((unused)), |
| 133 | mode_t mode __attribute__ ((unused))) |
| 134 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 135 | errno = ENOSYS; |
| 136 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 137 | } |
| 138 | #endif |
| 139 | |
| 140 | #ifndef HAVE_MKNODAT |
| 141 | int |
| 142 | mknodat (int dirfd __attribute__ ((unused)), |
| 143 | const char *pathname __attribute__ ((unused)), |
| 144 | mode_t mode __attribute__ ((unused)), |
| 145 | dev_t dev __attribute__ ((unused))) |
| 146 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 147 | errno = ENOSYS; |
| 148 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 149 | } |
| 150 | #endif |
| 151 | |
| 152 | #ifndef HAVE_OPENAT |
| 153 | int |
| 154 | openat (int dirfd __attribute__ ((unused)), |
| 155 | const char *pathname __attribute__ ((unused)), |
| 156 | int oflag __attribute__ ((unused)), |
| 157 | ...) |
| 158 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 159 | errno = ENOSYS; |
| 160 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 161 | } |
| 162 | #endif |
| 163 | |
| 164 | #ifndef HAVE_RENAMEAT |
| 165 | int |
| 166 | renameat (int olddirfd __attribute__ ((unused)), |
| 167 | const char *oldpath __attribute__ ((unused)), |
| 168 | int newdirfd __attribute__ ((unused)), |
| 169 | const char *newpath __attribute__ ((unused))) |
| 170 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 171 | errno = ENOSYS; |
| 172 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 173 | } |
| 174 | #endif |
| 175 | |
| 176 | #ifndef HAVE_SPLICE |
| 177 | int |
| 178 | splice (int fd __attribute__ ((unused)), |
| 179 | loff_t *off_in __attribute__ ((unused)), |
| 180 | int fd_out __attribute__ ((unused)), |
| 181 | loff_t *off_out __attribute__ ((unused)), |
| 182 | size_t len __attribute__ ((unused)), |
| 183 | unsigned int flags __attribute__ ((unused))) |
| 184 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 185 | errno = ENOSYS; |
| 186 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 187 | } |
| 188 | #endif |
| 189 | |
| 190 | #ifndef HAVE_TEE |
| 191 | int |
| 192 | tee (int fd_in __attribute__ ((unused)), |
| 193 | int fd_out __attribute__ ((unused)), |
| 194 | size_t len __attribute__ ((unused)), |
| 195 | unsigned int flags __attribute__ ((unused))) |
| 196 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 197 | errno = ENOSYS; |
| 198 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 199 | } |
| 200 | #endif |
| 201 | |
| 202 | #ifndef HAVE_UNLINKAT |
| 203 | int |
| 204 | unlinkat (int dirfd __attribute__ ((unused)), |
| 205 | const char *pathname __attribute__ ((unused)), |
| 206 | int flags __attribute__ ((unused))) |
| 207 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 208 | errno = ENOSYS; |
| 209 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 210 | } |
| 211 | #endif |
| 212 | |
| 213 | #ifndef HAVE_UNSHARE |
| 214 | int |
| 215 | unshare (int flags __attribute__ ((unused))) |
| 216 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame] | 217 | errno = ENOSYS; |
| 218 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 219 | } |
| 220 | #endif |