Linux-Development-Sys Digest #353, Volume #8 Fri, 15 Dec 00 17:13:21 EST
Contents:
Re: Accessing device driver from kernel (Kasper Dupont)
Re: What is the command to . . . ? (Kasper Dupont)
Re: >1 processes on 1 file at same time (Michael Kerrisk)
Re: A faster memcpy and bzero for x86 (Kasper Dupont)
Re: >1 processes on 1 file at same time (Kasper Dupont)
Re: How to make a BIOS call in Linux (Joe Pfeiffer)
Re: A faster memcpy and bzero for x86 (Andi Kleen)
Re: shared libs ... an idiot question (Johan Kullstam)
is there a linux checkpoint facility? (Eric Taylor)
Re: shared libs ... an idiot question (Steve Houseman)
Re: Compiling C++ programs with GCC --> no GPL license implications (Mike Stump)
Re: What is the command to . . . ? (Robert Kiesling)
Re: A faster memcpy and bzero for x86 (Linus Torvalds)
RE: open ttyS0 from kernel ("Massimiliano Caovilla")
kernel modules debugger ("Massimiliano Caovilla")
Re: Compiling C++ programs with GCC --> no GPL license implications (Pete Becker)
Re: What is the command to . . . ? (Juergen Ilse)
----------------------------------------------------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Accessing device driver from kernel
Date: Fri, 15 Dec 2000 17:06:33 +0100
[EMAIL PROTECTED] wrote:
>
> Is it safe to access a device driver from another device driver (ie a
> kernel module)?
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
It should be posible to do it in a safe way.
I can see two posible pitfalls. You must
ensure that some module is not unloaded
while it is actually needed by another
module. And when passing pointers you must
ensure that they point into the expected
address space, i.e. don't give a kernel
space pointer to a function expecting a
userspace pointer and vice versa.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Crossposted-To:
alt.os.linux.mandrake,alt.os.linux.slackware,alt.uu.comp.os.linux.questions,comp.os.linux.misc,comp.os.linux.networking,comp.os.linux.hardware,comp.os.linux.setup
Subject: Re: What is the command to . . . ?
Date: Fri, 15 Dec 2000 17:08:31 +0100
Josef Moellers wrote:
>
> Allen Wong wrote:
> >
> > In alt.os.linux.slackware Markus Amersdorfer <[EMAIL PROTECTED]> wrote:
> > > [EMAIL PROTECTED] wrote:
>
> > > find . -name '*.txt' -exec grep "Hello World" {} \;
> >
> > This works, but it's alot slower than "find . -type f -name '*.txt' -print |
> > xargs grep "Hello World".
>
> These solutions won't tell where they found the match.
> Markus' solution can be enhanced to do that:
> find . -name '*.txt' -exec grep "Hello World" {} \; -print
>
> --
> Josef M�llers (Pinguinpfleger bei FSC)
> If failure had no penalty success would not be a prize (T. Pratchett)
Grep will tell the filenames if there is more than one file.
If you just want to know the filename and not the actual
lines use grep -l "Hello World".
--
Kasper Dupont
------------------------------
From: [EMAIL PROTECTED] (Michael Kerrisk)
Subject: Re: >1 processes on 1 file at same time
Date: Fri, 15 Dec 2000 16:32:26 GMT
On Fri, 15 Dec 2000 12:51:50 GMT, Michael Palme
<[EMAIL PROTECTED]> wrote:
>hello....
>
>Im a rookie in kernel programming but very interested in system
>details. I want to understand what appears (in 2.2 kernels) if
>different processes (no father/son relation) opens the same file at the
>same time. Ive read several books. There are two partys with 2
>different explanations in one detail. One side says that for every
>process that opens that file an entry (struct file) is made in the
>global table of open files the other side says there is only one entry
>in that table (like in the inode table) and all processes
>filedescriptors (struct *file) that are related to the one file point
>to that single entry. Ive tried to search for information in the
>sources but im not good in finding such things. Please can somebody
>explain to me how it is really made and what appears if 2 processes
>open the same file at one time (an example would be nice). Im very
>interested how the race conditions are avoided and the several request
>for the file are managed.
In the book WR Stevens, Advanced Programming in the Unix Environment,
the text and diagrams on pp56 ff should clear everything up nicely.
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: A faster memcpy and bzero for x86
Date: Fri, 15 Dec 2000 17:36:53 +0100
Boris Gjenero wrote:
>
> Robert Redelmeier wrote:
> >
> > It matters in the kernel because of the "copy-on-write" virtual
> > memory policy. When a fresh page is written for the first time,
> > it gets remapped from the zeroeth page to real memory, and this
> > real memory cleared before the write. For the bzero, REP STOSD
> > is optimum in the same way as REP MOVSD.
>
> What about if the kernel kept some zeroed pages ready? Pages could be
> zeroed when the CPU is free and then when you need a new page all you
> need to do is change a page table entry.
>
> Of course if the CPU is busy all the time, if an application writes to a
> large number of new pages quickly, or if memory is outrageously limited
> in size then this wouldn't help, but perhaps in most cases it would
> help.
I think Linux does use idle time to zero pages on some architectures.
But I have no clue why doing it on some and not on others.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: >1 processes on 1 file at same time
Date: Fri, 15 Dec 2000 17:51:57 +0100
Michael Palme wrote:
>
> hello....
>
> Im a rookie in kernel programming but very interested in system
> details. I want to understand what appears (in 2.2 kernels) if
> different processes (no father/son relation) opens the same file at the
> same time. Ive read several books. There are two partys with 2
> different explanations in one detail. One side says that for every
> process that opens that file an entry (struct file) is made in the
> global table of open files the other side says there is only one entry
> in that table (like in the inode table) and all processes
> filedescriptors (struct *file) that are related to the one file point
> to that single entry. Ive tried to search for information in the
> sources but im not good in finding such things. Please can somebody
> explain to me how it is really made and what appears if 2 processes
> open the same file at one time (an example would be nice). Im very
> interested how the race conditions are avoided and the several request
> for the file are managed.
>
> I would be very thankful for every information i can get from you.
>
> cheers Michael Palme
>
> Sent via Deja.com
> http://www.deja.com/
Every successfull call of open creates a new struct file.
When a process calls fork the child will inherit pointers
to theese structs, and the struct file will first be
deleted when all references have been closed.
There can be more struct file refering to the same file
if it has been opened by multiple calls to open by the
same or different processes.
--
Kasper Dupont
------------------------------
From: Joe Pfeiffer <[EMAIL PROTECTED]>
Subject: Re: How to make a BIOS call in Linux
Date: 15 Dec 2000 09:35:46 -0700
> [EMAIL PROTECTED] wrote:
> >
> > I'm using a type of bios called smbios
> > ( http://www.phoenix.com/products/specs-smbios.pdf ) The spec is
> > written by various PC and BIOS companies, eg, Intel and Phoenix tech.
> > The smbios knows various aspects about the PC, including temperature,
> > voltage, bios rev, bios build date, manufacturing, etc.
> >
> > The static info, e.g., bios rev, bios date, etc, I can get them by
> > reading from a known location in memory. But for dynamic info,
> > temperature, voltage, etc, it looks like I need to make the bios call.
> > If there are other ways to get this info that would be great.
Take a look at the lm-sensors and i2c projects.
--
Joseph J. Pfeiffer, Jr., Ph.D. Phone -- (505) 646-1605
Department of Computer Science FAX -- (505) 646-1002
New Mexico State University http://www.cs.nmsu.edu/~pfeiffer
VL 2000 Homepage: http://www.cs.orst.edu/~burnett/vl2000/
------------------------------
From: Andi Kleen <[EMAIL PROTECTED]>
Subject: Re: A faster memcpy and bzero for x86
Date: 15 Dec 2000 17:56:32 +0100
Kasper Dupont <[EMAIL PROTECTED]> writes:
> > Of course if the CPU is busy all the time, if an application writes to a
> > large number of new pages quickly, or if memory is outrageously limited
> > in size then this wouldn't help, but perhaps in most cases it would
> > help.
>
> I think Linux does use idle time to zero pages on some architectures.
> But I have no clue why doing it on some and not on others.
It is only useful when the architecture has instructions to zero pages
without polluting the caches. PPC has this. Modern x86 with SSE has too,
but as far as I know nobody tried it there yet.
-Andi
------------------------------
Subject: Re: shared libs ... an idiot question
From: Johan Kullstam <[EMAIL PROTECTED]>
Date: 15 Dec 2000 12:51:03 -0500
Josef Moellers <[EMAIL PROTECTED]> writes:
> Steve Houseman wrote:
> >
> > are the code (or read only) bits of a shared lib, shared in ram
> > between all users (of the lib)?
>
> That's what sharing is all about, so: Yes.
it's half of what sharing is all about. the other half is saving the
disk space by not having libc &c statically linked into every
executable.
--
J o h a n K u l l s t a m
[[EMAIL PROTECTED]]
sysengr
------------------------------
From: Eric Taylor <[EMAIL PROTECTED]>
Subject: is there a linux checkpoint facility?
Date: Fri, 15 Dec 2000 18:07:18 GMT
Hi:
Does anyone know of a checkpointing utility/capability
for linux?
I have a large simulation that I want to snapshot
and be able to restore to execution later, possibly after
a reboot, or on a different linux box (running the same
version of linux incl libs). I can live w/o all the i/o
setup being done automatically, as long as the
program's data areas are all restored.
I might want to modify one or more shared librarys
prior to restart.
If nobody has done this already, then
I thought of perhaps forcing a core dump and
starting from there. Or looking at /proc/pid/mem
and /proc/pid/map and starting from there.
Anyone know of anything to do this?
thanks
eric
------------------------------
From: [EMAIL PROTECTED] (Steve Houseman)
Subject: Re: shared libs ... an idiot question
Date: 15 Dec 2000 18:36:54 -0000
Thanks for the response ... I had been using that assumption
(ie that the sharable parts of executables and shared libs were
shared) for a long time, but in trying to check some stuff out
in the kernel could find no evidence of the kernel caching/sharing
the actual executable code , and then I remembered this morning ...
ting! ....I had made this mistake some years ago .... the concept
of shared libs was about not having large executables rather than
sharing ram ...
So I was uncertain which was true in linux ... after seeing your
response I've gone back and done the obvious ... counted up
the mem seen in /proc/<pid>/maps and on my sys (64MB ram) I get
totals:pvtlen(73404)kBs shareable(32792)kBs sum shar len(241514)kBs
where the shareable is ro , and the 241514kBs would be the amount
needed for the ro chunks if a personal copy for all ... so is
clearly shared.
Time for a bit more digging on where/how it is shared.
Thanks for your help,
Steve Houseman
--
currently steve.houseman at virgin net
------------------------------
Crossposted-To: comp.lang.c++,gnu.misc.discuss
From: [EMAIL PROTECTED] (Mike Stump)
Subject: Re: Compiling C++ programs with GCC --> no GPL license implications
Date: Fri, 15 Dec 2000 18:48:31 GMT
In article <[EMAIL PROTECTED]>,
E. Robert Tisdale <[EMAIL PROTECTED]> wrote:
>Once again, I'm not a lawyer. I can't advise you or anyone else on
>the law.
I see. You want to play judge and/or lawyer when it suits you, and
then be coy when I refute your position. Look, it is simple, be
consistent, either play lawyer or not, I don't care which, but don't
play it half way. If you are going to tell people when they can be
sued, you are playing lawyer. If you are going to play lawyer in this
group, then I will play with you, that is _my_ purpose for being here.
If you dont' want to play the game, don't play. Saying what you said
is a cop out midgame.
Oh, any playing lawyer is exactly on topic for the group I am in.
------------------------------
Crossposted-To:
alt.os.linux.mandrake,alt.os.linux.slackware,alt.uu.comp.os.linux.questions,comp.os.linux.misc,comp.os.linux.networking,comp.os.linux.hardware,comp.os.linux.setup
Subject: Re: What is the command to . . . ?
From: Robert Kiesling <[EMAIL PROTECTED]>
Date: Fri, 15 Dec 2000 19:00:08 GMT
Kasper Dupont <[EMAIL PROTECTED]> writes:
> Josef Moellers wrote:
> >
> > Allen Wong wrote:
> > >
> > > In alt.os.linux.slackware Markus Amersdorfer <[EMAIL PROTECTED]> wrote:
> > > > [EMAIL PROTECTED] wrote:
> >
> > > > find . -name '*.txt' -exec grep "Hello World" {} \;
> > >
> > > This works, but it's alot slower than "find . -type f -name '*.txt' -print |
> > > xargs grep "Hello World".
> >
> > These solutions won't tell where they found the match.
> > Markus' solution can be enhanced to do that:
> > find . -name '*.txt' -exec grep "Hello World" {} \; -print
> >
> > --
> > Josef M�llers (Pinguinpfleger bei FSC)
> > If failure had no penalty success would not be a prize (T. Pratchett)
>
> Grep will tell the filenames if there is more than one file.
> If you just want to know the filename and not the actual
> lines use grep -l "Hello World".
>
> --
> Kasper Dupont
A slight elaboration to the "find" solution above: if you type
it on the command line, you must escape the braces with backslashes so
the shell doesn't interpret them:
$ find . -name '*.txt' -exec grep "Hello World" \{\} \; -print
As I remember it, only the semicolon needs to be escaped when command
is run from inside a bash shell script.
--
Robert Kiesling <[EMAIL PROTECTED]>
Web Page : http://www.mainmatter.com/kiesling
Linux FAQ:
http://www.mainmatter.com/linux-faq/toc.html http://www.mainmatter.com/
---
Tired of spam? Please forward messages to [EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED] (Linus Torvalds)
Subject: Re: A faster memcpy and bzero for x86
Date: 15 Dec 2000 11:17:00 -0800
In article <[EMAIL PROTECTED]>,
Andi Kleen <[EMAIL PROTECTED]> wrote:
>Kasper Dupont <[EMAIL PROTECTED]> writes:
>
>
>> > Of course if the CPU is busy all the time, if an application writes to a
>> > large number of new pages quickly, or if memory is outrageously limited
>> > in size then this wouldn't help, but perhaps in most cases it would
>> > help.
>>
>> I think Linux does use idle time to zero pages on some architectures.
>> But I have no clue why doing it on some and not on others.
>
>It is only useful when the architecture has instructions to zero pages
>without polluting the caches. PPC has this. Modern x86 with SSE has too,
>but as far as I know nobody tried it there yet.
It's not just about polluting the caches.
It's also about polluting a shared bus, where the other CPU's that
aren't idle may be doing real work that _needs_ that bus.
An idle thread should NOT use resources that may be useful for other
threads that are doing real work.
Linus
------------------------------
From: "Massimiliano Caovilla" <[EMAIL PROTECTED]>
Subject: RE: open ttyS0 from kernel
Date: Fri, 15 Dec 2000 13:33:39 +0100
<[EMAIL PROTECTED]> wrote in message 906000$980$[EMAIL PROTECTED]
>
>
> I'm constructing a kernel module (software modem) that must open the a
> serial port (ttyS?).
> The construction looks like:
> <user mode app> | <modem driver> | <ttyS> | <serial driver> | hardware
>
> I don't want to implement the whole serial driver my self (yes, I
> could, but that is not the design choosen) instead I want to use it as
> I would from user mode.
>
> The problem is: How do I open and read/write to it? I've tried
> both "open" (which fails) and "filp_open".
> filp_open() succeeds, and I get a lot of pointer to read/write.
>
> However, when I call write I get -29 in return, and nothing is written.
>
> Have anybody done somwthing like this before, and if so, what am I
> doing wrong?
>
> Finally, NO - the driver needs to be in the kernel, so I can't
> implement it as a user mode program.
>
> Thanks,
> Eric
>
I think you need to filp_open() it, then you'll get a fstruct file *, wich
has a member pointing to a file_operation struct, wich has pointers to
write(), read(), ioctl() you need to access the driver
your write will be someything like that
pr_file->f_op->write(...)
remember to set_fs(KERNEL_DS) or you'll get an invalid buffer error
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
From: "Massimiliano Caovilla" <[EMAIL PROTECTED]>
Subject: kernel modules debugger
Date: Fri, 15 Dec 2000 13:37:56 +0100
I'm trying to debug a big pseudo-driver I'm writing:
what kind of debugger should I use?
I don't think gdb can debug kernel modules...
What's the official one?
Is there any source-level debugger suitable for kernel modules?
Ciao & thanks
(and Merry Christmast, by the way)
------------------------------
From: Pete Becker <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.c++,gnu.misc.discuss
Subject: Re: Compiling C++ programs with GCC --> no GPL license implications
Date: Fri, 15 Dec 2000 14:56:12 -0500
Mike Stump wrote:
>
> In article <[EMAIL PROTECTED]>,
> E. Robert Tisdale <[EMAIL PROTECTED]> wrote:
> >Once again, I'm not a lawyer. I can't advise you or anyone else on
> >the law.
>
> I see. You want to play judge and/or lawyer when it suits you, and
> then be coy when I refute your position. Look, it is simple, be
> consistent, either play lawyer or not, I don't care which, but don't
> play it half way.
There is a difference between "I know what this means" and "There could
be problems here." The former is a legal judgment. The latter is not.
--
Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Contributing Editor, C/C++ Users Journal (http://www.cuj.com)
------------------------------
From: Juergen Ilse <[EMAIL PROTECTED]>
Crossposted-To:
alt.os.linux.mandrake,alt.os.linux.slackware,alt.uu.comp.os.linux.questions,comp.os.linux.misc,comp.os.linux.networking,comp.os.linux.hardware,comp.os.linux.setup
Subject: Re: What is the command to . . . ?
Date: 15 Dec 2000 21:50:00 GMT
Hello,
Robert Kiesling <[EMAIL PROTECTED]> wrote:
> A slight elaboration to the "find" solution above: if you type
> it on the command line, you must escape the braces with backslashes so
> the shell doesn't interpret them:
> $ find . -name '*.txt' -exec grep "Hello World" \{\} \; -print
No, the shell wouold interpret a single "{" or a single "}" in a special
way, the concatenation of "{" and "}" wthout any whitespace between is
not interpreted in a special way.
> As I remember it, only the semicolon needs to be escaped when command
> is run from inside a bash shell script.
You also don't need to quot the braces in the commandline.
If you don't trust me, try it fuer yourself...
For the Problem with the missing filename before the matching lines:
If grep searches more than one file, it will print the filename in
front of the matching lines, so you can use something like
find . -name '*.txt' -exec grep "Hello World" {} /dev/null \;
to achiev tha (note, that i don't use "-print" anymore!).
The other (faster!) solution:
find . -name '*.txt' -print | xargs grep
seems to avoid this problem, but that is not really true: xargs runs
the command "grep" on several filenamearguments (which were read from
stdin) at once, but what if xargs runs grep with a _single_ filename
the last time? To avoid this problem, you may fill in the additional
filename /dev/null (as used in the above solution) as parameter to grep:
find . -name '*.txt' -print | xargs grep /dev/null
This should work, if there are no filenames with whitespace or newline-
characters in the filename.
If you want it work also with these "unusual" filenames, i would suggest
to use the gnuish versions of "find" and "xargs":
find . -name '*.txt' -print0 | xargs -0 grep /dev/null
I think, there is no more complete and faster solution than this...
;-)
ciao,
Juergen Ilse ([EMAIL PROTECTED])
--
Eingedeutschte Fehlermeldungen sind doch etwas | Juergen Ilse
schoenes: "router:[/local]# rm -R var" | Internet POP Hannover
"rm: im Verzeichnis >>var<< absteigen?" | Vahrenwalder Str. 205
=====================================================| 30165 Hannover
Neu in de.comp.os.unix.linux.*? Lies die infos-Gruppe| [EMAIL PROTECTED]
------------------------------
** 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
******************************