Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140129318
D22814.id66737.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D22814.id66737.diff
View Options
Index: sys/compat/linux/linux_socket.c
===================================================================
--- sys/compat/linux/linux_socket.c
+++ sys/compat/linux/linux_socket.c
@@ -746,25 +746,19 @@
int
linux_socketpair(struct thread *td, struct linux_socketpair_args *args)
{
- struct socketpair_args /* {
- int domain;
- int type;
- int protocol;
- int *rsv;
- } */ bsd_args;
- int error;
+ int domain, error, sv[2], type;
- bsd_args.domain = linux_to_bsd_domain(args->domain);
- if (bsd_args.domain != PF_LOCAL)
+ domain = linux_to_bsd_domain(args->domain);
+ if (domain != PF_LOCAL)
return (EAFNOSUPPORT);
- bsd_args.type = args->type & LINUX_SOCK_TYPE_MASK;
- if (bsd_args.type < 0 || bsd_args.type > LINUX_SOCK_MAX)
+ type = args->type & LINUX_SOCK_TYPE_MASK;
+ if (type < 0 || type > LINUX_SOCK_MAX)
return (EINVAL);
error = linux_set_socket_flags(args->type & ~LINUX_SOCK_TYPE_MASK,
- &bsd_args.type);
+ &type);
if (error != 0)
return (error);
- if (args->protocol != 0 && args->protocol != PF_UNIX)
+ if (args->protocol != 0 && args->protocol != PF_UNIX) {
/*
* Use of PF_UNIX as protocol argument is not right,
@@ -773,10 +767,16 @@
* to FreeBSD one.
*/
return (EPROTONOSUPPORT);
- else
- bsd_args.protocol = 0;
- bsd_args.rsv = (int *)PTRIN(args->rsv);
- return (sys_socketpair(td, &bsd_args));
+ }
+ error = kern_socketpair(td, domain, type, 0, sv);
+ if (error != 0)
+ return (error);
+ error = copyout(sv, PTRIN(args->rsv), 2 * sizeof(int));
+ if (error != 0) {
+ (void)kern_close(td, sv[0]);
+ (void)kern_close(td, sv[1]);
+ }
+ return (error);
}
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 21, 3:27 PM (7 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27115181
Default Alt Text
D22814.id66737.diff (1 KB)
Attached To
Mode
D22814: Make linux(4) use kern_socketpair(9)
Attached
Detach File
Event Timeline
Log In to Comment