Linux-Development-Sys Digest #739, Volume #8     Tue, 22 May 01 02:13:08 EDT

Contents:
  Via / Cyrix MIII processor problems (Jeremy Savoy)
  timer->prev used to deterimine if timer active? (Grant Edwards)
  Re: realloc problem (Bernd Strieder)
  Re: Newbie hoping to install C++ on RedHat 7.1 ("Dono")
  Re: Raid A0 patch with Kernel 2.2.17 and ReiserFS ("Cristov")
  Re: Trouble using large amount of memory with Redhat 7 ("J. P. Montgomery")
  Re: Trouble using large amount of memory with Redhat 7 ("Karl Heyes")
  Re: Best PC config for linux/crosscompiler development (John Beardmore)
  Re: debugging init function in shared library? ("Paul Pluzhnikov")
  Re: Trouble using large amount of memory with Redhat 7 ("J. P. Montgomery")
  How to find system and user memory used? (Jiying Yin)
  Re: How to find system and user memory used? ("Kyle Brant")
  Re: PID and fork() (Lew Pitcher)
  Re: driver for Bluetooth (Juha Ruismäki)

----------------------------------------------------------------------------

From: Jeremy Savoy <[EMAIL PROTECTED]>
Subject: Via / Cyrix MIII processor problems
Date: Mon, 21 May 2001 21:11:58 GMT

I am having trouble using a Cyrix MII processor with Linux. The 2.4.4 
kernel has support for this processor build directly in, you can select 
it as one of the processor types. Using kgcc to build the kernel, it 
will hang where it should be passing control over to init every time. I 
also happened to notice that the kernel thinks the CPU has 16M of L2 
cache which is of course no where close to correct. Anyone seen anything 
like this??


Jeremy Savoy
IBM - Retail Store Solutions
[EMAIL PROTECTED]


------------------------------

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: timer->prev used to deterimine if timer active?
Date: Mon, 21 May 2001 21:28:17 GMT

I'm porting a driver from 2.2 to 2.4, and I've run into
the following bit of code:

static void xxxx_set_timer(struct xxxx *p, int ticks)
  {
    unsigned long new_time;
    
    if (!p->timer.prev)
      {
        p->timer.expires = jiffies + ticks;
        add_timer(&p->timer);
        return;
      }
      
    new_time = jiffies + ticks;
    if (p->timer.expires == new_time)
      return;
    
    if ((p->timer.expires - jiffies) > ticks)
      {
        del_timer(&p->timer);
        p->timer.expires = new_time;
        add_timer(&p->timer);
      }
  }

I believe that the timer.prev field is being used to determine
if the timer is currently "in use".  If it isn't then it's
added.  Otherwise if the timer is running AND it's going to
expire farther in the future than we want, it's deleted, a new
expire time is set, and it's added back.

The "prev" field has gone away.

Does the timer_pending() macro in timer.h fill the shoes of the
(timer.prev != NULL) test?

I think I'm also going to change it to use mod_timer()...

-- 
Grant Edwards                   grante             Yow!  As a FAD follower,
                                  at               my BEVERAGE choices are
                               visi.com            rich and fulfilling!

------------------------------

From: Bernd Strieder <[EMAIL PROTECTED]>
Subject: Re: realloc problem
Date: Mon, 21 May 2001 23:42:49 +0200

enib wrote:
> 
> Hello!
> My problem is: i wrote a function replacing all occurances of a pattern in a
> memoryblock with another string.
> To save memory i do it with realloc. It seems, it works, but i get the
> obscure phenomenon that if i call the function once on buffer and then a
> second time, the realloc-function(not writing/reading in the realloced
> memory, the reallocating on itself) causes the program to exit with
> "Speicherzugriffsfehler", i think "memoryaccess-error" in english. I think
> it comes from the system, because the prgram leaves immediately. system is:
> suse linux 6.1, kernel 2.2xxx. The funny thing is, if the memory block is
> really huge, no problem, everything works, only if it's small the error
> occurs(perhaps because the Pointer won't change for small new blocks?!?) .
> If i try to realloc a few, eg 20, bytes more, there is no error. why?!?
> Where is the difference between reallocating eg 220 Bytes or 200 Bytes?
> Please help me, i have no more ideas and think, the algorithm works.

I think it's a typical error with C strings. After reallocing a C string
might have lost the 0 byte at its end, especially if the old end is
lost. There is no place in your code that produces NUL chars. You seem
to reconstruct the strings with memmove while using the strn...
functions to not run out of your strings, so nothing happens here at
first. Use a debugger to carefully look at your strings, whether they
are really terminated with 0 (NUL). Perhaps it is enough to increase the
respective lenght variables by one to have the NUL chars memmoved, too.

Besides that, your code is inefficient or overcomplicated for the
following reasons.

* In some cases you search the pattern occurrences twice, while doing it
once should be sufficient.

* The end of your string is copied much too often. When done right,
every char needs to be copied at most once in this function.

* Whether the buffer has to be made larger or smaller depends purely on
the lengths of the pattern and the replacement.

* What if the pattern and the replacement have the same length? Is
reallocing necessary?


Some further suggestions:

* By allocating buffers with their sizes tailored exactly to the used
length you might run into memory fragmentation problems. Try to use only
sizes of powers of two, i.e. doubling the size when necessary, and
halving the size when less than some fraction below 50% is used. Then
only a few different sizes occurs which makes the blocks easily
reusable. In worst-case the double amount of memory is used, but with
fragentation the situation can be worse. Copying costs are reduced, when
avoiding realloc.

* If you want to improve your code by some order of magnitude, look for
the Boyer-Moore or Knuth-Morris-Pratt algorithms, especially if you use
the pattern repeatedly or if you often search pattern of substantial
length. If you want to search many pattern at once use tries or even
suffixtrees or any kind of dictionary, there are many.


Bernd Strieder

------------------------------

From: "Dono" <[EMAIL PROTECTED]>
Subject: Re: Newbie hoping to install C++ on RedHat 7.1
Date: Mon, 21 May 2001 22:13:54 GMT

Thank Gene.  Everything works great now.  Now if I could just remember
how to play with pointers again......................  BTW, my daughter
thanks you to, you made her day.........



>"Gene Heskett"
>[EMAIL PROTECTED]> wrote:


> Gene Heskett sends Greetings to Dono ;
>> My daughter who is majoring in computer science & math is looking to
>> compile her C++ programs on RedHat 7.1   (She wants to get a feel for
>> Linux and to get away from Windows.) The following packages have been
>> installed: KDevelop-1.4.1-2 glibc-devel-2.2.2-10 kdelib-devel-2.1.1-5
>> kdesupport-devel-2.1-2 gcc-2.96-81
> 
>> So far all is well using KDevelop 1.4 and compiling C, but no luck with
>> C++ with the following errors,
> 
>> checking how to run the C preprocessor... gcc -E checking for a
>> C++-Compiler...
>> checking for g++... g++
>> checking whether the C++ compiler (g++  -O0 -g3 -Wall      ) works...
>> no configure: error: installation or configuration problem: C++
>> compiler cannot  create executables. *** failed ***
> 
>> I apologize if I'm using the wrong terminology but any help would be
>> appreciated.    I thought that I read that GCC version 2 or higher
>> supplied the C++ compiler.
> 
>> What package supplies the C++ compiler? TIA.
> Go to redhat, rawhide directory, and find ALL packages with the
> 2.96-85.i386.rpm portion of their name.  Download and install all of
> them.
> IIRC thats
> c++
> gcc
> gcc-*
> libstdc++*
> about 6 packages total.  Oh, and don't forget the kernel_headers if
> you're gonna work on kernels.
> Cheers, Gene

------------------------------

From: "Cristov" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.setup
Subject: Re: Raid A0 patch with Kernel 2.2.17 and ReiserFS
Date: Mon, 21 May 2001 14:37:03 -0700

No offense but I would have rather of got responses for my question... not
some other thread that really didn't have any insight into what was asked.



<[EMAIL PROTECTED]> wrote in message
news:tQGM6.870$[EMAIL PROTECTED]...
> I'll add another question to the thread. 2 of the developers I work with
say
> that reiserFS should be used for development because it is more robust
then
> ext2 and in the embedded system we are developed, the power frequently is
> removed from the target system running Linux. As a consequence of the fact
> that power can be removed at any time, there is no graceful shutdown of
this
> system. I am told by one of the developers that reiserFS will be the new
> default file system in the next release of Linux. I wonder what some of
the
> developers here have to say about reiserFS and its reliability in a
> situation where power can and will be removed frequently from an embedded
> system.
>
> "Cristov" <[EMAIL PROTECTED]> wrote in message
> news:9duai2$[EMAIL PROTECTED]...
> > Does the Raid A0 patch for the 2.2.17 kernel fix whether or not ReiserFS
> > will work with Raid5?
> >
> > Chris
> >
> >
> >
>
>



------------------------------

From: "J. P. Montgomery" <[EMAIL PROTECTED]>
Subject: Re: Trouble using large amount of memory with Redhat 7
Date: Mon, 21 May 2001 19:05:43 -0500

This didn't work ...

But I do have more information of the problem.

I am running kernel 2.2.16-22 normally since I have a single processor
machine.  Today, I went ahead and booted on the smp version, even with one
processor.  When I did this, all of the 1.5 G memory was not recognized ...
instead only 885M was recognized.  However, when I ran the f90 code that
allocates memory, it ran all the way to 2048M just as I would expect.
Similarly,  the f77 version using just a dimension statement was able to get
just 892M ... even though I have a VM file of 2G.

Recall that when I use the non-SMP version, that the f90 code would only
allocate 1365M while the f77 version will only go to about 549M.

Does anyone have any suggestions?  Should I use a more recent kernel?
Should I recompile with some of the parameters set appropriately?  I am at a
loss.  I now tend to believe that this is really an OS problem and after
using Linux for 5 years this is the 1st time that I have really been
frustrated with the OS.  I am even thinking about using a Win2000 compiler!
(Heaven forbid!)

HELP!

Thanks,
Pat
"Anthony Pioli" <[EMAIL PROTECTED]> wrote in message
news:aiXN6.9873$[EMAIL PROTECTED]...
> In article <9e20mq$avo$[EMAIL PROTECTED]>, "J. P. Montgomery"
> <[EMAIL PROTECTED]> wrote:
>
> Just a suggestion - try to compile without optimizations turned on
> and see what happens. Could be a bug in the optimizer.



------------------------------

From: "Karl Heyes" <[EMAIL PROTECTED]>
Subject: Re: Trouble using large amount of memory with Redhat 7
Date: Tue, 22 May 2001 02:47:04 +0100

In article <9ec6kg$7jj$[EMAIL PROTECTED]>, "J. P. Montgomery"
<[EMAIL PROTECTED]> wrote:


> This didn't work ...
> But I do have more information of the problem.  I am running kernel
> 2.2.16-22 normally since I have a single processor machine.  Today, I went
> ahead and booted on the smp version, even with one processor.  When I did
> this, all of the 1.5 G memory was not recognized ... instead only 885M was
> recognized.  However, when I ran the f90 code that allocates memory, it ran
> all the way to 2048M just as I would expect. Similarly,  the f77 version
> using just a dimension statement was able to get just 892M ... even though I
> have a VM file of 2G.  Recall that when I use the non-SMP version, that the
> f90 code would only allocate 1365M while the f77 version will only go to
> about 549M.  Does anyone have any suggestions?  Should I use a more recent
> kernel? Should I recompile with some of the parameters set appropriately?  I
> am at a loss.  I now tend to believe that this is really an OS problem and
> after using Linux for 5 years this is the 1st time that I have really been
> frustrated with the OS.  I am even thinking about using a Win2000 compiler!
> (Heaven forbid!)
> HELP

First point, you have a memory detection issue.  Linux determines how much
memory you have from the BIOS, however there's many ways to determine
the value. The BIOS tends to be stupid that way.   2.2.16 may not have all
the known interfaces to the BIOS for your machine for memory detection. try 
2.2.19.

Detection of RAM size is different from process VM.  The process VM is 2G (it
can be altered to 3:1 instead of 2:2 ratio).  The problem sounds to be in the
compilation.  What version of  the compilers are you using. Are you using old
libc or glibc for the fortran?

run

strace -o output.txt <compiled program>

and look at the output.txt file.

karl.

------------------------------

From: John Beardmore <[EMAIL PROTECTED]>
Subject: Re: Best PC config for linux/crosscompiler development
Date: Tue, 22 May 2001 02:50:56 +0100

In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes
>In article <[EMAIL PROTECTED]>,
>John Beardmore  <[EMAIL PROTECTED]> wrote:
>
>>As I recall, GNU make won't compile in parallel, a huge defect in my
>>view,
>
>Have you tried "make -j"?

Ahh !  Dead good !

Thanks all !  Things have moved on !

Now, if on the ISDN drivers would work with more than one CPU in the
box !!


Cheers, J/.
-- 
John Beardmore

------------------------------

From: "Paul Pluzhnikov" <[EMAIL PROTECTED]>
Subject: Re: debugging init function in shared library?
Date: Tue, 22 May 2001 03:15:06 GMT

"John Reiser" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> > hello, how can I use gdb to set a break point in the init function
> > in a shared library loaded by my program?
>
> gdb-5.0 won't do that.  Workaround: hardcode a breakpoint into the

Actually, there is an easier way that works for many gdb/glibc/ld-so
combinations:

gdb /bin/date
(gdb) set stop-on-solib-event 1
(gdb) run
Stopped due to shared library event
(gdb) info shared
>From        To          Syms Read   Shared Object Library
0x4001a000  0x4010e85c  Yes         /lib/libc.so.6
0x40000000  0x40013ed0  Yes         /lib/ld-linux.so.2
(gdb) b _init
Breakpoint 1 at 0x4003277c: file ../sysdeps/unix/sysv/linux/init-first.c,
line 57.
(gdb) c
Breakpoint 1, _init (arg=0x1) at ../sysdeps/unix/sysv/linux/init-first.c:57
  ../sysdeps/unix/sysv/linux/init-first.c: No such file or directory



------------------------------

From: "J. P. Montgomery" <[EMAIL PROTECTED]>
Subject: Re: Trouble using large amount of memory with Redhat 7
Date: Mon, 21 May 2001 23:39:53 -0500

Certainly, the BIOS recognizes the memory ... at least it checks it.  When
using the non-SMP kernel, top and free (and other ways to indicate memory)
all indicate that I have 1.5G of memory and 2G of swap.  Clearly, there is a
memory detection issue with the SMP kernel ... but then this is the only
time I've ever booted into this kernel ...  The main thing I was noting here
was that the f90 program acquired up to 2G rather than just the 1365 by the
non-SMP kernel.  Of course, when I checked the limits using ulimit, the
memory and file parameters were set at 4G ... so why wouldn't the f90
program acquire close to 3.5 G (the 1.5G ram and the 2G  swap - minus any
locked memory)?

Incidently, when I run the SMP at home on my dual PPRO with 128 ram and 128
swap ... and the same kernel ... everything works as expected and the
results are the same for both the f77 and f90 versions of the test code.  Of
course, 128M is a far cry from 1.5 G.

What parameters (other than the normal ones that the shell commands give me
access to) should I be looking for if I recompile the kernel (which I
haven't done in quite a while ...)

Thanks for you help ...

I'll report tomorrow after further experiments as suggested ...

Pat


"Karl Heyes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> In article <9ec6kg$7jj$[EMAIL PROTECTED]>, "J. P. Montgomery"
> <[EMAIL PROTECTED]> wrote:
>
>
> > This didn't work ...
> > But I do have more information of the problem.  I am running kernel
> > 2.2.16-22 normally since I have a single processor machine.  Today, I
went
> > ahead and booted on the smp version, even with one processor.  When I
did
> > this, all of the 1.5 G memory was not recognized ... instead only 885M
was
> > recognized.  However, when I ran the f90 code that allocates memory, it
ran
> > all the way to 2048M just as I would expect. Similarly,  the f77 version
> > using just a dimension statement was able to get just 892M ... even
though I
> > have a VM file of 2G.  Recall that when I use the non-SMP version, that
the
> > f90 code would only allocate 1365M while the f77 version will only go to
> > about 549M.  Does anyone have any suggestions?  Should I use a more
recent
> > kernel? Should I recompile with some of the parameters set
appropriately?  I
> > am at a loss.  I now tend to believe that this is really an OS problem
and
> > after using Linux for 5 years this is the 1st time that I have really
been
> > frustrated with the OS.  I am even thinking about using a Win2000
compiler!
> > (Heaven forbid!)
> > HELP
>
> First point, you have a memory detection issue.  Linux determines how much
> memory you have from the BIOS, however there's many ways to determine
> the value. The BIOS tends to be stupid that way.   2.2.16 may not have all
> the known interfaces to the BIOS for your machine for memory detection.
try
> 2.2.19.
>
> Detection of RAM size is different from process VM.  The process VM is 2G
(it
> can be altered to 3:1 instead of 2:2 ratio).  The problem sounds to be in
the
> compilation.  What version of  the compilers are you using. Are you using
old
> libc or glibc for the fortran?
>
> run
>
> strace -o output.txt <compiled program>
>
> and look at the output.txt file.
>
> karl.



------------------------------

From: [EMAIL PROTECTED] (Jiying Yin)
Subject: How to find system and user memory used?
Date: 22 May 2001 14:43:58 +1000
Reply-To: [EMAIL PROTECTED]

Hi, there.
I just use short time Linux (RedHat6.2). I want to know
how to know how much system memory used and user memory
used.

Thanks!
Jiying


------------------------------

From: "Kyle Brant" <[EMAIL PROTECTED]>
Subject: Re: How to find system and user memory used?
Date: Tue, 22 May 2001 00:29:44 -0500

Take a look at the sysinfo system call if you are writing a program.
Gtop or ktop for programs that report such info (I think).

--
Best regards,
Kyle
cut.s.p.a.m.m.e.n.o.t. from email address to reply
Software Homepage:  http://msnhomepages.talkcity.com/CerfSt/kylesb/
K6Speed home page:
http://msnhomepages.talkcity.com/CerfSt/kylesb/k6speed.htm


"Jiying Yin" <[EMAIL PROTECTED]> wrote in message
news:9ecqqe$[EMAIL PROTECTED]...
| Hi, there.
| I just use short time Linux (RedHat6.2). I want to know
| how to know how much system memory used and user memory
| used.
|
| Thanks!
| Jiying
|


------------------------------

From: Lew Pitcher <[EMAIL PROTECTED]>
Subject: Re: PID and fork()
Date: Tue, 22 May 2001 05:46:19 GMT

Alessandro oVeRRiDe wrote:
> 
> If i do:
> pid=fork();
> in pid i get the value 0 if the child process was created correctly, -1
> otherwise. That's rigth, 'cos those are the two values returned in child's
> thread of execution but... how do i get child's PID? Man says thaty it is
> returned in parent's thread of execution (???)... help please!

  {
    pid_t pid;

    switch(pid = fork())
    {
       case -1: /* in parent, cant fork */
          perror("Fork out of tune\n");
          break;

       case 0:  /* in child, fork worked */
          printf("Child is active\n");
          break

       default: /* in parent, fork worked */
          printf("Child's PID is %d\n",(int) pid);
          break;
    }
  }


-- 
Lew Pitcher

Master Codewright and JOAT-in-training
Registered Linux User #112576

------------------------------

From: Juha Ruismäki <[EMAIL PROTECTED]>
Subject: Re: driver for Bluetooth
Date: Tue, 22 May 2001 09:00:18 +0300

gary zhu wrote:
> 
> Does anybody know where can I find the device driver for Bluetooth
> PC-card?
> Any help highly appreciated!

You might want to check following URL:
<http://developer.axis.com/software/bluetooth/>

Juha

------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list by posting to the
comp.os.linux.development.system newsgroup.

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Development-System Digest
******************************

Reply via email to