-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wasi-sockets: Add services database and implement getservbyname/getservbyport functions #532
base: main
Are you sure you want to change the base?
Conversation
Initially, I reviewed the macOS's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
I wonder if we want to bother with the complexity of including a "full" version here? How many folks will actually find that useful?
Also, I wonder if the name "full" is correct, since even with ~300 entries its still a subset of what it could be. If we really do want a "full" version should use the filesystem to actually load /etc/services
? Maybe not.
That's valid point. One option could be to remove the bigger optional db, which keeps things simple, but leave the weak symbol definition. So, if application requires specific db, it can still override the default one. |
That simpler option SGTM |
b9d1fad
to
84f6f6f
Compare
I removed the bigger db from the PR. |
This is a follow-up PR for #524 by implementing the following features:
getaddrinfo
to resolve named services in the address info. For examplegetaddrinfo("google.com", "https", NULL, &res);
getservbyname
andgetservbyport
functions. These functions are implemented using a static variable (global_serv
), which holds the returned service entry. This approach is acceptable because these functions are defined as not being thread-safe.Additionally, this PR introduces an optional, more comprehensive services database (sockets_full_services_db.c
), based on Debian Bookworm's/etc/services
file (320 entries). To use this database, link with the-lc-full-services-db
flag.