svn commit: r200020 - head/sys/netinet

2009-12-02 Thread Luigi Rizzo
Author: luigi
Date: Wed Dec  2 08:52:06 2009
New Revision: 200020
URL: http://svn.freebsd.org/changeset/base/200020

Log:
  change the type of the opcode from enum *:8  to u_int8_t
  so the size and alignment of the ipfw_insn is not compiler dependent.
  No changes in the code generated by gcc.
  
  There was only one instance of this kind in our entire source tree,
  so i suspect the old definition was a poor choice (which i made).
  
  MFC after:3 days

Modified:
  head/sys/netinet/ip_fw.h

Modified: head/sys/netinet/ip_fw.h
==
--- head/sys/netinet/ip_fw.hWed Dec  2 07:51:25 2009(r200019)
+++ head/sys/netinet/ip_fw.hWed Dec  2 08:52:06 2009(r200020)
@@ -237,7 +237,7 @@ enum ipfw_opcodes { /* arguments (4 byt
  *
  */
 typedef struct _ipfw_insn {/* template for instructions */
-   enum ipfw_opcodes   opcode:8;
+   u_int8_topcode;
u_int8_tlen;/* number of 32-bit words */
 #defineF_NOT   0x80
 #defineF_OR0x40
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn: stable/7/sys: conf dev/bce

2009-12-02 Thread Maxim Sobolev

Attila Nagy wrote:

Maxim Sobolev wrote:

Stanislav Sedov wrote:

On Mon, 30 Nov 2009 13:25:03 -0800
Maxim Sobolev  mentioned:

Can we change the name then? We've seen the similar issue without 
the jumbo frames, which made me wonder.


It's strange, because 'normal' frames are less than a page size in 
length,
so the issue I was experiencing should not be reproducable with jumbo 
frames
disabled.  Can you describe a bit more what kind of problem you're 
experiencing?


The traffic through interface abruptly halts randomly when under a 
load, without any signs of a problem. What is interesting is that the 
communication through unix domain sockets appears to be down too, 
since some scripts that connect to database not able to complete as 
well, so whatever this problem is it affect the whole network 
subsystem. We tried to replace hardware and it did not help. Only 
after we replaced bce(4) with IntelPro card (em) the problem has went 
away.
Sorry, I've just noticed this thread and did not read the earlier posts. 
I can see similar, although only (at least for now) on version 8 
(running something around RC2), also with bce interfaces and "heavy" -in 
terms of pps, this is a DNS server- network load.


Everything which involves network halts for some minutes, but the 
machine is completely usable from the console. top shows some processes 
(I don't have an output, but as far as I can remember they were only 
that which did network IO) in the "keglim" state.

Then something happens and the machine starts to work again.

Can this be the same, or is it completely different?


It really looks like the same issue. Those boxes are heavy-duty VoIP 
switches, so that they are handling high PPS as well in our case.


-Maxim
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r199827 - in head: include lib/libc/compat-43 sys/sys

2009-12-02 Thread Dima Panov
On Thursday 26 November 2009 23:49:38 Konstantin Belousov wrote:
> Author: kib
> Date: Thu Nov 26 13:49:37 2009
> New Revision: 199827
> URL: http://svn.freebsd.org/changeset/base/199827
> 
> Log:
>   Implement sighold, sigignore, sigpause, sigrelse, sigset functions
>   from SUSv4 XSI. Note that the functions are obsoleted, and only
>   provided to ease porting from System V-like systems. Since sigpause
>   already exists in compat with different interface, XSI sigpause is
>   named xsi_sigpause.
> 
>   Reviewed by:davidxu
>   MFC after:  3 weeks
> 
> Modified:
>   head/include/signal.h
>   head/lib/libc/compat-43/Makefile.inc
>   head/lib/libc/compat-43/Symbol.map
>   head/lib/libc/compat-43/sigcompat.c
>   head/lib/libc/compat-43/sigpause.2
>   head/sys/sys/signal.h
>   head/sys/sys/signalvar.h

kib, you forgot about osversion bump, it is strongly needed.

This changeset caused jdk (may be not only jdk) breakage, as jdk-bsd-patches
always provide own implementations of sigingnore() for FreeBSD.

Patch for jdk16 port will be ready soon.

-- 
Dima "Red Fox" Panov @ Home | C73E 2B72 1FFD 61BD E206 1234 A626 76ED 93E3 B018
Khabarovsk, Russia  | 2D30 2CCB 9984 130C 6F87 BAFC FB8B A09D D539 8F29
k...@freebsd Team | FreeBSD committer since 10.08.2009 | FreeBSD since Sept 1995
Twitter.com:fluffy_khv | Skype:dima.panov | Jabber.org:fluffy.khv | ICQ:1745024


signature.asc
Description: This is a digitally signed message part.


svn commit: r200021 - in stable/8/sys/cam: . scsi

2009-12-02 Thread Alexander Motin
Author: mav
Date: Wed Dec  2 10:10:37 2009
New Revision: 200021
URL: http://svn.freebsd.org/changeset/base/200021

Log:
  MFC r199279, r199280, r199281:
  - Fix several device freeze counting bugs.
  - Remove code that years ago was closing race between request submission
  to SIM and device/SIM freeze. That race become impossible after moving from
  spl to mutex locking, while this workaround causes some unexpected effects.

Modified:
  stable/8/sys/cam/cam_periph.c
  stable/8/sys/cam/cam_queue.c
  stable/8/sys/cam/cam_queue.h
  stable/8/sys/cam/cam_xpt.c
  stable/8/sys/cam/scsi/scsi_cd.c
  stable/8/sys/cam/scsi/scsi_ch.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/cam/cam_periph.c
==
--- stable/8/sys/cam/cam_periph.c   Wed Dec  2 08:52:06 2009
(r200020)
+++ stable/8/sys/cam/cam_periph.c   Wed Dec  2 10:10:37 2009
(r200021)
@@ -981,16 +981,21 @@ camperiphdone(struct cam_periph *periph,
 {
union ccb  *saved_ccb;
cam_status  status;
-   int frozen;
+   int frozen = 0;
int sense;
struct scsi_start_stop_unit *scsi_cmd;
u_int32_t   relsim_flags, timeout;
-   u_int32_t   qfrozen_cnt;
-   int xpt_done_ccb;
+   int xpt_done_ccb = FALSE;
 
-   xpt_done_ccb = FALSE;
status = done_ccb->ccb_h.status;
-   frozen = (status & CAM_DEV_QFRZN) != 0;
+   if (status & CAM_DEV_QFRZN) {
+   frozen = 1;
+   /*
+* Clear freeze flag now for case of retry,
+* freeze will be dropped later.
+*/
+   done_ccb->ccb_h.status &= ~CAM_DEV_QFRZN;
+   }
sense  = (status & CAM_AUTOSNS_VALID) != 0;
status &= CAM_STATUS_MASK;
 
@@ -998,17 +1003,6 @@ camperiphdone(struct cam_periph *periph,
relsim_flags = 0;
saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr;
 
-   /* 
-* Unfreeze the queue once if it is already frozen..
-*/
-   if (frozen != 0) {
-   qfrozen_cnt = cam_release_devq(done_ccb->ccb_h.path,
- /*relsim_flags*/0,
- /*openings*/0,
- /*timeout*/0,
- /*getcount_only*/0);
-   }
-
switch (status) {
case CAM_REQ_CMP:
{
@@ -1185,14 +1179,33 @@ camperiphdone(struct cam_periph *periph,
 */
if (done_ccb->ccb_h.retry_count > 0)
done_ccb->ccb_h.retry_count--;
-
-   qfrozen_cnt = cam_release_devq(done_ccb->ccb_h.path,
- /*relsim_flags*/relsim_flags,
- /*openings*/0,
- /*timeout*/timeout,
- /*getcount_only*/0);
-   if (xpt_done_ccb == TRUE)
+   /*
+* Drop freeze taken due to CAM_DEV_QFREEZE flag set on recovery
+* request.
+*/
+   cam_release_devq(done_ccb->ccb_h.path,
+/*relsim_flags*/relsim_flags,
+/*openings*/0,
+/*timeout*/timeout,
+/*getcount_only*/0);
+   if (xpt_done_ccb == TRUE) {
+   /*
+* Copy frozen flag from recovery request if it is set there
+* for some reason.
+*/
+   if (frozen != 0)
+   done_ccb->ccb_h.status |= CAM_DEV_QFRZN;
(*done_ccb->ccb_h.cbfcnp)(periph, done_ccb);
+   } else {
+   /* Drop freeze taken, if this recovery request got error. */
+   if (frozen != 0) {
+   cam_release_devq(done_ccb->ccb_h.path,
+/*relsim_flags*/0,
+/*openings*/0,
+/*timeout*/0,
+/*getcount_only*/0);
+   }
+   }
 }
 
 /*
@@ -1452,6 +1465,11 @@ camperiphscsisenseerror(union ccb *ccb, 
action_string = "No recovery CCB supplied";
goto sense_error_done;
}
+   /*
+* Clear freeze flag for original request here, as
+* this freeze will be dropped as part of ERESTART.
+*/
+   ccb->ccb_h.status &= ~CAM_DEV_QFRZN;
bcopy(ccb, save_ccb, siz

svn commit: r200022 - in stable/8: . contrib/top lib/libusb sbin/camcontrol sys/cam sys/cam/ata sys/dev/ahci sys/dev/siis tools/regression/lib/msun tools/regression/usr.bin/pkill tools/tools/ath/co...

2009-12-02 Thread Alexander Motin
Author: mav
Date: Wed Dec  2 10:32:34 2009
New Revision: 200022
URL: http://svn.freebsd.org/changeset/base/200022

Log:
  MFC r199747, r199799, r199821:
  - Extend XPT-SIM transfer settings control API. Now it allows to report to
  SATA SIM number of tags supported by each device, implement ATA mode and
  SATA revision negotiation for both SATA and PATA SIMs.
  - Make ahci(4) and siis(4) to use submitted maximum tag number, when
  scheduling requests. It allows to support NCQ on devices with lower tags
  count then controller supports.
  - Make PMP driver to report attached devices connection speeds.
  - Implement ATA mode negotiation between user settings, device and
  controller capabilities.
  - Improve ATA mode/SATA revision control.

Modified:
  stable/8/sbin/camcontrol/camcontrol.8
  stable/8/sbin/camcontrol/camcontrol.c
  stable/8/sys/cam/ata/ata_all.c
  stable/8/sys/cam/ata/ata_all.h
  stable/8/sys/cam/ata/ata_pmp.c
  stable/8/sys/cam/ata/ata_xpt.c
  stable/8/sys/cam/cam_ccb.h
  stable/8/sys/cam/cam_xpt.c
  stable/8/sys/dev/ahci/ahci.c
  stable/8/sys/dev/ahci/ahci.h
  stable/8/sys/dev/siis/siis.c
  stable/8/sys/dev/siis/siis.h
Directory Properties:
  stable/8/   (props changed)
  stable/8/ObsoleteFiles.inc   (props changed)
  stable/8/UPDATING   (props changed)
  stable/8/bin/csh/   (props changed)
  stable/8/bin/ps/   (props changed)
  stable/8/bin/sh/   (props changed)
  stable/8/cddl/compat/opensolaris/   (props changed)
  stable/8/cddl/contrib/opensolaris/   (props changed)
  stable/8/cddl/lib/libnvpair/   (props changed)
  stable/8/contrib/bind9/   (props changed)
  stable/8/contrib/bzip2/   (props changed)
  stable/8/contrib/cpio/   (props changed)
  stable/8/contrib/csup/   (props changed)
  stable/8/contrib/ee/   (props changed)
  stable/8/contrib/file/   (props changed)
  stable/8/contrib/gdb/   (props changed)
  stable/8/contrib/gdtoa/   (props changed)
  stable/8/contrib/less/   (props changed)
  stable/8/contrib/libpcap/   (props changed)
  stable/8/contrib/ncurses/   (props changed)
  stable/8/contrib/netcat/   (props changed)
  stable/8/contrib/ntp/   (props changed)
  stable/8/contrib/openbsm/   (props changed)
  stable/8/contrib/openpam/   (props changed)
  stable/8/contrib/pf/   (props changed)
  stable/8/contrib/sendmail/   (props changed)
  stable/8/contrib/tcpdump/   (props changed)
  stable/8/contrib/tcsh/   (props changed)
  stable/8/contrib/top/   (props changed)
  stable/8/contrib/top/install-sh   (props changed)
  stable/8/contrib/traceroute/   (props changed)
  stable/8/contrib/wpa/   (props changed)
  stable/8/crypto/openssh/   (props changed)
  stable/8/crypto/openssl/   (props changed)
  stable/8/etc/   (props changed)
  stable/8/games/fortune/   (props changed)
  stable/8/games/fortune/datfiles/   (props changed)
  stable/8/gnu/usr.bin/groff/   (props changed)
  stable/8/gnu/usr.bin/patch/   (props changed)
  stable/8/include/   (props changed)
  stable/8/kerberos5/lib/libgssapi_krb5/   (props changed)
  stable/8/kerberos5/lib/libgssapi_spnego/   (props changed)
  stable/8/lib/libarchive/   (props changed)
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libdevinfo/   (props changed)
  stable/8/lib/libdisk/   (props changed)
  stable/8/lib/libfetch/   (props changed)
  stable/8/lib/libkvm/   (props changed)
  stable/8/lib/libradius/   (props changed)
  stable/8/lib/libstand/   (props changed)
  stable/8/lib/libthr/   (props changed)
  stable/8/lib/libusb/   (props changed)
  stable/8/lib/libusb/usb.h   (props changed)
  stable/8/lib/libutil/   (props changed)
  stable/8/libexec/rtld-elf/   (props changed)
  stable/8/release/   (props changed)
  stable/8/release/doc/   (props changed)
  stable/8/release/doc/en_US.ISO8859-1/hardware/   (props changed)
  stable/8/sbin/   (props changed)
  stable/8/sbin/bsdlabel/   (props changed)
  stable/8/sbin/camcontrol/   (props changed)
  stable/8/sbin/ddb/   (props changed)
  stable/8/sbin/dhclient/   (props changed)
  stable/8/sbin/fsck/   (props changed)
  stable/8/sbin/geom/   (props changed)
  stable/8/sbin/ifconfig/   (props changed)
  stable/8/sbin/ipfw/   (props changed)
  stable/8/sbin/mksnap_ffs/   (props changed)
  stable/8/sbin/mount/   (props changed)
  stable/8/sbin/mount_cd9660/   (props changed)
  stable/8/sbin/mount_nfs/   (props changed)
  stable/8/sbin/umount/   (props changed)
  stable/8/secure/usr.bin/bdes/   (props changed)
  stable/8/share/man/man3/   (props changed)
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man5/   (props changed)
  stable/8/share/man/man7/   (props changed)
  stable/8/share/man/man9/   (props changed)
  stable/8/share/misc/   (props changed)
  stable/8/share/timedef/   (props changed)
  stable/8/share/zoneinfo/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props cha

svn commit: r200023 - head/sys/netinet

2009-12-02 Thread Luigi Rizzo
Author: luigi
Date: Wed Dec  2 10:36:41 2009
New Revision: 200023
URL: http://svn.freebsd.org/changeset/base/200023

Log:
  Add new sockopt names for ipfw and dummynet.
  
  This commit is just grabbing entries for the new names
  that will be used in the future, so you don't need to
  rebuild anything now.
  
  MFC after:3 days

Modified:
  head/sys/netinet/in.h

Modified: head/sys/netinet/in.h
==
--- head/sys/netinet/in.h   Wed Dec  2 10:32:34 2009(r200022)
+++ head/sys/netinet/in.h   Wed Dec  2 10:36:41 2009(r200023)
@@ -423,12 +423,20 @@ __END_DECLS
 #defineIP_ONESBCAST23   /* bool: send all-ones broadcast */
 #defineIP_BINDANY  24   /* bool: allow bind to any address 
*/
 
+/*
+ * Options for controlling the firewall and dummynet.
+ * Historical options (from 40 to 64) will eventually be
+ * replaced by only two options, IP_FW3 and IP_DUMMYNET3.
+ */
 #defineIP_FW_TABLE_ADD 40   /* add entry */
 #defineIP_FW_TABLE_DEL 41   /* delete entry */
 #defineIP_FW_TABLE_FLUSH   42   /* flush table */
 #defineIP_FW_TABLE_GETSIZE 43   /* get table size */
 #defineIP_FW_TABLE_LIST44   /* list table contents */
 
+#defineIP_FW3  48   /* generic ipfw v.3 sockopts */
+#defineIP_DUMMYNET349   /* generic dummynet v.3 sockopts */
+
 #defineIP_FW_ADD   50   /* add a firewall rule to chain */
 #defineIP_FW_DEL   51   /* delete a firewall rule from 
chain */
 #defineIP_FW_FLUSH 52   /* flush firewall rule chain */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200024 - in stable/8: . contrib/top lib/libusb sbin/atacontrol sys/conf sys/dev/ata sys/modules/ata/atausb sys/sys tools/regression/lib/msun tools/regression/usr.bin/pkill tools/tools/...

2009-12-02 Thread Alexander Motin
Author: mav
Date: Wed Dec  2 10:47:11 2009
New Revision: 200024
URL: http://svn.freebsd.org/changeset/base/200024

Log:
  MFC r199822:
  Drop USB mass storage devices support from ata(4). It is out of the build as
  long as I remember, and completely superseded by better maintained umass(4).
  It's main idea was to optionally avoid CAM dependency for such devices, but
  with move ATA to CAM, it is not actual any more.
  
  No objections:  hselasky@, thompsa@, arch@

Deleted:
  stable/8/sys/dev/ata/ata-usb.c
  stable/8/sys/modules/ata/atausb/
Modified:
  stable/8/sbin/atacontrol/atacontrol.c
  stable/8/sys/conf/files
  stable/8/sys/dev/ata/ata-all.c
  stable/8/sys/sys/ata.h
Directory Properties:
  stable/8/   (props changed)
  stable/8/ObsoleteFiles.inc   (props changed)
  stable/8/UPDATING   (props changed)
  stable/8/bin/csh/   (props changed)
  stable/8/bin/ps/   (props changed)
  stable/8/bin/sh/   (props changed)
  stable/8/cddl/compat/opensolaris/   (props changed)
  stable/8/cddl/contrib/opensolaris/   (props changed)
  stable/8/cddl/lib/libnvpair/   (props changed)
  stable/8/contrib/bind9/   (props changed)
  stable/8/contrib/bzip2/   (props changed)
  stable/8/contrib/cpio/   (props changed)
  stable/8/contrib/csup/   (props changed)
  stable/8/contrib/ee/   (props changed)
  stable/8/contrib/file/   (props changed)
  stable/8/contrib/gdb/   (props changed)
  stable/8/contrib/gdtoa/   (props changed)
  stable/8/contrib/less/   (props changed)
  stable/8/contrib/libpcap/   (props changed)
  stable/8/contrib/ncurses/   (props changed)
  stable/8/contrib/netcat/   (props changed)
  stable/8/contrib/ntp/   (props changed)
  stable/8/contrib/openbsm/   (props changed)
  stable/8/contrib/openpam/   (props changed)
  stable/8/contrib/pf/   (props changed)
  stable/8/contrib/sendmail/   (props changed)
  stable/8/contrib/tcpdump/   (props changed)
  stable/8/contrib/tcsh/   (props changed)
  stable/8/contrib/top/   (props changed)
  stable/8/contrib/top/install-sh   (props changed)
  stable/8/contrib/traceroute/   (props changed)
  stable/8/contrib/wpa/   (props changed)
  stable/8/crypto/openssh/   (props changed)
  stable/8/crypto/openssl/   (props changed)
  stable/8/etc/   (props changed)
  stable/8/games/fortune/   (props changed)
  stable/8/games/fortune/datfiles/   (props changed)
  stable/8/gnu/usr.bin/groff/   (props changed)
  stable/8/gnu/usr.bin/patch/   (props changed)
  stable/8/include/   (props changed)
  stable/8/kerberos5/lib/libgssapi_krb5/   (props changed)
  stable/8/kerberos5/lib/libgssapi_spnego/   (props changed)
  stable/8/lib/libarchive/   (props changed)
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libdevinfo/   (props changed)
  stable/8/lib/libdisk/   (props changed)
  stable/8/lib/libfetch/   (props changed)
  stable/8/lib/libkvm/   (props changed)
  stable/8/lib/libradius/   (props changed)
  stable/8/lib/libstand/   (props changed)
  stable/8/lib/libthr/   (props changed)
  stable/8/lib/libusb/   (props changed)
  stable/8/lib/libusb/usb.h   (props changed)
  stable/8/lib/libutil/   (props changed)
  stable/8/libexec/rtld-elf/   (props changed)
  stable/8/release/   (props changed)
  stable/8/release/doc/   (props changed)
  stable/8/release/doc/en_US.ISO8859-1/hardware/   (props changed)
  stable/8/sbin/   (props changed)
  stable/8/sbin/bsdlabel/   (props changed)
  stable/8/sbin/camcontrol/   (props changed)
  stable/8/sbin/ddb/   (props changed)
  stable/8/sbin/dhclient/   (props changed)
  stable/8/sbin/fsck/   (props changed)
  stable/8/sbin/geom/   (props changed)
  stable/8/sbin/ifconfig/   (props changed)
  stable/8/sbin/ipfw/   (props changed)
  stable/8/sbin/mksnap_ffs/   (props changed)
  stable/8/sbin/mount/   (props changed)
  stable/8/sbin/mount_cd9660/   (props changed)
  stable/8/sbin/mount_nfs/   (props changed)
  stable/8/sbin/umount/   (props changed)
  stable/8/secure/usr.bin/bdes/   (props changed)
  stable/8/share/man/man3/   (props changed)
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man5/   (props changed)
  stable/8/share/man/man7/   (props changed)
  stable/8/share/man/man9/   (props changed)
  stable/8/share/misc/   (props changed)
  stable/8/share/timedef/   (props changed)
  stable/8/share/zoneinfo/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/tools/kerneldoc/subsys/   (props changed)
  stable/8/tools/regression/bin/sh/   (props changed)
  stable/8/tools/regression/lib/msun/test-conj.t   (props changed)
  stable/8/tools/regression/poll/   (props changed)
  stable/8/tools/regression/priv/   (props changed)
  stable/8/tools/regression/usr.bin/pkill/pgrep-_g.t   (props changed)
  stable/8/tools/regre

svn commit: r200025 - stable/8/sbin/atacontrol

2009-12-02 Thread Alexander Motin
Author: mav
Date: Wed Dec  2 12:26:26 2009
New Revision: 200025
URL: http://svn.freebsd.org/changeset/base/200025

Log:
  MFC r199644:
  
  Add some missing WDMA/UDMA modes.

Modified:
  stable/8/sbin/atacontrol/atacontrol.c
Directory Properties:
  stable/8/sbin/atacontrol/   (props changed)

Modified: stable/8/sbin/atacontrol/atacontrol.c
==
--- stable/8/sbin/atacontrol/atacontrol.c   Wed Dec  2 10:47:11 2009
(r200024)
+++ stable/8/sbin/atacontrol/atacontrol.c   Wed Dec  2 12:26:26 2009
(r200025)
@@ -49,8 +49,13 @@ mode2str(int mode)
case ATA_PIO2: return "PIO2";
case ATA_PIO3: return "PIO3";
case ATA_PIO4: return "PIO4";
+   case ATA_WDMA0: return "WDMA0";
+   case ATA_WDMA1: return "WDMA1";
case ATA_WDMA2: return "WDMA2";
+   case ATA_UDMA0: return "UDMA0";
+   case ATA_UDMA1: return "UDMA1";
case ATA_UDMA2: return "UDMA33";
+   case ATA_UDMA3: return "UDMA44";
case ATA_UDMA4: return "UDMA66";
case ATA_UDMA5: return "UDMA100";
case ATA_UDMA6: return "UDMA133";
@@ -70,9 +75,15 @@ str2mode(char *str)
if (!strcasecmp(str, "PIO2")) return ATA_PIO2;
if (!strcasecmp(str, "PIO3")) return ATA_PIO3;
if (!strcasecmp(str, "PIO4")) return ATA_PIO4;
+   if (!strcasecmp(str, "WDMA0")) return ATA_WDMA0;
+   if (!strcasecmp(str, "WDMA1")) return ATA_WDMA1;
if (!strcasecmp(str, "WDMA2")) return ATA_WDMA2;
+   if (!strcasecmp(str, "UDMA0")) return ATA_UDMA0;
+   if (!strcasecmp(str, "UDMA1")) return ATA_UDMA1;
if (!strcasecmp(str, "UDMA2")) return ATA_UDMA2;
if (!strcasecmp(str, "UDMA33")) return ATA_UDMA2;
+   if (!strcasecmp(str, "UDMA3")) return ATA_UDMA3;
+   if (!strcasecmp(str, "UDMA44")) return ATA_UDMA3;
if (!strcasecmp(str, "UDMA4")) return ATA_UDMA4;
if (!strcasecmp(str, "UDMA66")) return ATA_UDMA4;
if (!strcasecmp(str, "UDMA5")) return ATA_UDMA5;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200026 - head/sys/netinet

2009-12-02 Thread Gleb Smirnoff
Author: glebius
Date: Wed Dec  2 13:24:21 2009
New Revision: 200026
URL: http://svn.freebsd.org/changeset/base/200026

Log:
  Until this moment carp(4) used a strange logging priority. It used debug
  priority for such important information as MASTER/BACKUP state change,
  and used a normal logging priority for such innocent messages as receiving
  short packet (which is a normal VRRP packet between some other routers) or
  receving a CARP packet on non-carp interface (someone else running CARP).
  
  This commit shifts message logging priorities to a more sane default.

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Wed Dec  2 12:26:26 2009(r200025)
+++ head/sys/netinet/ip_carp.c  Wed Dec  2 13:24:21 2009(r200026)
@@ -550,7 +550,7 @@ carp_input(struct mbuf *m, int hlen)
/* check if received on a valid carp interface */
if (m->m_pkthdr.rcvif->if_carp == NULL) {
CARPSTATS_INC(carps_badif);
-   CARP_LOG("carp_input: packet received on non-carp "
+   CARP_DEBUG("carp_input: packet received on non-carp "
"interface: %s\n",
m->m_pkthdr.rcvif->if_xname);
m_freem(m);
@@ -571,7 +571,7 @@ carp_input(struct mbuf *m, int hlen)
 
if (m->m_pkthdr.len < iplen + sizeof(*ch)) {
CARPSTATS_INC(carps_badlen);
-   CARP_LOG("carp_input: received len %zd < "
+   CARP_DEBUG("carp_input: received len %zd < "
"sizeof(struct carp_header) on %s\n",
m->m_len - sizeof(struct ip),
m->m_pkthdr.rcvif->if_xname);
@@ -582,7 +582,7 @@ carp_input(struct mbuf *m, int hlen)
if (iplen + sizeof(*ch) < m->m_len) {
if ((m = m_pullup(m, iplen + sizeof(*ch))) == NULL) {
CARPSTATS_INC(carps_hdrops);
-   CARP_LOG("carp_input: pullup failed\n");
+   CARP_DEBUG("carp_input: pullup failed\n");
return;
}
ip = mtod(m, struct ip *);
@@ -596,7 +596,7 @@ carp_input(struct mbuf *m, int hlen)
len = iplen + sizeof(*ch);
if (len > m->m_pkthdr.len) {
CARPSTATS_INC(carps_badlen);
-   CARP_LOG("carp_input: packet too short %d on %s\n",
+   CARP_DEBUG("carp_input: packet too short %d on %s\n",
m->m_pkthdr.len,
m->m_pkthdr.rcvif->if_xname);
m_freem(m);
@@ -614,7 +614,7 @@ carp_input(struct mbuf *m, int hlen)
m->m_data += iplen;
if (carp_cksum(m, len - iplen)) {
CARPSTATS_INC(carps_badsum);
-   CARP_LOG("carp_input: checksum failed on %s\n",
+   CARP_DEBUG("carp_input: checksum failed on %s\n",
m->m_pkthdr.rcvif->if_xname);
m_freem(m);
return;
@@ -643,7 +643,7 @@ carp6_input(struct mbuf **mp, int *offp,
/* check if received on a valid carp interface */
if (m->m_pkthdr.rcvif->if_carp == NULL) {
CARPSTATS_INC(carps_badif);
-   CARP_LOG("carp6_input: packet received on non-carp "
+   CARP_DEBUG("carp6_input: packet received on non-carp "
"interface: %s\n",
m->m_pkthdr.rcvif->if_xname);
m_freem(m);
@@ -653,7 +653,7 @@ carp6_input(struct mbuf **mp, int *offp,
/* verify that the IP TTL is 255 */
if (ip6->ip6_hlim != CARP_DFLTTL) {
CARPSTATS_INC(carps_badttl);
-   CARP_LOG("carp6_input: received ttl %d != 255 on %s\n",
+   CARP_DEBUG("carp6_input: received ttl %d != 255 on %s\n",
ip6->ip6_hlim,
m->m_pkthdr.rcvif->if_xname);
m_freem(m);
@@ -665,7 +665,7 @@ carp6_input(struct mbuf **mp, int *offp,
IP6_EXTHDR_GET(ch, struct carp_header *, m, *offp, sizeof(*ch));
if (ch == NULL) {
CARPSTATS_INC(carps_badlen);
-   CARP_LOG("carp6_input: packet size %u too small\n", len);
+   CARP_DEBUG("carp6_input: packet size %u too small\n", len);
return (IPPROTO_DONE);
}
 
@@ -674,7 +674,7 @@ carp6_input(struct mbuf **mp, int *offp,
m->m_data += *offp;
if (carp_cksum(m, sizeof(*ch))) {
CARPSTATS_INC(carps_badsum);
-   CARP_LOG("carp6_input: checksum failed, on %s\n",
+   CARP_DEBUG("carp6_input: checksum failed, on %s\n",
m->m_pkthdr.rcvif->if_xname);
m_freem(m);
return (IPPROTO_DONE);
@@ -727,7 +727,7 @@ carp_input_c(struct mbuf *m, struct carp
CARPSTATS_INC(carps_badver);
SC2IFP(sc)->if_ierrors++;
CARP_UNLOCK(ifp-

Re: svn commit: r199827 - in head: include lib/libc/compat-43 sys/sys

2009-12-02 Thread Kostik Belousov
On Wed, Dec 02, 2009 at 07:25:56PM +1000, Dima Panov wrote:
> On Thursday 26 November 2009 23:49:38 Konstantin Belousov wrote:
> > Author: kib
> > Date: Thu Nov 26 13:49:37 2009
> > New Revision: 199827
> > URL: http://svn.freebsd.org/changeset/base/199827
> > 
> > Log:
> >   Implement sighold, sigignore, sigpause, sigrelse, sigset functions
> >   from SUSv4 XSI. Note that the functions are obsoleted, and only
> >   provided to ease porting from System V-like systems. Since sigpause
> >   already exists in compat with different interface, XSI sigpause is
> >   named xsi_sigpause.
> > 
> >   Reviewed by:  davidxu
> >   MFC after:3 weeks
> > 
> > Modified:
> >   head/include/signal.h
> >   head/lib/libc/compat-43/Makefile.inc
> >   head/lib/libc/compat-43/Symbol.map
> >   head/lib/libc/compat-43/sigcompat.c
> >   head/lib/libc/compat-43/sigpause.2
> >   head/sys/sys/signal.h
> >   head/sys/sys/signalvar.h
> 
> kib, you forgot about osversion bump, it is strongly needed.
No. My interpretation of __FreeBSD_version is that the bump indicates
incompatible change in the interfaces. Sometime it is used to mark the
point where big changes hit the tree, possibly not related to interface
change.

Also, __FreeBSD_version denotes the kernel "version". We do support
running earlier usermode on the later kernels. Think about kernel-only
upgrades, compatXx libs and jails which can run arbitrary earlier
usermode. (The change in question is purely libc).

Said this, I think it is actually harmful practice to bump
__FreeBSD_version after API additions or feature implementation.

I can bump version for this case, but due to the above reason,
it would not make much sense.
> 
> This changeset caused jdk (may be not only jdk) breakage, as jdk-bsd-patches
> always provide own implementations of sigingnore() for FreeBSD.
> 
> Patch for jdk16 port will be ready soon.

Ok, thanks for working on this.


pgpJ1YjoFyCn2.pgp
Description: PGP signature


svn commit: r200027 - head/sys/netinet/ipfw

2009-12-02 Thread Hajimu UMEMOTO
Author: ume
Date: Wed Dec  2 14:32:01 2009
New Revision: 200027
URL: http://svn.freebsd.org/changeset/base/200027

Log:
  Teach an IPv6 to send_pkt() and ipfw_tick().
  It fixes the issue which keep-alive doesn't work for an IPv6.
  
  PR:   kern/117234
  Submitted by: mlaier, Joost Bekkers 
  MFC after:1 month

Modified:
  head/sys/netinet/ipfw/ip_fw2.c

Modified: head/sys/netinet/ipfw/ip_fw2.c
==
--- head/sys/netinet/ipfw/ip_fw2.c  Wed Dec  2 13:24:21 2009
(r200026)
+++ head/sys/netinet/ipfw/ip_fw2.c  Wed Dec  2 14:32:01 2009
(r200027)
@@ -94,6 +94,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #ifdef INET6
 #include 
+#include 
 #endif
 
 #include   /* XXX for in_cksum */
@@ -249,6 +250,10 @@ static struct mtx ipfw_dyn_mtx;/* mute
 #defineIPFW_DYN_UNLOCK()   mtx_unlock(&ipfw_dyn_mtx)
 #defineIPFW_DYN_LOCK_ASSERT()  mtx_assert(&ipfw_dyn_mtx, MA_OWNED)
 
+static struct mbuf *send_pkt(struct mbuf *, struct ipfw_flow_id *,
+u_int32_t, u_int32_t, int);
+
+
 /*
  * Timeouts for various events in handing dynamic rules.
  */
@@ -708,60 +713,18 @@ send_reject6(struct ip_fw_args *args, in
m = args->m;
if (code == ICMP6_UNREACH_RST && args->f_id.proto == IPPROTO_TCP) {
struct tcphdr *tcp;
-   tcp_seq ack, seq;
-   int flags;
-   struct {
-   struct ip6_hdr ip6;
-   struct tcphdr th;
-   } ti;
tcp = (struct tcphdr *)((char *)ip6 + hlen);
 
-   if ((tcp->th_flags & TH_RST) != 0) {
-   m_freem(m);
-   args->m = NULL;
-   return;
-   }
-
-   ti.ip6 = *ip6;
-   ti.th = *tcp;
-   ti.th.th_seq = ntohl(ti.th.th_seq);
-   ti.th.th_ack = ntohl(ti.th.th_ack);
-   ti.ip6.ip6_nxt = IPPROTO_TCP;
-
-   if (ti.th.th_flags & TH_ACK) {
-   ack = 0;
-   seq = ti.th.th_ack;
-   flags = TH_RST;
-   } else {
-   ack = ti.th.th_seq;
-   if ((m->m_flags & M_PKTHDR) != 0) {
-   /*
-* total new data to ACK is:
-* total packet length,
-* minus the header length,
-* minus the tcp header length.
-*/
-   ack += m->m_pkthdr.len - hlen
-   - (ti.th.th_off << 2);
-   } else if (ip6->ip6_plen) {
-   ack += ntohs(ip6->ip6_plen) + sizeof(*ip6) -
-   hlen - (ti.th.th_off << 2);
-   } else {
-   m_freem(m);
-   return;
-   }
-   if (tcp->th_flags & TH_SYN)
-   ack++;
-   seq = 0;
-   flags = TH_RST|TH_ACK;
+   if ((tcp->th_flags & TH_RST) == 0) {
+   struct mbuf *m0;
+   m0 = send_pkt(args->m, &(args->f_id),
+   ntohl(tcp->th_seq), ntohl(tcp->th_ack),
+   tcp->th_flags | TH_RST);
+   if (m0 != NULL)
+   ip6_output(m0, NULL, NULL, 0, NULL, NULL,
+   NULL);
}
-   bcopy(&ti, ip6, sizeof(ti));
-   /*
-* m is only used to recycle the mbuf
-* The data in it is never read so we don't need
-* to correct the offsets or anything
-*/
-   tcp_respond(NULL, ip6, tcp, m, ack, seq, flags);
+   m_freem(m);
} else if (code != ICMP6_UNREACH_RST) { /* Send an ICMPv6 unreach. */
 #if 0
/*
@@ -1649,13 +1612,16 @@ send_pkt(struct mbuf *replyto, struct ip
 u_int32_t ack, int flags)
 {
struct mbuf *m;
-   struct ip *ip;
-   struct tcphdr *tcp;
+   int len, dir;
+   struct ip *h = NULL;/* stupid compiler */
+#ifdef INET6
+   struct ip6_hdr *h6 = NULL;
+#endif
+   struct tcphdr *th = NULL;
 
MGETHDR(m, M_DONTWAIT, MT_DATA);
-   if (m == 0)
+   if (m == NULL)
return (NULL);
-   m->m_pkthdr.rcvif = (struct ifnet *)0;
 
M_SETFIB(m, id->fib);
 #ifdef MAC
@@ -1667,67 +1633,118 @@ send_pkt(struct mbuf *replyto, struct ip
(void)replyto;  /* don't warn about unused arg */
 #endif
 
-   m->m_pkthdr.len = m->m_len = sizeof(struct ip) + sizeof(struct tcphdr);
+   switch (id->addr_type) {
+   case 4:
+   

svn commit: r200028 - in head: . etc etc/defaults etc/rc.d

2009-12-02 Thread Hajimu UMEMOTO
Author: ume
Date: Wed Dec  2 15:05:26 2009
New Revision: 200028
URL: http://svn.freebsd.org/changeset/base/200028

Log:
  Unify rc.firewall and rc.firewall6, and obsolete rc.firewall6
  and rc.d/ip6fw.
  
  Reviewed by:  dougb, jhb
  MFC after:1 month

Deleted:
  head/etc/rc.d/ip6fw
  head/etc/rc.firewall6
Modified:
  head/ObsoleteFiles.inc
  head/etc/Makefile
  head/etc/defaults/rc.conf
  head/etc/rc.d/Makefile
  head/etc/rc.d/ipfw
  head/etc/rc.firewall

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Dec  2 14:32:01 2009(r200027)
+++ head/ObsoleteFiles.inc  Wed Dec  2 15:05:26 2009(r200028)
@@ -14,6 +14,9 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20091202: unify rc.firewall and rc.firewall6.
+OLD_FILES+=etc/rc.d/ip6fw
+OLD_FILES+=etc/rc.firewall6
 # 20091117: removal of rc.early(8) link
 OLD_FILES+=usr/share/man/man8/rc.early.8.gz
 # 20091027: pselect.3 implemented as syscall

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Wed Dec  2 14:32:01 2009(r200027)
+++ head/etc/Makefile   Wed Dec  2 15:05:26 2009(r200028)
@@ -15,7 +15,7 @@ BIN1= auth.conf \
inetd.conf libalias.conf login.access login.conf mac.conf motd \
netconfig network.subr networks newsyslog.conf nsswitch.conf \
phones profile protocols \
-   rc rc.bsdextended rc.firewall rc.firewall6 rc.initdiskless \
+   rc rc.bsdextended rc.firewall rc.initdiskless \
rc.sendmail rc.shutdown \
rc.subr remote rpc services shells \
sysctl.conf syslog.conf

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Wed Dec  2 14:32:01 2009(r200027)
+++ head/etc/defaults/rc.conf   Wed Dec  2 15:05:26 2009(r200028)
@@ -118,7 +118,10 @@ firewall_type="UNKNOWN"# Firewall type
 firewall_quiet="NO"# Set to YES to suppress rule display
 firewall_logging="NO"  # Set to YES to enable events logging
 firewall_flags=""  # Flags passed to ipfw when type is a file
-firewall_client_net="192.0.2.0/24" # Network address for "client" firewall.
+firewall_client_net="192.0.2.0/24" # IPv4 Network address for "client"
+   # firewall.
+#firewall_client_net_ipv6="2001:db8:2:1::/64" # IPv6 network prefix for
+   # "client" firewall.
 firewall_simple_iif="ed1"  # Inside network interface for "simple"
# firewall.
 firewall_simple_inet="192.0.2.16/28" # Inside network address for "simple"
@@ -127,12 +130,22 @@ firewall_simple_oif="ed0" # Outside netw
# firewall.
 firewall_simple_onet="192.0.2.0/28" # Outside network address for "simple"
# firewall.
+#firewall_simple_iif_ipv6="ed1"# Inside IPv6 network interface for 
"simple"
+   # firewall.
+#firewall_simple_inet_ipv6="2001:db8:2:800::/56" # Inside IPv6 network prefix
+   # for "simple" firewall.
+#firewall_simple_oif_ipv6="ed0"# Outside IPv6 network interface for 
"simple"
+   # firewall.
+#firewall_simple_onet_ipv6="2001:db8:2:0::/56" # Outside IPv6 network prefix
+   # for "simple" firewall.
 firewall_myservices="" # List of TCP ports on which this host
# offers services for "workstation" firewall.
 firewall_allowservices=""  # List of IPs which have access to
# $firewall_myservices for "workstation"
# firewall.
-firewall_trusted=""# List of IPs which have full access to this
+firewall_trusted=""# List of IPv4s which have full access to this
+   # host for "workstation" firewall.
+firewall_trusted_ipv6=""   # List of IPv6s which have full access to this
# host for "workstation" firewall.
 firewall_logdeny="NO"  # Set to YES to log default denied incoming
# packets for "workstation" firewall.
@@ -472,13 +485,6 @@ ipv6_faith_prefix="NO" # Set faith pref
# faithd(8) setup.
 ipv6_ipv4mapping="NO"  # Set to "YES"

svn commit: r200029 - head/sys/netinet/ipfw

2009-12-02 Thread Luigi Rizzo
Author: luigi
Date: Wed Dec  2 15:20:31 2009
New Revision: 200029
URL: http://svn.freebsd.org/changeset/base/200029

Log:
  small changes for portability and diff reduction wrt/ FreeBSD 7.
  No functional differences.
  
  - use the div64() macro to wrap 64 bit divisions
(which almost always are 64 / 32 bits) so they are easier
to handle with compilers or OS that do not have native
support for 64bit divisions;
  
  - use a local variable for p_numbytes even if not strictly
necessary on HEAD, as it reduces diffs with FreeBSD7
  
  - in dummynet_send() check that a tag is present before
dereferencing the pointer.
  
  - add a couple of blank lines for readability near the end of a function
  
  MFC after:3 days

Modified:
  head/sys/netinet/ipfw/ip_dummynet.c

Modified: head/sys/netinet/ipfw/ip_dummynet.c
==
--- head/sys/netinet/ipfw/ip_dummynet.c Wed Dec  2 15:05:26 2009
(r200028)
+++ head/sys/netinet/ipfw/ip_dummynet.c Wed Dec  2 15:20:31 2009
(r200029)
@@ -570,7 +570,7 @@ compute_extra_bits(struct mbuf *pkt, str
if (!p->samples || p->samples_no == 0)
return 0;
index  = random() % p->samples_no;
-   extra_bits = ((dn_key)p->samples[index] * p->bandwidth) / 1000;
+   extra_bits = div64((dn_key)p->samples[index] * p->bandwidth, 1000);
if (index >= p->loss_level) {
struct dn_pkt_tag *dt = dn_tag_get(pkt);
if (dt)
@@ -696,11 +696,20 @@ ready_event_wfq(struct dn_pipe *p, struc
int p_was_empty = (p->head == NULL);
struct dn_heap *sch = &(p->scheduler_heap);
struct dn_heap *neh = &(p->not_eligible_heap);
+   int64_t p_numbytes = p->numbytes;
+
+   /*
+* p->numbytes is only 32bits in FBSD7, but we might need 64 bits.
+* Use a local variable for the computations, and write back the
+* results when done, saturating if needed.
+* The local variable has no impact on performance and helps
+* reducing diffs between the various branches.
+*/
 
DUMMYNET_LOCK_ASSERT();
 
if (p->if_name[0] == 0) /* tx clock is simulated */
-   p->numbytes += (curr_time - p->sched_time) * p->bandwidth;
+   p_numbytes += (curr_time - p->sched_time) * p->bandwidth;
else {  /*
 * tx clock is for real,
 * the ifq must be empty or this is a NOP.
@@ -717,7 +726,7 @@ ready_event_wfq(struct dn_pipe *p, struc
 * While we have backlogged traffic AND credit, we need to do
 * something on the queue.
 */
-   while (p->numbytes >= 0 && (sch->elements > 0 || neh->elements > 0)) {
+   while (p_numbytes >= 0 && (sch->elements > 0 || neh->elements > 0)) {
if (sch->elements > 0) {
/* Have some eligible pkts to send out. */
struct dn_flow_queue *q = sch->p[0].object;
@@ -727,10 +736,10 @@ ready_event_wfq(struct dn_pipe *p, struc
int len_scaled = p->bandwidth ? len * 8 * hz : 0;
 
heap_extract(sch, NULL); /* Remove queue from heap. */
-   p->numbytes -= len_scaled;
+   p_numbytes -= len_scaled;
move_pkt(pkt, q, p, len);
 
-   p->V += (len << MY_M) / p->sum; /* Update V. */
+   p->V += div64((len << MY_M), p->sum);   /* Update V. */
q->S = q->F;/* Update start time. */
if (q->len == 0) {
/* Flow not backlogged any more. */
@@ -745,7 +754,7 @@ ready_event_wfq(struct dn_pipe *p, struc
 * (we will fix this later).
 */
len = (q->head)->m_pkthdr.len;
-   q->F += (len << MY_M) / (uint64_t)fs->weight;
+   q->F += div64((len << MY_M), fs->weight);
if (DN_KEY_LEQ(q->S, p->V))
heap_insert(neh, q->S, q);
else
@@ -768,11 +777,11 @@ ready_event_wfq(struct dn_pipe *p, struc
}
 
if (p->if_name[0] != '\0') { /* Tx clock is from a real thing */
-   p->numbytes = -1;   /* Mark not ready for I/O. */
+   p_numbytes = -1;/* Mark not ready for I/O. */
break;
}
}
-   if (sch->elements == 0 && neh->elements == 0 && p->numbytes >= 0) {
+   if (sch->elements == 0 && neh->elements == 0 && p_numbytes >= 0) {
p->idle_time = curr_time;
/*
 * No traffic and no events scheduled.
@@ -798,11 +807,11 @@ ready_event_wfq(struct dn_pipe *p, struc
 * If we are

svn commit: r200030 - stable/7/sys/vm

2009-12-02 Thread John Baldwin
Author: jhb
Date: Wed Dec  2 15:24:57 2009
New Revision: 200030
URL: http://svn.freebsd.org/changeset/base/200030

Log:
  MFC 194429:
  Add support for UMA_SLAB_KERNEL to page_free().  (While I'm here remove an
  unnecessary newline character from the end of two panic messages.)

Modified:
  stable/7/sys/vm/uma_core.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/vm/uma_core.c
==
--- stable/7/sys/vm/uma_core.c  Wed Dec  2 15:20:31 2009(r200029)
+++ stable/7/sys/vm/uma_core.c  Wed Dec  2 15:24:57 2009(r200030)
@@ -1033,8 +1033,10 @@ page_free(void *mem, int size, u_int8_t 
 
if (flags & UMA_SLAB_KMEM)
map = kmem_map;
+   else if (flags & UMA_SLAB_KERNEL)
+   map = kernel_map;
else
-   panic("UMA: page_free used with invalid flags %d\n", flags);
+   panic("UMA: page_free used with invalid flags %d", flags);
 
kmem_free(map, (vm_offset_t)mem, size);
 }
@@ -1292,7 +1294,7 @@ keg_ctor(void *mem, int size, void *udat
printf("zone %s ipers %d rsize %d size %d\n",
zone->uz_name, keg->uk_ipers, keg->uk_rsize,
keg->uk_size);
-   panic("UMA slab won't fit.\n");
+   panic("UMA slab won't fit.");
}
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200031 - stable/8/usr.bin/unifdef

2009-12-02 Thread Tony Finch
Author: fanf
Date: Wed Dec  2 15:30:53 2009
New Revision: 200031
URL: http://svn.freebsd.org/changeset/base/200031

Log:
  MFC 199813, 199817, 199842, 199867:
  
  Update unifdef to latest upstream version.

Modified:
  stable/8/usr.bin/unifdef/unifdef.1
  stable/8/usr.bin/unifdef/unifdef.c
  stable/8/usr.bin/unifdef/unifdefall.sh
Directory Properties:
  stable/8/usr.bin/unifdef/   (props changed)

Modified: stable/8/usr.bin/unifdef/unifdef.1
==
--- stable/8/usr.bin/unifdef/unifdef.1  Wed Dec  2 15:24:57 2009
(r200030)
+++ stable/8/usr.bin/unifdef/unifdef.1  Wed Dec  2 15:30:53 2009
(r200031)
@@ -1,6 +1,6 @@
 .\" Copyright (c) 1985, 1991, 1993
 .\"The Regents of the University of California.  All rights reserved.
-.\" Copyright (c) 2002 - 2005 Tony Finch .  All rights reserved.
+.\" Copyright (c) 2002 - 2009 Tony Finch .  All rights reserved.
 .\"
 .\" This code is derived from software contributed to Berkeley by
 .\" Dave Yost. It was rewritten to support ANSI C by Tony Finch.
@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" @(#)unifdef.1  8.2 (Berkeley) 4/1/94
-.\"$dotat: things/unifdef.1,v 1.51 2005/03/08 12:39:01 fanf2 Exp $
+.\"$dotat: unifdef/unifdef.1,v 1.60 2009/11/25 00:11:02 fanf2 Exp $
 .\" $FreeBSD$
 .\"
 .Dd September 24, 2002
@@ -41,7 +41,7 @@
 .Nd remove preprocessor conditionals from code
 .Sh SYNOPSIS
 .Nm
-.Op Fl cdeklnst
+.Op Fl BbcdeKknst
 .Op Fl I Ns Ar path
 .Op Fl D Ns Ar sym Ns Op = Ns Ar val
 .Op Fl U Ns Ar sym
@@ -70,46 +70,85 @@ utility acts on
 .Ic #if , #ifdef , #ifndef , #elif , #else ,
 and
 .Ic #endif
-lines,
-and it understands only the commonly-used subset
+lines.
+A directive is only processed
+if the symbols specified on the command line are sufficient to allow
+.Nm
+to get a definite value for its control expression.
+If the result is false,
+the directive and the following lines under its control are removed.
+If the result is true,
+only the directive is removed.
+An
+.Ic #ifdef
+or
+.Ic #ifndef
+directive is passed through unchanged
+if its controlling symbol is not specified on the command line.
+Any
+.Ic #if
+or
+.Ic #elif
+control expression that has an unknown value or that
+.Nm
+cannot parse is passed through unchanged.
+By default,
+.Nm
+ignores
+.Ic #if
+and
+.Ic #elif
+lines with constant expressions;
+it can be told to process them by specifying the
+.Fl k
+flag on the command line.
+.Pp
+It understands a commonly-used subset
 of the expression syntax for
 .Ic #if
 and
 .Ic #elif
-lines.
-It handles
+lines:
+integer constants,
 integer values of symbols defined on the command line,
 the
 .Fn defined
-operator applied to symbols defined or undefined on the command line,
+operator,
 the operators
 .Ic \&! , < , > , <= , >= , == , != , && , || ,
 and parenthesized expressions.
-Anything that it does not understand is passed through unharmed.
-It only processes
-.Ic #ifdef
-and
-.Ic #ifndef
-directives if the symbol is specified on the command line,
-otherwise they are also passed through unchanged.
-By default, it ignores
-.Ic #if
-and
-.Ic #elif
-lines with constant expressions,
-or they may be processed by specifying the
-.Fl k
-flag on the command line.
+A kind of
+.Dq "short circuit"
+evaluation is used for the
+.Ic &&
+operator:
+if either operand is definitely false then the result is false,
+even if the value of the other operand is unknown.
+Similarly,
+if either operand of
+.Ic ||
+is definitely true then the result is true.
+.Pp
+In most cases, the
+.Nm
+utility does not distinguish between object-like macros
+(without arguments) and function-like arguments (with arguments).
+If a macro is not explicitly defined, or is defined with the
+.Fl D
+flag on the command-line, its arguments are ignored.
+If a macro is explicitly undefined on the command line with the
+.Fl U
+flag, it may not have any arguments since this leads to a syntax error.
 .Pp
 The
 .Nm
-utility also understands just enough about C
+utility understands just enough about C
 to know when one of the directives is inactive
 because it is inside
 a comment,
 or affected by a backslash-continued line.
 It spots unusually-formatted preprocessor directives
-and knows when the layout is too odd to handle.
+and knows when the layout is too odd for it to handle.
 .Pp
 A script called
 .Nm unifdefall
@@ -125,8 +164,7 @@ and their definitions (or lack thereof),
 then invokes
 .Nm
 with appropriate arguments to process the file.
-.Pp
-Available options:
+.Sh OPTIONS
 .Pp
 .Bl -tag -width indent -compact
 .It Fl D Ns Ar sym Ns Op = Ns Ar val
@@ -143,6 +181,19 @@ Specify that a symbol is undefined.
 If the same symbol appears in more than one argument,
 the last occurrence dominates.
 .Pp
+.It Fl B
+Compress blank lines around a deleted section.
+Mutually exclusive with the
+.Fl b
+option.
+.Pp
+.It Fl b
+Replace removed lines with blank lines
+instead of deleting them.
+Mutually exclusive with the

Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ

2009-12-02 Thread Sean C. Farley

On Tue, 1 Dec 2009, M. Warner Losh wrote:


In message: 
   Robert Watson  writes:
: On Mon, 30 Nov 2009, Colin Percival wrote:
:
: > Brian Feldman wrote:
: >>   Do not gratuitously fail *env(3) operations due to corrupt ('='-less)
: >>   **environ entries.  This puts non-getenv(3) operations in line with
: >>   getenv(3) in that bad environ entries do not cause all operations to
: >>   fail.  There is still some inconsistency in that getenv(3) in the
: >>   absence of any environment-modifying operation does not emit corrupt
: >>   environ entry warnings.
: >>
: >>   I also fixed another inconsistency in getenv(3) where updating the
: >>   global environ pointer would not be reflected in the return values.
: >>   It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3)
: >>   in order to see the change.
: >
: > The FreeBSD Security Team is currently dealing with a security 
: > issue relating to this code.  Please back out your change (at 
: > least to getenv.c; I don't particularly care about the regression 
: > tests) until we've finished, and then submit the patch to us for 
: > review along with a detailed explanation of what it does.

: >
: > We've already had two major security issues arising out of 
: > getenv.c in the past year, and I'd like to make sure we don't have 
: > a third.

:
: I think it's fair to say that the POSIXization of the environment 
: code has been an unmitigated disaster, and speaks to the necessity 
: for careful review of those sorts of code changes.


Why we're not just reverting the whole thing as a bad idea is beyond 
me.  Clearly the tiny incremental benefits have been far overshadowed 
by this fiasco.


Which "whole thing"?  The code or the POSIX-compliance?  Technically, it 
is not pure compliance because the code has a few BSD requirements in it 
such as keeping old name=value entries even when new ones are created.


It was my fault for not checking how unsetenv() was used in all of base. 
The change to use unsetenv() in rtld.c was committed just prior to my 
change which introduced a version of unsetenv() that returned an int to 
allow checking.


I am testing a change to have unsetenv() not stop in its attempt to 
unset a variable which should mimic the old behavior.


One difference between our man page and IEEE Std 1003.1-2008 is the part 
concerning that the "environment shall be unchanged" which I will 
introduce to the man page:


Upon successful completion, zero shall be returned. Otherwise, -1
shall be returned, errno set to indicate the error, and the
environment shall be unchanged.

After my change, unsetenv() will not return an error if environ is 
corrupt.  It will wipe the variable.  The only time errors will be 
returned are when the name passed to unsetenv() is invalid or when 
memory allocation fails.


One question is whether the code should abort() when it detects a 
corrupt environ array or do its best to complete the request from the 
caller.


Sean
--
s...@freebsd.org
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200032 - stable/7/usr.bin/unifdef

2009-12-02 Thread Tony Finch
Author: fanf
Date: Wed Dec  2 15:34:13 2009
New Revision: 200032
URL: http://svn.freebsd.org/changeset/base/200032

Log:
  MFC 199813, 199817, 199842, 199867:
  
  Update unifdef to latest upstream version.

Modified:
  stable/7/usr.bin/unifdef/unifdef.1
  stable/7/usr.bin/unifdef/unifdef.c
  stable/7/usr.bin/unifdef/unifdefall.sh
Directory Properties:
  stable/7/usr.bin/unifdef/   (props changed)

Modified: stable/7/usr.bin/unifdef/unifdef.1
==
--- stable/7/usr.bin/unifdef/unifdef.1  Wed Dec  2 15:30:53 2009
(r200031)
+++ stable/7/usr.bin/unifdef/unifdef.1  Wed Dec  2 15:34:13 2009
(r200032)
@@ -1,6 +1,6 @@
 .\" Copyright (c) 1985, 1991, 1993
 .\"The Regents of the University of California.  All rights reserved.
-.\" Copyright (c) 2002 - 2005 Tony Finch .  All rights reserved.
+.\" Copyright (c) 2002 - 2009 Tony Finch .  All rights reserved.
 .\"
 .\" This code is derived from software contributed to Berkeley by
 .\" Dave Yost. It was rewritten to support ANSI C by Tony Finch.
@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" @(#)unifdef.1  8.2 (Berkeley) 4/1/94
-.\"$dotat: things/unifdef.1,v 1.51 2005/03/08 12:39:01 fanf2 Exp $
+.\"$dotat: unifdef/unifdef.1,v 1.60 2009/11/25 00:11:02 fanf2 Exp $
 .\" $FreeBSD$
 .\"
 .Dd September 24, 2002
@@ -41,7 +41,7 @@
 .Nd remove preprocessor conditionals from code
 .Sh SYNOPSIS
 .Nm
-.Op Fl cdeklnst
+.Op Fl BbcdeKknst
 .Op Fl I Ns Ar path
 .Op Fl D Ns Ar sym Ns Op = Ns Ar val
 .Op Fl U Ns Ar sym
@@ -70,46 +70,85 @@ utility acts on
 .Ic #if , #ifdef , #ifndef , #elif , #else ,
 and
 .Ic #endif
-lines,
-and it understands only the commonly-used subset
+lines.
+A directive is only processed
+if the symbols specified on the command line are sufficient to allow
+.Nm
+to get a definite value for its control expression.
+If the result is false,
+the directive and the following lines under its control are removed.
+If the result is true,
+only the directive is removed.
+An
+.Ic #ifdef
+or
+.Ic #ifndef
+directive is passed through unchanged
+if its controlling symbol is not specified on the command line.
+Any
+.Ic #if
+or
+.Ic #elif
+control expression that has an unknown value or that
+.Nm
+cannot parse is passed through unchanged.
+By default,
+.Nm
+ignores
+.Ic #if
+and
+.Ic #elif
+lines with constant expressions;
+it can be told to process them by specifying the
+.Fl k
+flag on the command line.
+.Pp
+It understands a commonly-used subset
 of the expression syntax for
 .Ic #if
 and
 .Ic #elif
-lines.
-It handles
+lines:
+integer constants,
 integer values of symbols defined on the command line,
 the
 .Fn defined
-operator applied to symbols defined or undefined on the command line,
+operator,
 the operators
 .Ic \&! , < , > , <= , >= , == , != , && , || ,
 and parenthesized expressions.
-Anything that it does not understand is passed through unharmed.
-It only processes
-.Ic #ifdef
-and
-.Ic #ifndef
-directives if the symbol is specified on the command line,
-otherwise they are also passed through unchanged.
-By default, it ignores
-.Ic #if
-and
-.Ic #elif
-lines with constant expressions,
-or they may be processed by specifying the
-.Fl k
-flag on the command line.
+A kind of
+.Dq "short circuit"
+evaluation is used for the
+.Ic &&
+operator:
+if either operand is definitely false then the result is false,
+even if the value of the other operand is unknown.
+Similarly,
+if either operand of
+.Ic ||
+is definitely true then the result is true.
+.Pp
+In most cases, the
+.Nm
+utility does not distinguish between object-like macros
+(without arguments) and function-like arguments (with arguments).
+If a macro is not explicitly defined, or is defined with the
+.Fl D
+flag on the command-line, its arguments are ignored.
+If a macro is explicitly undefined on the command line with the
+.Fl U
+flag, it may not have any arguments since this leads to a syntax error.
 .Pp
 The
 .Nm
-utility also understands just enough about C
+utility understands just enough about C
 to know when one of the directives is inactive
 because it is inside
 a comment,
 or affected by a backslash-continued line.
 It spots unusually-formatted preprocessor directives
-and knows when the layout is too odd to handle.
+and knows when the layout is too odd for it to handle.
 .Pp
 A script called
 .Nm unifdefall
@@ -125,8 +164,7 @@ and their definitions (or lack thereof),
 then invokes
 .Nm
 with appropriate arguments to process the file.
-.Pp
-Available options:
+.Sh OPTIONS
 .Pp
 .Bl -tag -width indent -compact
 .It Fl D Ns Ar sym Ns Op = Ns Ar val
@@ -143,6 +181,19 @@ Specify that a symbol is undefined.
 If the same symbol appears in more than one argument,
 the last occurrence dominates.
 .Pp
+.It Fl B
+Compress blank lines around a deleted section.
+Mutually exclusive with the
+.Fl b
+option.
+.Pp
+.It Fl b
+Replace removed lines with blank lines
+instead of deleting them.
+Mutually exclusive with the

Re: svn commit: r200030 - stable/7/sys/vm

2009-12-02 Thread John Baldwin
On Wednesday 02 December 2009 10:24:57 am John Baldwin wrote:
> Author: jhb
> Date: Wed Dec  2 15:24:57 2009
> New Revision: 200030
> URL: http://svn.freebsd.org/changeset/base/200030
> 
> Log:
>   MFC 194429:
>   Add support for UMA_SLAB_KERNEL to page_free().  (While I'm here remove an
>   unnecessary newline character from the end of two panic messages.)

This fixes "UMA free:" panics when draining zones during a memory shortage 
after the MFC of 194454 and 195385 in change 196838.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200033 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include

2009-12-02 Thread Andriy Gapon
Author: avg
Date: Wed Dec  2 15:45:55 2009
New Revision: 200033
URL: http://svn.freebsd.org/changeset/base/200033

Log:
  mca: improve status checking, recording and reporting
  
  - directly print mca information in case we fail to allocate memory
for a record
  - include bank number into mca record
  - print raw mca status value for extended information
  
  Reviewed by:  jhb
  MFC after:10 days

Modified:
  head/sys/amd64/amd64/mca.c
  head/sys/amd64/include/mca.h
  head/sys/i386/i386/mca.c
  head/sys/i386/include/mca.h

Modified: head/sys/amd64/amd64/mca.c
==
--- head/sys/amd64/amd64/mca.c  Wed Dec  2 15:34:13 2009(r200032)
+++ head/sys/amd64/amd64/mca.c  Wed Dec  2 15:45:55 2009(r200033)
@@ -117,48 +117,6 @@ sysctl_mca_records(SYSCTL_HANDLER_ARGS)
return (SYSCTL_OUT(req, &record, sizeof(record)));
 }
 
-static struct mca_record *
-mca_record_entry(int bank)
-{
-   struct mca_internal *rec;
-   uint64_t status;
-   u_int p[4];
-
-   status = rdmsr(MSR_MC_STATUS(bank));
-   if (!(status & MC_STATUS_VAL))
-   return (NULL);
-
-   rec = malloc(sizeof(*rec), M_MCA, M_NOWAIT | M_ZERO);
-   if (rec == NULL) {
-   printf("MCA: Unable to allocate space for an event.\n");
-   return (NULL);
-   }
-
-   /* Save exception information. */
-   rec->rec.mr_status = status;
-   if (status & MC_STATUS_ADDRV)
-   rec->rec.mr_addr = rdmsr(MSR_MC_ADDR(bank));
-   if (status & MC_STATUS_MISCV)
-   rec->rec.mr_misc = rdmsr(MSR_MC_MISC(bank));
-   rec->rec.mr_tsc = rdtsc();
-   rec->rec.mr_apic_id = PCPU_GET(apic_id);
-
-   /*
-* Clear machine check.  Don't do this for uncorrectable
-* errors so that the BIOS can see them.
-*/
-   if (!(rec->rec.mr_status & (MC_STATUS_PCC | MC_STATUS_UC))) {
-   wrmsr(MSR_MC_STATUS(bank), 0);
-   do_cpuid(0, p);
-   }
-
-   mtx_lock_spin(&mca_lock);
-   STAILQ_INSERT_TAIL(&mca_records, rec, link);
-   mca_count++;
-   mtx_unlock_spin(&mca_lock);
-   return (&rec->rec);
-}
-
 static const char *
 mca_error_ttype(uint16_t mca_error)
 {
@@ -219,11 +177,13 @@ mca_error_request(uint16_t mca_error)
 }
 
 /* Dump details about a single machine check. */
-static void
-mca_log(struct mca_record *rec)
+static void __nonnull(1)
+mca_log(const struct mca_record *rec)
 {
uint16_t mca_error;
 
+   printf("MCA: bank %d, status 0x%016llx\n", rec->mr_bank,
+   (long long)rec->mr_status);
printf("MCA: CPU %d ", rec->mr_apic_id);
if (rec->mr_status & MC_STATUS_UC)
printf("UNCOR ");
@@ -329,6 +289,59 @@ mca_log(struct mca_record *rec)
printf("MCA: Address 0x%llx\n", (long long)rec->mr_addr);
 }
 
+static int __nonnull(2)
+mca_check_status(int bank, struct mca_record *rec)
+{
+   uint64_t status;
+   u_int p[4];
+
+   status = rdmsr(MSR_MC_STATUS(bank));
+   if (!(status & MC_STATUS_VAL))
+   return (0);
+
+   /* Save exception information. */
+   rec->mr_status = status;
+   rec->mr_bank = bank;
+   rec->mr_addr = 0;
+   if (status & MC_STATUS_ADDRV)
+   rec->mr_addr = rdmsr(MSR_MC_ADDR(bank));
+   rec->mr_misc = 0;
+   if (status & MC_STATUS_MISCV)
+   rec->mr_misc = rdmsr(MSR_MC_MISC(bank));
+   rec->mr_tsc = rdtsc();
+   rec->mr_apic_id = PCPU_GET(apic_id);
+
+   /*
+* Clear machine check.  Don't do this for uncorrectable
+* errors so that the BIOS can see them.
+*/
+   if (!(rec->mr_status & (MC_STATUS_PCC | MC_STATUS_UC))) {
+   wrmsr(MSR_MC_STATUS(bank), 0);
+   do_cpuid(0, p);
+   }
+   return (1);
+}
+
+static void __nonnull(1)
+mca_record_entry(const struct mca_record *record)
+{
+   struct mca_internal *rec;
+
+   rec = malloc(sizeof(*rec), M_MCA, M_NOWAIT);
+   if (rec == NULL) {
+   printf("MCA: Unable to allocate space for an event.\n");
+   mca_log(record);
+   return;
+   }
+
+   rec->rec = *record;
+   rec->logged = 0;
+   mtx_lock_spin(&mca_lock);
+   STAILQ_INSERT_TAIL(&mca_records, rec, link);
+   mca_count++;
+   mtx_unlock_spin(&mca_lock);
+}
+
 /*
  * This scans all the machine check banks of the current CPU to see if
  * there are any machine checks.  Any non-recoverable errors are
@@ -341,7 +354,7 @@ mca_log(struct mca_record *rec)
 static int
 mca_scan(int mcip)
 {
-   struct mca_record *rec;
+   struct mca_record rec;
uint64_t mcg_cap, ucmask;
int count, i, recoverable;
 
@@ -354,13 +367,13 @@ mca_scan(int mcip)
ucmask |= MC_STATUS_OVER;
mcg_cap = rdmsr(MSR_MCG_CAP);
for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) {
-   rec = mca

svn commit: r200034 - head/sys/netinet

2009-12-02 Thread Luigi Rizzo
Author: luigi
Date: Wed Dec  2 15:50:43 2009
New Revision: 200034
URL: http://svn.freebsd.org/changeset/base/200034

Log:
  Dispatch sockopt calls to ipfw and dummynet
  using the new option numbers, IP_FW3 and IP_DUMMYNET3.
  Right now the modules return an error if called with those arguments
  so there is no danger of unwanted behaviour.
  
  MFC after:3 days

Modified:
  head/sys/netinet/raw_ip.c

Modified: head/sys/netinet/raw_ip.c
==
--- head/sys/netinet/raw_ip.c   Wed Dec  2 15:45:55 2009(r200033)
+++ head/sys/netinet/raw_ip.c   Wed Dec  2 15:50:43 2009(r200034)
@@ -535,6 +535,7 @@ rip_ctloutput(struct socket *so, struct 
error = sooptcopyout(sopt, &optval, sizeof optval);
break;
 
+   case IP_FW3:/* generic ipfw v.3 functions */
case IP_FW_ADD: /* ADD actually returns the body... */
case IP_FW_GET:
case IP_FW_TABLE_GETSIZE:
@@ -547,6 +548,7 @@ rip_ctloutput(struct socket *so, struct 
error = ENOPROTOOPT;
break;
 
+   case IP_DUMMYNET3:  /* generic dummynet v.3 functions */
case IP_DUMMYNET_GET:
if (ip_dn_ctl_ptr != NULL)
error = ip_dn_ctl_ptr(sopt);
@@ -592,6 +594,7 @@ rip_ctloutput(struct socket *so, struct 
inp->inp_flags &= ~INP_HDRINCL;
break;
 
+   case IP_FW3:/* generic ipfw v.3 functions */
case IP_FW_ADD:
case IP_FW_DEL:
case IP_FW_FLUSH:
@@ -608,6 +611,7 @@ rip_ctloutput(struct socket *so, struct 
error = ENOPROTOOPT;
break;
 
+   case IP_DUMMYNET3:  /* generic dummynet v.3 functions */
case IP_DUMMYNET_CONFIGURE:
case IP_DUMMYNET_DEL:
case IP_DUMMYNET_FLUSH:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200035 - head/lib/libutil

2009-12-02 Thread Ed Schouten
Author: ed
Date: Wed Dec  2 15:56:18 2009
New Revision: 200035
URL: http://svn.freebsd.org/changeset/base/200035

Log:
  Make  work when included by itself.
  
  There are several reasons why it didn't work:
  
  - It was missing  for __BEGIN_DECLS.
  - It uses various primitive types that were not declared.

Modified:
  head/lib/libutil/libutil.h

Modified: head/lib/libutil/libutil.h
==
--- head/lib/libutil/libutil.h  Wed Dec  2 15:50:43 2009(r200034)
+++ head/lib/libutil/libutil.h  Wed Dec  2 15:56:18 2009(r200035)
@@ -39,6 +39,34 @@
 #ifndef _LIBUTIL_H_
 #define_LIBUTIL_H_
 
+#include 
+#include 
+
+#ifndef _GID_T_DECLARED
+typedef__gid_t gid_t;
+#define_GID_T_DECLARED
+#endif
+
+#ifndef _INT64_T_DECLARED
+typedef__int64_t   int64_t;
+#define_INT64_T_DECLARED
+#endif
+
+#ifndef _PID_T_DECLARED
+typedef__pid_t pid_t;
+#define_PID_T_DECLARED
+#endif
+
+#ifndef _SIZE_T_DECLARED
+typedef__size_tsize_t;
+#define_SIZE_T_DECLARED
+#endif
+
+#ifndef _UID_T_DECLARED
+typedef__uid_t uid_t;
+#define_UID_T_DECLARED
+#endif
+
 #define PROPERTY_MAX_NAME  64
 #define PROPERTY_MAX_VALUE 512
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200036 - head/sys/cam/scsi

2009-12-02 Thread Scott Long
Author: scottl
Date: Wed Dec  2 16:08:33 2009
New Revision: 200036
URL: http://svn.freebsd.org/changeset/base/200036

Log:
  Fix several cases where the periph lock was held over malloc.
  
  Submitted by: Jaakko Heinonen

Modified:
  head/sys/cam/scsi/scsi_cd.c

Modified: head/sys/cam/scsi/scsi_cd.c
==
--- head/sys/cam/scsi/scsi_cd.c Wed Dec  2 15:56:18 2009(r200035)
+++ head/sys/cam/scsi/scsi_cd.c Wed Dec  2 16:08:33 2009(r200036)
@@ -2673,12 +2673,10 @@ cdioctl(struct disk *dp, u_long cmd, voi
 
authinfo = (struct dvd_authinfo *)addr;
 
-   cam_periph_lock(periph);
if (cmd == DVDIOCREPORTKEY)
error = cdreportkey(periph, authinfo);
else
error = cdsendkey(periph, authinfo);
-   cam_periph_unlock(periph);
break;
}
case DVDIOCREADSTRUCTURE: {
@@ -2686,9 +2684,7 @@ cdioctl(struct disk *dp, u_long cmd, voi
 
dvdstruct = (struct dvd_struct *)addr;
 
-   cam_periph_lock(periph);
error = cdreaddvdstructure(periph, dvdstruct);
-   cam_periph_unlock(periph);
 
break;
}
@@ -3732,8 +3728,6 @@ cdreportkey(struct cam_periph *periph, s
databuf = NULL;
lba = 0;
 
-   ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL);
-
switch (authinfo->format) {
case DVD_REPORT_AGID:
length = sizeof(struct scsi_report_key_data_agid);
@@ -3759,9 +3753,7 @@ cdreportkey(struct cam_periph *periph, s
length = 0;
break;
default:
-   error = EINVAL;
-   goto bailout;
-   break; /* NOTREACHED */
+   return (EINVAL);
}
 
if (length != 0) {
@@ -3769,6 +3761,8 @@ cdreportkey(struct cam_periph *periph, s
} else
databuf = NULL;
 
+   cam_periph_lock(periph);
+   ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL);
 
scsi_report_key(&ccb->csio,
/* retries */ 1,
@@ -3869,12 +3863,14 @@ cdreportkey(struct cam_periph *periph, s
goto bailout;
break; /* NOTREACHED */
}
+
 bailout:
+   xpt_release_ccb(ccb);
+   cam_periph_unlock(periph);
+
if (databuf != NULL)
free(databuf, M_DEVBUF);
 
-   xpt_release_ccb(ccb);
-
return(error);
 }
 
@@ -3889,8 +3885,6 @@ cdsendkey(struct cam_periph *periph, str
error = 0;
databuf = NULL;
 
-   ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL);
-
switch(authinfo->format) {
case DVD_SEND_CHALLENGE: {
struct scsi_report_key_data_challenge *challenge_data;
@@ -3942,11 +3936,12 @@ cdsendkey(struct cam_periph *periph, str
break;
}
default:
-   error = EINVAL;
-   goto bailout;
-   break; /* NOTREACHED */
+   return (EINVAL);
}
 
+   cam_periph_lock(periph);
+   ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL);
+
scsi_send_key(&ccb->csio,
  /* retries */ 1,
  /* cbfcnp */ cddone,
@@ -3961,13 +3956,12 @@ cdsendkey(struct cam_periph *periph, str
error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO,
 /*sense_flags*/SF_RETRY_UA);
 
-bailout:
+   xpt_release_ccb(ccb);
+   cam_periph_unlock(periph);
 
if (databuf != NULL)
free(databuf, M_DEVBUF);
 
-   xpt_release_ccb(ccb);
-
return(error);
 }
 
@@ -3985,8 +3979,6 @@ cdreaddvdstructure(struct cam_periph *pe
/* The address is reserved for many of the formats */
address = 0;
 
-   ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL);
-
switch(dvdstruct->format) {
case DVD_STRUCT_PHYSICAL:
length = sizeof(struct scsi_read_dvd_struct_data_physical);
@@ -4004,13 +3996,7 @@ cdreaddvdstructure(struct cam_periph *pe
length = sizeof(struct scsi_read_dvd_struct_data_manufacturer);
break;
case DVD_STRUCT_CMI:
-   error = ENODEV;
-   goto bailout;
-#ifdef notyet
-   length = sizeof(struct scsi_read_dvd_struct_data_copy_manage);
-   address = dvdstruct->address;
-#endif
-   break; /* NOTREACHED */
+   return (ENODEV);
case DVD_STRUCT_PROTDISCID:
length = sizeof(struct scsi_read_dvd_struct_data_prot_discid);
break;
@@ -4027,21 +4013,9 @@ cdreaddvdstructure(struct cam_periph *pe
length = sizeof(struct scsi_read_dvd_struct_data_spare_area);
break;
case DVD_STRUCT_RMD_LAST:
-   error = ENODEV;
-   goto bailout;
-#ifdef notyet
-   length = sizeof(struct scsi_read

Re: svn commit: r199827 - in head: include lib/libc/compat-43 sys/sys

2009-12-02 Thread M. Warner Losh
In message: <20091202132904.gh2...@deviant.kiev.zoral.com.ua>
Kostik Belousov  writes:
: On Wed, Dec 02, 2009 at 07:25:56PM +1000, Dima Panov wrote:
: > On Thursday 26 November 2009 23:49:38 Konstantin Belousov wrote:
: > > Author: kib
: > > Date: Thu Nov 26 13:49:37 2009
: > > New Revision: 199827
: > > URL: http://svn.freebsd.org/changeset/base/199827
: > > 
: > > Log:
: > >   Implement sighold, sigignore, sigpause, sigrelse, sigset functions
: > >   from SUSv4 XSI. Note that the functions are obsoleted, and only
: > >   provided to ease porting from System V-like systems. Since sigpause
: > >   already exists in compat with different interface, XSI sigpause is
: > >   named xsi_sigpause.
: > > 
: > >   Reviewed by:davidxu
: > >   MFC after:  3 weeks
: > > 
: > > Modified:
: > >   head/include/signal.h
: > >   head/lib/libc/compat-43/Makefile.inc
: > >   head/lib/libc/compat-43/Symbol.map
: > >   head/lib/libc/compat-43/sigcompat.c
: > >   head/lib/libc/compat-43/sigpause.2
: > >   head/sys/sys/signal.h
: > >   head/sys/sys/signalvar.h
: > 
: > kib, you forgot about osversion bump, it is strongly needed.
: No. My interpretation of __FreeBSD_version is that the bump indicates
: incompatible change in the interfaces. Sometime it is used to mark the
: point where big changes hit the tree, possibly not related to interface
: change.
: 
: Also, __FreeBSD_version denotes the kernel "version". We do support
: running earlier usermode on the later kernels. Think about kernel-only
: upgrades, compatXx libs and jails which can run arbitrary earlier
: usermode. (The change in question is purely libc).
: 
: Said this, I think it is actually harmful practice to bump
: __FreeBSD_version after API additions or feature implementation.
: 
: I can bump version for this case, but due to the above reason,
: it would not make much sense.

In the past, __FreeBSD_version has been used to expose changes in
interfaces (both plus, minus and delta) that are necessary for the
entire system.  Adding an interface definitely qualifies because this
is a build-time issue, not a run time one.

Unfortunately, __FreeBSD_version has also been used to force kernel
recompiles lately since it is encoded in the kernel modules.  Despite
this, it isn't just for kernels...

Warner

: > This changeset caused jdk (may be not only jdk) breakage, as jdk-bsd-patches
: > always provide own implementations of sigingnore() for FreeBSD.
: > 
: > Patch for jdk16 port will be ready soon.
: 
: Ok, thanks for working on this.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200037 - head/sys/dev/if_ndis

2009-12-02 Thread John Baldwin
Author: jhb
Date: Wed Dec  2 16:26:18 2009
New Revision: 200037
URL: http://svn.freebsd.org/changeset/base/200037

Log:
  ndis_scan_results() can sleep if the scan results are not ready when
  ndis_scan() is called.  However, ndis_scan() is invoked from softclock()
  and cannot sleep.  Move ndis_scan_results() to the ndis' driver's scan_end
  hook instead.
  
  Submitted by: Paul B Mahol  onemda of gmail
  MFC after:1 week

Modified:
  head/sys/dev/if_ndis/if_ndis.c

Modified: head/sys/dev/if_ndis/if_ndis.c
==
--- head/sys/dev/if_ndis/if_ndis.c  Wed Dec  2 16:08:33 2009
(r200036)
+++ head/sys/dev/if_ndis/if_ndis.c  Wed Dec  2 16:26:18 2009
(r200037)
@@ -3222,14 +3222,8 @@ ndis_newstate(struct ieee80211vap *vap, 
 static void
 ndis_scan(void *arg)
 {
-   struct ndis_softc *sc = arg;
-   struct ieee80211com *ic;
-   struct ieee80211vap *vap;
-
-   ic = sc->ifp->if_l2com;
-   vap = TAILQ_FIRST(&ic->ic_vaps);
+   struct ieee80211vap *vap = arg;
 
-   ndis_scan_results(sc);
ieee80211_scan_done(vap);
 }
 
@@ -3377,7 +3371,7 @@ ndis_scan_start(struct ieee80211com *ic)
return;
}
/* Set a timer to collect the results */
-   callout_reset(&sc->ndis_scan_callout, hz * 3, ndis_scan, sc);
+   callout_reset(&sc->ndis_scan_callout, hz * 3, ndis_scan, vap);
 }
 
 static void
@@ -3401,5 +3395,7 @@ ndis_scan_mindwell(struct ieee80211_scan
 static void
 ndis_scan_end(struct ieee80211com *ic)
 {
-   /* ignore */
+   struct ndis_softc *sc = ic->ic_ifp->if_softc;
+
+   ndis_scan_results(sc);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200038 - in head: contrib/gcc/config lib/csu/amd64 lib/csu/arm lib/csu/i386-elf lib/csu/ia64 lib/csu/mips lib/csu/powerpc lib/csu/sparc64

2009-12-02 Thread Konstantin Belousov
Author: kib
Date: Wed Dec  2 16:34:20 2009
New Revision: 200038
URL: http://svn.freebsd.org/changeset/base/200038

Log:
  Properly support -fPIE by linking PIE binaries with specially-built
  Scrt1.o instead of crt1.o, since the later is built as non-PIC.
  
  Separate i386-elf crt1.c into the pure assembler part and C code,
  supplying all data extracted by assembler stub as explicit parameters [1].
  Hide and localize _start1 symbol used as an interface between asm and
  C code.
  
  In collaboration with:kan
  Inspired by:  PR i386/127387 [1]
  Prodded and tested by:rdivacky [1]
  MFC after:3 weeks

Added:
  head/lib/csu/i386-elf/crt1_c.c
 - copied, changed from r200027, head/lib/csu/i386-elf/crt1.c
  head/lib/csu/i386-elf/crt1_s.S   (contents, props changed)
Deleted:
  head/lib/csu/i386-elf/crt1.c
Modified:
  head/contrib/gcc/config/freebsd-spec.h
  head/lib/csu/amd64/Makefile
  head/lib/csu/arm/Makefile
  head/lib/csu/i386-elf/Makefile
  head/lib/csu/ia64/Makefile
  head/lib/csu/mips/Makefile
  head/lib/csu/powerpc/Makefile
  head/lib/csu/sparc64/Makefile

Modified: head/contrib/gcc/config/freebsd-spec.h
==
--- head/contrib/gcc/config/freebsd-spec.h  Wed Dec  2 16:26:18 2009
(r200037)
+++ head/contrib/gcc/config/freebsd-spec.h  Wed Dec  2 16:34:20 2009
(r200038)
@@ -103,9 +103,10 @@ Boston, MA 02110-1301, USA.  */
   %{p:gcrt1.o%s} \
   %{!p: \
%{profile:gcrt1.o%s} \
-   %{!profile:crt1.o%s \
+   %{!profile: \
+  %{pie: Scrt1.o%s;:crt1.o%s} \
   crti.o%s \
-  %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+  %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
 
 /* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386.  Here we tack on
our own magical crtend.o file (see crtstuff.c) which provides part of
@@ -113,8 +114,7 @@ Boston, MA 02110-1301, USA.  */
entering `main', followed by the normal "finalizer" file, `crtn.o'.  */
 
 #define FBSD_ENDFILE_SPEC "\
-  %{!shared:crtend.o%s} \
-  %{shared:crtendS.o%s} \
+  %{shared|pie:crtendS.o%s;:crtend.o%s} \
   crtn.o%s "
 
 /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as

Modified: head/lib/csu/amd64/Makefile
==
--- head/lib/csu/amd64/Makefile Wed Dec  2 16:26:18 2009(r200037)
+++ head/lib/csu/amd64/Makefile Wed Dec  2 16:34:20 2009(r200038)
@@ -4,7 +4,7 @@
 
 SRCS=  crt1.c crti.S crtn.S
 OBJS=  ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= gcrt1.o
+OBJS+= Scrt1.o gcrt1.o
 CFLAGS+=   -I${.CURDIR}/../common \
-I${.CURDIR}/../../libc/include
 CFLAGS+=   -fno-omit-frame-pointer
@@ -16,6 +16,9 @@ CLEANFILES=   ${OBJS}
 gcrt1.o: crt1.c
${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c
 
+Scrt1.o: crt1.c
+   ${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1.o ${.CURDIR}/crt1.c
+
 realinstall:
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${OBJS} ${DESTDIR}${LIBDIR}

Modified: head/lib/csu/arm/Makefile
==
--- head/lib/csu/arm/Makefile   Wed Dec  2 16:26:18 2009(r200037)
+++ head/lib/csu/arm/Makefile   Wed Dec  2 16:34:20 2009(r200038)
@@ -4,7 +4,7 @@
 
 SRCS=  crt1.c crti.S crtn.S
 OBJS=  ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= gcrt1.o
+OBJS+= Scrt1.o gcrt1.o
 CFLAGS+=   -Wall -Wno-unused \
-I${.CURDIR}/../common \
-I${.CURDIR}/../../libc/include
@@ -16,6 +16,9 @@ CLEANFILES=   ${OBJS}
 gcrt1.o: crt1.c
${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC}
 
+Scrt1.o: crt1.c
+   ${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1.o ${.ALLSRC}
+
 realinstall:
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${OBJS} ${DESTDIR}${LIBDIR}

Modified: head/lib/csu/i386-elf/Makefile
==
--- head/lib/csu/i386-elf/Makefile  Wed Dec  2 16:26:18 2009
(r200037)
+++ head/lib/csu/i386-elf/Makefile  Wed Dec  2 16:34:20 2009
(r200038)
@@ -2,8 +2,8 @@
 
 .PATH: ${.CURDIR}/../common
 
-SRCS=  crt1.c crti.S crtn.S
-FILES= ${SRCS:N*.h:R:S/$/.o/g} gcrt1.o
+SRCS=  crti.S crtn.S
+FILES= ${SRCS:N*.h:R:S/$/.o/g} gcrt1.o crt1.o Scrt1.o
 FILESOWN=  ${LIBOWN}
 FILESGRP=  ${LIBGRP}
 FILESMODE= ${LIBMODE}
@@ -11,9 +11,23 @@ FILESDIR=${LIBDIR}
 WARNS?=6
 CFLAGS+=   -I${.CURDIR}/../common \
-I${.CURDIR}/../../libc/include
-CLEANFILES=${FILES}
+CLEANFILES=${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
 
-gcrt1.o: crt1.c
-   ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c
+gcrt1_c.o: crt1_c.c
+   ${CC} ${CFLAGS} -DGCRT -c -o gcrt1_c.o ${.CURDIR}/crt1_c.c

svn commit: r200039 - head/sys/sys

2009-12-02 Thread Konstantin Belousov
Author: kib
Date: Wed Dec  2 16:40:23 2009
New Revision: 200039
URL: http://svn.freebsd.org/changeset/base/200039

Log:
  Bump __FreeBSD_version for sigpause(3) addition [1] and
  PIE support in csu.
  
  Requested by: fluffy [1]

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hWed Dec  2 16:34:20 2009(r200038)
+++ head/sys/sys/param.hWed Dec  2 16:40:23 2009(r200039)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 92   /* Master, propagated to newvers */
+#define __FreeBSD_version 93   /* Master, propagated to newvers */
 
 #ifndef LOCORE
 #include 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ

2009-12-02 Thread Brian Fundakowski Feldman
On Wed, Dec 02, 2009 at 09:33:29AM -0600, Sean C. Farley wrote:
> On Tue, 1 Dec 2009, M. Warner Losh wrote:
> 
>> In message: 
>>Robert Watson  writes:
>> : On Mon, 30 Nov 2009, Colin Percival wrote:
>> :
>> : > Brian Feldman wrote:
>> : >>   Do not gratuitously fail *env(3) operations due to corrupt ('='-less)
>> : >>   **environ entries.  This puts non-getenv(3) operations in line with
>> : >>   getenv(3) in that bad environ entries do not cause all operations to
>> : >>   fail.  There is still some inconsistency in that getenv(3) in the
>> : >>   absence of any environment-modifying operation does not emit corrupt
>> : >>   environ entry warnings.
>> : >>
>> : >>   I also fixed another inconsistency in getenv(3) where updating the
>> : >>   global environ pointer would not be reflected in the return values.
>> : >>   It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3)
>> : >>   in order to see the change.
>> : >
>> : > The FreeBSD Security Team is currently dealing with a security : > 
>> issue relating to this code.  Please back out your change (at : > least to 
>> getenv.c; I don't particularly care about the regression : > tests) until 
>> we've finished, and then submit the patch to us for : > review along with 
>> a detailed explanation of what it does.
>> : >
>> : > We've already had two major security issues arising out of : > 
>> getenv.c in the past year, and I'd like to make sure we don't have : > a 
>> third.
>> :
>> : I think it's fair to say that the POSIXization of the environment : code 
>> has been an unmitigated disaster, and speaks to the necessity : for 
>> careful review of those sorts of code changes.
>> 
>> Why we're not just reverting the whole thing as a bad idea is beyond me.  
>> Clearly the tiny incremental benefits have been far overshadowed by this 
>> fiasco.
> 
> Which "whole thing"?  The code or the POSIX-compliance?  Technically, it is 
> not pure compliance because the code has a few BSD requirements in it such 
> as keeping old name=value entries even when new ones are created.
> 
> It was my fault for not checking how unsetenv() was used in all of base. 
> The change to use unsetenv() in rtld.c was committed just prior to my 
> change which introduced a version of unsetenv() that returned an int to 
> allow checking.
> 
> I am testing a change to have unsetenv() not stop in its attempt to unset a 
> variable which should mimic the old behavior.
> 
> One difference between our man page and IEEE Std 1003.1-2008 is the part 
> concerning that the "environment shall be unchanged" which I will introduce 
> to the man page:
> 
> Upon successful completion, zero shall be returned. Otherwise, -1
> shall be returned, errno set to indicate the error, and the
> environment shall be unchanged.
> 
> After my change, unsetenv() will not return an error if environ is corrupt. 
>  It will wipe the variable.  The only time errors will be returned are when 
> the name passed to unsetenv() is invalid or when memory allocation fails.
> 
> One question is whether the code should abort() when it detects a corrupt 
> environ array or do its best to complete the request from the caller.

The consensus seems to be that either of those two behaviors is okay.  I lean
more heavily toward repairing environ and moving on because it seems likely
that as often as not, *env(3) will not occur immediately after (unintentional)
environ corruption and abort() won't make debugging much easier, only make
lives harder.  Of course, we could also see what Solaris, Linux, NetBSD and
friends do...

Using abort() and assert() against data provided directly by the user
(that is, data that is not supposed to be already "owned" by the library)
is somewhat evil.  It annoys me to no end as a developer when libraries
do that (one of the guiltiest examples being libdbus.)

-- 
Brian Fundakowski Feldman   \'[ FreeBSD ]''\
  <> gr...@freebsd.org   \  The Power to Serve! \
 Opinions expressed are my own.   \,,\
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200040 - head/sys/netinet/ipfw

2009-12-02 Thread Luigi Rizzo
Author: luigi
Date: Wed Dec  2 17:50:52 2009
New Revision: 200040
URL: http://svn.freebsd.org/changeset/base/200040

Log:
  - initialize src_ip in the main loop to prevent a compiler warning
(gcc 4.x under linux, not sure how real is the complaint).
  - rename a macro argument to prevent name clashes.
  -  add the macro name on a couple of #endif
  - add a blank line for readability.
  
  MFC after:3 days

Modified:
  head/sys/netinet/ipfw/ip_fw2.c

Modified: head/sys/netinet/ipfw/ip_fw2.c
==
--- head/sys/netinet/ipfw/ip_fw2.c  Wed Dec  2 16:40:23 2009
(r200039)
+++ head/sys/netinet/ipfw/ip_fw2.c  Wed Dec  2 17:50:52 2009
(r200040)
@@ -186,6 +186,7 @@ SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, de
 &default_to_accept, 0,
 "Make the default rule accept all packets.");
 TUNABLE_INT("net.inet.ip.fw.default_to_accept", &default_to_accept);
+
 #ifdef INET6
 SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_NODE(_net_inet6_ip6, OID_AUTO, fw, CTLFLAG_RW, 0, "Firewall");
@@ -195,8 +196,9 @@ SYSCTL_VNET_PROC(_net_inet6_ip6_fw, OID_
 SYSCTL_VNET_INT(_net_inet6_ip6_fw, OID_AUTO, deny_unknown_exthdrs,
 CTLFLAG_RW | CTLFLAG_SECURE, &VNET_NAME(fw_deny_unknown_exthdrs), 0,
 "Deny packets with unknown IPv6 Extension Headers");
-#endif
-#endif
+#endif /* INET6 */
+
+#endif /* SYSCTL_NODE */
 
 /*
  * Description of dynamic rules.
@@ -2260,6 +2262,7 @@ ipfw_chk(struct ip_fw_args *args)
return (IP_FW_PASS);/* accept */
 
dst_ip.s_addr = 0;  /* make sure it is initialized */
+   src_ip.s_addr = 0;  /* make sure it is initialized */
pktlen = m->m_pkthdr.len;
args->f_id.fib = M_GETFIB(m); /* note mbuf not altered) */
proto = args->f_id.proto = 0;   /* mark f_id invalid */
@@ -2271,15 +2274,15 @@ ipfw_chk(struct ip_fw_args *args)
  * pointer might become stale after other pullups (but we never use it
  * this way).
  */
-#define PULLUP_TO(len, p, T)   \
+#define PULLUP_TO(_len, p, T)  \
 do {   \
-   int x = (len) + sizeof(T);  \
+   int x = (_len) + sizeof(T); \
if ((m)->m_len < x) {   \
args->m = m = m_pullup(m, x);   \
if (m == NULL)  \
goto pullup_failed; \
}   \
-   p = (mtod(m, char *) + (len));  \
+   p = (mtod(m, char *) + (_len)); \
 } while (0)
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200041 - head/sys/fs/portalfs

2009-12-02 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Dec  2 18:09:22 2009
New Revision: 200041
URL: http://svn.freebsd.org/changeset/base/200041

Log:
  Don't use ap->a_td->td_ucred when we were passed ap->a_cred.

Modified:
  head/sys/fs/portalfs/portal_vnops.c

Modified: head/sys/fs/portalfs/portal_vnops.c
==
--- head/sys/fs/portalfs/portal_vnops.c Wed Dec  2 17:50:52 2009
(r200040)
+++ head/sys/fs/portalfs/portal_vnops.c Wed Dec  2 18:09:22 2009
(r200041)
@@ -246,7 +246,7 @@ portal_open(ap)
/*
 * Create a new socket.
 */
-   error = socreate(AF_UNIX, &so, SOCK_STREAM, 0, ap->a_td->td_ucred,
+   error = socreate(AF_UNIX, &so, SOCK_STREAM, 0, ap->a_cred,
ap->a_td);
if (error)
goto bad;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200042 - head/share/man/man9

2009-12-02 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Dec  2 18:11:14 2009
New Revision: 200042
URL: http://svn.freebsd.org/changeset/base/200042

Log:
  Add missing parameter description.

Modified:
  head/share/man/man9/VOP_OPENCLOSE.9

Modified: head/share/man/man9/VOP_OPENCLOSE.9
==
--- head/share/man/man9/VOP_OPENCLOSE.9 Wed Dec  2 18:09:22 2009
(r200041)
+++ head/share/man/man9/VOP_OPENCLOSE.9 Wed Dec  2 18:11:14 2009
(r200042)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 5, 2007
+.Dd December 2, 2009
 .Os
 .Dt VOP_OPEN 9
 .Sh NAME
@@ -55,6 +55,8 @@ The arguments are:
 The vnode of the file.
 .It Fa mode
 The access mode required by the calling process.
+.It Fa cred
+The caller's credentials.
 .It Fa td
 The thread which is accessing the file.
 .It Fa fp
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ

2009-12-02 Thread M. Warner Losh
In message: 
"Sean C. Farley"  writes:
: On Tue, 1 Dec 2009, M. Warner Losh wrote:
: 
: > In message: 
: >Robert Watson  writes:
: > : On Mon, 30 Nov 2009, Colin Percival wrote:
: > :
: > : > Brian Feldman wrote:
: > : >>   Do not gratuitously fail *env(3) operations due to corrupt ('='-less)
: > : >>   **environ entries.  This puts non-getenv(3) operations in line with
: > : >>   getenv(3) in that bad environ entries do not cause all operations to
: > : >>   fail.  There is still some inconsistency in that getenv(3) in the
: > : >>   absence of any environment-modifying operation does not emit corrupt
: > : >>   environ entry warnings.
: > : >>
: > : >>   I also fixed another inconsistency in getenv(3) where updating the
: > : >>   global environ pointer would not be reflected in the return values.
: > : >>   It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3)
: > : >>   in order to see the change.
: > : >
: > : > The FreeBSD Security Team is currently dealing with a security 
: > : > issue relating to this code.  Please back out your change (at 
: > : > least to getenv.c; I don't particularly care about the regression 
: > : > tests) until we've finished, and then submit the patch to us for 
: > : > review along with a detailed explanation of what it does.
: > : >
: > : > We've already had two major security issues arising out of 
: > : > getenv.c in the past year, and I'd like to make sure we don't have 
: > : > a third.
: > :
: > : I think it's fair to say that the POSIXization of the environment 
: > : code has been an unmitigated disaster, and speaks to the necessity 
: > : for careful review of those sorts of code changes.
: >
: > Why we're not just reverting the whole thing as a bad idea is beyond 
: > me.  Clearly the tiny incremental benefits have been far overshadowed 
: > by this fiasco.
: 
: Which "whole thing"?  The code or the POSIX-compliance?  Technically, it 
: is not pure compliance because the code has a few BSD requirements in it 
: such as keeping old name=value entries even when new ones are created.

I'm calling for something fairly radical: Go back to the code that was
working before and abandon all this POSIX code.  If someone wants to
reimplement it correctly, securely and audits the system to prove it,
then it can go back in.  We've had two black eyes from the current
code and I have little confidence that all the subtle problems have
been resolved with it.  My gut tells me there are more lurking,
although that can be hard to quantify into an actionable item.

I don't think there's much support for this position, so the next best
thing is what consensus appears to be calling for: fix the current
code in a fail-safe manner.

Warner
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200043 - stable/8/games/factor

2009-12-02 Thread Tony Finch
Author: fanf
Date: Wed Dec  2 19:28:55 2009
New Revision: 200043
URL: http://svn.freebsd.org/changeset/base/200043

Log:
  MFC 199815:
  
  Fix performance bugs in factor(6).

Modified:
  stable/8/games/factor/factor.c
Directory Properties:
  stable/8/games/factor/   (props changed)

Modified: stable/8/games/factor/factor.c
==
--- stable/8/games/factor/factor.c  Wed Dec  2 18:11:14 2009
(r200042)
+++ stable/8/games/factor/factor.c  Wed Dec  2 19:28:55 2009
(r200043)
@@ -13,11 +13,7 @@
  * 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.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *may be used to endorse or promote products derived from this software
  *without specific prior written permission.
  *
@@ -35,18 +31,20 @@
  */
 
 #ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1989, 1993\n\
-   The Regents of the University of California.  All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)factor.c   8.4 (Berkeley) 5/4/95";
-__RCSID("$NetBSD: factor.c,v 1.13 2002/06/18 23:07:36 simonb Exp $");
+#include 
+#ifdef __COPYRIGHT
+__COPYRIGHT("@(#) Copyright (c) 1989, 1993\
+   The Regents of the University of California.  All rights reserved.");
+#endif
+#ifdef __SCCSID
+__SCCSID("@(#)factor.c 8.4 (Berkeley) 5/4/95");
+#endif
+#ifdef __RCSID
+__RCSID("$NetBSD: factor.c,v 1.19 2009/08/12 05:54:31 dholland Exp $");
+#endif
+#ifdef __FBSDID
+__FBSDID("$FreeBSD$");
 #endif
-static const char rcsid[] =
- "$FreeBSD$";
 #endif /* not lint */
 
 /*
@@ -63,7 +61,7 @@ static const char rcsid[] =
  *
  * number: factor1 factor1 factor2 factor3 factor3 factor3 ...
  *
- * where factor1 < factor2 < factor3 < ...
+ * where factor1 <= factor2 <= factor3 <= ...
  *
  * If no args are given, the list of numbers are read from stdin.
  */
@@ -214,7 +212,9 @@ pr_fact(BIGNUM *val)
bnfact = BN_new();
BN_set_word(bnfact, *(fact - 1));
BN_sqr(bnfact, bnfact, ctx);
-   if (BN_cmp(bnfact, val) > 0)
+   if (BN_cmp(bnfact, val) > 0 ||
+   BN_is_prime(val, PRIME_CHECKS,
+   NULL, NULL, NULL) == 1)
pr_print(val);
else
pollard_pminus1(val);
@@ -257,22 +257,28 @@ usage(void)
 
 #ifdef HAVE_OPENSSL
 
-/* pollard rho, algorithm from Jim Gillogly, May 2000 */
+/* pollard p-1, algorithm from Jim Gillogly, May 2000 */
 static void
 pollard_pminus1(BIGNUM *val)
 {
-   BIGNUM *base, *num, *i, *x;
+   BIGNUM *base, *rbase, *num, *i, *x;
 
base = BN_new();
+   rbase = BN_new();
num = BN_new();
i = BN_new();
x = BN_new();
 
+   BN_set_word(rbase, 1);
+newbase:
+   BN_add_word(rbase, 1);
BN_set_word(i, 2);
-   BN_set_word(base, 2);
+   BN_copy(base, rbase);
 
for (;;) {
BN_mod_exp(base, base, i, val, ctx);
+   if (BN_is_one(base))
+   goto newbase;
 
BN_copy(x, base);
BN_sub_word(x, 1);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200044 - stable/7/games/factor

2009-12-02 Thread Tony Finch
Author: fanf
Date: Wed Dec  2 19:30:33 2009
New Revision: 200044
URL: http://svn.freebsd.org/changeset/base/200044

Log:
  MFC 199815:
  
  Fix performance bugs in factor(6).

Modified:
  stable/7/games/factor/factor.c
Directory Properties:
  stable/7/games/factor/   (props changed)

Modified: stable/7/games/factor/factor.c
==
--- stable/7/games/factor/factor.c  Wed Dec  2 19:28:55 2009
(r200043)
+++ stable/7/games/factor/factor.c  Wed Dec  2 19:30:33 2009
(r200044)
@@ -13,11 +13,7 @@
  * 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.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *may be used to endorse or promote products derived from this software
  *without specific prior written permission.
  *
@@ -35,18 +31,20 @@
  */
 
 #ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1989, 1993\n\
-   The Regents of the University of California.  All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)factor.c   8.4 (Berkeley) 5/4/95";
-__RCSID("$NetBSD: factor.c,v 1.13 2002/06/18 23:07:36 simonb Exp $");
+#include 
+#ifdef __COPYRIGHT
+__COPYRIGHT("@(#) Copyright (c) 1989, 1993\
+   The Regents of the University of California.  All rights reserved.");
+#endif
+#ifdef __SCCSID
+__SCCSID("@(#)factor.c 8.4 (Berkeley) 5/4/95");
+#endif
+#ifdef __RCSID
+__RCSID("$NetBSD: factor.c,v 1.19 2009/08/12 05:54:31 dholland Exp $");
+#endif
+#ifdef __FBSDID
+__FBSDID("$FreeBSD$");
 #endif
-static const char rcsid[] =
- "$FreeBSD$";
 #endif /* not lint */
 
 /*
@@ -63,7 +61,7 @@ static const char rcsid[] =
  *
  * number: factor1 factor1 factor2 factor3 factor3 factor3 ...
  *
- * where factor1 < factor2 < factor3 < ...
+ * where factor1 <= factor2 <= factor3 <= ...
  *
  * If no args are given, the list of numbers are read from stdin.
  */
@@ -214,7 +212,9 @@ pr_fact(BIGNUM *val)
bnfact = BN_new();
BN_set_word(bnfact, *(fact - 1));
BN_sqr(bnfact, bnfact, ctx);
-   if (BN_cmp(bnfact, val) > 0)
+   if (BN_cmp(bnfact, val) > 0 ||
+   BN_is_prime(val, PRIME_CHECKS,
+   NULL, NULL, NULL) == 1)
pr_print(val);
else
pollard_pminus1(val);
@@ -257,22 +257,28 @@ usage(void)
 
 #ifdef HAVE_OPENSSL
 
-/* pollard rho, algorithm from Jim Gillogly, May 2000 */
+/* pollard p-1, algorithm from Jim Gillogly, May 2000 */
 static void
 pollard_pminus1(BIGNUM *val)
 {
-   BIGNUM *base, *num, *i, *x;
+   BIGNUM *base, *rbase, *num, *i, *x;
 
base = BN_new();
+   rbase = BN_new();
num = BN_new();
i = BN_new();
x = BN_new();
 
+   BN_set_word(rbase, 1);
+newbase:
+   BN_add_word(rbase, 1);
BN_set_word(i, 2);
-   BN_set_word(base, 2);
+   BN_copy(base, rbase);
 
for (;;) {
BN_mod_exp(base, base, i, val, ctx);
+   if (BN_is_one(base))
+   goto newbase;
 
BN_copy(x, base);
BN_sub_word(x, 1);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200045 - head/sys/dev/iir

2009-12-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Dec  2 20:24:37 2009
New Revision: 200045
URL: http://svn.freebsd.org/changeset/base/200045

Log:
  Include , to get the declarations of ostype and
  osrelease. Remove the duplicate declarations from this file.

Modified:
  head/sys/dev/iir/iir_ctrl.c

Modified: head/sys/dev/iir/iir_ctrl.c
==
--- head/sys/dev/iir/iir_ctrl.c Wed Dec  2 19:30:33 2009(r200044)
+++ head/sys/dev/iir/iir_ctrl.c Wed Dec  2 20:24:37 2009(r200045)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -83,8 +84,6 @@ static int iir_devsw_installed = 0;
 static int sdev_made = 0;
 #endif
 extern int gdt_cnt;
-extern char ostype[];
-extern char osrelease[];
 extern gdt_statist_t gdt_stat;
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200046 - in head/sys: i386/conf pc98/conf

2009-12-02 Thread Andrew Thompson
Author: thompsa
Date: Wed Dec  2 21:22:10 2009
New Revision: 200046
URL: http://svn.freebsd.org/changeset/base/200046

Log:
  Fix cut'n paste on the AR9280 entry.
  
  Submitted by: pluknet

Modified:
  head/sys/i386/conf/NOTES
  head/sys/pc98/conf/NOTES

Modified: head/sys/i386/conf/NOTES
==
--- head/sys/i386/conf/NOTESWed Dec  2 20:24:37 2009(r200045)
+++ head/sys/i386/conf/NOTESWed Dec  2 21:22:10 2009(r200046)
@@ -579,7 +579,7 @@ device  ath_hal # pci/cardbus chip supp
 #deviceath_ar5416  # AR5416 chips
 optionsAH_SUPPORT_AR5416   # enable AR5416 tx/rx descriptors
 #deviceath_ar9160  # AR9160 chips
-#deviceath_ar9280  # AR9160 chips
+#deviceath_ar9280  # AR9280 chips
 device ath_rate_sample # SampleRate tx rate control for ath
 device ce
 device cp

Modified: head/sys/pc98/conf/NOTES
==
--- head/sys/pc98/conf/NOTESWed Dec  2 20:24:37 2009(r200045)
+++ head/sys/pc98/conf/NOTESWed Dec  2 21:22:10 2009(r200046)
@@ -433,7 +433,7 @@ device  ath_hal # pci/cardbus chip supp
 #deviceath_ar5416  # AR5416 chips
 optionsAH_SUPPORT_AR5416   # enable AR5416 tx/rx descriptors
 #deviceath_ar9160  # AR9160 chips
-#deviceath_ar9280  # AR9160 chips
+#deviceath_ar9280  # AR9280 chips
 device ath_rate_sample # SampleRate tx rate control for ath
 
 #
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200047 - stable/8/usr.bin/gzip

2009-12-02 Thread Xin LI
Author: delphij
Date: Wed Dec  2 21:58:00 2009
New Revision: 200047
URL: http://svn.freebsd.org/changeset/base/200047

Log:
  MFC r199066 + 199339:
  
  Apply a NetBSD fix (revision 1.12) to handle multi-session bzip2 files
  as created by pbzip2.

Modified:
  stable/8/usr.bin/gzip/unbzip2.c
Directory Properties:
  stable/8/usr.bin/gzip/   (props changed)

Modified: stable/8/usr.bin/gzip/unbzip2.c
==
--- stable/8/usr.bin/gzip/unbzip2.c Wed Dec  2 21:22:10 2009
(r200046)
+++ stable/8/usr.bin/gzip/unbzip2.c Wed Dec  2 21:58:00 2009
(r200047)
@@ -1,4 +1,4 @@
-/* $NetBSD: unbzip2.c,v 1.11 2008/04/28 20:24:13 martin Exp $  */
+/* $NetBSD: unbzip2.c,v 1.12 2009/10/11 05:17:20 mrg Exp $ */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 static off_t
 unbzip2(int in, int out, char *pre, size_t prelen, off_t *bytes_in)
 {
-   int ret, end_of_file;
+   int ret, end_of_file, cold = 0;
off_t   bytes_out = 0;
bz_stream   bzs;
static char *inbuf, *outbuf;
@@ -64,7 +64,7 @@ unbzip2(int in, int out, char *pre, size
if (bytes_in)
*bytes_in = prelen;
 
-   while (ret >= BZ_OK && ret != BZ_STREAM_END) {
+   while (ret == BZ_OK) {
if (bzs.avail_in == 0 && !end_of_file) {
ssize_t n;
 
@@ -86,9 +86,19 @@ unbzip2(int in, int out, char *pre, size
switch (ret) {
case BZ_STREAM_END:
case BZ_OK:
-   if (ret == BZ_OK && end_of_file)
-   maybe_err("read");
-   if (!tflag) {
+   if (ret == BZ_OK && end_of_file) {
+   /*
+* If we hit this after a stream end, consider
+* it as the end of the whole file and don't
+* bail out.
+*/
+   if (cold == 1)
+   ret = BZ_STREAM_END;
+   else
+   maybe_errx("truncated file");
+   }
+   cold = 0;
+   if (!tflag && bzs.avail_out != BUFLEN) {
ssize_t n;
 
n = write(out, outbuf, BUFLEN - bzs.avail_out);
@@ -96,7 +106,14 @@ unbzip2(int in, int out, char *pre, size
maybe_err("write");
bytes_out += n;
}
-   break;
+   if (ret == BZ_STREAM_END && !end_of_file) {
+   if (BZ2_bzDecompressEnd(&bzs) != BZ_OK ||
+   BZ2_bzDecompressInit(&bzs, 0, 0) != BZ_OK)
+   maybe_errx("bzip2 re-init");
+   cold = 1;
+   ret = BZ_OK;
+   }
+   break;
 
case BZ_DATA_ERROR:
maybe_warnx("bzip2 data integrity error");
@@ -109,7 +126,10 @@ unbzip2(int in, int out, char *pre, size
case BZ_MEM_ERROR:
maybe_warnx("bzip2 out of memory");
break;
-
+   
+   default:
+   maybe_warnx("unknown bzip2 error: %d", ret);
+   break;
}
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200048 - stable/7/usr.bin/gzip

2009-12-02 Thread Xin LI
Author: delphij
Date: Wed Dec  2 21:58:34 2009
New Revision: 200048
URL: http://svn.freebsd.org/changeset/base/200048

Log:
  MFC r199066 + 199339:
  
  Apply a NetBSD fix (revision 1.12) to handle multi-session bzip2 files
  as created by pbzip2.

Modified:
  stable/7/usr.bin/gzip/unbzip2.c
Directory Properties:
  stable/7/usr.bin/gzip/   (props changed)

Modified: stable/7/usr.bin/gzip/unbzip2.c
==
--- stable/7/usr.bin/gzip/unbzip2.c Wed Dec  2 21:58:00 2009
(r200047)
+++ stable/7/usr.bin/gzip/unbzip2.c Wed Dec  2 21:58:34 2009
(r200048)
@@ -1,4 +1,4 @@
-/* $NetBSD: unbzip2.c,v 1.11 2008/04/28 20:24:13 martin Exp $  */
+/* $NetBSD: unbzip2.c,v 1.12 2009/10/11 05:17:20 mrg Exp $ */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 static off_t
 unbzip2(int in, int out, char *pre, size_t prelen, off_t *bytes_in)
 {
-   int ret, end_of_file;
+   int ret, end_of_file, cold = 0;
off_t   bytes_out = 0;
bz_stream   bzs;
static char *inbuf, *outbuf;
@@ -64,7 +64,7 @@ unbzip2(int in, int out, char *pre, size
if (bytes_in)
*bytes_in = prelen;
 
-   while (ret >= BZ_OK && ret != BZ_STREAM_END) {
+   while (ret == BZ_OK) {
if (bzs.avail_in == 0 && !end_of_file) {
ssize_t n;
 
@@ -86,9 +86,19 @@ unbzip2(int in, int out, char *pre, size
switch (ret) {
case BZ_STREAM_END:
case BZ_OK:
-   if (ret == BZ_OK && end_of_file)
-   maybe_err("read");
-   if (!tflag) {
+   if (ret == BZ_OK && end_of_file) {
+   /*
+* If we hit this after a stream end, consider
+* it as the end of the whole file and don't
+* bail out.
+*/
+   if (cold == 1)
+   ret = BZ_STREAM_END;
+   else
+   maybe_errx("truncated file");
+   }
+   cold = 0;
+   if (!tflag && bzs.avail_out != BUFLEN) {
ssize_t n;
 
n = write(out, outbuf, BUFLEN - bzs.avail_out);
@@ -96,7 +106,14 @@ unbzip2(int in, int out, char *pre, size
maybe_err("write");
bytes_out += n;
}
-   break;
+   if (ret == BZ_STREAM_END && !end_of_file) {
+   if (BZ2_bzDecompressEnd(&bzs) != BZ_OK ||
+   BZ2_bzDecompressInit(&bzs, 0, 0) != BZ_OK)
+   maybe_errx("bzip2 re-init");
+   cold = 1;
+   ret = BZ_OK;
+   }
+   break;
 
case BZ_DATA_ERROR:
maybe_warnx("bzip2 data integrity error");
@@ -109,7 +126,10 @@ unbzip2(int in, int out, char *pre, size
case BZ_MEM_ERROR:
maybe_warnx("bzip2 out of memory");
break;
-
+   
+   default:
+   maybe_warnx("unknown bzip2 error: %d", ret);
+   break;
}
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r200051 - in head/sys/ia64: ia64 include

2009-12-02 Thread Marcel Moolenaar
Author: marcel
Date: Thu Dec  3 04:06:48 2009
New Revision: 200051
URL: http://svn.freebsd.org/changeset/base/200051

Log:
  Make sure bus space accesses use unorder memory loads and stores.
  Memory accesses are posted in program order by virtue of the
  uncacheable memory attribute.
  Since GCC, by default, adds acquire and release semantics to
  volatile memory loads and stores, we need to use inline assembly
  to guarantee it. With inline assembly, we don't need volatile
  pointers anymore.
  
  Itanium does not support semaphore instructions to uncacheable
  memory.

Modified:
  head/sys/ia64/ia64/machdep.c
  head/sys/ia64/include/bus.h
  head/sys/ia64/include/cpufunc.h
  head/sys/ia64/include/ia64_cpu.h

Modified: head/sys/ia64/ia64/machdep.c
==
--- head/sys/ia64/ia64/machdep.cThu Dec  3 02:19:12 2009
(r200050)
+++ head/sys/ia64/ia64/machdep.cThu Dec  3 04:06:48 2009
(r200051)
@@ -919,14 +919,14 @@ ia64_init(void)
return (ret);
 }
 
-__volatile void *
+void *
 ia64_ioport_address(u_int port)
 {
uint64_t addr;
 
addr = (port > 0x) ? IA64_PHYS_TO_RR6((uint64_t)port) :
ia64_port_base | ((port & 0xfffc) << 10) | (port & 0xFFF);
-   return ((__volatile void *)addr);
+   return ((void *)addr);
 }
 
 uint64_t

Modified: head/sys/ia64/include/bus.h
==
--- head/sys/ia64/include/bus.h Thu Dec  3 02:19:12 2009(r200050)
+++ head/sys/ia64/include/bus.h Thu Dec  3 04:06:48 2009(r200051)
@@ -169,37 +169,37 @@ bus_space_barrier(bus_space_tag_t bst, b
 static __inline uint8_t
 bus_space_read_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
-   uint8_t __volatile *bsp;
+   uint8_t *bsp;
bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
__MEMIO_ADDR(bsh + ofs);
-   return (*bsp);
+   return (ia64_ld1(bsp));
 }
 
 static __inline uint16_t
 bus_space_read_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
-   uint16_t __volatile *bsp;
+   uint16_t *bsp;
bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
__MEMIO_ADDR(bsh + ofs);
-   return (*bsp);
+   return (ia64_ld2(bsp));
 }
 
 static __inline uint32_t
 bus_space_read_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
-   uint32_t __volatile *bsp;
+   uint32_t *bsp;
bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
__MEMIO_ADDR(bsh + ofs);
-   return (*bsp);
+   return (ia64_ld4(bsp));
 }
 
 static __inline uint64_t
 bus_space_read_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
-   uint64_t __volatile *bsp;
+   uint64_t *bsp;
bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
__MEMIO_ADDR(bsh + ofs);
-   return (*bsp);
+   return (ia64_ld8(bsp));
 }
 
 
@@ -212,40 +212,40 @@ static __inline void
 bus_space_write_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
 uint8_t val)
 {
-   uint8_t __volatile *bsp;
+   uint8_t *bsp;
bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
__MEMIO_ADDR(bsh + ofs);
-   *bsp = val;
+   ia64_st1(bsp, val);
 }
 
 static __inline void
 bus_space_write_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
 uint16_t val)
 {
-   uint16_t __volatile *bsp;
+   uint16_t *bsp;
bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
__MEMIO_ADDR(bsh + ofs);
-   *bsp = val;
+   ia64_st2(bsp, val);
 }
 
 static __inline void
 bus_space_write_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
 uint32_t val)
 {
-   uint32_t __volatile *bsp;
+   uint32_t *bsp;
bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
__MEMIO_ADDR(bsh + ofs);
-   *bsp = val;
+   ia64_st4(bsp, val);
 }
 
 static __inline void
 bus_space_write_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
 uint64_t val)
 {
-   uint64_t __volatile *bsp;
+   uint64_t *bsp;
bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
__MEMIO_ADDR(bsh + ofs);
-   *bsp = val;
+   ia64_st8(bsp, val);
 }
 
 
@@ -258,44 +258,44 @@ static __inline void
 bus_space_read_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
 bus_size_t ofs, uint8_t *bufp, size_t count)
 {
-   uint8_t __volatile *bsp;
+   uint8_t *bsp;
bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
__MEMIO_ADDR(bsh + ofs);
while (count-- > 0)
-   *bufp++ = *bsp;
+   *bufp++ = ia64_ld1(bsp);
 }
 
 static __inline void
 bus_space_read_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
 bus_size_t ofs, uint16_t *bufp, size_t count)
 {
-   uint16_t __volat