sys_hpux.c 27 KB

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