Cygwin: fhandler_socket: define socketpair as virtual function
...in preparation of moving the type and protocol test into the actual classes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
5b6cbef9e0
commit
1e5e44a9a5
@ -544,6 +544,8 @@ class fhandler_socket: public fhandler_base
|
|||||||
char *get_proc_fd_name (char *buf);
|
char *get_proc_fd_name (char *buf);
|
||||||
|
|
||||||
virtual int socket (int af, int type, int protocol, int flags) = 0;
|
virtual int socket (int af, int type, int protocol, int flags) = 0;
|
||||||
|
virtual int socketpair (int af, int type, int protocol, int flags,
|
||||||
|
fhandler_socket *fh_out) = 0;
|
||||||
virtual int bind (const struct sockaddr *name, int namelen) = 0;
|
virtual int bind (const struct sockaddr *name, int namelen) = 0;
|
||||||
virtual int listen (int backlog) = 0;
|
virtual int listen (int backlog) = 0;
|
||||||
virtual int accept4 (struct sockaddr *peer, int *len, int flags) = 0;
|
virtual int accept4 (struct sockaddr *peer, int *len, int flags) = 0;
|
||||||
@ -683,6 +685,8 @@ class fhandler_socket_inet: public fhandler_socket_wsock
|
|||||||
~fhandler_socket_inet ();
|
~fhandler_socket_inet ();
|
||||||
|
|
||||||
int socket (int af, int type, int protocol, int flags);
|
int socket (int af, int type, int protocol, int flags);
|
||||||
|
int socketpair (int af, int type, int protocol, int flags,
|
||||||
|
fhandler_socket *fh_out);
|
||||||
int bind (const struct sockaddr *name, int namelen);
|
int bind (const struct sockaddr *name, int namelen);
|
||||||
int listen (int backlog);
|
int listen (int backlog);
|
||||||
int accept4 (struct sockaddr *peer, int *len, int flags);
|
int accept4 (struct sockaddr *peer, int *len, int flags);
|
||||||
@ -769,7 +773,7 @@ class fhandler_socket_local: public fhandler_socket_wsock
|
|||||||
|
|
||||||
int socket (int af, int type, int protocol, int flags);
|
int socket (int af, int type, int protocol, int flags);
|
||||||
int socketpair (int af, int type, int protocol, int flags,
|
int socketpair (int af, int type, int protocol, int flags,
|
||||||
fhandler_socket_local *fh_out);
|
fhandler_socket *fh_out);
|
||||||
int bind (const struct sockaddr *name, int namelen);
|
int bind (const struct sockaddr *name, int namelen);
|
||||||
int listen (int backlog);
|
int listen (int backlog);
|
||||||
int accept4 (struct sockaddr *peer, int *len, int flags);
|
int accept4 (struct sockaddr *peer, int *len, int flags);
|
||||||
@ -838,7 +842,7 @@ class fhandler_socket_unix : public fhandler_socket
|
|||||||
|
|
||||||
int socket (int af, int type, int protocol, int flags);
|
int socket (int af, int type, int protocol, int flags);
|
||||||
int socketpair (int af, int type, int protocol, int flags,
|
int socketpair (int af, int type, int protocol, int flags,
|
||||||
fhandler_socket_unix *fh_out);
|
fhandler_socket *fh_out);
|
||||||
int bind (const struct sockaddr *name, int namelen);
|
int bind (const struct sockaddr *name, int namelen);
|
||||||
int listen (int backlog);
|
int listen (int backlog);
|
||||||
int accept4 (struct sockaddr *peer, int *len, int flags);
|
int accept4 (struct sockaddr *peer, int *len, int flags);
|
||||||
|
@ -720,6 +720,14 @@ fhandler_socket_inet::socket (int af, int type, int protocol, int flags)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
fhandler_socket_inet::socketpair (int af, int type, int protocol, int flags,
|
||||||
|
fhandler_socket *fh_out)
|
||||||
|
{
|
||||||
|
set_errno (EAFNOSUPPORT);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_socket_inet::bind (const struct sockaddr *name, int namelen)
|
fhandler_socket_inet::bind (const struct sockaddr *name, int namelen)
|
||||||
{
|
{
|
||||||
|
@ -255,13 +255,15 @@ fhandler_socket_local::socket (int af, int type, int protocol, int flags)
|
|||||||
|
|
||||||
int
|
int
|
||||||
fhandler_socket_local::socketpair (int af, int type, int protocol, int flags,
|
fhandler_socket_local::socketpair (int af, int type, int protocol, int flags,
|
||||||
fhandler_socket_local *fh_out)
|
fhandler_socket *_fh_out)
|
||||||
{
|
{
|
||||||
SOCKET insock = INVALID_SOCKET;
|
SOCKET insock = INVALID_SOCKET;
|
||||||
SOCKET outsock = INVALID_SOCKET;
|
SOCKET outsock = INVALID_SOCKET;
|
||||||
SOCKET sock = INVALID_SOCKET;
|
SOCKET sock = INVALID_SOCKET;
|
||||||
struct sockaddr_in sock_in, sock_out;
|
struct sockaddr_in sock_in, sock_out;
|
||||||
int len;
|
int len;
|
||||||
|
fhandler_socket_local *fh_out = reinterpret_cast<fhandler_socket_local *>
|
||||||
|
(_fh_out);
|
||||||
|
|
||||||
/* create listening socket */
|
/* create listening socket */
|
||||||
sock = ::socket (AF_INET, type, 0);
|
sock = ::socket (AF_INET, type, 0);
|
||||||
|
@ -235,7 +235,7 @@ fhandler_socket_unix::socket (int af, int type, int protocol, int flags)
|
|||||||
|
|
||||||
int
|
int
|
||||||
fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags,
|
fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags,
|
||||||
fhandler_socket_unix *fh_out)
|
fhandler_socket *fh_out)
|
||||||
{
|
{
|
||||||
set_errno (EAFNOSUPPORT);
|
set_errno (EAFNOSUPPORT);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -2303,7 +2303,7 @@ socketpair (int af, int type, int protocol, int *sb)
|
|||||||
{
|
{
|
||||||
int res = -1;
|
int res = -1;
|
||||||
const device *dev;
|
const device *dev;
|
||||||
fhandler_socket_local *fh_in, *fh_out;
|
fhandler_socket *fh_in, *fh_out;
|
||||||
|
|
||||||
int flags = type & _SOCK_FLAG_MASK;
|
int flags = type & _SOCK_FLAG_MASK;
|
||||||
type &= ~_SOCK_FLAG_MASK;
|
type &= ~_SOCK_FLAG_MASK;
|
||||||
@ -2349,8 +2349,8 @@ socketpair (int af, int type, int protocol, int *sb)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
fh_in = reinterpret_cast<fhandler_socket_local *> (build_fh_dev (*dev));
|
fh_in = reinterpret_cast<fhandler_socket *> (build_fh_dev (*dev));
|
||||||
fh_out = reinterpret_cast<fhandler_socket_local *> (build_fh_dev (*dev));
|
fh_out = reinterpret_cast<fhandler_socket *> (build_fh_dev (*dev));
|
||||||
if (fh_in && fh_out
|
if (fh_in && fh_out
|
||||||
&& fh_in->socketpair (af, type, protocol, flags, fh_out) == 0)
|
&& fh_in->socketpair (af, type, protocol, flags, fh_out) == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user