[DTrace-devel] [PATCH] bpf: dt_inet_ntoa() should return the length of its result

Eugene Loh eugene.loh at oracle.com
Fri Jul 21 21:29:55 UTC 2023


s/Thid/This/

And does this change make sense?  Without companion changes to 
subr_arg_to_tstring, the return value is simply ignored.  (We fill %r0 
without first reading its value.)  So, while I can see this change 
conceivably making sense, it needs to be partnered with some other work 
as well.

On 7/21/23 14:00, Kris Van Hees via DTrace-devel wrote:
> The implementation of inet_ntoa6() and inet_ntop() is greatly helped if
> dt_inet_ntoa() returns the number of characters in its result.  Thid
> change is not visible to users.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   bpf/inet_ntoa.S | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/bpf/inet_ntoa.S b/bpf/inet_ntoa.S
> index 1ef3b13a..08b63b8d 100644
> --- a/bpf/inet_ntoa.S
> +++ b/bpf/inet_ntoa.S
> @@ -114,7 +114,7 @@ dt_inet_ntoa_write_uint8:
>   #undef PTR
>   
>   /*
> - * void dt_inet_ntoa(uint8_t *src, char *dst) {
> + * uint64_t dt_inet_ntoa(uint8_t *src, char *dst) {
>    *     uint64_t off, inp, len;
>    *
>    *     bpf_probe_read(fp + -4, 4, src);
> @@ -142,6 +142,8 @@ dt_inet_ntoa_write_uint8:
>    *
>    *     done:
>    *     dst[off] = '\0';
> + *
> + *     return off;
>    * }
>    *
>    */



More information about the DTrace-devel mailing list