sys_hpux.c 27 KB

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