From 8848222728635ff95385c41c095cdfd2fddaceaf Mon Sep 17 00:00:00 2001 From: hackerchai Date: Wed, 7 Aug 2024 14:48:15 +0800 Subject: [PATCH] feat(c/libuv): Add GetIoWatcherFd func using LLGoFiles --- c/libuv/_wrap/libuv.c | 5 +++++ c/libuv/libuv.go | 1 + c/libuv/net.go | 5 +++++ 3 files changed, 11 insertions(+) create mode 100644 c/libuv/_wrap/libuv.c diff --git a/c/libuv/_wrap/libuv.c b/c/libuv/_wrap/libuv.c new file mode 100644 index 00000000..d3d51448 --- /dev/null +++ b/c/libuv/_wrap/libuv.c @@ -0,0 +1,5 @@ +#include + +int uv_tcp_get_io_watcher_fd (uv_tcp_t* handle) { + return handle->io_watcher.fd; +} \ No newline at end of file diff --git a/c/libuv/libuv.go b/c/libuv/libuv.go index 4dbaeddf..2bf343a8 100644 --- a/c/libuv/libuv.go +++ b/c/libuv/libuv.go @@ -9,6 +9,7 @@ import ( const ( LLGoPackage = "link: $(pkg-config --libs libuv); -luv" + LLGoFiles = "$(pkg-config --cflags libuv): _wrap/libuv.c" ) // ---------------------------------------------- diff --git a/c/libuv/net.go b/c/libuv/net.go index 80e8f186..a8de9458 100644 --- a/c/libuv/net.go +++ b/c/libuv/net.go @@ -378,6 +378,11 @@ func (tcp *Tcp) CloseReset(closeCb CloseCb) c.Int { return 0 } +// llgo:link (*Tcp).GetIoWatcherFd C.uv_tcp_get_io_watcher_fd +func (tcp *Tcp) GetIoWatcherFd() c.Int { + return 0 +} + //go:linkname TcpConnect C.uv_tcp_connect func TcpConnect(req *Connect, tcp *Tcp, addr *net.SockAddr, connectCb ConnectCb) c.Int