Linux-Development-Sys Digest #667, Volume #8 Tue, 24 Apr 01 11:13:18 EDT
Contents:
Re: How to get a number of processors (Dave Blake)
DVD Driver setup (Stefano Totaro)
Re: How to get a number of processors (Chris)
Re: Booting Linux on a robot ([EMAIL PROTECTED])
Re: shell programming question ([EMAIL PROTECTED])
Re: action command in initd scripts (Kasper Dupont)
Re: shell programming question (Kasper Dupont)
Re: [Help:] File system programming (Kasper Dupont)
Re: a newbie in linux device driver writing. ("NoWords")
Re: request_fn in 2.4? ("Peter T. Breuer")
Re: Booting Linux on a robot (Paul Sherwin)
Re: DVD Driver setup (Rolf Magnus)
Re: request_fn in 2.4? ("Andy Jeffries")
Re: Need your recommendation for a full-featured text editor (James Kanze)
File access within a kernel mod ("Wayne")
troubleshooting a kernel mod ("Wayne")
Re: File access within a kernel mod ("Zoran Cutura")
Re: Booting Linux on a robot (Steve Campbell)
Re: troubleshooting a kernel mod ("Zoran Cutura")
Re: Need your recommendation for a full-featured text editor (James Kanze)
----------------------------------------------------------------------------
From: [EMAIL PROTECTED] (Dave Blake)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: How to get a number of processors
Date: 24 Apr 2001 07:04:22 GMT
Reply-To: [EMAIL PROTECTED]
Chris <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > In comp.os.linux.development.system Chris <[EMAIL PROTECTED]> wrote:
> > > Hong Hsu wrote:
> > >> processors running in the host machine, is there API which allows me to
> > >> get a number of processors?
> > > sysconf(2); /usr/include/bits/confname.h
> > > printf("%d\n", sysconf(_SC_NPROCESSORS_CONF));
> > A better bet would be to have your program look at /proc/cpuinfo
> No it wouldn't.
Parsing /proc is the only way on a linux system. The kernel API
does not support the POSIX sysconf standard, although the glibc
maintainers do support it (I think by parsing /proc).
And I think that /proc/stat is going to prove more resistant to
change than /proc/cpuinfo, but neither are above change. I do
know that the procps package does need to know the number of
CPUs for a few things, and it parses /proc/stat to get this
info.
Including files directly from /usr/include/bits is kinda
poor form wrt compatibility though...
--
Dave Blake
[EMAIL PROTECTED]
------------------------------
From: Stefano Totaro <[EMAIL PROTECTED]>
Subject: DVD Driver setup
Date: Tue, 24 Apr 2001 10:20:33 GMT
Hi all,
I have a problem with a dvd: it is too noisy.
May anybody of you suggest to me how to limitate
the rotation speed of the dvd?
Thanks,
Stefano Totaro
p.s.
please reply via e-mail. Thanks!
------------------------------
From: Chris <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: How to get a number of processors
Date: Tue, 24 Apr 2001 12:50:50 +0100
Dave Blake wrote:
>
> Chris <[EMAIL PROTECTED]> wrote:
> > [EMAIL PROTECTED] wrote:
> > > In comp.os.linux.development.system Chris <[EMAIL PROTECTED]> wrote:
> > > > Hong Hsu wrote:
>
> > > >> processors running in the host machine, is there API which allows me to
> > > >> get a number of processors?
>
> > > > sysconf(2); /usr/include/bits/confname.h
> > > > printf("%d\n", sysconf(_SC_NPROCESSORS_CONF));
>
> > > A better bet would be to have your program look at /proc/cpuinfo
>
> > No it wouldn't.
>
> Parsing /proc is the only way on a linux system. The kernel API
> does not support the POSIX sysconf standard, although the glibc
> maintainers do support it (I think by parsing /proc).
I was incorrect in stating that it was a system call; it
is not, either on Linux or Solaris.
How glibc does the business is not really important, so
long as it works.
> And I think that /proc/stat is going to prove more resistant to
> change than /proc/cpuinfo, but neither are above change. I do
> know that the procps package does need to know the number of
> CPUs for a few things, and it parses /proc/stat to get this
> info.
This is a terrible idea, because it is gratuitously
non-portable. Obviously this is a linux newsgroup, but
that's no reason to suggest doing something by parsing
some random file in /proc when one could do it more
simply by using a standard and portable interface.
> Including files directly from /usr/include/bits is kinda
> poor form wrt compatibility though...
I wasn't suggesting including it, simply reading it to
find the available names. (Most of them are in the man
page, in fact.)
--
Chris Lightfoot -- chris at ex dash parrot dot com -- www.ex-parrot.com/~chris/
The Clairvoyant Society of London will not meet
Tuesday because of unforeseen circumstances
(announcement in the Financial Times)
------------------------------
From: [EMAIL PROTECTED]
Crossposted-To: alt.linux,alt.os.linux,alt.os.linux.mandrake,comp.os.linux.misc
Subject: Re: Booting Linux on a robot
Date: Tue, 24 Apr 2001 12:14:48 GMT
Jasmin Letendre wrote:
>
> I'm currently developping a six legged robots. The robot has an on-board
> conmputer and we want it to boot from a flash disk. We use Linux
> Mandrake. After long hour of trial and error, we managed to boot from
> the flash disk and have the prompt for a logging name.
>
> The problem is that any user name we enter (even root!) gives a "login
> invalid" without even asking for a password. And if we press
> Ctrl+Alt+Delete, it says "You don't exist. Go away!"
>
> Does anybody has an idea about this problem?
>
> Thanks.
>
> Jasmin
Ummm... Your Robot's name wouldn't happen to be Hal, would it?
jamess
--
"On the side of the software box, in the 'System Requirements' section,
it said 'Requires Windows 95 or better'. So I installed Linux."
-Anonymous
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: shell programming question
Date: Tue, 24 Apr 2001 12:18:45 GMT
On Mon, 23 Apr 2001 16:58:31 GMT, "Simon Bretin"
<[EMAIL PROTECTED]> wrote:
>I'm kind of a newbie in shell porgramming and I'm wanting to do something I
>can't do.
>So I hope somebody will be able to help me.
>
>The purpose of the script is to launch a program. The problem is that the
>program often crashes and has to be relaunched. Also, when the program
>crashes, some processe stays alive and have ot be killed before trying to
>launch the program antoher time.
>
>To do that I did a simple while loop :
>
>while [ 1 -ne 0 ];
>do
> echo launching prog
> ./prog > prog.log 2>&1
>done
>
>You can see that I did not write the part that kills the processes...
>Because I do not know how to do that !
You might be a little farther along, trying to find a program which
does at least part of what you want, and then modifying it. I believe
I've seen a couple of "watching" programs at Freshmeat over the years.
As far as killing these related processes goes, there are (at least) 2
schools of thought that I am aware of. Some programs (like mail
transport agents) actually write their process ID to a file. So, if
you know what file to look in, you can find out what process ID these
processes have. Another thing you can do, is to run the ps program
and pipe the output of that into a pattern matching program, and strip
the process ID after matching just the program (or programs) you are
interested in. Once you have the process ID(s), you send signals to
those programs with the "kill" function.
I hope that points you in the right direction.
Gord
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: action command in initd scripts
Date: Tue, 24 Apr 2001 13:04:55 +0000
nomad wrote:
>
> Hi,
>
> Does anybody knows what the command "action" means in
> the initd scripts ?
> I didn't find any information on the man and Howtos...
>
> Here is a sample of its utilisation:
> action "Bringing up interface lo" ./ifup ifcfg-lo
>
> I've tried to use it in a sh script, but the system resturned me an
> error...
>
> Thanks,
> nomad
>
> --
> Posted from smarthost2.mail.easynet.fr [212.180.1.69]
> via Mailgate.ORG Server - http://www.Mailgate.ORG
It is defined in the file /etc/init.d/functions,
this file is loaded at the start of the script.
It just print the given string, execute the rest
of the arguments as a command and finally print
[OK] or [FAILED], and it also sends output to the
system log.
Just writing ./ifup ifcfg-lo would have same
effect but less output.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: shell programming question
Date: Tue, 24 Apr 2001 13:15:07 +0000
Simon Bretin wrote:
[...]
> crashes, some processe stays alive and have ot be killed before trying to
[...]
You can send a signal to all processes in a process group.
Process groups can be created using the setsid or setpgrp
system calls. I don't know how you create a process group
and get its id from a shell script.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: [Help:] File system programming
Date: Tue, 24 Apr 2001 13:16:40 +0000
J. Liu wrote:
>
> Hi all,
>
> I'm kind of a newbie in kernel programming and and working on file
> systems.
>
> I'd like to know where is "struct inode" defined ?
>
> thanks in advance.
find /usr/src/linux-2.4.1 -type f | xargs grep -l "struct inode {"
/usr/src/linux-2.4.1/include/linux/fs.h
--
Kasper Dupont
------------------------------
Reply-To: "NoWords" <[EMAIL PROTECTED]>
From: "NoWords" <[EMAIL PROTECTED]>
Subject: Re: a newbie in linux device driver writing.
Date: Tue, 24 Apr 2001 13:31:07 GMT
According to www.oreilly.com the ETA is June 2001. I am going to pick one up
myself.
Ron
<[EMAIL PROTECTED]> wrote in message
news:eo%C6.2354$[EMAIL PROTECTED]...
> In comp.os.linux.development.system alan <[EMAIL PROTECTED]> wrote:
> : true (and it's still a good book), that's why there's going to be a
second
> : edition...you can also get beta's of the new example source (which does
> : support 2.4) for the second edition from
>
> I've seen this mentioned a lot ... do you know the ETA on the 2nd edition?
>
> --
> Jeff Gentry [EMAIL PROTECTED] [EMAIL PROTECTED]
> SEX DRUGS UNIX
------------------------------
From: "Peter T. Breuer" <[EMAIL PROTECTED]>
Subject: Re: request_fn in 2.4?
Date: Tue, 24 Apr 2001 13:59:35 GMT
Andy Jeffries <[EMAIL PROTECTED]> wrote:
> I am trying to write a 2.4 device driver but (basing it on the code in
> Linux Device Drivers by Mr Rubini) it complains about blk_dev[MAJOR] nor
> having a member named request_fn.
> I see from some of the kernel source code that there is a new style for
> request functions, something called make_request_fn. But I can't find
> any documentation on how to port it (or how to write 2.4 drivers from
> scratch).
The documentation IS the code. Look at examples of use in the other
drivers. Or just read the registration code itself. It should be plain to
you then.
Peter
------------------------------
From: [EMAIL PROTECTED] (Paul Sherwin)
Crossposted-To: alt.os.linux,alt.os.linux.mandrake,comp.os.linux.misc
Subject: Re: Booting Linux on a robot
Date: Tue, 24 Apr 2001 14:08:25 GMT
On Wed, 18 Apr 2001 02:49:41 GMT, Jasmin Letendre
<[EMAIL PROTECTED]> wrote:
>I'm currently developping a six legged robots. The robot has an on-board
>conmputer and we want it to boot from a flash disk. We use Linux
>Mandrake. After long hour of trial and error, we managed to boot from
>the flash disk and have the prompt for a logging name.
>
>The problem is that any user name we enter (even root!) gives a "login
>invalid" without even asking for a password. And if we press
>Ctrl+Alt+Delete, it says "You don't exist. Go away!"
>
>Does anybody has an idea about this problem?
>
As others have said, you have a problem with /etc/passwd, but if this
is missing for no good reason, other things are likely to be missing
also. Possibly you don't have an /etc directory at all, which you need
to boot into normal multiuser mode (though why do you need mutiuser
mode on a robot???)
I can see why you want to do things this way, and it's an interesting
project, but life will be much easier if you use a hard disk, maybe a
notebook disk if you want to keep the size down.
Best regards, Paul
Paul Sherwin Consulting 22 Monmouth Road, Oxford OX1 4TD, UK
Phone +44 (0)1865 721438 http://www.psherwin.strayduck.com
Mobile +44 (0)7931 578334 mailto:[EMAIL PROTECTED]
------------------------------
From: Rolf Magnus <[EMAIL PROTECTED]>
Subject: Re: DVD Driver setup
Date: Tue, 24 Apr 2001 16:09:43 +0200
Stefano Totaro wrote:
> Hi all,
> I have a problem with a dvd: it is too noisy.
> May anybody of you suggest to me how to limitate
> the rotation speed of the dvd?
Try hdparm, especially the parameter -E.
------------------------------
From: "Andy Jeffries" <[EMAIL PROTECTED]>
Subject: Re: request_fn in 2.4?
Date: Tue, 24 Apr 2001 15:10:34 +0100
>> I am trying to write a 2.4 device driver but (basing it on the code in
>> Linux Device Drivers by Mr Rubini) it complains about blk_dev[MAJOR]
>> nor having a member named request_fn.
>
>> I see from some of the kernel source code that there is a new style for
>> request functions, something called make_request_fn. But I can't find
>> any documentation on how to port it (or how to write 2.4 drivers from
>> scratch).
>
> The documentation IS the code. Look at examples of use in the other
> drivers. Or just read the registration code itself. It should be plain
> to you then.
You're obviously a much more experienced Kernel hacker than I!! I can
read C code well, but trying to pick up structures and function calls
that are embedded in the Kernel (during odd moments in my day-job) is
damn hard.
Someone on IRC did point me to a good porting guide though:
http://linuxkernel.to/module/port-2.4/eng/lkp.html
--
Andy Jeffries
Lead-developer of Scramdisk for Linux
Developer of original Scramdisk Delphi Component
------------------------------
From: James Kanze <[EMAIL PROTECTED]>
Crossposted-To:
alt.comp.shareware.programmer,comp.editors,comp.lang.java.help,comp.lang.java.programmer,comp.lang.java.softwaretools,comp.os.linux.advocacy
Subject: Re: Need your recommendation for a full-featured text editor
Date: Tue, 24 Apr 2001 16:27:36 +0200
Reply-To: [EMAIL PROTECTED]
Johan Kullstam wrote:
> "Aaron R. Kulkis" <[EMAIL PROTECTED]> writes:
> > Syntax highlighting is useful for NOVICE programmers.
> > Most experienced programmers have used one-color text for program
> > code for years...
> for me, 1 color is simply not enough. i want 2 colors -- one for
> foreground and another for background.
At least:-). While I don't like having a different color for
everything under the sun (especially as the simplified parsers used in
the editors often get it wrong anyway), I've found it useful to use
colors (or fonts) to distinguish :
keywords: if I mistype one, I notice immediately, because it
doesn't change color when I hit the blank after it.
comments: especially using block comments, as required by javadoc.
(Even in C, I *always* closed my comments at the end of each
line.)
strings and character literals: especially useful in the cases where
the strings contain data that could be interpreted as code.
The other "modern" features I like are parentheses matching (already
present in the original vi) and automatic indenting (which signals
immediately when I've got a parentheses too many or too few.
--
James Kanze mailto:[EMAIL PROTECTED]
Conseils en informatique orient�e objet/
Beratung in objektorientierter Datenverarbeitung
Ziegelh�ttenweg 17a, 60598 Frankfurt, Germany Tel. +49(069)63198627
------------------------------
From: "Wayne" <[EMAIL PROTECTED]>
Subject: File access within a kernel mod
Date: Tue, 24 Apr 2001 09:30:08 -0500
I'm still getting use to this kernel mod stuff and am curious if there is an
easy way
to access a file on the harddrive.
------------------------------
From: "Wayne" <[EMAIL PROTECTED]>
Subject: troubleshooting a kernel mod
Date: Tue, 24 Apr 2001 09:31:45 -0500
Is there anything out there to help with troubleshooting a kernel mod other
than a bunch of printk's ?? perhaps something you can trace with?
------------------------------
From: "Zoran Cutura" <[EMAIL PROTECTED]>
Subject: Re: File access within a kernel mod
Date: Tue, 24 Apr 2001 16:40:10 +0200
Reply-To: [EMAIL PROTECTED]
Once upon a while "Wayne" <[EMAIL PROTECTED]> wrote:
> I'm still getting use to this kernel mod stuff and am curious
> if there is an easy way
> to access a file on the harddrive.
>
>
If your kernel module needs to do such a thing, I'ld say
you need to consider to redesign your module/system.
Writing to harddrive is not possible from inside the kernel.
You would need to write a user mode program which connects
to the driver and writes the data for the module.
--
Z ([EMAIL PROTECTED])
"LISP is worth learning for the profound enlightenment experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days." -- Eric S. Raymond
------------------------------
From: Steve Campbell <[EMAIL PROTECTED]>
Subject: Re: Booting Linux on a robot
Crossposted-To: alt.linux,alt.os.linux,alt.os.linux.mandrake,comp.os.linux.misc
Date: Tue, 24 Apr 2001 15:45:40 +0100
[EMAIL PROTECTED] wrote:
> Jasmin Letendre wrote:
>>
>> I'm currently developping a six legged robots. The robot has an on-board
>> conmputer and we want it to boot from a flash disk. We use Linux
>> Mandrake. After long hour of trial and error, we managed to boot from
>> the flash disk and have the prompt for a logging name.
>>
>> The problem is that any user name we enter (even root!) gives a "login
>> invalid" without even asking for a password. And if we press
>> Ctrl+Alt+Delete, it says "You don't exist. Go away!"
>>
>> Does anybody has an idea about this problem?
>>
>> Thanks.
>>
>> Jasmin
>
> Ummm... Your Robot's name wouldn't happen to be Hal, would it?
>
> jamess
Needs a lesson in " the 3 laws":)
------------------------------
From: "Zoran Cutura" <[EMAIL PROTECTED]>
Subject: Re: troubleshooting a kernel mod
Date: Tue, 24 Apr 2001 16:55:36 +0200
Reply-To: [EMAIL PROTECTED]
Once upon a while "Wayne" <[EMAIL PROTECTED]> wrote:
> Is there anything out there to help with troubleshooting a
> kernel mod other than a bunch of printk's ?? perhaps something
> you can trace with?
>
>
The proc-fs might be of some help with this, but still is
not enabling you with a sort of traceing for the kernel.
With kgdb (http://kgdb.sourceforge.net/) you will be able
to use a debugger from a remote host via a serial line
connection.
Note that debugging the kernel isn't as easy as debugging
some process in user mode. That is due to the fact that
when there is no kernel running that hosts the debugger
you will not be able to run a debugger. If you wanted to
run a debugger with the kernel on one host, you would be
in need of a kernel that can run a kernel as a process. That
does not work with linux-kernels, AFAIK.
--
Z ([EMAIL PROTECTED])
"LISP is worth learning for the profound enlightenment experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days." -- Eric S. Raymond
------------------------------
From: James Kanze <[EMAIL PROTECTED]>
Crossposted-To:
alt.comp.shareware.programmer,comp.editors,comp.lang.java.help,comp.lang.java.programmer,comp.lang.java.softwaretools,comp.os.linux.advocacy
Subject: Re: Need your recommendation for a full-featured text editor
Date: Tue, 24 Apr 2001 16:39:01 +0200
Reply-To: [EMAIL PROTECTED]
Tor Arntsen wrote:
> Ken Tough <[EMAIL PROTECTED]> writes:
> >Paul Shirley <[EMAIL PROTECTED]> wrote:
> >><[EMAIL PROTECTED]> writes
> >>>Syntax highlighting is useful for NOVICE programmers.
> >>>Most experienced programmers have used one-color text
> >>>for program code for years...
> >>...although the ones that earn a living at it mostly side with the
> >>novices.
> >I think there's probably a UNIX/realtime - "enterprise" divide
> >here. Quick straw poll -- how many UNIX programmers use 1 colour?
> None where I work (although we used to use 2 colours way back :-)
> All of us, many with "enterprise"/Unix experience going decades
> back, are using XEmacs w/colour highlighting. Those that claim that
> experienced programmers have no use for more than 1 (sic) colour
> don't know what they are talking about. It simply means they have
> never really tried it.
I'll second that. With 25 years experience programming, and the last
15 almost exclusively on Unix, I really appreciate the benefits of
syntax coloring. (I might add that even under Windows, I use the
CygWin toolkit, emacs, etc., to have a Unix-like environment.)
--
James Kanze mailto:[EMAIL PROTECTED]
Conseils en informatique orient�e objet/
Beratung in objektorientierter Datenverarbeitung
Ziegelh�ttenweg 17a, 60598 Frankfurt, Germany Tel. +49(069)63198627
------------------------------
** 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
******************************