Date: Sun, 25 Apr 2010 23:42:23 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r207211 - in user/kmacy/head_page_lock_2: bin/ln bin/sh contrib/top lib/libc/gen lib/libc/sys lib/libkvm share/man/man1 sys/amd64/amd64 sys/amd64/conf sys/geom/part sys/i386/i386 sys/ne... Message-ID: <201004252342.o3PNgNo0005886@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kmacy Date: Sun Apr 25 23:42:23 2010 New Revision: 207211 URL: http://svn.freebsd.org/changeset/base/207211 Log: IFC 207179:207210 Modified: user/kmacy/head_page_lock_2/bin/ln/symlink.7 user/kmacy/head_page_lock_2/bin/sh/arith.y user/kmacy/head_page_lock_2/bin/sh/arith_lex.l user/kmacy/head_page_lock_2/bin/sh/expand.c user/kmacy/head_page_lock_2/lib/libc/gen/sysctl.3 user/kmacy/head_page_lock_2/lib/libc/sys/unlink.2 user/kmacy/head_page_lock_2/lib/libkvm/kvm.3 user/kmacy/head_page_lock_2/share/man/man1/builtin.1 user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c user/kmacy/head_page_lock_2/sys/amd64/conf/GENERIC user/kmacy/head_page_lock_2/sys/geom/part/g_part.c user/kmacy/head_page_lock_2/sys/i386/i386/pmap.c user/kmacy/head_page_lock_2/sys/net/bpf.c user/kmacy/head_page_lock_2/sys/net/bpfdesc.h user/kmacy/head_page_lock_2/sys/net/rtsock.c user/kmacy/head_page_lock_2/sys/netinet/sctp_indata.c user/kmacy/head_page_lock_2/sys/netinet/sctp_output.c user/kmacy/head_page_lock_2/usr.bin/alias/Makefile Directory Properties: user/kmacy/head_page_lock_2/ (props changed) user/kmacy/head_page_lock_2/cddl/contrib/opensolaris/ (props changed) user/kmacy/head_page_lock_2/contrib/bind9/ (props changed) user/kmacy/head_page_lock_2/contrib/ee/ (props changed) user/kmacy/head_page_lock_2/contrib/expat/ (props changed) user/kmacy/head_page_lock_2/contrib/file/ (props changed) user/kmacy/head_page_lock_2/contrib/gdb/ (props changed) user/kmacy/head_page_lock_2/contrib/gdtoa/ (props changed) user/kmacy/head_page_lock_2/contrib/gnu-sort/ (props changed) user/kmacy/head_page_lock_2/contrib/groff/ (props changed) user/kmacy/head_page_lock_2/contrib/less/ (props changed) user/kmacy/head_page_lock_2/contrib/libpcap/ (props changed) user/kmacy/head_page_lock_2/contrib/ncurses/ (props changed) user/kmacy/head_page_lock_2/contrib/netcat/ (props changed) user/kmacy/head_page_lock_2/contrib/ntp/ (props changed) user/kmacy/head_page_lock_2/contrib/one-true-awk/ (props changed) user/kmacy/head_page_lock_2/contrib/openbsm/ (props changed) user/kmacy/head_page_lock_2/contrib/openpam/ (props changed) user/kmacy/head_page_lock_2/contrib/pf/ (props changed) user/kmacy/head_page_lock_2/contrib/sendmail/ (props changed) user/kmacy/head_page_lock_2/contrib/tcpdump/ (props changed) user/kmacy/head_page_lock_2/contrib/tcsh/ (props changed) user/kmacy/head_page_lock_2/contrib/top/ (props changed) user/kmacy/head_page_lock_2/contrib/top/install-sh (props changed) user/kmacy/head_page_lock_2/contrib/tzcode/stdtime/ (props changed) user/kmacy/head_page_lock_2/contrib/tzcode/zic/ (props changed) user/kmacy/head_page_lock_2/contrib/tzdata/ (props changed) user/kmacy/head_page_lock_2/contrib/wpa/ (props changed) user/kmacy/head_page_lock_2/crypto/openssh/ (props changed) user/kmacy/head_page_lock_2/crypto/openssl/ (props changed) user/kmacy/head_page_lock_2/lib/libc/ (props changed) user/kmacy/head_page_lock_2/lib/libc/stdtime/ (props changed) user/kmacy/head_page_lock_2/lib/libutil/ (props changed) user/kmacy/head_page_lock_2/lib/libz/ (props changed) user/kmacy/head_page_lock_2/sbin/ (props changed) user/kmacy/head_page_lock_2/sbin/ipfw/ (props changed) user/kmacy/head_page_lock_2/share/zoneinfo/ (props changed) user/kmacy/head_page_lock_2/sys/ (props changed) user/kmacy/head_page_lock_2/sys/amd64/include/xen/ (props changed) user/kmacy/head_page_lock_2/sys/cddl/contrib/opensolaris/ (props changed) user/kmacy/head_page_lock_2/sys/contrib/dev/acpica/ (props changed) user/kmacy/head_page_lock_2/sys/contrib/pf/ (props changed) user/kmacy/head_page_lock_2/sys/contrib/x86emu/ (props changed) user/kmacy/head_page_lock_2/sys/dev/xen/xenpci/ (props changed) user/kmacy/head_page_lock_2/usr.bin/csup/ (props changed) user/kmacy/head_page_lock_2/usr.bin/procstat/ (props changed) user/kmacy/head_page_lock_2/usr.sbin/zic/ (props changed) Modified: user/kmacy/head_page_lock_2/bin/ln/symlink.7 ============================================================================== --- user/kmacy/head_page_lock_2/bin/ln/symlink.7 Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/bin/ln/symlink.7 Sun Apr 25 23:42:23 2010 (r207211) @@ -29,7 +29,7 @@ .\" @(#)symlink.7 8.3 (Berkeley) 3/31/94 .\" $FreeBSD$ .\" -.Dd March 31, 1994 +.Dd April 25, 2010 .Dt SYMLINK 7 .Os .Sh NAME @@ -103,19 +103,23 @@ the system call would return a file descriptor to the file .Dq afile . .Pp -There are nine system calls that do not follow links, and which operate +There are thirteen system calls that do not follow links, and which operate on the symbolic link itself. They are: .Xr lchflags 2 , .Xr lchmod 2 , .Xr lchown 2 , +.Xr lpathconf 2 , .Xr lstat 2 , .Xr lutimes 2 , .Xr readlink 2 , +.Xr readlinkat 2 , .Xr rename 2 , +.Xr renameat 2 , .Xr rmdir 2 , +.Xr unlink 2 , and -.Xr unlink 2 . +.Xr unlinkat 2 . Because .Xr remove 3 is an alias for @@ -123,9 +127,30 @@ is an alias for it also does not follow symbolic links. When .Xr rmdir 2 +or +.Xr unlinkat 2 +with the +.Dv AT_REMOVEDIR +flag is applied to a symbolic link, it fails with the error .Er ENOTDIR . .Pp +The +.Xr linkat 2 +system call does not follow symbolic links +unless given the +.Dv AT_SYMLINK_FOLLOW +flag. +.Pp +The following system calls follow symbolic links +unless given the +.Dv AT_SYMLINK_NOFOLLOW +flag: +.Xr fchmodat 2 , +.Xr fchownat 2 +and +.Xr fstatat 2 . +.Pp The owner and group of an existing symbolic link can be changed by means of the .Xr lchown 2 @@ -138,8 +163,8 @@ an existing symbolic link can be changed and .Xr lutimes 2 system calls, respectively. -Of these, only the flags are used by the system; -the access permissions and ownership are ignored. +Of these, only the flags and ownership are used by the system; +the access permissions are ignored. .Pp The .Bx 4.4 Modified: user/kmacy/head_page_lock_2/bin/sh/arith.y ============================================================================== --- user/kmacy/head_page_lock_2/bin/sh/arith.y Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/bin/sh/arith.y Sun Apr 25 23:42:23 2010 (r207211) @@ -287,7 +287,9 @@ arith_t arith(const char *s) { arith_t result; + struct stackmark smark; + setstackmark(&smark); arith_buf = arith_startbuf = s; INTOFF; @@ -295,6 +297,8 @@ arith(const char *s) arith_lex_reset(); /* Reprime lex. */ INTON; + popstackmark(&smark); + return result; } Modified: user/kmacy/head_page_lock_2/bin/sh/arith_lex.l ============================================================================== --- user/kmacy/head_page_lock_2/bin/sh/arith_lex.l Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/bin/sh/arith_lex.l Sun Apr 25 23:42:23 2010 (r207211) @@ -51,13 +51,6 @@ __FBSDID("$FreeBSD$"); int yylex(void); -struct varname -{ - struct varname *next; - char name[1]; -}; -static struct varname *varnames; - #undef YY_INPUT #define YY_INPUT(buf,result,max) \ result = (*buf = *arith_buf++) ? 1 : YY_NULL; @@ -87,14 +80,11 @@ static struct varname *varnames; * If variable doesn't exist, we should initialize * it to zero. */ - struct varname *temp; + char *temp; if (lookupvar(yytext) == NULL) setvarsafe(yytext, "0", 0); - temp = ckmalloc(sizeof(struct varname) + - strlen(yytext)); - temp->next = varnames; - varnames = temp; - yylval.s_value = strcpy(temp->name, yytext); + temp = stalloc(strlen(yytext) + 1); + yylval.s_value = strcpy(temp, yytext); return ARITH_VAR; } @@ -140,15 +130,5 @@ static struct varname *varnames; void arith_lex_reset(void) { - struct varname *name, *next; - YY_NEW_FILE; - - name = varnames; - while (name != NULL) { - next = name->next; - ckfree(name); - name = next; - } - varnames = NULL; } Modified: user/kmacy/head_page_lock_2/bin/sh/expand.c ============================================================================== --- user/kmacy/head_page_lock_2/bin/sh/expand.c Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/bin/sh/expand.c Sun Apr 25 23:42:23 2010 (r207211) @@ -360,7 +360,7 @@ removerecordregions(int endoff) void expari(int flag) { - char *p, *start; + char *p, *q, *start; arith_t result; int begoff; int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR); @@ -398,7 +398,9 @@ expari(int flag) removerecordregions(begoff); if (quotes) rmescapes(p+2); + q = grabstackstr(expdest); result = arith(p+2); + ungrabstackstr(q, expdest); fmtstr(p, DIGITS(result), ARITH_FORMAT_STR, result); while (*p++) ; Modified: user/kmacy/head_page_lock_2/lib/libc/gen/sysctl.3 ============================================================================== --- user/kmacy/head_page_lock_2/lib/libc/gen/sysctl.3 Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/lib/libc/gen/sysctl.3 Sun Apr 25 23:42:23 2010 (r207211) @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd February 21, 2010 +.Dd April 25, 2010 .Dt SYSCTL 3 .Os .Sh NAME @@ -325,7 +325,7 @@ information. .It "KERN_BOOTFILE string yes" .It "KERN_BOOTTIME struct timeval no" .It "KERN_CLOCKRATE struct clockinfo no" -.It "KERN_FILE struct file no" +.It "KERN_FILE struct xfile no" .It "KERN_HOSTID integer yes" .It "KERN_HOSTUUID string yes" .It "KERN_HOSTNAME string yes" @@ -342,14 +342,14 @@ information. .It "KERN_OSREV integer no" .It "KERN_OSTYPE string no" .It "KERN_POSIX1 integer no" -.It "KERN_PROC struct proc no" +.It "KERN_PROC node not applicable" .It "KERN_PROF node not applicable" .It "KERN_QUANTUM integer yes" .It "KERN_SAVED_IDS integer no" .It "KERN_SECURELVL integer raise only" .It "KERN_UPDATEINTERVAL integer no" .It "KERN_VERSION string no" -.It "KERN_VNODE struct vnode no" +.It "KERN_VNODE struct xvnode no" .El .Bl -tag -width 6n .It Li KERN_ARGMAX @@ -370,10 +370,8 @@ This structure contains the clock, stati frequencies, the number of micro-seconds per hz tick and the skew rate. .It Li KERN_FILE Return the entire file table. -The returned data consists of a single -.Va struct filehead -followed by an array of -.Va struct file , +The returned data consists of an array of +.Va struct xfile , whose size depends on the current number of such objects in the system. .It Li KERN_HOSTID Get or set the host ID. @@ -525,10 +523,8 @@ Note, the vnode table is not necessarily the system. The returned data consists of an array whose size depends on the current number of such objects in the system. -Each element of the array contains the kernel address of a vnode -.Va struct vnode * -followed by the vnode itself -.Va struct vnode . +Each element of the array consists of a +.Va struct xvnode . .El .Ss CTL_NET The string and integer information available for the CTL_NET level @@ -854,6 +850,8 @@ An attempt is made to set a read-only va A process without appropriate privilege attempts to set a value. .El .Sh SEE ALSO +.Xr confstr 3 , +.Xr kvm 3 , .Xr sysconf 3 , .Xr sysctl 8 .Sh HISTORY Modified: user/kmacy/head_page_lock_2/lib/libc/sys/unlink.2 ============================================================================== --- user/kmacy/head_page_lock_2/lib/libc/sys/unlink.2 Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/lib/libc/sys/unlink.2 Sun Apr 25 23:42:23 2010 (r207211) @@ -28,7 +28,7 @@ .\" @(#)unlink.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 10, 2008 +.Dd April 25, 2010 .Dt UNLINK 2 .Os .Sh NAME @@ -167,7 +167,7 @@ argument does not specify an absolute pa argument is neither .Dv AT_FDCWD nor a valid file descriptor open for searching. -.It Bq Er EEXIST +.It Bq Er ENOTEMPTY The .Fa flag parameter has the Modified: user/kmacy/head_page_lock_2/lib/libkvm/kvm.3 ============================================================================== --- user/kmacy/head_page_lock_2/lib/libkvm/kvm.3 Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/lib/libkvm/kvm.3 Sun Apr 25 23:42:23 2010 (r207211) @@ -32,7 +32,7 @@ .\" @(#)kvm.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd January 29, 2004 +.Dd April 25, 2010 .Dt KVM 3 .Os .Sh NAME @@ -46,12 +46,15 @@ The library provides a uniform interface for accessing kernel virtual memory images, including live systems and crash dumps. Access to live systems is via +.Xr sysctl 3 +for some functions, and .Xr mem 4 and .Xr kmem 4 +for other functions, while crash dumps can be examined via the core file generated by .Xr savecore 8 . -The interface behaves identically in both cases. +The interface behaves similarly in both cases. Memory can be read and written, kernel symbol addresses can be looked up efficiently, and information about user processes can be gathered. @@ -112,5 +115,6 @@ given descriptor. .Xr kvm_openfiles 3 , .Xr kvm_read 3 , .Xr kvm_write 3 , +.Xr sysctl 3 , .Xr kmem 4 , .Xr mem 4 Modified: user/kmacy/head_page_lock_2/share/man/man1/builtin.1 ============================================================================== --- user/kmacy/head_page_lock_2/share/man/man1/builtin.1 Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/share/man/man1/builtin.1 Sun Apr 25 23:42:23 2010 (r207211) @@ -245,7 +245,7 @@ but are implemented as scripts using a b .It Ic getopts Ta No** Ta \&No Ta Yes .It Ic glob Ta \&No Ta Yes Ta \&No .It Ic goto Ta \&No Ta Yes Ta \&No -.It Ic hash Ta \&No Ta \&No Ta Yes +.It Ic hash Ta No** Ta \&No Ta Yes .It Ic hashstat Ta \&No Ta Yes Ta \&No .It Ic history Ta \&No Ta Yes Ta \&No .It Ic hup Ta \&No Ta Yes Ta \&No @@ -290,8 +290,8 @@ but are implemented as scripts using a b .It Ic times Ta \&No Ta \&No Ta Yes .It Ic trap Ta \&No Ta \&No Ta Yes .It Ic true Ta Yes Ta \&No Ta Yes -.It Ic type Ta \&No Ta \&No Ta Yes -.It Ic ulimit Ta \&No Ta \&No Ta Yes +.It Ic type Ta No** Ta \&No Ta Yes +.It Ic ulimit Ta No** Ta \&No Ta Yes .It Ic umask Ta No** Ta Yes Ta Yes .It Ic unalias Ta No** Ta Yes Ta Yes .It Ic uncomplete Ta \&No Ta Yes Ta \&No Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c ============================================================================== --- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c Sun Apr 25 23:42:23 2010 (r207211) @@ -3035,7 +3035,6 @@ pmap_remove_all(vm_page_t m) * */ pmap_unuse_pt(pmap, pv->pv_va, *pde, &free); - pmap_invalidate_page(pmap, pv->pv_va); pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); @@ -3179,22 +3178,17 @@ retry: obits = pbits = *pte; if ((pbits & PG_V) == 0) continue; - if ((pbits & PG_MANAGED) && - (pbits & (PG_M | PG_A))) { - if (pa_tryrelock(pmap, pbits & PG_FRAME, &pa)) - goto restart; - m = PHYS_TO_VM_PAGE(pbits & PG_FRAME); - if (pbits & PG_A) { - vm_page_flag_set(m, PG_REFERENCED); - pbits &= ~PG_A; - } - if ((pbits & (PG_M | PG_RW)) == (PG_M | PG_RW)) + if ((prot & VM_PROT_WRITE) == 0) { + if ((pbits & (PG_MANAGED | PG_M | PG_RW)) == + (PG_MANAGED | PG_M | PG_RW)) { + m = PHYS_TO_VM_PAGE(pbits & PG_FRAME); + if (pa_tryrelock(pmap, pbits & PG_FRAME, &pa)) + goto restart; vm_page_dirty(m); - } - - if ((prot & VM_PROT_WRITE) == 0) + } pbits &= ~(PG_RW | PG_M); + } if ((prot & VM_PROT_EXECUTE) == 0) pbits |= pg_nx; Modified: user/kmacy/head_page_lock_2/sys/amd64/conf/GENERIC ============================================================================== --- user/kmacy/head_page_lock_2/sys/amd64/conf/GENERIC Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/sys/amd64/conf/GENERIC Sun Apr 25 23:42:23 2010 (r207211) @@ -281,7 +281,7 @@ device firmware # firmware assist modul device bpf # Berkeley packet filter # USB support -#options USB_DEBUG # enable debug msgs +options USB_DEBUG # enable debug msgs device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) Modified: user/kmacy/head_page_lock_2/sys/geom/part/g_part.c ============================================================================== --- user/kmacy/head_page_lock_2/sys/geom/part/g_part.c Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/sys/geom/part/g_part.c Sun Apr 25 23:42:23 2010 (r207211) @@ -1166,6 +1166,15 @@ g_part_ctl_undo(struct gctl_req *req, st return (0); } table = gp->softc; + + /* + * Synthesize a disk geometry. Some partitioning schemes + * depend on it and since some file systems need it even + * when the partitition scheme doesn't, we do it here in + * scheme-independent code. + */ + pp = cp->provider; + g_part_geometry(table, cp, pp->mediasize / pp->sectorsize); } error = G_PART_READ(table, cp); Modified: user/kmacy/head_page_lock_2/sys/i386/i386/pmap.c ============================================================================== --- user/kmacy/head_page_lock_2/sys/i386/i386/pmap.c Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/sys/i386/i386/pmap.c Sun Apr 25 23:42:23 2010 (r207211) @@ -2955,18 +2955,9 @@ retry: if (oldpde & PG_MANAGED) { eva = sva + NBPDR; for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME); - va < eva; va += PAGE_SIZE, m++) { - /* - * In contrast to the analogous operation on a 4KB page - * mapping, the mapping's PG_A flag is not cleared and - * the page's PG_REFERENCED flag is not set. The - * reason is that pmap_demote_pde() expects that a 2/4MB - * page mapping with a stored page table page has PG_A - * set. - */ + va < eva; va += PAGE_SIZE, m++) if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); - } } if ((prot & VM_PROT_WRITE) == 0) newpde &= ~(PG_RW | PG_M); @@ -3074,22 +3065,15 @@ retry: obits = pbits = *pte; if ((pbits & PG_V) == 0) continue; - if (pbits & PG_MANAGED) { - m = NULL; - if (pbits & PG_A) { + + if ((prot & VM_PROT_WRITE) == 0) { + if ((pbits & (PG_MANAGED | PG_M | PG_RW)) == + (PG_MANAGED | PG_M | PG_RW)) { m = PHYS_TO_VM_PAGE(pbits & PG_FRAME); - vm_page_flag_set(m, PG_REFERENCED); - pbits &= ~PG_A; - } - if ((pbits & (PG_M | PG_RW)) == (PG_M | PG_RW)) { - if (m == NULL) - m = PHYS_TO_VM_PAGE(pbits & PG_FRAME); vm_page_dirty(m); } - } - - if ((prot & VM_PROT_WRITE) == 0) pbits &= ~(PG_RW | PG_M); + } #ifdef PAE if ((prot & VM_PROT_EXECUTE) == 0) pbits |= pg_nx; Modified: user/kmacy/head_page_lock_2/sys/net/bpf.c ============================================================================== --- user/kmacy/head_page_lock_2/sys/net/bpf.c Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/sys/net/bpf.c Sun Apr 25 23:42:23 2010 (r207211) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include "opt_bpf.h" +#include "opt_compat.h" #include "opt_netgraph.h" #include <sys/types.h> @@ -89,6 +90,43 @@ MALLOC_DEFINE(M_BPF, "BPF", "BPF data"); #define PRINET 26 /* interruptible */ +#ifdef COMPAT_FREEBSD32 +#include <sys/mount.h> +#include <compat/freebsd32/freebsd32.h> +#define BPF_ALIGNMENT32 sizeof(int32_t) +#define BPF_WORDALIGN32(x) (((x)+(BPF_ALIGNMENT32-1))&~(BPF_ALIGNMENT32-1)) + +/* + * 32-bit version of structure prepended to each packet. We use this header + * instead of the standard one for 32-bit streams. We mark the a stream as + * 32-bit the first time we see a 32-bit compat ioctl request. + */ +struct bpf_hdr32 { + struct timeval32 bh_tstamp; /* time stamp */ + uint32_t bh_caplen; /* length of captured portion */ + uint32_t bh_datalen; /* original length of packet */ + uint16_t bh_hdrlen; /* length of bpf header (this struct + plus alignment padding) */ +}; + +struct bpf_program32 { + u_int bf_len; + uint32_t bf_insns; +}; + +struct bpf_dltlist32 { + u_int bfl_len; + u_int bfl_list; +}; + +#define BIOCSETF32 _IOW('B', 103, struct bpf_program32) +#define BIOCSRTIMEOUT32 _IOW('B',109, struct timeval32) +#define BIOCGRTIMEOUT32 _IOR('B',110, struct timeval32) +#define BIOCGDLTLIST32 _IOWR('B',121, struct bpf_dltlist32) +#define BIOCSETWF32 _IOW('B',123, struct bpf_program32) +#define BIOCSETFNR32 _IOW('B',130, struct bpf_program32) +#endif + /* * bpf_iflist is a list of BPF interface structures, each corresponding to a * specific DLT. The same network interface might have several BPF interface @@ -1005,8 +1043,14 @@ bpfioctl(struct cdev *dev, u_long cmd, c case BIOCFLUSH: case BIOCGDLT: case BIOCGDLTLIST: +#ifdef COMPAT_FREEBSD32 + case BIOCGDLTLIST32: +#endif case BIOCGETIF: case BIOCGRTIMEOUT: +#ifdef COMPAT_FREEBSD32 + case BIOCGRTIMEOUT32: +#endif case BIOCGSTATS: case BIOCVERSION: case BIOCGRSIG: @@ -1015,6 +1059,9 @@ bpfioctl(struct cdev *dev, u_long cmd, c case FIONREAD: case BIOCLOCK: case BIOCSRTIMEOUT: +#ifdef COMPAT_FREEBSD32 + case BIOCSRTIMEOUT32: +#endif case BIOCIMMEDIATE: case TIOCGPGRP: case BIOCROTZBUF: @@ -1023,6 +1070,22 @@ bpfioctl(struct cdev *dev, u_long cmd, c return (EPERM); } } +#ifdef COMPAT_FREEBSD32 + /* + * If we see a 32-bit compat ioctl, mark the stream as 32-bit so + * that it will get 32-bit packet headers. + */ + switch (cmd) { + case BIOCSETF32: + case BIOCSETFNR32: + case BIOCSETWF32: + case BIOCGDLTLIST32: + case BIOCGRTIMEOUT32: + case BIOCSRTIMEOUT32: + d->bd_compat32 = 1; + } +#endif + CURVNET_SET(TD_TO_VNET(td)); switch (cmd) { @@ -1080,6 +1143,11 @@ bpfioctl(struct cdev *dev, u_long cmd, c case BIOCSETF: case BIOCSETFNR: case BIOCSETWF: +#ifdef COMPAT_FREEBSD32 + case BIOCSETF32: + case BIOCSETFNR32: + case BIOCSETWF32: +#endif error = bpf_setf(d, (struct bpf_program *)addr, cmd); break; @@ -1123,6 +1191,26 @@ bpfioctl(struct cdev *dev, u_long cmd, c /* * Get a list of supported data link types. */ +#ifdef COMPAT_FREEBSD32 + case BIOCGDLTLIST32: + { + struct bpf_dltlist32 *list32; + struct bpf_dltlist dltlist; + + list32 = (struct bpf_dltlist32 *)addr; + dltlist.bfl_len = list32->bfl_len; + dltlist.bfl_list = PTRIN(list32->bfl_list); + if (d->bd_bif == NULL) + error = EINVAL; + else { + error = bpf_getdltlist(d, &dltlist); + if (error == 0) + list32->bfl_len = dltlist.bfl_len; + } + break; + } +#endif + case BIOCGDLTLIST: if (d->bd_bif == NULL) error = EINVAL; @@ -1166,8 +1254,23 @@ bpfioctl(struct cdev *dev, u_long cmd, c * Set read timeout. */ case BIOCSRTIMEOUT: +#ifdef COMPAT_FREEBSD32 + case BIOCSRTIMEOUT32: +#endif { struct timeval *tv = (struct timeval *)addr; +#ifdef COMPAT_FREEBSD32 + struct timeval32 *tv32; + struct timeval tv64; + + if (cmd == BIOCSRTIMEOUT32) { + tv32 = (struct timeval32 *)addr; + tv = &tv64; + tv->tv_sec = tv32->tv_sec; + tv->tv_usec = tv32->tv_usec; + } else +#endif + tv = (struct timeval *)addr; /* * Subtract 1 tick from tvtohz() since this isn't @@ -1182,11 +1285,31 @@ bpfioctl(struct cdev *dev, u_long cmd, c * Get read timeout. */ case BIOCGRTIMEOUT: +#ifdef COMPAT_FREEBSD32 + case BIOCGRTIMEOUT32: +#endif { - struct timeval *tv = (struct timeval *)addr; + struct timeval *tv; +#ifdef COMPAT_FREEBSD32 + struct timeval32 *tv32; + struct timeval tv64; + + if (cmd == BIOCGRTIMEOUT32) + tv = &tv64; + else +#endif + tv = (struct timeval *)addr; tv->tv_sec = d->bd_rtout / hz; tv->tv_usec = (d->bd_rtout % hz) * tick; +#ifdef COMPAT_FREEBSD32 + if (cmd == BIOCGRTIMEOUT32) { + tv32 = (struct timeval32 *)addr; + tv32->tv_sec = tv->tv_sec; + tv32->tv_usec = tv->tv_usec; + } +#endif + break; } @@ -1369,7 +1492,19 @@ bpf_setf(struct bpf_d *d, struct bpf_pro #ifdef BPF_JITTER bpf_jit_filter *ofunc; #endif - +#ifdef COMPAT_FREEBSD32 + struct bpf_program32 *fp32; + struct bpf_program fp_swab; + + if (cmd == BIOCSETWF32 || cmd == BIOCSETF32 || cmd == BIOCSETFNR32) { + fp32 = (struct bpf_program32 *)fp; + fp_swab.bf_len = fp32->bf_len; + fp_swab.bf_insns = (struct bpf_insn *)(uintptr_t)fp32->bf_insns; + fp = &fp_swab; + if (cmd == BIOCSETWF32) + cmd = BIOCSETWF; + } +#endif if (cmd == BIOCSETWF) { old = d->bd_wfilter; wfilter = 1; @@ -1771,6 +1906,9 @@ catchpacket(struct bpf_d *d, u_char *pkt struct timeval *tv) { struct bpf_hdr hdr; +#ifdef COMPAT_FREEBSD32 + struct bpf_hdr32 hdr32; +#endif int totlen, curlen; int hdrlen = d->bd_bif->bif_hdrlen; int do_wakeup = 0; @@ -1809,7 +1947,12 @@ catchpacket(struct bpf_d *d, u_char *pkt * buffer is considered immutable by the buffer model, try to rotate * the buffer and wakeup pending processes. */ - curlen = BPF_WORDALIGN(d->bd_slen); +#ifdef COMPAT_FREEBSD32 + if (d->bd_compat32) + curlen = BPF_WORDALIGN32(d->bd_slen); + else +#endif + curlen = BPF_WORDALIGN(d->bd_slen); if (curlen + totlen > d->bd_bufsize || !bpf_canwritebuf(d)) { if (d->bd_fbuf == NULL) { /* @@ -1831,6 +1974,22 @@ catchpacket(struct bpf_d *d, u_char *pkt * reader should be woken up. */ do_wakeup = 1; +#ifdef COMPAT_FREEBSD32 + /* + * If this is a 32-bit stream, then stick a 32-bit header at the + * front and copy the data into the buffer. + */ + if (d->bd_compat32) { + bzero(&hdr32, sizeof(hdr32)); + hdr32.bh_tstamp.tv_sec = tv->tv_sec; + hdr32.bh_tstamp.tv_usec = tv->tv_usec; + hdr32.bh_datalen = pktlen; + hdr32.bh_hdrlen = hdrlen; + hdr.bh_caplen = hdr32.bh_caplen = totlen - hdrlen; + bpf_append_bytes(d, d->bd_sbuf, curlen, &hdr32, sizeof(hdr32)); + goto copy; + } +#endif /* * Append the bpf header. Note we append the actual header size, but @@ -1846,6 +2005,9 @@ catchpacket(struct bpf_d *d, u_char *pkt /* * Copy the packet data into the store buffer and update its length. */ +#ifdef COMPAT_FREEBSD32 + copy: +#endif (*cpfn)(d, d->bd_sbuf, curlen + hdrlen, pkt, hdr.bh_caplen); d->bd_slen = curlen + totlen; Modified: user/kmacy/head_page_lock_2/sys/net/bpfdesc.h ============================================================================== --- user/kmacy/head_page_lock_2/sys/net/bpfdesc.h Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/sys/net/bpfdesc.h Sun Apr 25 23:42:23 2010 (r207211) @@ -97,6 +97,7 @@ struct bpf_d { u_int64_t bd_wfcount; /* number of packets that matched write filter */ u_int64_t bd_wdcount; /* number of packets dropped during a write */ u_int64_t bd_zcopy; /* number of zero copy operations */ + u_char bd_compat32; /* 32-bit stream on LP64 system */ }; /* Values for bd_state */ Modified: user/kmacy/head_page_lock_2/sys/net/rtsock.c ============================================================================== --- user/kmacy/head_page_lock_2/sys/net/rtsock.c Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/sys/net/rtsock.c Sun Apr 25 23:42:23 2010 (r207211) @@ -29,6 +29,7 @@ * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 * $FreeBSD$ */ +#include "opt_compat.h" #include "opt_sctp.h" #include "opt_mpath.h" #include "opt_inet.h" @@ -71,6 +72,49 @@ extern void sctp_addr_change(struct ifad #endif /* SCTP */ #endif +#ifdef COMPAT_FREEBSD32 +#include <sys/mount.h> +#include <compat/freebsd32/freebsd32.h> + +struct if_data32 { + uint8_t ifi_type; + uint8_t ifi_physical; + uint8_t ifi_addrlen; + uint8_t ifi_hdrlen; + uint8_t ifi_link_state; + uint8_t ifi_spare_char1; + uint8_t ifi_spare_char2; + uint8_t ifi_datalen; + uint32_t ifi_mtu; + uint32_t ifi_metric; + uint32_t ifi_baudrate; + uint32_t ifi_ipackets; + uint32_t ifi_ierrors; + uint32_t ifi_opackets; + uint32_t ifi_oerrors; + uint32_t ifi_collisions; + uint32_t ifi_ibytes; + uint32_t ifi_obytes; + uint32_t ifi_imcasts; + uint32_t ifi_omcasts; + uint32_t ifi_iqdrops; + uint32_t ifi_noproto; + uint32_t ifi_hwassist; + int32_t ifi_epoch; + struct timeval32 ifi_lastchange; +}; + +struct if_msghdr32 { + uint16_t ifm_msglen; + uint8_t ifm_version; + uint8_t ifm_type; + int32_t ifm_addrs; + int32_t ifm_flags; + uint16_t ifm_index; + struct if_data32 ifm_data; +}; +#endif + MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables"); /* NB: these are not modified */ @@ -1001,6 +1045,12 @@ again: break; case RTM_IFINFO: +#ifdef COMPAT_FREEBSD32 + if (w != NULL && w->w_req->flags & SCTL_MASK32) { + len = sizeof(struct if_msghdr32); + break; + } +#endif len = sizeof(struct if_msghdr); break; @@ -1367,6 +1417,38 @@ sysctl_dumpentry(struct radix_node *rn, return (error); } +#ifdef COMPAT_FREEBSD32 +static void +copy_ifdata32(struct if_data *src, struct if_data32 *dst) +{ + + bzero(dst, sizeof(*dst)); + CP(*src, *dst, ifi_type); + CP(*src, *dst, ifi_physical); + CP(*src, *dst, ifi_addrlen); + CP(*src, *dst, ifi_hdrlen); + CP(*src, *dst, ifi_link_state); + CP(*src, *dst, ifi_datalen); + CP(*src, *dst, ifi_mtu); + CP(*src, *dst, ifi_metric); + CP(*src, *dst, ifi_baudrate); + CP(*src, *dst, ifi_ipackets); + CP(*src, *dst, ifi_ierrors); + CP(*src, *dst, ifi_opackets); + CP(*src, *dst, ifi_oerrors); + CP(*src, *dst, ifi_collisions); + CP(*src, *dst, ifi_ibytes); + CP(*src, *dst, ifi_obytes); + CP(*src, *dst, ifi_imcasts); + CP(*src, *dst, ifi_omcasts); + CP(*src, *dst, ifi_iqdrops); + CP(*src, *dst, ifi_noproto); + CP(*src, *dst, ifi_hwassist); + CP(*src, *dst, ifi_epoch); + TV_CP(*src, *dst, ifi_lastchange); +} +#endif + static int sysctl_iflist(int af, struct walkarg *w) { @@ -1387,12 +1469,30 @@ sysctl_iflist(int af, struct walkarg *w) if (w->w_req && w->w_tmem) { struct if_msghdr *ifm; +#ifdef COMPAT_FREEBSD32 + if (w->w_req->flags & SCTL_MASK32) { + struct if_msghdr32 *ifm32; + + ifm32 = (struct if_msghdr32 *)w->w_tmem; + ifm32->ifm_index = ifp->if_index; + ifm32->ifm_flags = ifp->if_flags | + ifp->if_drv_flags; + copy_ifdata32(&ifp->if_data, &ifm32->ifm_data); + ifm32->ifm_addrs = info.rti_addrs; + error = SYSCTL_OUT(w->w_req, (caddr_t)ifm32, + len); + goto sysctl_out; + } +#endif ifm = (struct if_msghdr *)w->w_tmem; ifm->ifm_index = ifp->if_index; ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; ifm->ifm_data = ifp->if_data; ifm->ifm_addrs = info.rti_addrs; - error = SYSCTL_OUT(w->w_req,(caddr_t)ifm, len); + error = SYSCTL_OUT(w->w_req, (caddr_t)ifm, len); +#ifdef COMPAT_FREEBSD32 + sysctl_out: +#endif if (error) goto done; } Modified: user/kmacy/head_page_lock_2/sys/netinet/sctp_indata.c ============================================================================== --- user/kmacy/head_page_lock_2/sys/netinet/sctp_indata.c Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/sys/netinet/sctp_indata.c Sun Apr 25 23:42:23 2010 (r207211) @@ -3514,25 +3514,6 @@ sctp_strike_gap_ack_chunks(struct sctp_t if (tp1->sent == SCTP_DATAGRAM_RESEND) { struct sctp_nets *alt; - if ((stcb->asoc.peer_supports_prsctp) && - (PR_SCTP_RTX_ENABLED(tp1->flags))) { - /* - * Has it been retransmitted tv_sec times? - - * we store the retran count there. - */ - if (tp1->snd_count > tp1->rec.data.timetodrop.tv_sec) { - /* Yes, so drop it */ - if (tp1->data != NULL) { - (void)sctp_release_pr_sctp_chunk(stcb, tp1, - (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), - SCTP_SO_NOT_LOCKED); - } - /* Make sure to flag we had a FR */ - tp1->whoTo->net_ack++; - tp1 = TAILQ_NEXT(tp1, sctp_next); - continue; - } - } /* fix counts and things */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND, @@ -3555,6 +3536,25 @@ sctp_strike_gap_ack_chunks(struct sctp_t /* remove from the total flight */ sctp_total_flight_decrease(stcb, tp1); + if ((stcb->asoc.peer_supports_prsctp) && + (PR_SCTP_RTX_ENABLED(tp1->flags))) { + /* + * Has it been retransmitted tv_sec times? - + * we store the retran count there. + */ + if (tp1->snd_count > tp1->rec.data.timetodrop.tv_sec) { + /* Yes, so drop it */ + if (tp1->data != NULL) { + (void)sctp_release_pr_sctp_chunk(stcb, tp1, + (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), + SCTP_SO_NOT_LOCKED); + } + /* Make sure to flag we had a FR */ + tp1->whoTo->net_ack++; + tp1 = TAILQ_NEXT(tp1, sctp_next); + continue; + } + } /* printf("OK, we are now ready to FR this guy\n"); */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(tp1->rec.data.TSN_seq, tp1->snd_count, Modified: user/kmacy/head_page_lock_2/sys/netinet/sctp_output.c ============================================================================== --- user/kmacy/head_page_lock_2/sys/netinet/sctp_output.c Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/sys/netinet/sctp_output.c Sun Apr 25 23:42:23 2010 (r207211) @@ -8973,7 +8973,7 @@ sctp_chunk_retransmission(struct sctp_in /* (void)SCTP_GETTIME_TIMEVAL(&chk->whoTo->last_sent_time); */ *cnt_out += 1; chk->sent = SCTP_DATAGRAM_SENT; - sctp_ucount_decr(asoc->sent_queue_retran_cnt); + /* sctp_ucount_decr(asoc->sent_queue_retran_cnt); */ if (fwd_tsn == 0) { return (0); } else { Modified: user/kmacy/head_page_lock_2/usr.bin/alias/Makefile ============================================================================== --- user/kmacy/head_page_lock_2/usr.bin/alias/Makefile Sun Apr 25 23:18:02 2010 (r207210) +++ user/kmacy/head_page_lock_2/usr.bin/alias/Makefile Sun Apr 25 23:42:23 2010 (r207211) @@ -10,8 +10,11 @@ LINKS= ${BINDIR}/alias ${BINDIR}/bg \ ${BINDIR}/alias ${BINDIR}/fc \ ${BINDIR}/alias ${BINDIR}/fg \ ${BINDIR}/alias ${BINDIR}/getopts \ + ${BINDIR}/alias ${BINDIR}/hash \ ${BINDIR}/alias ${BINDIR}/jobs \ ${BINDIR}/alias ${BINDIR}/read \ + ${BINDIR}/alias ${BINDIR}/type \ + ${BINDIR}/alias ${BINDIR}/ulimit \ ${BINDIR}/alias ${BINDIR}/umask \ ${BINDIR}/alias ${BINDIR}/unalias \ ${BINDIR}/alias ${BINDIR}/wait
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004252342.o3PNgNo0005886>