* Renamed THREAD_FLAGS_IOCTL_SYSCALL to THREAD_FLAGS_SYSCALL,
syscall_restart_ioctl_is_restarted() to syscall_restart_is_restarted, IoctlSyscallFlagUnsetter to SyscallFlagUnsetter, and IoctlSyscallRestartWrapper to SyscallRestartWrapper, as they are no longer only used for ioctl(). * Removed unused syscall_restart_ioctl_handle_post(). * Made SyscallRestartWrapper a lot fancier. Instead of storing a reference to the result value, it stores the value itself, and it features all the interesting operators that make it appear like that value. This simplifies the use of the class quite a bit. * THREAD_FLAGS_SYSCALL is now set for all socket function and the read[v](), write[v]() syscalls. * Added is_syscall() function and net_stack hook to the net stack. * Removed "kernel" parameter from all net_stack_interface and net_socket module hooks. They aren't need any longer, since is_syscall() can be used instead. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24914 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
#include <net_stack.h>
|
||||
#include <net_stat.h>
|
||||
|
||||
#include "utility.h"
|
||||
|
||||
|
||||
struct net_socket_private : net_socket {
|
||||
struct list_link link;
|
||||
@@ -243,8 +245,7 @@ socket_writev(net_socket *socket, const iovec *vecs, size_t vecCount,
|
||||
|
||||
|
||||
status_t
|
||||
socket_control(net_socket *socket, int32 op, void *data, size_t length,
|
||||
bool kernel)
|
||||
socket_control(net_socket *socket, int32 op, void *data, size_t length)
|
||||
{
|
||||
switch (op) {
|
||||
case FIONBIO:
|
||||
@@ -253,14 +254,14 @@ socket_control(net_socket *socket, int32 op, void *data, size_t length,
|
||||
return B_BAD_VALUE;
|
||||
|
||||
int value;
|
||||
if (kernel) {
|
||||
value = *(int*)data;
|
||||
} else {
|
||||
if (is_syscall()) {
|
||||
if (!IS_USER_ADDRESS(data)
|
||||
|| user_memcpy(&value, data, sizeof(int)) != B_OK) {
|
||||
return B_BAD_ADDRESS;
|
||||
}
|
||||
}
|
||||
} else
|
||||
value = *(int*)data;
|
||||
|
||||
return socket_setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &value,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user