sys_hpux.c 27 KB

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