sys_hpux.c 27 KB

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