sys_hpux.c 27 KB

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