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 | |
| 51 | #ifndef HAVE_FCHMODAT |
| 52 | int |
| 53 | fchmodat (int dirfd __attribute__ ((unused)), |
| 54 | const char *pathname __attribute__ ((unused)), |
| 55 | mode_t mode __attribute__ ((unused)), |
| 56 | int flags __attribute__ ((unused))) |
| 57 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame^] | 58 | errno = ENOSYS; |
| 59 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 60 | } |
| 61 | #endif |
| 62 | |
| 63 | #ifndef HAVE_FCHOWNAT |
| 64 | int |
| 65 | fchownat (int dirfd __attribute__ ((unused)), |
| 66 | const char *pathname __attribute__ ((unused)), |
| 67 | uid_t owner __attribute__ ((unused)), |
| 68 | gid_t group __attribute__ ((unused)), |
| 69 | int flags __attribute__ ((unused))) |
| 70 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame^] | 71 | errno = ENOSYS; |
| 72 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 73 | } |
| 74 | #endif |
| 75 | |
| 76 | #ifndef HAVE_FUTIMESAT |
| 77 | int |
| 78 | futimesat (int dirfd __attribute__ ((unused)), |
| 79 | const char *pathname __attribute__ ((unused)), |
| 80 | const struct timeval times[2] __attribute__ ((unused))) |
| 81 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame^] | 82 | errno = ENOSYS; |
| 83 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 84 | } |
| 85 | #endif |
| 86 | |
| 87 | #ifndef HAVE_INOTIFY_ADD_WATCH |
| 88 | int |
| 89 | inotify_add_watch (int fd __attribute__ ((unused)), |
| 90 | const char* pathname __attribute__ ((unused)), |
| 91 | uint32_t mask __attribute__ ((unused))) |
| 92 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame^] | 93 | errno = ENOSYS; |
| 94 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 95 | } |
| 96 | #endif |
| 97 | |
| 98 | #ifndef HAVE_INOTIFY_INIT |
| 99 | int |
| 100 | inotify_init (void) |
| 101 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame^] | 102 | errno = ENOSYS; |
| 103 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 104 | } |
| 105 | #endif |
| 106 | |
| 107 | #ifndef HAVE_INOTIFY_RM_WATCH |
| 108 | int |
| 109 | inotify_rm_watch (int fd __attribute__ ((unused)), |
| 110 | uint32_t wd __attribute__ ((unused))) |
| 111 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame^] | 112 | errno = ENOSYS; |
| 113 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 114 | } |
| 115 | #endif |
| 116 | |
| 117 | #ifndef HAVE_MKDIRAT |
| 118 | int |
| 119 | mkdirat (int dirfd __attribute__ ((unused)), |
| 120 | const char *pathname __attribute__ ((unused)), |
| 121 | mode_t mode __attribute__ ((unused))) |
| 122 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame^] | 123 | errno = ENOSYS; |
| 124 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 125 | } |
| 126 | #endif |
| 127 | |
| 128 | #ifndef HAVE_MKNODAT |
| 129 | int |
| 130 | mknodat (int dirfd __attribute__ ((unused)), |
| 131 | const char *pathname __attribute__ ((unused)), |
| 132 | mode_t mode __attribute__ ((unused)), |
| 133 | dev_t dev __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_OPENAT |
| 141 | int |
| 142 | openat (int dirfd __attribute__ ((unused)), |
| 143 | const char *pathname __attribute__ ((unused)), |
| 144 | int oflag __attribute__ ((unused)), |
| 145 | ...) |
| 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_RENAMEAT |
| 153 | int |
| 154 | renameat (int olddirfd __attribute__ ((unused)), |
| 155 | const char *oldpath __attribute__ ((unused)), |
| 156 | int newdirfd __attribute__ ((unused)), |
| 157 | const char *newpath __attribute__ ((unused))) |
| 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_SPLICE |
| 165 | int |
| 166 | splice (int fd __attribute__ ((unused)), |
| 167 | loff_t *off_in __attribute__ ((unused)), |
| 168 | int fd_out __attribute__ ((unused)), |
| 169 | loff_t *off_out __attribute__ ((unused)), |
| 170 | size_t len __attribute__ ((unused)), |
| 171 | unsigned int flags __attribute__ ((unused))) |
| 172 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame^] | 173 | errno = ENOSYS; |
| 174 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 175 | } |
| 176 | #endif |
| 177 | |
| 178 | #ifndef HAVE_TEE |
| 179 | int |
| 180 | tee (int fd_in __attribute__ ((unused)), |
| 181 | int fd_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_UNLINKAT |
| 191 | int |
| 192 | unlinkat (int dirfd __attribute__ ((unused)), |
| 193 | const char *pathname __attribute__ ((unused)), |
| 194 | int flags __attribute__ ((unused))) |
| 195 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame^] | 196 | errno = ENOSYS; |
| 197 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 198 | } |
| 199 | #endif |
| 200 | |
| 201 | #ifndef HAVE_UNSHARE |
| 202 | int |
| 203 | unshare (int flags __attribute__ ((unused))) |
| 204 | { |
Ian Lance Taylor | 1c69e5e | 2012-02-02 22:58:54 +0000 | [diff] [blame^] | 205 | errno = ENOSYS; |
| 206 | return -1; |
Ian Lance Taylor | e02ed81 | 2012-01-26 20:24:01 +0000 | [diff] [blame] | 207 | } |
| 208 | #endif |