You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/09/28 02:29:40 UTC
[GitHub] [trafficserver] maskit commented on a change in pull request #8331: Change the function signature of safe_[get|set]sockopt
maskit commented on a change in pull request #8331:
URL: https://github.com/apache/trafficserver/pull/8331#discussion_r717175181
##########
File path: include/tscore/ink_sock.h
##########
@@ -34,8 +34,8 @@
#include "tscore/ink_apidefs.h"
-int safe_setsockopt(int s, int level, int optname, char *optval, int optlevel);
-int safe_getsockopt(int s, int level, int optname, char *optval, int *optlevel);
+int safe_setsockopt(int s, int level, int optname, void *optval, int optlevel);
+int safe_getsockopt(int s, int level, int optname, void *optval, int *optlevel);
Review comment:
I kept my change minimal.
If I change `int *` to `socklen_t *` I have to deal with the error below at all places that call `safe_getsockopt`. I could just reinterpret_cast at all the places but I guess some of the places can declare variables as `unsigned int` and don't need any casts. I don't want to check and fix that.
```
/Users/mkitajo/src/github.com/trafficserver/iocore/eventsystem/P_UnixSocketManager.h:482:11: error: no matching function for call to 'safe_getsockopt'
r = safe_getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&bsz, &bszsz);
^~~~~~~~~~~~~~~
../../include/tscore/ink_sock.h:38:5: note: candidate function not viable: no known conversion from 'int *' to 'socklen_t *' (aka 'unsigned int *') for 5th argument
int safe_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlevel);
^
```
I added `const` for `optval` for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org