| ... | ... | @@ -1598,6 +1598,10 @@ pub const libc = struct { |
| 1598 | 1598 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getsid.html |
| 1599 | 1599 | pub extern fn getsid(pid: pid_t) pid_t; |
| 1600 | 1600 | |
| 1601 | /// int getsockname(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len); |
| 1602 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getsockname.html |
| 1603 | pub extern fn getsockname(fd: c_int, noalias addr: *struct_sockaddr, noalias len: *socklen_t) c_int; |
| 1604 | |
| 1601 | 1605 | /// uid_t getuid(void); |
| 1602 | 1606 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getuid.html |
| 1603 | 1607 | pub extern fn getuid() uid_t; |
| ... | ... | @@ -3167,3 +3171,8 @@ pub fn writev(fd: c_int, iovec: []const struct_iovec) !usize { |
| 3167 | 3171 | std.debug.assert(rc >= 0); |
| 3168 | 3172 | return @intCast(rc); |
| 3169 | 3173 | } |
| 3174 | pub fn getsockname(socketfd: c_uint, noalias address: *struct_sockaddr, noalias address_len: *socklen_t) errno.Error!void { |
| 3175 | const rc = libc.getsockname(@intCast(socketfd), address, address_len); |
| 3176 | if (rc == -1) return errno.fromInt(errno.fromLibC()); |
| 3177 | std.debug.assert(rc == 0); |
| 3178 | } |