freebsd32_misc.c (205322) | freebsd32_misc.c (205323) |
---|---|
1/*- 2 * Copyright (c) 2002 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/compat/freebsd32/freebsd32_misc.c 205322 2010-03-19 11:01:51Z kib $"); | 28__FBSDID("$FreeBSD: head/sys/compat/freebsd32/freebsd32_misc.c 205323 2010-03-19 11:04:42Z kib $"); |
29 30#include "opt_compat.h" 31#include "opt_inet.h" 32#include "opt_inet6.h" 33 34#define __ELF_WORD_SIZE 32 35 36#include <sys/param.h> --- 1360 unchanged lines hidden (view full) --- 1397 return (error); 1398 copy_statfs(&s, &s32); 1399 return (copyout(&s32, uap->buf, sizeof(s32))); 1400} 1401#endif 1402 1403 1404int | 29 30#include "opt_compat.h" 31#include "opt_inet.h" 32#include "opt_inet6.h" 33 34#define __ELF_WORD_SIZE 32 35 36#include <sys/param.h> --- 1360 unchanged lines hidden (view full) --- 1397 return (error); 1398 copy_statfs(&s, &s32); 1399 return (copyout(&s32, uap->buf, sizeof(s32))); 1400} 1401#endif 1402 1403 1404int |
1405freebsd32_semsys(struct thread *td, struct freebsd32_semsys_args *uap) 1406{ 1407 1408#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1409 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) 1410 switch (uap->which) { 1411 case 0: 1412 return (freebsd7_freebsd32_semctl(td, 1413 (struct freebsd7_freebsd32_semctl_args *)&uap->a2)); 1414 default: 1415 return (semsys(td, (struct semsys_args *)uap)); 1416 } 1417#else 1418 return (nosys(td, NULL)); 1419#endif 1420} 1421 1422#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1423 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) 1424int 1425freebsd7_freebsd32_semctl(struct thread *td, 1426 struct freebsd7_freebsd32_semctl_args *uap) 1427{ 1428 struct semid_ds32_old dsbuf32; 1429 struct semid_ds dsbuf; 1430 union semun semun; 1431 union semun32 arg; 1432 register_t rval; 1433 int error; 1434 1435 switch (uap->cmd) { 1436 case SEM_STAT: 1437 case IPC_SET: 1438 case IPC_STAT: 1439 case GETALL: 1440 case SETVAL: 1441 case SETALL: 1442 error = copyin(uap->arg, &arg, sizeof(arg)); 1443 if (error) 1444 return (error); 1445 break; 1446 } 1447 1448 switch (uap->cmd) { 1449 case SEM_STAT: 1450 case IPC_STAT: 1451 semun.buf = &dsbuf; 1452 break; 1453 case IPC_SET: 1454 error = copyin(PTRIN(arg.buf), &dsbuf32, sizeof(dsbuf32)); 1455 if (error) 1456 return (error); 1457 freebsd32_ipcperm_old_in(&dsbuf32.sem_perm, &dsbuf.sem_perm); 1458 PTRIN_CP(dsbuf32, dsbuf, sem_base); 1459 CP(dsbuf32, dsbuf, sem_nsems); 1460 CP(dsbuf32, dsbuf, sem_otime); 1461 CP(dsbuf32, dsbuf, sem_ctime); 1462 semun.buf = &dsbuf; 1463 break; 1464 case GETALL: 1465 case SETALL: 1466 semun.array = PTRIN(arg.array); 1467 break; 1468 case SETVAL: 1469 semun.val = arg.val; 1470 break; 1471 } 1472 1473 error = kern_semctl(td, uap->semid, uap->semnum, uap->cmd, &semun, 1474 &rval); 1475 if (error) 1476 return (error); 1477 1478 switch (uap->cmd) { 1479 case SEM_STAT: 1480 case IPC_STAT: 1481 bzero(&dsbuf32, sizeof(dsbuf32)); 1482 freebsd32_ipcperm_old_out(&dsbuf.sem_perm, &dsbuf32.sem_perm); 1483 PTROUT_CP(dsbuf, dsbuf32, sem_base); 1484 CP(dsbuf, dsbuf32, sem_nsems); 1485 CP(dsbuf, dsbuf32, sem_otime); 1486 CP(dsbuf, dsbuf32, sem_ctime); 1487 error = copyout(&dsbuf32, PTRIN(arg.buf), sizeof(dsbuf32)); 1488 break; 1489 } 1490 1491 if (error == 0) 1492 td->td_retval[0] = rval; 1493 return (error); 1494} 1495#endif 1496 1497int 1498freebsd32_semctl(struct thread *td, struct freebsd32_semctl_args *uap) 1499{ 1500 struct semid_ds32 dsbuf32; 1501 struct semid_ds dsbuf; 1502 union semun semun; 1503 union semun32 arg; 1504 register_t rval; 1505 int error; 1506 1507 switch (uap->cmd) { 1508 case SEM_STAT: 1509 case IPC_SET: 1510 case IPC_STAT: 1511 case GETALL: 1512 case SETVAL: 1513 case SETALL: 1514 error = copyin(uap->arg, &arg, sizeof(arg)); 1515 if (error) 1516 return (error); 1517 break; 1518 } 1519 1520 switch (uap->cmd) { 1521 case SEM_STAT: 1522 case IPC_STAT: 1523 semun.buf = &dsbuf; 1524 break; 1525 case IPC_SET: 1526 error = copyin(PTRIN(arg.buf), &dsbuf32, sizeof(dsbuf32)); 1527 if (error) 1528 return (error); 1529 freebsd32_ipcperm_in(&dsbuf32.sem_perm, &dsbuf.sem_perm); 1530 PTRIN_CP(dsbuf32, dsbuf, sem_base); 1531 CP(dsbuf32, dsbuf, sem_nsems); 1532 CP(dsbuf32, dsbuf, sem_otime); 1533 CP(dsbuf32, dsbuf, sem_ctime); 1534 semun.buf = &dsbuf; 1535 break; 1536 case GETALL: 1537 case SETALL: 1538 semun.array = PTRIN(arg.array); 1539 break; 1540 case SETVAL: 1541 semun.val = arg.val; 1542 break; 1543 } 1544 1545 error = kern_semctl(td, uap->semid, uap->semnum, uap->cmd, &semun, 1546 &rval); 1547 if (error) 1548 return (error); 1549 1550 switch (uap->cmd) { 1551 case SEM_STAT: 1552 case IPC_STAT: 1553 bzero(&dsbuf32, sizeof(dsbuf32)); 1554 freebsd32_ipcperm_out(&dsbuf.sem_perm, &dsbuf32.sem_perm); 1555 PTROUT_CP(dsbuf, dsbuf32, sem_base); 1556 CP(dsbuf, dsbuf32, sem_nsems); 1557 CP(dsbuf, dsbuf32, sem_otime); 1558 CP(dsbuf, dsbuf32, sem_ctime); 1559 error = copyout(&dsbuf32, PTRIN(arg.buf), sizeof(dsbuf32)); 1560 break; 1561 } 1562 1563 if (error == 0) 1564 td->td_retval[0] = rval; 1565 return (error); 1566} 1567 1568int 1569freebsd32_msgsys(struct thread *td, struct freebsd32_msgsys_args *uap) 1570{ 1571 1572#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1573 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) 1574 switch (uap->which) { 1575 case 0: 1576 return (freebsd7_freebsd32_msgctl(td, 1577 (struct freebsd7_freebsd32_msgctl_args *)&uap->a2)); 1578 case 2: 1579 return (freebsd32_msgsnd(td, 1580 (struct freebsd32_msgsnd_args *)&uap->a2)); 1581 case 3: 1582 return (freebsd32_msgrcv(td, 1583 (struct freebsd32_msgrcv_args *)&uap->a2)); 1584 default: 1585 return (msgsys(td, (struct msgsys_args *)uap)); 1586 } 1587#else 1588 return (nosys(td, NULL)); 1589#endif 1590} 1591 1592#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1593 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) 1594int 1595freebsd7_freebsd32_msgctl(struct thread *td, 1596 struct freebsd7_freebsd32_msgctl_args *uap) 1597{ 1598 struct msqid_ds msqbuf; 1599 struct msqid_ds32_old msqbuf32; 1600 int error; 1601 1602 if (uap->cmd == IPC_SET) { 1603 error = copyin(uap->buf, &msqbuf32, sizeof(msqbuf32)); 1604 if (error) 1605 return (error); 1606 freebsd32_ipcperm_old_in(&msqbuf32.msg_perm, &msqbuf.msg_perm); 1607 PTRIN_CP(msqbuf32, msqbuf, msg_first); 1608 PTRIN_CP(msqbuf32, msqbuf, msg_last); 1609 CP(msqbuf32, msqbuf, msg_cbytes); 1610 CP(msqbuf32, msqbuf, msg_qnum); 1611 CP(msqbuf32, msqbuf, msg_qbytes); 1612 CP(msqbuf32, msqbuf, msg_lspid); 1613 CP(msqbuf32, msqbuf, msg_lrpid); 1614 CP(msqbuf32, msqbuf, msg_stime); 1615 CP(msqbuf32, msqbuf, msg_rtime); 1616 CP(msqbuf32, msqbuf, msg_ctime); 1617 } 1618 error = kern_msgctl(td, uap->msqid, uap->cmd, &msqbuf); 1619 if (error) 1620 return (error); 1621 if (uap->cmd == IPC_STAT) { 1622 bzero(&msqbuf32, sizeof(msqbuf32)); 1623 freebsd32_ipcperm_old_out(&msqbuf.msg_perm, &msqbuf32.msg_perm); 1624 PTROUT_CP(msqbuf, msqbuf32, msg_first); 1625 PTROUT_CP(msqbuf, msqbuf32, msg_last); 1626 CP(msqbuf, msqbuf32, msg_cbytes); 1627 CP(msqbuf, msqbuf32, msg_qnum); 1628 CP(msqbuf, msqbuf32, msg_qbytes); 1629 CP(msqbuf, msqbuf32, msg_lspid); 1630 CP(msqbuf, msqbuf32, msg_lrpid); 1631 CP(msqbuf, msqbuf32, msg_stime); 1632 CP(msqbuf, msqbuf32, msg_rtime); 1633 CP(msqbuf, msqbuf32, msg_ctime); 1634 error = copyout(&msqbuf32, uap->buf, sizeof(struct msqid_ds32)); 1635 } 1636 return (error); 1637} 1638#endif 1639 1640int 1641freebsd32_msgctl(struct thread *td, struct freebsd32_msgctl_args *uap) 1642{ 1643 struct msqid_ds msqbuf; 1644 struct msqid_ds32 msqbuf32; 1645 int error; 1646 1647 if (uap->cmd == IPC_SET) { 1648 error = copyin(uap->buf, &msqbuf32, sizeof(msqbuf32)); 1649 if (error) 1650 return (error); 1651 freebsd32_ipcperm_in(&msqbuf32.msg_perm, &msqbuf.msg_perm); 1652 PTRIN_CP(msqbuf32, msqbuf, msg_first); 1653 PTRIN_CP(msqbuf32, msqbuf, msg_last); 1654 CP(msqbuf32, msqbuf, msg_cbytes); 1655 CP(msqbuf32, msqbuf, msg_qnum); 1656 CP(msqbuf32, msqbuf, msg_qbytes); 1657 CP(msqbuf32, msqbuf, msg_lspid); 1658 CP(msqbuf32, msqbuf, msg_lrpid); 1659 CP(msqbuf32, msqbuf, msg_stime); 1660 CP(msqbuf32, msqbuf, msg_rtime); 1661 CP(msqbuf32, msqbuf, msg_ctime); 1662 } 1663 error = kern_msgctl(td, uap->msqid, uap->cmd, &msqbuf); 1664 if (error) 1665 return (error); 1666 if (uap->cmd == IPC_STAT) { 1667 freebsd32_ipcperm_out(&msqbuf.msg_perm, &msqbuf32.msg_perm); 1668 PTROUT_CP(msqbuf, msqbuf32, msg_first); 1669 PTROUT_CP(msqbuf, msqbuf32, msg_last); 1670 CP(msqbuf, msqbuf32, msg_cbytes); 1671 CP(msqbuf, msqbuf32, msg_qnum); 1672 CP(msqbuf, msqbuf32, msg_qbytes); 1673 CP(msqbuf, msqbuf32, msg_lspid); 1674 CP(msqbuf, msqbuf32, msg_lrpid); 1675 CP(msqbuf, msqbuf32, msg_stime); 1676 CP(msqbuf, msqbuf32, msg_rtime); 1677 CP(msqbuf, msqbuf32, msg_ctime); 1678 error = copyout(&msqbuf32, uap->buf, sizeof(struct msqid_ds32)); 1679 } 1680 return (error); 1681} 1682 1683int 1684freebsd32_msgsnd(struct thread *td, struct freebsd32_msgsnd_args *uap) 1685{ 1686 const void *msgp; 1687 long mtype; 1688 int32_t mtype32; 1689 int error; 1690 1691 msgp = PTRIN(uap->msgp); 1692 if ((error = copyin(msgp, &mtype32, sizeof(mtype32))) != 0) 1693 return (error); 1694 mtype = mtype32; 1695 return (kern_msgsnd(td, uap->msqid, 1696 (const char *)msgp + sizeof(mtype32), 1697 uap->msgsz, uap->msgflg, mtype)); 1698} 1699 1700int 1701freebsd32_msgrcv(struct thread *td, struct freebsd32_msgrcv_args *uap) 1702{ 1703 void *msgp; 1704 long mtype; 1705 int32_t mtype32; 1706 int error; 1707 1708 msgp = PTRIN(uap->msgp); 1709 if ((error = kern_msgrcv(td, uap->msqid, 1710 (char *)msgp + sizeof(mtype32), uap->msgsz, 1711 uap->msgtyp, uap->msgflg, &mtype)) != 0) 1712 return (error); 1713 mtype32 = (int32_t)mtype; 1714 return (copyout(&mtype32, msgp, sizeof(mtype32))); 1715} 1716 1717int 1718freebsd32_shmsys(struct thread *td, struct freebsd32_shmsys_args *uap) 1719{ 1720 1721#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1722 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) 1723 switch (uap->which) { 1724 case 0: { /* shmat */ 1725 struct shmat_args ap; 1726 1727 ap.shmid = uap->a2; 1728 ap.shmaddr = PTRIN(uap->a3); 1729 ap.shmflg = uap->a4; 1730 return (sysent[SYS_shmat].sy_call(td, &ap)); 1731 } 1732 case 2: { /* shmdt */ 1733 struct shmdt_args ap; 1734 1735 ap.shmaddr = PTRIN(uap->a2); 1736 return (sysent[SYS_shmdt].sy_call(td, &ap)); 1737 } 1738 case 3: { /* shmget */ 1739 struct shmget_args ap; 1740 1741 ap.key = uap->a2; 1742 ap.size = uap->a3; 1743 ap.shmflg = uap->a4; 1744 return (sysent[SYS_shmget].sy_call(td, &ap)); 1745 } 1746 case 4: { /* shmctl */ 1747 struct freebsd7_freebsd32_shmctl_args ap; 1748 1749 ap.shmid = uap->a2; 1750 ap.cmd = uap->a3; 1751 ap.buf = PTRIN(uap->a4); 1752 return (freebsd7_freebsd32_shmctl(td, &ap)); 1753 } 1754 case 1: /* oshmctl */ 1755 default: 1756 return (EINVAL); 1757 } 1758#else 1759 return (nosys(td, NULL)); 1760#endif 1761} 1762 1763#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1764 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) 1765int 1766freebsd7_freebsd32_shmctl(struct thread *td, 1767 struct freebsd7_freebsd32_shmctl_args *uap) 1768{ 1769 int error = 0; 1770 union { 1771 struct shmid_ds shmid_ds; 1772 struct shm_info shm_info; 1773 struct shminfo shminfo; 1774 } u; 1775 union { 1776 struct shmid_ds32_old shmid_ds32; 1777 struct shm_info32 shm_info32; 1778 struct shminfo32 shminfo32; 1779 } u32; 1780 size_t sz; 1781 1782 if (uap->cmd == IPC_SET) { 1783 if ((error = copyin(uap->buf, &u32.shmid_ds32, 1784 sizeof(u32.shmid_ds32)))) 1785 goto done; 1786 freebsd32_ipcperm_old_in(&u32.shmid_ds32.shm_perm, 1787 &u.shmid_ds.shm_perm); 1788 CP(u32.shmid_ds32, u.shmid_ds, shm_segsz); 1789 CP(u32.shmid_ds32, u.shmid_ds, shm_lpid); 1790 CP(u32.shmid_ds32, u.shmid_ds, shm_cpid); 1791 CP(u32.shmid_ds32, u.shmid_ds, shm_nattch); 1792 CP(u32.shmid_ds32, u.shmid_ds, shm_atime); 1793 CP(u32.shmid_ds32, u.shmid_ds, shm_dtime); 1794 CP(u32.shmid_ds32, u.shmid_ds, shm_ctime); 1795 } 1796 1797 error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz); 1798 if (error) 1799 goto done; 1800 1801 /* Cases in which we need to copyout */ 1802 switch (uap->cmd) { 1803 case IPC_INFO: 1804 CP(u.shminfo, u32.shminfo32, shmmax); 1805 CP(u.shminfo, u32.shminfo32, shmmin); 1806 CP(u.shminfo, u32.shminfo32, shmmni); 1807 CP(u.shminfo, u32.shminfo32, shmseg); 1808 CP(u.shminfo, u32.shminfo32, shmall); 1809 error = copyout(&u32.shminfo32, uap->buf, 1810 sizeof(u32.shminfo32)); 1811 break; 1812 case SHM_INFO: 1813 CP(u.shm_info, u32.shm_info32, used_ids); 1814 CP(u.shm_info, u32.shm_info32, shm_rss); 1815 CP(u.shm_info, u32.shm_info32, shm_tot); 1816 CP(u.shm_info, u32.shm_info32, shm_swp); 1817 CP(u.shm_info, u32.shm_info32, swap_attempts); 1818 CP(u.shm_info, u32.shm_info32, swap_successes); 1819 error = copyout(&u32.shm_info32, uap->buf, 1820 sizeof(u32.shm_info32)); 1821 break; 1822 case SHM_STAT: 1823 case IPC_STAT: 1824 freebsd32_ipcperm_old_out(&u.shmid_ds.shm_perm, 1825 &u32.shmid_ds32.shm_perm); 1826 if (u.shmid_ds.shm_segsz > INT32_MAX) 1827 u32.shmid_ds32.shm_segsz = INT32_MAX; 1828 else 1829 CP(u.shmid_ds, u32.shmid_ds32, shm_segsz); 1830 CP(u.shmid_ds, u32.shmid_ds32, shm_lpid); 1831 CP(u.shmid_ds, u32.shmid_ds32, shm_cpid); 1832 CP(u.shmid_ds, u32.shmid_ds32, shm_nattch); 1833 CP(u.shmid_ds, u32.shmid_ds32, shm_atime); 1834 CP(u.shmid_ds, u32.shmid_ds32, shm_dtime); 1835 CP(u.shmid_ds, u32.shmid_ds32, shm_ctime); 1836 u32.shmid_ds32.shm_internal = 0; 1837 error = copyout(&u32.shmid_ds32, uap->buf, 1838 sizeof(u32.shmid_ds32)); 1839 break; 1840 } 1841 1842done: 1843 if (error) { 1844 /* Invalidate the return value */ 1845 td->td_retval[0] = -1; 1846 } 1847 return (error); 1848} 1849#endif 1850 1851int 1852freebsd32_shmctl(struct thread *td, struct freebsd32_shmctl_args *uap) 1853{ 1854 int error = 0; 1855 union { 1856 struct shmid_ds shmid_ds; 1857 struct shm_info shm_info; 1858 struct shminfo shminfo; 1859 } u; 1860 union { 1861 struct shmid_ds32 shmid_ds32; 1862 struct shm_info32 shm_info32; 1863 struct shminfo32 shminfo32; 1864 } u32; 1865 size_t sz; 1866 1867 if (uap->cmd == IPC_SET) { 1868 if ((error = copyin(uap->buf, &u32.shmid_ds32, 1869 sizeof(u32.shmid_ds32)))) 1870 goto done; 1871 freebsd32_ipcperm_in(&u32.shmid_ds32.shm_perm, 1872 &u.shmid_ds.shm_perm); 1873 CP(u32.shmid_ds32, u.shmid_ds, shm_segsz); 1874 CP(u32.shmid_ds32, u.shmid_ds, shm_lpid); 1875 CP(u32.shmid_ds32, u.shmid_ds, shm_cpid); 1876 CP(u32.shmid_ds32, u.shmid_ds, shm_nattch); 1877 CP(u32.shmid_ds32, u.shmid_ds, shm_atime); 1878 CP(u32.shmid_ds32, u.shmid_ds, shm_dtime); 1879 CP(u32.shmid_ds32, u.shmid_ds, shm_ctime); 1880 } 1881 1882 error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz); 1883 if (error) 1884 goto done; 1885 1886 /* Cases in which we need to copyout */ 1887 switch (uap->cmd) { 1888 case IPC_INFO: 1889 CP(u.shminfo, u32.shminfo32, shmmax); 1890 CP(u.shminfo, u32.shminfo32, shmmin); 1891 CP(u.shminfo, u32.shminfo32, shmmni); 1892 CP(u.shminfo, u32.shminfo32, shmseg); 1893 CP(u.shminfo, u32.shminfo32, shmall); 1894 error = copyout(&u32.shminfo32, uap->buf, 1895 sizeof(u32.shminfo32)); 1896 break; 1897 case SHM_INFO: 1898 CP(u.shm_info, u32.shm_info32, used_ids); 1899 CP(u.shm_info, u32.shm_info32, shm_rss); 1900 CP(u.shm_info, u32.shm_info32, shm_tot); 1901 CP(u.shm_info, u32.shm_info32, shm_swp); 1902 CP(u.shm_info, u32.shm_info32, swap_attempts); 1903 CP(u.shm_info, u32.shm_info32, swap_successes); 1904 error = copyout(&u32.shm_info32, uap->buf, 1905 sizeof(u32.shm_info32)); 1906 break; 1907 case SHM_STAT: 1908 case IPC_STAT: 1909 freebsd32_ipcperm_out(&u.shmid_ds.shm_perm, 1910 &u32.shmid_ds32.shm_perm); 1911 if (u.shmid_ds.shm_segsz > INT32_MAX) 1912 u32.shmid_ds32.shm_segsz = INT32_MAX; 1913 else 1914 CP(u.shmid_ds, u32.shmid_ds32, shm_segsz); 1915 CP(u.shmid_ds, u32.shmid_ds32, shm_lpid); 1916 CP(u.shmid_ds, u32.shmid_ds32, shm_cpid); 1917 CP(u.shmid_ds, u32.shmid_ds32, shm_nattch); 1918 CP(u.shmid_ds, u32.shmid_ds32, shm_atime); 1919 CP(u.shmid_ds, u32.shmid_ds32, shm_dtime); 1920 CP(u.shmid_ds, u32.shmid_ds32, shm_ctime); 1921 error = copyout(&u32.shmid_ds32, uap->buf, 1922 sizeof(u32.shmid_ds32)); 1923 break; 1924 } 1925 1926done: 1927 if (error) { 1928 /* Invalidate the return value */ 1929 td->td_retval[0] = -1; 1930 } 1931 return (error); 1932} 1933 1934int | |
1935freebsd32_pread(struct thread *td, struct freebsd32_pread_args *uap) 1936{ 1937 struct pread_args ap; 1938 1939 ap.fd = uap->fd; 1940 ap.buf = uap->buf; 1941 ap.nbyte = uap->nbyte; 1942 ap.offset = PAIR32TO64(off_t,uap->offset); --- 1239 unchanged lines hidden --- | 1405freebsd32_pread(struct thread *td, struct freebsd32_pread_args *uap) 1406{ 1407 struct pread_args ap; 1408 1409 ap.fd = uap->fd; 1410 ap.buf = uap->buf; 1411 ap.nbyte = uap->nbyte; 1412 ap.offset = PAIR32TO64(off_t,uap->offset); --- 1239 unchanged lines hidden --- |