xref: /plan9-contrib/sys/src/ape/lib/bsd/sendto.c (revision 14f51593fd82e19ba95969a8c07ff71131015979)
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, void *, int)
15 {
16 	/* actually, should do connect if not done already */
17 	return send(fd, a, n, flags);
18 }
19 
20 int
21 recvfrom(int fd, void *a, int n, int flags,
22 	void *from, int *fromlen)
23 {
24 	if(getsockname(fd, from, fromlen) < 0)
25 		return -1;
26 	return recv(fd, a, n, flags);
27 }
28