linux32_unistd.c revision 1.7 1 /* $NetBSD: linux32_unistd.c,v 1.7 2007/03/18 21:38:33 dsl Exp $ */
2
3 /*-
4 * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Emmanuel Dreyfus
17 * 4. The name of the author may not be used to endorse or promote
18 * products derived from this software without specific prior written
19 * permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS''
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #include <sys/cdefs.h>
35
36 __KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.7 2007/03/18 21:38:33 dsl Exp $");
37
38 #include <sys/types.h>
39 #include <sys/param.h>
40 #include <sys/fstypes.h>
41 #include <sys/signal.h>
42 #include <sys/dirent.h>
43 #include <sys/kernel.h>
44 #include <sys/fcntl.h>
45 #include <sys/select.h>
46 #include <sys/proc.h>
47 #include <sys/ucred.h>
48 #include <sys/swap.h>
49
50 #include <machine/types.h>
51
52 #include <sys/syscallargs.h>
53
54 #include <compat/netbsd32/netbsd32.h>
55 #include <compat/netbsd32/netbsd32_conv.h>
56 #include <compat/netbsd32/netbsd32_syscallargs.h>
57
58 #include <compat/linux/common/linux_types.h>
59 #include <compat/linux/common/linux_signal.h>
60 #include <compat/linux/common/linux_machdep.h>
61 #include <compat/linux/common/linux_misc.h>
62 #include <compat/linux/common/linux_oldolduname.h>
63 #include <compat/linux/linux_syscallargs.h>
64
65 #include <compat/linux32/common/linux32_types.h>
66 #include <compat/linux32/common/linux32_signal.h>
67 #include <compat/linux32/common/linux32_machdep.h>
68 #include <compat/linux32/common/linux32_sysctl.h>
69 #include <compat/linux32/common/linux32_socketcall.h>
70 #include <compat/linux32/linux32_syscallargs.h>
71
72 static int linux32_select1(struct lwp *, register_t *,
73 int, fd_set *, fd_set *, fd_set *, struct timeval *);
74
75 int
76 linux32_sys_brk(l, v, retval)
77 struct lwp *l;
78 void *v;
79 register_t *retval;
80 {
81 struct linux32_sys_brk_args /* {
82 syscallarg(netbsd32_charp) nsize;
83 } */ *uap = v;
84 struct linux_sys_brk_args ua;
85
86 NETBSD32TOP_UAP(nsize, char);
87 return linux_sys_brk(l, &ua, retval);
88 }
89
90 int
91 linux32_sys_access(l, v, retval)
92 struct lwp *l;
93 void *v;
94 register_t *retval;
95 {
96 struct linux32_sys_access_args /* {
97 syscallarg(const netbsd32_charp) path;
98 syscallarg(int) flags;
99 } */ *uap = v;
100 struct sys_access_args ua;
101 void *sg;
102
103 NETBSD32TOP_UAP(path, const char);
104 NETBSD32TO64_UAP(flags);
105
106 sg = stackgap_init(l->l_proc, 0);
107 CHECK_ALT_EXIST(l, &sg, SCARG(&ua, path));
108
109 return sys_access(l, &ua, retval);
110 }
111
112 int
113 linux32_sys_llseek(l, v, retval)
114 struct lwp *l;
115 void *v;
116 register_t *retval;
117 {
118 struct linux32_sys_llseek_args /* {
119 syscallcarg(int) fd;
120 syscallarg(u_int32_t) ohigh;
121 syscallarg(u_int32_t) olow;
122 syscallarg(netbsd32_void *) res;
123 syscallcarg(int) whence;
124 } */ *uap = v;
125 struct linux_sys_llseek_args ua;
126
127 NETBSD32TO64_UAP(fd);
128 NETBSD32TO64_UAP(ohigh);
129 NETBSD32TO64_UAP(olow);
130 NETBSD32TOP_UAP(res, char);
131 NETBSD32TO64_UAP(whence);
132
133 return linux_sys_llseek(l, &ua, retval);
134 }
135
136 int
137 linux32_sys_readlink(l, v, retval)
138 struct lwp *l;
139 void *v;
140 register_t *retval;
141 {
142 struct linux32_sys_readlink_args /* {
143 syscallarg(const netbsd32_charp) name;
144 syscallarg(netbsd32_charp) buf;
145 syscallarg(int) count;
146 } */ *uap = v;
147 struct linux_sys_readlink_args ua;
148
149 NETBSD32TOP_UAP(name, const char);
150 NETBSD32TOP_UAP(buf, char)
151 NETBSD32TO64_UAP(count);
152
153 return linux_sys_readlink(l, &ua, retval);
154 }
155
156
157 int
158 linux32_sys_select(l, v, retval)
159 struct lwp *l;
160 void *v;
161 register_t *retval;
162 {
163 struct linux32_sys_select_args /* {
164 syscallarg(int) nfds;
165 syscallarg(netbsd32_fd_setp_t) readfds;
166 syscallarg(netbsd32_fd_setp_t) writefds;
167 syscallarg(netbsd32_fd_setp_t) exceptfds;
168 syscallarg(netbsd32_timevalp_t) timeout;
169 } */ *uap = v;
170
171 return linux32_select1(l, retval, SCARG(uap, nfds),
172 SCARG_P32(uap, readfds),
173 SCARG_P32(uap, writefds),
174 SCARG_P32(uap, exceptfds),
175 SCARG_P32(uap, timeout));
176 }
177
178 int
179 linux32_sys_oldselect(l, v, retval)
180 struct lwp *l;
181 void *v;
182 register_t *retval;
183 {
184 struct linux32_sys_oldselect_args /* {
185 syscallarg(linux32_oldselectp_t) lsp;
186 } */ *uap = v;
187 struct linux32_oldselect lsp32;
188 int error;
189
190 if ((error = copyin(SCARG_P32(uap, lsp), &lsp32, sizeof(lsp32))) != 0)
191 return error;
192
193 return linux32_select1(l, retval, lsp32.nfds,
194 NETBSD32PTR64(lsp32.readfds), NETBSD32PTR64(lsp32.writefds),
195 NETBSD32PTR64(lsp32.exceptfds), NETBSD32PTR64(lsp32.timeout));
196 }
197
198 static int
199 linux32_select1(l, retval, nfds, readfds, writefds, exceptfds, timeout)
200 struct lwp *l;
201 register_t *retval;
202 int nfds;
203 fd_set *readfds, *writefds, *exceptfds;
204 struct timeval *timeout;
205 {
206 struct timeval tv0, tv1, utv, otv;
207 struct netbsd32_timeval utv32;
208 int error;
209
210 timerclear(&otv); /* XXX GCC4 */
211
212 /*
213 * Store current time for computation of the amount of
214 * time left.
215 */
216 if (timeout) {
217 if ((error = copyin(timeout, &utv32, sizeof(utv32))))
218 return error;
219
220 netbsd32_to_timeval(&utv32, &utv);
221 otv = utv;
222
223 if (itimerfix(&utv)) {
224 /*
225 * The timeval was invalid. Convert it to something
226 * valid that will act as it does under Linux.
227 */
228 utv.tv_sec += utv.tv_usec / 1000000;
229 utv.tv_usec %= 1000000;
230 if (utv.tv_usec < 0) {
231 utv.tv_sec -= 1;
232 utv.tv_usec += 1000000;
233 }
234 if (utv.tv_sec < 0)
235 timerclear(&utv);
236 }
237 microtime(&tv0);
238 } else {
239 timerclear(&utv);
240 }
241
242 error = selcommon(l, retval, nfds,
243 readfds, writefds, exceptfds, &utv, NULL);
244
245 if (error) {
246 /*
247 * See fs/select.c in the Linux kernel. Without this,
248 * Maelstrom doesn't work.
249 */
250 if (error == ERESTART)
251 error = EINTR;
252 return error;
253 }
254
255 if (timeout) {
256 if (*retval) {
257 /*
258 * Compute how much time was left of the timeout,
259 * by subtracting the current time and the time
260 * before we started the call, and subtracting
261 * that result from the user-supplied value.
262 */
263 microtime(&tv1);
264 timersub(&tv1, &tv0, &tv1);
265 timersub(&otv, &tv1, &utv);
266 if (utv.tv_sec < 0)
267 timerclear(&utv);
268 } else {
269 timerclear(&utv);
270 }
271
272 netbsd32_from_timeval(&utv, &utv32);
273
274 if ((error = copyout(&utv32, timeout, sizeof(utv32))))
275 return error;
276 }
277
278 return 0;
279 }
280
281 int
282 linux32_sys_pipe(l, v, retval)
283 struct lwp *l;
284 void *v;
285 register_t *retval;
286 {
287 struct linux32_sys_pipe_args /* {
288 syscallarg(netbsd32_intp) fd;
289 } */ *uap = v;
290 int error;
291 int pfds[2];
292
293 if ((error = sys_pipe(l, 0, retval)))
294 return error;
295
296 pfds[0] = (int)retval[0];
297 pfds[1] = (int)retval[1];
298
299 if ((error = copyout(pfds, SCARG_P32(uap, fd), 2 * sizeof (int))) != 0)
300 return error;
301
302 retval[0] = 0;
303 retval[1] = 0;
304
305 return 0;
306 }
307
308
309 int
310 linux32_sys_unlink(l, v, retval)
311 struct lwp *l;
312 void *v;
313 register_t *retval;
314 {
315 struct linux32_sys_unlink_args /* {
316 syscallarg(const netbsd32_charp) path;
317 } */ *uap = v;
318 struct linux_sys_unlink_args ua;
319
320 NETBSD32TOP_UAP(path, const char);
321
322 return linux_sys_unlink(l, &ua, retval);
323 }
324
325 int
326 linux32_sys_chdir(l, v, retval)
327 struct lwp *l;
328 void *v;
329 register_t *retval;
330 {
331 struct linux32_sys_chdir_args /* {
332 syscallarg(const netbsd32_charp) path;
333 } */ *uap = v;
334 struct sys_chdir_args ua;
335 void *sg = stackgap_init(l->l_proc, 0);
336
337 NETBSD32TOP_UAP(path, const char);
338
339 CHECK_ALT_EXIST(l, &sg, SCARG(&ua, path));
340
341 return sys_chdir(l, &ua, retval);
342 }
343
344 int
345 linux32_sys_link(l, v, retval)
346 struct lwp *l;
347 void *v;
348 register_t *retval;
349 {
350 struct linux32_sys_link_args /* {
351 syscallarg(const netbsd32_charp) path;
352 syscallarg(const netbsd32_charp) link;
353 } */ *uap = v;
354 struct sys_link_args ua;
355 void *sg = stackgap_init(l->l_proc, 0);
356
357 NETBSD32TOP_UAP(path, const char);
358 NETBSD32TOP_UAP(link, const char);
359
360 CHECK_ALT_EXIST(l, &sg, SCARG(&ua, path));
361 CHECK_ALT_CREAT(l, &sg, SCARG(&ua, link));
362
363 return sys_link(l, &ua, retval);
364 }
365
366 int
367 linux32_sys_creat(l, v, retval)
368 struct lwp *l;
369 void *v;
370 register_t *retval;
371 {
372 struct linux32_sys_creat_args /* {
373 syscallarg(const netbsd32_charp) path;
374 syscallarg(int) mode;
375 } */ *uap = v;
376 struct sys_open_args ua;
377 void *sg = stackgap_init(l->l_proc, 0);
378
379 NETBSD32TOP_UAP(path, const char);
380 SCARG(&ua, flags) = O_CREAT | O_TRUNC | O_WRONLY;
381 NETBSD32TO64_UAP(mode);
382
383 CHECK_ALT_EXIST(l, &sg, SCARG(&ua, path));
384
385 return sys_open(l, &ua, retval);
386 }
387
388 int
389 linux32_sys_mknod(l, v, retval)
390 struct lwp *l;
391 void *v;
392 register_t *retval;
393 {
394 struct linux32_sys_mknod_args /* {
395 syscallarg(const netbsd32_charp) path;
396 syscallarg(int) mode;
397 syscallarg(int) dev;
398 } */ *uap = v;
399 struct linux_sys_mknod_args ua;
400
401 NETBSD32TOP_UAP(path, const char);
402 NETBSD32TO64_UAP(mode);
403 NETBSD32TO64_UAP(dev);
404
405 return linux_sys_mknod(l, &ua, retval);
406 }
407
408 int
409 linux32_sys_chmod(l, v, retval)
410 struct lwp *l;
411 void *v;
412 register_t *retval;
413 {
414 struct linux32_sys_chmod_args /* {
415 syscallarg(const netbsd32_charp) path;
416 syscallarg(int) mode;
417 } */ *uap = v;
418 struct sys_chmod_args ua;
419 void *sg = stackgap_init(l->l_proc, 0);
420
421 NETBSD32TOP_UAP(path, const char);
422 NETBSD32TO64_UAP(mode);
423
424 CHECK_ALT_EXIST(l, &sg, SCARG(&ua, path));
425
426 return sys_chmod(l, &ua, retval);
427 }
428
429 int
430 linux32_sys_lchown16(l, v, retval)
431 struct lwp *l;
432 void *v;
433 register_t *retval;
434 {
435 struct linux32_sys_lchown16_args /* {
436 syscallarg(const netbsd32_charp) path;
437 syscallarg(int) uid;
438 syscallarg(int) gid;
439 } */ *uap = v;
440 struct sys___posix_lchown_args ua;
441 void *sg = stackgap_init(l->l_proc, 0);
442
443 NETBSD32TOP_UAP(path, const char);
444 CHECK_ALT_SYMLINK(l, &sg, SCARG(&ua, path));
445
446 if ((linux32_uid_t)SCARG(uap, uid) == (linux32_uid_t)-1)
447 SCARG(&ua, uid) = (uid_t)-1;
448 else
449 SCARG(&ua, uid) = SCARG(uap, uid);
450
451 if ((linux32_gid_t)SCARG(uap, gid) == (linux32_gid_t)-1)
452 SCARG(&ua, gid) = (gid_t)-1;
453 else
454 SCARG(&ua, gid) = SCARG(uap, gid);
455
456 return sys___posix_lchown(l, &ua, retval);
457 }
458
459 int
460 linux32_sys_break(l, v, retval)
461 struct lwp *l;
462 void *v;
463 register_t *retval;
464 {
465 #if 0
466 struct linux32_sys_break_args /* {
467 syscallarg(const netbsd32_charp) nsize;
468 } */ *uap = v;
469 #endif
470
471 return ENOSYS;
472 }
473
474 int
475 linux32_sys_rename(l, v, retval)
476 struct lwp *l;
477 void *v;
478 register_t *retval;
479 {
480 struct linux32_sys_rename_args /* {
481 syscallarg(const netbsd32_charp) from;
482 syscallarg(const netbsd32_charp) to;
483 } */ *uap = v;
484 struct sys_rename_args ua;
485 void *sg = stackgap_init(l->l_proc, 0);
486
487 NETBSD32TOP_UAP(from, const char);
488 NETBSD32TOP_UAP(to, const char);
489
490 CHECK_ALT_EXIST(l, &sg, SCARG(&ua, from));
491 CHECK_ALT_CREAT(l, &sg, SCARG(&ua, to));
492
493 return sys___posix_rename(l, &ua, retval);
494 }
495
496 int
497 linux32_sys_mkdir(l, v, retval)
498 struct lwp *l;
499 void *v;
500 register_t *retval;
501 {
502 struct linux32_sys_mkdir_args /* {
503 syscallarg(const netbsd32_charp) path;
504 syscallarg(int) mode;
505 } */ *uap = v;
506 struct sys_mkdir_args ua;
507 void *sg = stackgap_init(l->l_proc, 0);
508
509 NETBSD32TOP_UAP(path, const char);
510 NETBSD32TO64_UAP(mode);
511
512 CHECK_ALT_CREAT(l, &sg, SCARG(&ua, path));
513
514 return sys_mkdir(l, &ua, retval);
515 }
516
517 int
518 linux32_sys_rmdir(l, v, retval)
519 struct lwp *l;
520 void *v;
521 register_t *retval;
522 {
523 struct linux32_sys_rmdir_args /* {
524 syscallarg(const netbsd32_charp) path;
525 } */ *uap = v;
526 struct sys_rmdir_args ua;
527 void *sg = stackgap_init(l->l_proc, 0);
528
529 NETBSD32TOP_UAP(path, const char);
530
531 CHECK_ALT_EXIST(l, &sg, SCARG(&ua, path));
532
533 return sys_rmdir(l, &ua, retval);
534 }
535
536 int
537 linux32_sys_getgroups16(l, v, retval)
538 struct lwp *l;
539 void *v;
540 register_t *retval;
541 {
542 struct linux32_sys_getgroups16_args /* {
543 syscallarg(int) gidsetsize;
544 syscallarg(linux32_gidp_t) gidset;
545 } */ *uap = v;
546 struct linux_sys_getgroups16_args ua;
547
548 NETBSD32TO64_UAP(gidsetsize);
549 NETBSD32TOP_UAP(gidset, linux_gid_t);
550
551 return linux_sys_getgroups16(l, &ua, retval);
552 }
553
554 int
555 linux32_sys_setgroups16(l, v, retval)
556 struct lwp *l;
557 void *v;
558 register_t *retval;
559 {
560 struct linux32_sys_setgroups16_args /* {
561 syscallarg(int) gidsetsize;
562 syscallarg(linux32_gidp_t) gidset;
563 } */ *uap = v;
564 struct linux_sys_setgroups16_args ua;
565
566 NETBSD32TO64_UAP(gidsetsize);
567 NETBSD32TOP_UAP(gidset, linux_gid_t);
568
569 return linux_sys_setgroups16(l, &ua, retval);
570 }
571
572 int
573 linux32_sys_symlink(l, v, retval)
574 struct lwp *l;
575 void *v;
576 register_t *retval;
577 {
578 struct linux32_sys_symlink_args /* {
579 syscallarg(const netbsd32_charp) path;
580 syscallarg(const netbsd32_charp) link;
581 } */ *uap = v;
582 struct sys_symlink_args ua;
583 void *sg = stackgap_init(l->l_proc, 0);
584
585 NETBSD32TOP_UAP(path, const char);
586 NETBSD32TOP_UAP(link, const char);
587
588 CHECK_ALT_EXIST(l, &sg, SCARG(&ua, path));
589 CHECK_ALT_CREAT(l, &sg, SCARG(&ua, link));
590
591 return sys_symlink(l, &ua, retval);
592 }
593
594
595 int
596 linux32_sys_swapon(l, v, retval)
597 struct lwp *l;
598 void *v;
599 register_t *retval;
600 {
601 struct linux32_sys_swapon_args /* {
602 syscallarg(const netbsd32_charp) name;
603 } */ *uap = v;
604 struct sys_swapctl_args ua;
605
606 SCARG(&ua, cmd) = SWAP_ON;
607 SCARG(&ua, arg) = SCARG_P32(uap, name);
608 SCARG(&ua, misc) = 0; /* priority */
609 return (sys_swapctl(l, &ua, retval));
610 }
611
612 int
613 linux32_sys_swapoff(l, v, retval)
614 struct lwp *l;
615 void *v;
616 register_t *retval;
617 {
618 struct linux32_sys_swapoff_args /* {
619 syscallarg(const netbsd32_charp) path;
620 } */ *uap = v;
621 struct sys_swapctl_args ua;
622
623 SCARG(&ua, cmd) = SWAP_OFF;
624 SCARG(&ua, arg) = SCARG_P32(uap, path);
625 SCARG(&ua, misc) = 0; /* priority */
626 return (sys_swapctl(l, &ua, retval));
627 }
628
629
630 int
631 linux32_sys_reboot(l, v, retval)
632 struct lwp *l;
633 void *v;
634 register_t *retval;
635 {
636 struct linux32_sys_reboot_args /* {
637 syscallarg(int) magic1;
638 syscallarg(int) magic2;
639 syscallarg(int) cmd;
640 syscallarg(netbsd32_voidp) arg;
641 } */ *uap = v;
642 struct linux_sys_reboot_args ua;
643
644 NETBSD32TO64_UAP(magic1);
645 NETBSD32TO64_UAP(magic2);
646 NETBSD32TO64_UAP(cmd);
647 NETBSD32TOP_UAP(arg, void);
648
649 return linux_sys_reboot(l, &ua, retval);
650 }
651
652 int
653 linux32_sys_truncate(l, v, retval)
654 struct lwp *l;
655 void *v;
656 register_t *retval;
657 {
658 struct linux32_sys_truncate_args /* {
659 syscallarg(const netbsd32_charp) path;
660 syscallarg(netbsd32_charp) buf;
661 syscallarg(int) count;
662 } */ *uap = v;
663 struct compat_43_sys_truncate_args ua;
664
665 NETBSD32TOP_UAP(path, const char);
666 NETBSD32TO64_UAP(length);
667
668 return compat_43_sys_truncate(l, &ua, retval);
669 }
670
671 int
672 linux32_sys_fchown16(l, v, retval)
673 struct lwp *l;
674 void *v;
675 register_t *retval;
676 {
677 struct linux32_sys_fchown16_args /* {
678 syscallarg(int) fd;
679 syscallarg(int) uid;
680 syscallarg(int) gid;
681 } */ *uap = v;
682 struct sys___posix_fchown_args ua;
683
684 SCARG(&ua, fd) = SCARG(uap, fd);
685
686 if ((linux32_uid_t)SCARG(uap, uid) == (linux32_uid_t)-1)
687 SCARG(&ua, uid) = (uid_t)-1;
688 else
689 SCARG(&ua, uid) = SCARG(uap, uid);
690
691 if ((linux32_gid_t)SCARG(uap, gid) == (linux32_gid_t)-1)
692 SCARG(&ua, gid) = (gid_t)-1;
693 else
694 SCARG(&ua, gid) = SCARG(uap, gid);
695
696 return sys___posix_fchown(l, &ua, retval);
697 }
698
699 int
700 linux32_sys_setresuid(l, v, retval)
701 struct lwp *l;
702 void *v;
703 register_t *retval;
704 {
705 struct linux32_sys_setresuid_args /* {
706 syscallarg(uid_t) ruid;
707 syscallarg(uid_t) euid;
708 syscallarg(uid_t) suid;
709 } */ *uap = v;
710 struct linux_sys_setresuid_args ua;
711
712 SCARG(&ua, ruid) = (SCARG(uap, ruid) == -1) ? -1 : SCARG(uap, ruid);
713 SCARG(&ua, euid) = (SCARG(uap, euid) == -1) ? -1 : SCARG(uap, euid);
714 SCARG(&ua, suid) = (SCARG(uap, suid) == -1) ? -1 : SCARG(uap, suid);
715
716 return linux_sys_setresuid(l, &ua, retval);
717 }
718
719 int
720 linux32_sys_setresgid(l, v, retval)
721 struct lwp *l;
722 void *v;
723 register_t *retval;
724 {
725 struct linux32_sys_setresgid_args /* {
726 syscallarg(gid_t) rgid;
727 syscallarg(gid_t) egid;
728 syscallarg(gid_t) sgid;
729 } */ *uap = v;
730 struct linux_sys_setresgid_args ua;
731
732 SCARG(&ua, rgid) = (SCARG(uap, rgid) == -1) ? -1 : SCARG(uap, rgid);
733 SCARG(&ua, egid) = (SCARG(uap, egid) == -1) ? -1 : SCARG(uap, egid);
734 SCARG(&ua, sgid) = (SCARG(uap, sgid) == -1) ? -1 : SCARG(uap, sgid);
735
736 return linux_sys_setresgid(l, &ua, retval);
737 }
738