Re: r239356: does it mean, that synchronous dhcp and dhcplcinet with disabled devd gone?

From: Ian Lepore <freebsd_at_damnhippie.dyndns.org>
Date: Tue, 21 Aug 2012 15:38:04 -0600
On Tue, 2012-08-21 at 14:04 -0600, Warner Losh wrote:
> On Aug 21, 2012, at 11:42 AM, Lev Serebryakov wrote:
> 
> > Hello, Ian.
> > You wrote 21 августа 2012 г., 21:36:30:
> > 
> > IL> I think it's funny how people have this knee-jerk reaction against C++
> > IL> apps.  The devd executable is not exactly an example of bloatware: 374k
> > IL> statically linked (so it already includes this "C++ runtime" that you
> > IL> think is large).    We routinely deploy embedded systems that use apps
> > IL> written exclusively in C++, on systems that only have 32 or 64mb of ram.
> > IL> We've been doing so since the days when the biggest compact flash card
> > IL> you could buy was 64mb.
> >  BTW, typical  MIPS  SoC-based  router has only 16MiB of flash. And,
> > yes, FreeBSD doesn't fit well in this size now, but why add another
> > mandatory program, only role of which is to monitor network cable and
> > re-run the same program every time?
> 
> You'd typically not run dhclient in daemon mode in a SoC, since you don't want to chew up the memory all the time, and you'd likely replace the system dhclient with one that's simpler...  But the network notification part of devd would be trivial to reproduce if you wanted in a specialized daemon that would do what's required.
> 
> Warner
> 

For example, this script can replace devd as a daemon that restarts
dhclient when any link comes back up...


 #!/bin/sh
 daemon_loop () {
   while true; do                                                                
     read line
     if [ -z "${line##!system=IFNET subsystem=* type=LINK_UP}" ] ; then
       eval ${line##!}
       /sbin/dhclient $subsystem
     fi
   done
 }
 cat /dev/devctl | daemon_loop

Of course the right thing to do is invoke the proper rc scripts rather
than dhclient directly... this is just to illustrate how easy it is to
replace devd if your needs are specialized.

-- Ian
Received on Tue Aug 21 2012 - 19:38:13 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:29 UTC