Back to index

glibc  2.9
recv.c File Reference
#include <errno.h>
#include <sys/socket.h>
#include <hurd.h>
#include <hurd/fd.h>
#include <hurd/socket.h>
#include <string.h>

Go to the source code of this file.


ssize_t __recv (int fd, void *buf, size_t n, int flags)

Function Documentation

ssize_t __recv ( int  fd,
void *  buf,
size_t  n,
int  flags 

Definition at line 30 of file recv.c.

  error_t err;
  mach_port_t addrport;
  char *bufp = buf;
  mach_msg_type_number_t nread = n;
  mach_port_t *ports;
  mach_msg_type_number_t nports = 0;
  char *cdata = NULL;
  mach_msg_type_number_t clen = 0;

  if (err = HURD_DPORT_USE (fd, __socket_recv (port, &addrport,
                                          flags, &bufp, &nread,
                                          &ports, &nports,
                                          &cdata, &clen,
    return __hurd_sockfail (fd, flags, err);

  __mach_port_deallocate (__mach_task_self (), addrport);
  __vm_deallocate (__mach_task_self (), (vm_address_t) cdata, clen);

  if (bufp != buf)
      memcpy (buf, bufp, nread);
      __vm_deallocate (__mach_task_self (), (vm_address_t) bufp, nread);

  return nread;

Here is the call graph for this function:

Here is the caller graph for this function: