recv.c 327 B

12345678910111213141516171819202122
  1. #include <sys/socket.h>
  2. #include <nlusctl.h>
  3. int uc_recv(int fd, void* buf, int len)
  4. {
  5. struct iovec iov = {
  6. .base = buf + 2,
  7. .len = len - 2
  8. };
  9. struct msghdr hdr = {
  10. .name = NULL,
  11. .namelen = 0,
  12. .iov = &iov,
  13. .iovlen = 1,
  14. .control = NULL,
  15. .controllen = 0,
  16. .flags = 0
  17. };
  18. return sys_recvmsg(fd, &hdr, 0);
  19. }