Re: netgraph one2many question
Milon Papezik writes: > I would like to extend ng_one2many module to include > automatic link failure datection, failover and FEC functionality. > > My question is: > Are interface nodes able to send upstream notification > that their state has changed or do I have to poll their status periodically > as it is done in ng_fec module made kindly available by wpaul ? They don't now, but I think you could add this in a reasonably unoffensive way. What you would do is add a new function pointer to struct ifnet, say "void (*if_report)(struct ifnet *, int status)" or something. When a device driver detected link going up/down, it could call this function (if non-NULL). Then if_ethersubr() would set this function pointer to point to some function if_ether_report(). When if_ether_report() is called, if ng_ether was loaded, it would call into ng_ether() to generate a control message that would be passed to the node connected to the "lower" hook. Then, ng_one2many could be modified to understand this control message and do the right thing according to its configuration. Or, something like that. Polling might be a quicker and easier though less precise way to do it for starters. -Archie __ Archie Cobbs * Packet Design * http://www.packetdesign.com To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
patch for review: multiple console support
This patch adds support for multiple simultaneous low level consoles to the kernel. In essence, it is equivalent to the -D flag in the /boot.config file. Support can be turned on by executing 'boot -D' from the loader, or by using the comcontrol program (which is appended to the end of the patch). The motivation for performing this work (other than wanting to be able to use ddb on vidconsol and comconsole interchangeably) is the upcoming network console support, which requires the ability to add a console after the system is up. Objections and bugs aside, I plan to commit this shortly. -- Jonathan Index: kern/tty_cons.c === RCS file: /ncvs/src/sys/kern/tty_cons.c,v retrieving revision 1.92 diff -u -r1.92 tty_cons.c --- kern/tty_cons.c 2001/09/12 08:37:46 1.92 +++ kern/tty_cons.c 2001/10/20 03:23:04 @@ -44,11 +44,15 @@ #include #include #include +#include +#include #include +#include #include #include #include #include +#include #include @@ -78,47 +82,43 @@ /* kqfilter */ cnkqfilter, }; -static dev_t cn_dev_t; /* seems to be never really used */ +struct cn_device { + STAILQ_ENTRY(cn_device) cnd_next; + charcnd_name[16]; + struct vnode *cnd_vp; + struct consdev *cnd_cn; +}; + +#define CNDEVPATHMAX 32 +#define CNDEVTAB_SIZE 4 +static struct cn_device cn_devtab[CNDEVTAB_SIZE]; +static STAILQ_HEAD(, cn_device) cn_devlist = +STAILQ_HEAD_INITIALIZER(cn_devlist); + +#define CND_INVALID(cnd, td) \ + (cnd == NULL || cnd->cnd_vp == NULL || \ + (cnd->cnd_vp->v_type == VBAD && !cn_devopen(cnd, td, 1))) + static udev_t cn_udev_t; SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLFLAG_RD, &cn_udev_t, sizeof cn_udev_t, "T,dev_t", ""); -static int cn_mute; - intcons_unavail = 0; /* XXX: * physical console not available for * input (i.e., it is in graphics mode) */ - -static u_char cn_is_open; /* nonzero if logical console is open */ -static int openmode, openflag; /* how /dev/console was openned */ +static int cn_mute; +static int openflag; /* how /dev/console was opened */ +static int cn_is_open; static dev_t cn_devfsdev; /* represents the device private info */ -static u_char cn_phys_is_open; /* nonzero if physical device is open */ -static d_close_t *cn_phys_close; /* physical device close function */ -static d_open_t *cn_phys_open; /* physical device open function */ - struct consdev *cn_tab; /* physical console device info */ CONS_DRIVER(cons, NULL, NULL, NULL, NULL, NULL, NULL, NULL); SET_DECLARE(cons_set, struct consdev); void -cninit() +cninit(void) { - struct consdev *best_cp, *cp, **list; - - /* -* Find the first console with the highest priority. -*/ - best_cp = NULL; - SET_FOREACH(list, cons_set) { - cp = *list; - if (cp->cn_probe == NULL) - continue; - (*cp->cn_probe)(cp); - if (cp->cn_pri > CN_DEAD && - (best_cp == NULL || cp->cn_pri > best_cp->cn_pri)) - best_cp = cp; - } + struct consdev *best_cn, *cn, **list; /* * Check if we should mute the console (for security reasons perhaps) @@ -131,74 +131,176 @@ |RB_VERBOSE |RB_ASKNAME |RB_CONFIG)) == RB_MUTE); - + /* -* If no console, give up. +* Find the first console with the highest priority. */ - if (best_cp == NULL) { - if (cn_tab != NULL && cn_tab->cn_term != NULL) - (*cn_tab->cn_term)(cn_tab); - cn_tab = best_cp; + best_cn = NULL; + SET_FOREACH(list, cons_set) { + cn = *list; + if (cn->cn_probe == NULL) + continue; + cn->cn_probe(cn); + if (cn->cn_pri == CN_DEAD) + continue; + if (best_cn == NULL || cn->cn_pri > best_cn->cn_pri) + best_cn = cn; + if (boothowto & RB_MULTIPLE) { + /* +* Initialize console, and attach to it. +*/ + cnadd(cn); + cn->cn_init(cn); + } + } + if (best_cn == NULL) return; + if ((boothowto & RB_MULTIPLE) == 0) { + cnadd(best_cn); + best_cn->cn_init(best_cn); } - /* -* Initialize console, then attach to it. This ordering allows -
where are kernel modules located?
Kernel modules are supposed to locate under /modules. It turns out we can find it under /. So where are kernel models located exactly? Thanks, -Zhihui To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: where are kernel modules located?
In messageZhihui Zhang writes: : Kernel modules are supposed to locate under /modules. It turns out we can : find it under /. So where are kernel models located exactly? In -stable it is /modules (except for about 8 hours in the last few days when they bogusly wound up in / due to a foobar by yours truly). In current they live in /boot/kernel/*. Warner To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
bash scripting help/suggestions.
I'm creating a bash script and I need to know if a directory exists and if it doesn't create it. So far the only why I can see to determine if a directory exists is to try to cd to it and if it doesn't exists trap the error. Is there a better way or a function that I am missing? If not how do you trap a error in bash, if at all possible. Rod http://storm.prohosting.com/osbeef/osbeef.htm 'musical rhythms can mess with your head...' - T La Rock "It's your's" To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: bash scripting help/suggestions.
On Sat, Oct 20, 2001 at 05:35:45PM -0400, Rod Person wrote: man test(1) tells you how to check for a directory (and lots more BTW) mkdir -p might also interest you (see the mkdir man page) > I'm creating a bash script and I need to know if a directory exists and if it >doesn't create it. So far the only why I can see to determine if a directory exists >is to try to cd to it and if it doesn't exists trap the error. Is there a better way >or a function that I am missing? If not how do you trap a error in bash, if at all >possible. > > Rod > > http://storm.prohosting.com/osbeef/osbeef.htm > > 'musical rhythms can mess with your head...' > - T La Rock > "It's your's" > > > To Unsubscribe: send mail to [EMAIL PROTECTED] > with "unsubscribe freebsd-hackers" in the body of the message ---end of quoted text--- -- | / o / /_ _ email: [EMAIL PROTECTED] |/|/ / / /( (_) Bulte Arnhem, The Netherlands To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: bash scripting help/suggestions.
Thanks. That exactly what I needed. It was Sat, 20 Oct 2001 23:44:30 +0200 and I don't really know but somebody said: > On Sat, Oct 20, 2001 at 05:35:45PM -0400, Rod Person wrote: > > man test(1) tells you how to check for a directory (and lots more BTW) > > mkdir -p might also interest you (see the mkdir man page) > > > I'm creating a bash script and I need to know if a directory exists > and if it doesn't create it. So far the only why I can see to determine > if a directory exists is to try to cd to it and if it doesn't exists > trap the error. Is there a better way or a function that I am missing? > If not how do you trap a error in bash, if at all possible. > > > > Rod > > > > http://storm.prohosting.com/osbeef/osbeef.htm > > > > 'musical rhythms can mess with your head...' > > - T La Rock > > "It's your's" > > > > > > To Unsubscribe: send mail to [EMAIL PROTECTED] > > with "unsubscribe freebsd-hackers" in the body of the message > ---end of quoted text--- > > -- > | / o / /_ _ email: [EMAIL PROTECTED] > |/|/ / / /( (_) Bulte Arnhem, The Netherlands Rod http://storm.prohosting.com/osbeef/osbeef.htm 'musical rhythms can mess with your head...' - T La Rock "It's your's" To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: bash scripting help/suggestions.
on Sat, 20 Oct 2001, Rod Person wrote: > I'm creating a bash script and I need to know if a directory exists > and if it doesn't create it. So far the only why I can see to > determine if a directory exists is to try to cd to it and if it > doesn't exists trap the error. Is there a better way or a function > that I am missing? If not how do you trap a error in bash, if at all if [ -d $dir ]; then ; else mkdir $dir; fi > possible. > > Rod > > http://storm.prohosting.com/osbeef/osbeef.htm > > 'musical rhythms can mess with your head...' > - T La Rock > "It's your's" > > > To Unsubscribe: send mail to [EMAIL PROTECTED] > with "unsubscribe freebsd-hackers" in the body of the message > Paul H. "Don't underestimate the power of stupid people in large groups" ___ http://dp.penix.org To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: truss vs ktrace
Arun Sharma <[EMAIL PROTECTED]> writes: > Another advantage of truss is that the output is "online" and interactive. > ktrace requires you to use kdump to view the trace. I certainly wouldn't call truss "interactive". As for "online", see the -l command-line option to kdump. DES -- Dag-Erling Smorgrav - [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: netgraph one2many question
Bill Paul has written a specific NETGRAPH FEC module... he has failover as well.. (it is only PART a netgraph module as it doesn;t use the netgraph hooks to talk to teh ethernet driver.. (strange)) I suggest you look for it in the archives or on http://www.freebsd.org/~wpaul/ On Sat, 20 Oct 2001, Archie Cobbs wrote: > Milon Papezik writes: > > I would like to extend ng_one2many module to include > > automatic link failure datection, failover and FEC functionality. > > > > My question is: > > Are interface nodes able to send upstream notification > > that their state has changed or do I have to poll their status periodically > > as it is done in ng_fec module made kindly available by wpaul ? > > They don't now, but I think you could add this in a reasonably > unoffensive way. > > What you would do is add a new function pointer to struct ifnet, > say "void (*if_report)(struct ifnet *, int status)" or something. > > When a device driver detected link going up/down, it could call > this function (if non-NULL). Then if_ethersubr() would set this > function pointer to point to some function if_ether_report(). > When if_ether_report() is called, if ng_ether was loaded, it > would call into ng_ether() to generate a control message that > would be passed to the node connected to the "lower" hook. > > Then, ng_one2many could be modified to understand this control > message and do the right thing according to its configuration. > > Or, something like that. Polling might be a quicker and easier > though less precise way to do it for starters. > > -Archie > > __ > Archie Cobbs * Packet Design * http://www.packetdesign.com > > To Unsubscribe: send mail to [EMAIL PROTECTED] > with "unsubscribe freebsd-net" in the body of the message > To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: truss vs ktrace
On Wed, 17 Oct 2001 02:02:07 + (UTC), Dag-Erling Smorgrav <[EMAIL PROTECTED]> wrote: > Jim Pirzyk <[EMAIL PROTECTED]> writes: > > So which should I use? Why is there two around? I see that truss has > > less command line switches than ktrace, but it is a little bit more > > standard. > > - truss slows down the slave process a *lot* as the slave process >stops at every syscall and waits for truss to notice, obtain and >process information (a task which in itself requires a bunch of >additional context switches and syscalls) and print its output. >This also means that if you pipe truss through less and don't page >down fast enough, the slave process will hang waiting for truss >which is waitig for less to absorb its output. True, the choice depends on which one meets your debugging needs better. I find the performance of truss usually adequate for my purposes. > > - truss currently can't follow forks and trace children of the >original process. This should be fixable, though. > This has been taken care of: http://www.sharma-home.net/~adsharma/projects/freebsd/truss.diff.gz http://www.sharma-home.net/~adsharma/projects/freebsd/truss.tar.gz The above patch supports fork as well as rfork, so can be used with libraries using rfork for pthread implementations. Another advantage of truss is that the output is "online" and interactive. ktrace requires you to use kdump to view the trace. -Arun To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: truss vs ktrace
Robert Watson <[EMAIL PROTECTED]> writes: > There are a fair number of differences, but from my perspective, one of > the primary ones is that truss relies on procfs, Truss could be easily be rewritten to use ptrace() instead of procfs. It'd be a lot slower though, because ptrace() can only return one int at a time from process memory whereas with /proc/pid/mem you can read as much as you want in one go. DES -- Dag-Erling Smorgrav - [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message