freebsd32_misc.c (192895) | freebsd32_misc.c (194910) |
---|---|
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 192895 2009-05-27 14:11:23Z jamie $"); | 28__FBSDID("$FreeBSD: head/sys/compat/freebsd32/freebsd32_misc.c 194910 2009-06-24 21:10:52Z jhb $"); |
29 30#include "opt_compat.h" 31#include "opt_inet.h" 32#include "opt_inet6.h" 33 34#include <sys/param.h> 35#include <sys/bus.h> 36#include <sys/clock.h> --- 1311 unchanged lines hidden (view full) --- 1348 error = kern_fhstatfs(td, fh, &s); 1349 if (error) 1350 return (error); 1351 copy_statfs(&s, &s32); 1352 return (copyout(&s32, uap->buf, sizeof(s32))); 1353} 1354#endif 1355 | 29 30#include "opt_compat.h" 31#include "opt_inet.h" 32#include "opt_inet6.h" 33 34#include <sys/param.h> 35#include <sys/bus.h> 36#include <sys/clock.h> --- 1311 unchanged lines hidden (view full) --- 1348 error = kern_fhstatfs(td, fh, &s); 1349 if (error) 1350 return (error); 1351 copy_statfs(&s, &s32); 1352 return (copyout(&s32, uap->buf, sizeof(s32))); 1353} 1354#endif 1355 |
1356#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1357 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) |
|
1356static void | 1358static void |
1359freebsd32_ipcperm_old_in(struct ipc_perm32_old *ip32, struct ipc_perm *ip) 1360{ 1361 1362 CP(*ip32, *ip, cuid); 1363 CP(*ip32, *ip, cgid); 1364 CP(*ip32, *ip, uid); 1365 CP(*ip32, *ip, gid); 1366 CP(*ip32, *ip, mode); 1367 CP(*ip32, *ip, seq); 1368 CP(*ip32, *ip, key); 1369} 1370 1371static void 1372freebsd32_ipcperm_old_out(struct ipc_perm *ip, struct ipc_perm32_old *ip32) 1373{ 1374 1375 CP(*ip, *ip32, cuid); 1376 CP(*ip, *ip32, cgid); 1377 CP(*ip, *ip32, uid); 1378 CP(*ip, *ip32, gid); 1379 CP(*ip, *ip32, mode); 1380 CP(*ip, *ip32, seq); 1381 CP(*ip, *ip32, key); 1382} 1383#endif 1384 1385static void |
|
1357freebsd32_ipcperm_in(struct ipc_perm32 *ip32, struct ipc_perm *ip) 1358{ 1359 1360 CP(*ip32, *ip, cuid); 1361 CP(*ip32, *ip, cgid); 1362 CP(*ip32, *ip, uid); 1363 CP(*ip32, *ip, gid); 1364 CP(*ip32, *ip, mode); --- 13 unchanged lines hidden (view full) --- 1378 CP(*ip, *ip32, seq); 1379 CP(*ip, *ip32, key); 1380} 1381 1382int 1383freebsd32_semsys(struct thread *td, struct freebsd32_semsys_args *uap) 1384{ 1385 | 1386freebsd32_ipcperm_in(struct ipc_perm32 *ip32, struct ipc_perm *ip) 1387{ 1388 1389 CP(*ip32, *ip, cuid); 1390 CP(*ip32, *ip, cgid); 1391 CP(*ip32, *ip, uid); 1392 CP(*ip32, *ip, gid); 1393 CP(*ip32, *ip, mode); --- 13 unchanged lines hidden (view full) --- 1407 CP(*ip, *ip32, seq); 1408 CP(*ip, *ip32, key); 1409} 1410 1411int 1412freebsd32_semsys(struct thread *td, struct freebsd32_semsys_args *uap) 1413{ 1414 |
1415#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1416 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) |
|
1386 switch (uap->which) { 1387 case 0: 1388 return (freebsd32_semctl(td, 1389 (struct freebsd32_semctl_args *)&uap->a2)); 1390 default: 1391 return (semsys(td, (struct semsys_args *)uap)); 1392 } | 1417 switch (uap->which) { 1418 case 0: 1419 return (freebsd32_semctl(td, 1420 (struct freebsd32_semctl_args *)&uap->a2)); 1421 default: 1422 return (semsys(td, (struct semsys_args *)uap)); 1423 } |
1424#else 1425 return (nosys(td, NULL)); 1426#endif |
|
1393} 1394 | 1427} 1428 |
1429#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1430 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) |
|
1395int | 1431int |
1432freebsd7_freebsd32_semctl(struct thread *td, 1433 struct freebsd7_freebsd32_semctl_args *uap) 1434{ 1435 struct semid_ds32_old dsbuf32; 1436 struct semid_ds dsbuf; 1437 union semun semun; 1438 union semun32 arg; 1439 register_t rval; 1440 int error; 1441 1442 switch (uap->cmd) { 1443 case SEM_STAT: 1444 case IPC_SET: 1445 case IPC_STAT: 1446 case GETALL: 1447 case SETVAL: 1448 case SETALL: 1449 error = copyin(uap->arg, &arg, sizeof(arg)); 1450 if (error) 1451 return (error); 1452 break; 1453 } 1454 1455 switch (uap->cmd) { 1456 case SEM_STAT: 1457 case IPC_STAT: 1458 semun.buf = &dsbuf; 1459 break; 1460 case IPC_SET: 1461 error = copyin(PTRIN(arg.buf), &dsbuf32, sizeof(dsbuf32)); 1462 if (error) 1463 return (error); 1464 freebsd32_ipcperm_old_in(&dsbuf32.sem_perm, &dsbuf.sem_perm); 1465 PTRIN_CP(dsbuf32, dsbuf, sem_base); 1466 CP(dsbuf32, dsbuf, sem_nsems); 1467 CP(dsbuf32, dsbuf, sem_otime); 1468 CP(dsbuf32, dsbuf, sem_ctime); 1469 semun.buf = &dsbuf; 1470 break; 1471 case GETALL: 1472 case SETALL: 1473 semun.array = PTRIN(arg.array); 1474 break; 1475 case SETVAL: 1476 semun.val = arg.val; 1477 break; 1478 } 1479 1480 error = kern_semctl(td, uap->semid, uap->semnum, uap->cmd, &semun, 1481 &rval); 1482 if (error) 1483 return (error); 1484 1485 switch (uap->cmd) { 1486 case SEM_STAT: 1487 case IPC_STAT: 1488 bzero(&dsbuf32, sizeof(dsbuf32)); 1489 freebsd32_ipcperm_old_out(&dsbuf.sem_perm, &dsbuf32.sem_perm); 1490 PTROUT_CP(dsbuf, dsbuf32, sem_base); 1491 CP(dsbuf, dsbuf32, sem_nsems); 1492 CP(dsbuf, dsbuf32, sem_otime); 1493 CP(dsbuf, dsbuf32, sem_ctime); 1494 error = copyout(&dsbuf32, PTRIN(arg.buf), sizeof(dsbuf32)); 1495 break; 1496 } 1497 1498 if (error == 0) 1499 td->td_retval[0] = rval; 1500 return (error); 1501} 1502#endif 1503 1504int |
|
1396freebsd32_semctl(struct thread *td, struct freebsd32_semctl_args *uap) 1397{ 1398 struct semid_ds32 dsbuf32; 1399 struct semid_ds dsbuf; 1400 union semun semun; 1401 union semun32 arg; 1402 register_t rval; 1403 int error; --- 19 unchanged lines hidden (view full) --- 1423 case IPC_SET: 1424 error = copyin(PTRIN(arg.buf), &dsbuf32, sizeof(dsbuf32)); 1425 if (error) 1426 return (error); 1427 freebsd32_ipcperm_in(&dsbuf32.sem_perm, &dsbuf.sem_perm); 1428 PTRIN_CP(dsbuf32, dsbuf, sem_base); 1429 CP(dsbuf32, dsbuf, sem_nsems); 1430 CP(dsbuf32, dsbuf, sem_otime); | 1505freebsd32_semctl(struct thread *td, struct freebsd32_semctl_args *uap) 1506{ 1507 struct semid_ds32 dsbuf32; 1508 struct semid_ds dsbuf; 1509 union semun semun; 1510 union semun32 arg; 1511 register_t rval; 1512 int error; --- 19 unchanged lines hidden (view full) --- 1532 case IPC_SET: 1533 error = copyin(PTRIN(arg.buf), &dsbuf32, sizeof(dsbuf32)); 1534 if (error) 1535 return (error); 1536 freebsd32_ipcperm_in(&dsbuf32.sem_perm, &dsbuf.sem_perm); 1537 PTRIN_CP(dsbuf32, dsbuf, sem_base); 1538 CP(dsbuf32, dsbuf, sem_nsems); 1539 CP(dsbuf32, dsbuf, sem_otime); |
1431 CP(dsbuf32, dsbuf, sem_pad1); | |
1432 CP(dsbuf32, dsbuf, sem_ctime); | 1540 CP(dsbuf32, dsbuf, sem_ctime); |
1433 CP(dsbuf32, dsbuf, sem_pad2); 1434 CP(dsbuf32, dsbuf, sem_pad3[0]); 1435 CP(dsbuf32, dsbuf, sem_pad3[1]); 1436 CP(dsbuf32, dsbuf, sem_pad3[2]); 1437 CP(dsbuf32, dsbuf, sem_pad3[3]); | |
1438 semun.buf = &dsbuf; 1439 break; 1440 case GETALL: 1441 case SETALL: 1442 semun.array = PTRIN(arg.array); 1443 break; 1444 case SETVAL: 1445 semun.val = arg.val; 1446 break; 1447 } 1448 1449 error = kern_semctl(td, uap->semid, uap->semnum, uap->cmd, &semun, 1450 &rval); 1451 if (error) 1452 return (error); 1453 1454 switch (uap->cmd) { 1455 case SEM_STAT: 1456 case IPC_STAT: | 1541 semun.buf = &dsbuf; 1542 break; 1543 case GETALL: 1544 case SETALL: 1545 semun.array = PTRIN(arg.array); 1546 break; 1547 case SETVAL: 1548 semun.val = arg.val; 1549 break; 1550 } 1551 1552 error = kern_semctl(td, uap->semid, uap->semnum, uap->cmd, &semun, 1553 &rval); 1554 if (error) 1555 return (error); 1556 1557 switch (uap->cmd) { 1558 case SEM_STAT: 1559 case IPC_STAT: |
1560 bzero(&dsbuf32, sizeof(dsbuf32)); |
|
1457 freebsd32_ipcperm_out(&dsbuf.sem_perm, &dsbuf32.sem_perm); 1458 PTROUT_CP(dsbuf, dsbuf32, sem_base); 1459 CP(dsbuf, dsbuf32, sem_nsems); 1460 CP(dsbuf, dsbuf32, sem_otime); | 1561 freebsd32_ipcperm_out(&dsbuf.sem_perm, &dsbuf32.sem_perm); 1562 PTROUT_CP(dsbuf, dsbuf32, sem_base); 1563 CP(dsbuf, dsbuf32, sem_nsems); 1564 CP(dsbuf, dsbuf32, sem_otime); |
1461 CP(dsbuf, dsbuf32, sem_pad1); | |
1462 CP(dsbuf, dsbuf32, sem_ctime); | 1565 CP(dsbuf, dsbuf32, sem_ctime); |
1463 CP(dsbuf, dsbuf32, sem_pad2); 1464 CP(dsbuf, dsbuf32, sem_pad3[0]); 1465 CP(dsbuf, dsbuf32, sem_pad3[1]); 1466 CP(dsbuf, dsbuf32, sem_pad3[2]); 1467 CP(dsbuf, dsbuf32, sem_pad3[3]); | |
1468 error = copyout(&dsbuf32, PTRIN(arg.buf), sizeof(dsbuf32)); 1469 break; 1470 } 1471 1472 if (error == 0) 1473 td->td_retval[0] = rval; 1474 return (error); 1475} 1476 1477int 1478freebsd32_msgsys(struct thread *td, struct freebsd32_msgsys_args *uap) 1479{ 1480 | 1566 error = copyout(&dsbuf32, PTRIN(arg.buf), sizeof(dsbuf32)); 1567 break; 1568 } 1569 1570 if (error == 0) 1571 td->td_retval[0] = rval; 1572 return (error); 1573} 1574 1575int 1576freebsd32_msgsys(struct thread *td, struct freebsd32_msgsys_args *uap) 1577{ 1578 |
1579#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1580 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) |
|
1481 switch (uap->which) { 1482 case 0: 1483 return (freebsd32_msgctl(td, 1484 (struct freebsd32_msgctl_args *)&uap->a2)); 1485 case 2: 1486 return (freebsd32_msgsnd(td, 1487 (struct freebsd32_msgsnd_args *)&uap->a2)); 1488 case 3: 1489 return (freebsd32_msgrcv(td, 1490 (struct freebsd32_msgrcv_args *)&uap->a2)); 1491 default: 1492 return (msgsys(td, (struct msgsys_args *)uap)); 1493 } | 1581 switch (uap->which) { 1582 case 0: 1583 return (freebsd32_msgctl(td, 1584 (struct freebsd32_msgctl_args *)&uap->a2)); 1585 case 2: 1586 return (freebsd32_msgsnd(td, 1587 (struct freebsd32_msgsnd_args *)&uap->a2)); 1588 case 3: 1589 return (freebsd32_msgrcv(td, 1590 (struct freebsd32_msgrcv_args *)&uap->a2)); 1591 default: 1592 return (msgsys(td, (struct msgsys_args *)uap)); 1593 } |
1594#else 1595 return (nosys(td, NULL)); 1596#endif |
|
1494} 1495 | 1597} 1598 |
1599#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1600 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) |
|
1496int | 1601int |
1602freebsd7_freebsd32_msgctl(struct thread *td, 1603 struct freebsd7_freebsd32_msgctl_args *uap) 1604{ 1605 struct msqid_ds msqbuf; 1606 struct msqid_ds32_old msqbuf32; 1607 int error; 1608 1609 if (uap->cmd == IPC_SET) { 1610 error = copyin(uap->buf, &msqbuf32, sizeof(msqbuf32)); 1611 if (error) 1612 return (error); 1613 freebsd32_ipcperm_old_in(&msqbuf32.msg_perm, &msqbuf.msg_perm); 1614 PTRIN_CP(msqbuf32, msqbuf, msg_first); 1615 PTRIN_CP(msqbuf32, msqbuf, msg_last); 1616 CP(msqbuf32, msqbuf, msg_cbytes); 1617 CP(msqbuf32, msqbuf, msg_qnum); 1618 CP(msqbuf32, msqbuf, msg_qbytes); 1619 CP(msqbuf32, msqbuf, msg_lspid); 1620 CP(msqbuf32, msqbuf, msg_lrpid); 1621 CP(msqbuf32, msqbuf, msg_stime); 1622 CP(msqbuf32, msqbuf, msg_rtime); 1623 CP(msqbuf32, msqbuf, msg_ctime); 1624 } 1625 error = kern_msgctl(td, uap->msqid, uap->cmd, &msqbuf); 1626 if (error) 1627 return (error); 1628 if (uap->cmd == IPC_STAT) { 1629 bzero(&msqbuf32, sizeof(msqbuf32)); 1630 freebsd32_ipcperm_old_out(&msqbuf.msg_perm, &msqbuf32.msg_perm); 1631 PTROUT_CP(msqbuf, msqbuf32, msg_first); 1632 PTROUT_CP(msqbuf, msqbuf32, msg_last); 1633 CP(msqbuf, msqbuf32, msg_cbytes); 1634 CP(msqbuf, msqbuf32, msg_qnum); 1635 CP(msqbuf, msqbuf32, msg_qbytes); 1636 CP(msqbuf, msqbuf32, msg_lspid); 1637 CP(msqbuf, msqbuf32, msg_lrpid); 1638 CP(msqbuf, msqbuf32, msg_stime); 1639 CP(msqbuf, msqbuf32, msg_rtime); 1640 CP(msqbuf, msqbuf32, msg_ctime); 1641 error = copyout(&msqbuf32, uap->buf, sizeof(struct msqid_ds32)); 1642 } 1643 return (error); 1644} 1645#endif 1646 1647int |
|
1497freebsd32_msgctl(struct thread *td, struct freebsd32_msgctl_args *uap) 1498{ 1499 struct msqid_ds msqbuf; 1500 struct msqid_ds32 msqbuf32; 1501 int error; 1502 1503 if (uap->cmd == IPC_SET) { 1504 error = copyin(uap->buf, &msqbuf32, sizeof(msqbuf32)); 1505 if (error) 1506 return (error); 1507 freebsd32_ipcperm_in(&msqbuf32.msg_perm, &msqbuf.msg_perm); 1508 PTRIN_CP(msqbuf32, msqbuf, msg_first); 1509 PTRIN_CP(msqbuf32, msqbuf, msg_last); 1510 CP(msqbuf32, msqbuf, msg_cbytes); 1511 CP(msqbuf32, msqbuf, msg_qnum); 1512 CP(msqbuf32, msqbuf, msg_qbytes); 1513 CP(msqbuf32, msqbuf, msg_lspid); 1514 CP(msqbuf32, msqbuf, msg_lrpid); 1515 CP(msqbuf32, msqbuf, msg_stime); | 1648freebsd32_msgctl(struct thread *td, struct freebsd32_msgctl_args *uap) 1649{ 1650 struct msqid_ds msqbuf; 1651 struct msqid_ds32 msqbuf32; 1652 int error; 1653 1654 if (uap->cmd == IPC_SET) { 1655 error = copyin(uap->buf, &msqbuf32, sizeof(msqbuf32)); 1656 if (error) 1657 return (error); 1658 freebsd32_ipcperm_in(&msqbuf32.msg_perm, &msqbuf.msg_perm); 1659 PTRIN_CP(msqbuf32, msqbuf, msg_first); 1660 PTRIN_CP(msqbuf32, msqbuf, msg_last); 1661 CP(msqbuf32, msqbuf, msg_cbytes); 1662 CP(msqbuf32, msqbuf, msg_qnum); 1663 CP(msqbuf32, msqbuf, msg_qbytes); 1664 CP(msqbuf32, msqbuf, msg_lspid); 1665 CP(msqbuf32, msqbuf, msg_lrpid); 1666 CP(msqbuf32, msqbuf, msg_stime); |
1516 CP(msqbuf32, msqbuf, msg_pad1); | |
1517 CP(msqbuf32, msqbuf, msg_rtime); | 1667 CP(msqbuf32, msqbuf, msg_rtime); |
1518 CP(msqbuf32, msqbuf, msg_pad2); | |
1519 CP(msqbuf32, msqbuf, msg_ctime); | 1668 CP(msqbuf32, msqbuf, msg_ctime); |
1520 CP(msqbuf32, msqbuf, msg_pad3); 1521 CP(msqbuf32, msqbuf, msg_pad4[0]); 1522 CP(msqbuf32, msqbuf, msg_pad4[1]); 1523 CP(msqbuf32, msqbuf, msg_pad4[2]); 1524 CP(msqbuf32, msqbuf, msg_pad4[3]); | |
1525 } 1526 error = kern_msgctl(td, uap->msqid, uap->cmd, &msqbuf); 1527 if (error) 1528 return (error); 1529 if (uap->cmd == IPC_STAT) { 1530 freebsd32_ipcperm_out(&msqbuf.msg_perm, &msqbuf32.msg_perm); 1531 PTROUT_CP(msqbuf, msqbuf32, msg_first); 1532 PTROUT_CP(msqbuf, msqbuf32, msg_last); 1533 CP(msqbuf, msqbuf32, msg_cbytes); 1534 CP(msqbuf, msqbuf32, msg_qnum); 1535 CP(msqbuf, msqbuf32, msg_qbytes); 1536 CP(msqbuf, msqbuf32, msg_lspid); 1537 CP(msqbuf, msqbuf32, msg_lrpid); 1538 CP(msqbuf, msqbuf32, msg_stime); | 1669 } 1670 error = kern_msgctl(td, uap->msqid, uap->cmd, &msqbuf); 1671 if (error) 1672 return (error); 1673 if (uap->cmd == IPC_STAT) { 1674 freebsd32_ipcperm_out(&msqbuf.msg_perm, &msqbuf32.msg_perm); 1675 PTROUT_CP(msqbuf, msqbuf32, msg_first); 1676 PTROUT_CP(msqbuf, msqbuf32, msg_last); 1677 CP(msqbuf, msqbuf32, msg_cbytes); 1678 CP(msqbuf, msqbuf32, msg_qnum); 1679 CP(msqbuf, msqbuf32, msg_qbytes); 1680 CP(msqbuf, msqbuf32, msg_lspid); 1681 CP(msqbuf, msqbuf32, msg_lrpid); 1682 CP(msqbuf, msqbuf32, msg_stime); |
1539 CP(msqbuf, msqbuf32, msg_pad1); | |
1540 CP(msqbuf, msqbuf32, msg_rtime); | 1683 CP(msqbuf, msqbuf32, msg_rtime); |
1541 CP(msqbuf, msqbuf32, msg_pad2); | |
1542 CP(msqbuf, msqbuf32, msg_ctime); | 1684 CP(msqbuf, msqbuf32, msg_ctime); |
1543 CP(msqbuf, msqbuf32, msg_pad3); 1544 CP(msqbuf, msqbuf32, msg_pad4[0]); 1545 CP(msqbuf, msqbuf32, msg_pad4[1]); 1546 CP(msqbuf, msqbuf32, msg_pad4[2]); 1547 CP(msqbuf, msqbuf32, msg_pad4[3]); | |
1548 error = copyout(&msqbuf32, uap->buf, sizeof(struct msqid_ds32)); 1549 } 1550 return (error); 1551} 1552 1553int 1554freebsd32_msgsnd(struct thread *td, struct freebsd32_msgsnd_args *uap) 1555{ --- 27 unchanged lines hidden (view full) --- 1583 mtype32 = (int32_t)mtype; 1584 return (copyout(&mtype32, msgp, sizeof(mtype32))); 1585} 1586 1587int 1588freebsd32_shmsys(struct thread *td, struct freebsd32_shmsys_args *uap) 1589{ 1590 | 1685 error = copyout(&msqbuf32, uap->buf, sizeof(struct msqid_ds32)); 1686 } 1687 return (error); 1688} 1689 1690int 1691freebsd32_msgsnd(struct thread *td, struct freebsd32_msgsnd_args *uap) 1692{ --- 27 unchanged lines hidden (view full) --- 1720 mtype32 = (int32_t)mtype; 1721 return (copyout(&mtype32, msgp, sizeof(mtype32))); 1722} 1723 1724int 1725freebsd32_shmsys(struct thread *td, struct freebsd32_shmsys_args *uap) 1726{ 1727 |
1728#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1729 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) |
|
1591 switch (uap->which) { 1592 case 0: { /* shmat */ 1593 struct shmat_args ap; 1594 1595 ap.shmid = uap->a2; 1596 ap.shmaddr = PTRIN(uap->a3); 1597 ap.shmflg = uap->a4; 1598 return (sysent[SYS_shmat].sy_call(td, &ap)); --- 19 unchanged lines hidden (view full) --- 1618 ap.cmd = uap->a3; 1619 ap.buf = PTRIN(uap->a4); 1620 return (freebsd32_shmctl(td, &ap)); 1621 } 1622 case 1: /* oshmctl */ 1623 default: 1624 return (EINVAL); 1625 } | 1730 switch (uap->which) { 1731 case 0: { /* shmat */ 1732 struct shmat_args ap; 1733 1734 ap.shmid = uap->a2; 1735 ap.shmaddr = PTRIN(uap->a3); 1736 ap.shmflg = uap->a4; 1737 return (sysent[SYS_shmat].sy_call(td, &ap)); --- 19 unchanged lines hidden (view full) --- 1757 ap.cmd = uap->a3; 1758 ap.buf = PTRIN(uap->a4); 1759 return (freebsd32_shmctl(td, &ap)); 1760 } 1761 case 1: /* oshmctl */ 1762 default: 1763 return (EINVAL); 1764 } |
1765#else 1766 return (nosys(td, NULL)); 1767#endif |
|
1626} 1627 | 1768} 1769 |
1770#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ 1771 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) |
|
1628int | 1772int |
1773freebsd7_freebsd32_shmctl(struct thread *td, 1774 struct freebsd7_freebsd32_shmctl_args *uap) 1775{ 1776 int error = 0; 1777 union { 1778 struct shmid_ds shmid_ds; 1779 struct shm_info shm_info; 1780 struct shminfo shminfo; 1781 } u; 1782 union { 1783 struct shmid_ds32_old shmid_ds32; 1784 struct shm_info32 shm_info32; 1785 struct shminfo32 shminfo32; 1786 } u32; 1787 size_t sz; 1788 1789 if (uap->cmd == IPC_SET) { 1790 if ((error = copyin(uap->buf, &u32.shmid_ds32, 1791 sizeof(u32.shmid_ds32)))) 1792 goto done; 1793 freebsd32_ipcperm_old_in(&u32.shmid_ds32.shm_perm, 1794 &u.shmid_ds.shm_perm); 1795 CP(u32.shmid_ds32, u.shmid_ds, shm_segsz); 1796 CP(u32.shmid_ds32, u.shmid_ds, shm_lpid); 1797 CP(u32.shmid_ds32, u.shmid_ds, shm_cpid); 1798 CP(u32.shmid_ds32, u.shmid_ds, shm_nattch); 1799 CP(u32.shmid_ds32, u.shmid_ds, shm_atime); 1800 CP(u32.shmid_ds32, u.shmid_ds, shm_dtime); 1801 CP(u32.shmid_ds32, u.shmid_ds, shm_ctime); 1802 } 1803 1804 error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz); 1805 if (error) 1806 goto done; 1807 1808 /* Cases in which we need to copyout */ 1809 switch (uap->cmd) { 1810 case IPC_INFO: 1811 CP(u.shminfo, u32.shminfo32, shmmax); 1812 CP(u.shminfo, u32.shminfo32, shmmin); 1813 CP(u.shminfo, u32.shminfo32, shmmni); 1814 CP(u.shminfo, u32.shminfo32, shmseg); 1815 CP(u.shminfo, u32.shminfo32, shmall); 1816 error = copyout(&u32.shminfo32, uap->buf, 1817 sizeof(u32.shminfo32)); 1818 break; 1819 case SHM_INFO: 1820 CP(u.shm_info, u32.shm_info32, used_ids); 1821 CP(u.shm_info, u32.shm_info32, shm_rss); 1822 CP(u.shm_info, u32.shm_info32, shm_tot); 1823 CP(u.shm_info, u32.shm_info32, shm_swp); 1824 CP(u.shm_info, u32.shm_info32, swap_attempts); 1825 CP(u.shm_info, u32.shm_info32, swap_successes); 1826 error = copyout(&u32.shm_info32, uap->buf, 1827 sizeof(u32.shm_info32)); 1828 break; 1829 case SHM_STAT: 1830 case IPC_STAT: 1831 freebsd32_ipcperm_old_out(&u.shmid_ds.shm_perm, 1832 &u32.shmid_ds32.shm_perm); 1833 if (u.shmid_ds.shm_segsz > INT32_MAX) 1834 u32.shmid_ds32.shm_segsz = INT32_MAX; 1835 else 1836 CP(u.shmid_ds, u32.shmid_ds32, shm_segsz); 1837 CP(u.shmid_ds, u32.shmid_ds32, shm_lpid); 1838 CP(u.shmid_ds, u32.shmid_ds32, shm_cpid); 1839 CP(u.shmid_ds, u32.shmid_ds32, shm_nattch); 1840 CP(u.shmid_ds, u32.shmid_ds32, shm_atime); 1841 CP(u.shmid_ds, u32.shmid_ds32, shm_dtime); 1842 CP(u.shmid_ds, u32.shmid_ds32, shm_ctime); 1843 u32.shmid_ds32.shm_internal = 0; 1844 error = copyout(&u32.shmid_ds32, uap->buf, 1845 sizeof(u32.shmid_ds32)); 1846 break; 1847 } 1848 1849done: 1850 if (error) { 1851 /* Invalidate the return value */ 1852 td->td_retval[0] = -1; 1853 } 1854 return (error); 1855} 1856#endif 1857 1858int |
|
1629freebsd32_shmctl(struct thread *td, struct freebsd32_shmctl_args *uap) 1630{ 1631 int error = 0; 1632 union { 1633 struct shmid_ds shmid_ds; 1634 struct shm_info shm_info; 1635 struct shminfo shminfo; 1636 } u; --- 12 unchanged lines hidden (view full) --- 1649 &u.shmid_ds.shm_perm); 1650 CP(u32.shmid_ds32, u.shmid_ds, shm_segsz); 1651 CP(u32.shmid_ds32, u.shmid_ds, shm_lpid); 1652 CP(u32.shmid_ds32, u.shmid_ds, shm_cpid); 1653 CP(u32.shmid_ds32, u.shmid_ds, shm_nattch); 1654 CP(u32.shmid_ds32, u.shmid_ds, shm_atime); 1655 CP(u32.shmid_ds32, u.shmid_ds, shm_dtime); 1656 CP(u32.shmid_ds32, u.shmid_ds, shm_ctime); | 1859freebsd32_shmctl(struct thread *td, struct freebsd32_shmctl_args *uap) 1860{ 1861 int error = 0; 1862 union { 1863 struct shmid_ds shmid_ds; 1864 struct shm_info shm_info; 1865 struct shminfo shminfo; 1866 } u; --- 12 unchanged lines hidden (view full) --- 1879 &u.shmid_ds.shm_perm); 1880 CP(u32.shmid_ds32, u.shmid_ds, shm_segsz); 1881 CP(u32.shmid_ds32, u.shmid_ds, shm_lpid); 1882 CP(u32.shmid_ds32, u.shmid_ds, shm_cpid); 1883 CP(u32.shmid_ds32, u.shmid_ds, shm_nattch); 1884 CP(u32.shmid_ds32, u.shmid_ds, shm_atime); 1885 CP(u32.shmid_ds32, u.shmid_ds, shm_dtime); 1886 CP(u32.shmid_ds32, u.shmid_ds, shm_ctime); |
1657 PTRIN_CP(u32.shmid_ds32, u.shmid_ds, shm_internal); | |
1658 } 1659 1660 error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz); 1661 if (error) 1662 goto done; 1663 1664 /* Cases in which we need to copyout */ 1665 switch (uap->cmd) { --- 15 unchanged lines hidden (view full) --- 1681 CP(u.shm_info, u32.shm_info32, swap_successes); 1682 error = copyout(&u32.shm_info32, uap->buf, 1683 sizeof(u32.shm_info32)); 1684 break; 1685 case SHM_STAT: 1686 case IPC_STAT: 1687 freebsd32_ipcperm_out(&u.shmid_ds.shm_perm, 1688 &u32.shmid_ds32.shm_perm); | 1887 } 1888 1889 error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz); 1890 if (error) 1891 goto done; 1892 1893 /* Cases in which we need to copyout */ 1894 switch (uap->cmd) { --- 15 unchanged lines hidden (view full) --- 1910 CP(u.shm_info, u32.shm_info32, swap_successes); 1911 error = copyout(&u32.shm_info32, uap->buf, 1912 sizeof(u32.shm_info32)); 1913 break; 1914 case SHM_STAT: 1915 case IPC_STAT: 1916 freebsd32_ipcperm_out(&u.shmid_ds.shm_perm, 1917 &u32.shmid_ds32.shm_perm); |
1689 CP(u.shmid_ds, u32.shmid_ds32, shm_segsz); | 1918 if (u.shmid_ds.shm_segsz > INT32_MAX) 1919 u32.shmid_ds32.shm_segsz = INT32_MAX; 1920 else 1921 CP(u.shmid_ds, u32.shmid_ds32, shm_segsz); |
1690 CP(u.shmid_ds, u32.shmid_ds32, shm_lpid); 1691 CP(u.shmid_ds, u32.shmid_ds32, shm_cpid); 1692 CP(u.shmid_ds, u32.shmid_ds32, shm_nattch); 1693 CP(u.shmid_ds, u32.shmid_ds32, shm_atime); 1694 CP(u.shmid_ds, u32.shmid_ds32, shm_dtime); 1695 CP(u.shmid_ds, u32.shmid_ds32, shm_ctime); | 1922 CP(u.shmid_ds, u32.shmid_ds32, shm_lpid); 1923 CP(u.shmid_ds, u32.shmid_ds32, shm_cpid); 1924 CP(u.shmid_ds, u32.shmid_ds32, shm_nattch); 1925 CP(u.shmid_ds, u32.shmid_ds32, shm_atime); 1926 CP(u.shmid_ds, u32.shmid_ds32, shm_dtime); 1927 CP(u.shmid_ds, u32.shmid_ds32, shm_ctime); |
1696 PTROUT_CP(u.shmid_ds, u32.shmid_ds32, shm_internal); | |
1697 error = copyout(&u32.shmid_ds32, uap->buf, 1698 sizeof(u32.shmid_ds32)); 1699 break; 1700 } 1701 1702done: 1703 if (error) { 1704 /* Invalidate the return value */ --- 1123 unchanged lines hidden --- | 1928 error = copyout(&u32.shmid_ds32, uap->buf, 1929 sizeof(u32.shmid_ds32)); 1930 break; 1931 } 1932 1933done: 1934 if (error) { 1935 /* Invalidate the return value */ --- 1123 unchanged lines hidden --- |