Re: bgpd: fix error message enforce remote-as enabled

2011-02-15 Thread Claudio Jeker
On Mon, Feb 14, 2011 at 10:06:58PM +, Stuart Henderson wrote:
 On 2011/02/14 21:39, Claudio Jeker wrote:
  
  After a bit more thinking I like this version a lot better. This correctly
  prints the neighbor AS number in both cases 16bit and 32bit AS Number.
 
 Ok. 
 
 Personally the only time I've hit this is when connecting to   
 an ixp route-server running with transparent-as, so logging
 the actual path is of limited use, but doing so doesn't hurt 
 nd might be useful in some cases.
 

It does not print the full path but prints the neighbor AS number in a
more correct way (as X.Y for 4byte AS numbers). It is just better then
printing the AS number with %i.

 
 
  Comments?
  -- 
  :wq Claudio
  
  Index: rde.c
  ===
  RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
  retrieving revision 1.306
  diff -u -p -r1.306 rde.c
  --- rde.c   29 Jan 2011 17:10:45 -  1.306
  +++ rde.c   14 Feb 2011 19:48:11 -
  @@ -922,8 +922,8 @@ rde_update_dispatch(struct imsg *imsg)
  fas = aspath_neighbor(asp-aspath);
  if (peer-conf.remote_as != fas) {
  log_peer_warnx(peer-conf, bad path, 
  -   starting with %i, 
  -   enforce neighbor-as enabled, fas);
  +   starting with %s, 
  +   enforce neighbor-as enabled, log_as(fas));
  rde_update_err(peer, ERR_UPDATE, ERR_UPD_ASPATH,
  NULL, 0);
  goto done;
 

-- 
:wq Claudio



Re: History for bc(1)

2011-02-15 Thread Gabriel Linder

On 02/14/11 17:43, Christiano F. Haesbaert wrote:

Any news on this ?



The diff still apply on -current. If there are changes needed I can work 
on it, but I have no news.




Re: alc(4) support for Atheros AR815x

2011-02-15 Thread Gabriel Linder

On 01/25/11 11:24, Kevin Lo wrote:

Hi,

The following diff adds support for Atheros AR8151/AR8152 chipsets;
mostly from FreeBSD. It also fixes an issue i386/6311.
Tested on Acer AOD255E.


Tried yesterday on EeePC 1005PX, some comments inline.


@@ -515,6 +694,20 @@ alc_attach(struct device *parent, struct
val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV);
val= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP);
CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val);
+   CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG,
+   CSR_READ_4(sc, ALC_LTSSM_ID_CFG)  ~LTSSM_ID_WRO_ENB);
+   CSR_WRITE_4(sc, ALC_PCIE_PHYMISC,
+   CSR_READ_4(sc, ALC_PCIE_PHYMISC) |
+   PCIE_PHYMISC_FORCE_RCV_DET);
+   if (sc-sc_product == PCI_PRODUCT_ATTANSIC_L2C_1
+   sc-alc_rev == ATHEROS_AR8152_B_V10) {


Using sc-sc_product and sc-alc_rev, but they are initialized later.


@@ -551,12 +747,39 @@ alc_attach(struct device *parent, struct
 * used in AR8132 can't establish gigabit link even if it
 * shows the same PHY model/revision number of AR8131.
 */
-   if (PCI_PRODUCT(pa-pa_id) == PCI_PRODUCT_ATTANSIC_L2C)
-   sc-alc_flags |= ALC_FLAG_FASTETHER | ALC_FLAG_JUMBO;
-   else
-   sc-alc_flags |= ALC_FLAG_JUMBO | ALC_FLAG_ASPM_MON;
+   sc-sc_product = PCI_PRODUCT(pa-pa_id);


Here is sc-sc_product, sc-alc_rev initialized line 569 of if_alc.c r1.9

alc_newbuf should always use M_DONTWAIT (get rid of init), see 
http://marc.info/?l=openbsd-techm=129639859909043w=2




Re: History for bc(1)

2011-02-15 Thread Otto Moerbeek
On Tue, Feb 15, 2011 at 12:23:41PM +0100, Gabriel Linder wrote:

 On 02/14/11 17:43, Christiano F. Haesbaert wrote:
 Any news on this ?
 
 
 The diff still apply on -current. If there are changes needed I can
 work on it, but I have no news.

sorry, in have a diff in my tree, but I see myself always ignoring it.
I just almost never actually use the editing capabilities. It seems my
25yr finger memory is too strong.  So I'm not a proper tester for this
diff, other than it does not seem to cause a regression. 

-Otto



Re: plug a memleak in output_listing()

2011-02-15 Thread Claudio Jeker
On Fri, Feb 11, 2011 at 07:34:41PM -0300, Gleydson Soares wrote:
 plug a memleak in output_listing(); from NetBSD
 Index: aicasm.c
 ===
 RCS file: /cvs/src/sys/dev/microcode/aic7xxx/aicasm.c,v
 retrieving revision 1.14
 diff -u -r1.14 aicasm.c
 --- aicasm.c  4 Oct 2005 23:46:14 -   1.14
 +++ aicasm.c  11 Feb 2011 22:24:44 -
 @@ -594,6 +594,7 @@
   if (isatty(fileno(stdin)) == 0)
   putchar(input);
   }
 + free(func_values);
   fprintf(stdout, \nThanks!\n);
   }
 

This is wrong. check_patch() is called later on with func_values as an
argument. I think there is no point in trying to free this memory since
the application is going to exit more or less soon.

-- 
:wq Claudio



Re: ifconfig vlan tag range

2011-02-15 Thread Claudio Jeker
On Thu, Feb 10, 2011 at 12:08:24PM +0100, Henning Brauer wrote:
 * Camiel Dobbelaar c...@sentia.nl [2011-02-09 20:34]:
  The valid range for vlan tags in OpenBSD is 0-4095 (inclusive).
 
 not only in openbsd - that's what you can fit in the 12 bits ;)
 
  Index: ifconfig.c
  ===
  RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
  retrieving revision 1.242
  diff -u -r1.242 ifconfig.c
  --- ifconfig.c  9 Nov 2010 21:14:47 -   1.242
  +++ ifconfig.c  5 Feb 2011 14:28:56 -
  @@ -3351,7 +3351,7 @@
  struct vlanreq vreq;
  const char *errmsg = NULL;
   
  -   __tag = tag = strtonum(val, 0, 65535, errmsg);
  +   __tag = tag = strtonum(val, 0, 4095, errmsg);
  if (errmsg)
  errx(1, vlan tag %s: %s, val, errmsg);
  __have_tag = 1;
  @@ -3411,7 +3411,7 @@
   
  if (!__have_tag  vreq.vlr_tag == 0) {
  skip = strcspn(ifr.ifr_name, 0123456789);
  -   tag = strtonum(ifr.ifr_name + skip, 1, 4095, estr);
  +   tag = strtonum(ifr.ifr_name + skip, 0, 4095, estr);
  if (estr != NULL)
  errx(1, invalid vlan tag and device specification);
  vreq.vlr_tag = tag;
  
 
 ok.
 
... and OK claudio@

This seems to be still pending. What is the holdup? Camiel please commit
:)

-- 
:wq Claudio



Re: MicroLinear 6692 PHY for tl(4) -- Olicom 2326

2011-02-15 Thread Claudio Jeker
On Sun, Feb 13, 2011 at 05:03:03AM -0500, Loganaden Velvindron wrote:
 Hi,
 
 Claudio suggested to me a better way of cycling through the PHYs.
 Does this look good ?
 
 /*$OpenBSD: ukphy.c,v 1.20 2010/07/23 07:47:13 jsg Exp $  */
 /*$NetBSD: ukphy.c,v 1.9 2000/02/02 23:34:57 thorpej Exp $*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999
  *Bill Paul wpaul at ctr.columbia.edu.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *must display the following acknowledgement:
  *This product includes software developed by Bill Paul.
  * 4. Neither the name of the author nor the names of any co-contributors
  *may be used to endorse or promote products derived from this software
  *without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
  */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
  * NASA Ames Research Center, and by Frank van der Linden.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) 

Re: MicroLinear 6692 PHY for tl(4) -- Olicom 2326

2011-02-15 Thread Stuart Henderson
On 2011/02/15 14:05, Claudio Jeker wrote:
  
  /*
   * Micro Linear PHY reports oui == 0 model == 0
   */
  if (MII_OUI(ma-mii_id1, ma-mii_id2) != 0 ||
 MII_MODEL(ma-mii_id2) != 0)
  return (0);
  /*
   * Make sure the parent is a `tl'. So far, I have only
   * encountered the 6692 on an Olicom card with a ThunderLAN
   * controller chip.
   */
  if (strcmp(parent-dv_cfdata-cf_driver-cd_name, tl) != 0)
  return (0);
 
 I don't like this. Why restrict it to tl(4) only. The phy may work on any
 other mii bus so there is no reason for this restriction.

I'm not sure attaching to every OUI 0x00 model 0x is safe..

pcn0 at pci0 dev 3 function 0 AMD 79c970 PCnet-PCI rev 0x30, Am79c973, rev 0: 
irq 11, address 08:00:27:6a:ef:bc
ukphy0 at pcn0 phy 0: Generic IEEE 802.3u media interface, rev. 0: OUI 
0x00, model 0x

mos0 at uhub0 port 4 configuration 1 interface 0 Moschip Semiconductor USB-MAC 
Controller rev 2.00/1.00 addr 2
mos0: MCS7830, address 00:0c:f6:3a:f4:46
ukphy0 at mos0 phy 1: Generic IEEE 802.3u media interface, rev. 0: OUI 
0x00, model 0x



Re: MicroLinear 6692 PHY for tl(4) -- Olicom 2326

2011-02-15 Thread Claudio Jeker
On Tue, Feb 15, 2011 at 01:28:28PM +, Stuart Henderson wrote:
 On 2011/02/15 14:05, Claudio Jeker wrote:
   
 /*
  * Micro Linear PHY reports oui == 0 model == 0
  */
 if (MII_OUI(ma-mii_id1, ma-mii_id2) != 0 ||
MII_MODEL(ma-mii_id2) != 0)
 return (0);
 /*
  * Make sure the parent is a `tl'. So far, I have only
  * encountered the 6692 on an Olicom card with a ThunderLAN
  * controller chip.
  */
 if (strcmp(parent-dv_cfdata-cf_driver-cd_name, tl) != 0)
 return (0);
  
  I don't like this. Why restrict it to tl(4) only. The phy may work on any
  other mii bus so there is no reason for this restriction.
 
 I'm not sure attaching to every OUI 0x00 model 0x is safe..
 
 pcn0 at pci0 dev 3 function 0 AMD 79c970 PCnet-PCI rev 0x30, Am79c973, rev 
 0: irq 11, address 08:00:27:6a:ef:bc
 ukphy0 at pcn0 phy 0: Generic IEEE 802.3u media interface, rev. 0: OUI 
 0x00, model 0x
 
 mos0 at uhub0 port 4 configuration 1 interface 0 Moschip Semiconductor 
 USB-MAC Controller rev 2.00/1.00 addr 2
 mos0: MCS7830, address 00:0c:f6:3a:f4:46
 ukphy0 at mos0 phy 1: Generic IEEE 802.3u media interface, rev. 0: OUI 
 0x00, model 0x
 

Hmm. Right. Forgot that the PHY has no oui or model. So ignore that.

-- 
:wq Claudio



Nikon P100 y Canon SX30

2011-02-15 Thread DigitalesNet
USD479   Camara 
Digital NIKON P100 Tipo  compacta, visor
electroacute;nico / Sensor CMOS  de 10,30
MP efectivos / Objetivo (en 35 mm) 26,0  -
678,0 mm / Zoom 26x (oacute;ptico) / Soportes  
   compatibles SD Card / Pantalla TFT de 3,00 pulgadas   USD
   580   Canon  SX30 IS
Caacute;mara  digital compacta, visor
electroacute;nico / Sensor  CCD de 14,10 MP
efectivos / Objetivo (en 35 mm)  24,0 -
840,0 mm Zoom 35x (oacute;ptico) / 4x (digital) / Soportes 
compatibles SD Card / MMC, SDHC, MMCplus, HC MMCplus,   
  SDXC / Pantalla TFT de 2,70 pulgadas



Re: Tracking What it's changing in current

2011-02-15 Thread BSD

On 02/15/11 10:54, Orestes Leal R. wrote:

I need to see (with a tool or whatever) what changes have occured between
current,
let's say between current 4.9 from february 9 and current dated february
14. They are logged in some place?



cvs



Re: Incorrect exit status from which(1)/whereis(1)

2011-02-15 Thread Jason McIntyre
On Mon, Feb 14, 2011 at 11:31:18AM +, David Julio wrote:
 Is the exit status of which(1)/whereis(1) correct?
 
 $ which a b c
 which: a: Command not found
 which: b: Command not found
 which: c: Command not found
 
 $ echo $?
 2
 
 $ which -a a b c
 which: a: Command not found
 which: b: Command not found
 which: c: Command not found
 
 $ echo $?
 1
 
 If it is incorrect, below is my attempt to contribute.
 
 Thank you for your time.
 

this command is not covered by posix, so there's no reference there.
neither free nor netbsd document exit status for this command either.

i have no access to such systems, but maybe someone who does can tell us
how other bsd behave?

if it's a doc bug, it can be fixed easy enough. that would seem strange
behaviour though. if it's a software bug, any developer want to look at
this?

jmc

 Index: which.c
 ===
 RCS file: /cvs/src/usr.bin/which/which.c,v
 retrieving revision 1.16
 diff -u -r1.16 which.c
 --- which.c   31 May 2010 14:01:49 -  1.16
 +++ which.c   14 Feb 2011 11:02:10 -
 @@ -55,11 +55,7 @@
 
   (void)setlocale(LC_ALL, );
 
 - if (argc == 1)
 - usage();
 -
 - /* Don't accept command args but check since old whereis(1) used to */
 - while ((ch = getopt(argc, argv, a)) != -1) {
 + while ((ch = getopt(argc, argv, a)) != -1)
   switch (ch) {
   case 'a':
   allmatches = 1;
 @@ -67,7 +63,11 @@
   default:
   usage();
   }
 - }
 + argc -= optind;
 + argv += optind;
 +
 + if (argc == 0)
 + usage();
 
   /*
* which(1) uses user's $PATH.
 @@ -98,11 +98,11 @@
   if (setuid(geteuid()))
   err(1, Can't set uid to %u, geteuid());
 
 - for (n = optind; n  argc; n++)
 + for (n = 0; n  argc; n++)
   if (findprog(argv[n], path, progmode, allmatches) == 0)
   notfound++;
 
 - exit((notfound == 0) ? 0 : ((notfound == argc - 1) ? 2 : 1));
 + exit((notfound == 0) ? 0 : ((notfound == argc) ? 2 : 1));
  }
 
  int



Re: MicroLinear 6692 PHY for tl(4) -- Olicom 2326

2011-02-15 Thread Loganaden Velvindron
Hi,

Yes, the diff does work with half/full duplex.

I fixed the style issues  added checks for other being NULL. To
test those changes, I disabled tlphy  ukphy, and tested the tl
adapter with mlphy only. All modes work. I think it's better to
be on the safe side and assume that the companion PHY may not be
present at all (It could be damaged for instance).

/*  $OpenBSD: ukphy.c,v 1.20 2010/07/23 07:47:13 jsg Exp $  */
/*  $NetBSD: ukphy.c,v 1.9 2000/02/02 23:34:57 thorpej Exp $*/

/*-
 * Copyright (c) 1997, 1998, 1999
 *  Bill Paul wpaul at ctr.columbia.edu.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *notice, this list of conditions and the following disclaimer in the
 *documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *must display the following acknowledgement:
 *  This product includes software developed by Bill Paul.
 * 4. Neither the name of the author nor the names of any co-contributors
 *may be used to endorse or promote products derived from this software
 *without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

/*-
 * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
 * NASA Ames Research Center, and by Frank van der Linden.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *notice, this list of conditions and the following disclaimer in the
 *documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * Copyright (c) 1997 Manuel Bouyer.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *notice, this list of conditions and the following disclaimer in the
 *documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 

Re: Incorrect exit status from which(1)/whereis(1)

2011-02-15 Thread Thordur Bjornsson
On Tue, Feb 15, 2011 at 05:30:11PM +, Jason McIntyre wrote:
 On Mon, Feb 14, 2011 at 11:31:18AM +, David Julio wrote:
  Is the exit status of which(1)/whereis(1) correct?
  
  $ which a b c
  which: a: Command not found
  which: b: Command not found
  which: c: Command not found
  
  $ echo $?
  2
 
  $ which -a a b c
  which: a: Command not found
  which: b: Command not found
  which: c: Command not found
  
  $ echo $?
  1
 
  If it is incorrect, below is my attempt to contribute.
 
 this command is not covered by posix, so there's no reference there.
 neither free nor netbsd document exit status for this command either.
 
 i have no access to such systems, but maybe someone who does can tell us
 how other bsd behave?
SunOS 5.10 doesn't document the exit status, doesn't have a -a switch.
Simple check show that  there exit status is 1 if noone are found, 0
if all/some are found.

Linux behaves the same way, but has an exit code of 2 if there where
invalid arguments passed.

DragonflyBSD (And FreeBSD) behave the same, but return 1 if there
where invalid arguments.

No access to a NetBSD box, and there man page doesn't document the
exit status.
   
 if it's a doc bug, it can be fixed easy enough. that would seem strange
 behaviour though. if it's a software bug, any developer want to look at
 this?
What's correct there, I've no idea.

At the very least we should be consistent with our own man page so, the 
diff might be the right solution.

kv, thib

  Index: which.c
  ===
  RCS file: /cvs/src/usr.bin/which/which.c,v
  retrieving revision 1.16
  diff -u -r1.16 which.c
  --- which.c 31 May 2010 14:01:49 -  1.16
  +++ which.c 14 Feb 2011 11:02:10 -
  @@ -55,11 +55,7 @@
  
  (void)setlocale(LC_ALL, );
  
  -   if (argc == 1)
  -   usage();
  -
  -   /* Don't accept command args but check since old whereis(1) used to */
  -   while ((ch = getopt(argc, argv, a)) != -1) {
  +   while ((ch = getopt(argc, argv, a)) != -1)
  switch (ch) {
  case 'a':
  allmatches = 1;
  @@ -67,7 +63,11 @@
  default:
  usage();
  }
  -   }
  +   argc -= optind;
  +   argv += optind;
  +
  +   if (argc == 0)
  +   usage();
  
  /*
   * which(1) uses user's $PATH.
  @@ -98,11 +98,11 @@
  if (setuid(geteuid()))
  err(1, Can't set uid to %u, geteuid());
  
  -   for (n = optind; n  argc; n++)
  +   for (n = 0; n  argc; n++)
  if (findprog(argv[n], path, progmode, allmatches) == 0)
  notfound++;
  
  -   exit((notfound == 0) ? 0 : ((notfound == argc - 1) ? 2 : 1));
  +   exit((notfound == 0) ? 0 : ((notfound == argc) ? 2 : 1));
   }
  
   int



OpenBSD 4.8 RAID 0+1 or 1+0 or 5

2011-02-15 Thread Steven R. Gerber
Sorry for cross posting?
I am trying to setup a decent RAID (0+1 or 1+0 or 5) and there SEEMS to
be no approved method.  (4 disks -- I usually like stripe on top of
mirrors.)
I believe that I have done my homework.
What are my options?

softraid (bioctl) cannot handle stripe on mirrors:
I can easily create 2 mirrors and they survive reboot.
I can create stripe on those mirrors (works -- can create files), but it
does not survive reboot.
Message is device not configured.

Both ccd and RAIDframe are decprecated (FAQ 14.13):
 Software Options
 OpenBSD supports softraid(4), a framework supporting many kinds of I/O
transformations, including RAID and encryption disciplines. Softraid(4)
is managed using bioctl(8).

 OpenBSD also includes RAIDframe (raid(4), requires a custom kernel),
and ccd(4) as historic ways of implementing RAID, but at this point
OpenBSD does not suggest implementing either as a RAID solution for new
installs or reinstalls.
OpenBSD does not suggest implementing either
Also, RAIDframe requires a custom kernel and we all know that GENERIC is
preferred.

RAID 5 is experimental (man bioctl):
 CAVEATS
  Use of the CRYPTO  RAID 4/5 disciplines are currently considered
  experimental.

 OpenBSD 4.9December 22, 2010
OpenBSD 4.9

Also, bioctl would not let me create a RAID 5 set:
# bioctl -iv softraid0
# bioctl -c 5 -l /dev/sd1a,/dev/sd2a,/dev/sd3a,/dev/sd4a softraid0
bioctl: BIOCCREATERAID: Invalid argument
# bioctl -iv softraid0
# dmesg|tail
sd11 at scsibus6 targ 0 lun 0: OPENBSD, SR RAID 0, 004 SCSI2 0/direct
fixed
sd11: 3815436MB, 512 bytes/sec, 7814014721 sec total
sd11 detached
scsibus6 detached
sd10 detached
scsibus5 detached
sd9 detached
scsibus4 detached
softraid0: not part of the same volume
softraid0: can't attach metadata type 0

Thanks,
Steven