sys_hpux.c 27 KB

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