[devkitPPC/libogc] getsockname() missing

Post Reply
Midar
Posts: 4
Joined: Thu Jun 13, 2013 1:51 am

[devkitPPC/libogc] getsockname() missing

Post by Midar » Thu Jun 13, 2013 2:07 am

The net_getsockname() function seems to be missing. I added the following implementation and it seems to work:

Code: Select all

s32 net_getsockname(s32 s, struct sockaddr *addr, socklen_t *addrlen)
{
       STACK_ALIGN(u32, _socket, 1, 32);
       STACK_ALIGN(u8, _addr, sizeof(struct sockaddr), 32);
       s32 ret;

       if (net_ip_top_fd < 0) return -ENXIO;
       if (*addrlen<sizeof(struct sockaddr)) return -ENOMEM;

       *_socket = s;
       ret = _net_convert_error(IOS_Ioctl(net_ip_top_fd, IOCTL_SO_GETSOCKNAME, 

       memcpy(addr, _addr, sizeof(struct sockaddr));

       return ret;
}
Please review this patch and commit it if it is good.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests