mirror of
https://github.com/mii443/qemu.git
synced 2025-12-09 22:18:23 +00:00
sockets: move fd_is_socket() into common sockets code
The fd_is_socket() helper method is useful in a few places, so put it in the common sockets code. Make the code more compact while moving it. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
committed by
Daniel P. Berrangé
parent
abd983c0e0
commit
58dc31f1a7
@@ -91,6 +91,14 @@ NetworkAddressFamily inet_netfamily(int family)
|
||||
return NETWORK_ADDRESS_FAMILY_UNKNOWN;
|
||||
}
|
||||
|
||||
bool fd_is_socket(int fd)
|
||||
{
|
||||
int optval;
|
||||
socklen_t optlen = sizeof(optval);
|
||||
return !qemu_getsockopt(fd, SOL_SOCKET, SO_TYPE, &optval, &optlen);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Matrix we're trying to apply
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user