Linux-Development-Sys Digest #741, Volume #8 Wed, 23 May 01 00:13:14 EDT
Contents:
Re: Write a module (Michael Ferguson)
Re: Write a module (=?iso-8859-1?Q?Andr=E9?= David)
atomic_dec_and_test (Zhihui Zhang)
wildcard [1-10] ("Ryan Storgaard")
Touch screen ([EMAIL PROTECTED])
Touch screen ([EMAIL PROTECTED])
Re: How to find system and user memory used?
Re: Write a module
Re: Write a module (Grant Edwards)
Re: realloc problem ("enib")
Block driver and /proc/partitions ("Mike Austin")
Kernel (mal)function after harmless driver Segmenttion Error ("Norm Dresner")
Re: How to find system and user memory used? ([EMAIL PROTECTED])
Re: Touch screen ("Cameron Kerr")
Re: How to find system and user memory used? ("Cameron Kerr")
Re: Trouble using large amount of memory with Redhat 7 ("J. P. Montgomery")
Re: Formulating Compatibility Signature: (Frank Ranner)
----------------------------------------------------------------------------
From: Michael Ferguson <[EMAIL PROTECTED]>
Subject: Re: Write a module
Date: Tue, 22 May 2001 11:09:04 -0600
Have a look at http://www.linuxdoc.org/LDP/lkmpg/mpg.html
This should provide you with all you need to know to get started with
modules.
Julien Laganier wrote:
>
> Hi folks,
>
> I have to write a module for the linux kernel. What are the required
> functions to implement, and the parameters, like #define, #include, etc.
> ?
> I know int __init(void), void __exit(void), is there any others ?
>
> Thanks.
------------------------------
From: =?iso-8859-1?Q?Andr=E9?= David <[EMAIL PROTECTED]>
Subject: Re: Write a module
Date: Tue, 22 May 2001 19:16:42 +0200
This is a multi-part message in MIME format.
==============E8B1B68F99A1B24A7BB9D8A4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Julien Laganier wrote:
>
> Hi folks,
>
> I have to write a module for the linux kernel. What are the required
> functions to implement, and the parameters, like #define, #include, etc.
> ?
> I know int __init(void), void __exit(void), is there any others ?
>
> Kind regards.
Why don't you browse the kernel source code?
--
"Share the code. If you hide it ain't good."
Popular knowledge
==============E8B1B68F99A1B24A7BB9D8A4
Content-Type: text/x-vcard; charset=us-ascii;
name="Andre.David.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Andr� David
Content-Disposition: attachment;
filename="Andre.David.vcf"
begin:vcard
n:David;Andr�
tel;cell:+41792013849
tel;work:+41227676147
x-mozilla-html:FALSE
org:CERN - European Centre for Nuclear Research;EP/NA60
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
note:Geneva, Switzerland
x-mozilla-cpt:;-16000
fn:Andr� David
end:vcard
==============E8B1B68F99A1B24A7BB9D8A4==
------------------------------
Date: Tue, 22 May 2001 14:57:03 -0400
From: Zhihui Zhang <[EMAIL PROTECTED]>
Subject: atomic_dec_and_test
The comment to this function in file include/asm-i386/atomic.h says
"Note that the guaranteed useful range of an atomic_t is only 24 bits."
Why only 24 bits? Please explain this to me. Thanks.
-Zhihui
------------------------------
From: "Ryan Storgaard" <[EMAIL PROTECTED]>
Subject: wildcard [1-10]
Date: Tue, 22 May 2001 19:30:58 GMT
Hi there,
I am writing a script to move and/or delete files/directories and I ran into
a problem when using a wildcard...
for example,
rm -r -f [1-9] works fine, but I need to remove past 9. And of course, as
soon as I put [1-10] I run into problems because bash is taking the 10 as
1,0 ...
I can work around this but I was just curious if it was possible to do the
above somehow.
cheers,
Ryan
------------------------------
From: [EMAIL PROTECTED]
Subject: Touch screen
Date: 22 May 2001 20:11:55 GMT
I have a capacitive touch screen connected to a serial port in a panel pc
PPC150T-CT (Advantech).
It is a ELOGRAPHICS touch screen.
I have no any driver for this. I need some documentation aboout the serial
protocol of this touch. Or if someone knows about a C driver for this touch
much better!
The elotouch company didnt give me any specification or doc.
Anyone can help me?
Thanks in advance
Javier
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email [EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED]
Subject: Touch screen
Date: 22 May 2001 20:12:18 GMT
I have a capacitive touch screen connected to a serial port in a panel pc
PPC150T-CT (Advantech).
It is a ELOGRAPHICS touch screen.
I have no any driver for this. I need some documentation aboout the serial
protocol of this touch. Or if someone knows about a C driver for this touch
much better!
The elotouch company didnt give me any specification or doc.
Anyone can help me?
Thanks in advance
Javier
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email [EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED] ()
Subject: Re: How to find system and user memory used?
Date: Tue, 22 May 2001 20:18:19 -0000
In article <9ectcp$28vma$[EMAIL PROTECTED]>,
Kyle Brant <[EMAIL PROTECTED]> wrote:
>Gtop or ktop for programs that report such info (I think).
What's wrong with free?
--
http://www.spinics.net/linux
------------------------------
From: [EMAIL PROTECTED] ()
Subject: Re: Write a module
Date: Tue, 22 May 2001 20:24:11 -0000
In article <[EMAIL PROTECTED]>,
Julien Laganier <[EMAIL PROTECTED]> wrote:
>I have to write a module for the linux kernel. What are the required
>functions to implement, and the parameters, like #define, #include, etc.
>?
>I know int __init(void), void __exit(void), is there any others ?
>
>Kind regards.
You probably should get a copy of Linux Device Drivers by Alessandro
Rubini:
http://www.amazon.com/exec/obidos/ASIN/1565922921/ricksphotograpag
--
http://www.spinics.net/linux
------------------------------
From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: Write a module
Date: Tue, 22 May 2001 20:37:14 GMT
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote:
>In article <[EMAIL PROTECTED]>,
>Julien Laganier <[EMAIL PROTECTED]> wrote:
>
>>I have to write a module for the linux kernel. What are the required
>>functions to implement, and the parameters, like #define, #include, etc.
>>?
>>I know int __init(void), void __exit(void), is there any others ?
>>
>>Kind regards.
>
>You probably should get a copy of Linux Device Drivers by Alessandro
>Rubini:
>
> http://www.amazon.com/exec/obidos/ASIN/1565922921/ricksphotograpag
A very good book.
FYI, The seceond edition (which covers 2.4), is due out in
July. The first edition mainly covers 2.0, with some notes
about 2.1.
However, the 1st edition programming examples modified to run
under 2.4 are available from the O'Reilly web site:
ftp://ftp.ora.com/pub/examples/linux/drivers/v2.4.tar.gz
If you can't wait 5-6 weeks, the first edition is still worth the
money, IMO.
--
Grant Edwards grante Yow! This is my WILLIAM
at BENDIX memorial CORNER
visi.com where I worship William
Bendix like a GOD!!
------------------------------
From: "enib" <[EMAIL PROTECTED]>
Subject: Re: realloc problem
Date: Tue, 22 May 2001 21:32:09 +0200
Thanks for your hints!
You were right, the memmove was the guiltier!
Now it works fine, even though not with best performance. In this case it's
not necessary, because there are only about 2 or 4 occurences that have to
be replaced in about 400Bytes. But for future i will stop scrimshanking
(funny word, correct in this context?) to read the Donald Knuth-Book. I also
think that we will learn something about this in the next semester in
"efficient algorithms".
Okydoky, thanks for your effort, Benjamin!
"Bernd Strieder" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]...
> 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: "Mike Austin" <[EMAIL PROTECTED]>
Subject: Block driver and /proc/partitions
Date: Tue, 22 May 2001 17:14:34 -0400
Greetings!
I'm trying to get my partitionable block driver (a module) to show up in
/proc/partitions. Reading Rubini's books lead me to believe that
resetup_one_dev would accomplish this. However, it doesn't seem to be
effective. How would you get a modular partitionable block device listed in
proc partitions?
Thanks in advance!
Michael Austin
------------------------------
From: "Norm Dresner" <[EMAIL PROTECTED]>
Subject: Kernel (mal)function after harmless driver Segmenttion Error
Date: Tue, 22 May 2001 21:54:33 GMT
A few weeks ago I'd noticed that when a new driver I was writing crashed
with a segmentation error that the system log ceased to function. Several
readers in this newsgroup pointed out that the failure could have been
caused by my driver clobbering essential kernel code, and I while I didn't
agree, I couldn't prove otherwise.
Yesterday, after finally getting the driver working, I intentionally
introduced a controllable segmentation fault into it via an ioctl-code which
tried to read from the raw PCI address -- not the ioremap-ed virtual address
that I know works. That's all it did: read a word from this address into a
local variable and if successful print it out via printk().
And, exactly as before, after the segmentation fault, the system log was
inoperative. This time I know that there was no clobbering of kernel code.
So ... I ask again: Why does the system log either die or hang after any
segmentation error?
Thanks
Norm
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: How to find system and user memory used?
Date: 23 May 2001 10:45:34 +1000
Reply-To: [EMAIL PROTECTED]
Thanks for all answers.
If I only want to backup all users' files, not system files,
I want to know each user's memory of files used and all users'
memory of files used. What command do I need to use excepting
gtop, ktop or free? Thanks
Best regards
Jiying
------------------------------
From: "Cameron Kerr" <[EMAIL PROTECTED]>
Subject: Re: Touch screen
Date: Wed, 23 May 2001 13:01:56 +1200
IIRC, Xfree86 has support for this. Try looking in /usr/lib/X11/doc/ and
in the man page for XF86Config, esp the Pointer Section.
--
Cameron Kerr -- cameron.kerr @ paradise.net.nz
Praise Slackware, our baud and saviour!
--
------------------------------
From: "Cameron Kerr" <[EMAIL PROTECTED]>
Subject: Re: How to find system and user memory used?
Date: Wed, 23 May 2001 13:04:09 +1200
In article <9ef17e$[EMAIL PROTECTED]>, "Unknown"
<[EMAIL PROTECTED]> wrote:
> Thanks for all answers.
>
> If I only want to backup all users' files, not system files, I want to
> know each user's memory of files used and all users' memory of files
> used. What command do I need to use excepting gtop, ktop or free? Thanks
>
> Best regards
> Jiying
I think your missing the point here.
You want to backup FILES, not the stuff in MEMORY. If you want to know
how much space is available in a filesystem, use the df command
eg. dh -h
--
Cameron Kerr -- cameron.kerr @ paradise.net.nz
Praise Slackware, our baud and saviour!
--
------------------------------
From: "J. P. Montgomery" <[EMAIL PROTECTED]>
Subject: Re: Trouble using large amount of memory with Redhat 7
Date: Tue, 22 May 2001 23:49:34 -0500
Thanks for the added information ... I did run strace and appear to be using
the latest libraries ... I'll bring the files home tomorrow and send them if
necessary. Incidently, although I have used mem= in lilo but have not
included it presently. I'll try this tomorrow.
Is there anything in the strace output you were looking for other than the
libraries? I noticed that it was outputting bk() values that I have seen in
memory discussions ...
Incidently, I use Portland compilers ... I have only mentioned g77 as a way
of comparing results. The Portland guy I exchanged email said that g77
imposes a hard limit on size ... but I still find this hard to believe since
I know a lot of people regularly use gcc and g77. Portland is licensed
software ... but allows a home use license and so both compilers are
identical versions running the same kernel (except the SMP kernel is used at
home on the dual processor machine).
I understand about swap and ram ... I do not understand the actual limits in
the kernel and how to find them. When I use a simple C code to retrieve the
resource limits (rlimit) I get 4G for the process size (ram+swap). However,
I had not run this on the big machine with the SMP kernel. I would have
thought that this would have retrieved the values that the kernel
recognizes.
I was wondering what you think about just upgrading my distribution to
Redhat 7.1 and the 2.4.? kernel ... ? Of course, I do have a never give up
philosophy ...
More information tomorrow ..
Thanks,
Pat
"Karl Heyes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> In article <9ecmlg$5vj$[EMAIL PROTECTED]>, "J. P. Montgomery"
> <[EMAIL PROTECTED]> wrote:
>
>
> > 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 problem is the interfaces to the BIOS. A similar sort of thing
happened
> with hard disk size detection, although linux bypassed the BIOS in that
case.
>
> 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)?
>
> Again the physical memory (actual RAM) is different from VM. VM size is
> always the same for each process. ie you could have 100 processes taking
> up 1 Gig of VM space and only have 128Meg of RAM, you just be hitting swap
> harder.
>
> The reason you don't get 4Gig for each process is that there is also the
> kernel involved. There all sorts of different patches that are not part
of
> the syandard kernel which allow the VM system deal with large process
spaces.
>
> > 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.
>
> Again BIOS different so the memory detection may work. Is it the same
> version of the compilers. I don't use fortran myself so I don't known the
> history the the compilers.
>
> > 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 ...)
>
> One thing I didn't mention for the memory detection issue is that you can
> supply parameters to the kernel that can override the memory detection
value
>
> eg from lilo
>
> linux mem=XXXM
>
> karl.
------------------------------
From: Frank Ranner <[EMAIL PROTECTED]>
Subject: Re: Formulating Compatibility Signature:
Date: Wed, 23 May 2001 13:43:34 +1000
Adam Shapira wrote:
>
> Rene Herman wrote:
> >
> > Adam Shapira wrote:
> >
> > > Is there any more official way of determining a compatibility
> > > signature other than using the OS_TYPE and HOSTTYPE environment
> > > variables?
> >
> > Parsing the ouput from "uname" I guess. Do a "uname --help", "man
> > uname" or "info uname" for more information.
> >
> > Hope this helps.
> > Rene Herman
>
> Thanks a lot. I've tried this command on the RH6.x machine. But
> though I haven't yet gotten to try it on the RH7 machine, my
> intuition tells me that this command's behaviour is just as
> non-standard as the Environment Variables (if not more so).
Your intuition is mistaken. uname -s produces 'Linux' under Redhat 7
and Redhat 6.2.
Regards,
Frank Ranner
------------------------------
** 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
******************************