PageRenderTime 48ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

lib/libc/sys-minix/listen.c

http://www.minix3.org/
C | 37 lines | 29 code | 8 blank | 0 comment | 8 complexity | a788b4530ee1c30fa17b5e9c76e6e72a MD5 | raw file
Possible License(s): MIT, WTFPL, AGPL-1.0, BSD-3-Clause, GPL-3.0, LGPL-2.0, JSON, 0BSD
  1. #include <sys/cdefs.h>
  2. #include "namespace.h"
  3. #include <errno.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <sys/ioctl.h>
  7. #include <sys/socket.h>
  8. #include <netinet/in.h>
  9. #include <net/gen/in.h>
  10. #include <net/gen/tcp.h>
  11. #include <net/gen/tcp_io.h>
  12. #include <net/gen/udp.h>
  13. #include <net/gen/udp_io.h>
  14. #define DEBUG 0
  15. int listen(int sock, int backlog)
  16. {
  17. int r;
  18. r= ioctl(sock, NWIOTCPLISTENQ, &backlog);
  19. if (r != -1 || errno != EBADIOCTL)
  20. return r;
  21. r= ioctl(sock, NWIOSUDSBLOG, &backlog);
  22. if (r != -1 || errno != EBADIOCTL)
  23. return r;
  24. #if DEBUG
  25. fprintf(stderr, "listen: not implemented for fd %d\n", sock);
  26. #endif
  27. errno= ENOSYS;
  28. return -1;
  29. }