Linux-Development-Sys Digest #632, Volume #7     Mon, 28 Feb 00 06:13:14 EST

Contents:
  Re: How debug linux modules (Derek Callaway)
  Re: lowlevel and highlevel hardware access (Chetan Ahuja)
  Re: complex math in a device driver ([EMAIL PROTECTED])
  clone() and shared library heap allocations ("Frank V. Castellucci")
  Is there a trick to starting gnu emacs? ("Lord Petrosky")
  Re: Memory Mapping problem (pramodh mallipatna)
  Re: complex math in a device driver (Charles Bryant)
  clone threads... ("Vitaliy Rabotnik")
  Re: clone threads... ("Vitaliy Rabotnik")
  Re: Is there a trick to starting gnu emacs? ("jeff")
  Re: clone threads... (Derek Callaway)
  Re: 2.2.x SMP and DK440LX issues (Dmitri A. Sergatskov)
  2.0.38 kernel for RH6.1 system (Dmitri A. Sergatskov)
  Odd cua0 vs. ttyS0 bug from gpm w/kernel 2.2.14 (Larry Morley)
  Re: Debugging application using pthread (Andrzej Popowski)
  Re: glibc development language (Stefaan A Eeckels)
  Re: Odd cua0 vs. ttyS0 bug from gpm w/kernel 2.2.14 ([EMAIL PROTECTED])

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

From: Derek Callaway <[EMAIL PROTECTED]>
Subject: Re: How debug linux modules
Date: 27 Feb 2000 20:22:50 GMT

Hernan <[EMAIL PROTECTED]> wrote:
> i want learn how to write linux network devices drivers, so i want trace
> a module to look how it work, if any body know how it work i apreciate
> your help                                     Thanks Hernan

I've been struggling with LKM debugging, too. AFAICT, if you load a Linux kernel
into user space with a tool such as VMWare, (there's similar software
available, I'm sure) you won't have to fight against kernel panics and
other odd behavior. I'm not _exactly_ sure how this works, though; maybe
someone could elaborate on this particular technique or other methods of
module and kernel debugging...

--
/* Derek Callaway <[EMAIL PROTECTED]> char *sites[]={"http://www.geekwise.com", 
   Programmer; CE Net, Inc. "http://www.freezersearch.com/index.cfm?aff=dhc",
   (302) 837-8769           "http://www.homeworkhelp.org",0};  S@IRC  */

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

From: Chetan Ahuja <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.help
Subject: Re: lowlevel and highlevel hardware access
Date: 27 Feb 2000 20:40:14 GMT

BerryBear <[EMAIL PROTECTED]>  spoke thusly:
> I'd like to understand hardware access in Linux. How does it work?
> What are the different possibilities of accessing hardware like
> printers, scanner, gamepads, soundcards, keyboard, graphic cards and
> mice.
> Please tell me where I can find information and (good) libraries related
> to that problem. I've spent a lot of money searching for information in
> the internet :-(

> berrybear

  Your best bet probably is to buy the book Linux Device Drivers by
Alessandro Rubini. It talks mainly about writing device drivers for
the 2.0 kernel but it does take some cognizance of the changes made in
2.1 series (and thus some changes in the stable 2.2 series) It's a
well written book and not too expensive. Published by  O'Reilly.

   There're also a few "books" available on the internet dealing with
the linux kernel and device driver writing. Go to www.linuxdocs.org
and look in the "guides" section.

    Chetan
    



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

From: [EMAIL PROTECTED]
Subject: Re: complex math in a device driver
Date: Sun, 27 Feb 2000 20:51:03 GMT

On Sat, 26 Feb 2000 20:50:35 GMT Grant Edwards <[EMAIL PROTECTED]> wrote:

|>Why should you use math in a device driver?
|
| To provide a layer of abstraction.  For example, if I have a set of
| analog inputs, and I make an IOCTL call to read the voltages, it's
| awfully nice to get answers in volts.  That way the driver has to keep
| track of the peculiarities of the hardware rather than the user
| software.  Much like SCSI hides the whole cylinders, heads, sectors
| stuff from the user program, it would be nice if device drivers could
| hide the ugly details of A/D and D/A hardware from the user.

I just thought about some uses for A/D and D/A hardware, and realized
that the way you are suggesting the abstraction may be a poor design.
Getting data from an A/D convert, or providing data to a D/A converter,
should be a stream of data, not a bunch of ioctl() calls.  That stream
then needs to be portable across multiple platforms, and hence not use
a binary data format unless the binary data format is specifically
defined in a definition of the format/protocol.

If you design a protocol that includes command codes, response codes,
as well as data, then you can easily do this over a network, and would
not be limited to just running the analysis program on the same computer
as the hardware is on.  You might be wanting to run some very extensive
analysis but it might be convenient to have the hardware on a cheaper
and older machine.  You may also want to control more than one A/D or
D/A device in the same stream (in much the same way as an audio wave
file has left and right channels, although this protocol should be
smarter than an audio wave file).

Personally, I'd rather use integer arithment where possible, anyway.
But floating point will work the right way, and large data blocks of
complex state can be managed in a process space library better.  That
is where to do it.

-- 
| Phil Howard - KA9WGN | for headlines that | Just say no to absurd patents |
| [EMAIL PROTECTED] | really matter:     | Boycott Amazon.Com (AMZN)     |
| Dallas - Texas - USA | linuxhomepage.com  | Shop http://bn.com/ instead   |

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

Date: Sun, 27 Feb 2000 18:15:27 -0500
From: "Frank V. Castellucci" <[EMAIL PROTECTED]>
Subject: clone() and shared library heap allocations


// --------- in shared library header

class B
{
public:

   B( void );



   void *method( int a );

private:

    void *buffer;

};

// -------- in shared library source

B::B( void )
{
   buffer = new char[200];   
}

void *B::method( int a )
{
   return &buffer[a];
}

// ------- in executable source

  B aObject;

int main( void )
{
  clone(threadFunc,,CLONE_VM | ...,(void *)&aObject);

}

int threadFunc( void *arg )
{
   B *aObjectInstance = (B *)arg;

   printf("Child address from B::method =
%x\n",aObjectInstance->method(0));
};

// -------- output


Child address from B::method = (nil)


All code (library and executable) are compiled with -D_REENTRANT. I
removed all other code for the example, semaphores, etc.


-- 
Frank V. Castellucci
http://corelinux.sourceforge.net
OOA/OOD/C++ Standards and Guidelines for Linux

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

From: "Lord Petrosky" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.setup,comp.os.linux.misc
Subject: Is there a trick to starting gnu emacs?
Date: Sun, 27 Feb 2000 19:02:38 -0500

hey,

after using redhat's rpm on emacs and emacs-nox and verifying they are
installed i check whereis emacs and i get a few paths.  after exporting them
to my PATH typing emacs doesn't give any result except a msg stating no
command found.  i installed another app from rpm just to make sure my method
was sound and that one worked.  my emacs version is 20.13 release 9 i
believe.  i tried from two separate cd's with the same result.

any ideas?

LP



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

From: pramodh mallipatna <[EMAIL PROTECTED]>
Subject: Re: Memory Mapping problem
Date: 28 Feb 2000 00:56:43 GMT

Hi Rob,

If I allocate a PAGE_SIZE worth of memory, is it possible that it is
allocated in chunks which are spread out across different physical
pages?

I am asking this because, in the page I am getting, I can only see about 
1K of my data..it starts from the middle of a page pointer (I get from
the way I described in my other mail) and spans across one more page.
But, I was expecting to see atleast 4K (PAGE_SIZE) of contiguous data.
But, it does not seem so.

If this is true, how do I get hold of all my actual contents?

Thanks,
Pramodh

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

From: Charles Bryant <[EMAIL PROTECTED]>
Subject: Re: complex math in a device driver
Date: 28 Feb 2000 01:17:51 -0000

In article <[EMAIL PROTECTED]>,
Grant Edwards <[EMAIL PROTECTED]> wrote:
... floating point in driver ...
>Much like SCSI hides the whole cylinders, heads, sectors
>stuff from the user program, it would be nice if device drivers could
>hide the ugly details of A/D and D/A hardware from the user.

I would suggest you represent the values by fractions in the range
[0..1) so a 32-bit maximum value is 0xffffffff. This has the nice
property that an N-bit A/D value is simply the topmost N bits in a
word, making the conversion between device-dependent and
device-independent representations no more than one shift instruction.

-- 
Eppur si muove


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

From: "Vitaliy Rabotnik" <[EMAIL PROTECTED]>
Subject: clone threads...
Date: 28 Feb 2000 01:10:08 GMT



--
======================================================================
Vitaliy Rabotnik
Carleton University
Computer Science III (Software and Computing, Co-op)
WWW: http://chat.carleton.ca/~vrabotni
======================================================================

                   The truth is out there...

======================================================================



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

From: "Vitaliy Rabotnik" <[EMAIL PROTECTED]>
Subject: Re: clone threads...
Date: 28 Feb 2000 01:10:46 GMT


Could anyone show an example of use of the clone system call?

I need to implement the "dinning philosophers problem" using threads in
Linux OS.
I was told to use clone method to create threads, but I need to see  an
example how it is done...
Thank you.


> ----------------------------------------------------------------------
> Vitaliy Rabotnik
> Carleton University
> Computer Science III (Software and Computing, Co-op)
> WWW: http://chat.carleton.ca/~vrabotni
> ----------------------------------------------------------------------
>
>                    The truth is out there...
>
> ----------------------------------------------------------------------
>
>



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

From: "jeff" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.setup,comp.os.linux.misc
Subject: Re: Is there a trick to starting gnu emacs?
Date: Sun, 27 Feb 2000 17:34:19 -0800

Don't know much about RedHat, but have you tried to cd to the emacs
directory, and exec with ./emacs?  If even that fails, my guess is that
you're missing a common lib module, or some such - though I thought RPMs
prevented such failures.

Jeff

"Lord Petrosky" <[EMAIL PROTECTED]> wrote in message
news:57ju4.81$[EMAIL PROTECTED]...
> hey,
>
> after using redhat's rpm on emacs and emacs-nox and verifying they are
> installed i check whereis emacs and i get a few paths.  after exporting
them
> to my PATH typing emacs doesn't give any result except a msg stating no
> command found.  i installed another app from rpm just to make sure my
method
> was sound and that one worked.  my emacs version is 20.13 release 9 i
> believe.  i tried from two separate cd's with the same result.
>
> any ideas?
>
> LP
>
>



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

From: Derek Callaway <[EMAIL PROTECTED]>
Subject: Re: clone threads...
Date: 28 Feb 2000 02:55:20 GMT

Vitaliy Rabotnik <[EMAIL PROTECTED]> wrote:

> Could anyone show an example of use of the clone system call?

> I need to implement the "dinning philosophers problem" using threads in
> Linux OS.
> I was told to use clone method to create threads, but I need to see  an

I suggest using a library that does the clone() calls for you like
libpthread (POSIX threads).

> example how it is done...
> Thank you.

The source of linuxthreads (available with glibc) has quite a few
examples, although they may be a bit obscure.

--
/* Derek Callaway <[EMAIL PROTECTED]> char *sites[]={"http://www.geekwise.com", 
   Programmer; CE Net, Inc. "http://www.freezersearch.com/index.cfm?aff=dhc",
   (302) 837-8769           "http://www.homeworkhelp.org",0};  S@IRC  */

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

From: [EMAIL PROTECTED] (Dmitri A. Sergatskov)
Crossposted-To: comp.os.linux.hardware
Subject: Re: 2.2.x SMP and DK440LX issues
Date: 28 Feb 2000 08:03:06 GMT

On 26 Feb 2000 08:10:38 GMT, jwk <[EMAIL PROTECTED]> wrote:
>On Sat, 26 Feb 2000 00:42:23 -0800, Robert Redelmeier
><[EMAIL PROTECTED]> wrote:
>>Dmitri A. Sergatskov wrote:
>>> Alan Cox thinks that I have a problem with scheduling and the task get
>>> (excessively) bounced between two CPUs. So, I guess, the system time
>>> does come from scheduler.
>>
>>Why?  IIRC, CPU task migration is inhibited by a fairly heavy penalty
>>in the scheduler.  If you run two copies of the task, do you still 
>>see the same system overhead? 
>>
>There has recently been discussion on the kernel mailing list that this
>penalty is in fact not severe enough. This has been corrected in the
>last 2.3.4x kernels, IIRC.
>
>Jurriaan
>

I tried to increase PROC_CHANGE_PENALTY in  include/asm-i386/smp.h
from 15 to 45 (2.2.15 rh6.2b kernel) w/o noticeable difference.

I was not able to compile 2.0.38 on RH6.1 system - it fails on 'make dep'.

I tried 2.3.18 and it _DID_ reduce the system time for my little
benchmark to almost 0. BUT it _DID_ increase the user time by approx. 30%!
Matlab benchmark:

Computer                Loops           LU      Sparse

LX m/b (333 MHz)         0.92           0.72    0.81
BX m/b (333 MHz)         0.62           0.70    0.62

Here is an excerpts from bench.m:

%    Loops     For loops and "zeros".   Strings and "malloc".
%    LU        MATLAB's "LINPACK".      Primarily floating point.
%    Sparse    Solve sparse system.     Mixed integer and floating point.

Which suggests that memory allocation with 2.3.18 is slow.

Sincerely,

Dmitri.




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

From: [EMAIL PROTECTED] (Dmitri A. Sergatskov)
Subject: 2.0.38 kernel for RH6.1 system
Date: 28 Feb 2000 08:09:01 GMT

Is it possible to compile 2.0.x kernels on RH6.1 (glibc based) 
system?

I tried 2.0.38 and it fails on 'make dep'. The output 
before the failure is appended.

Sincerely,

Dmitri.

p.s.:

make[1]: Entering directory `/usr/src/linux-2.0.38/drivers'
if [ -n "" ]; then \
/usr/src/linux-2.0.38/scripts/mkdep *.[chS] > .depend; fi
set -e; for i in block char net  pci sbus scsi sound cdrom isdn; do make -C $i f
astdep; done
make[2]: Entering directory `/usr/src/linux-2.0.38/drivers/block'
if [ -n "DAC960.c DAC960.h ali14xx.c amiflop.c ataflop.c cmd640.c cpqarray.c cpq
array.h dtc2278.c floppy.c genhd.c hd.c ht6560b.c ida_cmd.h ida_ioctl.h ide-cd.c
 ide-floppy.c ide-tape.c ide-tape.h ide.c ide.h ide_modes.h linear.c ll_rw_blk.c
 loop.c md.c proc_array.c promise.c promise.h qd6580.c raid0.c raid1.c raid5.c r
d.c rz1000.c triton.c umc8672.c xd.c" ]; then \
/usr/src/linux-2.0.38/scripts/mkdep *.[chS] > .depend; fi
cpqarray.h doesn't need config
make[2]: Leaving directory `/usr/src/linux-2.0.38/drivers/block'
make[2]: Entering directory `/usr/src/linux-2.0.38/drivers/char'
if [ -n "amigamouse.c atarimouse.c atixlmouse.c baycom.c busmouse.c cd1865.h con
makehash.c console.c console_struct.h consolemap.c consolemap.h cyclades.c defke
ymap.c diacr.h digi.h digi_bios.h digi_fep.h fbmem.c fep.h h8.c h8.h isicom.c is
tallion.c kbd_kern.h keyb_m68k.c keyboard.c lp.c lp_intern.c lp_m68k.c mem.c mis
c.c msbusmouse.c n_tty.c pcwd.c pcxx.c pcxx.h psaux.c pty.c random.c riscom8.c r
iscom8.h riscom8_reg.h rtc.c scc.c selection.c selection.h serial.c softdog.c sp
ecialix.c specialix_io8.h stallion.c tga.c tpqic02.c tty_io.c tty_ioctl.c vc_scr
een.c vesa_blank.c vga.c vt.c vt_kern.h wd501p.h wdt.c" ]; then \
/usr/src/linux-2.0.38/scripts/mkdep *.[chS] > .depend; fi
make[2]: *** [fastdep] Error 135
make[2]: Leaving directory `/usr/src/linux-2.0.38/drivers/char'
make[1]: *** [fastdep] Error 2
make[1]: Leaving directory `/usr/src/linux-2.0.38/drivers'
make: *** [dep-files] Error 2

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

From: Larry Morley <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.hardware
Subject: Odd cua0 vs. ttyS0 bug from gpm w/kernel 2.2.14
Date: Mon, 28 Feb 2000 04:22:52 -0500

Hi,

Just built 2.2.14 from the sources on top of a RH 5.2 distribution.  It
works
except for a few minor glitches.  Not exactly the smoothest trip going,
but
I think I made it unscathed...

One that I can't figure out is gpm triggering a '... used obsolete
/dev/cua0 -
update software to use /dev/ttyS0' from kernel source file tty_io.c

Well, I did "update" gpm (downloaded and installed v.1.14 - Im not
convinced
it's any different from what was already there), and the source code
definitely uses ttyS0 explicitly.  The error message comes from
tty_open() in
tty_io when .type is TTY_DRIVER_TYPE_SERIAL and .subtype is SERIAL_TYPE_
CALLOUT; tty_io.c is set to generate this message 5 times and then shut
up.

I finally figured out why - gpm uses /dev/mouse by default, which was
a link to /dev/cua0 under RH 5.2.  A "ln -s /dev/ttys0 /dev/mouse" fixed
it.  But, can anyone give me a little more insight as to what this
message
means, if anything else is affected, why this change was made etc.?

Also noted a few other oddities while I was doing this.  If anyone is
trying
something similar and has any questions, feel free; I may have run up
against it.

Tomorrow I may update my glibc if I feel like causing myself some more
grief
:)

Thanks in advance,
Larry

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

From: [EMAIL PROTECTED] (Andrzej Popowski)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Debugging application using pthread
Reply-To: [EMAIL PROTECTED]
Date: Sun, 27 Feb 2000 18:14:41 GMT

Fri, 25 Feb 2000 20:14:46 -0500, Mark Clayton <[EMAIL PROTECTED]>
wrote:

>>You must take a patch for libc and gdb to support thread debuging or
>>install a recent distrib.
>
>Actually a recent distro might not be the answer.  The Mandrake I have
>here has gdb 4.18, but still does not debug threaded apps.  I patched
>a copy of 4.17 which does work.  Anyone know of a patch for 4.18 or know
>why 4.18 doesn't work?

gdb 4.18 from Red Hat 6.1 works with pthreads.



Andrzej Popowski

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

From: [EMAIL PROTECTED] (Stefaan A Eeckels)
Subject: Re: glibc development language
Date: 28 Feb 2000 09:56:03 GMT

In article <8947kb$[EMAIL PROTECTED]>,
        "tye4" <[EMAIL PROTECTED]> writes:
> 
> Most programmers use C++ or Java nowadays.
If you want to use that argument, then we should be
developing glibc in Visual Basic. 

-- 
Stefaan
-- 
--PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)--
Ninety-Ninety Rule of Project Schedules:
        The first ninety percent of the task takes ninety percent of
the time, and the last ten percent takes the other ninety percent.

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

From: [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.hardware
Subject: Re: Odd cua0 vs. ttyS0 bug from gpm w/kernel 2.2.14
Date: Mon, 28 Feb 2000 10:30:36 GMT

In comp.os.linux.development.system Larry Morley <[EMAIL PROTECTED]> wrote:

| I finally figured out why - gpm uses /dev/mouse by default, which was
| a link to /dev/cua0 under RH 5.2.  A "ln -s /dev/ttys0 /dev/mouse" fixed
| it.  But, can anyone give me a little more insight as to what this
| message
| means, if anything else is affected, why this change was made etc.?

Separate serial port devices for different behaviours is gone.  One device
can perform all serial port behaviours when properly configured.  This is
a change to finally clean up the leftovers from when different devices
we needed.  Just use ttyS0, ttyS1, etc, and be happy.


| Also noted a few other oddities while I was doing this.  If anyone is
| trying
| something similar and has any questions, feel free; I may have run up
| against it.

I **always** install new systems from scratch.  Leftovers from upgrades
can sometimes make a real mess.  Other times, they may make things work
that, say due to a hard drive failure, won't work when you do have to
re-install from scratch.  By doing at first what you would do again later,
you can improve your odds at reproducibility.


| Tomorrow I may update my glibc if I feel like causing myself some more
| grief
| :)

Be sure your rescue disk is handy.

-- 
| Phil Howard - KA9WGN | for headlines that | Just say no to absurd patents |
| [EMAIL PROTECTED] | really matter:     | Boycott Amazon.Com (AMZN)     |
| Dallas - Texas - USA | linuxhomepage.com  | Shop http://bn.com/ instead   |

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


** 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 (and comp.os.linux.development.system) via:

    Internet: [EMAIL PROTECTED]

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