From owner-svn-src-head@freebsd.org Fri Feb 24 19:22:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 702FECECEF4; Fri, 24 Feb 2017 19:22:19 +0000 (UTC) (envelope-from mmokhi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E1871A04; Fri, 24 Feb 2017 19:22:19 +0000 (UTC) (envelope-from mmokhi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1OJMI8b016097; Fri, 24 Feb 2017 19:22:18 GMT (envelope-from mmokhi@FreeBSD.org) Received: (from mmokhi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1OJMHmH016092; Fri, 24 Feb 2017 19:22:17 GMT (envelope-from mmokhi@FreeBSD.org) Message-Id: <201702241922.v1OJMHmH016092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmokhi set sender to mmokhi@FreeBSD.org using -f From: Mahdi Mokhtari Date: Fri, 24 Feb 2017 19:22:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314217 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2017 19:22:19 -0000 Author: mmokhi (ports committer) Date: Fri Feb 24 19:22:17 2017 New Revision: 314217 URL: https://svnweb.freebsd.org/changeset/base/314217 Log: Add linux_preadv() and linux_pwritev() syscalls to Linuxulator. Reviewed by: dchagin Approved by: dchagin, trasz (src committers) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D9722 Modified: head/sys/amd64/linux/linux_dummy.c head/sys/amd64/linux32/linux32_dummy.c head/sys/amd64/linux32/linux32_machdep.c head/sys/compat/linux/linux_file.c head/sys/i386/linux/linux_dummy.c Modified: head/sys/amd64/linux/linux_dummy.c ============================================================================== --- head/sys/amd64/linux/linux_dummy.c Fri Feb 24 18:56:00 2017 (r314216) +++ head/sys/amd64/linux/linux_dummy.c Fri Feb 24 19:22:17 2017 (r314217) @@ -110,9 +110,6 @@ DUMMY(timerfd_gettime); /* linux 2.6.27: */ DUMMY(signalfd4); DUMMY(inotify_init1); -/* linux 2.6.30: */ -DUMMY(preadv); -DUMMY(pwritev); /* linux 2.6.31: */ DUMMY(perf_event_open); /* linux 2.6.38: */ Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Fri Feb 24 18:56:00 2017 (r314216) +++ head/sys/amd64/linux32/linux32_dummy.c Fri Feb 24 19:22:17 2017 (r314217) @@ -110,9 +110,6 @@ DUMMY(timerfd_gettime); /* linux 2.6.27: */ DUMMY(signalfd4); DUMMY(inotify_init1); -/* linux 2.6.30: */ -DUMMY(preadv); -DUMMY(pwritev); /* linux 2.6.31: */ DUMMY(perf_event_open); /* linux 2.6.33: */ Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Fri Feb 24 18:56:00 2017 (r314216) +++ head/sys/amd64/linux32/linux32_machdep.c Fri Feb 24 19:22:17 2017 (r314217) @@ -241,6 +241,52 @@ linux_writev(struct thread *td, struct l return (error); } +int +linux_preadv(struct thread *td, struct linux_preadv_args *uap) +{ + struct uio *auio; + int error; + off_t offset; + + error = linux32_copyinuio((struct l_iovec32 *)uap->vec, + uap->vlen, &auio); + if (error) + return (error); + /* + * According http://man7.org/linux/man-pages/man2/preadv.2.html#NOTES + * pos_l and pos_h, respectively, contain the + * low order and high order 32 bits of offset. + */ + offset = (((off_t)uap->pos_h << (sizeof(offset) * 4)) << + (sizeof(offset) * 4)) | uap->pos_l; + error = kern_preadv(td, uap->fd, auio, offset); + free(auio, M_IOV); + return (error); +} + +int +linux_pwritev(struct thread *td, struct linux_pwritev_args *uap) +{ + struct uio *auio; + int error; + off_t offset; + + error = linux32_copyinuio((struct l_iovec32 *)uap->vec, + uap->vlen, &auio); + if (error) + return (error); + /* + * According http://man7.org/linux/man-pages/man2/pwritev.2.html#NOTES + * pos_l and pos_h, respectively, contain the + * low order and high order 32 bits of offset. + */ + offset = (((off_t)uap->pos_h << (sizeof(offset) * 4)) << + (sizeof(offset) * 4)) | uap->pos_l; + error = kern_pwritev(td, uap->fd, auio, offset); + free(auio, M_IOV); + return (error); +} + struct l_ipc_kludge { l_uintptr_t msgp; l_long msgtyp; Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Fri Feb 24 18:56:00 2017 (r314216) +++ head/sys/compat/linux/linux_file.c Fri Feb 24 19:22:17 2017 (r314217) @@ -1027,6 +1027,52 @@ linux_pwrite(struct thread *td, struct l return (kern_pwrite(td, uap->fd, uap->buf, uap->nbyte, uap->offset)); } +#if !(defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_preadv(struct thread *td, struct linux_preadv_args *uap) +{ + struct uio *auio; + int error; + off_t offset; + + error = copyinuio(uap->vec, uap->vlen, &auio); + if (error) + return (error); + /* + * According http://man7.org/linux/man-pages/man2/preadv.2.html#NOTES + * pos_l and pos_h, respectively, contain the + * low order and high order 32 bits of offset. + */ + offset = (((off_t)uap->pos_h << (sizeof(offset) * 4)) << + (sizeof(offset) * 4)) | uap->pos_l; + error = kern_preadv(td, uap->fd, auio, offset); + free(auio, M_IOV); + return (error); +} + +int +linux_pwritev(struct thread *td, struct linux_pwritev_args *uap) +{ + struct uio *auio; + int error; + off_t offset; + + error = copyinuio(uap->vec, uap->vlen, &auio); + if (error) + return (error); + /* + * According http://man7.org/linux/man-pages/man2/pwritev.2.html#NOTES + * pos_l and pos_h, respectively, contain the + * low order and high order 32 bits of offset. + */ + offset = (((off_t)uap->pos_h << (sizeof(offset) * 4)) << + (sizeof(offset) * 4)) | uap->pos_l; + error = kern_pwritev(td, uap->fd, auio, offset); + free(auio, M_IOV); + return (error); +} +#endif /* !(__amd64__ && COMPAT_LINUX32) */ + int linux_mount(struct thread *td, struct linux_mount_args *args) { Modified: head/sys/i386/linux/linux_dummy.c ============================================================================== --- head/sys/i386/linux/linux_dummy.c Fri Feb 24 18:56:00 2017 (r314216) +++ head/sys/i386/linux/linux_dummy.c Fri Feb 24 19:22:17 2017 (r314217) @@ -106,9 +106,6 @@ DUMMY(timerfd_gettime); /* linux 2.6.27: */ DUMMY(signalfd4); DUMMY(inotify_init1); -/* linux 2.6.30: */ -DUMMY(preadv); -DUMMY(pwritev); /* linux 2.6.31: */ DUMMY(perf_event_open); /* linux 2.6.33: */