Linux-Development-Sys Digest #33, Volume #8 Wed, 19 Jul 00 18:13:19 EDT
Contents:
Re: floating point issue (Grant Edwards)
Re: Still no NFS in 2.2.16 ("Rex Dieter")
Re: Resources for writing device drivers (Grant Edwards)
MORE INFO Re: Question: system() from C++ CGI to Perl with Kernel 2.2.16 (Lisa
Wilcox)
Re: C problem (David Wragg)
Re: Drivers: read routine (Pete Zaitcev)
Re: strange "mv" bug (Daniel R. Grayson)
Re: Programming giude for the network device drvier like an ethernet or adsl modem
(Rick Ellis)
Re: CHILD_MAX: can't limit the number of processes per real UID (Olivier ROBERT)
Re: Resources for writing device drivers (Dave Boutcher)
Re: floating point issue (David Wragg)
Re: Semaphores in the kernel ("Robert T. Bauer")
Question about after upgrading kernel (Wesley Wong)
How to deal with System.map and Module_info after updating kernel (Wesley Wong)
Some questions about modules (Wesley Wong)
recompile kernel...?? (Wesley Wong)
Re: Question about after upgrading kernel (Kaz Kylheku)
----------------------------------------------------------------------------
From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: floating point issue
Date: Wed, 19 Jul 2000 18:23:55 GMT
In article <8l4mso$uis$[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote:
>But, I found that how come if I put the option -O2, I can load
>the module (no unresolved symbol log) and I also got the
>correct answer!?
The -O2 probably caused gcc to generating an inlined version of
log() rather than calling the log() in libm. The availability
of inline functions isn't guaranteed, so you can't depend on
this behavior. It might work this time, but not with the next
version of gcc -- though that's unlikely.
>Does this means I CAN execute floating point calculation in the
>kernel module.
That depends on your definition of "can execute floating point
calculation". Yes, there's nothing stopping you from doing
floating point operations.
But, you may be stomping on a user-task's floating point state
information. You might get the right answer in your driver
module, but it could end up causing other (possibly unrelated)
tasks to get wrong answers.
A floating-point exception generated from kernel-space may have
unintended consequences.
>ps. I didn't do any fp status/registers save/store mechanism
>during my fp calculation.
>
>Anything's wrong or right?
At minimum, you've got to save the FP state before you do FP
calculations, make sure you handle FP exceptions properly, then
restore the FP state when you're done. I'm not a kernel guru,
but that's the answer I came up with when I wanted to do FP in
a driver.
--
Grant Edwards grante Yow! .. I want a COLOR
at T.V. and a VIBRATING BED!!!
visi.com
------------------------------
From: "Rex Dieter" <[EMAIL PROTECTED]>
Subject: Re: Still no NFS in 2.2.16
Date: Wed, 19 Jul 2000 13:32:15 -0500
You need to enable the "experimental drivers" switch before you'll see the
option to enable kernel NFS support.
Or better yet, use an official kernel from a Linux distribution (redhhat,
mandrake, valinux, etc...) so that you (usually) don't have to worry about
stuff like this. (-:
--
Rex Dieter
Computer System Administrator
Mathematics and Statistics
University of Nebraska Lincoln
<[EMAIL PROTECTED]> wrote in message news:8l4jm0$8tq$[EMAIL PROTECTED]...
> Never got a reply to my previous post; why doesn't knfsd work in 2.2.16
(at
> least on Linux)? I always get an error with "nfssvc".
>
> It seems to work fine with kernel 2.2.12, which I'm currently using. I
built
> both kernels from source, using the same nfs options.
>
> I'd very much appreciate any pointers to info on this problem.
>
> Hugh
> [EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: Resources for writing device drivers
Date: Wed, 19 Jul 2000 18:29:15 GMT
In article <[EMAIL PROTECTED]>, MJ Dainty wrote:
>I saw the O'Reilly "Linux Device Drivers" book, and given their
>reputation, I'm tempted. However the book was published
>1997/98, and I'm concerned that the book may be out of date
>given the constantly advancing state of the kernel, so
>something more up-to-date would be nice.
IMO, Rubini is still worth reading. A second edition updated
for 2.[234] would be on my short list of books to buy.
Most of the information is still valid, but you do need to keep
in mind that the examples are from 2.0 and 2.1 kernels, so you
have to watch out for things that have changed since then.
For a simple character mode driver, not a lot has changed.
A good exercise is to compare the examples in Rubini to driver
source code that comes with the kernel you're using.
--
Grant Edwards grante Yow! I'm having BEAUTIFUL
at THOUGHTS about the INSIPID
visi.com WIVES of smug and wealthy
CORPORATE LAWYERS...
------------------------------
From: Lisa Wilcox <[EMAIL PROTECTED]>
Subject: MORE INFO Re: Question: system() from C++ CGI to Perl with Kernel 2.2.16
Date: Wed, 19 Jul 2000 14:53:12 -0400
Thanks to everyone who responded. I haven't gotten much farther, but at
least I'm ruling things out. First, let me summarize the problem. I've got
a C++ CGI making a syscall (system()) to a Perl module on a Red Hat Linux
server running kernel 2.2.16. I actually am doing this on two servers.
Everything is similar (the CGI code, C++ and Perl, and the back end system
are identical) except that the test server runs the syscall and the
production server (with the newer kernel 2.2.16) does not.
Basically, the C++ CGI takes arguments from the HTML form and passes them
first to a back end search and retrieval system, then makes a system call to
the Perl module, which does a search of the individual "hits" reported by
the search and retrieval system. After the Perl module is finished, the C++
CGI finishes processing the hit list. On the test server, the output of the
Perl module is printing back to the user. On the production server, the
output of the Perl module is not printing back to the user. The main
difference is in the versions of glibc and the linux kernel.
As suggested, I tried using the -w flag, but I'm not seeing additional error
messages. Actually, I'm not seeing any error messages. Nothing is
reporting to /var/log/httpd/error_log. If I use "use strict", the script
balks at the number of globally scoped variables I'm using. Lazy
programming practice, I know. But if this were part or all of the problem,
why would this be an issue on one server and not the other? Otherwise, if I
run the Perl program at the command line, it works as expected.
I did grab the return value of the syscall, which is a high nonzero,
positive number (33,000+, depending on the query used) on the version that
does not work as expected. Where it does work as expected, the number
returned is zero. According to the system, system() should return -1 or 127
if there is an error, and zero is the string is null and the shell is not
available. What does this mean?
Using strace wasn't very useful to me because I can't run the C++ CGI from
the command line. (It's programmed to parse GET or POST method requests.)
I did use strace on the command without the arguments just to see what I
would get, and found no differences between the version that works and the
one that does not.
I haven't tried adding a statement at the beginning of the C++ program that
makes STDERR go to a special log file. That's next on my list. Thanks to
Stephen Harris for that suggestion.
Thanks again for all of your help.
Lisa Wilcox wrote:
> Hello all,
>
> I've got a C++ CGI making a syscall to a Perl program on a Red Hat Linux
>
> test server with kernel 2.2.5, and working beautifully. On another
> system where the main difference is the kernel (2.2.16), it doesn't work
>
> at all. I have combed through all relevant logs in /var/log and there
> are no error messages whatsoever. It appears to be running the Perl
> program, as error messages from its system calls are being logged to
> /var/log/httpd/error_log. I've tried using popen() instead, with no
> success. The C++ CGI compiles cleanly and runs as expected with
> exception of the system call. The Perl program runs as expected when
> run from the command line.
>
> What's the problem?!?! Is this a security issue? Is this just a bug
> and all I need is a patch? I'm using Perl 5.005_03, glibc 2.1.2-11,
> apache 1.3.12, and compiling with g++. I *really* don't want to embed a
>
> Perl interpreter because I think its overkill for what I'm trying to
> do. However, if the problem is a security issue blocking the execution,
>
> either within Apache or the kernel, I would be willing to do it. If
> someone could recommend an example that makes sense, I would appreciate
> it. All I want to do is run the program and have the results print back
>
> to the user.
>
> Any solutions to the problem would be joyously received.
>
> Thanks,
>
> --
> Lisa Wilcox
> SAGE Systems Developer
> SAGE Project: http://sage.library.emory.edu/
> Woodruff Library/Emory University
> Email: [EMAIL PROTECTED]
> Phone: 404-727-0961
--
Lisa Wilcox
SAGE Systems Developer
SAGE Project: http://sage.library.emory.edu/
Woodruff Library/Emory University
Email: [EMAIL PROTECTED]
Phone: 404-727-0961
------------------------------
From: David Wragg <[EMAIL PROTECTED]>
Subject: Re: C problem
Date: 19 Jul 2000 14:06:17 +0000
[EMAIL PROTECTED] (China Blue Ribbon Commission) writes:
> / in the follow example, when it call strtok, it will got segmentation fault
> / in Linux,
> / but with the same code, it won't happen in win32, what is the problem?
> / i got to use strcpy or strdup to eliminate this prolem.
> /
> / int main(void){
> / char *str = "abc";
> / char *brkstr = ",";
> / char *s;
> /
> / s = strtok(str, brkstr);
> / }
>
> I believe strtok tries to modify the string in place to keep its context
> between calls. A literal string "abc" is usually put on a read-only page
> in unix, so that attempting to modify it will cause a page permission
> violation. So, yes, you would have to copy the string to a writable page
> yourself, or tell the compiler to put string literals on a writable page.
There's a much easier way. Change the declaration of str to be
char str[] = "abc";
This says that you want an initialized char array (which will be
writable since you haven't declared it const), rather than a pointer
to a string literal (which might not be writable). And it works
within the C90 and C99 standards, unlike compiler flags for writable
strings.
David Wragg
------------------------------
From: [EMAIL PROTECTED] (Pete Zaitcev)
Subject: Re: Drivers: read routine
Date: Wed, 19 Jul 2000 19:42:56 GMT
> Please copy any answers to [EMAIL PROTECTED]
Hmm
> /* also tried &test[0] */
> __copy_to_user((char *) buf , test,5);
Use copy_to_user(), check for its return code, and make sure twice
that you have its arguments in right order. I never can remember
which is source and which is destination.
--Pete
------------------------------
Subject: Re: strange "mv" bug
From: [EMAIL PROTECTED] (Daniel R. Grayson)
Date: 19 Jul 2000 15:20:12 -0500
[EMAIL PROTECTED] (Mario Klebsch) writes:
> [EMAIL PROTECTED] (Daniel R. Grayson) writes:
>
> >Here is a fix.
>
> >- ep->node = (char *) node;
> >+ ep->node = (char *) strdup(node);
>
> Just adding a strdup()? Don't you have to add a matching free()
> somwhere to avoid creating a memory leak?
No, these file names must be remembered until the 'mv' is done moving the
files. But after that, it exits.
> Anyway, mv(1) doesn't normally live long enough to seriously complain
> about a memory leak. :-)
Yup.
------------------------------
From: [EMAIL PROTECTED] (Rick Ellis)
Subject: Re: Programming giude for the network device drvier like an ethernet or adsl
modem
Date: 19 Jul 2000 20:41:41 GMT
In article <[EMAIL PROTECTED]>,
Kaz Kylheku <[EMAIL PROTECTED]> wrote:
>>I am interested in the programming of the network device driver.
>>If you have the related information to this, please let me know it or the
>>URL....
>The programming guide is in the kernel source code. There are so many network
>drivers in the drivers/net directory, that it would be surprising if you could
>not create a new one after reading a good number of them.
There's also some good information at:
http://kernelbook.sourceforge.net
--
http://www.fnet.net/~ellis/linux.html
------------------------------
From: Olivier ROBERT <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.setup,comp.os.linux.misc
Subject: Re: CHILD_MAX: can't limit the number of processes per real UID
Date: Wed, 19 Jul 2000 22:44:34 +0200
For people interested in the subject, I solved my problem...
CHILD_MAX seems to be no longer supported on Linux kernels, now that the
limit on user processes can be set dynamically! See the setrlimit()
system call and the bash primitive ulimit for details!
O.R.
------------------------------
From: Dave Boutcher <[EMAIL PROTECTED]>
Subject: Re: Resources for writing device drivers
Date: 19 Jul 2000 15:35:11 -0500
MJ Dainty <[EMAIL PROTECTED]> writes:
> My list already includes the kernel source tree :) but I was wondering
> if there were any good books. I saw the O'Reilly "Linux Device Drivers"
> book, and given their reputation, I'm tempted. However the book was
> published 1997/98, and I'm concerned that the book may be out of date
> given the constantly advancing state of the kernel, so something more
> up-to-date would be nice.
This book is basically THE only book. It is still very relevant. I've
heard there is a new version coming out this year.
Dave B
------------------------------
From: David Wragg <[EMAIL PROTECTED]>
Subject: Re: floating point issue
Date: 19 Jul 2000 19:44:45 +0000
Mathias Waack <[EMAIL PROTECTED]> writes:
> It can. Nobody forbids you doing floating point calculation inside the
> kernel. The kernel sources are free. Do what you want with it.
>
> But adding floating point support to kernel would add a lot of code and
> slow down the whole kernel. So the kernel will (probably) never support
> floating point.
Actually, it's quite easy. The kernel now does it, though to use MMX
rather than floating point; see arch/i386/lib/mmx.c in 2.4.0testX.
(In interrupts it might be a bit harder though).
> And there is not need for this. I've never seen a
> situation where somebody really(!) needs floating point in a driver.
> Do this stuff in the user space and avoid a lot of problems.
Yes. I think the reasoning is not "you shouldn't use floating point
because the kernel can't handle it", but rather "the kernel can't
handle it because you shouldn't use floating point".
David Wragg
------------------------------
From: "Robert T. Bauer" <[EMAIL PROTECTED]>
Subject: Re: Semaphores in the kernel
Date: Wed, 19 Jul 2000 14:24:43 -0700
Wayne,
You may wish to consider having the user level tasks write the control
messages to special device. Then you write a
very simple device driver that takes the requests off the queue and
processes them. Since, by design, the "filesystem"
will write the data in buffers you use the os services to avoid concurrency.
by opening the device in synchronous mode
you can enforce blocking semantics on your application.
Now, your device driver "simply" reads the requests off the queue just as an
ordinary (block) device driver would.
My suggestion: you don't need semaphores, nor spinlocks for this problem -
they'll just waste cpu cycles.
Robert.
Wayne Rasmuss wrote in message <[EMAIL PROTECTED]>...
> I am creating an extension to the linux-2.2.9 kernel that deals with
>forwarding packets received via an eithernet interface. I use ioctl
>functions to change routing information. I need to protect my data
>against collisions between ioctl calls from different applications. or
>one application and the kernel. Does anyone know the correct way to do
>this?
>
>
>Thanks For Your Help
>
>Wayne
>
------------------------------
From: Wesley Wong <[EMAIL PROTECTED]>
Subject: Question about after upgrading kernel
Date: Wed, 19 Jul 2000 21:30:08 GMT
1. After kernel is compiled (bzImage is out), will all the .o files be
deleted automatically? Or I have to do it myself?
2. After I got the whole thing working (being able to boot with the new
image) is it a good idea to remove the /usr/src/linux tree? If not the
whole tree, what files I can deleted? (I want to save space by removing
the source, since I won't need it until the next update...but I don't know
what files to delete)
3. Is it a good idea then to remove /usr/src/linux/modules? Should I do
"make clean" after I installed the new kernel? Is "make clean" the same as
"make mrproper" ?? Should I do a make clean after I got all the things
working? (installed kernel, installed modules)
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
From: Wesley Wong <[EMAIL PROTECTED]>
Subject: How to deal with System.map and Module_info after updating kernel
Date: Wed, 19 Jul 2000 21:30:09 GMT
When I am updating the kernel, I know I should make backup of my old image
file and probably old initrd.img file. But tutorials never mention about
the System.map, and Module_info. They are still pointing to the old file?
or Should I create new one? how? (I can't find any Module_info file in
/usr/src/linux directories...)
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
From: Wesley Wong <[EMAIL PROTECTED]>
Subject: Some questions about modules
Date: Wed, 19 Jul 2000 21:30:09 GMT
1.) I don't understand where the files go for modules. Do they give me a
.o for each modules I needed? Is it all in /lib/modules/2.2.xx? If not,
where is all the .o file?
2.) what's the different between the /lib/modules and
/usr/src/linux/modules ?? They both seems to have a lot of .o modules in
it... while /usr/src/linux/modules seems to have more
than /lib/modules. Which one is safe to delete?
3.) How do I set it so that it will/will not load a
certain module at boot time?
4.) How come the tutorials for updating kernel did not mention anything
about backuping the modules files? Do we need to? If we need to, how?
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
From: Wesley Wong <[EMAIL PROTECTED]>
Subject: recompile kernel...??
Date: Wed, 19 Jul 2000 21:30:10 GMT
If I find out that I have a option unchecked in previous make menuconfig,
that I need it check now, do I need to recompile the whole kernel again?
(meaning run "make menuconfig dep clean bzImage modules modules_install")
Is there a fast and convenient way to do it rather than that because
compiling kernel takes time.... if I just need to reconfigure a little
part of kernel is there a way to do so? I am asking in general. Thanks for
teaching this newbie.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Question about after upgrading kernel
Reply-To: [EMAIL PROTECTED]
Date: Wed, 19 Jul 2000 21:30:37 GMT
On Wed, 19 Jul 2000 21:30:08 GMT, Wesley Wong <[EMAIL PROTECTED]> wrote:
>1. After kernel is compiled (bzImage is out), will all the .o files be
>deleted automatically? Or I have to do it myself?
No, for that you do a make clean.
>2. After I got the whole thing working (being able to boot with the new
>image) is it a good idea to remove the /usr/src/linux tree? If not the
No, because the header files are needed. There are symbolic links
in /usr/include that point there. If you blow away the whole kernel source
tree, you won't be able to compile userland things.
--
Any hyperlinks appearing in this article were inserted by the unscrupulous
operators of a Usenet-to-web gateway, without obtaining the proper permission
of the author, who does not endorse any of the linked-to products or services.
------------------------------
** 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
******************************