xref: /plan9-contrib/sys/src/ape/lib/bsd/sendto.c (revision 7dd7cddf99dd7472612f1413b4da293630e6b1bc)
1 /* posix */
2 #include <sys/types.h>
3 #include <unistd.h>
4 #include <fcntl.h>
5 #include <errno.h>
6 
7 /* bsd extensions */
8 #include <sys/uio.h>
9 #include <sys/socket.h>
10 
11 #include "priv.h"
12 
13 int
14 sendto(int fd, void *a, int n, int flags,
15 	void *to, int tolen)
16 {
17 	/* actually, should do connect if not done already */
18 	return send(fd, a, n, flags);
19 }
20 
21 int
22 recvfrom(int fd, void *a, int n, int flags,
23 	void *from, int *fromlen)
24 {
25 	if(getsockname(fd, from, fromlen) < 0)
26 		return -1;
27 	return recv(fd, a, n, flags);
28 }
29