I built on Nick Dandoulakis an answer for a similar use case. I wanted to find the definition of the socket function in glibc. This finds a bunch of functions with a โsocketโ in the name, but socket not found, emphasizing what many others said: there may be better ways to extract this information, such as tools provided by compilers.
Then
$ cd glibc $ find . -name "*.c" -print0 | xargs -0 -n 1 python find_functions.py | grep ':.*socket' ./hurd/hurdsock.c: _hurd_socket_server (int domain, int dead) ./manual/examples/mkfsock.c: make_named_socket (const char *filename) ./manual/examples/mkisock.c: make_socket (uint16_t port) ./nscd/connections.c: close_sockets (void) ./nscd/nscd.c: nscd_open_socket (void) ./nscd/nscd_helper.c: wait_on_socket (int sock, long int usectmo) ./nscd/nscd_helper.c: open_socket (request_type type, const char *key, size_t keylen) ./nscd/nscd_helper.c: __nscd_open_socket (const char *key, size_t keylen, request_type type, ./socket/socket.c: __socket (int domain, int type, int protocol) ./socket/socketpair.c: socketpair (int domain, int type, int protocol, int fds[2]) ./sunrpc/key_call.c: key_call_socket (u_long proc, xdrproc_t xdr_arg, char *arg, ./sunrpc/pm_getport.c: __get_socket (struct sockaddr_in *saddr) ./sysdeps/mach/hurd/socket.c: __socket (int domain, int type, int protocol) ./sysdeps/mach/hurd/socketpair.c: __socketpair (int domain, int type, int protocol, int fds[2]) ./sysdeps/unix/sysv/linux/socket.c: __socket (int fd, int type, int domain) ./sysdeps/unix/sysv/linux/socketpair.c: __socketpair (int domain, int type, int protocol, int sv[2])
In my case, this and this can help me, besides it looks like I will need to read the assembly code in order to reuse the strategy described there.
source share