native: net: Make _native_tap_fd static
One global variable less is always good.
This commit is contained in:
parent
88a81a3753
commit
800b057fac
@ -36,7 +36,11 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
int tap_init(char *name);
|
int tap_init(char *name);
|
||||||
|
|
||||||
extern int _native_tap_fd;
|
/**
|
||||||
|
* Close tap device
|
||||||
|
*/
|
||||||
|
void tap_cleanup(void);
|
||||||
|
|
||||||
extern unsigned char _native_tap_mac[ETHER_ADDR_LEN];
|
extern unsigned char _native_tap_mac[ETHER_ADDR_LEN];
|
||||||
|
|
||||||
struct nativenet_header {
|
struct nativenet_header {
|
||||||
|
|||||||
@ -73,9 +73,7 @@ int reboot_arch(int mode)
|
|||||||
/* TODO: close stdio fds */
|
/* TODO: close stdio fds */
|
||||||
#endif
|
#endif
|
||||||
#ifdef MODULE_NATIVENET
|
#ifdef MODULE_NATIVENET
|
||||||
if (_native_tap_fd != -1) {
|
tap_cleanup();
|
||||||
real_close(_native_tap_fd);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (real_execve(_native_argv[0], _native_argv, NULL) == -1) {
|
if (real_execve(_native_argv[0], _native_argv, NULL) == -1) {
|
||||||
|
|||||||
@ -351,4 +351,15 @@ int tap_init(char *name)
|
|||||||
DEBUG("RIOT native tap initialized.\n");
|
DEBUG("RIOT native tap initialized.\n");
|
||||||
return _native_tap_fd;
|
return _native_tap_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tap_cleanup(void)
|
||||||
|
{
|
||||||
|
if (_native_tap_fd == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
real_close(_native_tap_fd);
|
||||||
|
_native_tap_fd = -1;
|
||||||
|
|
||||||
|
}
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user