]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/net/tcpip/v2_0/src/lib/recvfrom.c
Initial revision
[karo-tx-redboot.git] / packages / net / tcpip / v2_0 / src / lib / recvfrom.c
1 //==========================================================================
2 //
3 //      lib/recvfrom.c
4 //
5 //      recvfrom() system call
6 //
7 //==========================================================================
8 //####BSDCOPYRIGHTBEGIN####
9 //
10 // -------------------------------------------
11 //
12 // Portions of this software may have been derived from OpenBSD or other sources,
13 // and are covered by the appropriate copyright disclaimers included herein.
14 //
15 // -------------------------------------------
16 //
17 //####BSDCOPYRIGHTEND####
18 //==========================================================================
19 //#####DESCRIPTIONBEGIN####
20 //
21 // Author(s):    gthomas
22 // Contributors: gthomas
23 // Date:         2000-01-10
24 // Purpose:      
25 // Description:  
26 //              
27 //
28 //####DESCRIPTIONEND####
29 //
30 //==========================================================================
31
32
33 #include <sys/param.h>
34 #include <cyg/io/file.h>
35 #include <sys/socket.h>
36 #include <sys/socketvar.h>
37
38 #include <sys/syscallargs.h>
39
40 ssize_t 
41 recvfrom(int s, const void *buf, size_t buflen, 
42        int flags, const struct sockaddr *from, socklen_t *fromlen)
43 {
44     struct sys_recvfrom_args args;
45     int res, error;
46     SYSCALLARG(args,s) = s;
47     SYSCALLARG(args,buf) = (void *)buf;
48     SYSCALLARG(args,len) = buflen;
49     SYSCALLARG(args,flags) = flags; 
50     SYSCALLARG(args,from) = (struct sockaddr *)from;
51     SYSCALLARG(args,fromlenaddr) = fromlen;
52     error = sys_recvfrom(&args, &res);
53     if (error) {
54         errno = error;
55         return -1;
56     } else {
57         return res;
58     }
59 }