unsubscribe freebsd-hackers
freebsd-hackers-digest wrote:
> freebsd-hackers-digestSaturday, March 25 2000Volume 04 : Number 792
>
> In this issue:
> Re: shell issue
> Re: top sorting error
> zsh compdef collection for FreeBSD
> Missing keyboard symbols
> Re: top sorting error
> 3.x -> 4.x kernel config converter
> Re: zsh compdef collection for FreeBSD
> Re: Missing keyboard symbols
> Re: Missing keyboard symbols
> Re: zsh compdef collection for FreeBSD
> Re: Missing keyboard symbols
> Re: WaveLAN PCI Adapter
> Re: Possible bug in 3.4
> Re: 3.x -> 4.x kernel config converter
> Dreamweaver 2
> Comments above kmem_malloc() (vm/vm_kern.c)
> Re: Dreamweaver 2
> Re: Unicode on FreeBSD
> Re: Unicode on FreeBSD
> Request for review (HW checksum patches)
> Shim Code #error needed
>
> --
>
> Date: Fri, 24 Mar 2000 12:19:32 -0800
> From: Alfred Perlstein <[EMAIL PROTECTED]>
> Subject: Re: shell issue
>
> * Dungeonkeeper <[EMAIL PROTECTED]> [000324 10:03] wrote:
> >
> >
> > Hi there,
> >
> > First of all: I want to apologise for my poor english.
> >
> > Today me and a few friends of mine discussed the shells' (well, shell is
> > actualy one of: sh/bash/csh/tcsh... not tested for ksh) command line expansion
> > routines, mainly because of a problem discovered by one of my friends. I'm not
> > sure if this is something new... So, let me explain what he found. It seems
> > that the shell wants to allocate enough memory to hold the entire command line
> > when expanding all of the arguments and we can force it to allocate hudge
> > ammount of memory with a tricky command like this:
> >
> > carnivoro# /bin/csh -c `cat /dev/urandom`
> >
> > (I use tcsh here (the carnivoro# prompt), but the same thing happens when
> > testing with sh/bash/tcsh) In this situation, the shell tries to allocate enough
> > memory to hold what it
> > reads from /dev/urandom, because it must be passed as a command line argument
> > to /bin/csh ( actually, any command will be ok ). So, the shell eats more and
> > more memory (on my machine (3.4-STABLE) - 251 MB) before the kernel decided to
> > take some action (like killing some processes... started by other users?
> > system services? or... in my case... crash :). My friend said that he sent a
> > mail to bugtraq describing this problem. Those who are interested can read it.
> >
> > I believe that the shells have a maximum command lenght, so... I'm trying now
> > to make the shell use the same command lenght when expanding such commands. I
> > think this is the best way to avoid this problem. Any ideas?
>
> Yes, that's a good idea, I'd file a problem report with send-pr and
> it will probably be addressed.
>
> thanks,
> - -Alfred
>
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message
>
> --
>
> Date: Fri, 24 Mar 2000 20:04:21 +
> From: David Malone <[EMAIL PROTECTED]>
> Subject: Re: top sorting error
>
> On Fri, Mar 24, 2000 at 01:00:54PM -0500, Luke Hollins wrote:
>
> > I don't know if this is specific to FreeBSD but I just noticed it when i
> > picked o time in top:
> >
> > PID USERNAME PRI NICE SIZERES STATETIME WCPUCPU COMMAND
> > 79364 root2 0 2696K 1636K select 8:23 0.00% 0.00% apache
> > 235 mysql 2 0 13372K 6384K poll 361:14 0.15% 0.15% mysqld
>
> It seems to be an overflow problem - top was reilying on things
> fitting into a int, which were 64 bits long. It looks like someone
> ran into the problem before for the %cpu field, and fixed it in a
> different way. This patch below should fix it regardless of the
> type of the variable.
>
> It's for a file in /usr/src/usr.bin/top.
>
> David.
>
> - --- machine.c.origFri Mar 24 19:57:36 2000
> +++ machine.c Fri Mar 24 19:58:17 2000
> @@ -737,26 +737,26 @@
> 4 /* stop */
> };
>
> +#define CMP(a,b) ( (a) == (b) ? 0 : (a) < (b) ? -1 : 1 )
>
> #define ORDERKEY_PCTCPU \
> - - if (lresult = (long) PP(p2, p_pctcpu) - (long) PP(p1, p_pctcpu), \
> - - (result = lresult > 0 ? 1 : lresult < 0 ? -1 : 0) == 0)
> + if ((result = CMP(PP(p2, p_pctcpu),PP(p1, p_pctcpu))) == 0)
>
> #define ORDERKEY_CPTICKS \
> - - if ((result = PP(p2, p_runtime) - PP(p1, p_runtime)) == 0)
> + if ((result = CMP(PP(p2, p_runtime),PP(p1, p_runtime))) == 0)
>
> #define ORDERKEY_STATE \
> - - if ((result = sorted_state[(unsigned char) PP(p2, p_stat)] - \
> - -sorted_state[(unsigned char) PP(p1, p_stat)]) == 0)
> + if ((result = CMP(sorted_state[(unsigned char) PP(p2, p_stat)], \
> +sorted_state[(unsigned char) PP(p1, p_stat)])) == 0)
>
> #define ORDERKEY_PRIO \
> - - if ((result = PP(p2, p_priority) - PP(p1, p_priority)) == 0)
> + if ((result = CMP(PP(p2, p_priority),PP(p1, p_priority))) == 0)
>
> #define ORDERKEY_RSSIZE \
> - - if ((result = VP(p2, vm_rssize) - VP(p1, vm_rssize)) =