mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 00:43:24 +00:00
Implement (un)register_observer
for TCP/UDP
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
29ebf8e60c
commit
8628543067
@ -3,6 +3,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/poll.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
@ -170,3 +171,22 @@ FN_TEST(accept)
|
||||
TEST_ERRNO(accept(sk_connected, psaddr, &addrlen), EOPNOTSUPP);
|
||||
}
|
||||
END_TEST()
|
||||
|
||||
FN_TEST(poll)
|
||||
{
|
||||
struct pollfd pfd = { .events = POLLIN | POLLOUT };
|
||||
|
||||
pfd.fd = sk_unbound;
|
||||
// FIXME: Uncomment this
|
||||
// TEST_RES(poll(&pfd, 1, 0),
|
||||
// (pfd.revents & (POLLIN | POLLOUT)) == POLLOUT);
|
||||
|
||||
pfd.fd = sk_bound;
|
||||
TEST_RES(poll(&pfd, 1, 0),
|
||||
(pfd.revents & (POLLIN | POLLOUT)) == POLLOUT);
|
||||
|
||||
pfd.fd = sk_connected;
|
||||
TEST_RES(poll(&pfd, 1, 0),
|
||||
(pfd.revents & (POLLIN | POLLOUT)) == POLLOUT);
|
||||
}
|
||||
END_TEST()
|
||||
|
Reference in New Issue
Block a user