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