From mav at FreeBSD.org Wed Jul 1 08:43:06 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Wed Jul 1 08:43:24 2009 Subject: svn commit: r195232 - in stable/7/sys: . contrib/pf netgraph Message-ID: <200907010843.n618h5Xm006670@svn.freebsd.org> Author: mav Date: Wed Jul 1 08:43:05 2009 New Revision: 195232 URL: http://svn.freebsd.org/changeset/base/195232 Log: MFC rev.194699: Mark ng_ether node hooks as HI_STACK. It is usually the last point when netgraph may unroll the call stack, and I have found that in some cases 2K guarantied there for i386 may be not enough for NIC driver and BPF. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netgraph/ng_ether.c Modified: stable/7/sys/netgraph/ng_ether.c ============================================================================== --- stable/7/sys/netgraph/ng_ether.c Wed Jul 1 08:08:56 2009 (r195231) +++ stable/7/sys/netgraph/ng_ether.c Wed Jul 1 08:43:05 2009 (r195232) @@ -403,7 +403,7 @@ ng_ether_newhook(node_p node, hook_p hoo /* Disable hardware checksums while 'upper' hook is connected */ if (hookptr == &priv->upper) priv->ifp->if_hwassist = 0; - + NG_HOOK_HI_STACK(hook); /* OK */ *hookptr = hook; return (0); From avg at FreeBSD.org Wed Jul 1 12:44:24 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Wed Jul 1 12:44:30 2009 Subject: svn commit: r195236 - in stable/7/sys: . contrib/pf nfsserver Message-ID: <200907011244.n61CiNVH012914@svn.freebsd.org> Author: avg Date: Wed Jul 1 12:44:23 2009 New Revision: 195236 URL: http://svn.freebsd.org/changeset/base/195236 Log: MFC 185586 (kan): Change nfsserver slightly so that it does not trip over the timestamp validation code on ZFS. This should fix O_CREAT|O_EXCL open on NFS where a server is 64-bit with v13 ZFS code. PR: kern/135412 Pointed out by: Jaakko Heinonen Tested by: Jaakko Heinonen, Danny Braniss Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/nfsserver/nfs_serv.c Modified: stable/7/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/7/sys/nfsserver/nfs_serv.c Wed Jul 1 12:36:10 2009 (r195235) +++ stable/7/sys/nfsserver/nfs_serv.c Wed Jul 1 12:44:23 2009 (r195236) @@ -1656,13 +1656,12 @@ nfsrv_create(struct nfsrv_descript *nfsd caddr_t bpos; int error = 0, rdev, len, tsize, dirfor_ret = 1, diraft_ret = 1; int v3 = (nfsd->nd_flag & ND_NFSV3), how, exclusive_flag = 0; - caddr_t cp; struct mbuf *mb, *mreq; struct vnode *dirp = NULL; nfsfh_t nfh; fhandle_t *fhp; u_quad_t tempsize; - u_char cverf[NFSX_V3CREATEVERF]; + struct timespec cverf; struct mount *mp = NULL; int tvfslocked; int vfslocked; @@ -1741,8 +1740,11 @@ nfsrv_create(struct nfsrv_descript *nfsd nfsm_srvsattr(vap); break; case NFSV3CREATE_EXCLUSIVE: - cp = nfsm_dissect_nonblock(caddr_t, NFSX_V3CREATEVERF); - bcopy(cp, cverf, NFSX_V3CREATEVERF); + tl = nfsm_dissect_nonblock(u_int32_t *, + NFSX_V3CREATEVERF); + /* Unique bytes, endianness is not important. */ + cverf.tv_sec = tl[0]; + cverf.tv_nsec = tl[1]; exclusive_flag = 1; break; }; @@ -1788,8 +1790,7 @@ nfsrv_create(struct nfsrv_descript *nfsd if (exclusive_flag) { exclusive_flag = 0; VATTR_NULL(vap); - bcopy(cverf, (caddr_t)&vap->va_atime, - NFSX_V3CREATEVERF); + vap->va_atime = cverf; error = VOP_SETATTR(nd.ni_vp, vap, cred, td); } @@ -1873,7 +1874,7 @@ nfsrv_create(struct nfsrv_descript *nfsd } if (v3) { if (exclusive_flag && !error && - bcmp(cverf, (caddr_t)&vap->va_atime, NFSX_V3CREATEVERF)) + bcmp(&cverf, &vap->va_atime, sizeof (cverf))) error = EEXIST; if (dirp == nd.ni_dvp) diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td); From np at FreeBSD.org Wed Jul 1 17:51:00 2009 From: np at FreeBSD.org (Navdeep Parhar) Date: Wed Jul 1 17:51:11 2009 Subject: svn commit: r195250 - stable/7/sys/dev/cxgb Message-ID: <200907011750.n61HoxPr019738@svn.freebsd.org> Author: np Date: Wed Jul 1 17:50:59 2009 New Revision: 195250 URL: http://svn.freebsd.org/changeset/base/195250 Log: Fix cxgb's version checks in stable. This makes it select the correct buffer size for freelist1. Approved by: gnn (mentor) Modified: stable/7/sys/dev/cxgb/cxgb_sge.c Modified: stable/7/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- stable/7/sys/dev/cxgb/cxgb_sge.c Wed Jul 1 17:20:07 2009 (r195249) +++ stable/7/sys/dev/cxgb/cxgb_sge.c Wed Jul 1 17:50:59 2009 (r195250) @@ -375,7 +375,7 @@ t3_sge_prep(adapter_t *adap, struct sge_ while (!powerof2(fl_q_size)) fl_q_size--; -#if __FreeBSD_version > 700000 +#if __FreeBSD_version >= 700111 if (cxgb_use_16k_clusters) jumbo_q_size = min(nmbjumbo16/(3*nqsets), JUMBO_Q_SIZE); else @@ -2377,7 +2377,7 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i q->fl[0].buf_size = (MCLBYTES - header_size); q->fl[0].zone = zone_clust; q->fl[0].type = EXT_CLUSTER; -#if __FreeBSD_version > 800000 +#if __FreeBSD_version >= 700111 if (cxgb_use_16k_clusters) { q->fl[1].buf_size = MJUM16BYTES - header_size; q->fl[1].zone = zone_jumbo16; From delphij at FreeBSD.org Thu Jul 2 00:36:01 2009 From: delphij at FreeBSD.org (Xin LI) Date: Thu Jul 2 00:36:18 2009 Subject: svn commit: r195272 - in stable/7/usr.sbin/sysinstall: . help Message-ID: <200907020036.n620a06g028508@svn.freebsd.org> Author: delphij Date: Thu Jul 2 00:36:00 2009 New Revision: 195272 URL: http://svn.freebsd.org/changeset/base/195272 Log: MFC r180208 (peter): Set magic fbsd:nokeywords property that allows files to bypass keyword expansion. (file-specific replacement for CVSROOT/exclude) Modified: stable/7/usr.sbin/sysinstall/ (props changed) stable/7/usr.sbin/sysinstall/help/anonftp.hlp (props changed) stable/7/usr.sbin/sysinstall/help/configure.hlp (props changed) stable/7/usr.sbin/sysinstall/help/distributions.hlp (props changed) stable/7/usr.sbin/sysinstall/help/drives.hlp (props changed) stable/7/usr.sbin/sysinstall/help/fixit.hlp (props changed) stable/7/usr.sbin/sysinstall/help/html.hlp (props changed) stable/7/usr.sbin/sysinstall/help/media.hlp (props changed) stable/7/usr.sbin/sysinstall/help/network_device.hlp (props changed) stable/7/usr.sbin/sysinstall/help/options.hlp (props changed) stable/7/usr.sbin/sysinstall/help/partition.hlp (props changed) stable/7/usr.sbin/sysinstall/help/securelevel.hlp (props changed) stable/7/usr.sbin/sysinstall/help/shortcuts.hlp (props changed) stable/7/usr.sbin/sysinstall/help/slice.hlp (props changed) stable/7/usr.sbin/sysinstall/help/tcp.hlp (props changed) stable/7/usr.sbin/sysinstall/help/usage.hlp (props changed) stable/7/usr.sbin/sysinstall/help/usermgmt.hlp (props changed) From delphij at FreeBSD.org Thu Jul 2 00:39:26 2009 From: delphij at FreeBSD.org (Xin LI) Date: Thu Jul 2 00:39:42 2009 Subject: svn commit: r195273 - in stable/7/usr.sbin/sysinstall: . help Message-ID: <200907020039.n620dPMp028673@svn.freebsd.org> Author: delphij Date: Thu Jul 2 00:39:25 2009 New Revision: 195273 URL: http://svn.freebsd.org/changeset/base/195273 Log: MFC r195012: Correct a typo (which you can use to in order -> which you can use in order to). PR: bin/136040 Submitted by: "Vikentii L. Karabin" Modified: stable/7/usr.sbin/sysinstall/ (props changed) stable/7/usr.sbin/sysinstall/help/usage.hlp Modified: stable/7/usr.sbin/sysinstall/help/usage.hlp ============================================================================== --- stable/7/usr.sbin/sysinstall/help/usage.hlp Thu Jul 2 00:36:00 2009 (r195272) +++ stable/7/usr.sbin/sysinstall/help/usage.hlp Thu Jul 2 00:39:25 2009 (r195273) @@ -56,7 +56,7 @@ it's also useful when dealing with sub-s that don't use menus and tend to scroll their output off the top of the screen. -FreeBSD also supports multiple "virtual consoles" which you can use to +FreeBSD also supports multiple "virtual consoles" which you can use in order to have several active sessions at once. Use ALT-F to switch between screens, where `F' is the function key corresponding to the screen you wish to see. By default, the system comes with 8 From mav at FreeBSD.org Sat Jul 4 06:00:58 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sat Jul 4 06:01:04 2009 Subject: svn commit: r195336 - in stable/7/sys: . contrib/pf netgraph Message-ID: <200907040600.n6460vaU000179@svn.freebsd.org> Author: mav Date: Sat Jul 4 06:00:57 2009 New Revision: 195336 URL: http://svn.freebsd.org/changeset/base/195336 Log: MFC rev.195335: Fix infinite loop in ng_iface, that happens when packet passes out via two different ng interfaces sequentially due to tunnelling. PR: kern/134557 Submitted by: Mikolaj Golub Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netgraph/ng_iface.c Modified: stable/7/sys/netgraph/ng_iface.c ============================================================================== --- stable/7/sys/netgraph/ng_iface.c Sat Jul 4 05:07:52 2009 (r195335) +++ stable/7/sys/netgraph/ng_iface.c Sat Jul 4 06:00:57 2009 (r195336) @@ -365,7 +365,8 @@ ng_iface_output(struct ifnet *ifp, struc } /* Protect from deadly infinite recursion. */ - while ((mtag = m_tag_locate(m, MTAG_NGIF, MTAG_NGIF_CALLED, NULL))) { + mtag = NULL; + while ((mtag = m_tag_locate(m, MTAG_NGIF, MTAG_NGIF_CALLED, mtag))) { if (*(struct ifnet **)(mtag + 1) == ifp) { log(LOG_NOTICE, "Loop detected on %s\n", ifp->if_xname); m_freem(m); From brian at FreeBSD.org Sun Jul 5 06:24:07 2009 From: brian at FreeBSD.org (Brian Somers) Date: Sun Jul 5 06:24:24 2009 Subject: svn commit: r195347 - in stable/7/gnu/usr.bin/man: . apropos Message-ID: <200907050624.n656O6MF038991@svn.freebsd.org> Author: brian Date: Sun Jul 5 06:24:06 2009 New Revision: 195347 URL: http://svn.freebsd.org/changeset/base/195347 Log: MFC: Don't set $PATH - if the caller doesn't have /bin and /usr/bin in their PATH then they can expect things to break. PR: 135417 Modified: stable/7/gnu/usr.bin/man/ (props changed) stable/7/gnu/usr.bin/man/apropos/apropos.sh Modified: stable/7/gnu/usr.bin/man/apropos/apropos.sh ============================================================================== --- stable/7/gnu/usr.bin/man/apropos/apropos.sh Sun Jul 5 06:14:59 2009 (r195346) +++ stable/7/gnu/usr.bin/man/apropos/apropos.sh Sun Jul 5 06:24:06 2009 (r195347) @@ -18,7 +18,6 @@ # $FreeBSD$ -PATH=/bin:/usr/bin:$PATH db=whatis # name of whatis data base grepopt='' From brian at FreeBSD.org Sun Jul 5 06:28:24 2009 From: brian at FreeBSD.org (Brian Somers) Date: Sun Jul 5 06:28:30 2009 Subject: svn commit: r195348 - stable/7/etc Message-ID: <200907050628.n656SNch039124@svn.freebsd.org> Author: brian Date: Sun Jul 5 06:28:23 2009 New Revision: 195348 URL: http://svn.freebsd.org/changeset/base/195348 Log: MFC: Remove HOME= PR: 132135 Modified: stable/7/etc/ (props changed) stable/7/etc/crontab Modified: stable/7/etc/crontab ============================================================================== --- stable/7/etc/crontab Sun Jul 5 06:24:06 2009 (r195347) +++ stable/7/etc/crontab Sun Jul 5 06:28:23 2009 (r195348) @@ -4,7 +4,6 @@ # SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin -HOME=/var/log # #minute hour mday month wday who command # From brian at FreeBSD.org Sun Jul 5 06:32:11 2009 From: brian at FreeBSD.org (Brian Somers) Date: Sun Jul 5 06:32:18 2009 Subject: svn commit: r195349 - in stable/7/usr.sbin/lpr: . lp Message-ID: <200907050632.n656WAYV039325@svn.freebsd.org> Author: brian Date: Sun Jul 5 06:32:10 2009 New Revision: 195349 URL: http://svn.freebsd.org/changeset/base/195349 Log: MFC: Add -m and -t options. PR: 129554 Modified: stable/7/usr.sbin/lpr/ (props changed) stable/7/usr.sbin/lpr/lp/lp.1 stable/7/usr.sbin/lpr/lp/lp.sh Modified: stable/7/usr.sbin/lpr/lp/lp.1 ============================================================================== --- stable/7/usr.sbin/lpr/lp/lp.1 Sun Jul 5 06:28:23 2009 (r195348) +++ stable/7/usr.sbin/lpr/lp/lp.1 Sun Jul 5 06:32:10 2009 (r195349) @@ -78,6 +78,8 @@ or .Ev PRINTER (with this precedence) are taken as the destination printer. +.It Fl m +Send mail upon completion. .It Fl n Ar num Specify that .Ar num @@ -91,6 +93,9 @@ Silent operation. Not supported, provided only as a compatibility option for .St -susv2 . +.It Fl t Ar title +Set the job title to +.Ar title . .El .Sh ENVIRONMENT As described above, the variables Modified: stable/7/usr.sbin/lpr/lp/lp.sh ============================================================================== --- stable/7/usr.sbin/lpr/lp/lp.sh Sun Jul 5 06:28:23 2009 (r195348) +++ stable/7/usr.sbin/lpr/lp/lp.sh Sun Jul 5 06:32:10 2009 (r195349) @@ -41,6 +41,8 @@ ncopies="" symlink="-s" +mailafter="" +title="" # Posix says LPDEST gets precedence over PRINTER dest=${LPDEST:-${PRINTER:-lp}} @@ -51,7 +53,7 @@ dest=${LPDEST:-${PRINTER:-lp}} # XXX We include the -s flag as a dummy. SUSv2 requires it, # although we do not yet emit the affected messages. # -while getopts "cd:n:o:s" option +while getopts "cd:mn:o:st:" option do case $option in @@ -59,12 +61,16 @@ do symlink="";; d) # destination dest="${OPTARG}";; + m) # mail after job + mailafter="-m";; n) # number of copies ncopies="-#${OPTARG}";; o) # (printer option) : ;; s) # (silent option) : ;; + t) # title for banner page + title="-J${OPTARG}";; *) # (error msg printed by getopts) exit 2;; esac @@ -72,4 +78,4 @@ done shift $(($OPTIND - 1)) -exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} "$@" +exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} ${mailafter} "${title}" "$@" From jilles at FreeBSD.org Sun Jul 5 13:17:19 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Sun Jul 5 13:17:32 2009 Subject: svn commit: r195361 - stable/7/usr.bin/ipcs Message-ID: <200907051317.n65DHIk6050159@svn.freebsd.org> Author: jilles Date: Sun Jul 5 13:17:18 2009 New Revision: 195361 URL: http://svn.freebsd.org/changeset/base/195361 Log: MFC ipcs(1) part of r189283 by kib This fixes display of shared memory segment sizes greater than 2 GB in ipcs -b. PR: kern/136226 Approved by: ed (mentor) Modified: stable/7/usr.bin/ipcs/ (props changed) stable/7/usr.bin/ipcs/ipcs.c Modified: stable/7/usr.bin/ipcs/ipcs.c ============================================================================== --- stable/7/usr.bin/ipcs/ipcs.c Sun Jul 5 08:40:26 2009 (r195360) +++ stable/7/usr.bin/ipcs/ipcs.c Sun Jul 5 13:17:18 2009 (r195361) @@ -452,8 +452,8 @@ print_kshmptr(int i, int option, struct kshmptr->u.shm_nattch); if (option & BIGGEST) - printf(" %12d", - kshmptr->u.shm_segsz); + printf(" %12zu", + kshmptr->shm_bsegsz); if (option & PID) printf(" %12d %12d", From yongari at FreeBSD.org Mon Jul 6 01:04:46 2009 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Mon Jul 6 01:04:58 2009 Subject: svn commit: r195387 - in stable/7/sys: . contrib/pf dev/ale Message-ID: <200907060104.n6614jfk064205@svn.freebsd.org> Author: yongari Date: Mon Jul 6 01:04:45 2009 New Revision: 195387 URL: http://svn.freebsd.org/changeset/base/195387 Log: MFC r195153: Disable Rx checksum offload until I find more clue why it breaks under certain environments. However give users chance to override it when he/she surely knows his/her hardware works with Rx checksum offload. Reported by: Ulrich Spoerlein ( uqs <> spoerlein dot net ) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ale/if_ale.c Modified: stable/7/sys/dev/ale/if_ale.c ============================================================================== --- stable/7/sys/dev/ale/if_ale.c Sun Jul 5 21:47:39 2009 (r195386) +++ stable/7/sys/dev/ale/if_ale.c Mon Jul 6 01:04:45 2009 (r195387) @@ -620,6 +620,14 @@ ale_attach(device_t dev) ifp->if_capabilities |= IFCAP_VLAN_MTU; ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM; ifp->if_capenable = ifp->if_capabilities; + /* + * Even though controllers supported by ale(3) have Rx checksum + * offload bug the workaround for fragmented frames seemed to + * work so far. However it seems Rx checksum offload does not + * work under certain conditions. So disable Rx checksum offload + * until I find more clue about it but allow users to override it. + */ + ifp->if_capenable &= ~IFCAP_RXCSUM; /* Tell the upper layer(s) we support long frames. */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); From brooks at FreeBSD.org Mon Jul 6 01:32:31 2009 From: brooks at FreeBSD.org (Brooks Davis) Date: Mon Jul 6 01:32:42 2009 Subject: svn commit: r195388 - stable/7/usr.bin/catman Message-ID: <200907060132.n661WT0L064915@svn.freebsd.org> Author: brooks Date: Mon Jul 6 01:32:29 2009 New Revision: 195388 URL: http://svn.freebsd.org/changeset/base/195388 Log: MFC r194493 and r194548 When checking if we can write to a file, use access() instead of a manual permission check based on stat output. Also, get rid of the executability check since it is not used. Modified: stable/7/usr.bin/catman/ (props changed) stable/7/usr.bin/catman/catman.c Modified: stable/7/usr.bin/catman/catman.c ============================================================================== --- stable/7/usr.bin/catman/catman.c Mon Jul 6 01:04:45 2009 (r195387) +++ stable/7/usr.bin/catman/catman.c Mon Jul 6 01:32:29 2009 (r195388) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #define TEST_FILE 0x04 #define TEST_READABLE 0x08 #define TEST_WRITABLE 0x10 -#define TEST_EXECUTABLE 0x20 static int verbose; /* -v flag: be verbose with warnings */ static int pretend; /* -n, -p flags: print out what would be done @@ -93,8 +92,6 @@ static const char *locale_device[] = { enum Ziptype {NONE, BZIP, GZIP}; static uid_t uid; -static gid_t gids[NGROUPS_MAX]; -static int ngids; static int starting_dir; static char tmp_file[MAXPATHLEN]; struct stat test_st; @@ -320,23 +317,10 @@ test_path(char *name, time_t *mod_time) result |= TEST_DIR; else if (S_ISREG(test_st.st_mode)) result |= TEST_FILE; - if (test_st.st_uid == uid) { - test_st.st_mode >>= 6; - } else { - int i; - for (i = 0; i < ngids; i++) { - if (test_st.st_gid == gids[i]) { - test_st.st_mode >>= 3; - break; - } - } - } - if (test_st.st_mode & S_IROTH) + if (access(name, R_OK)) result |= TEST_READABLE; - if (test_st.st_mode & S_IWOTH) + if (access(name, W_OK)) result |= TEST_WRITABLE; - if (test_st.st_mode & S_IXOTH) - result |= TEST_EXECUTABLE; return result; } @@ -789,7 +773,6 @@ main(int argc, char **argv) /* NOTREACHED */ } } - ngids = getgroups(NGROUPS_MAX, gids); if ((starting_dir = open(".", 0)) < 0) { err(1, "."); } From n_hibma at FreeBSD.org Mon Jul 6 09:07:37 2009 From: n_hibma at FreeBSD.org (Nick Hibma) Date: Mon Jul 6 09:07:47 2009 Subject: svn commit: r195402 - stable/7/sys/dev/usb Message-ID: <200907060907.n6697a22074004@svn.freebsd.org> Author: n_hibma Date: Mon Jul 6 09:07:35 2009 New Revision: 195402 URL: http://svn.freebsd.org/changeset/base/195402 Log: bugfix: Clear the out endpoint on a stall on the written endpoint, not *in*. Modified: stable/7/sys/dev/usb/ucom.c Modified: stable/7/sys/dev/usb/ucom.c ============================================================================== --- stable/7/sys/dev/usb/ucom.c Mon Jul 6 08:16:25 2009 (r195401) +++ stable/7/sys/dev/usb/ucom.c Mon Jul 6 09:07:35 2009 (r195402) @@ -693,7 +693,7 @@ ucomwritecb(usbd_xfer_handle xfer, usbd_ printf("%s: ucomwritecb: %s\n", device_get_nameunit(sc->sc_dev), usbd_errstr(status)); if (status == USBD_STALLED) - usbd_clear_endpoint_stall_async(sc->sc_bulkin_pipe); + usbd_clear_endpoint_stall_async(sc->sc_bulkout_pipe); /* XXX we should restart after some delay. */ goto error; } From delphij at FreeBSD.org Wed Jul 8 01:41:42 2009 From: delphij at FreeBSD.org (Xin LI) Date: Wed Jul 8 01:42:00 2009 Subject: svn commit: r195431 - in stable/7/lib/libc: . rpc Message-ID: <200907080141.n681ffiI034575@svn.freebsd.org> Author: delphij Date: Wed Jul 8 01:41:41 2009 New Revision: 195431 URL: http://svn.freebsd.org/changeset/base/195431 Log: MFC r194932 Lock around access to nc_file and netconfig_info ("ni"). The RPC part of libc is still not thread safe but this would at least reduce the problems we have. PR: threads/118544 Submitted by: Changming Sun Modified: stable/7/lib/libc/ (props changed) stable/7/lib/libc/rpc/getnetconfig.c Modified: stable/7/lib/libc/rpc/getnetconfig.c ============================================================================== --- stable/7/lib/libc/rpc/getnetconfig.c Wed Jul 8 01:09:12 2009 (r195430) +++ stable/7/lib/libc/rpc/getnetconfig.c Wed Jul 8 01:41:41 2009 (r195431) @@ -130,7 +130,11 @@ static struct netconfig *dup_ncp(struct static FILE *nc_file; /* for netconfig db */ +static pthread_mutex_t nc_file_lock = PTHREAD_MUTEX_INITIALIZER; + static struct netconfig_info ni = { 0, 0, NULL, NULL}; +static pthread_mutex_t ni_lock = PTHREAD_MUTEX_INITIALIZER; + #define MAXNETCONFIGLINE 1000 @@ -204,14 +208,24 @@ setnetconfig() * For multiple calls, i.e. nc_file is not NULL, we just return the * handle without reopening the netconfig db. */ + mutex_lock(&ni_lock); ni.ref++; + mutex_unlock(&ni_lock); + + mutex_lock(&nc_file_lock); if ((nc_file != NULL) || (nc_file = fopen(NETCONFIG, "r")) != NULL) { nc_vars->valid = NC_VALID; nc_vars->flag = 0; nc_vars->nc_configs = ni.head; + mutex_unlock(&nc_file_lock); return ((void *)nc_vars); } + mutex_unlock(&nc_file_lock); + + mutex_lock(&ni_lock); ni.ref--; + mutex_unlock(&ni_lock); + nc_error = NC_NONETCONFIG; free(nc_vars); return (NULL); @@ -234,14 +248,18 @@ void *handlep; char *stringp; /* tmp string pointer */ struct netconfig_list *list; struct netconfig *np; + struct netconfig *result; /* * Verify that handle is valid */ + mutex_lock(&nc_file_lock); if (ncp == NULL || nc_file == NULL) { nc_error = NC_NOTINIT; + mutex_unlock(&nc_file_lock); return (NULL); } + mutex_unlock(&nc_file_lock); switch (ncp->valid) { case NC_VALID: @@ -255,7 +273,9 @@ void *handlep; */ if (ncp->flag == 0) { /* first time */ ncp->flag = 1; + mutex_lock(&ni_lock); ncp->nc_configs = ni.head; + mutex_unlock(&ni_lock); if (ncp->nc_configs != NULL) /* entry already exist */ return(ncp->nc_configs->ncp); } @@ -268,7 +288,13 @@ void *handlep; * If we cannot find the entry in the list and is end of file, * we give up. */ - if (ni.eof == 1) return(NULL); + mutex_lock(&ni_lock); + if (ni.eof == 1) { + mutex_unlock(&ni_lock); + return(NULL); + } + mutex_unlock(&ni_lock); + break; default: nc_error = NC_NOTINIT; @@ -289,13 +315,18 @@ void *handlep; /* * Read a line from netconfig file. */ + mutex_lock(&nc_file_lock); do { if (fgets(stringp, MAXNETCONFIGLINE, nc_file) == NULL) { free(stringp); + mutex_lock(&ni_lock); ni.eof = 1; + mutex_unlock(&ni_lock); + mutex_unlock(&nc_file_lock); return (NULL); } } while (*stringp == '#'); + mutex_unlock(&nc_file_lock); list = (struct netconfig_list *) malloc(sizeof (struct netconfig_list)); if (list == NULL) { @@ -325,6 +356,7 @@ void *handlep; * Reposition the current pointer of the handle to the last entry * in the list. */ + mutex_lock(&ni_lock); if (ni.head == NULL) { /* first entry */ ni.head = ni.tail = list; } @@ -333,7 +365,9 @@ void *handlep; ni.tail = ni.tail->next; } ncp->nc_configs = ni.tail; - return(ni.tail->ncp); + result = ni.tail->ncp; + mutex_unlock(&ni_lock); + return(result); } } @@ -367,7 +401,9 @@ void *handlep; nc_handlep->valid = NC_INVALID; nc_handlep->flag = 0; nc_handlep->nc_configs = NULL; + mutex_lock(&ni_lock); if (--ni.ref > 0) { + mutex_unlock(&ni_lock); free(nc_handlep); return(0); } @@ -380,6 +416,8 @@ void *handlep; ni.eof = ni.ref = 0; ni.head = NULL; ni.tail = NULL; + mutex_unlock(&ni_lock); + while (q) { p = q->next; if (q->ncp->nc_lookups != NULL) free(q->ncp->nc_lookups); @@ -390,8 +428,11 @@ void *handlep; } free(nc_handlep); + mutex_lock(&nc_file_lock); fclose(nc_file); nc_file = NULL; + mutex_unlock(&nc_file_lock); + return (0); } @@ -439,15 +480,20 @@ getnetconfigent(netid) * If all the netconfig db has been read and placed into the list and * there is no match for the netid, return NULL. */ + mutex_lock(&ni_lock); if (ni.head != NULL) { for (list = ni.head; list; list = list->next) { if (strcmp(list->ncp->nc_netid, netid) == 0) { + mutex_unlock(&ni_lock); return(dup_ncp(list->ncp)); } } - if (ni.eof == 1) /* that's all the entries */ + if (ni.eof == 1) { /* that's all the entries */ + mutex_unlock(&ni_lock); return(NULL); + } } + mutex_unlock(&ni_lock); if ((file = fopen(NETCONFIG, "r")) == NULL) { From makc at issp.ac.ru Wed Jul 8 07:29:33 2009 From: makc at issp.ac.ru (Max Brazhnikov) Date: Wed Jul 8 07:29:46 2009 Subject: svn commit: r195197 - in stable/7/sys: . amd64/amd64 amd64/include contrib/pf dev/coretemp dev/hwpmc i386/cpufreq i386/i386 i386/include In-Reply-To: <200906301710.n5UHA8b0086710@svn.freebsd.org> References: <200906301710.n5UHA8b0086710@svn.freebsd.org> Message-ID: <200907081104.29163.makc@issp.ac.ru> On Tue, 30 Jun 2009 17:10:08 +0000 (UTC)Tue Jun 30 17:10:08 2009, Andriy Gapon wrote: > Author: avg > Date: Tue Jun 30 17:10:08 2009 > New Revision: 195197 > URL: http://svn.freebsd.org/changeset/base/195197 > > Log: > MFC 185295, 185341, 185343: cpu identification improvements > > Goal of this MFC is to minimize unnecessary code differences between > head and the branch, and to improve/fix invariant TSC detection for > a wide range of CPUs. > > 185295 by takawata: Honor AMDPM_TSC_INVARIANT for Intel CPUs (i386 only) > 185341 by jkim: Introduce cpu_vendor_id... > 185343 by jkim: Use newly introduced cpu_vendor_id... > > These revision are bundled together because all intermediate revisions > have one or more of the following deficiencies: > o AMDPM_TSC_INVARIANT bit (CPUID.0x80000007.EDX[8]) is not honored for > Intel CPUs; > o AMD-specific CPU model/revision checks are performed on Intel CPUs. > > Nod from: jkim > > Modified: > stable/7/sys/ (props changed) > stable/7/sys/amd64/amd64/amd64_mem.c > stable/7/sys/amd64/amd64/identcpu.c > stable/7/sys/amd64/amd64/initcpu.c > stable/7/sys/amd64/amd64/local_apic.c > stable/7/sys/amd64/amd64/mp_machdep.c > stable/7/sys/amd64/amd64/msi.c > stable/7/sys/amd64/include/cputypes.h > stable/7/sys/amd64/include/md_var.h > stable/7/sys/amd64/include/specialreg.h > stable/7/sys/contrib/pf/ (props changed) > stable/7/sys/dev/coretemp/coretemp.c > stable/7/sys/dev/hwpmc/hwpmc_intel.c > stable/7/sys/dev/hwpmc/hwpmc_piv.c > stable/7/sys/dev/hwpmc/hwpmc_ppro.c > stable/7/sys/dev/hwpmc/hwpmc_x86.c > stable/7/sys/i386/cpufreq/est.c > stable/7/sys/i386/i386/i686_mem.c > stable/7/sys/i386/i386/identcpu.c > stable/7/sys/i386/i386/initcpu.c > stable/7/sys/i386/i386/k6_mem.c > stable/7/sys/i386/i386/local_apic.c > stable/7/sys/i386/i386/longrun.c > stable/7/sys/i386/i386/mp_machdep.c > stable/7/sys/i386/i386/msi.c > stable/7/sys/i386/include/cputypes.h > stable/7/sys/i386/include/md_var.h > stable/7/sys/i386/include/specialreg.h > > Modified: stable/7/sys/amd64/amd64/amd64_mem.c > =========================================================================== >=== --- stable/7/sys/amd64/amd64/amd64_mem.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/amd64/amd64/amd64_mem.c Tue Jun 30 17:10:08 > 2009 (r195197) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > #include > #include > > @@ -677,8 +678,8 @@ amd64_mem_drvinit(void *unused) > return; > if ((cpu_id & 0xf00) != 0x600 && (cpu_id & 0xf00) != 0xf00) > return; > - if ((strcmp(cpu_vendor, "GenuineIntel") != 0) && > - (strcmp(cpu_vendor, "AuthenticAMD") != 0)) > + if (cpu_vendor_id != CPU_VENDOR_INTEL && > + cpu_vendor_id != CPU_VENDOR_AMD) > return; > mem_range_softc.mr_op = &amd64_mrops; > } > > Modified: stable/7/sys/amd64/amd64/identcpu.c > =========================================================================== >=== --- stable/7/sys/amd64/amd64/identcpu.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/amd64/amd64/identcpu.c Tue Jun 30 17:10:08 > 2009 (r195197) @@ -69,6 +69,7 @@ void identify_cpu(void); > void earlysetcpuclass(void); > void panicifcpuunsupported(void); > > +static u_int find_cpu_vendor_id(void); > static void print_AMD_info(void); > static void print_AMD_assoc(int i); > > @@ -95,6 +96,14 @@ static struct { > { "Sledgehammer", CPUCLASS_K8 }, /* CPU_SLEDGEHAMMER */ > }; > > +static struct { > + char *vendor; > + u_int vendor_id; > +} cpu_vendors[] = { > + { INTEL_VENDOR_ID, CPU_VENDOR_INTEL }, /* GenuineIntel */ > + { AMD_VENDOR_ID, CPU_VENDOR_AMD }, /* AuthenticAMD */ > +}; > + > void > printcpuinfo(void) > { > @@ -115,10 +124,10 @@ printcpuinfo(void) > } > } > > - if (strcmp(cpu_vendor, "GenuineIntel") == 0) { > + if (cpu_vendor_id == CPU_VENDOR_INTEL) { > /* Please make up your mind folks! */ > strcat(cpu_model, "EM64T"); > - } else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { > + } else if (cpu_vendor_id == CPU_VENDOR_AMD) { > /* > * Values taken from AMD Processor Recognition > * http://www.amd.com/K6/k6docs/pdf/20734g.pdf > @@ -158,13 +167,13 @@ printcpuinfo(void) > printf("Unknown"); /* will panic below... */ > } > printf("-class CPU)\n"); > - if(*cpu_vendor) > - printf(" Origin = \"%s\"",cpu_vendor); > - if(cpu_id) > + if (*cpu_vendor) > + printf(" Origin = \"%s\"", cpu_vendor); > + if (cpu_id) > printf(" Id = 0x%x", cpu_id); > > - if (strcmp(cpu_vendor, "GenuineIntel") == 0 || > - strcmp(cpu_vendor, "AuthenticAMD") == 0) { > + if (cpu_vendor_id == CPU_VENDOR_INTEL || > + cpu_vendor_id == CPU_VENDOR_AMD) { > printf(" Stepping = %u", cpu_id & 0xf); > if (cpu_high > 0) { > u_int cmp = 1, htt = 1; > @@ -336,22 +345,28 @@ printcpuinfo(void) > ); > } > > - if (cpu_feature & CPUID_HTT && strcmp(cpu_vendor, > - "AuthenticAMD") == 0) > + if ((cpu_feature & CPUID_HTT) && > + cpu_vendor_id == CPU_VENDOR_AMD) > cpu_feature &= ~CPUID_HTT; > > /* > * If this CPU supports P-state invariant TSC then > * mention the capability. > */ > - if (!tsc_is_invariant && > - (strcmp(cpu_vendor, "AuthenticAMD") == 0 && > - ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 || > - AMD64_CPU_FAMILY(cpu_id) >= 0x10 || > - cpu_id == 0x60fb2))) { > - tsc_is_invariant = 1; > - printf("\n TSC: P-state invariant"); > + switch (cpu_vendor_id) { > + case CPU_VENDOR_AMD: > + if ((amd_pminfo & AMDPM_TSC_INVARIANT) || > + AMD64_CPU_FAMILY(cpu_id) >= 0x10 || > + cpu_id == 0x60fb2) > + tsc_is_invariant = 1; > + break; > + case CPU_VENDOR_INTEL: > + if (amd_pminfo & AMDPM_TSC_INVARIANT) > + tsc_is_invariant = 1; > + break; > } > + if (tsc_is_invariant) > + printf("\n TSC: P-state invariant"); > > /* > * If this CPU supports HTT or CMP then mention the > @@ -359,10 +374,10 @@ printcpuinfo(void) > */ > if (cpu_feature & CPUID_HTT) > htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16; > - if (strcmp(cpu_vendor, "AuthenticAMD") == 0 && > + if (cpu_vendor_id == CPU_VENDOR_AMD && > (amd_feature2 & AMDID2_CMP)) > cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; > - else if (strcmp(cpu_vendor, "GenuineIntel") == 0 && > + else if (cpu_vendor_id == CPU_VENDOR_INTEL && > (cpu_high >= 4)) { > cpuid_count(4, 0, regs); > if ((regs[0] & 0x1f) != 0) > @@ -382,7 +397,7 @@ printcpuinfo(void) > if (!bootverbose) > return; > > - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) > + if (cpu_vendor_id == CPU_VENDOR_AMD) > print_AMD_info(); > } > > @@ -441,6 +456,7 @@ identify_cpu(void) > ((u_int *)&cpu_vendor)[1] = regs[3]; > ((u_int *)&cpu_vendor)[2] = regs[2]; > cpu_vendor[12] = '\0'; > + cpu_vendor_id = find_cpu_vendor_id(); > > do_cpuid(1, regs); > cpu_id = regs[0]; > @@ -448,8 +464,8 @@ identify_cpu(void) > cpu_feature = regs[3]; > cpu_feature2 = regs[2]; > > - if (strcmp(cpu_vendor, "GenuineIntel") == 0 || > - strcmp(cpu_vendor, "AuthenticAMD") == 0) { > + if (cpu_vendor_id == CPU_VENDOR_INTEL || > + cpu_vendor_id == CPU_VENDOR_AMD) { > do_cpuid(0x80000000, regs); > cpu_exthigh = regs[0]; > } > @@ -471,6 +487,17 @@ identify_cpu(void) > cpu = CPU_CLAWHAMMER; > } > > +static u_int > +find_cpu_vendor_id(void) > +{ > + int i; > + > + for (i = 0; i < sizeof(cpu_vendors) / sizeof(cpu_vendors[0]); i++) > + if (strcmp(cpu_vendor, cpu_vendors[i].vendor) == 0) > + return (cpu_vendors[i].vendor_id); > + return (0); > +} > + > static void > print_AMD_assoc(int i) > { > > Modified: stable/7/sys/amd64/amd64/initcpu.c > =========================================================================== >=== --- stable/7/sys/amd64/amd64/initcpu.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/amd64/amd64/initcpu.c Tue Jun 30 17:10:08 > 2009 (r195197) @@ -60,6 +60,7 @@ u_int cpu_id; /* Stepping ID */ > u_int cpu_procinfo; /* HyperThreading Info / Brand Index / CLFUSH */ > u_int cpu_procinfo2; /* Multicore info */ > char cpu_vendor[20]; /* CPU Origin code */ > +u_int cpu_vendor_id; /* CPU vendor ID */ > u_int cpu_fxsr; /* SSE enabled */ > u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */ > > > Modified: stable/7/sys/amd64/amd64/local_apic.c > =========================================================================== >=== --- stable/7/sys/amd64/amd64/local_apic.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/amd64/amd64/local_apic.c Tue Jun 30 > 17:10:08 2009 (r195197) @@ -323,7 +323,7 @@ lapic_setup(int boot) > > /* XXX: Error and thermal LVTs */ > > - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { > + if (cpu_vendor_id == CPU_VENDOR_AMD) { > /* > * Detect the presence of C1E capability mostly on latest > * dual-cores (or future) k8 family. This feature renders > > Modified: stable/7/sys/amd64/amd64/mp_machdep.c > =========================================================================== >=== --- stable/7/sys/amd64/amd64/mp_machdep.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/amd64/amd64/mp_machdep.c Tue Jun 30 > 17:10:08 2009 (r195197) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); > #include > > #include > +#include > #include > #include > #include > @@ -376,8 +377,7 @@ cpu_mp_start(void) > * First determine if this is an Intel processor which claims > * to have hyperthreading support. > */ > - if ((cpu_feature & CPUID_HTT) && > - (strcmp(cpu_vendor, "GenuineIntel") == 0)) { > + if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) { > /* > * If the "deterministic cache parameters" cpuid calls > * are available, use them. > > Modified: stable/7/sys/amd64/amd64/msi.c > =========================================================================== >=== --- stable/7/sys/amd64/amd64/msi.c Tue Jun 30 15:23:16 2009 (r195196) > +++ stable/7/sys/amd64/amd64/msi.c Tue Jun 30 17:10:08 2009 (r195197) @@ > -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -211,8 +212,8 @@ msi_init(void) > { > > /* Check if we have a supported CPU. */ > - if (!(strcmp(cpu_vendor, "GenuineIntel") == 0 || > - strcmp(cpu_vendor, "AuthenticAMD") == 0)) > + if (!(cpu_vendor_id == CPU_VENDOR_INTEL || > + cpu_vendor_id == CPU_VENDOR_AMD)) > return; > > msi_enabled = 1; > > Modified: stable/7/sys/amd64/include/cputypes.h > =========================================================================== >=== --- stable/7/sys/amd64/include/cputypes.h Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/amd64/include/cputypes.h Tue Jun 30 > 17:10:08 2009 (r195197) @@ -33,15 +33,21 @@ > /* > * Classes of processor. > */ > -#define CPUCLASS_X86 0 /* X86 */ > -#define CPUCLASS_K8 1 /* K8 AMD64 class */ > +#define CPUCLASS_X86 0 /* X86 */ > +#define CPUCLASS_K8 1 /* K8 AMD64 class */ > > /* > * Kinds of processor. > */ > -#define CPU_X86 0 /* Intel */ > -#define CPU_CLAWHAMMER 1 /* AMD Clawhammer */ > -#define CPU_SLEDGEHAMMER 2 /* AMD Sledgehammer */ > +#define CPU_X86 0 /* Intel */ > +#define CPU_CLAWHAMMER 1 /* AMD Clawhammer */ > +#define CPU_SLEDGEHAMMER 2 /* AMD Sledgehammer */ > + > +/* > + * Vendors of processor. > + */ > +#define CPU_VENDOR_AMD 0x1022 /* AMD */ > +#define CPU_VENDOR_INTEL 0x8086 /* Intel */ > > #ifndef LOCORE > extern int cpu; > > Modified: stable/7/sys/amd64/include/md_var.h > =========================================================================== >=== --- stable/7/sys/amd64/include/md_var.h Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/amd64/include/md_var.h Tue Jun 30 17:10:08 > 2009 (r195197) @@ -52,6 +52,7 @@ extern u_int cpu_mxcsr_mask; > extern u_int cpu_procinfo; > extern u_int cpu_procinfo2; > extern char cpu_vendor[]; > +extern u_int cpu_vendor_id; > extern char kstack[]; > extern char sigcode[]; > extern int szsigcode; > > Modified: stable/7/sys/amd64/include/specialreg.h > =========================================================================== >=== --- stable/7/sys/amd64/include/specialreg.h Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/amd64/include/specialreg.h Tue Jun 30 > 17:10:08 2009 (r195197) @@ -204,8 +204,8 @@ > /* > * CPUID manufacturers identifiers > */ > -#define INTEL_VENDOR_ID "GenuineIntel" > -#define AMD_VENDOR_ID "AuthenticAMD" > +#define AMD_VENDOR_ID "AuthenticAMD" > +#define INTEL_VENDOR_ID "GenuineIntel" > > /* > * Model-specific registers for the i386 family > > Modified: stable/7/sys/dev/coretemp/coretemp.c > =========================================================================== >=== --- stable/7/sys/dev/coretemp/coretemp.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/dev/coretemp/coretemp.c Tue Jun 30 17:10:08 > 2009 (r195197) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > > #include > #include > +#include > #include > > struct coretemp_softc { > @@ -94,7 +95,7 @@ coretemp_identify(driver_t *driver, devi > return; > > /* Check that CPUID 0x06 is supported and the vendor is Intel.*/ > - if (cpu_high < 6 || strcmp(cpu_vendor, "GenuineIntel")) > + if (cpu_high < 6 || cpu_vendor_id != CPU_VENDOR_INTEL) > return; > /* > * CPUID 0x06 returns 1 if the processor has on-die thermal > > Modified: stable/7/sys/dev/hwpmc/hwpmc_intel.c > =========================================================================== >=== --- stable/7/sys/dev/hwpmc/hwpmc_intel.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/dev/hwpmc/hwpmc_intel.c Tue Jun 30 17:10:08 > 2009 (r195197) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); > #include > > #include > +#include > #include > #include > > @@ -79,7 +80,7 @@ pmc_intel_initialize(void) > enum pmc_cputype cputype; > int error, model, nclasses, ncpus; > > - KASSERT(strcmp(cpu_vendor, "GenuineIntel") == 0, > + KASSERT(cpu_vendor_id == CPU_VENDOR_INTEL, > ("[intel,%d] Initializing non-intel processor", __LINE__)); > > PMCDBG(MDP,INI,0, "intel-initialize cpuid=0x%x", cpu_id); > > Modified: stable/7/sys/dev/hwpmc/hwpmc_piv.c > =========================================================================== >=== --- stable/7/sys/dev/hwpmc/hwpmc_piv.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/dev/hwpmc/hwpmc_piv.c Tue Jun 30 17:10:08 > 2009 (r195197) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); > > #include > #include > +#include > #include > #include > > @@ -1610,7 +1611,7 @@ pmc_p4_initialize(struct pmc_mdep *md, i > struct p4_event_descr *pe; > > KASSERT(md != NULL, ("[p4,%d] md is NULL", __LINE__)); > - KASSERT(strcmp(cpu_vendor, "GenuineIntel") == 0, > + KASSERT(cpu_vendor_id == CPU_VENDOR_INTEL, > ("[p4,%d] Initializing non-intel processor", __LINE__)); > > PMCDBG(MDP,INI,1, "%s", "p4-initialize"); > > Modified: stable/7/sys/dev/hwpmc/hwpmc_ppro.c > =========================================================================== >=== --- stable/7/sys/dev/hwpmc/hwpmc_ppro.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/dev/hwpmc/hwpmc_ppro.c Tue Jun 30 17:10:08 > 2009 (r195197) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); > > #include > #include > +#include > #include > #include > #include > @@ -781,7 +782,7 @@ pmc_p6_initialize(struct pmc_mdep *md, i > { > struct pmc_classdep *pcd; > > - KASSERT(strcmp(cpu_vendor, "GenuineIntel") == 0, > + KASSERT(cpu_vendor_id == CPU_VENDOR_INTEL, > ("[p6,%d] Initializing non-intel processor", __LINE__)); > > PMCDBG(MDP,INI,1, "%s", "p6-initialize"); > > Modified: stable/7/sys/dev/hwpmc/hwpmc_x86.c > =========================================================================== >=== --- stable/7/sys/dev/hwpmc/hwpmc_x86.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/dev/hwpmc/hwpmc_x86.c Tue Jun 30 17:10:08 > 2009 (r195197) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); > #include > > #include > +#include > #include > #include > #include > @@ -252,9 +253,9 @@ pmc_md_initialize() > > /* determine the CPU kind */ > md = NULL; > - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) > + if (cpu_vendor_id == CPU_VENDOR_AMD) > md = pmc_amd_initialize(); > - else if (strcmp(cpu_vendor, "GenuineIntel") == 0) > + else if (cpu_vendor_id == CPU_VENDOR_INTEL) > md = pmc_intel_initialize(); > else > KASSERT(0, ("[x86,%d] Unknown vendor", __LINE__)); > @@ -270,9 +271,9 @@ pmc_md_initialize() > void > pmc_md_finalize(struct pmc_mdep *md) > { > - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) > + if (cpu_vendor_id == CPU_VENDOR_AMD) > pmc_amd_finalize(md); > - else if (strcmp(cpu_vendor, "GenuineIntel") == 0) > + else if (cpu_vendor_id == CPU_VENDOR_INTEL) > pmc_intel_finalize(md); > else > KASSERT(0, ("[x86,%d] Unknown vendor", __LINE__)); > > Modified: stable/7/sys/i386/cpufreq/est.c > =========================================================================== >=== --- stable/7/sys/i386/cpufreq/est.c Tue Jun 30 15:23:16 2009 (r195196) > +++ stable/7/sys/i386/cpufreq/est.c Tue Jun 30 17:10:08 2009 (r195197) @@ > -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); > > #include "cpufreq_if.h" > #include > +#include > #include > #include > > @@ -54,6 +55,10 @@ __FBSDID("$FreeBSD$"); > #define MSR_MISC_ENABLE 0x1a0 > #define MSR_SS_ENABLE (1<<16) > > +#ifndef CPU_VENDOR_CENTAUR > +#define CPU_VENDOR_CENTAUR 0x111d > +#endif > + > /* Frequency and MSR control values. */ > typedef struct { > uint16_t freq; > @@ -64,7 +69,7 @@ typedef struct { > > /* Identifying characteristics of a processor and supported frequencies. > */ typedef struct { > - const char *vendor; > + const u_int vendor_id; > uint32_t id32; > freq_info *freqtab; > } cpu_info; > @@ -88,12 +93,10 @@ struct est_softc { > #define FREQ_INFO(MHz, mV, bus_clk) \ > FREQ_INFO_PWR(MHz, mV, bus_clk, CPUFREQ_VAL_UNKNOWN) > #define INTEL(tab, zhi, vhi, zlo, vlo, bus_clk) \ > - { intel_id, ID32(zhi, vhi, zlo, vlo, bus_clk), tab } > + { CPU_VENDOR_INTEL, ID32(zhi, vhi, zlo, vlo, bus_clk), tab } > #define CENTAUR(tab, zhi, vhi, zlo, vlo, bus_clk) \ > - { centaur_id, ID32(zhi, vhi, zlo, vlo, bus_clk), tab } > + { CPU_VENDOR_CENTAUR, ID32(zhi, vhi, zlo, vlo, bus_clk), tab } > > -const char intel_id[] = "GenuineIntel"; > -const char centaur_id[] = "CentaurHauls"; > static int msr_info_enabled = 0; > TUNABLE_INT("hw.est.msr_info", &msr_info_enabled); > > @@ -891,7 +894,7 @@ static cpu_info ESTprocs[] = { > CENTAUR(C7M_772_ULV, 1200, 844, 400, 796, 100), > CENTAUR(C7M_779_ULV, 1000, 796, 400, 796, 100), > CENTAUR(C7M_770_ULV, 1000, 844, 400, 796, 100), > - { NULL, 0, NULL }, > + { 0, 0, NULL }, > }; > > static void est_identify(driver_t *driver, device_t parent); > @@ -958,8 +961,8 @@ est_identify(driver_t *driver, device_t > return; > > /* Check that CPUID is supported and the vendor is Intel.*/ > - if (cpu_high == 0 || (strcmp(cpu_vendor, intel_id) != 0 && > - strcmp(cpu_vendor, centaur_id) != 0)) > + if (cpu_high == 0 || (cpu_vendor_id != CPU_VENDOR_INTEL && > + cpu_vendor_id != CPU_VENDOR_CENTAUR)) > return; > > /* > @@ -1159,7 +1162,7 @@ est_table_info(device_t dev, uint64_t ms > /* Find a table which matches (vendor, id32). */ > id = msr >> 32; > for (p = ESTprocs; p->id32 != 0; p++) { > - if (strcmp(p->vendor, cpu_vendor) == 0 && p->id32 == id) > + if (p->vendor_id == cpu_vendor_id && p->id32 == id) > break; > } > if (p->id32 == 0) > > Modified: stable/7/sys/i386/i386/i686_mem.c > =========================================================================== >=== --- stable/7/sys/i386/i386/i686_mem.c Tue Jun 30 15:23:16 2009 (r195196) > +++ stable/7/sys/i386/i386/i686_mem.c Tue Jun 30 17:10:08 2009 (r195197) @@ > -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > #include > #include > > @@ -677,8 +678,8 @@ i686_mem_drvinit(void *unused) > return; > if ((cpu_id & 0xf00) != 0x600 && (cpu_id & 0xf00) != 0xf00) > return; > - if ((strcmp(cpu_vendor, "GenuineIntel") != 0) && > - (strcmp(cpu_vendor, "AuthenticAMD") != 0)) > + if (cpu_vendor_id != CPU_VENDOR_INTEL && > + cpu_vendor_id != CPU_VENDOR_AMD) > return; > mem_range_softc.mr_op = &i686_mrops; > } > > Modified: stable/7/sys/i386/i386/identcpu.c > =========================================================================== >=== --- stable/7/sys/i386/i386/identcpu.c Tue Jun 30 15:23:16 2009 (r195196) > +++ stable/7/sys/i386/i386/identcpu.c Tue Jun 30 17:10:08 2009 (r195197) @@ > -77,6 +77,7 @@ void panicifcpuunsupported(void); > > static void identifycyrix(void); > static void init_exthigh(void); > +static u_int find_cpu_vendor_id(void); > static void print_AMD_info(void); > static void print_INTEL_info(void); > static void print_INTEL_TLB(u_int data); > @@ -138,6 +139,26 @@ static struct { > { "Pentium 4", CPUCLASS_686 }, /* CPU_P4 */ > }; > > +static struct { > + char *vendor; > + u_int vendor_id; > +} cpu_vendors[] = { > + { INTEL_VENDOR_ID, CPU_VENDOR_INTEL }, /* GenuineIntel */ > + { AMD_VENDOR_ID, CPU_VENDOR_AMD }, /* AuthenticAMD */ > + { CENTAUR_VENDOR_ID, CPU_VENDOR_CENTAUR }, /* CentaurHauls */ > + { NSC_VENDOR_ID, CPU_VENDOR_NSC }, /* Geode by NSC */ > + { CYRIX_VENDOR_ID, CPU_VENDOR_CYRIX }, /* CyrixInstead */ > + { TRANSMETA_VENDOR_ID, CPU_VENDOR_TRANSMETA }, /* GenuineTMx86 */ > + { SIS_VENDOR_ID, CPU_VENDOR_SIS }, /* SiS SiS SiS */ > + { UMC_VENDOR_ID, CPU_VENDOR_UMC }, /* UMC UMC UMC */ > + { NEXGEN_VENDOR_ID, CPU_VENDOR_NEXGEN }, /* NexGenDriven */ > + { RISE_VENDOR_ID, CPU_VENDOR_RISE }, /* RiseRiseRise */ > +#if 0 > + /* XXX CPUID 8000_0000h and 8086_0000h, not 0000_0000h */ > + { "TransmetaCPU", CPU_VENDOR_TRANSMETA }, > +#endif > +}; > + > #if defined(I586_CPU) && !defined(NO_F00F_HACK) > int has_f00f_bug = 0; /* Initialized so that it can be patched. */ > #endif > @@ -150,12 +171,11 @@ init_exthigh(void) > > if (done == 0) { > if (cpu_high > 0 && > - (strcmp(cpu_vendor, "GenuineIntel") == 0 || > - strcmp(cpu_vendor, "AuthenticAMD") == 0 || > - strcmp(cpu_vendor, "GenuineTMx86") == 0 || > - strcmp(cpu_vendor, "TransmetaCPU") == 0 || > - strcmp(cpu_vendor, "CentaurHauls") == 0 || > - strcmp(cpu_vendor, "Geode by NSC") == 0)) { > + (cpu_vendor_id == CPU_VENDOR_INTEL || > + cpu_vendor_id == CPU_VENDOR_AMD || > + cpu_vendor_id == CPU_VENDOR_TRANSMETA || > + cpu_vendor_id == CPU_VENDOR_CENTAUR || > + cpu_vendor_id == CPU_VENDOR_NSC)) { > do_cpuid(0x80000000, regs); > if (regs[0] >= 0x80000000) > cpu_exthigh = regs[0]; > @@ -186,7 +206,7 @@ printcpuinfo(void) > } > } > > - if (strcmp(cpu_vendor, "GenuineIntel") == 0) { > + if (cpu_vendor_id == CPU_VENDOR_INTEL) { > if ((cpu_id & 0xf00) > 0x300) { > u_int brand_index; > u_int model; > @@ -330,7 +350,7 @@ printcpuinfo(void) > cpu_brandtable[brand_index]); > } > } > - } else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { > + } else if (cpu_vendor_id == CPU_VENDOR_AMD) { > /* > * Values taken from AMD Processor Recognition > * http://www.amd.com/K6/k6docs/pdf/20734g.pdf > @@ -410,7 +430,7 @@ printcpuinfo(void) > enable_K6_wt_alloc(); > } > #endif > - } else if (strcmp(cpu_vendor, "CyrixInstead") == 0) { > + } else if (cpu_vendor_id == CPU_VENDOR_CYRIX) { > strcpy(cpu_model, "Cyrix "); > switch (cpu_id & 0xff0) { > case 0x440: > @@ -546,7 +566,7 @@ printcpuinfo(void) > } > break; > } > - } else if (strcmp(cpu_vendor, "RiseRiseRise") == 0) { > + } else if (cpu_vendor_id == CPU_VENDOR_RISE) { > strcpy(cpu_model, "Rise "); > switch (cpu_id & 0xff0) { > case 0x500: > @@ -555,7 +575,7 @@ printcpuinfo(void) > default: > strcat(cpu_model, "Unknown"); > } > - } else if (strcmp(cpu_vendor, "CentaurHauls") == 0) { > + } else if (cpu_vendor_id == CPU_VENDOR_CENTAUR) { > switch (cpu_id & 0xff0) { > case 0x540: > strcpy(cpu_model, "IDT WinChip C6"); > @@ -586,9 +606,9 @@ printcpuinfo(void) > default: > strcpy(cpu_model, "VIA/IDT Unknown"); > } > - } else if (strcmp(cpu_vendor, "IBM") == 0) { > + } else if (cpu_vendor_id == CPU_VENDOR_IBM) { > strcpy(cpu_model, "Blue Lightning CPU"); > - } else if (strcmp(cpu_vendor, "Geode by NSC") == 0) { > + } else if (cpu_vendor_id == CPU_VENDOR_NSC) { > switch (cpu_id & 0xfff) { > case 0x540: > strcpy(cpu_model, "Geode SC1100"); > @@ -652,17 +672,16 @@ printcpuinfo(void) > if(cpu_id) > printf(" Id = 0x%x", cpu_id); > > - if (strcmp(cpu_vendor, "GenuineIntel") == 0 || > - strcmp(cpu_vendor, "AuthenticAMD") == 0 || > - strcmp(cpu_vendor, "GenuineTMx86") == 0 || > - strcmp(cpu_vendor, "TransmetaCPU") == 0 || > - strcmp(cpu_vendor, "RiseRiseRise") == 0 || > - strcmp(cpu_vendor, "CentaurHauls") == 0 || > - strcmp(cpu_vendor, "Geode by NSC") == 0 || > - ((strcmp(cpu_vendor, "CyrixInstead") == 0) && > + if (cpu_vendor_id == CPU_VENDOR_INTEL || > + cpu_vendor_id == CPU_VENDOR_AMD || > + cpu_vendor_id == CPU_VENDOR_TRANSMETA || > + cpu_vendor_id == CPU_VENDOR_RISE || > + cpu_vendor_id == CPU_VENDOR_CENTAUR || > + cpu_vendor_id == CPU_VENDOR_NSC || > + (cpu_vendor_id == CPU_VENDOR_CYRIX && > ((cpu_id & 0xf00) > 0x500))) { > printf(" Stepping = %u", cpu_id & 0xf); > - if (strcmp(cpu_vendor, "CyrixInstead") == 0) > + if (cpu_vendor_id == CPU_VENDOR_CYRIX) > printf(" DIR=0x%04x", cyrix_did); > if (cpu_high > 0) { > u_int cmp = 1, htt = 1; > @@ -834,22 +853,28 @@ printcpuinfo(void) > ); > } > > - if (cpu_feature & CPUID_HTT && strcmp(cpu_vendor, > - "AuthenticAMD") == 0) > + if ((cpu_feature & CPUID_HTT) && > + cpu_vendor_id == CPU_VENDOR_AMD) > cpu_feature &= ~CPUID_HTT; > > /* > * If this CPU supports P-state invariant TSC then > * mention the capability. > */ > - if (!tsc_is_invariant && > - (strcmp(cpu_vendor, "AuthenticAMD") == 0 && > - ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 || > - I386_CPU_FAMILY(cpu_id) >= 0x10 || > - cpu_id == 0x60fb2))) { > - tsc_is_invariant = 1; > - printf("\n TSC: P-state invariant"); > + switch (cpu_vendor_id) { > + case CPU_VENDOR_AMD: > + if ((amd_pminfo & AMDPM_TSC_INVARIANT) || > + I386_CPU_FAMILY(cpu_id) >= 0x10 || > + cpu_id == 0x60fb2) > + tsc_is_invariant = 1; > + break; > + case CPU_VENDOR_INTEL: > + if (amd_pminfo & AMDPM_TSC_INVARIANT) > + tsc_is_invariant = 1; > + break; > } > + if (tsc_is_invariant) > + printf("\n TSC: P-state invariant"); > > /* > * If this CPU supports HTT or CMP then mention the > @@ -857,10 +882,10 @@ printcpuinfo(void) > */ > if (cpu_feature & CPUID_HTT) > htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16; > - if (strcmp(cpu_vendor, "AuthenticAMD") == 0 && > + if (cpu_vendor_id == CPU_VENDOR_AMD && > (amd_feature2 & AMDID2_CMP)) > cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; > - else if (strcmp(cpu_vendor, "GenuineIntel") == 0 && > + else if (cpu_vendor_id == CPU_VENDOR_INTEL && > (cpu_high >= 4)) { > cpuid_count(4, 0, regs); > if ((regs[0] & 0x1f) != 0) > @@ -872,7 +897,7 @@ printcpuinfo(void) > printf("\n Logical CPUs per core: %d", > htt / cmp); > } > - } else if (strcmp(cpu_vendor, "CyrixInstead") == 0) { > + } else if (cpu_vendor_id == CPU_VENDOR_CYRIX) { > printf(" DIR=0x%04x", cyrix_did); > printf(" Stepping=%u", (cyrix_did & 0xf000) >> 12); > printf(" Revision=%u", (cyrix_did & 0x0f00) >> 8); > @@ -881,7 +906,7 @@ printcpuinfo(void) > printf("\n CPU cache: write-through mode"); > #endif > } > - if (strcmp(cpu_vendor, "CentaurHauls") == 0) > + if (cpu_vendor_id == CPU_VENDOR_CENTAUR) > print_via_padlock_info(); > > /* Avoid ugly blank lines: only print newline when we have to. */ > @@ -891,12 +916,11 @@ printcpuinfo(void) > if (!bootverbose) > return; > > - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) > + if (cpu_vendor_id == CPU_VENDOR_AMD) > print_AMD_info(); > - else if (strcmp(cpu_vendor, "GenuineIntel") == 0) > + else if (cpu_vendor_id == CPU_VENDOR_INTEL) > print_INTEL_info(); > - else if (strcmp(cpu_vendor, "GenuineTMx86") == 0 || > - strcmp(cpu_vendor, "TransmetaCPU") == 0) > + else if (cpu_vendor_id == CPU_VENDOR_TRANSMETA) > print_transmeta_info(); > } > > @@ -1091,9 +1115,11 @@ finishidentcpu(void) > u_char ccr3; > u_int regs[4]; > > + cpu_vendor_id = find_cpu_vendor_id(); > + > /* Detect AMD features (PTE no-execute bit, 3dnow, 64 bit mode etc) */ > - if (strcmp(cpu_vendor, "GenuineIntel") == 0 || > - strcmp(cpu_vendor, "AuthenticAMD") == 0) { > + if (cpu_vendor_id == CPU_VENDOR_INTEL || > + cpu_vendor_id == CPU_VENDOR_AMD) { > init_exthigh(); > if (cpu_exthigh >= 0x80000001) { > do_cpuid(0x80000001, regs); > @@ -1108,7 +1134,7 @@ finishidentcpu(void) > do_cpuid(0x80000008, regs); > cpu_procinfo2 = regs[2]; > } > - } else if (strcmp(cpu_vendor, "CyrixInstead") == 0) { > + } else if (cpu_vendor_id == CPU_VENDOR_CYRIX) { > if (cpu == CPU_486) { > /* > * These conditions are equivalent to: > @@ -1118,6 +1144,7 @@ finishidentcpu(void) > isblue = identblue(); > if (isblue == IDENTBLUE_IBMCPU) { > strcpy(cpu_vendor, "IBM"); > + cpu_vendor_id = CPU_VENDOR_IBM; > cpu = CPU_BLUE; > return; > } > @@ -1191,12 +1218,24 @@ finishidentcpu(void) > isblue = identblue(); > if (isblue == IDENTBLUE_IBMCPU) { > strcpy(cpu_vendor, "IBM"); > + cpu_vendor_id = CPU_VENDOR_IBM; > cpu = CPU_BLUE; > return; > } > } > } > > +static u_int > +find_cpu_vendor_id(void) > +{ > + int i; > + > + for (i = 0; i < sizeof(cpu_vendors) / sizeof(cpu_vendors[0]); i++) > + if (strcmp(cpu_vendor, cpu_vendors[i].vendor) == 0) > + return (cpu_vendors[i].vendor_id); > + return (0); > +} > + > static void > print_AMD_assoc(int i) > { > > Modified: stable/7/sys/i386/i386/initcpu.c > =========================================================================== >=== --- stable/7/sys/i386/i386/initcpu.c Tue Jun 30 15:23:16 2009 (r195196) > +++ stable/7/sys/i386/i386/initcpu.c Tue Jun 30 17:10:08 2009 (r195197) @@ > -90,6 +90,7 @@ u_int cpu_id = 0; /* Stepping ID */ > u_int cpu_procinfo = 0; /* HyperThreading Info / Brand Index / CLFUSH */ > u_int cpu_procinfo2 = 0; /* Multicore info */ > char cpu_vendor[20] = ""; /* CPU Origin code */ > +u_int cpu_vendor_id = 0; /* CPU vendor ID */ > > SYSCTL_UINT(_hw, OID_AUTO, via_feature_rng, CTLFLAG_RD, > &via_feature_rng, 0, "VIA C3/C7 RNG feature available in CPU"); > > Modified: stable/7/sys/i386/i386/k6_mem.c > =========================================================================== >=== --- stable/7/sys/i386/i386/k6_mem.c Tue Jun 30 15:23:16 2009 (r195196) > +++ stable/7/sys/i386/i386/k6_mem.c Tue Jun 30 17:10:08 2009 (r195197) @@ > -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > #include > #include > > @@ -175,7 +176,7 @@ static void > k6_mem_drvinit(void *unused) > { > > - if (strcmp(cpu_vendor, "AuthenticAMD") != 0) > + if (cpu_vendor_id != CPU_VENDOR_AMD) > return; > if ((cpu_id & 0xf00) != 0x500) > return; > > Modified: stable/7/sys/i386/i386/local_apic.c > =========================================================================== >=== --- stable/7/sys/i386/i386/local_apic.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/i386/i386/local_apic.c Tue Jun 30 17:10:08 > 2009 (r195197) @@ -325,7 +325,7 @@ lapic_setup(int boot) > > /* XXX: Error and thermal LVTs */ > > - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { > + if (cpu_vendor_id == CPU_VENDOR_AMD) { > /* > * Detect the presence of C1E capability mostly on latest > * dual-cores (or future) k8 family. This feature renders > @@ -1073,7 +1073,7 @@ apic_init(void *dummy __unused) > * CPUs during early startup. We need to turn the local APIC back > * on on such CPUs now. > */ > - if (cpu == CPU_686 && strcmp(cpu_vendor, "GenuineIntel") == 0 && > + if (cpu == CPU_686 && cpu_vendor_id == CPU_VENDOR_INTEL && > (cpu_id & 0xff0) == 0x610) { > apic_base = rdmsr(MSR_APICBASE); > apic_base |= APICBASE_ENABLED; > > Modified: stable/7/sys/i386/i386/longrun.c > =========================================================================== >=== --- stable/7/sys/i386/i386/longrun.c Tue Jun 30 15:23:16 2009 (r195196) > +++ stable/7/sys/i386/i386/longrun.c Tue Jun 30 17:10:08 2009 (r195197) @@ > -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > #include > #include > > @@ -262,8 +263,8 @@ tmx86_longrun_profile_sysctl(SYSCTL_HAND > static void > setup_tmx86_longrun(void *dummy __unused) > { > - if (strcmp(cpu_vendor, "GenuineTMx86") != 0 && > - strcmp(cpu_vendor, "TransmetaCPU") != 0) > + > + if (cpu_vendor_id != CPU_VENDOR_TRANSMETA) > return; > > crusoe_longrun = tmx86_get_longrun_mode(); > > Modified: stable/7/sys/i386/i386/mp_machdep.c > =========================================================================== >=== --- stable/7/sys/i386/i386/mp_machdep.c Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/i386/i386/mp_machdep.c Tue Jun 30 17:10:08 > 2009 (r195197) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); > #include > > #include > +#include > #include > #include > #include > @@ -425,8 +426,7 @@ cpu_mp_start(void) > * First determine if this is an Intel processor which claims > * to have hyperthreading support. > */ > - if ((cpu_feature & CPUID_HTT) && > - (strcmp(cpu_vendor, "GenuineIntel") == 0)) { > + if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) { > /* > * If the "deterministic cache parameters" cpuid calls > * are available, use them. > > Modified: stable/7/sys/i386/i386/msi.c > =========================================================================== >=== --- stable/7/sys/i386/i386/msi.c Tue Jun 30 15:23:16 2009 (r195196) +++ > stable/7/sys/i386/i386/msi.c Tue Jun 30 17:10:08 2009 (r195197) @@ -46,6 > +46,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -211,8 +212,8 @@ msi_init(void) > { > > /* Check if we have a supported CPU. */ > - if (!(strcmp(cpu_vendor, "GenuineIntel") == 0 || > - strcmp(cpu_vendor, "AuthenticAMD") == 0)) > + if (!(cpu_vendor_id == CPU_VENDOR_INTEL || > + cpu_vendor_id == CPU_VENDOR_AMD)) > return; > > msi_enabled = 1; > > Modified: stable/7/sys/i386/include/cputypes.h > =========================================================================== >=== --- stable/7/sys/i386/include/cputypes.h Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/i386/include/cputypes.h Tue Jun 30 17:10:08 > 2009 (r195197) @@ -33,33 +33,49 @@ > /* > * Classes of processor. > */ > -#define CPUCLASS_286 0 > -#define CPUCLASS_386 1 > -#define CPUCLASS_486 2 > -#define CPUCLASS_586 3 > -#define CPUCLASS_686 4 > +#define CPUCLASS_286 0 > +#define CPUCLASS_386 1 > +#define CPUCLASS_486 2 > +#define CPUCLASS_586 3 > +#define CPUCLASS_686 4 > > /* > * Kinds of processor. > */ > -#define CPU_286 0 /* Intel 80286 */ > -#define CPU_386SX 1 /* Intel 80386SX */ > -#define CPU_386 2 /* Intel 80386DX */ > -#define CPU_486SX 3 /* Intel 80486SX */ > -#define CPU_486 4 /* Intel 80486DX */ > -#define CPU_586 5 /* Intel P.....m (I hate lawyers; it's TM) */ > -#define CPU_486DLC 6 /* Cyrix 486DLC */ > -#define CPU_686 7 /* Pentium Pro */ > -#define CPU_M1SC 8 /* Cyrix M1sc (aka 5x86) */ > -#define CPU_M1 9 /* Cyrix M1 (aka 6x86) */ > -#define CPU_BLUE 10 /* IBM BlueLighting CPU */ > -#define CPU_M2 11 /* Cyrix M2 (aka enhanced 6x86 with MMX */ > -#define CPU_NX586 12 /* NexGen (now AMD) 586 */ > -#define CPU_CY486DX 13 /* Cyrix 486S/DX/DX2/DX4 */ > -#define CPU_PII 14 /* Intel Pentium II */ > -#define CPU_PIII 15 /* Intel Pentium III */ > -#define CPU_P4 16 /* Intel Pentium 4 */ > -#define CPU_GEODE1100 17 /* NS Geode SC1100 */ > +#define CPU_286 0 /* Intel 80286 */ > +#define CPU_386SX 1 /* Intel 80386SX */ > +#define CPU_386 2 /* Intel 80386DX */ > +#define CPU_486SX 3 /* Intel 80486SX */ > +#define CPU_486 4 /* Intel 80486DX */ > +#define CPU_586 5 /* Intel Pentium */ > +#define CPU_486DLC 6 /* Cyrix 486DLC */ > +#define CPU_686 7 /* Pentium Pro */ > +#define CPU_M1SC 8 /* Cyrix M1sc (aka 5x86) */ > +#define CPU_M1 9 /* Cyrix M1 (aka 6x86) */ > +#define CPU_BLUE 10 /* IBM BlueLighting CPU */ > +#define CPU_M2 11 /* Cyrix M2 (enhanced 6x86 with MMX) */ > +#define CPU_NX586 12 /* NexGen (now AMD) 586 */ > +#define CPU_CY486DX 13 /* Cyrix 486S/DX/DX2/DX4 */ > +#define CPU_PII 14 /* Intel Pentium II */ > +#define CPU_PIII 15 /* Intel Pentium III */ > +#define CPU_P4 16 /* Intel Pentium 4 */ > +#define CPU_GEODE1100 17 /* NS Geode SC1100 */ > + > +/* > + * Vendors of processor. > + */ > +#define CPU_VENDOR_NSC 0x100b /* NSC */ > +#define CPU_VENDOR_IBM 0x1014 /* IBM */ > +#define CPU_VENDOR_AMD 0x1022 /* AMD */ > +#define CPU_VENDOR_SIS 0x1039 /* SiS */ > +#define CPU_VENDOR_UMC 0x1060 /* UMC */ > +#define CPU_VENDOR_NEXGEN 0x1074 /* Nexgen */ > +#define CPU_VENDOR_CYRIX 0x1078 /* Cyrix */ > +#define CPU_VENDOR_IDT 0x111d /* Centaur/IDT/VIA */ > +#define CPU_VENDOR_TRANSMETA 0x1279 /* Transmeta */ > +#define CPU_VENDOR_INTEL 0x8086 /* Intel */ > +#define CPU_VENDOR_RISE 0xdead2bad /* Rise */ > +#define CPU_VENDOR_CENTAUR CPU_VENDOR_IDT > > #ifndef LOCORE > extern int cpu; > > Modified: stable/7/sys/i386/include/md_var.h > =========================================================================== >=== --- stable/7/sys/i386/include/md_var.h Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/i386/include/md_var.h Tue Jun 30 17:10:08 > 2009 (r195197) @@ -59,6 +59,7 @@ extern u_int cpu_mxcsr_mask; > extern u_int cpu_procinfo; > extern u_int cpu_procinfo2; > extern char cpu_vendor[]; > +extern u_int cpu_vendor_id; > extern u_int cyrix_did; > extern char kstack[]; > extern char sigcode[]; > > Modified: stable/7/sys/i386/include/specialreg.h > =========================================================================== >=== --- stable/7/sys/i386/include/specialreg.h Tue Jun 30 15:23:16 > 2009 (r195196) +++ stable/7/sys/i386/include/specialreg.h Tue Jun 30 > 17:10:08 2009 (r195197) @@ -203,8 +203,16 @@ > /* > * CPUID manufacturers identifiers > */ > -#define INTEL_VENDOR_ID "GenuineIntel" > -#define AMD_VENDOR_ID "AuthenticAMD" > +#define AMD_VENDOR_ID "AuthenticAMD" > +#define CENTAUR_VENDOR_ID "CentaurHauls" > +#define CYRIX_VENDOR_ID "CyrixInstead" > +#define INTEL_VENDOR_ID "GenuineIntel" > +#define NEXGEN_VENDOR_ID "NexGenDriven" > +#define NSC_VENDOR_ID "Geode by NSC" > +#define RISE_VENDOR_ID "RiseRiseRise" > +#define SIS_VENDOR_ID "SiS SiS SiS " > +#define TRANSMETA_VENDOR_ID "GenuineTMx86" > +#define UMC_VENDOR_ID "UMC UMC UMC " > > /* > * Model-specific registers for the i386 family buildkernel fails for me with latest stable: ===> coretemp (all) cc -O2 -fno-strict-aliasing -pipe -march=prescott -D_KERNEL -DKLD_MODULE - std=c99 -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/usr/src/sys/LQC/opt_global.h -I. -I@ -I@/contrib/altq -finline- limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 - fno-common -g -I/usr/obj/usr/src/sys/LQC -mno-align-long-strings -mpreferred- stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 - ffreestanding -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes - Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno- pointer-sign -fformat-extensions -c /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c: In function 'coretemp_identify': /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c:98: error: 'cpu_vendor_id' undeclared (first use in this function) /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c:98: error: (Each undeclared identifier is reported only once /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c:98: error: for each function it appears in.) /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c:98: error: 'CPU_VENDOR_INTEL' undeclared (first use in this function) *** Error code 1 Stop in /usr/src/sys/modules/coretemp. *** Error code 1 Stop in /usr/src/sys/modules. *** Error code 1 Stop in /usr/obj/usr/src/sys/LQC. *** Error code 1 Stop in /usr/src. *** Error code 1 Stop in /usr/src. From avg at freebsd.org Wed Jul 8 08:43:21 2009 From: avg at freebsd.org (Andriy Gapon) Date: Wed Jul 8 08:43:28 2009 Subject: svn commit: r195197 - in stable/7/sys: . amd64/amd64 amd64/include contrib/pf dev/coretemp dev/hwpmc i386/cpufreq i386/i386 i386/include In-Reply-To: <200907081104.29163.makc@issp.ac.ru> References: <200906301710.n5UHA8b0086710@svn.freebsd.org> <200907081104.29163.makc@issp.ac.ru> Message-ID: <4A545875.1080401@freebsd.org> on 08/07/2009 10:04 Max Brazhnikov said the following: > > buildkernel fails for me with latest stable: I almost missed your message - so much of the original commit message you quoted :-) I can not reproduce this build failure here. What arch is this (I assumed i386)? What method of obtaining/updating sources? What non-standard/non-default flags? > ===> coretemp (all) > cc -O2 -fno-strict-aliasing -pipe -march=prescott -D_KERNEL -DKLD_MODULE - > std=c99 -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include > /usr/obj/usr/src/sys/LQC/opt_global.h -I. -I@ -I@/contrib/altq -finline- > limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 - > fno-common -g -I/usr/obj/usr/src/sys/LQC -mno-align-long-strings -mpreferred- > stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 - > ffreestanding -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes - > Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno- > pointer-sign -fformat-extensions -c > /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c > /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c: In function > 'coretemp_identify': > /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c:98: error: > 'cpu_vendor_id' undeclared (first use in this function) > /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c:98: error: (Each > undeclared identifier is reported only once > /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c:98: error: for > each function it appears in.) > /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c:98: error: > 'CPU_VENDOR_INTEL' undeclared (first use in this function) > *** Error code 1 > > Stop in /usr/src/sys/modules/coretemp. > *** Error code 1 -- Andriy Gapon From kib at FreeBSD.org Thu Jul 9 09:12:22 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Jul 9 09:12:38 2009 Subject: svn commit: r195485 - in stable/7/sys: . contrib/pf kern Message-ID: <200907090912.n699CGx0077581@svn.freebsd.org> Author: kib Date: Thu Jul 9 09:12:16 2009 New Revision: 195485 URL: http://svn.freebsd.org/changeset/base/195485 Log: MFC r194993: In lf_iteratelocks_vnode, increment state->ls_threads around iterating of the vnode advisory lock list. This prevents deallocation of state while inside the loop. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/kern_lockf.c Modified: stable/7/sys/kern/kern_lockf.c ============================================================================== --- stable/7/sys/kern/kern_lockf.c Thu Jul 9 01:58:59 2009 (r195484) +++ stable/7/sys/kern/kern_lockf.c Thu Jul 9 09:12:16 2009 (r195485) @@ -1937,9 +1937,14 @@ lf_iteratelocks_vnode(struct vnode *vp, * make sure it doesn't go away before we are finished. */ STAILQ_INIT(&locks); + VI_LOCK(vp); ls = vp->v_lockf; - if (!ls) + if (!ls) { + VI_UNLOCK(vp); return (0); + } + ls->ls_threads++; + VI_UNLOCK(vp); sx_xlock(&ls->ls_lock); LIST_FOREACH(lf, &ls->ls_active, lf_link) { @@ -1960,6 +1965,10 @@ lf_iteratelocks_vnode(struct vnode *vp, STAILQ_INSERT_TAIL(&locks, ldesc, link); } sx_xunlock(&ls->ls_lock); + VI_LOCK(vp); + ls->ls_threads--; + wakeup(ls); + VI_UNLOCK(vp); /* * Call the iterator function for each lock in turn. If the From avg at FreeBSD.org Thu Jul 9 13:48:08 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Thu Jul 9 13:48:19 2009 Subject: svn commit: r195492 - in stable/7/sys: . cddl/dev/dtrace/amd64 contrib/pf Message-ID: <200907091348.n69Dm7ON086801@svn.freebsd.org> Author: avg Date: Thu Jul 9 13:48:06 2009 New Revision: 195492 URL: http://svn.freebsd.org/changeset/base/195492 Log: MFC 194850: dtrace/amd64: fix virtual address checks Modified: stable/7/sys/ (props changed) stable/7/sys/cddl/dev/dtrace/amd64/dtrace_isa.c stable/7/sys/cddl/dev/dtrace/amd64/dtrace_subr.c stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- stable/7/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Thu Jul 9 13:42:18 2009 (r195491) +++ stable/7/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Thu Jul 9 13:48:06 2009 (r195492) @@ -42,8 +42,6 @@ #include #include -extern uintptr_t kernbase; -uintptr_t kernelbase = (uintptr_t) &kernbase; uint8_t dtrace_fuword8_nocheck(void *); uint16_t dtrace_fuword16_nocheck(void *); @@ -524,9 +522,9 @@ dtrace_getreg(struct regs *rp, uint_t re static int dtrace_copycheck(uintptr_t uaddr, uintptr_t kaddr, size_t size) { - ASSERT(kaddr >= kernelbase && kaddr + size >= kaddr); + ASSERT(INKERNEL(kaddr) && kaddr + size >= kaddr); - if (uaddr + size >= kernelbase || uaddr + size < uaddr) { + if (uaddr + size > VM_MAXUSER_ADDRESS || uaddr + size < uaddr) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = uaddr; return (0); @@ -570,7 +568,7 @@ dtrace_copyoutstr(uintptr_t kaddr, uintp uint8_t dtrace_fuword8(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); @@ -581,7 +579,7 @@ dtrace_fuword8(void *uaddr) uint16_t dtrace_fuword16(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); @@ -592,7 +590,7 @@ dtrace_fuword16(void *uaddr) uint32_t dtrace_fuword32(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); @@ -603,7 +601,7 @@ dtrace_fuword32(void *uaddr) uint64_t dtrace_fuword64(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); Modified: stable/7/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- stable/7/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Jul 9 13:42:18 2009 (r195491) +++ stable/7/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Jul 9 13:48:06 2009 (r195492) @@ -40,7 +40,6 @@ #include #include -extern uintptr_t kernelbase; extern uintptr_t dtrace_in_probe_addr; extern int dtrace_in_probe; From avg at FreeBSD.org Thu Jul 9 14:53:06 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Thu Jul 9 14:53:23 2009 Subject: svn commit: r195493 - stable/7/sys/amd64/amd64 Message-ID: <200907091453.n69Er5iF088218@svn.freebsd.org> Author: avg Date: Thu Jul 9 14:53:05 2009 New Revision: 195493 URL: http://svn.freebsd.org/changeset/base/195493 Log: dtrace/amd64: remove duplicate definition of dtrace_gethrtime function Primary (and enhanced) definition of this function is in sys/cddl/dev/dtrace/amd64/dtrace_subr.c. This is a direct commit to the branch, because this instance of the function was added to the branch in rev 182231, which claimed to be dtrace MFH, but in fact the code in question never existed in head. And does not exist now. Another reason for this de-duplication is that there is only one instance of this function for i386 arch. Briefly discussed with: jhb Silence from: jb Modified: stable/7/sys/amd64/amd64/tsc.c Modified: stable/7/sys/amd64/amd64/tsc.c ============================================================================== --- stable/7/sys/amd64/amd64/tsc.c Thu Jul 9 13:48:06 2009 (r195492) +++ stable/7/sys/amd64/amd64/tsc.c Thu Jul 9 14:53:05 2009 (r195493) @@ -234,18 +234,3 @@ tsc_get_timecount(struct timecounter *tc { return (rdtsc()); } - -#ifdef KDTRACE_HOOKS -/* - * DTrace needs a high resolution time function which can - * be called from a probe context and guaranteed not to have - * instrumented with probes itself. - * - * Returns nanoseconds since boot. - */ -uint64_t -dtrace_gethrtime() -{ - return (rdtsc() * (uint64_t) 1000000000 / tsc_freq); -} -#endif From n_hibma at FreeBSD.org Thu Jul 9 15:27:08 2009 From: n_hibma at FreeBSD.org (Nick Hibma) Date: Thu Jul 9 15:27:24 2009 Subject: svn commit: r195498 - stable/7/sys/dev/usb Message-ID: <200907091527.n69FR7Kg089168@svn.freebsd.org> Author: n_hibma Date: Thu Jul 9 15:27:07 2009 New Revision: 195498 URL: http://svn.freebsd.org/changeset/base/195498 Log: Errors we would like to see during debugging. Modified: stable/7/sys/dev/usb/ohci.c Modified: stable/7/sys/dev/usb/ohci.c ============================================================================== --- stable/7/sys/dev/usb/ohci.c Thu Jul 9 15:05:50 2009 (r195497) +++ stable/7/sys/dev/usb/ohci.c Thu Jul 9 15:27:07 2009 (r195498) @@ -1381,7 +1381,7 @@ ohci_softintr(void *v) */ opipe = (struct ohci_pipe *)xfer->pipe; - DPRINTFN(15,("ohci_process_done: error cc=%d (%s)\n", + DPRINTF(("ohci_process_done: error cc=%d (%s)\n", OHCI_TD_GET_CC(le32toh(std->td.td_flags)), ohci_cc_strs[OHCI_TD_GET_CC(le32toh(std->td.td_flags))])); callout_stop(&xfer->timeout_handle); From n_hibma at FreeBSD.org Thu Jul 9 15:29:27 2009 From: n_hibma at FreeBSD.org (Nick Hibma) Date: Thu Jul 9 15:29:34 2009 Subject: svn commit: r195499 - stable/7/sys/dev/usb Message-ID: <200907091529.n69FTQ71089251@svn.freebsd.org> Author: n_hibma Date: Thu Jul 9 15:29:26 2009 New Revision: 195499 URL: http://svn.freebsd.org/changeset/base/195499 Log: Improve the debugging output: Make it switchable through a sysctl for ucom and u3g. Try to reset the device if it produces ucomwritecb and ucomreadcb errors. Modified: stable/7/sys/dev/usb/u3g.c stable/7/sys/dev/usb/ucom.c Modified: stable/7/sys/dev/usb/u3g.c ============================================================================== --- stable/7/sys/dev/usb/u3g.c Thu Jul 9 15:27:07 2009 (r195498) +++ stable/7/sys/dev/usb/u3g.c Thu Jul 9 15:29:26 2009 (r195499) @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -51,16 +52,13 @@ #endif #include "usbdevs.h" -//#define U3G_DEBUG -#ifdef U3G_DEBUG -#define DPRINTF(x...) device_printf(sc->sc_dev, ##x) -#define bootverbose (1) -#else -#define DPRINTF(x...) /* nop */ -#endif +static int u3gdebug = 1; +SYSCTL_NODE(_hw_usb, OID_AUTO, u3g, CTLFLAG_RW, 0, "USB u3g"); +SYSCTL_INT(_hw_usb_u3g, OID_AUTO, debug, CTLFLAG_RW, + &u3gdebug, 0, "u3g debug level"); +#define DPRINTF(x...) if (u3gdebug) device_printf(sc->sc_dev, ##x) -#define U3G_MAXPORTS 4 -#define U3G_CONFIG_INDEX 0 +#define U3G_MAXPORTS 6 struct u3g_softc { struct ucom_softc sc_ucom[U3G_MAXPORTS]; @@ -258,6 +256,9 @@ u3g_attach(device_t self) sprintf(devnamefmt,"U%d.%%d", device_get_unit(self)); int portno = 0; for (i = 0; i < uaa->nifaces && portno < U3G_MAXPORTS; i++) { + DPRINTF("Interface %d of %d, %sin use\n", + i, uaa->nifaces, + (uaa->ifaces[i]? "not ":"")); if (uaa->ifaces[i] == NULL) continue; @@ -268,7 +269,7 @@ u3g_attach(device_t self) * Claim the first umass device (cdX) as it contains * only Windows drivers anyway (CD-ROM), hiding it. */ - if (!bootverbose) + if (!(bootverbose || u3gdebug)) if (uaa->vendor == USB_VENDOR_HUAWEI) if (id->bInterfaceNumber == 2) uaa->ifaces[i] = NULL; @@ -279,6 +280,9 @@ u3g_attach(device_t self) int claim_iface = 0; for (n = 0; n < id->bNumEndpoints && portno < U3G_MAXPORTS; n++) { ed = usbd_interface2endpoint_descriptor(uaa->ifaces[i], n); + DPRINTF(" Endpoint %d of %d%s\n", + n, id->bNumEndpoints, + (ed? "":"no descriptor")); if (ed == NULL) continue; if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN @@ -585,7 +589,7 @@ u3gstub_BBB_cmd(struct u3gstub_softc *sc usbd_errstr(err)); } } else if (err != USBD_NORMAL_COMPLETION) { - if (bootverbose) + if (u3gdebug) device_printf(sc->sc_dev, "Failed to retrieve CSW to " "change to modem mode: %s\n", @@ -609,13 +613,10 @@ u3gstub_sierra_init(struct u3gstub_softc USETW(req.wLength, 0); err = usbd_do_request(sc->sc_udev, &req, 0); - if (bootverbose) { - if (err) { - device_printf(sc->sc_dev, - "Failed to send Sierra request: %s\n", - usbd_errstr(err)); - } - } + if (err && u3gdebug) + device_printf(sc->sc_dev, + "Failed to send Sierra request: %s\n", + usbd_errstr(err)); return 1; } @@ -633,13 +634,10 @@ u3gstub_huawei_init(struct u3gstub_softc USETW(req.wLength, 0); err = usbd_do_request(sc->sc_udev, &req, 0); - if (bootverbose) { - if (err) { - device_printf(sc->sc_dev, - "Failed to send Huawei request: %s\n", - usbd_errstr(err)); - } - } + if (err && u3gdebug) + device_printf(sc->sc_dev, + "Failed to send Huawei request: %s\n", + usbd_errstr(err)); return 1; } @@ -659,19 +657,19 @@ u3gstub_do_init(void *priv) u3g_dev_type = u3g_lookup(sc->sc_vendor, sc->sc_product); switch (u3g_dev_type->init) { case U3GINIT_HUAWEI: - if (bootverbose) + if (bootverbose || u3gdebug) device_printf(sc->sc_dev, "changing Huawei modem to modem mode\n"); u3gstub_huawei_init(sc); break; case U3GINIT_SIERRA: - if (bootverbose) + if (bootverbose || u3gdebug) device_printf(sc->sc_dev, "changing Sierra modem to modem mode\n"); u3gstub_sierra_init(sc); break; case U3GINIT_EJECT: - if (bootverbose) + if (bootverbose || u3gdebug) device_printf(sc->sc_dev, "sending CD eject command to change to modem mode\n"); while (!sc->sc_dying @@ -680,20 +678,20 @@ u3gstub_do_init(void *priv) ; /* nop */ break; case U3GINIT_ZTESTOR: - if (bootverbose) + if (bootverbose || u3gdebug) device_printf(sc->sc_dev, "changing ZTE STOR modem to modem mode\n"); u3gstub_BBB_cmd(sc, ztestor_cmd); break; case U3GINIT_CMOTECH: - if (bootverbose) + if (bootverbose || u3gdebug) device_printf(sc->sc_dev, "changing CMOTECH modem to modem mode\n"); u3gstub_BBB_cmd(sc, cmotech_cmd); break; case U3GINIT_WAIT: default: - if (bootverbose) + if (bootverbose || u3gdebug) device_printf(sc->sc_dev, "waiting for modem to change to modem mode\n"); /* nop */ @@ -726,7 +724,7 @@ u3gstub_match(device_t self) id = usbd_get_interface_descriptor(uaa->iface); if (id && id->bInterfaceNumber == 0 && id->bInterfaceClass == UICLASS_MASS) { - if (!bootverbose) + if (u3gdebug == 0) device_quiet(self); return UMATCH_VENDOR_PRODUCT; @@ -745,7 +743,7 @@ u3gstub_attach(device_t self) usb_endpoint_descriptor_t *ed; int i, err; - if (!bootverbose) + if (u3gdebug == 0) device_quiet(self); for (i = 0; i < uaa->nifaces; i++) Modified: stable/7/sys/dev/usb/ucom.c ============================================================================== --- stable/7/sys/dev/usb/ucom.c Thu Jul 9 15:27:07 2009 (r195498) +++ stable/7/sys/dev/usb/ucom.c Thu Jul 9 15:29:26 2009 (r195499) @@ -95,7 +95,6 @@ __FBSDID("$FreeBSD$"); #include -#ifdef USB_DEBUG static int ucomdebug = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, ucom, CTLFLAG_RW, 0, "USB ucom"); SYSCTL_INT(_hw_usb_ucom, OID_AUTO, debug, CTLFLAG_RW, @@ -109,10 +108,6 @@ SYSCTL_INT(_hw_usb_ucom, OID_AUTO, debug if (ucomdebug > (n)) \ printf x; \ } while (0) -#else -#define DPRINTF(x) -#define DPRINTFN(n, x) -#endif static int ucom_modevent(module_t, int, void *); static void ucom_cleanup(struct ucom_softc *); @@ -690,11 +685,19 @@ ucomwritecb(usbd_xfer_handle xfer, usbd_ goto error; if (status != USBD_NORMAL_COMPLETION) { - printf("%s: ucomwritecb: %s\n", - device_get_nameunit(sc->sc_dev), usbd_errstr(status)); - if (status == USBD_STALLED) + if (status == USBD_STALLED) { + printf("%s: ucomwritecb: STALLED; clearing.\n", + device_get_nameunit(sc->sc_dev)); usbd_clear_endpoint_stall_async(sc->sc_bulkout_pipe); - /* XXX we should restart after some delay. */ + } else if (status == USBD_IOERROR) { + printf("%s: ucomwritecb: IOERROR; resetting device.\n", + device_get_nameunit(sc->sc_dev)); + usbd_reset_device(sc->sc_udev); + } else if (status != USBD_CANCELLED) { + printf("%s: ucomwritecb: %s\n", + device_get_nameunit(sc->sc_dev), + usbd_errstr(status)); + } goto error; } @@ -774,7 +777,21 @@ ucomreadcb(usbd_xfer_handle xfer, usbd_p sc->sc_state |= UCS_RXSTOP; if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->sc_bulkin_pipe); - /* XXX we should restart after some delay. */ + else if (status == USBD_IOERROR) + usbd_reset_device(sc->sc_udev); + if (status == USBD_STALLED) { + printf("%s: ucomreadcb: STALLED; clearing.\n", + device_get_nameunit(sc->sc_dev)); + usbd_clear_endpoint_stall_async(sc->sc_bulkin_pipe); + } else if (status == USBD_IOERROR) { + printf("%s: ucomreadcb: IOERROR; resetting device.\n", + device_get_nameunit(sc->sc_dev)); + usbd_reset_device(sc->sc_udev); + } else if (status != USBD_CANCELLED) { + printf("%s: ucomreadcb: %s\n", + device_get_nameunit(sc->sc_dev), + usbd_errstr(status)); + } return; } sc->sc_state |= UCS_RXSTOP; From brian at Awfulhak.org Thu Jul 9 18:00:17 2009 From: brian at Awfulhak.org (Brian Somers) Date: Thu Jul 9 18:00:29 2009 Subject: svn commit: r195485 - in stable/7/sys: . contrib/pf kern In-Reply-To: <200907090912.n699CGx0077581@svn.freebsd.org> References: <200907090912.n699CGx0077581@svn.freebsd.org> Message-ID: <20090709103126.02bf7206@Awfulhak.org> On Thu, 9 Jul 2009 09:12:16 +0000 (UTC), Konstantin Belousov wrote: > Author: kib > Date: Thu Jul 9 09:12:16 2009 > New Revision: 195485 > URL: http://svn.freebsd.org/changeset/base/195485 > > Log: > MFC r194993: > In lf_iteratelocks_vnode, increment state->ls_threads around iterating > of the vnode advisory lock list. This prevents deallocation of state > while inside the loop. > > Modified: > stable/7/sys/ (props changed) > stable/7/sys/contrib/pf/ (props changed) > stable/7/sys/kern/kern_lockf.c Just picking on this commit.... Are the properties on stable/7/sys/contrib/pf intentional or should they merged into stable/7/sys (a no-op hopefully) and removed? -- Brian Somers Don't _EVER_ lose your sense of humour ! From max at love2party.net Thu Jul 9 20:48:34 2009 From: max at love2party.net (Max Laier) Date: Thu Jul 9 20:48:40 2009 Subject: svn commit: r195485 - in stable/7/sys: . contrib/pf kern In-Reply-To: <20090709103126.02bf7206@Awfulhak.org> References: <200907090912.n699CGx0077581@svn.freebsd.org> <20090709103126.02bf7206@Awfulhak.org> Message-ID: <200907092235.18828.max@love2party.net> On Thursday 09 July 2009 19:31:26 Brian Somers wrote: > On Thu, 9 Jul 2009 09:12:16 +0000 (UTC), Konstantin Belousov wrote: > > Author: kib > > Date: Thu Jul 9 09:12:16 2009 > > New Revision: 195485 > > URL: http://svn.freebsd.org/changeset/base/195485 > > > > Log: > > MFC r194993: > > In lf_iteratelocks_vnode, increment state->ls_threads around iterating > > of the vnode advisory lock list. This prevents deallocation of state > > while inside the loop. > > > > Modified: > > stable/7/sys/ (props changed) > > stable/7/sys/contrib/pf/ (props changed) > > stable/7/sys/kern/kern_lockf.c > > Just picking on this commit.... > > Are the properties on stable/7/sys/contrib/pf intentional or should > they merged into stable/7/sys (a no-op hopefully) and removed? No it shouldn't[*]. The problem is that contrib/pf is - as the path suggests - backed by contributed code and thus has vendor specific merge info. [*] That being said, I don't really care about the merge info in there - as it turns out, subversion's automerging capabilities are rather poor anyway and I can't see the benefit of the mergeinfo in dealing with vendor code. It's always easy enough to figure out the revisions you want merged and you don't really need the mergeinfo for that. OTOH, it is valuable meta-information that should be recorded - as I recall that's one reason why we switched to subversion in the first place. One way out - which I proposed several times before but never got feedback on - would be to change the hierarchies in vendor-sys to have an extra sys/contrib prefix (e.g. vendor-sys/pf/dist/*sys/contrib*/pf/...). This way we can record the mergeinfo in src/sys as well and get rid of the extra info in contrib/* I'd need some feedback from svn-savvy people to go this road, though. Before somebody asks why pf is the only offender - simply because it's the only sys/contrib source with a post-cvs merge of vendor code to the releng. -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News From delphij at FreeBSD.org Fri Jul 10 06:55:31 2009 From: delphij at FreeBSD.org (Xin LI) Date: Fri Jul 10 06:55:48 2009 Subject: svn commit: r195528 - in stable/7/sys: . contrib/pf dev/usb Message-ID: <200907100655.n6A6tUaW009989@svn.freebsd.org> Author: delphij Date: Fri Jul 10 06:55:30 2009 New Revision: 195528 URL: http://svn.freebsd.org/changeset/base/195528 Log: MFC r195080 (technically this is not really a MFC but an new implementation of the original patch to apply against 7-STABLE). Add quirks for Actions MP4 player. Submitted by: John Hixson Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/usb/umass.c stable/7/sys/dev/usb/usbdevs Modified: stable/7/sys/dev/usb/umass.c ============================================================================== --- stable/7/sys/dev/usb/umass.c Fri Jul 10 02:19:57 2009 (r195527) +++ stable/7/sys/dev/usb/umass.c Fri Jul 10 06:55:30 2009 (r195528) @@ -887,6 +887,10 @@ static struct umass_devdescr_t umass_dev UMASS_PROTO_SCSI | UMASS_PROTO_BBB, NO_INQUIRY | NO_SYNCHRONIZE_CACHE }, + { USB_VENDOR_ACTIONS, USB_PRODUCT_ACTIONS_MP4, RID_WILDCARD, + UMASS_PROTO_SCSI | UMASS_PROTO_BBB, + NO_SYNCHRONIZE_CACHE + }, { VID_EOT, PID_EOT, RID_EOT, 0, 0 } }; Modified: stable/7/sys/dev/usb/usbdevs ============================================================================== --- stable/7/sys/dev/usb/usbdevs Fri Jul 10 02:19:57 2009 (r195527) +++ stable/7/sys/dev/usb/usbdevs Fri Jul 10 06:55:30 2009 (r195528) @@ -552,6 +552,7 @@ vendor USI 0x10ab USI vendor PLX 0x10b5 PLX vendor ASANTE 0x10bd Asante vendor SILABS 0x10c4 Silicon Labs +vendor ACTIONS 0x10d6 Actions vendor ANALOG 0x1110 Analog Devices vendor TENX 0x1130 Ten X Technology, Inc. vendor ISSC 0x1131 Integrated System Solution Corp. @@ -2471,6 +2472,9 @@ product WESTERN EXTHDD 0x0400 External product WESTERN HUB 0x0500 USB HUB product WESTERN MYBOOK 0x0901 MyBook External HDD +/* Wilson Co. Ltd products */ +product ACTIONS MP4 0x1101 Mp4 Player + /* Windbond Electronics */ product WINBOND UH104 0x5518 4-port USB Hub From delphij at FreeBSD.org Fri Jul 10 06:57:02 2009 From: delphij at FreeBSD.org (Xin LI) Date: Fri Jul 10 06:57:18 2009 Subject: svn commit: r195529 - in stable/7/sys: . contrib/pf i386/isa Message-ID: <200907100657.n6A6v0lK010063@svn.freebsd.org> Author: delphij Date: Fri Jul 10 06:57:00 2009 New Revision: 195529 URL: http://svn.freebsd.org/changeset/base/195529 Log: MFC r193790: Add line width calculations for 15/16 and 24/32 bit modes in case the "Get Scan Line Length" function fails, as it does in Parallels (in Version 2.2, Build 2112 at least). PR: i386/127367 Obtained from: DragonFly Submitted by: Pedro Giffuni Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/isa/vesa.c Modified: stable/7/sys/i386/isa/vesa.c ============================================================================== --- stable/7/sys/i386/isa/vesa.c Fri Jul 10 06:55:30 2009 (r195528) +++ stable/7/sys/i386/isa/vesa.c Fri Jul 10 06:57:00 2009 (r195529) @@ -1111,6 +1111,14 @@ vesa_set_mode(video_adapter_t *adp, int default: /* shouldn't happen */ vesa_adp->va_line_width = info.vi_width; break; + case 15: + case 16: + vesa_adp->va_line_width = info.vi_width*2; + break; + case 24: + case 32: + vesa_adp->va_line_width = info.vi_width*4; + break; } } else { vesa_adp->va_line_width = info.vi_width; From brian at FreeBSD.org Fri Jul 10 09:01:55 2009 From: brian at FreeBSD.org (Brian Somers) Date: Fri Jul 10 09:02:02 2009 Subject: svn commit: r195485 - in stable/7/sys: . contrib/pf kern In-Reply-To: <200907092235.18828.max@love2party.net> References: <200907090912.n699CGx0077581@svn.freebsd.org> <20090709103126.02bf7206@Awfulhak.org> <200907092235.18828.max@love2party.net> Message-ID: <20090710013243.68775e75@dev.lan.Awfulhak.org> On Thu, 9 Jul 2009 22:35:18 +0200 Max Laier wrote: > On Thursday 09 July 2009 19:31:26 Brian Somers wrote: > > On Thu, 9 Jul 2009 09:12:16 +0000 (UTC), Konstantin Belousov > wrote: > > > Author: kib > > > Date: Thu Jul 9 09:12:16 2009 > > > New Revision: 195485 > > > URL: http://svn.freebsd.org/changeset/base/195485 > > > > > > Log: > > > MFC r194993: > > > In lf_iteratelocks_vnode, increment state->ls_threads around iterating > > > of the vnode advisory lock list. This prevents deallocation of state > > > while inside the loop. > > > > > > Modified: > > > stable/7/sys/ (props changed) > > > stable/7/sys/contrib/pf/ (props changed) > > > stable/7/sys/kern/kern_lockf.c > > > > Just picking on this commit.... > > > > Are the properties on stable/7/sys/contrib/pf intentional or should > > they merged into stable/7/sys (a no-op hopefully) and removed? > > No it shouldn't[*]. The problem is that contrib/pf is - as the path suggests > - backed by contributed code and thus has vendor specific merge info. > > [*] That being said, I don't really care about the merge info in there - as it > turns out, subversion's automerging capabilities are rather poor anyway and I > can't see the benefit of the mergeinfo in dealing with vendor code. It's > always easy enough to figure out the revisions you want merged and you don't > really need the mergeinfo for that. OTOH, it is valuable meta-information > that should be recorded - as I recall that's one reason why we switched to > subversion in the first place. > > One way out - which I proposed several times before but never got feedback on > - would be to change the hierarchies in vendor-sys to have an extra > sys/contrib prefix (e.g. vendor-sys/pf/dist/*sys/contrib*/pf/...). This way > we can record the mergeinfo in src/sys as well and get rid of the extra info > in contrib/* I'd need some feedback from svn-savvy people to go this road, > though. > > Before somebody asks why pf is the only offender - simply because it's the > only sys/contrib source with a post-cvs merge of vendor code to the releng. Yes, I was thinking along the same lines. AFAICT this would work fine with the caveat that it may be necessary to import some vendor code in pieces. If for example a vendor distributed some-package/etc/config-file some-package/bin/program some-package/kernel/driver we might need to import it in two pieces so that we can maintain the contrib/some-package part of the hierarchy when merging sys/, even though the other two hierarchies can be merged directly into src/etc and usr.bin/program directly. However, the bit that I don't understand about the original commit and its update of the contrib/pf mergeinfo is why it's updated at all by svn - it just seems wrong. When I do: cd svn/stable/7/sys svn merge -c NNNNN ^/head/sys given that change NNNNN has nothing to do with pf, I don't understand why subversion updates stable/7/sys/contrib/pf's mergeinfo. Is the "special" thing about sys/contrib/pf just that it already has mergeinfo associated with it? And if so, why does that make it special. Surely having NNNNN in sys's mergeinfo implies that it's been merged to every part beneath sys. Having said all that, svn's --depth switch allows partially sparse tree checkouts, and it's always possible to svn revert part of a merge before committing. This implies that the only way svn could successfully maintain mergeinfo would be to store it at least against every node with a merged modification. Depending on how people branch and merge, this would become very unwieldy very quickly (certainly in other environments if not in ours (we would get away with it because we eventually forget about old branches)). So I guess I'm probably just re-iterating other people's suggestions that svn's merge capabilities are somewhat dysfunctional by design. -- Brian Somers Don't _EVER_ lose your sense of humour ! -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 306 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-stable-7/attachments/20090710/b49a9fbf/signature.pgp From des at des.no Fri Jul 10 11:19:25 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Fri Jul 10 11:19:36 2009 Subject: svn commit: r195485 - in stable/7/sys: . contrib/pf kern In-Reply-To: <20090710013243.68775e75@dev.lan.Awfulhak.org> (Brian Somers's message of "Fri, 10 Jul 2009 01:32:43 -0700") References: <200907090912.n699CGx0077581@svn.freebsd.org> <20090709103126.02bf7206@Awfulhak.org> <200907092235.18828.max@love2party.net> <20090710013243.68775e75@dev.lan.Awfulhak.org> Message-ID: <86ws6gu6o7.fsf@ds4.des.no> Brian Somers writes: > However, the bit that I don't understand about the original commit and > its update of the contrib/pf mergeinfo is why it's updated at all > [...] Because svn needs to record that the revision you merged into sys was also merged into sys/contrib/pf. > Having said all that, svn's --depth switch allows partially sparse tree > checkouts, and it's always possible to svn revert part of a merge > before committing. Don't. You'd just make things worse. Read http://wiki.freebsd.org/SubversionPrimer and its subpages. DES -- Dag-Erling Sm?rgrav - des@des.no From kmacy at FreeBSD.org Fri Jul 10 19:43:08 2009 From: kmacy at FreeBSD.org (Kip Macy) Date: Fri Jul 10 19:43:20 2009 Subject: svn commit: r195586 - in stable/7/sys: . kern netgraph sys Message-ID: <200907101943.n6AJh8SX030247@svn.freebsd.org> Author: kmacy Date: Fri Jul 10 19:43:07 2009 New Revision: 195586 URL: http://svn.freebsd.org/changeset/base/195586 Log: propagate MFC of 195148 to -STABLE: - Turn the third (islocked) argument of the knote call into flags parameter. Introduce the new flag KNF_NOKQLOCK to allow event callers to be called without KQ_LOCK mtx held. - Modify VFS knote calls to always use KNF_NOKQLOCK flag. This is required for ZFS as its getattr implementation may sleep. Modified: stable/7/sys/ (props changed) stable/7/sys/kern/kern_event.c stable/7/sys/netgraph/ng_ksocket.c stable/7/sys/sys/event.h stable/7/sys/sys/mount.h stable/7/sys/sys/vnode.h Modified: stable/7/sys/kern/kern_event.c ============================================================================== --- stable/7/sys/kern/kern_event.c Fri Jul 10 19:31:05 2009 (r195585) +++ stable/7/sys/kern/kern_event.c Fri Jul 10 19:43:07 2009 (r195586) @@ -1608,17 +1608,18 @@ kqueue_wakeup(struct kqueue *kq) * first. */ void -knote(struct knlist *list, long hint, int islocked) +knote(struct knlist *list, long hint, int lockflags) { struct kqueue *kq; struct knote *kn; + int error; if (list == NULL) return; - KNL_ASSERT_LOCK(list, islocked); + KNL_ASSERT_LOCK(list, lockflags & KNF_LISTLOCKED); - if (!islocked) + if ((lockflags & KNF_LISTLOCKED) == 0) list->kl_lock(list->kl_lockarg); /* @@ -1633,17 +1634,28 @@ knote(struct knlist *list, long hint, in kq = kn->kn_kq; if ((kn->kn_status & KN_INFLUX) != KN_INFLUX) { KQ_LOCK(kq); - if ((kn->kn_status & KN_INFLUX) != KN_INFLUX) { + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + KQ_UNLOCK(kq); + } else if ((lockflags & KNF_NOKQLOCK) != 0) { + kn->kn_status |= KN_INFLUX; + KQ_UNLOCK(kq); + error = kn->kn_fop->f_event(kn, hint); + KQ_LOCK(kq); + kn->kn_status &= ~KN_INFLUX; + if (error) + KNOTE_ACTIVATE(kn, 1); + KQ_UNLOCK_FLUX(kq); + } else { kn->kn_status |= KN_HASKQLOCK; if (kn->kn_fop->f_event(kn, hint)) KNOTE_ACTIVATE(kn, 1); kn->kn_status &= ~KN_HASKQLOCK; + KQ_UNLOCK(kq); } - KQ_UNLOCK(kq); } kq = NULL; } - if (!islocked) + if ((lockflags & KNF_LISTLOCKED) == 0) list->kl_unlock(list->kl_lockarg); } Modified: stable/7/sys/netgraph/ng_ksocket.c ============================================================================== --- stable/7/sys/netgraph/ng_ksocket.c Fri Jul 10 19:31:05 2009 (r195585) +++ stable/7/sys/netgraph/ng_ksocket.c Fri Jul 10 19:43:07 2009 (r195586) @@ -1214,7 +1214,7 @@ ng_ksocket_finish_accept(priv_p priv) SOCK_UNLOCK(so); ACCEPT_UNLOCK(); - /* XXX KNOTE(&head->so_rcv.sb_sel.si_note, 0); */ + /* XXX KNOTE_UNLOCKED(&head->so_rcv.sb_sel.si_note, 0); */ soaccept(so, &sa); Modified: stable/7/sys/sys/event.h ============================================================================== --- stable/7/sys/sys/event.h Fri Jul 10 19:31:05 2009 (r195585) +++ stable/7/sys/sys/event.h Fri Jul 10 19:43:07 2009 (r195586) @@ -135,8 +135,14 @@ struct knlist { MALLOC_DECLARE(M_KQUEUE); #endif -#define KNOTE(list, hist, lock) knote(list, hist, lock) -#define KNOTE_LOCKED(list, hint) knote(list, hint, 1) +/* + * Flags for knote call + */ +#define KNF_LISTLOCKED 0x0001 /* knlist is locked */ +#define KNF_NOKQLOCK 0x0002 /* do not keep KQ_LOCK */ + +#define KNOTE(list, hist, flags) knote(list, hist, flags) +#define KNOTE_LOCKED(list, hint) knote(list, hint, KNF_LISTLOCKED) #define KNOTE_UNLOCKED(list, hint) knote(list, hint, 0) #define KNLIST_EMPTY(list) SLIST_EMPTY(&(list)->kl_list) @@ -204,7 +210,7 @@ struct thread; struct proc; struct knlist; -extern void knote(struct knlist *list, long hint, int islocked); +extern void knote(struct knlist *list, long hint, int lockflags); extern void knote_fork(struct knlist *list, int pid); extern void knlist_add(struct knlist *knl, struct knote *kn, int islocked); extern void knlist_remove(struct knlist *knl, struct knote *kn, int islocked); Modified: stable/7/sys/sys/mount.h ============================================================================== --- stable/7/sys/sys/mount.h Fri Jul 10 19:31:05 2009 (r195585) +++ stable/7/sys/sys/mount.h Fri Jul 10 19:43:07 2009 (r195586) @@ -633,7 +633,7 @@ extern int mpsafe_vfs; #define VFS_KNOTE_LOCKED(vp, hint) do \ { \ if (((vp)->v_vflag & VV_NOKNOTE) == 0) \ - VN_KNOTE((vp), (hint), 1); \ + VN_KNOTE((vp), (hint), KNF_LISTLOCKED); \ } while (0) #define VFS_KNOTE_UNLOCKED(vp, hint) do \ Modified: stable/7/sys/sys/vnode.h ============================================================================== --- stable/7/sys/sys/vnode.h Fri Jul 10 19:31:05 2009 (r195585) +++ stable/7/sys/sys/vnode.h Fri Jul 10 19:43:07 2009 (r195586) @@ -222,9 +222,10 @@ struct xvnode { #define VN_KNOTE(vp, b, a) \ do { \ if (!VN_KNLIST_EMPTY(vp)) \ - KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note, (b), (a)); \ + KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note, (b), \ + (a) | KNF_NOKQLOCK); \ } while (0) -#define VN_KNOTE_LOCKED(vp, b) VN_KNOTE(vp, b, 1) +#define VN_KNOTE_LOCKED(vp, b) VN_KNOTE(vp, b, KNF_LISTLOCKED) #define VN_KNOTE_UNLOCKED(vp, b) VN_KNOTE(vp, b, 0) /* From dougb at FreeBSD.org Sat Jul 11 08:24:53 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sat Jul 11 08:25:01 2009 Subject: svn commit: r195615 - stable/7/usr.sbin/mergemaster Message-ID: <200907110824.n6B8Oq24046802@svn.freebsd.org> Author: dougb Date: Sat Jul 11 08:24:51 2009 New Revision: 195615 URL: http://svn.freebsd.org/changeset/base/195615 Log: MFC r193853, update -U message when there is no mtree db, dramatically reduce the size of the saved mtree db, streamline find command for the main loop, and remove a spurious comment. Modified: stable/7/usr.sbin/mergemaster/ (props changed) stable/7/usr.sbin/mergemaster/mergemaster.sh Modified: stable/7/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/7/usr.sbin/mergemaster/mergemaster.sh Sat Jul 11 08:10:18 2009 (r195614) +++ stable/7/usr.sbin/mergemaster/mergemaster.sh Sat Jul 11 08:24:51 2009 (r195615) @@ -353,7 +353,8 @@ case "${AUTO_UPGRADE}" in *) if [ ! -s "${DESTDIR}${MTREEFILE}" ]; then echo '' - echo "*** Unable to find mtree database. Skipping auto-upgrade." + echo "*** Unable to find mtree database. Skipping auto-upgrade on this run." + echo " It will be created for the next run when this one is complete." echo '' press_to_continue unset AUTO_UPGRADE @@ -674,8 +675,11 @@ rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/e # We only need to compare things like freebsd.cf once find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null -# Delete 0 length files to make the mtree database as small as possible. +# Delete stuff we do not need to keep the mtree database small, +# and to make the actual comparison faster. +find ${TEMPROOT}/usr -type l -delete 2>/dev/null find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null +find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null # Build the mtree database in a temporary location. MTREENEW=`mktemp -t mergemaster.mtree` @@ -963,11 +967,7 @@ if [ -r "${MM_PRE_COMPARE_SCRIPT}" ]; th . "${MM_PRE_COMPARE_SCRIPT}" fi -# Using -size +0 avoids uselessly checking the empty log files created -# by ${SOURCEDIR}/etc/Makefile and the device entries in ./dev, but does -# check the scripts in ./dev, as we'd like (assuming no devfs of course). -# -for COMPFILE in `find . -type f -size +0`; do +for COMPFILE in `find . -type f`; do # First, check to see if the file exists in DESTDIR. If not, the # diff_loop function knows how to handle it. From dougb at FreeBSD.org Sat Jul 11 08:27:49 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sat Jul 11 08:28:08 2009 Subject: svn commit: r195617 - stable/7/sys/geom/label Message-ID: <200907110827.n6B8Rm1K046951@svn.freebsd.org> Author: dougb Date: Sat Jul 11 08:27:48 2009 New Revision: 195617 URL: http://svn.freebsd.org/changeset/base/195617 Log: MFC r193131, Crank the debug level necessary to display the "Label foo is removed" and "Label for provider ..." messages up from 0 to 1. Modified: stable/7/sys/geom/label/ (props changed) stable/7/sys/geom/label/g_label.c (contents, props changed) Modified: stable/7/sys/geom/label/g_label.c ============================================================================== --- stable/7/sys/geom/label/g_label.c Sat Jul 11 08:25:43 2009 (r195616) +++ stable/7/sys/geom/label/g_label.c Sat Jul 11 08:27:48 2009 (r195617) @@ -104,7 +104,7 @@ static void g_label_orphan(struct g_consumer *cp) { - G_LABEL_DEBUG(0, "Label %s removed.", + G_LABEL_DEBUG(1, "Label %s removed.", LIST_FIRST(&cp->geom->provider)->name); g_slice_orphan(cp); } @@ -113,7 +113,7 @@ static void g_label_spoiled(struct g_consumer *cp) { - G_LABEL_DEBUG(0, "Label %s removed.", + G_LABEL_DEBUG(1, "Label %s removed.", LIST_FIRST(&cp->geom->provider)->name); g_slice_spoiled(cp); } @@ -181,7 +181,7 @@ g_label_create(struct gctl_req *req, str g_access(cp, -1, 0, 0); g_slice_config(gp, 0, G_SLICE_CONFIG_SET, (off_t)0, mediasize, pp->sectorsize, name); - G_LABEL_DEBUG(0, "Label for provider %s is %s.", pp->name, name); + G_LABEL_DEBUG(1, "Label for provider %s is %s.", pp->name, name); return (gp); } @@ -203,7 +203,7 @@ g_label_destroy(struct g_geom *gp, boole return (EBUSY); } } else { - G_LABEL_DEBUG(0, "Label %s removed.", + G_LABEL_DEBUG(1, "Label %s removed.", LIST_FIRST(&gp->provider)->name); } g_slice_spoiled(LIST_FIRST(&gp->consumer)); From jhb at freebsd.org Mon Jul 13 15:32:42 2009 From: jhb at freebsd.org (John Baldwin) Date: Mon Jul 13 15:33:18 2009 Subject: svn commit: r195485 - in stable/7/sys: . contrib/pf kern In-Reply-To: <20090710013243.68775e75@dev.lan.Awfulhak.org> References: <200907090912.n699CGx0077581@svn.freebsd.org> <200907092235.18828.max@love2party.net> <20090710013243.68775e75@dev.lan.Awfulhak.org> Message-ID: <200907131119.00579.jhb@freebsd.org> On Friday 10 July 2009 4:32:43 am Brian Somers wrote: > we might need to import it in two pieces so that we can maintain the > contrib/some-package part of the hierarchy when merging sys/, even > though the other two hierarchies can be merged directly into src/etc > and usr.bin/program directly. We actually already have that split up since vendor and vendor-sys are separate. However, I think the idea was to try to keep the trees under vendor and vendor-sys as pristine as possible. > However, the bit that I don't understand about the original commit and > its update of the contrib/pf mergeinfo is why it's updated at all by svn > - it just seems wrong. When I do: > > cd svn/stable/7/sys > svn merge -c NNNNN ^/head/sys > > given that change NNNNN has nothing to do with pf, I don't understand > why subversion updates stable/7/sys/contrib/pf's mergeinfo. Is the > "special" thing about sys/contrib/pf just that it already has mergeinfo > associated with it? And if so, why does that make it special. Surely > having NNNNN in sys's mergeinfo implies that it's been merged to > every part beneath sys. No, mergeinfo is _not_ inherited, so the mergeinfo for sys/ has to be duplicated in sys/contrib/pf. -- John Baldwin From rpaulo at FreeBSD.org Mon Jul 13 16:36:05 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Jul 13 16:36:21 2009 Subject: svn commit: r195657 - in stable/7/sys: . boot/i386/libi386 contrib/pf geom/label Message-ID: <200907131636.n6DGa4mT030091@svn.freebsd.org> Author: rpaulo Date: Mon Jul 13 16:36:04 2009 New Revision: 195657 URL: http://svn.freebsd.org/changeset/base/195657 Log: MFC r195045: On special systems where the MBR and the GPT are in sync (up to the 4th slicei, Apple EFI hardware), the bootloader will fail to recognize the GPT if it finds anything else but the EFI partition. Change the check to continue detecting the GPT by looking at the EFI partition on the MBR but stopping successfuly after finding it. PR: kern/134590 Submitted by: Christoph Langguth Reviewed by: jhb Modified: stable/7/sys/ (props changed) stable/7/sys/boot/i386/libi386/biosdisk.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/geom/label/ (props changed) stable/7/sys/geom/label/g_label.c (props changed) Modified: stable/7/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/7/sys/boot/i386/libi386/biosdisk.c Mon Jul 13 12:53:43 2009 (r195656) +++ stable/7/sys/boot/i386/libi386/biosdisk.c Mon Jul 13 16:36:04 2009 (r195657) @@ -888,7 +888,7 @@ bd_open_gpt(struct open_disk *od, struct for (i = 0; i < NDOSPART; i++) { if (dp[i].dp_typ == 0xee) part++; - else if (dp[i].dp_typ != 0x00) + else if ((part != 1) && (dp[i].dp_typ != 0x00)) return (EINVAL); } if (part != 1) From jhb at FreeBSD.org Mon Jul 13 17:46:18 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Jul 13 17:46:29 2009 Subject: svn commit: r195658 - in stable/7/sys: . contrib/pf geom/label Message-ID: <200907131746.n6DHkHx6031494@svn.freebsd.org> Author: jhb Date: Mon Jul 13 17:46:17 2009 New Revision: 195658 URL: http://svn.freebsd.org/changeset/base/195658 Log: Move the mergeinfo for 195617 up to sys/. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/geom/label/ (props changed) stable/7/sys/geom/label/g_label.c (props changed) From jkim at FreeBSD.org Mon Jul 13 22:13:14 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Mon Jul 13 22:13:32 2009 Subject: svn commit: r195667 - in stable/7/sys: . amd64/amd64 amd64/include boot/i386/libi386 compat/linprocfs conf contrib/pf i386/cpufreq i386/i386 modules/agp pci Message-ID: <200907132213.n6DMDDWb037150@svn.freebsd.org> Author: jkim Date: Mon Jul 13 22:13:13 2009 New Revision: 195667 URL: http://svn.freebsd.org/changeset/base/195667 Log: MFC: Replace remaining cpu_vendor with cpu_vendor_id and add basic VIA Nano processor support for amd64 and i386. r186797 - Add Centaur/IDT/VIA vendor ID for Nano family. r187101 - Allow VIA Nano processors to boot FreeBSD/amd64. r187117 - Replace more cpu_vendor with cpu_vendor_id. r187118 - Add basic i386 support for VIA Nano processors. r187157 - Enable MSI support for VIA Nano processors on i386. r187594 - Replace more cpu_vendor with cpu_vendor_id. r187597 - Include a missing header file. r187598 - VIA Nano processor has P-state invariant TSC. r187633 - Add more VIA bridges to agp_via.c. Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/identcpu.c stable/7/sys/amd64/include/cputypes.h stable/7/sys/amd64/include/specialreg.h stable/7/sys/boot/i386/libi386/bootinfo64.c stable/7/sys/compat/linprocfs/linprocfs.c stable/7/sys/conf/files.amd64 stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/cpufreq/est.c stable/7/sys/i386/cpufreq/smist.c stable/7/sys/i386/i386/i686_mem.c stable/7/sys/i386/i386/identcpu.c stable/7/sys/i386/i386/initcpu.c stable/7/sys/i386/i386/msi.c stable/7/sys/modules/agp/Makefile stable/7/sys/pci/agp_via.c Modified: stable/7/sys/amd64/amd64/identcpu.c ============================================================================== --- stable/7/sys/amd64/amd64/identcpu.c Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/amd64/amd64/identcpu.c Mon Jul 13 22:13:13 2009 (r195667) @@ -102,6 +102,7 @@ static struct { } cpu_vendors[] = { { INTEL_VENDOR_ID, CPU_VENDOR_INTEL }, /* GenuineIntel */ { AMD_VENDOR_ID, CPU_VENDOR_AMD }, /* AuthenticAMD */ + { CENTAUR_VENDOR_ID, CPU_VENDOR_CENTAUR }, /* CentaurHauls */ }; void @@ -368,6 +369,12 @@ printcpuinfo(void) AMD64_CPU_MODEL(cpu_id) >= 0x3)) tsc_is_invariant = 1; break; + case CPU_VENDOR_CENTAUR: + if (AMD64_CPU_FAMILY(cpu_id) == 0x6 && + AMD64_CPU_MODEL(cpu_id) >= 0xf && + (rdmsr(0x1203) & 0x100000000ULL) == 0) + tsc_is_invariant = 1; + break; } if (tsc_is_invariant) printf("\n TSC: P-state invariant"); Modified: stable/7/sys/amd64/include/cputypes.h ============================================================================== --- stable/7/sys/amd64/include/cputypes.h Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/amd64/include/cputypes.h Mon Jul 13 22:13:13 2009 (r195667) @@ -47,7 +47,9 @@ * Vendors of processor. */ #define CPU_VENDOR_AMD 0x1022 /* AMD */ +#define CPU_VENDOR_IDT 0x111d /* Centaur/IDT/VIA */ #define CPU_VENDOR_INTEL 0x8086 /* Intel */ +#define CPU_VENDOR_CENTAUR CPU_VENDOR_IDT #ifndef LOCORE extern int cpu; Modified: stable/7/sys/amd64/include/specialreg.h ============================================================================== --- stable/7/sys/amd64/include/specialreg.h Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/amd64/include/specialreg.h Mon Jul 13 22:13:13 2009 (r195667) @@ -205,6 +205,7 @@ * CPUID manufacturers identifiers */ #define AMD_VENDOR_ID "AuthenticAMD" +#define CENTAUR_VENDOR_ID "CentaurHauls" #define INTEL_VENDOR_ID "GenuineIntel" /* Modified: stable/7/sys/boot/i386/libi386/bootinfo64.c ============================================================================== --- stable/7/sys/boot/i386/libi386/bootinfo64.c Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/boot/i386/libi386/bootinfo64.c Mon Jul 13 22:13:13 2009 (r195667) @@ -150,8 +150,9 @@ bi_checkcpu(void) cpu_vendor = (char *)vendor; /* Check for vendors that support AMD features. */ - if (strncmp(cpu_vendor, "GenuineIntel", 12) != 0 && - strncmp(cpu_vendor, "AuthenticAMD", 12) != 0) + if (strncmp(cpu_vendor, INTEL_VENDOR_ID, 12) != 0 && + strncmp(cpu_vendor, AMD_VENDOR_ID, 12) != 0 && + strncmp(cpu_vendor, CENTAUR_VENDOR_ID, 12) != 0) return (0); /* Has to support AMD features. */ Modified: stable/7/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/7/sys/compat/linprocfs/linprocfs.c Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/compat/linprocfs/linprocfs.c Mon Jul 13 22:13:13 2009 (r195667) @@ -273,11 +273,17 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) sbuf_cat(sb, "flags\t\t:"); - if (!strcmp(cpu_vendor, "AuthenticAMD") && (class < 6)) { - flags[16] = "fcmov"; - } else if (!strcmp(cpu_vendor, "CyrixInstead")) { +#ifdef __i386__ + switch (cpu_vendor_id) { + case CPU_VENDOR_AMD: + if (class < 6) + flags[16] = "fcmov"; + break; + case CPU_VENDOR_CYRIX: flags[24] = "cxmmx"; + break; } +#endif for (i = 0; i < 32; i++) if (cpu_feature & (1 << i)) Modified: stable/7/sys/conf/files.amd64 ============================================================================== --- stable/7/sys/conf/files.amd64 Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/conf/files.amd64 Mon Jul 13 22:13:13 2009 (r195667) @@ -205,6 +205,7 @@ kern/link_elf_obj.c standard pci/agp_amd64.c optional agp pci/agp_i810.c optional agp pci/agp_intel.c optional agp +pci/agp_via.c optional agp # # IA32 binary support # Modified: stable/7/sys/i386/cpufreq/est.c ============================================================================== --- stable/7/sys/i386/cpufreq/est.c Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/i386/cpufreq/est.c Mon Jul 13 22:13:13 2009 (r195667) @@ -55,10 +55,6 @@ __FBSDID("$FreeBSD$"); #define MSR_MISC_ENABLE 0x1a0 #define MSR_SS_ENABLE (1<<16) -#ifndef CPU_VENDOR_CENTAUR -#define CPU_VENDOR_CENTAUR 0x111d -#endif - /* Frequency and MSR control values. */ typedef struct { uint16_t freq; Modified: stable/7/sys/i386/cpufreq/smist.c ============================================================================== --- stable/7/sys/i386/cpufreq/smist.c Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/i386/cpufreq/smist.c Mon Jul 13 22:13:13 2009 (r195667) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -285,7 +286,7 @@ smist_identify(driver_t *driver, device_ return; /* Check for a supported processor */ - if (strcmp(cpu_vendor, "GenuineIntel") != 0) + if (cpu_vendor_id != CPU_VENDOR_INTEL) return; switch (cpu_id & 0xff0) { case 0x680: /* Pentium III [coppermine] */ Modified: stable/7/sys/i386/i386/i686_mem.c ============================================================================== --- stable/7/sys/i386/i386/i686_mem.c Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/i386/i386/i686_mem.c Mon Jul 13 22:13:13 2009 (r195667) @@ -678,9 +678,17 @@ i686_mem_drvinit(void *unused) return; if ((cpu_id & 0xf00) != 0x600 && (cpu_id & 0xf00) != 0xf00) return; - if (cpu_vendor_id != CPU_VENDOR_INTEL && - cpu_vendor_id != CPU_VENDOR_AMD) + switch (cpu_vendor_id) { + case CPU_VENDOR_INTEL: + case CPU_VENDOR_AMD: + break; + case CPU_VENDOR_CENTAUR: + if (cpu_exthigh >= 0x80000008) + break; + /* FALLTHROUGH */ + default: return; + } mem_range_softc.mr_op = &i686_mrops; } SYSINIT(i686memdev, SI_SUB_DRIVERS, SI_ORDER_FIRST, i686_mem_drvinit, NULL); Modified: stable/7/sys/i386/i386/identcpu.c ============================================================================== --- stable/7/sys/i386/i386/identcpu.c Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/i386/i386/identcpu.c Mon Jul 13 22:13:13 2009 (r195667) @@ -603,6 +603,9 @@ printcpuinfo(void) case 0x6d0: strcpy(cpu_model, "VIA C7 Esther"); break; + case 0x6f0: + strcpy(cpu_model, "VIA Nano"); + break; default: strcpy(cpu_model, "VIA/IDT Unknown"); } @@ -853,6 +856,9 @@ printcpuinfo(void) ); } + if (cpu_vendor_id == CPU_VENDOR_CENTAUR) + print_via_padlock_info(); + if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_AMD) cpu_feature &= ~CPUID_HTT; @@ -872,6 +878,12 @@ printcpuinfo(void) if (amd_pminfo & AMDPM_TSC_INVARIANT) tsc_is_invariant = 1; break; + case CPU_VENDOR_CENTAUR: + if (I386_CPU_FAMILY(cpu_id) == 0x6 && + I386_CPU_MODEL(cpu_id) >= 0xf && + (rdmsr(0x1203) & 0x100000000ULL) == 0) + tsc_is_invariant = 1; + break; } if (tsc_is_invariant) printf("\n TSC: P-state invariant"); @@ -906,8 +918,6 @@ printcpuinfo(void) printf("\n CPU cache: write-through mode"); #endif } - if (cpu_vendor_id == CPU_VENDOR_CENTAUR) - print_via_padlock_info(); /* Avoid ugly blank lines: only print newline when we have to. */ if (*cpu_vendor || cpu_id) @@ -1559,6 +1569,7 @@ print_via_padlock_info(void) return; case 0x6a0: case 0x6d0: + case 0x6f0: break; default: return; Modified: stable/7/sys/i386/i386/initcpu.c ============================================================================== --- stable/7/sys/i386/i386/initcpu.c Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/i386/i386/initcpu.c Mon Jul 13 22:13:13 2009 (r195667) @@ -650,7 +650,7 @@ initializecpu(void) init_6x86MX(); break; case CPU_686: - if (strcmp(cpu_vendor, "GenuineIntel") == 0) { + if (cpu_vendor_id == CPU_VENDOR_INTEL) { switch (cpu_id & 0xff0) { case 0x610: init_ppro(); @@ -659,7 +659,7 @@ initializecpu(void) init_mendocino(); break; } - } else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_AMD) { #if defined(I686_CPU) && defined(CPU_ATHLON_SSE_HACK) /* * Sometimes the BIOS doesn't enable SSE instructions. @@ -678,7 +678,7 @@ initializecpu(void) cpu_feature = regs[3]; } #endif - } else if (strcmp(cpu_vendor, "CentaurHauls") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_CENTAUR) { switch (cpu_id & 0xff0) { case 0x690: if ((cpu_id & 0xf) < 3) @@ -686,6 +686,7 @@ initializecpu(void) /* fall through. */ case 0x6a0: case 0x6d0: + case 0x6f0: init_via(); break; default: @@ -718,7 +719,7 @@ initializecpu(void) * CPU_UPGRADE_HW_CACHE option in your kernel configuration file. * This option eliminates unneeded cache flush instruction(s). */ - if (strcmp(cpu_vendor, "CyrixInstead") == 0) { + if (cpu_vendor_id == CPU_VENDOR_CYRIX) { switch (cpu) { #ifdef I486_CPU case CPU_486DLC: @@ -737,7 +738,7 @@ initializecpu(void) default: break; } - } else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_AMD) { switch (cpu_id & 0xFF0) { case 0x470: /* Enhanced Am486DX2 WB */ case 0x490: /* Enhanced Am486DX4 WB */ @@ -745,7 +746,7 @@ initializecpu(void) need_pre_dma_flush = 1; break; } - } else if (strcmp(cpu_vendor, "IBM") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_IBM) { need_post_dma_flush = 1; } else { #ifdef CPU_I486_ON_386 @@ -941,7 +942,7 @@ DB_SHOW_COMMAND(cyrixreg, cyrixreg) u_char ccr0 = 0, ccr4 = 0, ccr5 = 0, pcr0 = 0; cr0 = rcr0(); - if (strcmp(cpu_vendor,"CyrixInstead") == 0) { + if (cpu_vendor_id == CPU_VENDOR_CYRIX) { eflags = read_eflags(); disable_intr(); Modified: stable/7/sys/i386/i386/msi.c ============================================================================== --- stable/7/sys/i386/i386/msi.c Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/i386/i386/msi.c Mon Jul 13 22:13:13 2009 (r195667) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include /* Fields in address for Intel MSI messages. */ @@ -212,9 +213,18 @@ msi_init(void) { /* Check if we have a supported CPU. */ - if (!(cpu_vendor_id == CPU_VENDOR_INTEL || - cpu_vendor_id == CPU_VENDOR_AMD)) + switch (cpu_vendor_id) { + case CPU_VENDOR_INTEL: + case CPU_VENDOR_AMD: + break; + case CPU_VENDOR_CENTAUR: + if (I386_CPU_FAMILY(cpu_id) == 0x6 && + I386_CPU_MODEL(cpu_id) >= 0xf) + break; + /* FALLTHROUGH */ + default: return; + } msi_enabled = 1; intr_register_pic(&msi_pic); Modified: stable/7/sys/modules/agp/Makefile ============================================================================== --- stable/7/sys/modules/agp/Makefile Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/modules/agp/Makefile Mon Jul 13 22:13:13 2009 (r195667) @@ -12,7 +12,7 @@ SRCS+= agp_i810.c agp_intel.c agp_via.c SRCS+= agp_amd64.c .endif .if ${MACHINE_ARCH} == "amd64" -SRCS+= agp_amd64.c agp_i810.c +SRCS+= agp_amd64.c agp_i810.c agp_via.c .endif SRCS+= device_if.h bus_if.h agp_if.h pci_if.h SRCS+= opt_bus.h Modified: stable/7/sys/pci/agp_via.c ============================================================================== --- stable/7/sys/pci/agp_via.c Mon Jul 13 21:36:31 2009 (r195666) +++ stable/7/sys/pci/agp_via.c Mon Jul 13 22:13:13 2009 (r195667) @@ -85,8 +85,14 @@ agp_via_match(device_t dev) return ("VIA 3296 (P4M800) host to PCI bridge"); case 0x03051106: return ("VIA 82C8363 (Apollo KT133x/KM133) host to PCI bridge"); + case 0x03141106: + return ("VIA 3314 (P4M800CE) host to PCI bridge"); case 0x03241106: return ("VIA VT3324 (CX700) host to PCI bridge"); + case 0x03271106: + return ("VIA 3327 (P4M890) host to PCI bridge"); + case 0x03641106: + return ("VIA 3364 (P4M900) host to PCI bridge"); case 0x03911106: return ("VIA 8371 (Apollo KX133) host to PCI bridge"); case 0x05011106: @@ -168,7 +174,10 @@ agp_via_attach(device_t dev) case 0x02591106: case 0x02691106: case 0x02961106: + case 0x03141106: case 0x03241106: + case 0x03271106: + case 0x03641106: case 0x31231106: case 0x31681106: case 0x31891106: From jhb at FreeBSD.org Tue Jul 14 14:56:02 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Jul 14 14:56:14 2009 Subject: svn commit: r195679 - in stable/7/sys: . contrib/pf dev/pci Message-ID: <200907141456.n6EEu1du062934@svn.freebsd.org> Author: jhb Date: Tue Jul 14 14:56:01 2009 New Revision: 195679 URL: http://svn.freebsd.org/changeset/base/195679 Log: MFC: Enable MSI in the MSI capability registers any time that the first message in an MSI group is enabled, not just if the address/data pair are not initialized. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/pci/pci.c Modified: stable/7/sys/dev/pci/pci.c ============================================================================== --- stable/7/sys/dev/pci/pci.c Tue Jul 14 14:41:48 2009 (r195678) +++ stable/7/sys/dev/pci/pci.c Tue Jul 14 14:56:01 2009 (r195679) @@ -2869,8 +2869,10 @@ pci_setup_intr(device_t dev, device_t ch goto bad; dinfo->cfg.msi.msi_addr = addr; dinfo->cfg.msi.msi_data = data; - pci_enable_msi(child, addr, data); } + if (dinfo->cfg.msi.msi_handlers == 0) + pci_enable_msi(child, dinfo->cfg.msi.msi_addr, + dinfo->cfg.msi.msi_data); dinfo->cfg.msi.msi_handlers++; } else { KASSERT(dinfo->cfg.msix.msix_alloc > 0, From jhb at FreeBSD.org Tue Jul 14 15:16:40 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Jul 14 15:16:57 2009 Subject: svn commit: r195681 - in stable/7/sys: . contrib/pf kern Message-ID: <200907141516.n6EFGdRD063426@svn.freebsd.org> Author: jhb Date: Tue Jul 14 15:16:39 2009 New Revision: 195681 URL: http://svn.freebsd.org/changeset/base/195681 Log: MFC: Return errors from intr_event_bind() to the caller of intr_set_affinity(). Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/kern_intr.c Modified: stable/7/sys/kern/kern_intr.c ============================================================================== --- stable/7/sys/kern/kern_intr.c Tue Jul 14 15:06:58 2009 (r195680) +++ stable/7/sys/kern/kern_intr.c Tue Jul 14 15:16:39 2009 (r195681) @@ -373,8 +373,7 @@ intr_setaffinity(int irq, void *m) ie = intr_lookup(irq); if (ie == NULL) return (ESRCH); - intr_event_bind(ie, cpu); - return (0); + return (intr_event_bind(ie, cpu)); } int From rnoland at FreeBSD.org Tue Jul 14 15:26:43 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Tue Jul 14 15:26:48 2009 Subject: svn commit: r195679 - in stable/7/sys: . contrib/pf dev/pci In-Reply-To: <200907141456.n6EEu1du062934@svn.freebsd.org> References: <200907141456.n6EEu1du062934@svn.freebsd.org> Message-ID: <1247583879.1745.24.camel@balrog.2hip.net> On Tue, 2009-07-14 at 14:56 +0000, John Baldwin wrote: > Author: jhb > Date: Tue Jul 14 14:56:01 2009 > New Revision: 195679 > URL: http://svn.freebsd.org/changeset/base/195679 > > Log: > MFC: Enable MSI in the MSI capability registers any time that the first > message in an MSI group is enabled, not just if the address/data pair are > not initialized. With this MFC, Intel drm on 965+ chipsets should suck substantially less than before. i.e. This should fix interrupts after a VT Switch issue. I'll follow on and MFC the rest of the changes from HEAD in the next day or so. robert. > Modified: > stable/7/sys/ (props changed) > stable/7/sys/contrib/pf/ (props changed) > stable/7/sys/dev/pci/pci.c > > Modified: stable/7/sys/dev/pci/pci.c > ============================================================================== > --- stable/7/sys/dev/pci/pci.c Tue Jul 14 14:41:48 2009 (r195678) > +++ stable/7/sys/dev/pci/pci.c Tue Jul 14 14:56:01 2009 (r195679) > @@ -2869,8 +2869,10 @@ pci_setup_intr(device_t dev, device_t ch > goto bad; > dinfo->cfg.msi.msi_addr = addr; > dinfo->cfg.msi.msi_data = data; > - pci_enable_msi(child, addr, data); > } > + if (dinfo->cfg.msi.msi_handlers == 0) > + pci_enable_msi(child, dinfo->cfg.msi.msi_addr, > + dinfo->cfg.msi.msi_data); > dinfo->cfg.msi.msi_handlers++; > } else { > KASSERT(dinfo->cfg.msix.msix_alloc > 0, -- Robert Noland FreeBSD -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-stable-7/attachments/20090714/9c88b32a/attachment.pgp From jhb at FreeBSD.org Tue Jul 14 15:31:00 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Jul 14 15:31:13 2009 Subject: svn commit: r195682 - stable/7/usr.sbin/sysinstall Message-ID: <200907141531.n6EFV03F063723@svn.freebsd.org> Author: jhb Date: Tue Jul 14 15:30:59 2009 New Revision: 195682 URL: http://svn.freebsd.org/changeset/base/195682 Log: MFC: Raise the default size of the EFI partition on ia64 from 100MB to 400MB. Modified: stable/7/usr.sbin/sysinstall/ (props changed) stable/7/usr.sbin/sysinstall/label.c Modified: stable/7/usr.sbin/sysinstall/label.c ============================================================================== --- stable/7/usr.sbin/sysinstall/label.c Tue Jul 14 15:16:39 2009 (r195681) +++ stable/7/usr.sbin/sysinstall/label.c Tue Jul 14 15:30:59 2009 (r195682) @@ -1410,7 +1410,7 @@ try_auto_label(Device **devs, Device *de #ifdef __ia64__ AutoEfi = NULL; if (EfiChunk == NULL) { - sz = 100 * ONE_MEG; + sz = 400 * ONE_MEG; AutoEfi = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c, sz, efi, 0, 0); if (AutoEfi == NULL) { From jkim at FreeBSD.org Tue Jul 14 17:38:00 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Tue Jul 14 17:38:12 2009 Subject: svn commit: r195686 - in stable/7/sys: . amd64/amd64 amd64/include conf contrib/pf crypto/via modules Message-ID: <200907141737.n6EHbxrN066458@svn.freebsd.org> Author: jkim Date: Tue Jul 14 17:37:59 2009 New Revision: 195686 URL: http://svn.freebsd.org/changeset/base/195686 Log: MFC: r187109, r187112 r187109 - Add basic amd64 support for VIA Nano processors. r187112 - Connect padlock(4) to amd64 build for VIA Nano processors. Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/amd64_mem.c stable/7/sys/amd64/amd64/identcpu.c stable/7/sys/amd64/amd64/initcpu.c stable/7/sys/amd64/amd64/msi.c stable/7/sys/amd64/include/md_var.h stable/7/sys/amd64/include/specialreg.h stable/7/sys/conf/files.amd64 stable/7/sys/contrib/pf/ (props changed) stable/7/sys/crypto/via/padlock.c stable/7/sys/crypto/via/padlock_hash.c stable/7/sys/modules/Makefile Modified: stable/7/sys/amd64/amd64/amd64_mem.c ============================================================================== --- stable/7/sys/amd64/amd64/amd64_mem.c Tue Jul 14 17:26:37 2009 (r195685) +++ stable/7/sys/amd64/amd64/amd64_mem.c Tue Jul 14 17:37:59 2009 (r195686) @@ -678,9 +678,17 @@ amd64_mem_drvinit(void *unused) return; if ((cpu_id & 0xf00) != 0x600 && (cpu_id & 0xf00) != 0xf00) return; - if (cpu_vendor_id != CPU_VENDOR_INTEL && - cpu_vendor_id != CPU_VENDOR_AMD) + switch (cpu_vendor_id) { + case CPU_VENDOR_INTEL: + case CPU_VENDOR_AMD: + break; + case CPU_VENDOR_CENTAUR: + if (cpu_exthigh >= 0x80000008) + break; + /* FALLTHROUGH */ + default: return; + } mem_range_softc.mr_op = &amd64_mrops; } SYSINIT(amd64memdev, SI_SUB_DRIVERS, SI_ORDER_FIRST, amd64_mem_drvinit, NULL); Modified: stable/7/sys/amd64/amd64/identcpu.c ============================================================================== --- stable/7/sys/amd64/amd64/identcpu.c Tue Jul 14 17:26:37 2009 (r195685) +++ stable/7/sys/amd64/amd64/identcpu.c Tue Jul 14 17:37:59 2009 (r195686) @@ -72,6 +72,7 @@ void panicifcpuunsupported(void); static u_int find_cpu_vendor_id(void); static void print_AMD_info(void); static void print_AMD_assoc(int i); +static void print_via_padlock_info(void); int cpu_class; char machine[] = "amd64"; @@ -125,24 +126,33 @@ printcpuinfo(void) } } - if (cpu_vendor_id == CPU_VENDOR_INTEL) { + switch (cpu_vendor_id) { + case CPU_VENDOR_INTEL: /* Please make up your mind folks! */ strcat(cpu_model, "EM64T"); - } else if (cpu_vendor_id == CPU_VENDOR_AMD) { + break; + case CPU_VENDOR_AMD: /* * Values taken from AMD Processor Recognition * http://www.amd.com/K6/k6docs/pdf/20734g.pdf * (also describes ``Features'' encodings. */ strcpy(cpu_model, "AMD "); - switch (cpu_id & 0xF00) { - case 0xf00: + if ((cpu_id & 0xf00) == 0xf00) strcat(cpu_model, "AMD64 Processor"); - break; - default: + else strcat(cpu_model, "Unknown"); - break; - } + break; + case CPU_VENDOR_CENTAUR: + strcpy(cpu_model, "VIA "); + if ((cpu_id & 0xff0) == 0x6f0) + strcat(cpu_model, "Nano Processor"); + else + strcat(cpu_model, "Unknown"); + break; + default: + strcat(cpu_model, "Unknown"); + break; } /* @@ -174,7 +184,8 @@ printcpuinfo(void) printf(" Id = 0x%x", cpu_id); if (cpu_vendor_id == CPU_VENDOR_INTEL || - cpu_vendor_id == CPU_VENDOR_AMD) { + cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_CENTAUR) { printf(" Stepping = %u", cpu_id & 0xf); if (cpu_high > 0) { u_int cmp = 1, htt = 1; @@ -346,6 +357,9 @@ printcpuinfo(void) ); } + if (cpu_vendor_id == CPU_VENDOR_CENTAUR) + print_via_padlock_info(); + if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_AMD) cpu_feature &= ~CPUID_HTT; @@ -454,7 +468,7 @@ EVENTHANDLER_DEFINE(cpufreq_post_change, EVENTHANDLER_PRI_ANY); /* - * Final stage of CPU identification. -- Should I check TI? + * Final stage of CPU identification. */ void identify_cpu(void) @@ -476,7 +490,8 @@ identify_cpu(void) cpu_feature2 = regs[2]; if (cpu_vendor_id == CPU_VENDOR_INTEL || - cpu_vendor_id == CPU_VENDOR_AMD) { + cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_CENTAUR) { do_cpuid(0x80000000, regs); cpu_exthigh = regs[0]; } @@ -597,3 +612,37 @@ print_AMD_info(void) print_AMD_l2_assoc((regs[2] >> 12) & 0x0f); } } + +static void +print_via_padlock_info(void) +{ + u_int regs[4]; + + /* Check for supported models. */ + switch (cpu_id & 0xff0) { + case 0x690: + if ((cpu_id & 0xf) < 3) + return; + case 0x6a0: + case 0x6d0: + case 0x6f0: + break; + default: + return; + } + + do_cpuid(0xc0000000, regs); + if (regs[0] >= 0xc0000001) + do_cpuid(0xc0000001, regs); + else + return; + + printf("\n VIA Padlock Features=0x%b", regs[3], + "\020" + "\003RNG" /* RNG */ + "\007AES" /* ACE */ + "\011AES-CTR" /* ACE2 */ + "\013SHA1,SHA256" /* PHE */ + "\015RSA" /* PMM */ + ); +} Modified: stable/7/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/7/sys/amd64/amd64/initcpu.c Tue Jul 14 17:26:37 2009 (r195685) +++ stable/7/sys/amd64/amd64/initcpu.c Tue Jul 14 17:37:59 2009 (r195686) @@ -54,6 +54,8 @@ u_int cpu_feature2; /* Feature flags */ u_int amd_feature; /* AMD feature flags */ u_int amd_feature2; /* AMD feature flags */ u_int amd_pminfo; /* AMD advanced power management info */ +u_int via_feature_rng; /* VIA RNG features */ +u_int via_feature_xcrypt; /* VIA ACE features */ u_int cpu_high; /* Highest arg to CPUID */ u_int cpu_exthigh; /* Highest arg to extended CPUID */ u_int cpu_id; /* Stepping ID */ @@ -64,6 +66,75 @@ u_int cpu_vendor_id; /* CPU vendor ID * u_int cpu_fxsr; /* SSE enabled */ u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */ +SYSCTL_UINT(_hw, OID_AUTO, via_feature_rng, CTLFLAG_RD, + &via_feature_rng, 0, "VIA C3/C7 RNG feature available in CPU"); +SYSCTL_UINT(_hw, OID_AUTO, via_feature_xcrypt, CTLFLAG_RD, + &via_feature_xcrypt, 0, "VIA C3/C7 xcrypt feature available in CPU"); + +/* + * Initialize special VIA C3/C7 features + */ +static void +init_via(void) +{ + u_int regs[4], val; + u_int64_t msreg; + + do_cpuid(0xc0000000, regs); + val = regs[0]; + if (val >= 0xc0000001) { + do_cpuid(0xc0000001, regs); + val = regs[3]; + } else + val = 0; + + /* Enable RNG if present and disabled */ + if (val & VIA_CPUID_HAS_RNG) { + if (!(val & VIA_CPUID_DO_RNG)) { + msreg = rdmsr(0x110B); + msreg |= 0x40; + wrmsr(0x110B, msreg); + } + via_feature_rng = VIA_HAS_RNG; + } + /* Enable AES engine if present and disabled */ + if (val & VIA_CPUID_HAS_ACE) { + if (!(val & VIA_CPUID_DO_ACE)) { + msreg = rdmsr(0x1107); + msreg |= (0x01 << 28); + wrmsr(0x1107, msreg); + } + via_feature_xcrypt |= VIA_HAS_AES; + } + /* Enable ACE2 engine if present and disabled */ + if (val & VIA_CPUID_HAS_ACE2) { + if (!(val & VIA_CPUID_DO_ACE2)) { + msreg = rdmsr(0x1107); + msreg |= (0x01 << 28); + wrmsr(0x1107, msreg); + } + via_feature_xcrypt |= VIA_HAS_AESCTR; + } + /* Enable SHA engine if present and disabled */ + if (val & VIA_CPUID_HAS_PHE) { + if (!(val & VIA_CPUID_DO_PHE)) { + msreg = rdmsr(0x1107); + msreg |= (0x01 << 28/**/); + wrmsr(0x1107, msreg); + } + via_feature_xcrypt |= VIA_HAS_SHA; + } + /* Enable MM engine if present and disabled */ + if (val & VIA_CPUID_HAS_PMM) { + if (!(val & VIA_CPUID_DO_PMM)) { + msreg = rdmsr(0x1107); + msreg |= (0x01 << 28/**/); + wrmsr(0x1107, msreg); + } + via_feature_xcrypt |= VIA_HAS_MM; + } +} + /* * Initialize CPU control registers */ @@ -81,4 +152,8 @@ initializecpu(void) wrmsr(MSR_EFER, msr); pg_nx = PG_NX; } + if (cpu_vendor_id == CPU_VENDOR_CENTAUR && + AMD64_CPU_FAMILY(cpu_id) == 0x6 && + AMD64_CPU_MODEL(cpu_id) >= 0xf) + init_via(); } Modified: stable/7/sys/amd64/amd64/msi.c ============================================================================== --- stable/7/sys/amd64/amd64/msi.c Tue Jul 14 17:26:37 2009 (r195685) +++ stable/7/sys/amd64/amd64/msi.c Tue Jul 14 17:37:59 2009 (r195686) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include /* Fields in address for Intel MSI messages. */ @@ -212,9 +213,18 @@ msi_init(void) { /* Check if we have a supported CPU. */ - if (!(cpu_vendor_id == CPU_VENDOR_INTEL || - cpu_vendor_id == CPU_VENDOR_AMD)) + switch (cpu_vendor_id) { + case CPU_VENDOR_INTEL: + case CPU_VENDOR_AMD: + break; + case CPU_VENDOR_CENTAUR: + if (AMD64_CPU_FAMILY(cpu_id) == 0x6 && + AMD64_CPU_MODEL(cpu_id) >= 0xf) + break; + /* FALLTHROUGH */ + default: return; + } msi_enabled = 1; intr_register_pic(&msi_pic); Modified: stable/7/sys/amd64/include/md_var.h ============================================================================== --- stable/7/sys/amd64/include/md_var.h Tue Jul 14 17:26:37 2009 (r195685) +++ stable/7/sys/amd64/include/md_var.h Tue Jul 14 17:37:59 2009 (r195686) @@ -45,6 +45,8 @@ extern u_int cpu_feature2; extern u_int amd_feature; extern u_int amd_feature2; extern u_int amd_pminfo; +extern u_int via_feature_rng; +extern u_int via_feature_xcrypt; extern u_int cpu_fxsr; extern u_int cpu_high; extern u_int cpu_id; Modified: stable/7/sys/amd64/include/specialreg.h ============================================================================== --- stable/7/sys/amd64/include/specialreg.h Tue Jul 14 17:26:37 2009 (r195685) +++ stable/7/sys/amd64/include/specialreg.h Tue Jul 14 17:37:59 2009 (r195686) @@ -459,4 +459,40 @@ #define MSR_TOP_MEM2 0xc001001d /* boundary for ram above 4G */ #define MSR_K8_UCODE_UPDATE 0xc0010020 /* update microcode */ +/* VIA ACE crypto featureset: for via_feature_rng */ +#define VIA_HAS_RNG 1 /* cpu has RNG */ + +/* VIA ACE crypto featureset: for via_feature_xcrypt */ +#define VIA_HAS_AES 1 /* cpu has AES */ +#define VIA_HAS_SHA 2 /* cpu has SHA1 & SHA256 */ +#define VIA_HAS_MM 4 /* cpu has RSA instructions */ +#define VIA_HAS_AESCTR 8 /* cpu has AES-CTR instructions */ + +/* Centaur Extended Feature flags */ +#define VIA_CPUID_HAS_RNG 0x000004 +#define VIA_CPUID_DO_RNG 0x000008 +#define VIA_CPUID_HAS_ACE 0x000040 +#define VIA_CPUID_DO_ACE 0x000080 +#define VIA_CPUID_HAS_ACE2 0x000100 +#define VIA_CPUID_DO_ACE2 0x000200 +#define VIA_CPUID_HAS_PHE 0x000400 +#define VIA_CPUID_DO_PHE 0x000800 +#define VIA_CPUID_HAS_PMM 0x001000 +#define VIA_CPUID_DO_PMM 0x002000 + +/* VIA ACE xcrypt-* instruction context control options */ +#define VIA_CRYPT_CWLO_ROUND_M 0x0000000f +#define VIA_CRYPT_CWLO_ALG_M 0x00000070 +#define VIA_CRYPT_CWLO_ALG_AES 0x00000000 +#define VIA_CRYPT_CWLO_KEYGEN_M 0x00000080 +#define VIA_CRYPT_CWLO_KEYGEN_HW 0x00000000 +#define VIA_CRYPT_CWLO_KEYGEN_SW 0x00000080 +#define VIA_CRYPT_CWLO_NORMAL 0x00000000 +#define VIA_CRYPT_CWLO_INTERMEDIATE 0x00000100 +#define VIA_CRYPT_CWLO_ENCRYPT 0x00000000 +#define VIA_CRYPT_CWLO_DECRYPT 0x00000200 +#define VIA_CRYPT_CWLO_KEY128 0x0000000a /* 128bit, 10 rds */ +#define VIA_CRYPT_CWLO_KEY192 0x0000040c /* 192bit, 12 rds */ +#define VIA_CRYPT_CWLO_KEY256 0x0000080e /* 256bit, 15 rds */ + #endif /* !_MACHINE_SPECIALREG_H_ */ Modified: stable/7/sys/conf/files.amd64 ============================================================================== --- stable/7/sys/conf/files.amd64 Tue Jul 14 17:26:37 2009 (r195685) +++ stable/7/sys/conf/files.amd64 Tue Jul 14 17:37:59 2009 (r195686) @@ -130,6 +130,9 @@ amd64/pci/pci_bus.c optional pci amd64/pci/pci_cfgreg.c optional pci crypto/blowfish/bf_enc.c optional crypto | ipsec crypto/des/des_enc.c optional crypto | ipsec | netsmb +crypto/via/padlock.c optional padlock +crypto/via/padlock_cipher.c optional padlock +crypto/via/padlock_hash.c optional padlock dev/acpica/acpi_if.m standard dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci Modified: stable/7/sys/crypto/via/padlock.c ============================================================================== --- stable/7/sys/crypto/via/padlock.c Tue Jul 14 17:26:37 2009 (r195685) +++ stable/7/sys/crypto/via/padlock.c Tue Jul 14 17:37:59 2009 (r195686) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(__i386__) && !defined(PC98) +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) #include #include #include @@ -83,7 +83,7 @@ padlock_probe(device_t dev) { char capp[256]; -#if defined(__i386__) && !defined(PC98) +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) /* If there is no AES support, we has nothing to do here. */ if (!(via_feature_xcrypt & VIA_HAS_AES)) { device_printf(dev, "No ACE support.\n"); Modified: stable/7/sys/crypto/via/padlock_hash.c ============================================================================== --- stable/7/sys/crypto/via/padlock_hash.c Tue Jul 14 17:26:37 2009 (r195685) +++ stable/7/sys/crypto/via/padlock_hash.c Tue Jul 14 17:37:59 2009 (r195686) @@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(__i386__) && !defined(PC98) +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) #include #include #include Modified: stable/7/sys/modules/Makefile ============================================================================== --- stable/7/sys/modules/Makefile Tue Jul 14 17:26:37 2009 (r195685) +++ stable/7/sys/modules/Makefile Tue Jul 14 17:37:59 2009 (r195686) @@ -559,6 +559,11 @@ _nxge= nxge .if ${MK_CDDL} != "no" || defined(ALL_MODULES) _opensolaris= opensolaris .endif +.if ${MK_CRYPT} != "no" || defined(ALL_MODULES) +.if exists(${.CURDIR}/../crypto/via) +_padlock= padlock +.endif +.endif _pccard= pccard _rdma= rdma _safe= safe From jkim at FreeBSD.org Tue Jul 14 18:40:32 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Tue Jul 14 18:40:49 2009 Subject: svn commit: r195687 - in stable/7/sys: . amd64/amd64 contrib/pf i386/i386 Message-ID: <200907141840.n6EIeV4i067797@svn.freebsd.org> Author: jkim Date: Tue Jul 14 18:40:31 2009 New Revision: 195687 URL: http://svn.freebsd.org/changeset/base/195687 Log: MFC: r191788 Unlock the largest standard CPUID on Intel CPUs for both amd64 and i386. On i386, we extend it to cover Core, Core 2, and Core i7 processors, not just Pentium 4 family, and move it to better place. On amd64, all supported Intel CPUs should have this MSR. Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/identcpu.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/i386/identcpu.c Modified: stable/7/sys/amd64/amd64/identcpu.c ============================================================================== --- stable/7/sys/amd64/amd64/identcpu.c Tue Jul 14 17:37:59 2009 (r195686) +++ stable/7/sys/amd64/amd64/identcpu.c Tue Jul 14 18:40:31 2009 (r195687) @@ -489,6 +489,22 @@ identify_cpu(void) cpu_feature = regs[3]; cpu_feature2 = regs[2]; + /* + * Clear "Limit CPUID Maxval" bit and get the largest standard CPUID + * function number again if it is set from BIOS. It is necessary + * for probing correct CPU topology later. + * XXX This is only done on the BSP package. + */ + if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_high > 0 && cpu_high < 4) { + uint64_t msr; + msr = rdmsr(MSR_IA32_MISC_ENABLE); + if ((msr & 0x400000ULL) != 0) { + wrmsr(MSR_IA32_MISC_ENABLE, msr & ~0x400000ULL); + do_cpuid(0, regs); + cpu_high = regs[0]; + } + } + if (cpu_vendor_id == CPU_VENDOR_INTEL || cpu_vendor_id == CPU_VENDOR_AMD || cpu_vendor_id == CPU_VENDOR_CENTAUR) { Modified: stable/7/sys/i386/i386/identcpu.c ============================================================================== --- stable/7/sys/i386/i386/identcpu.c Tue Jul 14 17:37:59 2009 (r195686) +++ stable/7/sys/i386/i386/identcpu.c Tue Jul 14 18:40:31 2009 (r195687) @@ -209,7 +209,6 @@ printcpuinfo(void) if (cpu_vendor_id == CPU_VENDOR_INTEL) { if ((cpu_id & 0xf00) > 0x300) { u_int brand_index; - u_int model; cpu_model[0] = '\0'; @@ -322,16 +321,6 @@ printcpuinfo(void) case 0xf00: strcat(cpu_model, "Pentium 4"); cpu = CPU_P4; - model = (cpu_id & 0x0f0) >> 4; - if (model == 3 || model == 4 || model == 6) { - uint64_t tmp; - - tmp = rdmsr(MSR_IA32_MISC_ENABLE); - wrmsr(MSR_IA32_MISC_ENABLE, - tmp & ~(1LL << 22)); - do_cpuid(0, regs); - cpu_high = regs[0]; - } break; default: strcat(cpu_model, "unknown"); @@ -1127,6 +1116,24 @@ finishidentcpu(void) cpu_vendor_id = find_cpu_vendor_id(); + /* + * Clear "Limit CPUID Maxval" bit and get the largest standard CPUID + * function number again if it is set from BIOS. It is necessary + * for probing correct CPU topology later. + * XXX This is only done on the BSP package. + */ + if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_high > 0 && cpu_high < 4 && + ((I386_CPU_FAMILY(cpu_id) == 0xf && I386_CPU_MODEL(cpu_id) >= 0x3) || + (I386_CPU_FAMILY(cpu_id) == 0x6 && I386_CPU_MODEL(cpu_id) >= 0xe))) { + uint64_t msr; + msr = rdmsr(MSR_IA32_MISC_ENABLE); + if ((msr & 0x400000ULL) != 0) { + wrmsr(MSR_IA32_MISC_ENABLE, msr & ~0x400000ULL); + do_cpuid(0, regs); + cpu_high = regs[0]; + } + } + /* Detect AMD features (PTE no-execute bit, 3dnow, 64 bit mode etc) */ if (cpu_vendor_id == CPU_VENDOR_INTEL || cpu_vendor_id == CPU_VENDOR_AMD) { From jhb at FreeBSD.org Tue Jul 14 19:48:35 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Jul 14 19:48:51 2009 Subject: svn commit: r195694 - in stable/7: include lib/libc lib/libc/sys sys sys/compat/freebsd32 sys/contrib/pf sys/kern sys/sys tools/regression/file tools/regression/file/closefrom tools/regression/file... Message-ID: <200907141948.n6EJmVs0069443@svn.freebsd.org> Author: jhb Date: Tue Jul 14 19:48:31 2009 New Revision: 195694 URL: http://svn.freebsd.org/changeset/base/195694 Log: MFC: Add a new 'void closefrom(int lowfd)' system call. When called, it closes any open file descriptors >= 'lowfd'. Bump __FreeBSD_version to 702104. Added: stable/7/lib/libc/sys/closefrom.2 - copied unchanged from r194262, head/lib/libc/sys/closefrom.2 stable/7/tools/regression/file/closefrom/ - copied from r194262, head/tools/regression/file/closefrom/ Modified: stable/7/include/ (props changed) stable/7/include/unistd.h stable/7/lib/libc/ (props changed) stable/7/lib/libc/sys/Makefile.inc stable/7/lib/libc/sys/Symbol.map stable/7/lib/libc/sys/close.2 stable/7/sys/ (props changed) stable/7/sys/compat/freebsd32/syscalls.master stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/kern_descrip.c stable/7/sys/kern/syscalls.master stable/7/sys/sys/param.h stable/7/tools/regression/file/ (props changed) stable/7/tools/regression/file/flock/ (props changed) Modified: stable/7/include/unistd.h ============================================================================== --- stable/7/include/unistd.h Tue Jul 14 19:45:36 2009 (r195693) +++ stable/7/include/unistd.h Tue Jul 14 19:48:31 2009 (r195694) @@ -326,6 +326,7 @@ unsigned int alarm(unsigned int); int chdir(const char *); int chown(const char *, uid_t, gid_t); int close(int); +void closefrom(int); int dup(int); int dup2(int, int); int eaccess(const char *, int); Modified: stable/7/lib/libc/sys/Makefile.inc ============================================================================== --- stable/7/lib/libc/sys/Makefile.inc Tue Jul 14 19:45:36 2009 (r195693) +++ stable/7/lib/libc/sys/Makefile.inc Tue Jul 14 19:48:31 2009 (r195694) @@ -63,7 +63,7 @@ MAN+= _exit.2 abort2.2 accept.2 access.2 aio_cancel.2 aio_error.2 aio_read.2 aio_return.2 \ aio_suspend.2 aio_waitcomplete.2 aio_write.2 \ bind.2 brk.2 chdir.2 chflags.2 \ - chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 \ + chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 closefrom.2 \ connect.2 cpuset.2 cpuset_getaffinity.2 dup.2 execve.2 \ extattr_get_file.2 fcntl.2 fhopen.2 flock.2 fork.2 fsync.2 \ getdirentries.2 getdtablesize.2 \ Modified: stable/7/lib/libc/sys/Symbol.map ============================================================================== --- stable/7/lib/libc/sys/Symbol.map Tue Jul 14 19:45:36 2009 (r195693) +++ stable/7/lib/libc/sys/Symbol.map Tue Jul 14 19:48:31 2009 (r195694) @@ -337,6 +337,7 @@ FBSD_1.0 { }; FBSD_1.1 { + closefrom; cpuset; cpuset_getid; cpuset_setid; @@ -458,6 +459,8 @@ FBSDprivate_1.0 { __sys_clock_settime; _close; __sys_close; + _closefrom; + __sys_closefrom; _connect; __sys_connect; _cpuset; Modified: stable/7/lib/libc/sys/close.2 ============================================================================== --- stable/7/lib/libc/sys/close.2 Tue Jul 14 19:45:36 2009 (r195693) +++ stable/7/lib/libc/sys/close.2 Tue Jul 14 19:48:31 2009 (r195694) @@ -120,6 +120,7 @@ before all pending data was delivered. .El .Sh SEE ALSO .Xr accept 2 , +.Xr closefrom 2 , .Xr execve 2 , .Xr fcntl 2 , .Xr flock 2 , Copied: stable/7/lib/libc/sys/closefrom.2 (from r194262, head/lib/libc/sys/closefrom.2) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/lib/libc/sys/closefrom.2 Tue Jul 14 19:48:31 2009 (r195694, copy of r194262, head/lib/libc/sys/closefrom.2) @@ -0,0 +1,53 @@ +.\" Copyright (c) 2009 Advanced Computing Technologies LLC +.\" Written by: John H. Baldwin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (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$ +.\" +.Dd June 12, 2009 +.Dt CLOSEFROM 2 +.Os +.Sh NAME +.Nm closefrom +.Nd delete open file descriptors +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In unistd.h +.Ft void +.Fn closefrom "int lowfd" +.Sh DESCRIPTION +The +.Fn closefrom +system call deletes all open file descriptors greater than or equal to +.Fa lowfd +from the per-process object reference table. +Any errors encountered while closing file descriptors are ignored. +.Sh SEE ALSO +.Xr close 2 +.Sh HISTORY +The +.Fn closefrom +function first appeared in +.Fx 8.0 . Modified: stable/7/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/7/sys/compat/freebsd32/syscalls.master Tue Jul 14 19:45:36 2009 (r195693) +++ stable/7/sys/compat/freebsd32/syscalls.master Tue Jul 14 19:48:31 2009 (r195694) @@ -854,3 +854,24 @@ uint32_t idlo, uint32_t idhi, \ size_t cpusetsize, \ const cpuset_t *mask); } +489 AUE_NULL UNIMPL faccessat +490 AUE_NULL UNIMPL fchmodat +491 AUE_NULL UNIMPL fchownat +492 AUE_NULL UNIMPL freebsd32_fexecve +493 AUE_NULL UNIMPL freebsd32_fstatat +494 AUE_NULL UNIMPL freebsd32_futimesat +495 AUE_NULL UNIMPL linkat +496 AUE_NULL UNIMPL mkdirat +497 AUE_NULL UNIMPL mkfifoat +498 AUE_NULL UNIMPL mknodat +499 AUE_NULL UNIMPL openat +500 AUE_NULL UNIMPL readlinkat +501 AUE_NULL UNIMPL renameat +502 AUE_NULL UNIMPL symlinkat +503 AUE_NULL UNIMPL unlinkat +504 AUE_NULL UNIMPL posix_openpt +505 AUE_NULL UNIMPL gssd_syscall +506 AUE_NULL UNIMPL freebsd32_jail_get +507 AUE_NULL UNIMPL freebsd32_jail_set +508 AUE_NULL UNIMPL jail_remove +509 AUE_CLOSEFROM NOPROTO { int closefrom(int lowfd); } Modified: stable/7/sys/kern/kern_descrip.c ============================================================================== --- stable/7/sys/kern/kern_descrip.c Tue Jul 14 19:45:36 2009 (r195693) +++ stable/7/sys/kern/kern_descrip.c Tue Jul 14 19:48:31 2009 (r195694) @@ -1136,6 +1136,42 @@ kern_close(td, fd) return (error); } +/* + * Close open file descriptors. + */ +#ifndef _SYS_SYSPROTO_H_ +struct closefrom_args { + int lowfd; +}; +#endif +/* ARGSUSED */ +int +closefrom(struct thread *td, struct closefrom_args *uap) +{ + struct filedesc *fdp; + int fd; + + fdp = td->td_proc->p_fd; + AUDIT_ARG(fd, uap->lowfd); + + /* + * Treat negative starting file descriptor values identical to + * closefrom(0) which closes all files. + */ + if (uap->lowfd < 0) + uap->lowfd = 0; + FILEDESC_SLOCK(fdp); + for (fd = uap->lowfd; fd < fdp->fd_nfiles; fd++) { + if (fdp->fd_ofiles[fd] != NULL) { + FILEDESC_SUNLOCK(fdp); + (void)kern_close(td, fd); + FILEDESC_SLOCK(fdp); + } + } + FILEDESC_SUNLOCK(fdp); + return (0); +} + #if defined(COMPAT_43) /* * Return status information about a file descriptor. Modified: stable/7/sys/kern/syscalls.master ============================================================================== --- stable/7/sys/kern/syscalls.master Tue Jul 14 19:45:36 2009 (r195693) +++ stable/7/sys/kern/syscalls.master Tue Jul 14 19:48:31 2009 (r195694) @@ -870,6 +870,26 @@ 488 AUE_NULL STD { int cpuset_setaffinity(cpulevel_t level, \ cpuwhich_t which, id_t id, size_t cpusetsize, \ const cpuset_t *mask); } - +489 AUE_NULL UNIMPL faccessat +490 AUE_NULL UNIMPL fchmodat +491 AUE_NULL UNIMPL fchownat +492 AUE_NULL UNIMPL fexecve +493 AUE_NULL UNIMPL fstatat +494 AUE_NULL UNIMPL futimesat +495 AUE_NULL UNIMPL linkat +496 AUE_NULL UNIMPL mkdirat +497 AUE_NULL UNIMPL mkfifoat +498 AUE_NULL UNIMPL mknodat +499 AUE_NULL UNIMPL openat +500 AUE_NULL UNIMPL readlinkat +501 AUE_NULL UNIMPL renameat +502 AUE_NULL UNIMPL symlinkat +503 AUE_NULL UNIMPL unlinkat +504 AUE_NULL UNIMPL posix_openpt +505 AUE_NULL UNIMPL gssd_syscall +506 AUE_NULL UNIMPL jail_get +507 AUE_NULL UNIMPL jail_set +508 AUE_NULL UNIMPL jail_remove +509 AUE_CLOSEFROM STD { int closefrom(int lowfd); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: stable/7/sys/sys/param.h ============================================================================== --- stable/7/sys/sys/param.h Tue Jul 14 19:45:36 2009 (r195693) +++ stable/7/sys/sys/param.h Tue Jul 14 19:48:31 2009 (r195694) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 702103 /* Master, propagated to newvers */ +#define __FreeBSD_version 702104 /* Master, propagated to newvers */ #ifndef LOCORE #include From jhb at FreeBSD.org Tue Jul 14 19:50:47 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Jul 14 19:50:59 2009 Subject: svn commit: r195695 - in stable/7/sys: compat/freebsd32 kern sys Message-ID: <200907141950.n6EJokxc069550@svn.freebsd.org> Author: jhb Date: Tue Jul 14 19:50:46 2009 New Revision: 195695 URL: http://svn.freebsd.org/changeset/base/195695 Log: Regenerate after addition of closefrom(). Modified: stable/7/sys/compat/freebsd32/freebsd32_proto.h stable/7/sys/compat/freebsd32/freebsd32_syscall.h stable/7/sys/compat/freebsd32/freebsd32_syscalls.c stable/7/sys/compat/freebsd32/freebsd32_sysent.c stable/7/sys/kern/init_sysent.c stable/7/sys/kern/syscalls.c stable/7/sys/kern/systrace_args.c stable/7/sys/sys/syscall.h stable/7/sys/sys/syscall.mk stable/7/sys/sys/sysproto.h Modified: stable/7/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_proto.h Tue Jul 14 19:48:31 2009 (r195694) +++ stable/7/sys/compat/freebsd32/freebsd32_proto.h Tue Jul 14 19:50:46 2009 (r195695) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 194359 2009-06-17 13:12:43Z kib + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195694 2009-07-14 19:48:31Z jhb */ #ifndef _FREEBSD32_SYSPROTO_H_ Modified: stable/7/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_syscall.h Tue Jul 14 19:48:31 2009 (r195694) +++ stable/7/sys/compat/freebsd32/freebsd32_syscall.h Tue Jul 14 19:50:46 2009 (r195695) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 194359 2009-06-17 13:12:43Z kib + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195694 2009-07-14 19:48:31Z jhb */ #define FREEBSD32_SYS_syscall 0 @@ -361,4 +361,5 @@ #define FREEBSD32_SYS_freebsd32_cpuset_getid 486 #define FREEBSD32_SYS_freebsd32_cpuset_getaffinity 487 #define FREEBSD32_SYS_freebsd32_cpuset_setaffinity 488 -#define FREEBSD32_SYS_MAXSYSCALL 489 +#define FREEBSD32_SYS_closefrom 509 +#define FREEBSD32_SYS_MAXSYSCALL 510 Modified: stable/7/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_syscalls.c Tue Jul 14 19:48:31 2009 (r195694) +++ stable/7/sys/compat/freebsd32/freebsd32_syscalls.c Tue Jul 14 19:50:46 2009 (r195695) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 194359 2009-06-17 13:12:43Z kib + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195694 2009-07-14 19:48:31Z jhb */ const char *freebsd32_syscallnames[] = { @@ -496,4 +496,25 @@ const char *freebsd32_syscallnames[] = { "freebsd32_cpuset_getid", /* 486 = freebsd32_cpuset_getid */ "freebsd32_cpuset_getaffinity", /* 487 = freebsd32_cpuset_getaffinity */ "freebsd32_cpuset_setaffinity", /* 488 = freebsd32_cpuset_setaffinity */ + "#489", /* 489 = faccessat */ + "#490", /* 490 = fchmodat */ + "#491", /* 491 = fchownat */ + "#492", /* 492 = freebsd32_fexecve */ + "#493", /* 493 = freebsd32_fstatat */ + "#494", /* 494 = freebsd32_futimesat */ + "#495", /* 495 = linkat */ + "#496", /* 496 = mkdirat */ + "#497", /* 497 = mkfifoat */ + "#498", /* 498 = mknodat */ + "#499", /* 499 = openat */ + "#500", /* 500 = readlinkat */ + "#501", /* 501 = renameat */ + "#502", /* 502 = symlinkat */ + "#503", /* 503 = unlinkat */ + "#504", /* 504 = posix_openpt */ + "#505", /* 505 = gssd_syscall */ + "#506", /* 506 = freebsd32_jail_get */ + "#507", /* 507 = freebsd32_jail_set */ + "#508", /* 508 = jail_remove */ + "closefrom", /* 509 = closefrom */ }; Modified: stable/7/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_sysent.c Tue Jul 14 19:48:31 2009 (r195694) +++ stable/7/sys/compat/freebsd32/freebsd32_sysent.c Tue Jul 14 19:50:46 2009 (r195695) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 194359 2009-06-17 13:12:43Z kib + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195694 2009-07-14 19:48:31Z jhb */ #include "opt_compat.h" @@ -527,4 +527,25 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_cpuset_getid_args), (sy_call_t *)freebsd32_cpuset_getid, AUE_NULL, NULL, 0, 0 }, /* 486 = freebsd32_cpuset_getid */ { AS(freebsd32_cpuset_getaffinity_args), (sy_call_t *)freebsd32_cpuset_getaffinity, AUE_NULL, NULL, 0, 0 }, /* 487 = freebsd32_cpuset_getaffinity */ { AS(freebsd32_cpuset_setaffinity_args), (sy_call_t *)freebsd32_cpuset_setaffinity, AUE_NULL, NULL, 0, 0 }, /* 488 = freebsd32_cpuset_setaffinity */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 489 = faccessat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 490 = fchmodat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 491 = fchownat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 492 = freebsd32_fexecve */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 493 = freebsd32_fstatat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 494 = freebsd32_futimesat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 495 = linkat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 496 = mkdirat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 497 = mkfifoat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 498 = mknodat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 499 = openat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 500 = readlinkat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 501 = renameat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 502 = symlinkat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 503 = unlinkat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 504 = posix_openpt */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 505 = gssd_syscall */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 506 = freebsd32_jail_get */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 507 = freebsd32_jail_set */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 508 = jail_remove */ + { AS(closefrom_args), (sy_call_t *)closefrom, AUE_CLOSEFROM, NULL, 0, 0 }, /* 509 = closefrom */ }; Modified: stable/7/sys/kern/init_sysent.c ============================================================================== --- stable/7/sys/kern/init_sysent.c Tue Jul 14 19:48:31 2009 (r195694) +++ stable/7/sys/kern/init_sysent.c Tue Jul 14 19:50:46 2009 (r195695) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/kern/syscalls.master 180808 2008-07-25 17:46:01Z jhb + * created from FreeBSD: stable/7/sys/kern/syscalls.master 195694 2009-07-14 19:48:31Z jhb */ #include "opt_compat.h" @@ -517,4 +517,25 @@ struct sysent sysent[] = { { AS(cpuset_getid_args), (sy_call_t *)cpuset_getid, AUE_NULL, NULL, 0, 0 }, /* 486 = cpuset_getid */ { AS(cpuset_getaffinity_args), (sy_call_t *)cpuset_getaffinity, AUE_NULL, NULL, 0, 0 }, /* 487 = cpuset_getaffinity */ { AS(cpuset_setaffinity_args), (sy_call_t *)cpuset_setaffinity, AUE_NULL, NULL, 0, 0 }, /* 488 = cpuset_setaffinity */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 489 = faccessat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 490 = fchmodat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 491 = fchownat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 492 = fexecve */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 493 = fstatat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 494 = futimesat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 495 = linkat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 496 = mkdirat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 497 = mkfifoat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 498 = mknodat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 499 = openat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 500 = readlinkat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 501 = renameat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 502 = symlinkat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 503 = unlinkat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 504 = posix_openpt */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 505 = gssd_syscall */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 506 = jail_get */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 507 = jail_set */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 508 = jail_remove */ + { AS(closefrom_args), (sy_call_t *)closefrom, AUE_CLOSEFROM, NULL, 0, 0 }, /* 509 = closefrom */ }; Modified: stable/7/sys/kern/syscalls.c ============================================================================== --- stable/7/sys/kern/syscalls.c Tue Jul 14 19:48:31 2009 (r195694) +++ stable/7/sys/kern/syscalls.c Tue Jul 14 19:50:46 2009 (r195695) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/kern/syscalls.master 180808 2008-07-25 17:46:01Z jhb + * created from FreeBSD: stable/7/sys/kern/syscalls.master 195694 2009-07-14 19:48:31Z jhb */ const char *syscallnames[] = { @@ -496,4 +496,25 @@ const char *syscallnames[] = { "cpuset_getid", /* 486 = cpuset_getid */ "cpuset_getaffinity", /* 487 = cpuset_getaffinity */ "cpuset_setaffinity", /* 488 = cpuset_setaffinity */ + "#489", /* 489 = faccessat */ + "#490", /* 490 = fchmodat */ + "#491", /* 491 = fchownat */ + "#492", /* 492 = fexecve */ + "#493", /* 493 = fstatat */ + "#494", /* 494 = futimesat */ + "#495", /* 495 = linkat */ + "#496", /* 496 = mkdirat */ + "#497", /* 497 = mkfifoat */ + "#498", /* 498 = mknodat */ + "#499", /* 499 = openat */ + "#500", /* 500 = readlinkat */ + "#501", /* 501 = renameat */ + "#502", /* 502 = symlinkat */ + "#503", /* 503 = unlinkat */ + "#504", /* 504 = posix_openpt */ + "#505", /* 505 = gssd_syscall */ + "#506", /* 506 = jail_get */ + "#507", /* 507 = jail_set */ + "#508", /* 508 = jail_remove */ + "closefrom", /* 509 = closefrom */ }; Modified: stable/7/sys/kern/systrace_args.c ============================================================================== --- stable/7/sys/kern/systrace_args.c Tue Jul 14 19:48:31 2009 (r195694) +++ stable/7/sys/kern/systrace_args.c Tue Jul 14 19:50:46 2009 (r195695) @@ -2936,6 +2936,13 @@ systrace_args(int sysnum, void *params, *n_args = 5; break; } + /* closefrom */ + case 509: { + struct closefrom_args *p = params; + iarg[0] = p->lowfd; /* int */ + *n_args = 1; + break; + } default: *n_args = 0; break; @@ -4489,6 +4496,16 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* setfib */ + case 175: + switch(ndx) { + case 0: + p = "int"; + break; + default: + break; + }; + break; /* ntp_adjtime */ case 176: switch(ndx) { @@ -7652,6 +7669,105 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* cpuset */ + case 484: + switch(ndx) { + case 0: + p = "cpusetid_t *"; + break; + default: + break; + }; + break; + /* cpuset_setid */ + case 485: + switch(ndx) { + case 0: + p = "cpuwhich_t"; + break; + case 1: + p = "id_t"; + break; + case 2: + p = "cpusetid_t"; + break; + default: + break; + }; + break; + /* cpuset_getid */ + case 486: + switch(ndx) { + case 0: + p = "cpulevel_t"; + break; + case 1: + p = "cpuwhich_t"; + break; + case 2: + p = "id_t"; + break; + case 3: + p = "cpusetid_t *"; + break; + default: + break; + }; + break; + /* cpuset_getaffinity */ + case 487: + switch(ndx) { + case 0: + p = "cpulevel_t"; + break; + case 1: + p = "cpuwhich_t"; + break; + case 2: + p = "id_t"; + break; + case 3: + p = "size_t"; + break; + case 4: + p = "cpuset_t *"; + break; + default: + break; + }; + break; + /* cpuset_setaffinity */ + case 488: + switch(ndx) { + case 0: + p = "cpulevel_t"; + break; + case 1: + p = "cpuwhich_t"; + break; + case 2: + p = "id_t"; + break; + case 3: + p = "size_t"; + break; + case 4: + p = "const cpuset_t *"; + break; + default: + break; + }; + break; + /* closefrom */ + case 509: + switch(ndx) { + case 0: + p = "int"; + break; + default: + break; + }; + break; default: break; }; Modified: stable/7/sys/sys/syscall.h ============================================================================== --- stable/7/sys/sys/syscall.h Tue Jul 14 19:48:31 2009 (r195694) +++ stable/7/sys/sys/syscall.h Tue Jul 14 19:50:46 2009 (r195695) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/kern/syscalls.master 180808 2008-07-25 17:46:01Z jhb + * created from FreeBSD: stable/7/sys/kern/syscalls.master 195694 2009-07-14 19:48:31Z jhb */ #define SYS_syscall 0 @@ -408,4 +408,5 @@ #define SYS_cpuset_getid 486 #define SYS_cpuset_getaffinity 487 #define SYS_cpuset_setaffinity 488 -#define SYS_MAXSYSCALL 489 +#define SYS_closefrom 509 +#define SYS_MAXSYSCALL 510 Modified: stable/7/sys/sys/syscall.mk ============================================================================== --- stable/7/sys/sys/syscall.mk Tue Jul 14 19:48:31 2009 (r195694) +++ stable/7/sys/sys/syscall.mk Tue Jul 14 19:50:46 2009 (r195695) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: stable/7/sys/kern/syscalls.master 180808 2008-07-25 17:46:01Z jhb +# created from FreeBSD: stable/7/sys/kern/syscalls.master 195694 2009-07-14 19:48:31Z jhb MIASM = \ syscall.o \ exit.o \ @@ -356,4 +356,5 @@ MIASM = \ cpuset_setid.o \ cpuset_getid.o \ cpuset_getaffinity.o \ - cpuset_setaffinity.o + cpuset_setaffinity.o \ + closefrom.o Modified: stable/7/sys/sys/sysproto.h ============================================================================== --- stable/7/sys/sys/sysproto.h Tue Jul 14 19:48:31 2009 (r195694) +++ stable/7/sys/sys/sysproto.h Tue Jul 14 19:50:46 2009 (r195695) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/kern/syscalls.master 180808 2008-07-25 17:46:01Z jhb + * created from FreeBSD: stable/7/sys/kern/syscalls.master 195694 2009-07-14 19:48:31Z jhb */ #ifndef _SYS_SYSPROTO_H_ @@ -1558,6 +1558,9 @@ struct cpuset_setaffinity_args { char cpusetsize_l_[PADL_(size_t)]; size_t cpusetsize; char cpusetsize_r_[PADR_(size_t)]; char mask_l_[PADL_(const cpuset_t *)]; const cpuset_t * mask; char mask_r_[PADR_(const cpuset_t *)]; }; +struct closefrom_args { + char lowfd_l_[PADL_(int)]; int lowfd; char lowfd_r_[PADR_(int)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -1904,6 +1907,7 @@ int cpuset_setid(struct thread *, struct int cpuset_getid(struct thread *, struct cpuset_getid_args *); int cpuset_getaffinity(struct thread *, struct cpuset_getaffinity_args *); int cpuset_setaffinity(struct thread *, struct cpuset_setaffinity_args *); +int closefrom(struct thread *, struct closefrom_args *); #ifdef COMPAT_43 @@ -2475,6 +2479,7 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_cpuset_getid AUE_NULL #define SYS_AUE_cpuset_getaffinity AUE_NULL #define SYS_AUE_cpuset_setaffinity AUE_NULL +#define SYS_AUE_closefrom AUE_CLOSEFROM #undef PAD_ #undef PADL_ From jhb at FreeBSD.org Tue Jul 14 20:46:20 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Jul 14 20:46:32 2009 Subject: svn commit: r195696 - in stable/7: crypto/openssh secure/lib/libssh Message-ID: <200907142046.n6EKkJwO070823@svn.freebsd.org> Author: jhb Date: Tue Jul 14 20:46:19 2009 New Revision: 195696 URL: http://svn.freebsd.org/changeset/base/195696 Log: MFC: Use the closefrom(2) system call. Modified: stable/7/crypto/openssh/ (props changed) stable/7/crypto/openssh/config.h stable/7/crypto/openssh/ssh_namespace.h stable/7/secure/lib/libssh/ (props changed) stable/7/secure/lib/libssh/Makefile Modified: stable/7/crypto/openssh/config.h ============================================================================== --- stable/7/crypto/openssh/config.h Tue Jul 14 19:50:46 2009 (r195695) +++ stable/7/crypto/openssh/config.h Tue Jul 14 20:46:19 2009 (r195696) @@ -211,7 +211,7 @@ #define HAVE_CLOCK_T 1 /* Define to 1 if you have the `closefrom' function. */ -/* #undef HAVE_CLOSEFROM */ +#define HAVE_CLOSEFROM 1 /* Define if gai_strerror() returns const char * */ #define HAVE_CONST_GAI_STRERROR_PROTO 1 Modified: stable/7/crypto/openssh/ssh_namespace.h ============================================================================== --- stable/7/crypto/openssh/ssh_namespace.h Tue Jul 14 19:50:46 2009 (r195695) +++ stable/7/crypto/openssh/ssh_namespace.h Tue Jul 14 20:46:19 2009 (r195696) @@ -154,7 +154,6 @@ #define ciphers_valid ssh_ciphers_valid #define cleanhostname ssh_cleanhostname #define cleanup_exit ssh_cleanup_exit -#define closefrom ssh_closefrom #define colon ssh_colon #define compat_cipher_proposal ssh_compat_cipher_proposal #define compat_datafellows ssh_compat_datafellows Modified: stable/7/secure/lib/libssh/Makefile ============================================================================== --- stable/7/secure/lib/libssh/Makefile Tue Jul 14 19:50:46 2009 (r195695) +++ stable/7/secure/lib/libssh/Makefile Tue Jul 14 20:46:19 2009 (r195696) @@ -19,7 +19,7 @@ SRCS= acss.c authfd.c authfile.c bufaux. # compiled directly into sshd instead. # Portability layer -SRCS+= bsd-arc4random.c bsd-closefrom.c bsd-misc.c fmt_scaled.c \ +SRCS+= bsd-arc4random.c bsd-misc.c fmt_scaled.c \ getrrsetbyname.c openssl-compat.c port-tun.c strtonum.c \ vis.c xcrypt.c xmmap.c # FreeBSD additions From ed at FreeBSD.org Wed Jul 15 08:32:20 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Wed Jul 15 08:32:28 2009 Subject: svn commit: r195706 - in stable/7/sys: . amd64/conf contrib/pf i386/conf ia64/conf pc98/conf powerpc/conf sparc64/conf sun4v/conf Message-ID: <200907150832.n6F8WJeh085517@svn.freebsd.org> Author: ed Date: Wed Jul 15 08:32:19 2009 New Revision: 195706 URL: http://svn.freebsd.org/changeset/base/195706 Log: MFC r195295: Enable POSIX semaphores on all non-embedded architectures by default. More applications (including Firefox) seem to depend on this nowadays, so not having this enabled by default is a bad idea. Proposed by: miwi Patch by: Florian Smeets Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/conf/GENERIC stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/conf/GENERIC stable/7/sys/ia64/conf/GENERIC stable/7/sys/pc98/conf/GENERIC stable/7/sys/powerpc/conf/GENERIC stable/7/sys/sparc64/conf/GENERIC stable/7/sys/sun4v/conf/GENERIC Modified: stable/7/sys/amd64/conf/GENERIC ============================================================================== --- stable/7/sys/amd64/conf/GENERIC Wed Jul 15 00:56:15 2009 (r195705) +++ stable/7/sys/amd64/conf/GENERIC Wed Jul 15 08:32:19 2009 (r195706) @@ -58,6 +58,7 @@ options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores +options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev options ADAPTIVE_GIANT # Giant mutex is adaptive. Modified: stable/7/sys/i386/conf/GENERIC ============================================================================== --- stable/7/sys/i386/conf/GENERIC Wed Jul 15 00:56:15 2009 (r195705) +++ stable/7/sys/i386/conf/GENERIC Wed Jul 15 08:32:19 2009 (r195706) @@ -59,6 +59,7 @@ options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores +options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev options ADAPTIVE_GIANT # Giant mutex is adaptive. Modified: stable/7/sys/ia64/conf/GENERIC ============================================================================== --- stable/7/sys/ia64/conf/GENERIC Wed Jul 15 00:56:15 2009 (r195705) +++ stable/7/sys/ia64/conf/GENERIC Wed Jul 15 08:32:19 2009 (r195706) @@ -55,6 +55,7 @@ options STACK # stack(9) support options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options SYSVSHM # SYSV-style shared memory +options P1003_1B_SEMAPHORES # POSIX-style semaphores options UFS_ACL # Support for access control lists options UFS_DIRHASH # Hash-based directory lookup scheme options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B RT extensions Modified: stable/7/sys/pc98/conf/GENERIC ============================================================================== --- stable/7/sys/pc98/conf/GENERIC Wed Jul 15 00:56:15 2009 (r195705) +++ stable/7/sys/pc98/conf/GENERIC Wed Jul 15 08:32:19 2009 (r195706) @@ -62,6 +62,7 @@ options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores +options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev options AUDIT # Security event auditing Modified: stable/7/sys/powerpc/conf/GENERIC ============================================================================== --- stable/7/sys/powerpc/conf/GENERIC Wed Jul 15 00:56:15 2009 (r195705) +++ stable/7/sys/powerpc/conf/GENERIC Wed Jul 15 08:32:19 2009 (r195706) @@ -60,6 +60,7 @@ options STACK #stack(9) support options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores +options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options AUDIT # Security event auditing Modified: stable/7/sys/sparc64/conf/GENERIC ============================================================================== --- stable/7/sys/sparc64/conf/GENERIC Wed Jul 15 00:56:15 2009 (r195705) +++ stable/7/sys/sparc64/conf/GENERIC Wed Jul 15 08:32:19 2009 (r195706) @@ -61,6 +61,7 @@ options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores +options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options ADAPTIVE_GIANT # Giant mutex is adaptive. options AUDIT # Security event auditing Modified: stable/7/sys/sun4v/conf/GENERIC ============================================================================== --- stable/7/sys/sun4v/conf/GENERIC Wed Jul 15 00:56:15 2009 (r195705) +++ stable/7/sys/sun4v/conf/GENERIC Wed Jul 15 08:32:19 2009 (r195706) @@ -60,6 +60,7 @@ options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores +options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. From mav at FreeBSD.org Wed Jul 15 10:08:20 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Wed Jul 15 10:08:26 2009 Subject: svn commit: r195708 - in stable/7/sys: . contrib/pf dev/sound/pci/hda Message-ID: <200907151008.n6FA8JcM087975@svn.freebsd.org> Author: mav Date: Wed Jul 15 10:08:19 2009 New Revision: 195708 URL: http://svn.freebsd.org/changeset/base/195708 Log: MFC r188656, r189086, r189127, r190630, r193228, r193642, r194177, r194861, r195690. Sync snd_hda driver with HEAD, except latest "Sound Mega-commit" r193640. Except some fixes, this commit also enables MSI interrupts usage by default, when supported, except some reported to be broken chips. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/sound/pci/hda/hdac.c Modified: stable/7/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/7/sys/dev/sound/pci/hda/hdac.c Wed Jul 15 09:19:01 2009 (r195707) +++ stable/7/sys/dev/sound/pci/hda/hdac.c Wed Jul 15 10:08:19 2009 (r195708) @@ -83,7 +83,7 @@ #include "mixer_if.h" -#define HDA_DRV_TEST_REV "20090329_0131" +#define HDA_DRV_TEST_REV "20090624_0136" SND_DECLARE_FILE("$FreeBSD$"); @@ -109,12 +109,6 @@ SND_DECLARE_FILE("$FreeBSD$"); #define hdac_lockassert(sc) snd_mtxassert((sc)->lock) #define hdac_lockowned(sc) mtx_owned((sc)->lock) -#undef HDAC_MSI_ENABLED -#if __FreeBSD_version >= 700026 || \ - (__FreeBSD_version < 700000 && __FreeBSD_version >= 602106) -#define HDAC_MSI_ENABLED 1 -#endif - #define HDA_FLAG_MATCH(fl, v) (((fl) & (v)) == (v)) #define HDA_DEV_MATCH(fl, v) ((fl) == (v) || \ (fl) == 0xffffffff || \ @@ -267,6 +261,7 @@ SND_DECLARE_FILE("$FreeBSD$"); #define ASUS_A7T_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x13c2) #define ASUS_W2J_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x1971) #define ASUS_M5200_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x1993) +#define ASUS_P5PL2_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x817f) #define ASUS_P1AH2_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x81cb) #define ASUS_M2NPVMX_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x81cb) #define ASUS_M2V_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x81e7) @@ -474,53 +469,57 @@ static uint32_t hdac_fmt[] = { static struct pcmchan_caps hdac_caps = {48000, 48000, hdac_fmt, 0}; +#define HDAC_NO_MSI 1 +#define HDAC_NO_64BIT 2 + static const struct { uint32_t model; char *desc; + char flags; } hdac_devices[] = { - { HDA_INTEL_82801F, "Intel 82801F" }, - { HDA_INTEL_63XXESB, "Intel 631x/632xESB" }, - { HDA_INTEL_82801G, "Intel 82801G" }, - { HDA_INTEL_82801H, "Intel 82801H" }, - { HDA_INTEL_82801I, "Intel 82801I" }, - { HDA_INTEL_82801J, "Intel 82801J" }, - { HDA_INTEL_PCH, "Intel PCH" }, - { HDA_INTEL_SCH, "Intel SCH" }, - { HDA_NVIDIA_MCP51, "NVidia MCP51" }, - { HDA_NVIDIA_MCP55, "NVidia MCP55" }, - { HDA_NVIDIA_MCP61_1, "NVidia MCP61" }, - { HDA_NVIDIA_MCP61_2, "NVidia MCP61" }, - { HDA_NVIDIA_MCP65_1, "NVidia MCP65" }, - { HDA_NVIDIA_MCP65_2, "NVidia MCP65" }, - { HDA_NVIDIA_MCP67_1, "NVidia MCP67" }, - { HDA_NVIDIA_MCP67_2, "NVidia MCP67" }, - { HDA_NVIDIA_MCP73_1, "NVidia MCP73" }, - { HDA_NVIDIA_MCP73_2, "NVidia MCP73" }, - { HDA_NVIDIA_MCP78_1, "NVidia MCP78" }, - { HDA_NVIDIA_MCP78_2, "NVidia MCP78" }, - { HDA_NVIDIA_MCP78_3, "NVidia MCP78" }, - { HDA_NVIDIA_MCP78_4, "NVidia MCP78" }, - { HDA_NVIDIA_MCP79_1, "NVidia MCP79" }, - { HDA_NVIDIA_MCP79_2, "NVidia MCP79" }, - { HDA_NVIDIA_MCP79_3, "NVidia MCP79" }, - { HDA_NVIDIA_MCP79_4, "NVidia MCP79" }, - { HDA_ATI_SB450, "ATI SB450" }, - { HDA_ATI_SB600, "ATI SB600" }, - { HDA_ATI_RS600, "ATI RS600" }, - { HDA_ATI_RS690, "ATI RS690" }, - { HDA_ATI_RS780, "ATI RS780" }, - { HDA_ATI_R600, "ATI R600" }, - { HDA_ATI_RV610, "ATI RV610" }, - { HDA_ATI_RV620, "ATI RV620" }, - { HDA_ATI_RV630, "ATI RV630" }, - { HDA_ATI_RV635, "ATI RV635" }, - { HDA_ATI_RV710, "ATI RV710" }, - { HDA_ATI_RV730, "ATI RV730" }, - { HDA_ATI_RV740, "ATI RV740" }, - { HDA_ATI_RV770, "ATI RV770" }, - { HDA_VIA_VT82XX, "VIA VT8251/8237A" }, - { HDA_SIS_966, "SiS 966" }, - { HDA_ULI_M5461, "ULI M5461" }, + { HDA_INTEL_82801F, "Intel 82801F", 0 }, + { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0 }, + { HDA_INTEL_82801G, "Intel 82801G", 0 }, + { HDA_INTEL_82801H, "Intel 82801H", 0 }, + { HDA_INTEL_82801I, "Intel 82801I", 0 }, + { HDA_INTEL_82801J, "Intel 82801J", 0 }, + { HDA_INTEL_PCH, "Intel PCH", 0 }, + { HDA_INTEL_SCH, "Intel SCH", 0 }, + { HDA_NVIDIA_MCP51, "NVidia MCP51", HDAC_NO_MSI }, + { HDA_NVIDIA_MCP55, "NVidia MCP55", HDAC_NO_MSI }, + { HDA_NVIDIA_MCP61_1, "NVidia MCP61", 0 }, + { HDA_NVIDIA_MCP61_2, "NVidia MCP61", 0 }, + { HDA_NVIDIA_MCP65_1, "NVidia MCP65", 0 }, + { HDA_NVIDIA_MCP65_2, "NVidia MCP65", 0 }, + { HDA_NVIDIA_MCP67_1, "NVidia MCP67", 0 }, + { HDA_NVIDIA_MCP67_2, "NVidia MCP67", 0 }, + { HDA_NVIDIA_MCP73_1, "NVidia MCP73", 0 }, + { HDA_NVIDIA_MCP73_2, "NVidia MCP73", 0 }, + { HDA_NVIDIA_MCP78_1, "NVidia MCP78", HDAC_NO_64BIT }, + { HDA_NVIDIA_MCP78_2, "NVidia MCP78", HDAC_NO_64BIT }, + { HDA_NVIDIA_MCP78_3, "NVidia MCP78", HDAC_NO_64BIT }, + { HDA_NVIDIA_MCP78_4, "NVidia MCP78", HDAC_NO_64BIT }, + { HDA_NVIDIA_MCP79_1, "NVidia MCP79", 0 }, + { HDA_NVIDIA_MCP79_2, "NVidia MCP79", 0 }, + { HDA_NVIDIA_MCP79_3, "NVidia MCP79", 0 }, + { HDA_NVIDIA_MCP79_4, "NVidia MCP79", 0 }, + { HDA_ATI_SB450, "ATI SB450", 0 }, + { HDA_ATI_SB600, "ATI SB600", 0 }, + { HDA_ATI_RS600, "ATI RS600", 0 }, + { HDA_ATI_RS690, "ATI RS690", 0 }, + { HDA_ATI_RS780, "ATI RS780", 0 }, + { HDA_ATI_R600, "ATI R600", 0 }, + { HDA_ATI_RV610, "ATI RV610", 0 }, + { HDA_ATI_RV620, "ATI RV620", 0 }, + { HDA_ATI_RV630, "ATI RV630", 0 }, + { HDA_ATI_RV635, "ATI RV635", 0 }, + { HDA_ATI_RV710, "ATI RV710", 0 }, + { HDA_ATI_RV730, "ATI RV730", 0 }, + { HDA_ATI_RV740, "ATI RV740", 0 }, + { HDA_ATI_RV770, "ATI RV770", 0 }, + { HDA_VIA_VT82XX, "VIA VT8251/8237A",0 }, + { HDA_SIS_966, "SiS 966", 0 }, + { HDA_ULI_M5461, "ULI M5461", 0 }, /* Unknown */ { HDA_INTEL_ALL, "Intel (Unknown)" }, { HDA_NVIDIA_ALL, "NVidia (Unknown)" }, @@ -1593,20 +1592,19 @@ hdac_dma_alloc(struct hdac_softc *sc, st { bus_size_t roundsz; int result; - int lowaddr; roundsz = roundup2(size, HDAC_DMA_ALIGNMENT); - lowaddr = (sc->support_64bit) ? BUS_SPACE_MAXADDR : - BUS_SPACE_MAXADDR_32BIT; bzero(dma, sizeof(*dma)); /* * Create a DMA tag */ - result = bus_dma_tag_create(NULL, /* parent */ + result = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), /* parent */ HDAC_DMA_ALIGNMENT, /* alignment */ 0, /* boundary */ - lowaddr, /* lowaddr */ + (sc->support_64bit) ? BUS_SPACE_MAXADDR : + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, /* filtfunc */ NULL, /* fistfuncarg */ @@ -1751,13 +1749,11 @@ hdac_irq_alloc(struct hdac_softc *sc) irq = &sc->irq; irq->irq_rid = 0x0; -#ifdef HDAC_MSI_ENABLED if ((sc->flags & HDAC_F_MSI) && (result = pci_msi_count(sc->dev)) == 1 && pci_alloc_msi(sc->dev, &result) == 0) irq->irq_rid = 0x1; else -#endif sc->flags &= ~HDAC_F_MSI; irq->irq_res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, @@ -1800,10 +1796,8 @@ hdac_irq_free(struct hdac_softc *sc) if (irq->irq_res != NULL) bus_release_resource(sc->dev, SYS_RES_IRQ, irq->irq_rid, irq->irq_res); -#ifdef HDAC_MSI_ENABLED - if ((sc->flags & HDAC_F_MSI) && irq->irq_rid == 0x1) + if (irq->irq_rid == 0x1) pci_release_msi(sc->dev); -#endif irq->irq_handle = NULL; irq->irq_res = NULL; irq->irq_rid = 0x0; @@ -2432,13 +2426,20 @@ hdac_widget_pin_getconfig(struct hdac_wi /* New patches */ if (id == HDA_CODEC_AD1986A && (sc->pci_subvendor == ASUS_M2NPVMX_SUBVENDOR || - sc->pci_subvendor == ASUS_A8NVMCSM_SUBVENDOR)) { + sc->pci_subvendor == ASUS_A8NVMCSM_SUBVENDOR || + sc->pci_subvendor == ASUS_P5PL2_SUBVENDOR)) { switch (nid) { - case 28: /* 5.1 out => 2.0 out + 2 inputs */ + case 26: /* Headphones with redirection */ + patch = "as=1 seq=15"; + break; + case 28: /* 5.1 out => 2.0 out + 1 input */ patch = "device=Line-in as=8 seq=1"; break; - case 29: - patch = "device=Mic as=8 seq=2"; + case 29: /* Can't use this as input, as the only available mic + * preamplifier is busy by front panel mic (nid 31). + * If you want to use this rear connector as mic input, + * you have to disable the front panel one. */ + patch = "as=0"; break; case 31: /* Lot of inputs configured with as=15 and unusable */ patch = "as=8 seq=3"; @@ -3990,12 +3991,32 @@ hdac_attach(device_t dev) { struct hdac_softc *sc; int result; - int i; + int i, devid = -1; + uint32_t model; + uint16_t class, subclass; uint16_t vendor; uint8_t v; device_printf(dev, "HDA Driver Revision: %s\n", HDA_DRV_TEST_REV); + model = (uint32_t)pci_get_device(dev) << 16; + model |= (uint32_t)pci_get_vendor(dev) & 0x0000ffff; + class = pci_get_class(dev); + subclass = pci_get_subclass(dev); + + for (i = 0; i < HDAC_DEVICES_LEN; i++) { + if (hdac_devices[i].model == model) { + devid = i; + break; + } + if (HDA_DEV_MATCH(hdac_devices[i].model, model) && + class == PCIC_MULTIMEDIA && + subclass == PCIS_MULTIMEDIA_HDA) { + devid = i; + break; + } + } + sc = device_get_softc(dev); sc->lock = snd_mtxcreate(device_get_nameunit(dev), HDAC_MTX_NAME); sc->dev = dev; @@ -4022,29 +4043,6 @@ hdac_attach(device_t dev) else sc->polling = 0; - result = bus_dma_tag_create(NULL, /* parent */ - HDAC_DMA_ALIGNMENT, /* alignment */ - 0, /* boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, /* filtfunc */ - NULL, /* fistfuncarg */ - HDA_BUFSZ_MAX, /* maxsize */ - 1, /* nsegments */ - HDA_BUFSZ_MAX, /* maxsegsz */ - 0, /* flags */ - NULL, /* lockfunc */ - NULL, /* lockfuncarg */ - &sc->chan_dmat); /* dmat */ - if (result != 0) { - device_printf(dev, "%s: bus_dma_tag_create failed (%x)\n", - __func__, result); - snd_mtxfree(sc->lock); - free(sc, M_DEVBUF); - return (ENXIO); - } - - sc->hdabus = NULL; for (i = 0; i < HDAC_CODEC_MAX; i++) sc->codecs[i] = NULL; @@ -4061,14 +4059,17 @@ hdac_attach(device_t dev) ); } -#ifdef HDAC_MSI_ENABLED - if (resource_int_value(device_get_name(dev), - device_get_unit(dev), "msi", &i) == 0 && i != 0 && - pci_msi_count(dev) == 1) - sc->flags |= HDAC_F_MSI; - else -#endif + if (devid >= 0 && (hdac_devices[devid].flags & HDAC_NO_MSI)) sc->flags &= ~HDAC_F_MSI; + else + sc->flags |= HDAC_F_MSI; + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "msi", &i) == 0) { + if (i == 0) + sc->flags &= ~HDAC_F_MSI; + else + sc->flags |= HDAC_F_MSI; + } #if defined(__i386__) || defined(__amd64__) sc->flags |= HDAC_F_DMA_NOCACHE; @@ -4138,6 +4139,9 @@ hdac_attach(device_t dev) if (result != 0) goto hdac_attach_fail; + if (devid >= 0 && (hdac_devices[devid].flags & HDAC_NO_64BIT)) + sc->support_64bit = 0; + /* Allocate CORB and RIRB dma memory */ result = hdac_dma_alloc(sc, &sc->corb_dma, sc->corb_size * sizeof(uint32_t)); @@ -4148,6 +4152,28 @@ hdac_attach(device_t dev) if (result != 0) goto hdac_attach_fail; + result = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), /* parent */ + HDAC_DMA_ALIGNMENT, /* alignment */ + 0, /* boundary */ + (sc->support_64bit) ? BUS_SPACE_MAXADDR : + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, /* filtfunc */ + NULL, /* fistfuncarg */ + HDA_BUFSZ_MAX, /* maxsize */ + 1, /* nsegments */ + HDA_BUFSZ_MAX, /* maxsegsz */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockfuncarg */ + &sc->chan_dmat); /* dmat */ + if (result != 0) { + device_printf(dev, "%s: bus_dma_tag_create failed (%x)\n", + __func__, result); + goto hdac_attach_fail; + } + /* Quiesce everything */ HDA_BOOTHVERBOSE( device_printf(dev, "Reset controller...\n"); @@ -4633,6 +4659,7 @@ hdac_vendor_patch_parse(struct hdac_devi } switch (id) { +#if 0 case HDA_CODEC_ALC883: /* * nid: 24/25 = External (jack) or Internal (fixed) Mic. @@ -4662,6 +4689,7 @@ hdac_vendor_patch_parse(struct hdac_devi * nid: 26 = Line-in, leave it alone. */ break; +#endif case HDA_CODEC_AD1983: /* * This codec has several possible usages, but none @@ -4715,6 +4743,35 @@ hdac_vendor_patch_parse(struct hdac_devi w = hdac_widget_get(devinfo, 15); if (w != NULL) w->connsenable[3] = 0; + /* There is only one mic preamplifier, use it effectively. */ + w = hdac_widget_get(devinfo, 31); + if (w != NULL) { + if ((w->wclass.pin.config & + HDA_CONFIG_DEFAULTCONF_DEVICE_MASK) == + HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN) { + w = hdac_widget_get(devinfo, 16); + if (w != NULL) + w->connsenable[2] = 0; + } else { + w = hdac_widget_get(devinfo, 15); + if (w != NULL) + w->connsenable[0] = 0; + } + } + w = hdac_widget_get(devinfo, 32); + if (w != NULL) { + if ((w->wclass.pin.config & + HDA_CONFIG_DEFAULTCONF_DEVICE_MASK) == + HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN) { + w = hdac_widget_get(devinfo, 16); + if (w != NULL) + w->connsenable[0] = 0; + } else { + w = hdac_widget_get(devinfo, 15); + if (w != NULL) + w->connsenable[1] = 0; + } + } if (subvendor == ASUS_A8X_SUBVENDOR) { /* From mav at FreeBSD.org Thu Jul 16 08:27:13 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Thu Jul 16 08:27:24 2009 Subject: svn commit: r195714 - in stable/7/sys: . contrib/pf dev/acpica Message-ID: <200907160827.n6G8RC05017163@svn.freebsd.org> Author: mav Date: Thu Jul 16 08:27:12 2009 New Revision: 195714 URL: http://svn.freebsd.org/changeset/base/195714 Log: MFC rev. 191760, 191763, 191764. Avoid comparing negative signed to positive unsignad values. It was leading to a bug, when C-state does not decrease on sleep shorter then declared transition latency. Fixing this deprecates workaround for broken C-states on some hardware. By the way, change state selecting logic a bit. Instead of last sleep time use short-time average of it. Global interrupts rate in system is a quite random value, to corellate subsequent sleeps so directly. Make dev.cpu.X.cx_usage sysctl also report current average of sleep time. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/acpica/acpi_cpu.c Modified: stable/7/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/7/sys/dev/acpica/acpi_cpu.c Wed Jul 15 22:27:36 2009 (r195713) +++ stable/7/sys/dev/acpica/acpi_cpu.c Thu Jul 16 08:27:12 2009 (r195714) @@ -79,7 +79,6 @@ struct acpi_cpu_softc { int cpu_features; /* Child driver supported features. */ /* Runtime state. */ int cpu_non_c3; /* Index of lowest non-C3 state. */ - int cpu_short_slp; /* Count of < 1us sleeps. */ u_int cpu_cx_stats[MAX_CX_STATES];/* Cx usage history. */ /* Values for sysctl. */ struct sysctl_ctx_list cpu_sysctl_ctx; @@ -875,43 +874,13 @@ acpi_cpu_idle() return; } - /* - * If we slept 100 us or more, use the lowest Cx state. Otherwise, - * find the lowest state that has a latency less than or equal to - * the length of our last sleep. - */ - cx_next_idx = sc->cpu_cx_lowest; - if (sc->cpu_prev_sleep < 100) { - /* - * If we sleep too short all the time, this system may not implement - * C2/3 correctly (i.e. reads return immediately). In this case, - * back off and use the next higher level. - * It seems that when you have a dual core cpu (like the Intel Core Duo) - * that both cores will get out of C3 state as soon as one of them - * requires it. This breaks the sleep detection logic as the sleep - * counter is local to each cpu. Disable the sleep logic for now as a - * workaround if there's more than one CPU. The right fix would probably - * be to add quirks for system that don't really support C3 state. - */ - if (mp_ncpus < 2 && sc->cpu_prev_sleep <= 1) { - sc->cpu_short_slp++; - if (sc->cpu_short_slp == 1000 && sc->cpu_cx_lowest != 0) { - if (sc->cpu_non_c3 == sc->cpu_cx_lowest && sc->cpu_non_c3 != 0) - sc->cpu_non_c3--; - sc->cpu_cx_lowest--; - sc->cpu_short_slp = 0; - device_printf(sc->cpu_dev, - "too many short sleeps, backing off to C%d\n", - sc->cpu_cx_lowest + 1); - } - } else - sc->cpu_short_slp = 0; - - for (i = sc->cpu_cx_lowest; i >= 0; i--) - if (sc->cpu_cx_states[i].trans_lat <= sc->cpu_prev_sleep) { - cx_next_idx = i; - break; - } + /* Find the lowest state that has small enough latency. */ + cx_next_idx = 0; + for (i = sc->cpu_cx_lowest; i >= 0; i--) { + if (sc->cpu_cx_states[i].trans_lat * 3 <= sc->cpu_prev_sleep) { + cx_next_idx = i; + break; + } } /* @@ -936,10 +905,10 @@ acpi_cpu_idle() /* * Execute HLT (or equivalent) and wait for an interrupt. We can't * calculate the time spent in C1 since the place we wake up is an - * ISR. Assume we slept one quantum and return. + * ISR. Assume we slept half of quantum and return. */ if (cx_next->type == ACPI_STATE_C1) { - sc->cpu_prev_sleep = 1000000 / hz; + sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + 500000 / hz) / 4; acpi_cpu_c1(); return; } @@ -982,9 +951,9 @@ acpi_cpu_idle() } ACPI_ENABLE_IRQS(); - /* Find the actual time asleep in microseconds, minus overhead. */ + /* Find the actual time asleep in microseconds. */ end_time = acpi_TimerDelta(end_time, start_time); - sc->cpu_prev_sleep = PM_USEC(end_time) - cx_next->trans_lat; + sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + PM_USEC(end_time)) / 4; } /* @@ -1106,8 +1075,9 @@ acpi_cpu_usage_sysctl(SYSCTL_HANDLER_ARG sbuf_printf(&sb, "%u.%02u%% ", (u_int)(whole / sum), (u_int)(fract / sum)); } else - sbuf_printf(&sb, "0%% "); + sbuf_printf(&sb, "0.00%% "); } + sbuf_printf(&sb, "last %dus", sc->cpu_prev_sleep); sbuf_trim(&sb); sbuf_finish(&sb); sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); From des at FreeBSD.org Fri Jul 17 07:07:39 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Fri Jul 17 07:07:51 2009 Subject: svn commit: r195733 - in stable/7/share/man/man4: . man4.i386 Message-ID: <200907170707.n6H77cfp057855@svn.freebsd.org> Author: des Date: Fri Jul 17 07:07:38 2009 New Revision: 195733 URL: http://svn.freebsd.org/changeset/base/195733 Log: merge r181967: delete duplicate ichwd(4) Deleted: stable/7/share/man/man4/man4.i386/ichwd.4 Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/ichwd.4 stable/7/share/man/man4/man4.i386/Makefile Modified: stable/7/share/man/man4/ichwd.4 ============================================================================== --- stable/7/share/man/man4/ichwd.4 Fri Jul 17 02:28:27 2009 (r195732) +++ stable/7/share/man/man4/ichwd.4 Fri Jul 17 07:07:38 2009 (r195733) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 23, 2007 +.Dd August 20, 2008 .Dt ICHWD 4 .Os .Sh NAME @@ -50,12 +50,29 @@ The .Nm driver provides .Xr watchdog 4 -support for the watchdog interrupt timer present in -the Intel ICH motherboard chipsets. +support for the watchdog interrupt timer present on +all Intel ICH motherboard chipsets. +.Pp +The ICH WDT counts down in ticks of approximately 0.6 seconds; the +exact value depends on hardware quality and environmental factors. +Supported watchdog intervals range from 2 to 63 ticks. +.Pp +Note that on some ICH-based systems, the WDT may be present but +disabled, either in hardware or by the BIOS. +The +.Nm +driver attempts to detect this condition and will refuse to attach if +it believes the WDT is disabled. .Sh SEE ALSO .Xr watchdog 4 , .Xr watchdog 8 , -.Xr watchdogd 8 +.Xr watchdogd 8, +.Xr watchdog 9 +.Rs +.%T Using the Intel ICH Family Watchdog Timer (WDT) +.%R Intel Application Note AP-725 +.%O Document Number 292273-001 +.Re .Sh HISTORY The .Nm @@ -65,8 +82,9 @@ driver first appeared in .An -nosplit The .Nm -driver was originally written by -.An Wm. Daryl Hawkins -of Texas A&M University. +driver was written by +.An Wm. Daryl Hawkins Aq dhawkins@tamu.edu +of Texas A&M University and +.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . This manual page was written by .An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . Modified: stable/7/share/man/man4/man4.i386/Makefile ============================================================================== --- stable/7/share/man/man4/man4.i386/Makefile Fri Jul 17 02:28:27 2009 (r195732) +++ stable/7/share/man/man4/man4.i386/Makefile Fri Jul 17 07:07:38 2009 (r195733) @@ -25,7 +25,6 @@ MAN= acpi_aiboost.4 \ ex.4 \ fe.4 \ glxsb.4 \ - ichwd.4 \ ie.4 \ io.4 \ linux.4 \ From brian at FreeBSD.org Sat Jul 18 20:19:27 2009 From: brian at FreeBSD.org (Brian Somers) Date: Sat Jul 18 20:19:45 2009 Subject: svn commit: r195756 - in stable/7: share/man/man8 usr.bin/ypcat usr.bin/ypmatch usr.bin/ypwhich usr.sbin/ypserv Message-ID: <200907182019.n6IKJPIX010790@svn.freebsd.org> Author: brian Date: Sat Jul 18 20:19:25 2009 New Revision: 195756 URL: http://svn.freebsd.org/changeset/base/195756 Log: MFC: Support shadow.byname and shadow.byuid maps, protecting them by insisting on privileged port access. Include /var/yp/Makefile.local if it exists and suggest using it to override /var/yp/Makefile behaviour. Modified: stable/7/share/man/man8/ (props changed) stable/7/share/man/man8/yp.8 stable/7/usr.bin/ypcat/ (props changed) stable/7/usr.bin/ypcat/ypcat.c stable/7/usr.bin/ypmatch/ (props changed) stable/7/usr.bin/ypmatch/ypmatch.c stable/7/usr.bin/ypwhich/ (props changed) stable/7/usr.bin/ypwhich/ypwhich.c stable/7/usr.sbin/ypserv/ (props changed) stable/7/usr.sbin/ypserv/Makefile.yp stable/7/usr.sbin/ypserv/yp_access.c stable/7/usr.sbin/ypserv/ypserv.8 Modified: stable/7/share/man/man8/yp.8 ============================================================================== --- stable/7/share/man/man8/yp.8 Sat Jul 18 17:38:18 2009 (r195755) +++ stable/7/share/man/man8/yp.8 Sat Jul 18 20:19:25 2009 (r195756) @@ -28,7 +28,7 @@ .\" from: @(#)yp.8 1.0 (deraadt) 4/26/93 .\" $FreeBSD$ .\" -.Dd April 5, 1993 +.Dd June 25, 2009 .Dt YP 8 .Os .Sh NAME @@ -310,9 +310,15 @@ The .Tn NIS .Pa Makefile .Pq Pa /var/yp/Makefile -will do this automatically if the administrator comments out the -line which says -.Dq Li NOPUSH=true +will do this automatically if the administrator creates +.Pa /var/yp/Makefile.local +and empties the +.Va NOPUSH +variable: +.Bd -literal -offset four +.Li NOPUSH= +.Ed +.Pp .Va ( NOPUSH is set to true by default because the default configuration is for a small network with only one @@ -394,9 +400,11 @@ To help prevent this, .Fx Ns 's .Tn NIS server handles the shadow password maps -.Pa ( master.passwd.byname +.Pa ( master.passwd.byname , +.Pa master.passwd.byuid , +.Pa shadow.byname and -.Pa master.passwd.byuid ) +.Pa shadow.byuid ) in a special way: the server will only provide access to these maps in response to requests that originate on privileged ports. Since only the super-user is allowed to bind to a privileged port, Modified: stable/7/usr.bin/ypcat/ypcat.c ============================================================================== --- stable/7/usr.bin/ypcat/ypcat.c Sat Jul 18 17:38:18 2009 (r195755) +++ stable/7/usr.bin/ypcat/ypcat.c Sat Jul 18 20:19:25 2009 (r195756) @@ -52,6 +52,7 @@ struct ypalias { } ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, + { "shadow", "shadow.byname" }, { "group", "group.byname" }, { "networks", "networks.byaddr" }, { "hosts", "hosts.byaddr" }, Modified: stable/7/usr.bin/ypmatch/ypmatch.c ============================================================================== --- stable/7/usr.bin/ypmatch/ypmatch.c Sat Jul 18 17:38:18 2009 (r195755) +++ stable/7/usr.bin/ypmatch/ypmatch.c Sat Jul 18 20:19:25 2009 (r195756) @@ -52,6 +52,7 @@ struct ypalias { } ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, + { "shadow", "shadow.byname" }, { "group", "group.byname" }, { "networks", "networks.byaddr" }, { "hosts", "hosts.byname" }, Modified: stable/7/usr.bin/ypwhich/ypwhich.c ============================================================================== --- stable/7/usr.bin/ypwhich/ypwhich.c Sat Jul 18 17:38:18 2009 (r195755) +++ stable/7/usr.bin/ypwhich/ypwhich.c Sat Jul 18 20:19:25 2009 (r195756) @@ -64,6 +64,7 @@ struct ypalias { } ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, + { "shadow", "shadow.byname" }, { "group", "group.byname" }, { "networks", "networks.byaddr" }, { "hosts", "hosts.byaddr" }, Modified: stable/7/usr.sbin/ypserv/Makefile.yp ============================================================================== --- stable/7/usr.sbin/ypserv/Makefile.yp Sat Jul 18 17:38:18 2009 (r195755) +++ stable/7/usr.sbin/ypserv/Makefile.yp Sat Jul 18 20:19:25 2009 (r195756) @@ -11,33 +11,40 @@ # This Makefile can be modified to support more NIS maps if desired. # -# If this machine is an NIS master, comment out this next line so -# that changes to the NIS maps can be propagated to the slave servers. -# (By default we assume that we are only serving a small domain with -# only one server.) +# If this machine is an NIS master, reset this variable (NOPUSH=) +# in Makefile.local so that changes to the NIS maps can be propagated to +# the slave servers. (By default we assume that we are only serving a +# small domain with only one server.) # NOPUSH = "True" +# If this machine does not wish to generate a linux-style shadow map +# from the master.passwd file, reset this variable (SHADOW=) in +# Makefile.local. +SHADOW = "True" + # If you want to use a FreeBSD NIS server to serve non-FreeBSD clients # (i.e. clients who expect the password field in the passwd maps to be -# valid) then uncomment this line. This will cause $YPDIR/passwd to -# be generated with valid password fields. This is insecure: FreeBSD -# normally only serves the master.passwd maps (which have real encrypted -# passwords in them) to the superuser on other FreeBSD machines, but -# non-FreeBSD clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX, -# etc...) will only work properly in 'unsecure' mode. +# valid) then set this variable (UNSECURE="True") in Makefile.local. +# This will cause $YPDIR/passwd to be generated with valid password +# fields. This is insecure: FreeBSD normally only serves the +# master.passwd and shadow maps (which have real encrypted passwords +# in them) to the superuser on other FreeBSD machines, but non-FreeBSD +# clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX, etc...) +# will only work properly in 'unsecure' mode. # #UNSECURE = "True" # The following line encodes the YP_INTERDOMAIN key into the hosts.byname # and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve -# hosts not in the current domain. Commenting this line out will disable -# the DNS lookups. +# hosts not in the current domain. Resetting this variable in +# Makefile.local (B=) will disable the DNS lookups. B=-b -# Normally, the master.passwd.* maps are guarded against access from -# non-privileged users. By commenting out the following line, the YP_SECURE -# key will be removed from these maps, allowing anyone to access them. +# Normally, the master.passwd.* and shadow.* maps are guarded against access +# from non-privileged users. By resetting S in Makefile.local (S=), the +# YP_SECURE key will be removed from these maps, allowing anyone to access +# them. S=-s # These are commands which this Makefile needs to properly rebuild the @@ -118,6 +125,17 @@ PUBLICKEY = $(YPSRCDIR)/publickey NETID = $(YPSRCDIR)/netid AMDHOST = $(YPSRCDIR)/amd.map +target: + @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ + cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ + make -f ../Makefile all; echo "NIS Map update completed." + +# Read overrides. Note, the current directory will be /var/yp/ +# when 'all' is built. +.if exists(${YPDIR}/Makefile.local) +.include "${YPDIR}/Makefile.local" +.endif + # List of maps that are always built. # If you want to omit some of them, feel free to comment # them out from this list. @@ -148,6 +166,9 @@ NETGROUP= /dev/null .if exists($(MASTER)) TARGETS+= passwd master.passwd netid +.if ${SHADOW} == "\"True\"" +TARGETS+= shadow +.endif .else MASTER= /dev/null TARGETS+= nopass @@ -171,11 +192,6 @@ TARGETS+= ipnodes IPNODES= /dev/null .endif -target: - @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ - cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ - make -f ../Makefile all; echo "NIS Map update completed." - all: $(TARGETS) ethers: ethers.byname ethers.byaddr @@ -187,6 +203,7 @@ protocols: protocols.bynumber protocols. rpc: rpc.byname rpc.bynumber services: services.byname passwd: passwd.byname passwd.byuid +shadow: shadow.byname shadow.byuid group: group.byname group.bygid netgrp: netgroup netid: netid.byname @@ -207,6 +224,10 @@ pushpw: @$(DBLOAD) -c @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi +.if ${SHADOW} == "\"True\"" + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byname ; fi + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byuid ; fi +.endif @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi @@ -586,6 +607,36 @@ master.passwd.byuid: $(MASTER) .endif +shadow.byname: $(MASTER) + @echo "Updating $@..." +.if ${MASTER} == "/dev/null" + @echo "Master.passwd source file not found -- skipping" +.else + @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ + print $$1"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \ + | sed 's/\( [^:]*:\)\*:/\1!:/' \ + | $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ + $(RMV) $(TMP) $@ + @$(DBLOAD) -c + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi + @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi +.endif + +shadow.byuid: $(MASTER) + @echo "Updating $@..." +.if ${MASTER} == "/dev/null" + @echo "Master.passwd source file not found -- skipping" +.else + @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ + print $$3"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \ + | sed 's/\( [^:]*:\)\*:/\1!:/' \ + | $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ + $(RMV) $(TMP) $@ + @$(DBLOAD) -c + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi + @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi +.endif + amd.map: $(AMDHOST) @echo "Updating $@..." @$(AWK) '$$1 !~ "^#.*" { \ @@ -604,4 +655,3 @@ amd.map: $(AMDHOST) @$(DBLOAD) -c @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - Modified: stable/7/usr.sbin/ypserv/yp_access.c ============================================================================== --- stable/7/usr.sbin/ypserv/yp_access.c Sat Jul 18 17:38:18 2009 (r195755) +++ stable/7/usr.sbin/ypserv/yp_access.c Sat Jul 18 20:19:25 2009 (r195756) @@ -178,9 +178,9 @@ load_securenets(void) * yp_access() checks the mapname and client host address and watches for * the following things: * - * - If the client is referencing one of the master.passwd.* maps, it must - * be using a privileged port to make its RPC to us. If it is, then we can - * assume that the caller is root and allow the RPC to succeed. If it + * - If the client is referencing one of the master.passwd.* or shadow.* maps, + * it must be using a privileged port to make its RPC to us. If it is, then + * we can assume that the caller is root and allow the RPC to succeed. If it * isn't access is denied. * * - The client's IP address is checked against the securenets rules. @@ -254,7 +254,7 @@ possible spoof attempt from %s:%d", #ifdef DB_CACHE if ((yp_testflag((char *)map, (char *)domain, YP_SECURE) || #else - if ((strstr(map, "master.passwd.") || + if ((strstr(map, "master.passwd.") || strstr(map, "shadow.") || #endif (rqstp->rq_prog == YPPROG && rqstp->rq_proc == YPPROC_XFR) || Modified: stable/7/usr.sbin/ypserv/ypserv.8 ============================================================================== --- stable/7/usr.sbin/ypserv/ypserv.8 Sat Jul 18 17:38:18 2009 (r195755) +++ stable/7/usr.sbin/ypserv/ypserv.8 Sat Jul 18 20:19:25 2009 (r195756) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 3, 2008 +.Dd June 25, 2009 .Dt YPSERV 8 .Os .Sh NAME @@ -142,7 +142,11 @@ and .Pa master.passwd.byuid maps in a special way. When the server receives a request to access -either of these two maps, it will check the TCP port from which the +either of these two maps (or in fact either of the +.Pa shadow.byname +or +.Pa shadow.byuid +maps), it will check the TCP port from which the request originated and return an error if the port number is greater than 1023. Since only the superuser is allowed to bind to TCP ports From brian at FreeBSD.org Sat Jul 18 21:50:54 2009 From: brian at FreeBSD.org (Brian Somers) Date: Sat Jul 18 21:51:10 2009 Subject: svn commit: r195758 - stable/7 Message-ID: <200907182150.n6ILorri012691@svn.freebsd.org> Author: brian Date: Sat Jul 18 21:50:53 2009 New Revision: 195758 URL: http://svn.freebsd.org/changeset/base/195758 Log: Fix some typos. The changes only apply to UPDATING in stable/7. PR: 133110 Submitted by: Glen Barber - glen.j.barber at gmail Modified: stable/7/UPDATING Modified: stable/7/UPDATING ============================================================================== --- stable/7/UPDATING Sat Jul 18 20:19:53 2009 (r195757) +++ stable/7/UPDATING Sat Jul 18 21:50:53 2009 (r195758) @@ -143,13 +143,13 @@ portupgrade. The important thing to note is that the 82575 adapters were supported in the em driver in 7.0, but now needed - to be moved into igb, so if you have the effected cards + to be moved into igb, so if you have the affected cards be sure and make any script changes to follow the name change. - There are only 3 PCI ID's effected in this change: + There are only 3 PCI ID's affected in this change: 0x10A7, 0x10A9, and 0x10D6 - So you can know ahead of time if they will be effected, + So you can know ahead of time if they will be affected, these will now be supported in the igb driver. That driver will also support the new 82576 followon. @@ -161,7 +161,7 @@ portupgrade. 20080724: I have MFC'd in code to support multiple routing tables. - see the man pages setfib(1) and setfib(2). + See the man pages setfib(1) and setfib(2). This is a backwards compatible version, but to make use of it you need to compile your kernel with options ROUTETABLES=2 (or more up to 16). From lulf at FreeBSD.org Sun Jul 19 12:57:11 2009 From: lulf at FreeBSD.org (Ulf Lilleengen) Date: Sun Jul 19 12:57:23 2009 Subject: svn commit: r195759 - in stable/7/sys: . contrib/pf geom/linux_lvm Message-ID: <200907191257.n6JCvA9r043100@svn.freebsd.org> Author: lulf Date: Sun Jul 19 12:57:10 2009 New Revision: 195759 URL: http://svn.freebsd.org/changeset/base/195759 Log: MFC r194924: - Apply the same naming rules of LVM names as done in the LVM code itself. PR: kern/135874 Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/geom/linux_lvm/g_linux_lvm.c Modified: stable/7/sys/geom/linux_lvm/g_linux_lvm.c ============================================================================== --- stable/7/sys/geom/linux_lvm/g_linux_lvm.c Sat Jul 18 21:50:53 2009 (r195758) +++ stable/7/sys/geom/linux_lvm/g_linux_lvm.c Sun Jul 19 12:57:10 2009 (r195759) @@ -826,14 +826,6 @@ llvm_md_decode(const u_char *data, struc return (0); } -#define GRAB_NAME(tok, name, len) \ - len = 0; \ - while (tok[len] && (isalpha(tok[len]) || isdigit(tok[len])) && \ - len < G_LLVM_NAMELEN - 1) \ - len++; \ - bcopy(tok, name, len); \ - name[len] = '\0'; - #define GRAB_INT(key, tok1, tok2, v) \ if (tok1 && tok2 && strncmp(tok1, key, sizeof(key)) == 0) { \ v = strtol(tok2, &tok1, 10); \ @@ -864,6 +856,27 @@ llvm_md_decode(const u_char *data, struc break; \ } +static size_t +llvm_grab_name(char *name, const char *tok) +{ + size_t len; + + len = 0; + if (tok == NULL) + return (0); + if (tok[0] == '-') + return (0); + if (strcmp(tok, ".") == 0 || strcmp(tok, "..") == 0) + return (0); + while (tok[len] && (isalpha(tok[len]) || isdigit(tok[len]) || + tok[len] == '.' || tok[len] == '_' || tok[len] == '-' || + tok[len] == '+') && len < G_LLVM_NAMELEN - 1) + len++; + bcopy(tok, name, len); + name[len] = '\0'; + return (len); +} + static int llvm_textconf_decode(u_char *data, int buflen, struct g_llvm_metadata *md) { @@ -872,7 +885,7 @@ llvm_textconf_decode(u_char *data, int b char *tok, *v; char name[G_LLVM_NAMELEN]; char uuid[G_LLVM_UUIDLEN]; - int len; + size_t len; if (buf == NULL || *buf == '\0') return (EINVAL); @@ -880,7 +893,7 @@ llvm_textconf_decode(u_char *data, int b tok = strsep(&buf, "\n"); if (tok == NULL) return (EINVAL); - GRAB_NAME(tok, name, len); + len = llvm_grab_name(name, tok); if (len == 0) return (EINVAL); @@ -970,7 +983,7 @@ llvm_textconf_decode_pv(char **buf, char { struct g_llvm_pv *pv; char *v; - int len; + size_t len; if (*buf == NULL || **buf == '\0') return (EINVAL); @@ -983,7 +996,7 @@ llvm_textconf_decode_pv(char **buf, char len = 0; if (tok == NULL) goto bad; - GRAB_NAME(tok, pv->pv_name, len); + len = llvm_grab_name(pv->pv_name, tok); if (len == 0) goto bad; @@ -1024,7 +1037,7 @@ llvm_textconf_decode_lv(char **buf, char struct g_llvm_lv *lv; struct g_llvm_segment *sg; char *v; - int len; + size_t len; if (*buf == NULL || **buf == '\0') return (EINVAL); @@ -1036,10 +1049,9 @@ llvm_textconf_decode_lv(char **buf, char lv->lv_vg = vg; LIST_INIT(&lv->lv_segs); - len = 0; if (tok == NULL) goto bad; - GRAB_NAME(tok, lv->lv_name, len); + len = llvm_grab_name(lv->lv_name, tok); if (len == 0) goto bad; @@ -1162,7 +1174,6 @@ bad: free(sg, M_GLLVM); return (-1); } -#undef GRAB_NAME #undef GRAB_INT #undef GRAB_STR #undef SPLIT From bms at FreeBSD.org Sun Jul 19 16:50:49 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Sun Jul 19 16:51:06 2009 Subject: svn commit: r195764 - stable/7/contrib/gcc Message-ID: <200907191650.n6JGons0048592@svn.freebsd.org> Author: bms Date: Sun Jul 19 16:50:48 2009 New Revision: 195764 URL: http://svn.freebsd.org/changeset/base/195764 Log: Output debug information for global 'using' declarations, instead of just blowing up. A very similar change to this exists which is GPLv3 licensed, this is my own change. See also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31899 Reviewed by: luigi Modified: stable/7/contrib/gcc/dwarf2out.c Modified: stable/7/contrib/gcc/dwarf2out.c ============================================================================== --- stable/7/contrib/gcc/dwarf2out.c Sun Jul 19 16:48:25 2009 (r195763) +++ stable/7/contrib/gcc/dwarf2out.c Sun Jul 19 16:50:48 2009 (r195764) @@ -10007,7 +10007,7 @@ reference_to_unused (tree * tp, int * wa return NULL_TREE; else if (!cgraph_global_info_ready && (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL)) - gcc_unreachable (); + return *tp; else if (DECL_P (*tp) && TREE_CODE (*tp) == VAR_DECL) { struct cgraph_varpool_node *node = cgraph_varpool_node (*tp); From kostikbel at gmail.com Sun Jul 19 17:07:29 2009 From: kostikbel at gmail.com (Kostik Belousov) Date: Sun Jul 19 17:07:40 2009 Subject: svn commit: r195764 - stable/7/contrib/gcc In-Reply-To: <200907191650.n6JGons0048592@svn.freebsd.org> References: <200907191650.n6JGons0048592@svn.freebsd.org> Message-ID: <20090719165555.GC55190@deviant.kiev.zoral.com.ua> On Sun, Jul 19, 2009 at 04:50:49PM +0000, Bruce M Simpson wrote: > Author: bms > Date: Sun Jul 19 16:50:48 2009 > New Revision: 195764 > URL: http://svn.freebsd.org/changeset/base/195764 > > Log: > Output debug information for global 'using' declarations, instead > of just blowing up. A very similar change to this exists which is > GPLv3 licensed, this is my own change. > > See also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31899 > Reviewed by: luigi > > Modified: > stable/7/contrib/gcc/dwarf2out.c Was this committed to HEAD first ? Please revert ASAP if not. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-stable-7/attachments/20090719/59fb876a/attachment.pgp From bms at FreeBSD.org Sun Jul 19 17:13:17 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Sun Jul 19 17:13:30 2009 Subject: svn commit: r195766 - stable/7/contrib/gcc Message-ID: <200907191713.n6JHDGel049114@svn.freebsd.org> Author: bms Date: Sun Jul 19 17:13:16 2009 New Revision: 195766 URL: http://svn.freebsd.org/changeset/base/195766 Log: Revert previous change. Requested by: kib Modified: stable/7/contrib/gcc/dwarf2out.c Modified: stable/7/contrib/gcc/dwarf2out.c ============================================================================== --- stable/7/contrib/gcc/dwarf2out.c Sun Jul 19 16:54:24 2009 (r195765) +++ stable/7/contrib/gcc/dwarf2out.c Sun Jul 19 17:13:16 2009 (r195766) @@ -10007,7 +10007,7 @@ reference_to_unused (tree * tp, int * wa return NULL_TREE; else if (!cgraph_global_info_ready && (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL)) - return *tp; + gcc_unreachable (); else if (DECL_P (*tp) && TREE_CODE (*tp) == VAR_DECL) { struct cgraph_varpool_node *node = cgraph_varpool_node (*tp); From bms at FreeBSD.org Sun Jul 19 18:36:55 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Sun Jul 19 18:37:02 2009 Subject: svn commit: r195770 - stable/7/sys/netinet Message-ID: <200907191836.n6JIasO8050942@svn.freebsd.org> Author: bms Date: Sun Jul 19 18:36:54 2009 New Revision: 195770 URL: http://svn.freebsd.org/changeset/base/195770 Log: Fix two typos in sctp_send_initiate(); these corrupt the INIT chunk on 64-bit platforms, in the 7.x SCTP stack. Observed on 7.2-STABLE/amd64. Submitted by: Michael Tuexen Reviewed by: rrs Modified: stable/7/sys/netinet/sctp_output.c Modified: stable/7/sys/netinet/sctp_output.c ============================================================================== --- stable/7/sys/netinet/sctp_output.c Sun Jul 19 17:40:45 2009 (r195769) +++ stable/7/sys/netinet/sctp_output.c Sun Jul 19 18:36:54 2009 (r195770) @@ -6087,7 +6087,7 @@ sctp_send_initiate(struct sctp_inpcb *in ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); ph->param_type = htons(SCTP_HAS_NAT_SUPPORT); ph->param_length = htons(sizeof(struct sctp_paramhdr)); - SCTP_BUF_LEN(m) += sizeof(sizeof(struct sctp_paramhdr)); + SCTP_BUF_LEN(m) += sizeof(struct sctp_paramhdr); } /* add authentication parameters */ if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) { @@ -7198,7 +7198,7 @@ do_a_abort: ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); ph->param_type = htons(SCTP_HAS_NAT_SUPPORT); ph->param_length = htons(sizeof(struct sctp_paramhdr)); - SCTP_BUF_LEN(m) += sizeof(sizeof(struct sctp_paramhdr)); + SCTP_BUF_LEN(m) += sizeof(struct sctp_paramhdr); } /* And now tell the peer we do all the extensions */ pr_supported = (struct sctp_supported_chunk_types_param *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); From bms at FreeBSD.org Sun Jul 19 18:37:22 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Sun Jul 19 18:37:39 2009 Subject: svn commit: r195771 - stable/7/sys/netinet Message-ID: <200907191837.n6JIbKme050987@svn.freebsd.org> Author: bms Date: Sun Jul 19 18:37:20 2009 New Revision: 195771 URL: http://svn.freebsd.org/changeset/base/195771 Log: When moving an SCTP association from one hash table to another, make sure the association's link entry in the hash table is updated. This fixes a panic on closing an association in the 7.x SCTP stack. Observed on 7.2-STABLE/amd64. Submitted by: Michael Tuexen Reviewed by: rrs Modified: stable/7/sys/netinet/sctp_pcb.c Modified: stable/7/sys/netinet/sctp_pcb.c ============================================================================== --- stable/7/sys/netinet/sctp_pcb.c Sun Jul 19 18:36:54 2009 (r195770) +++ stable/7/sys/netinet/sctp_pcb.c Sun Jul 19 18:37:20 2009 (r195771) @@ -2504,7 +2504,9 @@ sctp_move_pcb_and_assoc(struct sctp_inpc /* Pull the tcb from the old association */ LIST_REMOVE(stcb, sctp_tcbhash); LIST_REMOVE(stcb, sctp_tcblist); - + if (stcb->asoc.in_asocid_hash) { + LIST_REMOVE(stcb, sctp_tcbasocidhash); + } /* Now insert the new_inp into the TCP connected hash */ head = &SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR((lport), SCTP_BASE_INFO(hashtcpmark))]; @@ -2520,7 +2522,12 @@ sctp_move_pcb_and_assoc(struct sctp_inpc * only have one connection? Probably not :> so lets get rid of it * and not suck up any kernel memory in that. */ - + if (stcb->asoc.in_asocid_hash) { + struct sctpasochead *lhd; + lhd = &new_inp->sctp_asocidhash[SCTP_PCBHASH_ASOC(stcb->asoc.assoc_id, + new_inp->hashasocidmark)]; + LIST_INSERT_HEAD(lhd, stcb, sctp_tcbasocidhash); + } /* Ok. Let's restart timer. */ TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, new_inp, From snb at FreeBSD.org Mon Jul 20 16:19:43 2009 From: snb at FreeBSD.org (Sean Nicholas Barkas) Date: Mon Jul 20 16:20:00 2009 Subject: svn commit: r195783 - stable/7/sys/ufs/ufs Message-ID: <200907201619.n6KGJgQ0082553@svn.freebsd.org> Author: snb Date: Mon Jul 20 16:19:42 2009 New Revision: 195783 URL: http://svn.freebsd.org/changeset/base/195783 Log: MFC r195003: Fix a bug reported by pho@ where one can induce a panic by decreasing vfs.ufs.dirhash_maxmem below the current amount of memory used by dirhash. When ufsdirhash_build() is called with the memory in use greater than dirhash_maxmem, it attempts to free up memory by calling ufsdirhash_recycle(). If successful in freeing enough memory, ufsdirhash_recycle() leaves the dirhash list locked. But at this point in ufsdirhash_build(), the list is not explicitly unlocked after the call(s) to ufsdirhash_recycle(). When we next attempt to lock the dirhash list, we will get a "panic: _mtx_lock_sleep: recursed on non-recursive mutex dirhash list". Approved by: dwmalone (mentor) Modified: stable/7/sys/ufs/ufs/ufs_dirhash.c Modified: stable/7/sys/ufs/ufs/ufs_dirhash.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_dirhash.c Mon Jul 20 13:55:33 2009 (r195782) +++ stable/7/sys/ufs/ufs/ufs_dirhash.c Mon Jul 20 16:19:42 2009 (r195783) @@ -329,9 +329,12 @@ ufsdirhash_build(struct inode *ip) int dirblocks, i, j, memreqd, nblocks, narrays, nslots, slot; /* Take care of a decreased sysctl value. */ - while (ufs_dirhashmem > ufs_dirhashmaxmem) + while (ufs_dirhashmem > ufs_dirhashmaxmem) { if (ufsdirhash_recycle(0) != 0) return (-1); + /* Recycled enough memory, so unlock the list. */ + DIRHASHLIST_UNLOCK(); + } /* Check if we can/should use dirhash. */ if (ip->i_size < ufs_mindirhashsize || OFSFMT(ip->i_vnode) || From dougb at FreeBSD.org Mon Jul 20 19:20:40 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Mon Jul 20 19:20:46 2009 Subject: svn commit: r195786 - in stable/7/games/fortune: . datfiles fortune Message-ID: <200907201920.n6KJKbtj086449@svn.freebsd.org> Author: dougb Date: Mon Jul 20 19:20:37 2009 New Revision: 195786 URL: http://svn.freebsd.org/changeset/base/195786 Log: MFC 195726: spaces before commas and one ). Modified: stable/7/games/fortune/ (props changed) stable/7/games/fortune/datfiles/ (props changed) stable/7/games/fortune/datfiles/fortunes stable/7/games/fortune/datfiles/fortunes-o.real stable/7/games/fortune/datfiles/freebsd-tips (props changed) stable/7/games/fortune/fortune/ (props changed) Modified: stable/7/games/fortune/datfiles/fortunes ============================================================================== --- stable/7/games/fortune/datfiles/fortunes Mon Jul 20 19:16:42 2009 (r195785) +++ stable/7/games/fortune/datfiles/fortunes Mon Jul 20 19:20:37 2009 (r195786) @@ -12229,7 +12229,7 @@ after they got done, you wanted to be tr "The test or the room?" "The tests or the room? Vell, nah, about them I can't complain." "The nurses? The food?" asked Fats, but Bernard shook his head no. -Fats laughed and said, "Listen , Bernie, you went to the MBH, they did this +Fats laughed and said, "Listen, Bernie, you went to the MBH, they did this great workup, and when I asked you shy you came to the House of God, all you tell me is, 'Nah, I can't complain.' So why did you come here? Why, Bernie, why?" @@ -25009,7 +25009,7 @@ Great song. -- Fred Reuss % I went to a job interview the other day, the guy asked me if I had any -questions , I said yes, just one, if you're in a car traveling at the +questions, I said yes, just one, if you're in a car traveling at the speed of light and you turn your headlights on, does anything happen? He said he couldn't answer that, I told him sorry, but I couldn't work @@ -25534,7 +25534,7 @@ we wouldn't reach a conclusion. If an average person on the subway turns to you, like an ancient mariner, and starts telling you her tale, you turn away or nod and hope she stops, not just because you fear she might be crazy. If she tells her tale on -camera, you might listen. Watching strangers on television , even +camera, you might listen. Watching strangers on television, even responding to them from a studio audience, we're disengaged - voyeurs collaborating with exhibitionists in rituals of sham community. Never have so many known so much about people for whom they cared so little. @@ -26161,9 +26161,9 @@ they'll never hurt you, nine times out o % If practice makes perfect, and nobody's perfect, why practice? % -If preceded by a '-' , the timezone shall be east of the Prime +If preceded by a '-', the timezone shall be east of the Prime Meridian; otherwise, it shall be west (which may be indicated by -an optional preceding '+' ). +an optional preceding '+'). -- POSIX 2001 The "+" or "-" indicates whether the time-of-day is ahead of Modified: stable/7/games/fortune/datfiles/fortunes-o.real ============================================================================== --- stable/7/games/fortune/datfiles/fortunes-o.real Mon Jul 20 19:16:42 2009 (r195785) +++ stable/7/games/fortune/datfiles/fortunes-o.real Mon Jul 20 19:20:37 2009 (r195786) @@ -6576,7 +6576,7 @@ mean. The answer is hot tubs. A hot tu water that you sit in naked with members of the opposite sex, none of whom is necessarily your spouse. After a few hours in their hot tubs, Californians don't give a damn about earthquakes or mass murderers. They don't give a -damn about anything , which is why they are able to produce "Laverne and +damn about anything, which is why they are able to produce "Laverne and Shirley" week after week. -- Dave Barry % From delphij at FreeBSD.org Tue Jul 21 04:04:36 2009 From: delphij at FreeBSD.org (Xin LI) Date: Tue Jul 21 04:04:48 2009 Subject: svn commit: r195796 - stable/7/usr.bin/gzip Message-ID: <200907210404.n6L44Za3098751@svn.freebsd.org> Author: delphij Date: Tue Jul 21 04:04:35 2009 New Revision: 195796 URL: http://svn.freebsd.org/changeset/base/195796 Log: MFC all recent gzip(1) changes, up to r194916. Added: stable/7/usr.bin/gzip/unpack.c - copied unchanged from r195795, head/usr.bin/gzip/unpack.c Modified: stable/7/usr.bin/gzip/ (props changed) stable/7/usr.bin/gzip/gzip.1 stable/7/usr.bin/gzip/gzip.c stable/7/usr.bin/gzip/zuncompress.c Modified: stable/7/usr.bin/gzip/gzip.1 ============================================================================== --- stable/7/usr.bin/gzip/gzip.1 Tue Jul 21 02:14:39 2009 (r195795) +++ stable/7/usr.bin/gzip/gzip.1 Tue Jul 21 04:04:35 2009 (r195796) @@ -1,4 +1,4 @@ -.\" $NetBSD: gzip.1,v 1.19 2008/05/29 14:51:27 mrg Exp $ +.\" $NetBSD: gzip.1,v 1.20 2009/04/01 08:15:37 mrg Exp $ .\" .\" Copyright (c) 1997, 2003, 2004 Matthew R. Green .\" All rights reserved. @@ -25,7 +25,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd June 30, 2008 +.Dd June 24, 2009 .Dt GZIP 1 .Os .Sh NAME @@ -152,8 +152,8 @@ embedded in the file. This option causes the stored filename in the input file to be used as the output file. .It Fl n , -no-name -This option stops the filename from being stored in the output -file. +This option stops the filename and timestamp from being stored in +the output file. .It Fl q , -quiet With this option, no warnings or errors are printed. .It Fl r , -recursive @@ -206,7 +206,7 @@ This implementation of was ported based on the .Nx .Nm -20060927, and first appeared in +20090412, and first appeared in .Fx 7.0 . .Sh AUTHORS This implementation of Modified: stable/7/usr.bin/gzip/gzip.c ============================================================================== --- stable/7/usr.bin/gzip/gzip.c Tue Jul 21 02:14:39 2009 (r195795) +++ stable/7/usr.bin/gzip/gzip.c Tue Jul 21 04:04:35 2009 (r195796) @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.92 2008/07/21 14:19:22 lukem Exp $ */ +/* $NetBSD: gzip.c,v 1.94 2009/04/12 10:31:14 lukem Exp $ */ /*- * Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green @@ -79,6 +79,9 @@ enum filetype { #ifndef NO_COMPRESS_SUPPORT FT_Z, #endif +#ifndef NO_PACK_SUPPORT + FT_PACK, +#endif FT_LAST, FT_UNKNOWN }; @@ -95,6 +98,10 @@ enum filetype { #define Z_MAGIC "\037\235" #endif +#ifndef NO_PACK_SUPPORT +#define PACK_MAGIC "\037\036" +#endif + #define GZ_SUFFIX ".gz" #define BUFLEN (64 * 1024) @@ -143,7 +150,7 @@ static suffixes_t suffixes[] = { }; #define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0]) -static const char gzip_version[] = "FreeBSD gzip 20070711"; +static const char gzip_version[] = "FreeBSD gzip 20090621"; #ifndef SMALL static const char gzip_copyright[] = \ @@ -195,10 +202,10 @@ static int exit_value = 0; /* exit valu static char *infile; /* name of file coming in */ -static void maybe_err(const char *fmt, ...) +static void maybe_err(const char *fmt, ...) __dead2 __attribute__((__format__(__printf__, 1, 2))); #ifndef NO_BZIP2_SUPPORT -static void maybe_errx(const char *fmt, ...) +static void maybe_errx(const char *fmt, ...) __dead2 __attribute__((__format__(__printf__, 1, 2))); #endif static void maybe_warn(const char *fmt, ...) @@ -248,6 +255,10 @@ static FILE *zdopen(int); static off_t zuncompress(FILE *, FILE *, char *, size_t, off_t *); #endif +#ifndef NO_PACK_SUPPORT +static off_t unpack(int, int, char *, size_t, off_t *); +#endif + int main(int, char **p); #ifdef SMALL @@ -1104,6 +1115,11 @@ file_gettype(u_char *buf) return FT_Z; else #endif +#ifndef NO_PACK_SUPPORT + if (memcmp(buf, PACK_MAGIC, 2) == 0) + return FT_PACK; + else +#endif return FT_UNKNOWN; } @@ -1297,7 +1313,7 @@ file_uncompress(char *file, char *outfil ssize_t rbytes; unsigned char header1[4]; enum filetype method; - int rv, fd, ofd, zfd = -1; + int fd, ofd, zfd = -1; #ifndef SMALL time_t timestamp = 0; unsigned char name[PATH_MAX + 1]; @@ -1344,9 +1360,10 @@ file_uncompress(char *file, char *outfil #ifndef SMALL if (method == FT_GZIP && Nflag) { unsigned char ts[4]; /* timestamp */ + ssize_t rv; rv = pread(fd, ts, sizeof ts, GZIP_TIMESTAMP); - if (rv >= 0 && (size_t)rv < sizeof ts) + if (rv >= 0 && rv < (ssize_t)(sizeof ts)) goto unexpected_EOF; if (rv == -1) { if (!fflag) @@ -1457,6 +1474,17 @@ file_uncompress(char *file, char *outfil } else #endif +#ifndef NO_PACK_SUPPORT + if (method == FT_PACK) { + if (lflag) { + maybe_warnx("no -l with packed files"); + goto lose; + } + + size = unpack(fd, zfd, NULL, 0, NULL); + } else +#endif + #ifndef SMALL if (method == FT_UNKNOWN) { if (lflag) { @@ -1650,6 +1678,12 @@ handle_stdin(void) fclose(in); break; #endif +#ifndef NO_PACK_SUPPORT + case FT_PACK: + usize = unpack(STDIN_FILENO, STDOUT_FILENO, + (char *)header1, sizeof header1, &gsize); + break; +#endif } #ifndef SMALL @@ -1966,6 +2000,8 @@ print_list(int fd, off_t out, const char } in_tot += in; out_tot += out; +#else + (void)&ts; /* XXX */ #endif printf("%12llu %12llu ", (unsigned long long)out, (unsigned long long)in); print_ratio(in, out, stdout); @@ -2035,6 +2071,9 @@ display_version(void) #ifndef NO_COMPRESS_SUPPORT #include "zuncompress.c" #endif +#ifndef NO_PACK_SUPPORT +#include "unpack.c" +#endif static ssize_t read_retry(int fd, void *buf, size_t sz) Copied: stable/7/usr.bin/gzip/unpack.c (from r195795, head/usr.bin/gzip/unpack.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/usr.bin/gzip/unpack.c Tue Jul 21 04:04:35 2009 (r195796, copy of r195795, head/usr.bin/gzip/unpack.c) @@ -0,0 +1,322 @@ +/*- + * Copyright (c) 2009 Xin LI + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (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$ + */ + +/* This file is #included by gzip.c */ + +/* + * pack(1) file format: + * + * The first 7 bytes is the header: + * 00, 01 - Signature (US, RS), we already validated it earlier. + * 02..05 - Uncompressed size + * 06 - Level for the huffman tree (<=24) + * + * pack(1) will then store symbols (leaf) nodes count in each huffman + * tree levels, each level would consume 1 byte (See [1]). + * + * After the symbol count table, there is the symbol table, storing + * symbols represented by coresponding leaf node. EOB is not being + * explicitly transmitted (not necessary anyway) in the symbol table. + * + * Compressed data goes after the symbol table. + * + * NOTES + * + * [1] If we count EOB into the symbols, that would mean that we will + * have at most 256 symbols in the huffman tree. pack(1) rejects empty + * file and files that just repeats one character, which means that we + * will have at least 2 symbols. Therefore, pack(1) would reduce the + * last level symbol count by 2 which makes it a number in + * range [0..254], so all levels' symbol count would fit into 1 byte. + */ + +#define PACK_HEADER_LENGTH 7 +#define HTREE_MAXLEVEL 24 + +/* + * unpack descriptor + * + * Represent the huffman tree in a similiar way that pack(1) would + * store in a packed file. We store all symbols in a linear table, + * and store pointers to each level's first symbol. In addition to + * that, maintain two counts for each level: inner nodes count and + * leaf nodes count. + */ +typedef struct { + int symbol_size; /* Size of the symbol table */ + int treelevels; /* Levels for the huffman tree */ + + int *symbolsin; /* Table of leaf symbols count in + each level */ + int *inodesin; /* Table of internal nodes count in + each level */ + + char *symbol; /* The symbol table */ + char *symbol_eob; /* Pointer to the EOB symbol */ + char **tree; /* Decoding huffman tree (pointers to + first symbol of each tree level */ + + off_t uncompressed_size; /* Uncompressed size */ + FILE *fpIn; /* Input stream */ + FILE *fpOut; /* Output stream */ +} unpack_descriptor_t; + +/* + * Release resource allocated to an unpack descriptor. + * + * Caller is responsible to make sure that all of these pointers are + * initialized (in our case, they all point to valid memory block). + * We don't zero out pointers here because nobody else would ever + * reference the memory block without scrubing them. + */ +static void +unpack_descriptor_fini(unpack_descriptor_t *unpackd) +{ + + free(unpackd->symbolsin); + free(unpackd->inodesin); + free(unpackd->symbol); + free(unpackd->tree); + + fclose(unpackd->fpIn); + fclose(unpackd->fpOut); +} + +/* + * Recursively fill the internal node count table + */ +static void +unpackd_fill_inodesin(const unpack_descriptor_t *unpackd, int level) +{ + + /* + * The internal nodes would be 1/2 of total internal nodes and + * leaf nodes in the next level. For the last level there + * would be no internal node by defination. + */ + if (level < unpackd->treelevels) { + unpackd_fill_inodesin(unpackd, level + 1); + unpackd->inodesin[level] = (unpackd->inodesin[level + 1] + + unpackd->symbolsin[level + 1]) / 2; + } else + unpackd->inodesin[level] = 0; +} + +/* + * Update counter for accepted bytes + */ +static void +accepted_bytes(off_t *bytes_in, off_t newbytes) +{ + + if (bytes_in != NULL) + (*bytes_in) += newbytes; +} + +/* + * Read file header and construct the tree. Also, prepare the buffered I/O + * for decode rountine. + * + * Return value is uncompressed size. + */ +static void +unpack_parse_header(int in, int out, char *pre, size_t prelen, off_t *bytes_in, + unpack_descriptor_t *unpackd) +{ + unsigned char hdr[PACK_HEADER_LENGTH]; /* buffer for header */ + ssize_t bytesread; /* Bytes read from the file */ + int i, j, thisbyte; + + /* Prepend the header buffer if we already read some data */ + if (prelen != 0) + memcpy(hdr, pre, prelen); + + /* Read in and fill the rest bytes of header */ + bytesread = read(in, hdr + prelen, PACK_HEADER_LENGTH - prelen); + if (bytesread < 0) + maybe_err("Error reading pack header"); + + accepted_bytes(bytes_in, PACK_HEADER_LENGTH); + + /* Obtain uncompressed length (bytes 2,3,4,5)*/ + unpackd->uncompressed_size = 0; + for (i = 2; i <= 5; i++) { + unpackd->uncompressed_size <<= 8; + unpackd->uncompressed_size |= hdr[i]; + } + + /* Get the levels of the tree */ + unpackd->treelevels = hdr[6]; + if (unpackd->treelevels > HTREE_MAXLEVEL || unpackd->treelevels < 1) + maybe_errx("Huffman tree has insane levels"); + + /* Let libc take care for buffering from now on */ + if ((unpackd->fpIn = fdopen(in, "r")) == NULL) + maybe_err("Can not fdopen() input stream"); + if ((unpackd->fpOut = fdopen(out, "w")) == NULL) + maybe_err("Can not fdopen() output stream"); + + /* Allocate for the tables of bounds and the tree itself */ + unpackd->inodesin = + calloc(unpackd->treelevels, sizeof(*(unpackd->inodesin))); + unpackd->symbolsin = + calloc(unpackd->treelevels, sizeof(*(unpackd->symbolsin))); + unpackd->tree = + calloc(unpackd->treelevels, (sizeof (*(unpackd->tree)))); + if (unpackd->inodesin == NULL || unpackd->symbolsin == NULL || + unpackd->tree == NULL) + maybe_err("calloc"); + + /* We count from 0 so adjust to match array upper bound */ + unpackd->treelevels--; + + /* Read the levels symbol count table and caculate total */ + unpackd->symbol_size = 1; /* EOB */ + for (i = 0; i <= unpackd->treelevels; i++) { + if ((thisbyte = fgetc(unpackd->fpIn)) == EOF) + maybe_err("File appears to be truncated"); + unpackd->symbolsin[i] = (unsigned char)thisbyte; + unpackd->symbol_size += unpackd->symbolsin[i]; + } + accepted_bytes(bytes_in, unpackd->treelevels); + if (unpackd->symbol_size > 256) + maybe_errx("Bad symbol table"); + + /* Allocate for the symbol table, point symbol_eob at the beginning */ + unpackd->symbol_eob = unpackd->symbol = calloc(1, unpackd->symbol_size); + if (unpackd->symbol == NULL) + maybe_err("calloc"); + + /* + * Read in the symbol table, which contain [2, 256] symbols. + * In order to fit the count in one byte, pack(1) would offset + * it by reducing 2 from the actual number from the last level. + * + * We adjust the last level's symbol count by 1 here, because + * the EOB symbol is not being transmitted explicitly. Another + * adjustment would be done later afterward. + */ + unpackd->symbolsin[unpackd->treelevels]++; + for (i = 0; i <= unpackd->treelevels; i++) { + unpackd->tree[i] = unpackd->symbol_eob; + for (j = 0; j < unpackd->symbolsin[i]; j++) { + if ((thisbyte = fgetc(unpackd->fpIn)) == EOF) + maybe_errx("Symbol table truncated"); + *unpackd->symbol_eob++ = (char)thisbyte; + } + accepted_bytes(bytes_in, unpackd->symbolsin[i]); + } + + /* Now, take account for the EOB symbol as well */ + unpackd->symbolsin[unpackd->treelevels]++; + + /* + * The symbolsin table has been constructed now. + * Caculate the internal nodes count table based on it. + */ + unpackd_fill_inodesin(unpackd, 0); +} + +/* + * Decode huffman stream, based on the huffman tree. + */ +static void +unpack_decode(const unpack_descriptor_t *unpackd, off_t *bytes_in) +{ + int thislevel, thiscode, thisbyte, inlevelindex; + int i; + off_t bytes_out = 0; + const char *thissymbol; /* The symbol pointer decoded from stream */ + + /* + * Decode huffman. Fetch every bytes from the file, get it + * into 'thiscode' bit-by-bit, then output the symbol we got + * when one has been found. + * + * Assumption: sizeof(int) > ((max tree levels + 1) / 8). + * bad things could happen if not. + */ + thislevel = 0; + thiscode = thisbyte = 0; + + while ((thisbyte = fgetc(unpackd->fpIn)) != EOF) { + accepted_bytes(bytes_in, 1); + + /* + * Split one bit from thisbyte, from highest to lowest, + * feed the bit into thiscode, until we got a symbol from + * the tree. + */ + for (i = 7; i >= 0; i--) { + thiscode = (thiscode << 1) | ((thisbyte >> i) & 1); + + /* Did we got a symbol? (referencing leaf node) */ + if (thiscode >= unpackd->inodesin[thislevel]) { + inlevelindex = + thiscode - unpackd->inodesin[thislevel]; + if (inlevelindex > unpackd->symbolsin[thislevel]) + maybe_errx("File corrupt"); + + thissymbol = + &(unpackd->tree[thislevel][inlevelindex]); + if ((thissymbol == unpackd->symbol_eob) && + (bytes_out == unpackd->uncompressed_size)) + goto finished; + + fputc((*thissymbol), unpackd->fpOut); + bytes_out++; + + /* Prepare for next input */ + thislevel = 0; thiscode = 0; + } else { + thislevel++; + if (thislevel > unpackd->treelevels) + maybe_errx("File corrupt"); + } + } + } + +finished: + if (bytes_out != unpackd->uncompressed_size) + maybe_errx("Premature EOF"); +} + +/* Handler for pack(1)'ed file */ +static off_t +unpack(int in, int out, char *pre, size_t prelen, off_t *bytes_in) +{ + unpack_descriptor_t unpackd; + + unpack_parse_header(dup(in), dup(out), pre, prelen, bytes_in, &unpackd); + unpack_decode(&unpackd, bytes_in); + unpack_descriptor_fini(&unpackd); + + /* If we reached here, the unpack was successful */ + return (unpackd.uncompressed_size); +} + Modified: stable/7/usr.bin/gzip/zuncompress.c ============================================================================== --- stable/7/usr.bin/gzip/zuncompress.c Tue Jul 21 02:14:39 2009 (r195795) +++ stable/7/usr.bin/gzip/zuncompress.c Tue Jul 21 04:04:35 2009 (r195796) @@ -1,4 +1,4 @@ -/* $NetBSD: zuncompress.c,v 1.6 2005/11/22 09:05:30 mrg Exp $ */ +/* $NetBSD: zuncompress.c,v 1.7 2009/04/12 10:31:14 lukem Exp $ */ /*- * Copyright (c) 1985, 1986, 1992, 1993 @@ -147,7 +147,7 @@ zuncompress(FILE *in, FILE *out, char *p compressed_pre = NULL; while ((bin = fread(buf, 1, sizeof(buf), in)) != 0) { - if (tflag == 0 && fwrite(buf, 1, bin, out) != (size_t)bin) { + if (tflag == 0 && (off_t)fwrite(buf, 1, bin, out) != bin) { free(buf); return -1; } From obrien at FreeBSD.org Tue Jul 21 04:33:02 2009 From: obrien at FreeBSD.org (David O'Brien) Date: Tue Jul 21 04:33:09 2009 Subject: svn commit: r195696 - in stable/7: crypto/openssh secure/lib/libssh In-Reply-To: <200907142046.n6EKkJwO070823@svn.freebsd.org> References: <200907142046.n6EKkJwO070823@svn.freebsd.org> Message-ID: <20090721040810.GA84807@dragon.NUXI.org> On Tue, Jul 14, 2009 at 08:46:19PM +0000, John Baldwin wrote: > Date: Tue Jul 14 20:46:19 2009 > New Revision: 195696 > URL: http://svn.freebsd.org/changeset/base/195696 > Log: > MFC: Use the closefrom(2) system call. > Modified: > stable/7/crypto/openssh/ (props changed) > stable/7/crypto/openssh/config.h > stable/7/crypto/openssh/ssh_namespace.h > stable/7/secure/lib/libssh/ (props changed) > stable/7/secure/lib/libssh/Makefile Hi John, Would you mind backing out this commit from 7-stable. This change mades it so one cannot seriously boot a machine multiuser with an older kernel as /usr/sbin/sshd dies due to bad system call. I think the MFC of this part of the closefrom(2) addtion edge up against POLA for a mature -stable branch. Even in -CURRENT it's good form to add a new system call and then immedately use it... without some time laps to allow folks to boot a week old kernel. Thanks, -- David From des at des.no Tue Jul 21 12:43:13 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Tue Jul 21 12:43:29 2009 Subject: svn commit: r195696 - in stable/7: crypto/openssh secure/lib/libssh In-Reply-To: <20090721040810.GA84807@dragon.NUXI.org> (David O'Brien's message of "Mon, 20 Jul 2009 21:08:10 -0700") References: <200907142046.n6EKkJwO070823@svn.freebsd.org> <20090721040810.GA84807@dragon.NUXI.org> Message-ID: <86hbx6xl40.fsf@ds4.des.no> "David O'Brien" writes: > Would you mind backing out this commit from 7-stable. Rather than backing it out, we can fix it by adding a closefrom implementation in crypto/openssh/compat/. DES -- Dag-Erling Sm?rgrav - des@des.no From des at des.no Tue Jul 21 12:45:07 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Tue Jul 21 12:45:24 2009 Subject: svn commit: r195696 - in stable/7: crypto/openssh secure/lib/libssh In-Reply-To: <86hbx6xl40.fsf@ds4.des.no> ("Dag-Erling =?utf-8?Q?Sm=C3=B8rg?= =?utf-8?Q?rav=22's?= message of "Tue, 21 Jul 2009 14:43:11 +0200") References: <200907142046.n6EKkJwO070823@svn.freebsd.org> <20090721040810.GA84807@dragon.NUXI.org> <86hbx6xl40.fsf@ds4.des.no> Message-ID: <86d47uxl0u.fsf@ds4.des.no> Dag-Erling Sm?rgrav writes: > "David O'Brien" writes: > > Would you mind backing out this commit from 7-stable. > Rather than backing it out, we can fix it by adding a closefrom > implementation in crypto/openssh/compat/. Brain fart. That's what we had before the MFC. John, please back out your commit. DES -- Dag-Erling Sm?rgrav - des@des.no From jhb at freebsd.org Tue Jul 21 13:44:03 2009 From: jhb at freebsd.org (John Baldwin) Date: Tue Jul 21 13:44:38 2009 Subject: svn commit: r195696 - in stable/7: crypto/openssh secure/lib/libssh In-Reply-To: <20090721040810.GA84807@dragon.NUXI.org> References: <200907142046.n6EKkJwO070823@svn.freebsd.org> <20090721040810.GA84807@dragon.NUXI.org> Message-ID: <200907210933.24176.jhb@freebsd.org> On Tuesday 21 July 2009 12:08:10 am David O'Brien wrote: > On Tue, Jul 14, 2009 at 08:46:19PM +0000, John Baldwin wrote: > > Date: Tue Jul 14 20:46:19 2009 > > New Revision: 195696 > > URL: http://svn.freebsd.org/changeset/base/195696 > > Log: > > MFC: Use the closefrom(2) system call. > > Modified: > > stable/7/crypto/openssh/ (props changed) > > stable/7/crypto/openssh/config.h > > stable/7/crypto/openssh/ssh_namespace.h > > stable/7/secure/lib/libssh/ (props changed) > > stable/7/secure/lib/libssh/Makefile > > Hi John, > Would you mind backing out this commit from 7-stable. > This change mades it so one cannot seriously boot a machine multiuser > with an older kernel as /usr/sbin/sshd dies due to bad system call. I > think the MFC of this part of the closefrom(2) addtion edge up against > POLA for a mature -stable branch. > > Even in -CURRENT it's good form to add a new system call and then > immedately use it... without some time laps to allow folks to boot > a week old kernel. Will do, no problem. -- John Baldwin From jhb at FreeBSD.org Tue Jul 21 13:45:41 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Jul 21 13:45:47 2009 Subject: svn commit: r195802 - in stable/7: crypto/openssh secure/lib/libssh Message-ID: <200907211345.n6LDjeZb012884@svn.freebsd.org> Author: jhb Date: Tue Jul 21 13:45:40 2009 New Revision: 195802 URL: http://svn.freebsd.org/changeset/base/195802 Log: Revert to using the userland closefrom() stub instead of the system call to give a longer grace time where newer ssh binaries work with older kernels. Requested by: obrien Approved by: des Modified: stable/7/crypto/openssh/ (props changed) stable/7/crypto/openssh/config.h stable/7/crypto/openssh/ssh_namespace.h stable/7/secure/lib/libssh/ (props changed) stable/7/secure/lib/libssh/Makefile Modified: stable/7/crypto/openssh/config.h ============================================================================== --- stable/7/crypto/openssh/config.h Tue Jul 21 12:32:46 2009 (r195801) +++ stable/7/crypto/openssh/config.h Tue Jul 21 13:45:40 2009 (r195802) @@ -211,7 +211,7 @@ #define HAVE_CLOCK_T 1 /* Define to 1 if you have the `closefrom' function. */ -#define HAVE_CLOSEFROM 1 +/* #undef HAVE_CLOSEFROM */ /* Define if gai_strerror() returns const char * */ #define HAVE_CONST_GAI_STRERROR_PROTO 1 Modified: stable/7/crypto/openssh/ssh_namespace.h ============================================================================== --- stable/7/crypto/openssh/ssh_namespace.h Tue Jul 21 12:32:46 2009 (r195801) +++ stable/7/crypto/openssh/ssh_namespace.h Tue Jul 21 13:45:40 2009 (r195802) @@ -154,6 +154,7 @@ #define ciphers_valid ssh_ciphers_valid #define cleanhostname ssh_cleanhostname #define cleanup_exit ssh_cleanup_exit +#define closefrom ssh_closefrom #define colon ssh_colon #define compat_cipher_proposal ssh_compat_cipher_proposal #define compat_datafellows ssh_compat_datafellows Modified: stable/7/secure/lib/libssh/Makefile ============================================================================== --- stable/7/secure/lib/libssh/Makefile Tue Jul 21 12:32:46 2009 (r195801) +++ stable/7/secure/lib/libssh/Makefile Tue Jul 21 13:45:40 2009 (r195802) @@ -19,7 +19,7 @@ SRCS= acss.c authfd.c authfile.c bufaux. # compiled directly into sshd instead. # Portability layer -SRCS+= bsd-arc4random.c bsd-misc.c fmt_scaled.c \ +SRCS+= bsd-arc4random.c bsd-closefrom.c bsd-misc.c fmt_scaled.c \ getrrsetbyname.c openssl-compat.c port-tun.c strtonum.c \ vis.c xcrypt.c xmmap.c # FreeBSD additions From bms at FreeBSD.org Wed Jul 22 01:07:51 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Wed Jul 22 01:07:58 2009 Subject: svn commit: r195816 - stable/7/contrib/gcc Message-ID: <200907220107.n6M17ofL026878@svn.freebsd.org> Author: bms Date: Wed Jul 22 01:07:49 2009 New Revision: 195816 URL: http://svn.freebsd.org/changeset/base/195816 Log: Output DWARF debug information for global 'using' declarations, instead of just blowing up. A very similar change to this exists which is GPLv3 licensed, this is my own change. This problem was triggered by running the Boost regression tests. See also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31899 Reviewed by: luigi Modified: stable/7/contrib/gcc/dwarf2out.c Modified: stable/7/contrib/gcc/dwarf2out.c ============================================================================== --- stable/7/contrib/gcc/dwarf2out.c Wed Jul 22 01:07:11 2009 (r195815) +++ stable/7/contrib/gcc/dwarf2out.c Wed Jul 22 01:07:49 2009 (r195816) @@ -10007,7 +10007,7 @@ reference_to_unused (tree * tp, int * wa return NULL_TREE; else if (!cgraph_global_info_ready && (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL)) - gcc_unreachable (); + return *tp; else if (DECL_P (*tp) && TREE_CODE (*tp) == VAR_DECL) { struct cgraph_varpool_node *node = cgraph_varpool_node (*tp); From bms at FreeBSD.org Wed Jul 22 15:26:22 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Wed Jul 22 15:26:39 2009 Subject: svn commit: r195823 - stable/7/contrib/gcc Message-ID: <200907221526.n6MFQJvr045140@svn.freebsd.org> Author: bms Date: Wed Jul 22 15:26:19 2009 New Revision: 195823 URL: http://svn.freebsd.org/changeset/base/195823 Log: Mark the dwarf2out.c bug fix, r195815 as integrated; using --record-only. Pointy hat to: bms Requested by: kib Modified: stable/7/contrib/gcc/ (props changed) From avg at FreeBSD.org Wed Jul 22 15:41:38 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Wed Jul 22 15:41:54 2009 Subject: svn commit: r195824 - in stable/7/sys: . cddl/dev/dtrace/amd64 cddl/dev/dtrace/i386 contrib/pf Message-ID: <200907221541.n6MFfbEo045455@svn.freebsd.org> Author: avg Date: Wed Jul 22 15:41:37 2009 New Revision: 195824 URL: http://svn.freebsd.org/changeset/base/195824 Log: MFC 195710: dtrace_gethrtime: improve scaling of TSC ticks to nanoseconds PR: kern/127441 Modified: stable/7/sys/ (props changed) stable/7/sys/cddl/dev/dtrace/amd64/dtrace_subr.c stable/7/sys/cddl/dev/dtrace/i386/dtrace_subr.c stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- stable/7/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Wed Jul 22 15:26:19 2009 (r195823) +++ stable/7/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Wed Jul 22 15:41:37 2009 (r195824) @@ -366,6 +366,10 @@ dtrace_safe_defer_signal(void) static int64_t tgt_cpu_tsc; static int64_t hst_cpu_tsc; static int64_t tsc_skew[MAXCPU]; +static uint64_t nsec_scale; + +/* See below for the explanation of this macro. */ +#define SCALE_SHIFT 28 static void dtrace_gethrtime_init_sync(void *arg) @@ -401,9 +405,36 @@ dtrace_gethrtime_init_cpu(void *arg) static void dtrace_gethrtime_init(void *arg) { + uint64_t tsc_f; cpumask_t map; int i; - struct pcpu *cp; + + /* + * Get TSC frequency known at this moment. + * This should be constant if TSC is invariant. + * Otherwise tick->time conversion will be inaccurate, but + * will preserve monotonic property of TSC. + */ + tsc_f = tsc_freq; + + /* + * The following line checks that nsec_scale calculated below + * doesn't overflow 32-bit unsigned integer, so that it can multiply + * another 32-bit integer without overflowing 64-bit. + * Thus minimum supported TSC frequency is 62.5MHz. + */ + KASSERT(tsc_f > (NANOSEC >> (32 - SCALE_SHIFT)), ("TSC frequency is too low")); + + /* + * We scale up NANOSEC/tsc_f ratio to preserve as much precision + * as possible. + * 2^28 factor was chosen quite arbitrarily from practical + * considerations: + * - it supports TSC frequencies as low as 62.5MHz (see above); + * - it provides quite good precision (e < 0.01%) up to THz + * (terahertz) values; + */ + nsec_scale = ((uint64_t)NANOSEC << SCALE_SHIFT) / tsc_f; /* The current CPU is the reference one. */ tsc_skew[curcpu] = 0; @@ -412,7 +443,7 @@ dtrace_gethrtime_init(void *arg) if (i == curcpu) continue; - if ((cp = pcpu_find(i)) == NULL) + if (pcpu_find(i) == NULL) continue; map = 0; @@ -439,7 +470,21 @@ SYSINIT(dtrace_gethrtime_init, SI_SUB_SM uint64_t dtrace_gethrtime() { - return ((rdtsc() + tsc_skew[curcpu]) * (int64_t) 1000000000 / tsc_freq); + uint64_t tsc; + uint32_t lo; + uint32_t hi; + + /* + * We split TSC value into lower and higher 32-bit halves and separately + * scale them with nsec_scale, then we scale them down by 2^28 + * (see nsec_scale calculations) taking into account 32-bit shift of + * the higher half and finally add. + */ + tsc = rdtsc() + tsc_skew[curcpu]; + lo = tsc; + hi = tsc >> 32; + return (((lo * nsec_scale) >> SCALE_SHIFT) + + ((hi * nsec_scale) << (32 - SCALE_SHIFT))); } uint64_t Modified: stable/7/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- stable/7/sys/cddl/dev/dtrace/i386/dtrace_subr.c Wed Jul 22 15:26:19 2009 (r195823) +++ stable/7/sys/cddl/dev/dtrace/i386/dtrace_subr.c Wed Jul 22 15:41:37 2009 (r195824) @@ -366,6 +366,10 @@ dtrace_safe_defer_signal(void) static int64_t tgt_cpu_tsc; static int64_t hst_cpu_tsc; static int64_t tsc_skew[MAXCPU]; +static uint64_t nsec_scale; + +/* See below for the explanation of this macro. */ +#define SCALE_SHIFT 28 static void dtrace_gethrtime_init_sync(void *arg) @@ -401,10 +405,38 @@ dtrace_gethrtime_init_cpu(void *arg) static void dtrace_gethrtime_init(void *arg) { + uint64_t tsc_f; cpumask_t map; int i; struct pcpu *cp; + /* + * Get TSC frequency known at this moment. + * This should be constant if TSC is invariant. + * Otherwise tick->time conversion will be inaccurate, but + * will preserve monotonic property of TSC. + */ + tsc_f = tsc_freq; + + /* + * The following line checks that nsec_scale calculated below + * doesn't overflow 32-bit unsigned integer, so that it can multiply + * another 32-bit integer without overflowing 64-bit. + * Thus minimum supported TSC frequency is 62.5MHz. + */ + KASSERT(tsc_f > (NANOSEC >> (32 - SCALE_SHIFT)), ("TSC frequency is too low")); + + /* + * We scale up NANOSEC/tsc_f ratio to preserve as much precision + * as possible. + * 2^28 factor was chosen quite arbitrarily from practical + * considerations: + * - it supports TSC frequencies as low as 62.5MHz (see above); + * - it provides quite good precision (e < 0.01%) up to THz + * (terahertz) values; + */ + nsec_scale = ((uint64_t)NANOSEC << SCALE_SHIFT) / tsc_f; + /* The current CPU is the reference one. */ tsc_skew[curcpu] = 0; @@ -439,7 +471,21 @@ SYSINIT(dtrace_gethrtime_init, SI_SUB_SM uint64_t dtrace_gethrtime() { - return ((rdtsc() + tsc_skew[curcpu]) * (int64_t) 1000000000 / tsc_freq); + uint64_t tsc; + uint32_t lo; + uint32_t hi; + + /* + * We split TSC value into lower and higher 32-bit halves and separately + * scale them with nsec_scale, then we scale them down by 2^28 + * (see nsec_scale calculations) taking into account 32-bit shift of + * the higher half and finally add. + */ + tsc = rdtsc() + tsc_skew[curcpu]; + lo = tsc; + hi = tsc >> 32; + return (((lo * nsec_scale) >> SCALE_SHIFT) + + ((hi * nsec_scale) << (32 - SCALE_SHIFT))); } uint64_t From bms at FreeBSD.org Thu Jul 23 01:35:15 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Thu Jul 23 01:35:22 2009 Subject: svn commit: r195829 - stable/7/sys/dev/usb Message-ID: <200907230135.n6N1ZEar057595@svn.freebsd.org> Author: bms Date: Thu Jul 23 01:35:13 2009 New Revision: 195829 URL: http://svn.freebsd.org/changeset/base/195829 Log: MFC r182138: Greatly expand the devices listed as being supported. This list was taken from PR/121184 which was mechanically generated from similar lists in the Linux ipaq driver. I then took the numbers we had in usbdevs and filled in the right symbols and eliminated duplicates. PR: usb/121184 Modified: stable/7/sys/dev/usb/uipaq.c Modified: stable/7/sys/dev/usb/uipaq.c ============================================================================== --- stable/7/sys/dev/usb/uipaq.c Wed Jul 22 22:13:42 2009 (r195828) +++ stable/7/sys/dev/usb/uipaq.c Thu Jul 23 01:35:13 2009 (r195829) @@ -119,16 +119,465 @@ struct uipaq_type { u_int16_t uv_flags; }; -static const struct uipaq_type uipaq_devs[] = { - {{ USB_VENDOR_HP, USB_PRODUCT_HP_2215 }, 0 }, - {{ USB_VENDOR_HP, USB_PRODUCT_HP_568J }, 0}, - {{ USB_VENDOR_HTC, USB_PRODUCT_HTC_WINMOBILE }, 0}, - {{ USB_VENDOR_HTC, USB_PRODUCT_HTC_PPC6700MODEM }, 0}, - {{ USB_VENDOR_HTC, USB_PRODUCT_HTC_SMARTPHONE }, 0}, - {{ USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQPOCKETPC } , 0}, - {{ USB_VENDOR_CASIO, USB_PRODUCT_CASIO_BE300 } , 0}, - {{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_WZERO3ES }, 0}, - {{ USB_VENDOR_ASUS, USB_PRODUCT_ASUS_P535 }, 0}, +/* + * Much of this list is generated from lists of other drivers that support + * the same hardware. Numeric values are used where no usbdevs entries + * exist. + */ + static const struct uipaq_type uipaq_devs[] = { + {{ 0x0104, 0x00be }, 0}, /* Socket USB Sync */ + {{ 0x04ad, 0x0301 }, 0}, /* USB Sync 0301 */ + {{ 0x04ad, 0x0302 }, 0}, /* USB Sync 0302 */ + {{ 0x04ad, 0x0303 }, 0}, /* USB Sync 0303 */ + {{ 0x04ad, 0x0306 }, 0}, /* GPS Pocket PC USB Sync */ + {{ 0x0536, 0x01a0 }, 0}, /* HHP PDT */ + {{ 0x067e, 0x1001 }, 0}, /* Intermec Mobile Computer */ + {{ 0x094b, 0x0001 }, 0}, /* Linkup Systems USB Sync */ + {{ 0x0960, 0x0065 }, 0}, /* BCOM USB Sync 0065 */ + {{ 0x0960, 0x0066 }, 0}, /* BCOM USB Sync 0066 */ + {{ 0x0960, 0x0067 }, 0}, /* BCOM USB Sync 0067 */ + {{ 0x0961, 0x0010 }, 0}, /* Portatec USB Sync */ + {{ 0x099e, 0x0052 }, 0}, /* Trimble GeoExplorer */ + {{ 0x099e, 0x4000 }, 0}, /* TDS Data Collector */ + {{ 0x0c44, 0x03a2 }, 0}, /* Motorola iDEN Smartphone */ + {{ 0x0c8e, 0x6000 }, 0}, /* Cesscom Luxian Series */ + {{ 0x0cad, 0x9001 }, 0}, /* Motorola PowerPad Pocket PCDevice */ + {{ 0x0f4e, 0x0200 }, 0}, /* Freedom Scientific USB Sync */ + {{ 0x0f98, 0x0201 }, 0}, /* Cyberbank USB Sync */ + {{ 0x0fb8, 0x3001 }, 0}, /* Wistron USB Sync */ + {{ 0x0fb8, 0x3002 }, 0}, /* Wistron USB Sync */ + {{ 0x0fb8, 0x3003 }, 0}, /* Wistron USB Sync */ + {{ 0x0fb8, 0x4001 }, 0}, /* Wistron USB Sync */ + {{ 0x1066, 0x00ce }, 0}, /* E-TEN USB Sync */ + {{ 0x1066, 0x0300 }, 0}, /* E-TEN P3XX Pocket PC */ + {{ 0x1066, 0x0500 }, 0}, /* E-TEN P5XX Pocket PC */ + {{ 0x1066, 0x0600 }, 0}, /* E-TEN P6XX Pocket PC */ + {{ 0x1066, 0x0700 }, 0}, /* E-TEN P7XX Pocket PC */ + {{ 0x1114, 0x0001 }, 0}, /* Psion Teklogix Sync 753x */ + {{ 0x1114, 0x0004 }, 0}, /* Psion Teklogix Sync netBookPro */ + {{ 0x1114, 0x0006 }, 0}, /* Psion Teklogix Sync 7525 */ + {{ 0x1182, 0x1388 }, 0}, /* VES USB Sync */ + {{ 0x11d9, 0x1002 }, 0}, /* Rugged Pocket PC 2003 */ + {{ 0x11d9, 0x1003 }, 0}, /* Rugged Pocket PC 2003 */ + {{ 0x1231, 0xce01 }, 0}, /* USB Sync 03 */ + {{ 0x1231, 0xce02 }, 0}, /* USB Sync 03 */ + {{ 0x3340, 0x011c }, 0}, /* Mio DigiWalker PPC StrongARM */ + {{ 0x3340, 0x0326 }, 0}, /* Mio DigiWalker 338 */ + {{ 0x3340, 0x0426 }, 0}, /* Mio DigiWalker 338 */ + {{ 0x3340, 0x043a }, 0}, /* Mio DigiWalker USB Sync */ + {{ 0x3340, 0x051c }, 0}, /* MiTAC USB Sync 528 */ + {{ 0x3340, 0x053a }, 0}, /* Mio DigiWalker SmartPhone USB Sync */ + {{ 0x3340, 0x071c }, 0}, /* MiTAC USB Sync */ + {{ 0x3340, 0x0b1c }, 0}, /* Generic PPC StrongARM */ + {{ 0x3340, 0x0e3a }, 0}, /* Generic PPC USB Sync */ + {{ 0x3340, 0x0f1c }, 0}, /* Itautec USB Sync */ + {{ 0x3340, 0x0f3a }, 0}, /* Generic SmartPhone USB Sync */ + {{ 0x3340, 0x1326 }, 0}, /* Itautec USB Sync */ + {{ 0x3340, 0x191c }, 0}, /* YAKUMO USB Sync */ + {{ 0x3340, 0x2326 }, 0}, /* Vobis USB Sync */ + {{ 0x3340, 0x3326 }, 0}, /* MEDION Winodws Moble USB Sync */ + {{ 0x3708, 0x20ce }, 0}, /* Legend USB Sync */ + {{ 0x3708, 0x21ce }, 0}, /* Lenovo USB Sync */ + {{ 0x4113, 0x0210 }, 0}, /* Mobile Media Technology USB Sync */ + {{ 0x4113, 0x0211 }, 0}, /* Mobile Media Technology USB Sync */ + {{ 0x4113, 0x0400 }, 0}, /* Mobile Media Technology USB Sync */ + {{ 0x4113, 0x0410 }, 0}, /* Mobile Media Technology USB Sync */ + {{ 0x4505, 0x0010 }, 0}, /* Smartphone */ + {{ 0x5e04, 0xce00 }, 0}, /* SAGEM Wireless Assistant */ + {{ USB_VENDOR_ACER, 0x1631 }, 0}, /* c10 Series */ + {{ USB_VENDOR_ACER, 0x1632 }, 0}, /* c20 Series */ + {{ USB_VENDOR_ACER, 0x16e1 }, 0}, /* Acer n10 Handheld USB Sync */ + {{ USB_VENDOR_ACER, 0x16e2 }, 0}, /* Acer n20 Handheld USB Sync */ + {{ USB_VENDOR_ACER, 0x16e3 }, 0}, /* Acer n30 Handheld USB Sync */ + {{ USB_VENDOR_ASUS, 0x4200 }, 0}, /* ASUS USB Sync */ + {{ USB_VENDOR_ASUS, 0x4201 }, 0}, /* ASUS USB Sync */ + {{ USB_VENDOR_ASUS, 0x4202 }, 0}, /* ASUS USB Sync */ + {{ USB_VENDOR_ASUS, 0x9200 }, 0}, /* ASUS USB Sync */ + {{ USB_VENDOR_ASUS, 0x9202 }, 0}, /* ASUS USB Sync */ + {{ USB_VENDOR_ASUS, USB_PRODUCT_ASUS_P535 }, 0}, + {{ USB_VENDOR_CASIO, 0x2001 }, 0}, /* CASIO USB Sync 2001 */ + {{ USB_VENDOR_CASIO, 0x2003 }, 0}, /* CASIO USB Sync 2003 */ + {{ USB_VENDOR_CASIO, USB_PRODUCT_CASIO_BE300 } , 0}, + {{ USB_VENDOR_COMPAL, 0x0531 }, 0}, /* MyGuide 7000 XL USB Sync */ + {{ USB_VENDOR_COMPAQ, 0x0032 }, 0}, /* Compaq iPAQ USB Sync */ + {{ USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQPOCKETPC } , 0}, + {{ USB_VENDOR_DELL, 0x4001 }, 0}, /* Dell Axim USB Sync */ + {{ USB_VENDOR_DELL, 0x4002 }, 0}, /* Dell Axim USB Sync */ + {{ USB_VENDOR_DELL, 0x4003 }, 0}, /* Dell Axim USB Sync */ + {{ USB_VENDOR_DELL, 0x4004 }, 0}, /* Dell Axim USB Sync */ + {{ USB_VENDOR_DELL, 0x4005 }, 0}, /* Dell Axim USB Sync */ + {{ USB_VENDOR_DELL, 0x4006 }, 0}, /* Dell Axim USB Sync */ + {{ USB_VENDOR_DELL, 0x4007 }, 0}, /* Dell Axim USB Sync */ + {{ USB_VENDOR_DELL, 0x4008 }, 0}, /* Dell Axim USB Sync */ + {{ USB_VENDOR_DELL, 0x4009 }, 0}, /* Dell Axim USB Sync */ + {{ USB_VENDOR_FSC, 0x1001 }, 0}, /* Fujitsu Siemens Computers USB Sync */ + {{ USB_VENDOR_FUJITSU, 0x1058 }, 0}, /* FUJITSU USB Sync */ + {{ USB_VENDOR_FUJITSU, 0x1079 }, 0}, /* FUJITSU USB Sync */ + {{ USB_VENDOR_GIGASET, 0x0601 }, 0}, /* Askey USB Sync */ + {{ USB_VENDOR_HITACHI, 0x0014 }, 0}, /* Hitachi USB Sync */ + {{ USB_VENDOR_HP, 0x1216 }, 0}, /* HP USB Sync 1612 */ + {{ USB_VENDOR_HP, 0x2016 }, 0}, /* HP USB Sync 1620 */ + {{ USB_VENDOR_HP, 0x2116 }, 0}, /* HP USB Sync 1621 */ + {{ USB_VENDOR_HP, 0x2216 }, 0}, /* HP USB Sync 1622 */ + {{ USB_VENDOR_HP, 0x3016 }, 0}, /* HP USB Sync 1630 */ + {{ USB_VENDOR_HP, 0x3116 }, 0}, /* HP USB Sync 1631 */ + {{ USB_VENDOR_HP, 0x3216 }, 0}, /* HP USB Sync 1632 */ + {{ USB_VENDOR_HP, 0x4016 }, 0}, /* HP USB Sync 1640 */ + {{ USB_VENDOR_HP, 0x4116 }, 0}, /* HP USB Sync 1641 */ + {{ USB_VENDOR_HP, 0x4216 }, 0}, /* HP USB Sync 1642 */ + {{ USB_VENDOR_HP, 0x5016 }, 0}, /* HP USB Sync 1650 */ + {{ USB_VENDOR_HP, 0x5116 }, 0}, /* HP USB Sync 1651 */ + {{ USB_VENDOR_HP, 0x5216 }, 0}, /* HP USB Sync 1652 */ + {{ USB_VENDOR_HP, USB_PRODUCT_HP_2215 }, 0 }, + {{ USB_VENDOR_HP, USB_PRODUCT_HP_568J }, 0}, + {{ USB_VENDOR_HTC, 0x00cf }, 0}, /* HTC USB Modem */ + {{ USB_VENDOR_HTC, 0x0a01 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a02 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a03 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a04 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a05 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a06 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a07 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a08 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a09 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a0a }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a0b }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a0c }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a0d }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a0e }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a0f }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a10 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a11 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a12 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a13 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a14 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a15 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a16 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a17 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a18 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a19 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a1a }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a1b }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a1c }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a1d }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a1e }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a1f }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a20 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a21 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a22 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a23 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a24 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a25 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a26 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a27 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a28 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a29 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a2a }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a2b }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a2c }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a2d }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a2e }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a2f }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a30 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a31 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a32 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a33 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a34 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a35 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a36 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a37 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a38 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a39 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a3a }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a3b }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a3c }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a3d }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a3e }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a3f }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a40 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a41 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a42 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a43 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a44 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a45 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a46 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a47 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a48 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a49 }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a4a }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a4b }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a4c }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a4d }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a4e }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a4f }, 0}, /* PocketPC USB Sync */ + {{ USB_VENDOR_HTC, 0x0a50 }, 0}, /* HTC SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a52 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a53 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a54 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a55 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a56 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a57 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a58 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a59 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a5a }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a5b }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a5c }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a5d }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a5e }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a5f }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a60 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a61 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a62 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a63 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a64 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a65 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a66 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a67 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a68 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a69 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a6a }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a6b }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a6c }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a6d }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a6e }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a6f }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a70 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a71 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a72 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a73 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a74 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a75 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a76 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a77 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a78 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a79 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a7a }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a7b }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a7c }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a7d }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a7e }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a7f }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a80 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a81 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a82 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a83 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a84 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a85 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a86 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a87 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a88 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a89 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a8a }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a8b }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a8c }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a8d }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a8e }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a8f }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a90 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a91 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a92 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a93 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a94 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a95 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a96 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a97 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a98 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a99 }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a9a }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a9b }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a9c }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a9d }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a9e }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0a9f }, 0}, /* SmartPhone USB Sync */ + {{ USB_VENDOR_HTC, 0x0bce }, 0}, /* "High Tech Computer Corp" */ + {{ USB_VENDOR_HTC, USB_PRODUCT_HTC_PPC6700MODEM }, 0}, + {{ USB_VENDOR_HTC, USB_PRODUCT_HTC_SMARTPHONE }, 0}, + {{ USB_VENDOR_HTC, USB_PRODUCT_HTC_WINMOBILE }, 0}, + {{ USB_VENDOR_JVC, 0x3011 }, 0}, /* JVC USB Sync */ + {{ USB_VENDOR_JVC, 0x3012 }, 0}, /* JVC USB Sync */ + {{ USB_VENDOR_LG, 0x9c01 }, 0}, /* LGE USB Sync */ + {{ USB_VENDOR_MICROSOFT, 0x00ce }, 0}, /* Microsoft USB Sync */ + {{ USB_VENDOR_MICROSOFT, 0x0400 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0401 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0402 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0403 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0404 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0405 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0406 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0407 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0408 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0409 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x040a }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x040b }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x040c }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x040d }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x040e }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x040f }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0410 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0411 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0412 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0413 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0414 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0415 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0416 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0417 }, 0}, /* Windows Pocket PC 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x0432 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0433 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0434 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0435 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0436 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0437 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0438 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0439 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x043a }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x043b }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x043c }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x043d }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x043e }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x043f }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0440 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0441 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0442 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0443 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0444 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0445 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0446 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0447 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0448 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0449 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x044a }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x044b }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x044c }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x044d }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x044e }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x044f }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0450 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0451 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0452 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0453 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0454 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0455 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0456 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0457 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0458 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0459 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x045a }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x045b }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x045c }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x045d }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x045e }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x045f }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0460 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0461 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0462 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0463 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0464 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0465 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0466 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0467 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0468 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0469 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x046a }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x046b }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x046c }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x046d }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x046e }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x046f }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0470 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0471 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0472 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0473 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0474 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0475 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0476 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0477 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0478 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x0479 }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x047a }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x047b }, 0}, /* Windows Pocket PC 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04c8 }, 0}, /* Windows Smartphone 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x04c9 }, 0}, /* Windows Smartphone 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x04ca }, 0}, /* Windows Smartphone 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x04cb }, 0}, /* Windows Smartphone 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x04cc }, 0}, /* Windows Smartphone 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x04cd }, 0}, /* Windows Smartphone 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x04ce }, 0}, /* Windows Smartphone 2002 */ + {{ USB_VENDOR_MICROSOFT, 0x04d7 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04d8 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04d9 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04da }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04db }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04dc }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04dd }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04de }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04df }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04e0 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04e1 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04e2 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04e3 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04e4 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04e5 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04e6 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04e7 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04e8 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04e9 }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MICROSOFT, 0x04ea }, 0}, /* Windows Smartphone 2003 */ + {{ USB_VENDOR_MOTOROLA2, 0x4204 }, 0}, /* Motorola MPx200 Smartphone */ + {{ USB_VENDOR_MOTOROLA2, 0x4214 }, 0}, /* Motorola MPc GSM */ + {{ USB_VENDOR_MOTOROLA2, 0x4224 }, 0}, /* Motorola MPx220 Smartphone */ + {{ USB_VENDOR_MOTOROLA2, 0x4234 }, 0}, /* Motorola MPc CDMA */ + {{ USB_VENDOR_MOTOROLA2, 0x4244 }, 0}, /* Motorola MPx100 Smartphone */ + {{ USB_VENDOR_NEC, 0x00d5 }, 0}, /* NEC USB Sync */ + {{ USB_VENDOR_NEC, 0x00d6 }, 0}, /* NEC USB Sync */ + {{ USB_VENDOR_NEC, 0x00d7 }, 0}, /* NEC USB Sync */ + {{ USB_VENDOR_NEC, 0x8024 }, 0}, /* NEC USB Sync */ + {{ USB_VENDOR_NEC, 0x8025 }, 0}, /* NEC USB Sync */ + {{ USB_VENDOR_PANASONIC, 0x2500 }, 0}, /* Panasonic USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x5f00 }, 0}, /* Samsung NEXiO USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x5f01 }, 0}, /* Samsung NEXiO USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x5f02 }, 0}, /* Samsung NEXiO USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x5f03 }, 0}, /* Samsung NEXiO USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x5f04 }, 0}, /* Samsung NEXiO USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x6611 }, 0}, /* Samsung MITs USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x6613 }, 0}, /* Samsung MITs USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x6615 }, 0}, /* Samsung MITs USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x6617 }, 0}, /* Samsung MITs USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x6619 }, 0}, /* Samsung MITs USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x661b }, 0}, /* Samsung MITs USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x662e }, 0}, /* Samsung MITs USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x6630 }, 0}, /* Samsung MITs USB Sync */ + {{ USB_VENDOR_SAMSUNG, 0x6632 }, 0}, /* Samsung MITs USB Sync */ + {{ USB_VENDOR_SHARP, 0x9102 }, 0}, /* SHARP WS003SH USB Modem */ + {{ USB_VENDOR_SHARP, 0x9121 }, 0}, /* SHARP WS004SH USB Modem */ + {{ USB_VENDOR_SHARP, 0x9151 }, 0}, /* SHARP S01SH USB Modem */ + {{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_WZERO3ES }, 0}, + {{ USB_VENDOR_SYMBOL, 0x2000 }, 0}, /* Symbol USB Sync */ + {{ USB_VENDOR_SYMBOL, 0x2001 }, 0}, /* Symbol USB Sync 0x2001 */ + {{ USB_VENDOR_SYMBOL, 0x2002 }, 0}, /* Symbol USB Sync 0x2002 */ + {{ USB_VENDOR_SYMBOL, 0x2003 }, 0}, /* Symbol USB Sync 0x2003 */ + {{ USB_VENDOR_SYMBOL, 0x2004 }, 0}, /* Symbol USB Sync 0x2004 */ + {{ USB_VENDOR_SYMBOL, 0x2005 }, 0}, /* Symbol USB Sync 0x2005 */ + {{ USB_VENDOR_SYMBOL, 0x2006 }, 0}, /* Symbol USB Sync 0x2006 */ + {{ USB_VENDOR_SYMBOL, 0x2007 }, 0}, /* Symbol USB Sync 0x2007 */ + {{ USB_VENDOR_SYMBOL, 0x2008 }, 0}, /* Symbol USB Sync 0x2008 */ + {{ USB_VENDOR_SYMBOL, 0x2009 }, 0}, /* Symbol USB Sync 0x2009 */ + {{ USB_VENDOR_SYMBOL, 0x200a }, 0}, /* Symbol USB Sync 0x200a */ + {{ USB_VENDOR_TOSHIBA, 0x0700 }, 0}, /* TOSHIBA USB Sync 0700 */ + {{ USB_VENDOR_TOSHIBA, 0x0705 }, 0}, /* TOSHIBA Pocket PC e310 */ + {{ USB_VENDOR_TOSHIBA, 0x0707 }, 0}, /* TOSHIBA Pocket PC e330 Series */ + {{ USB_VENDOR_TOSHIBA, 0x0708 }, 0}, /* TOSHIBA Pocket PC e350Series */ + {{ USB_VENDOR_TOSHIBA, 0x0709 }, 0}, /* TOSHIBA Pocket PC e750 Series */ + {{ USB_VENDOR_TOSHIBA, 0x070a }, 0}, /* TOSHIBA Pocket PC e400 Series */ + {{ USB_VENDOR_TOSHIBA, 0x070b }, 0}, /* TOSHIBA Pocket PC e800 Series */ + {{ USB_VENDOR_TOSHIBA, USB_PRODUCT_TOSHIBA_POCKETPC_E740 }, 0}, /* TOSHIBA Pocket PC e740 */ + {{ USB_VENDOR_VIEWSONIC, 0x0ed9 }, 0}, /* ViewSonic Color Pocket PC V35 */ + {{ USB_VENDOR_VIEWSONIC, 0x1527 }, 0}, /* ViewSonic Color Pocket PC V36 */ + {{ USB_VENDOR_VIEWSONIC, 0x1529 }, 0}, /* ViewSonic Color Pocket PC V37 */ + {{ USB_VENDOR_VIEWSONIC, 0x152b }, 0}, /* ViewSonic Color Pocket PC V38 */ + {{ USB_VENDOR_VIEWSONIC, 0x152e }, 0}, /* ViewSonic Pocket PC */ + {{ USB_VENDOR_VIEWSONIC, 0x1921 }, 0}, /* ViewSonic Communicator Pocket PC */ + {{ USB_VENDOR_VIEWSONIC, 0x1922 }, 0}, /* ViewSonic Smartphone */ + {{ USB_VENDOR_VIEWSONIC, 0x1923 }, 0}, /* ViewSonic Pocket PC V30 */ }; #define uipaq_lookup(v, p) ((const struct uipaq_type *)usb_lookup(uipaq_devs, v, p)) From bms at incunabulum.net Thu Jul 23 01:58:54 2009 From: bms at incunabulum.net (Bruce Simpson) Date: Thu Jul 23 01:59:01 2009 Subject: svn commit: r195829 - stable/7/sys/dev/usb In-Reply-To: <200907230135.n6N1ZEar057595@svn.freebsd.org> References: <200907230135.n6N1ZEar057595@svn.freebsd.org> Message-ID: <4A67BFB1.40904@incunabulum.net> Hi all, I haven't updated the mergeinfo for this file, as the USB stack in HEAD has been completely replaced with the new USB stack. If this is desired, please let me know how to proceed -- I'm new to mergeinfo. When I used the following command to try to maintain the mergeinfo information, I got a very large list of revisions, not all of which look as though they should be merged for this file: % svn merge --record-only -c182138 $FSVN/head/sys/dev/usb/uipaq.c@182138 uipaq.c If I omit the @182138 from the above command, the resultant mergeinfo is empty. thanks, BMS P.S. I tested the code in this commit with an HP iPaq 2215 and it appears to work fine. From brian at FreeBSD.org Thu Jul 23 10:15:23 2009 From: brian at FreeBSD.org (Brian Somers) Date: Thu Jul 23 10:15:29 2009 Subject: svn commit: r195829 - stable/7/sys/dev/usb In-Reply-To: <4A67BFB1.40904@incunabulum.net> References: <200907230135.n6N1ZEar057595@svn.freebsd.org> <4A67BFB1.40904@incunabulum.net> Message-ID: <20090723024640.6f5c893a@dev.lan.Awfulhak.org> On Thu, 23 Jul 2009 02:41:05 +0100 Bruce Simpson wrote: > Hi all, > > I haven't updated the mergeinfo for this file, as the USB stack in > HEAD has been completely replaced with the new USB stack. If this is > desired, please let me know how to proceed -- I'm new to mergeinfo. > > When I used the following command to try to maintain the mergeinfo > information, I got a very large list of revisions, not all of which look > as though they should be merged for this file: > % svn merge --record-only -c182138 > $FSVN/head/sys/dev/usb/uipaq.c@182138 uipaq.c > > If I omit the @182138 from the above command, the resultant mergeinfo is > empty. > > thanks, > BMS > > P.S. I tested the code in this commit with an HP iPaq 2215 and it > appears to work fine. It seems ok to me: brian@dev svn $ cd stable/7/sys brian@dev sys $ svn merge --record-only -c182138 ^/head/sys brian@dev sys $ svn diff Property changes on: . ___________________________________________________________________ Modified: svn:mergeinfo Merged /head/sys:r182138 Property changes on: contrib/pf ___________________________________________________________________ Modified: svn:mergeinfo Merged /head/sys/contrib/pf:r182138 brian@dev sys $ svn st M . M contrib/pf You should keep the mergeinfo on the sys directory, so the entire merge should really have been done as with the above command but without the --record-only - that would update the mergeinfo properties (as above) and patch uipaq.c in one commit. HTH. -- Brian Somers Don't _EVER_ lose your sense of humour ! -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 306 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-stable-7/attachments/20090723/5751fe27/signature.pgp From bms at incunabulum.net Thu Jul 23 12:40:47 2009 From: bms at incunabulum.net (Bruce Simpson) Date: Thu Jul 23 12:40:59 2009 Subject: svn commit: r195829 - stable/7/sys/dev/usb In-Reply-To: <20090723024640.6f5c893a@dev.lan.Awfulhak.org> References: <200907230135.n6N1ZEar057595@svn.freebsd.org> <4A67BFB1.40904@incunabulum.net> <20090723024640.6f5c893a@dev.lan.Awfulhak.org> Message-ID: <4A685A4B.9070201@incunabulum.net> Brian Somers wrote: > ... > brian@dev sys $ svn st > M . > M contrib/pf > > You should keep the mergeinfo on the sys directory, so the entire merge > should really have been done as with the above command but without > the --record-only - that would update the mergeinfo properties (as above) > and patch uipaq.c in one commit. > Why would this commit update contrib/pf? This looks spurious. I got a lot more revisions than this (especially ones listed well after the new USB merge) in the mergeinfo output, therefore I did not commit the mergeinfo update. Too many to list here ATM. thanks, BMS From jhb at freebsd.org Thu Jul 23 17:52:26 2009 From: jhb at freebsd.org (John Baldwin) Date: Thu Jul 23 17:52:38 2009 Subject: svn commit: r195829 - stable/7/sys/dev/usb In-Reply-To: <4A685A4B.9070201@incunabulum.net> References: <200907230135.n6N1ZEar057595@svn.freebsd.org> <20090723024640.6f5c893a@dev.lan.Awfulhak.org> <4A685A4B.9070201@incunabulum.net> Message-ID: <200907231023.47428.jhb@freebsd.org> On Thursday 23 July 2009 8:40:43 am Bruce Simpson wrote: > Brian Somers wrote: > > ... > > brian@dev sys $ svn st > > M . > > M contrib/pf > > > > You should keep the mergeinfo on the sys directory, so the entire merge > > should really have been done as with the above command but without > > the --record-only - that would update the mergeinfo properties (as above) > > and patch uipaq.c in one commit. > > > > Why would this commit update contrib/pf? This looks spurious. This is a FAQ at this point and has been discussed multiple times in the archives, but it is correct. > I got a lot more revisions than this (especially ones listed well after > the new USB merge) in the mergeinfo output, therefore I did not commit > the mergeinfo update. Too many to list here ATM. That's because you merged to the file rather than to sys/. There's a set of instructions about mergning with SVN on the wiki that explains why to do kernel merges to sys/ instead of individual files. -- John Baldwin From bms at FreeBSD.org Thu Jul 23 19:03:05 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Thu Jul 23 19:03:17 2009 Subject: svn commit: r195835 - in stable/7/sys: . contrib/pf Message-ID: <200907231903.n6NJ34hP086636@svn.freebsd.org> Author: bms Date: Thu Jul 23 19:03:04 2009 New Revision: 195835 URL: http://svn.freebsd.org/changeset/base/195835 Log: Update mergeinfo for merge of r182138 to sys/dev/usb/uipaq.c. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) From bms at incunabulum.net Thu Jul 23 19:03:42 2009 From: bms at incunabulum.net (Bruce Simpson) Date: Thu Jul 23 19:03:53 2009 Subject: svn commit: r195829 - stable/7/sys/dev/usb In-Reply-To: <200907231023.47428.jhb@freebsd.org> References: <200907230135.n6N1ZEar057595@svn.freebsd.org> <20090723024640.6f5c893a@dev.lan.Awfulhak.org> <4A685A4B.9070201@incunabulum.net> <200907231023.47428.jhb@freebsd.org> Message-ID: <4A68B40A.8020307@incunabulum.net> John Baldwin wrote: > ... > That's because you merged to the file rather than to sys/. There's a set of > instructions about mergning with SVN on the wiki that explains why to do > kernel merges to sys/ instead of individual files. > I read them, having been pointed at them by kib@ -- but they didn't explain why contrib/pf was being touched at all. In the absence of other information, I'll take this at face value, and commit the mergeinfo, although I would be happier understanding why contrib/pf is being touched by the merge. Perhaps a purchase of the Subversion book is in my future. thanks, BMS From jhb at freebsd.org Thu Jul 23 20:00:31 2009 From: jhb at freebsd.org (John Baldwin) Date: Thu Jul 23 20:00:47 2009 Subject: svn commit: r195829 - stable/7/sys/dev/usb In-Reply-To: <4A68B40A.8020307@incunabulum.net> References: <200907230135.n6N1ZEar057595@svn.freebsd.org> <200907231023.47428.jhb@freebsd.org> <4A68B40A.8020307@incunabulum.net> Message-ID: <200907231516.05011.jhb@freebsd.org> On Thursday 23 July 2009 3:03:38 pm Bruce Simpson wrote: > John Baldwin wrote: > > ... > > That's because you merged to the file rather than to sys/. There's a set of > > instructions about mergning with SVN on the wiki that explains why to do > > kernel merges to sys/ instead of individual files. > > > > I read them, having been pointed at them by kib@ -- but they didn't > explain why contrib/pf was being touched at all. True enough, though I was pointing to the docs to explain merging to sys/ rather than the file. I should probably add some note to the wiki page about the "spurious" mergeinfo. The short version is that stable/7/sys/contrib/pf has two sets of mergeinfo: 1 from head/sys/contrib/pf and 2 from vendor-sys/pf. 2) is inherited from head and is a result of a vendor update of pf being merged over from the vendor area into sys/contrib/pf. It is not suitable for other parts of the kernel. 1) is the normal mergeinfo for merges from head/sys to stable/7/sys. However, a design choice in mergeinfo is that mergeinfo is not inherited via pathnames. Specifically, when the svn client starts walking up the path tree to find mergeinfo, it stops at the first parent directory that has any mergeinfo whatsoever and expects that mergeinfo to fully describe all the mergeinfo for its subtree. Thus, because the mergeinfo from 2) is present on sys/contrib/pf, the mergeinfo in 1) has to be duplicated in sys/contrib/pf in addition to sys. I'm not sure this is the best design, but that is the way Subversion works. -- John Baldwin From brian at FreeBSD.org Thu Jul 23 20:51:20 2009 From: brian at FreeBSD.org (Brian Somers) Date: Thu Jul 23 20:51:26 2009 Subject: svn commit: r195829 - stable/7/sys/dev/usb In-Reply-To: <4A68B40A.8020307@incunabulum.net> References: <200907230135.n6N1ZEar057595@svn.freebsd.org> <20090723024640.6f5c893a@dev.lan.Awfulhak.org> <4A685A4B.9070201@incunabulum.net> <200907231023.47428.jhb@freebsd.org> <4A68B40A.8020307@incunabulum.net> Message-ID: <20090723135044.53ad9173@FreeBSD.org> On Thu, 23 Jul 2009 20:03:38 +0100, Bruce Simpson wrote: > Perhaps a purchase of the Subversion book is in my future. You can download the pdf for free - it's worth reading. IMHO the svn:mergeinfo idea is flawed. It doesn't handle hierarchies with mixed --depth values at all - it should at least handle merges to trees with non-infinity-depth nodes by duplicating the mergeinfo for each non-infinity-depth node from it's closest parent and not merging to the node. The observant committer would of course not commit such a thing (and would set their depth to infinity on these nodes first). -- Brian Somers Don't _EVER_ lose your sense of humour ! From jhb at FreeBSD.org Fri Jul 24 19:35:07 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Fri Jul 24 19:35:20 2009 Subject: svn commit: r195854 - in stable/7: lib/libc lib/libc/sys sys sys/compat/freebsd32 sys/contrib/pf sys/kern sys/sys Message-ID: <200907241935.n6OJZ6HX019123@svn.freebsd.org> Author: jhb Date: Fri Jul 24 19:35:06 2009 New Revision: 195854 URL: http://svn.freebsd.org/changeset/base/195854 Log: MFC: Several cleanups to the syscall tables: - Add explicit prototypes for lkmnosys() and lkmressys() in and remove hacks for those routines from makesyscalls.sh. - Change the LKM syscall entries in the freebsd32 table to use lkmnosys rather than nosys. - Use NOPROTO for __syscall() to remove more magic logic from makesyscalls.sh. - Retire the unused nfsclnt() system call and mark it as UNIMPL rather than NOIMPL. - Remove the NOIMPL system call type. - Allow multiple flags in the type system call type field. Use this to retire CPT_NOA. - Update the comment descriptions for COMPAT[45] system calls in various generated files. - Update comments in syscalls.master. - Include defintions for audit identifiers for compat system calls in . Modified: stable/7/lib/libc/ (props changed) stable/7/lib/libc/sys/Symbol.map stable/7/sys/ (props changed) stable/7/sys/compat/freebsd32/syscalls.master stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/makesyscalls.sh stable/7/sys/kern/syscalls.master stable/7/sys/sys/sysent.h Modified: stable/7/lib/libc/sys/Symbol.map ============================================================================== --- stable/7/lib/libc/sys/Symbol.map Fri Jul 24 19:12:19 2009 (r195853) +++ stable/7/lib/libc/sys/Symbol.map Fri Jul 24 19:35:06 2009 (r195854) @@ -202,7 +202,6 @@ FBSD_1.0 { nanosleep; netbsd_lchown; netbsd_msync; - nfsclnt; nfssvc; nfstat; nlstat; @@ -746,8 +745,6 @@ FBSDprivate_1.0 { __sys_netbsd_lchown; _netbsd_msync; __sys_netbsd_msync; - _nfsclnt; - __sys_nfsclnt; _nfssvc; __sys_nfssvc; _nfstat; Modified: stable/7/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/7/sys/compat/freebsd32/syscalls.master Fri Jul 24 19:12:19 2009 (r195853) +++ stable/7/sys/compat/freebsd32/syscalls.master Fri Jul 24 19:35:06 2009 (r195854) @@ -5,15 +5,17 @@ ; System call name/number master file. ; Processed to created init_sysent.c, syscalls.c and syscall.h. -; Columns: number audit type nargs name alt{name,tag,rtyp}/comments +; Columns: number audit type name alt{name,tag,rtyp}/comments ; number system call number, must be in order ; audit the audit event associated with the system call ; A value of AUE_NULL means no auditing, but it also means that ; there is no audit event for the call at this time. For the ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. -; type one of STD, OBSOL, UNIMPL, COMPAT, CPT_NOA, LIBCOMPAT, -; NODEF, NOARGS, NOPROTO, NOIMPL, NOSTD, COMPAT4 +; type one of STD, OBSOL, UNIMPL, COMPAT, COMPAT4, COMPAT6, +; LIBCOMPAT, NODEF, NOARGS, NOPROTO, NOSTD +; The COMPAT* options may be combined with one or more NO* +; options separated by '|' with no spaces (e.g. COMPAT|NOARGS) ; name psuedo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different @@ -25,15 +27,16 @@ ; STD always included ; COMPAT included on COMPAT #ifdef ; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat) +; COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat) ; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only ; NOSTD implemented but as a lkm that can be statically -; compiled in; sysent entry will be filled with lkmsys +; compiled in; sysent entry will be filled with lkmressys ; so the SYSCALL_MODULE macro works ; NOARGS same as STD except do not create structure in sys/sysproto.h ; NODEF same as STD except only have the entry in the syscall table -; added. Meaning - do do not create structure or function +; added. Meaning - do not create structure or function ; prototype in sys/sysproto.h ; NOPROTO same as STD except do not create structure or ; function prototype in sys/sysproto.h. Does add a @@ -388,16 +391,16 @@ ; ; The following are reserved for loadable syscalls ; -210 AUE_NULL UNIMPL -211 AUE_NULL UNIMPL -212 AUE_NULL UNIMPL -213 AUE_NULL UNIMPL -214 AUE_NULL UNIMPL -215 AUE_NULL UNIMPL -216 AUE_NULL UNIMPL -217 AUE_NULL UNIMPL -218 AUE_NULL UNIMPL -219 AUE_NULL UNIMPL +210 AUE_NULL NODEF lkmnosys lkmnosys nosys_args int +211 AUE_NULL NODEF lkmnosys lkmnosys nosys_args int +212 AUE_NULL NODEF lkmnosys lkmnosys nosys_args int +213 AUE_NULL NODEF lkmnosys lkmnosys nosys_args int +214 AUE_NULL NODEF lkmnosys lkmnosys nosys_args int +215 AUE_NULL NODEF lkmnosys lkmnosys nosys_args int +216 AUE_NULL NODEF lkmnosys lkmnosys nosys_args int +217 AUE_NULL NODEF lkmnosys lkmnosys nosys_args int +218 AUE_NULL NODEF lkmnosys lkmnosys nosys_args int +219 AUE_NULL NODEF lkmnosys lkmnosys nosys_args int ; ; The following were introduced with NetBSD/4.4Lite-2 @@ -652,7 +655,7 @@ 367 AUE_NULL UNIMPL __cap_get_file 368 AUE_NULL UNIMPL __cap_set_fd 369 AUE_NULL UNIMPL __cap_set_file -370 AUE_NULL UNIMPL lkmressys +370 AUE_NULL UNIMPL nosys 371 AUE_EXTATTR_SET_FD NOPROTO { int extattr_set_fd(int fd, \ int attrnamespace, const char *attrname, \ void *data, size_t nbytes); } Modified: stable/7/sys/kern/makesyscalls.sh ============================================================================== --- stable/7/sys/kern/makesyscalls.sh Fri Jul 24 19:12:19 2009 (r195853) +++ stable/7/sys/kern/makesyscalls.sh Fri Jul 24 19:35:06 2009 (r195854) @@ -213,6 +213,19 @@ s/\$//g print exit 1 } + # Returns true if the type "name" is the first flag in the type field + function type(name, flags, n) { + n = split($3, flags, /\|/) + return (n > 0 && flags[1] == name) + } + # Returns true if the flag "name" is set in the type field + function flag(name, flags, i, n) { + n = split($3, flags, /\|/) + for (i = 1; i <= n; i++) + if (flags[i] == name) + return 1 + return 0 + } function align_sysent_comment(column) { printf("\t") > sysent column = column + 8 - column % 8 @@ -241,7 +254,7 @@ s/\$//g rettype="int" end=NF } - if ($3 == "NODEF") { + if (flag("NODEF")) { auditev="AUE_NULL" funcname=$4 argssize = "AS(" $6 ")" @@ -267,11 +280,11 @@ s/\$//g funcalias = funcname if (argalias == "") { argalias = funcname "_args" - if ($3 == "COMPAT") + if (flag("COMPAT")) argalias = "o" argalias - if ($3 == "COMPAT4") + if (flag("COMPAT4")) argalias = "freebsd4_" argalias - if ($3 == "COMPAT6") + if (flag("COMPAT6")) argalias = "freebsd6_" argalias } f++ @@ -318,8 +331,8 @@ s/\$//g auditev = $2; } - $3 == "STD" || $3 == "NODEF" || $3 == "NOARGS" || $3 == "NOPROTO" \ - || $3 == "NOIMPL" || $3 == "NOSTD" { + type("STD") || type("NODEF") || type("NOARGS") || type("NOPROTO") \ + || type("NOSTD") { parseline() printf("\t/* %s */\n\tcase %d: {\n", funcname, syscall) > systrace printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > systracetmp @@ -345,43 +358,30 @@ s/\$//g } printf("\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", argc) > systrace printf("\t\tbreak;\n") > systracetmp - if ((!nosys || funcname != "nosys") && \ - (funcname != "lkmnosys") && (funcname != "lkmressys")) { - if (argc != 0 && $3 != "NOARGS" && $3 != "NOPROTO") { - printf("struct %s {\n", argalias) > sysarg - for (i = 1; i <= argc; i++) - printf("\tchar %s_l_[PADL_(%s)]; " \ - "%s %s; char %s_r_[PADR_(%s)];\n", - argname[i], argtype[i], - argtype[i], argname[i], - argname[i], argtype[i]) > sysarg - printf("};\n") > sysarg - } - else if ($3 != "NOARGS" && $3 != "NOPROTO" && \ - $3 != "NODEF") - printf("struct %s {\n\tregister_t dummy;\n};\n", - argalias) > sysarg - } - if (($3 != "NOPROTO" && $3 != "NODEF" && \ - (funcname != "nosys" || !nosys)) || \ - (funcname == "lkmnosys" && !lkmnosys) || \ - funcname == "lkmressys") { + if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \ + !flag("NODEF")) { + printf("struct %s {\n", argalias) > sysarg + for (i = 1; i <= argc; i++) + printf("\tchar %s_l_[PADL_(%s)]; " \ + "%s %s; char %s_r_[PADR_(%s)];\n", + argname[i], argtype[i], + argtype[i], argname[i], + argname[i], argtype[i]) > sysarg + printf("};\n") > sysarg + } + else if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF")) + printf("struct %s {\n\tregister_t dummy;\n};\n", + argalias) > sysarg + if (!flag("NOPROTO") && !flag("NODEF")) { printf("%s\t%s(struct thread *, struct %s *)", rettype, funcname, argalias) > sysdcl printf(";\n") > sysdcl printf("#define\t%sAUE_%s\t%s\n", syscallprefix, funcalias, auditev) > sysaue } - if (funcname == "nosys") - nosys = 1 - if (funcname == "lkmnosys") - lkmnosys = 1 printf("\t{ %s, (sy_call_t *)", argssize) > sysent column = 8 + 2 + length(argssize) + 15 - if ($3 == "NOIMPL") { - printf("%s },", "nosys, AUE_NULL, NULL, 0, 0") > sysent - column = column + length("nosys") + 3 - } else if ($3 == "NOSTD") { + if (flag("NOSTD")) { printf("%s },", "lkmressys, AUE_NULL, NULL, 0, 0") > sysent column = column + length("lkmressys") + 3 } else { @@ -392,7 +392,7 @@ s/\$//g printf("/* %d = %s */\n", syscall, funcalias) > sysent printf("\t\"%s\",\t\t\t/* %d = %s */\n", funcalias, syscall, funcalias) > sysnames - if ($3 != "NODEF") { + if (!flag("NODEF")) { printf("#define\t%s%s\t%d\n", syscallprefix, funcalias, syscall) > syshdr printf(" \\\n\t%s.o", funcalias) > sysmk @@ -400,28 +400,32 @@ s/\$//g syscall++ next } - $3 == "COMPAT" || $3 == "COMPAT4" || $3 == "COMPAT6" || $3 == "CPT_NOA" { - if ($3 == "COMPAT" || $3 == "CPT_NOA") { + type("COMPAT") || type("COMPAT4") || type("COMPAT6") { + if (flag("COMPAT")) { ncompat++ out = syscompat outdcl = syscompatdcl wrap = "compat" prefix = "o" - } else if ($3 == "COMPAT4") { + descr = "old" + } else if (flag("COMPAT4")) { ncompat4++ out = syscompat4 outdcl = syscompat4dcl wrap = "compat4" prefix = "freebsd4_" - } else if ($3 == "COMPAT6") { + descr = "freebsd4" + } else if (flag("COMPAT6")) { ncompat6++ out = syscompat6 outdcl = syscompat6dcl wrap = "compat6" prefix = "freebsd6_" + descr = "freebsd6" } parseline() - if (argc != 0 && $3 != "CPT_NOA") { + if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \ + !flag("NODEF")) { printf("struct %s {\n", argalias) > out for (i = 1; i <= argc; i++) printf("\tchar %s_l_[PADL_(%s)]; %s %s; " \ @@ -431,22 +435,33 @@ s/\$//g argname[i], argtype[i]) > out printf("};\n") > out } - else if($3 != "CPT_NOA") + else if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF")) printf("struct %s {\n\tregister_t dummy;\n};\n", argalias) > sysarg - printf("%s\t%s%s(struct thread *, struct %s *);\n", - rettype, prefix, funcname, argalias) > outdcl - printf("\t{ %s(%s,%s), %s, NULL, 0, 0 },", - wrap, argssize, funcname, auditev) > sysent - align_sysent_comment(8 + 9 + \ - length(argssize) + 1 + length(funcname) + length(auditev) + 4) - printf("/* %d = old %s */\n", syscall, funcalias) > sysent - printf("\t\"%s.%s\",\t\t/* %d = old %s */\n", - wrap, funcalias, syscall, funcalias) > sysnames - if ($3 == "COMPAT" || $3 == "CPT_NOA") { + if (!flag("NOPROTO") && !flag("NODEF")) { + printf("%s\t%s%s(struct thread *, struct %s *);\n", + rettype, prefix, funcname, argalias) > outdcl + printf("#define\t%sAUE_%s%s\t%s\n", syscallprefix, + prefix, funcname, auditev) > sysaue + } + if (flag("NOSTD")) { + printf("\t{ %s, (sy_call_t *)%s, %s, NULL, 0, 0 },", + "0", "lkmressys", "AUE_NULL") > sysent + align_sysent_comment(8 + 2 + length("0") + 15 + \ + length("lkmressys") + 3) + } else { + printf("\t{ %s(%s,%s), %s, NULL, 0, 0 },", + wrap, argssize, funcname, auditev) > sysent + align_sysent_comment(8 + 9 + length(argssize) + 1 + \ + length(funcname) + length(auditev) + 4) + } + printf("/* %d = %s %s */\n", syscall, descr, funcalias) > sysent + printf("\t\"%s.%s\",\t\t/* %d = %s %s */\n", + wrap, funcalias, syscall, descr, funcalias) > sysnames + if (flag("COMPAT")) { printf("\t\t\t\t/* %d is old %s */\n", syscall, funcalias) > syshdr - } else { + } else if (!flag("NODEF")) { printf("#define\t%s%s%s\t%d\n", syscallprefix, prefix, funcalias, syscall) > syshdr printf(" \\\n\t%s%s.o", prefix, funcalias) > sysmk @@ -454,7 +469,7 @@ s/\$//g syscall++ next } - $3 == "LIBCOMPAT" { + type("LIBCOMPAT") { ncompat++ parseline() printf("%s\to%s();\n", rettype, funcname) > syscompatdcl @@ -471,7 +486,7 @@ s/\$//g syscall++ next } - $3 == "OBSOL" { + type("OBSOL") { printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },") > sysent align_sysent_comment(34) printf("/* %d = obsolete %s */\n", syscall, comment) > sysent @@ -482,7 +497,7 @@ s/\$//g syscall++ next } - $3 == "UNIMPL" { + type("UNIMPL") { printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },\t\t\t/* %d = %s */\n", syscall, comment) > sysent printf("\t\"#%d\",\t\t\t/* %d = %s */\n", Modified: stable/7/sys/kern/syscalls.master ============================================================================== --- stable/7/sys/kern/syscalls.master Fri Jul 24 19:12:19 2009 (r195853) +++ stable/7/sys/kern/syscalls.master Fri Jul 24 19:35:06 2009 (r195854) @@ -11,8 +11,10 @@ ; there is no audit event for the call at this time. For the ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. -; type one of STD, OBSOL, UNIMPL, COMPAT, CPT_NOA, LIBCOMPAT, -; NODEF, NOARGS, NOPROTO, NOIMPL, NOSTD, COMPAT4 +; type one of STD, OBSOL, UNIMPL, COMPAT, COMPAT4, COMPAT6, +; LIBCOMPAT, NODEF, NOARGS, NOPROTO, NOSTD +; The COMPAT* options may be combined with one or more NO* +; options separated by '|' with no spaces (e.g. COMPAT|NOARGS) ; name psuedo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different @@ -24,15 +26,16 @@ ; STD always included ; COMPAT included on COMPAT #ifdef ; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat) +; COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat) ; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only ; NOSTD implemented but as a lkm that can be statically -; compiled in; sysent entry will be filled with lkmsys +; compiled in; sysent entry will be filled with lkmressys ; so the SYSCALL_MODULE macro works ; NOARGS same as STD except do not create structure in sys/sysproto.h ; NODEF same as STD except only have the entry in the syscall table -; added. Meaning - do do not create structure or function +; added. Meaning - do not create structure or function ; prototype in sys/sysproto.h ; NOPROTO same as STD except do not create structure or ; function prototype in sys/sysproto.h. Does add a @@ -214,7 +217,7 @@ int protocol); } 98 AUE_CONNECT STD { int connect(int s, caddr_t name, \ int namelen); } -99 AUE_ACCEPT CPT_NOA { int accept(int s, caddr_t name, \ +99 AUE_ACCEPT COMPAT|NOARGS { int accept(int s, caddr_t name, \ int *anamelen); } accept accept_args int 100 AUE_GETPRIORITY STD { int getpriority(int which, int who); } 101 AUE_SEND COMPAT { int send(int s, caddr_t buf, int len, \ @@ -258,7 +261,7 @@ struct timezone *tzp); } 123 AUE_FCHOWN STD { int fchown(int fd, int uid, int gid); } 124 AUE_FCHMOD STD { int fchmod(int fd, int mode); } -125 AUE_RECVFROM CPT_NOA { int recvfrom(int s, caddr_t buf, \ +125 AUE_RECVFROM COMPAT|NOARGS { int recvfrom(int s, caddr_t buf, \ size_t len, int flags, caddr_t from, int \ *fromlenaddr); } recvfrom recvfrom_args \ int @@ -294,7 +297,7 @@ 148 AUE_QUOTACTL STD { int quotactl(char *path, int cmd, int uid, \ caddr_t arg); } 149 AUE_O_QUOTA COMPAT { int quota(void); } -150 AUE_GETSOCKNAME CPT_NOA { int getsockname(int fdec, \ +150 AUE_GETSOCKNAME COMPAT|NOARGS { int getsockname(int fdec, \ caddr_t asa, int *alen); } getsockname \ getsockname_args int @@ -380,7 +383,7 @@ 197 AUE_MMAP STD { caddr_t freebsd6_mmap(caddr_t addr, \ size_t len, int prot, int flags, int fd, \ int pad, off_t pos); } -198 AUE_NULL STD { int nosys(void); } __syscall \ +198 AUE_NULL NOPROTO { int nosys(void); } __syscall \ __syscall_args int 199 AUE_LSEEK STD { off_t freebsd6_lseek(int fd, int pad, \ off_t offset, int whence); } @@ -657,7 +660,7 @@ 367 AUE_NULL UNIMPL __cap_get_file 368 AUE_NULL UNIMPL __cap_set_fd 369 AUE_NULL UNIMPL __cap_set_file -370 AUE_NULL NODEF lkmressys lkmressys nosys_args int +370 AUE_NULL UNIMPL nosys 371 AUE_EXTATTR_SET_FD STD { int extattr_set_fd(int fd, \ int attrnamespace, const char *attrname, \ void *data, size_t nbytes); } @@ -668,7 +671,7 @@ int attrnamespace, \ const char *attrname); } 374 AUE_NULL STD { int __setugid(int flag); } -375 AUE_NULL NOIMPL { int nfsclnt(int flag, caddr_t argp); } +375 AUE_NULL UNIMPL nfsclnt 376 AUE_EACCESS STD { int eaccess(char *path, int flags); } 377 AUE_NULL UNIMPL afs_syscall 378 AUE_NMOUNT STD { int nmount(struct iovec *iovp, \ Modified: stable/7/sys/sys/sysent.h ============================================================================== --- stable/7/sys/sys/sysent.h Fri Jul 24 19:12:19 2009 (r195853) +++ stable/7/sys/sys/sysent.h Fri Jul 24 19:35:06 2009 (r195854) @@ -158,6 +158,12 @@ int syscall_register(int *offset, str int syscall_deregister(int *offset, struct sysent *old_sysent); int syscall_module_handler(struct module *mod, int what, void *arg); +/* Special purpose system call functions. */ +struct nosys_args; + +int lkmnosys(struct thread *, struct nosys_args *); +int lkmressys(struct thread *, struct nosys_args *); + #endif /* _KERNEL */ #endif /* !_SYS_SYSENT_H_ */ From gad at FreeBSD.org Fri Jul 24 20:35:45 2009 From: gad at FreeBSD.org (Garance A Drosehn) Date: Fri Jul 24 20:35:51 2009 Subject: svn commit: r195855 - in stable/7/usr.sbin/lpr: . common_source Message-ID: <200907242035.n6OKZiNF020486@svn.freebsd.org> Author: gad Date: Fri Jul 24 20:35:44 2009 New Revision: 195855 URL: http://svn.freebsd.org/changeset/base/195855 Log: MFC: Fix end-of-line issues that can come up when `lpq' reads information about a queue from a remote host. PR: bin/104731 Modified: stable/7/usr.sbin/lpr/ (props changed) stable/7/usr.sbin/lpr/common_source/displayq.c Modified: stable/7/usr.sbin/lpr/common_source/displayq.c ============================================================================== --- stable/7/usr.sbin/lpr/common_source/displayq.c Fri Jul 24 19:35:06 2009 (r195854) +++ stable/7/usr.sbin/lpr/common_source/displayq.c Fri Jul 24 20:35:44 2009 (r195855) @@ -69,6 +69,13 @@ __FBSDID("$FreeBSD$"); #define SIZCOL 62 /* start of Size column in normal */ /* + * isprint() takes a parameter of 'int', but expect values in the range + * of unsigned char. Define a wrapper which takes a value of type 'char', + * whether signed or unsigned, and ensure it ends up in the right range. + */ +#define isprintch(Anychar) isprint((u_char)(Anychar)) + +/* * Stuff for handling job specifications */ extern uid_t uid, euid; @@ -86,6 +93,7 @@ static const char *head0 = "Rank Owne static const char *head1 = "Total Size\n"; static void alarmhandler(int _signo); +static void filtered_write(char *_obuffer, int _wlen, FILE *_wstream); static void warn(const struct printer *_pp); /* @@ -254,12 +262,105 @@ displayq(struct printer *pp, int format) if (write(fd, line, i) != i) fatal(pp, "Lost connection"); while ((i = read(fd, line, sizeof(line))) > 0) - (void) fwrite(line, 1, i, stdout); + filtered_write(line, i, stdout); + filtered_write(NULL, -1, stdout); (void) close(fd); } } /* + * The lpq-info read from remote hosts may contain unprintable characters, + * or carriage-returns instead of line-feeds. Clean those up before echoing + * the lpq-info line(s) to stdout. The info may also be missing any kind of + * end-of-line character. This also turns CRLF and LFCR into a plain LF. + * + * This routine may be called multiple times to process a single set of + * information, and after a set is finished this routine must be called + * one extra time with NULL specified as the buffer address. + */ +static void +filtered_write(char *wbuffer, int wlen, FILE *wstream) +{ + static char lastchar, savedchar; + char *chkptr, *dest_end, *dest_ch, *nxtptr, *w_end; + int destlen; + char destbuf[BUFSIZ]; + + if (wbuffer == NULL) { + if (savedchar != '\0') { + if (savedchar == '\r') + savedchar = '\n'; + fputc(savedchar, wstream); + lastchar = savedchar; + savedchar = '\0'; + } + if (lastchar != '\0' && lastchar != '\n') + fputc('\n', wstream); + lastchar = '\0'; + return; + } + + dest_ch = &destbuf[0]; + dest_end = dest_ch + sizeof(destbuf); + chkptr = wbuffer; + w_end = wbuffer + wlen; + lastchar = '\0'; + if (savedchar != '\0') { + chkptr = &savedchar; + nxtptr = wbuffer; + } else + nxtptr = chkptr + 1; + + while (chkptr < w_end) { + if (nxtptr < w_end) { + if ((*chkptr == '\r' && *nxtptr == '\n') || + (*chkptr == '\n' && *nxtptr == '\r')) { + *dest_ch++ = '\n'; + /* want to skip past that second character */ + nxtptr++; + goto check_next; + } + } else { + /* This is the last byte in the buffer given on this + * call, so check if it could be the first-byte of a + * significant two-byte sequence. If it is, then + * don't write it out now, but save for checking in + * the next call. + */ + savedchar = '\0'; + if (*chkptr == '\r' || *chkptr == '\n') { + savedchar = *chkptr; + break; + } + } + if (*chkptr == '\r') + *dest_ch++ = '\n'; +#if 0 /* XXX - don't translate unprintable characters (yet) */ + else if (*chkptr != '\t' && *chkptr != '\n' && + !isprintch(*chkptr)) + *dest_ch++ = '?'; +#endif + else + *dest_ch++ = *chkptr; + +check_next: + chkptr = nxtptr; + nxtptr = chkptr + 1; + if (dest_ch >= dest_end) { + destlen = dest_ch - &destbuf[0]; + fwrite(destbuf, 1, destlen, wstream); + lastchar = destbuf[destlen - 1]; + dest_ch = &destbuf[0]; + } + } + destlen = dest_ch - &destbuf[0]; + if (destlen > 0) { + fwrite(destbuf, 1, destlen, wstream); + lastchar = destbuf[destlen - 1]; + } +} + +/* * Print a warning message if there is no daemon present. */ static void From jhb at FreeBSD.org Fri Jul 24 21:30:11 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Fri Jul 24 21:30:36 2009 Subject: svn commit: r195856 - in stable/7/sys: compat/freebsd32 kern sys Message-ID: <200907242130.n6OLUAc8021667@svn.freebsd.org> Author: jhb Date: Fri Jul 24 21:30:10 2009 New Revision: 195856 URL: http://svn.freebsd.org/changeset/base/195856 Log: Regen. Modified: stable/7/sys/compat/freebsd32/freebsd32_proto.h stable/7/sys/compat/freebsd32/freebsd32_syscall.h stable/7/sys/compat/freebsd32/freebsd32_syscalls.c stable/7/sys/compat/freebsd32/freebsd32_sysent.c stable/7/sys/kern/init_sysent.c stable/7/sys/kern/syscalls.c stable/7/sys/kern/systrace_args.c stable/7/sys/sys/syscall.h stable/7/sys/sys/syscall.mk stable/7/sys/sys/sysproto.h Modified: stable/7/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_proto.h Fri Jul 24 20:35:44 2009 (r195855) +++ stable/7/sys/compat/freebsd32/freebsd32_proto.h Fri Jul 24 21:30:10 2009 (r195856) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195694 2009-07-14 19:48:31Z jhb + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195854 2009-07-24 19:35:06Z jhb */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -647,15 +647,24 @@ int freebsd6_freebsd32_ftruncate(struct #endif /* COMPAT_FREEBSD6 */ #define FREEBSD32_SYS_AUE_freebsd32_wait4 AUE_WAIT4 +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_getfsstat AUE_GETFSSTAT #define FREEBSD32_SYS_AUE_freebsd32_recvmsg AUE_RECVMSG #define FREEBSD32_SYS_AUE_freebsd32_sendmsg AUE_SENDMSG #define FREEBSD32_SYS_AUE_freebsd32_recvfrom AUE_RECVFROM +#define FREEBSD32_SYS_AUE_ofreebsd32_sigaction AUE_SIGACTION +#define FREEBSD32_SYS_AUE_ofreebsd32_sigprocmask AUE_SIGPROCMASK +#define FREEBSD32_SYS_AUE_ofreebsd32_sigpending AUE_SIGPENDING #define FREEBSD32_SYS_AUE_freebsd32_sigaltstack AUE_SIGALTSTACK #define FREEBSD32_SYS_AUE_freebsd32_ioctl AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_execve AUE_EXECVE #define FREEBSD32_SYS_AUE_freebsd32_setitimer AUE_SETITIMER #define FREEBSD32_SYS_AUE_freebsd32_getitimer AUE_GETITIMER #define FREEBSD32_SYS_AUE_freebsd32_select AUE_SELECT +#define FREEBSD32_SYS_AUE_ofreebsd32_sigvec AUE_O_SIGVEC +#define FREEBSD32_SYS_AUE_ofreebsd32_sigblock AUE_O_SIGBLOCK +#define FREEBSD32_SYS_AUE_ofreebsd32_sigsetmask AUE_O_SIGSETMASK +#define FREEBSD32_SYS_AUE_ofreebsd32_sigsuspend AUE_SIGSUSPEND +#define FREEBSD32_SYS_AUE_ofreebsd32_sigstack AUE_O_SIGSTACK #define FREEBSD32_SYS_AUE_freebsd32_gettimeofday AUE_GETTIMEOFDAY #define FREEBSD32_SYS_AUE_freebsd32_getrusage AUE_GETRUSAGE #define FREEBSD32_SYS_AUE_freebsd32_readv AUE_READV @@ -663,13 +672,21 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_settimeofday AUE_SETTIMEOFDAY #define FREEBSD32_SYS_AUE_freebsd32_utimes AUE_UTIMES #define FREEBSD32_SYS_AUE_freebsd32_adjtime AUE_ADJTIME +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_statfs AUE_STATFS +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_fstatfs AUE_FSTATFS #define FREEBSD32_SYS_AUE_freebsd32_semsys AUE_SEMSYS #define FREEBSD32_SYS_AUE_freebsd32_msgsys AUE_MSGSYS #define FREEBSD32_SYS_AUE_freebsd32_shmsys AUE_SHMSYS +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_pread AUE_PREAD +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_pwrite AUE_PWRITE #define FREEBSD32_SYS_AUE_freebsd32_stat AUE_STAT #define FREEBSD32_SYS_AUE_freebsd32_fstat AUE_FSTAT #define FREEBSD32_SYS_AUE_freebsd32_lstat AUE_LSTAT #define FREEBSD32_SYS_AUE_freebsd32_getdirentries AUE_GETDIRENTRIES +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_mmap AUE_MMAP +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_lseek AUE_LSEEK +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_truncate AUE_TRUNCATE +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_ftruncate AUE_FTRUNCATE #define FREEBSD32_SYS_AUE_freebsd32_sysctl AUE_SYSCTL #define FREEBSD32_SYS_AUE_freebsd32_futimes AUE_FUTIMES #define FREEBSD32_SYS_AUE_freebsd32_semctl AUE_SEMCTL @@ -687,6 +704,7 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_lutimes AUE_LUTIMES #define FREEBSD32_SYS_AUE_freebsd32_preadv AUE_PREADV #define FREEBSD32_SYS_AUE_freebsd32_pwritev AUE_PWRITEV +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_fhstatfs AUE_FHSTATFS #define FREEBSD32_SYS_AUE_freebsd32_modstat AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_aio_return AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_aio_suspend AUE_NULL @@ -695,7 +713,10 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_oaio_read AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_oaio_write AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_olio_listio AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_sendfile AUE_SENDFILE #define FREEBSD32_SYS_AUE_freebsd32_jail AUE_JAIL +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_sigaction AUE_SIGACTION +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_sigreturn AUE_SIGRETURN #define FREEBSD32_SYS_AUE_freebsd32_sigtimedwait AUE_SIGWAIT #define FREEBSD32_SYS_AUE_freebsd32_sigwaitinfo AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_aio_waitcomplete AUE_NULL Modified: stable/7/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_syscall.h Fri Jul 24 20:35:44 2009 (r195855) +++ stable/7/sys/compat/freebsd32/freebsd32_syscall.h Fri Jul 24 21:30:10 2009 (r195856) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195694 2009-07-14 19:48:31Z jhb + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195854 2009-07-24 19:35:06Z jhb */ #define FREEBSD32_SYS_syscall 0 Modified: stable/7/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jul 24 20:35:44 2009 (r195855) +++ stable/7/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jul 24 21:30:10 2009 (r195856) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195694 2009-07-14 19:48:31Z jhb + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195854 2009-07-24 19:35:06Z jhb */ const char *freebsd32_syscallnames[] = { @@ -25,7 +25,7 @@ const char *freebsd32_syscallnames[] = { "chmod", /* 15 = chmod */ "chown", /* 16 = chown */ "break", /* 17 = break */ - "compat4.freebsd32_getfsstat", /* 18 = old freebsd32_getfsstat */ + "compat4.freebsd32_getfsstat", /* 18 = freebsd4 freebsd32_getfsstat */ "obs_olseek", /* 19 = obsolete olseek */ "getpid", /* 20 = getpid */ "mount", /* 21 = mount */ @@ -164,8 +164,8 @@ const char *freebsd32_syscallnames[] = { "#154", /* 154 = nlm_syscall */ "#155", /* 155 = nfssvc */ "obs_ogetdirentries", /* 156 = obsolete ogetdirentries */ - "compat4.freebsd32_statfs", /* 157 = old freebsd32_statfs */ - "compat4.freebsd32_fstatfs", /* 158 = old freebsd32_fstatfs */ + "compat4.freebsd32_statfs", /* 157 = freebsd4 freebsd32_statfs */ + "compat4.freebsd32_fstatfs", /* 158 = freebsd4 freebsd32_fstatfs */ "#159", /* 159 = nosys */ "#160", /* 160 = lgetfh */ "getfh", /* 161 = getfh */ @@ -180,8 +180,8 @@ const char *freebsd32_syscallnames[] = { "freebsd32_msgsys", /* 170 = freebsd32_msgsys */ "freebsd32_shmsys", /* 171 = freebsd32_shmsys */ "#172", /* 172 = nosys */ - "compat6.freebsd32_pread", /* 173 = old freebsd32_pread */ - "compat6.freebsd32_pwrite", /* 174 = old freebsd32_pwrite */ + "compat6.freebsd32_pread", /* 173 = freebsd6 freebsd32_pread */ + "compat6.freebsd32_pwrite", /* 174 = freebsd6 freebsd32_pwrite */ "#175", /* 175 = nosys */ "ntp_adjtime", /* 176 = ntp_adjtime */ "#177", /* 177 = sfork */ @@ -204,11 +204,11 @@ const char *freebsd32_syscallnames[] = { "getrlimit", /* 194 = getrlimit */ "setrlimit", /* 195 = setrlimit */ "freebsd32_getdirentries", /* 196 = freebsd32_getdirentries */ - "compat6.freebsd32_mmap", /* 197 = old freebsd32_mmap */ + "compat6.freebsd32_mmap", /* 197 = freebsd6 freebsd32_mmap */ "__syscall", /* 198 = __syscall */ - "compat6.freebsd32_lseek", /* 199 = old freebsd32_lseek */ - "compat6.freebsd32_truncate", /* 200 = old freebsd32_truncate */ - "compat6.freebsd32_ftruncate", /* 201 = old freebsd32_ftruncate */ + "compat6.freebsd32_lseek", /* 199 = freebsd6 freebsd32_lseek */ + "compat6.freebsd32_truncate", /* 200 = freebsd6 freebsd32_truncate */ + "compat6.freebsd32_ftruncate", /* 201 = freebsd6 freebsd32_ftruncate */ "freebsd32_sysctl", /* 202 = freebsd32_sysctl */ "mlock", /* 203 = mlock */ "munlock", /* 204 = munlock */ @@ -217,16 +217,16 @@ const char *freebsd32_syscallnames[] = { "getpgid", /* 207 = getpgid */ "#208", /* 208 = newreboot */ "poll", /* 209 = poll */ - "#210", /* 210 = */ - "#211", /* 211 = */ - "#212", /* 212 = */ - "#213", /* 213 = */ - "#214", /* 214 = */ - "#215", /* 215 = */ - "#216", /* 216 = */ - "#217", /* 217 = */ - "#218", /* 218 = */ - "#219", /* 219 = */ + "lkmnosys", /* 210 = lkmnosys */ + "lkmnosys", /* 211 = lkmnosys */ + "lkmnosys", /* 212 = lkmnosys */ + "lkmnosys", /* 213 = lkmnosys */ + "lkmnosys", /* 214 = lkmnosys */ + "lkmnosys", /* 215 = lkmnosys */ + "lkmnosys", /* 216 = lkmnosys */ + "lkmnosys", /* 217 = lkmnosys */ + "lkmnosys", /* 218 = lkmnosys */ + "lkmnosys", /* 219 = lkmnosys */ "freebsd32_semctl", /* 220 = freebsd32_semctl */ "semget", /* 221 = semget */ "semop", /* 222 = semop */ @@ -304,7 +304,7 @@ const char *freebsd32_syscallnames[] = { "#294", /* 294 = nosys */ "#295", /* 295 = nosys */ "#296", /* 296 = nosys */ - "compat4.freebsd32_fhstatfs", /* 297 = old freebsd32_fhstatfs */ + "compat4.freebsd32_fhstatfs", /* 297 = freebsd4 freebsd32_fhstatfs */ "fhopen", /* 298 = fhopen */ "fhstat", /* 299 = fhstat */ "modnext", /* 300 = modnext */ @@ -343,15 +343,15 @@ const char *freebsd32_syscallnames[] = { "sched_get_priority_min", /* 333 = sched_get_priority_min */ "sched_rr_get_interval", /* 334 = sched_rr_get_interval */ "utrace", /* 335 = utrace */ - "compat4.freebsd32_sendfile", /* 336 = old freebsd32_sendfile */ + "compat4.freebsd32_sendfile", /* 336 = freebsd4 freebsd32_sendfile */ "kldsym", /* 337 = kldsym */ "freebsd32_jail", /* 338 = freebsd32_jail */ "#339", /* 339 = pioctl */ "sigprocmask", /* 340 = sigprocmask */ "sigsuspend", /* 341 = sigsuspend */ - "compat4.freebsd32_sigaction", /* 342 = old freebsd32_sigaction */ + "compat4.freebsd32_sigaction", /* 342 = freebsd4 freebsd32_sigaction */ "sigpending", /* 343 = sigpending */ - "compat4.freebsd32_sigreturn", /* 344 = old freebsd32_sigreturn */ + "compat4.freebsd32_sigreturn", /* 344 = freebsd4 freebsd32_sigreturn */ "freebsd32_sigtimedwait", /* 345 = freebsd32_sigtimedwait */ "freebsd32_sigwaitinfo", /* 346 = freebsd32_sigwaitinfo */ "__acl_get_file", /* 347 = __acl_get_file */ @@ -377,7 +377,7 @@ const char *freebsd32_syscallnames[] = { "#367", /* 367 = __cap_get_file */ "#368", /* 368 = __cap_set_fd */ "#369", /* 369 = __cap_set_file */ - "#370", /* 370 = lkmressys */ + "#370", /* 370 = nosys */ "extattr_set_fd", /* 371 = extattr_set_fd */ "extattr_get_fd", /* 372 = extattr_get_fd */ "extattr_delete_fd", /* 373 = extattr_delete_fd */ Modified: stable/7/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_sysent.c Fri Jul 24 20:35:44 2009 (r195855) +++ stable/7/sys/compat/freebsd32/freebsd32_sysent.c Fri Jul 24 21:30:10 2009 (r195856) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195694 2009-07-14 19:48:31Z jhb + * created from FreeBSD: stable/7/sys/compat/freebsd32/syscalls.master 195854 2009-07-24 19:35:06Z jhb */ #include "opt_compat.h" @@ -56,7 +56,7 @@ struct sysent freebsd32_sysent[] = { { AS(chmod_args), (sy_call_t *)chmod, AUE_CHMOD, NULL, 0, 0 }, /* 15 = chmod */ { AS(chown_args), (sy_call_t *)chown, AUE_CHOWN, NULL, 0, 0 }, /* 16 = chown */ { AS(obreak_args), (sy_call_t *)obreak, AUE_NULL, NULL, 0, 0 }, /* 17 = break */ - { compat4(AS(freebsd4_freebsd32_getfsstat_args),freebsd32_getfsstat), AUE_GETFSSTAT, NULL, 0, 0 }, /* 18 = old freebsd32_getfsstat */ + { compat4(AS(freebsd4_freebsd32_getfsstat_args),freebsd32_getfsstat), AUE_GETFSSTAT, NULL, 0, 0 }, /* 18 = freebsd4 freebsd32_getfsstat */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 19 = obsolete olseek */ { 0, (sy_call_t *)getpid, AUE_GETPID, NULL, 0, 0 }, /* 20 = getpid */ { AS(mount_args), (sy_call_t *)mount, AUE_MOUNT, NULL, 0, 0 }, /* 21 = mount */ @@ -195,8 +195,8 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 154 = nlm_syscall */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 155 = nfssvc */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 156 = obsolete ogetdirentries */ - { compat4(AS(freebsd4_freebsd32_statfs_args),freebsd32_statfs), AUE_STATFS, NULL, 0, 0 }, /* 157 = old freebsd32_statfs */ - { compat4(AS(freebsd4_freebsd32_fstatfs_args),freebsd32_fstatfs), AUE_FSTATFS, NULL, 0, 0 }, /* 158 = old freebsd32_fstatfs */ + { compat4(AS(freebsd4_freebsd32_statfs_args),freebsd32_statfs), AUE_STATFS, NULL, 0, 0 }, /* 157 = freebsd4 freebsd32_statfs */ + { compat4(AS(freebsd4_freebsd32_fstatfs_args),freebsd32_fstatfs), AUE_FSTATFS, NULL, 0, 0 }, /* 158 = freebsd4 freebsd32_fstatfs */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 159 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 160 = lgetfh */ { AS(getfh_args), (sy_call_t *)getfh, AUE_NFS_GETFH, NULL, 0, 0 }, /* 161 = getfh */ @@ -211,8 +211,8 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_msgsys_args), (sy_call_t *)freebsd32_msgsys, AUE_MSGSYS, NULL, 0, 0 }, /* 170 = freebsd32_msgsys */ { AS(freebsd32_shmsys_args), (sy_call_t *)freebsd32_shmsys, AUE_SHMSYS, NULL, 0, 0 }, /* 171 = freebsd32_shmsys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 172 = nosys */ - { compat6(AS(freebsd6_freebsd32_pread_args),freebsd32_pread), AUE_PREAD, NULL, 0, 0 }, /* 173 = old freebsd32_pread */ - { compat6(AS(freebsd6_freebsd32_pwrite_args),freebsd32_pwrite), AUE_PWRITE, NULL, 0, 0 }, /* 174 = old freebsd32_pwrite */ + { compat6(AS(freebsd6_freebsd32_pread_args),freebsd32_pread), AUE_PREAD, NULL, 0, 0 }, /* 173 = freebsd6 freebsd32_pread */ + { compat6(AS(freebsd6_freebsd32_pwrite_args),freebsd32_pwrite), AUE_PWRITE, NULL, 0, 0 }, /* 174 = freebsd6 freebsd32_pwrite */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 175 = nosys */ { AS(ntp_adjtime_args), (sy_call_t *)ntp_adjtime, AUE_NTP_ADJTIME, NULL, 0, 0 }, /* 176 = ntp_adjtime */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 177 = sfork */ @@ -235,11 +235,11 @@ struct sysent freebsd32_sysent[] = { { AS(__getrlimit_args), (sy_call_t *)getrlimit, AUE_GETRLIMIT, NULL, 0, 0 }, /* 194 = getrlimit */ { AS(__setrlimit_args), (sy_call_t *)setrlimit, AUE_SETRLIMIT, NULL, 0, 0 }, /* 195 = setrlimit */ { AS(freebsd32_getdirentries_args), (sy_call_t *)freebsd32_getdirentries, AUE_GETDIRENTRIES, NULL, 0, 0 }, /* 196 = freebsd32_getdirentries */ - { compat6(AS(freebsd6_freebsd32_mmap_args),freebsd32_mmap), AUE_MMAP, NULL, 0, 0 }, /* 197 = old freebsd32_mmap */ + { compat6(AS(freebsd6_freebsd32_mmap_args),freebsd32_mmap), AUE_MMAP, NULL, 0, 0 }, /* 197 = freebsd6 freebsd32_mmap */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 198 = __syscall */ - { compat6(AS(freebsd6_freebsd32_lseek_args),freebsd32_lseek), AUE_LSEEK, NULL, 0, 0 }, /* 199 = old freebsd32_lseek */ - { compat6(AS(freebsd6_freebsd32_truncate_args),freebsd32_truncate), AUE_TRUNCATE, NULL, 0, 0 }, /* 200 = old freebsd32_truncate */ - { compat6(AS(freebsd6_freebsd32_ftruncate_args),freebsd32_ftruncate), AUE_FTRUNCATE, NULL, 0, 0 }, /* 201 = old freebsd32_ftruncate */ + { compat6(AS(freebsd6_freebsd32_lseek_args),freebsd32_lseek), AUE_LSEEK, NULL, 0, 0 }, /* 199 = freebsd6 freebsd32_lseek */ + { compat6(AS(freebsd6_freebsd32_truncate_args),freebsd32_truncate), AUE_TRUNCATE, NULL, 0, 0 }, /* 200 = freebsd6 freebsd32_truncate */ + { compat6(AS(freebsd6_freebsd32_ftruncate_args),freebsd32_ftruncate), AUE_FTRUNCATE, NULL, 0, 0 }, /* 201 = freebsd6 freebsd32_ftruncate */ { AS(freebsd32_sysctl_args), (sy_call_t *)freebsd32_sysctl, AUE_SYSCTL, NULL, 0, 0 }, /* 202 = freebsd32_sysctl */ { AS(mlock_args), (sy_call_t *)mlock, AUE_MLOCK, NULL, 0, 0 }, /* 203 = mlock */ { AS(munlock_args), (sy_call_t *)munlock, AUE_MUNLOCK, NULL, 0, 0 }, /* 204 = munlock */ @@ -248,16 +248,16 @@ struct sysent freebsd32_sysent[] = { { AS(getpgid_args), (sy_call_t *)getpgid, AUE_GETPGID, NULL, 0, 0 }, /* 207 = getpgid */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 208 = newreboot */ { AS(poll_args), (sy_call_t *)poll, AUE_POLL, NULL, 0, 0 }, /* 209 = poll */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 210 = */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 211 = */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 212 = */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 213 = */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 214 = */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 215 = */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 216 = */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 217 = */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 218 = */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 219 = */ + { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0 }, /* 210 = lkmnosys */ + { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0 }, /* 211 = lkmnosys */ + { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0 }, /* 212 = lkmnosys */ + { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0 }, /* 213 = lkmnosys */ + { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0 }, /* 214 = lkmnosys */ + { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0 }, /* 215 = lkmnosys */ + { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0 }, /* 216 = lkmnosys */ + { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0 }, /* 217 = lkmnosys */ + { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0 }, /* 218 = lkmnosys */ + { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0 }, /* 219 = lkmnosys */ { AS(freebsd32_semctl_args), (sy_call_t *)freebsd32_semctl, AUE_SEMCTL, NULL, 0, 0 }, /* 220 = freebsd32_semctl */ { AS(semget_args), (sy_call_t *)semget, AUE_SEMGET, NULL, 0, 0 }, /* 221 = semget */ { AS(semop_args), (sy_call_t *)semop, AUE_SEMOP, NULL, 0, 0 }, /* 222 = semop */ @@ -335,7 +335,7 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 294 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 295 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 296 = nosys */ - { compat4(AS(freebsd4_freebsd32_fhstatfs_args),freebsd32_fhstatfs), AUE_FHSTATFS, NULL, 0, 0 }, /* 297 = old freebsd32_fhstatfs */ + { compat4(AS(freebsd4_freebsd32_fhstatfs_args),freebsd32_fhstatfs), AUE_FHSTATFS, NULL, 0, 0 }, /* 297 = freebsd4 freebsd32_fhstatfs */ { AS(fhopen_args), (sy_call_t *)fhopen, AUE_FHOPEN, NULL, 0, 0 }, /* 298 = fhopen */ { AS(fhstat_args), (sy_call_t *)fhstat, AUE_FHSTAT, NULL, 0, 0 }, /* 299 = fhstat */ { AS(modnext_args), (sy_call_t *)modnext, AUE_NULL, NULL, 0, 0 }, /* 300 = modnext */ @@ -374,15 +374,15 @@ struct sysent freebsd32_sysent[] = { { AS(sched_get_priority_min_args), (sy_call_t *)sched_get_priority_min, AUE_NULL, NULL, 0, 0 }, /* 333 = sched_get_priority_min */ { AS(sched_rr_get_interval_args), (sy_call_t *)sched_rr_get_interval, AUE_NULL, NULL, 0, 0 }, /* 334 = sched_rr_get_interval */ { AS(utrace_args), (sy_call_t *)utrace, AUE_NULL, NULL, 0, 0 }, /* 335 = utrace */ - { compat4(AS(freebsd4_freebsd32_sendfile_args),freebsd32_sendfile), AUE_SENDFILE, NULL, 0, 0 }, /* 336 = old freebsd32_sendfile */ + { compat4(AS(freebsd4_freebsd32_sendfile_args),freebsd32_sendfile), AUE_SENDFILE, NULL, 0, 0 }, /* 336 = freebsd4 freebsd32_sendfile */ { AS(kldsym_args), (sy_call_t *)kldsym, AUE_NULL, NULL, 0, 0 }, /* 337 = kldsym */ { AS(freebsd32_jail_args), (sy_call_t *)freebsd32_jail, AUE_JAIL, NULL, 0, 0 }, /* 338 = freebsd32_jail */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 339 = pioctl */ { AS(sigprocmask_args), (sy_call_t *)sigprocmask, AUE_SIGPROCMASK, NULL, 0, 0 }, /* 340 = sigprocmask */ { AS(sigsuspend_args), (sy_call_t *)sigsuspend, AUE_SIGSUSPEND, NULL, 0, 0 }, /* 341 = sigsuspend */ - { compat4(AS(freebsd4_freebsd32_sigaction_args),freebsd32_sigaction), AUE_SIGACTION, NULL, 0, 0 }, /* 342 = old freebsd32_sigaction */ + { compat4(AS(freebsd4_freebsd32_sigaction_args),freebsd32_sigaction), AUE_SIGACTION, NULL, 0, 0 }, /* 342 = freebsd4 freebsd32_sigaction */ { AS(sigpending_args), (sy_call_t *)sigpending, AUE_SIGPENDING, NULL, 0, 0 }, /* 343 = sigpending */ - { compat4(AS(freebsd4_freebsd32_sigreturn_args),freebsd32_sigreturn), AUE_SIGRETURN, NULL, 0, 0 }, /* 344 = old freebsd32_sigreturn */ + { compat4(AS(freebsd4_freebsd32_sigreturn_args),freebsd32_sigreturn), AUE_SIGRETURN, NULL, 0, 0 }, /* 344 = freebsd4 freebsd32_sigreturn */ { AS(freebsd32_sigtimedwait_args), (sy_call_t *)freebsd32_sigtimedwait, AUE_SIGWAIT, NULL, 0, 0 }, /* 345 = freebsd32_sigtimedwait */ { AS(freebsd32_sigwaitinfo_args), (sy_call_t *)freebsd32_sigwaitinfo, AUE_NULL, NULL, 0, 0 }, /* 346 = freebsd32_sigwaitinfo */ { AS(__acl_get_file_args), (sy_call_t *)__acl_get_file, AUE_NULL, NULL, 0, 0 }, /* 347 = __acl_get_file */ @@ -408,7 +408,7 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 367 = __cap_get_file */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 368 = __cap_set_fd */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 369 = __cap_set_file */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 370 = lkmressys */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 370 = nosys */ { AS(extattr_set_fd_args), (sy_call_t *)extattr_set_fd, AUE_EXTATTR_SET_FD, NULL, 0, 0 }, /* 371 = extattr_set_fd */ { AS(extattr_get_fd_args), (sy_call_t *)extattr_get_fd, AUE_EXTATTR_GET_FD, NULL, 0, 0 }, /* 372 = extattr_get_fd */ { AS(extattr_delete_fd_args), (sy_call_t *)extattr_delete_fd, AUE_EXTATTR_DELETE_FD, NULL, 0, 0 }, /* 373 = extattr_delete_fd */ Modified: stable/7/sys/kern/init_sysent.c ============================================================================== --- stable/7/sys/kern/init_sysent.c Fri Jul 24 20:35:44 2009 (r195855) +++ stable/7/sys/kern/init_sysent.c Fri Jul 24 21:30:10 2009 (r195856) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/kern/syscalls.master 195694 2009-07-14 19:48:31Z jhb + * created from FreeBSD: stable/7/sys/kern/syscalls.master 195854 2009-07-24 19:35:06Z jhb */ #include "opt_compat.h" @@ -46,7 +46,7 @@ struct sysent sysent[] = { { AS(chmod_args), (sy_call_t *)chmod, AUE_CHMOD, NULL, 0, 0 }, /* 15 = chmod */ { AS(chown_args), (sy_call_t *)chown, AUE_CHOWN, NULL, 0, 0 }, /* 16 = chown */ { AS(obreak_args), (sy_call_t *)obreak, AUE_NULL, NULL, 0, 0 }, /* 17 = break */ - { compat4(AS(freebsd4_getfsstat_args),getfsstat), AUE_GETFSSTAT, NULL, 0, 0 }, /* 18 = old getfsstat */ + { compat4(AS(freebsd4_getfsstat_args),getfsstat), AUE_GETFSSTAT, NULL, 0, 0 }, /* 18 = freebsd4 getfsstat */ { compat(AS(olseek_args),lseek), AUE_LSEEK, NULL, 0, 0 }, /* 19 = old lseek */ { 0, (sy_call_t *)getpid, AUE_GETPID, NULL, 0, 0 }, /* 20 = getpid */ { AS(mount_args), (sy_call_t *)mount, AUE_MOUNT, NULL, 0, 0 }, /* 21 = mount */ @@ -185,8 +185,8 @@ struct sysent sysent[] = { { AS(nlm_syscall_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 154 = nlm_syscall */ { AS(nfssvc_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 155 = nfssvc */ { compat(AS(ogetdirentries_args),getdirentries), AUE_GETDIRENTRIES, NULL, 0, 0 }, /* 156 = old getdirentries */ - { compat4(AS(freebsd4_statfs_args),statfs), AUE_STATFS, NULL, 0, 0 }, /* 157 = old statfs */ - { compat4(AS(freebsd4_fstatfs_args),fstatfs), AUE_FSTATFS, NULL, 0, 0 }, /* 158 = old fstatfs */ + { compat4(AS(freebsd4_statfs_args),statfs), AUE_STATFS, NULL, 0, 0 }, /* 157 = freebsd4 statfs */ + { compat4(AS(freebsd4_fstatfs_args),fstatfs), AUE_FSTATFS, NULL, 0, 0 }, /* 158 = freebsd4 fstatfs */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 159 = nosys */ { AS(lgetfh_args), (sy_call_t *)lgetfh, AUE_LGETFH, NULL, 0, 0 }, /* 160 = lgetfh */ { AS(getfh_args), (sy_call_t *)getfh, AUE_NFS_GETFH, NULL, 0, 0 }, /* 161 = getfh */ @@ -325,7 +325,7 @@ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 294 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 295 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 296 = nosys */ - { compat4(AS(freebsd4_fhstatfs_args),fhstatfs), AUE_FHSTATFS, NULL, 0, 0 }, /* 297 = old fhstatfs */ + { compat4(AS(freebsd4_fhstatfs_args),fhstatfs), AUE_FHSTATFS, NULL, 0, 0 }, /* 297 = freebsd4 fhstatfs */ { AS(fhopen_args), (sy_call_t *)fhopen, AUE_FHOPEN, NULL, 0, 0 }, /* 298 = fhopen */ { AS(fhstat_args), (sy_call_t *)fhstat, AUE_FHSTAT, NULL, 0, 0 }, /* 299 = fhstat */ { AS(modnext_args), (sy_call_t *)modnext, AUE_NULL, NULL, 0, 0 }, /* 300 = modnext */ @@ -364,15 +364,15 @@ struct sysent sysent[] = { { AS(sched_get_priority_min_args), (sy_call_t *)sched_get_priority_min, AUE_NULL, NULL, 0, 0 }, /* 333 = sched_get_priority_min */ { AS(sched_rr_get_interval_args), (sy_call_t *)sched_rr_get_interval, AUE_NULL, NULL, 0, 0 }, /* 334 = sched_rr_get_interval */ { AS(utrace_args), (sy_call_t *)utrace, AUE_NULL, NULL, 0, 0 }, /* 335 = utrace */ - { compat4(AS(freebsd4_sendfile_args),sendfile), AUE_SENDFILE, NULL, 0, 0 }, /* 336 = old sendfile */ + { compat4(AS(freebsd4_sendfile_args),sendfile), AUE_SENDFILE, NULL, 0, 0 }, /* 336 = freebsd4 sendfile */ { AS(kldsym_args), (sy_call_t *)kldsym, AUE_NULL, NULL, 0, 0 }, /* 337 = kldsym */ { AS(jail_args), (sy_call_t *)jail, AUE_JAIL, NULL, 0, 0 }, /* 338 = jail */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 339 = pioctl */ { AS(sigprocmask_args), (sy_call_t *)sigprocmask, AUE_SIGPROCMASK, NULL, 0, 0 }, /* 340 = sigprocmask */ { AS(sigsuspend_args), (sy_call_t *)sigsuspend, AUE_SIGSUSPEND, NULL, 0, 0 }, /* 341 = sigsuspend */ - { compat4(AS(freebsd4_sigaction_args),sigaction), AUE_SIGACTION, NULL, 0, 0 }, /* 342 = old sigaction */ + { compat4(AS(freebsd4_sigaction_args),sigaction), AUE_SIGACTION, NULL, 0, 0 }, /* 342 = freebsd4 sigaction */ { AS(sigpending_args), (sy_call_t *)sigpending, AUE_SIGPENDING, NULL, 0, 0 }, /* 343 = sigpending */ - { compat4(AS(freebsd4_sigreturn_args),sigreturn), AUE_SIGRETURN, NULL, 0, 0 }, /* 344 = old sigreturn */ + { compat4(AS(freebsd4_sigreturn_args),sigreturn), AUE_SIGRETURN, NULL, 0, 0 }, /* 344 = freebsd4 sigreturn */ { AS(sigtimedwait_args), (sy_call_t *)sigtimedwait, AUE_SIGWAIT, NULL, 0, 0 }, /* 345 = sigtimedwait */ { AS(sigwaitinfo_args), (sy_call_t *)sigwaitinfo, AUE_NULL, NULL, 0, 0 }, /* 346 = sigwaitinfo */ { AS(__acl_get_file_args), (sy_call_t *)__acl_get_file, AUE_NULL, NULL, 0, 0 }, /* 347 = __acl_get_file */ @@ -398,12 +398,12 @@ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 367 = __cap_get_file */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 368 = __cap_set_fd */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 369 = __cap_set_file */ - { AS(nosys_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 370 = lkmressys */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 370 = nosys */ { AS(extattr_set_fd_args), (sy_call_t *)extattr_set_fd, AUE_EXTATTR_SET_FD, NULL, 0, 0 }, /* 371 = extattr_set_fd */ { AS(extattr_get_fd_args), (sy_call_t *)extattr_get_fd, AUE_EXTATTR_GET_FD, NULL, 0, 0 }, /* 372 = extattr_get_fd */ { AS(extattr_delete_fd_args), (sy_call_t *)extattr_delete_fd, AUE_EXTATTR_DELETE_FD, NULL, 0, 0 }, /* 373 = extattr_delete_fd */ { AS(__setugid_args), (sy_call_t *)__setugid, AUE_NULL, NULL, 0, 0 }, /* 374 = __setugid */ - { AS(nfsclnt_args), (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 375 = nfsclnt */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 375 = nfsclnt */ { AS(eaccess_args), (sy_call_t *)eaccess, AUE_EACCESS, NULL, 0, 0 }, /* 376 = eaccess */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 377 = afs_syscall */ { AS(nmount_args), (sy_call_t *)nmount, AUE_NMOUNT, NULL, 0, 0 }, /* 378 = nmount */ Modified: stable/7/sys/kern/syscalls.c ============================================================================== --- stable/7/sys/kern/syscalls.c Fri Jul 24 20:35:44 2009 (r195855) +++ stable/7/sys/kern/syscalls.c Fri Jul 24 21:30:10 2009 (r195856) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/kern/syscalls.master 195694 2009-07-14 19:48:31Z jhb + * created from FreeBSD: stable/7/sys/kern/syscalls.master 195854 2009-07-24 19:35:06Z jhb */ const char *syscallnames[] = { @@ -25,7 +25,7 @@ const char *syscallnames[] = { "chmod", /* 15 = chmod */ "chown", /* 16 = chown */ "break", /* 17 = break */ - "compat4.getfsstat", /* 18 = old getfsstat */ + "compat4.getfsstat", /* 18 = freebsd4 getfsstat */ "compat.lseek", /* 19 = old lseek */ "getpid", /* 20 = getpid */ "mount", /* 21 = mount */ @@ -164,8 +164,8 @@ const char *syscallnames[] = { "nlm_syscall", /* 154 = nlm_syscall */ "nfssvc", /* 155 = nfssvc */ "compat.getdirentries", /* 156 = old getdirentries */ - "compat4.statfs", /* 157 = old statfs */ - "compat4.fstatfs", /* 158 = old fstatfs */ + "compat4.statfs", /* 157 = freebsd4 statfs */ + "compat4.fstatfs", /* 158 = freebsd4 fstatfs */ "#159", /* 159 = nosys */ "lgetfh", /* 160 = lgetfh */ "getfh", /* 161 = getfh */ @@ -304,7 +304,7 @@ const char *syscallnames[] = { "#294", /* 294 = nosys */ "#295", /* 295 = nosys */ "#296", /* 296 = nosys */ - "compat4.fhstatfs", /* 297 = old fhstatfs */ + "compat4.fhstatfs", /* 297 = freebsd4 fhstatfs */ "fhopen", /* 298 = fhopen */ "fhstat", /* 299 = fhstat */ "modnext", /* 300 = modnext */ @@ -343,15 +343,15 @@ const char *syscallnames[] = { "sched_get_priority_min", /* 333 = sched_get_priority_min */ "sched_rr_get_interval", /* 334 = sched_rr_get_interval */ "utrace", /* 335 = utrace */ - "compat4.sendfile", /* 336 = old sendfile */ + "compat4.sendfile", /* 336 = freebsd4 sendfile */ "kldsym", /* 337 = kldsym */ "jail", /* 338 = jail */ "#339", /* 339 = pioctl */ "sigprocmask", /* 340 = sigprocmask */ "sigsuspend", /* 341 = sigsuspend */ - "compat4.sigaction", /* 342 = old sigaction */ + "compat4.sigaction", /* 342 = freebsd4 sigaction */ "sigpending", /* 343 = sigpending */ - "compat4.sigreturn", /* 344 = old sigreturn */ + "compat4.sigreturn", /* 344 = freebsd4 sigreturn */ "sigtimedwait", /* 345 = sigtimedwait */ "sigwaitinfo", /* 346 = sigwaitinfo */ "__acl_get_file", /* 347 = __acl_get_file */ @@ -377,12 +377,12 @@ const char *syscallnames[] = { "#367", /* 367 = __cap_get_file */ "#368", /* 368 = __cap_set_fd */ "#369", /* 369 = __cap_set_file */ - "lkmressys", /* 370 = lkmressys */ + "#370", /* 370 = nosys */ "extattr_set_fd", /* 371 = extattr_set_fd */ "extattr_get_fd", /* 372 = extattr_get_fd */ "extattr_delete_fd", /* 373 = extattr_delete_fd */ "__setugid", /* 374 = __setugid */ - "nfsclnt", /* 375 = nfsclnt */ + "#375", /* 375 = nfsclnt */ "eaccess", /* 376 = eaccess */ "#377", /* 377 = afs_syscall */ "nmount", /* 378 = nmount */ Modified: stable/7/sys/kern/systrace_args.c ============================================================================== --- stable/7/sys/kern/systrace_args.c Fri Jul 24 20:35:44 2009 (r195855) +++ stable/7/sys/kern/systrace_args.c Fri Jul 24 21:30:10 2009 (r195856) @@ -2016,11 +2016,6 @@ systrace_args(int sysnum, void *params, *n_args = 6; break; } - /* lkmressys */ - case 370: { - *n_args = 0; - break; - } /* extattr_set_fd */ case 371: { struct extattr_set_fd_args *p = params; @@ -2059,14 +2054,6 @@ systrace_args(int sysnum, void *params, *n_args = 1; break; } - /* nfsclnt */ - case 375: { - struct nfsclnt_args *p = params; - iarg[0] = p->flag; /* int */ - uarg[1] = (intptr_t) p->argp; /* caddr_t */ - *n_args = 2; - break; - } /* eaccess */ case 376: { struct eaccess_args *p = params; @@ -6188,9 +6175,6 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; - /* lkmressys */ - case 370: - break; /* extattr_set_fd */ case 371: switch(ndx) { @@ -6261,19 +6245,6 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; - /* nfsclnt */ - case 375: - switch(ndx) { - case 0: - p = "int"; - break; - case 1: - p = "caddr_t"; - break; - default: - break; - }; - break; /* eaccess */ case 376: switch(ndx) { Modified: stable/7/sys/sys/syscall.h ============================================================================== --- stable/7/sys/sys/syscall.h Fri Jul 24 20:35:44 2009 (r195855) +++ stable/7/sys/sys/syscall.h Fri Jul 24 21:30:10 2009 (r195856) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/kern/syscalls.master 195694 2009-07-14 19:48:31Z jhb + * created from FreeBSD: stable/7/sys/kern/syscalls.master 195854 2009-07-24 19:35:06Z jhb */ #define SYS_syscall 0 @@ -305,7 +305,6 @@ #define SYS_extattr_get_fd 372 #define SYS_extattr_delete_fd 373 #define SYS___setugid 374 -#define SYS_nfsclnt 375 #define SYS_eaccess 376 #define SYS_nmount 378 #define SYS_kse_exit 379 Modified: stable/7/sys/sys/syscall.mk ============================================================================== --- stable/7/sys/sys/syscall.mk Fri Jul 24 20:35:44 2009 (r195855) +++ stable/7/sys/sys/syscall.mk Fri Jul 24 21:30:10 2009 (r195856) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: stable/7/sys/kern/syscalls.master 195694 2009-07-14 19:48:31Z jhb +# created from FreeBSD: stable/7/sys/kern/syscalls.master 195854 2009-07-24 19:35:06Z jhb MIASM = \ syscall.o \ exit.o \ @@ -254,7 +254,6 @@ MIASM = \ extattr_get_fd.o \ extattr_delete_fd.o \ __setugid.o \ - nfsclnt.o \ eaccess.o \ nmount.o \ kse_exit.o \ Modified: stable/7/sys/sys/sysproto.h ============================================================================== --- stable/7/sys/sys/sysproto.h Fri Jul 24 20:35:44 2009 (r195855) +++ stable/7/sys/sys/sysproto.h Fri Jul 24 21:30:10 2009 (r195856) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/7/sys/kern/syscalls.master 195694 2009-07-14 19:48:31Z jhb + * created from FreeBSD: stable/7/sys/kern/syscalls.master 195854 2009-07-24 19:35:06Z jhb */ #ifndef _SYS_SYSPROTO_H_ @@ -1091,10 +1091,6 @@ struct extattr_delete_fd_args { struct __setugid_args { char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)]; }; -struct nfsclnt_args { - char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)]; - char argp_l_[PADL_(caddr_t)]; caddr_t argp; char argp_r_[PADR_(caddr_t)]; -}; struct eaccess_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; @@ -1702,7 +1698,6 @@ int undelete(struct thread *, struct und int futimes(struct thread *, struct futimes_args *); int getpgid(struct thread *, struct getpgid_args *); int poll(struct thread *, struct poll_args *); -int lkmnosys(struct thread *, struct nosys_args *); int __semctl(struct thread *, struct __semctl_args *); int semget(struct thread *, struct semget_args *); int semop(struct thread *, struct semop_args *); @@ -1799,12 +1794,10 @@ int getresuid(struct thread *, struct ge int getresgid(struct thread *, struct getresgid_args *); int kqueue(struct thread *, struct kqueue_args *); int kevent(struct thread *, struct kevent_args *); -int lkmressys(struct thread *, struct nosys_args *); int extattr_set_fd(struct thread *, struct extattr_set_fd_args *); int extattr_get_fd(struct thread *, struct extattr_get_fd_args *); int extattr_delete_fd(struct thread *, struct extattr_delete_fd_args *); int __setugid(struct thread *, struct __setugid_args *); -int nfsclnt(struct thread *, struct nfsclnt_args *); int eaccess(struct thread *, struct eaccess_args *); int nmount(struct thread *, struct nmount_args *); int kse_exit(struct thread *, struct kse_exit_args *); @@ -2141,6 +2134,7 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_open AUE_OPEN_RWTC #define SYS_AUE_close AUE_CLOSE #define SYS_AUE_wait4 AUE_WAIT4 +#define SYS_AUE_ocreat AUE_CREAT #define SYS_AUE_link AUE_LINK #define SYS_AUE_unlink AUE_UNLINK #define SYS_AUE_chdir AUE_CHDIR @@ -2149,6 +2143,8 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_chmod AUE_CHMOD #define SYS_AUE_chown AUE_CHOWN #define SYS_AUE_break AUE_NULL +#define SYS_AUE_freebsd4_getfsstat AUE_GETFSSTAT +#define SYS_AUE_olseek AUE_LSEEK #define SYS_AUE_getpid AUE_GETPID #define SYS_AUE_mount AUE_MOUNT #define SYS_AUE_unmount AUE_UMOUNT @@ -2167,16 +2163,21 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_fchflags AUE_FCHFLAGS #define SYS_AUE_sync AUE_SYNC #define SYS_AUE_kill AUE_KILL +#define SYS_AUE_ostat AUE_STAT #define SYS_AUE_getppid AUE_GETPPID +#define SYS_AUE_olstat AUE_LSTAT #define SYS_AUE_dup AUE_DUP #define SYS_AUE_pipe AUE_PIPE #define SYS_AUE_getegid AUE_GETEGID #define SYS_AUE_profil AUE_PROFILE #define SYS_AUE_ktrace AUE_KTRACE +#define SYS_AUE_osigaction AUE_SIGACTION #define SYS_AUE_getgid AUE_GETGID +#define SYS_AUE_osigprocmask AUE_SIGPROCMASK #define SYS_AUE_getlogin AUE_GETLOGIN #define SYS_AUE_setlogin AUE_SETLOGIN #define SYS_AUE_acct AUE_ACCT +#define SYS_AUE_osigpending AUE_SIGPENDING #define SYS_AUE_sigaltstack AUE_SIGALTSTACK #define SYS_AUE_ioctl AUE_IOCTL #define SYS_AUE_reboot AUE_REBOOT @@ -2186,10 +2187,14 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_execve AUE_EXECVE #define SYS_AUE_umask AUE_UMASK #define SYS_AUE_chroot AUE_CHROOT +#define SYS_AUE_ofstat AUE_FSTAT +#define SYS_AUE_ogetkerninfo AUE_NULL +#define SYS_AUE_ogetpagesize AUE_NULL #define SYS_AUE_msync AUE_MSYNC #define SYS_AUE_vfork AUE_VFORK #define SYS_AUE_sbrk AUE_SBRK #define SYS_AUE_sstk AUE_SSTK +#define SYS_AUE_ommap AUE_MMAP #define SYS_AUE_vadvise AUE_O_VADVISE #define SYS_AUE_munmap AUE_MUNMAP #define SYS_AUE_mprotect AUE_MPROTECT @@ -2200,8 +2205,11 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_getpgrp AUE_GETPGRP #define SYS_AUE_setpgid AUE_SETPGRP #define SYS_AUE_setitimer AUE_SETITIMER +#define SYS_AUE_owait AUE_WAIT4 #define SYS_AUE_swapon AUE_SWAPON #define SYS_AUE_getitimer AUE_GETITIMER +#define SYS_AUE_ogethostname AUE_SYSCTL +#define SYS_AUE_osethostname AUE_SYSCTL #define SYS_AUE_getdtablesize AUE_GETDTABLESIZE #define SYS_AUE_dup2 AUE_DUP2 #define SYS_AUE_fcntl AUE_FCNTL @@ -2210,10 +2218,21 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_setpriority AUE_SETPRIORITY #define SYS_AUE_socket AUE_SOCKET #define SYS_AUE_connect AUE_CONNECT +#define SYS_AUE_oaccept AUE_ACCEPT #define SYS_AUE_getpriority AUE_GETPRIORITY +#define SYS_AUE_osend AUE_SEND +#define SYS_AUE_orecv AUE_RECV +#define SYS_AUE_osigreturn AUE_SIGRETURN #define SYS_AUE_bind AUE_BIND #define SYS_AUE_setsockopt AUE_SETSOCKOPT #define SYS_AUE_listen AUE_LISTEN +#define SYS_AUE_osigvec AUE_NULL +#define SYS_AUE_osigblock AUE_NULL +#define SYS_AUE_osigsetmask AUE_NULL +#define SYS_AUE_osigsuspend AUE_NULL +#define SYS_AUE_osigstack AUE_NULL +#define SYS_AUE_orecvmsg AUE_RECVMSG +#define SYS_AUE_osendmsg AUE_SENDMSG #define SYS_AUE_gettimeofday AUE_GETTIMEOFDAY #define SYS_AUE_getrusage AUE_GETRUSAGE #define SYS_AUE_getsockopt AUE_GETSOCKOPT @@ -2222,9 +2241,12 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_settimeofday AUE_SETTIMEOFDAY #define SYS_AUE_fchown AUE_FCHOWN #define SYS_AUE_fchmod AUE_FCHMOD +#define SYS_AUE_orecvfrom AUE_RECVFROM #define SYS_AUE_setreuid AUE_SETREUID #define SYS_AUE_setregid AUE_SETREGID #define SYS_AUE_rename AUE_RENAME +#define SYS_AUE_otruncate AUE_TRUNCATE +#define SYS_AUE_oftruncate AUE_FTRUNCATE #define SYS_AUE_flock AUE_FLOCK #define SYS_AUE_mkfifo AUE_MKFIFO #define SYS_AUE_sendto AUE_SENDTO @@ -2234,10 +2256,21 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_rmdir AUE_RMDIR #define SYS_AUE_utimes AUE_UTIMES #define SYS_AUE_adjtime AUE_ADJTIME +#define SYS_AUE_ogetpeername AUE_GETPEERNAME +#define SYS_AUE_ogethostid AUE_SYSCTL +#define SYS_AUE_osethostid AUE_SYSCTL +#define SYS_AUE_ogetrlimit AUE_GETRLIMIT +#define SYS_AUE_osetrlimit AUE_SETRLIMIT +#define SYS_AUE_okillpg AUE_KILLPG #define SYS_AUE_setsid AUE_SETSID #define SYS_AUE_quotactl AUE_QUOTACTL +#define SYS_AUE_oquota AUE_O_QUOTA +#define SYS_AUE_ogetsockname AUE_GETSOCKNAME #define SYS_AUE_nlm_syscall AUE_NULL #define SYS_AUE_nfssvc AUE_NFS_SVC +#define SYS_AUE_ogetdirentries AUE_GETDIRENTRIES +#define SYS_AUE_freebsd4_statfs AUE_STATFS +#define SYS_AUE_freebsd4_fstatfs AUE_FSTATFS #define SYS_AUE_lgetfh AUE_LGETFH #define SYS_AUE_getfh AUE_NFS_GETFH #define SYS_AUE_getdomainname AUE_SYSCTL @@ -2274,7 +2307,6 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_futimes AUE_FUTIMES #define SYS_AUE_getpgid AUE_GETPGID #define SYS_AUE_poll AUE_POLL -#define SYS_AUE_lkmnosys AUE_NULL #define SYS_AUE___semctl AUE_SEMCTL #define SYS_AUE_semget AUE_SEMGET #define SYS_AUE_semop AUE_SEMOP @@ -2312,6 +2344,7 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_nlstat AUE_LSTAT #define SYS_AUE_preadv AUE_PREADV #define SYS_AUE_pwritev AUE_PWRITEV +#define SYS_AUE_freebsd4_fhstatfs AUE_FHSTATFS #define SYS_AUE_fhopen AUE_FHOPEN #define SYS_AUE_fhstat AUE_FHSTAT #define SYS_AUE_modnext AUE_NULL @@ -2347,11 +2380,14 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_sched_get_priority_min AUE_NULL #define SYS_AUE_sched_rr_get_interval AUE_NULL #define SYS_AUE_utrace AUE_NULL +#define SYS_AUE_freebsd4_sendfile AUE_SENDFILE #define SYS_AUE_kldsym AUE_NULL #define SYS_AUE_jail AUE_JAIL #define SYS_AUE_sigprocmask AUE_SIGPROCMASK #define SYS_AUE_sigsuspend AUE_SIGSUSPEND +#define SYS_AUE_freebsd4_sigaction AUE_SIGACTION #define SYS_AUE_sigpending AUE_SIGPENDING +#define SYS_AUE_freebsd4_sigreturn AUE_SIGRETURN #define SYS_AUE_sigtimedwait AUE_SIGWAIT #define SYS_AUE_sigwaitinfo AUE_NULL #define SYS_AUE___acl_get_file AUE_NULL @@ -2371,12 +2407,10 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_getresgid AUE_GETRESGID #define SYS_AUE_kqueue AUE_KQUEUE #define SYS_AUE_kevent AUE_NULL -#define SYS_AUE_lkmressys AUE_NULL #define SYS_AUE_extattr_set_fd AUE_EXTATTR_SET_FD #define SYS_AUE_extattr_get_fd AUE_EXTATTR_GET_FD #define SYS_AUE_extattr_delete_fd AUE_EXTATTR_DELETE_FD #define SYS_AUE___setugid AUE_NULL -#define SYS_AUE_nfsclnt AUE_NULL #define SYS_AUE_eaccess AUE_EACCESS #define SYS_AUE_nmount AUE_NMOUNT #define SYS_AUE_kse_exit AUE_NULL From brooks at FreeBSD.org Fri Jul 24 21:42:12 2009 From: brooks at FreeBSD.org (Brooks Davis) Date: Fri Jul 24 21:42:30 2009 Subject: svn commit: r195859 - in stable/7: lib/libc lib/libc/gen lib/libc/rpc lib/libc/sys usr.bin/id usr.bin/newgrp usr.bin/quota usr.sbin/chown usr.sbin/chroot usr.sbin/jail usr.sbin/jexec usr.sbin/lpr u... Message-ID: <200907242142.n6OLgA3K022060@svn.freebsd.org> Author: brooks Date: Fri Jul 24 21:42:10 2009 New Revision: 195859 URL: http://svn.freebsd.org/changeset/base/195859 Log: MFC r194494 to improve support for 7.x worlds on >=8.0 kernels: In preparation for raising NGROUPS and NGROUPS_MAX, change base system callers of getgroups(), getgrouplist(), and setgroups() to allocate buffers dynamically. Specifically, allocate a buffer of size sysconf(_SC_NGROUPS_MAX)+1 (+2 in a few cases to allow for overflow). This (or similar gymnastics) is required for the code to actually follow the POSIX.1-2008 specification where {NGROUPS_MAX} may differ at runtime and where getgroups may return {NGROUPS_MAX}+1 results on systems like FreeBSD which include the primary group. In id(1), don't pointlessly add the primary group to the list of all groups, it is always the first result from getgroups(). In principle the old code was more portable, but this was only done in one of the two places where getgroups() was called to the overall effect was pointless. Document the actual POSIX requirements in the getgroups(2) and setgroups(2) manpages. We do not yet support a dynamic NGROUPS, but we may in the future. Modified: stable/7/lib/libc/ (props changed) stable/7/lib/libc/gen/initgroups.3 stable/7/lib/libc/gen/initgroups.c stable/7/lib/libc/rpc/auth_unix.c stable/7/lib/libc/sys/getgroups.2 stable/7/lib/libc/sys/setgroups.2 stable/7/usr.bin/id/ (props changed) stable/7/usr.bin/id/id.c stable/7/usr.bin/newgrp/ (props changed) stable/7/usr.bin/newgrp/newgrp.c stable/7/usr.bin/quota/ (props changed) stable/7/usr.bin/quota/quota.c stable/7/usr.sbin/chown/ (props changed) stable/7/usr.sbin/chown/chown.c stable/7/usr.sbin/chroot/ (props changed) stable/7/usr.sbin/chroot/chroot.c stable/7/usr.sbin/jail/ (props changed) stable/7/usr.sbin/jail/jail.c stable/7/usr.sbin/jexec/ (props changed) stable/7/usr.sbin/jexec/jexec.c stable/7/usr.sbin/lpr/ (props changed) stable/7/usr.sbin/lpr/lpc/lpc.c Modified: stable/7/lib/libc/gen/initgroups.3 ============================================================================== --- stable/7/lib/libc/gen/initgroups.3 Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/lib/libc/gen/initgroups.3 Fri Jul 24 21:42:10 2009 (r195859) @@ -65,6 +65,13 @@ function may fail and set .Va errno for any of the errors specified for the library function .Xr setgroups 2 . +It may also return: +.Bl -tag -width Er +.It Bq Er ENOMEM +The +.Fn initgroups +function was unable to allocate temporary storage. +.El .Sh SEE ALSO .Xr setgroups 2 , .Xr getgrouplist 3 Modified: stable/7/lib/libc/gen/initgroups.c ============================================================================== --- stable/7/lib/libc/gen/initgroups.c Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/lib/libc/gen/initgroups.c Fri Jul 24 21:42:10 2009 (r195859) @@ -35,10 +35,12 @@ __FBSDID("$FreeBSD$"); #include -#include #include "namespace.h" #include #include "un-namespace.h" +#include +#include +#include #include int @@ -46,14 +48,21 @@ initgroups(uname, agroup) const char *uname; gid_t agroup; { - int ngroups; + int ngroups, ret; + long ngroups_max; + gid_t *groups; + /* - * Provide space for one group more than NGROUPS to allow + * Provide space for one group more than possible to allow * setgroups to fail and set errno. */ - gid_t groups[NGROUPS + 1]; + ngroups_max = sysconf(_SC_NGROUPS_MAX) + 2; + if ((groups = malloc(sizeof(*groups) * ngroups_max)) == NULL) + return (ENOMEM); - ngroups = NGROUPS + 1; + ngroups = (int)ngroups_max; getgrouplist(uname, agroup, groups, &ngroups); - return (setgroups(ngroups, groups)); + ret = setgroups(ngroups, groups); + free(groups); + return (ret); } Modified: stable/7/lib/libc/rpc/auth_unix.c ============================================================================== --- stable/7/lib/libc/rpc/auth_unix.c Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/lib/libc/rpc/auth_unix.c Fri Jul 24 21:42:10 2009 (r195859) @@ -185,23 +185,29 @@ authunix_create(machname, uid, gid, len, AUTH * authunix_create_default() { - int len; + int ngids; + long ngids_max; char machname[MAXHOSTNAMELEN + 1]; uid_t uid; gid_t gid; - gid_t gids[NGROUPS_MAX]; + gid_t *gids; + + ngids_max = sysconf(_SC_NGROUPS_MAX) + 1; + gids = malloc(sizeof(gid_t) * ngids_max); + if (gids == NULL) + return (NULL); if (gethostname(machname, sizeof machname) == -1) abort(); machname[sizeof(machname) - 1] = 0; uid = geteuid(); gid = getegid(); - if ((len = getgroups(NGROUPS_MAX, gids)) < 0) + if ((ngids = getgroups(ngids_max, gids)) < 0) abort(); - if (len > NGRPS) - len = NGRPS; + if (ngids > NGRPS) + ngids = NGRPS; /* XXX: interface problem; those should all have been unsigned */ - return (authunix_create(machname, (int)uid, (int)gid, len, + return (authunix_create(machname, (int)uid, (int)gid, ngids, (int *)gids)); } Modified: stable/7/lib/libc/sys/getgroups.2 ============================================================================== --- stable/7/lib/libc/sys/getgroups.2 Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/lib/libc/sys/getgroups.2 Fri Jul 24 21:42:10 2009 (r195859) @@ -58,10 +58,7 @@ The system call returns the actual number of groups returned in .Fa gidset . -No more than -.Dv NGROUPS_MAX -will ever -be returned. +At least one and as many as {NGROUPS_MAX}+1 values may be returned. If .Fa gidsetlen is zero, @@ -92,6 +89,11 @@ an invalid address. .Sh SEE ALSO .Xr setgroups 2 , .Xr initgroups 3 +.Sh STANDARDS +The +.Fn getgroups +system call conforms to +.St -p1003.1-2008 . .Sh HISTORY The .Fn getgroups Modified: stable/7/lib/libc/sys/setgroups.2 ============================================================================== --- stable/7/lib/libc/sys/setgroups.2 Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/lib/libc/sys/setgroups.2 Fri Jul 24 21:42:10 2009 (r195859) @@ -53,9 +53,7 @@ The argument indicates the number of entries in the array and must be no more than -.Dv NGROUPS , -as defined in -.In sys/param.h . +.Dv {NGROUPS_MAX}+1 . .Pp Only the super-user may set new groups. .Sh RETURN VALUES @@ -71,7 +69,7 @@ The caller is not the super-user. The number specified in the .Fa ngroups argument is larger than the -.Dv NGROUPS +.Dv {NGROUPS_MAX}+1 limit. .It Bq Er EFAULT The address specified for Modified: stable/7/usr.bin/id/id.c ============================================================================== --- stable/7/usr.bin/id/id.c Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/usr.bin/id/id.c Fri Jul 24 21:42:10 2009 (r195859) @@ -258,7 +258,8 @@ id_print(struct passwd *pw, int use_ggl, gid_t gid, egid, lastgid; uid_t uid, euid; int cnt, ngroups; - gid_t groups[NGROUPS + 1]; + long ngroups_max; + gid_t *groups; const char *fmt; if (pw != NULL) { @@ -270,12 +271,16 @@ id_print(struct passwd *pw, int use_ggl, gid = getgid(); } + ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; + if ((groups = malloc(sizeof(gid_t) * ngroups_max)) == NULL) + err(1, "malloc"); + if (use_ggl && pw != NULL) { - ngroups = NGROUPS + 1; + ngroups = ngroups_max; getgrouplist(pw->pw_name, gid, groups, &ngroups); } else { - ngroups = getgroups(NGROUPS + 1, groups); + ngroups = getgroups(ngroups_max, groups); } if (pw != NULL) @@ -306,6 +311,7 @@ id_print(struct passwd *pw, int use_ggl, lastgid = gid; } printf("\n"); + free(groups); } #ifdef USE_BSM_AUDIT @@ -361,15 +367,19 @@ group(struct passwd *pw, int nflag) { struct group *gr; int cnt, id, lastid, ngroups; - gid_t groups[NGROUPS + 1]; + long ngroups_max; + gid_t *groups; const char *fmt; + ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; + if ((groups = malloc(sizeof(gid_t) * (ngroups_max))) == NULL) + err(1, "malloc"); + if (pw) { - ngroups = NGROUPS + 1; + ngroups = ngroups_max; (void) getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups); } else { - groups[0] = getgid(); - ngroups = getgroups(NGROUPS, groups + 1) + 1; + ngroups = getgroups(ngroups_max, groups); } fmt = nflag ? "%s" : "%u"; for (lastid = -1, cnt = 0; cnt < ngroups; ++cnt) { @@ -389,6 +399,7 @@ group(struct passwd *pw, int nflag) lastid = id; } (void)printf("\n"); + free(groups); } void Modified: stable/7/usr.bin/newgrp/newgrp.c ============================================================================== --- stable/7/usr.bin/newgrp/newgrp.c Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/usr.bin/newgrp/newgrp.c Fri Jul 24 21:42:10 2009 (r195859) @@ -146,8 +146,8 @@ restoregrps(void) static void addgroup(const char *grpname) { - gid_t grps[NGROUPS_MAX]; - long lgid; + gid_t *grps; + long lgid, ngrps_max; int dbmember, i, ngrps; gid_t egid; struct group *grp; @@ -185,7 +185,10 @@ addgroup(const char *grpname) } } - if ((ngrps = getgroups(NGROUPS_MAX, (gid_t *)grps)) < 0) { + ngrps_max = sysconf(_SC_NGROUPS_MAX) + 1; + if ((grps = malloc(sizeof(gid_t) * ngrps_max)) == NULL) + err(1, "malloc"); + if ((ngrps = getgroups(ngrps_max, (gid_t *)grps)) < 0) { warn("getgroups"); return; } @@ -217,7 +220,7 @@ addgroup(const char *grpname) /* Add old effective gid to supp. list if it does not exist. */ if (egid != grp->gr_gid && !inarray(egid, grps, ngrps)) { - if (ngrps == NGROUPS_MAX) + if (ngrps == ngrps_max) warnx("too many groups"); else { grps[ngrps++] = egid; @@ -231,6 +234,7 @@ addgroup(const char *grpname) } } + free(grps); } static int Modified: stable/7/usr.bin/quota/quota.c ============================================================================== --- stable/7/usr.bin/quota/quota.c Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/usr.bin/quota/quota.c Fri Jul 24 21:42:10 2009 (r195859) @@ -117,7 +117,8 @@ int main(int argc, char *argv[]) { int ngroups; - gid_t mygid, gidset[NGROUPS]; + long ngroups_max; + gid_t mygid, *gidset; int i, ch, gflag = 0, uflag = 0, errflag = 0; while ((ch = getopt(argc, argv, "f:ghlrquv")) != -1) { @@ -159,13 +160,18 @@ main(int argc, char *argv[]) errflag += showuid(getuid()); if (gflag) { mygid = getgid(); - ngroups = getgroups(NGROUPS, gidset); + ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; + if ((gidset = malloc(sizeof(gid_t) * ngroups_max)) + == NULL) + err(1, "malloc"); + ngroups = getgroups(ngroups_max, gidset); if (ngroups < 0) err(1, "getgroups"); errflag += showgid(mygid); for (i = 0; i < ngroups; i++) if (gidset[i] != mygid) errflag += showgid(gidset[i]); + free(gidset); } return(errflag); } Modified: stable/7/usr.sbin/chown/chown.c ============================================================================== --- stable/7/usr.sbin/chown/chown.c Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/usr.sbin/chown/chown.c Fri Jul 24 21:42:10 2009 (r195859) @@ -269,7 +269,8 @@ chownerr(const char *file) { static uid_t euid = -1; static int ngroups = -1; - gid_t groups[NGROUPS_MAX]; + static long ngroups_max; + gid_t *groups; /* Check for chown without being root. */ if (errno != EPERM || (uid != (uid_t)-1 && @@ -281,7 +282,10 @@ chownerr(const char *file) /* Check group membership; kernel just returns EPERM. */ if (gid != (gid_t)-1 && ngroups == -1 && euid == (uid_t)-1 && (euid = geteuid()) != 0) { - ngroups = getgroups(NGROUPS_MAX, groups); + ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; + if ((groups = malloc(sizeof(gid_t) * ngroups_max)) == NULL) + err(1, "malloc"); + ngroups = getgroups(ngroups_max, groups); while (--ngroups >= 0 && gid != groups[ngroups]); if (ngroups < 0) { warnx("you are not a member of group %s", gname); Modified: stable/7/usr.sbin/chroot/chroot.c ============================================================================== --- stable/7/usr.sbin/chroot/chroot.c Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/usr.sbin/chroot/chroot.c Fri Jul 24 21:42:10 2009 (r195859) @@ -69,9 +69,10 @@ main(argc, argv) struct passwd *pw; char *endp, *p; const char *shell; - gid_t gid, gidlist[NGROUPS_MAX]; + gid_t gid, *gidlist; uid_t uid; int ch, gids; + long ngroups_max; gid = 0; uid = 0; @@ -117,8 +118,11 @@ main(argc, argv) } } + ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; + if ((gidlist = malloc(sizeof(gid_t) * ngroups_max)) == NULL) + err(1, "malloc"); for (gids = 0; - (p = strsep(&grouplist, ",")) != NULL && gids < NGROUPS_MAX; ) { + (p = strsep(&grouplist, ",")) != NULL && gids < ngroups_max; ) { if (*p == '\0') continue; @@ -135,7 +139,7 @@ main(argc, argv) } gids++; } - if (p != NULL && gids == NGROUPS_MAX) + if (p != NULL && gids == ngroups_max) errx(1, "too many supplementary groups provided"); if (user != NULL) { Modified: stable/7/usr.sbin/jail/jail.c ============================================================================== --- stable/7/usr.sbin/jail/jail.c Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/usr.sbin/jail/jail.c Fri Jul 24 21:42:10 2009 (r195859) @@ -68,7 +68,7 @@ STAILQ_HEAD(addr6head, addr6entry) addr6 lcap = login_getpwclass(pwd); \ if (lcap == NULL) \ err(1, "getpwclass: %s", username); \ - ngroups = NGROUPS; \ + ngroups = ngroups_max; \ if (getgrouplist(username, pwd->pw_gid, groups, &ngroups) != 0) \ err(1, "getgrouplist: %s", username); \ } while (0) @@ -79,9 +79,10 @@ main(int argc, char **argv) login_cap_t *lcap = NULL; struct jail j; struct passwd *pwd = NULL; - gid_t groups[NGROUPS]; + gid_t *groups; int ch, error, i, ngroups, securelevel; int hflag, iflag, Jflag, lflag, uflag, Uflag; + long ngroups_max; char path[PATH_MAX], *jailname, *ep, *username, *JidFile, *ip; static char *cleanenv; const char *shell, *p = NULL; @@ -94,6 +95,10 @@ main(int argc, char **argv) jailname = username = JidFile = cleanenv = NULL; fp = NULL; + ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; + if ((groups = malloc(sizeof(gid_t) * ngroups_max)) == NULL) + err(1, "malloc"); + while ((ch = getopt(argc, argv, "hiln:s:u:U:J:")) != -1) { switch (ch) { case 'h': Modified: stable/7/usr.sbin/jexec/jexec.c ============================================================================== --- stable/7/usr.sbin/jexec/jexec.c Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/usr.sbin/jexec/jexec.c Fri Jul 24 21:42:10 2009 (r195859) @@ -202,7 +202,7 @@ lookup_jail(int jid, char *jailname) lcap = login_getpwclass(pwd); \ if (lcap == NULL) \ err(1, "getpwclass: %s", username); \ - ngroups = NGROUPS; \ + ngroups = ngroups_max; \ if (getgrouplist(username, pwd->pw_gid, groups, &ngroups) != 0) \ err(1, "getgrouplist: %s", username); \ } while (0) @@ -213,14 +213,19 @@ main(int argc, char *argv[]) int jid; login_cap_t *lcap = NULL; struct passwd *pwd = NULL; - gid_t groups[NGROUPS]; + gid_t *groups = NULL; int ch, ngroups, uflag, Uflag; + long ngroups_max; char *jailname, *username; ch = uflag = Uflag = 0; jailname = username = NULL; jid = -1; + ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; + if ((groups = malloc(sizeof(gid_t) * ngroups_max)) == NULL) + err(1, "malloc"); + while ((ch = getopt(argc, argv, "i:n:u:U:")) != -1) { switch (ch) { case 'n': Modified: stable/7/usr.sbin/lpr/lpc/lpc.c ============================================================================== --- stable/7/usr.sbin/lpr/lpc/lpc.c Fri Jul 24 21:38:51 2009 (r195858) +++ stable/7/usr.sbin/lpr/lpc/lpc.c Fri Jul 24 21:42:10 2009 (r195859) @@ -356,7 +356,8 @@ ingroup(const char *grname) { static struct group *gptr=NULL; static int ngroups = 0; - static gid_t groups[NGROUPS]; + static long ngroups_max; + static gid_t *groups; register gid_t gid; register int i; @@ -365,7 +366,10 @@ ingroup(const char *grname) warnx("warning: unknown group '%s'", grname); return(0); } - ngroups = getgroups(NGROUPS, groups); + ngroups_max = sysconf(_SC_NGROUPS_MAX); + if ((groups = malloc(sizeof(gid_t) * ngroups_max)) == NULL) + err(1, "malloc"); + ngroups = getgroups(ngroups_max, groups); if (ngroups < 0) err(1, "getgroups"); } From emaste at FreeBSD.org Sat Jul 25 02:22:11 2009 From: emaste at FreeBSD.org (Ed Maste) Date: Sat Jul 25 02:22:23 2009 Subject: svn commit: r195860 - in stable/7/sys: . boot/i386/libi386 contrib/pf Message-ID: <200907250222.n6P2MAah027591@svn.freebsd.org> Author: emaste Date: Sat Jul 25 02:22:10 2009 New Revision: 195860 URL: http://svn.freebsd.org/changeset/base/195860 Log: MFC r179825 by olli: Implement a workaround for a long-standing problem in libi386's time(), caused by a qemu bug. The bug might be present in other BIOSes, too. qemu either does not simulate the AT RTC correctly or has a broken BIOS 1A/02 implementation, and will return an incorrect value if the RTC is read while it is being updated. The effect is worsened by the fact that qemu's INT 15/86 function ("wait" a.k.a. usleep) is non-implmeneted or broken and returns immediately, causing beastie.4th to spin in a tight loop calling the "read RTC" function millions of times, triggering the problem quickly. Therefore, we keep reading the BIOS value until we get the same result twice. This change fixes beastie.4th's countdown under qemu. Modified: stable/7/sys/ (props changed) stable/7/sys/boot/i386/libi386/time.c stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/i386/libi386/time.c ============================================================================== --- stable/7/sys/boot/i386/libi386/time.c Fri Jul 24 21:42:10 2009 (r195859) +++ stable/7/sys/boot/i386/libi386/time.c Sat Jul 25 02:22:10 2009 (r195860) @@ -32,18 +32,16 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "libi386.h" +static int bios_seconds(void); + /* - * Return the time in seconds since the beginning of the day. - * - * If we pass midnight, don't wrap back to 0. + * Return the BIOS time-of-day value. * * XXX uses undocumented BCD support from libstand. */ - -time_t -time(time_t *t) +static int +bios_seconds(void) { - static time_t lasttime, now; int hr, minute, sec; v86.ctl = 0; @@ -55,7 +53,33 @@ time(time_t *t) minute = bcd2bin(v86.ecx & 0xff); /* minute in %cl */ sec = bcd2bin((v86.edx & 0xff00) >> 8); /* second in %dh */ - now = hr * 3600 + minute * 60 + sec; + return (hr * 3600 + minute * 60 + sec); +} + +/* + * Return the time in seconds since the beginning of the day. + * + * Some BIOSes (notably qemu) don't correctly read the RTC + * registers in an atomic way, sometimes returning bogus values. + * Therefore we "debounce" the reading by accepting it only when + * we got two identical values in succession. + * + * If we pass midnight, don't wrap back to 0. + */ +time_t +time(time_t *t) +{ + static time_t lasttime; + time_t now, check; + int try; + + try = 0; + check = bios_seconds(); + do { + now = check; + check = bios_seconds(); + } while (now != check && ++try < 1000); + if (now < lasttime) now += 24 * 3600; lasttime = now; From nyan at FreeBSD.org Sat Jul 25 11:10:02 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Sat Jul 25 11:10:14 2009 Subject: svn commit: r195866 - in stable/7/sys: . boot/pc98/libpc98 contrib/pf Message-ID: <200907251110.n6PBA10l039335@svn.freebsd.org> Author: nyan Date: Sat Jul 25 11:10:01 2009 New Revision: 195866 URL: http://svn.freebsd.org/changeset/base/195866 Log: MFC: r190126 Reduce diffs against i386. Modified: stable/7/sys/ (props changed) stable/7/sys/boot/pc98/libpc98/time.c stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/pc98/libpc98/time.c ============================================================================== --- stable/7/sys/boot/pc98/libpc98/time.c Sat Jul 25 10:22:51 2009 (r195865) +++ stable/7/sys/boot/pc98/libpc98/time.c Sat Jul 25 11:10:01 2009 (r195866) @@ -33,23 +33,21 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "libi386.h" +static int bios_seconds(void); + /* - * Return the time in seconds since the beginning of the day. - * - * If we pass midnight, don't wrap back to 0. + * Return the BIOS time-of-day value. * * XXX uses undocumented BCD support from libstand. */ - -time_t -time(time_t *t) +static int +bios_seconds(void) { - static time_t lasttime, now; int hr, minute, sec; unsigned char bios_time[6]; - + v86.ctl = 0; - v86.addr = 0x1c; /* int 0x1c, function 0 */ + v86.addr = 0x1c; /* int 0x1c, function 0 */ v86.eax = 0x0000; v86.es = VTOPSEG(bios_time); v86.ebx = VTOPOFF(bios_time); @@ -59,7 +57,20 @@ time(time_t *t) minute = bcd2bin(bios_time[4]); sec = bcd2bin(bios_time[5]); - now = hr * 3600 + minute * 60 + sec; + return (hr * 3600 + minute * 60 + sec); +} + +/* + * Return the time in seconds since the beginning of the day. + */ +time_t +time(time_t *t) +{ + static time_t lasttime; + time_t now; + + now = bios_seconds(); + if (now < lasttime) now += 24 * 3600; lasttime = now; From delphij at FreeBSD.org Sun Jul 26 09:00:38 2009 From: delphij at FreeBSD.org (Xin LI) Date: Sun Jul 26 09:00:55 2009 Subject: svn commit: r195888 - in stable/7/lib/libc: . stdtime Message-ID: <200907260900.n6Q90bpi065075@svn.freebsd.org> Author: delphij Date: Sun Jul 26 09:00:37 2009 New Revision: 195888 URL: http://svn.freebsd.org/changeset/base/195888 Log: Implement %z for strptime. PR: kern/63064 Submitted by: Stefan `Sec` Zehl (with some small changes) Modified: stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdtime/strptime.c Modified: stable/7/lib/libc/stdtime/strptime.c ============================================================================== --- stable/7/lib/libc/stdtime/strptime.c Sun Jul 26 08:47:00 2009 (r195887) +++ stable/7/lib/libc/stdtime/strptime.c Sun Jul 26 09:00:37 2009 (r195888) @@ -514,6 +514,34 @@ label: } } break; + + case 'z': + { + int sign = 1; + + if (*buf != '+') { + if (*buf == '-') + sign = -1; + else + return 0; + } + + buf++; + i = 0; + for (len = 4; len > 0; len--) { + if (isdigit((int)*buf)) { + i *= 10; + i += *buf - '0'; + buf++; + } else + return 0; + } + + tm->tm_hour -= sign * (i / 100); + tm->tm_min -= sign * (i % 100); + *GMTp = 1; + } + break; } } return (char *)buf; From rnoland at FreeBSD.org Mon Jul 27 16:05:52 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Mon Jul 27 16:06:26 2009 Subject: svn commit: r195912 - in stable/7/sys: . contrib/pf dev/drm Message-ID: <200907271605.n6RG5p0h005329@svn.freebsd.org> Author: rnoland Date: Mon Jul 27 16:05:51 2009 New Revision: 195912 URL: http://svn.freebsd.org/changeset/base/195912 Log: MFC r194741,194745-194746,194748-194749,194759,194960,194963,194965-194966,194969,194986,194996 This pulls in numerous vblank related fixes from HEAD. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/drm/drmP.h stable/7/sys/dev/drm/drm_drv.c stable/7/sys/dev/drm/drm_irq.c stable/7/sys/dev/drm/drm_sysctl.c stable/7/sys/dev/drm/i915_dma.c stable/7/sys/dev/drm/i915_drv.c stable/7/sys/dev/drm/i915_drv.h stable/7/sys/dev/drm/i915_irq.c stable/7/sys/dev/drm/radeon_cp.c stable/7/sys/dev/drm/radeon_irq.c Modified: stable/7/sys/dev/drm/drmP.h ============================================================================== --- stable/7/sys/dev/drm/drmP.h Mon Jul 27 16:03:04 2009 (r195911) +++ stable/7/sys/dev/drm/drmP.h Mon Jul 27 16:05:51 2009 (r195912) @@ -502,19 +502,10 @@ typedef struct drm_local_map { TAILQ_ENTRY(drm_local_map) link; } drm_local_map_t; -TAILQ_HEAD(drm_vbl_sig_list, drm_vbl_sig); -typedef struct drm_vbl_sig { - TAILQ_ENTRY(drm_vbl_sig) link; - unsigned int sequence; - int signo; - int pid; -} drm_vbl_sig_t; - struct drm_vblank_info { wait_queue_head_t queue; /* vblank wait queue */ atomic_t count; /* number of VBLANK interrupts */ /* (driver must alloc the right number of counters) */ - struct drm_vbl_sig_list sigs; /* signal list to send on VBLANK */ atomic_t refcount; /* number of users of vblank interrupts */ u32 last; /* protected by dev->vbl_lock, used */ /* for wraparound handling */ @@ -684,7 +675,6 @@ struct drm_device { int last_context; /* Last current context */ int vblank_disable_allowed; - atomic_t vbl_signal_pending; /* number of signals pending on all crtcs */ struct callout vblank_disable_timer; u32 max_vblank_count; /* size of vblank counter register */ struct drm_vblank_info *vblank; /* per crtc vblank info */ @@ -802,7 +792,6 @@ void drm_vblank_put(struct drm_device *d void drm_vblank_cleanup(struct drm_device *dev); int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); int drm_vblank_init(struct drm_device *dev, int num_crtcs); -void drm_vbl_send_signals(struct drm_device *dev, int crtc); int drm_modeset_ctl(struct drm_device *dev, void *data, struct drm_file *file_priv); Modified: stable/7/sys/dev/drm/drm_drv.c ============================================================================== --- stable/7/sys/dev/drm/drm_drv.c Mon Jul 27 16:03:04 2009 (r195911) +++ stable/7/sys/dev/drm/drm_drv.c Mon Jul 27 16:05:51 2009 (r195912) @@ -273,11 +273,14 @@ int drm_detach(device_t kdev) drm_unload(dev); - bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr); - - if (dev->msi_enabled) { - pci_release_msi(dev->device); - DRM_INFO("MSI released\n"); + if (dev->irqr) { + bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, + dev->irqr); + + if (dev->msi_enabled) { + pci_release_msi(dev->device); + DRM_INFO("MSI released\n"); + } } return 0; Modified: stable/7/sys/dev/drm/drm_irq.c ============================================================================== --- stable/7/sys/dev/drm/drm_irq.c Mon Jul 27 16:03:04 2009 (r195911) +++ stable/7/sys/dev/drm/drm_irq.c Mon Jul 27 16:05:51 2009 (r195912) @@ -70,6 +70,9 @@ static void vblank_disable_fn(void *arg) struct drm_device *dev = (struct drm_device *)arg; int i; + /* Make sure that we are called with the lock held */ + mtx_assert(&dev->vbl_lock, MA_OWNED); + if (callout_pending(&dev->vblank_disable_timer)) { /* callout was reset */ return; @@ -86,7 +89,7 @@ static void vblank_disable_fn(void *arg) return; for (i = 0; i < dev->num_crtcs; i++) { - if (atomic_read(&dev->vblank[i].refcount) == 0 && + if (dev->vblank[i].refcount == 0 && dev->vblank[i].enabled && !dev->vblank[i].inmodeset) { DRM_DEBUG("disabling vblank on crtc %d\n", i); dev->vblank[i].last = @@ -109,7 +112,9 @@ void drm_vblank_cleanup(struct drm_devic callout_drain(&dev->vblank_disable_timer); + DRM_SPINLOCK(&dev->vbl_lock); vblank_disable_fn((void *)dev); + DRM_SPINUNLOCK(&dev->vbl_lock); free(dev->vblank, DRM_MEM_DRIVER); @@ -121,7 +126,6 @@ int drm_vblank_init(struct drm_device *d int i, ret = ENOMEM; callout_init_mtx(&dev->vblank_disable_timer, &dev->vbl_lock, 0); - atomic_set(&dev->vbl_signal_pending, 0); dev->num_crtcs = num_crtcs; dev->vblank = malloc(sizeof(struct drm_vblank_info) * num_crtcs, @@ -132,14 +136,14 @@ int drm_vblank_init(struct drm_device *d DRM_DEBUG("\n"); /* Zero per-crtc vblank stuff */ + DRM_SPINLOCK(&dev->vbl_lock); for (i = 0; i < num_crtcs; i++) { DRM_INIT_WAITQUEUE(&dev->vblank[i].queue); - TAILQ_INIT(&dev->vblank[i].sigs); - atomic_set(&dev->vblank[i].count, 0); - atomic_set(&dev->vblank[i].refcount, 0); + dev->vblank[i].refcount = 0; + atomic_set_rel_32(&dev->vblank[i].count, 0); } - dev->vblank_disable_allowed = 0; + DRM_SPINUNLOCK(&dev->vbl_lock); return 0; @@ -272,7 +276,7 @@ int drm_control(struct drm_device *dev, u32 drm_vblank_count(struct drm_device *dev, int crtc) { - return atomic_read(&dev->vblank[crtc].count); + return atomic_load_acq_32(&dev->vblank[crtc].count); } static void drm_update_vblank_count(struct drm_device *dev, int crtc) @@ -298,45 +302,48 @@ static void drm_update_vblank_count(stru DRM_DEBUG("enabling vblank interrupts on crtc %d, missed %d\n", crtc, diff); - atomic_add(diff, &dev->vblank[crtc].count); + atomic_add_rel_32(&dev->vblank[crtc].count, diff); } int drm_vblank_get(struct drm_device *dev, int crtc) { int ret = 0; - DRM_SPINLOCK(&dev->vbl_lock); + /* Make sure that we are called with the lock held */ + mtx_assert(&dev->vbl_lock, MA_OWNED); + /* Going from 0->1 means we have to enable interrupts again */ - atomic_add_acq_int(&dev->vblank[crtc].refcount, 1); - if (dev->vblank[crtc].refcount == 1 && + if (++dev->vblank[crtc].refcount == 1 && !dev->vblank[crtc].enabled) { ret = dev->driver->enable_vblank(dev, crtc); DRM_DEBUG("enabling vblank on crtc %d, ret: %d\n", crtc, ret); if (ret) - atomic_dec(&dev->vblank[crtc].refcount); + --dev->vblank[crtc].refcount; else { dev->vblank[crtc].enabled = 1; drm_update_vblank_count(dev, crtc); } } - DRM_SPINUNLOCK(&dev->vbl_lock); + + if (dev->vblank[crtc].enabled) + dev->vblank[crtc].last = + dev->driver->get_vblank_counter(dev, crtc); return ret; } void drm_vblank_put(struct drm_device *dev, int crtc) { - KASSERT(atomic_read(&dev->vblank[crtc].refcount) > 0, + /* Make sure that we are called with the lock held */ + mtx_assert(&dev->vbl_lock, MA_OWNED); + + KASSERT(dev->vblank[crtc].refcount > 0, ("invalid refcount")); /* Last user schedules interrupt disable */ - atomic_subtract_acq_int(&dev->vblank[crtc].refcount, 1); - - DRM_SPINLOCK(&dev->vbl_lock); - if (dev->vblank[crtc].refcount == 0) + if (--dev->vblank[crtc].refcount == 0) callout_reset(&dev->vblank_disable_timer, 5 * DRM_HZ, (timeout_t *)vblank_disable_fn, (void *)dev); - DRM_SPINUNLOCK(&dev->vbl_lock); } int drm_modeset_ctl(struct drm_device *dev, void *data, @@ -345,13 +352,11 @@ int drm_modeset_ctl(struct drm_device *d struct drm_modeset_ctl *modeset = data; int crtc, ret = 0; - DRM_DEBUG("num_crtcs=%d\n", dev->num_crtcs); /* If drm_vblank_init() hasn't been called yet, just no-op */ if (!dev->num_crtcs) goto out; crtc = modeset->crtc; - DRM_DEBUG("crtc=%d\n", crtc); if (crtc >= dev->num_crtcs) { ret = EINVAL; goto out; @@ -366,25 +371,25 @@ int drm_modeset_ctl(struct drm_device *d */ switch (modeset->cmd) { case _DRM_PRE_MODESET: - DRM_DEBUG("pre-modeset\n"); + DRM_DEBUG("pre-modeset, crtc %d\n", crtc); + DRM_SPINLOCK(&dev->vbl_lock); if (!dev->vblank[crtc].inmodeset) { dev->vblank[crtc].inmodeset = 0x1; if (drm_vblank_get(dev, crtc) == 0) dev->vblank[crtc].inmodeset |= 0x2; } + DRM_SPINUNLOCK(&dev->vbl_lock); break; case _DRM_POST_MODESET: - DRM_DEBUG("post-modeset\n"); + DRM_DEBUG("post-modeset, crtc %d\n", crtc); + DRM_SPINLOCK(&dev->vbl_lock); if (dev->vblank[crtc].inmodeset) { - DRM_SPINLOCK(&dev->vbl_lock); - dev->vblank_disable_allowed = 1; - DRM_SPINUNLOCK(&dev->vbl_lock); - if (dev->vblank[crtc].inmodeset & 0x2) drm_vblank_put(dev, crtc); - dev->vblank[crtc].inmodeset = 0; } + dev->vblank_disable_allowed = 1; + DRM_SPINUNLOCK(&dev->vbl_lock); break; default: ret = EINVAL; @@ -418,7 +423,9 @@ int drm_wait_vblank(struct drm_device *d if (crtc >= dev->num_crtcs) return EINVAL; + DRM_SPINLOCK(&dev->vbl_lock); ret = drm_vblank_get(dev, crtc); + DRM_SPINUNLOCK(&dev->vbl_lock); if (ret) { DRM_ERROR("failed to acquire vblank counter, %d\n", ret); return ret; @@ -442,28 +449,11 @@ int drm_wait_vblank(struct drm_device *d } if (flags & _DRM_VBLANK_SIGNAL) { -#if 0 /* disabled */ - drm_vbl_sig_t *vbl_sig = malloc(sizeof(drm_vbl_sig_t), - DRM_MEM_DRIVER, M_NOWAIT | M_ZERO); - if (vbl_sig == NULL) - return ENOMEM; - - vbl_sig->sequence = vblwait->request.sequence; - vbl_sig->signo = vblwait->request.signal; - vbl_sig->pid = DRM_CURRENTPID; - - vblwait->reply.sequence = atomic_read(&dev->vbl_received); - - DRM_SPINLOCK(&dev->vbl_lock); - TAILQ_INSERT_HEAD(&dev->vbl_sig_list, vbl_sig, link); - DRM_SPINUNLOCK(&dev->vbl_lock); - ret = 0; -#endif + /* There have never been any consumers */ ret = EINVAL; } else { DRM_DEBUG("waiting on vblank count %d, crtc %d\n", vblwait->request.sequence, crtc); - dev->vblank[crtc].last = vblwait->request.sequence; for ( ret = 0 ; !ret && !(((drm_vblank_count(dev, crtc) - vblwait->request.sequence) <= (1 << 23)) || !dev->irq_enabled) ; ) { @@ -473,7 +463,7 @@ int drm_wait_vblank(struct drm_device *d !dev->irq_enabled)) ret = mtx_sleep(&dev->vblank[crtc].queue, &dev->irq_lock, PCATCH, "vblwtq", - 3 * DRM_HZ); + DRM_HZ); mtx_unlock(&dev->irq_lock); } @@ -492,42 +482,16 @@ int drm_wait_vblank(struct drm_device *d } done: + DRM_SPINLOCK(&dev->vbl_lock); drm_vblank_put(dev, crtc); - return ret; -} - -void drm_vbl_send_signals(struct drm_device *dev, int crtc) -{ -} - -#if 0 /* disabled */ -void drm_vbl_send_signals(struct drm_device *dev, int crtc ) -{ - drm_vbl_sig_t *vbl_sig; - unsigned int vbl_seq = atomic_read( &dev->vbl_received ); - struct proc *p; - - vbl_sig = TAILQ_FIRST(&dev->vbl_sig_list); - while (vbl_sig != NULL) { - drm_vbl_sig_t *next = TAILQ_NEXT(vbl_sig, link); - - if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) { - p = pfind(vbl_sig->pid); - if (p != NULL) - psignal(p, vbl_sig->signo); + DRM_SPINUNLOCK(&dev->vbl_lock); - TAILQ_REMOVE(&dev->vbl_sig_list, vbl_sig, link); - DRM_FREE(vbl_sig,sizeof(*vbl_sig)); - } - vbl_sig = next; - } + return ret; } -#endif void drm_handle_vblank(struct drm_device *dev, int crtc) { - atomic_inc(&dev->vblank[crtc].count); + atomic_add_rel_32(&dev->vblank[crtc].count, 1); DRM_WAKEUP(&dev->vblank[crtc].queue); - drm_vbl_send_signals(dev, crtc); } Modified: stable/7/sys/dev/drm/drm_sysctl.c ============================================================================== --- stable/7/sys/dev/drm/drm_sysctl.c Mon Jul 27 16:03:04 2009 (r195911) +++ stable/7/sys/dev/drm/drm_sysctl.c Mon Jul 27 16:05:51 2009 (r195912) @@ -38,6 +38,7 @@ static int drm_name_info DRM_SYSCTL_H static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS; static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS; static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS; +static int drm_vblank_info DRM_SYSCTL_HANDLER_ARGS; struct drm_sysctl_list { const char *name; @@ -47,6 +48,7 @@ struct drm_sysctl_list { {"vm", drm_vm_info}, {"clients", drm_clients_info}, {"bufs", drm_bufs_info}, + {"vblank", drm_vblank_info}, }; #define DRM_SYSCTL_ENTRIES (sizeof(drm_sysctl_list)/sizeof(drm_sysctl_list[0])) @@ -313,3 +315,25 @@ done: free(tempprivs, DRM_MEM_DRIVER); return retcode; } + +static int drm_vblank_info DRM_SYSCTL_HANDLER_ARGS +{ + struct drm_device *dev = arg1; + char buf[128]; + int retcode; + int i; + + DRM_SYSCTL_PRINT("\ncrtc ref count last enabled inmodeset\n"); + for(i = 0 ; i < dev->num_crtcs ; i++) { + DRM_SYSCTL_PRINT(" %02d %02d %08d %08d %02d %02d\n", + i, atomic_load_acq_32(&dev->vblank[i].refcount), + atomic_load_acq_32(&dev->vblank[i].count), + atomic_load_acq_32(&dev->vblank[i].last), + atomic_load_acq_int(&dev->vblank[i].enabled), + atomic_load_acq_int(&dev->vblank[i].inmodeset)); + } + + SYSCTL_OUT(req, "", -1); +done: + return retcode; +} Modified: stable/7/sys/dev/drm/i915_dma.c ============================================================================== --- stable/7/sys/dev/drm/i915_dma.c Mon Jul 27 16:03:04 2009 (r195911) +++ stable/7/sys/dev/drm/i915_dma.c Mon Jul 27 16:05:51 2009 (r195912) @@ -644,18 +644,17 @@ static int i915_batchbuffer(struct drm_d return -EFAULT; } } - DRM_LOCK(); ret = i915_dispatch_batchbuffer(dev, batch); - if (sarea_priv) - sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); - - DRM_UNLOCK(); if (batch->num_cliprects) vsunlock(batch->cliprects, cliplen); + DRM_LOCK(); + if (sarea_priv) + sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); + return ret; } @@ -697,10 +696,9 @@ static int i915_cmdbuffer(struct drm_dev return -EFAULT; } } - DRM_LOCK(); ret = i915_dispatch_cmdbuffer(dev, cmdbuf); - DRM_UNLOCK(); + if (cmdbuf->num_cliprects) { vsunlock(cmdbuf->buf, cmdbuf->sz); vsunlock(cmdbuf->cliprects, cliplen); Modified: stable/7/sys/dev/drm/i915_drv.c ============================================================================== --- stable/7/sys/dev/drm/i915_drv.c Mon Jul 27 16:03:04 2009 (r195911) +++ stable/7/sys/dev/drm/i915_drv.c Mon Jul 27 16:05:51 2009 (r195912) @@ -52,7 +52,10 @@ static int i915_suspend(device_t kdev) return -ENODEV; } + DRM_LOCK(); + DRM_DEBUG("starting suspend\n"); i915_save_state(dev); + DRM_UNLOCK(); return (bus_generic_suspend(kdev)); } @@ -61,7 +64,10 @@ static int i915_resume(device_t kdev) { struct drm_device *dev = device_get_softc(kdev); + DRM_LOCK(); i915_restore_state(dev); + DRM_DEBUG("finished resume\n"); + DRM_UNLOCK(); return (bus_generic_resume(kdev)); } Modified: stable/7/sys/dev/drm/i915_drv.h ============================================================================== --- stable/7/sys/dev/drm/i915_drv.h Mon Jul 27 16:03:04 2009 (r195911) +++ stable/7/sys/dev/drm/i915_drv.h Mon Jul 27 16:05:51 2009 (r195912) @@ -129,7 +129,6 @@ typedef struct drm_i915_private { int page_flipping; wait_queue_head_t irq_queue; - atomic_t irq_received; /** Protects user_irq_refcount and irq_mask_reg */ DRM_SPINTYPE user_irq_lock; /** Refcount for i915_user_irq_get() versus i915_user_irq_put(). */ Modified: stable/7/sys/dev/drm/i915_irq.c ============================================================================== --- stable/7/sys/dev/drm/i915_irq.c Mon Jul 27 16:03:04 2009 (r195911) +++ stable/7/sys/dev/drm/i915_irq.c Mon Jul 27 16:05:51 2009 (r195912) @@ -53,12 +53,6 @@ __FBSDID("$FreeBSD$"); #define I915_INTERRUPT_ENABLE_MASK (I915_INTERRUPT_ENABLE_FIX | \ I915_INTERRUPT_ENABLE_VAR) -#define I915_PIPE_VBLANK_STATUS (PIPE_START_VBLANK_INTERRUPT_STATUS |\ - PIPE_VBLANK_INTERRUPT_STATUS) - -#define I915_PIPE_VBLANK_ENABLE (PIPE_START_VBLANK_INTERRUPT_ENABLE |\ - PIPE_VBLANK_INTERRUPT_ENABLE) - #define DRM_I915_VBLANK_PIPE_ALL (DRM_I915_VBLANK_PIPE_A | \ DRM_I915_VBLANK_PIPE_B) @@ -154,7 +148,7 @@ u32 i915_get_vblank_counter(struct drm_d low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL; if (!i915_pipe_enabled(dev, pipe)) { - DRM_ERROR("trying to get vblank count for disabled pipe %d\n", pipe); + DRM_DEBUG("trying to get vblank count for disabled pipe %d\n", pipe); return 0; } @@ -183,7 +177,7 @@ u32 g45_get_vblank_counter(struct drm_de int reg = pipe ? PIPEB_FRMCOUNT_GM45 : PIPEA_FRMCOUNT_GM45; if (!i915_pipe_enabled(dev, pipe)) { - DRM_ERROR("trying to get vblank count for disabled pipe %d\n", pipe); + DRM_DEBUG("trying to get vblank count for disabled pipe %d\n", pipe); return 0; } @@ -200,12 +194,10 @@ irqreturn_t i915_driver_irq_handler(DRM_ u32 vblank_enable; int irq_received; - atomic_inc(&dev_priv->irq_received); - iir = I915_READ(IIR); if (IS_I965G(dev)) { - vblank_status = I915_START_VBLANK_INTERRUPT_STATUS; + vblank_status = PIPE_START_VBLANK_INTERRUPT_STATUS; vblank_enable = PIPE_START_VBLANK_INTERRUPT_ENABLE; } else { vblank_status = I915_VBLANK_INTERRUPT_STATUS; @@ -305,9 +297,12 @@ void i915_user_irq_get(struct drm_device { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; + if (dev->irq_enabled == 0) + return; + DRM_DEBUG("\n"); DRM_SPINLOCK(&dev_priv->user_irq_lock); - if (dev->irq_enabled && (++dev_priv->user_irq_refcount == 1)) + if (++dev_priv->user_irq_refcount == 1) i915_enable_irq(dev_priv, I915_USER_INTERRUPT); DRM_SPINUNLOCK(&dev_priv->user_irq_lock); } @@ -316,12 +311,13 @@ void i915_user_irq_put(struct drm_device { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; + if (dev->irq_enabled == 0) + return; + DRM_SPINLOCK(&dev_priv->user_irq_lock); - if (dev->irq_enabled) { - KASSERT(dev_priv->user_irq_refcount > 0, ("invalid refcount")); - if (--dev_priv->user_irq_refcount == 0) - i915_disable_irq(dev_priv, I915_USER_INTERRUPT); - } + KASSERT(dev_priv->user_irq_refcount > 0, ("invalid refcount")); + if (--dev_priv->user_irq_refcount == 0) + i915_disable_irq(dev_priv, I915_USER_INTERRUPT); DRM_SPINUNLOCK(&dev_priv->user_irq_lock); } @@ -408,11 +404,8 @@ int i915_irq_wait(struct drm_device *dev int i915_enable_vblank(struct drm_device *dev, int pipe) { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; - int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; - u32 pipeconf; - pipeconf = I915_READ(pipeconf_reg); - if (!(pipeconf & PIPEACONF_ENABLE)) + if (!i915_pipe_enabled(dev, pipe)) return -EINVAL; DRM_SPINLOCK(&dev_priv->user_irq_lock); @@ -500,8 +493,6 @@ void i915_driver_irq_preinstall(struct d { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; - atomic_set_int(&dev_priv->irq_received, 0); - I915_WRITE(HWSTAM, 0xeffe); I915_WRITE(PIPEASTAT, 0); I915_WRITE(PIPEBSTAT, 0); @@ -519,9 +510,6 @@ int i915_driver_irq_postinstall(struct d /* Unmask the interrupts that we always want on. */ dev_priv->irq_mask_reg = ~I915_INTERRUPT_ENABLE_FIX; - dev_priv->pipestat[0] = 0; - dev_priv->pipestat[1] = 0; - /* Disable pipe interrupt enables, clear pending pipe status */ I915_WRITE(PIPEASTAT, I915_READ(PIPEASTAT) & 0x8000ffff); I915_WRITE(PIPEBSTAT, I915_READ(PIPEBSTAT) & 0x8000ffff); @@ -531,6 +519,10 @@ int i915_driver_irq_postinstall(struct d I915_WRITE(IER, I915_INTERRUPT_ENABLE_MASK); I915_WRITE(IMR, dev_priv->irq_mask_reg); + I915_WRITE(PIPEASTAT, dev_priv->pipestat[0] | + (dev_priv->pipestat[0] >> 16)); + I915_WRITE(PIPEBSTAT, dev_priv->pipestat[1] | + (dev_priv->pipestat[1] >> 16)); (void) I915_READ(IER); return 0; Modified: stable/7/sys/dev/drm/radeon_cp.c ============================================================================== --- stable/7/sys/dev/drm/radeon_cp.c Mon Jul 27 16:03:04 2009 (r195911) +++ stable/7/sys/dev/drm/radeon_cp.c Mon Jul 27 16:05:51 2009 (r195912) @@ -2064,16 +2064,22 @@ int radeon_driver_load(struct drm_device drm_get_resource_len(dev, 2), _DRM_REGISTERS, _DRM_READ_ONLY | _DRM_DRIVER, &dev_priv->mmio); if (ret != 0) - return ret; + goto error; ret = drm_vblank_init(dev, 2); - if (ret) { - radeon_driver_unload(dev); - return ret; - } + if (ret != 0) + goto error; + + dev->max_vblank_count = 0x001fffff; DRM_DEBUG("%s card detected\n", - ((dev_priv->flags & RADEON_IS_AGP) ? "AGP" : (((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI")))); + ((dev_priv->flags & RADEON_IS_AGP) ? "AGP" : + (((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI")))); + + return ret; + +error: + radeon_driver_unload(dev); return ret; } Modified: stable/7/sys/dev/drm/radeon_irq.c ============================================================================== --- stable/7/sys/dev/drm/radeon_irq.c Mon Jul 27 16:03:04 2009 (r195911) +++ stable/7/sys/dev/drm/radeon_irq.c Mon Jul 27 16:05:51 2009 (r195912) @@ -380,8 +380,6 @@ int radeon_driver_irq_postinstall(struct atomic_set(&dev_priv->swi_emitted, 0); DRM_INIT_WAITQUEUE(&dev_priv->swi_queue); - dev->max_vblank_count = 0x001fffff; - radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1); return 0; From rnoland at FreeBSD.org Mon Jul 27 16:11:45 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Mon Jul 27 16:12:01 2009 Subject: svn commit: r195913 - in stable/7/sys: . contrib/pf dev/drm Message-ID: <200907271611.n6RGBicY005642@svn.freebsd.org> Author: rnoland Date: Mon Jul 27 16:11:44 2009 New Revision: 195913 URL: http://svn.freebsd.org/changeset/base/195913 Log: MFC r195501 Add support for Radeon HD 4770 (RV740) chips. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/drm/drm_pciids.h stable/7/sys/dev/drm/r600_cp.c stable/7/sys/dev/drm/radeon_drv.h Modified: stable/7/sys/dev/drm/drm_pciids.h ============================================================================== --- stable/7/sys/dev/drm/drm_pciids.h Mon Jul 27 16:05:51 2009 (r195912) +++ stable/7/sys/dev/drm/drm_pciids.h Mon Jul 27 16:11:44 2009 (r195913) @@ -257,6 +257,11 @@ {0x1002, 0x940A, CHIP_R600|RADEON_NEW_MEMMAP, "ATI FireGL V8650"}, \ {0x1002, 0x940B, CHIP_R600|RADEON_NEW_MEMMAP, "ATI FireGL V8600"}, \ {0x1002, 0x940F, CHIP_R600|RADEON_NEW_MEMMAP, "ATI FireGL V7600"}, \ + {0x1002, 0x94A0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4830"}, \ + {0x1002, 0x94A1, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4850"}, \ + {0x1002, 0x94B1, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI RV740"}, \ + {0x1002, 0x94B3, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI Radeon HD 4770"}, \ + {0x1002, 0x94B5, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI Radeon HD 4770"}, \ {0x1002, 0x94C0, CHIP_RV610|RADEON_NEW_MEMMAP, "RV610"}, \ {0x1002, 0x94C1, CHIP_RV610|RADEON_NEW_MEMMAP, "Radeon HD 2400 XT"}, \ {0x1002, 0x94C3, CHIP_RV610|RADEON_NEW_MEMMAP, "Radeon HD 2400 Pro"}, \ Modified: stable/7/sys/dev/drm/r600_cp.c ============================================================================== --- stable/7/sys/dev/drm/r600_cp.c Mon Jul 27 16:05:51 2009 (r195912) +++ stable/7/sys/dev/drm/r600_cp.c Mon Jul 27 16:11:44 2009 (r195913) @@ -421,7 +421,8 @@ static void r700_cp_load_microcode(drm_r cp = RV770_cp_microcode; break; case CHIP_RV730: - DRM_INFO("Loading RV730 Microcode\n"); + case CHIP_RV740: + DRM_INFO("Loading RV730/RV740 Microcode\n"); pfp = RV730_pfp_microcode; cp = RV730_cp_microcode; break; @@ -1244,6 +1245,31 @@ static void r700_gfx_init(struct drm_dev dev_priv->r700_sc_hiz_tile_fifo_size = 0x30; dev_priv->r700_sc_earlyz_tile_fifo_fize = 0x130; break; + case CHIP_RV740: + dev_priv->r600_max_pipes = 4; + dev_priv->r600_max_tile_pipes = 4; + dev_priv->r600_max_simds = 8; + dev_priv->r600_max_backends = 4; + dev_priv->r600_max_gprs = 256; + dev_priv->r600_max_threads = 248; + dev_priv->r600_max_stack_entries = 512; + dev_priv->r600_max_hw_contexts = 8; + dev_priv->r600_max_gs_threads = 16 * 2; + dev_priv->r600_sx_max_export_size = 256; + dev_priv->r600_sx_max_export_pos_size = 32; + dev_priv->r600_sx_max_export_smx_size = 224; + dev_priv->r600_sq_num_cf_insts = 2; + + dev_priv->r700_sx_num_of_sets = 7; + dev_priv->r700_sc_prim_fifo_size = 0x100; + dev_priv->r700_sc_hiz_tile_fifo_size = 0x30; + dev_priv->r700_sc_earlyz_tile_fifo_fize = 0x130; + + if (dev_priv->r600_sx_max_export_pos_size > 16) { + dev_priv->r600_sx_max_export_pos_size -= 16; + dev_priv->r600_sx_max_export_smx_size += 16; + } + break; case CHIP_RV730: dev_priv->r600_max_pipes = 2; dev_priv->r600_max_tile_pipes = 4; @@ -1263,6 +1289,11 @@ static void r700_gfx_init(struct drm_dev dev_priv->r700_sc_prim_fifo_size = 0xf9; dev_priv->r700_sc_hiz_tile_fifo_size = 0x30; dev_priv->r700_sc_earlyz_tile_fifo_fize = 0x130; + + if (dev_priv->r600_sx_max_export_pos_size > 16) { + dev_priv->r600_sx_max_export_pos_size -= 16; + dev_priv->r600_sx_max_export_smx_size += 16; + } break; case CHIP_RV710: dev_priv->r600_max_pipes = 2; @@ -1430,6 +1461,7 @@ static void r700_gfx_init(struct drm_dev case CHIP_RV770: sq_ms_fifo_sizes |= R600_FETCH_FIFO_HIWATER(0x1); break; + case CHIP_RV740: case CHIP_RV730: case CHIP_RV710: default: @@ -1507,6 +1539,7 @@ static void r700_gfx_init(struct drm_dev switch (dev_priv->flags & RADEON_FAMILY_MASK) { case CHIP_RV770: + case CHIP_RV740: case CHIP_RV730: gs_prim_buffer_depth = 384; break; Modified: stable/7/sys/dev/drm/radeon_drv.h ============================================================================== --- stable/7/sys/dev/drm/radeon_drv.h Mon Jul 27 16:05:51 2009 (r195912) +++ stable/7/sys/dev/drm/radeon_drv.h Mon Jul 27 16:11:44 2009 (r195913) @@ -146,6 +146,7 @@ enum radeon_family { CHIP_RV670, CHIP_RS780, CHIP_RV770, + CHIP_RV740, CHIP_RV730, CHIP_RV710, CHIP_LAST, From dougb at FreeBSD.org Tue Jul 28 23:42:40 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Tue Jul 28 23:42:47 2009 Subject: svn commit: r195932 - stable/7/contrib/bind9 Message-ID: <200907282342.n6SNgd7A047000@svn.freebsd.org> Author: dougb Date: Tue Jul 28 23:42:39 2009 New Revision: 195932 URL: http://svn.freebsd.org/changeset/base/195932 Log: These files don't belong in contrib at all anymore, so remove them. Deleted: stable/7/contrib/bind9/FREEBSD-Upgrade stable/7/contrib/bind9/FREEBSD-Xlist From dougb at FreeBSD.org Tue Jul 28 23:59:23 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Tue Jul 28 23:59:39 2009 Subject: svn commit: r195933 - in stable/7/contrib/bind9: . bin/named lib/dns Message-ID: <200907282359.n6SNxMib047455@svn.freebsd.org> Author: dougb Date: Tue Jul 28 23:59:22 2009 New Revision: 195933 URL: http://svn.freebsd.org/changeset/base/195933 Log: Update to version 9.4.3-P3 which addresses a remote DoS vulnerability: Receipt of a specially-crafted dynamic update message may cause BIND 9 servers to exit. This vulnerability affects all servers -- it is not limited to those that are configured to allow dynamic updates. Access controls will not provide an effective workaround. More details can be found here: https://www.isc.org/node/474 All BIND users are encouraged to update to a patched version ASAP. Modified: stable/7/contrib/bind9/ (props changed) stable/7/contrib/bind9/CHANGES (contents, props changed) stable/7/contrib/bind9/bin/named/update.c stable/7/contrib/bind9/lib/dns/validator.c (props changed) stable/7/contrib/bind9/version (contents, props changed) Modified: stable/7/contrib/bind9/CHANGES ============================================================================== --- stable/7/contrib/bind9/CHANGES Tue Jul 28 23:42:39 2009 (r195932) +++ stable/7/contrib/bind9/CHANGES Tue Jul 28 23:59:22 2009 (r195933) @@ -1,3 +1,8 @@ + --- 9.4.3-P3 released --- + +2640. [security] A specially crafted update packet will cause named + to exit. [RT #20000] + --- 9.4.3-P2 released --- 2579. [bug] DNSSEC lookaside validation failed to handle unknown Modified: stable/7/contrib/bind9/bin/named/update.c ============================================================================== --- stable/7/contrib/bind9/bin/named/update.c Tue Jul 28 23:42:39 2009 (r195932) +++ stable/7/contrib/bind9/bin/named/update.c Tue Jul 28 23:59:22 2009 (r195933) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: update.c,v 1.109.18.27 2008/02/07 03:16:08 marka Exp $ */ +/* $Id: update.c,v 1.109.18.27.4.1 2009/07/28 13:57:27 marka Exp $ */ #include @@ -865,7 +865,11 @@ temp_check(isc_mem_t *mctx, dns_diff_t * if (type == dns_rdatatype_rrsig || type == dns_rdatatype_sig) covers = dns_rdata_covers(&t->rdata); - else + else if (type == dns_rdatatype_any) { + dns_db_detachnode(db, &node); + dns_diff_clear(&trash); + return (DNS_R_NXRRSET); + } else covers = 0; /* Modified: stable/7/contrib/bind9/version ============================================================================== --- stable/7/contrib/bind9/version Tue Jul 28 23:42:39 2009 (r195932) +++ stable/7/contrib/bind9/version Tue Jul 28 23:59:22 2009 (r195933) @@ -1,4 +1,4 @@ -# $Id: version,v 1.29.134.23.2.2 2009/03/17 02:23:49 marka Exp $ +# $Id: version,v 1.29.134.23.2.3 2009/07/28 13:57:27 marka Exp $ # # This file must follow /bin/sh rules. It is imported directly via # configure. @@ -7,4 +7,4 @@ MAJORVER=9 MINORVER=4 PATCHVER=3 RELEASETYPE=-P -RELEASEVER=2 +RELEASEVER=3 From jamie at FreeBSD.org Thu Jul 30 05:36:32 2009 From: jamie at FreeBSD.org (Jamie Gritton) Date: Thu Jul 30 05:36:44 2009 Subject: svn commit: r195969 - stable/7/usr.sbin/jexec Message-ID: <200907300536.n6U5aVrM093284@svn.freebsd.org> Author: jamie Date: Thu Jul 30 05:36:31 2009 New Revision: 195969 URL: http://svn.freebsd.org/changeset/base/195969 Log: Preset errno to zero before calling strtol(), so the check afterwards will be valid. This is required since the malloc call from r195859 leaves errno in an unknown state. For STABLE-7 only, as CURRENT doesn't make this strtol call. Reported by: Michael Butler Approved by: bz (mentor) Modified: stable/7/usr.sbin/jexec/jexec.c Modified: stable/7/usr.sbin/jexec/jexec.c ============================================================================== --- stable/7/usr.sbin/jexec/jexec.c Thu Jul 30 00:57:54 2009 (r195968) +++ stable/7/usr.sbin/jexec/jexec.c Thu Jul 30 05:36:31 2009 (r195969) @@ -248,6 +248,7 @@ main(int argc, char *argv[]) if (argc < 2) usage(); if (strlen(argv[0]) > 0) { + errno = 0; jid = (int)strtol(argv[0], NULL, 10); if (errno) err(1, "Unable to parse jail ID."); From mav at FreeBSD.org Thu Jul 30 13:19:14 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Thu Jul 30 13:19:19 2009 Subject: svn commit: r195973 - in stable/7/sys: . contrib/pf dev/ata Message-ID: <200907301319.n6UDJC6B014743@svn.freebsd.org> Author: mav Date: Thu Jul 30 13:19:12 2009 New Revision: 195973 URL: http://svn.freebsd.org/changeset/base/195973 Log: MFC rev. 195724: Limit IOCATAREQUEST ioctl data size to controller's maximum I/O size. It fixes kernel panic when requested size is too large (0xffffffff). PR: kern/136726 Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ata/ata-all.c Modified: stable/7/sys/dev/ata/ata-all.c ============================================================================== --- stable/7/sys/dev/ata/ata-all.c Thu Jul 30 12:41:19 2009 (r195972) +++ stable/7/sys/dev/ata/ata-all.c Thu Jul 30 13:19:12 2009 (r195973) @@ -440,6 +440,7 @@ int ata_device_ioctl(device_t dev, u_long cmd, caddr_t data) { struct ata_device *atadev = device_get_softc(dev); + struct ata_channel *ch = device_get_softc(device_get_parent(dev)); struct ata_ioc_request *ioc_request = (struct ata_ioc_request *)data; struct ata_params *params = (struct ata_params *)data; int *mode = (int *)data; @@ -449,6 +450,10 @@ ata_device_ioctl(device_t dev, u_long cm switch (cmd) { case IOCATAREQUEST: + if (ioc_request->count > + (ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS)) { + return (EFBIG); + } if (!(buf = malloc(ioc_request->count, M_ATA, M_NOWAIT))) { return ENOMEM; } From oliver.pntr at gmail.com Fri Jul 31 04:37:54 2009 From: oliver.pntr at gmail.com (Oliver Pinter) Date: Fri Jul 31 04:38:10 2009 Subject: svn commit: r195973 - in stable/7/sys: . contrib/pf dev/ata In-Reply-To: <200907301319.n6UDJC6B014743@svn.freebsd.org> References: <200907301319.n6UDJC6B014743@svn.freebsd.org> Message-ID: <6101e8c40907302114l46e6a0f2wa783384a80504a0@mail.gmail.com> fix complie error, tested, booted, used On 7/30/09, Alexander Motin wrote: > Author: mav > Date: Thu Jul 30 13:19:12 2009 > New Revision: 195973 > URL: http://svn.freebsd.org/changeset/base/195973 > > Log: > MFC rev. 195724: > > Limit IOCATAREQUEST ioctl data size to controller's maximum I/O size. > It fixes kernel panic when requested size is too large (0xffffffff). > > PR: kern/136726 > > Modified: > stable/7/sys/ (props changed) > stable/7/sys/contrib/pf/ (props changed) > stable/7/sys/dev/ata/ata-all.c > > Modified: stable/7/sys/dev/ata/ata-all.c > ============================================================================== > --- stable/7/sys/dev/ata/ata-all.c Thu Jul 30 12:41:19 2009 (r195972) > +++ stable/7/sys/dev/ata/ata-all.c Thu Jul 30 13:19:12 2009 (r195973) > @@ -440,6 +440,7 @@ int > ata_device_ioctl(device_t dev, u_long cmd, caddr_t data) > { > struct ata_device *atadev = device_get_softc(dev); > + struct ata_channel *ch = device_get_softc(device_get_parent(dev)); > struct ata_ioc_request *ioc_request = (struct ata_ioc_request *)data; > struct ata_params *params = (struct ata_params *)data; > int *mode = (int *)data; > @@ -449,6 +450,10 @@ ata_device_ioctl(device_t dev, u_long cm > > switch (cmd) { > case IOCATAREQUEST: > + if (ioc_request->count > > + (ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS)) { > + return (EFBIG); > + } > if (!(buf = malloc(ioc_request->count, M_ATA, M_NOWAIT))) { > return ENOMEM; > } > _______________________________________________ > svn-src-stable-7@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7 > To unsubscribe, send any mail to "svn-src-stable-7-unsubscribe@freebsd.org" > -------------- next part -------------- A non-text attachment was scrubbed... Name: ata_compile_fix.diff Type: text/x-diff Size: 932 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-stable-7/attachments/20090731/893e1eca/ata_compile_fix.bin From mav at FreeBSD.org Fri Jul 31 07:53:11 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Fri Jul 31 07:53:27 2009 Subject: svn commit: r195987 - stable/7/sys/dev/ata Message-ID: <200907310753.n6V7rAeg059805@svn.freebsd.org> Author: mav Date: Fri Jul 31 07:53:09 2009 New Revision: 195987 URL: http://svn.freebsd.org/changeset/base/195987 Log: Fix build breakage introduced by rev. 195973 due to difference from HEAD, Submitted by: Oliver Pinter Modified: stable/7/sys/dev/ata/ata-all.c Modified: stable/7/sys/dev/ata/ata-all.c ============================================================================== --- stable/7/sys/dev/ata/ata-all.c Fri Jul 31 01:04:35 2009 (r195986) +++ stable/7/sys/dev/ata/ata-all.c Fri Jul 31 07:53:09 2009 (r195987) @@ -451,7 +451,7 @@ ata_device_ioctl(device_t dev, u_long cm switch (cmd) { case IOCATAREQUEST: if (ioc_request->count > - (ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS)) { + (ch->dma->max_iosize ? ch->dma->max_iosize : DFLTPHYS)) { return (EFBIG); } if (!(buf = malloc(ioc_request->count, M_ATA, M_NOWAIT))) { From mav at FreeBSD.org Fri Jul 31 08:54:11 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Fri Jul 31 08:54:18 2009 Subject: svn commit: r195973 - in stable/7/sys: . contrib/pf dev/ata In-Reply-To: <6101e8c40907302114l46e6a0f2wa783384a80504a0@mail.gmail.com> References: <200907301319.n6UDJC6B014743@svn.freebsd.org> <6101e8c40907302114l46e6a0f2wa783384a80504a0@mail.gmail.com> Message-ID: <4A72A31D.3030103@FreeBSD.org> Oliver Pinter wrote: > fix complie error, tested, booted, used Fixed. Thanks. Sorry. > On 7/30/09, Alexander Motin wrote: >> Author: mav >> Date: Thu Jul 30 13:19:12 2009 >> New Revision: 195973 >> URL: http://svn.freebsd.org/changeset/base/195973 >> >> Log: >> MFC rev. 195724: >> >> Limit IOCATAREQUEST ioctl data size to controller's maximum I/O size. >> It fixes kernel panic when requested size is too large (0xffffffff). >> >> PR: kern/136726 -- Alexander Motin From jhb at FreeBSD.org Fri Jul 31 20:32:56 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Fri Jul 31 20:33:16 2009 Subject: svn commit: r196006 - in stable/7: . lib/libc lib/libc/gen lib/libc/include lib/libc/sys sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/contrib/pf sys/i386/ibcs2 sys/kern sys/sys usr... Message-ID: <200907312032.n6VKWtZG080053@svn.freebsd.org> Author: jhb Date: Fri Jul 31 20:32:55 2009 New Revision: 196006 URL: http://svn.freebsd.org/changeset/base/196006 Log: MFC: Change the ABI of some of the structures used by the SYSV IPC API: - Various members of struct ipc_perm use appropriate types instead of unsigned short. - The shm_segsz member of struct shmid_ds is now a size_t instead of an int which should allow for complete support of SYSV SHM regions >= 2GB. - The shm_nattch member of struct shmid_ds is now an int instead of a short. - The existing versions of the __semctl(), msgctl(), and shmctl() system calls have been renamed to freebsd7_*() and implement the old ABI. New versions of these system calls provide the new ABI. The new system calls also use newer symbol versions in libc so old and new binaries will both work under new kernels. - Specific to 7.x: the kern_msgctl(), kern_semctl(), and kern_shmctl() functions now use ABI shims that transparently "rename" the functions to kern_new_*() for all new modules. Existing compat functions under the old names remain to provide compatibility for older kernel modules. Added: stable/7/lib/libc/include/compat.h - copied unchanged from r194910, head/lib/libc/include/compat.h Modified: stable/7/UPDATING stable/7/lib/libc/ (props changed) stable/7/lib/libc/gen/Symbol.map stable/7/lib/libc/gen/msgctl.3 stable/7/lib/libc/gen/semctl.c stable/7/lib/libc/sys/Makefile.inc stable/7/lib/libc/sys/Symbol.map stable/7/lib/libc/sys/semctl.2 stable/7/lib/libc/sys/shmctl.2 stable/7/sys/ (props changed) stable/7/sys/compat/freebsd32/freebsd32_ipc.h stable/7/sys/compat/freebsd32/freebsd32_misc.c stable/7/sys/compat/freebsd32/syscalls.master stable/7/sys/compat/linux/linux_ipc.c stable/7/sys/compat/svr4/svr4_ipc.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/ibcs2/ibcs2_ipc.c stable/7/sys/kern/syscalls.master stable/7/sys/kern/sysv_ipc.c stable/7/sys/kern/sysv_msg.c stable/7/sys/kern/sysv_sem.c stable/7/sys/kern/sysv_shm.c stable/7/sys/sys/ipc.h stable/7/sys/sys/msg.h stable/7/sys/sys/param.h stable/7/sys/sys/sem.h stable/7/sys/sys/shm.h stable/7/sys/sys/syscallsubr.h stable/7/usr.bin/ipcs/ (props changed) stable/7/usr.bin/ipcs/ipcs.c Modified: stable/7/UPDATING ============================================================================== --- stable/7/UPDATING Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/UPDATING Fri Jul 31 20:32:55 2009 (r196006) @@ -8,6 +8,10 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20090731: + The ABI of various structures related to the SYSV IPC API have + been changed. Bump __FreeBSD_version to 702105. + 20090606: The components of PmcTools have been upgraded. Please update world and the kernel. Modified: stable/7/lib/libc/gen/Symbol.map ============================================================================== --- stable/7/lib/libc/gen/Symbol.map Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/lib/libc/gen/Symbol.map Fri Jul 31 20:32:55 2009 (r196006) @@ -257,7 +257,6 @@ FBSD_1.0 { sem_timedwait; sem_post; sem_getvalue; - semctl; setdomainname; sethostname; longjmperror; @@ -339,6 +338,7 @@ FBSD_1.0 { FBSD_1.1 { fdopendir; feature_present; + semctl; }; FBSDprivate_1.0 { Modified: stable/7/lib/libc/gen/msgctl.3 ============================================================================== --- stable/7/lib/libc/gen/msgctl.3 Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/lib/libc/gen/msgctl.3 Fri Jul 31 20:32:55 2009 (r196006) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd November 24, 1997 +.Dd April 3, 2008 .Dt MSGCTL 3 .Os .Sh NAME @@ -65,18 +65,14 @@ struct msqid_ds { struct ipc_perm msg_perm; /* msg queue permission bits */ struct msg *msg_first; /* first message in the queue */ struct msg *msg_last; /* last message in the queue */ - u_long msg_cbytes; /* number of bytes in use on the queue */ - u_long msg_qnum; /* number of msgs in the queue */ - u_long msg_qbytes; /* max # of bytes on the queue */ + msglen_t msg_cbytes; /* number of bytes in use on the queue */ + msgqnum_t msg_qnum; /* number of msgs in the queue */ + msglen_t msg_qbytes; /* max # of bytes on the queue */ pid_t msg_lspid; /* pid of last msgsnd() */ pid_t msg_lrpid; /* pid of last msgrcv() */ time_t msg_stime; /* time of last msgsnd() */ - long msg_pad1; time_t msg_rtime; /* time of last msgrcv() */ - long msg_pad2; time_t msg_ctime; /* time of last msgctl() */ - long msg_pad3; - long msg_pad4[4]; }; .Ed .Pp @@ -89,13 +85,13 @@ structure is defined in and looks like this: .Bd -literal struct ipc_perm { - ushort cuid; /* creator user id */ - ushort cgid; /* creator group id */ - ushort uid; /* user id */ - ushort gid; /* group id */ - ushort mode; /* r/w permission */ - ushort seq; /* sequence # (to generate unique msg/sem/shm id) */ - key_t key; /* user specified msg/sem/shm key */ + uid_t cuid; /* creator user id */ + gid_t cgid; /* creator group id */ + uid_t uid; /* user id */ + gid_t gid; /* group id */ + mode_t mode; /* r/w permission */ + unsigned short seq; /* sequence # (to generate unique ipcid) */ + key_t key; /* user specified msg/sem/shm key */ }; .Ed .Pp Modified: stable/7/lib/libc/gen/semctl.c ============================================================================== --- stable/7/lib/libc/gen/semctl.c Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/lib/libc/gen/semctl.c Fri Jul 31 20:32:55 2009 (r196006) @@ -29,15 +29,19 @@ #include __FBSDID("$FreeBSD$"); +#define _WANT_SEMUN_OLD + #include #include #include #include #include -extern int __semctl(int semid, int semnum, int cmd, union semun *arg); +int __semctl(int semid, int semnum, int cmd, union semun *arg); +int freebsd7___semctl(int semid, int semnum, int cmd, union semun_old *arg); -int semctl(int semid, int semnum, int cmd, ...) +int +semctl(int semid, int semnum, int cmd, ...) { va_list ap; union semun semun; @@ -55,3 +59,25 @@ int semctl(int semid, int semnum, int cm return (__semctl(semid, semnum, cmd, semun_ptr)); } + +int +freebsd7_semctl(int semid, int semnum, int cmd, ...) +{ + va_list ap; + union semun_old semun; + union semun_old *semun_ptr; + + va_start(ap, cmd); + if (cmd == IPC_SET || cmd == IPC_STAT || cmd == GETALL + || cmd == SETVAL || cmd == SETALL) { + semun = va_arg(ap, union semun_old); + semun_ptr = &semun; + } else { + semun_ptr = NULL; + } + va_end(ap); + + return (freebsd7___semctl(semid, semnum, cmd, semun_ptr)); +} + +__sym_compat(semctl, freebsd7_semctl, FBSD_1.0); Copied: stable/7/lib/libc/include/compat.h (from r194910, head/lib/libc/include/compat.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/lib/libc/include/compat.h Fri Jul 31 20:32:55 2009 (r196006, copy of r194910, head/lib/libc/include/compat.h) @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 2009 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (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$ + */ + +/* + * This file defines compatiblity symbol versions for old system calls. It + * is included in all generated system call files. + */ + +#ifndef __LIBC_COMPAT_H__ +#define __LIBC_COMPAT_H__ + +#define __sym_compat(sym,impl,verid) \ + .symver impl , sym @ verid + +__sym_compat(__semctl, freebsd7___semctl, FBSD_1.0); +__sym_compat(msgctl, freebsd7_msgctl, FBSD_1.0); +__sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0); + +#undef __sym_compat + +#endif /* __LIBC_COMPAT_H__ */ + Modified: stable/7/lib/libc/sys/Makefile.inc ============================================================================== --- stable/7/lib/libc/sys/Makefile.inc Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/lib/libc/sys/Makefile.inc Fri Jul 31 20:32:55 2009 (r196006) @@ -53,11 +53,13 @@ SYM_MAPS+= ${.CURDIR}/sys/Symbol.map CLEANFILES+= ${SASM} ${SPSEUDO} ${SASM}: - printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' > ${.TARGET} + printf '#include "compat.h"\n' > ${.TARGET} + printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' >> ${.TARGET} ${SPSEUDO}: + printf '#include "compat.h"\n' > ${.TARGET} printf '#include "SYS.h"\nPSEUDO(${.PREFIX:S/_//})\n' \ - > ${.TARGET} + >> ${.TARGET} MAN+= _exit.2 abort2.2 accept.2 access.2 acct.2 adjtime.2 \ aio_cancel.2 aio_error.2 aio_read.2 aio_return.2 \ Modified: stable/7/lib/libc/sys/Symbol.map ============================================================================== --- stable/7/lib/libc/sys/Symbol.map Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/lib/libc/sys/Symbol.map Fri Jul 31 20:32:55 2009 (r196006) @@ -31,7 +31,6 @@ FBSD_1.0 { __mac_set_file; __mac_set_link; __mac_set_proc; - __semctl; __setugid; __syscall; __sysctl; @@ -190,7 +189,6 @@ FBSD_1.0 { modstat; mount; mprotect; - msgctl; msgget; msgrcv; msgsnd; @@ -271,7 +269,6 @@ FBSD_1.0 { settimeofday; setuid; shmat; - shmctl; shmdt; shmget; shmsys; @@ -336,13 +333,16 @@ FBSD_1.0 { }; FBSD_1.1 { + __semctl; closefrom; cpuset; cpuset_getid; cpuset_setid; cpuset_getaffinity; cpuset_setaffinity; + msgctl; setfib; + shmctl; }; FBSDprivate_1.0 { Modified: stable/7/lib/libc/sys/semctl.2 ============================================================================== --- stable/7/lib/libc/sys/semctl.2 Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/lib/libc/sys/semctl.2 Fri Jul 31 20:32:55 2009 (r196006) @@ -148,12 +148,9 @@ struct semid_ds { struct sem *sem_base; /* pointer to first semaphore in set */ u_short sem_nsems; /* number of sems in set */ time_t sem_otime; /* last operation time */ - long sem_pad1; /* SVABI/386 says I need this here */ time_t sem_ctime; /* last change time */ /* Times measured in secs since */ /* 00:00:00 GMT, Jan. 1, 1970 */ - long sem_pad2; /* SVABI/386 says I need this here */ - long sem_pad3[4]; /* SVABI/386 says I need this here */ }; .Ed .Sh RETURN VALUES Modified: stable/7/lib/libc/sys/shmctl.2 ============================================================================== --- stable/7/lib/libc/sys/shmctl.2 Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/lib/libc/sys/shmctl.2 Fri Jul 31 20:32:55 2009 (r196006) @@ -100,14 +100,13 @@ structure is defined as follows: .Bd -literal struct shmid_ds { struct ipc_perm shm_perm; /* operation permission structure */ - int shm_segsz; /* size of segment in bytes */ + size_t shm_segsz; /* size of segment in bytes */ pid_t shm_lpid; /* process ID of last shared memory op */ pid_t shm_cpid; /* process ID of creator */ - short shm_nattch; /* number of current attaches */ + int shm_nattch; /* number of current attaches */ time_t shm_atime; /* time of last shmat() */ time_t shm_dtime; /* time of last shmdt() */ time_t shm_ctime; /* time of last change by shmctl() */ - void *shm_internal; /* sysv stupidity */ }; .Ed .Sh RETURN VALUES @@ -133,16 +132,6 @@ the shared memory segment's owner or cre Permission denied due to mismatch between operation and mode of shared memory segment. .El -.Sh "BUGS" -The segment size has size_t type. -The shm_segsz member of the -.Vt shmid_ds -structure has type int, which is too short to represent the full range -of values for a segment size. -If shared memory limits are raised to allow segments with size > 2 GB -to be created, be aware that IPC_STAT call may return a truncated value -for shm_segsz. -.El .Sh "SEE ALSO" .Xr shmat 2 , .Xr shmdt 2 , Modified: stable/7/sys/compat/freebsd32/freebsd32_ipc.h ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_ipc.h Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/sys/compat/freebsd32/freebsd32_ipc.h Fri Jul 31 20:32:55 2009 (r196006) @@ -30,11 +30,11 @@ #define _COMPAT_FREEBSD32_FREEBSD32_IPC_H_ struct ipc_perm32 { - uint16_t cuid; - uint16_t cgid; - uint16_t uid; - uint16_t gid; - uint16_t mode; + uid_t cuid; + gid_t cgid; + uid_t uid; + gid_t gid; + mode_t mode; uint16_t seq; uint32_t key; }; @@ -44,10 +44,7 @@ struct semid_ds32 { uint32_t sem_base; unsigned short sem_nsems; int32_t sem_otime; - int32_t sem_pad1; int32_t sem_ctime; - int32_t sem_pad2; - int32_t sem_pad3[4]; }; union semun32 { @@ -66,24 +63,19 @@ struct msqid_ds32 { pid_t msg_lspid; pid_t msg_lrpid; int32_t msg_stime; - int32_t msg_pad1; int32_t msg_rtime; - int32_t msg_pad2; int32_t msg_ctime; - int32_t msg_pad3; - int32_t msg_pad4[4]; }; struct shmid_ds32 { struct ipc_perm32 shm_perm; int32_t shm_segsz; - int32_t shm_lpid; - int32_t shm_cpid; - int16_t shm_nattch; + pid_t shm_lpid; + pid_t shm_cpid; + int shm_nattch; int32_t shm_atime; int32_t shm_dtime; int32_t shm_ctime; - uint32_t shm_internal; }; struct shm_info32 { @@ -103,4 +95,55 @@ struct shminfo32 { uint32_t shmall; }; +struct ipc_perm32_old { + uint16_t cuid; + uint16_t cgid; + uint16_t uid; + uint16_t gid; + uint16_t mode; + uint16_t seq; + uint32_t key; +}; + +struct semid_ds32_old { + struct ipc_perm32_old sem_perm; + uint32_t sem_base; + unsigned short sem_nsems; + int32_t sem_otime; + int32_t sem_pad1; + int32_t sem_ctime; + int32_t sem_pad2; + int32_t sem_pad3[4]; +}; + +struct msqid_ds32_old { + struct ipc_perm32_old msg_perm; + uint32_t msg_first; + uint32_t msg_last; + uint32_t msg_cbytes; + uint32_t msg_qnum; + uint32_t msg_qbytes; + pid_t msg_lspid; + pid_t msg_lrpid; + int32_t msg_stime; + int32_t msg_pad1; + int32_t msg_rtime; + int32_t msg_pad2; + int32_t msg_ctime; + int32_t msg_pad3; + int32_t msg_pad4[4]; +}; + +struct shmid_ds32_old { + struct ipc_perm32_old shm_perm; + int32_t shm_segsz; + pid_t shm_lpid; + pid_t shm_cpid; + int16_t shm_nattch; + int32_t shm_atime; + int32_t shm_dtime; + int32_t shm_ctime; + uint32_t shm_internal; +}; + #endif /* !_COMPAT_FREEBSD32_FREEBSD32_IPC_H_ */ Modified: stable/7/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_misc.c Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/sys/compat/freebsd32/freebsd32_misc.c Fri Jul 31 20:32:55 2009 (r196006) @@ -1310,6 +1310,32 @@ freebsd4_freebsd32_fhstatfs(struct threa #endif static void +freebsd32_ipcperm_old_in(struct ipc_perm32_old *ip32, struct ipc_perm *ip) +{ + + CP(*ip32, *ip, cuid); + CP(*ip32, *ip, cgid); + CP(*ip32, *ip, uid); + CP(*ip32, *ip, gid); + CP(*ip32, *ip, mode); + CP(*ip32, *ip, seq); + CP(*ip32, *ip, key); +} + +static void +freebsd32_ipcperm_old_out(struct ipc_perm *ip, struct ipc_perm32_old *ip32) +{ + + CP(*ip, *ip32, cuid); + CP(*ip, *ip32, cgid); + CP(*ip, *ip32, uid); + CP(*ip, *ip32, gid); + CP(*ip, *ip32, mode); + CP(*ip, *ip32, seq); + CP(*ip, *ip32, key); +} + +static void freebsd32_ipcperm_in(struct ipc_perm32 *ip32, struct ipc_perm *ip) { @@ -1341,14 +1367,86 @@ freebsd32_semsys(struct thread *td, stru switch (uap->which) { case 0: - return (freebsd32_semctl(td, - (struct freebsd32_semctl_args *)&uap->a2)); + return (freebsd7_freebsd32_semctl(td, + (struct freebsd7_freebsd32_semctl_args *)&uap->a2)); default: return (semsys(td, (struct semsys_args *)uap)); } } int +freebsd7_freebsd32_semctl(struct thread *td, + struct freebsd7_freebsd32_semctl_args *uap) +{ + struct semid_ds32_old dsbuf32; + struct semid_ds dsbuf; + union semun semun; + union semun32 arg; + register_t rval; + int error; + + switch (uap->cmd) { + case SEM_STAT: + case IPC_SET: + case IPC_STAT: + case GETALL: + case SETVAL: + case SETALL: + error = copyin(uap->arg, &arg, sizeof(arg)); + if (error) + return (error); + break; + } + + switch (uap->cmd) { + case SEM_STAT: + case IPC_STAT: + semun.buf = &dsbuf; + break; + case IPC_SET: + error = copyin(PTRIN(arg.buf), &dsbuf32, sizeof(dsbuf32)); + if (error) + return (error); + freebsd32_ipcperm_old_in(&dsbuf32.sem_perm, &dsbuf.sem_perm); + PTRIN_CP(dsbuf32, dsbuf, sem_base); + CP(dsbuf32, dsbuf, sem_nsems); + CP(dsbuf32, dsbuf, sem_otime); + CP(dsbuf32, dsbuf, sem_ctime); + semun.buf = &dsbuf; + break; + case GETALL: + case SETALL: + semun.array = PTRIN(arg.array); + break; + case SETVAL: + semun.val = arg.val; + break; + } + + error = kern_semctl(td, uap->semid, uap->semnum, uap->cmd, &semun, + &rval); + if (error) + return (error); + + switch (uap->cmd) { + case SEM_STAT: + case IPC_STAT: + bzero(&dsbuf32, sizeof(dsbuf32)); + freebsd32_ipcperm_old_out(&dsbuf.sem_perm, &dsbuf32.sem_perm); + PTROUT_CP(dsbuf, dsbuf32, sem_base); + CP(dsbuf, dsbuf32, sem_nsems); + CP(dsbuf, dsbuf32, sem_otime); + CP(dsbuf, dsbuf32, sem_ctime); + error = copyout(&dsbuf32, PTRIN(arg.buf), sizeof(dsbuf32)); + break; + } + + if (error == 0) + td->td_retval[0] = rval; + return (error); +} + +int freebsd32_semctl(struct thread *td, struct freebsd32_semctl_args *uap) { struct semid_ds32 dsbuf32; @@ -1384,13 +1482,7 @@ freebsd32_semctl(struct thread *td, stru PTRIN_CP(dsbuf32, dsbuf, sem_base); CP(dsbuf32, dsbuf, sem_nsems); CP(dsbuf32, dsbuf, sem_otime); - CP(dsbuf32, dsbuf, sem_pad1); CP(dsbuf32, dsbuf, sem_ctime); - CP(dsbuf32, dsbuf, sem_pad2); - CP(dsbuf32, dsbuf, sem_pad3[0]); - CP(dsbuf32, dsbuf, sem_pad3[1]); - CP(dsbuf32, dsbuf, sem_pad3[2]); - CP(dsbuf32, dsbuf, sem_pad3[3]); semun.buf = &dsbuf; break; case GETALL: @@ -1410,17 +1502,12 @@ freebsd32_semctl(struct thread *td, stru switch (uap->cmd) { case SEM_STAT: case IPC_STAT: + bzero(&dsbuf32, sizeof(dsbuf32)); freebsd32_ipcperm_out(&dsbuf.sem_perm, &dsbuf32.sem_perm); PTROUT_CP(dsbuf, dsbuf32, sem_base); CP(dsbuf, dsbuf32, sem_nsems); CP(dsbuf, dsbuf32, sem_otime); - CP(dsbuf, dsbuf32, sem_pad1); CP(dsbuf, dsbuf32, sem_ctime); - CP(dsbuf, dsbuf32, sem_pad2); - CP(dsbuf, dsbuf32, sem_pad3[0]); - CP(dsbuf, dsbuf32, sem_pad3[1]); - CP(dsbuf, dsbuf32, sem_pad3[2]); - CP(dsbuf, dsbuf32, sem_pad3[3]); error = copyout(&dsbuf32, PTRIN(arg.buf), sizeof(dsbuf32)); break; } @@ -1436,8 +1523,8 @@ freebsd32_msgsys(struct thread *td, stru switch (uap->which) { case 0: - return (freebsd32_msgctl(td, - (struct freebsd32_msgctl_args *)&uap->a2)); + return (freebsd7_freebsd32_msgctl(td, + (struct freebsd7_freebsd32_msgctl_args *)&uap->a2)); case 2: return (freebsd32_msgsnd(td, (struct freebsd32_msgsnd_args *)&uap->a2)); @@ -1450,6 +1537,51 @@ freebsd32_msgsys(struct thread *td, stru } int +freebsd7_freebsd32_msgctl(struct thread *td, + struct freebsd7_freebsd32_msgctl_args *uap) +{ + struct msqid_ds msqbuf; + struct msqid_ds32_old msqbuf32; + int error; + + if (uap->cmd == IPC_SET) { + error = copyin(uap->buf, &msqbuf32, sizeof(msqbuf32)); + if (error) + return (error); + freebsd32_ipcperm_old_in(&msqbuf32.msg_perm, &msqbuf.msg_perm); + PTRIN_CP(msqbuf32, msqbuf, msg_first); + PTRIN_CP(msqbuf32, msqbuf, msg_last); + CP(msqbuf32, msqbuf, msg_cbytes); + CP(msqbuf32, msqbuf, msg_qnum); + CP(msqbuf32, msqbuf, msg_qbytes); + CP(msqbuf32, msqbuf, msg_lspid); + CP(msqbuf32, msqbuf, msg_lrpid); + CP(msqbuf32, msqbuf, msg_stime); + CP(msqbuf32, msqbuf, msg_rtime); + CP(msqbuf32, msqbuf, msg_ctime); + } + error = kern_msgctl(td, uap->msqid, uap->cmd, &msqbuf); + if (error) + return (error); + if (uap->cmd == IPC_STAT) { + bzero(&msqbuf32, sizeof(msqbuf32)); + freebsd32_ipcperm_old_out(&msqbuf.msg_perm, &msqbuf32.msg_perm); + PTROUT_CP(msqbuf, msqbuf32, msg_first); + PTROUT_CP(msqbuf, msqbuf32, msg_last); + CP(msqbuf, msqbuf32, msg_cbytes); + CP(msqbuf, msqbuf32, msg_qnum); + CP(msqbuf, msqbuf32, msg_qbytes); + CP(msqbuf, msqbuf32, msg_lspid); + CP(msqbuf, msqbuf32, msg_lrpid); + CP(msqbuf, msqbuf32, msg_stime); + CP(msqbuf, msqbuf32, msg_rtime); + CP(msqbuf, msqbuf32, msg_ctime); + error = copyout(&msqbuf32, uap->buf, sizeof(struct msqid_ds32)); + } + return (error); +} + +int freebsd32_msgctl(struct thread *td, struct freebsd32_msgctl_args *uap) { struct msqid_ds msqbuf; @@ -1469,15 +1601,8 @@ freebsd32_msgctl(struct thread *td, stru CP(msqbuf32, msqbuf, msg_lspid); CP(msqbuf32, msqbuf, msg_lrpid); CP(msqbuf32, msqbuf, msg_stime); - CP(msqbuf32, msqbuf, msg_pad1); CP(msqbuf32, msqbuf, msg_rtime); - CP(msqbuf32, msqbuf, msg_pad2); CP(msqbuf32, msqbuf, msg_ctime); - CP(msqbuf32, msqbuf, msg_pad3); - CP(msqbuf32, msqbuf, msg_pad4[0]); - CP(msqbuf32, msqbuf, msg_pad4[1]); - CP(msqbuf32, msqbuf, msg_pad4[2]); - CP(msqbuf32, msqbuf, msg_pad4[3]); } error = kern_msgctl(td, uap->msqid, uap->cmd, &msqbuf); if (error) @@ -1492,15 +1617,8 @@ freebsd32_msgctl(struct thread *td, stru CP(msqbuf, msqbuf32, msg_lspid); CP(msqbuf, msqbuf32, msg_lrpid); CP(msqbuf, msqbuf32, msg_stime); - CP(msqbuf, msqbuf32, msg_pad1); CP(msqbuf, msqbuf32, msg_rtime); - CP(msqbuf, msqbuf32, msg_pad2); CP(msqbuf, msqbuf32, msg_ctime); - CP(msqbuf, msqbuf32, msg_pad3); - CP(msqbuf, msqbuf32, msg_pad4[0]); - CP(msqbuf, msqbuf32, msg_pad4[1]); - CP(msqbuf, msqbuf32, msg_pad4[2]); - CP(msqbuf, msqbuf32, msg_pad4[3]); error = copyout(&msqbuf32, uap->buf, sizeof(struct msqid_ds32)); } return (error); @@ -1568,12 +1686,12 @@ freebsd32_shmsys(struct thread *td, stru return (sysent[SYS_shmget].sy_call(td, &ap)); } case 4: { /* shmctl */ - struct freebsd32_shmctl_args ap; + struct freebsd7_freebsd32_shmctl_args ap; ap.shmid = uap->a2; ap.cmd = uap->a3; ap.buf = PTRIN(uap->a4); - return (freebsd32_shmctl(td, &ap)); + return (freebsd7_freebsd32_shmctl(td, &ap)); } case 1: /* oshmctl */ default: @@ -1582,6 +1700,91 @@ freebsd32_shmsys(struct thread *td, stru } int +freebsd7_freebsd32_shmctl(struct thread *td, + struct freebsd7_freebsd32_shmctl_args *uap) +{ + int error = 0; + union { + struct shmid_ds shmid_ds; + struct shm_info shm_info; + struct shminfo shminfo; + } u; + union { + struct shmid_ds32_old shmid_ds32; + struct shm_info32 shm_info32; + struct shminfo32 shminfo32; + } u32; + size_t sz; + + if (uap->cmd == IPC_SET) { + if ((error = copyin(uap->buf, &u32.shmid_ds32, + sizeof(u32.shmid_ds32)))) + goto done; + freebsd32_ipcperm_old_in(&u32.shmid_ds32.shm_perm, + &u.shmid_ds.shm_perm); + CP(u32.shmid_ds32, u.shmid_ds, shm_segsz); + CP(u32.shmid_ds32, u.shmid_ds, shm_lpid); + CP(u32.shmid_ds32, u.shmid_ds, shm_cpid); + CP(u32.shmid_ds32, u.shmid_ds, shm_nattch); + CP(u32.shmid_ds32, u.shmid_ds, shm_atime); + CP(u32.shmid_ds32, u.shmid_ds, shm_dtime); + CP(u32.shmid_ds32, u.shmid_ds, shm_ctime); + } + + error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz); + if (error) + goto done; + + /* Cases in which we need to copyout */ + switch (uap->cmd) { + case IPC_INFO: + CP(u.shminfo, u32.shminfo32, shmmax); + CP(u.shminfo, u32.shminfo32, shmmin); + CP(u.shminfo, u32.shminfo32, shmmni); + CP(u.shminfo, u32.shminfo32, shmseg); + CP(u.shminfo, u32.shminfo32, shmall); + error = copyout(&u32.shminfo32, uap->buf, + sizeof(u32.shminfo32)); + break; + case SHM_INFO: + CP(u.shm_info, u32.shm_info32, used_ids); + CP(u.shm_info, u32.shm_info32, shm_rss); + CP(u.shm_info, u32.shm_info32, shm_tot); + CP(u.shm_info, u32.shm_info32, shm_swp); + CP(u.shm_info, u32.shm_info32, swap_attempts); + CP(u.shm_info, u32.shm_info32, swap_successes); + error = copyout(&u32.shm_info32, uap->buf, + sizeof(u32.shm_info32)); + break; + case SHM_STAT: + case IPC_STAT: + freebsd32_ipcperm_old_out(&u.shmid_ds.shm_perm, + &u32.shmid_ds32.shm_perm); + if (u.shmid_ds.shm_segsz > INT32_MAX) + u32.shmid_ds32.shm_segsz = INT32_MAX; + else + CP(u.shmid_ds, u32.shmid_ds32, shm_segsz); + CP(u.shmid_ds, u32.shmid_ds32, shm_lpid); + CP(u.shmid_ds, u32.shmid_ds32, shm_cpid); + CP(u.shmid_ds, u32.shmid_ds32, shm_nattch); + CP(u.shmid_ds, u32.shmid_ds32, shm_atime); + CP(u.shmid_ds, u32.shmid_ds32, shm_dtime); + CP(u.shmid_ds, u32.shmid_ds32, shm_ctime); + u32.shmid_ds32.shm_internal = 0; + error = copyout(&u32.shmid_ds32, uap->buf, + sizeof(u32.shmid_ds32)); + break; + } + +done: + if (error) { + /* Invalidate the return value */ + td->td_retval[0] = -1; + } + return (error); +} + +int freebsd32_shmctl(struct thread *td, struct freebsd32_shmctl_args *uap) { int error = 0; @@ -1610,7 +1813,6 @@ freebsd32_shmctl(struct thread *td, stru CP(u32.shmid_ds32, u.shmid_ds, shm_atime); CP(u32.shmid_ds32, u.shmid_ds, shm_dtime); CP(u32.shmid_ds32, u.shmid_ds, shm_ctime); - PTRIN_CP(u32.shmid_ds32, u.shmid_ds, shm_internal); } error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz); @@ -1642,14 +1844,16 @@ freebsd32_shmctl(struct thread *td, stru case IPC_STAT: freebsd32_ipcperm_out(&u.shmid_ds.shm_perm, &u32.shmid_ds32.shm_perm); - CP(u.shmid_ds, u32.shmid_ds32, shm_segsz); + if (u.shmid_ds.shm_segsz > INT32_MAX) + u32.shmid_ds32.shm_segsz = INT32_MAX; + else + CP(u.shmid_ds, u32.shmid_ds32, shm_segsz); CP(u.shmid_ds, u32.shmid_ds32, shm_lpid); CP(u.shmid_ds, u32.shmid_ds32, shm_cpid); CP(u.shmid_ds, u32.shmid_ds32, shm_nattch); CP(u.shmid_ds, u32.shmid_ds32, shm_atime); CP(u.shmid_ds, u32.shmid_ds32, shm_dtime); CP(u.shmid_ds, u32.shmid_ds32, shm_ctime); - PTROUT_CP(u.shmid_ds, u32.shmid_ds32, shm_internal); error = copyout(&u32.shmid_ds32, uap->buf, sizeof(u32.shmid_ds32)); break; Modified: stable/7/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/7/sys/compat/freebsd32/syscalls.master Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/sys/compat/freebsd32/syscalls.master Fri Jul 31 20:32:55 2009 (r196006) @@ -406,15 +406,15 @@ ; The following were introduced with NetBSD/4.4Lite-2 ; They are initialized by thier respective modules/sysinits ; XXX PROBLEM!! -220 AUE_SEMCTL STD { int freebsd32_semctl(int semid, int semnum, \ - int cmd, union semun32 *arg); } +220 AUE_SEMCTL STD { int freebsd7_freebsd32_semctl(int semid, \ + int semnum, int cmd, union semun32 *arg); } 221 AUE_SEMGET NOPROTO { int semget(key_t key, int nsems, \ int semflg); } 222 AUE_SEMOP NOPROTO { int semop(int semid, struct sembuf *sops, \ u_int nsops); } 223 AUE_NULL UNIMPL semconfig -224 AUE_MSGCTL STD { int freebsd32_msgctl(int msqid, int cmd, \ - struct msqid_ds32 *buf); } +224 AUE_MSGCTL STD { int freebsd7_freebsd32_msgctl(int msqid, \ + int cmd, struct msqid_ds32_old *buf); } 225 AUE_MSGGET NOPROTO { int msgget(key_t key, int msgflg); } 226 AUE_MSGSND STD { int freebsd32_msgsnd(int msqid, void *msgp, \ size_t msgsz, int msgflg); } @@ -422,8 +422,8 @@ size_t msgsz, long msgtyp, int msgflg); } 228 AUE_SHMAT NOPROTO { int shmat(int shmid, void *shmaddr, \ int shmflg); } -229 AUE_SHMCTL STD { int freebsd32_shmctl(int shmid, int cmd, \ - struct shmid_ds *buf); } +229 AUE_SHMCTL STD { int freebsd7_freebsd32_shmctl(int shmid, \ + int cmd, struct shmid_ds32_old *buf); } 230 AUE_SHMDT NOPROTO { int shmdt(void *shmaddr); } 231 AUE_SHMGET NOPROTO { int shmget(key_t key, int size, \ int shmflg); } @@ -878,3 +878,9 @@ 507 AUE_NULL UNIMPL freebsd32_jail_set 508 AUE_NULL UNIMPL jail_remove 509 AUE_CLOSEFROM NOPROTO { int closefrom(int lowfd); } +510 AUE_SEMCTL STD { int freebsd32_semctl(int semid, int semnum, \ + int cmd, union semun32 *arg); } +511 AUE_MSGCTL STD { int freebsd32_msgctl(int msqid, int cmd, \ + struct msqid_ds32 *buf); } +512 AUE_SHMCTL STD { int freebsd32_shmctl(int shmid, int cmd, \ + struct shmid_ds32 *buf); } Modified: stable/7/sys/compat/linux/linux_ipc.c ============================================================================== --- stable/7/sys/compat/linux/linux_ipc.c Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/sys/compat/linux/linux_ipc.c Fri Jul 31 20:32:55 2009 (r196006) @@ -230,23 +230,26 @@ linux_to_bsd_shmid_ds(struct l_shmid_ds bsp->shm_atime = lsp->shm_atime; bsp->shm_dtime = lsp->shm_dtime; bsp->shm_ctime = lsp->shm_ctime; - /* this goes (yet) SOS */ - bsp->shm_internal = PTRIN(lsp->private3); } static void bsd_to_linux_shmid_ds(struct shmid_ds *bsp, struct l_shmid_ds *lsp) { bsd_to_linux_ipc_perm(&bsp->shm_perm, &lsp->shm_perm); - lsp->shm_segsz = bsp->shm_segsz; + if (bsp->shm_segsz > INT_MAX) + lsp->shm_segsz = INT_MAX; + else + lsp->shm_segsz = bsp->shm_segsz; lsp->shm_lpid = bsp->shm_lpid; lsp->shm_cpid = bsp->shm_cpid; - lsp->shm_nattch = bsp->shm_nattch; + if (bsp->shm_nattch > SHRT_MAX) + lsp->shm_nattch = SHRT_MAX; + else + lsp->shm_nattch = bsp->shm_nattch; lsp->shm_atime = bsp->shm_atime; lsp->shm_dtime = bsp->shm_dtime; lsp->shm_ctime = bsp->shm_ctime; - /* this goes (yet) SOS */ - lsp->private3 = PTROUT(bsp->shm_internal); + lsp->private3 = 0; } static void @@ -424,6 +427,15 @@ linux_shmid_pushdown(l_int ver, struct l { struct l_shmid64_ds linux_shmid64; + /* + * XXX: This is backwards and loses information in shm_nattch + * and shm_segsz. We should probably either expose the BSD + * shmid structure directly and convert it to either the + * non-64 or 64 variant directly or the code should always + * convert to the 64 variant and then truncate values into the + * non-64 variant if needed since the 64 variant has more + * precision. + */ if (ver == LINUX_IPC_64) { bzero(&linux_shmid64, sizeof(linux_shmid64)); Modified: stable/7/sys/compat/svr4/svr4_ipc.c ============================================================================== --- stable/7/sys/compat/svr4/svr4_ipc.c Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/sys/compat/svr4/svr4_ipc.c Fri Jul 31 20:32:55 2009 (r196006) @@ -169,13 +169,12 @@ bsd_to_svr4_semid_ds(bds, sds) const struct semid_ds *bds; struct svr4_semid_ds *sds; { + bzero(sds, sizeof(*sds)); bsd_to_svr4_ipc_perm(&bds->sem_perm, &sds->sem_perm); sds->sem_base = (struct svr4_sem *) bds->sem_base; sds->sem_nsems = bds->sem_nsems; sds->sem_otime = bds->sem_otime; - sds->sem_pad1 = bds->sem_pad1; sds->sem_ctime = bds->sem_ctime; - sds->sem_pad2 = bds->sem_pad2; } static void @@ -187,9 +186,7 @@ svr4_to_bsd_semid_ds(sds, bds) bds->sem_base = (struct sem *) bds->sem_base; bds->sem_nsems = sds->sem_nsems; bds->sem_otime = sds->sem_otime; - bds->sem_pad1 = sds->sem_pad1; bds->sem_ctime = sds->sem_ctime; - bds->sem_pad2 = sds->sem_pad2; } struct svr4_sys_semctl_args { @@ -350,6 +347,7 @@ bsd_to_svr4_msqid_ds(bds, sds) const struct msqid_ds *bds; struct svr4_msqid_ds *sds; { + bzero(sds, sizeof(*sds)); bsd_to_svr4_ipc_perm(&bds->msg_perm, &sds->msg_perm); sds->msg_first = (struct svr4_msg *) bds->msg_first; sds->msg_last = (struct svr4_msg *) bds->msg_last; @@ -359,18 +357,8 @@ bsd_to_svr4_msqid_ds(bds, sds) sds->msg_lspid = bds->msg_lspid; sds->msg_lrpid = bds->msg_lrpid; sds->msg_stime = bds->msg_stime; - sds->msg_pad1 = bds->msg_pad1; sds->msg_rtime = bds->msg_rtime; - sds->msg_pad2 = bds->msg_pad2; sds->msg_ctime = bds->msg_ctime; - sds->msg_pad3 = bds->msg_pad3; - - /* use the padding for the rest of the fields */ - { - const short *pad = (const short *) bds->msg_pad4; - sds->msg_cv = pad[0]; - sds->msg_qnum_cv = pad[1]; - } } static void @@ -387,18 +375,8 @@ svr4_to_bsd_msqid_ds(sds, bds) bds->msg_lspid = sds->msg_lspid; bds->msg_lrpid = sds->msg_lrpid; bds->msg_stime = sds->msg_stime; - bds->msg_pad1 = sds->msg_pad1; bds->msg_rtime = sds->msg_rtime; - bds->msg_pad2 = sds->msg_pad2; bds->msg_ctime = sds->msg_ctime; - bds->msg_pad3 = sds->msg_pad3; - - /* use the padding for the rest of the fields */ - { - short *pad = (short *) bds->msg_pad4; - pad[0] = sds->msg_cv; - pad[1] = sds->msg_qnum_cv; - } } struct svr4_sys_msgsnd_args { @@ -543,20 +521,18 @@ bsd_to_svr4_shmid_ds(bds, sds) const struct shmid_ds *bds; struct svr4_shmid_ds *sds; { + bzero(sds, sizeof(*sds)); bsd_to_svr4_ipc_perm(&bds->shm_perm, &sds->shm_perm); sds->shm_segsz = bds->shm_segsz; sds->shm_lkcnt = 0; sds->shm_lpid = bds->shm_lpid; sds->shm_cpid = bds->shm_cpid; - sds->shm_amp = bds->shm_internal; + sds->shm_amp = 0; sds->shm_nattch = bds->shm_nattch; sds->shm_cnattch = 0; sds->shm_atime = bds->shm_atime; - sds->shm_pad1 = 0; sds->shm_dtime = bds->shm_dtime; - sds->shm_pad2 = 0; sds->shm_ctime = bds->shm_ctime; - sds->shm_pad3 = 0; } static void @@ -568,7 +544,6 @@ svr4_to_bsd_shmid_ds(sds, bds) bds->shm_segsz = sds->shm_segsz; bds->shm_lpid = sds->shm_lpid; bds->shm_cpid = sds->shm_cpid; - bds->shm_internal = sds->shm_amp; bds->shm_nattch = sds->shm_nattch; bds->shm_atime = sds->shm_atime; bds->shm_dtime = sds->shm_dtime; Modified: stable/7/sys/i386/ibcs2/ibcs2_ipc.c ============================================================================== --- stable/7/sys/i386/ibcs2/ibcs2_ipc.c Fri Jul 31 19:13:16 2009 (r196005) +++ stable/7/sys/i386/ibcs2/ibcs2_ipc.c Fri Jul 31 20:32:55 2009 (r196006) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***