Deleted Added
full compact
linux_socket.c (103839) linux_socket.c (103886)
1/*-
2 * Copyright (c) 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

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

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
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 *
1/*-
2 * Copyright (c) 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

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

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
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 * $FreeBSD: head/sys/compat/linux/linux_socket.c 103839 2002-09-23 06:17:54Z mini $
28 * $FreeBSD: head/sys/compat/linux/linux_socket.c 103886 2002-09-24 07:03:01Z mini $
29 */
30
31/* XXX we use functions that might not exist. */
32#include "opt_compat.h"
33
34#ifndef COMPAT_43
35#error "Unable to compile Linux-emulator due to missing COMPAT_43 option!"
36#endif

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

498 int error;
499
500 if ((error = copyin(args, &linux_args, sizeof(linux_args))))
501 return (error);
502
503 bsd_args.s = linux_args.s;
504 bsd_args.name = (caddr_t)linux_args.addr;
505 bsd_args.anamelen = linux_args.namelen;
29 */
30
31/* XXX we use functions that might not exist. */
32#include "opt_compat.h"
33
34#ifndef COMPAT_43
35#error "Unable to compile Linux-emulator due to missing COMPAT_43 option!"
36#endif

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

498 int error;
499
500 if ((error = copyin(args, &linux_args, sizeof(linux_args))))
501 return (error);
502
503 bsd_args.s = linux_args.s;
504 bsd_args.name = (caddr_t)linux_args.addr;
505 bsd_args.anamelen = linux_args.namelen;
506 error = accept(td, &bsd_args);
506 error = oaccept(td, &bsd_args);
507 if (error)
508 return (error);
509
510 /*
511 * linux appears not to copy flags from the parent socket to the
512 * accepted one, so we must clear the flags in the new descriptor.
513 * Ignore any errors, because we already have an open fd.
514 */

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

538 int error;
539
540 if ((error = copyin(args, &linux_args, sizeof(linux_args))))
541 return (error);
542
543 bsd_args.fdes = linux_args.s;
544 bsd_args.asa = (caddr_t) linux_args.addr;
545 bsd_args.alen = linux_args.namelen;
507 if (error)
508 return (error);
509
510 /*
511 * linux appears not to copy flags from the parent socket to the
512 * accepted one, so we must clear the flags in the new descriptor.
513 * Ignore any errors, because we already have an open fd.
514 */

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

538 int error;
539
540 if ((error = copyin(args, &linux_args, sizeof(linux_args))))
541 return (error);
542
543 bsd_args.fdes = linux_args.s;
544 bsd_args.asa = (caddr_t) linux_args.addr;
545 bsd_args.alen = linux_args.namelen;
546 return (getsockname(td, &bsd_args));
546 return (ogetsockname(td, &bsd_args));
547}
548
549struct linux_getpeername_args {
550 int s;
551 struct sockaddr *addr;
552 int *namelen;
553};
554
555static int
556linux_getpeername(struct thread *td, struct linux_getpeername_args *args)
557{
558 struct linux_getpeername_args linux_args;
547}
548
549struct linux_getpeername_args {
550 int s;
551 struct sockaddr *addr;
552 int *namelen;
553};
554
555static int
556linux_getpeername(struct thread *td, struct linux_getpeername_args *args)
557{
558 struct linux_getpeername_args linux_args;
559 struct getpeername_args /* {
559 struct ogetpeername_args /* {
560 int fdes;
561 caddr_t asa;
562 int *alen;
563 } */ bsd_args;
564 int error;
565
566 if ((error = copyin(args, &linux_args, sizeof(linux_args))))
567 return (error);
568
569 bsd_args.fdes = linux_args.s;
570 bsd_args.asa = (caddr_t) linux_args.addr;
571 bsd_args.alen = linux_args.namelen;
560 int fdes;
561 caddr_t asa;
562 int *alen;
563 } */ bsd_args;
564 int error;
565
566 if ((error = copyin(args, &linux_args, sizeof(linux_args))))
567 return (error);
568
569 bsd_args.fdes = linux_args.s;
570 bsd_args.asa = (caddr_t) linux_args.addr;
571 bsd_args.alen = linux_args.namelen;
572 return (getpeername(td, &bsd_args));
572 return (ogetpeername(td, &bsd_args));
573}
574
575struct linux_socketpair_args {
576 int domain;
577 int type;
578 int protocol;
579 int *rsv;
580};

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

610 int len;
611 int flags;
612};
613
614static int
615linux_send(struct thread *td, struct linux_send_args *args)
616{
617 struct linux_send_args linux_args;
573}
574
575struct linux_socketpair_args {
576 int domain;
577 int type;
578 int protocol;
579 int *rsv;
580};

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

610 int len;
611 int flags;
612};
613
614static int
615linux_send(struct thread *td, struct linux_send_args *args)
616{
617 struct linux_send_args linux_args;
618 struct sendto_args /* {
619 int s;
618 struct osend_args /* {
619 int s;
620 caddr_t buf;
620 caddr_t buf;
621 size_t len;
621 int len;
622 int flags;
622 int flags;
623 caddr_t to;
624 int tolen;
625 } */ bsd_args;
626 int error;
627
628 if ((error = copyin(args, &linux_args, sizeof(linux_args))))
629 return (error);
630
631 bsd_args.s = linux_args.s;
632 bsd_args.buf = linux_args.msg;
633 bsd_args.len = linux_args.len;
634 bsd_args.flags = linux_args.flags;
623 } */ bsd_args;
624 int error;
625
626 if ((error = copyin(args, &linux_args, sizeof(linux_args))))
627 return (error);
628
629 bsd_args.s = linux_args.s;
630 bsd_args.buf = linux_args.msg;
631 bsd_args.len = linux_args.len;
632 bsd_args.flags = linux_args.flags;
635 bsd_args.to = NULL;
636 bsd_args.tolen = 0;
637 return (sendto(td, &bsd_args));
633 return (osend(td, &bsd_args));
638}
639
640struct linux_recv_args {
641 int s;
642 void *msg;
643 int len;
644 int flags;
645};
646
647static int
648linux_recv(struct thread *td, struct linux_recv_args *args)
649{
650 struct linux_recv_args linux_args;
634}
635
636struct linux_recv_args {
637 int s;
638 void *msg;
639 int len;
640 int flags;
641};
642
643static int
644linux_recv(struct thread *td, struct linux_recv_args *args)
645{
646 struct linux_recv_args linux_args;
651 struct recvfrom_args /* {
647 struct orecv_args /* {
652 int s;
653 caddr_t buf;
654 int len;
655 int flags;
648 int s;
649 caddr_t buf;
650 int len;
651 int flags;
656 caddr_t from;
657 int fromlen;
658 } */ bsd_args;
659 int error;
660
661 if ((error = copyin(args, &linux_args, sizeof(linux_args))))
662 return (error);
663
664 bsd_args.s = linux_args.s;
665 bsd_args.buf = linux_args.msg;
666 bsd_args.len = linux_args.len;
667 bsd_args.flags = linux_args.flags;
652 } */ bsd_args;
653 int error;
654
655 if ((error = copyin(args, &linux_args, sizeof(linux_args))))
656 return (error);
657
658 bsd_args.s = linux_args.s;
659 bsd_args.buf = linux_args.msg;
660 bsd_args.len = linux_args.len;
661 bsd_args.flags = linux_args.flags;
668 bsd_args.from = NULL;
669 bsd_args.fromlenaddr = NULL;
670 return (recvfrom(td, &bsd_args));
662 return (orecv(td, &bsd_args));
671}
672
673struct linux_sendto_args {
674 int s;
675 void *msg;
676 int len;
677 int flags;
678 caddr_t to;

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

737 return (error);
738
739 bsd_args.s = linux_args.s;
740 bsd_args.buf = linux_args.buf;
741 bsd_args.len = linux_args.len;
742 bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags);
743 bsd_args.from = linux_args.from;
744 bsd_args.fromlenaddr = linux_args.fromlen;
663}
664
665struct linux_sendto_args {
666 int s;
667 void *msg;
668 int len;
669 int flags;
670 caddr_t to;

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

729 return (error);
730
731 bsd_args.s = linux_args.s;
732 bsd_args.buf = linux_args.buf;
733 bsd_args.len = linux_args.len;
734 bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags);
735 bsd_args.from = linux_args.from;
736 bsd_args.fromlenaddr = linux_args.fromlen;
745 return (recvfrom(td, &bsd_args));
737 return (orecvfrom(td, &bsd_args));
746}
747
748struct linux_recvmsg_args {
749 int s;
750 struct msghdr *msg;
751 int flags;
752};
753

--- 226 unchanged lines hidden ---
738}
739
740struct linux_recvmsg_args {
741 int s;
742 struct msghdr *msg;
743 int flags;
744};
745

--- 226 unchanged lines hidden ---