9 #include <sys/socket.h>
10 #include <netinet/in.h>
12 #include <net/gen/in.h>
13 #include <net/gen/tcp.h>
14 #include <net/gen/tcp_io.h>
15 #include <net/gen/udp.h>
16 #include <net/gen/udp_io.h>
19 * Put a socket in listening mode.
22 __listen(int fd
, int backlog
)
26 memset(&m
, 0, sizeof(m
));
27 m
.m_lc_vfs_listen
.fd
= fd
;
28 m
.m_lc_vfs_listen
.backlog
= backlog
;
30 return _syscall(VFS_PROC_NR
, VFS_LISTEN
, &m
);
33 int listen(int sock
, int backlog
)
37 r
= __listen(sock
, backlog
);
38 if (r
!= -1 || (errno
!= ENOTSOCK
&& errno
!= ENOSYS
))
41 r
= ioctl(sock
, NWIOTCPLISTENQ
, &backlog
);
42 if (r
!= -1 || errno
!= ENOTTY
)
45 r
= ioctl(sock
, NWIOSUDSBLOG
, &backlog
);
46 if (r
!= -1 || errno
!= ENOTTY
)