Deleted Added
full compact
linux_file.c (315376) linux_file.c (315538)
1/*-
2 * Copyright (c) 1994-1995 S��ren Schmidt
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

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1994-1995 S��ren Schmidt
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

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: stable/11/sys/compat/linux/linux_file.c 315376 2017-03-16 06:32:58Z dchagin $");
30__FBSDID("$FreeBSD: stable/11/sys/compat/linux/linux_file.c 315538 2017-03-19 10:32:39Z trasz $");
31
32#include "opt_compat.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/capsicum.h>
37#include <sys/conf.h>
38#include <sys/dirent.h>

--- 1585 unchanged lines hidden (view full) ---

1624 int error;
1625
1626#ifdef DEBUG
1627 if (ldebug(pipe))
1628 printf(ARGS(pipe, "*"));
1629#endif
1630
1631 error = kern_pipe(td, fildes, 0, NULL, NULL);
31
32#include "opt_compat.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/capsicum.h>
37#include <sys/conf.h>
38#include <sys/dirent.h>

--- 1585 unchanged lines hidden (view full) ---

1624 int error;
1625
1626#ifdef DEBUG
1627 if (ldebug(pipe))
1628 printf(ARGS(pipe, "*"));
1629#endif
1630
1631 error = kern_pipe(td, fildes, 0, NULL, NULL);
1632 if (error)
1632 if (error != 0)
1633 return (error);
1634
1633 return (error);
1634
1635 /* XXX: Close descriptors on error. */
1636 return (copyout(fildes, args->pipefds, sizeof(fildes)));
1635 error = copyout(fildes, args->pipefds, sizeof(fildes));
1636 if (error != 0) {
1637 (void)kern_close(td, fildes[0]);
1638 (void)kern_close(td, fildes[1]);
1639 }
1640
1641 return (error);
1637}
1638
1639int
1640linux_pipe2(struct thread *td, struct linux_pipe2_args *args)
1641{
1642 int fildes[2];
1643 int error, flags;
1644

--- 6 unchanged lines hidden (view full) ---

1651 return (EINVAL);
1652
1653 flags = 0;
1654 if ((args->flags & LINUX_O_NONBLOCK) != 0)
1655 flags |= O_NONBLOCK;
1656 if ((args->flags & LINUX_O_CLOEXEC) != 0)
1657 flags |= O_CLOEXEC;
1658 error = kern_pipe(td, fildes, flags, NULL, NULL);
1642}
1643
1644int
1645linux_pipe2(struct thread *td, struct linux_pipe2_args *args)
1646{
1647 int fildes[2];
1648 int error, flags;
1649

--- 6 unchanged lines hidden (view full) ---

1656 return (EINVAL);
1657
1658 flags = 0;
1659 if ((args->flags & LINUX_O_NONBLOCK) != 0)
1660 flags |= O_NONBLOCK;
1661 if ((args->flags & LINUX_O_CLOEXEC) != 0)
1662 flags |= O_CLOEXEC;
1663 error = kern_pipe(td, fildes, flags, NULL, NULL);
1659 if (error)
1664 if (error != 0)
1660 return (error);
1661
1665 return (error);
1666
1662 /* XXX: Close descriptors on error. */
1663 return (copyout(fildes, args->pipefds, sizeof(fildes)));
1667 error = copyout(fildes, args->pipefds, sizeof(fildes));
1668 if (error != 0) {
1669 (void)kern_close(td, fildes[0]);
1670 (void)kern_close(td, fildes[1]);
1671 }
1672
1673 return (error);
1664}
1665
1666int
1667linux_dup3(struct thread *td, struct linux_dup3_args *args)
1668{
1669 int cmd;
1670 intptr_t newfd;
1671

--- 27 unchanged lines hidden ---
1674}
1675
1676int
1677linux_dup3(struct thread *td, struct linux_dup3_args *args)
1678{
1679 int cmd;
1680 intptr_t newfd;
1681

--- 27 unchanged lines hidden ---