p4-projects@freebsd.org
[Top] [All Lists]

PERFORCE change 71264 for review

Subject: PERFORCE change 71264 for review
From: Peter Wemm
Date: Fri, 18 Feb 2005 20:29:18 GMT
http://perforce.freebsd.org/chv.cgi?CH=71264

Change 71264 by peter@peter_daintree on 2005/02/18 20:28:23

        IFC @71263

Affected files ...

.. //depot/projects/hammer/lib/libpthread/thread/thr_init.c#20 integrate
.. //depot/projects/hammer/share/man/man4/cpufreq.4#2 integrate
.. //depot/projects/hammer/sys/alpha/linux/linux_machdep.c#11 integrate
.. //depot/projects/hammer/sys/alpha/osf1/osf1_misc.c#15 integrate
.. //depot/projects/hammer/sys/alpha/osf1/osf1_mount.c#9 integrate
.. //depot/projects/hammer/sys/alpha/osf1/osf1_util.h#3 integrate
.. //depot/projects/hammer/sys/amd64/linux32/linux32_machdep.c#5 integrate
.. //depot/projects/hammer/sys/amd64/linux32/linux32_sysvec.c#4 integrate
.. //depot/projects/hammer/sys/arm/arm/cpufunc.c#7 integrate
.. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_misc.c#21 integrate
.. //depot/projects/hammer/sys/compat/ndis/pe_var.h#9 integrate
.. //depot/projects/hammer/sys/compat/ndis/subr_ndis.c#24 integrate
.. //depot/projects/hammer/sys/compat/ndis/subr_pe.c#7 integrate
.. //depot/projects/hammer/sys/compat/ndis/winx64_wrap.S#2 integrate
.. //depot/projects/hammer/sys/dev/acpica/acpi_perf.c#3 integrate
.. //depot/projects/hammer/sys/dev/acpica/acpi_throttle.c#3 integrate
.. //depot/projects/hammer/sys/dev/cpufreq/ichss.c#3 integrate
.. //depot/projects/hammer/sys/dev/pccard/pccard_cis.c#10 integrate
.. //depot/projects/hammer/sys/dev/pci/pci_pci.c#12 integrate
.. //depot/projects/hammer/sys/fs/udf/udf.h#8 integrate
.. //depot/projects/hammer/sys/fs/udf/udf_vfsops.c#17 integrate
.. //depot/projects/hammer/sys/isofs/cd9660/cd9660_vfsops.c#26 integrate
.. //depot/projects/hammer/sys/kern/cpufreq_if.m#2 integrate
.. //depot/projects/hammer/sys/kern/kern_cpu.c#3 integrate
.. //depot/projects/hammer/sys/kern/uipc_accf.c#6 integrate
.. //depot/projects/hammer/sys/kern/uipc_socket.c#51 integrate
.. //depot/projects/hammer/sys/kern/uipc_syscalls.c#44 integrate
.. //depot/projects/hammer/sys/kern/vfs_subr.c#74 integrate
.. //depot/projects/hammer/sys/netatalk/ddp_usrreq.c#14 integrate
.. //depot/projects/hammer/sys/netinet/tcp_input.c#45 integrate
.. //depot/projects/hammer/sys/netinet/tcp_sack.c#8 integrate
.. //depot/projects/hammer/sys/netinet/tcp_var.h#24 integrate
.. //depot/projects/hammer/sys/sparc64/include/pmap.h#17 integrate
.. //depot/projects/hammer/sys/sys/socketvar.h#26 integrate
.. //depot/projects/hammer/sys/sys/syslimits.h#9 integrate
.. //depot/projects/hammer/usr.bin/make/var.c#20 integrate
.. //depot/projects/hammer/usr.bin/tar/bsdtar.1#15 integrate
.. //depot/projects/hammer/usr.sbin/acpi/acpidump/acpidump.h#11 integrate

Differences ...

==== //depot/projects/hammer/lib/libpthread/thread/thr_init.c#20 (text+ko) ====

@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libpthread/thread/thr_init.c,v 1.69 2005/02/15 15:02:11 
deischen Exp $
+ * $FreeBSD: src/lib/libpthread/thread/thr_init.c,v 1.70 2005/02/18 16:07:05 
deischen Exp $
  */
 
 /* Allocate space for global thread variables here: */
@@ -421,7 +421,7 @@
                mib[1] = KERN_CLOCKRATE;
                len = sizeof (struct clockinfo);
                if (sysctl(mib, 2, &clockinfo, &len, NULL, 0) == 0)
-                       _clock_res_usec = clockinfo.tick;
+                       _clock_res_usec = 1000000 / clockinfo.stathz;
                else
                        _clock_res_usec = CLOCK_RES_USEC;
 

==== //depot/projects/hammer/share/man/man4/cpufreq.4#2 (text+ko) ====

@@ -22,9 +22,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/cpufreq.4,v 1.3 2005/02/14 18:17:47 njl Exp $
+.\" $FreeBSD: src/share/man/man4/cpufreq.4,v 1.4 2005/02/18 00:28:52 njl Exp $
 .\"
-.Dd February 14, 2005
+.Dd February 17, 2005
 .Dt CPUFREQ 4
 .Os
 .Sh NAME
@@ -45,9 +45,10 @@
 .Fa "device_t dev"
 .Fa "struct cf_setting *sets"
 .Fa "int *count"
-.Fa "int *type"
 .Fc
 .Ft int
+.Fn cpufreq_drv_type "device_t dev" "int *type"
+.Ft int
 .Fn cpufreq_drv_set "device_t dev" "const struct cf_setting *set"
 .Ft int
 .Fn cpufreq_drv_get "device_t dev" "struct cf_setting *set"
@@ -182,8 +183,9 @@
 their individual settings through the
 .Nm
 driver interface.
-This involves implementing three methods:
+This involves implementing these methods:
 .Fn cpufreq_drv_settings ,
+.Fn cpufreq_drv_type ,
 .Fn cpufreq_drv_set ,
 and
 .Fn cpufreq_drv_get .
@@ -218,12 +220,19 @@
 .Fa count
 will allow, it should return
 .Er E2BIG .
-The driver sets
-.Fa type
-to the type of settings it offers, either
+.Pp
+The
+.Fn cpufreq_drv_type
+method indicates the type of settings it offers, either
 .Dv CPUFREQ_TYPE_ABSOLUTE
 or
 .Dv CPUFREQ_TYPE_RELATIVE .
+Additionally, the driver may set the
+.Dv CPUFREQ_FLAG_INFO_ONLY
+flag if the settings it provides are information for other drivers only
+and cannot be passed to
+.Fn cpufreq_drv_set
+to activate them.
 .Pp
 The
 .Fn cpufreq_drv_set

==== //depot/projects/hammer/sys/alpha/linux/linux_machdep.c#11 (text+ko) ====

@@ -27,11 +27,13 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/linux/linux_machdep.c,v 1.35 2004/11/27 
06:51:32 das Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/linux/linux_machdep.c,v 1.36 2005/02/18 
18:32:32 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/imgact.h>
 #include <sys/lock.h>
+#include <sys/malloc.h>
 #include <sys/mman.h>
 #include <sys/mount.h>
 #include <sys/mutex.h>
@@ -64,20 +66,23 @@
 int
 linux_execve(struct thread *td, struct linux_execve_args *args)
 {
-       struct execve_args bsd;
-       caddr_t sg;
+       struct image_args eargs;
+       char *path;
+       int error;
 
-       sg = stackgap_init();
-       CHECKALTEXIST(td, &sg, args->path);
+       LCONVPATHEXIST(td, args->path, &path);
 
 #ifdef DEBUG
        if (ldebug(execve))
-               printf(ARGS(execve, "%s"), args->path);
+               printf(ARGS(execve, "%s"), path);
 #endif
-       bsd.fname = args->path;
-       bsd.argv = args->argp;
-       bsd.envv = args->envp;
-       return (execve(td, &bsd));
+       error = exec_copyin_args(&eargs, path, UIO_SYSSPACE, args->argp,
+           args->envp);
+       free(path, M_TEMP);
+       if (error == 0)
+               error = kern_execve(td, &eargs, NULL);
+       exec_free_args(&eargs);
+       return (error);
 }
 
 /*

==== //depot/projects/hammer/sys/alpha/osf1/osf1_misc.c#15 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/osf1/osf1_misc.c,v 1.52 2005/01/05 20:05:51 
imp Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/osf1/osf1_misc.c,v 1.53 2005/02/18 18:37:26 
jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -95,6 +95,7 @@
 static int  osf2bsd_pathconf(int *);
 
 static const char osf1_emul_path[] = "/compat/osf1";
+
 /*
  * [ taken from the linux emulator ]
  * Search an alternate path before passing pathname arguments on
@@ -105,133 +106,12 @@
  * be in exists.
  */
 int
-osf1_emul_find(td, sgp, prefix, path, pbuf, cflag)
-       struct thread   *td;
-       caddr_t         *sgp;          /* Pointer to stackgap memory */
-       const char      *prefix;
-       char            *path;
-       char            **pbuf;
-       int             cflag;
+osf1_emul_find(struct thread *td, char *path, enum uio_seg pathseg,
+    char **pbuf, int create)
 {
-        int                    error;
-        size_t                 len, sz;
-        char                   *buf, *cp, *ptr;
-       struct ucred            *ucred;
-        struct nameidata       nd;
-        struct nameidata       ndroot;
-        struct vattr           vat;
-        struct vattr           vatroot;
 
-       buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
-       *pbuf = path;
-
-       for (ptr = buf; (*ptr = *prefix) != '\0'; ptr++, prefix++)
-               continue;
-
-       sz = MAXPATHLEN - (ptr - buf);
-
-       /*
-        * If sgp is not given then the path is already in kernel space
-        */
-       if (sgp == NULL)
-               error = copystr(path, ptr, sz, &len);
-       else
-               error = copyinstr(path, ptr, sz, &len);
-
-       if (error) {
-               free(buf, M_TEMP);
-               return error;
-       }
-
-       if (*ptr != '/') {
-               free(buf, M_TEMP);
-               return EINVAL;
-       }
-
-       /*
-        *  We know that there is a / somewhere in this pathname.
-        *  Search backwards for it, to find the file's parent dir
-        *  to see if it exists in the alternate tree. If it does,
-        *  and we want to create a file (cflag is set). We don't
-        *  need to worry about the root comparison in this case.
-        */
-
-       if (cflag) {
-               for (cp = &ptr[len] - 1; *cp != '/'; cp--)
-                       ;
-               *cp = '\0';
-
-               NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, td);
-
-               if ((error = namei(&nd)) != 0) {
-                       free(buf, M_TEMP);
-                       return error;
-               }
-
-               *cp = '/';
-       } else {
-               NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, td);
-
-               if ((error = namei(&nd)) != 0) {
-                       free(buf, M_TEMP);
-                       return error;
-               }
-
-               /*
-                * We now compare the vnode of the osf1_root to the one
-                * vnode asked. If they resolve to be the same, then we
-                * ignore the match so that the real root gets used.
-                * This avoids the problem of traversing "../.." to find the
-                * root directory and never finding it, because "/" resolves
-                * to the emulation root directory. This is expensive :-(
-                */
-               NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, osf1_emul_path,
-                   td);
-
-               if ((error = namei(&ndroot)) != 0) {
-                       /* Cannot happen! */
-                       free(buf, M_TEMP);
-                       vrele(nd.ni_vp);
-                       return error;
-               }
-
-               ucred = td->td_ucred;
-               if ((error = VOP_GETATTR(nd.ni_vp, &vat, ucred, td)) != 0) {
-                       goto bad;
-               }
-
-               if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, ucred,
-                   td)) != 0) {
-                       goto bad;
-               }
-
-               if (vat.va_fsid == vatroot.va_fsid &&
-                   vat.va_fileid == vatroot.va_fileid) {
-                       error = ENOENT;
-                       goto bad;
-               }
-
-       }
-       if (sgp == NULL)
-               *pbuf = buf;
-       else {
-               sz = &ptr[len] - buf;
-               *pbuf = stackgap_alloc(sgp, sz + 1);
-               error = copyout(buf, *pbuf, sz);
-               free(buf, M_TEMP);
-       }
-
-       vrele(nd.ni_vp);
-       if (!cflag)
-               vrele(ndroot.ni_vp);
-
-       return error;
-
-bad:
-       vrele(ndroot.ni_vp);
-       vrele(nd.ni_vp);
-       free(buf, M_TEMP);
-       return error;
+       return (kern_alternate_path(td, osf1_emul_path, path, pathseg, pbuf,
+           create));
 }
 
 
@@ -240,21 +120,15 @@
        struct thread *td;
        struct osf1_open_args *uap;
 {
-       struct open_args /* {
-               syscallarg(char *) path;
-               syscallarg(int) flags;
-               syscallarg(int) mode;
-       } */ a;
-       caddr_t sg;
+       char *path;
+       int error;
 
-       sg = stackgap_init();
-       CHECKALTEXIST(td, &sg, uap->path);
+       CHECKALTEXIST(td, uap->path, &path);
 
-       a.path = uap->path;
-       a.flags = uap->flags;           /* XXX translate */
-       a.mode = uap->mode;
-
-       return open(td, &a);
+       /* XXX: translate flags */
+       error = kern_open(td, path, UIO_SYSSPACE, uap->flags, uap->mode);
+       free(path, M_TEMP);
+       return (error);
 }
 
 extern long totalphysmem;
@@ -608,22 +482,15 @@
        struct thread *td;
        struct osf1_stat_args *uap;
 {
-       int error;
        struct stat sb;
        struct osf1_stat osb;
-       struct nameidata nd;
-       caddr_t sg;
+       char *path;
+       int error;
 
-       sg = stackgap_init();
+       CHECKALTEXIST(td, uap->path, &path);
 
-       CHECKALTEXIST(td, &sg, uap->path);
-
-       NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
-           uap->path, td);
-       if ((error = namei(&nd)))
-               return (error);
-       error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td);
-       vput(nd.ni_vp);
+       error = kern_stat(td, path, UIO_SYSSPACE, &sb);
+       free(path, M_TEMP);
        if (error)
                return (error);
        cvtstat2osf1(&sb, &osb);
@@ -643,18 +510,13 @@
 {
        struct stat sb;
        struct osf1_stat osb;
+       char *path;
        int error;
-       struct nameidata nd;
-       caddr_t sg = stackgap_init();
 
-       CHECKALTEXIST(td, &sg, uap->path);
+       CHECKALTEXIST(td, uap->path, &path);
 
-       NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE,
-           uap->path, td);
-       if ((error = namei(&nd)))
-               return (error);
-       error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td);
-       vput(nd.ni_vp);
+       error = kern_lstat(td, path, UIO_SYSSPACE, &sb);
+       free(path, M_TEMP);
        if (error)
                return (error);
        cvtstat2osf1(&sb, &osb);
@@ -671,15 +533,13 @@
        struct thread *td;
        register struct osf1_fstat_args *uap;
 {
-       struct file *fp;
+       struct osf1_stat oub;
        struct stat ub;
-       struct osf1_stat oub;
        int error;
 
-       if ((error = fget(td, uap->fd, &fp)) != 0)
+       error = kern_fstat(td, uap->fd, &ub);
+       if (error)
                return (error);
-       error = fo_stat(fp, &ub, td->td_ucred, td);
-       fdrop(fp, td);
        cvtstat2osf1(&ub, &oub);
        if (error == 0)
                error = copyout((caddr_t)&oub, (caddr_t)uap->sb,
@@ -735,12 +595,13 @@
        struct thread *td;
        struct osf1_access_args *uap;
 {
-       caddr_t sg;
+       char *path;
+       int error;
 
-       sg = stackgap_init();
-       CHECKALTEXIST(td, &sg, uap->path);
-
-       return access(td, (struct access_args *)uap);
+       CHECKALTEXIST(td, uap->path, &path);
+       error = kern_access(td, path, UIO_SYSSPACE, uap->flags);
+       free(path, M_TEMP);
+       return (error);
 }
 
 
@@ -1239,17 +1100,13 @@
        struct thread *td;
        struct osf1_truncate_args *uap;
 {
-       caddr_t sg;
-       struct truncate_args a;
+       char *path;
+       int error;
 
-       sg = stackgap_init();
-        CHECKALTEXIST(td, &sg, uap->path);
-
-       a.path = uap->path;
-       a.pad = 0;
-       a.length = uap->length;
-
-       return truncate(td, &a);
+        CHECKALTEXIST(td, uap->path, &path);
+       error = kern_truncate(td, path, UIO_SYSSPACE, uap->length);
+       free(path, M_TEMP);
+       return (error);
 }
 
 
@@ -1309,11 +1166,15 @@
        struct thread *td;
        struct osf1_pathconf_args *uap;
 {
+       char *path;
+       int error;
 
        if (osf2bsd_pathconf(&uap->name))
                return (EINVAL);
-       else
-               return (pathconf(td, (void *)uap));
+       CHECKALTEXIST(td, uap->path, &path);
+       error = kern_pathconf(td, path, UIO_SYSSPACE, uap->name);
+       free(path, M_TEMP);
+       return (error);
 }
 
 
@@ -1397,17 +1258,19 @@
        struct thread *td;
        struct osf1_execve_args *uap;
 {
-       caddr_t sg;
-       struct execve_args ap;
+       struct image_args eargs;
+       char *path;
+       int error;
 
-       sg = stackgap_init();
-       CHECKALTEXIST(td, &sg, uap->path);
+       CHECKALTEXIST(td, uap->path, &path);
 
-       ap.fname = uap->path;
-       ap.argv = uap->argp;
-       ap.envv = uap->envp;
-
-       return execve(td, &ap);
+       error = exec_copyin_args(&eargs, path, UIO_SYSSPACE, uap->argp,
+           uap->envp);
+       free(path, M_TEMP);
+       if (error == 0)
+               error = kern_execve(td, &eargs, NULL);
+       exec_free_args(&eargs);
+       return (error);
 }
 
 
@@ -1454,7 +1317,8 @@
 }
 
 
-int osf1_gettimeofday(td, uap)
+int
+osf1_gettimeofday(td, uap)
        struct thread *td;
        register struct osf1_gettimeofday_args *uap;
 {
@@ -1482,26 +1346,24 @@
 }
 
 
-int osf1_select(td, uap)
+int
+osf1_select(td, uap)
        struct thread *td;
        register struct osf1_select_args *uap;
 {
-       if (uap->tv) {
-               int error;
-               caddr_t sg;
-               struct osf1_timeval otv;
-               struct timeval tv;
+       struct osf1_timeval otv;
+       struct timeval tv, *tvp;
+       int error;
 
-               sg = stackgap_init();
-
-               if ((error=copyin((caddr_t)uap->tv,(caddr_t)&otv,sizeof(otv))))
-                       return(error);
-               TV_CP(otv,tv);
-               uap->tv = stackgap_alloc(&sg, sizeof(struct timeval));
-               if ((error=copyout((caddr_t)&tv, (caddr_t)uap->tv,sizeof(tv))))
-                       return(error);
-       }
-       return(select(td, (struct select_args *)uap));
+       if (uap->tv != NULL) {
+               error = copyin(uap->tv, &otv, sizeof(otv));
+               if (error)
+                       return (error);
+               TV_CP(otv, tv);
+               tvp = &tv;
+       } else
+               tvp = NULL;
+       return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp));
 }
 
 
@@ -1510,43 +1372,27 @@
        struct thread *td;
        struct osf1_setitimer_args *uap;
 {
-
+       struct itimerval itv, oitv;
+       struct osf1_itimerval otv;
        int error;
-       caddr_t old_oitv, sg;
-       struct itimerval itv;
-       struct osf1_itimerval otv;
 
-       error = 0;
-       old_oitv = (caddr_t)uap->oitv;
-       sg = stackgap_init();
-
-       if ((error = copyin((caddr_t)uap->itv,(caddr_t)&otv,sizeof(otv)))) {
+       error = copyin(uap->itv, &otv, sizeof(otv));
+       if (error) {
                printf("%s(%d): error = %d\n", __FILE__, __LINE__, error);
-               return error;
+               return (error);
        }
-       TV_CP(otv.it_interval,itv.it_interval);
-       TV_CP(otv.it_value,itv.it_value);
-       uap->itv = stackgap_alloc(&sg, sizeof(struct itimerval));
-       if ((error = copyout((caddr_t)&itv,(caddr_t)uap->itv,sizeof(itv)))) {
+       TV_CP(otv.it_interval, itv.it_interval);
+       TV_CP(otv.it_value, itv.it_value);
+       error = kern_setitimer(td, uap->which, &itv, &oitv);
+       if (error || uap->oitv == NULL)
+               return (error);
+
+       TV_CP(oitv.it_interval, otv.it_interval);
+       TV_CP(oitv.it_value, otv.it_value);
+       error = copyout(&otv, uap->oitv, sizeof(otv));
+       if (error)
                printf("%s(%d): error = %d\n", __FILE__, __LINE__, error);
-               return error;
-       }
-       uap->oitv = stackgap_alloc(&sg, sizeof(struct itimerval));
-       if ((error = setitimer(td, (struct setitimer_args *)uap))) {
-               printf("%s(%d): error = %d\n", __FILE__, __LINE__, error);
-               return error;
-       }
-       if ((error = copyin((caddr_t)uap->oitv,(caddr_t)&itv,sizeof(itv)))) {
-               printf("%s(%d): error = %d\n", __FILE__, __LINE__, error);
-               return error;
-       }
-       TV_CP(itv.it_interval,otv.it_interval);
-       TV_CP(itv.it_value,otv.it_value);
-       if (old_oitv
-           && (error = copyout((caddr_t)&otv, old_oitv, sizeof(otv)))) {
-               printf("%s(%d): error = %d\n", __FILE__, __LINE__, error);
-       }
-       return error;
+       return (error);
 }
 
 
@@ -1555,30 +1401,19 @@
        struct thread *td;
        struct osf1_getitimer_args *uap;
 {
-       int error;
-       caddr_t old_itv, sg;
        struct itimerval itv;
        struct osf1_itimerval otv;
+       int error;
 
-       error = 0;
-       old_itv = (caddr_t)uap->itv;
-       sg = stackgap_init();
-
-       uap->itv = stackgap_alloc(&sg, sizeof(struct itimerval));
-       if ((error = getitimer(td, (struct getitimer_args *)uap))) {
+       error = kern_getitimer(td, uap->which, &itv);
+       if (error)
+               return (error);
+       TV_CP(itv.it_interval, otv.it_interval);
+       TV_CP(itv.it_value, otv.it_value);
+       error = copyout(&otv, uap->itv, sizeof(otv));
+       if (error)
                printf("%s(%d): error = %d\n", __FILE__, __LINE__, error);
-               return error;
-       }
-       if ((error = copyin((caddr_t)uap->itv,(caddr_t)&itv,sizeof(itv)))) {
-               printf("%s(%d): error = %d\n", __FILE__, __LINE__, error);
-               return error;
-       }
-       TV_CP(itv.it_interval,otv.it_interval);
-       TV_CP(itv.it_value,otv.it_value);
-       if ((error = copyout((caddr_t)&otv, old_itv, sizeof(otv)))) {
-               printf("%s(%d): error = %d\n", __FILE__, __LINE__, error);
-       }
-       return error;
+       return (error);
 }
 
 

==== //depot/projects/hammer/sys/alpha/osf1/osf1_mount.c#9 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/osf1/osf1_mount.c,v 1.19 2005/01/05 20:05:51 
imp Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/osf1/osf1_mount.c,v 1.20 2005/02/18 18:37:26 
jhb Exp $");
 
 #include "opt_mac.h"
 #include "opt_nfs.h"
@@ -52,6 +52,7 @@
 #include <sys/socketvar.h>
 #include <sys/domain.h>
 #include <sys/protosw.h>
+#include <sys/syscallsubr.h>
 #include <sys/namei.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
@@ -122,29 +123,15 @@
        struct thread *td;
        struct osf1_statfs_args *uap;
 {
+       struct osf1_statfs osfs;
+       struct statfs sf;
        int error;
-       struct mount *mp;
-       struct statfs *sp;
-       struct osf1_statfs osfs;
-       struct nameidata nd;
 
-       NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
-       if ((error = namei(&nd)))
-               return (error);
-       mp = nd.ni_vp->v_mount;
-       sp = &mp->mnt_stat;
-       vrele(nd.ni_vp);
-#ifdef MAC
-       error = mac_check_mount_stat(td->td_ucred, mp);
+       error = kern_statfs(td, uap->path, UIO_USERSPACE, &sf);
        if (error)
                return (error);
-#endif
-       if ((error = VFS_STATFS(mp, sp, td)))
-               return (error);
-       sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
-       bsd2osf_statfs(sp, &osfs);
-       return copyout(&osfs, uap->buf, min(sizeof osfs,
-           uap->len));
+       bsd2osf_statfs(&sf, &osfs);
+       return (copyout(&osfs, uap->buf, min(sizeof osfs, uap->len)));
 }
 
 int
@@ -152,31 +139,15 @@
        struct thread *td;
        struct osf1_fstatfs_args *uap;
 {
+       struct osf1_statfs osfs;
+       struct statfs sf;
        int error;
-       struct file *fp;
-       struct mount *mp;
-       struct statfs *sp;
-       struct osf1_statfs osfs;
 
-       if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)))
-               return (error);
-       mp = fp->f_vnode->v_mount;
-#ifdef MAC
-       error = mac_check_mount_stat(td->td_ucred, mp);
-       if (error) {
-               fdrop(fp, td);
-               return (error);
-       }
-#endif
-       sp = &mp->mnt_stat;
-       error = VFS_STATFS(mp, sp, td);
-       fdrop(fp, td);
+       error = kern_fstatfs(td, uap->fd, &sf);
        if (error)
                return (error);
-       sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
-       bsd2osf_statfs(sp, &osfs);
-       return copyout(&osfs, uap->buf, min(sizeof osfs,
-           uap->len));
+       bsd2osf_statfs(&sf, &osfs);
+       return (copyout(&osfs, uap->buf, min(sizeof osfs, uap->len)));
 }
 
 int

==== //depot/projects/hammer/sys/alpha/osf1/osf1_util.h#3 (text+ko) ====

@@ -25,7 +25,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/alpha/osf1/osf1_util.h,v 1.7 2002/12/14 01:56:24 alfred 
Exp $
+ * $FreeBSD: src/sys/alpha/osf1/osf1_util.h,v 1.8 2005/02/18 18:37:26 jhb Exp $
  */
 
 #include <vm/vm.h>
@@ -60,19 +60,17 @@
 }
 
 
-extern const char osf1_emul_path[];
-int osf1_emul_find(struct thread *, caddr_t *, const char *, char *,
-                       char **, int);
+int    osf1_emul_find(struct thread *td, char *path, enum uio_seg pathseg,
+           char **pbuf, int create);
 
-#define CHECKALT(p, sgp, path, i)                                      \
+#define CHECKALT(td, upath, pathp, i)                                  \
        do {                                                            \
                int _error;                                             \
                                                                        \
-               _error = osf1_emul_find(p, sgp, osf1_emul_path, path,   \
-                                       &path, i);                      \
-               if (_error == EFAULT)                                   \
+               _error = osf1_emul_find(td, upath, UIO_USERSPACE, pathp, i); \
+               if (*(pathp) == NULL)                                   \
                        return (_error);                                \
        } while (0)
 
-#define        CHECKALTEXIST(p, sgp, path) CHECKALT((p), (sgp), (path), 0)
-#define        CHECKALTCREAT(p, sgp, path) CHECKALT((p), (sgp), (path), 1)
+#define        CHECKALTEXIST(td, upath, pathp) CHECKALT((td), (upath), 
(pathp), 0)
+#define        CHECKALTCREAT(td, upath, pathp) CHECKALT((td), (upath), 
(pathp), 1)

==== //depot/projects/hammer/sys/amd64/linux32/linux32_machdep.c#5 (text+ko) 
====

@@ -29,11 +29,12 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_machdep.c,v 1.5 2004/10/05 
18:51:10 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_machdep.c,v 1.6 2005/02/18 
18:51:59 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/systm.h>
+#include <sys/imgact.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mman.h>
@@ -49,6 +50,8 @@
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
+#include <vm/vm_extern.h>
+#include <vm/vm_kern.h>
 #include <vm/vm_map.h>
 
 #include <amd64/linux32/linux.h>
@@ -89,72 +92,120 @@
        return (lsa);
 }
 
-int
-linux_execve(struct thread *td, struct linux_execve_args *args)
+/*
+ * Custom version of exec_copyin_args() so that we can translate
+ * the pointers.
+ */
+static int
+linux_exec_copyin_args(struct image_args *args, char *fname,
+    enum uio_seg segflg, char **argv, char **envv)
 {
-       struct execve_args ap;
-       caddr_t sg;
+       char *argp, *envp;
+       u_int32_t *p32, arg;
+       size_t length;
        int error;
-       u_int32_t *p32, arg;
-       char **p, *p64;
-       int count;
+
+       bzero(args, sizeof(*args));
+       if (argv == NULL)
+               return (EFAULT);
 
-       sg = stackgap_init();
-       CHECKALTEXIST(td, &sg, args->path);
+       /*
+        * Allocate temporary demand zeroed space for argument and
+        *      environment strings
+        */
+       args->buf = (char *) kmem_alloc_wait(exec_map, PATH_MAX + ARG_MAX);
+       if (args->buf == NULL)
+               return (ENOMEM);
+       args->begin_argv = args->buf;
+       args->endp = args->begin_argv;
+       args->stringspace = ARG_MAX;
 
-#ifdef DEBUG
-       if (ldebug(execve))
-               printf(ARGS(execve, "%s"), args->path);
-#endif
+       args->fname = args->buf + ARG_MAX;
 
-       ap.fname = args->path;
+       /*
+        * Copy the file name.
+        */
+       error = (segflg == UIO_SYSSPACE) ?
+           copystr(fname, args->fname, PATH_MAX, &length) :
+           copyinstr(fname, args->fname, PATH_MAX, &length);
+       if (error != 0)
+               return (error);
 
-       if (args->argp != NULL) {
-               count = 0;
-               p32 = (u_int32_t *)args->argp;
-               do {
-                       error = copyin(p32++, &arg, sizeof(arg));
-                       if (error)
-                               return error;
-                       count++;
-               } while (arg != 0);
-               p = stackgap_alloc(&sg, count * sizeof(char *));
-               ap.argv = p;
-               p32 = (u_int32_t *)args->argp;
-               do {
-                       error = copyin(p32++, &arg, sizeof(arg));
-                       if (error)
-                               return error;
-                       p64 = PTRIN(arg);
-                       error = copyout(&p64, p++, sizeof(p64));
-                       if (error)
-                               return error;
-               } while (arg != 0);
+       /*
+        * extract arguments first
+        */
+       p32 = (u_int32_t *)argv;
+       for (;;) {
+               error = copyin(p32++, &arg, sizeof(arg));
+               if (error)
+                       return (error);
+               if (arg == 0)
+                       break;
+               argp = PTRIN(arg);
+               error = copyinstr(argp, args->endp, args->stringspace, &length);
+               if (error) {
+                       if (error == ENAMETOOLONG)
+                               return (E2BIG);
+                       else
+                               return (error);
+               }
+               args->stringspace -= length;
+               args->endp += length;
+               args->argc++;
        }
-       if (args->envp != NULL) {
-               count = 0;
-               p32 = (u_int32_t *)args->envp;
-               do {
+                       
+       args->begin_envv = args->endp;
+
+       /*
+        * extract environment strings
+        */
+       if (envv) {
+               p32 = (u_int32_t *)envv;
+               for (;;) {
                        error = copyin(p32++, &arg, sizeof(arg));
                        if (error)
-                               return error;
-                       count++;
-               } while (arg != 0);
-               p = stackgap_alloc(&sg, count * sizeof(char *));
-               ap.envv = p;
-               p32 = (u_int32_t *)args->envp;
-               do {
-                       error = copyin(p32++, &arg, sizeof(arg));
-                       if (error)
-                               return error;
-                       p64 = PTRIN(arg);
-                       error = copyout(&p64, p++, sizeof(p64));
-                       if (error)
-                               return error;
-               } while (arg != 0);
+                               return (error);
+                       if (arg == 0)
+                               break;
+                       envp = PTRIN(arg);
+                       error = copyinstr(envp, args->endp, args->stringspace,
+                           &length);
+                       if (error) {
+                               if (error == ENAMETOOLONG)
+                                       return (E2BIG);
+                               else
+                                       return (error);
+                       }
+                       args->stringspace -= length;
+                       args->endp += length;
+                       args->envc++;
+               }
        }
 
-       return (execve(td, &ap));
+       return (0);
+}
+
+int
+linux_execve(struct thread *td, struct linux_execve_args *args)
+{
+       struct image_args eargs;
+       char *path;
+       int error;
+
+       LCONVPATHEXIST(td, args->path, &path);
+
+#ifdef DEBUG
+       if (ldebug(execve))
+               printf(ARGS(execve, "%s"), path);
+#endif
+

>>> TRUNCATED FOR MAIL (1000 lines) <<<
_______________________________________________
p4-projects@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/p4-projects
To unsubscribe, send any mail to "p4-projects-unsubscribe@xxxxxxxxxxx"

<Prev in Thread] Current Thread [Next in Thread>
  • PERFORCE change 71264 for review, Peter Wemm <=