linux_misc.c (218030) | linux_misc.c (218031) |
---|---|
1/*- 2 * Copyright (c) 2002 Doug Rabson 3 * Copyright (c) 1994-1995 S�ren Schmidt 4 * 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: --- 14 unchanged lines hidden (view full) --- 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002 Doug Rabson 3 * Copyright (c) 1994-1995 S�ren Schmidt 4 * 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: --- 14 unchanged lines hidden (view full) --- 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/compat/linux/linux_misc.c 218030 2011-01-28 18:47:07Z dchagin $"); | 31__FBSDID("$FreeBSD: head/sys/compat/linux/linux_misc.c 218031 2011-01-28 19:04:15Z dchagin $"); |
32 33#include "opt_compat.h" 34 35#include <sys/param.h> 36#include <sys/blist.h> 37#include <sys/fcntl.h> 38#if defined(__i386__) 39#include <sys/imgact_aout.h> --- 115 unchanged lines hidden (view full) --- 155 156 sysinfo.procs = nprocs; 157 158 /* The following are only present in newer Linux kernels. */ 159 sysinfo.totalbig = 0; 160 sysinfo.freebig = 0; 161 sysinfo.mem_unit = 1; 162 | 32 33#include "opt_compat.h" 34 35#include <sys/param.h> 36#include <sys/blist.h> 37#include <sys/fcntl.h> 38#if defined(__i386__) 39#include <sys/imgact_aout.h> --- 115 unchanged lines hidden (view full) --- 155 156 sysinfo.procs = nprocs; 157 158 /* The following are only present in newer Linux kernels. */ 159 sysinfo.totalbig = 0; 160 sysinfo.freebig = 0; 161 sysinfo.mem_unit = 1; 162 |
163 return copyout(&sysinfo, args->info, sizeof(sysinfo)); | 163 return (copyout(&sysinfo, args->info, sizeof(sysinfo))); |
164} 165 166int 167linux_alarm(struct thread *td, struct linux_alarm_args *args) 168{ 169 struct itimerval it, old_it; 170 u_int secs; 171 int error; --- 39 unchanged lines hidden (view full) --- 211 old = (vm_offset_t)vm->vm_daddr + ctob(vm->vm_dsize); 212 new = (vm_offset_t)args->dsend; 213 tmp.nsize = (char *)new; 214 if (((caddr_t)new > vm->vm_daddr) && !obreak(td, &tmp)) 215 td->td_retval[0] = (long)new; 216 else 217 td->td_retval[0] = (long)old; 218 | 164} 165 166int 167linux_alarm(struct thread *td, struct linux_alarm_args *args) 168{ 169 struct itimerval it, old_it; 170 u_int secs; 171 int error; --- 39 unchanged lines hidden (view full) --- 211 old = (vm_offset_t)vm->vm_daddr + ctob(vm->vm_dsize); 212 new = (vm_offset_t)args->dsend; 213 tmp.nsize = (char *)new; 214 if (((caddr_t)new > vm->vm_daddr) && !obreak(td, &tmp)) 215 td->td_retval[0] = (long)new; 216 else 217 td->td_retval[0] = (long)old; 218 |
219 return 0; | 219 return (0); |
220} 221 222#if defined(__i386__) 223/* XXX: what about amd64/linux32? */ 224 225int 226linux_uselib(struct thread *td, struct linux_uselib_args *args) 227{ --- 235 unchanged lines hidden (view full) --- 463 VFS_UNLOCK_GIANT(vfslocked); 464 } 465 466 /* Release the kernel mapping. */ 467 if (a_out) 468 vm_map_remove(kernel_map, (vm_offset_t)a_out, 469 (vm_offset_t)a_out + PAGE_SIZE); 470 | 220} 221 222#if defined(__i386__) 223/* XXX: what about amd64/linux32? */ 224 225int 226linux_uselib(struct thread *td, struct linux_uselib_args *args) 227{ --- 235 unchanged lines hidden (view full) --- 463 VFS_UNLOCK_GIANT(vfslocked); 464 } 465 466 /* Release the kernel mapping. */ 467 if (a_out) 468 vm_map_remove(kernel_map, (vm_offset_t)a_out, 469 (vm_offset_t)a_out + PAGE_SIZE); 470 |
471 return error; | 471 return (error); |
472} 473 474#endif /* __i386__ */ 475 476int 477linux_select(struct thread *td, struct linux_select_args *args) 478{ 479 l_timeval ltv; --- 77 unchanged lines hidden (view full) --- 557 goto select_out; 558 } 559 560select_out: 561#ifdef DEBUG 562 if (ldebug(select)) 563 printf(LMSG("select_out -> %d"), error); 564#endif | 472} 473 474#endif /* __i386__ */ 475 476int 477linux_select(struct thread *td, struct linux_select_args *args) 478{ 479 l_timeval ltv; --- 77 unchanged lines hidden (view full) --- 557 goto select_out; 558 } 559 560select_out: 561#ifdef DEBUG 562 if (ldebug(select)) 563 printf(LMSG("select_out -> %d"), error); 564#endif |
565 return error; | 565 return (error); |
566} 567 568int 569linux_mremap(struct thread *td, struct linux_mremap_args *args) 570{ 571 struct munmap_args /* { 572 void *addr; 573 size_t len; --- 23 unchanged lines hidden (view full) --- 597 return (EINVAL); 598 } 599 600 args->new_len = round_page(args->new_len); 601 args->old_len = round_page(args->old_len); 602 603 if (args->new_len > args->old_len) { 604 td->td_retval[0] = 0; | 566} 567 568int 569linux_mremap(struct thread *td, struct linux_mremap_args *args) 570{ 571 struct munmap_args /* { 572 void *addr; 573 size_t len; --- 23 unchanged lines hidden (view full) --- 597 return (EINVAL); 598 } 599 600 args->new_len = round_page(args->new_len); 601 args->old_len = round_page(args->old_len); 602 603 if (args->new_len > args->old_len) { 604 td->td_retval[0] = 0; |
605 return ENOMEM; | 605 return (ENOMEM); |
606 } 607 608 if (args->new_len < args->old_len) { 609 bsd_args.addr = 610 (caddr_t)((uintptr_t)args->addr + args->new_len); 611 bsd_args.len = args->old_len - args->new_len; 612 error = munmap(td, &bsd_args); 613 } 614 615 td->td_retval[0] = error ? 0 : (uintptr_t)args->addr; | 606 } 607 608 if (args->new_len < args->old_len) { 609 bsd_args.addr = 610 (caddr_t)((uintptr_t)args->addr + args->new_len); 611 bsd_args.len = args->old_len - args->new_len; 612 error = munmap(td, &bsd_args); 613 } 614 615 td->td_retval[0] = error ? 0 : (uintptr_t)args->addr; |
616 return error; | 616 return (error); |
617} 618 619#define LINUX_MS_ASYNC 0x0001 620#define LINUX_MS_INVALIDATE 0x0002 621#define LINUX_MS_SYNC 0x0004 622 623int 624linux_msync(struct thread *td, struct linux_msync_args *args) 625{ 626 struct msync_args bsd_args; 627 628 bsd_args.addr = (caddr_t)(uintptr_t)args->addr; 629 bsd_args.len = (uintptr_t)args->len; 630 bsd_args.flags = args->fl & ~LINUX_MS_SYNC; 631 | 617} 618 619#define LINUX_MS_ASYNC 0x0001 620#define LINUX_MS_INVALIDATE 0x0002 621#define LINUX_MS_SYNC 0x0004 622 623int 624linux_msync(struct thread *td, struct linux_msync_args *args) 625{ 626 struct msync_args bsd_args; 627 628 bsd_args.addr = (caddr_t)(uintptr_t)args->addr; 629 bsd_args.len = (uintptr_t)args->len; 630 bsd_args.flags = args->fl & ~LINUX_MS_SYNC; 631 |
632 return msync(td, &bsd_args); | 632 return (msync(td, &bsd_args)); |
633} 634 635int 636linux_time(struct thread *td, struct linux_time_args *args) 637{ 638 struct timeval tv; 639 l_time_t tm; 640 int error; 641 642#ifdef DEBUG 643 if (ldebug(time)) 644 printf(ARGS(time, "*")); 645#endif 646 647 microtime(&tv); 648 tm = tv.tv_sec; 649 if (args->tm && (error = copyout(&tm, args->tm, sizeof(tm)))) | 633} 634 635int 636linux_time(struct thread *td, struct linux_time_args *args) 637{ 638 struct timeval tv; 639 l_time_t tm; 640 int error; 641 642#ifdef DEBUG 643 if (ldebug(time)) 644 printf(ARGS(time, "*")); 645#endif 646 647 microtime(&tv); 648 tm = tv.tv_sec; 649 if (args->tm && (error = copyout(&tm, args->tm, sizeof(tm)))) |
650 return error; | 650 return (error); |
651 td->td_retval[0] = tm; | 651 td->td_retval[0] = tm; |
652 return 0; | 652 return (0); |
653} 654 655struct l_times_argv { 656 l_clock_t tms_utime; 657 l_clock_t tms_stime; 658 l_clock_t tms_cutime; 659 l_clock_t tms_cstime; 660}; --- 36 unchanged lines hidden (view full) --- 697 698 tms.tms_utime = CONVTCK(utime); 699 tms.tms_stime = CONVTCK(stime); 700 701 tms.tms_cutime = CONVTCK(cutime); 702 tms.tms_cstime = CONVTCK(cstime); 703 704 if ((error = copyout(&tms, args->buf, sizeof(tms)))) | 653} 654 655struct l_times_argv { 656 l_clock_t tms_utime; 657 l_clock_t tms_stime; 658 l_clock_t tms_cutime; 659 l_clock_t tms_cstime; 660}; --- 36 unchanged lines hidden (view full) --- 697 698 tms.tms_utime = CONVTCK(utime); 699 tms.tms_stime = CONVTCK(stime); 700 701 tms.tms_cutime = CONVTCK(cutime); 702 tms.tms_cstime = CONVTCK(cstime); 703 704 if ((error = copyout(&tms, args->buf, sizeof(tms)))) |
705 return error; | 705 return (error); |
706 } 707 708 microuptime(&tv); 709 td->td_retval[0] = (int)CONVTCK(tv); | 706 } 707 708 microuptime(&tv); 709 td->td_retval[0] = (int)CONVTCK(tv); |
710 return 0; | 710 return (0); |
711} 712 713int 714linux_newuname(struct thread *td, struct linux_newuname_args *args) 715{ 716 struct l_new_utsname utsname; 717 char osname[LINUX_MAX_UTSNAME]; 718 char osrelease[LINUX_MAX_UTSNAME]; --- 42 unchanged lines hidden (view full) --- 761#ifdef DEBUG 762 if (ldebug(utime)) 763 printf(ARGS(utime, "%s, *"), fname); 764#endif 765 766 if (args->times) { 767 if ((error = copyin(args->times, &lut, sizeof lut))) { 768 LFREEPATH(fname); | 711} 712 713int 714linux_newuname(struct thread *td, struct linux_newuname_args *args) 715{ 716 struct l_new_utsname utsname; 717 char osname[LINUX_MAX_UTSNAME]; 718 char osrelease[LINUX_MAX_UTSNAME]; --- 42 unchanged lines hidden (view full) --- 761#ifdef DEBUG 762 if (ldebug(utime)) 763 printf(ARGS(utime, "%s, *"), fname); 764#endif 765 766 if (args->times) { 767 if ((error = copyin(args->times, &lut, sizeof lut))) { 768 LFREEPATH(fname); |
769 return error; | 769 return (error); |
770 } 771 tv[0].tv_sec = lut.l_actime; 772 tv[0].tv_usec = 0; 773 tv[1].tv_sec = lut.l_modtime; 774 tv[1].tv_usec = 0; 775 tvp = tv; 776 } else 777 tvp = NULL; --- 220 unchanged lines hidden (view full) --- 998int 999linux_personality(struct thread *td, struct linux_personality_args *args) 1000{ 1001#ifdef DEBUG 1002 if (ldebug(personality)) 1003 printf(ARGS(personality, "%lu"), (unsigned long)args->per); 1004#endif 1005 if (args->per != 0) | 770 } 771 tv[0].tv_sec = lut.l_actime; 772 tv[0].tv_usec = 0; 773 tv[1].tv_sec = lut.l_modtime; 774 tv[1].tv_usec = 0; 775 tvp = tv; 776 } else 777 tvp = NULL; --- 220 unchanged lines hidden (view full) --- 998int 999linux_personality(struct thread *td, struct linux_personality_args *args) 1000{ 1001#ifdef DEBUG 1002 if (ldebug(personality)) 1003 printf(ARGS(personality, "%lu"), (unsigned long)args->per); 1004#endif 1005 if (args->per != 0) |
1006 return EINVAL; | 1006 return (EINVAL); |
1007 1008 /* Yes Jim, it's still a Linux... */ 1009 td->td_retval[0] = 0; | 1007 1008 /* Yes Jim, it's still a Linux... */ 1009 td->td_retval[0] = 0; |
1010 return 0; | 1010 return (0); |
1011} 1012 1013struct l_itimerval { 1014 l_timeval it_interval; 1015 l_timeval it_value; 1016}; 1017 1018#define B2L_ITIMERVAL(bip, lip) \ --- 61 unchanged lines hidden (view full) --- 1080int 1081linux_nice(struct thread *td, struct linux_nice_args *args) 1082{ 1083 struct setpriority_args bsd_args; 1084 1085 bsd_args.which = PRIO_PROCESS; 1086 bsd_args.who = 0; /* current process */ 1087 bsd_args.prio = args->inc; | 1011} 1012 1013struct l_itimerval { 1014 l_timeval it_interval; 1015 l_timeval it_value; 1016}; 1017 1018#define B2L_ITIMERVAL(bip, lip) \ --- 61 unchanged lines hidden (view full) --- 1080int 1081linux_nice(struct thread *td, struct linux_nice_args *args) 1082{ 1083 struct setpriority_args bsd_args; 1084 1085 bsd_args.which = PRIO_PROCESS; 1086 bsd_args.who = 0; /* current process */ 1087 bsd_args.prio = args->inc; |
1088 return setpriority(td, &bsd_args); | 1088 return (setpriority(td, &bsd_args)); |
1089} 1090 1091int 1092linux_setgroups(struct thread *td, struct linux_setgroups_args *args) 1093{ 1094 struct ucred *newcred, *oldcred; 1095 l_gid_t *linux_gidset; 1096 gid_t *bsd_gidset; --- 210 unchanged lines hidden (view full) --- 1307 break; 1308 case LINUX_SCHED_FIFO: 1309 bsd.policy = SCHED_FIFO; 1310 break; 1311 case LINUX_SCHED_RR: 1312 bsd.policy = SCHED_RR; 1313 break; 1314 default: | 1089} 1090 1091int 1092linux_setgroups(struct thread *td, struct linux_setgroups_args *args) 1093{ 1094 struct ucred *newcred, *oldcred; 1095 l_gid_t *linux_gidset; 1096 gid_t *bsd_gidset; --- 210 unchanged lines hidden (view full) --- 1307 break; 1308 case LINUX_SCHED_FIFO: 1309 bsd.policy = SCHED_FIFO; 1310 break; 1311 case LINUX_SCHED_RR: 1312 bsd.policy = SCHED_RR; 1313 break; 1314 default: |
1315 return EINVAL; | 1315 return (EINVAL); |
1316 } 1317 1318 bsd.pid = args->pid; 1319 bsd.param = (struct sched_param *)args->param; | 1316 } 1317 1318 bsd.pid = args->pid; 1319 bsd.param = (struct sched_param *)args->param; |
1320 return sched_setscheduler(td, &bsd); | 1320 return (sched_setscheduler(td, &bsd)); |
1321} 1322 1323int 1324linux_sched_getscheduler(struct thread *td, 1325 struct linux_sched_getscheduler_args *args) 1326{ 1327 struct sched_getscheduler_args bsd; 1328 int error; --- 13 unchanged lines hidden (view full) --- 1342 case SCHED_FIFO: 1343 td->td_retval[0] = LINUX_SCHED_FIFO; 1344 break; 1345 case SCHED_RR: 1346 td->td_retval[0] = LINUX_SCHED_RR; 1347 break; 1348 } 1349 | 1321} 1322 1323int 1324linux_sched_getscheduler(struct thread *td, 1325 struct linux_sched_getscheduler_args *args) 1326{ 1327 struct sched_getscheduler_args bsd; 1328 int error; --- 13 unchanged lines hidden (view full) --- 1342 case SCHED_FIFO: 1343 td->td_retval[0] = LINUX_SCHED_FIFO; 1344 break; 1345 case SCHED_RR: 1346 td->td_retval[0] = LINUX_SCHED_RR; 1347 break; 1348 } 1349 |
1350 return error; | 1350 return (error); |
1351} 1352 1353int 1354linux_sched_get_priority_max(struct thread *td, 1355 struct linux_sched_get_priority_max_args *args) 1356{ 1357 struct sched_get_priority_max_args bsd; 1358 --- 8 unchanged lines hidden (view full) --- 1367 break; 1368 case LINUX_SCHED_FIFO: 1369 bsd.policy = SCHED_FIFO; 1370 break; 1371 case LINUX_SCHED_RR: 1372 bsd.policy = SCHED_RR; 1373 break; 1374 default: | 1351} 1352 1353int 1354linux_sched_get_priority_max(struct thread *td, 1355 struct linux_sched_get_priority_max_args *args) 1356{ 1357 struct sched_get_priority_max_args bsd; 1358 --- 8 unchanged lines hidden (view full) --- 1367 break; 1368 case LINUX_SCHED_FIFO: 1369 bsd.policy = SCHED_FIFO; 1370 break; 1371 case LINUX_SCHED_RR: 1372 bsd.policy = SCHED_RR; 1373 break; 1374 default: |
1375 return EINVAL; | 1375 return (EINVAL); |
1376 } | 1376 } |
1377 return sched_get_priority_max(td, &bsd); | 1377 return (sched_get_priority_max(td, &bsd)); |
1378} 1379 1380int 1381linux_sched_get_priority_min(struct thread *td, 1382 struct linux_sched_get_priority_min_args *args) 1383{ 1384 struct sched_get_priority_min_args bsd; 1385 --- 8 unchanged lines hidden (view full) --- 1394 break; 1395 case LINUX_SCHED_FIFO: 1396 bsd.policy = SCHED_FIFO; 1397 break; 1398 case LINUX_SCHED_RR: 1399 bsd.policy = SCHED_RR; 1400 break; 1401 default: | 1378} 1379 1380int 1381linux_sched_get_priority_min(struct thread *td, 1382 struct linux_sched_get_priority_min_args *args) 1383{ 1384 struct sched_get_priority_min_args bsd; 1385 --- 8 unchanged lines hidden (view full) --- 1394 break; 1395 case LINUX_SCHED_FIFO: 1396 bsd.policy = SCHED_FIFO; 1397 break; 1398 case LINUX_SCHED_RR: 1399 bsd.policy = SCHED_RR; 1400 break; 1401 default: |
1402 return EINVAL; | 1402 return (EINVAL); |
1403 } | 1403 } |
1404 return sched_get_priority_min(td, &bsd); | 1404 return (sched_get_priority_min(td, &bsd)); |
1405} 1406 1407#define REBOOT_CAD_ON 0x89abcdef 1408#define REBOOT_CAD_OFF 0 1409#define REBOOT_HALT 0xcdef0123 1410#define REBOOT_RESTART 0x01234567 1411#define REBOOT_RESTART2 0xA1B2C3D4 1412#define REBOOT_POWEROFF 0x4321FEDC --- 8 unchanged lines hidden (view full) --- 1421 struct reboot_args bsd_args; 1422 1423#ifdef DEBUG 1424 if (ldebug(reboot)) 1425 printf(ARGS(reboot, "0x%x"), args->cmd); 1426#endif 1427 1428 if (args->magic1 != REBOOT_MAGIC1) | 1405} 1406 1407#define REBOOT_CAD_ON 0x89abcdef 1408#define REBOOT_CAD_OFF 0 1409#define REBOOT_HALT 0xcdef0123 1410#define REBOOT_RESTART 0x01234567 1411#define REBOOT_RESTART2 0xA1B2C3D4 1412#define REBOOT_POWEROFF 0x4321FEDC --- 8 unchanged lines hidden (view full) --- 1421 struct reboot_args bsd_args; 1422 1423#ifdef DEBUG 1424 if (ldebug(reboot)) 1425 printf(ARGS(reboot, "0x%x"), args->cmd); 1426#endif 1427 1428 if (args->magic1 != REBOOT_MAGIC1) |
1429 return EINVAL; | 1429 return (EINVAL); |
1430 1431 switch (args->magic2) { 1432 case REBOOT_MAGIC2: 1433 case REBOOT_MAGIC2A: 1434 case REBOOT_MAGIC2B: 1435 break; 1436 default: | 1430 1431 switch (args->magic2) { 1432 case REBOOT_MAGIC2: 1433 case REBOOT_MAGIC2A: 1434 case REBOOT_MAGIC2B: 1435 break; 1436 default: |
1437 return EINVAL; | 1437 return (EINVAL); |
1438 } 1439 1440 switch (args->cmd) { 1441 case REBOOT_CAD_ON: 1442 case REBOOT_CAD_OFF: 1443 return (priv_check(td, PRIV_REBOOT)); 1444 case REBOOT_HALT: 1445 bsd_args.opt = RB_HALT; 1446 break; 1447 case REBOOT_RESTART: 1448 case REBOOT_RESTART2: 1449 bsd_args.opt = 0; 1450 break; 1451 case REBOOT_POWEROFF: 1452 bsd_args.opt = RB_POWEROFF; 1453 break; 1454 default: | 1438 } 1439 1440 switch (args->cmd) { 1441 case REBOOT_CAD_ON: 1442 case REBOOT_CAD_OFF: 1443 return (priv_check(td, PRIV_REBOOT)); 1444 case REBOOT_HALT: 1445 bsd_args.opt = RB_HALT; 1446 break; 1447 case REBOOT_RESTART: 1448 case REBOOT_RESTART2: 1449 bsd_args.opt = 0; 1450 break; 1451 case REBOOT_POWEROFF: 1452 bsd_args.opt = RB_POWEROFF; 1453 break; 1454 default: |
1455 return EINVAL; | 1455 return (EINVAL); |
1456 } | 1456 } |
1457 return reboot(td, &bsd_args); | 1457 return (reboot(td, &bsd_args)); |
1458} 1459 1460 1461/* 1462 * The FreeBSD native getpid(2), getgid(2) and getuid(2) also modify 1463 * td->td_retval[1] when COMPAT_43 is defined. This clobbers registers that 1464 * are assumed to be preserved. The following lightweight syscalls fixes 1465 * this. See also linux_getgid16() and linux_getuid16() in linux_uid16.c --- 121 unchanged lines hidden (view full) --- 1587 struct getsid_args bsd; 1588 1589#ifdef DEBUG 1590 if (ldebug(getsid)) 1591 printf(ARGS(getsid, "%i"), args->pid); 1592#endif 1593 1594 bsd.pid = args->pid; | 1458} 1459 1460 1461/* 1462 * The FreeBSD native getpid(2), getgid(2) and getuid(2) also modify 1463 * td->td_retval[1] when COMPAT_43 is defined. This clobbers registers that 1464 * are assumed to be preserved. The following lightweight syscalls fixes 1465 * this. See also linux_getgid16() and linux_getuid16() in linux_uid16.c --- 121 unchanged lines hidden (view full) --- 1587 struct getsid_args bsd; 1588 1589#ifdef DEBUG 1590 if (ldebug(getsid)) 1591 printf(ARGS(getsid, "%i"), args->pid); 1592#endif 1593 1594 bsd.pid = args->pid; |
1595 return getsid(td, &bsd); | 1595 return (getsid(td, &bsd)); |
1596} 1597 1598int 1599linux_nosys(struct thread *td, struct nosys_args *ignore) 1600{ 1601 1602 return (ENOSYS); 1603} --- 8 unchanged lines hidden (view full) --- 1612 if (ldebug(getpriority)) 1613 printf(ARGS(getpriority, "%i, %i"), args->which, args->who); 1614#endif 1615 1616 bsd_args.which = args->which; 1617 bsd_args.who = args->who; 1618 error = getpriority(td, &bsd_args); 1619 td->td_retval[0] = 20 - td->td_retval[0]; | 1596} 1597 1598int 1599linux_nosys(struct thread *td, struct nosys_args *ignore) 1600{ 1601 1602 return (ENOSYS); 1603} --- 8 unchanged lines hidden (view full) --- 1612 if (ldebug(getpriority)) 1613 printf(ARGS(getpriority, "%i, %i"), args->which, args->who); 1614#endif 1615 1616 bsd_args.which = args->which; 1617 bsd_args.who = args->who; 1618 error = getpriority(td, &bsd_args); 1619 td->td_retval[0] = 20 - td->td_retval[0]; |
1620 return error; | 1620 return (error); |
1621} 1622 1623int 1624linux_sethostname(struct thread *td, struct linux_sethostname_args *args) 1625{ 1626 int name[2]; 1627 1628#ifdef DEBUG --- 189 unchanged lines hidden --- | 1621} 1622 1623int 1624linux_sethostname(struct thread *td, struct linux_sethostname_args *args) 1625{ 1626 int name[2]; 1627 1628#ifdef DEBUG --- 189 unchanged lines hidden --- |