Deleted Added
sdiff udiff text old ( 103839 ) new ( 103886 )
full compact
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 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;
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;
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;
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;
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;
618 struct osend_args /* {
619 int s;
620 caddr_t buf;
621 int len;
622 int 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;
633 return (osend(td, &bsd_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;
647 struct orecv_args /* {
648 int s;
649 caddr_t buf;
650 int len;
651 int 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;
662 return (orecv(td, &bsd_args));
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;
737 return (orecvfrom(td, &bsd_args));
738}
739
740struct linux_recvmsg_args {
741 int s;
742 struct msghdr *msg;
743 int flags;
744};
745

--- 226 unchanged lines hidden ---