2012-05-08 02:41:05 +00:00
|
|
|
#include "marignotti.h"
|
|
|
|
#include <gno/kerntool.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
2012-05-13 23:45:14 +00:00
|
|
|
#include "s16debug.h"
|
|
|
|
|
|
|
|
|
2012-05-08 02:41:05 +00:00
|
|
|
#pragma noroot
|
|
|
|
#pragma optimize 79
|
|
|
|
|
2012-05-15 01:30:27 +00:00
|
|
|
|
|
|
|
|
2012-05-08 02:41:05 +00:00
|
|
|
int mgetsockname(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5)
|
|
|
|
{
|
2012-05-15 01:30:27 +00:00
|
|
|
xsockaddr_in tmp;
|
2012-05-08 02:41:05 +00:00
|
|
|
|
2012-05-15 01:30:27 +00:00
|
|
|
xsockaddr_in *addr = (xsockaddr_in *)p3;
|
2012-05-08 02:41:05 +00:00
|
|
|
int *addrlen = (int *)p4;
|
2012-05-13 23:45:14 +00:00
|
|
|
|
|
|
|
if (Debug > 0)
|
|
|
|
{
|
|
|
|
s16_debug_printf("getsockname");
|
|
|
|
}
|
|
|
|
|
2012-05-08 02:41:05 +00:00
|
|
|
|
2012-05-15 01:44:13 +00:00
|
|
|
if (!addrlen || !addr) return EINVAL;
|
|
|
|
if (!*addrlen) return 0;
|
2012-05-08 02:41:05 +00:00
|
|
|
|
2012-05-15 01:30:27 +00:00
|
|
|
tmp.sin_family = AF_INET;
|
2012-05-08 02:41:05 +00:00
|
|
|
IncBusy();
|
2012-05-15 01:30:27 +00:00
|
|
|
tmp.sin_port = TCPIPGetSourcePort(e->ipid);
|
|
|
|
tmp.sin_addr = TCPIPGetMyIPAddress();
|
2012-05-08 02:41:05 +00:00
|
|
|
DecBusy();
|
|
|
|
|
|
|
|
|
2012-05-15 01:30:27 +00:00
|
|
|
copy_addr(&tmp, addr, addrlen);
|
2012-05-08 02:41:05 +00:00
|
|
|
|
|
|
|
return 0;
|
2016-01-06 00:59:13 +00:00
|
|
|
}
|