summaryrefslogtreecommitdiff
path: root/libgo/runtime/go-nosys.c
blob: b2829589b1490f5e1dd90a1b422aa9e85dbb8b1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/* go-nosys.c -- functions missing from system.

   Copyright 2012 The Go Authors. All rights reserved.
   Use of this source code is governed by a BSD-style
   license that can be found in the LICENSE file.  */

/* This file exists to provide definitions for functions that are
   missing from libc, according to the configure script.  This permits
   the Go syscall package to not worry about whether the functions
   exist or not.  */

#include "config.h"

#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>

#ifndef HAVE_OFF64_T
typedef signed int off64_t __attribute__ ((mode (DI)));
#endif

#ifndef HAVE_LOFF_T
typedef off64_t loff_t;
#endif

#ifndef HAVE_EPOLL_CREATE1
int
epoll_create1 (int flags __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_FACCESSAT
int
faccessat (int fd __attribute__ ((unused)),
	   const char *pathname __attribute__ ((unused)),
	   int mode __attribute__ ((unused)),
	   int flags __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_FALLOCATE
int
fallocate (int fd __attribute__ ((unused)),
	   int mode __attribute__ ((unused)),
	   off_t offset __attribute __ ((unused)),
	   off_t len __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_FCHMODAT
int
fchmodat (int dirfd __attribute__ ((unused)),
	  const char *pathname __attribute__ ((unused)),
	  mode_t mode __attribute__ ((unused)),
	  int flags __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_FCHOWNAT
int
fchownat (int dirfd __attribute__ ((unused)),
	  const char *pathname __attribute__ ((unused)),
	  uid_t owner __attribute__ ((unused)),
	  gid_t group __attribute__ ((unused)),
	  int flags __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_FUTIMESAT
int
futimesat (int dirfd __attribute__ ((unused)),
	   const char *pathname __attribute__ ((unused)),
	   const struct timeval times[2] __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_INOTIFY_ADD_WATCH
int
inotify_add_watch (int fd __attribute__ ((unused)),
		   const char* pathname __attribute__ ((unused)),
		   uint32_t mask __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_INOTIFY_INIT
int
inotify_init (void)
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_INOTIFY_RM_WATCH
int
inotify_rm_watch (int fd __attribute__ ((unused)),
		  uint32_t wd __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_MKDIRAT
int
mkdirat (int dirfd __attribute__ ((unused)),
	 const char *pathname __attribute__ ((unused)),
	 mode_t mode __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_MKNODAT
int
mknodat (int dirfd __attribute__ ((unused)),
	 const char *pathname __attribute__ ((unused)),
	 mode_t mode __attribute__ ((unused)),
	 dev_t dev __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_OPENAT
int
openat (int dirfd __attribute__ ((unused)),
	const char *pathname __attribute__ ((unused)),
	int oflag __attribute__ ((unused)),
	...)
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_RENAMEAT
int
renameat (int olddirfd __attribute__ ((unused)),
	  const char *oldpath __attribute__ ((unused)),
	  int newdirfd __attribute__ ((unused)),
	  const char *newpath __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_SPLICE
int
splice (int fd __attribute__ ((unused)),
	loff_t *off_in __attribute__ ((unused)),
	int fd_out __attribute__ ((unused)),
	loff_t *off_out __attribute__ ((unused)),
	size_t len __attribute__ ((unused)),
	unsigned int flags __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_TEE
int
tee (int fd_in __attribute__ ((unused)),
     int fd_out __attribute__ ((unused)),
     size_t len __attribute__ ((unused)),
     unsigned int flags __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_UNLINKAT
int
unlinkat (int dirfd __attribute__ ((unused)),
	  const char *pathname __attribute__ ((unused)),
	  int flags __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif

#ifndef HAVE_UNSHARE
int
unshare (int flags __attribute__ ((unused)))
{
  errno = ENOSYS;
  return -1;
}
#endif