Linux-Development-Sys Digest #947, Volume #7 Mon, 12 Jun 00 02:13:09 EDT
Contents:
Re: Getting IP from Telnet-User ("Wouter Verhelst")
Alan Po Again. How to start to study the KERNEL of Linux ("Alan Po")
Get BIOS name and version (Adam R)
Re: Alan Po Again. How to start to study the KERNEL of Linux (Steve Martin)
pthreads programming question ([EMAIL PROTECTED])
Contexts in Linux? ("Pablo Schklowsky")
Re: Alan Po Again. How to start to study the KERNEL of Linux ("Alex DeLarge")
Re: pthreads programming question (Kaz Kylheku)
Re: how to access /proc/ files from Kernel Module? ([EMAIL PROTECTED])
Re: Alan Po Again. How to start to study the KERNEL of Linux ([EMAIL PROTECTED])
Re: Alan Po Again. How to start to study the KERNEL of Linux ("Alan Po")
how to get disk information of linux? ("Harold")
Re: how to access /proc/ files from Kernel Module? (Sam Birch)
Re: Alan Po Again. How to start to study the KERNEL of Linux (Sam Birch)
----------------------------------------------------------------------------
From: "Wouter Verhelst" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development
Subject: Re: Getting IP from Telnet-User
Date: Sun, 11 Jun 2000 14:01:48 GMT
Jan R�hrich <[EMAIL PROTECTED]> schreef in berichtnieuws
[EMAIL PROTECTED]
> How can I find out the IP of the client-system in a telnet-session? I
> want to use the IP to connect back!
You can parse it out of "finger" 's output. It's not difficult, I've done
this a dozen times...
--
Greetings,
Wouter
------------------------------
From: "Alan Po" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development,comp.os.linux.hardware
Subject: Alan Po Again. How to start to study the KERNEL of Linux
Date: Sun, 11 Jun 2000 23:22:50 +0800
Dear all!
Alan again, the University student who need to write an embedded Linux.
Before to start my project, I want to know more about the design and
structure of Linux Kernel. Is there any good reference on the web or books?
I have found a web which is the Linux Documentation Project (LDP) but I want
to know more. Please give me some suggestion and recommendation.
Thanks a lot,
Alan Po
[EMAIL PROTECTED]
------------------------------
From: Adam R <[EMAIL PROTECTED]>
Subject: Get BIOS name and version
Date: 11 Jun 2000 11:37:44 -0700
Is there a way to get the name and version
of the BIOS programmatically from linux?
Thanks in advance
Adam
------------------------------
From: Steve Martin <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development,comp.os.linux.hardware
Subject: Re: Alan Po Again. How to start to study the KERNEL of Linux
Date: Sun, 11 Jun 2000 16:03:54 -0400
Alan Po wrote:
> Before to start my project, I want to know more about the design and
> structure of Linux Kernel.
For Unix OS internals, I'd suggest "The Design of the UNIX Operating
System" by Maurice J. Bach. (Warning: it's heady stuff.)
After you've waded your way through that, go to www.amazon.com
and do a search on "Linux kernel" for more Linux-specific resources.
------------------------------
From: [EMAIL PROTECTED]
Subject: pthreads programming question
Date: Sun, 11 Jun 2000 21:40:57 GMT
Hi:
I have this multi threaded C++ program with pthreads. One of the APIs
used to make an Orbix( CORBA ) call to a legacy system seems to be
taking a lot of times. I m trying to put a timeout for this call. Right
now what I m planning to do is as follows...
===================
1. A thread is ready to make teh legacy call.
2. It creates/initializes a condition variable ( pthread_cond_init() )
3. It creates a new thread, by passing the cond variable pointer along
with other data required to make teh call, in the call to
pthread_create ().
4. The new thread makes teh legacy call. When teh call returns, just
before terminating, this thread signals the cond variable.
5. Meanwhile the original thread wait on the cond variable using
pthread_cond_timedwait() which waits/blocks only for a pre defined
time. 6. The main thread checks teh return value of
pthread_cond_timedwait(). If it is ETIMEDOUT, it will pthread_kill()
the child thread and throw an exception to the user.
=================
Now the question.
1. Do you see any problem with this strategy.
2. Is there a better way to do it since this method requires teh
creation of a thread and condition variable and a mutex per legacy
call. 3. A general one - In a multithreaded environment, how is the
system call sleep() working irrespective of which signals you have
blocked or ignored. ( My basis for the confusion is that sleep() works
by
interrupting the sleep() call by a kernal generated SIGALARM signal
when the sleep time expires ).
Any clarification for any of teh questions will be greatly appreciated.
Thanks
Sony
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: "Pablo Schklowsky" <[EMAIL PROTECTED]>
Subject: Contexts in Linux?
Date: Sun, 11 Jun 2000 18:02:46 -0400
Hi, all - does anyone know whether ucontext.h is supported by the Linux
kernel? I'm running RedHat 6.2, gcc version egcs-2.91.66, and whenever I
make a reference to getcontext, swapcontext, etc., I get the warning:
"warning: foo is not implemented and will always fail" (where foo is
getcontext or setcontext or whatever). Anyone else get this? Thanks,
-pablos
------------------------------
From: "Alex DeLarge" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development,comp.os.linux.hardware
Subject: Re: Alan Po Again. How to start to study the KERNEL of Linux
Date: Sun, 11 Jun 2000 23:00:23 +0100
Do you need to write it on your own, or do you want to join a project to
make a full version of Linux that fits on a compact flash card?
--
Alex DeLarge: DeLarge and in charge
Check out http://www.bristol2600.org.uk for all your Bristol 2600 meet
needs.
First friday each month!
Guven Linux at 0.01rc5
Alan Po <[EMAIL PROTECTED]> wrote in message
news:8i0av0$[EMAIL PROTECTED]...
> Dear all!
>
> Alan again, the University student who need to write an embedded Linux.
> Before to start my project, I want to know more about the design and
> structure of Linux Kernel. Is there any good reference on the web or
books?
> I have found a web which is the Linux Documentation Project (LDP) but I
want
> to know more. Please give me some suggestion and recommendation.
>
> Thanks a lot,
>
> Alan Po
> [EMAIL PROTECTED]
>
>
>
>
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: pthreads programming question
Reply-To: [EMAIL PROTECTED]
Date: Sun, 11 Jun 2000 22:22:56 GMT
On Sun, 11 Jun 2000 21:40:57 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>Hi:
> I have this multi threaded C++ program with pthreads. One of the APIs
>used to make an Orbix( CORBA ) call to a legacy system seems to be
>taking a lot of times. I m trying to put a timeout for this call. Right
>now what I m planning to do is as follows...
There is no safe way to cancel a thread calling third-party code that is not
known to be cancellation safe.
>Now the question.
>1. Do you see any problem with this strategy.
Yes; you have no clue what state the legacy library is in when you kill
the thread. So after this action, you cannot possibly rely on that
library ever again.
If that library is properly designed with POSIX threads in mind,
it should be robust to a pthread_cancel. The pthread cancellation
mechanism allows libraries to register clean-up handlers, so that
they can put themselves into a sane state when a thread is
cancelled. They can also control when cancellation can happen.
Of course, unless third party code to which you have no sources
documents that it is robust this way, you can't assume it.
--
#exclude <windows.h>
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: how to access /proc/ files from Kernel Module?
Date: Sun, 11 Jun 2000 23:14:15 GMT
i'm also interested in the same thing.
i've read Rubini but i still want to access /proc files and normal
files for 3 reasons:
1) user mode programs will evenutally create/read files I want to
access from my kernel modules
2) i won't be accessing these files often, so the performance is not
an issue compared to implementing a higher performance mechanism when
performance is not an issue
3) debugging is simplified when i can read/write the configuration
/proc files from the command line and/or simple scripts
So.... i am still looking for how to open/read/write/etc. normal and
/proc files
Also, on the kernel/user/kernel context switching issue,
there must be kernel mode access functions available without the
context switching.
According to "Linux Kernel Internals, 2nd Ed." (Beck, Bohme, et. al.),
sys_open(), sys_close(), sys_read(), & sys_write() all exist.
both sys_open() & sys_close() are in linux/fs/open.c but the only one
i can see in /proc/ksyms and linkto from a kernel moduel is
sys_close()
sys_read() & sys_write are in linux/fs/read_write.c but i can't see
them in /proc/ksyms or link to them
adding
#include <linux/fs.h>
adds function prototypes for sys_open() & sys_close() but not the rest
but i still get a linkage failure on sys_open() when i run insmod
what do i do to get at the rest?
thanks for the suggestion, but i'm still not there.
eagerly looking for a soulution
On Sat, 10 Jun 2000 07:40:21 GMT, Sam Birch <[EMAIL PROTECTED]>
wrote:
>On Sat, 10 Jun 2000 21:07:51 GMT, [EMAIL PROTECTED] wrote:
>
>>my objective is to have several modules locate each other using /proc
>>files to publish pointers to functiions and data structures
>>i'm already publishing the pointers, now i need to read them from
>>other kernel modules.
>>
>>this way modules can gracefully handle a missing non-critical module
>>without failing to load due to a link failure.
>>also addresses loading/unloading sequence issues.
>
>The kernel has the functionality you desire without having to resort
>to accessing the proc files. In fact, accessing the proc filesystem
>is doing double duty. Any time you would perform a read on the proc
>filesystem, you are actually having a module perform a user-space to
>kernel-space copy of data which another module is creating dynamically
>by doing a kernel-space to user-space copy......just keep it in the
>kernel!?!
>
>Look into request_module, release_module, etc... in
>linux/include/linux/kerneld.h. This topic is pretty well covered in
>Linux Device Drivers, by Alessandro Rubini (in the chapter "Loading
>modules on demand").
>
>HTH
>Sam
------------------------------
From: [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.hardware,comp.os.linux.development
Subject: Re: Alan Po Again. How to start to study the KERNEL of Linux
Date: Sun, 11 Jun 00 21:10:18 PDT
In Article<8i0av0$[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> writes:
> Path:
>reader4.news.rcn.net!feed1.news.rcn.net!rcn!news.maxwell.syr.edu!newsgate.netvigator.com!imsp212.netvigator.com!not-for-mail
> From: "Alan Po" <[EMAIL PROTECTED]>
> Newsgroups:
>comp.os.linux.development,comp.os.linux.development.system,comp.os.linux.hardware
> Subject: Alan Po Again. How to start to study the KERNEL of Linux
> Date: Sun, 11 Jun 2000 23:22:50 +0800
> Organization: IMS Netvigator
> Lines: 16
> Message-ID: <8i0av0$[EMAIL PROTECTED]>
> NNTP-Posting-Host: pcd044132.netvigator.com
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 5.00.2615.200
> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
> Xref: reader4.news.rcn.net comp.os.linux.development.system:116310
>comp.os.linux.hardware:234297
>
> Dear all!
>
> Alan again, the University student who need to write an embedded Linux.
> Before to start my project, I want to know more about the design and
> structure of Linux Kernel. Is there any good reference on the web or books?
> I have found a web which is the Linux Documentation Project (LDP) but I want
> to know more. Please give me some suggestion and recommendation.
>
> Thanks a lot,
>
> Alan Po
> [EMAIL PROTECTED]
>
>
>
>
There's a book published by Coriolis publishing that contains full LINUX
kernel code (for some unknown to me version). As a note, Coriolis has
published several equally depth volumes for similar nuts-and-bolts topics.
The LINUX ernel books is not especially cheap (nor are the others). But I
suspect all would be a good place to start . . . .
------------------------------
From: "Alan Po" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development,comp.os.linux.hardware
Subject: Re: Alan Po Again. How to start to study the KERNEL of Linux
Date: Mon, 12 Jun 2000 11:01:53 +0800
Yes! I need to write it on my own and then minimize it so that it is small
enough to fit into any environment.
Alan Po
Alex DeLarge <[EMAIL PROTECTED]> wrote in message
news:8i12h8$9oj$[EMAIL PROTECTED]...
> Do you need to write it on your own, or do you want to join a project to
> make a full version of Linux that fits on a compact flash card?
>
> --
> Alex DeLarge: DeLarge and in charge
>
> Check out http://www.bristol2600.org.uk for all your Bristol 2600 meet
> needs.
> First friday each month!
>
> Guven Linux at 0.01rc5
>
> Alan Po <[EMAIL PROTECTED]> wrote in message
> news:8i0av0$[EMAIL PROTECTED]...
> > Dear all!
> >
> > Alan again, the University student who need to write an embedded Linux.
> > Before to start my project, I want to know more about the design and
> > structure of Linux Kernel. Is there any good reference on the web or
> books?
> > I have found a web which is the Linux Documentation Project (LDP) but I
> want
> > to know more. Please give me some suggestion and recommendation.
> >
> > Thanks a lot,
> >
> > Alan Po
> > [EMAIL PROTECTED]
> >
> >
> >
> >
>
>
------------------------------
From: "Harold" <[EMAIL PROTECTED]>
Subject: how to get disk information of linux?
Date: Mon, 12 Jun 2000 11:18:49 +0800
This is a multi-part message in MIME format.
=======_NextPart_000_001D_01BFD45F.FB5693C0
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Untitled Documenthi all,
how to get disk information, such as=20
partition, type, file system, etc.
Thanks.
==========================================================================
=======
Welcome to my linux page:
Linux Paradise (under construction)
BTW: Because my job is so busy, I=20
want some friend to maintain this=20
site with me together, please give=20
me some suggestion.
Thanks.=20
=======_NextPart_000_001D_01BFD45F.FB5693C0
Content-Type: text/html;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Untitled Document</TITLE>
<META content=3D"text/html; charset=3Dgb2312" =
http-equiv=3DContent-Type><BASE=20
href=3Dfile://C:\WIN98\Desktop\>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>hi all,</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>how to get disk information, such as </DIV>
<DIV>partition, type, file system, etc.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Thanks.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<HR>
<BR>
<P>Welcome to my linux page:<BR><A href=3D"http://hyang.uhome.net"=20
target=3D_blank>Linux Paradise</A> (under construction)<BR>BTW: Because =
my job is=20
so busy, I <BR>want some friend to maintain this <BR>site with me =
together,=20
please give <BR>me some suggestion.<BR>Thanks. </P></BODY></HTML>
=======_NextPart_000_001D_01BFD45F.FB5693C0==
------------------------------
From: Sam Birch <[EMAIL PROTECTED]>
Subject: Re: how to access /proc/ files from Kernel Module?
Reply-To: [EMAIL PROTECTED]
Date: Mon, 12 Jun 2000 05:31:37 GMT
On Sun, 11 Jun 2000 23:14:15 GMT, [EMAIL PROTECTED] wrote:
>i'm also interested in the same thing.
>i've read Rubini but i still want to access /proc files and normal
>files for 3 reasons:
>
>1) user mode programs will evenutally create/read files I want to
>access from my kernel modules
After poking around a bit, I think you may want to look into
do_generic_file_read(). The khttpd module uses this (linux 2.3/4
kernels only).
>2) i won't be accessing these files often, so the performance is not
>an issue compared to implementing a higher performance mechanism when
>performance is not an issue
>
>3) debugging is simplified when i can read/write the configuration
>/proc files from the command line and/or simple scripts
Hear, Hear! I agree with that! But what does that have to do with two
of your modules communicationg with each other...or with having to
read/write to normal files?
>So.... i am still looking for how to open/read/write/etc. normal and
>/proc files
>
>Also, on the kernel/user/kernel context switching issue,
>there must be kernel mode access functions available without the
>context switching.
>According to "Linux Kernel Internals, 2nd Ed." (Beck, Bohme, et. al.),
>sys_open(), sys_close(), sys_read(), & sys_write() all exist.
These are only there for file system operations.
What I meant was that a proc file is something that is only virtual.
Your module's code writes to its buffer when a user app reads it. You
are populating a user-space memory location with kernel code. You are
calling kernel code to read a virtual user-space file, which has to be
dynamically populated by your other modules file operations.
If you are in the kernel already, reading a proc file, you are reading
a buffer that had to be filled from the kernel...you should already be
able to access that information from within the kernel, especially if
it is YOUR modules, you can export anything you want...
>both sys_open() & sys_close() are in linux/fs/open.c but the only one
>i can see in /proc/ksyms and linkto from a kernel moduel is
>sys_close()
>
>sys_read() & sys_write are in linux/fs/read_write.c but i can't see
>them in /proc/ksyms or link to them
fs ops only...
>adding
>#include <linux/fs.h>
>adds function prototypes for sys_open() & sys_close() but not the rest
>but i still get a linkage failure on sys_open() when i run insmod
>
>what do i do to get at the rest?
>
>thanks for the suggestion, but i'm still not there.
>
>eagerly looking for a soulution
>
>
>
>On Sat, 10 Jun 2000 07:40:21 GMT, Sam Birch <[EMAIL PROTECTED]>
>wrote:
>
>>On Sat, 10 Jun 2000 21:07:51 GMT, [EMAIL PROTECTED] wrote:
>>
>>>my objective is to have several modules locate each other using /proc
>>>files to publish pointers to functiions and data structures
>>>i'm already publishing the pointers, now i need to read them from
>>>other kernel modules.
>>>
>>>this way modules can gracefully handle a missing non-critical module
>>>without failing to load due to a link failure.
>>>also addresses loading/unloading sequence issues.
>>
>>The kernel has the functionality you desire without having to resort
>>to accessing the proc files. In fact, accessing the proc filesystem
>>is doing double duty. Any time you would perform a read on the proc
>>filesystem, you are actually having a module perform a user-space to
>>kernel-space copy of data which another module is creating dynamically
>>by doing a kernel-space to user-space copy......just keep it in the
>>kernel!?!
>>
>>Look into request_module, release_module, etc... in
>>linux/include/linux/kerneld.h. This topic is pretty well covered in
>>Linux Device Drivers, by Alessandro Rubini (in the chapter "Loading
>>modules on demand").
>>
>>HTH
>>Sam
------------------------------
From: Sam Birch <[EMAIL PROTECTED]>
Subject: Re: Alan Po Again. How to start to study the KERNEL of Linux
Reply-To: [EMAIL PROTECTED]
Date: Mon, 12 Jun 2000 05:41:04 GMT
On Sun, 11 Jun 2000 23:22:50 +0800, "Alan Po" <[EMAIL PROTECTED]>
wrote:
>Dear all!
>
>Alan again, the University student who need to write an embedded Linux.
>Before to start my project, I want to know more about the design and
>structure of Linux Kernel. Is there any good reference on the web or books?
>I have found a web which is the Linux Documentation Project (LDP) but I want
>to know more. Please give me some suggestion and recommendation.
>
>Thanks a lot,
>
>Alan Po
>[EMAIL PROTECTED]
>
I don't know which book is the best for learning the kernel overall,
but I have learned a lot by reading/using Linux Device Drivers (by
Alessandro Rubini), using LXR (http://lxr.linux.no/), and thumbing
through the Guides (Linux Kernel Hackers Guide, Linux Kernel Module
Programming Guide, etc.).
Since your goal is an embedded system, it might be good to look over
ongoing projects...I have come across at least a couple.
http://www.linux-embedded.com/ would be a good place to start...
HTH
Sam
------------------------------
** 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
******************************