add support for finding nxlink host

This commit is contained in:
Dave Murphy 2018-03-15 20:32:21 +00:00 committed by plutoo
parent 213676c5f8
commit e8fdd73561
2 changed files with 12 additions and 0 deletions

View File

@ -678,6 +678,8 @@ struct sockaddr_in6 {
extern const struct in6_addr in6addr_any; extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback; extern const struct in6_addr in6addr_loopback;
extern struct in_addr __nxlink_host;
#endif #endif
#endif /* !_NETINET_IN_H_*/ #endif /* !_NETINET_IN_H_*/

View File

@ -1,5 +1,8 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h>
#include <netinet/in.h>
#include "result.h" #include "result.h"
#include "runtime/env.h" #include "runtime/env.h"
#include "kernel/svc.h" #include "kernel/svc.h"
@ -7,6 +10,7 @@
// System globals we define here // System globals we define here
int __system_argc; int __system_argc;
char** __system_argv; char** __system_argv;
struct in_addr __nxlink_host;
extern char* fake_heap_start; extern char* fake_heap_start;
extern char* fake_heap_end; extern char* fake_heap_end;
@ -136,6 +140,12 @@ void argvSetup(void)
__system_argc++; __system_argc++;
} }
if (strncmp(__system_argv[__system_argc - 1], "NXLINKED", 8) == 0 ) {
__system_argc--;
__nxlink_host.s_addr = strtoul(&__system_argv[__system_argc][8], NULL, 16);
}
__system_argv[__system_argc] = NULL; __system_argv[__system_argc] = NULL;
} }