sys_parisc32.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. /*
  2. * sys_parisc32.c: Conversion between 32bit and 64bit native syscalls.
  3. *
  4. * Copyright (C) 2000-2001 Hewlett Packard Company
  5. * Copyright (C) 2000 John Marvin
  6. * Copyright (C) 2001 Matthew Wilcox
  7. *
  8. * These routines maintain argument size conversion between 32bit and 64bit
  9. * environment. Based heavily on sys_ia32.c and sys_sparc32.c.
  10. */
  11. #include <linux/compat.h>
  12. #include <linux/kernel.h>
  13. #include <linux/sched.h>
  14. #include <linux/fs.h>
  15. #include <linux/mm.h>
  16. #include <linux/file.h>
  17. #include <linux/signal.h>
  18. #include <linux/resource.h>
  19. #include <linux/times.h>
  20. #include <linux/utsname.h>
  21. #include <linux/time.h>
  22. #include <linux/smp.h>
  23. #include <linux/smp_lock.h>
  24. #include <linux/sem.h>
  25. #include <linux/msg.h>
  26. #include <linux/shm.h>
  27. #include <linux/slab.h>
  28. #include <linux/uio.h>
  29. #include <linux/nfs_fs.h>
  30. #include <linux/ncp_fs.h>
  31. #include <linux/sunrpc/svc.h>
  32. #include <linux/nfsd/nfsd.h>
  33. #include <linux/nfsd/cache.h>
  34. #include <linux/nfsd/xdr.h>
  35. #include <linux/nfsd/syscall.h>
  36. #include <linux/poll.h>
  37. #include <linux/personality.h>
  38. #include <linux/stat.h>
  39. #include <linux/highmem.h>
  40. #include <linux/highuid.h>
  41. #include <linux/mman.h>
  42. #include <linux/binfmts.h>
  43. #include <linux/namei.h>
  44. #include <linux/vfs.h>
  45. #include <linux/ptrace.h>
  46. #include <linux/swap.h>
  47. #include <linux/syscalls.h>
  48. #include <asm/types.h>
  49. #include <asm/uaccess.h>
  50. #include <asm/semaphore.h>
  51. #include <asm/mmu_context.h>
  52. #include "sys32.h"
  53. #undef DEBUG
  54. #ifdef DEBUG
  55. #define DBG(x) printk x
  56. #else
  57. #define DBG(x)
  58. #endif
  59. /*
  60. * sys32_execve() executes a new program.
  61. */
  62. asmlinkage int sys32_execve(struct pt_regs *regs)
  63. {
  64. int error;
  65. char *filename;
  66. DBG(("sys32_execve(%p) r26 = 0x%lx\n", regs, regs->gr[26]));
  67. filename = getname((const char __user *) regs->gr[26]);
  68. error = PTR_ERR(filename);
  69. if (IS_ERR(filename))
  70. goto out;
  71. error = compat_do_execve(filename, compat_ptr(regs->gr[25]),
  72. compat_ptr(regs->gr[24]), regs);
  73. if (error == 0) {
  74. task_lock(current);
  75. current->ptrace &= ~PT_DTRACE;
  76. task_unlock(current);
  77. }
  78. putname(filename);
  79. out:
  80. return error;
  81. }
  82. asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23,
  83. int r22, int r21, int r20)
  84. {
  85. printk(KERN_ERR "%s(%d): Unimplemented 32 on 64 syscall #%d!\n",
  86. current->comm, current->pid, r20);
  87. return -ENOSYS;
  88. }
  89. #ifdef CONFIG_SYSCTL
  90. struct __sysctl_args32 {
  91. u32 name;
  92. int nlen;
  93. u32 oldval;
  94. u32 oldlenp;
  95. u32 newval;
  96. u32 newlen;
  97. u32 __unused[4];
  98. };
  99. asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
  100. {
  101. struct __sysctl_args32 tmp;
  102. int error;
  103. unsigned int oldlen32;
  104. size_t oldlen, *oldlenp = NULL;
  105. unsigned long addr = (((long __force)&args->__unused[0]) + 7) & ~7;
  106. extern int do_sysctl(int *name, int nlen, void *oldval, size_t *oldlenp,
  107. void *newval, size_t newlen);
  108. DBG(("sysctl32(%p)\n", args));
  109. if (copy_from_user(&tmp, args, sizeof(tmp)))
  110. return -EFAULT;
  111. if (tmp.oldval && tmp.oldlenp) {
  112. /* Duh, this is ugly and might not work if sysctl_args
  113. is in read-only memory, but do_sysctl does indirectly
  114. a lot of uaccess in both directions and we'd have to
  115. basically copy the whole sysctl.c here, and
  116. glibc's __sysctl uses rw memory for the structure
  117. anyway. */
  118. /* a possibly better hack than this, which will avoid the
  119. * problem if the struct is read only, is to push the
  120. * 'oldlen' value out to the user's stack instead. -PB
  121. */
  122. if (get_user(oldlen32, (u32 *)(u64)tmp.oldlenp))
  123. return -EFAULT;
  124. oldlen = oldlen32;
  125. if (put_user(oldlen, (size_t *)addr))
  126. return -EFAULT;
  127. oldlenp = (size_t *)addr;
  128. }
  129. lock_kernel();
  130. error = do_sysctl((int *)(u64)tmp.name, tmp.nlen, (void *)(u64)tmp.oldval,
  131. oldlenp, (void *)(u64)tmp.newval, tmp.newlen);
  132. unlock_kernel();
  133. if (oldlenp) {
  134. if (!error) {
  135. if (get_user(oldlen, (size_t *)addr)) {
  136. error = -EFAULT;
  137. } else {
  138. oldlen32 = oldlen;
  139. if (put_user(oldlen32, (u32 *)(u64)tmp.oldlenp))
  140. error = -EFAULT;
  141. }
  142. }
  143. if (copy_to_user(&args->__unused[0], tmp.__unused, sizeof(tmp.__unused)))
  144. error = -EFAULT;
  145. }
  146. return error;
  147. }
  148. #endif /* CONFIG_SYSCTL */
  149. asmlinkage long sys32_sched_rr_get_interval(pid_t pid,
  150. struct compat_timespec __user *interval)
  151. {
  152. struct timespec t;
  153. int ret;
  154. KERNEL_SYSCALL(ret, sys_sched_rr_get_interval, pid, (struct timespec __user *)&t);
  155. if (put_compat_timespec(&t, interval))
  156. return -EFAULT;
  157. return ret;
  158. }
  159. static int
  160. put_compat_timeval(struct compat_timeval __user *u, struct timeval *t)
  161. {
  162. struct compat_timeval t32;
  163. t32.tv_sec = t->tv_sec;
  164. t32.tv_usec = t->tv_usec;
  165. return copy_to_user(u, &t32, sizeof t32);
  166. }
  167. static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
  168. {
  169. long usec;
  170. if (__get_user(o->tv_sec, &i->tv_sec))
  171. return -EFAULT;
  172. if (__get_user(usec, &i->tv_usec))
  173. return -EFAULT;
  174. o->tv_nsec = usec * 1000;
  175. return 0;
  176. }
  177. asmlinkage int
  178. sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
  179. {
  180. extern void do_gettimeofday(struct timeval *tv);
  181. if (tv) {
  182. struct timeval ktv;
  183. do_gettimeofday(&ktv);
  184. if (put_compat_timeval(tv, &ktv))
  185. return -EFAULT;
  186. }
  187. if (tz) {
  188. extern struct timezone sys_tz;
  189. if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
  190. return -EFAULT;
  191. }
  192. return 0;
  193. }
  194. asmlinkage
  195. int sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
  196. {
  197. struct timespec kts;
  198. struct timezone ktz;
  199. if (tv) {
  200. if (get_ts32(&kts, tv))
  201. return -EFAULT;
  202. }
  203. if (tz) {
  204. if (copy_from_user(&ktz, tz, sizeof(ktz)))
  205. return -EFAULT;
  206. }
  207. return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
  208. }
  209. int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
  210. {
  211. compat_ino_t ino;
  212. int err;
  213. if (stat->size > MAX_NON_LFS || !new_valid_dev(stat->dev) ||
  214. !new_valid_dev(stat->rdev))
  215. return -EOVERFLOW;
  216. ino = stat->ino;
  217. if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
  218. return -EOVERFLOW;
  219. err = put_user(new_encode_dev(stat->dev), &statbuf->st_dev);
  220. err |= put_user(ino, &statbuf->st_ino);
  221. err |= put_user(stat->mode, &statbuf->st_mode);
  222. err |= put_user(stat->nlink, &statbuf->st_nlink);
  223. err |= put_user(0, &statbuf->st_reserved1);
  224. err |= put_user(0, &statbuf->st_reserved2);
  225. err |= put_user(new_encode_dev(stat->rdev), &statbuf->st_rdev);
  226. err |= put_user(stat->size, &statbuf->st_size);
  227. err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
  228. err |= put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec);
  229. err |= put_user(stat->mtime.tv_sec, &statbuf->st_mtime);
  230. err |= put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec);
  231. err |= put_user(stat->ctime.tv_sec, &statbuf->st_ctime);
  232. err |= put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec);
  233. err |= put_user(stat->blksize, &statbuf->st_blksize);
  234. err |= put_user(stat->blocks, &statbuf->st_blocks);
  235. err |= put_user(0, &statbuf->__unused1);
  236. err |= put_user(0, &statbuf->__unused2);
  237. err |= put_user(0, &statbuf->__unused3);
  238. err |= put_user(0, &statbuf->__unused4);
  239. err |= put_user(0, &statbuf->__unused5);
  240. err |= put_user(0, &statbuf->st_fstype); /* not avail */
  241. err |= put_user(0, &statbuf->st_realdev); /* not avail */
  242. err |= put_user(0, &statbuf->st_basemode); /* not avail */
  243. err |= put_user(0, &statbuf->st_spareshort);
  244. err |= put_user(stat->uid, &statbuf->st_uid);
  245. err |= put_user(stat->gid, &statbuf->st_gid);
  246. err |= put_user(0, &statbuf->st_spare4[0]);
  247. err |= put_user(0, &statbuf->st_spare4[1]);
  248. err |= put_user(0, &statbuf->st_spare4[2]);
  249. return err;
  250. }
  251. struct linux32_dirent {
  252. u32 d_ino;
  253. compat_off_t d_off;
  254. u16 d_reclen;
  255. char d_name[1];
  256. };
  257. struct old_linux32_dirent {
  258. u32 d_ino;
  259. u32 d_offset;
  260. u16 d_namlen;
  261. char d_name[1];
  262. };
  263. struct getdents32_callback {
  264. struct linux32_dirent __user * current_dir;
  265. struct linux32_dirent __user * previous;
  266. int count;
  267. int error;
  268. };
  269. struct readdir32_callback {
  270. struct old_linux32_dirent __user * dirent;
  271. int count;
  272. };
  273. #define ROUND_UP(x,a) ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)))
  274. #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
  275. static int
  276. filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
  277. unsigned int d_type)
  278. {
  279. struct linux32_dirent __user * dirent;
  280. struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
  281. int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4);
  282. u32 d_ino;
  283. buf->error = -EINVAL; /* only used if we fail.. */
  284. if (reclen > buf->count)
  285. return -EINVAL;
  286. d_ino = ino;
  287. if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
  288. return -EOVERFLOW;
  289. dirent = buf->previous;
  290. if (dirent)
  291. put_user(offset, &dirent->d_off);
  292. dirent = buf->current_dir;
  293. buf->previous = dirent;
  294. put_user(d_ino, &dirent->d_ino);
  295. put_user(reclen, &dirent->d_reclen);
  296. copy_to_user(dirent->d_name, name, namlen);
  297. put_user(0, dirent->d_name + namlen);
  298. dirent = ((void __user *)dirent) + reclen;
  299. buf->current_dir = dirent;
  300. buf->count -= reclen;
  301. return 0;
  302. }
  303. asmlinkage long
  304. sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
  305. {
  306. struct file * file;
  307. struct linux32_dirent __user * lastdirent;
  308. struct getdents32_callback buf;
  309. int error;
  310. error = -EBADF;
  311. file = fget(fd);
  312. if (!file)
  313. goto out;
  314. buf.current_dir = (struct linux32_dirent __user *) dirent;
  315. buf.previous = NULL;
  316. buf.count = count;
  317. buf.error = 0;
  318. error = vfs_readdir(file, filldir32, &buf);
  319. if (error < 0)
  320. goto out_putf;
  321. error = buf.error;
  322. lastdirent = buf.previous;
  323. if (lastdirent) {
  324. put_user(file->f_pos, &lastdirent->d_off);
  325. error = count - buf.count;
  326. }
  327. out_putf:
  328. fput(file);
  329. out:
  330. return error;
  331. }
  332. static int
  333. fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t ino,
  334. unsigned int d_type)
  335. {
  336. struct readdir32_callback * buf = (struct readdir32_callback *) __buf;
  337. struct old_linux32_dirent __user * dirent;
  338. u32 d_ino;
  339. if (buf->count)
  340. return -EINVAL;
  341. d_ino = ino;
  342. if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
  343. return -EOVERFLOW;
  344. buf->count++;
  345. dirent = buf->dirent;
  346. put_user(d_ino, &dirent->d_ino);
  347. put_user(offset, &dirent->d_offset);
  348. put_user(namlen, &dirent->d_namlen);
  349. copy_to_user(dirent->d_name, name, namlen);
  350. put_user(0, dirent->d_name + namlen);
  351. return 0;
  352. }
  353. asmlinkage long
  354. sys32_readdir (unsigned int fd, void __user * dirent, unsigned int count)
  355. {
  356. int error;
  357. struct file * file;
  358. struct readdir32_callback buf;
  359. error = -EBADF;
  360. file = fget(fd);
  361. if (!file)
  362. goto out;
  363. buf.count = 0;
  364. buf.dirent = dirent;
  365. error = vfs_readdir(file, fillonedir32, &buf);
  366. if (error >= 0)
  367. error = buf.count;
  368. fput(file);
  369. out:
  370. return error;
  371. }
  372. /*** copied from mips64 ***/
  373. /*
  374. * Ooo, nasty. We need here to frob 32-bit unsigned longs to
  375. * 64-bit unsigned longs.
  376. */
  377. static inline int
  378. get_fd_set32(unsigned long n, u32 *ufdset, unsigned long *fdset)
  379. {
  380. n = (n + 8*sizeof(u32) - 1) / (8*sizeof(u32));
  381. if (ufdset) {
  382. unsigned long odd;
  383. if (!access_ok(VERIFY_WRITE, ufdset, n*sizeof(u32)))
  384. return -EFAULT;
  385. odd = n & 1UL;
  386. n &= ~1UL;
  387. while (n) {
  388. unsigned long h, l;
  389. __get_user(l, ufdset);
  390. __get_user(h, ufdset+1);
  391. ufdset += 2;
  392. *fdset++ = h << 32 | l;
  393. n -= 2;
  394. }
  395. if (odd)
  396. __get_user(*fdset, ufdset);
  397. } else {
  398. /* Tricky, must clear full unsigned long in the
  399. * kernel fdset at the end, this makes sure that
  400. * actually happens.
  401. */
  402. memset(fdset, 0, ((n + 1) & ~1)*sizeof(u32));
  403. }
  404. return 0;
  405. }
  406. static inline void
  407. set_fd_set32(unsigned long n, u32 *ufdset, unsigned long *fdset)
  408. {
  409. unsigned long odd;
  410. n = (n + 8*sizeof(u32) - 1) / (8*sizeof(u32));
  411. if (!ufdset)
  412. return;
  413. odd = n & 1UL;
  414. n &= ~1UL;
  415. while (n) {
  416. unsigned long h, l;
  417. l = *fdset++;
  418. h = l >> 32;
  419. __put_user(l, ufdset);
  420. __put_user(h, ufdset+1);
  421. ufdset += 2;
  422. n -= 2;
  423. }
  424. if (odd)
  425. __put_user(*fdset, ufdset);
  426. }
  427. struct msgbuf32 {
  428. int mtype;
  429. char mtext[1];
  430. };
  431. asmlinkage long sys32_msgsnd(int msqid,
  432. struct msgbuf32 __user *umsgp32,
  433. size_t msgsz, int msgflg)
  434. {
  435. struct msgbuf *mb;
  436. struct msgbuf32 mb32;
  437. int err;
  438. if ((mb = kmalloc(msgsz + sizeof *mb + 4, GFP_KERNEL)) == NULL)
  439. return -ENOMEM;
  440. err = get_user(mb32.mtype, &umsgp32->mtype);
  441. mb->mtype = mb32.mtype;
  442. err |= copy_from_user(mb->mtext, &umsgp32->mtext, msgsz);
  443. if (err)
  444. err = -EFAULT;
  445. else
  446. KERNEL_SYSCALL(err, sys_msgsnd, msqid, (struct msgbuf __user *)mb, msgsz, msgflg);
  447. kfree(mb);
  448. return err;
  449. }
  450. asmlinkage long sys32_msgrcv(int msqid,
  451. struct msgbuf32 __user *umsgp32,
  452. size_t msgsz, long msgtyp, int msgflg)
  453. {
  454. struct msgbuf *mb;
  455. struct msgbuf32 mb32;
  456. int err, len;
  457. if ((mb = kmalloc(msgsz + sizeof *mb + 4, GFP_KERNEL)) == NULL)
  458. return -ENOMEM;
  459. KERNEL_SYSCALL(err, sys_msgrcv, msqid, (struct msgbuf __user *)mb, msgsz, msgtyp, msgflg);
  460. if (err >= 0) {
  461. len = err;
  462. mb32.mtype = mb->mtype;
  463. err = put_user(mb32.mtype, &umsgp32->mtype);
  464. err |= copy_to_user(&umsgp32->mtext, mb->mtext, len);
  465. if (err)
  466. err = -EFAULT;
  467. else
  468. err = len;
  469. }
  470. kfree(mb);
  471. return err;
  472. }
  473. asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
  474. {
  475. mm_segment_t old_fs = get_fs();
  476. int ret;
  477. off_t of;
  478. if (offset && get_user(of, offset))
  479. return -EFAULT;
  480. set_fs(KERNEL_DS);
  481. ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count);
  482. set_fs(old_fs);
  483. if (offset && put_user(of, offset))
  484. return -EFAULT;
  485. return ret;
  486. }
  487. asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count)
  488. {
  489. mm_segment_t old_fs = get_fs();
  490. int ret;
  491. loff_t lof;
  492. if (offset && get_user(lof, offset))
  493. return -EFAULT;
  494. set_fs(KERNEL_DS);
  495. ret = sys_sendfile64(out_fd, in_fd, offset ? (loff_t __user *)&lof : NULL, count);
  496. set_fs(old_fs);
  497. if (offset && put_user(lof, offset))
  498. return -EFAULT;
  499. return ret;
  500. }
  501. struct sysinfo32 {
  502. s32 uptime;
  503. u32 loads[3];
  504. u32 totalram;
  505. u32 freeram;
  506. u32 sharedram;
  507. u32 bufferram;
  508. u32 totalswap;
  509. u32 freeswap;
  510. unsigned short procs;
  511. u32 totalhigh;
  512. u32 freehigh;
  513. u32 mem_unit;
  514. char _f[12];
  515. };
  516. /* We used to call sys_sysinfo and translate the result. But sys_sysinfo
  517. * undoes the good work done elsewhere, and rather than undoing the
  518. * damage, I decided to just duplicate the code from sys_sysinfo here.
  519. */
  520. asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info)
  521. {
  522. struct sysinfo val;
  523. int err;
  524. unsigned long seq;
  525. /* We don't need a memset here because we copy the
  526. * struct to userspace once element at a time.
  527. */
  528. do {
  529. seq = read_seqbegin(&xtime_lock);
  530. val.uptime = jiffies / HZ;
  531. val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
  532. val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
  533. val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);
  534. val.procs = nr_threads;
  535. } while (read_seqretry(&xtime_lock, seq));
  536. si_meminfo(&val);
  537. si_swapinfo(&val);
  538. err = put_user (val.uptime, &info->uptime);
  539. err |= __put_user (val.loads[0], &info->loads[0]);
  540. err |= __put_user (val.loads[1], &info->loads[1]);
  541. err |= __put_user (val.loads[2], &info->loads[2]);
  542. err |= __put_user (val.totalram, &info->totalram);
  543. err |= __put_user (val.freeram, &info->freeram);
  544. err |= __put_user (val.sharedram, &info->sharedram);
  545. err |= __put_user (val.bufferram, &info->bufferram);
  546. err |= __put_user (val.totalswap, &info->totalswap);
  547. err |= __put_user (val.freeswap, &info->freeswap);
  548. err |= __put_user (val.procs, &info->procs);
  549. err |= __put_user (val.totalhigh, &info->totalhigh);
  550. err |= __put_user (val.freehigh, &info->freehigh);
  551. err |= __put_user (val.mem_unit, &info->mem_unit);
  552. return err ? -EFAULT : 0;
  553. }
  554. /* lseek() needs a wrapper because 'offset' can be negative, but the top
  555. * half of the argument has been zeroed by syscall.S.
  556. */
  557. asmlinkage int sys32_lseek(unsigned int fd, int offset, unsigned int origin)
  558. {
  559. return sys_lseek(fd, offset, origin);
  560. }
  561. asmlinkage long sys32_semctl(int semid, int semnum, int cmd, union semun arg)
  562. {
  563. union semun u;
  564. if (cmd == SETVAL) {
  565. /* Ugh. arg is a union of int,ptr,ptr,ptr, so is 8 bytes.
  566. * The int should be in the first 4, but our argument
  567. * frobbing has left it in the last 4.
  568. */
  569. u.val = *((int *)&arg + 1);
  570. return sys_semctl (semid, semnum, cmd, u);
  571. }
  572. return sys_semctl (semid, semnum, cmd, arg);
  573. }
  574. long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf,
  575. size_t len)
  576. {
  577. return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
  578. buf, len);
  579. }