Changeset caf8ede in rtems-libbsd


Ignore:
Timestamp:
Oct 10, 2013, 9:29:33 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, a8f29d695e152575479ad1a97fa354f661bebd4d, freebsd-9.3, d892051f37c2c4ad7f345f6a817ea3d38e56a431
Children:
609df33
Parents:
69b29a0
git-author:
Sebastian Huber <sebastian.huber@…> (10/10/13 09:29:33)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/31/13 12:18:47)
Message:

Import socket() implementation from FreeBSD

Add new test syscalls01.

Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r69b29a0 rcaf8ede  
    164164LIB_C_FILES += freebsd/sys/libkern/random.c
    165165LIB_C_FILES += freebsd/sys/vm/uma_core.c
     166LIB_C_FILES += freebsd/sys/kern/sys_socket.c
     167LIB_C_FILES += freebsd/sys/kern/uipc_syscalls.c
    166168LIB_C_FILES += freebsd/sys/net/bridgestp.c
    167169LIB_C_FILES += freebsd/sys/net/ieee8023ad_lacp.c
     
    779781LIB_C_FILES += freebsd/usr.bin/netstat/unix.c
    780782
     783TEST_SYSCALLS01 = testsuite/syscalls01/syscalls01.exe
     784TEST_SYSCALLS01_O_FILES =
     785TEST_SYSCALLS01_D_FILES =
     786TEST_SYSCALLS01_O_FILES += testsuite/syscalls01/test_main.o
     787TEST_SYSCALLS01_D_FILES += testsuite/syscalls01/test_main.d
     788$(TEST_SYSCALLS01): $(TEST_SYSCALLS01_O_FILES) $(LIB)
     789        $(LINK.c) -Wl,-Map,testsuite/syscalls01/syscalls01.map $^ -lm -o $@
     790TESTS += $(TEST_SYSCALLS01)
     791O_FILES += $(TEST_SYSCALLS01_O_FILES)
     792D_FILES += $(TEST_SYSCALLS01_D_FILES)
     793RUN_TESTS += $(TEST_SYSCALLS01)
     794
    781795TEST_USB01 = testsuite/usb01/usb01.exe
    782796TEST_USB01_O_FILES =
  • freebsd-to-rtems.py

    r69b29a0 rcaf8ede  
    14331433net.addSourceFiles(
    14341434        [
     1435                'sys/kern/sys_socket.c',
     1436                'sys/kern/uipc_syscalls.c',
    14351437                'sys/net/bridgestp.c',
    14361438                'sys/net/ieee8023ad_lacp.c',
     
    23572359
    23582360tests = Module('tests')
     2361tests.addTest('syscalls01', ['test_main'])
    23592362tests.addTest('usb01', ['init', 'test-file-system'], False)
    23602363tests.addTest('loopback01', ['test_main'])
  • freebsd/sys/sys/file.h

    r69b29a0 rcaf8ede  
    255255extern struct fileops vnops;
    256256extern struct fileops badfileops;
     257#ifndef __rtems__
    257258extern struct fileops socketops;
     259#else /* __rtems__ */
     260extern const rtems_filesystem_file_handlers_r socketops;
     261#endif /* __rtems__ */
    258262extern int maxfiles;            /* kernel limit on number of open files */
    259263extern int maxfilesperproc;     /* per process limit on number of open files */
     
    281285int _fdrop(struct file *fp, struct thread *td);
    282286
     287#ifndef __rtems__
    283288/*
    284289 * The socket operations are used a couple of places.
     
    294299fo_stat_t       soo_stat;
    295300fo_close_t      soo_close;
     301#endif /* __rtems__ */
    296302
    297303#ifndef __rtems__
  • freebsd/sys/sys/sysproto.h

    r69b29a0 rcaf8ede  
    351351        char prio_l_[PADL_(int)]; int prio; char prio_r_[PADR_(int)];
    352352};
     353#endif /* __rtems__ */
    353354struct socket_args {
    354355        char domain_l_[PADL_(int)]; int domain; char domain_r_[PADR_(int)];
     
    356357        char protocol_l_[PADL_(int)]; int protocol; char protocol_r_[PADR_(int)];
    357358};
     359#ifndef __rtems__
    358360struct connect_args {
    359361        char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
  • rtemsbsd/include/machine/rtems-bsd-syscall-api.h

    r69b29a0 rcaf8ede  
    4747#include <sys/cdefs.h>
    4848#include <sys/select.h>
     49#include <sys/socket.h>
    4950
    5051__BEGIN_DECLS
     
    5556int     select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
    5657
     58int     socket(int, int, int);
     59
    5760__END_DECLS
    5861
  • rtemsbsd/rtems/rtems-bsd-syscalls.c

    r69b29a0 rcaf8ede  
    194194 */
    195195int
    196 socket (int domain, int type, int protocol)
    197 {
    198         struct thread *td;
    199         struct socket *so;
    200         int fd, error;
    201 
    202         td = curthread;
    203         if (!td) {
    204           printf("Current thread NULL\n");
    205           exit(0);
    206         }
    207 #ifdef MAC
    208         error = mac_socket_check_create(td->td_ucred, domain, type, protocol);
    209         if (error == 0 )
    210         {
    211 #endif
    212                 /* An extra reference on `fp' has been held for us by falloc(). */
    213                 error = socreate(domain, &so, type, protocol, td->td_ucred, td);
    214                 if (error == 0) {
    215                         fd = rtems_bsdnet_makeFdForSocket (so);
    216                         if (fd < 0)
    217                         {
    218                                 soclose (so);
    219                                 error = EBADF;
    220                         }
    221                 }
    222 #ifdef MAC
    223         }
    224 #endif
    225         if( error == 0 )
    226         {
    227                 return fd;
    228         }
    229         errno = error;
    230         return -1;
    231 }
    232 
    233 int
    234196kern_bind(td, fd, sa)
    235197        struct thread *td;
Note: See TracChangeset for help on using the changeset viewer.