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