* Introduced a reader_thread member to the private net_device_interface.
* When shutting down an interface, we now wait until its reader thread is gone, too; this is necessary in case the kernel unloads the networking stack before the reader thread had a chance to exit. * Added some debug output to net_socket in case you ask for unknown options. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19741 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
86e355a227
commit
de8a7c2680
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -520,13 +520,13 @@ interface_protocol_up(net_datalink_protocol *_protocol)
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
snprintf(name, sizeof(name), "%s reader", device->name);
|
||||
|
||||
thread_id thread = spawn_kernel_thread(device_reader_thread, name,
|
||||
deviceInterface->reader_thread = spawn_kernel_thread(device_reader_thread, name,
|
||||
B_REAL_TIME_DISPLAY_PRIORITY - 10, deviceInterface);
|
||||
if (thread < B_OK)
|
||||
return thread;
|
||||
if (deviceInterface->reader_thread < B_OK)
|
||||
return deviceInterface->reader_thread;
|
||||
|
||||
device->flags |= IFF_UP;
|
||||
resume_thread(thread);
|
||||
resume_thread(deviceInterface->reader_thread);
|
||||
|
||||
deviceInterface->up_count = 1;
|
||||
return B_OK;
|
||||
@ -552,6 +552,10 @@ interface_protocol_down(net_datalink_protocol *_protocol)
|
||||
|
||||
device->flags &= ~IFF_UP;
|
||||
protocol->device_module->down(protocol->device);
|
||||
|
||||
// make sure the reader thread is gone before shutting down the interface
|
||||
status_t status;
|
||||
wait_for_thread(deviceInterface->reader_thread, &status);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -34,6 +34,7 @@ struct net_device_interface {
|
||||
const char *name;
|
||||
struct net_device_module_info *module;
|
||||
struct net_device *device;
|
||||
thread_id reader_thread;
|
||||
uint32 up_count;
|
||||
// a device can be brought up by more than one interface
|
||||
int32 ref_count;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -716,6 +716,7 @@ socket_getsockopt(net_socket *socket, int level, int option, void *value,
|
||||
break;
|
||||
}
|
||||
|
||||
dprintf("socket_getsockopt: unknown option %d\n", option);
|
||||
return ENOPROTOOPT;
|
||||
}
|
||||
|
||||
@ -996,6 +997,7 @@ socket_setsockopt(net_socket *socket, int level, int option, const void *value,
|
||||
break;
|
||||
}
|
||||
|
||||
dprintf("socket_setsockopt: unknown option %d\n", option);
|
||||
return ENOPROTOOPT;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user