sys_hpux.c 26 KB

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