]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Implements HPUX syscalls. | |
3 | * | |
4 | * Copyright (C) 1999 Matthew Wilcox <willy with parisc-linux.org> | |
5 | * Copyright (C) 2000 Philipp Rumpf | |
6 | * Copyright (C) 2000 John Marvin <jsm with parisc-linux.org> | |
7 | * Copyright (C) 2000 Michael Ang <mang with subcarrier.org> | |
8 | * Copyright (C) 2001 Nathan Neulinger <nneul at umr.edu> | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; either version 2 of the License, or | |
13 | * (at your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program; if not, write to the Free Software | |
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 | */ | |
24 | ||
a9415644 | 25 | #include <linux/capability.h> |
1da177e4 LT |
26 | #include <linux/file.h> |
27 | #include <linux/fs.h> | |
28 | #include <linux/namei.h> | |
29 | #include <linux/sched.h> | |
30 | #include <linux/slab.h> | |
1da177e4 LT |
31 | #include <linux/syscalls.h> |
32 | #include <linux/utsname.h> | |
33 | #include <linux/vfs.h> | |
34 | #include <linux/vmalloc.h> | |
35 | ||
36 | #include <asm/errno.h> | |
37 | #include <asm/pgalloc.h> | |
38 | #include <asm/uaccess.h> | |
39 | ||
40 | unsigned long hpux_brk(unsigned long addr) | |
41 | { | |
42 | /* Sigh. Looks like HP/UX libc relies on kernel bugs. */ | |
43 | return sys_brk(addr + PAGE_SIZE); | |
44 | } | |
45 | ||
46 | int hpux_sbrk(void) | |
47 | { | |
48 | return -ENOSYS; | |
49 | } | |
50 | ||
51 | /* Random other syscalls */ | |
52 | ||
53 | int hpux_nice(int priority_change) | |
54 | { | |
55 | return -ENOSYS; | |
56 | } | |
57 | ||
58 | int hpux_ptrace(void) | |
59 | { | |
60 | return -ENOSYS; | |
61 | } | |
62 | ||
e51ec241 | 63 | int hpux_wait(int __user *stat_loc) |
1da177e4 LT |
64 | { |
65 | return sys_waitpid(-1, stat_loc, 0); | |
66 | } | |
67 | ||
68 | int hpux_setpgrp(void) | |
69 | { | |
70 | return sys_setpgid(0,0); | |
71 | } | |
72 | ||
73 | int hpux_setpgrp3(void) | |
74 | { | |
75 | return hpux_setpgrp(); | |
76 | } | |
77 | ||
78 | #define _SC_CPU_VERSION 10001 | |
79 | #define _SC_OPEN_MAX 4 | |
80 | #define CPU_PA_RISC1_1 0x210 | |
81 | ||
82 | int hpux_sysconf(int which) | |
83 | { | |
84 | switch (which) { | |
85 | case _SC_CPU_VERSION: | |
86 | return CPU_PA_RISC1_1; | |
87 | case _SC_OPEN_MAX: | |
88 | return INT_MAX; | |
89 | default: | |
90 | return -EINVAL; | |
91 | } | |
92 | } | |
93 | ||
94 | /*****************************************************************************/ | |
95 | ||
96 | #define HPUX_UTSLEN 9 | |
97 | #define HPUX_SNLEN 15 | |
98 | ||
99 | struct hpux_utsname { | |
100 | char sysname[HPUX_UTSLEN]; | |
101 | char nodename[HPUX_UTSLEN]; | |
102 | char release[HPUX_UTSLEN]; | |
103 | char version[HPUX_UTSLEN]; | |
104 | char machine[HPUX_UTSLEN]; | |
105 | char idnumber[HPUX_SNLEN]; | |
106 | } ; | |
107 | ||
108 | struct hpux_ustat { | |
109 | int32_t f_tfree; /* total free (daddr_t) */ | |
110 | u_int32_t f_tinode; /* total inodes free (ino_t) */ | |
111 | char f_fname[6]; /* filsys name */ | |
112 | char f_fpack[6]; /* filsys pack name */ | |
113 | u_int32_t f_blksize; /* filsys block size (int) */ | |
114 | }; | |
115 | ||
116 | /* | |
117 | * HPUX's utssys() call. It's a collection of miscellaneous functions, | |
118 | * alas, so there's no nice way of splitting them up. | |
119 | */ | |
120 | ||
121 | /* This function is called from hpux_utssys(); HP-UX implements | |
122 | * ustat() as an option to utssys(). | |
123 | * | |
124 | * Now, struct ustat on HP-UX is exactly the same as on Linux, except | |
125 | * that it contains one addition field on the end, int32_t f_blksize. | |
126 | * So, we could have written this function to just call the Linux | |
127 | * sys_ustat(), (defined in linux/fs/super.c), and then just | |
128 | * added this additional field to the user's structure. But I figure | |
129 | * if we're gonna be digging through filesystem structures to get | |
130 | * this, we might as well just do the whole enchilada all in one go. | |
131 | * | |
132 | * So, most of this function is almost identical to sys_ustat(). | |
133 | * I have placed comments at the few lines changed or added, to | |
134 | * aid in porting forward if and when sys_ustat() is changed from | |
135 | * its form in kernel 2.2.5. | |
136 | */ | |
137 | static int hpux_ustat(dev_t dev, struct hpux_ustat __user *ubuf) | |
138 | { | |
139 | struct super_block *s; | |
140 | struct hpux_ustat tmp; /* Changed to hpux_ustat */ | |
141 | struct kstatfs sbuf; | |
142 | int err = -EINVAL; | |
143 | ||
144 | s = user_get_super(dev); | |
145 | if (s == NULL) | |
146 | goto out; | |
ebabe9a9 | 147 | err = statfs_by_dentry(s->s_root, &sbuf); |
1da177e4 LT |
148 | drop_super(s); |
149 | if (err) | |
150 | goto out; | |
151 | ||
152 | memset(&tmp,0,sizeof(tmp)); | |
153 | ||
154 | tmp.f_tfree = (int32_t)sbuf.f_bfree; | |
155 | tmp.f_tinode = (u_int32_t)sbuf.f_ffree; | |
156 | tmp.f_blksize = (u_int32_t)sbuf.f_bsize; /* Added this line */ | |
157 | ||
158 | err = copy_to_user(ubuf, &tmp, sizeof(tmp)) ? -EFAULT : 0; | |
159 | out: | |
160 | return err; | |
161 | } | |
162 | ||
163 | /* | |
164 | * Wrapper for hpux statfs call. At the moment, just calls the linux native one | |
165 | * and ignores the extra fields at the end of the hpux statfs struct. | |
166 | * | |
167 | */ | |
168 | ||
169 | typedef int32_t hpux_fsid_t[2]; /* file system ID type */ | |
170 | typedef uint16_t hpux_site_t; | |
171 | ||
172 | struct hpux_statfs { | |
173 | int32_t f_type; /* type of info, zero for now */ | |
174 | int32_t f_bsize; /* fundamental file system block size */ | |
175 | int32_t f_blocks; /* total blocks in file system */ | |
176 | int32_t f_bfree; /* free block in fs */ | |
177 | int32_t f_bavail; /* free blocks avail to non-superuser */ | |
178 | int32_t f_files; /* total file nodes in file system */ | |
179 | int32_t f_ffree; /* free file nodes in fs */ | |
180 | hpux_fsid_t f_fsid; /* file system ID */ | |
181 | int32_t f_magic; /* file system magic number */ | |
182 | int32_t f_featurebits; /* file system features */ | |
183 | int32_t f_spare[4]; /* spare for later */ | |
184 | hpux_site_t f_cnode; /* cluster node where mounted */ | |
185 | int16_t f_pad; | |
186 | }; | |
187 | ||
ebabe9a9 | 188 | static int do_statfs_hpux(struct path *path, struct hpux_statfs *buf) |
1da177e4 LT |
189 | { |
190 | struct kstatfs st; | |
191 | int retval; | |
192 | ||
ebabe9a9 | 193 | retval = vfs_statfs(path, &st); |
1da177e4 LT |
194 | if (retval) |
195 | return retval; | |
196 | ||
197 | memset(buf, 0, sizeof(*buf)); | |
198 | buf->f_type = st.f_type; | |
199 | buf->f_bsize = st.f_bsize; | |
200 | buf->f_blocks = st.f_blocks; | |
201 | buf->f_bfree = st.f_bfree; | |
202 | buf->f_bavail = st.f_bavail; | |
203 | buf->f_files = st.f_files; | |
204 | buf->f_ffree = st.f_ffree; | |
205 | buf->f_fsid[0] = st.f_fsid.val[0]; | |
206 | buf->f_fsid[1] = st.f_fsid.val[1]; | |
207 | ||
208 | return 0; | |
209 | } | |
210 | ||
211 | /* hpux statfs */ | |
2d8f3038 | 212 | asmlinkage long hpux_statfs(const char __user *pathname, |
1da177e4 LT |
213 | struct hpux_statfs __user *buf) |
214 | { | |
2d8f3038 | 215 | struct path path; |
1da177e4 LT |
216 | int error; |
217 | ||
2d8f3038 | 218 | error = user_path(pathname, &path); |
1da177e4 LT |
219 | if (!error) { |
220 | struct hpux_statfs tmp; | |
ebabe9a9 | 221 | error = do_statfs_hpux(&path, &tmp); |
1da177e4 LT |
222 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
223 | error = -EFAULT; | |
2d8f3038 | 224 | path_put(&path); |
1da177e4 LT |
225 | } |
226 | return error; | |
227 | } | |
228 | ||
229 | asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf) | |
230 | { | |
231 | struct file *file; | |
232 | struct hpux_statfs tmp; | |
233 | int error; | |
234 | ||
235 | error = -EBADF; | |
236 | file = fget(fd); | |
237 | if (!file) | |
238 | goto out; | |
ebabe9a9 | 239 | error = do_statfs_hpux(&file->f_path, &tmp); |
1da177e4 LT |
240 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
241 | error = -EFAULT; | |
242 | fput(file); | |
243 | out: | |
244 | return error; | |
245 | } | |
246 | ||
247 | ||
248 | /* This function is called from hpux_utssys(); HP-UX implements | |
249 | * uname() as an option to utssys(). | |
250 | * | |
251 | * The form of this function is pretty much copied from sys_olduname(), | |
252 | * defined in linux/arch/i386/kernel/sys_i386.c. | |
253 | */ | |
254 | /* TODO: Are these put_user calls OK? Should they pass an int? | |
255 | * (I copied it from sys_i386.c like this.) | |
256 | */ | |
e51ec241 | 257 | static int hpux_uname(struct hpux_utsname __user *name) |
1da177e4 LT |
258 | { |
259 | int error; | |
260 | ||
261 | if (!name) | |
262 | return -EFAULT; | |
263 | if (!access_ok(VERIFY_WRITE,name,sizeof(struct hpux_utsname))) | |
264 | return -EFAULT; | |
265 | ||
266 | down_read(&uts_sem); | |
267 | ||
e9ff3990 SH |
268 | error = __copy_to_user(&name->sysname, &utsname()->sysname, |
269 | HPUX_UTSLEN - 1); | |
270 | error |= __put_user(0, name->sysname + HPUX_UTSLEN - 1); | |
271 | error |= __copy_to_user(&name->nodename, &utsname()->nodename, | |
272 | HPUX_UTSLEN - 1); | |
273 | error |= __put_user(0, name->nodename + HPUX_UTSLEN - 1); | |
274 | error |= __copy_to_user(&name->release, &utsname()->release, | |
275 | HPUX_UTSLEN - 1); | |
276 | error |= __put_user(0, name->release + HPUX_UTSLEN - 1); | |
277 | error |= __copy_to_user(&name->version, &utsname()->version, | |
278 | HPUX_UTSLEN - 1); | |
279 | error |= __put_user(0, name->version + HPUX_UTSLEN - 1); | |
280 | error |= __copy_to_user(&name->machine, &utsname()->machine, | |
281 | HPUX_UTSLEN - 1); | |
282 | error |= __put_user(0, name->machine + HPUX_UTSLEN - 1); | |
1da177e4 LT |
283 | |
284 | up_read(&uts_sem); | |
285 | ||
286 | /* HP-UX utsname has no domainname field. */ | |
287 | ||
288 | /* TODO: Implement idnumber!!! */ | |
289 | #if 0 | |
290 | error |= __put_user(0,name->idnumber); | |
291 | error |= __put_user(0,name->idnumber+HPUX_SNLEN-1); | |
292 | #endif | |
293 | ||
294 | error = error ? -EFAULT : 0; | |
295 | ||
296 | return error; | |
297 | } | |
298 | ||
299 | /* Note: HP-UX just uses the old suser() function to check perms | |
300 | * in this system call. We'll use capable(CAP_SYS_ADMIN). | |
301 | */ | |
e51ec241 | 302 | int hpux_utssys(char __user *ubuf, int n, int type) |
1da177e4 LT |
303 | { |
304 | int len; | |
305 | int error; | |
306 | switch( type ) { | |
307 | case 0: | |
308 | /* uname(): */ | |
e51ec241 | 309 | return hpux_uname((struct hpux_utsname __user *)ubuf); |
1da177e4 LT |
310 | break ; |
311 | case 1: | |
312 | /* Obsolete (used to be umask().) */ | |
313 | return -EFAULT ; | |
314 | break ; | |
315 | case 2: | |
316 | /* ustat(): */ | |
e51ec241 MW |
317 | return hpux_ustat(new_decode_dev(n), |
318 | (struct hpux_ustat __user *)ubuf); | |
319 | break; | |
1da177e4 LT |
320 | case 3: |
321 | /* setuname(): | |
322 | * | |
323 | * On linux (unlike HP-UX), utsname.nodename | |
324 | * is the same as the hostname. | |
325 | * | |
326 | * sys_sethostname() is defined in linux/kernel/sys.c. | |
327 | */ | |
328 | if (!capable(CAP_SYS_ADMIN)) | |
329 | return -EPERM; | |
330 | /* Unlike Linux, HP-UX returns an error if n==0: */ | |
331 | if ( n <= 0 ) | |
332 | return -EINVAL ; | |
333 | /* Unlike Linux, HP-UX truncates it if n is too big: */ | |
334 | len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; | |
e51ec241 | 335 | return sys_sethostname(ubuf, len); |
1da177e4 LT |
336 | break ; |
337 | case 4: | |
338 | /* sethostname(): | |
339 | * | |
340 | * sys_sethostname() is defined in linux/kernel/sys.c. | |
341 | */ | |
342 | if (!capable(CAP_SYS_ADMIN)) | |
343 | return -EPERM; | |
344 | /* Unlike Linux, HP-UX returns an error if n==0: */ | |
345 | if ( n <= 0 ) | |
346 | return -EINVAL ; | |
347 | /* Unlike Linux, HP-UX truncates it if n is too big: */ | |
348 | len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; | |
e51ec241 | 349 | return sys_sethostname(ubuf, len); |
1da177e4 LT |
350 | break ; |
351 | case 5: | |
352 | /* gethostname(): | |
353 | * | |
354 | * sys_gethostname() is defined in linux/kernel/sys.c. | |
355 | */ | |
356 | /* Unlike Linux, HP-UX returns an error if n==0: */ | |
357 | if ( n <= 0 ) | |
358 | return -EINVAL ; | |
e51ec241 | 359 | return sys_gethostname(ubuf, n); |
1da177e4 LT |
360 | break ; |
361 | case 6: | |
362 | /* Supposedly called from setuname() in libc. | |
363 | * TODO: When and why is this called? | |
364 | * Is it ever even called? | |
365 | * | |
366 | * This code should look a lot like sys_sethostname(), | |
367 | * defined in linux/kernel/sys.c. If that gets updated, | |
368 | * update this code similarly. | |
369 | */ | |
370 | if (!capable(CAP_SYS_ADMIN)) | |
371 | return -EPERM; | |
372 | /* Unlike Linux, HP-UX returns an error if n==0: */ | |
373 | if ( n <= 0 ) | |
374 | return -EINVAL ; | |
375 | /* Unlike Linux, HP-UX truncates it if n is too big: */ | |
376 | len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; | |
377 | /**/ | |
378 | /* TODO: print a warning about using this? */ | |
379 | down_write(&uts_sem); | |
380 | error = -EFAULT; | |
e9ff3990 SH |
381 | if (!copy_from_user(utsname()->sysname, ubuf, len)) { |
382 | utsname()->sysname[len] = 0; | |
1da177e4 LT |
383 | error = 0; |
384 | } | |
385 | up_write(&uts_sem); | |
386 | return error; | |
387 | break ; | |
388 | case 7: | |
389 | /* Sets utsname.release, if you're allowed. | |
390 | * Undocumented. Used by swinstall to change the | |
391 | * OS version, during OS updates. Yuck!!! | |
392 | * | |
393 | * This code should look a lot like sys_sethostname() | |
394 | * in linux/kernel/sys.c. If that gets updated, update | |
395 | * this code similarly. | |
396 | */ | |
397 | if (!capable(CAP_SYS_ADMIN)) | |
398 | return -EPERM; | |
399 | /* Unlike Linux, HP-UX returns an error if n==0: */ | |
400 | if ( n <= 0 ) | |
401 | return -EINVAL ; | |
402 | /* Unlike Linux, HP-UX truncates it if n is too big: */ | |
403 | len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; | |
404 | /**/ | |
405 | /* TODO: print a warning about this? */ | |
406 | down_write(&uts_sem); | |
407 | error = -EFAULT; | |
e9ff3990 SH |
408 | if (!copy_from_user(utsname()->release, ubuf, len)) { |
409 | utsname()->release[len] = 0; | |
1da177e4 LT |
410 | error = 0; |
411 | } | |
412 | up_write(&uts_sem); | |
413 | return error; | |
414 | break ; | |
415 | default: | |
416 | /* This system call returns -EFAULT if given an unknown type. | |
417 | * Why not -EINVAL? I don't know, it's just not what they did. | |
418 | */ | |
419 | return -EFAULT ; | |
420 | } | |
421 | } | |
422 | ||
e51ec241 | 423 | int hpux_getdomainname(char __user *name, int len) |
1da177e4 LT |
424 | { |
425 | int nlen; | |
426 | int err = -EFAULT; | |
427 | ||
428 | down_read(&uts_sem); | |
429 | ||
e9ff3990 | 430 | nlen = strlen(utsname()->domainname) + 1; |
1da177e4 LT |
431 | |
432 | if (nlen < len) | |
433 | len = nlen; | |
434 | if(len > __NEW_UTS_LEN) | |
435 | goto done; | |
e9ff3990 | 436 | if(copy_to_user(name, utsname()->domainname, len)) |
1da177e4 LT |
437 | goto done; |
438 | err = 0; | |
439 | done: | |
440 | up_read(&uts_sem); | |
441 | return err; | |
442 | ||
443 | } | |
444 | ||
445 | int hpux_pipe(int *kstack_fildes) | |
446 | { | |
853b3da1 | 447 | return do_pipe_flags(kstack_fildes, 0); |
1da177e4 LT |
448 | } |
449 | ||
450 | /* lies - says it works, but it really didn't lock anything */ | |
451 | int hpux_lockf(int fildes, int function, off_t size) | |
452 | { | |
453 | return 0; | |
454 | } | |
455 | ||
456 | int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2) | |
457 | { | |
458 | char *fsname = NULL; | |
459 | int len = 0; | |
460 | int fstype; | |
461 | ||
462 | /*Unimplemented HP-UX syscall emulation. Syscall #334 (sysfs) | |
463 | Args: 1 80057bf4 0 400179f0 0 0 0 */ | |
464 | printk(KERN_DEBUG "in hpux_sysfs\n"); | |
465 | printk(KERN_DEBUG "hpux_sysfs called with opcode = %d\n", opcode); | |
466 | printk(KERN_DEBUG "hpux_sysfs called with arg1='%lx'\n", arg1); | |
467 | ||
468 | if ( opcode == 1 ) { /* GETFSIND */ | |
e51ec241 MW |
469 | char __user *user_fsname = (char __user *)arg1; |
470 | len = strlen_user(user_fsname); | |
1da177e4 | 471 | printk(KERN_DEBUG "len of arg1 = %d\n", len); |
1fcbf053 KM |
472 | if (len == 0) |
473 | return 0; | |
5cbded58 | 474 | fsname = kmalloc(len, GFP_KERNEL); |
e51ec241 | 475 | if (!fsname) { |
1da177e4 LT |
476 | printk(KERN_DEBUG "failed to kmalloc fsname\n"); |
477 | return 0; | |
478 | } | |
479 | ||
e51ec241 | 480 | if (copy_from_user(fsname, user_fsname, len)) { |
1da177e4 LT |
481 | printk(KERN_DEBUG "failed to copy_from_user fsname\n"); |
482 | kfree(fsname); | |
483 | return 0; | |
484 | } | |
485 | ||
1fcbf053 KM |
486 | /* String could be altered by userspace after strlen_user() */ |
487 | fsname[len] = '\0'; | |
488 | ||
1da177e4 LT |
489 | printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); |
490 | if ( !strcmp(fsname, "hfs") ) { | |
491 | fstype = 0; | |
492 | } else { | |
493 | fstype = 0; | |
e51ec241 | 494 | } |
1da177e4 LT |
495 | |
496 | kfree(fsname); | |
497 | ||
498 | printk(KERN_DEBUG "returning fstype=%d\n", fstype); | |
499 | return fstype; /* something other than default */ | |
500 | } | |
501 | ||
502 | ||
503 | return 0; | |
504 | } | |
505 | ||
506 | ||
507 | /* Table of syscall names and handle for unimplemented routines */ | |
79793455 | 508 | static const char * const syscall_names[] = { |
1da177e4 LT |
509 | "nosys", /* 0 */ |
510 | "exit", | |
511 | "fork", | |
512 | "read", | |
513 | "write", | |
514 | "open", /* 5 */ | |
515 | "close", | |
516 | "wait", | |
517 | "creat", | |
518 | "link", | |
519 | "unlink", /* 10 */ | |
520 | "execv", | |
521 | "chdir", | |
522 | "time", | |
523 | "mknod", | |
524 | "chmod", /* 15 */ | |
525 | "chown", | |
526 | "brk", | |
527 | "lchmod", | |
528 | "lseek", | |
529 | "getpid", /* 20 */ | |
530 | "mount", | |
531 | "umount", | |
532 | "setuid", | |
533 | "getuid", | |
534 | "stime", /* 25 */ | |
535 | "ptrace", | |
536 | "alarm", | |
537 | NULL, | |
538 | "pause", | |
539 | "utime", /* 30 */ | |
540 | "stty", | |
541 | "gtty", | |
542 | "access", | |
543 | "nice", | |
544 | "ftime", /* 35 */ | |
545 | "sync", | |
546 | "kill", | |
547 | "stat", | |
548 | "setpgrp3", | |
549 | "lstat", /* 40 */ | |
550 | "dup", | |
551 | "pipe", | |
552 | "times", | |
553 | "profil", | |
554 | "ki_call", /* 45 */ | |
555 | "setgid", | |
556 | "getgid", | |
557 | NULL, | |
558 | NULL, | |
559 | NULL, /* 50 */ | |
560 | "acct", | |
561 | "set_userthreadid", | |
562 | NULL, | |
563 | "ioctl", | |
564 | "reboot", /* 55 */ | |
565 | "symlink", | |
566 | "utssys", | |
567 | "readlink", | |
568 | "execve", | |
569 | "umask", /* 60 */ | |
570 | "chroot", | |
571 | "fcntl", | |
572 | "ulimit", | |
573 | NULL, | |
574 | NULL, /* 65 */ | |
575 | "vfork", | |
576 | NULL, | |
577 | NULL, | |
578 | NULL, | |
579 | NULL, /* 70 */ | |
580 | "mmap", | |
581 | NULL, | |
582 | "munmap", | |
583 | "mprotect", | |
584 | "madvise", /* 75 */ | |
585 | "vhangup", | |
586 | "swapoff", | |
587 | NULL, | |
588 | "getgroups", | |
589 | "setgroups", /* 80 */ | |
590 | "getpgrp2", | |
591 | "setpgid/setpgrp2", | |
592 | "setitimer", | |
593 | "wait3", | |
594 | "swapon", /* 85 */ | |
595 | "getitimer", | |
596 | NULL, | |
597 | NULL, | |
598 | NULL, | |
599 | "dup2", /* 90 */ | |
600 | NULL, | |
601 | "fstat", | |
602 | "select", | |
603 | NULL, | |
604 | "fsync", /* 95 */ | |
605 | "setpriority", | |
606 | NULL, | |
607 | NULL, | |
608 | NULL, | |
609 | "getpriority", /* 100 */ | |
610 | NULL, | |
611 | NULL, | |
612 | NULL, | |
613 | NULL, | |
614 | NULL, /* 105 */ | |
615 | NULL, | |
616 | NULL, | |
617 | "sigvector", | |
618 | "sigblock", | |
619 | "sigsetmask", /* 110 */ | |
620 | "sigpause", | |
621 | "sigstack", | |
622 | NULL, | |
623 | NULL, | |
624 | NULL, /* 115 */ | |
625 | "gettimeofday", | |
626 | "getrusage", | |
627 | NULL, | |
628 | NULL, | |
629 | "readv", /* 120 */ | |
630 | "writev", | |
631 | "settimeofday", | |
632 | "fchown", | |
633 | "fchmod", | |
634 | NULL, /* 125 */ | |
635 | "setresuid", | |
636 | "setresgid", | |
637 | "rename", | |
638 | "truncate", | |
639 | "ftruncate", /* 130 */ | |
640 | NULL, | |
641 | "sysconf", | |
642 | NULL, | |
643 | NULL, | |
644 | NULL, /* 135 */ | |
645 | "mkdir", | |
646 | "rmdir", | |
647 | NULL, | |
648 | "sigcleanup", | |
649 | "setcore", /* 140 */ | |
650 | NULL, | |
651 | "gethostid", | |
652 | "sethostid", | |
653 | "getrlimit", | |
654 | "setrlimit", /* 145 */ | |
655 | NULL, | |
656 | NULL, | |
657 | "quotactl", | |
658 | "get_sysinfo", | |
659 | NULL, /* 150 */ | |
660 | "privgrp", | |
661 | "rtprio", | |
662 | "plock", | |
663 | NULL, | |
664 | "lockf", /* 155 */ | |
665 | "semget", | |
666 | NULL, | |
667 | "semop", | |
668 | "msgget", | |
669 | NULL, /* 160 */ | |
670 | "msgsnd", | |
671 | "msgrcv", | |
672 | "shmget", | |
673 | NULL, | |
674 | "shmat", /* 165 */ | |
675 | "shmdt", | |
676 | NULL, | |
677 | "csp/nsp_init", | |
678 | "cluster", | |
679 | "mkrnod", /* 170 */ | |
680 | "test", | |
681 | "unsp_open", | |
682 | NULL, | |
683 | "getcontext", | |
684 | "osetcontext", /* 175 */ | |
685 | "bigio", | |
686 | "pipenode", | |
687 | "lsync", | |
688 | "getmachineid", | |
689 | "cnodeid/mysite", /* 180 */ | |
690 | "cnodes/sitels", | |
691 | "swapclients", | |
692 | "rmtprocess", | |
693 | "dskless_stats", | |
694 | "sigprocmask", /* 185 */ | |
695 | "sigpending", | |
696 | "sigsuspend", | |
697 | "sigaction", | |
698 | NULL, | |
699 | "nfssvc", /* 190 */ | |
700 | "getfh", | |
701 | "getdomainname", | |
702 | "setdomainname", | |
703 | "async_daemon", | |
704 | "getdirentries", /* 195 */ | |
705 | NULL, | |
706 | NULL, | |
707 | "vfsmount", | |
708 | NULL, | |
709 | "waitpid", /* 200 */ | |
710 | NULL, | |
711 | NULL, | |
712 | NULL, | |
713 | NULL, | |
714 | NULL, /* 205 */ | |
715 | NULL, | |
716 | NULL, | |
717 | NULL, | |
718 | NULL, | |
719 | NULL, /* 210 */ | |
720 | NULL, | |
721 | NULL, | |
722 | NULL, | |
723 | NULL, | |
724 | NULL, /* 215 */ | |
725 | NULL, | |
726 | NULL, | |
727 | NULL, | |
728 | NULL, | |
729 | NULL, /* 220 */ | |
730 | NULL, | |
731 | NULL, | |
732 | NULL, | |
733 | "sigsetreturn", | |
734 | "sigsetstatemask", /* 225 */ | |
735 | "bfactl", | |
736 | "cs", | |
737 | "cds", | |
738 | NULL, | |
739 | "pathconf", /* 230 */ | |
740 | "fpathconf", | |
741 | NULL, | |
742 | NULL, | |
743 | "nfs_fcntl", | |
744 | "ogetacl", /* 235 */ | |
745 | "ofgetacl", | |
746 | "osetacl", | |
747 | "ofsetacl", | |
748 | "pstat", | |
749 | "getaudid", /* 240 */ | |
750 | "setaudid", | |
751 | "getaudproc", | |
752 | "setaudproc", | |
753 | "getevent", | |
754 | "setevent", /* 245 */ | |
755 | "audwrite", | |
756 | "audswitch", | |
757 | "audctl", | |
758 | "ogetaccess", | |
759 | "fsctl", /* 250 */ | |
760 | "ulconnect", | |
761 | "ulcontrol", | |
762 | "ulcreate", | |
763 | "uldest", | |
764 | "ulrecv", /* 255 */ | |
765 | "ulrecvcn", | |
766 | "ulsend", | |
767 | "ulshutdown", | |
768 | "swapfs", | |
769 | "fss", /* 260 */ | |
770 | NULL, | |
771 | NULL, | |
772 | NULL, | |
773 | NULL, | |
774 | NULL, /* 265 */ | |
775 | NULL, | |
776 | "tsync", | |
777 | "getnumfds", | |
778 | "poll", | |
779 | "getmsg", /* 270 */ | |
780 | "putmsg", | |
781 | "fchdir", | |
782 | "getmount_cnt", | |
783 | "getmount_entry", | |
784 | "accept", /* 275 */ | |
785 | "bind", | |
786 | "connect", | |
787 | "getpeername", | |
788 | "getsockname", | |
789 | "getsockopt", /* 280 */ | |
790 | "listen", | |
791 | "recv", | |
792 | "recvfrom", | |
793 | "recvmsg", | |
794 | "send", /* 285 */ | |
795 | "sendmsg", | |
796 | "sendto", | |
797 | "setsockopt", | |
798 | "shutdown", | |
799 | "socket", /* 290 */ | |
800 | "socketpair", | |
801 | "proc_open", | |
802 | "proc_close", | |
803 | "proc_send", | |
804 | "proc_recv", /* 295 */ | |
805 | "proc_sendrecv", | |
806 | "proc_syscall", | |
807 | "ipccreate", | |
808 | "ipcname", | |
809 | "ipcnamerase", /* 300 */ | |
810 | "ipclookup", | |
811 | "ipcselect", | |
812 | "ipcconnect", | |
813 | "ipcrecvcn", | |
814 | "ipcsend", /* 305 */ | |
815 | "ipcrecv", | |
816 | "ipcgetnodename", | |
817 | "ipcsetnodename", | |
818 | "ipccontrol", | |
819 | "ipcshutdown", /* 310 */ | |
820 | "ipcdest", | |
821 | "semctl", | |
822 | "msgctl", | |
823 | "shmctl", | |
824 | "mpctl", /* 315 */ | |
825 | "exportfs", | |
826 | "getpmsg", | |
827 | "putpmsg", | |
828 | "strioctl", | |
829 | "msync", /* 320 */ | |
830 | "msleep", | |
831 | "mwakeup", | |
832 | "msem_init", | |
833 | "msem_remove", | |
834 | "adjtime", /* 325 */ | |
835 | "kload", | |
836 | "fattach", | |
837 | "fdetach", | |
838 | "serialize", | |
839 | "statvfs", /* 330 */ | |
840 | "fstatvfs", | |
841 | "lchown", | |
842 | "getsid", | |
843 | "sysfs", | |
844 | NULL, /* 335 */ | |
845 | NULL, | |
846 | "sched_setparam", | |
847 | "sched_getparam", | |
848 | "sched_setscheduler", | |
849 | "sched_getscheduler", /* 340 */ | |
850 | "sched_yield", | |
851 | "sched_get_priority_max", | |
852 | "sched_get_priority_min", | |
853 | "sched_rr_get_interval", | |
854 | "clock_settime", /* 345 */ | |
855 | "clock_gettime", | |
856 | "clock_getres", | |
857 | "timer_create", | |
858 | "timer_delete", | |
859 | "timer_settime", /* 350 */ | |
860 | "timer_gettime", | |
861 | "timer_getoverrun", | |
862 | "nanosleep", | |
863 | "toolbox", | |
864 | NULL, /* 355 */ | |
865 | "getdents", | |
866 | "getcontext", | |
867 | "sysinfo", | |
868 | "fcntl64", | |
869 | "ftruncate64", /* 360 */ | |
870 | "fstat64", | |
871 | "getdirentries64", | |
872 | "getrlimit64", | |
873 | "lockf64", | |
874 | "lseek64", /* 365 */ | |
875 | "lstat64", | |
876 | "mmap64", | |
877 | "setrlimit64", | |
878 | "stat64", | |
879 | "truncate64", /* 370 */ | |
880 | "ulimit64", | |
881 | NULL, | |
882 | NULL, | |
883 | NULL, | |
884 | NULL, /* 375 */ | |
885 | NULL, | |
886 | NULL, | |
887 | NULL, | |
888 | NULL, | |
889 | "setcontext", /* 380 */ | |
890 | "sigaltstack", | |
891 | "waitid", | |
892 | "setpgrp", | |
893 | "recvmsg2", | |
894 | "sendmsg2", /* 385 */ | |
895 | "socket2", | |
896 | "socketpair2", | |
897 | "setregid", | |
898 | "lwp_create", | |
899 | "lwp_terminate", /* 390 */ | |
900 | "lwp_wait", | |
901 | "lwp_suspend", | |
902 | "lwp_resume", | |
903 | "lwp_self", | |
904 | "lwp_abort_syscall", /* 395 */ | |
905 | "lwp_info", | |
906 | "lwp_kill", | |
907 | "ksleep", | |
908 | "kwakeup", | |
909 | "ksleep_abort", /* 400 */ | |
910 | "lwp_proc_info", | |
911 | "lwp_exit", | |
912 | "lwp_continue", | |
913 | "getacl", | |
914 | "fgetacl", /* 405 */ | |
915 | "setacl", | |
916 | "fsetacl", | |
917 | "getaccess", | |
918 | "lwp_mutex_init", | |
919 | "lwp_mutex_lock_sys", /* 410 */ | |
920 | "lwp_mutex_unlock", | |
921 | "lwp_cond_init", | |
922 | "lwp_cond_signal", | |
923 | "lwp_cond_broadcast", | |
924 | "lwp_cond_wait_sys", /* 415 */ | |
925 | "lwp_getscheduler", | |
926 | "lwp_setscheduler", | |
927 | "lwp_getprivate", | |
928 | "lwp_setprivate", | |
929 | "lwp_detach", /* 420 */ | |
930 | "mlock", | |
931 | "munlock", | |
932 | "mlockall", | |
933 | "munlockall", | |
934 | "shm_open", /* 425 */ | |
935 | "shm_unlink", | |
936 | "sigqueue", | |
937 | "sigwaitinfo", | |
938 | "sigtimedwait", | |
939 | "sigwait", /* 430 */ | |
940 | "aio_read", | |
941 | "aio_write", | |
942 | "lio_listio", | |
943 | "aio_error", | |
944 | "aio_return", /* 435 */ | |
945 | "aio_cancel", | |
946 | "aio_suspend", | |
947 | "aio_fsync", | |
948 | "mq_open", | |
949 | "mq_unlink", /* 440 */ | |
950 | "mq_send", | |
951 | "mq_receive", | |
952 | "mq_notify", | |
953 | "mq_setattr", | |
954 | "mq_getattr", /* 445 */ | |
955 | "ksem_open", | |
956 | "ksem_unlink", | |
957 | "ksem_close", | |
958 | "ksem_destroy", | |
959 | "lw_sem_incr", /* 450 */ | |
960 | "lw_sem_decr", | |
961 | "lw_sem_read", | |
962 | "mq_close", | |
963 | }; | |
964 | static const int syscall_names_max = 453; | |
965 | ||
966 | int | |
967 | hpux_unimplemented(unsigned long arg1,unsigned long arg2,unsigned long arg3, | |
968 | unsigned long arg4,unsigned long arg5,unsigned long arg6, | |
969 | unsigned long arg7,unsigned long sc_num) | |
970 | { | |
971 | /* NOTE: sc_num trashes arg8 for the few syscalls that actually | |
972 | * have a valid 8th argument. | |
973 | */ | |
974 | const char *name = NULL; | |
975 | if ( sc_num <= syscall_names_max && sc_num >= 0 ) { | |
976 | name = syscall_names[sc_num]; | |
977 | } | |
978 | ||
979 | if ( name ) { | |
980 | printk(KERN_DEBUG "Unimplemented HP-UX syscall emulation. Syscall #%lu (%s)\n", | |
981 | sc_num, name); | |
982 | } else { | |
983 | printk(KERN_DEBUG "Unimplemented unknown HP-UX syscall emulation. Syscall #%lu\n", | |
984 | sc_num); | |
985 | } | |
986 | ||
987 | printk(KERN_DEBUG " Args: %lx %lx %lx %lx %lx %lx %lx\n", | |
988 | arg1, arg2, arg3, arg4, arg5, arg6, arg7); | |
989 | ||
990 | return -ENOSYS; | |
991 | } |