Introduce some more SO_ option equivalents from Linux to FreeBSD.

The msg variable in linux_recvmsg() was not initialized.
Copy it from userspace.

Submitted by: rdivacky
This commit is contained in:
Konstantin Belousov 2007-02-01 13:36:19 +00:00
parent 75ee4e5462
commit d0b2365eec
3 changed files with 32 additions and 0 deletions

View File

@ -662,6 +662,13 @@ union l_semun {
#define LINUX_SO_NO_CHECK 11
#define LINUX_SO_PRIORITY 12
#define LINUX_SO_LINGER 13
#define LINUX_SO_PEERCRED 17
#define LINUX_SO_RCVLOWAT 18
#define LINUX_SO_SNDLOWAT 19
#define LINUX_SO_RCVTIMEO 20
#define LINUX_SO_SNDTIMEO 21
#define LINUX_SO_TIMESTAMP 29
#define LINUX_SO_ACCEPTCONN 30
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2

View File

@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <sys/syscallsubr.h>
#include <sys/uio.h>
#include <sys/syslog.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@ -292,6 +293,20 @@ linux_to_bsd_so_sockopt(int opt)
return (SO_OOBINLINE);
case LINUX_SO_LINGER:
return (SO_LINGER);
case LINUX_SO_PEERCRED:
return (LOCAL_PEERCRED);
case LINUX_SO_RCVLOWAT:
return (SO_RCVLOWAT);
case LINUX_SO_SNDLOWAT:
return (SO_SNDLOWAT);
case LINUX_SO_RCVTIMEO:
return (SO_RCVTIMEO);
case LINUX_SO_SNDTIMEO:
return (SO_SNDTIMEO);
case LINUX_SO_TIMESTAMP:
return (SO_TIMESTAMP);
case LINUX_SO_ACCEPTCONN:
return (SO_ACCEPTCONN);
}
return (-1);
}
@ -1048,6 +1063,9 @@ linux_recvmsg(struct thread *td, struct linux_recvmsg_args *args)
if ((error = copyin(args, &linux_args, sizeof(linux_args))))
return (error);
if ((error = copyin(PTRIN(args->msg), &msg, sizeof (msg))))
return (error);
bsd_args.s = linux_args.s;
bsd_args.msg = PTRIN(linux_args.msg);
bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags);

View File

@ -633,6 +633,13 @@ union l_semun {
#define LINUX_SO_NO_CHECK 11
#define LINUX_SO_PRIORITY 12
#define LINUX_SO_LINGER 13
#define LINUX_SO_PEERCRED 17
#define LINUX_SO_RCVLOWAT 18
#define LINUX_SO_SNDLOWAT 19
#define LINUX_SO_RCVTIMEO 20
#define LINUX_SO_SNDTIMEO 21
#define LINUX_SO_TIMESTAMP 29
#define LINUX_SO_ACCEPTCONN 30
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2