svn commit: r321026 - in stable/10/sys: amd64/linux compat/linux

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 18:25:59 2017
New Revision: 321026
URL: https://svnweb.freebsd.org/changeset/base/321026

Log:
  MFC r305994 (by emaste@):
  
  Catch up to sys/capability.h rename to sys/capsicum.h in r263232

Modified:
  stable/10/sys/amd64/linux/linux_machdep.c
  stable/10/sys/compat/linux/linux_event.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux_machdep.c
==
--- stable/10/sys/amd64/linux/linux_machdep.c   Sat Jul 15 18:08:20 2017
(r321025)
+++ stable/10/sys/amd64/linux/linux_machdep.c   Sat Jul 15 18:25:59 2017
(r321026)
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 

Modified: stable/10/sys/compat/linux/linux_event.c
==
--- stable/10/sys/compat/linux/linux_event.cSat Jul 15 18:08:20 2017
(r321025)
+++ stable/10/sys/compat/linux/linux_event.cSat Jul 15 18:25:59 2017
(r321026)
@@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321025 - stable/10/sys/compat/linux

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 18:08:20 2017
New Revision: 321025
URL: https://svnweb.freebsd.org/changeset/base/321025

Log:
  MFC r298071 (by pfg@):
  
  compat/linux: for pointers replace 0 with NULL.
  
  plvc is a pointer, no functional change.
  
  Found with devel/coccinelle.

Modified:
  stable/10/sys/compat/linux/linux_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_ioctl.c
==
--- stable/10/sys/compat/linux/linux_ioctl.cSat Jul 15 18:05:28 2017
(r321024)
+++ stable/10/sys/compat/linux/linux_ioctl.cSat Jul 15 18:08:20 2017
(r321025)
@@ -2912,7 +2912,7 @@ linux_v4l_cliplist_copy(struct l_video_window *lvw, st
vw->clips = NULL;
ppvc = &(vw->clips);
while (clipcount-- > 0) {
-   if (plvc == 0) {
+   if (plvc == NULL) {
error = EFAULT;
break;
} else {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321024 - in stable/10/sys: amd64/linux amd64/linux32 i386/linux

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 18:05:28 2017
New Revision: 321024
URL: https://svnweb.freebsd.org/changeset/base/321024

Log:
  MFC r297597 (by bapt@):
  
  Add kern.features flags for linux and linux64 modules
  
  kern.features.linux: 1 meaning linux 32 bits binaries are supported
  kern.features.linux64: 1 meaning linux 64 bits binaries are supported
  
  The goal here is to help 3rd party applications (including ports) to determine
  if the host do support linux emulation
  
  Relnotes: yes

Modified:
  stable/10/sys/amd64/linux/linux_sysvec.c
  stable/10/sys/amd64/linux32/linux32_sysvec.c
  stable/10/sys/i386/linux/linux_sysvec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux_sysvec.c
==
--- stable/10/sys/amd64/linux/linux_sysvec.cSat Jul 15 17:59:28 2017
(r321023)
+++ stable/10/sys/amd64/linux/linux_sysvec.cSat Jul 15 18:05:28 2017
(r321024)
@@ -990,3 +990,4 @@ static moduledata_t linux64_elf_mod = {
 
 DECLARE_MODULE_TIED(linux64elf, linux64_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY);
 MODULE_DEPEND(linux64elf, linux_common, 1, 1, 1);
+FEATURE(linux64, "Linux 64bit support");

Modified: stable/10/sys/amd64/linux32/linux32_sysvec.c
==
--- stable/10/sys/amd64/linux32/linux32_sysvec.cSat Jul 15 17:59:28 
2017(r321023)
+++ stable/10/sys/amd64/linux32/linux32_sysvec.cSat Jul 15 18:05:28 
2017(r321024)
@@ -1208,3 +1208,4 @@ static moduledata_t linux_elf_mod = {
 
 DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY);
 MODULE_DEPEND(linuxelf, linux_common, 1, 1, 1);
+FEATURE(linux, "Linux 32bit support");

Modified: stable/10/sys/i386/linux/linux_sysvec.c
==
--- stable/10/sys/i386/linux/linux_sysvec.c Sat Jul 15 17:59:28 2017
(r321023)
+++ stable/10/sys/i386/linux/linux_sysvec.c Sat Jul 15 18:05:28 2017
(r321024)
@@ -1203,3 +1203,4 @@ static moduledata_t linux_elf_mod = {
 };
 
 DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY);
+FEATURE(linux, "Linux 32bit support");
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321022 - stable/10/sys/compat/linux

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 17:44:29 2017
New Revision: 321022
URL: https://svnweb.freebsd.org/changeset/base/321022

Log:
  MFC r296503:
  
  Linux accept() system call return EOPNOTSUPP errno instead of EINVAL
  for UDP sockets.
  
  MFC r296504:
  
  Does not leak fp. While here remove bogus cast of fp->f_data.
  
  MFC r313913:
  
  Initialize cap_rights before use.

Modified:
  stable/10/sys/compat/linux/linux_socket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_socket.c
==
--- stable/10/sys/compat/linux/linux_socket.c   Sat Jul 15 17:28:03 2017
(r321021)
+++ stable/10/sys/compat/linux/linux_socket.c   Sat Jul 15 17:44:29 2017
(r321022)
@@ -836,7 +836,10 @@ linux_accept_common(struct thread *td, int s, l_uintpt
socklen_t * __restrict anamelen;
int flags;
} */ bsd_args;
-   int error;
+   cap_rights_t rights;
+   struct socket *so;
+   struct file *fp;
+   int error, error1;
 
bsd_args.s = s;
/* XXX: */
@@ -851,6 +854,18 @@ linux_accept_common(struct thread *td, int s, l_uintpt
if (error) {
if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
return (EINVAL);
+   if (error == EINVAL) {
+   error1 = getsock_cap(td, s,
+   cap_rights_init(, CAP_ACCEPT), , NULL);
+   if (error1 != 0)
+   return (error1);
+   so = fp->f_data;
+   if (so->so_type == SOCK_DGRAM) {
+   fdrop(fp, td);
+   return (EOPNOTSUPP);
+   }
+   fdrop(fp, td);
+   }
return (error);
}
if (addr)
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321021 - in stable/10/sys: kern netinet sys

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 17:28:03 2017
New Revision: 321021
URL: https://svnweb.freebsd.org/changeset/base/321021

Log:
  MFC r281437 (by mjg@):
  
  Replace struct filedesc argument in getsock_cap with struct thread
  
  This is is a step towards removal of spurious arguments.

Modified:
  stable/10/sys/kern/uipc_syscalls.c
  stable/10/sys/netinet/sctp_syscalls.c
  stable/10/sys/sys/socketvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/uipc_syscalls.c
==
--- stable/10/sys/kern/uipc_syscalls.c  Sat Jul 15 17:25:40 2017
(r321020)
+++ stable/10/sys/kern/uipc_syscalls.c  Sat Jul 15 17:28:03 2017
(r321021)
@@ -150,17 +150,17 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, sfstat, CTLTYPE_OPAQU
  * A reference on the file entry is held upon returning.
  */
 int
-getsock_cap(struct filedesc *fdp, int fd, cap_rights_t *rightsp,
+getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
 struct file **fpp, u_int *fflagp)
 {
struct file *fp;
int error;
 
-   error = fget_unlocked(fdp, fd, rightsp, 0, , NULL);
+   error = fget_unlocked(td->td_proc->p_fd, fd, rightsp, 0, , NULL);
if (error != 0)
return (error);
if (fp->f_type != DTYPE_SOCKET) {
-   fdrop(fp, curthread);
+   fdrop(fp, td);
return (ENOTSOCK);
}
if (fflagp != NULL)
@@ -258,8 +258,8 @@ kern_bindat(struct thread *td, int dirfd, int fd, stru
 
AUDIT_ARG_FD(fd);
AUDIT_ARG_SOCKADDR(td, dirfd, sa);
-   error = getsock_cap(td->td_proc->p_fd, fd,
-   cap_rights_init(, CAP_BIND), , NULL);
+   error = getsock_cap(td, fd, cap_rights_init(, CAP_BIND),
+   , NULL);
if (error != 0)
return (error);
so = fp->f_data;
@@ -326,8 +326,8 @@ sys_listen(td, uap)
int error;
 
AUDIT_ARG_FD(uap->s);
-   error = getsock_cap(td->td_proc->p_fd, uap->s,
-   cap_rights_init(, CAP_LISTEN), , NULL);
+   error = getsock_cap(td, uap->s, cap_rights_init(, CAP_LISTEN),
+   , NULL);
if (error == 0) {
so = fp->f_data;
 #ifdef MAC
@@ -403,7 +403,6 @@ int
 kern_accept4(struct thread *td, int s, struct sockaddr **name,
 socklen_t *namelen, int flags, struct file **fp)
 {
-   struct filedesc *fdp;
struct file *headfp, *nfp = NULL;
struct sockaddr *sa = NULL;
struct socket *head, *so;
@@ -416,8 +415,7 @@ kern_accept4(struct thread *td, int s, struct sockaddr
*name = NULL;
 
AUDIT_ARG_FD(s);
-   fdp = td->td_proc->p_fd;
-   error = getsock_cap(fdp, s, cap_rights_init(, CAP_ACCEPT),
+   error = getsock_cap(td, s, cap_rights_init(, CAP_ACCEPT),
, );
if (error != 0)
return (error);
@@ -624,8 +622,8 @@ kern_connectat(struct thread *td, int dirfd, int fd, s
 
AUDIT_ARG_FD(fd);
AUDIT_ARG_SOCKADDR(td, dirfd, sa);
-   error = getsock_cap(td->td_proc->p_fd, fd,
-   cap_rights_init(, CAP_CONNECT), , NULL);
+   error = getsock_cap(td, fd, cap_rights_init(, CAP_CONNECT),
+   , NULL);
if (error != 0)
return (error);
so = fp->f_data;
@@ -892,7 +890,7 @@ kern_sendit(td, s, mp, flags, control, segflg)
AUDIT_ARG_SOCKADDR(td, AT_FDCWD, mp->msg_name);
cap_rights_set(, CAP_CONNECT);
}
-   error = getsock_cap(td->td_proc->p_fd, s, , , NULL);
+   error = getsock_cap(td, s, , , NULL);
if (error != 0)
return (error);
so = (struct socket *)fp->f_data;
@@ -1092,8 +1090,8 @@ kern_recvit(td, s, mp, fromseg, controlp)
*controlp = NULL;
 
AUDIT_ARG_FD(s);
-   error = getsock_cap(td->td_proc->p_fd, s,
-   cap_rights_init(, CAP_RECV), , NULL);
+   error = getsock_cap(td, s, cap_rights_init(, CAP_RECV),
+   , NULL);
if (error != 0)
return (error);
so = fp->f_data;
@@ -1407,8 +1405,8 @@ sys_shutdown(td, uap)
int error;
 
AUDIT_ARG_FD(uap->s);
-   error = getsock_cap(td->td_proc->p_fd, uap->s,
-   cap_rights_init(, CAP_SHUTDOWN), , NULL);
+   error = getsock_cap(td, uap->s, cap_rights_init(, CAP_SHUTDOWN),
+   , NULL);
if (error == 0) {
so = fp->f_data;
error = soshutdown(so, uap->how);
@@ -1472,8 +1470,8 @@ kern_setsockopt(td, s, level, name, val, valseg, valsi
}
 
AUDIT_ARG_FD(s);
-   error = getsock_cap(td->td_proc->p_fd, s,
-   cap_rights_init(, CAP_SETSOCKOPT), , NULL);
+   error = getsock_cap(td, s, cap_rights_init(, CAP_SETSOCKOPT),
+   , NULL);
if (error == 0) {
so = fp->f_data;
error = sosetopt(so, );
@@ -1553,8 +1551,8 @@ kern_getsockopt(td, s, level, name, 

svn commit: r321020 - in stable/10/sys: compat/svr4 dev/streams kern netinet ofed/include/linux sys

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 17:25:40 2017
New Revision: 321020
URL: https://svnweb.freebsd.org/changeset/base/321020

Log:
  MFC r281436 (by mjg@):
  
  fd: remove filedesc argument from fdclose
  
  Just accept a thread instead. This makes it consistent with fdalloc.
  
  No functional changes.

Modified:
  stable/10/sys/compat/svr4/svr4_stream.c
  stable/10/sys/dev/streams/streams.c
  stable/10/sys/kern/kern_descrip.c
  stable/10/sys/kern/kern_fork.c
  stable/10/sys/kern/sys_pipe.c
  stable/10/sys/kern/tty_pts.c
  stable/10/sys/kern/uipc_mqueue.c
  stable/10/sys/kern/uipc_sem.c
  stable/10/sys/kern/uipc_shm.c
  stable/10/sys/kern/uipc_syscalls.c
  stable/10/sys/netinet/sctp_syscalls.c
  stable/10/sys/ofed/include/linux/file.h
  stable/10/sys/sys/filedesc.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/svr4/svr4_stream.c
==
--- stable/10/sys/compat/svr4/svr4_stream.c Sat Jul 15 17:03:35 2017
(r321019)
+++ stable/10/sys/compat/svr4/svr4_stream.c Sat Jul 15 17:25:40 2017
(r321020)
@@ -1828,7 +1828,7 @@ svr4_do_getmsg(td, uap, fp)
break;
 
default:
-   fdclose(td->td_proc->p_fd, afp, st->s_afd, td);
+   fdclose(td, afp, st->s_afd);
fdrop(afp, td);
st->s_afd = -1;
mtx_unlock();
@@ -1966,7 +1966,7 @@ svr4_do_getmsg(td, uap, fp)
 
if (error) {
if (afp) {
-   fdclose(td->td_proc->p_fd, afp, st->s_afd, td);
+   fdclose(td, afp, st->s_afd);
fdrop(afp, td);
st->s_afd = -1;
}

Modified: stable/10/sys/dev/streams/streams.c
==
--- stable/10/sys/dev/streams/streams.c Sat Jul 15 17:03:35 2017
(r321019)
+++ stable/10/sys/dev/streams/streams.c Sat Jul 15 17:25:40 2017
(r321020)
@@ -188,7 +188,6 @@ MODULE_DEPEND(streams, svr4elf, 1, 1, 1);
 static  int
 streamsopen(struct cdev *dev, int oflags, int devtype, struct thread *td)
 {
-   struct filedesc *fdp;
struct svr4_strm *st;
struct socket *so;
struct file *fp;
@@ -244,14 +243,13 @@ streamsopen(struct cdev *dev, int oflags, int devtype,
  return EOPNOTSUPP;
}
 
-   fdp = td->td_proc->p_fd;
if ((error = falloc(td, , , 0)) != 0)
  return error;
/* An extra reference on `fp' has been held for us by falloc(). */
 
error = socreate(family, , type, protocol, td->td_ucred, td);
if (error) {
-  fdclose(fdp, fp, fd, td);
+  fdclose(td, fp, fd);
   fdrop(fp, td);
   return error;
}

Modified: stable/10/sys/kern/kern_descrip.c
==
--- stable/10/sys/kern/kern_descrip.c   Sat Jul 15 17:03:35 2017
(r321019)
+++ stable/10/sys/kern/kern_descrip.c   Sat Jul 15 17:25:40 2017
(r321020)
@@ -2184,8 +2184,9 @@ setugidsafety(struct thread *td)
  * file descriptor out from under the thread creating the file object.
  */
 void
-fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td)
+fdclose(struct thread *td, struct file *fp, int idx)
 {
+   struct filedesc *fdp = td->td_proc->p_fd;
 
FILEDESC_XLOCK(fdp);
if (fdp->fd_ofiles[idx].fde_file == fp) {

Modified: stable/10/sys/kern/kern_fork.c
==
--- stable/10/sys/kern/kern_fork.c  Sat Jul 15 17:03:35 2017
(r321019)
+++ stable/10/sys/kern/kern_fork.c  Sat Jul 15 17:25:40 2017
(r321020)
@@ -983,7 +983,7 @@ fail2:
uma_zfree(proc_zone, newproc);
 #ifdef PROCDESC
if ((flags & RFPROCDESC) != 0 && fp_procdesc != NULL) {
-   fdclose(td->td_proc->p_fd, fp_procdesc, *procdescp, td);
+   fdclose(td, fp_procdesc, *procdescp);
fdrop(fp_procdesc, td);
}
 #endif

Modified: stable/10/sys/kern/sys_pipe.c
==
--- stable/10/sys/kern/sys_pipe.c   Sat Jul 15 17:03:35 2017
(r321019)
+++ stable/10/sys/kern/sys_pipe.c   Sat Jul 15 17:25:40 2017
(r321020)
@@ -403,13 +403,11 @@ kern_pipe(struct thread *td, int fildes[2])
 int
 kern_pipe2(struct thread *td, int fildes[2], int flags)
 {
-   struct filedesc *fdp; 
struct file *rf, *wf;
struct pipe *rpipe, *wpipe;
struct pipepair *pp;
int fd, fflags, error;
 
-   fdp = td->td_proc->p_fd;
pipe_paircreate(td, );
rpipe = >pp_rpipe;
wpipe = >pp_wpipe;
@@ -435,7 +433,7 @@ kern_pipe2(struct thread *td, int fildes[2], int flags
finit(rf, fflags, 

svn commit: r321019 - stable/10/sys/netinet

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 17:03:35 2017
New Revision: 321019
URL: https://svnweb.freebsd.org/changeset/base/321019

Log:
  MFC r284613 (by tuexen@):
  
  When using KTRACE, set a variable to the appropriate value and don't
  leave it initialized at NULL.

Modified:
  stable/10/sys/netinet/sctp_syscalls.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/sctp_syscalls.c
==
--- stable/10/sys/netinet/sctp_syscalls.c   Sat Jul 15 17:00:43 2017
(r321018)
+++ stable/10/sys/netinet/sctp_syscalls.c   Sat Jul 15 17:03:35 2017
(r321019)
@@ -277,6 +277,10 @@ sys_sctp_generic_sendmsg (td, uap)
auio.uio_td = td;
auio.uio_offset = 0;/* XXX */
auio.uio_resid = 0;
+#ifdef KTRACE
+   if (KTRPOINT(td, KTR_GENIO))
+   ktruio = cloneuio();
+#endif /* KTRACE */
len = auio.uio_resid = uap->mlen;
CURVNET_SET(so->so_vnet);
error = sctp_lower_sosend(so, to, , (struct mbuf *)NULL,
@@ -400,6 +404,10 @@ sys_sctp_generic_sendmsg_iov(td, uap)
goto sctp_bad;
}
}
+#ifdef KTRACE
+   if (KTRPOINT(td, KTR_GENIO))
+   ktruio = cloneuio();
+#endif /* KTRACE */
len = auio.uio_resid;
CURVNET_SET(so->so_vnet);
error = sctp_lower_sosend(so, to, ,
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321018 - in stable/10/sys: compat/freebsd32 kern

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 17:00:43 2017
New Revision: 321018
URL: https://svnweb.freebsd.org/changeset/base/321018

Log:
  Regen after r321017.
  Move the SCTP syscalls to netinet with the rest of the SCTP code.

Modified:
  stable/10/sys/compat/freebsd32/freebsd32_sysent.c
  stable/10/sys/kern/init_sysent.c

Modified: stable/10/sys/compat/freebsd32/freebsd32_sysent.c
==
--- stable/10/sys/compat/freebsd32/freebsd32_sysent.c   Sat Jul 15 16:55:02 
2017(r321017)
+++ stable/10/sys/compat/freebsd32/freebsd32_sysent.c   Sat Jul 15 17:00:43 
2017(r321018)
@@ -517,10 +517,10 @@ struct sysent freebsd32_sysent[] = {
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 468 = nosys */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 469 = __getpath_fromfd */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 470 = __getpath_fromaddr */
-   { AS(sctp_peeloff_args), (sy_call_t *)sys_sctp_peeloff, AUE_NULL, NULL, 
0, 0, 0, SY_THR_STATIC },   /* 471 = sctp_peeloff */
-   { AS(sctp_generic_sendmsg_args), (sy_call_t *)sys_sctp_generic_sendmsg, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   /* 472 = sctp_generic_sendmsg */
-   { AS(sctp_generic_sendmsg_iov_args), (sy_call_t 
*)sys_sctp_generic_sendmsg_iov, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   
/* 473 = sctp_generic_sendmsg_iov */
-   { AS(sctp_generic_recvmsg_args), (sy_call_t *)sys_sctp_generic_recvmsg, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   /* 474 = sctp_generic_recvmsg */
+   { AS(sctp_peeloff_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
0, SY_THR_ABSENT },  /* 471 = sctp_peeloff */
+   { AS(sctp_generic_sendmsg_args), (sy_call_t *)lkmressys, AUE_NULL, 
NULL, 0, 0, 0, SY_THR_ABSENT },  /* 472 = sctp_generic_sendmsg */
+   { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)lkmressys, AUE_NULL, 
NULL, 0, 0, 0, SY_THR_ABSENT },  /* 473 = sctp_generic_sendmsg_iov */
+   { AS(sctp_generic_recvmsg_args), (sy_call_t *)lkmressys, AUE_NULL, 
NULL, 0, 0, 0, SY_THR_ABSENT },  /* 474 = sctp_generic_recvmsg */
 #ifdef PAD64_REQUIRED
{ AS(freebsd32_pread_args), (sy_call_t *)freebsd32_pread, AUE_PREAD, 
NULL, 0, 0, 0, SY_THR_STATIC },/* 475 = freebsd32_pread */
{ AS(freebsd32_pwrite_args), (sy_call_t *)freebsd32_pwrite, AUE_PWRITE, 
NULL, 0, 0, 0, SY_THR_STATIC }, /* 476 = freebsd32_pwrite */

Modified: stable/10/sys/kern/init_sysent.c
==
--- stable/10/sys/kern/init_sysent.cSat Jul 15 16:55:02 2017
(r321017)
+++ stable/10/sys/kern/init_sysent.cSat Jul 15 17:00:43 2017
(r321018)
@@ -504,10 +504,10 @@ struct sysent sysent[] = {
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 468 = nosys */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 469 = __getpath_fromfd */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 470 = __getpath_fromaddr */
-   { AS(sctp_peeloff_args), (sy_call_t *)sys_sctp_peeloff, AUE_NULL, NULL, 
0, 0, SYF_CAPENABLED, SY_THR_STATIC },  /* 471 = sctp_peeloff */
-   { AS(sctp_generic_sendmsg_args), (sy_call_t *)sys_sctp_generic_sendmsg, 
AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },  /* 472 = 
sctp_generic_sendmsg */
-   { AS(sctp_generic_sendmsg_iov_args), (sy_call_t 
*)sys_sctp_generic_sendmsg_iov, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, 
SY_THR_STATIC },  /* 473 = sctp_generic_sendmsg_iov */
-   { AS(sctp_generic_recvmsg_args), (sy_call_t *)sys_sctp_generic_recvmsg, 
AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },  /* 474 = 
sctp_generic_recvmsg */
+   { AS(sctp_peeloff_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_ABSENT }, /* 471 = sctp_peeloff */
+   { AS(sctp_generic_sendmsg_args), (sy_call_t *)lkmressys, AUE_NULL, 
NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 472 = sctp_generic_sendmsg */
+   { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)lkmressys, AUE_NULL, 
NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 473 = 
sctp_generic_sendmsg_iov */
+   { AS(sctp_generic_recvmsg_args), (sy_call_t *)lkmressys, AUE_NULL, 
NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 474 = sctp_generic_recvmsg */
{ AS(pread_args), (sy_call_t *)sys_pread, AUE_PREAD, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },   /* 475 = pread */
{ AS(pwrite_args), (sy_call_t *)sys_pwrite, AUE_PWRITE, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },/* 476 = pwrite */
{ AS(mmap_args), (sy_call_t *)sys_mmap, AUE_MMAP, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },  /* 477 = mmap */

svn commit: r321017 - in stable/10/sys: compat/freebsd32 conf kern netinet sys

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 16:55:02 2017
New Revision: 321017
URL: https://svnweb.freebsd.org/changeset/base/321017

Log:
  MFC r272823:
  
  Move the SCTP syscalls to netinet with the rest of the SCTP code.  The
  syscalls themselves are tightly coupled with the network stack and
  therefore should not be in the generic socket code.
  
  The following four syscalls have been marked as NOSTD so they can be
  dynamically registered in sctp_syscalls_init() function:
sys_sctp_peeloff
sys_sctp_generic_sendmsg
sys_sctp_generic_sendmsg_iov
sys_sctp_generic_recvmsg
  
  The syscalls are also set up to be dynamically registered when COMPAT32
  option is configured.
  
  As a side effect of moving the SCTP syscalls, getsock_cap needs to be
  made available outside of the uipc_syscalls.c source file.  A proper
  prototype has been added to the sys/socketvar.h header file.
  
  API tests from the SCTP reference implementation have been run to ensure
  compatibility. (http://code.google.com/p/sctp-refimpl/source/checkout)

Added:
  stable/10/sys/netinet/sctp_syscalls.c
 - copied unchanged from r272823, head/sys/netinet/sctp_syscalls.c
Modified:
  stable/10/sys/compat/freebsd32/syscalls.master
  stable/10/sys/conf/files
  stable/10/sys/kern/syscalls.master
  stable/10/sys/kern/uipc_syscalls.c
  stable/10/sys/sys/socketvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/freebsd32/syscalls.master
==
--- stable/10/sys/compat/freebsd32/syscalls.master  Sat Jul 15 16:52:40 
2017(r321016)
+++ stable/10/sys/compat/freebsd32/syscalls.master  Sat Jul 15 16:55:02 
2017(r321017)
@@ -845,14 +845,14 @@
 468AUE_NULLUNIMPL  nosys
 469AUE_NULLUNIMPL  __getpath_fromfd
 470AUE_NULLUNIMPL  __getpath_fromaddr
-471AUE_NULLNOPROTO { int sctp_peeloff(int sd, uint32_t name); }
-472AUE_NULLNOPROTO { int sctp_generic_sendmsg(int sd, caddr_t msg, 
int mlen, \
+471AUE_NULLNOPROTO|NOSTD   { int sctp_peeloff(int sd, uint32_t 
name); }
+472AUE_NULLNOPROTO|NOSTD   { int sctp_generic_sendmsg(int sd, 
caddr_t msg, int mlen, \
caddr_t to, __socklen_t tolen, \
struct sctp_sndrcvinfo *sinfo, int flags); }
-473AUE_NULLNOPROTO { int sctp_generic_sendmsg_iov(int sd, struct 
iovec *iov, int iovlen, \
+473AUE_NULLNOPROTO|NOSTD   { int sctp_generic_sendmsg_iov(int sd, 
struct iovec *iov, int iovlen, \
caddr_t to, __socklen_t tolen, \
struct sctp_sndrcvinfo *sinfo, int flags); }
-474AUE_NULLNOPROTO { int sctp_generic_recvmsg(int sd, struct iovec 
*iov, int iovlen, \
+474AUE_NULLNOPROTO|NOSTD   { int sctp_generic_recvmsg(int sd, 
struct iovec *iov, int iovlen, \
struct sockaddr * from, __socklen_t 
*fromlenaddr, \
struct sctp_sndrcvinfo *sinfo, int 
*msg_flags); }
 #ifdef PAD64_REQUIRED

Modified: stable/10/sys/conf/files
==
--- stable/10/sys/conf/filesSat Jul 15 16:52:40 2017(r321016)
+++ stable/10/sys/conf/filesSat Jul 15 16:55:02 2017(r321017)
@@ -3570,6 +3570,7 @@ netinet/sctp_output.c optional inet sctp | 
inet6 sctp
 netinet/sctp_pcb.c optional inet sctp | inet6 sctp
 netinet/sctp_peeloff.c optional inet sctp | inet6 sctp
 netinet/sctp_ss_functions.coptional inet sctp | inet6 sctp
+netinet/sctp_syscalls.coptional inet sctp | inet6 sctp
 netinet/sctp_sysctl.c  optional inet sctp | inet6 sctp
 netinet/sctp_timer.c   optional inet sctp | inet6 sctp
 netinet/sctp_usrreq.c  optional inet sctp | inet6 sctp

Modified: stable/10/sys/kern/syscalls.master
==
--- stable/10/sys/kern/syscalls.master  Sat Jul 15 16:52:40 2017
(r321016)
+++ stable/10/sys/kern/syscalls.master  Sat Jul 15 16:55:02 2017
(r321017)
@@ -837,14 +837,14 @@
 468AUE_NULLUNIMPL  nosys
 469AUE_NULLUNIMPL  __getpath_fromfd
 470AUE_NULLUNIMPL  __getpath_fromaddr
-471AUE_NULLSTD { int sctp_peeloff(int sd, uint32_t name); }
-472 AUE_NULLSTD{ int sctp_generic_sendmsg(int sd, caddr_t msg, 
int mlen, \
+471AUE_NULLNOSTD   { int sctp_peeloff(int sd, uint32_t name); }
+472 AUE_NULLNOSTD  { int sctp_generic_sendmsg(int sd, caddr_t msg, 
int mlen, \
caddr_t to, __socklen_t tolen, \
struct sctp_sndrcvinfo *sinfo, int flags); }
-473 AUE_NULLSTD{ int 

svn commit: r321016 - stable/10/sys/kern

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 16:52:40 2017
New Revision: 321016
URL: https://svnweb.freebsd.org/changeset/base/321016

Log:
  Temporarily r284696:
  
  MFC r284613. When using KTRACE, set a variable to the appropriate value
  and don't leave it initialized at NULL.
  
  Will MFC it after proper MFC of r272823.

Modified:
  stable/10/sys/kern/uipc_syscalls.c

Modified: stable/10/sys/kern/uipc_syscalls.c
==
--- stable/10/sys/kern/uipc_syscalls.c  Sat Jul 15 16:42:55 2017
(r321015)
+++ stable/10/sys/kern/uipc_syscalls.c  Sat Jul 15 16:52:40 2017
(r321016)
@@ -2746,10 +2746,6 @@ sys_sctp_generic_sendmsg (td, uap)
auio.uio_td = td;
auio.uio_offset = 0;/* XXX */
auio.uio_resid = 0;
-#ifdef KTRACE
-   if (KTRPOINT(td, KTR_GENIO))
-   ktruio = cloneuio();
-#endif /* KTRACE */
len = auio.uio_resid = uap->mlen;
CURVNET_SET(so->so_vnet);
error = sctp_lower_sosend(so, to, , (struct mbuf *)NULL,
@@ -2873,10 +2869,6 @@ sys_sctp_generic_sendmsg_iov(td, uap)
goto sctp_bad;
}
}
-#ifdef KTRACE
-   if (KTRPOINT(td, KTR_GENIO))
-   ktruio = cloneuio();
-#endif /* KTRACE */
len = auio.uio_resid;
CURVNET_SET(so->so_vnet);
error = sctp_lower_sosend(so, to, ,
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321014 - stable/10/sys/amd64/linux

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 15:26:38 2017
New Revision: 321014
URL: https://svnweb.freebsd.org/changeset/base/321014

Log:
  MFC r293908:
  
  Regen after get_robust_list fix.

Modified:
  stable/10/sys/amd64/linux/linux_proto.h
  stable/10/sys/amd64/linux/linux_systrace_args.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux_proto.h
==
--- stable/10/sys/amd64/linux/linux_proto.h Sat Jul 15 15:21:43 2017
(r321013)
+++ stable/10/sys/amd64/linux/linux_proto.h Sat Jul 15 15:26:38 2017
(r321014)
@@ -965,7 +965,7 @@ struct linux_set_robust_list_args {
 };
 struct linux_get_robust_list_args {
char pid_l_[PADL_(l_int)]; l_int pid; char pid_r_[PADR_(l_int)];
-   char head_l_[PADL_(struct linux_robust_list_head *)]; struct 
linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head 
*)];
+   char head_l_[PADL_(struct linux_robust_list_head **)]; struct 
linux_robust_list_head ** head; char head_r_[PADR_(struct 
linux_robust_list_head **)];
char len_l_[PADL_(l_size_t *)]; l_size_t * len; char 
len_r_[PADR_(l_size_t *)];
 };
 struct linux_splice_args {

Modified: stable/10/sys/amd64/linux/linux_systrace_args.c
==
--- stable/10/sys/amd64/linux/linux_systrace_args.c Sat Jul 15 15:21:43 
2017(r321013)
+++ stable/10/sys/amd64/linux/linux_systrace_args.c Sat Jul 15 15:26:38 
2017(r321014)
@@ -2020,7 +2020,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg
case 274: {
struct linux_get_robust_list_args *p = params;
iarg[0] = p->pid; /* l_int */
-   uarg[1] = (intptr_t) p->head; /* struct linux_robust_list_head 
* */
+   uarg[1] = (intptr_t) p->head; /* struct linux_robust_list_head 
** */
uarg[2] = (intptr_t) p->len; /* l_size_t * */
*n_args = 3;
break;
@@ -5347,7 +5347,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d
p = "l_int";
break;
case 1:
-   p = "struct linux_robust_list_head *";
+   p = "struct linux_robust_list_head **";
break;
case 2:
p = "l_size_t *";
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321013 - stable/10/sys/amd64/linux

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 15:21:43 2017
New Revision: 321013
URL: https://svnweb.freebsd.org/changeset/base/321013

Log:
  MFC r293907 (glebius@) partially:
  
  Change linux get_robust_list system call to match actual linux one.
  This is the forgotten part of r293897.

Modified:
  stable/10/sys/amd64/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/syscalls.master
==
--- stable/10/sys/amd64/linux/syscalls.master   Sat Jul 15 15:08:18 2017
(r321012)
+++ stable/10/sys/amd64/linux/syscalls.master   Sat Jul 15 15:21:43 2017
(r321013)
@@ -461,8 +461,8 @@
 272AUE_NULLSTD { int linux_unshare(void); }
 273AUE_NULLSTD { int linux_set_robust_list(struct 
linux_robust_list_head *head, \
l_size_t len); }
-274AUE_NULLSTD { int linux_get_robust_list(l_int pid, struct 
linux_robust_list_head *head, \
-   l_size_t *len); }
+274AUE_NULLSTD { int linux_get_robust_list(l_int pid, \
+   struct linux_robust_list_head **head, 
l_size_t *len); }
 275AUE_NULLSTD { int linux_splice(void); }
 276AUE_NULLSTD { int linux_tee(void); }
 277AUE_NULLSTD { int linux_sync_file_range(void); }
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321012 - stable/10/sys/compat/linux

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 15:08:18 2017
New Revision: 321012
URL: https://svnweb.freebsd.org/changeset/base/321012

Log:
  MFC r292744:
  
  Return EINVAL in case of incorrect sigev_signo value specified instead of 
panicing.

Modified:
  stable/10/sys/compat/linux/linux_timer.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_timer.c
==
--- stable/10/sys/compat/linux/linux_timer.cSat Jul 15 15:00:13 2017
(r321011)
+++ stable/10/sys/compat/linux/linux_timer.cSat Jul 15 15:08:18 2017
(r321012)
@@ -57,6 +57,8 @@ linux_convert_l_sigevent(struct l_sigevent *l_sig, str
CP(*l_sig, *sig, sigev_notify);
switch (l_sig->sigev_notify) {
case L_SIGEV_SIGNAL:
+   if (!LINUX_SIG_VALID(l_sig->sigev_signo))
+   return (EINVAL);
sig->sigev_notify = SIGEV_SIGNAL;
sig->sigev_signo = linux_to_bsd_signal(l_sig->sigev_signo);
PTRIN_CP(*l_sig, *sig, sigev_value.sival_ptr);
@@ -73,6 +75,8 @@ linux_convert_l_sigevent(struct l_sigevent *l_sig, str
return (EINVAL);
 #endif
case L_SIGEV_THREAD_ID:
+   if (!LINUX_SIG_VALID(l_sig->sigev_signo))
+   return (EINVAL);
sig->sigev_notify = SIGEV_THREAD_ID;
CP2(*l_sig, *sig, _l_sigev_un._tid, sigev_notify_thread_id);
sig->sigev_signo = linux_to_bsd_signal(l_sig->sigev_signo);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321010 - stable/10/sys/compat/linux

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 14:57:24 2017
New Revision: 321010
URL: https://svnweb.freebsd.org/changeset/base/321010

Log:
  MFC r281882(by trasz@):
  
  Simplify linux_getcwd(), removing code that was longer used.

Modified:
  stable/10/sys/compat/linux/linux_getcwd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_getcwd.c
==
--- stable/10/sys/compat/linux/linux_getcwd.c   Sat Jul 15 14:48:31 2017
(r321009)
+++ stable/10/sys/compat/linux/linux_getcwd.c   Sat Jul 15 14:57:24 2017
(r321010)
@@ -2,11 +2,15 @@
 /* $NetBSD: vfs_getcwd.c,v 1.3.2.3 1999/07/11 10:24:09 sommerfeld Exp $ */
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 2015 The FreeBSD Foundation
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Bill Sommerfeld.
  *
+ * Portions of this software were developed by Edward Tomasz Napierala
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -36,19 +40,9 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
 #include 
-#include 
 #include 
-#include 
-#include/* XXX only for DIRBLKSIZ */
 
 #ifdef COMPAT_LINUX32
 #include 
@@ -60,408 +54,37 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
-static int
-linux_getcwd_scandir(struct vnode **, struct vnode **,
-char **, char *, struct thread *);
-static int
-linux_getcwd_common(struct vnode *, struct vnode *,
-  char **, char *, int, int, struct thread *);
-
-#define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN+1) + 4)
-
 /*
- * Vnode variable naming conventions in this file:
- *
- * rvp: the current root we're aiming towards.
- * lvp, *lvpp: the "lower" vnode
- * uvp, *uvpp: the "upper" vnode.
- *
- * Since all the vnodes we're dealing with are directories, and the
- * lookups are going *up* in the filesystem rather than *down*, the
- * usual "pvp" (parent) or "dvp" (directory) naming conventions are
- * too confusing.
- */
-
-/*
- * XXX Will infinite loop in certain cases if a directory read reliably
- * returns EINVAL on last block.
- * XXX is EINVAL the right thing to return if a directory is malformed?
- */
-
-/*
- * XXX Untested vs. mount -o union; probably does the wrong thing.
- */
-
-/*
- * Find parent vnode of *lvpp, return in *uvpp
- *
- * If we care about the name, scan it looking for name of directory
- * entry pointing at lvp.
- *
- * Place the name in the buffer which starts at bufp, immediately
- * before *bpp, and move bpp backwards to point at the start of it.
- *
- * On entry, *lvpp is a locked vnode reference; on exit, it is vput and NULL'ed
- * On exit, *uvpp is either NULL or is a locked vnode reference.
- */
-static int
-linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, td)
-   struct vnode **lvpp;
-   struct vnode **uvpp;
-   char **bpp;
-   char *bufp;
-   struct thread *td;
-{
-   int error = 0;
-   int eofflag;
-   off_t   off;
-   int tries;
-   struct uio uio;
-   struct iovec iov;
-   char   *dirbuf = NULL;
-   int dirbuflen;
-   ino_t   fileno;
-   struct vattr va;
-   struct vnode *uvp = NULL;
-   struct vnode *lvp = *lvpp;  
-   struct componentname cn;
-   int len, reclen;
-   tries = 0;
-
-   /*
-* If we want the filename, get some info we need while the
-* current directory is still locked.
-*/
-   if (bufp != NULL) {
-   error = VOP_GETATTR(lvp, , td->td_ucred);
-   if (error) {
-   vput(lvp);
-   *lvpp = NULL;
-   *uvpp = NULL;
-   return error;
-   }
-   }
-
-   /*
-* Ok, we have to do it the hard way..
-* Next, get parent vnode using lookup of ..
-*/
-   cn.cn_nameiop = LOOKUP;
-   cn.cn_flags = ISLASTCN | ISDOTDOT | RDONLY;
-   cn.cn_thread = td;
-   cn.cn_cred = td->td_ucred;
-   cn.cn_pnbuf = NULL;
-   cn.cn_nameptr = "..";
-   cn.cn_namelen = 2;
-   cn.cn_consume = 0;
-   cn.cn_lkflags = LK_SHARED;
-   
-   /*
-* At this point, lvp is locked and will be unlocked by the lookup.
-* On successful return, *uvpp will be locked
-*/
-#ifdef MAC
-   error = mac_vnode_check_lookup(td->td_ucred, lvp, );
-   if (error == 0)
-#endif
-   error = VOP_LOOKUP(lvp, uvpp, );
-   if (error) {
-   vput(lvp);
-   *lvpp = NULL;
-   *uvpp = NULL;
-   return error;
-   }
-   uvp = *uvpp;
-
-   

svn commit: r321009 - in stable/10/sys: compat/linux kern sys

2017-07-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jul 15 14:48:31 2017
New Revision: 321009
URL: https://svnweb.freebsd.org/changeset/base/321009

Log:
  MFC r281829 (by trasz@):
  
  Modify kern___getcwd() to take max pathlen limit as an additional
  argument.  This will be used for the Linux emulation layer - for Linux,
  PATH_MAX is 4096 and not 1024.

Modified:
  stable/10/sys/compat/linux/linux_getcwd.c
  stable/10/sys/compat/linux/linux_misc.h
  stable/10/sys/kern/vfs_cache.c
  stable/10/sys/sys/syscallsubr.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_getcwd.c
==
--- stable/10/sys/compat/linux/linux_getcwd.c   Sat Jul 15 09:04:23 2017
(r321008)
+++ stable/10/sys/compat/linux/linux_getcwd.c   Sat Jul 15 14:48:31 2017
(r321009)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #endif
+#include 
 #include 
 
 #include 
@@ -423,14 +424,14 @@ linux_getcwd(struct thread *td, struct linux_getcwd_ar
 
len = args->bufsize;
 
-   if (len > MAXPATHLEN*4)
-   len = MAXPATHLEN*4;
+   if (len > LINUX_PATH_MAX)
+   len = LINUX_PATH_MAX;
else if (len < 2)
return ERANGE;
 
path = malloc(len, M_TEMP, M_WAITOK);
 
-   error = kern___getcwd(td, path, UIO_SYSSPACE, len);
+   error = kern___getcwd(td, path, UIO_SYSSPACE, len, LINUX_PATH_MAX);
if (!error) {
lenused = strlen(path) + 1;
if (lenused <= args->bufsize) {

Modified: stable/10/sys/compat/linux/linux_misc.h
==
--- stable/10/sys/compat/linux/linux_misc.h Sat Jul 15 09:04:23 2017
(r321008)
+++ stable/10/sys/compat/linux/linux_misc.h Sat Jul 15 14:48:31 2017
(r321009)
@@ -60,6 +60,8 @@
 #defineLINUX_MREMAP_MAYMOVE1
 #defineLINUX_MREMAP_FIXED  2
 
+#defineLINUX_PATH_MAX  4096
+
 extern const char *linux_kplatform;
 
 /*

Modified: stable/10/sys/kern/vfs_cache.c
==
--- stable/10/sys/kern/vfs_cache.c  Sat Jul 15 09:04:23 2017
(r321008)
+++ stable/10/sys/kern/vfs_cache.c  Sat Jul 15 14:48:31 2017
(r321009)
@@ -1073,11 +1073,13 @@ int
 sys___getcwd(struct thread *td, struct __getcwd_args *uap)
 {
 
-   return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen));
+   return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen,
+   MAXPATHLEN));
 }
 
 int
-kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen)
+kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen,
+u_int path_max)
 {
char *bp, *tmpbuf;
struct filedesc *fdp;
@@ -1088,8 +1090,8 @@ kern___getcwd(struct thread *td, char *buf, enum uio_s
return (ENODEV);
if (buflen < 2)
return (EINVAL);
-   if (buflen > MAXPATHLEN)
-   buflen = MAXPATHLEN;
+   if (buflen > path_max)
+   buflen = path_max;
 
tmpbuf = malloc(buflen, M_TEMP, M_WAITOK);
fdp = td->td_proc->p_fd;

Modified: stable/10/sys/sys/syscallsubr.h
==
--- stable/10/sys/sys/syscallsubr.h Sat Jul 15 09:04:23 2017
(r321008)
+++ stable/10/sys/sys/syscallsubr.h Sat Jul 15 14:48:31 2017
(r321009)
@@ -59,7 +59,7 @@ struct sched_param;
 struct __wrusage;
 
 intkern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg,
-   u_int buflen);
+   u_int buflen, u_int path_max);
 intkern_accept(struct thread *td, int s, struct sockaddr **name,
socklen_t *namelen, struct file **fp);
 intkern_accept4(struct thread *td, int s, struct sockaddr **name,
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r316958 - in stable/10: bin/csh contrib/tcsh contrib/tcsh/config contrib/tcsh/nls contrib/tcsh/nls/C contrib/tcsh/nls/et contrib/tcsh/nls/finnish contrib/tcsh/nls/french contrib/tcsh/nl...

2017-04-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Apr 15 11:16:11 2017
New Revision: 316958
URL: https://svnweb.freebsd.org/changeset/base/316958

Log:
  MFC r315948:
  
  Update tcsh to 6.20.00
  
  MFC r315952:
  
  Update tcsh to vendor git b605cb561d
  
  Vendor changes:
  
  1. PR/471: Daiki Ueno: Delay interpreting arginp until we've processed
  our startup files (which can change the NLS environment).
  
  2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar).
  
  3. Fix out of bounds read (Brooks Davis)
  (reproduce by starting tcsh and hitting tab at the prompt).
  
  4. Don't play pointer tricks that are undefined in modern c
  (Brooks Davis).

Added:
  stable/10/contrib/tcsh/dotlock.c
 - copied unchanged from r315948, head/contrib/tcsh/dotlock.c
  stable/10/contrib/tcsh/dotlock.h
 - copied unchanged from r315948, head/contrib/tcsh/dotlock.h
  stable/10/contrib/tcsh/tcsh.man.new
 - copied unchanged from r315948, head/contrib/tcsh/tcsh.man.new
Deleted:
  stable/10/contrib/tcsh/configure.in
Modified:
  stable/10/bin/csh/Makefile
  stable/10/contrib/tcsh/Fixes   (contents, props changed)
  stable/10/contrib/tcsh/Imakefile   (contents, props changed)
  stable/10/contrib/tcsh/Makefile.in   (contents, props changed)
  stable/10/contrib/tcsh/Makefile.std   (contents, props changed)
  stable/10/contrib/tcsh/Makefile.vms   (contents, props changed)
  stable/10/contrib/tcsh/README   (contents, props changed)
  stable/10/contrib/tcsh/complete.tcsh   (contents, props changed)
  stable/10/contrib/tcsh/config.guess   (contents, props changed)
  stable/10/contrib/tcsh/config.h.in   (contents, props changed)
  stable/10/contrib/tcsh/config.sub   (contents, props changed)
  stable/10/contrib/tcsh/config/bsd4.4   (contents, props changed)
  stable/10/contrib/tcsh/config_f.h   (contents, props changed)
  stable/10/contrib/tcsh/configure   (contents, props changed)
  stable/10/contrib/tcsh/ed.chared.c   (contents, props changed)
  stable/10/contrib/tcsh/ed.decls.h   (contents, props changed)
  stable/10/contrib/tcsh/ed.defns.c   (contents, props changed)
  stable/10/contrib/tcsh/ed.inputl.c   (contents, props changed)
  stable/10/contrib/tcsh/ed.refresh.c   (contents, props changed)
  stable/10/contrib/tcsh/ed.screen.c   (contents, props changed)
  stable/10/contrib/tcsh/ed.term.h   (contents, props changed)
  stable/10/contrib/tcsh/ed.xmap.c   (contents, props changed)
  stable/10/contrib/tcsh/gethost.c   (contents, props changed)
  stable/10/contrib/tcsh/glob.c   (contents, props changed)
  stable/10/contrib/tcsh/host.defs   (contents, props changed)
  stable/10/contrib/tcsh/nls/C/set1   (contents, props changed)
  stable/10/contrib/tcsh/nls/C/set20   (contents, props changed)
  stable/10/contrib/tcsh/nls/C/set9   (contents, props changed)
  stable/10/contrib/tcsh/nls/Makefile.in
  stable/10/contrib/tcsh/nls/catgen
  stable/10/contrib/tcsh/nls/et/set1   (contents, props changed)
  stable/10/contrib/tcsh/nls/et/set20   (contents, props changed)
  stable/10/contrib/tcsh/nls/et/set9   (contents, props changed)
  stable/10/contrib/tcsh/nls/finnish/set1   (contents, props changed)
  stable/10/contrib/tcsh/nls/finnish/set20   (contents, props changed)
  stable/10/contrib/tcsh/nls/finnish/set3   (contents, props changed)
  stable/10/contrib/tcsh/nls/finnish/set9   (contents, props changed)
  stable/10/contrib/tcsh/nls/french/set1   (contents, props changed)
  stable/10/contrib/tcsh/nls/french/set20   (contents, props changed)
  stable/10/contrib/tcsh/nls/french/set9   (contents, props changed)
  stable/10/contrib/tcsh/nls/german/set1   (contents, props changed)
  stable/10/contrib/tcsh/nls/german/set20   (contents, props changed)
  stable/10/contrib/tcsh/nls/german/set9   (contents, props changed)
  stable/10/contrib/tcsh/nls/greek/set1   (contents, props changed)
  stable/10/contrib/tcsh/nls/greek/set20   (contents, props changed)
  stable/10/contrib/tcsh/nls/greek/set9   (contents, props changed)
  stable/10/contrib/tcsh/nls/italian/set1   (contents, props changed)
  stable/10/contrib/tcsh/nls/italian/set20   (contents, props changed)
  stable/10/contrib/tcsh/nls/italian/set9   (contents, props changed)
  stable/10/contrib/tcsh/nls/ja/set1   (contents, props changed)
  stable/10/contrib/tcsh/nls/russian/set1   (contents, props changed)
  stable/10/contrib/tcsh/nls/russian/set20   (contents, props changed)
  stable/10/contrib/tcsh/nls/russian/set9   (contents, props changed)
  stable/10/contrib/tcsh/nls/spanish/set1   (contents, props changed)
  stable/10/contrib/tcsh/nls/spanish/set20   (contents, props changed)
  stable/10/contrib/tcsh/nls/spanish/set9   (contents, props changed)
  stable/10/contrib/tcsh/nls/ukrainian/set1   (contents, props changed)
  stable/10/contrib/tcsh/nls/ukrainian/set20   (contents, props changed)
  stable/10/contrib/tcsh/nls/ukrainian/set9   (contents, props changed)
  stable/10/contrib/tcsh/patchlevel.h   (contents, props changed)
  stable/10/contrib/tcsh/sh.c   (contents, props 

svn commit: r306294 - stable/10/sys/compat/linux

2016-09-24 Thread Dmitry Chagin
Author: dchagin
Date: Sat Sep 24 10:34:35 2016
New Revision: 306294
URL: https://svnweb.freebsd.org/changeset/base/306294

Log:
  MFC r305896:
  
  Implement BLKSSZGET ioctl for the Linuxulator.
  
  PR:   212700

Modified:
  stable/10/sys/compat/linux/linux_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_ioctl.c
==
--- stable/10/sys/compat/linux/linux_ioctl.cSat Sep 24 10:32:26 2016
(r306293)
+++ stable/10/sys/compat/linux/linux_ioctl.cSat Sep 24 10:34:35 2016
(r306294)
@@ -296,6 +296,15 @@ linux_ioctl_disk(struct thread *td, stru
return (copyout(, (void *)args->arg,
sizeof(sectorsize)));
break;
+   case LINUX_BLKSSZGET:
+   error = fo_ioctl(fp, DIOCGSECTORSIZE,
+   (caddr_t), td->td_ucred, td);
+   fdrop(fp, td);
+   if (error)
+   return (error);
+   return (copyout(, (void *)args->arg,
+   sizeof(sectorsize)));
+   break;
}
fdrop(fp, td);
return (ENOIOCTL);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r302964 - in stable/10/sys: amd64/linux amd64/linux32 compat/linux conf i386/linux modules/linux modules/linux_common

2016-07-17 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jul 17 15:23:32 2016
New Revision: 302964
URL: https://svnweb.freebsd.org/changeset/base/302964

Log:
  MFC r302517:
  
  Fix a copy/paste bug introduced during X86_64 Linuxulator work.
  FreeBSD support NX bit on X86_64 processors out of the box, for i386 emulation
  use READ_IMPLIES_EXEC flag, introduced in r302515.
  
  While here move common part of mmap() and mprotect() code to the files in 
compat/linux
  to reduce code dupcliation between Linuxulator's.
  
  MFC r302518, r302626:
  
  Add linux_mmap.c to the appropriate conf/files.

Added:
  stable/10/sys/compat/linux/linux_mmap.c
 - copied, changed from r302517, head/sys/compat/linux/linux_mmap.c
  stable/10/sys/compat/linux/linux_mmap.h
 - copied unchanged from r302517, head/sys/compat/linux/linux_mmap.h
Modified:
  stable/10/sys/amd64/linux/linux.h
  stable/10/sys/amd64/linux/linux_machdep.c
  stable/10/sys/amd64/linux32/linux.h
  stable/10/sys/amd64/linux32/linux32_machdep.c
  stable/10/sys/conf/files.amd64
  stable/10/sys/conf/files.i386
  stable/10/sys/conf/files.pc98
  stable/10/sys/i386/linux/linux.h
  stable/10/sys/i386/linux/linux_machdep.c
  stable/10/sys/modules/linux/Makefile
  stable/10/sys/modules/linux_common/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux.h
==
--- stable/10/sys/amd64/linux/linux.h   Sun Jul 17 15:11:23 2016
(r302963)
+++ stable/10/sys/amd64/linux/linux.h   Sun Jul 17 15:23:32 2016
(r302964)
@@ -139,13 +139,6 @@ struct l_rlimit {
l_ulong rlim_max;
 };
 
-/* mmap options */
-#defineLINUX_MAP_SHARED0x0001
-#defineLINUX_MAP_PRIVATE   0x0002
-#defineLINUX_MAP_FIXED 0x0010
-#defineLINUX_MAP_ANON  0x0020
-#defineLINUX_MAP_GROWSDOWN 0x0100
-
 /*
  * stat family of syscalls
  */

Modified: stable/10/sys/amd64/linux/linux_machdep.c
==
--- stable/10/sys/amd64/linux/linux_machdep.c   Sun Jul 17 15:11:23 2016
(r302963)
+++ stable/10/sys/amd64/linux/linux_machdep.c   Sun Jul 17 15:23:32 2016
(r302964)
@@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -122,181 +123,19 @@ linux_set_upcall_kse(struct thread *td, 
return (0);
 }
 
-#define STACK_SIZE  (2 * 1024 * 1024)
-#define GUARD_SIZE  (4 * PAGE_SIZE)
-
 int
 linux_mmap2(struct thread *td, struct linux_mmap2_args *args)
 {
-   struct proc *p = td->td_proc;
-   struct mmap_args /* {
-   caddr_t addr;
-   size_t len;
-   int prot;
-   int flags;
-   int fd;
-   long pad;
-   off_t pos;
-   } */ bsd_args;
-   int error;
-   struct file *fp;
-   cap_rights_t rights;
-
-   LINUX_CTR6(mmap2, "0x%lx, %ld, %ld, 0x%08lx, %ld, 0x%lx",
-   args->addr, args->len, args->prot,
-   args->flags, args->fd, args->pgoff);
-
-   error = 0;
-   bsd_args.flags = 0;
-   fp = NULL;
-
-   /*
-* Linux mmap(2):
-* You must specify exactly one of MAP_SHARED and MAP_PRIVATE
-*/
-   if (! ((args->flags & LINUX_MAP_SHARED) ^
-   (args->flags & LINUX_MAP_PRIVATE)))
-   return (EINVAL);
-
-   if (args->flags & LINUX_MAP_SHARED)
-   bsd_args.flags |= MAP_SHARED;
-   if (args->flags & LINUX_MAP_PRIVATE)
-   bsd_args.flags |= MAP_PRIVATE;
-   if (args->flags & LINUX_MAP_FIXED)
-   bsd_args.flags |= MAP_FIXED;
-   if (args->flags & LINUX_MAP_ANON)
-   bsd_args.flags |= MAP_ANON;
-   else
-   bsd_args.flags |= MAP_NOSYNC;
-   if (args->flags & LINUX_MAP_GROWSDOWN)
-   bsd_args.flags |= MAP_STACK;
-
-   /*
-* PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC
-* on Linux/i386. We do this to ensure maximum compatibility.
-* Linux/ia64 does the same in i386 emulation mode.
-*/
-   bsd_args.prot = args->prot;
-   if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC))
-   bsd_args.prot |= PROT_READ | PROT_EXEC;
-
-   /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */
-   bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : args->fd;
-   if (bsd_args.fd != -1) {
-   /*
-* Linux follows Solaris mmap(2) description:
-* The file descriptor fildes is opened with
-* read permission, regardless of the
-* protection options specified.
-*/
-
-   error = fget(td, bsd_args.fd,
-   cap_rights_init(, CAP_MMAP), );
-   if (error != 0 )
-   return (error);
- 

svn commit: r302963 - in stable/10/sys: amd64/linux amd64/linux32 i386/linux

2016-07-17 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jul 17 15:11:23 2016
New Revision: 302963
URL: https://svnweb.freebsd.org/changeset/base/302963

Log:
  Regen for r302962 (Linux personality), record mergeinfo for r320516.

Modified:
  stable/10/sys/amd64/linux/linux_proto.h
  stable/10/sys/amd64/linux/linux_syscall.h
  stable/10/sys/amd64/linux/linux_syscalls.c
  stable/10/sys/amd64/linux/linux_sysent.c
  stable/10/sys/amd64/linux/linux_systrace_args.c
  stable/10/sys/amd64/linux32/linux32_proto.h
  stable/10/sys/amd64/linux32/linux32_syscall.h
  stable/10/sys/amd64/linux32/linux32_syscalls.c
  stable/10/sys/amd64/linux32/linux32_sysent.c
  stable/10/sys/amd64/linux32/linux32_systrace_args.c
  stable/10/sys/i386/linux/linux_proto.h
  stable/10/sys/i386/linux/linux_syscall.h
  stable/10/sys/i386/linux/linux_syscalls.c
  stable/10/sys/i386/linux/linux_sysent.c
  stable/10/sys/i386/linux/linux_systrace_args.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux_proto.h
==
--- stable/10/sys/amd64/linux/linux_proto.h Sun Jul 17 15:07:33 2016
(r302962)
+++ stable/10/sys/amd64/linux/linux_proto.h Sun Jul 17 15:11:23 2016
(r302963)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 294368 
2016-01-20 01:09:53Z jhb 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 302962 
2016-07-17 15:07:33Z dchagin 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -499,7 +499,7 @@ struct linux_mknod_args {
char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)];
 };
 struct linux_personality_args {
-   char per_l_[PADL_(l_ulong)]; l_ulong per; char per_r_[PADR_(l_ulong)];
+   char per_l_[PADL_(l_uint)]; l_uint per; char per_r_[PADR_(l_uint)];
 };
 struct linux_ustat_args {
char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)];

Modified: stable/10/sys/amd64/linux/linux_syscall.h
==
--- stable/10/sys/amd64/linux/linux_syscall.h   Sun Jul 17 15:07:33 2016
(r302962)
+++ stable/10/sys/amd64/linux/linux_syscall.h   Sun Jul 17 15:11:23 2016
(r302963)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 294368 
2016-01-20 01:09:53Z jhb 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 302962 
2016-07-17 15:07:33Z dchagin 
  */
 
 #defineLINUX_SYS_read  0

Modified: stable/10/sys/amd64/linux/linux_syscalls.c
==
--- stable/10/sys/amd64/linux/linux_syscalls.c  Sun Jul 17 15:07:33 2016
(r302962)
+++ stable/10/sys/amd64/linux/linux_syscalls.c  Sun Jul 17 15:11:23 2016
(r302963)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 294368 
2016-01-20 01:09:53Z jhb 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 302962 
2016-07-17 15:07:33Z dchagin 
  */
 
 const char *linux_syscallnames[] = {

Modified: stable/10/sys/amd64/linux/linux_sysent.c
==
--- stable/10/sys/amd64/linux/linux_sysent.cSun Jul 17 15:07:33 2016
(r302962)
+++ stable/10/sys/amd64/linux/linux_sysent.cSun Jul 17 15:11:23 2016
(r302963)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 294368 
2016-01-20 01:09:53Z jhb 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 302962 
2016-07-17 15:07:33Z dchagin 
  */
 
 #include 

Modified: stable/10/sys/amd64/linux/linux_systrace_args.c
==
--- stable/10/sys/amd64/linux/linux_systrace_args.c Sun Jul 17 15:07:33 
2016(r302962)
+++ stable/10/sys/amd64/linux/linux_systrace_args.c Sun Jul 17 15:11:23 
2016(r302963)
@@ -1120,7 +1120,7 @@ systrace_args(int sysnum, void *params, 
/* linux_personality */
case 135: {
struct linux_personality_args *p = params;
-   iarg[0] = p->per; /* l_ulong */
+   iarg[0] = p->per; /* l_uint */
*n_args = 1;
break;
}
@@ -4112,7 +4112,7 @@ systrace_entry_setargdesc(int sysnum, in
case 135:
switch(ndx) {
case 0:
-   p = "l_ulong";
+   p = "l_uint";
break;
default:
break;

Modified: stable/10/sys/amd64/linux32/linux32_proto.h

svn commit: r302962 - in stable/10/sys: amd64/linux amd64/linux32 compat/linux i386/linux

2016-07-17 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jul 17 15:07:33 2016
New Revision: 302962
URL: https://svnweb.freebsd.org/changeset/base/302962

Log:
  MFC r302515:
  
  Implement Linux personality() system call mainly due to READ_IMPLIES_EXEC 
flag.
  In Linux if this flag is set, PROT_READ implies PROT_EXEC for mmap().
  Linux/i386 set this flag automatically if the binary requires executable 
stack.
  
  READ_IMPLIES_EXEC flag will be used in the next Linux mmap() commit.

Added:
  stable/10/sys/compat/linux/linux_persona.h
 - copied unchanged from r302515, head/sys/compat/linux/linux_persona.h
Modified:
  stable/10/sys/amd64/linux/syscalls.master
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/compat/linux/linux_emul.c
  stable/10/sys/compat/linux/linux_emul.h
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/syscalls.master
==
--- stable/10/sys/amd64/linux/syscalls.master   Sun Jul 17 14:45:15 2016
(r302961)
+++ stable/10/sys/amd64/linux/syscalls.master   Sun Jul 17 15:07:33 2016
(r302962)
@@ -270,7 +270,7 @@
 133AUE_MKNOD   STD { int linux_mknod(char *path, l_int mode, \
l_dev_t dev); }
 134AUE_USELIB  UNIMPL  uselib
-135AUE_PERSONALITY STD { int linux_personality(l_ulong per); }
+135AUE_PERSONALITY STD { int linux_personality(l_uint per); }
 136AUE_NULLSTD { int linux_ustat(l_dev_t dev, \
struct l_ustat *ubuf); }
 137AUE_STATFS  STD { int linux_statfs(char *path, \

Modified: stable/10/sys/amd64/linux32/syscalls.master
==
--- stable/10/sys/amd64/linux32/syscalls.master Sun Jul 17 14:45:15 2016
(r302961)
+++ stable/10/sys/amd64/linux32/syscalls.master Sun Jul 17 15:07:33 2016
(r302962)
@@ -238,7 +238,7 @@
 134AUE_BDFLUSH STD { int linux_bdflush(void); }
 135AUE_NULLSTD { int linux_sysfs(l_int option, \
l_ulong arg1, l_ulong arg2); }
-136AUE_PERSONALITY STD { int linux_personality(l_ulong per); }
+136AUE_PERSONALITY STD { int linux_personality(l_uint per); }
 137AUE_NULLUNIMPL  afs_syscall
 138AUE_SETFSUIDSTD { int linux_setfsuid16(l_uid16_t uid); }
 139AUE_SETFSGIDSTD { int linux_setfsgid16(l_gid16_t gid); }

Modified: stable/10/sys/compat/linux/linux_emul.c
==
--- stable/10/sys/compat/linux/linux_emul.c Sun Jul 17 14:45:15 2016
(r302961)
+++ stable/10/sys/compat/linux/linux_emul.c Sun Jul 17 15:07:33 2016
(r302962)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 
 
@@ -127,7 +128,7 @@ linux_proc_init(struct thread *td, struc
 /* epoll should be destroyed in a case of exec. */
pem = pem_find(p);
KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n"));
-
+   pem->persona = 0;
if (pem->epoll != NULL) {
emd = pem->epoll;
pem->epoll = NULL;
@@ -220,6 +221,9 @@ linux_proc_exec(void *arg __unused, stru
 {
struct thread *td = curthread;
struct thread *othertd;
+#if defined(__amd64__)
+   struct linux_pemuldata *pem;
+#endif
 
/*
 * In a case of execing from linux binary properly detach
@@ -243,6 +247,17 @@ linux_proc_exec(void *arg __unused, stru
linux_proc_init(td, NULL, 0);
else
linux_proc_init(td, td, 0);
+#if defined(__amd64__)
+   /*
+* An IA32 executable which has executable stack will have the
+* READ_IMPLIES_EXEC personality flag set automatically.
+*/
+   if (SV_PROC_FLAG(td->td_proc, SV_ILP32) &&
+   imgp->stack_prot & VM_PROT_EXECUTE) {
+   pem = pem_find(p);
+   pem->persona |= LINUX_READ_IMPLIES_EXEC;
+   }
+#endif
}
 }
 

Modified: stable/10/sys/compat/linux/linux_emul.h
==
--- stable/10/sys/compat/linux/linux_emul.h Sun Jul 17 14:45:15 2016
(r302961)
+++ stable/10/sys/compat/linux/linux_emul.h Sun Jul 17 15:07:33 2016
(r302962)
@@ -67,6 +67,7 @@ struct linux_pemuldata {
uint32_tflags;  /* process emuldata flags */
struct sx   pem_sx; /* lock for this struct */
void*epoll; /* epoll data */
+   uint32_tpersona;/* process execution domain */
 };
 
 

svn commit: r302259 - stable/10/sys/compat/linux

2016-06-29 Thread Dmitry Chagin
Author: dchagin
Date: Wed Jun 29 06:04:45 2016
New Revision: 302259
URL: https://svnweb.freebsd.org/changeset/base/302259

Log:
  MFC r302213:
  
  Fix a bug introduced in r283433.
  
  [1] Remove unneeded sockaddr conversion before kern_recvit() call as the from
  argument is used to record result (the source address of the received 
message) only.
  
  [2] In Linux the type of msg_namelen member of struct msghdr is signed but 
native
  msg_namelen has a unsigned type (socklen_t). So use the proper storage to 
fetch fromlen
  from userspace and than check the user supplied value and return EINVAL if it 
is less
  than 0 as a Linux do.
  
  Reported by:  Thomas Mueller  [1]
  Tested by:Thomas Mueller  [both]
  Reviewed by:  kib@

Modified:
  stable/10/sys/compat/linux/linux_socket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_socket.c
==
--- stable/10/sys/compat/linux/linux_socket.c   Wed Jun 29 05:21:25 2016
(r302258)
+++ stable/10/sys/compat/linux/linux_socket.c   Wed Jun 29 06:04:45 2016
(r302259)
@@ -1040,18 +1040,16 @@ linux_recvfrom(struct thread *td, struct
 {
struct msghdr msg;
struct iovec aiov;
-   int error;
+   int error, fromlen;
 
if (PTRIN(args->fromlen) != NULL) {
-   error = copyin(PTRIN(args->fromlen), _namelen,
-   sizeof(msg.msg_namelen));
-   if (error != 0)
-   return (error);
-
-   error = linux_to_bsd_sockaddr((struct sockaddr 
*)PTRIN(args->from),
-   msg.msg_namelen);
+   error = copyin(PTRIN(args->fromlen), ,
+   sizeof(fromlen));
if (error != 0)
return (error);
+   if (fromlen < 0)
+   return (EINVAL);
+   msg.msg_namelen = fromlen;
} else
msg.msg_namelen = 0;
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r301441 - stable/10/sys/sys

2016-06-05 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jun  5 10:48:27 2016
New Revision: 301441
URL: https://svnweb.freebsd.org/changeset/base/301441

Log:
  MFC r300429:
  
  Remove a now unused global declaration of some sysentvec struct.

Modified:
  stable/10/sys/sys/sysent.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/sys/sysent.h
==
--- stable/10/sys/sys/sysent.h  Sun Jun  5 10:33:53 2016(r301440)
+++ stable/10/sys/sys/sysent.h  Sun Jun  5 10:48:27 2016(r301441)
@@ -154,8 +154,6 @@ struct sysentvec {
 
 #ifdef _KERNEL
 extern struct sysentvec aout_sysvec;
-extern struct sysentvec elf_freebsd_sysvec;
-extern struct sysentvec null_sysvec;
 extern struct sysent sysent[];
 extern const char *syscallnames[];
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r301431 - stable/10/sys/compat/linux

2016-06-05 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jun  5 07:43:20 2016
New Revision: 301431
URL: https://svnweb.freebsd.org/changeset/base/301431

Log:
  MFC r300431:
  
  Convert proto family in both directions. The linux and native values for
  local and inet are identical, but for inet6 values differ.
  
  PR:   155040
  Reported by:  Simon Walton

Modified:
  stable/10/sys/compat/linux/linux_socket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_socket.c
==
--- stable/10/sys/compat/linux/linux_socket.c   Sun Jun  5 07:40:12 2016
(r301430)
+++ stable/10/sys/compat/linux/linux_socket.c   Sun Jun  5 07:43:20 2016
(r301431)
@@ -462,12 +462,16 @@ bsd_to_linux_sockaddr(struct sockaddr *a
 {
struct sockaddr sa;
size_t sa_len = sizeof(struct sockaddr);
-   int error;
+   int error, bdom;
 
if ((error = copyin(arg, , sa_len)))
return (error);
 
-   *(u_short *) = sa.sa_family;
+   bdom = bsd_to_linux_domain(sa.sa_family);
+   if (bdom == -1)
+   return (EAFNOSUPPORT);
+
+   *(u_short *) = bdom;
return (copyout(, arg, sa_len));
 }
 
@@ -476,12 +480,16 @@ linux_to_bsd_sockaddr(struct sockaddr *a
 {
struct sockaddr sa;
size_t sa_len = sizeof(struct sockaddr);
-   int error;
+   int error, bdom;
 
if ((error = copyin(arg, , sa_len)))
return (error);
 
-   sa.sa_family = *(sa_family_t *)
+   bdom = linux_to_bsd_domain(*(sa_family_t *));
+   if (bdom == -1)
+   return (EAFNOSUPPORT);
+
+   sa.sa_family = bdom;
sa.sa_len = len;
return (copyout(, arg, sa_len));
 }
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r301430 - stable/10/sys/compat/linux

2016-06-05 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jun  5 07:40:12 2016
New Revision: 301430
URL: https://svnweb.freebsd.org/changeset/base/301430

Log:
  MFC r300569:
  
  Don't leak fp in case where fo_ioctl() returns an error.
  
  Reported by:  C Turt 

Modified:
  stable/10/sys/compat/linux/linux_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_ioctl.c
==
--- stable/10/sys/compat/linux/linux_ioctl.cSun Jun  5 07:38:56 2016
(r301429)
+++ stable/10/sys/compat/linux/linux_ioctl.cSun Jun  5 07:40:12 2016
(r301430)
@@ -978,7 +978,7 @@ linux_ioctl_termio(struct thread *td, st
error = fo_ioctl(fp, TIOCGETD, (caddr_t)_line,
td->td_ucred, td);
if (error)
-   return (error);
+   break;
switch (bsd_line) {
case TTYDISC:
linux_line = LINUX_N_TTY;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r301429 - stable/10/sys/compat/linux

2016-06-05 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jun  5 07:38:56 2016
New Revision: 301429
URL: https://svnweb.freebsd.org/changeset/base/301429

Log:
  MFC r300416:
  
  Add a missing errno translation for SO_ERROR optname.
  
  PR:   135458
  Reported by:  Stefan Schmidt

Modified:
  stable/10/sys/compat/linux/linux_socket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_socket.c
==
--- stable/10/sys/compat/linux/linux_socket.c   Sun Jun  5 07:34:10 2016
(r301428)
+++ stable/10/sys/compat/linux/linux_socket.c   Sun Jun  5 07:38:56 2016
(r301429)
@@ -1594,10 +1594,10 @@ linux_getsockopt(struct thread *td, stru
} */ bsd_args;
l_timeval linux_tv;
struct timeval tv;
-   socklen_t tv_len, xulen;
+   socklen_t tv_len, xulen, len;
struct xucred xu;
struct l_ucred lxu;
-   int error, name;
+   int error, name, newval;
 
bsd_args.s = args->s;
bsd_args.level = linux_to_bsd_sockopt_level(args->level);
@@ -1636,6 +1636,15 @@ linux_getsockopt(struct thread *td, stru
return (copyout(, PTRIN(args->optval), 
sizeof(lxu)));
/* NOTREACHED */
break;
+   case SO_ERROR:
+   len = sizeof(newval);
+   error = kern_getsockopt(td, args->s, bsd_args.level,
+   name, , UIO_SYSSPACE, );
+   if (error)
+   return (error);
+   newval = -SV_ABI_ERRNO(td->td_proc, newval);
+   return (copyout(, PTRIN(args->optval), len));
+   /* NOTREACHED */
default:
break;
}
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r301428 - in stable/10/sys: amd64/amd64 i386/i386 powerpc/powerpc sparc64/sparc64 sys

2016-06-05 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jun  5 07:34:10 2016
New Revision: 301428
URL: https://svnweb.freebsd.org/changeset/base/301428

Log:
  MFC r300415:
  
  Add macro to convert errno and use it when appropriate.

Modified:
  stable/10/sys/amd64/amd64/vm_machdep.c
  stable/10/sys/i386/i386/vm_machdep.c
  stable/10/sys/powerpc/powerpc/exec_machdep.c
  stable/10/sys/sparc64/sparc64/vm_machdep.c
  stable/10/sys/sys/sysent.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/vm_machdep.c
==
--- stable/10/sys/amd64/amd64/vm_machdep.c  Sun Jun  5 06:37:54 2016
(r301427)
+++ stable/10/sys/amd64/amd64/vm_machdep.c  Sun Jun  5 07:34:10 2016
(r301428)
@@ -414,13 +414,7 @@ cpu_set_syscall_retval(struct thread *td
break;
 
default:
-   if (td->td_proc->p_sysent->sv_errsize) {
-   if (error >= td->td_proc->p_sysent->sv_errsize)
-   error = -1; /* XXX */
-   else
-   error = td->td_proc->p_sysent->sv_errtbl[error];
-   }
-   td->td_frame->tf_rax = error;
+   td->td_frame->tf_rax = SV_ABI_ERRNO(td->td_proc, error);
td->td_frame->tf_rflags |= PSL_C;
break;
}

Modified: stable/10/sys/i386/i386/vm_machdep.c
==
--- stable/10/sys/i386/i386/vm_machdep.cSun Jun  5 06:37:54 2016
(r301427)
+++ stable/10/sys/i386/i386/vm_machdep.cSun Jun  5 07:34:10 2016
(r301428)
@@ -486,13 +486,7 @@ cpu_set_syscall_retval(struct thread *td
break;
 
default:
-   if (td->td_proc->p_sysent->sv_errsize) {
-   if (error >= td->td_proc->p_sysent->sv_errsize)
-   error = -1; /* XXX */
-   else
-   error = td->td_proc->p_sysent->sv_errtbl[error];
-   }
-   td->td_frame->tf_eax = error;
+   td->td_frame->tf_eax = SV_ABI_ERRNO(td->td_proc, error);
td->td_frame->tf_eflags |= PSL_C;
break;
}

Modified: stable/10/sys/powerpc/powerpc/exec_machdep.c
==
--- stable/10/sys/powerpc/powerpc/exec_machdep.cSun Jun  5 06:37:54 
2016(r301427)
+++ stable/10/sys/powerpc/powerpc/exec_machdep.cSun Jun  5 07:34:10 
2016(r301428)
@@ -901,11 +901,7 @@ cpu_set_syscall_retval(struct thread *td
tf->srr0 -= 4;
break;
default:
-   if (p->p_sysent->sv_errsize) {
-   error = (error < p->p_sysent->sv_errsize) ?
-   p->p_sysent->sv_errtbl[error] : -1;
-   }
-   tf->fixreg[FIRSTARG] = error;
+   tf->fixreg[FIRSTARG] = SV_ABI_ERRNO(p, error);
tf->cr |= 0x1000;   /* Set summary overflow */
break;
}

Modified: stable/10/sys/sparc64/sparc64/vm_machdep.c
==
--- stable/10/sys/sparc64/sparc64/vm_machdep.c  Sun Jun  5 06:37:54 2016
(r301427)
+++ stable/10/sys/sparc64/sparc64/vm_machdep.c  Sun Jun  5 07:34:10 2016
(r301428)
@@ -196,13 +196,7 @@ cpu_set_syscall_retval(struct thread *td
break;
 
default:
-   if (td->td_proc->p_sysent->sv_errsize) {
-   if (error >= td->td_proc->p_sysent->sv_errsize)
-   error = -1; /* XXX */
-   else
-   error = td->td_proc->p_sysent->sv_errtbl[error];
-   }
-   td->td_frame->tf_out[0] = error;
+   td->td_frame->tf_out[0] = SV_ABI_ERRNO(td->td_proc, error);
td->td_frame->tf_tstate |= TSTATE_XCC_C;
break;
}

Modified: stable/10/sys/sys/sysent.h
==
--- stable/10/sys/sys/sysent.h  Sun Jun  5 06:37:54 2016(r301427)
+++ stable/10/sys/sys/sysent.h  Sun Jun  5 07:34:10 2016(r301428)
@@ -141,6 +141,8 @@ struct sysentvec {
 #defineSV_SHP  0x01
 
 #defineSV_ABI_MASK 0xff
+#defineSV_ABI_ERRNO(p, e)  ((p)->p_sysent->sv_errsize <= 0 ? e :   
\
+   ((e) >= (p)->p_sysent->sv_errsize ? -1 : (p)->p_sysent->sv_errtbl[e]))
 #defineSV_PROC_FLAG(p, x)  ((p)->p_sysent->sv_flags & (x))
 #defineSV_PROC_ABI(p)  ((p)->p_sysent->sv_flags & SV_ABI_MASK)
 #defineSV_CURPROC_FLAG(x)  SV_PROC_FLAG(curproc, x)
___

svn commit: r301426 - stable/10/sys/compat/linux

2016-06-05 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jun  5 06:06:55 2016
New Revision: 301426
URL: https://svnweb.freebsd.org/changeset/base/301426

Log:
  MFC r300413:
  
  Due to lack the priority propagation feature replace sx by mutex. WIth this
  commit NPTL tests are ends in 1 minute faster.
  
  MFC r300414:
  
  For future use move futex timeout code to the separate function and
  switch to the high resolution sbintime_t.

Modified:
  stable/10/sys/compat/linux/linux_futex.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_futex.c
==
--- stable/10/sys/compat/linux/linux_futex.cSun Jun  5 06:04:25 2016
(r301425)
+++ stable/10/sys/compat/linux/linux_futex.cSun Jun  5 06:06:55 2016
(r301426)
@@ -55,9 +55,10 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.
 #include 
 #include 
 #include 
-#include 
 #include 
 
+#include 
+
 #ifdef COMPAT_LINUX32
 #include 
 #include 
@@ -109,7 +110,7 @@ LIN_SDT_PROBE_DEFINE3(futex, futex_get, 
 LIN_SDT_PROBE_DEFINE0(futex, futex_get, error);
 LIN_SDT_PROBE_DEFINE1(futex, futex_get, return, "int");
 LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, entry, "struct futex *",
-"struct waiting_proc **", "int");
+"struct waiting_proc **", "struct timespec *");
 LIN_SDT_PROBE_DEFINE5(futex, futex_sleep, requeue_error, "int", "uint32_t *",
 "struct waiting_proc *", "uint32_t *", "uint32_t");
 LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, sleep_error, "int", "uint32_t *",
@@ -128,7 +129,7 @@ LIN_SDT_PROBE_DEFINE3(futex, futex_reque
 "struct waiting_proc *", "uint32_t");
 LIN_SDT_PROBE_DEFINE1(futex, futex_requeue, return, "int");
 LIN_SDT_PROBE_DEFINE4(futex, futex_wait, entry, "struct futex *",
-"struct waiting_proc **", "int", "uint32_t");
+"struct waiting_proc **", "struct timespec *", "uint32_t");
 LIN_SDT_PROBE_DEFINE1(futex, futex_wait, sleep_error, "int");
 LIN_SDT_PROBE_DEFINE1(futex, futex_wait, return, "int");
 LIN_SDT_PROBE_DEFINE3(futex, futex_atomic_op, entry, "struct thread *",
@@ -142,7 +143,6 @@ LIN_SDT_PROBE_DEFINE1(futex, futex_atomi
 LIN_SDT_PROBE_DEFINE2(futex, linux_sys_futex, entry, "struct thread *",
 "struct linux_sys_futex_args *");
 LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, unimplemented_clockswitch);
-LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, itimerfix_error, "int");
 LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, copyin_error, "int");
 LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, invalid_cmp_requeue_use);
 LIN_SDT_PROBE_DEFINE3(futex, linux_sys_futex, debug_wait, "uint32_t *",
@@ -197,7 +197,7 @@ struct waiting_proc {
 };
 
 struct futex {
-   struct sx   f_lck;
+   struct mtx  f_lck;
uint32_t*f_uaddr;   /* user-supplied value, for debug */
struct umtx_key f_key;
uint32_tf_refcount;
@@ -208,20 +208,22 @@ struct futex {
 
 struct futex_list futex_list;
 
-#define FUTEX_LOCK(f)  sx_xlock(&(f)->f_lck)
-#define FUTEX_UNLOCK(f)sx_xunlock(&(f)->f_lck)
+#define FUTEX_LOCK(f)  mtx_lock(&(f)->f_lck)
+#define FUTEX_LOCKED(f)mtx_owned(&(f)->f_lck)
+#define FUTEX_UNLOCK(f)mtx_unlock(&(f)->f_lck)
 #define FUTEX_INIT(f)  do { \
-   sx_init_flags(&(f)->f_lck, "ftlk", \
-   SX_DUPOK); \
+   mtx_init(&(f)->f_lck, "ftlk", NULL, \
+   MTX_DUPOK); \
LIN_SDT_PROBE1(futex, futex, create, \
&(f)->f_lck); \
} while (0)
 #define FUTEX_DESTROY(f)   do { \
LIN_SDT_PROBE1(futex, futex, destroy, \
&(f)->f_lck); \
-   sx_destroy(&(f)->f_lck); \
+   mtx_destroy(&(f)->f_lck); \
} while (0)
-#define FUTEX_ASSERT_LOCKED(f) sx_assert(&(f)->f_lck, SA_XLOCKED)
+#define FUTEX_ASSERT_LOCKED(f) mtx_assert(&(f)->f_lck, MA_OWNED)
+#define FUTEX_ASSERT_UNLOCKED(f) mtx_assert(&(f)->f_lck, MA_NOTOWNED)
 
 struct mtx futex_mtx;  /* protects the futex list */
 #define FUTEXES_LOCK   do { \
@@ -240,6 +242,7 @@ struct mtx futex_mtx;   /* protects the 
 #define FUTEX_DONTCREATE   0x2 /* don't create futex if not exists */
 #define FUTEX_DONTEXISTS   0x4 /* return EINVAL if futex exists */
 #defineFUTEX_SHARED0x8 /* shared futex */
+#defineFUTEX_DONTLOCK  0x10/* don't lock futex */
 
 /* wp_flags */
 #define FUTEX_WP_REQUEUED  0x1 /* wp requeued - wp moved from wp_list
@@ -254,11 +257,15 @@ static void futex_put(struct futex *, st
 static int futex_get0(uint32_t *, struct futex **f, uint32_t);
 static int 

svn commit: r301425 - stable/10/sys/compat/linux

2016-06-05 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jun  5 06:04:25 2016
New Revision: 301425
URL: https://svnweb.freebsd.org/changeset/base/301425

Log:
  MFC r300412:
  
  Add my copyright as I rewrote most of the futex code. Minor style(9) cleanup
  while here.

Modified:
  stable/10/sys/compat/linux/linux_futex.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_futex.c
==
--- stable/10/sys/compat/linux/linux_futex.cSun Jun  5 06:02:37 2016
(r301424)
+++ stable/10/sys/compat/linux/linux_futex.cSun Jun  5 06:04:25 2016
(r301425)
@@ -1,7 +1,9 @@
 /* $NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $ */
 
 /*-
- * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
+ * Copyright (c) 2009-2016 Dmitry Chagin
+ * Copyright (c) 2005 Emmanuel Dreyfus
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -605,7 +607,7 @@ futex_atomic_op(struct thread *td, int e
 
LIN_SDT_PROBE4(futex, futex_atomic_op, decoded_op, op, cmp, oparg,
cmparg);
-   
+
/* XXX: Linux verifies access here and returns EFAULT */
LIN_SDT_PROBE0(futex, futex_atomic_op, missing_access_check);
 
@@ -997,7 +999,6 @@ linux_sys_futex(struct thread *td, struc
return (ENOSYS);
 
case LINUX_FUTEX_REQUEUE:
-
/*
 * Glibc does not use this operation since version 2.3.3,
 * as it is racy and replaced by FUTEX_CMP_REQUEUE operation.
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r301424 - stable/10/sys/compat/linux

2016-06-05 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jun  5 06:02:37 2016
New Revision: 301424
URL: https://svnweb.freebsd.org/changeset/base/301424

Log:
  MFC r300411:
  
  Minor style(9) cleanup, no functional changes.

Modified:
  stable/10/sys/compat/linux/linux_file.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_file.c
==
--- stable/10/sys/compat/linux/linux_file.c Sun Jun  5 05:55:27 2016
(r301423)
+++ stable/10/sys/compat/linux/linux_file.c Sun Jun  5 06:02:37 2016
(r301424)
@@ -69,108 +69,106 @@ __FBSDID("$FreeBSD$");
 int
 linux_creat(struct thread *td, struct linux_creat_args *args)
 {
-char *path;
-int error;
-
-LCONVPATHEXIST(td, args->path, );
+   char *path;
+   int error;
 
+   LCONVPATHEXIST(td, args->path, );
 #ifdef DEBUG
if (ldebug(creat))
printf(ARGS(creat, "%s, %d"), path, args->mode);
 #endif
-error = kern_open(td, path, UIO_SYSSPACE, O_WRONLY | O_CREAT | O_TRUNC,
-   args->mode);
-LFREEPATH(path);
-return (error);
+   error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE,
+   O_WRONLY | O_CREAT | O_TRUNC, args->mode);
+   LFREEPATH(path);
+   return (error);
 }
 
 
 static int
 linux_common_open(struct thread *td, int dirfd, char *path, int l_flags, int 
mode)
 {
-cap_rights_t rights;
-struct proc *p = td->td_proc;
-struct file *fp;
-int fd;
-int bsd_flags, error;
-
-bsd_flags = 0;
-switch (l_flags & LINUX_O_ACCMODE) {
-case LINUX_O_WRONLY:
-   bsd_flags |= O_WRONLY;
-   break;
-case LINUX_O_RDWR:
-   bsd_flags |= O_RDWR;
-   break;
-default:
-   bsd_flags |= O_RDONLY;
-}
-if (l_flags & LINUX_O_NDELAY)
-   bsd_flags |= O_NONBLOCK;
-if (l_flags & LINUX_O_APPEND)
-   bsd_flags |= O_APPEND;
-if (l_flags & LINUX_O_SYNC)
-   bsd_flags |= O_FSYNC;
-if (l_flags & LINUX_O_NONBLOCK)
-   bsd_flags |= O_NONBLOCK;
-if (l_flags & LINUX_FASYNC)
-   bsd_flags |= O_ASYNC;
-if (l_flags & LINUX_O_CREAT)
-   bsd_flags |= O_CREAT;
-if (l_flags & LINUX_O_TRUNC)
-   bsd_flags |= O_TRUNC;
-if (l_flags & LINUX_O_EXCL)
-   bsd_flags |= O_EXCL;
-if (l_flags & LINUX_O_NOCTTY)
-   bsd_flags |= O_NOCTTY;
-if (l_flags & LINUX_O_DIRECT)
-   bsd_flags |= O_DIRECT;
-if (l_flags & LINUX_O_NOFOLLOW)
-   bsd_flags |= O_NOFOLLOW;
-if (l_flags & LINUX_O_DIRECTORY)
-   bsd_flags |= O_DIRECTORY;
-/* XXX LINUX_O_NOATIME: unable to be easily implemented. */
-
-error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode);
-if (error != 0)
-   goto done;
-
-if (bsd_flags & O_NOCTTY)
-   goto done;
-
-/*
- * XXX In between kern_open() and fget(), another process
- * having the same filedesc could use that fd without
- * checking below.
- */
-fd = td->td_retval[0];
-if (fget(td, fd, cap_rights_init(, CAP_IOCTL), ) == 0) {
-   if (fp->f_type != DTYPE_VNODE) {
-   fdrop(fp, td);
-   goto done;
-   }
-   sx_slock(_lock);
-   PROC_LOCK(p);
-   if (SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
-   PROC_UNLOCK(p);
-   sx_sunlock(_lock);
-   /* XXXPJD: Verify if TIOCSCTTY is allowed. */
-   (void) fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0,
-   td->td_ucred, td);
-   } else {
-   PROC_UNLOCK(p);
-   sx_sunlock(_lock);
-   }
-   fdrop(fp, td);
-}
+   cap_rights_t rights;
+   struct proc *p = td->td_proc;
+   struct file *fp;
+   int fd;
+   int bsd_flags, error;
+
+   bsd_flags = 0;
+   switch (l_flags & LINUX_O_ACCMODE) {
+   case LINUX_O_WRONLY:
+   bsd_flags |= O_WRONLY;
+   break;
+   case LINUX_O_RDWR:
+   bsd_flags |= O_RDWR;
+   break;
+   default:
+   bsd_flags |= O_RDONLY;
+   }
+   if (l_flags & LINUX_O_NDELAY)
+   bsd_flags |= O_NONBLOCK;
+   if (l_flags & LINUX_O_APPEND)
+   bsd_flags |= O_APPEND;
+   if (l_flags & LINUX_O_SYNC)
+   bsd_flags |= O_FSYNC;
+   if (l_flags & LINUX_O_NONBLOCK)
+   bsd_flags |= O_NONBLOCK;
+   if (l_flags & LINUX_FASYNC)
+   bsd_flags |= O_ASYNC;
+   if (l_flags & LINUX_O_CREAT)
+   bsd_flags |= O_CREAT;
+   if (l_flags & LINUX_O_TRUNC)
+   bsd_flags |= O_TRUNC;
+   if (l_flags & LINUX_O_EXCL)
+   bsd_flags |= O_EXCL;
+   if (l_flags & LINUX_O_NOCTTY)
+   bsd_flags |= O_NOCTTY;
+   if (l_flags & LINUX_O_DIRECT)
+   bsd_flags |= O_DIRECT;
+   if (l_flags & LINUX_O_NOFOLLOW)
+   bsd_flags 

svn commit: r301422 - in stable/10/sys: amd64/linux amd64/linux32 i386/linux

2016-06-04 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jun  5 05:49:33 2016
New Revision: 301422
URL: https://svnweb.freebsd.org/changeset/base/301422

Log:
  MFC r300359, r300360:
  
  Correct an argument param of linux_sched_* system calls as a struct 
l_sched_param
  does not defined due to it's nature.

Modified:
  stable/10/sys/amd64/linux/linux_proto.h
  stable/10/sys/amd64/linux/linux_systrace_args.c
  stable/10/sys/amd64/linux/syscalls.master
  stable/10/sys/amd64/linux32/linux32_proto.h
  stable/10/sys/amd64/linux32/linux32_systrace_args.c
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/i386/linux/linux_proto.h
  stable/10/sys/i386/linux/linux_systrace_args.c
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux_proto.h
==
--- stable/10/sys/amd64/linux/linux_proto.h Sun Jun  5 02:17:51 2016
(r301421)
+++ stable/10/sys/amd64/linux/linux_proto.h Sun Jun  5 05:49:33 2016
(r301422)
@@ -524,16 +524,16 @@ struct linux_getpriority_args {
 };
 struct linux_sched_setparam_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
-   char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * 
param; char param_r_[PADR_(struct l_sched_param *)];
+   char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; 
char param_r_[PADR_(struct sched_param *)];
 };
 struct linux_sched_getparam_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
-   char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * 
param; char param_r_[PADR_(struct l_sched_param *)];
+   char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; 
char param_r_[PADR_(struct sched_param *)];
 };
 struct linux_sched_setscheduler_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
char policy_l_[PADL_(l_int)]; l_int policy; char 
policy_r_[PADR_(l_int)];
-   char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * 
param; char param_r_[PADR_(struct l_sched_param *)];
+   char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; 
char param_r_[PADR_(struct sched_param *)];
 };
 struct linux_sched_getscheduler_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];

Modified: stable/10/sys/amd64/linux/linux_systrace_args.c
==
--- stable/10/sys/amd64/linux/linux_systrace_args.c Sun Jun  5 02:17:51 
2016(r301421)
+++ stable/10/sys/amd64/linux/linux_systrace_args.c Sun Jun  5 05:49:33 
2016(r301422)
@@ -1178,7 +1178,7 @@ systrace_args(int sysnum, void *params, 
case 142: {
struct linux_sched_setparam_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
-   uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
+   uarg[1] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 2;
break;
}
@@ -1186,7 +1186,7 @@ systrace_args(int sysnum, void *params, 
case 143: {
struct linux_sched_getparam_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
-   uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
+   uarg[1] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 2;
break;
}
@@ -1195,7 +1195,7 @@ systrace_args(int sysnum, void *params, 
struct linux_sched_setscheduler_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
iarg[1] = p->policy; /* l_int */
-   uarg[2] = (intptr_t) p->param; /* struct l_sched_param * */
+   uarg[2] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 3;
break;
}
@@ -4209,7 +4209,7 @@ systrace_entry_setargdesc(int sysnum, in
p = "l_pid_t";
break;
case 1:
-   p = "struct l_sched_param *";
+   p = "struct sched_param *";
break;
default:
break;
@@ -4222,7 +4222,7 @@ systrace_entry_setargdesc(int sysnum, in
p = "l_pid_t";
break;
case 1:
-   p = "struct l_sched_param *";
+   p = "struct sched_param *";
break;
default:
break;
@@ -4238,7 +4238,7 @@ systrace_entry_setargdesc(int sysnum, in
p = "l_int";
break;
case 2:
-   p = "struct l_sched_param *";
+   p = "struct 

svn commit: r300467 - stable/10/sys/amd64/linux

2016-05-22 Thread Dmitry Chagin
Author: dchagin
Date: Mon May 23 05:31:53 2016
New Revision: 300467
URL: https://svnweb.freebsd.org/changeset/base/300467

Log:
  MFC r299249:
  
  Add a forgotten in r283424 .eh_frame section with CFI & FDE records to allow
  stack unwinding through signal handler.

Modified:
  stable/10/sys/amd64/linux/linux_locore.s
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux_locore.s
==
--- stable/10/sys/amd64/linux/linux_locore.sMon May 23 05:30:24 2016
(r300466)
+++ stable/10/sys/amd64/linux/linux_locore.sMon May 23 05:31:53 2016
(r300467)
@@ -29,6 +29,7 @@ NON_GPROF_ENTRY(linux_rt_sigcode)
movq$LINUX_SYS_linux_rt_sigreturn,%rax   /* linux_rt_sigreturn() */
syscall /* enter kernel with args */
hlt
+.endrtsigcode:
 0: jmp 0b
 
 NON_GPROF_ENTRY(__vdso_clock_gettime)
@@ -74,3 +75,34 @@ NON_GPROF_ENTRY(__vdso_getcpu)
.balign 4
.previous
 #endif
+
+   .section .eh_frame,"a",@progbits
+.LSTARTFRAMEDLSI0:
+   .long .LENDCIEDLSI0-.LSTARTCIEDLSI0
+.LSTARTCIEDLSI0:
+   .long 0 /* CIE ID */
+   .byte 1 /* Version number */
+   .string "zR"/* NULL-terminated
+* augmentation string
+*/
+   .uleb128 1  /* Code alignment factor */
+   .sleb128 -4 /* Data alignment factor */
+   .byte 8 /* Return address register 
column */
+   .uleb128 1  /* Augmentation value length */
+   .byte 0x1b  /* 
DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
+   .byte 0x0c  /* DW_CFA_def_cfa */
+   .uleb128 4
+   .uleb128 4
+   .byte 0x88  /* DW_CFA_offset, column 0x8 */
+   .uleb128 1
+   .align 4
+.LENDCIEDLSI0:
+   .long .LENDFDEDLSI0-.LSTARTFDEDLSI0 /* Length FDE */
+.LSTARTFDEDLSI0:
+   .long .LSTARTFDEDLSI0-.LSTARTFRAMEDLSI0 /* CIE pointer */
+   .long .startrtsigcode-. /* PC-relative start address */
+   .long .endrtsigcode-.startrtsigcode
+   .uleb128 0
+   .align 4
+.LENDFDEDLSI0:
+   .previous
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r299219 - stable/10/sys/compat/linprocfs

2016-05-07 Thread Dmitry Chagin
Author: dchagin
Date: Sat May  7 18:54:35 2016
New Revision: 299219
URL: https://svnweb.freebsd.org/changeset/base/299219

Log:
  MFC r285394 (by mjg@):
  vref the vnode passed to vn_fullpath.

Modified:
  stable/10/sys/compat/linprocfs/linprocfs.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linprocfs/linprocfs.c
==
--- stable/10/sys/compat/linprocfs/linprocfs.c  Sat May  7 18:48:48 2016
(r299218)
+++ stable/10/sys/compat/linprocfs/linprocfs.c  Sat May  7 18:54:35 2016
(r299219)
@@ -858,10 +858,20 @@ linprocfs_doprocstatus(PFS_FILL_ARGS)
 static int
 linprocfs_doproccwd(PFS_FILL_ARGS)
 {
+   struct filedesc *fdp;
+   struct vnode *vp;
char *fullpath = "unknown";
char *freepath = NULL;
 
-   vn_fullpath(td, p->p_fd->fd_cdir, , );
+   fdp = p->p_fd;
+   FILEDESC_SLOCK(fdp);
+   vp = fdp->fd_cdir;
+   if (vp != NULL)
+   VREF(vp);
+   FILEDESC_SUNLOCK(fdp);
+   vn_fullpath(td, vp, , );
+   if (vp != NULL)
+   vrele(vp);
sbuf_printf(sb, "%s", fullpath);
if (freepath)
free(freepath, M_TEMP);
@@ -874,12 +884,20 @@ linprocfs_doproccwd(PFS_FILL_ARGS)
 static int
 linprocfs_doprocroot(PFS_FILL_ARGS)
 {
-   struct vnode *rvp;
+   struct filedesc *fdp;
+   struct vnode *vp;
char *fullpath = "unknown";
char *freepath = NULL;
 
-   rvp = jailed(p->p_ucred) ? p->p_fd->fd_jdir : p->p_fd->fd_rdir;
-   vn_fullpath(td, rvp, , );
+   fdp = p->p_fd;
+   FILEDESC_SLOCK(fdp);
+   vp = jailed(p->p_ucred) ? fdp->fd_jdir : fdp->fd_rdir;
+   if (vp != NULL)
+   VREF(vp);
+   FILEDESC_SUNLOCK(fdp);
+   vn_fullpath(td, vp, , );
+   if (vp != NULL)
+   vrele(vp);
sbuf_printf(sb, "%s", fullpath);
if (freepath)
free(freepath, M_TEMP);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r299215 - in stable/10/sys: compat/svr4 dev/streams modules/streams modules/svr4

2016-05-07 Thread Dmitry Chagin
Author: dchagin
Date: Sat May  7 08:30:21 2016
New Revision: 299215
URL: https://svnweb.freebsd.org/changeset/base/299215

Log:
  MFC r298519:
  Fix streams and svr4 module dependency. Both modules are complaining about
  undefined symbol svr4_delete_socket which was moved from streams to the svr4 
module
  in r160558 that created a two-way dependency between them.
  
  MFC r298520:
  Allow to build svr4 module with SYSV support separatelly from the kernel 
build.
  
  PR:   208464
  Reported by:  Kristoffer Eriksson

Modified:
  stable/10/sys/compat/svr4/svr4_ipc.c
  stable/10/sys/compat/svr4/svr4_socket.c
  stable/10/sys/compat/svr4/svr4_sysvec.c
  stable/10/sys/dev/streams/streams.c
  stable/10/sys/modules/streams/Makefile
  stable/10/sys/modules/svr4/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/svr4/svr4_ipc.c
==
--- stable/10/sys/compat/svr4/svr4_ipc.cSat May  7 08:26:05 2016
(r299214)
+++ stable/10/sys/compat/svr4/svr4_ipc.cSat May  7 08:30:21 2016
(r299215)
@@ -86,14 +86,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#if defined(SYSVMSG) || defined(SYSVSHM) || defined(SYSVSEM)
 static void svr4_to_bsd_ipc_perm(const struct svr4_ipc_perm *,
  struct ipc_perm *);
 static void bsd_to_svr4_ipc_perm(const struct ipc_perm *,
  struct svr4_ipc_perm *);
-#endif
-
-#ifdef SYSVSEM
 static void bsd_to_svr4_semid_ds(const struct semid_ds *,
  struct svr4_semid_ds *);
 static void svr4_to_bsd_semid_ds(const struct svr4_semid_ds *,
@@ -101,9 +97,6 @@ static void svr4_to_bsd_semid_ds(const s
 static int svr4_semop(struct thread *, void *);
 static int svr4_semget(struct thread *, void *);
 static int svr4_semctl(struct thread *, void *);
-#endif
-
-#ifdef SYSVMSG
 static void bsd_to_svr4_msqid_ds(const struct msqid_ds *,
  struct svr4_msqid_ds *);
 static void svr4_to_bsd_msqid_ds(const struct svr4_msqid_ds *,
@@ -112,9 +105,6 @@ static int svr4_msgsnd(struct thread *, 
 static int svr4_msgrcv(struct thread *, void *);
 static int svr4_msgget(struct thread *, void *);
 static int svr4_msgctl(struct thread *, void *);
-#endif
-
-#ifdef SYSVSHM
 static void bsd_to_svr4_shmid_ds(const struct shmid_ds *,
  struct svr4_shmid_ds *);
 static void svr4_to_bsd_shmid_ds(const struct svr4_shmid_ds *,
@@ -123,9 +113,6 @@ static int svr4_shmat(struct thread *, v
 static int svr4_shmdt(struct thread *, void *);
 static int svr4_shmget(struct thread *, void *);
 static int svr4_shmctl(struct thread *, void *);
-#endif
-
-#if defined(SYSVMSG) || defined(SYSVSHM) || defined(SYSVSEM)
 
 static void
 svr4_to_bsd_ipc_perm(spp, bpp)
@@ -154,9 +141,7 @@ bsd_to_svr4_ipc_perm(bpp, spp)
spp->mode = bpp->mode;
spp->seq = bpp->seq;
 }
-#endif
 
-#ifdef SYSVSEM
 static void
 bsd_to_svr4_semid_ds(bds, sds)
const struct semid_ds *bds;
@@ -331,10 +316,7 @@ svr4_sys_semsys(td, uap)
}
 }
 
-MODULE_DEPEND(svr4elf, sysvsem, 1, 1, 1);
-#endif
 
-#ifdef SYSVMSG
 static void
 bsd_to_svr4_msqid_ds(bds, sds)
const struct msqid_ds *bds;
@@ -421,7 +403,7 @@ svr4_msgrcv(td, v)
 
return sys_msgrcv(td, );
 }
-   
+
 struct svr4_sys_msgget_args {
int what;
svr4_key_t key;
@@ -504,10 +486,6 @@ svr4_sys_msgsys(td, uap)
}
 }
 
-MODULE_DEPEND(svr4elf, sysvmsg, 1, 1, 1);
-#endif
-
-#ifdef SYSVSHM
 
 static void
 bsd_to_svr4_shmid_ds(bds, sds)
@@ -657,7 +635,7 @@ svr4_shmctl(td, v)
default:
return (EINVAL);
}
-   
+
error = kern_shmctl(td, uap->shmid, cmd, , );
if (error)
return (error);
@@ -697,4 +675,5 @@ svr4_sys_shmsys(td, uap)
 }
 
 MODULE_DEPEND(svr4elf, sysvshm, 1, 1, 1);
-#endif /* SYSVSHM */
+MODULE_DEPEND(svr4elf, sysvmsg, 1, 1, 1);
+MODULE_DEPEND(svr4elf, sysvsem, 1, 1, 1);

Modified: stable/10/sys/compat/svr4/svr4_socket.c
==
--- stable/10/sys/compat/svr4/svr4_socket.c Sat May  7 08:26:05 2016
(r299214)
+++ stable/10/sys/compat/svr4/svr4_socket.c Sat May  7 08:30:21 2016
(r299215)
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 struct svr4_sockcache_entry {
struct proc *p; /* Process for the socket   */
@@ -168,6 +169,19 @@ svr4_delete_socket(p, fp)
mtx_unlock(_sockcache_lock);
 }
 
+struct svr4_strm *
+svr4_stream_get(fp)
+   struct file *fp;
+{
+   struct socket *so;
+
+   if (fp == NULL || fp->f_type != DTYPE_SOCKET)
+   return NULL;
+
+   so = fp->f_data;
+   return so->so_emuldata;
+}
+
 void
 svr4_purge_sockcache(arg, p)
void *arg;


svn commit: r297780 - stable/10/sys/compat/linux

2016-04-10 Thread Dmitry Chagin
Author: dchagin
Date: Sun Apr 10 06:36:58 2016
New Revision: 297780
URL: https://svnweb.freebsd.org/changeset/base/297780

Log:
  MFCR r297519, r297525 (by pfg@):
  
  Move Linux specific times tests up to guarantee the values are defined.

Modified:
  stable/10/sys/compat/linux/linux_misc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_misc.c
==
--- stable/10/sys/compat/linux/linux_misc.c Sun Apr 10 06:19:26 2016
(r297779)
+++ stable/10/sys/compat/linux/linux_misc.c Sun Apr 10 06:36:58 2016
(r297780)
@@ -894,13 +894,14 @@ linux_utimensat(struct thread *td, struc
break;
}
timesp = times;
-   }
 
-   if (times[0].tv_nsec == UTIME_OMIT && times[1].tv_nsec == UTIME_OMIT)
/* This breaks POSIX, but is what the Linux kernel does
 * _on purpose_ (documented in the man page for utimensat(2)),
 * so we must follow that behaviour. */
-   return (0);
+   if (times[0].tv_nsec == UTIME_OMIT &&
+   times[1].tv_nsec == UTIME_OMIT)
+   return (0);
+   }
 
if (args->pathname != NULL)
LCONVPATHEXIST_AT(td, args->pathname, , dfd);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297518 - stable/10/sys/compat/linux

2016-04-03 Thread Dmitry Chagin
Author: dchagin
Date: Sun Apr  3 06:22:36 2016
New Revision: 297518
URL: https://svnweb.freebsd.org/changeset/base/297518

Log:
  MFC r297309:
  
  Whitespaces and style(9) fix. No functional changes.

Modified:
  stable/10/sys/compat/linux/linux_socket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_socket.c
==
--- stable/10/sys/compat/linux/linux_socket.c   Sat Apr  2 19:42:12 2016
(r297517)
+++ stable/10/sys/compat/linux/linux_socket.c   Sun Apr  3 06:22:36 2016
(r297518)
@@ -448,7 +448,7 @@ linux_to_bsd_msg_flags(int flags)
if (flags & LINUX_MSG_ERRQUEUE)
;
 #endif
-   return ret_flags;
+   return (ret_flags);
 }
 
 /*
@@ -463,15 +463,12 @@ bsd_to_linux_sockaddr(struct sockaddr *a
struct sockaddr sa;
size_t sa_len = sizeof(struct sockaddr);
int error;
-   
+
if ((error = copyin(arg, , sa_len)))
return (error);
-   
+
*(u_short *) = sa.sa_family;
-   
-   error = copyout(, arg, sa_len);
-   
-   return (error);
+   return (copyout(, arg, sa_len));
 }
 
 static int
@@ -486,10 +483,7 @@ linux_to_bsd_sockaddr(struct sockaddr *a
 
sa.sa_family = *(sa_family_t *)
sa.sa_len = len;
-
-   error = copyout(, arg, sa_len);
-
-   return (error);
+   return (copyout(, arg, sa_len));
 }
 
 static int
@@ -511,11 +505,7 @@ linux_sa_put(struct osockaddr *osa)
return (EINVAL);
 
sa.sa_family = bdom;
-   error = copyout(, osa, sizeof(sa.sa_family));
-   if (error)
-   return (error);
-
-   return (0);
+   return (copyout(, osa, sizeof(sa.sa_family)));
 }
 
 static int
@@ -898,10 +888,7 @@ linux_getsockname(struct thread *td, str
bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa);
if (error)
return (error);
-   error = linux_sa_put(PTRIN(args->addr));
-   if (error)
-   return (error);
-   return (0);
+   return (linux_sa_put(PTRIN(args->addr)));
 }
 
 int
@@ -921,10 +908,7 @@ linux_getpeername(struct thread *td, str
bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa);
if (error)
return (error);
-   error = linux_sa_put(PTRIN(args->addr));
-   if (error)
-   return (error);
-   return (0);
+   return (linux_sa_put(PTRIN(args->addr)));
 }
 
 int
@@ -989,7 +973,7 @@ linux_send(struct thread *td, struct lin
bsd_args.flags = args->flags;
bsd_args.to = NULL;
bsd_args.tolen = 0;
-   return sys_sendto(td, _args);
+   return (sys_sendto(td, _args));
 }
 
 struct linux_recv_args {
@@ -1026,7 +1010,6 @@ linux_sendto(struct thread *td, struct l
 {
struct msghdr msg;
struct iovec aiov;
-   int error;
 
if (linux_check_hdrincl(td, args->s) == 0)
/* IP_HDRINCL set, tweak the packet before sending */
@@ -1040,9 +1023,8 @@ linux_sendto(struct thread *td, struct l
msg.msg_flags = 0;
aiov.iov_base = PTRIN(args->msg);
aiov.iov_len = args->len;
-   error = linux_sendit(td, args->s, , args->flags, NULL,
-   UIO_USERSPACE);
-   return (error);
+   return (linux_sendit(td, args->s, , args->flags, NULL,
+   UIO_USERSPACE));
 }
 
 int
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297503 - stable/10/sys/compat/linux

2016-04-02 Thread Dmitry Chagin
Author: dchagin
Date: Sat Apr  2 06:18:19 2016
New Revision: 297503
URL: https://svnweb.freebsd.org/changeset/base/297503

Log:
  MFC r297297:
  
  When write(2) on eventfd object fails with the error EAGAIN do not return the 
number of bytes written.

Modified:
  stable/10/sys/compat/linux/linux_event.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_event.c
==
--- stable/10/sys/compat/linux/linux_event.cSat Apr  2 06:15:14 2016
(r297502)
+++ stable/10/sys/compat/linux/linux_event.cSat Apr  2 06:18:19 2016
(r297503)
@@ -748,6 +748,8 @@ retry:
if (UINT64_MAX - efd->efd_count <= count) {
if ((efd->efd_flags & LINUX_O_NONBLOCK) != 0) {
mtx_unlock(>efd_lock);
+   /* Do not not return the number of bytes written */
+   uio->uio_resid += sizeof(eventfd_t);
return (EAGAIN);
}
error = mtx_sleep(>efd_count, >efd_lock,
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297502 - stable/10/sys/compat/linux

2016-04-02 Thread Dmitry Chagin
Author: dchagin
Date: Sat Apr  2 06:15:14 2016
New Revision: 297502
URL: https://svnweb.freebsd.org/changeset/base/297502

Log:
  MFC r297296:
  
  Implement O_NONBLOCK flag via fcntl(F_SETFL) for eventfd object.

Modified:
  stable/10/sys/compat/linux/linux_event.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_event.c
==
--- stable/10/sys/compat/linux/linux_event.cSat Apr  2 01:59:53 2016
(r297501)
+++ stable/10/sys/compat/linux/linux_event.cSat Apr  2 06:15:14 2016
(r297502)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -868,8 +869,24 @@ static int
 eventfd_ioctl(struct file *fp, u_long cmd, void *data,
struct ucred *active_cred, struct thread *td)
 {
+   struct eventfd *efd;
 
-   return (ENXIO);
+   efd = fp->f_data;
+   if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
+   return (EINVAL);
+
+   switch (cmd)
+   {
+   case FIONBIO:
+   if (*(int *)data)
+   efd->efd_flags |= LINUX_O_NONBLOCK;
+   else
+   efd->efd_flags &= ~LINUX_O_NONBLOCK;
+   case FIOASYNC:
+   return (0);
+   default:
+   return (ENXIO);
+   }
 }
 
 /*ARGSUSED*/
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297306 - stable/10/sys/compat/linux

2016-03-27 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 27 07:34:42 2016
New Revision: 297306
URL: https://svnweb.freebsd.org/changeset/base/297306

Log:
  Revert r297303.

Modified:
  stable/10/sys/compat/linux/linux_socket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_socket.c
==
--- stable/10/sys/compat/linux/linux_socket.c   Sun Mar 27 06:55:49 2016
(r297305)
+++ stable/10/sys/compat/linux/linux_socket.c   Sun Mar 27 07:34:42 2016
(r297306)
@@ -838,10 +838,7 @@ linux_accept_common(struct thread *td, i
socklen_t * __restrict anamelen;
int flags;
} */ bsd_args;
-   cap_rights_t rights;
-   struct socket *so;
-   struct file *fp;
-   int error, error1;
+   int error;
 
bsd_args.s = s;
/* XXX: */
@@ -856,17 +853,6 @@ linux_accept_common(struct thread *td, i
if (error) {
if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
return (EINVAL);
-   if (error == EINVAL) {
-   error1 = getsock_cap(td, s, , , NULL);
-   if (error1 != 0)
-   return (error1);
-   so = fp->f_data;
-   if (so->so_type == SOCK_DGRAM) {
-   fdrop(fp, td);
-   return (EOPNOTSUPP);
-   }
-   fdrop(fp, td);
-   }
return (error);
}
if (addr)
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297305 - stable/10/sys/compat/linux

2016-03-27 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 27 06:55:49 2016
New Revision: 297305
URL: https://svnweb.freebsd.org/changeset/base/297305

Log:
  MFC r296501:
  
  Link the newly created process to the corresponding parent as
  if CLONE_PARENT is set, then the parent of the new process will be
  the same as that of the calling process.

Modified:
  stable/10/sys/compat/linux/linux_fork.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_fork.c
==
--- stable/10/sys/compat/linux/linux_fork.c Sun Mar 27 06:52:40 2016
(r297304)
+++ stable/10/sys/compat/linux/linux_fork.c Sun Mar 27 06:55:49 2016
(r297305)
@@ -213,6 +213,18 @@ linux_clone_proc(struct thread *td, stru
if (args->flags & LINUX_CLONE_SETTLS)
linux_set_cloned_tls(td2, args->tls);
 
+   /*
+* If CLONE_PARENT is set, then the parent of the new process will be 
+* the same as that of the calling process.
+*/
+   if (args->flags & LINUX_CLONE_PARENT) {
+   sx_xlock(_lock);
+   PROC_LOCK(p2);
+   proc_reparent(p2, td->td_proc->p_pptr);
+   PROC_UNLOCK(p2);
+   sx_xunlock(_lock);
+   }
+
 #ifdef DEBUG
if (ldebug(clone))
printf(LMSG("clone: successful rfork to %d, "
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297304 - stable/10/sys/compat/linux

2016-03-27 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 27 06:52:40 2016
New Revision: 297304
URL: https://svnweb.freebsd.org/changeset/base/297304

Log:
  MFC r296502, r296543, r296546, r297060:
  
1. Limit secs to INT32_MAX / 2 to avoid errors from kern_setitimer().
   Assert that kern_setitimer() returns 0.
   Remove bogus cast of secs.
   Fix style(9) issues.
  
2. Increment the return value if the remaining tv_usec value more than 
50 as a Linux does.

Modified:
  stable/10/sys/compat/linux/linux_misc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_misc.c
==
--- stable/10/sys/compat/linux/linux_misc.c Sun Mar 27 06:43:05 2016
(r297303)
+++ stable/10/sys/compat/linux/linux_misc.c Sun Mar 27 06:52:40 2016
(r297304)
@@ -198,24 +198,27 @@ linux_alarm(struct thread *td, struct li
if (ldebug(alarm))
printf(ARGS(alarm, "%u"), args->secs);
 #endif
-   
secs = args->secs;
+   /*
+* Linux alarm() is always successfull. Limit secs to INT32_MAX / 2
+* to match kern_setitimer()'s limit to avoid error from it.
+*
+* XXX. Linux limit secs to INT_MAX on 32 and does not limit on 64-bit
+* platforms.
+*/
+   if (secs > INT32_MAX / 2)
+   secs = INT32_MAX / 2;
 
-   if (secs > INT_MAX)
-   secs = INT_MAX;
-
-   it.it_value.tv_sec = (long) secs;
+   it.it_value.tv_sec = secs;
it.it_value.tv_usec = 0;
-   it.it_interval.tv_sec = 0;
-   it.it_interval.tv_usec = 0;
+   timevalclear(_interval);
error = kern_setitimer(td, ITIMER_REAL, , _it);
-   if (error)
-   return (error);
-   if (timevalisset(_it.it_value)) {
-   if (old_it.it_value.tv_usec != 0)
-   old_it.it_value.tv_sec++;
-   td->td_retval[0] = old_it.it_value.tv_sec;
-   }
+   KASSERT(error == 0, ("kern_setitimer returns %d", error));
+
+   if ((old_it.it_value.tv_sec == 0 && old_it.it_value.tv_usec > 0) ||
+   old_it.it_value.tv_usec >= 50)
+   old_it.it_value.tv_sec++;
+   td->td_retval[0] = old_it.it_value.tv_sec;
return (0);
 }
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297303 - stable/10/sys/compat/linux

2016-03-27 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 27 06:43:05 2016
New Revision: 297303
URL: https://svnweb.freebsd.org/changeset/base/297303

Log:
  MFC r296503, r296504:
  
  Linux accept() system call return EOPNOTSUPP errno instead of EINVAL for UDP 
sockets.

Modified:
  stable/10/sys/compat/linux/linux_socket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_socket.c
==
--- stable/10/sys/compat/linux/linux_socket.c   Sun Mar 27 06:21:05 2016
(r297302)
+++ stable/10/sys/compat/linux/linux_socket.c   Sun Mar 27 06:43:05 2016
(r297303)
@@ -838,7 +838,10 @@ linux_accept_common(struct thread *td, i
socklen_t * __restrict anamelen;
int flags;
} */ bsd_args;
-   int error;
+   cap_rights_t rights;
+   struct socket *so;
+   struct file *fp;
+   int error, error1;
 
bsd_args.s = s;
/* XXX: */
@@ -853,6 +856,17 @@ linux_accept_common(struct thread *td, i
if (error) {
if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
return (EINVAL);
+   if (error == EINVAL) {
+   error1 = getsock_cap(td, s, , , NULL);
+   if (error1 != 0)
+   return (error1);
+   so = fp->f_data;
+   if (so->so_type == SOCK_DGRAM) {
+   fdrop(fp, td);
+   return (EOPNOTSUPP);
+   }
+   fdrop(fp, td);
+   }
return (error);
}
if (addr)
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297302 - stable/10/sys/compat/linux

2016-03-27 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 27 06:21:05 2016
New Revision: 297302
URL: https://svnweb.freebsd.org/changeset/base/297302

Log:
  MFC r297063:
 Whitespaces, style(9) fixes. No functional changes.
  
  MFC r297070:
Return EOVERFLOW in case when actual statfs values are large enough and
not fit into 32 bit fileds of a Linux struct statfs.
  
  MFC r297072:
  
Check bsd_to_linux_statfs() return value.

Modified:
  stable/10/sys/compat/linux/linux_stats.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_stats.c
==
--- stable/10/sys/compat/linux/linux_stats.cSun Mar 27 06:17:19 2016
(r297301)
+++ stable/10/sys/compat/linux/linux_stats.cSun Mar 27 06:21:05 2016
(r297302)
@@ -256,7 +256,7 @@ static int
 stat_copyout(struct stat *buf, void *ubuf)
 {
struct l_stat lbuf;
-   
+
bzero(, sizeof(lbuf));
lbuf.st_dev = buf->st_dev;
lbuf.st_ino = buf->st_ino;
@@ -302,7 +302,7 @@ linux_stat(struct thread *td, struct lin
return (error);
}
LFREEPATH(path);
-   return(stat_copyout(, args->up));
+   return (stat_copyout(, args->up));
 }
 
 int
@@ -324,7 +324,7 @@ linux_lstat(struct thread *td, struct li
return (error);
}
LFREEPATH(path);
-   return(stat_copyout(, args->up));
+   return (stat_copyout(, args->up));
 }
 #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
 
@@ -380,10 +380,22 @@ bsd_to_linux_ftype(const char *fstypenam
return (0L);
 }
 
-static void
+static int
 bsd_to_linux_statfs(struct statfs *bsd_statfs, struct l_statfs *linux_statfs)
 {
+#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
+   uint64_t tmp;
 
+#defineLINUX_HIBITS0xULL
+
+   tmp = bsd_statfs->f_blocks | bsd_statfs->f_bfree | bsd_statfs->f_files |
+   bsd_statfs->f_bsize;
+   if ((bsd_statfs->f_bavail != -1 && (bsd_statfs->f_bavail & 
LINUX_HIBITS)) ||
+   (bsd_statfs->f_ffree != -1 && (bsd_statfs->f_ffree & LINUX_HIBITS)) 
||
+   (tmp & LINUX_HIBITS))
+   return (EOVERFLOW);
+#undef LINUX_HIBITS
+#endif
linux_statfs->f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename);
linux_statfs->f_bsize = bsd_statfs->f_bsize;
linux_statfs->f_blocks = bsd_statfs->f_blocks;
@@ -394,6 +406,8 @@ bsd_to_linux_statfs(struct statfs *bsd_s
linux_statfs->f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
linux_statfs->f_namelen = MAXNAMLEN;
+
+   return (0);
 }
 
 int
@@ -414,8 +428,10 @@ linux_statfs(struct thread *td, struct l
LFREEPATH(path);
if (error)
return (error);
-   bsd_to_linux_statfs(_statfs, _statfs);
-   return copyout(_statfs, args->buf, sizeof(linux_statfs));
+   error = bsd_to_linux_statfs(_statfs, _statfs);
+   if (error)
+   return (error);
+   return (copyout(_statfs, args->buf, sizeof(linux_statfs)));
 }
 
 #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
@@ -457,7 +473,7 @@ linux_statfs64(struct thread *td, struct
if (error)
return (error);
bsd_to_linux_statfs64(_statfs, _statfs);
-   return copyout(_statfs, args->buf, sizeof(linux_statfs));
+   return (copyout(_statfs, args->buf, sizeof(linux_statfs)));
 }
 
 int
@@ -495,9 +511,11 @@ linux_fstatfs(struct thread *td, struct 
 #endif
error = kern_fstatfs(td, args->fd, _statfs);
if (error)
-   return error;
-   bsd_to_linux_statfs(_statfs, _statfs);
-   return copyout(_statfs, args->buf, sizeof(linux_statfs));
+   return (error);
+   error = bsd_to_linux_statfs(_statfs, _statfs);
+   if (error)
+   return (error);
+   return (copyout(_statfs, args->buf, sizeof(linux_statfs)));
 }
 
 struct l_ustat
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297301 - in stable/10/sys: amd64/linux32 i386/linux

2016-03-27 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 27 06:17:19 2016
New Revision: 297301
URL: https://svnweb.freebsd.org/changeset/base/297301

Log:
  MFC r297062:
  
  Regen for r297061 (fstatfs64 Linux syscall).

Modified:
  stable/10/sys/amd64/linux32/linux32_proto.h
  stable/10/sys/amd64/linux32/linux32_syscall.h
  stable/10/sys/amd64/linux32/linux32_syscalls.c
  stable/10/sys/amd64/linux32/linux32_sysent.c
  stable/10/sys/amd64/linux32/linux32_systrace_args.c
  stable/10/sys/i386/linux/linux_proto.h
  stable/10/sys/i386/linux/linux_syscall.h
  stable/10/sys/i386/linux/linux_syscalls.c
  stable/10/sys/i386/linux/linux_sysent.c
  stable/10/sys/i386/linux/linux_systrace_args.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/linux32_proto.h
==
--- stable/10/sys/amd64/linux32/linux32_proto.h Sun Mar 27 06:10:51 2016
(r297300)
+++ stable/10/sys/amd64/linux32/linux32_proto.h Sun Mar 27 06:17:19 2016
(r297301)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 294368 
2016-01-20 01:09:53Z jhb 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 297300 
2016-03-27 06:10:51Z dchagin 
  */
 
 #ifndef _LINUX32_SYSPROTO_H_
@@ -844,7 +844,9 @@ struct linux_statfs64_args {
char buf_l_[PADL_(struct l_statfs64_buf *)]; struct l_statfs64_buf * 
buf; char buf_r_[PADR_(struct l_statfs64_buf *)];
 };
 struct linux_fstatfs64_args {
-   register_t dummy;
+   char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)];
+   char bufsize_l_[PADL_(size_t)]; size_t bufsize; char 
bufsize_r_[PADR_(size_t)];
+   char buf_l_[PADL_(struct l_statfs64_buf *)]; struct l_statfs64_buf * 
buf; char buf_r_[PADR_(struct l_statfs64_buf *)];
 };
 struct linux_tgkill_args {
char tgid_l_[PADL_(int)]; int tgid; char tgid_r_[PADR_(int)];

Modified: stable/10/sys/amd64/linux32/linux32_syscall.h
==
--- stable/10/sys/amd64/linux32/linux32_syscall.h   Sun Mar 27 06:10:51 
2016(r297300)
+++ stable/10/sys/amd64/linux32/linux32_syscall.h   Sun Mar 27 06:17:19 
2016(r297301)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 294368 
2016-01-20 01:09:53Z jhb 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 297300 
2016-03-27 06:10:51Z dchagin 
  */
 
 #defineLINUX32_SYS_linux_exit  1

Modified: stable/10/sys/amd64/linux32/linux32_syscalls.c
==
--- stable/10/sys/amd64/linux32/linux32_syscalls.c  Sun Mar 27 06:10:51 
2016(r297300)
+++ stable/10/sys/amd64/linux32/linux32_syscalls.c  Sun Mar 27 06:17:19 
2016(r297301)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 294368 
2016-01-20 01:09:53Z jhb 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 297300 
2016-03-27 06:10:51Z dchagin 
  */
 
 const char *linux32_syscallnames[] = {

Modified: stable/10/sys/amd64/linux32/linux32_sysent.c
==
--- stable/10/sys/amd64/linux32/linux32_sysent.cSun Mar 27 06:10:51 
2016(r297300)
+++ stable/10/sys/amd64/linux32/linux32_sysent.cSun Mar 27 06:17:19 
2016(r297301)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 294368 
2016-01-20 01:09:53Z jhb 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 297300 
2016-03-27 06:10:51Z dchagin 
  */
 
 #include "opt_compat.h"
@@ -288,7 +288,7 @@ struct sysent linux32_sysent[] = {
{ AS(linux_clock_getres_args), (sy_call_t *)linux_clock_getres, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   /* 266 = linux_clock_getres */
{ AS(linux_clock_nanosleep_args), (sy_call_t *)linux_clock_nanosleep, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 267 = linux_clock_nanosleep */
{ AS(linux_statfs64_args), (sy_call_t *)linux_statfs64, AUE_STATFS, 
NULL, 0, 0, 0, SY_THR_STATIC }, /* 268 = linux_statfs64 */
-   { 0, (sy_call_t *)linux_fstatfs64, AUE_FSTATFS, NULL, 0, 0, 0, 
SY_THR_STATIC }, /* 269 = linux_fstatfs64 */
+   { AS(linux_fstatfs64_args), (sy_call_t *)linux_fstatfs64, AUE_FSTATFS, 
NULL, 0, 0, 0, SY_THR_STATIC },  /* 269 = linux_fstatfs64 */
{ AS(linux_tgkill_args), (sy_call_t *)linux_tgkill, AUE_NULL, NULL, 0, 
0, 0, SY_THR_STATIC },   /* 270 = linux_tgkill */
{ AS(linux_utimes_args), (sy_call_t *)linux_utimes, 

svn commit: r296797 - stable/10/etc/rc.d

2016-03-13 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 13 08:19:27 2016
New Revision: 296797
URL: https://svnweb.freebsd.org/changeset/base/296797

Log:
  MFC r296542:
  Load linux64 module for amd64 if Linux abi enabled.

Modified:
  stable/10/etc/rc.d/abi
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/rc.d/abi
==
--- stable/10/etc/rc.d/abi  Sun Mar 13 02:09:01 2016(r296796)
+++ stable/10/etc/rc.d/abi  Sun Mar 13 08:19:27 2016(r296797)
@@ -27,6 +27,11 @@ linux_start()
 
echo -n ' linux'
load_kld -e 'linux(aout|elf)' linux
+   case `sysctl -n hw.machine_arch` in
+   amd64)
+   load_kld -e 'linux64elf' linux64
+   ;;
+   esac
if [ -x /compat/linux/sbin/ldconfigDisabled ]; then
_tmpdir=`mktemp -d -t linux-ldconfig`
/compat/linux/sbin/ldconfig -C ${_tmpdir}/ld.so.cache
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r294764 - stable/10/sys/amd64/linux

2016-01-25 Thread Dmitry Chagin
Author: dchagin
Date: Tue Jan 26 06:05:55 2016
New Revision: 294764
URL: https://svnweb.freebsd.org/changeset/base/294764

Log:
  MFC r294620:
  
Fix a typo.
  
  MFC r294621:
  
Remove obsolete comment.

Modified:
  stable/10/sys/amd64/linux/linux.h
  stable/10/sys/amd64/linux/linux_machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux.h
==
--- stable/10/sys/amd64/linux/linux.h   Tue Jan 26 05:04:36 2016
(r294763)
+++ stable/10/sys/amd64/linux/linux.h   Tue Jan 26 06:05:55 2016
(r294764)
@@ -530,8 +530,8 @@ struct l_pollfd {
 
 #define LINUX_ARCH_SET_GS  0x1001
 #define LINUX_ARCH_SET_FS  0x1002
-#define LINUX_ARCH_GET_GS  0x1003
-#define LINUX_ARCH_GET_FS  0x1004
+#define LINUX_ARCH_GET_FS  0x1003
+#define LINUX_ARCH_GET_GS  0x1004
 
 #definelinux_copyout_rusage(r, u)  copyout(r, u, sizeof(*r))
 

Modified: stable/10/sys/amd64/linux/linux_machdep.c
==
--- stable/10/sys/amd64/linux/linux_machdep.c   Tue Jan 26 05:04:36 2016
(r294763)
+++ stable/10/sys/amd64/linux/linux_machdep.c   Tue Jan 26 06:05:55 2016
(r294764)
@@ -383,7 +383,6 @@ linux_sigaltstack(struct thread *td, str
return (error);
 }
 
-/* XXX do all */
 int
 linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args)
 {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r294529 - stable/10/sys/compat/linux

2016-01-21 Thread Dmitry Chagin
Author: dchagin
Date: Thu Jan 21 19:19:24 2016
New Revision: 294529
URL: https://svnweb.freebsd.org/changeset/base/294529

Log:
  MFC 294233:
  
  Prevent double free of control in common sendmsg path as sosend
  already freeing it.

Modified:
  stable/10/sys/compat/linux/linux_socket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_socket.c
==
--- stable/10/sys/compat/linux/linux_socket.c   Thu Jan 21 18:45:46 2016
(r294528)
+++ stable/10/sys/compat/linux/linux_socket.c   Thu Jan 21 19:19:24 2016
(r294529)
@@ -1164,6 +1164,7 @@ linux_sendmsg_common(struct thread *td, 
msg.msg_iov = iov;
msg.msg_flags = 0;
error = linux_sendit(td, s, , flags, control, UIO_USERSPACE);
+   control = NULL;
 
 bad:
m_freem(control);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r294135 - stable/10/usr.bin/kdump

2016-01-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan 16 07:46:25 2016
New Revision: 294135
URL: https://svnweb.freebsd.org/changeset/base/294135

Log:
  MFC r283430:
  
  Teach kdump to understand both linux emulation.

Added:
  stable/10/usr.bin/kdump/linux32_syscalls.conf
 - copied unchanged from r283430, head/usr.bin/kdump/linux32_syscalls.conf
Modified:
  stable/10/usr.bin/kdump/Makefile
  stable/10/usr.bin/kdump/kdump.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/kdump/Makefile
==
--- stable/10/usr.bin/kdump/MakefileSat Jan 16 05:58:17 2016
(r294134)
+++ stable/10/usr.bin/kdump/MakefileSat Jan 16 07:46:25 2016
(r294135)
@@ -3,10 +3,6 @@
 
 .include 
 
-.if (${MACHINE_ARCH} == "amd64")
-SFX=   32
-.endif
-
 .PATH: ${.CURDIR}/../ktrace
 
 PROG=  kdump
@@ -24,6 +20,9 @@ CLEANFILES=   ioctl.c kdump_subr.c kdump_s
 .if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386")
 CLEANFILES+=   linux_syscalls.c
 .endif
+.if (${MACHINE_ARCH} == "amd64")
+CLEANFILES+=   linux32_syscalls.c
+.endif
 
 ioctl.c: mkioctls
env MACHINE=${MACHINE} CPP="${CPP}" \
@@ -37,7 +36,11 @@ kdump_subr.c: mksubr kdump_subr.h
sh ${.CURDIR}/mksubr ${DESTDIR}/usr/include >${.TARGET}
 .if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386")
sh ${.CURDIR}/../../sys/kern/makesyscalls.sh \
-   ${.CURDIR}/../../sys/${MACHINE_ARCH}/linux${SFX}/syscalls.master 
${.CURDIR}/linux_syscalls.conf
+   ${.CURDIR}/../../sys/${MACHINE_ARCH}/linux/syscalls.master 
${.CURDIR}/linux_syscalls.conf
+.endif
+.if (${MACHINE_ARCH} == "amd64")
+   sh ${.CURDIR}/../../sys/kern/makesyscalls.sh \
+   ${.CURDIR}/../../sys/${MACHINE_ARCH}/linux32/syscalls.master 
${.CURDIR}/linux32_syscalls.conf
 .endif
 
 .include 

Modified: stable/10/usr.bin/kdump/kdump.c
==
--- stable/10/usr.bin/kdump/kdump.c Sat Jan 16 05:58:17 2016
(r294134)
+++ stable/10/usr.bin/kdump/kdump.c Sat Jan 16 07:46:25 2016
(r294135)
@@ -139,13 +139,11 @@ static struct ktr_header ktr_header;
 
 #if defined(__amd64__) || defined(__i386__)
 
-void linux_ktrsyscall(struct ktr_syscall *);
-void linux_ktrsysret(struct ktr_sysret *);
+void linux_ktrsyscall(struct ktr_syscall *, u_int);
+void linux_ktrsysret(struct ktr_sysret *, u_int);
 extern const char *linux_syscallnames[];
 
 #include 
-static int nlinux_syscalls = sizeof(linux_syscallnames) / \
-   sizeof(linux_syscallnames[0]);
 
 /*
  * from linux.h
@@ -165,6 +163,12 @@ static int bsd_to_linux_errno[ELAST + 1]
 };
 #endif
 
+#if defined(__amd64__)
+extern const char *linux32_syscallnames[];
+
+#include 
+#endif
+
 struct proc_info
 {
TAILQ_ENTRY(proc_info)  info;
@@ -331,7 +335,8 @@ main(int argc, char *argv[])
case KTR_SYSCALL:
 #if defined(__amd64__) || defined(__i386__)
if ((sv_flags & SV_ABI_MASK) == SV_ABI_LINUX)
-   linux_ktrsyscall((struct ktr_syscall *)m);
+   linux_ktrsyscall((struct ktr_syscall *)m,
+   sv_flags);
else
 #endif
ktrsyscall((struct ktr_syscall *)m, sv_flags);
@@ -339,7 +344,8 @@ main(int argc, char *argv[])
case KTR_SYSRET:
 #if defined(__amd64__) || defined(__i386__)
if ((sv_flags & SV_ABI_MASK) == SV_ABI_LINUX)
-   linux_ktrsysret((struct ktr_sysret *)m);
+   linux_ktrsysret((struct ktr_sysret *)m, 
+   sv_flags);
else
 #endif
ktrsysret((struct ktr_sysret *)m, sv_flags);
@@ -1891,16 +1897,28 @@ ktrfaultend(struct ktr_faultend *ktr)
 }
 
 #if defined(__amd64__) || defined(__i386__)
+
+#if defined(__amd64__)
+#defineNLINUX_SYSCALLS(v)  ((v) & SV_ILP32 ?   
\
+   nitems(linux32_syscallnames) : nitems(linux_syscallnames))
+#defineLINUX_SYSCALLNAMES(v, i)((v) & SV_ILP32 ?   
\
+   linux32_syscallnames[i] : linux_syscallnames[i])
+#else
+#defineNLINUX_SYSCALLS(v)  (nitems(linux_syscallnames))
+#defineLINUX_SYSCALLNAMES(v, i)(linux_syscallnames[i])
+#endif
+
 void
-linux_ktrsyscall(struct ktr_syscall *ktr)
+linux_ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
 {
int narg = ktr->ktr_narg;
+   unsigned code = ktr->ktr_code;
register_t *ip;
 
-   if (ktr->ktr_code >= nlinux_syscalls || ktr->ktr_code < 0)
+   if (ktr->ktr_code < 0 || code >= NLINUX_SYSCALLS(sv_flags))
printf("[%d]", ktr->ktr_code);
else {
-   printf("%s", linux_syscallnames[ktr->ktr_code]);
+   

svn commit: r294136 - in stable/10/sys: amd64/amd64 amd64/linux amd64/linux32 arm/arm compat/ia32 compat/svr4 i386/i386 i386/ibcs2 i386/linux kern mips/mips powerpc/powerpc sparc64/sparc64 sys

2016-01-15 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan 16 07:56:49 2016
New Revision: 294136
URL: https://svnweb.freebsd.org/changeset/base/294136

Log:
  MFC r293613:
  
  Implement vsyscall hack. Prior to 2.13 glibc uses vsyscall
  instead of vdso. An upcoming linux_base-c6 needs it.

Modified:
  stable/10/sys/amd64/amd64/elf_machdep.c
  stable/10/sys/amd64/amd64/trap.c
  stable/10/sys/amd64/linux/linux_sysvec.c
  stable/10/sys/amd64/linux32/linux32_sysvec.c
  stable/10/sys/arm/arm/elf_machdep.c
  stable/10/sys/compat/ia32/ia32_sysvec.c
  stable/10/sys/compat/svr4/svr4_sysvec.c
  stable/10/sys/i386/i386/elf_machdep.c
  stable/10/sys/i386/ibcs2/ibcs2_sysvec.c
  stable/10/sys/i386/linux/linux_sysvec.c
  stable/10/sys/kern/imgact_aout.c
  stable/10/sys/kern/init_main.c
  stable/10/sys/mips/mips/elf_machdep.c
  stable/10/sys/mips/mips/freebsd32_machdep.c
  stable/10/sys/powerpc/powerpc/elf32_machdep.c
  stable/10/sys/powerpc/powerpc/elf64_machdep.c
  stable/10/sys/sparc64/sparc64/elf_machdep.c
  stable/10/sys/sys/sysent.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/elf_machdep.c
==
--- stable/10/sys/amd64/amd64/elf_machdep.c Sat Jan 16 07:46:25 2016
(r294135)
+++ stable/10/sys/amd64/amd64/elf_machdep.c Sat Jan 16 07:56:49 2016
(r294136)
@@ -83,6 +83,7 @@ struct sysentvec elf64_freebsd_sysvec = 
.sv_shared_page_len = PAGE_SIZE,
.sv_schedtail   = NULL,
.sv_thread_detach = NULL,
+   .sv_trap= NULL,
 };
 INIT_SYSENTVEC(elf64_sysvec, _freebsd_sysvec);
 

Modified: stable/10/sys/amd64/amd64/trap.c
==
--- stable/10/sys/amd64/amd64/trap.cSat Jan 16 07:46:25 2016
(r294135)
+++ stable/10/sys/amd64/amd64/trap.cSat Jan 16 07:56:49 2016
(r294136)
@@ -327,6 +327,13 @@ trap(struct trapframe *frame)
break;
 
case T_PAGEFLT: /* page fault */
+   /*
+* Emulator can take care about this trap?
+*/
+   if (*p->p_sysent->sv_trap != NULL &&
+   (*p->p_sysent->sv_trap)(td) == 0)
+   goto userout;
+
addr = frame->tf_addr;
i = trap_pfault(frame, TRUE);
if (i == -1)

Modified: stable/10/sys/amd64/linux/linux_sysvec.c
==
--- stable/10/sys/amd64/linux/linux_sysvec.cSat Jan 16 07:46:25 2016
(r294135)
+++ stable/10/sys/amd64/linux/linux_sysvec.cSat Jan 16 07:56:49 2016
(r294136)
@@ -129,6 +129,7 @@ static void linux_set_syscall_retval(str
 static int linux_fetch_syscall_args(struct thread *td, struct syscall_args 
*sa);
 static voidlinux_exec_setregs(struct thread *td, struct image_params *imgp,
u_long stack);
+static int linux_vsyscall(struct thread *td);
 
 /*
  * Linux syscalls return negative errno's, we do positive and map them
@@ -746,6 +747,53 @@ exec_linux_imgact_try(struct image_param
return(error);
 }
 
+#defineLINUX_VSYSCALL_START(-10UL << 20)
+#defineLINUX_VSYSCALL_SZ   1024
+
+const unsigned long linux_vsyscall_vector[] = {
+   LINUX_SYS_gettimeofday,
+   LINUX_SYS_linux_time,
+   /* getcpu not implemented */
+};
+
+static int
+linux_vsyscall(struct thread *td)
+{
+   struct trapframe *frame;
+   uint64_t retqaddr;
+   int code, traced;
+   int error; 
+
+   frame = td->td_frame;
+
+   /* Check %rip for vsyscall area */
+   if (__predict_true(frame->tf_rip < LINUX_VSYSCALL_START))
+   return (EINVAL);
+   if ((frame->tf_rip & (LINUX_VSYSCALL_SZ - 1)) != 0)
+   return (EINVAL);
+   code = (frame->tf_rip - LINUX_VSYSCALL_START) / LINUX_VSYSCALL_SZ;
+   if (code >= nitems(linux_vsyscall_vector))
+   return (EINVAL);
+
+   /*
+* vsyscall called as callq *(%rax), so we must
+* use return address from %rsp and also fixup %rsp
+*/
+   error = copyin((void *)frame->tf_rsp, , sizeof(retqaddr));
+   if (error)
+   return (error);
+
+   frame->tf_rip = retqaddr;
+   frame->tf_rax = linux_vsyscall_vector[code];
+   frame->tf_rsp += 8;
+
+   traced = (frame->tf_flags & PSL_T);
+
+   amd64_syscall(td, traced);
+
+   return (0);
+}
+
 struct sysentvec elf_linux_sysvec = {
.sv_size= LINUX_SYS_MAXSYSCALL,
.sv_table   = linux_sysent,
@@ -781,7 +829,8 @@ struct sysentvec elf_linux_sysvec = {
.sv_shared_page_base = SHAREDPAGE,
.sv_shared_page_len = PAGE_SIZE,
.sv_schedtail   = linux_schedtail,
-   .sv_thread_detach = 

svn commit: r293645 - stable/10

2016-01-10 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jan 10 21:40:31 2016
New Revision: 293645
URL: https://svnweb.freebsd.org/changeset/base/293645

Log:
  Record only mergeinfo for r283371, r283376, r283380, r283393, r283395,
  r283397, r283400, r283402, r283405, r283425, r283429, r283442, r283445,
  r283452, r283466, r283468, r283482, r283486, r283489, r283493.
  
  regen syscall tables.

Modified:
Directory Properties:
  stable/10/   (props changed)
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293488 - in stable/10/sys: amd64/linux32 i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:48:23 2016
New Revision: 293488
URL: https://svnweb.freebsd.org/changeset/base/293488

Log:
  Regen fro r293487.

Modified:
  stable/10/sys/amd64/linux32/linux32_proto.h
  stable/10/sys/amd64/linux32/linux32_syscall.h
  stable/10/sys/amd64/linux32/linux32_syscalls.c
  stable/10/sys/amd64/linux32/linux32_sysent.c
  stable/10/sys/amd64/linux32/linux32_systrace_args.c
  stable/10/sys/i386/linux/linux_proto.h
  stable/10/sys/i386/linux/linux_syscall.h
  stable/10/sys/i386/linux/linux_syscalls.c
  stable/10/sys/i386/linux/linux_sysent.c
  stable/10/sys/i386/linux/linux_systrace_args.c

Modified: stable/10/sys/amd64/linux32/linux32_proto.h
==
--- stable/10/sys/amd64/linux32/linux32_proto.h Sat Jan  9 14:47:08 2016
(r293487)
+++ stable/10/sys/amd64/linux32/linux32_proto.h Sat Jan  9 14:48:23 2016
(r293488)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293478 
2016-01-09 14:33:10Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293487 
2016-01-09 14:47:08Z dchagin 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -478,6 +478,14 @@ struct linux_fdatasync_args {
 struct linux_sysctl_args {
char args_l_[PADL_(struct l___sysctl_args *)]; struct l___sysctl_args * 
args; char args_r_[PADR_(struct l___sysctl_args *)];
 };
+struct linux_sched_setparam_args {
+   char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
+   char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * 
param; char param_r_[PADR_(struct l_sched_param *)];
+};
+struct linux_sched_getparam_args {
+   char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
+   char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * 
param; char param_r_[PADR_(struct l_sched_param *)];
+};
 struct linux_sched_setscheduler_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
char policy_l_[PADL_(l_int)]; l_int policy; char 
policy_r_[PADR_(l_int)];
@@ -1220,6 +1228,8 @@ int   linux_writev(struct thread *, struct
 intlinux_getsid(struct thread *, struct linux_getsid_args *);
 intlinux_fdatasync(struct thread *, struct linux_fdatasync_args *);
 intlinux_sysctl(struct thread *, struct linux_sysctl_args *);
+intlinux_sched_setparam(struct thread *, struct linux_sched_setparam_args 
*);
+intlinux_sched_getparam(struct thread *, struct linux_sched_getparam_args 
*);
 intlinux_sched_setscheduler(struct thread *, struct 
linux_sched_setscheduler_args *);
 intlinux_sched_getscheduler(struct thread *, struct 
linux_sched_getscheduler_args *);
 intlinux_sched_get_priority_max(struct thread *, struct 
linux_sched_get_priority_max_args *);
@@ -1523,6 +1533,8 @@ int   linux_process_vm_writev(struct threa
 #defineLINUX_SYS_AUE_linux_getsid  AUE_GETSID
 #defineLINUX_SYS_AUE_linux_fdatasync   AUE_NULL
 #defineLINUX_SYS_AUE_linux_sysctl  AUE_SYSCTL
+#defineLINUX_SYS_AUE_linux_sched_setparam  AUE_SCHED_SETPARAM
+#defineLINUX_SYS_AUE_linux_sched_getparam  AUE_SCHED_GETPARAM
 #defineLINUX_SYS_AUE_linux_sched_setscheduler  AUE_SCHED_SETSCHEDULER
 #defineLINUX_SYS_AUE_linux_sched_getscheduler  AUE_SCHED_GETSCHEDULER
 #defineLINUX_SYS_AUE_linux_sched_get_priority_max  
AUE_SCHED_GET_PRIORITY_MAX

Modified: stable/10/sys/amd64/linux32/linux32_syscall.h
==
--- stable/10/sys/amd64/linux32/linux32_syscall.h   Sat Jan  9 14:47:08 
2016(r293487)
+++ stable/10/sys/amd64/linux32/linux32_syscall.h   Sat Jan  9 14:48:23 
2016(r293488)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293478 
2016-01-09 14:33:10Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293487 
2016-01-09 14:47:08Z dchagin 
  */
 
 #defineLINUX_SYS_linux_exit1
@@ -143,8 +143,8 @@
 #defineLINUX_SYS_munlock   151
 #defineLINUX_SYS_mlockall  152
 #defineLINUX_SYS_munlockall153
-#defineLINUX_SYS_sched_setparam154
-#defineLINUX_SYS_sched_getparam155
+#defineLINUX_SYS_linux_sched_setparam  154
+#defineLINUX_SYS_linux_sched_getparam  155
 #defineLINUX_SYS_linux_sched_setscheduler  156
 #defineLINUX_SYS_linux_sched_getscheduler  157
 #defineLINUX_SYS_sched_yield   158

Modified: stable/10/sys/amd64/linux32/linux32_syscalls.c
==
--- stable/10/sys/amd64/linux32/linux32_syscalls.c  Sat Jan  9 14:47:08 

svn commit: r293496 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:19:43 2016
New Revision: 293496
URL: https://svnweb.freebsd.org/changeset/base/293496

Log:
  MFC r283386:
  
  Introduce LINUX_VERSION_STR, LINUX_VERSION_CODE macro for use instead
  of harcoded pr_osrelease, pr_osrel values. This will be used later in
  the VDSO.

Modified:
  stable/10/sys/compat/linux/linux_mib.c
  stable/10/sys/compat/linux/linux_mib.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_mib.c
==
--- stable/10/sys/compat/linux/linux_mib.c  Sat Jan  9 15:18:36 2016
(r293495)
+++ stable/10/sys/compat/linux/linux_mib.c  Sat Jan  9 15:19:43 2016
(r293496)
@@ -130,9 +130,9 @@ struct linux_prison {
 
 static struct linux_prison lprison0 = {
.pr_osname ="Linux",
-   .pr_osrelease = "2.6.18",
+   .pr_osrelease = LINUX_VERSION_STR,
.pr_oss_version =   0x030600,
-   .pr_osrel = 2006018
+   .pr_osrel = LINUX_VERSION_CODE
 };
 
 static unsigned linux_osd_jail_slot;

Modified: stable/10/sys/compat/linux/linux_mib.h
==
--- stable/10/sys/compat/linux/linux_mib.h  Sat Jan  9 15:18:36 2016
(r293495)
+++ stable/10/sys/compat/linux/linux_mib.h  Sat Jan  9 15:19:43 2016
(r293496)
@@ -42,8 +42,19 @@ int  linux_get_oss_version(struct thread 
 
 intlinux_kernver(struct thread *td);
 
-#defineLINUX_KERNVER_2004000   2004000
-#defineLINUX_KERNVER_2006000   2006000
+#defineLINUX_KVERSION  2
+#defineLINUX_KPATCHLEVEL   6
+#defineLINUX_KSUBLEVEL 18
+
+#defineLINUX_KERNVER(a,b,c)(((a) << 16) + ((b) << 8) + (c))
+#defineLINUX_VERSION_CODE  LINUX_KERNVER(LINUX_KVERSION,   
\
+   LINUX_KPATCHLEVEL, LINUX_KSUBLEVEL)
+#defineLINUX_KERNVERSTR(x) #x
+#defineLINUX_XKERNVERSTR(x)LINUX_KERNVERSTR(x)
+#defineLINUX_VERSION_STR   
LINUX_XKERNVERSTR(LINUX_KVERSION.LINUX_KPATCHLEVEL.LINUX_KSUBLEVEL)
+
+#defineLINUX_KERNVER_2004000   LINUX_KERNVER(2,4,0)
+#defineLINUX_KERNVER_2006000   LINUX_KERNVER(2,6,0)
 
 #definelinux_use26(t)  (linux_kernver(t) >= 
LINUX_KERNVER_2006000)
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293511 - in stable/10/sys: amd64/linux32 i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:38:16 2016
New Revision: 293511
URL: https://svnweb.freebsd.org/changeset/base/293511

Log:
  Regen for r293510.

Modified:
  stable/10/sys/amd64/linux32/linux32_proto.h
  stable/10/sys/amd64/linux32/linux32_syscall.h
  stable/10/sys/amd64/linux32/linux32_syscalls.c
  stable/10/sys/amd64/linux32/linux32_sysent.c
  stable/10/sys/amd64/linux32/linux32_systrace_args.c
  stable/10/sys/i386/linux/linux_proto.h
  stable/10/sys/i386/linux/linux_syscall.h
  stable/10/sys/i386/linux/linux_syscalls.c
  stable/10/sys/i386/linux/linux_sysent.c
  stable/10/sys/i386/linux/linux_systrace_args.c

Modified: stable/10/sys/amd64/linux32/linux32_proto.h
==
--- stable/10/sys/amd64/linux32/linux32_proto.h Sat Jan  9 15:37:10 2016
(r293510)
+++ stable/10/sys/amd64/linux32/linux32_proto.h Sat Jan  9 15:38:16 2016
(r293511)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293508 
2016-01-09 15:34:54Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293510 
2016-01-09 15:37:10Z dchagin 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -1097,7 +1097,10 @@ struct linux_fanotify_mark_args {
register_t dummy;
 };
 struct linux_prlimit64_args {
-   register_t dummy;
+   char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
+   char resource_l_[PADL_(l_uint)]; l_uint resource; char 
resource_r_[PADR_(l_uint)];
+   char new_l_[PADL_(struct rlimit *)]; struct rlimit * new; char 
new_r_[PADR_(struct rlimit *)];
+   char old_l_[PADL_(struct rlimit *)]; struct rlimit * old; char 
old_r_[PADR_(struct rlimit *)];
 };
 struct linux_name_to_handle_at_args {
register_t dummy;

Modified: stable/10/sys/amd64/linux32/linux32_syscall.h
==
--- stable/10/sys/amd64/linux32/linux32_syscall.h   Sat Jan  9 15:37:10 
2016(r293510)
+++ stable/10/sys/amd64/linux32/linux32_syscall.h   Sat Jan  9 15:38:16 
2016(r293511)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293508 
2016-01-09 15:34:54Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293510 
2016-01-09 15:37:10Z dchagin 
  */
 
 #defineLINUX_SYS_linux_exit1

Modified: stable/10/sys/amd64/linux32/linux32_syscalls.c
==
--- stable/10/sys/amd64/linux32/linux32_syscalls.c  Sat Jan  9 15:37:10 
2016(r293510)
+++ stable/10/sys/amd64/linux32/linux32_syscalls.c  Sat Jan  9 15:38:16 
2016(r293511)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293508 
2016-01-09 15:34:54Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293510 
2016-01-09 15:37:10Z dchagin 
  */
 
 const char *linux_syscallnames[] = {

Modified: stable/10/sys/amd64/linux32/linux32_sysent.c
==
--- stable/10/sys/amd64/linux32/linux32_sysent.cSat Jan  9 15:37:10 
2016(r293510)
+++ stable/10/sys/amd64/linux32/linux32_sysent.cSat Jan  9 15:38:16 
2016(r293511)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293508 
2016-01-09 15:34:54Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293510 
2016-01-09 15:37:10Z dchagin 
  */
 
 #include "opt_compat.h"
@@ -359,7 +359,7 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)linux_recvmmsg, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC }, /* 337 = linux_recvmmsg */
{ 0, (sy_call_t *)linux_fanotify_init, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 338 = linux_fanotify_init */
{ 0, (sy_call_t *)linux_fanotify_mark, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 339 = linux_fanotify_mark */
-   { 0, (sy_call_t *)linux_prlimit64, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 340 = linux_prlimit64 */
+   { AS(linux_prlimit64_args), (sy_call_t *)linux_prlimit64, AUE_NULL, 
NULL, 0, 0, 0, SY_THR_STATIC }, /* 340 = linux_prlimit64 */
{ 0, (sy_call_t *)linux_name_to_handle_at, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 341 = linux_name_to_handle_at */
{ 0, (sy_call_t *)linux_open_by_handle_at, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 342 = linux_open_by_handle_at */
{ 0, (sy_call_t *)linux_clock_adjtime, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 343 = linux_clock_adjtime */


svn commit: r293510 - in stable/10/sys: amd64/linux32 compat/linux i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:37:10 2016
New Revision: 293510
URL: https://svnweb.freebsd.org/changeset/base/293510

Log:
  MFC r283401:
  
  Implement prlimit64() system call.

Modified:
  stable/10/sys/amd64/linux32/linux32_dummy.c
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/compat/linux/linux_misc.h
  stable/10/sys/i386/linux/linux_dummy.c
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/linux32_dummy.c
==
--- stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan  9 15:35:57 2016
(r293509)
+++ stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan  9 15:37:10 2016
(r293510)
@@ -134,8 +134,6 @@ DUMMY(perf_event_open);
 DUMMY(recvmmsg);
 DUMMY(fanotify_init);
 DUMMY(fanotify_mark);
-/* linux 2.6.36: */
-DUMMY(prlimit64);
 /* later: */
 DUMMY(name_to_handle_at);
 DUMMY(open_by_handle_at);

Modified: stable/10/sys/amd64/linux32/syscalls.master
==
--- stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 15:35:57 2016
(r293509)
+++ stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 15:37:10 2016
(r293510)
@@ -554,7 +554,10 @@
 338AUE_NULLSTD { int linux_fanotify_init(void); }
 339AUE_NULLSTD { int linux_fanotify_mark(void); }
 ; linux 2.6.36:
-340AUE_NULLSTD { int linux_prlimit64(void); }
+340AUE_NULLSTD { int linux_prlimit64(l_pid_t pid,  \
+   l_uint resource,\
+   struct rlimit *new, \
+   struct rlimit *old); }
 ; later:
 341AUE_NULLSTD { int linux_name_to_handle_at(void); }
 342AUE_NULLSTD { int linux_open_by_handle_at(void); }

Modified: stable/10/sys/compat/linux/linux_misc.c
==
--- stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 15:35:57 2016
(r293509)
+++ stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 15:37:10 2016
(r293510)
@@ -2032,6 +2032,79 @@ linux_sched_setaffinity(struct thread *t
return (sys_cpuset_setaffinity(td, ));
 }
 
+struct linux_rlimit64 {
+   uint64_trlim_cur;
+   uint64_trlim_max;
+};
+
+int
+linux_prlimit64(struct thread *td, struct linux_prlimit64_args *args)
+{
+   struct rlimit rlim, nrlim;
+   struct linux_rlimit64 lrlim;
+   struct proc *p;
+   u_int which;
+   int flags;
+   int error;
+
+#ifdef DEBUG
+   if (ldebug(prlimit64))
+   printf(ARGS(prlimit64, "%d, %d, %p, %p"), args->pid,
+   args->resource, (void *)args->new, (void *)args->old);
+#endif
+
+   if (args->resource >= LINUX_RLIM_NLIMITS)
+   return (EINVAL);
+
+   which = linux_to_bsd_resource[args->resource];
+   if (which == -1)
+   return (EINVAL);
+
+   if (args->new != NULL) {
+   /*
+* Note. Unlike FreeBSD where rlim is signed 64-bit Linux
+* rlim is unsigned 64-bit. FreeBSD treats negative limits
+* as INFINITY so we do not need a conversion even.
+*/
+   error = copyin(args->new, , sizeof(nrlim));
+   if (error != 0)
+   return (error);
+   }
+
+   flags = PGET_HOLD | PGET_NOTWEXIT;
+   if (args->new != NULL)
+   flags |= PGET_CANDEBUG;
+   else
+   flags |= PGET_CANSEE;
+   error = pget(args->pid, flags, );
+   if (error != 0)
+   return (error);
+
+   if (args->old != NULL) {
+   PROC_LOCK(p);
+   lim_rlimit(p, which, );
+   PROC_UNLOCK(p);
+   if (rlim.rlim_cur == RLIM_INFINITY)
+   lrlim.rlim_cur = LINUX_RLIM_INFINITY;
+   else
+   lrlim.rlim_cur = rlim.rlim_cur;
+   if (rlim.rlim_max == RLIM_INFINITY)
+   lrlim.rlim_max = LINUX_RLIM_INFINITY;
+   else
+   lrlim.rlim_max = rlim.rlim_max;
+   error = copyout(, args->old, sizeof(lrlim));
+   if (error != 0)
+   goto out;
+   }
+
+   if (args->new != NULL)
+   error = kern_proc_setrlimit(td, p, which, );
+
+ out:
+   PRELE(p);
+   return (error);
+}
+
 int
 linux_sched_rr_get_interval(struct thread *td,
 struct linux_sched_rr_get_interval_args *uap)

Modified: stable/10/sys/compat/linux/linux_misc.h
==
--- stable/10/sys/compat/linux/linux_misc.h Sat Jan  9 15:35:57 2016  

svn commit: r293483 - stable/10/sys/i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:41:58 2016
New Revision: 293483
URL: https://svnweb.freebsd.org/changeset/base/293483

Log:
  MFC r283375:
  
  In preparation for switching linuxulator to the use the native 1:1
  threads use MI linux_sched_rr_get_interval() in i386.

Modified:
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/i386/linux/syscalls.master
==
--- stable/10/sys/i386/linux/syscalls.masterSat Jan  9 14:40:38 2016
(r293482)
+++ stable/10/sys/i386/linux/syscalls.masterSat Jan  9 14:41:58 2016
(r293483)
@@ -283,8 +283,8 @@
l_int policy); }
 160AUE_SCHED_GET_PRIORITY_MIN  STD { int linux_sched_get_priority_min( 
\
l_int policy); }
-161AUE_SCHED_RR_GET_INTERVAL   NOPROTO { int 
sched_rr_get_interval(l_pid_t pid, \
-   struct l_timespec *interval); }
+161AUE_SCHED_RR_GET_INTERVAL   STD { int 
linux_sched_rr_get_interval( \
+   l_pid_t pid, struct l_timespec *interval); }
 162AUE_NULLSTD { int linux_nanosleep( \
const struct l_timespec *rqtp, \
struct l_timespec *rmtp); }
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293490 - in stable/10/sys: amd64/amd64 arm/arm compat/ia32 compat/svr4 i386/i386 i386/ibcs2 kern mips/mips powerpc/powerpc sparc64/sparc64 sys

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:53:08 2016
New Revision: 293490
URL: https://svnweb.freebsd.org/changeset/base/293490

Log:
  MFC r283382:
  
  In preparation for switching linuxulator to the use the native 1:1
  threads add a hook for cleaning thread resources before the thread die.

Modified:
  stable/10/sys/amd64/amd64/elf_machdep.c
  stable/10/sys/arm/arm/elf_machdep.c
  stable/10/sys/compat/ia32/ia32_sysvec.c
  stable/10/sys/compat/svr4/svr4_sysvec.c
  stable/10/sys/i386/i386/elf_machdep.c
  stable/10/sys/i386/ibcs2/ibcs2_sysvec.c
  stable/10/sys/kern/imgact_aout.c
  stable/10/sys/kern/init_main.c
  stable/10/sys/kern/kern_thread.c
  stable/10/sys/mips/mips/elf_machdep.c
  stable/10/sys/mips/mips/freebsd32_machdep.c
  stable/10/sys/powerpc/powerpc/elf32_machdep.c
  stable/10/sys/powerpc/powerpc/elf64_machdep.c
  stable/10/sys/sparc64/sparc64/elf_machdep.c
  stable/10/sys/sys/sysent.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/elf_machdep.c
==
--- stable/10/sys/amd64/amd64/elf_machdep.c Sat Jan  9 14:51:50 2016
(r293489)
+++ stable/10/sys/amd64/amd64/elf_machdep.c Sat Jan  9 14:53:08 2016
(r293490)
@@ -82,6 +82,7 @@ struct sysentvec elf64_freebsd_sysvec = 
.sv_shared_page_base = SHAREDPAGE,
.sv_shared_page_len = PAGE_SIZE,
.sv_schedtail   = NULL,
+   .sv_thread_detach = NULL,
 };
 INIT_SYSENTVEC(elf64_sysvec, _freebsd_sysvec);
 

Modified: stable/10/sys/arm/arm/elf_machdep.c
==
--- stable/10/sys/arm/arm/elf_machdep.c Sat Jan  9 14:51:50 2016
(r293489)
+++ stable/10/sys/arm/arm/elf_machdep.c Sat Jan  9 14:53:08 2016
(r293490)
@@ -79,6 +79,7 @@ struct sysentvec elf32_freebsd_sysvec = 
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
.sv_schedtail   = NULL,
+   .sv_thread_detach = NULL,
 };
 
 static Elf32_Brandinfo freebsd_brand_info = {

Modified: stable/10/sys/compat/ia32/ia32_sysvec.c
==
--- stable/10/sys/compat/ia32/ia32_sysvec.c Sat Jan  9 14:51:50 2016
(r293489)
+++ stable/10/sys/compat/ia32/ia32_sysvec.c Sat Jan  9 14:53:08 2016
(r293490)
@@ -139,6 +139,7 @@ struct sysentvec ia32_freebsd_sysvec = {
.sv_shared_page_base = FREEBSD32_SHAREDPAGE,
.sv_shared_page_len = PAGE_SIZE,
.sv_schedtail   = NULL,
+   .sv_thread_detach = NULL,
 };
 INIT_SYSENTVEC(elf_ia32_sysvec, _freebsd_sysvec);
 

Modified: stable/10/sys/compat/svr4/svr4_sysvec.c
==
--- stable/10/sys/compat/svr4/svr4_sysvec.c Sat Jan  9 14:51:50 2016
(r293489)
+++ stable/10/sys/compat/svr4/svr4_sysvec.c Sat Jan  9 14:53:08 2016
(r293490)
@@ -196,6 +196,7 @@ struct sysentvec svr4_sysvec = {
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = NULL,
.sv_schedtail   = NULL,
+   .sv_thread_detach = NULL,
 };
 
 const char  svr4_emul_path[] = "/compat/svr4";

Modified: stable/10/sys/i386/i386/elf_machdep.c
==
--- stable/10/sys/i386/i386/elf_machdep.c   Sat Jan  9 14:51:50 2016
(r293489)
+++ stable/10/sys/i386/i386/elf_machdep.c   Sat Jan  9 14:53:08 2016
(r293490)
@@ -88,6 +88,7 @@ struct sysentvec elf32_freebsd_sysvec = 
.sv_shared_page_base = SHAREDPAGE,
.sv_shared_page_len = PAGE_SIZE,
.sv_schedtail   = NULL,
+   .sv_thread_detach = NULL,
 };
 INIT_SYSENTVEC(elf32_sysvec, _freebsd_sysvec);
 

Modified: stable/10/sys/i386/ibcs2/ibcs2_sysvec.c
==
--- stable/10/sys/i386/ibcs2/ibcs2_sysvec.c Sat Jan  9 14:51:50 2016
(r293489)
+++ stable/10/sys/i386/ibcs2/ibcs2_sysvec.c Sat Jan  9 14:53:08 2016
(r293490)
@@ -89,6 +89,7 @@ struct sysentvec ibcs2_svr3_sysvec = {
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = NULL,
.sv_schedtail   = NULL,
+   .sv_thread_detach = NULL,
 };
 
 static int

Modified: stable/10/sys/kern/imgact_aout.c
==
--- stable/10/sys/kern/imgact_aout.cSat Jan  9 14:51:50 2016
(r293489)
+++ stable/10/sys/kern/imgact_aout.cSat Jan  9 14:53:08 2016
(r293490)
@@ -99,6 +99,7 @@ struct sysentvec aout_sysvec = {
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
.sv_schedtail   = NULL,
+   .sv_thread_detach = NULL,
 };
 
 #elif defined(__amd64__)

Modified: stable/10/sys/kern/init_main.c

svn commit: r293489 - stable/10/sys/sys

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:51:50 2016
New Revision: 293489
URL: https://svnweb.freebsd.org/changeset/base/293489

Log:
  MFC r283381:
  
  In preparation for switching linuxulator to the use the native 1:1
  threads add per thread emulator state data.

Modified:
  stable/10/sys/sys/proc.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/sys/proc.h
==
--- stable/10/sys/sys/proc.hSat Jan  9 14:48:23 2016(r293488)
+++ stable/10/sys/sys/proc.hSat Jan  9 14:51:50 2016(r293489)
@@ -323,6 +323,7 @@ struct thread {
void*td_su; /* (k) FFS SU private */
u_int   td_dbg_sc_code; /* (c) Syscall code to debugger. */
u_int   td_dbg_sc_narg; /* (c) Syscall arg count to debugger.*/
+   void*td_emuldata;   /* Emulator state data */
 };
 
 struct mtx *thread_lock_block(struct thread *);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293502 - stable/10/sys/i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:26:20 2016
New Revision: 293502
URL: https://svnweb.freebsd.org/changeset/base/293502

Log:
  Regen for r293501.

Modified:
  stable/10/sys/i386/linux/linux_proto.h
  stable/10/sys/i386/linux/linux_syscall.h
  stable/10/sys/i386/linux/linux_syscalls.c
  stable/10/sys/i386/linux/linux_sysent.c
  stable/10/sys/i386/linux/linux_systrace_args.c

Modified: stable/10/sys/i386/linux/linux_proto.h
==
--- stable/10/sys/i386/linux/linux_proto.h  Sat Jan  9 15:25:22 2016
(r293501)
+++ stable/10/sys/i386/linux/linux_proto.h  Sat Jan  9 15:26:20 2016
(r293502)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293487 
2016-01-09 14:47:08Z dchagin 
+ * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293501 
2016-01-09 15:25:22Z dchagin 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -360,7 +360,7 @@ struct linux_wait4_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
char status_l_[PADL_(l_int *)]; l_int * status; char 
status_r_[PADR_(l_int *)];
char options_l_[PADL_(l_int)]; l_int options; char 
options_r_[PADR_(l_int)];
-   char rusage_l_[PADL_(struct l_rusage *)]; struct l_rusage * rusage; 
char rusage_r_[PADR_(struct l_rusage *)];
+   char rusage_l_[PADL_(void *)]; void * rusage; char rusage_r_[PADR_(void 
*)];
 };
 struct linux_swapoff_args {
register_t dummy;

Modified: stable/10/sys/i386/linux/linux_syscall.h
==
--- stable/10/sys/i386/linux/linux_syscall.hSat Jan  9 15:25:22 2016
(r293501)
+++ stable/10/sys/i386/linux/linux_syscall.hSat Jan  9 15:26:20 2016
(r293502)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293487 
2016-01-09 14:47:08Z dchagin 
+ * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293501 
2016-01-09 15:25:22Z dchagin 
  */
 
 #defineLINUX_SYS_linux_exit1

Modified: stable/10/sys/i386/linux/linux_syscalls.c
==
--- stable/10/sys/i386/linux/linux_syscalls.c   Sat Jan  9 15:25:22 2016
(r293501)
+++ stable/10/sys/i386/linux/linux_syscalls.c   Sat Jan  9 15:26:20 2016
(r293502)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293487 
2016-01-09 14:47:08Z dchagin 
+ * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293501 
2016-01-09 15:25:22Z dchagin 
  */
 
 const char *linux_syscallnames[] = {

Modified: stable/10/sys/i386/linux/linux_sysent.c
==
--- stable/10/sys/i386/linux/linux_sysent.c Sat Jan  9 15:25:22 2016
(r293501)
+++ stable/10/sys/i386/linux/linux_sysent.c Sat Jan  9 15:26:20 2016
(r293502)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293487 
2016-01-09 14:47:08Z dchagin 
+ * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 293501 
2016-01-09 15:25:22Z dchagin 
  */
 
 #include 

Modified: stable/10/sys/i386/linux/linux_systrace_args.c
==
--- stable/10/sys/i386/linux/linux_systrace_args.c  Sat Jan  9 15:25:22 
2016(r293501)
+++ stable/10/sys/i386/linux/linux_systrace_args.c  Sat Jan  9 15:26:20 
2016(r293502)
@@ -792,7 +792,7 @@ systrace_args(int sysnum, void *params, 
iarg[0] = p->pid; /* l_pid_t */
uarg[1] = (intptr_t) p->status; /* l_int * */
iarg[2] = p->options; /* l_int */
-   uarg[3] = (intptr_t) p->rusage; /* struct l_rusage * */
+   uarg[3] = (intptr_t) p->rusage; /* void * */
*n_args = 4;
break;
}
@@ -3548,7 +3548,7 @@ systrace_entry_setargdesc(int sysnum, in
p = "l_int";
break;
case 3:
-   p = "struct l_rusage *";
+   p = "void *";
break;
default:
break;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293481 - in stable/10/sys: kern sys

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:38:29 2016
New Revision: 293481
URL: https://svnweb.freebsd.org/changeset/base/293481

Log:
  MFC r283373:
  
  In preparation for switching linuxulator to the use the native 1:1
  threads introduce kern_thr_alloc() which will be used later in the
  linux_clone().

Modified:
  stable/10/sys/kern/kern_thr.c
  stable/10/sys/sys/syscallsubr.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_thr.c
==
--- stable/10/sys/kern/kern_thr.c   Sat Jan  9 14:36:44 2016
(r293480)
+++ stable/10/sys/kern/kern_thr.c   Sat Jan  9 14:38:29 2016
(r293481)
@@ -192,12 +192,6 @@ thread_create(struct thread *td, struct 
 
p = td->td_proc;
 
-   /* Have race condition but it is cheap. */
-   if (p->p_numthreads >= max_threads_per_proc) {
-   ++max_threads_hits;
-   return (EPROCLIM);
-   }
-
if (rtp != NULL) {
switch(rtp->type) {
case RTP_PRIO_REALTIME:
@@ -225,11 +219,9 @@ thread_create(struct thread *td, struct 
 #endif
 
/* Initialize our td */
-   newtd = thread_alloc(0);
-   if (newtd == NULL) {
-   error = ENOMEM;
+   error = kern_thr_alloc(p, 0, );
+   if (error)
goto fail;
-   }
 
cpu_set_upcall(newtd, td);
 
@@ -564,3 +556,20 @@ sys_thr_set_name(struct thread *td, stru
PROC_UNLOCK(p);
return (error);
 }
+
+int
+kern_thr_alloc(struct proc *p, int pages, struct thread **ntd)
+{
+
+   /* Have race condition but it is cheap. */
+   if (p->p_numthreads >= max_threads_per_proc) {
+   ++max_threads_hits;
+   return (EPROCLIM);
+   }
+
+   *ntd = thread_alloc(pages);
+   if (*ntd == NULL)
+   return (ENOMEM);
+
+   return (0);
+}

Modified: stable/10/sys/sys/syscallsubr.h
==
--- stable/10/sys/sys/syscallsubr.h Sat Jan  9 14:36:44 2016
(r293480)
+++ stable/10/sys/sys/syscallsubr.h Sat Jan  9 14:38:29 2016
(r293481)
@@ -246,6 +246,7 @@ int kern_ktimer_settime(struct thread *t
 intkern_ktimer_gettime(struct thread *td, int timer_id,
struct itimerspec *val);
 intkern_ktimer_getoverrun(struct thread *td, int timer_id);
+intkern_thr_alloc(struct proc *, int pages, struct thread **);
 intkern_thr_exit(struct thread *td);
 intkern_thr_new(struct thread *td, struct thr_param *param);
 intkern_thr_suspend(struct thread *td, struct timespec *tsp);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293487 - in stable/10/sys: amd64/linux32 compat/linux i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:47:08 2016
New Revision: 293487
URL: https://svnweb.freebsd.org/changeset/base/293487

Log:
  MFC r283379:
  
  Implement a Linux version of sched_getparam() && sched_setparam().
  Temporarily use the first thread in proc.

Modified:
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/syscalls.master
==
--- stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 14:45:41 2016
(r293486)
+++ stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 14:47:08 2016
(r293487)
@@ -267,10 +267,10 @@
 151AUE_MUNLOCK NOPROTO { int munlock(const void *addr, size_t len); }
 152AUE_MLOCKALLNOPROTO { int mlockall(int how); }
 153AUE_MUNLOCKALL  NOPROTO { int munlockall(void); }
-154AUE_SCHED_SETPARAM  NOPROTO { int sched_setparam(pid_t pid, \
-   const struct sched_param *param); }
-155AUE_SCHED_GETPARAM  NOPROTO { int sched_getparam(pid_t pid, \
-   struct sched_param *param); }
+154AUE_SCHED_SETPARAM  STD { int linux_sched_setparam(l_pid_t pid, 
\
+   struct l_sched_param *param); }
+155AUE_SCHED_GETPARAM  STD { int linux_sched_getparam(l_pid_t pid, 
\
+   struct l_sched_param *param); }
 156AUE_SCHED_SETSCHEDULER  STD { int linux_sched_setscheduler( \
l_pid_t pid, l_int policy, \
struct l_sched_param *param); }

Modified: stable/10/sys/compat/linux/linux_misc.c
==
--- stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 14:45:41 2016
(r293486)
+++ stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 14:47:08 2016
(r293487)
@@ -1871,6 +1871,78 @@ linux_prctl(struct thread *td, struct li
return (error);
 }
 
+int
+linux_sched_setparam(struct thread *td,
+struct linux_sched_setparam_args *uap)
+{
+   struct sched_param sched_param;
+   struct thread *tdt;
+   struct proc *p;
+   int error;
+
+#ifdef DEBUG
+   if (ldebug(sched_setparam))
+   printf(ARGS(sched_setparam, "%d, *"), uap->pid);
+#endif
+
+   error = copyin(uap->param, _param, sizeof(sched_param));
+   if (error)
+   return (error);
+
+   if (uap->pid == 0) {
+   tdt = td;
+   p = tdt->td_proc;
+   PROC_LOCK(p);
+   } else {
+   p = pfind(uap->pid);
+   if (p == NULL)
+   return (ESRCH);
+   /*
+* XXX. Scheduling parameters are in fact per-thread
+* attributes in Linux. Temporarily use the first
+* thread in proc. The same for get_param().
+*/
+   tdt = FIRST_THREAD_IN_PROC(p);
+   }
+
+   error = kern_sched_setparam(td, tdt, _param);
+   PROC_UNLOCK(p);
+   return (error);
+}
+
+int
+linux_sched_getparam(struct thread *td,
+struct linux_sched_getparam_args *uap)
+{
+   struct sched_param sched_param;
+   struct thread *tdt;
+   struct proc *p;
+   int error;
+
+#ifdef DEBUG
+   if (ldebug(sched_getparam))
+   printf(ARGS(sched_getparam, "%d, *"), uap->pid);
+#endif
+
+   if (uap->pid == 0) {
+   tdt = td;
+   p = tdt->td_proc;
+   PROC_LOCK(p);
+   } else {
+   p = pfind(uap->pid);
+   if (p == NULL)
+   return (ESRCH);
+   tdt = FIRST_THREAD_IN_PROC(p);
+   }
+
+   error = kern_sched_getparam(td, tdt, _param);
+   PROC_UNLOCK(p);
+   if (error == 0)
+   error = copyout(_param, uap->param,
+   sizeof(sched_param));
+   return (error);
+}
+
 /*
  * Get affinity of a process.
  */

Modified: stable/10/sys/i386/linux/syscalls.master
==
--- stable/10/sys/i386/linux/syscalls.masterSat Jan  9 14:45:41 2016
(r293486)
+++ stable/10/sys/i386/linux/syscalls.masterSat Jan  9 14:47:08 2016
(r293487)
@@ -269,10 +269,10 @@
 151AUE_MUNLOCK NOPROTO { int munlock(const void *addr, size_t len); }
 152AUE_MLOCKALLNOPROTO { int mlockall(int how); }
 153AUE_MUNLOCKALL  NOPROTO { int munlockall(void); }
-154AUE_SCHED_SETPARAM  NOPROTO { int sched_setparam(pid_t pid, \
-   const struct sched_param *param); }
-155AUE_SCHED_GETPARAM  NOPROTO { int sched_getparam(pid_t pid, \
-   struct sched_param *param); }
+154 

svn commit: r293499 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:22:50 2016
New Revision: 293499
URL: https://svnweb.freebsd.org/changeset/base/293499

Log:
  MFC r283390:
  
  Add a function for converting wait options.

Modified:
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/compat/linux/linux_misc.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_misc.c
==
--- stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 15:21:45 2016
(r293498)
+++ stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 15:22:50 2016
(r293499)
@@ -2006,3 +2006,22 @@ linux_tdfind(struct thread *td, lwpid_t 
 
return (tdt);
 }
+
+void
+linux_to_bsd_waitopts(int options, int *bsdopts)
+{
+
+   if (options & LINUX_WNOHANG)
+   *bsdopts |= WNOHANG;
+   if (options & LINUX_WUNTRACED)
+   *bsdopts |= WUNTRACED;
+   if (options & LINUX_WEXITED)
+   *bsdopts |= WEXITED;
+   if (options & LINUX_WCONTINUED)
+   *bsdopts |= WCONTINUED;
+   if (options & LINUX_WNOWAIT)
+   *bsdopts |= WNOWAIT;
+
+   if (options & __WCLONE)
+   *bsdopts |= WLINUXCLONE;
+}

Modified: stable/10/sys/compat/linux/linux_misc.h
==
--- stable/10/sys/compat/linux/linux_misc.h Sat Jan  9 15:21:45 2016
(r293498)
+++ stable/10/sys/compat/linux/linux_misc.h Sat Jan  9 15:22:50 2016
(r293499)
@@ -111,10 +111,21 @@ struct l_new_utsname {
 
 extern int stclohz;
 
-#define __WCLONE 0x8000
+#defineLINUX_WNOHANG   0x0001
+#defineLINUX_WUNTRACED 0x0002
+#defineLINUX_WSTOPPED  LINUX_WUNTRACED
+#defineLINUX_WEXITED   0x0004
+#defineLINUX_WCONTINUED0x0008
+#defineLINUX_WNOWAIT   0x0100
+
+
+#define__WNOTHREAD 0x2000
+#define__WALL  0x4000
+#define__WCLONE0x8000
 
 int linux_common_wait(struct thread *td, int pid, int *status,
int options, struct rusage *ru);
+void linux_to_bsd_waitopts(int options, int *bsdopts);
 int linux_set_upcall_kse(struct thread *td, register_t stack);
 int linux_set_cloned_tls(struct thread *td, void *desc);
 struct thread  *linux_tdfind(struct thread *, lwpid_t, pid_t);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293512 - in stable/10/sys: amd64/linux32 compat/linux i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:39:41 2016
New Revision: 293512
URL: https://svnweb.freebsd.org/changeset/base/293512

Log:
  MFC r283403:
  
  Implement pselect6() system call.

Modified:
  stable/10/sys/amd64/linux32/linux32_dummy.c
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/i386/linux/linux_dummy.c
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/linux32_dummy.c
==
--- stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan  9 15:38:16 2016
(r293511)
+++ stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan  9 15:39:41 2016
(r293512)
@@ -96,7 +96,6 @@ DUMMY(inotify_add_watch);
 DUMMY(inotify_rm_watch);
 /* linux 2.6.16: */
 DUMMY(migrate_pages);
-DUMMY(pselect6);
 DUMMY(ppoll);
 DUMMY(unshare);
 /* linux 2.6.17: */

Modified: stable/10/sys/amd64/linux32/syscalls.master
==
--- stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 15:38:16 2016
(r293511)
+++ stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 15:39:41 2016
(r293512)
@@ -508,7 +508,9 @@
 306AUE_FCHMODATSTD { int linux_fchmodat(l_int dfd, const char 
*filename, \
l_mode_t mode); }
 307AUE_FACCESSAT   STD { int linux_faccessat(l_int dfd, const char 
*filename, l_int amode, int flag); }
-308AUE_NULLSTD { int linux_pselect6(void); }
+308AUE_SELECT  STD { int linux_pselect6(l_int nfds, l_fd_set 
*readfds, \
+   l_fd_set *writefds, l_fd_set 
*exceptfds,\
+   struct l_timespec *tsp, l_uintptr_t 
*sig); }
 309AUE_NULLSTD { int linux_ppoll(void); }
 310AUE_NULLSTD { int linux_unshare(void); }
 ; linux 2.6.17:

Modified: stable/10/sys/compat/linux/linux_misc.c
==
--- stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 15:38:16 2016
(r293511)
+++ stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 15:39:41 2016
(r293512)
@@ -117,6 +117,12 @@ struct l_sysinfo {
l_uint  mem_unit;
char_f[20-2*sizeof(l_long)-sizeof(l_int)];  /* padding */
 };
+
+struct l_pselect6arg {
+   l_uintptr_t ss;
+   l_size_tss_len;
+};
+
 int
 linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args)
 {
@@ -2106,6 +2112,84 @@ linux_prlimit64(struct thread *td, struc
 }
 
 int
+linux_pselect6(struct thread *td, struct linux_pselect6_args *args)
+{
+   struct timeval utv, tv0, tv1, *tvp;
+   struct l_pselect6arg lpse6;
+   struct l_timespec lts;
+   struct timespec uts;
+   l_sigset_t l_ss;
+   sigset_t *ssp;
+   sigset_t ss;
+   int error;
+
+   ssp = NULL;
+   if (args->sig != NULL) {
+   error = copyin(args->sig, , sizeof(lpse6));
+   if (error != 0)
+   return (error);
+   if (lpse6.ss_len != sizeof(l_ss))
+   return (EINVAL);
+   if (lpse6.ss != 0) {
+   error = copyin(PTRIN(lpse6.ss), _ss,
+   sizeof(l_ss));
+   if (error != 0)
+   return (error);
+   linux_to_bsd_sigset(_ss, );
+   ssp = 
+   }
+   }
+
+   /*
+* Currently glibc changes nanosecond number to microsecond.
+* This mean losing precision but for now it is hardly seen.
+*/
+   if (args->tsp != NULL) {
+   error = copyin(args->tsp, , sizeof(lts));
+   if (error != 0)
+   return (error);
+   uts.tv_sec = lts.tv_sec;
+   uts.tv_nsec = lts.tv_nsec;
+
+   TIMESPEC_TO_TIMEVAL(, );
+   if (itimerfix())
+   return (EINVAL);
+
+   microtime();
+   tvp = 
+   } else
+   tvp = NULL;
+
+   error = kern_pselect(td, args->nfds, args->readfds, args->writefds,
+   args->exceptfds, tvp, ssp, sizeof(l_int) * 8);
+
+   if (error == 0 && args->tsp != NULL) {
+   if (td->td_retval[0] != 0) {
+   /*
+* Compute how much time was left of the timeout,
+* by subtracting the current time and the time
+* before we started the call, and subtracting
+* that result from the user-supplied value.
+*/
+
+   microtime();
+   timevalsub(, );
+   timevalsub(, );
+   if 

svn commit: r293478 - in stable/10/sys: amd64/linux32 compat/linux i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:33:10 2016
New Revision: 293478
URL: https://svnweb.freebsd.org/changeset/base/293478

Log:
  MFC r283370:
  
  In preparation for switching linuxulator to the use the native 1:1
  threads introduce linux_exit() stub instead of sys_exit() call
  (which terminates process).
  In the new linuxulator exit() system call terminates the calling
  thread (not a whole process).

Modified:
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/compat/linux/linux_fork.c
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/syscalls.master
==
--- stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 14:31:03 2016
(r293477)
+++ stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 14:33:10 2016
(r293478)
@@ -38,8 +38,7 @@
 ; #ifdef's, etc. may be included, and are copied to the output files.
 
 0  AUE_NULLUNIMPL  setup
-1  AUE_EXITNOPROTO { void sys_exit(int rval); } exit \
-   sys_exit_args void
+1  AUE_EXITSTD { void linux_exit(int rval); }
 2  AUE_FORKSTD { int linux_fork(void); }
 3  AUE_NULLNOPROTO { int read(int fd, char *buf, \
u_int nbyte); }

Modified: stable/10/sys/compat/linux/linux_fork.c
==
--- stable/10/sys/compat/linux/linux_fork.c Sat Jan  9 14:31:03 2016
(r293477)
+++ stable/10/sys/compat/linux/linux_fork.c Sat Jan  9 14:33:10 2016
(r293478)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #ifdef COMPAT_LINUX32
 #include 
@@ -276,3 +277,16 @@ linux_clone(struct thread *td, struct li
 
return (0);
 }
+
+int
+linux_exit(struct thread *td, struct linux_exit_args *args)
+{
+
+#ifdef DEBUG
+   if (ldebug(exit))
+   printf(ARGS(exit, "%d"), args->rval);
+#endif
+
+   exit1(td, W_EXITCODE(args->rval, 0));
+   /* NOTREACHED */
+}

Modified: stable/10/sys/i386/linux/syscalls.master
==
--- stable/10/sys/i386/linux/syscalls.masterSat Jan  9 14:31:03 2016
(r293477)
+++ stable/10/sys/i386/linux/syscalls.masterSat Jan  9 14:33:10 2016
(r293478)
@@ -37,8 +37,7 @@
 ; #ifdef's, etc. may be included, and are copied to the output files.
 
 0  AUE_NULLUNIMPL  setup
-1  AUE_EXITNOPROTO { void sys_exit(int rval); } exit \
-   sys_exit_args void
+1  AUE_EXITSTD { void linux_exit(int rval); }
 2  AUE_FORKSTD { int linux_fork(void); }
 3  AUE_NULLNOPROTO { int read(int fd, char *buf, \
u_int nbyte); }
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293479 - in stable/10/sys: amd64/linux32 i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:34:29 2016
New Revision: 293479
URL: https://svnweb.freebsd.org/changeset/base/293479

Log:
  Regen for r293478.

Modified:
  stable/10/sys/amd64/linux32/linux32_proto.h
  stable/10/sys/amd64/linux32/linux32_syscall.h
  stable/10/sys/amd64/linux32/linux32_syscalls.c
  stable/10/sys/amd64/linux32/linux32_sysent.c
  stable/10/sys/amd64/linux32/linux32_systrace_args.c
  stable/10/sys/i386/linux/linux_proto.h
  stable/10/sys/i386/linux/linux_syscall.h
  stable/10/sys/i386/linux/linux_syscalls.c
  stable/10/sys/i386/linux/linux_sysent.c
  stable/10/sys/i386/linux/linux_systrace_args.c

Modified: stable/10/sys/amd64/linux32/linux32_proto.h
==
--- stable/10/sys/amd64/linux32/linux32_proto.h Sat Jan  9 14:33:10 2016
(r293478)
+++ stable/10/sys/amd64/linux32/linux32_proto.h Sat Jan  9 14:34:29 2016
(r293479)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 276810 
2015-01-08 06:23:11Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293478 
2016-01-09 14:33:10Z dchagin 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -35,6 +35,9 @@ struct thread;
 #endif
 
 #definenosys   linux_nosys
+struct linux_exit_args {
+   char rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)];
+};
 struct linux_fork_args {
register_t dummy;
 };
@@ -1105,6 +1108,7 @@ struct linux_process_vm_writev_args {
register_t dummy;
 };
 #definenosys   linux_nosys
+intlinux_exit(struct thread *, struct linux_exit_args *);
 intlinux_fork(struct thread *, struct linux_fork_args *);
 intlinux_open(struct thread *, struct linux_open_args *);
 intlinux_waitpid(struct thread *, struct linux_waitpid_args *);
@@ -1407,6 +1411,7 @@ int   linux_process_vm_writev(struct threa
 
 #endif /* COMPAT_FREEBSD7 */
 
+#defineLINUX_SYS_AUE_linux_exitAUE_EXIT
 #defineLINUX_SYS_AUE_linux_forkAUE_FORK
 #defineLINUX_SYS_AUE_linux_openAUE_OPEN_RWTC
 #defineLINUX_SYS_AUE_linux_waitpid AUE_WAIT4

Modified: stable/10/sys/amd64/linux32/linux32_syscall.h
==
--- stable/10/sys/amd64/linux32/linux32_syscall.h   Sat Jan  9 14:33:10 
2016(r293478)
+++ stable/10/sys/amd64/linux32/linux32_syscall.h   Sat Jan  9 14:34:29 
2016(r293479)
@@ -3,10 +3,10 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 276810 
2015-01-08 06:23:11Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293478 
2016-01-09 14:33:10Z dchagin 
  */
 
-#defineLINUX_SYS_exit  1
+#defineLINUX_SYS_linux_exit1
 #defineLINUX_SYS_linux_fork2
 #defineLINUX_SYS_read  3
 #defineLINUX_SYS_write 4

Modified: stable/10/sys/amd64/linux32/linux32_syscalls.c
==
--- stable/10/sys/amd64/linux32/linux32_syscalls.c  Sat Jan  9 14:33:10 
2016(r293478)
+++ stable/10/sys/amd64/linux32/linux32_syscalls.c  Sat Jan  9 14:34:29 
2016(r293479)
@@ -3,13 +3,13 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 276810 
2015-01-08 06:23:11Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293478 
2016-01-09 14:33:10Z dchagin 
  */
 
 const char *linux_syscallnames[] = {
 #definenosys   linux_nosys
"#0",   /* 0 = setup */
-   "exit", /* 1 = exit */
+   "linux_exit",   /* 1 = linux_exit */
"linux_fork",   /* 2 = linux_fork */
"read", /* 3 = read */
"write",/* 4 = write */

Modified: stable/10/sys/amd64/linux32/linux32_sysent.c
==
--- stable/10/sys/amd64/linux32/linux32_sysent.cSat Jan  9 14:33:10 
2016(r293478)
+++ stable/10/sys/amd64/linux32/linux32_sysent.cSat Jan  9 14:34:29 
2016(r293479)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 276810 
2015-01-08 06:23:11Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293478 
2016-01-09 14:33:10Z dchagin 
  */
 
 #include "opt_compat.h"
@@ -20,7 +20,7 @@
 struct sysent linux_sysent[] = {
 #definenosys   linux_nosys
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 0 = setup */
-   { 

svn commit: r293485 - in stable/10/sys: kern sys

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:44:41 2016
New Revision: 293485
URL: https://svnweb.freebsd.org/changeset/base/293485

Log:
  MFC r283377:
  
  In preparation for switching linuxulator to the use the native 1:1
  threads split sys_sched_getparam(), sys_sched_setparam(),
  sys_sched_getscheduler(), sys_sched_setscheduler() to their kern_*
  counterparts and add targettd parameter to allow specify the target
  thread directly by callee.

Modified:
  stable/10/sys/kern/p1003_1b.c
  stable/10/sys/sys/syscallsubr.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/p1003_1b.c
==
--- stable/10/sys/kern/p1003_1b.c   Sat Jan  9 14:43:16 2016
(r293484)
+++ stable/10/sys/kern/p1003_1b.c   Sat Jan  9 14:44:41 2016
(r293485)
@@ -130,16 +130,29 @@ sys_sched_setparam(struct thread *td, st
targettd = FIRST_THREAD_IN_PROC(targetp);
}
 
-   e = p_cansched(td, targetp);
-   if (e == 0) {
-   e = ksched_setparam(ksched, targettd,
-   (const struct sched_param *)_param);
-   }
+   e = kern_sched_setparam(td, targettd, _param);
PROC_UNLOCK(targetp);
return (e);
 }
 
 int
+kern_sched_setparam(struct thread *td, struct thread *targettd,
+struct sched_param *param)
+{
+   struct proc *targetp;
+   int error;
+
+   targetp = targettd->td_proc;
+   PROC_LOCK_ASSERT(targetp, MA_OWNED);
+
+   error = p_cansched(td, targetp);
+   if (error == 0)
+   error = ksched_setparam(ksched, targettd,
+   (const struct sched_param *)param);
+   return (error);
+}
+
+int
 sys_sched_getparam(struct thread *td, struct sched_getparam_args *uap)
 {
int e;
@@ -159,10 +172,7 @@ sys_sched_getparam(struct thread *td, st
targettd = FIRST_THREAD_IN_PROC(targetp);
}
 
-   e = p_cansee(td, targetp);
-   if (e == 0) {
-   e = ksched_getparam(ksched, targettd, _param);
-   }
+   e = kern_sched_getparam(td, targettd, _param);
PROC_UNLOCK(targetp);
if (e == 0)
e = copyout(_param, uap->param, sizeof(sched_param));
@@ -170,6 +180,22 @@ sys_sched_getparam(struct thread *td, st
 }
 
 int
+kern_sched_getparam(struct thread *td, struct thread *targettd,
+struct sched_param *param)
+{
+   struct proc *targetp;
+   int error;
+
+   targetp = targettd->td_proc;
+   PROC_LOCK_ASSERT(targetp, MA_OWNED);
+
+   error = p_cansee(td, targetp);
+   if (error == 0)
+   error = ksched_getparam(ksched, targettd, param);
+   return (error);
+}
+
+int
 sys_sched_setscheduler(struct thread *td, struct sched_setscheduler_args *uap)
 {
int e;
@@ -177,11 +203,6 @@ sys_sched_setscheduler(struct thread *td
struct thread *targettd;
struct proc *targetp;
 
-   /* Don't allow non root user to set a scheduler policy. */
-   e = priv_check(td, PRIV_SCHED_SET);
-   if (e)
-   return (e);
-
e = copyin(uap->param, _param, sizeof(sched_param));
if (e)
return (e);
@@ -197,16 +218,35 @@ sys_sched_setscheduler(struct thread *td
targettd = FIRST_THREAD_IN_PROC(targetp);
}
 
-   e = p_cansched(td, targetp);
-   if (e == 0) {
-   e = ksched_setscheduler(ksched, targettd,
-   uap->policy, (const struct sched_param *)_param);
-   }
+   e = kern_sched_setscheduler(td, targettd, uap->policy,
+   _param);
PROC_UNLOCK(targetp);
return (e);
 }
 
 int
+kern_sched_setscheduler(struct thread *td, struct thread *targettd,
+int policy, struct sched_param *param)
+{
+   struct proc *targetp;
+   int error;
+
+   targetp = targettd->td_proc;
+   PROC_LOCK_ASSERT(targetp, MA_OWNED);
+
+   /* Don't allow non root user to set a scheduler policy. */
+   error = priv_check(td, PRIV_SCHED_SET);
+   if (error)
+   return (error);
+
+   error = p_cansched(td, targetp);
+   if (error == 0)
+   error = ksched_setscheduler(ksched, targettd, policy,
+   (const struct sched_param *)param);
+   return (error);
+}
+
+int
 sys_sched_getscheduler(struct thread *td, struct sched_getscheduler_args *uap)
 {
int e, policy;
@@ -224,17 +264,31 @@ sys_sched_getscheduler(struct thread *td
targettd = FIRST_THREAD_IN_PROC(targetp);
}
 
-   e = p_cansee(td, targetp);
-   if (e == 0) {
-   e = ksched_getscheduler(ksched, targettd, );
-   td->td_retval[0] = policy;
-   }
+   e = kern_sched_getscheduler(td, targettd, );
PROC_UNLOCK(targetp);
+   if (e == 0)
+   td->td_retval[0] = policy;
 
return (e);
 }
 
 int
+kern_sched_getscheduler(struct thread *td, struct thread 

svn commit: r293486 - stable/10/sys/amd64/linux32

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:45:41 2016
New Revision: 293486
URL: https://svnweb.freebsd.org/changeset/base/293486

Log:
  MFC r283378:
  
  Remove a now unused include.

Modified:
  stable/10/sys/amd64/linux32/linux32_machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/linux32_machdep.c
==
--- stable/10/sys/amd64/linux32/linux32_machdep.c   Sat Jan  9 14:44:41 
2016(r293485)
+++ stable/10/sys/amd64/linux32/linux32_machdep.c   Sat Jan  9 14:45:41 
2016(r293486)
@@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293492 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:12:31 2016
New Revision: 293492
URL: https://svnweb.freebsd.org/changeset/base/293492

Log:
  To facillitate Linuxulator merging temporarilly revert r288994 (by bdrewery).

Modified:
  stable/10/sys/compat/linux/linux_fork.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_fork.c
==
--- stable/10/sys/compat/linux/linux_fork.c Sat Jan  9 14:53:23 2016
(r293491)
+++ stable/10/sys/compat/linux/linux_fork.c Sat Jan  9 15:12:31 2016
(r293492)
@@ -112,8 +112,9 @@ linux_vfork(struct thread *td, struct li
printf(ARGS(vfork, ""));
 #endif
 
-   if ((error = fork1(td, RFFDG | RFPROC | RFMEM | RFPPWAIT | RFSTOPPED,
-   0, , NULL, 0)) != 0)
+   /* Exclude RFPPWAIT */
+   if ((error = fork1(td, RFFDG | RFPROC | RFMEM | RFSTOPPED, 0, ,
+   NULL, 0)) != 0)
return (error);
 
td->td_retval[0] = p2->p_pid;
@@ -122,6 +123,10 @@ linux_vfork(struct thread *td, struct li
if (error)
return (error);
 
+   PROC_LOCK(p2);
+   p2->p_flag |= P_PPWAIT;
+   PROC_UNLOCK(p2);
+
td2 = FIRST_THREAD_IN_PROC(p2);
 
/*
@@ -132,6 +137,12 @@ linux_vfork(struct thread *td, struct li
sched_add(td2, SRQ_BORING);
thread_unlock(td2);
 
+   /* wait for the children to exit, ie. emulate vfork */
+   PROC_LOCK(p2);
+   while (p2->p_flag & P_PPWAIT)
+   cv_wait(>p_pwait, >p_mtx);
+   PROC_UNLOCK(p2);
+
return (0);
 }
 
@@ -193,9 +204,6 @@ linux_clone(struct thread *td, struct li
if (args->parent_tidptr == NULL)
return (EINVAL);
 
-   if (args->flags & LINUX_CLONE_VFORK)
-   ff |= RFPPWAIT;
-
error = fork1(td, ff, 0, , NULL, 0);
if (error)
return (error);
@@ -264,6 +272,12 @@ linux_clone(struct thread *td, struct li
"stack %p sig = %d"), (int)p2->p_pid, args->stack,
exit_signal);
 #endif
+   if (args->flags & LINUX_CLONE_VFORK) {
+   PROC_LOCK(p2);
+   p2->p_flag |= P_PPWAIT;
+   PROC_UNLOCK(p2);
+   }
+
/*
 * Make this runnable after we are finished with it.
 */
@@ -275,6 +289,14 @@ linux_clone(struct thread *td, struct li
td->td_retval[0] = p2->p_pid;
td->td_retval[1] = 0;
 
+   if (args->flags & LINUX_CLONE_VFORK) {
+   /* wait for the children to exit, ie. emulate vfork */
+   PROC_LOCK(p2);
+   while (p2->p_flag & P_PPWAIT)
+   cv_wait(>p_pwait, >p_mtx);
+   PROC_UNLOCK(p2);
+   }
+
return (0);
 }
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293494 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:17:34 2016
New Revision: 293494
URL: https://svnweb.freebsd.org/changeset/base/293494

Log:
  MFC r283384:
  
  pthread_join() caller do futex_wait on child_clear_tid. As a results
  of multiple simultaneous calls to pthread_join() specifying the same
  target thread are undefined wake up the one thread.

Modified:
  stable/10/sys/compat/linux/linux_emul.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_emul.c
==
--- stable/10/sys/compat/linux/linux_emul.c Sat Jan  9 15:16:13 2016
(r293493)
+++ stable/10/sys/compat/linux/linux_emul.c Sat Jan  9 15:17:34 2016
(r293494)
@@ -271,7 +271,7 @@ linux_thread_detach(struct thread *td)
 
cup.uaddr = child_clear_tid;
cup.op = LINUX_FUTEX_WAKE;
-   cup.val = 0x7fff;   /* Awake everyone */
+   cup.val = 1;/* wake one */
cup.timeout = NULL;
cup.uaddr2 = NULL;
cup.val3 = 0;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293508 - in stable/10/sys: amd64/linux32 compat/linux i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:34:54 2016
New Revision: 293508
URL: https://svnweb.freebsd.org/changeset/base/293508

Log:
  MFC r283399:
  
  Implement dup3() system call.

Modified:
  stable/10/sys/amd64/linux32/linux32_dummy.c
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/compat/linux/linux_file.c
  stable/10/sys/i386/linux/linux_dummy.c
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/linux32_dummy.c
==
--- stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan  9 15:33:48 2016
(r293507)
+++ stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan  9 15:34:54 2016
(r293508)
@@ -123,7 +123,6 @@ DUMMY(timerfd_gettime);
 DUMMY(signalfd4);
 DUMMY(eventfd2);
 DUMMY(epoll_create1);
-DUMMY(dup3);
 DUMMY(inotify_init1);
 /* linux 2.6.30: */
 DUMMY(preadv);

Modified: stable/10/sys/amd64/linux32/syscalls.master
==
--- stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 15:33:48 2016
(r293507)
+++ stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 15:34:54 2016
(r293508)
@@ -539,7 +539,8 @@
 327AUE_NULLSTD { int linux_signalfd4(void); }
 328AUE_NULLSTD { int linux_eventfd2(void); }
 329AUE_NULLSTD { int linux_epoll_create1(void); }
-330AUE_NULLSTD { int linux_dup3(void); }
+330AUE_NULLSTD { int linux_dup3(l_int oldfd,   \
+   l_int newfd, l_int flags); }
 331AUE_NULLSTD { int linux_pipe2(l_int *pipefds, l_int flags); 
}
 332AUE_NULLSTD { int linux_inotify_init1(void); }
 ; linux 2.6.30:

Modified: stable/10/sys/compat/linux/linux_file.c
==
--- stable/10/sys/compat/linux/linux_file.c Sat Jan  9 15:33:48 2016
(r293507)
+++ stable/10/sys/compat/linux/linux_file.c Sat Jan  9 15:34:54 2016
(r293508)
@@ -1600,3 +1600,22 @@ linux_pipe2(struct thread *td, struct li
/* XXX: Close descriptors on error. */
return (copyout(fildes, args->pipefds, sizeof(fildes)));
 }
+
+int
+linux_dup3(struct thread *td, struct linux_dup3_args *args)
+{
+   int cmd;
+   intptr_t newfd;
+
+   if (args->oldfd == args->newfd)
+   return (EINVAL);
+   if ((args->flags & ~LINUX_O_CLOEXEC) != 0)
+   return (EINVAL);
+   if (args->flags & LINUX_O_CLOEXEC)
+   cmd = F_DUP2FD_CLOEXEC;
+   else
+   cmd = F_DUP2FD;
+
+   newfd = args->newfd;
+   return (kern_fcntl(td, args->oldfd, cmd, newfd));
+}

Modified: stable/10/sys/i386/linux/linux_dummy.c
==
--- stable/10/sys/i386/linux/linux_dummy.c  Sat Jan  9 15:33:48 2016
(r293507)
+++ stable/10/sys/i386/linux/linux_dummy.c  Sat Jan  9 15:34:54 2016
(r293508)
@@ -119,7 +119,6 @@ DUMMY(timerfd_gettime);
 DUMMY(signalfd4);
 DUMMY(eventfd2);
 DUMMY(epoll_create1);
-DUMMY(dup3);
 DUMMY(inotify_init1);
 /* linux 2.6.30: */
 DUMMY(preadv);

Modified: stable/10/sys/i386/linux/syscalls.master
==
--- stable/10/sys/i386/linux/syscalls.masterSat Jan  9 15:33:48 2016
(r293507)
+++ stable/10/sys/i386/linux/syscalls.masterSat Jan  9 15:34:54 2016
(r293508)
@@ -547,7 +547,8 @@
 327AUE_NULLSTD { int linux_signalfd4(void); }
 328AUE_NULLSTD { int linux_eventfd2(void); }
 329AUE_NULLSTD { int linux_epoll_create1(void); }
-330AUE_NULLSTD { int linux_dup3(void); }
+330AUE_NULLSTD { int linux_dup3(l_int oldfd,   \
+   l_int newfd, l_int flags); }
 331AUE_NULLSTD { int linux_pipe2(l_int *pipefds, l_int flags); 
}
 332AUE_NULLSTD { int linux_inotify_init1(void); }
 ; linux 2.6.30:
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293480 - in stable/10/sys: kern sys

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:36:44 2016
New Revision: 293480
URL: https://svnweb.freebsd.org/changeset/base/293480

Log:
  MFC r283372:
  
  In preparation for switching linuxulator to the use the native 1:1
  threads split sys_thr_exit() up into sys_thr_exit() and kern_thr_exit().
  Move
  Where the second will be used in linux_exit() system call later.

Modified:
  stable/10/sys/kern/kern_thr.c
  stable/10/sys/sys/syscallsubr.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_thr.c
==
--- stable/10/sys/kern/kern_thr.c   Sat Jan  9 14:34:29 2016
(r293479)
+++ stable/10/sys/kern/kern_thr.c   Sat Jan  9 14:36:44 2016
(r293480)
@@ -305,9 +305,6 @@ int
 sys_thr_exit(struct thread *td, struct thr_exit_args *uap)
 /* long *state */
 {
-   struct proc *p;
-
-   p = td->td_proc;
 
/* Signal userland that it can free the stack. */
if ((void *)uap->state != NULL) {
@@ -315,8 +312,17 @@ sys_thr_exit(struct thread *td, struct t
kern_umtx_wake(td, uap->state, INT_MAX, 0);
}
 
-   rw_wlock(_lock);
+   return (kern_thr_exit(td));
+}
+
+int
+kern_thr_exit(struct thread *td)
+{
+   struct proc *p;
 
+   p = td->td_proc;
+
+   rw_wlock(_lock);
PROC_LOCK(p);
 
if (p->p_numthreads != 1) {

Modified: stable/10/sys/sys/syscallsubr.h
==
--- stable/10/sys/sys/syscallsubr.h Sat Jan  9 14:34:29 2016
(r293479)
+++ stable/10/sys/sys/syscallsubr.h Sat Jan  9 14:36:44 2016
(r293480)
@@ -246,6 +246,7 @@ int kern_ktimer_settime(struct thread *t
 intkern_ktimer_gettime(struct thread *td, int timer_id,
struct itimerspec *val);
 intkern_ktimer_getoverrun(struct thread *td, int timer_id);
+intkern_thr_exit(struct thread *td);
 intkern_thr_new(struct thread *td, struct thr_param *param);
 intkern_thr_suspend(struct thread *td, struct timespec *tsp);
 intkern_truncate(struct thread *td, char *path, enum uio_seg pathseg,
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293497 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:20:48 2016
New Revision: 293497
URL: https://svnweb.freebsd.org/changeset/base/293497

Log:
  MFC r283388:
  
  Remove a now unused define.

Modified:
  stable/10/sys/compat/linux/linux_misc.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_misc.h
==
--- stable/10/sys/compat/linux/linux_misc.h Sat Jan  9 15:19:43 2016
(r293496)
+++ stable/10/sys/compat/linux/linux_misc.h Sat Jan  9 15:20:48 2016
(r293497)
@@ -88,10 +88,6 @@ extern const char *linux_platform;
 #defineLINUX_CLONE_CHILD_CLEARTID  0x0020
 #defineLINUX_CLONE_CHILD_SETTID0x0100
 
-#defineLINUX_THREADING_FLAGS   \
-   (LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES |  \
-   LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD)
-
 /* Scheduling policies */
 #defineLINUX_SCHED_OTHER   0
 #defineLINUX_SCHED_FIFO1
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293506 - in stable/10/sys: amd64/linux32 i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:32:33 2016
New Revision: 293506
URL: https://svnweb.freebsd.org/changeset/base/293506

Log:
  Regen for r293505.

Modified:
  stable/10/sys/amd64/linux32/linux32_proto.h
  stable/10/sys/amd64/linux32/linux32_syscall.h
  stable/10/sys/amd64/linux32/linux32_syscalls.c
  stable/10/sys/amd64/linux32/linux32_sysent.c
  stable/10/sys/amd64/linux32/linux32_systrace_args.c
  stable/10/sys/i386/linux/linux_proto.h
  stable/10/sys/i386/linux/linux_syscall.h
  stable/10/sys/i386/linux/linux_syscalls.c
  stable/10/sys/i386/linux/linux_sysent.c
  stable/10/sys/i386/linux/linux_systrace_args.c

Modified: stable/10/sys/amd64/linux32/linux32_proto.h
==
--- stable/10/sys/amd64/linux32/linux32_proto.h Sat Jan  9 15:31:15 2016
(r293505)
+++ stable/10/sys/amd64/linux32/linux32_proto.h Sat Jan  9 15:32:33 2016
(r293506)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293503 
2016-01-09 15:28:05Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293505 
2016-01-09 15:31:15Z dchagin 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -574,7 +574,9 @@ struct linux_rt_sigtimedwait_args {
char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char 
sigsetsize_r_[PADR_(l_size_t)];
 };
 struct linux_rt_sigqueueinfo_args {
-   register_t dummy;
+   char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
+   char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)];
+   char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char 
info_r_[PADR_(l_siginfo_t *)];
 };
 struct linux_rt_sigsuspend_args {
char newset_l_[PADL_(l_sigset_t *)]; l_sigset_t * newset; char 
newset_r_[PADR_(l_sigset_t *)];

Modified: stable/10/sys/amd64/linux32/linux32_syscall.h
==
--- stable/10/sys/amd64/linux32/linux32_syscall.h   Sat Jan  9 15:31:15 
2016(r293505)
+++ stable/10/sys/amd64/linux32/linux32_syscall.h   Sat Jan  9 15:32:33 
2016(r293506)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293503 
2016-01-09 15:28:05Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293505 
2016-01-09 15:31:15Z dchagin 
  */
 
 #defineLINUX_SYS_linux_exit1

Modified: stable/10/sys/amd64/linux32/linux32_syscalls.c
==
--- stable/10/sys/amd64/linux32/linux32_syscalls.c  Sat Jan  9 15:31:15 
2016(r293505)
+++ stable/10/sys/amd64/linux32/linux32_syscalls.c  Sat Jan  9 15:32:33 
2016(r293506)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293503 
2016-01-09 15:28:05Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293505 
2016-01-09 15:31:15Z dchagin 
  */
 
 const char *linux_syscallnames[] = {

Modified: stable/10/sys/amd64/linux32/linux32_sysent.c
==
--- stable/10/sys/amd64/linux32/linux32_sysent.cSat Jan  9 15:31:15 
2016(r293505)
+++ stable/10/sys/amd64/linux32/linux32_sysent.cSat Jan  9 15:32:33 
2016(r293506)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293503 
2016-01-09 15:28:05Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 293505 
2016-01-09 15:31:15Z dchagin 
  */
 
 #include "opt_compat.h"
@@ -197,7 +197,7 @@ struct sysent linux_sysent[] = {
{ AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   /* 175 = linux_rt_sigprocmask */
{ AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 176 = linux_rt_sigpending */
{ AS(linux_rt_sigtimedwait_args), (sy_call_t *)linux_rt_sigtimedwait, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 177 = linux_rt_sigtimedwait */
-   { 0, (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },  /* 178 = linux_rt_sigqueueinfo */
+   { AS(linux_rt_sigqueueinfo_args), (sy_call_t *)linux_rt_sigqueueinfo, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 178 = linux_rt_sigqueueinfo */
{ AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 179 = linux_rt_sigsuspend */
{ AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD, NULL, 0, 
0, 0, 

svn commit: r293505 - in stable/10/sys: amd64/linux32 compat/linux i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:31:15 2016
New Revision: 293505
URL: https://svnweb.freebsd.org/changeset/base/293505

Log:
  MFC r283396:
  
  Implement rt_sigqueueinfo() system call.

Modified:
  stable/10/sys/amd64/linux32/linux32_dummy.c
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/compat/linux/linux_signal.c
  stable/10/sys/compat/linux/linux_signal.h
  stable/10/sys/i386/linux/linux_dummy.c
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/linux32_dummy.c
==
--- stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan  9 15:29:10 2016
(r293504)
+++ stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan  9 15:31:15 2016
(r293505)
@@ -62,7 +62,6 @@ DUMMY(bdflush);
 DUMMY(sysfs);
 DUMMY(query_module);
 DUMMY(nfsservctl);
-DUMMY(rt_sigqueueinfo);
 DUMMY(sendfile);
 DUMMY(setfsuid);
 DUMMY(setfsgid);

Modified: stable/10/sys/amd64/linux32/syscalls.master
==
--- stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 15:29:10 2016
(r293504)
+++ stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 15:31:15 2016
(r293505)
@@ -318,7 +318,8 @@
l_siginfo_t *ptr, \
struct l_timeval *timeout, \
l_size_t sigsetsize); }
-178AUE_NULLSTD { int linux_rt_sigqueueinfo(void); }
+178AUE_NULLSTD { int linux_rt_sigqueueinfo(l_pid_t pid, l_int 
sig, \
+   l_siginfo_t *info); }
 179AUE_NULLSTD { int linux_rt_sigsuspend( \
l_sigset_t *newset, \
l_size_t sigsetsize); }

Modified: stable/10/sys/compat/linux/linux_signal.c
==
--- stable/10/sys/compat/linux/linux_signal.c   Sat Jan  9 15:29:10 2016
(r293504)
+++ stable/10/sys/compat/linux/linux_signal.c   Sat Jan  9 15:31:15 2016
(r293505)
@@ -751,3 +751,58 @@ siginfo_to_lsiginfo(const siginfo_t *si,
break;
}
 }
+
+void
+lsiginfo_to_ksiginfo(const l_siginfo_t *lsi, ksiginfo_t *ksi, int sig)
+{
+
+   ksi->ksi_signo = sig;
+   ksi->ksi_code = lsi->lsi_code;  /* XXX. Convert. */
+   ksi->ksi_pid = lsi->lsi_pid;
+   ksi->ksi_uid = lsi->lsi_uid;
+   ksi->ksi_status = lsi->lsi_status;
+   ksi->ksi_addr = PTRIN(lsi->lsi_addr);
+   ksi->ksi_info.si_value.sival_int = lsi->lsi_int;
+}
+
+int
+linux_rt_sigqueueinfo(struct thread *td, struct linux_rt_sigqueueinfo_args 
*args)
+{
+   l_siginfo_t linfo;
+   struct proc *p;
+   ksiginfo_t ksi;
+   int error;
+   int sig;
+
+   if (!LINUX_SIG_VALID(args->sig))
+   return (EINVAL);
+
+   error = copyin(args->info, , sizeof(linfo));
+   if (error != 0)
+   return (error);
+
+   if (linfo.lsi_code >= 0)
+   return (EPERM);
+
+   if (args->sig > 0 && args->sig <= LINUX_SIGTBLSZ)
+   sig = linux_to_bsd_signal[_SIG_IDX(args->sig)];
+   else
+   sig = args->sig;
+
+   error = ESRCH;
+   if ((p = pfind(args->pid)) != NULL ||
+   (p = zpfind(args->pid)) != NULL) {
+   error = p_cansignal(td, p, sig);
+   if (error != 0) {
+   PROC_UNLOCK(p);
+   return (error);
+   }
+
+   ksiginfo_init();
+   lsiginfo_to_ksiginfo(, , sig);
+   error = tdsendsignal(p, NULL, sig, );
+   PROC_UNLOCK(p);
+   }
+
+   return (error);
+}

Modified: stable/10/sys/compat/linux/linux_signal.h
==
--- stable/10/sys/compat/linux/linux_signal.h   Sat Jan  9 15:29:10 2016
(r293504)
+++ stable/10/sys/compat/linux/linux_signal.h   Sat Jan  9 15:31:15 2016
(r293505)
@@ -51,6 +51,7 @@ void bsd_to_linux_sigset(sigset_t *, l_s
 int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *);
 void ksiginfo_to_lsiginfo(const ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig);
 void siginfo_to_lsiginfo(const siginfo_t *si, l_siginfo_t *lsi, l_int sig);
+void lsiginfo_to_ksiginfo(const l_siginfo_t *lsi, ksiginfo_t *ksi, int sig);
 
 #define LINUX_SIG_VALID(sig)   ((sig) <= LINUX_NSIG && (sig) > 0)
 

Modified: stable/10/sys/i386/linux/linux_dummy.c
==
--- stable/10/sys/i386/linux/linux_dummy.c  Sat Jan  9 15:29:10 2016
(r293504)
+++ stable/10/sys/i386/linux/linux_dummy.c  Sat Jan  9 15:31:15 2016
(r293505)
@@ -65,7 +65,6 @@ DUMMY(sysfs);
 DUMMY(vm86);
 DUMMY(query_module);
 

svn commit: r293482 - in stable/10/sys: amd64/linux32 compat/linux kern sys

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 14:40:38 2016
New Revision: 293482
URL: https://svnweb.freebsd.org/changeset/base/293482

Log:
  MFC r283374:
  
  In preparation for switching linuxulator to the use the native 1:1
  threads refactor kern_sched_rr_get_interval() and sys_sched_rr_get_interval().
  Add a kern_sched_rr_get_interval() counterpart which takes a targettd
  parameter to allow specify target thread directly by callee (new Linuxulator).
  
  Linuxulator temporarily uses first thread in proc.
  
  Move linux_sched_rr_get_interval() to the MI part.

Modified:
  stable/10/sys/amd64/linux32/linux32_machdep.c
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/kern/p1003_1b.c
  stable/10/sys/sys/syscallsubr.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/linux32_machdep.c
==
--- stable/10/sys/amd64/linux32/linux32_machdep.c   Sat Jan  9 14:38:29 
2016(r293481)
+++ stable/10/sys/amd64/linux32/linux32_machdep.c   Sat Jan  9 14:40:38 
2016(r293482)
@@ -924,22 +924,6 @@ linux_getrusage(struct thread *td, struc
 }
 
 int
-linux_sched_rr_get_interval(struct thread *td,
-struct linux_sched_rr_get_interval_args *uap)
-{
-   struct timespec ts;
-   struct l_timespec ts32;
-   int error;
-
-   error = kern_sched_rr_get_interval(td, uap->pid, );
-   if (error != 0)
-   return (error);
-   ts32.tv_sec = ts.tv_sec;
-   ts32.tv_nsec = ts.tv_nsec;
-   return (copyout(, uap->interval, sizeof(ts32)));
-}
-
-int
 linux_set_thread_area(struct thread *td,
 struct linux_set_thread_area_args *args)
 {

Modified: stable/10/sys/compat/linux/linux_misc.c
==
--- stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 14:38:29 2016
(r293481)
+++ stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 14:40:38 2016
(r293482)
@@ -1926,3 +1926,33 @@ linux_sched_setaffinity(struct thread *t
 
return (sys_cpuset_setaffinity(td, ));
 }
+
+int
+linux_sched_rr_get_interval(struct thread *td,
+struct linux_sched_rr_get_interval_args *uap)
+{
+   struct timespec ts;
+   struct l_timespec lts;
+   struct thread *tdt;
+   struct proc *p;
+   int error;
+
+   if (uap->pid == 0) {
+   tdt = td;
+   p = tdt->td_proc;
+   PROC_LOCK(p);
+   } else {
+   p = pfind(uap->pid);
+   if (p == NULL)
+   return (ESRCH);
+   tdt = FIRST_THREAD_IN_PROC(p);
+   }
+
+   error = kern_sched_rr_get_interval_td(td, tdt, );
+   PROC_UNLOCK(p);
+   if (error != 0)
+   return (error);
+   lts.tv_sec = ts.tv_sec;
+   lts.tv_nsec = ts.tv_nsec;
+   return (copyout(, uap->interval, sizeof(lts)));
+}

Modified: stable/10/sys/kern/p1003_1b.c
==
--- stable/10/sys/kern/p1003_1b.c   Sat Jan  9 14:38:29 2016
(r293481)
+++ stable/10/sys/kern/p1003_1b.c   Sat Jan  9 14:40:38 2016
(r293482)
@@ -296,13 +296,26 @@ kern_sched_rr_get_interval(struct thread
targettd = FIRST_THREAD_IN_PROC(targetp);
}
 
-   e = p_cansee(td, targetp);
-   if (e == 0)
-   e = ksched_rr_get_interval(ksched, targettd, ts);
+   e = kern_sched_rr_get_interval_td(td, targettd, ts);
PROC_UNLOCK(targetp);
return (e);
 }
 
+int
+kern_sched_rr_get_interval_td(struct thread *td, struct thread *targettd,
+struct timespec *ts)
+{
+   struct proc *p;
+   int error;
+
+   p = targettd->td_proc;
+   PROC_LOCK_ASSERT(p, MA_OWNED);
+
+   error = p_cansee(td, p);
+   if (error == 0)
+   error = ksched_rr_get_interval(ksched, targettd, ts);
+   return (error);
+}
 #endif
 
 static void

Modified: stable/10/sys/sys/syscallsubr.h
==
--- stable/10/sys/sys/syscallsubr.h Sat Jan  9 14:38:29 2016
(r293481)
+++ stable/10/sys/sys/syscallsubr.h Sat Jan  9 14:40:38 2016
(r293482)
@@ -197,6 +197,8 @@ int kern_rmdirat(struct thread *td, int 
enum uio_seg pathseg);
 intkern_sched_rr_get_interval(struct thread *td, pid_t pid,
struct timespec *ts);
+intkern_sched_rr_get_interval_td(struct thread *td, struct thread 
*targettd,
+   struct timespec *ts);
 intkern_semctl(struct thread *td, int semid, int semnum, int cmd,
union semun *arg, register_t *rval);
 intkern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to 

svn commit: r293501 - stable/10/sys/i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:25:22 2016
New Revision: 293501
URL: https://svnweb.freebsd.org/changeset/base/293501

Log:
  MFC r283392:
  
  struct l_rusage does not defined for i386 Linuxulator due to it's nature.

Modified:
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/i386/linux/syscalls.master
==
--- stable/10/sys/i386/linux/syscalls.masterSat Jan  9 15:23:54 2016
(r293500)
+++ stable/10/sys/i386/linux/syscalls.masterSat Jan  9 15:25:22 2016
(r293501)
@@ -208,7 +208,7 @@
 113AUE_NULLSTD { int linux_vm86old(void); }
 114AUE_WAIT4   STD { int linux_wait4(l_pid_t pid, \
l_int *status, l_int options, \
-   struct l_rusage *rusage); }
+   void *rusage); }
 115AUE_SWAPOFF STD { int linux_swapoff(void); }
 116AUE_NULLSTD { int linux_sysinfo(struct l_sysinfo *info); }
 117AUE_NULLSTD { int linux_ipc(l_uint what, l_int arg1, \
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293518 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:50:55 2016
New Revision: 293518
URL: https://svnweb.freebsd.org/changeset/base/293518

Log:
  MFC r283412:
  
  Get ready to commit x86_64 Linux emulation.
  All fields of type l_int in struct statfs are defined
  as l_long on i386 and amd64.

Modified:
  stable/10/sys/compat/linux/linux_stats.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_stats.c
==
--- stable/10/sys/compat/linux/linux_stats.cSat Jan  9 15:49:42 2016
(r293517)
+++ stable/10/sys/compat/linux/linux_stats.cSat Jan  9 15:50:55 2016
(r293518)
@@ -326,18 +326,17 @@ linux_lstat(struct thread *td, struct li
return(stat_copyout(, args->up));
 }
 
-/* XXX - All fields of type l_int are defined as l_long on i386 */
 struct l_statfs {
-   l_int   f_type;
-   l_int   f_bsize;
-   l_int   f_blocks;
-   l_int   f_bfree;
-   l_int   f_bavail;
-   l_int   f_files;
-   l_int   f_ffree;
+   l_long  f_type;
+   l_long  f_bsize;
+   l_long  f_blocks;
+   l_long  f_bfree;
+   l_long  f_bavail;
+   l_long  f_files;
+   l_long  f_ffree;
l_fsid_tf_fsid;
-   l_int   f_namelen;
-   l_int   f_spare[6];
+   l_long  f_namelen;
+   l_long  f_spare[6];
 };
 
 #defineLINUX_CODA_SUPER_MAGIC  0x73757245L
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293540 - in stable/10/sys: amd64/linux32 compat/linux i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 16:29:51 2016
New Revision: 293540
URL: https://svnweb.freebsd.org/changeset/base/293540

Log:
  MFC r283436:
  
  Use the BSD_TO_LINUX_SIGNAL() wherever there is no need
  to check the ABI as it is known.

Modified:
  stable/10/sys/amd64/linux32/linux32_sysvec.c
  stable/10/sys/compat/linux/linux_signal.c
  stable/10/sys/i386/linux/linux_sysvec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/linux32_sysvec.c
==
--- stable/10/sys/amd64/linux32/linux32_sysvec.cSat Jan  9 16:28:40 
2016(r293539)
+++ stable/10/sys/amd64/linux32/linux32_sysvec.cSat Jan  9 16:29:51 
2016(r293540)
@@ -344,9 +344,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo
/*
 * Build the argument list for the signal handler.
 */
-   if (p->p_sysent->sv_sigtbl)
-   if (sig <= p->p_sysent->sv_sigsize)
-   sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
+   sig = BSD_TO_LINUX_SIGNAL(sig);
 
bzero(, sizeof(frame));
 
@@ -492,9 +490,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t 
/*
 * Build the argument list for the signal handler.
 */
-   if (p->p_sysent->sv_sigtbl)
-   if (sig <= p->p_sysent->sv_sigsize)
-   sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
+   sig = BSD_TO_LINUX_SIGNAL(sig);
 
bzero(, sizeof(frame));
 

Modified: stable/10/sys/compat/linux/linux_signal.c
==
--- stable/10/sys/compat/linux/linux_signal.c   Sat Jan  9 16:28:40 2016
(r293539)
+++ stable/10/sys/compat/linux/linux_signal.c   Sat Jan  9 16:29:51 2016
(r293540)
@@ -628,10 +628,8 @@ linux_tkill(struct thread *td, struct li
if (!LINUX_SIG_VALID(args->sig))
return (EINVAL);
 
-   if (args->sig > 0 && args->sig <= LINUX_SIGTBLSZ)
-   sig = linux_to_bsd_signal[_SIG_IDX(args->sig)];
-   else
-   sig = args->sig;
+
+   sig = BSD_TO_LINUX_SIGNAL(args->sig);
 
tdt = linux_tdfind(td, args->tid, -1);
if (tdt == NULL)
@@ -788,10 +786,7 @@ linux_rt_sigqueueinfo(struct thread *td,
if (linfo.lsi_code >= 0)
return (EPERM);
 
-   if (args->sig > 0 && args->sig <= LINUX_SIGTBLSZ)
-   sig = linux_to_bsd_signal[_SIG_IDX(args->sig)];
-   else
-   sig = args->sig;
+   sig = BSD_TO_LINUX_SIGNAL(args->sig);
 
error = ESRCH;
if ((p = pfind(args->pid)) != NULL ||

Modified: stable/10/sys/i386/linux/linux_sysvec.c
==
--- stable/10/sys/i386/linux/linux_sysvec.c Sat Jan  9 16:28:40 2016
(r293539)
+++ stable/10/sys/i386/linux/linux_sysvec.c Sat Jan  9 16:29:51 2016
(r293540)
@@ -480,9 +480,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo
/*
 * Build the argument list for the signal handler.
 */
-   if (p->p_sysent->sv_sigtbl)
-   if (sig <= p->p_sysent->sv_sigsize)
-   sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
+   sig = BSD_TO_LINUX_SIGNAL(sig);
 
bzero(, sizeof(frame));
 
@@ -623,9 +621,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t 
/*
 * Build the argument list for the signal handler.
 */
-   if (p->p_sysent->sv_sigtbl)
-   if (sig <= p->p_sysent->sv_sigsize)
-   sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
+   sig = BSD_TO_LINUX_SIGNAL(sig);
 
bzero(, sizeof(frame));
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293565 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 17:11:25 2016
New Revision: 293565
URL: https://svnweb.freebsd.org/changeset/base/293565

Log:
  MFC r283463:
  
  Do not use struct l_timespec without conversion. While here move
  args->timeout handling before acquiring the futex key at FUTEX_WAIT path.

Modified:
  stable/10/sys/compat/linux/linux_futex.c
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/compat/linux/linux_time.c
  stable/10/sys/compat/linux/linux_timer.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_futex.c
==
--- stable/10/sys/compat/linux/linux_futex.cSat Jan  9 17:10:22 2016
(r293564)
+++ stable/10/sys/compat/linux/linux_futex.cSat Jan  9 17:11:25 2016
(r293565)
@@ -66,6 +66,7 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* DTrace init */
@@ -670,7 +671,8 @@ linux_sys_futex(struct thread *td, struc
struct linux_pemuldata *pem;
struct waiting_proc *wp;
struct futex *f, *f2;
-   struct l_timespec timeout;
+   struct l_timespec ltimeout;
+   struct timespec timeout;
struct timeval utv, ctv;
int timeout_hz;
int error;
@@ -714,6 +716,38 @@ linux_sys_futex(struct thread *td, struc
LINUX_CTR3(sys_futex, "WAIT uaddr %p val 0x%x bitset 0x%x",
args->uaddr, args->val, args->val3);
 
+   if (args->timeout != NULL) {
+   error = copyin(args->timeout, , 
sizeof(ltimeout));
+   if (error) {
+   LIN_SDT_PROBE1(futex, linux_sys_futex, 
copyin_error,
+   error);
+   LIN_SDT_PROBE1(futex, linux_sys_futex, return, 
error);
+   return (error);
+   }
+   error = linux_to_native_timespec(, );
+   if (error)
+   return (error);
+   TIMESPEC_TO_TIMEVAL(, );
+   error = itimerfix();
+   if (error) {
+   LIN_SDT_PROBE1(futex, linux_sys_futex, 
itimerfix_error,
+   error);
+   LIN_SDT_PROBE1(futex, linux_sys_futex, return, 
error);
+   return (error);
+   }
+   if (clockrt) {
+   microtime();
+   timevalsub(, );
+   } else if (args->op == LINUX_FUTEX_WAIT_BITSET) {
+   microuptime();
+   timevalsub(, );
+   }
+   if (utv.tv_sec < 0)
+   timevalclear();
+   timeout_hz = tvtohz();
+   } else
+   timeout_hz = 0;
+
error = futex_get(args->uaddr, , ,
flags | FUTEX_CREATE_WP);
if (error) {
@@ -746,37 +780,6 @@ linux_sys_futex(struct thread *td, struc
return (EWOULDBLOCK);
}
 
-   if (args->timeout != NULL) {
-   error = copyin(args->timeout, , 
sizeof(timeout));
-   if (error) {
-   LIN_SDT_PROBE1(futex, linux_sys_futex, 
copyin_error,
-   error);
-   LIN_SDT_PROBE1(futex, linux_sys_futex, return, 
error);
-   futex_put(f, wp);
-   return (error);
-   }
-   TIMESPEC_TO_TIMEVAL(, );
-   error = itimerfix();
-   if (error) {
-   LIN_SDT_PROBE1(futex, linux_sys_futex, 
itimerfix_error,
-   error);
-   LIN_SDT_PROBE1(futex, linux_sys_futex, return, 
error);
-   futex_put(f, wp);
-   return (error);
-   }
-   if (clockrt) {
-   microtime();
-   timevalsub(, );
-   } else if (args->op == LINUX_FUTEX_WAIT_BITSET) {
-   microuptime();
-   timevalsub(, );
-   }
-   if (utv.tv_sec < 0)
-   timevalclear();
-   timeout_hz = tvtohz();
-   } else
-   timeout_hz = 0;
-
error = futex_wait(f, wp, timeout_hz, args->val3);
break;
 

Modified: stable/10/sys/compat/linux/linux_misc.c

svn commit: r293566 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 17:12:45 2016
New Revision: 293566
URL: https://svnweb.freebsd.org/changeset/base/293566

Log:
  MFC r283464:
  
  Delete the duplicate of linux_to_native_clockid() function.

Modified:
  stable/10/sys/compat/linux/linux_time.c
  stable/10/sys/compat/linux/linux_timer.c
  stable/10/sys/compat/linux/linux_timer.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_time.c
==
--- stable/10/sys/compat/linux/linux_time.c Sat Jan  9 17:11:25 2016
(r293565)
+++ stable/10/sys/compat/linux/linux_time.c Sat Jan  9 17:12:45 2016
(r293566)
@@ -120,8 +120,6 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_
 LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int");
 LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, return, "int");
 
-static int linux_to_native_clockid(clockid_t *, clockid_t);
-
 
 void
 native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp)
@@ -152,7 +150,7 @@ linux_to_native_timespec(struct timespec
return (0);
 }
 
-static int
+int
 linux_to_native_clockid(clockid_t *n, clockid_t l)
 {
 

Modified: stable/10/sys/compat/linux/linux_timer.c
==
--- stable/10/sys/compat/linux/linux_timer.cSat Jan  9 17:11:25 2016
(r293565)
+++ stable/10/sys/compat/linux/linux_timer.cSat Jan  9 17:12:45 2016
(r293566)
@@ -49,23 +49,6 @@ __FBSDID("$FreeBSD$");
 #endif
 #include 
 
-static int
-linux_convert_l_clockid(clockid_t *clock_id)
-{
-
-   switch (*clock_id) {
-   case LINUX_CLOCK_REALTIME:
-   *clock_id = CLOCK_REALTIME;
-   break;
-   case LINUX_CLOCK_MONOTONIC:
-   *clock_id = CLOCK_MONOTONIC;
-   break;
-   default:
-   return (EINVAL);
-   }
-
-   return (0);
-}
 
 static int
 linux_convert_l_sigevent(struct l_sigevent *l_sig, struct sigevent *sig)
@@ -106,6 +89,7 @@ linux_timer_create(struct thread *td, st
 {
struct l_sigevent l_ev;
struct sigevent ev, *evp;
+   clockid_t nwhich;
int error, id;
 
if (uap->evp == NULL) {
@@ -119,10 +103,10 @@ linux_timer_create(struct thread *td, st
return (error);
evp = 
}
-   error = linux_convert_l_clockid(>clock_id);
+   error = linux_to_native_clockid(, uap->clock_id);
if (error != 0)
return (error);
-   error = kern_ktimer_create(td, uap->clock_id, evp, , -1);
+   error = kern_ktimer_create(td, nwhich, evp, , -1);
if (error == 0) {
error = copyout(, uap->timerid, sizeof(int));
if (error != 0)
@@ -179,4 +163,3 @@ linux_timer_delete(struct thread *td, st
 
return (kern_ktimer_delete(td, uap->timerid));
 }
-

Modified: stable/10/sys/compat/linux/linux_timer.h
==
--- stable/10/sys/compat/linux/linux_timer.hSat Jan  9 17:11:25 2016
(r293565)
+++ stable/10/sys/compat/linux/linux_timer.hSat Jan  9 17:12:45 2016
(r293566)
@@ -115,5 +115,6 @@ void native_to_linux_timespec(struct l_t
 struct timespec *);
 int linux_to_native_timespec(struct timespec *,
 struct l_timespec *);
+int linux_to_native_clockid(clockid_t *, clockid_t);
 
 #endif /* _LINUX_TIMER_H */
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293569 - in stable/10/sys: amd64/linux amd64/linux32 i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 17:18:03 2016
New Revision: 293569
URL: https://svnweb.freebsd.org/changeset/base/293569

Log:
  MFC r283467:
  
  Call nosys in case when the incorrect syscall number is specified.
  
  Its my fault, fixed by mjg@ at r289055.

Modified:
  stable/10/sys/amd64/linux/linux_sysvec.c
  stable/10/sys/amd64/linux/syscalls.master
  stable/10/sys/amd64/linux32/linux32_sysvec.c
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/i386/linux/linux_sysvec.c
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux_sysvec.c
==
--- stable/10/sys/amd64/linux/linux_sysvec.cSat Jan  9 17:15:03 2016
(r293568)
+++ stable/10/sys/amd64/linux/linux_sysvec.cSat Jan  9 17:18:03 2016
(r293569)
@@ -254,10 +254,10 @@ linux_fetch_syscall_args(struct thread *
sa->args[5] = frame->tf_r9;
sa->code = frame->tf_rax;
 
-   if (sa->code >= p->p_sysent->sv_size) {
-   PROC_LOCK(p);
-   sigexit(td, SIGILL);
-   } else
+   if (sa->code >= p->p_sysent->sv_size)
+   /* nosys */
+   sa->callp = >p_sysent->sv_table[LINUX_SYS_MAXSYSCALL];
+   else
sa->callp = >p_sysent->sv_table[sa->code];
sa->narg = sa->callp->sy_narg;
 

Modified: stable/10/sys/amd64/linux/syscalls.master
==
--- stable/10/sys/amd64/linux/syscalls.master   Sat Jan  9 17:15:03 2016
(r293568)
+++ stable/10/sys/amd64/linux/syscalls.master   Sat Jan  9 17:18:03 2016
(r293569)
@@ -506,3 +506,5 @@
 310AUE_NULLSTD { int linux_process_vm_writev(void); }
 311AUE_NULLSTD { int linux_kcmp(void); }
 312AUE_NULLSTD { int linux_finit_module(void); }
+; please, keep this line at the end.
+313AUE_NULLUNIMPL  nosys

Modified: stable/10/sys/amd64/linux32/linux32_sysvec.c
==
--- stable/10/sys/amd64/linux32/linux32_sysvec.cSat Jan  9 17:15:03 
2016(r293568)
+++ stable/10/sys/amd64/linux32/linux32_sysvec.cSat Jan  9 17:18:03 
2016(r293569)
@@ -764,7 +764,8 @@ linux32_fetch_syscall_args(struct thread
sa->code = frame->tf_rax;
 
if (sa->code >= p->p_sysent->sv_size)
-   sa->callp = >p_sysent->sv_table[0];
+   /* nosys */
+   sa->callp = >p_sysent->sv_table[LINUX_SYS_MAXSYSCALL];
else
sa->callp = >p_sysent->sv_table[sa->code];
sa->narg = sa->callp->sy_narg;

Modified: stable/10/sys/amd64/linux32/syscalls.master
==
--- stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 17:15:03 2016
(r293568)
+++ stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 17:18:03 2016
(r293569)
@@ -575,3 +575,5 @@
 346AUE_NULLSTD { int linux_setns(void); }
 347AUE_NULLSTD { int linux_process_vm_readv(void); }
 348AUE_NULLSTD { int linux_process_vm_writev(void); }
+; please, keep this line at the end.
+349AUE_NULLUNIMPL  nosys

Modified: stable/10/sys/i386/linux/linux_sysvec.c
==
--- stable/10/sys/i386/linux/linux_sysvec.c Sat Jan  9 17:15:03 2016
(r293568)
+++ stable/10/sys/i386/linux/linux_sysvec.c Sat Jan  9 17:18:03 2016
(r293569)
@@ -890,7 +890,8 @@ linux_fetch_syscall_args(struct thread *
sa->args[5] = frame->tf_ebp;/* Unconfirmed */
 
if (sa->code >= p->p_sysent->sv_size)
-   sa->callp = >p_sysent->sv_table[0];
+   /* nosys */
+   sa->callp = >p_sysent->sv_table[LINUX_SYS_MAXSYSCALL];
else
sa->callp = >p_sysent->sv_table[sa->code];
sa->narg = sa->callp->sy_narg;

Modified: stable/10/sys/i386/linux/syscalls.master
==
--- stable/10/sys/i386/linux/syscalls.masterSat Jan  9 17:15:03 2016
(r293568)
+++ stable/10/sys/i386/linux/syscalls.masterSat Jan  9 17:18:03 2016
(r293569)
@@ -583,3 +583,5 @@
 346AUE_NULLSTD { int linux_setns(void); }
 347AUE_NULLSTD { int linux_process_vm_readv(void); }
 348AUE_NULLSTD { int linux_process_vm_writev(void); }
+; please, keep this line at the end.
+349AUE_NULLUNIMPL  nosys
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293573 - stable/10/sys/compat/linprocfs

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 17:23:57 2016
New Revision: 293573
URL: https://svnweb.freebsd.org/changeset/base/293573

Log:
  MFC r283472:
  
  Add vdso and stack names to the /proc/self/maps.

Modified:
  stable/10/sys/compat/linprocfs/linprocfs.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linprocfs/linprocfs.c
==
--- stable/10/sys/compat/linprocfs/linprocfs.c  Sat Jan  9 17:22:51 2016
(r293572)
+++ stable/10/sys/compat/linprocfs/linprocfs.c  Sat Jan  9 17:23:57 2016
(r293573)
@@ -961,6 +961,8 @@ linprocfs_doprocenviron(PFS_FILL_ARGS)
 
 static char l32_map_str[] = "%08lx-%08lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n";
 static char l64_map_str[] = "%016lx-%016lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n";
+static char vdso_str[] = "  [vdso]";
+static char stack_str[] = "  [stack]";
 
 /*
  * Filler function for proc/pid/maps
@@ -997,6 +999,11 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
vm = vmspace_acquire_ref(p);
if (vm == NULL)
return (ESRCH);
+
+   if (SV_CURPROC_FLAG(SV_LP64))
+   l_map_str = l64_map_str;
+   else
+   l_map_str = l32_map_str;
map = >vm_map;
vm_map_lock_read(map);
for (entry = map->header.next; entry != >header;
@@ -1035,6 +1042,11 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
VOP_GETATTR(vp, , td->td_ucred);
ino = vat.va_fileid;
vput(vp);
+   } else if (SV_PROC_ABI(p) == SV_ABI_LINUX) {
+   if (e_start == p->p_sysent->sv_shared_page_base)
+   name = vdso_str;
+   if (e_end == p->p_sysent->sv_usrstack)
+   name = stack_str;
}
} else {
flags = 0;
@@ -1046,10 +1058,6 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 * format:
 *  start, end, access, offset, major, minor, inode, name.
 */
-   if (SV_CURPROC_FLAG(SV_LP64))
-   l_map_str = l64_map_str;
-   else
-   l_map_str = l32_map_str;
error = sbuf_printf(sb, l_map_str,
(u_long)e_start, (u_long)e_end,
(e_prot & VM_PROT_READ)?"r":"-",
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293601 - stable/10/sys/conf

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 18:09:07 2016
New Revision: 293601
URL: https://svnweb.freebsd.org/changeset/base/293601

Log:
  MFC r283569 (by nyan):
  
  MFi386: r283407
Implement vdso - virtual dynamic shared object.
  
  MFi386: r283474
Rework signal code to allow using it by other modules, like linprocfs.
  
  MFi386: r283506
For objcopy, use --input-target and --output-target.
  
  This fixes pc98 build.

Modified:
  stable/10/sys/conf/files.pc98
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/files.pc98
==
--- stable/10/sys/conf/files.pc98   Sat Jan  9 18:07:48 2016
(r293600)
+++ stable/10/sys/conf/files.pc98   Sat Jan  9 18:09:07 2016
(r293601)
@@ -21,6 +21,18 @@ linux_assym.hoptional
compat_linux\
no-obj no-implicit-rule before-depend   \
clean   "linux_assym.h"
 #
+linux_locore.o optionalcompat_linux\
+   dependency  "linux_assym.h $S/i386/linux/linux_locore.s"\
+   compile-with"${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe 
-I. -I$S -Werror -Wall -fno-common -nostdinc -nostdlib 
-Wl,-T$S/i386/linux/linux_vdso.lds.s 
-Wl,-soname=linux_vdso.so,--eh-frame-hdr,-fPIC,-warn-common ${.IMPSRC} -o 
${.TARGET}" \
+   no-obj no-implicit-rule \
+   clean   "linux_locore.o"
+#
+linux_vdso.so  optionalcompat_linux\
+   dependency  "linux_locore.o"\
+   compile-with"${OBJCOPY} --input-target binary --output-target 
elf32-i386-freebsd --binary-architecture i386 linux_locore.o ${.TARGET}" \
+   no-implicit-rule\
+   clean   "linux_vdso.so"
+#
 svr4_genassym.ooptionalcompat_svr4 
\
dependency  "$S/i386/svr4/svr4_genassym.c"  \
compile-with"${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}"\
@@ -59,6 +71,8 @@ compat/linux/linux_time.c optional compa
 compat/linux/linux_timer.c optional compat_linux
 compat/linux/linux_uid16.c optional compat_linux
 compat/linux/linux_util.c  optional compat_linux
+compat/linux/linux_vdso.c  optional compat_linux
+compat/linux/linux.c   optional compat_linux
 compat/svr4/imgact_svr4.c  optional compat_svr4
 compat/svr4/svr4_fcntl.c   optional compat_svr4
 compat/svr4/svr4_filio.c   optional compat_svr4
@@ -193,8 +207,6 @@ i386/isa/pmtimer.c  optional pmtimer
 i386/isa/prof_machdep.coptional profiling-routine
 i386/linux/imgact_linux.c  optional compat_linux
 i386/linux/linux_dummy.c   optional compat_linux
-i386/linux/linux_locore.s  optional compat_linux   \
-   dependency  "linux_assym.h"
 i386/linux/linux_machdep.c optional compat_linux
 i386/linux/linux_ptrace.c  optional compat_linux
 i386/linux/linux_support.s optional compat_linux   \
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293604 - stable/10/sys/amd64/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 18:19:18 2016
New Revision: 293604
URL: https://svnweb.freebsd.org/changeset/base/293604

Log:
  MFC r284159:
  
  Futex is an aligned 32-bit integer. Use the proper instruction and
  operand when dereferencing futex pointer.

Modified:
  stable/10/sys/amd64/linux/linux_support.s
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux_support.s
==
--- stable/10/sys/amd64/linux/linux_support.s   Sat Jan  9 18:17:58 2016
(r293603)
+++ stable/10/sys/amd64/linux/linux_support.s   Sat Jan  9 18:19:18 2016
(r293604)
@@ -45,9 +45,9 @@ ENTRY(futex_xchgl)
movq$VM_MAXUSER_ADDRESS-4,%rax
cmpq%rax,%rsi
ja  futex_fault
-   xchgq   %rdi,(%rsi)
-   movq%rdi,(%rdx)
-   xorq%rax,%rax
+   xchgl   %edi,(%rsi)
+   movl%edi,(%rdx)
+   xorl%eax,%eax
movq%rax,PCB_ONFAULT(%r8)
ret
 
@@ -60,9 +60,9 @@ ENTRY(futex_addl)
 #ifdef SMP
lock
 #endif
-   xaddq   %rdi,(%rsi)
-   movq%rdi,(%rdx)
-   xorq%rax,%rax
+   xaddl   %edi,(%rsi)
+   movl%edi,(%rdx)
+   xorl%eax,%eax
movq%rax,PCB_ONFAULT(%r8)
ret
 
@@ -72,16 +72,16 @@ ENTRY(futex_orl)
movq$VM_MAXUSER_ADDRESS-4,%rax
cmpq%rax,%rsi
ja  futex_fault
-   movq(%rsi),%rax
-1: movq%rax,%rcx
-   orq %rdi,%rcx
+   movl(%rsi),%eax
+1: movl%eax,%ecx
+   orl %edi,%ecx
 #ifdef SMP
lock
 #endif
-   cmpxchgq %rcx,(%rsi)
+   cmpxchgl %ecx,(%rsi)
jnz 1b
-   movq%rax,(%rdx)
-   xorq%rax,%rax
+   movl%eax,(%rdx)
+   xorl%eax,%eax
movq%rax,PCB_ONFAULT(%r8)
ret
 
@@ -91,16 +91,16 @@ ENTRY(futex_andl)
movq$VM_MAXUSER_ADDRESS-4,%rax
cmpq%rax,%rsi
ja  futex_fault
-   movq(%rsi),%rax
-1: movq%rax,%rcx
-   andq%rdi,%rcx
+   movl(%rsi),%eax
+1: movl%eax,%ecx
+   andl%edi,%ecx
 #ifdef SMP
lock
 #endif
-   cmpxchgq %rcx,(%rsi)
+   cmpxchgl %ecx,(%rsi)
jnz 1b
-   movq%rax,(%rdx)
-   xorq%rax,%rax
+   movl%eax,(%rdx)
+   xorl%eax,%eax
movq%rax,PCB_ONFAULT(%r8)
ret
 
@@ -110,15 +110,15 @@ ENTRY(futex_xorl)
movq$VM_MAXUSER_ADDRESS-4,%rax
cmpq%rax,%rsi
ja  futex_fault
-   movq(%rsi),%rax
-1: movq%rax,%rcx
-   xorq%rdi,%rcx
+   movl(%rsi),%eax
+1: movl%eax,%ecx
+   xorl%edi,%ecx
 #ifdef SMP
lock
 #endif
-   cmpxchgq %rcx,(%rsi)
+   cmpxchgl %ecx,(%rsi)
jnz 1b
-   movq%rax,(%rdx)
-   xorq%rax,%rax
+   movl%eax,(%rdx)
+   xorl%eax,%eax
movq%rax,PCB_ONFAULT(%r8)
ret
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293515 - in stable/10/sys: amd64/linux32 i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:46:05 2016
New Revision: 293515
URL: https://svnweb.freebsd.org/changeset/base/293515

Log:
  MFC r283408:
  
  Eliminate a now unused global declaration of elf_linux_sysvec.

Modified:
  stable/10/sys/amd64/linux32/linux.h
  stable/10/sys/i386/linux/linux.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/linux.h
==
--- stable/10/sys/amd64/linux32/linux.h Sat Jan  9 15:44:38 2016
(r293514)
+++ stable/10/sys/amd64/linux32/linux.h Sat Jan  9 15:46:05 2016
(r293515)
@@ -523,8 +523,6 @@ struct l_rt_sigframe {
l_handler_t sf_handler;
 } __packed;
 
-extern struct sysentvec elf_linux_sysvec;
-
 /*
  * open/fcntl flags
  */

Modified: stable/10/sys/i386/linux/linux.h
==
--- stable/10/sys/i386/linux/linux.hSat Jan  9 15:44:38 2016
(r293514)
+++ stable/10/sys/i386/linux/linux.hSat Jan  9 15:46:05 2016
(r293515)
@@ -499,7 +499,6 @@ struct l_rt_sigframe {
 };
 
 extern struct sysentvec linux_sysvec;
-extern struct sysentvec elf_linux_sysvec;
 
 /*
  * open/fcntl flags
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293517 - in stable/10/sys: amd64/linux32 i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:49:42 2016
New Revision: 293517
URL: https://svnweb.freebsd.org/changeset/base/293517

Log:
  MFC r283411:
  
  Remove stale comment about a signal trampoline which
  is moved to the shared page at r219609.

Modified:
  stable/10/sys/amd64/linux32/linux32_sysvec.c
  stable/10/sys/i386/linux/linux_sysvec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux32/linux32_sysvec.c
==
--- stable/10/sys/amd64/linux32/linux32_sysvec.cSat Jan  9 15:48:11 
2016(r293516)
+++ stable/10/sys/amd64/linux32/linux32_sysvec.cSat Jan  9 15:49:42 
2016(r293517)
@@ -879,7 +879,6 @@ linux_copyout_strings(struct image_param
 
/*
 * Calculate string base and vector table pointers.
-* Also deal with signal trampoline code for this exec type.
 */
arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS;
destp = (caddr_t)arginfo - SPARE_USRSPACE -

Modified: stable/10/sys/i386/linux/linux_sysvec.c
==
--- stable/10/sys/i386/linux/linux_sysvec.c Sat Jan  9 15:48:11 2016
(r293516)
+++ stable/10/sys/i386/linux/linux_sysvec.c Sat Jan  9 15:49:42 2016
(r293517)
@@ -320,7 +320,6 @@ linux_copyout_strings(struct image_param
 
/*
 * Calculate string base and vector table pointers.
-* Also deal with signal trampoline code for this exec type.
 */
p = imgp->proc;
arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293533 - in stable/10/sys: amd64/linux amd64/linux32 compat/linux i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 16:21:39 2016
New Revision: 293533
URL: https://svnweb.freebsd.org/changeset/base/293533

Log:
  MFC r283428:
  
  Change linux faccessat syscall definition to match actual linux one.
  
  The AT_EACCESS and AT_SYMLINK_NOFOLLOW flags are actually implemented
  within the glibc wrapper function for faccessat().  If either of these
  flags are specified, then the wrapper function employs fstatat() to
  determine access permissions.

Modified:
  stable/10/sys/amd64/linux/syscalls.master
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/compat/linux/linux_file.c
  stable/10/sys/i386/linux/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/syscalls.master
==
--- stable/10/sys/amd64/linux/syscalls.master   Sat Jan  9 16:20:29 2016
(r293532)
+++ stable/10/sys/amd64/linux/syscalls.master   Sat Jan  9 16:21:39 2016
(r293533)
@@ -450,7 +450,7 @@
 268AUE_FCHMODATSTD { int linux_fchmodat(l_int dfd, const char 
*filename, \
l_mode_t mode); }
 269AUE_FACCESSAT   STD { int linux_faccessat(l_int dfd, const char 
*filename, \
-   l_int amode, l_int flag); }
+   l_int amode); }
 270AUE_SELECT  STD { int linux_pselect6(l_int nfds,
\
l_fd_set *readfds, l_fd_set *writefds, 
l_fd_set *exceptfds, \
struct l_timespec *tsp, l_uintptr_t *sig); }

Modified: stable/10/sys/amd64/linux32/syscalls.master
==
--- stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 16:20:29 2016
(r293532)
+++ stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 16:21:39 2016
(r293533)
@@ -507,7 +507,8 @@
char *buf, l_int bufsiz); }
 306AUE_FCHMODATSTD { int linux_fchmodat(l_int dfd, const char 
*filename, \
l_mode_t mode); }
-307AUE_FACCESSAT   STD { int linux_faccessat(l_int dfd, const char 
*filename, l_int amode, int flag); }
+307AUE_FACCESSAT   STD { int linux_faccessat(l_int dfd, const char 
*filename, \
+   l_int amode); }
 308AUE_SELECT  STD { int linux_pselect6(l_int nfds, l_fd_set 
*readfds, \
l_fd_set *writefds, l_fd_set 
*exceptfds,\
struct l_timespec *tsp, l_uintptr_t 
*sig); }

Modified: stable/10/sys/compat/linux/linux_file.c
==
--- stable/10/sys/compat/linux/linux_file.c Sat Jan  9 16:20:29 2016
(r293532)
+++ stable/10/sys/compat/linux/linux_file.c Sat Jan  9 16:21:39 2016
(r293533)
@@ -580,10 +580,8 @@ int
 linux_faccessat(struct thread *td, struct linux_faccessat_args *args)
 {
char *path;
-   int error, dfd, flag;
+   int error, dfd;
 
-   if (args->flag & ~LINUX_AT_EACCESS)
-   return (EINVAL);
/* linux convention */
if (args->amode & ~(F_OK | X_OK | W_OK | R_OK))
return (EINVAL);
@@ -596,8 +594,7 @@ linux_faccessat(struct thread *td, struc
printf(ARGS(access, "%s, %d"), path, args->amode);
 #endif
 
-   flag = (args->flag & LINUX_AT_EACCESS) == 0 ? 0 : AT_EACCESS;
-   error = kern_accessat(td, dfd, path, UIO_SYSSPACE, flag, args->amode);
+   error = kern_accessat(td, dfd, path, UIO_SYSSPACE, 0, args->amode);
LFREEPATH(path);
 
return (error);

Modified: stable/10/sys/i386/linux/syscalls.master
==
--- stable/10/sys/i386/linux/syscalls.masterSat Jan  9 16:20:29 2016
(r293532)
+++ stable/10/sys/i386/linux/syscalls.masterSat Jan  9 16:21:39 2016
(r293533)
@@ -515,7 +515,8 @@
char *buf, l_int bufsiz); }
 306AUE_FCHMODATSTD { int linux_fchmodat(l_int dfd, const char 
*filename, \
l_mode_t mode); }
-307AUE_FACCESSAT   STD { int linux_faccessat(l_int dfd, const char 
*filename, l_int amode, l_int flag); }
+307AUE_FACCESSAT   STD { int linux_faccessat(l_int dfd, const char 
*filename, \
+   l_int amode); }
 308AUE_SELECT  STD { int linux_pselect6(l_int nfds, l_fd_set 
*readfds, \
l_fd_set *writefds, l_fd_set 
*exceptfds,\
struct l_timespec *tsp, l_uintptr_t 
*sig); }
___
svn-src-stable-10@freebsd.org 

svn commit: r293550 - in stable/10/sys: amd64/linux amd64/linux32 i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 16:50:09 2016
New Revision: 293550
URL: https://svnweb.freebsd.org/changeset/base/293550

Log:
  Regen for r293549.

Modified:
  stable/10/sys/amd64/linux/linux_proto.h
  stable/10/sys/amd64/linux/linux_syscall.h
  stable/10/sys/amd64/linux/linux_syscalls.c
  stable/10/sys/amd64/linux/linux_sysent.c
  stable/10/sys/amd64/linux/linux_systrace_args.c
  stable/10/sys/amd64/linux32/linux32_proto.h
  stable/10/sys/amd64/linux32/linux32_syscall.h
  stable/10/sys/amd64/linux32/linux32_syscalls.c
  stable/10/sys/amd64/linux32/linux32_sysent.c
  stable/10/sys/amd64/linux32/linux32_systrace_args.c
  stable/10/sys/i386/linux/linux_proto.h
  stable/10/sys/i386/linux/linux_syscall.h
  stable/10/sys/i386/linux/linux_syscalls.c
  stable/10/sys/i386/linux/linux_sysent.c
  stable/10/sys/i386/linux/linux_systrace_args.c

Modified: stable/10/sys/amd64/linux/linux_proto.h
==
--- stable/10/sys/amd64/linux/linux_proto.h Sat Jan  9 16:48:50 2016
(r293549)
+++ stable/10/sys/amd64/linux/linux_proto.h Sat Jan  9 16:50:09 2016
(r293550)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293546 
2016-01-09 16:44:17Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293549 
2016-01-09 16:48:50Z dchagin 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -997,7 +997,7 @@ struct linux_timerfd_args {
register_t dummy;
 };
 struct linux_eventfd_args {
-   register_t dummy;
+   char initval_l_[PADL_(l_uint)]; l_uint initval; char 
initval_r_[PADR_(l_uint)];
 };
 struct linux_fallocate_args {
register_t dummy;
@@ -1018,7 +1018,8 @@ struct linux_signalfd4_args {
register_t dummy;
 };
 struct linux_eventfd2_args {
-   register_t dummy;
+   char initval_l_[PADL_(l_uint)]; l_uint initval; char 
initval_r_[PADR_(l_uint)];
+   char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
 };
 struct linux_epoll_create1_args {
char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];

Modified: stable/10/sys/amd64/linux/linux_syscall.h
==
--- stable/10/sys/amd64/linux/linux_syscall.h   Sat Jan  9 16:48:50 2016
(r293549)
+++ stable/10/sys/amd64/linux/linux_syscall.h   Sat Jan  9 16:50:09 2016
(r293550)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293546 
2016-01-09 16:44:17Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293549 
2016-01-09 16:48:50Z dchagin 
  */
 
 #defineLINUX_SYS_read  0

Modified: stable/10/sys/amd64/linux/linux_syscalls.c
==
--- stable/10/sys/amd64/linux/linux_syscalls.c  Sat Jan  9 16:48:50 2016
(r293549)
+++ stable/10/sys/amd64/linux/linux_syscalls.c  Sat Jan  9 16:50:09 2016
(r293550)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293546 
2016-01-09 16:44:17Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293549 
2016-01-09 16:48:50Z dchagin 
  */
 
 const char *linux_syscallnames[] = {

Modified: stable/10/sys/amd64/linux/linux_sysent.c
==
--- stable/10/sys/amd64/linux/linux_sysent.cSat Jan  9 16:48:50 2016
(r293549)
+++ stable/10/sys/amd64/linux/linux_sysent.cSat Jan  9 16:50:09 2016
(r293550)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293546 
2016-01-09 16:44:17Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293549 
2016-01-09 16:48:50Z dchagin 
  */
 
 #include 
@@ -302,13 +302,13 @@ struct sysent linux_sysent[] = {
{ AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, 
NULL, 0, 0, 0, SY_THR_STATIC }, /* 281 = linux_epoll_pwait */
{ 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC }, /* 282 = linux_signalfd */
{ 0, (sy_call_t *)linux_timerfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC 
},  /* 283 = linux_timerfd */
-   { 0, (sy_call_t *)linux_eventfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC 
},  /* 284 = linux_eventfd */
+   { AS(linux_eventfd_args), (sy_call_t *)linux_eventfd, AUE_NULL, NULL, 
0, 0, 0, SY_THR_STATIC }, /* 284 = linux_eventfd */
{ 0, (sy_call_t *)linux_fallocate, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 285 = linux_fallocate */
{ 0, (sy_call_t *)linux_timerfd_settime, 

svn commit: r293549 - in stable/10/sys: amd64/linux amd64/linux32 compat/linux i386/linux sys

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 16:48:50 2016
New Revision: 293549
URL: https://svnweb.freebsd.org/changeset/base/293549

Log:
  MFC r283444:
  
  Implement eventfd system call.

Modified:
  stable/10/sys/amd64/linux/linux_dummy.c
  stable/10/sys/amd64/linux/syscalls.master
  stable/10/sys/amd64/linux32/linux32_dummy.c
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/compat/linux/linux_event.c
  stable/10/sys/compat/linux/linux_event.h
  stable/10/sys/i386/linux/linux_dummy.c
  stable/10/sys/i386/linux/syscalls.master
  stable/10/sys/sys/file.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux_dummy.c
==
--- stable/10/sys/amd64/linux/linux_dummy.c Sat Jan  9 16:47:36 2016
(r293548)
+++ stable/10/sys/amd64/linux/linux_dummy.c Sat Jan  9 16:48:50 2016
(r293549)
@@ -103,12 +103,10 @@ DUMMY(utimensat);
 DUMMY(epoll_pwait);
 DUMMY(signalfd);
 DUMMY(timerfd);
-DUMMY(eventfd);
 DUMMY(fallocate);
 DUMMY(timerfd_settime);
 DUMMY(timerfd_gettime);
 DUMMY(signalfd4);
-DUMMY(eventfd2);
 DUMMY(inotify_init1);
 DUMMY(preadv);
 DUMMY(pwritev);

Modified: stable/10/sys/amd64/linux/syscalls.master
==
--- stable/10/sys/amd64/linux/syscalls.master   Sat Jan  9 16:47:36 2016
(r293548)
+++ stable/10/sys/amd64/linux/syscalls.master   Sat Jan  9 16:48:50 2016
(r293549)
@@ -472,14 +472,14 @@
 l_int maxevents, l_int timeout, 
l_sigset_t *mask); }
 282AUE_NULLSTD { int linux_signalfd(void); }
 283AUE_NULLSTD { int linux_timerfd(void); }
-284AUE_NULLSTD { int linux_eventfd(void); }
+284AUE_NULLSTD { int linux_eventfd(l_uint initval); }
 285AUE_NULLSTD { int linux_fallocate(void); }
 286AUE_NULLSTD { int linux_timerfd_settime(void); }
 287AUE_NULLSTD { int linux_timerfd_gettime(void); }
 288AUE_ACCEPT  STD { int linux_accept4(l_int s, l_uintptr_t addr, \
l_uintptr_t namelen, int flags); }
 289AUE_NULLSTD { int linux_signalfd4(void); }
-290AUE_NULLSTD { int linux_eventfd2(void); }
+290AUE_NULLSTD { int linux_eventfd2(l_uint initval, l_int 
flags); }
 291AUE_NULLSTD { int linux_epoll_create1(l_int flags); }
 292AUE_NULLSTD { int linux_dup3(l_int oldfd,   \
l_int newfd, l_int flags); }

Modified: stable/10/sys/amd64/linux32/linux32_dummy.c
==
--- stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan  9 16:47:36 2016
(r293548)
+++ stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan  9 16:48:50 2016
(r293549)
@@ -109,7 +109,6 @@ DUMMY(epoll_pwait);
 DUMMY(utimensat);
 DUMMY(signalfd);
 DUMMY(timerfd_create);
-DUMMY(eventfd);
 /* linux 2.6.23: */
 DUMMY(fallocate);
 /* linux 2.6.25: */
@@ -117,7 +116,6 @@ DUMMY(timerfd_settime);
 DUMMY(timerfd_gettime);
 /* linux 2.6.27: */
 DUMMY(signalfd4);
-DUMMY(eventfd2);
 DUMMY(inotify_init1);
 /* linux 2.6.30: */
 DUMMY(preadv);

Modified: stable/10/sys/amd64/linux32/syscalls.master
==
--- stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 16:47:36 2016
(r293548)
+++ stable/10/sys/amd64/linux32/syscalls.master Sat Jan  9 16:48:50 2016
(r293549)
@@ -535,7 +535,7 @@
 320AUE_NULLSTD { int linux_utimensat(void); }
 321AUE_NULLSTD { int linux_signalfd(void); }
 322AUE_NULLSTD { int linux_timerfd_create(void); }
-323AUE_NULLSTD { int linux_eventfd(void); }
+323AUE_NULLSTD { int linux_eventfd(l_uint initval); }
 ; linux 2.6.23:
 324AUE_NULLSTD { int linux_fallocate(void); }
 ; linux 2.6.25:
@@ -543,7 +543,7 @@
 326AUE_NULLSTD { int linux_timerfd_gettime(void); }
 ; linux 2.6.27:
 327AUE_NULLSTD { int linux_signalfd4(void); }
-328AUE_NULLSTD { int linux_eventfd2(void); }
+328AUE_NULLSTD { int linux_eventfd2(l_uint initval, l_int 
flags); }
 329AUE_NULLSTD { int linux_epoll_create1(l_int flags); }
 330AUE_NULLSTD { int linux_dup3(l_int oldfd,   \
l_int newfd, l_int flags); }

Modified: stable/10/sys/compat/linux/linux_event.c
==
--- stable/10/sys/compat/linux/linux_event.cSat Jan  9 16:47:36 2016
(r293548)
+++ stable/10/sys/compat/linux/linux_event.cSat Jan  9 16:48:50 2016
(r293549)
@@ -43,7 +43,9 @@ __FBSDID("$FreeBSD$");
 

svn commit: r293557 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 17:01:26 2016
New Revision: 293557
URL: https://svnweb.freebsd.org/changeset/base/293557

Log:
  MFC r283453:
  
  Remove the unnecessary cast.

Modified:
  stable/10/sys/compat/linux/linux_emul.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_emul.c
==
--- stable/10/sys/compat/linux/linux_emul.c Sat Jan  9 17:00:15 2016
(r293556)
+++ stable/10/sys/compat/linux/linux_emul.c Sat Jan  9 17:01:26 2016
(r293557)
@@ -265,7 +265,7 @@ linux_schedtail(struct thread *td)
child_set_tid = em->child_set_tid;
 
if (child_set_tid != NULL) {
-   error = copyout(>em_tid, (int *)child_set_tid,
+   error = copyout(>em_tid, child_set_tid,
sizeof(em->em_tid));
LINUX_CTR4(clone, "schedtail(%d) %p stored %d error %d",
td->td_tid, child_set_tid, em->em_tid, error);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293564 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 17:10:22 2016
New Revision: 293564
URL: https://svnweb.freebsd.org/changeset/base/293564

Log:
  MFC r283462:
  
  Add prototypes for static futex functions.

Modified:
  stable/10/sys/compat/linux/linux_futex.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_futex.c
==
--- stable/10/sys/compat/linux/linux_futex.cSat Jan  9 17:08:33 2016
(r293563)
+++ stable/10/sys/compat/linux/linux_futex.cSat Jan  9 17:10:22 2016
(r293564)
@@ -247,6 +247,21 @@ struct mtx futex_mtx;  /* protects the 
 * wp_list to prevent double wakeup.
 */
 
+static void futex_put(struct futex *, struct waiting_proc *);
+static int futex_get0(uint32_t *, struct futex **f, uint32_t);
+static int futex_get(uint32_t *, struct waiting_proc **, struct futex **,
+uint32_t);
+static int futex_sleep(struct futex *, struct waiting_proc *, int);
+static int futex_wake(struct futex *, int, uint32_t);
+static int futex_requeue(struct futex *, int, struct futex *, int);
+static int futex_wait(struct futex *, struct waiting_proc *, int,
+uint32_t);
+static int futex_atomic_op(struct thread *, int, uint32_t *);
+static int handle_futex_death(struct linux_emuldata *, uint32_t *,
+unsigned int);
+static int fetch_robust_entry(struct linux_robust_list **,
+struct linux_robust_list **, unsigned int *);
+
 /* support.s */
 int futex_xchgl(int oparg, uint32_t *uaddr, int *oldval);
 int futex_addl(int oparg, uint32_t *uaddr, int *oldval);
@@ -254,6 +269,7 @@ int futex_orl(int oparg, uint32_t *uaddr
 int futex_andl(int oparg, uint32_t *uaddr, int *oldval);
 int futex_xorl(int oparg, uint32_t *uaddr, int *oldval);
 
+
 static void
 futex_put(struct futex *f, struct waiting_proc *wp)
 {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293606 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 18:23:34 2016
New Revision: 293606
URL: https://svnweb.freebsd.org/changeset/base/293606

Log:
  MFC r284626:
  
  Add EPOLLRDHUP support.

Modified:
  stable/10/sys/compat/linux/linux_event.c
  stable/10/sys/compat/linux/linux_event.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_event.c
==
--- stable/10/sys/compat/linux/linux_event.cSat Jan  9 18:22:09 2016
(r293605)
+++ stable/10/sys/compat/linux/linux_event.cSat Jan  9 18:23:34 2016
(r293606)
@@ -257,6 +257,8 @@ epoll_to_kevent(struct thread *td, struc
*kev_flags |= EV_CLEAR;
if ((levents & LINUX_EPOLLERR) != 0)
*kev_flags |= EV_ERROR;
+   if ((levents & LINUX_EPOLLRDHUP) != 0)
+   *kev_flags |= EV_EOF;
 
/* flags related to what event is registered */
if ((levents & LINUX_EPOLL_EVRD) != 0) {
@@ -306,6 +308,8 @@ kevent_to_epoll(struct kevent *kevent, s
switch (kevent->filter) {
case EVFILT_READ:
l_event->events = 
LINUX_EPOLLIN|LINUX_EPOLLRDNORM|LINUX_EPOLLPRI;
+   if ((kevent->flags & EV_EOF) != 0)
+   l_event->events |= LINUX_EPOLLRDHUP;
break;
case EVFILT_WRITE:
l_event->events = LINUX_EPOLLOUT|LINUX_EPOLLWRNORM;

Modified: stable/10/sys/compat/linux/linux_event.h
==
--- stable/10/sys/compat/linux/linux_event.hSat Jan  9 18:22:09 2016
(r293605)
+++ stable/10/sys/compat/linux/linux_event.hSat Jan  9 18:23:34 2016
(r293606)
@@ -49,7 +49,7 @@
|LINUX_EPOLLHUP|LINUX_EPOLLERR|LINUX_EPOLLPRI)
 #defineLINUX_EPOLL_EVWR(LINUX_EPOLLOUT|LINUX_EPOLLWRNORM)
 #defineLINUX_EPOLL_EVSUP   (LINUX_EPOLLET|LINUX_EPOLLONESHOT   
\
-   |LINUX_EPOLL_EVRD|LINUX_EPOLL_EVWR)
+   |LINUX_EPOLL_EVRD|LINUX_EPOLL_EVWR|LINUX_EPOLLRDHUP)
 
 #defineLINUX_EPOLL_CTL_ADD 1
 #defineLINUX_EPOLL_CTL_DEL 2
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293610 - stable/10/sys/sys

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 18:40:20 2016
New Revision: 293610
URL: https://svnweb.freebsd.org/changeset/base/293610

Log:
  Bump __FreeBSD_version after Linux changes merge.

Modified:
  stable/10/sys/sys/param.h

Modified: stable/10/sys/sys/param.h
==
--- stable/10/sys/sys/param.h   Sat Jan  9 18:32:52 2016(r293609)
+++ stable/10/sys/sys/param.h   Sat Jan  9 18:40:20 2016(r293610)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1002506  /* Master, propagated to newvers */
+#define __FreeBSD_version 1002507  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293523 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:57:28 2016
New Revision: 293523
URL: https://svnweb.freebsd.org/changeset/base/293523

Log:
  MFC r283417:
  
  Add 64 bit support to the vdso.

Modified:
  stable/10/sys/compat/linux/linux_vdso.c
  stable/10/sys/compat/linux/linux_vdso.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_vdso.c
==
--- stable/10/sys/compat/linux/linux_vdso.c Sat Jan  9 15:56:01 2016
(r293522)
+++ stable/10/sys/compat/linux/linux_vdso.c Sat Jan  9 15:57:28 2016
(r293523)
@@ -29,7 +29,11 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_compat.h"
 
+#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
 #define__ELF_WORD_SIZE 32
+#else
+#define__ELF_WORD_SIZE 64
+#endif
 
 #include 
 #include 
@@ -135,7 +139,7 @@ __elfN(linux_vdso_fixup)(struct sysentve
 }
 
 void
-__elfN(linux_vdso_reloc)(struct sysentvec *sv, int vdso_adjust)
+__elfN(linux_vdso_reloc)(struct sysentvec *sv, long vdso_adjust)
 {
struct linux_vdso_sym *lsym;
Elf_Ehdr *ehdr;

Modified: stable/10/sys/compat/linux/linux_vdso.h
==
--- stable/10/sys/compat/linux/linux_vdso.h Sat Jan  9 15:56:01 2016
(r293522)
+++ stable/10/sys/compat/linux/linux_vdso.h Sat Jan  9 15:57:28 2016
(r293523)
@@ -41,7 +41,7 @@ struct linux_vdso_sym {
 vm_object_t __elfN(linux_shared_page_init)(char **);
 void   __elfN(linux_shared_page_fini)(vm_object_t);
 void   __elfN(linux_vdso_fixup)(struct sysentvec *);
-void   __elfN(linux_vdso_reloc)(struct sysentvec *, int);
+void   __elfN(linux_vdso_reloc)(struct sysentvec *, long);
 void   __elfN(linux_vdso_sym_init)(struct linux_vdso_sym *);
 
 #defineLINUX_VDSO_SYM_INTPTR(name) \
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293524 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 15:58:42 2016
New Revision: 293524
URL: https://svnweb.freebsd.org/changeset/base/293524

Log:
  MFC r283419:
  
  Fix compilation with -DDEBUG option.

Modified:
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/compat/linux/linux_signal.c
  stable/10/sys/compat/linux/linux_stats.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_misc.c
==
--- stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 15:57:28 2016
(r293523)
+++ stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 15:58:42 2016
(r293524)
@@ -993,7 +993,8 @@ linux_mknod(struct thread *td, struct li
 
 #ifdef DEBUG
if (ldebug(mknod))
-   printf(ARGS(mknod, "%s, %d, %d"), path, args->mode, args->dev);
+   printf(ARGS(mknod, "%s, %d, %ju"), path, args->mode,
+   (uintmax_t)args->dev);
 #endif
 
switch (args->mode & S_IFMT) {
@@ -1843,8 +1844,9 @@ linux_prctl(struct thread *td, struct li
 
 #ifdef DEBUG
if (ldebug(prctl))
-   printf(ARGS(prctl, "%d, %d, %d, %d, %d"), args->option,
-   args->arg2, args->arg3, args->arg4, args->arg5);
+   printf(ARGS(prctl, "%d, %ju, %ju, %ju, %ju"), args->option,
+   (uintmax_t)args->arg2, (uintmax_t)args->arg3,
+   (uintmax_t)args->arg4, (uintmax_t)args->arg5);
 #endif
 
switch (args->option) {

Modified: stable/10/sys/compat/linux/linux_signal.c
==
--- stable/10/sys/compat/linux/linux_signal.c   Sat Jan  9 15:57:28 2016
(r293523)
+++ stable/10/sys/compat/linux/linux_signal.c   Sat Jan  9 15:58:42 2016
(r293524)
@@ -468,8 +468,8 @@ linux_rt_sigtimedwait(struct thread *td,
 #ifdef DEBUG
if (ldebug(rt_sigtimedwait))
printf(LMSG("linux_rt_sigtimedwait: "
-   "incoming timeout (%d/%d)\n"),
-   ltv.tv_sec, ltv.tv_usec);
+   "incoming timeout (%jd/%jd)\n"),
+   (intmax_t)ltv.tv_sec, (intmax_t)ltv.tv_usec);
 #endif
tv.tv_sec = (long)ltv.tv_sec;
tv.tv_usec = (suseconds_t)ltv.tv_usec;

Modified: stable/10/sys/compat/linux/linux_stats.c
==
--- stable/10/sys/compat/linux/linux_stats.cSat Jan  9 15:57:28 2016
(r293523)
+++ stable/10/sys/compat/linux/linux_stats.cSat Jan  9 15:58:42 2016
(r293524)
@@ -496,7 +496,7 @@ linux_ustat(struct thread *td, struct li
 {
 #ifdef DEBUG
if (ldebug(ustat))
-   printf(ARGS(ustat, "%d, *"), args->dev);
+   printf(ARGS(ustat, "%ju, *"), (uintmax_t)args->dev);
 #endif
 
return (EOPNOTSUPP);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293534 - in stable/10/sys: amd64/linux amd64/linux32 i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 16:23:11 2016
New Revision: 293534
URL: https://svnweb.freebsd.org/changeset/base/293534

Log:
  Regen for r293533.

Modified:
  stable/10/sys/amd64/linux/linux_proto.h
  stable/10/sys/amd64/linux/linux_syscall.h
  stable/10/sys/amd64/linux/linux_syscalls.c
  stable/10/sys/amd64/linux/linux_sysent.c
  stable/10/sys/amd64/linux/linux_systrace_args.c
  stable/10/sys/amd64/linux32/linux32_proto.h
  stable/10/sys/amd64/linux32/linux32_syscall.h
  stable/10/sys/amd64/linux32/linux32_syscalls.c
  stable/10/sys/amd64/linux32/linux32_sysent.c
  stable/10/sys/amd64/linux32/linux32_systrace_args.c
  stable/10/sys/i386/linux/linux_proto.h
  stable/10/sys/i386/linux/linux_syscall.h
  stable/10/sys/i386/linux/linux_syscalls.c
  stable/10/sys/i386/linux/linux_sysent.c
  stable/10/sys/i386/linux/linux_systrace_args.c

Modified: stable/10/sys/amd64/linux/linux_proto.h
==
--- stable/10/sys/amd64/linux/linux_proto.h Sat Jan  9 16:21:39 2016
(r293533)
+++ stable/10/sys/amd64/linux/linux_proto.h Sat Jan  9 16:23:11 2016
(r293534)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 283424 
2015-05-24 16:07:11Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293533 
2016-01-09 16:21:39Z dchagin 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -935,7 +935,6 @@ struct linux_faccessat_args {
char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
char filename_l_[PADL_(const char *)]; const char * filename; char 
filename_r_[PADR_(const char *)];
char amode_l_[PADL_(l_int)]; l_int amode; char amode_r_[PADR_(l_int)];
-   char flag_l_[PADL_(l_int)]; l_int flag; char flag_r_[PADR_(l_int)];
 };
 struct linux_pselect6_args {
char nfds_l_[PADL_(l_int)]; l_int nfds; char nfds_r_[PADR_(l_int)];

Modified: stable/10/sys/amd64/linux/linux_syscall.h
==
--- stable/10/sys/amd64/linux/linux_syscall.h   Sat Jan  9 16:21:39 2016
(r293533)
+++ stable/10/sys/amd64/linux/linux_syscall.h   Sat Jan  9 16:23:11 2016
(r293534)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 283424 
2015-05-24 16:07:11Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293533 
2016-01-09 16:21:39Z dchagin 
  */
 
 #defineLINUX_SYS_read  0

Modified: stable/10/sys/amd64/linux/linux_syscalls.c
==
--- stable/10/sys/amd64/linux/linux_syscalls.c  Sat Jan  9 16:21:39 2016
(r293533)
+++ stable/10/sys/amd64/linux/linux_syscalls.c  Sat Jan  9 16:23:11 2016
(r293534)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 283424 
2015-05-24 16:07:11Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293533 
2016-01-09 16:21:39Z dchagin 
  */
 
 const char *linux_syscallnames[] = {

Modified: stable/10/sys/amd64/linux/linux_sysent.c
==
--- stable/10/sys/amd64/linux/linux_sysent.cSat Jan  9 16:21:39 2016
(r293533)
+++ stable/10/sys/amd64/linux/linux_sysent.cSat Jan  9 16:23:11 2016
(r293534)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 283424 
2015-05-24 16:07:11Z dchagin 
+ * created from FreeBSD: stable/10/sys/amd64/linux/syscalls.master 293533 
2016-01-09 16:21:39Z dchagin 
  */
 
 #include 

Modified: stable/10/sys/amd64/linux/linux_systrace_args.c
==
--- stable/10/sys/amd64/linux/linux_systrace_args.c Sat Jan  9 16:21:39 
2016(r293533)
+++ stable/10/sys/amd64/linux/linux_systrace_args.c Sat Jan  9 16:23:11 
2016(r293534)
@@ -1965,8 +1965,7 @@ systrace_args(int sysnum, void *params, 
iarg[0] = p->dfd; /* l_int */
uarg[1] = (intptr_t) p->filename; /* const char * */
iarg[2] = p->amode; /* l_int */
-   iarg[3] = p->flag; /* l_int */
-   *n_args = 4;
+   *n_args = 3;
break;
}
/* linux_pselect6 */
@@ -5181,9 +5180,6 @@ systrace_entry_setargdesc(int sysnum, in
case 2:
p = "l_int";
break;
-   case 3:
-   p = "l_int";
-   break;
default:
break;
};


svn commit: r293541 - in stable/10/sys: amd64/linux amd64/linux32 compat/linux i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 16:31:10 2016
New Revision: 293541
URL: https://svnweb.freebsd.org/changeset/base/293541

Log:
  MFC r283437:
  
  To avoid code duplication move open/fcntl definitions to the MI
  header file.

Modified:
  stable/10/sys/amd64/linux/linux.h
  stable/10/sys/amd64/linux32/linux.h
  stable/10/sys/compat/linux/linux_file.h
  stable/10/sys/compat/linux/linux_socket.c
  stable/10/sys/i386/linux/linux.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux.h
==
--- stable/10/sys/amd64/linux/linux.h   Sat Jan  9 16:29:51 2016
(r293540)
+++ stable/10/sys/amd64/linux/linux.h   Sat Jan  9 16:31:10 2016
(r293541)
@@ -407,44 +407,6 @@ struct l_rt_sigframe {
 };
 
 /*
- * open/fcntl flags
- */
-#defineLINUX_O_RDONLY  
-#defineLINUX_O_WRONLY  0001
-#defineLINUX_O_RDWR0002
-#defineLINUX_O_ACCMODE 0003
-#defineLINUX_O_CREAT   0100
-#defineLINUX_O_EXCL0200
-#defineLINUX_O_NOCTTY  0400
-#defineLINUX_O_TRUNC   1000
-#defineLINUX_O_APPEND  2000
-#defineLINUX_O_NONBLOCK4000
-#defineLINUX_O_NDELAY  LINUX_O_NONBLOCK
-#defineLINUX_O_SYNC0001
-#defineLINUX_FASYNC0002
-#defineLINUX_O_DIRECT  0004/* Direct disk access 
hint */
-#defineLINUX_O_LARGEFILE   0010
-#defineLINUX_O_DIRECTORY   0020/* Must be a directory 
*/
-#defineLINUX_O_NOFOLLOW0040/* Do not follow links 
*/
-#defineLINUX_O_NOATIME 0100
-#defineLINUX_O_CLOEXEC 0200
-
-#defineLINUX_F_DUPFD   0
-#defineLINUX_F_GETFD   1
-#defineLINUX_F_SETFD   2
-#defineLINUX_F_GETFL   3
-#defineLINUX_F_SETFL   4
-#defineLINUX_F_GETLK   5
-#defineLINUX_F_SETLK   6
-#defineLINUX_F_SETLKW  7
-#defineLINUX_F_SETOWN  8
-#defineLINUX_F_GETOWN  9
-
-#defineLINUX_F_RDLCK   0
-#defineLINUX_F_WRLCK   1
-#defineLINUX_F_UNLCK   2
-
-/*
  * mount flags
  */
 #defineLINUX_MS_RDONLY 0x0001

Modified: stable/10/sys/amd64/linux32/linux.h
==
--- stable/10/sys/amd64/linux32/linux.h Sat Jan  9 16:29:51 2016
(r293540)
+++ stable/10/sys/amd64/linux32/linux.h Sat Jan  9 16:31:10 2016
(r293541)
@@ -520,47 +520,12 @@ struct l_rt_sigframe {
 } __packed;
 
 /*
- * open/fcntl flags
+ * arch specific open/fcntl flags
  */
-#defineLINUX_O_RDONLY  
-#defineLINUX_O_WRONLY  0001
-#defineLINUX_O_RDWR0002
-#defineLINUX_O_ACCMODE 0003
-#defineLINUX_O_CREAT   0100
-#defineLINUX_O_EXCL0200
-#defineLINUX_O_NOCTTY  0400
-#defineLINUX_O_TRUNC   1000
-#defineLINUX_O_APPEND  2000
-#defineLINUX_O_NONBLOCK4000
-#defineLINUX_O_NDELAY  LINUX_O_NONBLOCK
-#defineLINUX_O_SYNC0001
-#defineLINUX_FASYNC0002
-#defineLINUX_O_DIRECT  0004/* Direct disk access 
hint */
-#defineLINUX_O_LARGEFILE   0010
-#defineLINUX_O_DIRECTORY   0020/* Must be a directory 
*/
-#defineLINUX_O_NOFOLLOW0040/* Do not follow links 
*/
-#defineLINUX_O_NOATIME 0100
-#defineLINUX_O_CLOEXEC 0200
-
-#defineLINUX_F_DUPFD   0
-#defineLINUX_F_GETFD   1
-#defineLINUX_F_SETFD   2
-#defineLINUX_F_GETFL   3
-#defineLINUX_F_SETFL   4
-#defineLINUX_F_GETLK   5
-#defineLINUX_F_SETLK   6
-#defineLINUX_F_SETLKW  7
-#defineLINUX_F_SETOWN  8
-#defineLINUX_F_GETOWN  9
-
 #defineLINUX_F_GETLK64 12
 #defineLINUX_F_SETLK64 13
 #defineLINUX_F_SETLKW6414
 
-#defineLINUX_F_RDLCK   0
-#defineLINUX_F_WRLCK   1
-#defineLINUX_F_UNLCK   2
-
 union l_semun {
l_int   val;
l_uintptr_t buf;

Modified: stable/10/sys/compat/linux/linux_file.h
==
--- stable/10/sys/compat/linux/linux_file.h Sat Jan  9 16:29:51 2016
(r293540)
+++ 

svn commit: r293542 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 16:32:35 2016
New Revision: 293542
URL: https://svnweb.freebsd.org/changeset/base/293542

Log:
  MFC r283438:
  
  Add several fcntl flags.

Modified:
  stable/10/sys/compat/linux/linux_file.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_file.h
==
--- stable/10/sys/compat/linux/linux_file.h Sat Jan  9 16:31:10 2016
(r293541)
+++ stable/10/sys/compat/linux/linux_file.h Sat Jan  9 16:32:35 2016
(r293542)
@@ -91,6 +91,33 @@
 #defineLINUX_F_SETOWN  8
 #defineLINUX_F_GETOWN  9
 #endif
+#ifndef LINUX_F_SETSIG
+#defineLINUX_F_SETSIG  10
+#defineLINUX_F_GETSIG  11
+#endif
+#ifndef LINUX_F_SETOWN_EX
+#defineLINUX_F_SETOWN_EX   15
+#defineLINUX_F_GETOWN_EX   16
+#defineLINUX_F_GETOWNER_UIDS   17
+#endif
+
+#defineLINUX_F_SPECIFIC_BASE   1024
+
+#defineLINUX_F_SETLEASE(LINUX_F_SPECIFIC_BASE + 0)
+#defineLINUX_F_GETLEASE(LINUX_F_SPECIFIC_BASE + 1)
+#defineLINUX_F_CANCELLK(LINUX_F_SPECIFIC_BASE + 5)
+#defineLINUX_F_DUPFD_CLOEXEC   (LINUX_F_SPECIFIC_BASE + 6)
+#defineLINUX_F_NOTIFY  (LINUX_F_SPECIFIC_BASE + 2)
+#defineLINUX_F_SETPIPE_SZ  (LINUX_F_SPECIFIC_BASE + 7)
+#defineLINUX_F_GETPIPE_SZ  (LINUX_F_SPECIFIC_BASE + 8)
+
+#defineLINUX_F_GETLKP  36
+#defineLINUX_F_SETLKP  37
+#defineLINUX_F_SETLKPW 38
+
+#defineLINUX_F_OWNER_TID   0
+#defineLINUX_F_OWNER_PID   1
+#defineLINUX_F_OWNER_PGRP  2
 
 #ifndef LINUX_F_RDLCK
 #defineLINUX_F_RDLCK   0
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293548 - in stable/10/sys: amd64/linux amd64/linux32 compat/linux i386/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 16:47:36 2016
New Revision: 293548
URL: https://svnweb.freebsd.org/changeset/base/293548

Log:
  MFC r283443:
  
  Put the correct value for the abi_nfdbits parameter of kern_select() for
  all supported Linuxulators.

Modified:
  stable/10/sys/amd64/linux/linux.h
  stable/10/sys/amd64/linux32/linux.h
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/compat/linux/linux_misc.h
  stable/10/sys/i386/linux/linux.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux.h
==
--- stable/10/sys/amd64/linux/linux.h   Sat Jan  9 16:45:54 2016
(r293547)
+++ stable/10/sys/amd64/linux/linux.h   Sat Jan  9 16:47:36 2016
(r293548)
@@ -82,6 +82,7 @@ typedef l_longl_time_t;
 typedef l_int  l_timer_t;
 typedef l_int  l_mqd_t;
 typedef l_size_t   l_socklen_t;
+typedefl_ulong l_fd_mask;
 
 typedef struct {
l_int   val[2];

Modified: stable/10/sys/amd64/linux32/linux.h
==
--- stable/10/sys/amd64/linux32/linux.h Sat Jan  9 16:45:54 2016
(r293547)
+++ stable/10/sys/amd64/linux32/linux.h Sat Jan  9 16:47:36 2016
(r293548)
@@ -95,6 +95,7 @@ typedef l_uintl_uid_t;
 typedef l_ushort   l_uid16_t;
 typedef l_int  l_timer_t;
 typedef l_int  l_mqd_t;
+typedefl_ulong l_fd_mask;
 
 typedef struct {
l_int   val[2];

Modified: stable/10/sys/compat/linux/linux_misc.c
==
--- stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 16:45:54 2016
(r293547)
+++ stable/10/sys/compat/linux/linux_misc.c Sat Jan  9 16:47:36 2016
(r293548)
@@ -532,7 +532,7 @@ linux_select(struct thread *td, struct l
tvp = NULL;
 
error = kern_select(td, args->nfds, args->readfds, args->writefds,
-   args->exceptfds, tvp, sizeof(l_int) * 8);
+   args->exceptfds, tvp, LINUX_NFDBITS);
 
 #ifdef DEBUG
if (ldebug(select))
@@ -2179,7 +2179,7 @@ linux_pselect6(struct thread *td, struct
tvp = NULL;
 
error = kern_pselect(td, args->nfds, args->readfds, args->writefds,
-   args->exceptfds, tvp, ssp, sizeof(l_int) * 8);
+   args->exceptfds, tvp, ssp, LINUX_NFDBITS);
 
if (error == 0 && args->tsp != NULL) {
if (td->td_retval[0] != 0) {

Modified: stable/10/sys/compat/linux/linux_misc.h
==
--- stable/10/sys/compat/linux/linux_misc.h Sat Jan  9 16:45:54 2016
(r293547)
+++ stable/10/sys/compat/linux/linux_misc.h Sat Jan  9 16:47:36 2016
(r293548)
@@ -33,6 +33,9 @@
 
 #include 
 
+   /* bits per mask */
+#defineLINUX_NFDBITS   sizeof(l_fd_mask) * 8
+
 /*
  * Miscellaneous
  */

Modified: stable/10/sys/i386/linux/linux.h
==
--- stable/10/sys/i386/linux/linux.hSat Jan  9 16:45:54 2016
(r293547)
+++ stable/10/sys/i386/linux/linux.hSat Jan  9 16:47:36 2016
(r293548)
@@ -89,6 +89,7 @@ typedef l_uintl_uid_t;
 typedef l_ushort   l_uid16_t;
 typedef l_int  l_timer_t;
 typedef l_int  l_mqd_t;
+typedefl_ulong l_fd_mask;
 
 typedef struct {
l_int   val[2];
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293552 - stable/10/sys/modules

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 16:55:44 2016
New Revision: 293552
URL: https://svnweb.freebsd.org/changeset/base/293552

Log:
  MFC r283448:
  
  Connect linux64 module to the build.

Modified:
  stable/10/sys/modules/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/modules/Makefile
==
--- stable/10/sys/modules/Makefile  Sat Jan  9 16:52:25 2016
(r293551)
+++ stable/10/sys/modules/Makefile  Sat Jan  9 16:55:44 2016
(r293552)
@@ -198,6 +198,7 @@ SUBDIR= \
${_linsysfs} \
${_linux} \
${_linux_common} \
+   ${_linux64} \
lmc \
lpt \
mac_biba \
@@ -801,6 +802,7 @@ _virtio=virtio
 .if ${MK_BHYVE} != "no" || defined(ALL_MODULES)
 _vmm=  vmm
 _linux_common= linux_common
+_linux64=  linux64
 .endif
 _vxge= vxge
 _x86bios=  x86bios
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293558 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 17:02:35 2016
New Revision: 293558
URL: https://svnweb.freebsd.org/changeset/base/293558

Log:
  MFC r283454:
  
  Avoid unnecessary em zeroing in non-exec path
  as it already zeroed by malloc with M_ZERO flag
  and move zeroing to the proper place in exec path.

Modified:
  stable/10/sys/compat/linux/linux_emul.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_emul.c
==
--- stable/10/sys/compat/linux/linux_emul.c Sat Jan  9 17:01:26 2016
(r293557)
+++ stable/10/sys/compat/linux/linux_emul.c Sat Jan  9 17:02:35 2016
(r293558)
@@ -89,8 +89,6 @@ linux_proc_init(struct thread *td, struc
if (newtd != NULL) {
/* non-exec call */
em = malloc(sizeof(*em), M_TEMP, M_WAITOK | M_ZERO);
-   em->pdeath_signal = 0;
-   em->robust_futexes = NULL;
if (flags & LINUX_CLONE_THREAD) {
LINUX_CTR1(proc_init, "thread newtd(%d)",
newtd->td_tid);
@@ -117,6 +115,11 @@ linux_proc_init(struct thread *td, struc
KASSERT(em != NULL, ("proc_init: emuldata not found in exec 
case.\n"));
 
em->em_tid = td->td_proc->p_pid;
+   em->flags = 0;
+   em->pdeath_signal = 0;
+   em->robust_futexes = NULL;
+   em->child_clear_tid = NULL;
+   em->child_set_tid = NULL;
 
 /* epoll should be destroyed in a case of exec. */
pem = pem_find(td->td_proc);
@@ -129,8 +132,6 @@ linux_proc_init(struct thread *td, struc
}
}
 
-   em->child_clear_tid = NULL;
-   em->child_set_tid = NULL;
 }
 
 void 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293594 - stable/10/sys/compat/linux

2016-01-09 Thread Dmitry Chagin
Author: dchagin
Date: Sat Jan  9 18:00:51 2016
New Revision: 293594
URL: https://svnweb.freebsd.org/changeset/base/293594

Log:
  MFC r283494:
  
  Fix an mbuf(9) leak in sendmsg() under failure condition and
  remove unneeded check for failed M_WAITOK allocation.

Modified:
  stable/10/sys/compat/linux/linux_socket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_socket.c
==
--- stable/10/sys/compat/linux/linux_socket.c   Sat Jan  9 17:56:04 2016
(r293593)
+++ stable/10/sys/compat/linux/linux_socket.c   Sat Jan  9 18:00:51 2016
(r293594)
@@ -1092,8 +1092,6 @@ linux_sendmsg_common(struct thread *td, 
error = ENOBUFS;
cmsg = malloc(CMSG_HDRSZ, M_LINUX, M_WAITOK|M_ZERO);
control = m_get(M_WAITOK, MT_CONTROL);
-   if (control == NULL)
-   goto bad;
 
do {
error = copyin(ptr_cmsg, _cmsg,
@@ -1165,6 +1163,7 @@ linux_sendmsg_common(struct thread *td, 
error = linux_sendit(td, s, , flags, control, UIO_USERSPACE);
 
 bad:
+   m_freem(control);
free(iov, M_IOV);
if (cmsg)
free(cmsg, M_LINUX);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


  1   2   >