From root@iMach.com  Thu Mar 28 02:09:20 2002
Return-Path: <root@iMach.com>
Received: from iMach.com (barbwire.iMach.com [206.127.77.82])
	by hub.freebsd.org (Postfix) with ESMTP id E7A0A37B417
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Mar 2002 02:09:19 -0800 (PST)
Received: (from root@localhost)
	by iMach.com (8.11.6/8.11.6) id g2R2sJB05876;
	Wed, 27 Mar 2002 02:54:19 GMT
	(envelope-from root)
Message-Id: <200203270254.g2R2sJB05876@FluxCapacitor.iMach.com>
Date: Wed, 27 Mar 2002 02:54:19 GMT
From: "Forrest W. Christian" <forrestc@iMach.com>
Reply-To: "Forrest W. Christian" <forrestc@iMach.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: pccardd added option to exit after probe
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         36418
>Category:       bin
>Synopsis:       pccardd added option to exit after probe
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    imp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 28 02:10:01 PST 2002
>Closed-Date:    Sun Sep 29 17:00:35 MDT 2002
>Last-Modified:  Sun Sep 29 17:00:35 MDT 2002
>Originator:     Forrest W.Christian (forrestc@imach.com)
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
iMach, Ltd.
>Environment:
	N/A
>Description:
	pccardd does not contain an option to exit immediately after probing
	the cards.  This is neccessary in low-memory embedded environments
	where the overhead of pccardd running after the initial probe is not
	wanted or needed.
>How-To-Repeat:
	N/A
>Fix:

Patch is attached.   I am currently re-applying this to my source tree 
by hand after each cvsup.  I have tested this and it works (dozens of
486 8MB wireless systems floating around with this patch).

I would appreciate it if a maintainer would look at this and possibly
apply it to the -STABLE tree, if possible.

(Both man page and source file patches are below)


*** /usr/src/usr.sbin/pccard/pccardd/pccardd.c	Tue Sep  4 20:51:36 2001
--- pccardd.c	Wed Mar 27 02:31:39 2002
***************
*** 156,167 ****
  {
  	struct slot *sp;
  	int count, dodebug = 0;
  	int delay = 0;
  	int irq_arg[16];
  	int irq_specified = 0;
  	int i;
  	struct sockaddr_un sun;
! #define	COM_OPTS	":Idvf:s:i:z"
  
  	bzero(irq_arg, sizeof(irq_arg));
  	use_kern_irq = 1;
--- 156,168 ----
  {
  	struct slot *sp;
  	int count, dodebug = 0;
+         int probeonly = 0;
  	int delay = 0;
  	int irq_arg[16];
  	int irq_specified = 0;
  	int i;
  	struct sockaddr_un sun;
! #define	COM_OPTS	":Idvf:s:i:zx"
  
  	bzero(irq_arg, sizeof(irq_arg));
  	use_kern_irq = 1;
***************
*** 196,201 ****
--- 197,205 ----
  		case 's':
  			sock = optarg;
  			break;
+ 		case 'x':
+ 			probeonly = 1;
+ 			break;
  		case 'z':
  			delay = 1;
  			break;
***************
*** 224,235 ****
  	if (doverbose)
  		dump_config_file();
  	log_setup();
! 	if (!dodebug && !delay)
  		if (daemon(0, 0))
  			die("fork failed");
  	slots = readslots();
  	if (slots == 0)
  		die("no PC-CARD slots");
  	if (delay)
  		if (daemon(0, 0))
  			die("fork failed");
--- 228,241 ----
  	if (doverbose)
  		dump_config_file();
  	log_setup();
! 	if (!dodebug && !delay && !probeonly)
  		if (daemon(0, 0))
  			die("fork failed");
  	slots = readslots();
  	if (slots == 0)
  		die("no PC-CARD slots");
+         if (probeonly)
+                 exit(0);
  	if (delay)
  		if (daemon(0, 0))
  			die("fork failed");


*** /usr/src/usr.sbin/pccard/pccardd/pccardd.8	Tue Sep  4 20:51:30 2001
--- pccardd.8	Wed Mar 27 02:19:57 2002
***************
*** 35,40 ****
--- 35,41 ----
  .Nm
  .Op Fl d
  .Op Fl v
+ .Op Fl x
  .Op Fl z
  .Op Fl i Ar IRQ
  .Op Fl I
***************
*** 134,139 ****
--- 135,145 ----
  .It Fl v
  After reading the configuration file, print out a summary
  of it.
+ .It Fl x
+ Exits immediately after the cards have been probed and attached.   This is
+ primarily useful in embedded applications where it is desirable to use 
+ pccardd to start PC-CARD devices but prohibitive memory-wise to leave
+ the pccardd process running.
  .It Fl z
  Delays running as a daemon until after the cards have been probed and attached.
  .It Fl I
>Release-Note:
>Audit-Trail:

From: "Forrest W. Christian" <forrestc@imach.com>
To: Peter Pentchev <roam@ringlet.net>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: bin/36418: pccardd added option to exit after probe
Date: Fri, 29 Mar 2002 02:34:59 +0000 (GMT)

 Revised Patches below....
 
 - Forrest W. Christian (forrestc@imach.com) AC7DE
 ----------------------------------------------------------------------
 
 --- /usr/src/usr.sbin/pccard/pccardd/pccardd.c	Tue Sep  4 20:51:36 2001
 +++ pccardd.c	Thu Mar 28 01:33:51 2002
 @@ -156,12 +156,13 @@
  {
  	struct slot *sp;
  	int count, dodebug = 0;
 +	int probeonly = 0;
  	int delay = 0;
  	int irq_arg[16];
  	int irq_specified = 0;
  	int i;
  	struct sockaddr_un sun;
 -#define	COM_OPTS	":Idvf:s:i:z"
 +#define	COM_OPTS	":Idvf:s:i:zx"
 
  	bzero(irq_arg, sizeof(irq_arg));
  	use_kern_irq = 1;
 @@ -196,6 +197,9 @@
  		case 's':
  			sock = optarg;
  			break;
 +		case 'x':
 +			probeonly = 1;
 +			break;
  		case 'z':
  			delay = 1;
  			break;
 @@ -224,12 +228,14 @@
  	if (doverbose)
  		dump_config_file();
  	log_setup();
 -	if (!dodebug && !delay)
 +	if (!dodebug && !delay && !probeonly)
  		if (daemon(0, 0))
  			die("fork failed");
  	slots = readslots();
  	if (slots == 0)
  		die("no PC-CARD slots");
 +	if (probeonly)
 +		exit(0);
  	if (delay)
  		if (daemon(0, 0))
  			die("fork failed");
 
 
 --- /usr/src/usr.sbin/pccard/pccardd/pccardd.8	Tue Sep  4 20:51:30 2001
 +++ pccardd.8	Thu Mar 28 01:31:28 2002
 @@ -35,6 +35,7 @@
  .Nm
  .Op Fl d
  .Op Fl v
 +.Op Fl x
  .Op Fl z
  .Op Fl i Ar IRQ
  .Op Fl I
 @@ -134,6 +135,14 @@
  .It Fl v
  After reading the configuration file, print out a summary
  of it.
 +.It Fl x
 +Exits immediately after the cards have been probed and attached.
 +This is primarily useful in embedded applications where it is
 +desirable to use
 +.Nm
 +to start PC-CARD devices but prohibitive memory-wise to leave the
 +.Nm
 +process running.
  .It Fl z
  Delays running as a daemon until after the cards have been probed and attached.
  .It Fl I
 
Responsible-Changed-From-To: freebsd-bugs->imp 
Responsible-Changed-By: roam 
Responsible-Changed-When: Fri Mar 29 04:11:15 PST 2002 
Responsible-Changed-Why:  
Over to the PC-CARD code maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=36418 
State-Changed-From-To: open->closed 
State-Changed-By: imp 
State-Changed-When: Sun Sep 29 17:00:19 MDT 2002 
State-Changed-Why:  
Integrated patch, will MFC eventually. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=36418 
>Unformatted:
