Changeset 5c0aa97 in rtems-libbsd


Ignore:
Timestamp:
Feb 12, 2015, 12:34:09 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, c1e05b9ea378b2971e3d7704779112b4bc4296da, freebsd-9.3, 4a77611a223ea883fb548679b516d326a020d447
Children:
be2e60c
Parents:
f181630
git-author:
Sebastian Huber <sebastian.huber@…> (02/12/15 12:34:09)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/13/15 09:34:20)
Message:

Add zerocopy sendto

Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    rf181630 r5c0aa97  
    8181LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-log.c
    8282LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-malloc.c
     83LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-mbuf.c
    8384LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-mutex.c
    8485LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-muteximpl.c
     
    13861387O_FILES += $(TEST_PPP01_O_FILES)
    13871388D_FILES += $(TEST_PPP01_D_FILES)
     1389
     1390TEST_ZEROCOPY01 = testsuite/zerocopy01/zerocopy01.exe
     1391TEST_ZEROCOPY01_O_FILES =
     1392TEST_ZEROCOPY01_D_FILES =
     1393TEST_ZEROCOPY01_O_FILES += testsuite/zerocopy01/test_main.o
     1394TEST_ZEROCOPY01_D_FILES += testsuite/zerocopy01/test_main.d
     1395$(TEST_ZEROCOPY01): $(TEST_ZEROCOPY01_O_FILES) $(LIB)
     1396        $(LINK.c) -Wl,-Map,testsuite/zerocopy01/zerocopy01.map $^ -lm -lz -o $@
     1397NET_TESTS += $(TEST_ZEROCOPY01)
     1398O_FILES += $(TEST_ZEROCOPY01_O_FILES)
     1399D_FILES += $(TEST_ZEROCOPY01_D_FILES)
    13881400LIB_C_FILES += dhcpcd/arp.c
    13891401dhcpcd/arp.o: dhcpcd/arp.c
  • freebsd-to-rtems.py

    rf181630 r5c0aa97  
    681681                'rtems/rtems-bsd-log.c',
    682682                'rtems/rtems-bsd-malloc.c',
     683                'rtems/rtems-bsd-mbuf.c',
    683684                'rtems/rtems-bsd-mutex.c',
    684685                'rtems/rtems-bsd-muteximpl.c',
     
    25122513tests.addTest('condvar01', ['test_main'])
    25132514tests.addTest('ppp01', ['test_main'], runTest = False)
     2515tests.addTest('zerocopy01', ['test_main'], runTest = False, netTest = True)
    25142516
    25152517dhcpcd = Module('dhcpcd')
  • freebsd/sys/kern/uipc_syscalls.c

    rf181630 r5c0aa97  
    100100#ifdef __rtems__
    101101#include <machine/rtems-bsd-syscall-api.h>
     102#include <rtems/bsd/zerocopy.h>
    102103
    103104static int kern_bind(struct thread *, int, struct sockaddr *);
     
    11371138                rtems_set_errno_and_return_minus_one(error);
    11381139        }
     1140}
     1141
     1142int
     1143rtems_bsd_sendto(int socket, struct mbuf *m, int flags,
     1144    const struct sockaddr *dest_addr)
     1145{
     1146        struct thread *td = rtems_bsd_get_curthread_or_null();
     1147        struct file *fp;
     1148        struct socket *so;
     1149        int error;
     1150
     1151        error = getsock_cap(td->td_proc->p_fd, socket, CAP_WRITE, &fp, NULL);
     1152        if (error)
     1153                return (error);
     1154        so = (struct socket *)fp->f_data;
     1155
     1156        if (td != NULL) {
     1157                error = sosend(so, __DECONST(struct sockaddr *, dest_addr),
     1158                    NULL, m, NULL, flags, td);
     1159        } else {
     1160                error = ENOMEM;
     1161        }
     1162
     1163        return (error);
    11391164}
    11401165#endif /* __rtems__ */
Note: See TracChangeset for help on using the changeset viewer.