Linux-Development-Sys Digest #187, Volume #8 Tue, 3 Oct 00 07:13:15 EDT
Contents:
/proc file system help ("Keith")
PCI Documentation ([EMAIL PROTECTED])
Re: PCI Documentation (Pete Zaitcev)
Re: question about memory leaks in linux (Rick Ellis)
Re: question about memory leaks in linux (Karl Heyes)
Re: Linux Stack Sizes? (0/1) (David Wragg)
Re: new windowing system (Christopher Browne)
Re: How to load shared libs at runtime? (Tramm Hudson)
Re: question about memory leaks in linux (Nick Andrew)
Re: How to load shared libs at runtime? ("Peter Koch")
Re: /proc file system help ("[EMAIL PROTECTED]")
"su" inside program ("Jasiu")
Re: extend ethernet header to 18 bytes? (NortonNg)
NFS question (Jerome Corre)
----------------------------------------------------------------------------
From: "Keith" <[EMAIL PROTECTED]>
Subject: /proc file system help
Date: Mon, 2 Oct 2000 16:56:34 -0400
I have a structure that is being implemented in KLIPS (add on to the kernel
which supports IPSec stuff) and I want to be able to access this information
using the /proc file system. How would I go about doing this? How does /proc
work so that it can access it.
I would really appreciate the help guys
Thanks,
Keith
------------------------------
From: [EMAIL PROTECTED]
Subject: PCI Documentation
Date: Mon, 02 Oct 2000 20:55:30 GMT
I am writing a pci driver to interface with a home-grown pci
peripheral. I already have Linux Device Drivers by Alessandro Rubini,
first edition. Does anyone know of any other documentation concerning
pci drivers and pci peripherals.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: [EMAIL PROTECTED] (Pete Zaitcev)
Subject: Re: PCI Documentation
Date: Mon, 02 Oct 2000 21:37:32 GMT
On Mon, 02 Oct 2000 20:55:30 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I am writing a pci driver to interface with a home-grown pci
> peripheral. I already have Linux Device Drivers by Alessandro Rubini,
> first edition. Does anyone know of any other documentation concerning
> pci drivers and pci peripherals.
/usr/src/linux/Documentation/IO-mapping.txt
/usr/src/linux/drivers/char/bttv.c
Rubini book is great according to people who have read it,
but I never had a need to read any printed material.
--Pete
------------------------------
From: [EMAIL PROTECTED] (Rick Ellis)
Subject: Re: question about memory leaks in linux
Date: 2 Oct 2000 21:57:55 GMT
In article <[EMAIL PROTECTED]>,
Matthew Gatto <[EMAIL PROTECTED]> wrote:
>If I write a C program with memory leaks, after execution of the
>program is over, will all that leaked memory be automatically
>de-allocated by the linux kernel?
Of course!
--
http://www.fnet.net/~ellis/photo/linux.html
------------------------------
From: Karl Heyes <[EMAIL PROTECTED]>
Subject: Re: question about memory leaks in linux
Date: Tue, 03 Oct 2000 00:08:40 +0000
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Matthew Gatto) wrote:
> If I write a C program with memory leaks, after execution of the
> program is over, will all that leaked memory be automatically
> de-allocated by the linux kernel? I was wondering what kind of
> protections towards this type of thing the linux kernel has built in
> to it so that I can comfortably develop in C with gcc, while not
> having to worry about exhausting my system resources.
>
The MMU is the the magical device that sorts this out. Any user program
that addresses some part of memory has to go through the MMU to be
translated to physical (RAM) addresses. The MMU gets the translation
from page tables, therefore each process has a set of page-tables.
When a process dies, all information gets swiped in one go, therefore
no memory leaks left by processes can affect the system.
Each process has a separate view of the memory (VM- virtual memory)
and the kernel shares the physical memory between the different
processes based upon the usage.
karl
------------------------------
From: David Wragg <[EMAIL PROTECTED]>
Subject: Re: Linux Stack Sizes? (0/1)
Date: 01 Oct 2000 22:29:51 +0000
[EMAIL PROTECTED] (Philip Armstrong) writes:
> mprotect() is in linux/mm/mprotect.c
>
> I note that under 2.2.x it takes the big kernel lock; this has gone in
> 2.4.0pre8. It also seems to involve cache flushes + tlb flushes. I
> think we can assume this makes it an expensive operation :)
And on SMP it needs a TLB shootdown, which makes it even more
expensive.
------------------------------
From: [EMAIL PROTECTED] (Christopher Browne)
Crossposted-To: comp.os.linux.x,comp.windows.x
Subject: Re: new windowing system
Reply-To: [EMAIL PROTECTED]
Date: Tue, 03 Oct 2000 00:38:37 GMT
In our last episode (01 Oct 2000 16:42:06 +0100),
the artist formerly known as Juliusz Chroboczek said:
>Nix <$}xinix{[email protected]>:
>
>N> Using CORBA was probably right. It's just a super-RPC, is all. And it
>N> *is* damned useful. It's another componenting scheme, no better or worse
>N> than pipelines [...]
>
>As far as I recall, Corba doesn't support reliable asynchronous
>communication. (Neither does Sun RPC, by the way.)
The Messaging Service appears to not yet be ratified, but there is a
specification...
<http://citeseer.nj.nec.com/298154.html>
<http://www.omg.org/techprocess/meetings/schedule/Messaging_RTF.html>
--
(concatenate 'string "cbbrowne" "@" "hex.net")
<http://www.hex.net/~cbbrowne/lsf.html>
'There is no substitute for good manners, except, perhaps, fast
reflexes.' -- random unix fortune
------------------------------
From: [EMAIL PROTECTED] (Tramm Hudson)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: How to load shared libs at runtime?
Date: 3 Oct 2000 01:47:58 GMT
Peter Koch <[EMAIL PROTECTED]> wrote:
> ... I am considering to port an application from win32 to linus....
Have you asked Linus about this? He usually doesn't like having
new software ported to him. I understand that he is quite happy
with the wetware installed in his brain "from the factory".
Additionally, he would most likely be hesitant to run any software
that came from Windows. Imagine his embarassment if he blue screened
while giving an important presentation.
> ... load a shared library at runtime and find the address of a
> function within it ...
As everyone else has suggested, dlopen(3) is what you want.
Trollingly yours,
Tramm
--
o [EMAIL PROTECTED] [EMAIL PROTECTED] O___|
/|\ http://www.swcp.com/~hudson/ H 505.323.38.81 /\ \_
<< KC5RNF @ N5YYF.NM.AMPR.ORG W 505.986.60.75 \ \/\_\
0 U \_ |
------------------------------
From: [EMAIL PROTECTED] (Nick Andrew)
Subject: Re: question about memory leaks in linux
Date: 3 Oct 2000 16:36:34 +1100
[EMAIL PROTECTED] (Matthew Gatto) writes:
>If I write a C program with memory leaks, after execution of the
>program is over, will all that leaked memory be automatically
>de-allocated by the linux kernel?
Yes, unless the memory is specifically allocated as shared (see
"man shmctl" and "man ipcs").
>I was wondering what kind of
>protections towards this type of thing the linux kernel has built in
>to it so that I can comfortably develop in C with gcc, while not
>having to worry about exhausting my system resources.
The kernel keeps proper track of your processes' resources so it knows
which memory to free when your process exits.
Nick.
--
Pacific Internet SP4 Fax: +61-2-9247-4738 Voice: 03-9674-7543
http://www.zeta.org.au/~nick/
"Sorry to say this, but the job falls to the ultimate defenders
of liberty - you and me." [Keith Henson, 2000-06-29]
------------------------------
From: "Peter Koch" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: How to load shared libs at runtime?
Date: Tue, 3 Oct 2000 08:58:45 +0200
Thanks for all your replies. Seems I have to get a bigger disk to install
the whole distribution since i cannot figure out in what packages the man
pages and other docs are spread that i might need.
Peter Koch
"James Cownie" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]...
> Peter Koch wrote:
> >
> > Thanks, but there are no "man" pages available for these functions (I'm
> > using SuSE 7.0). I found the necessary declarators in
/usr/include/dlfcn.h
> > meanwhile however and think I can work with this. Seems the tricky part
of
> > linux development is getting used to poor documentation.
>
> Well maybe you just need to install the man pages ?
>
> On my RH system they're all there, e.g.
>
> DLOPEN(3) Linux Programmer's Manual DLOPEN(3)
>
> NAME
> dlclose, dlerror, dlopen, dlsym - Programming interface to
> dynamic linking loader.
>
> SYNOPSIS
> #include <dlfcn.h>
>
> void *dlopen (const char *filename, int flag);
> const char *dlerror(void);
> void *dlsym(void *handle, char *symbol);
> int dlclose (void *handle);
>
> Special symbols: _init, _fini.
>
> DESCRIPTION
> dlopen loads a dynamic library from the file named by the
> null terminated string filename and returns an opaque
> "handle" for the dynamic library. If filename is not an
> absolute path (i.e., it does not begin with a "/"), then
> the file is searched for in the following locations:
>
> A colon-separated list of directories in the user's
> LD_LIBRARY path environment variable.
>
> The list of libraries specified in
> /etc/ld.so.cache.
>
> /usr/lib, followed by /lib.
>
> If filename is a NULL pointer, then the returned handle is
> for the main program.
>
> External references in the library are resolved using the
> libraries in that library's dependency list and any other
> libraries previously opened with the RTLD_GLOBAL flag. If
> the executable was linked with the flag "-rdynamic", then
> the global symbols in the executable will also be used to
> resolve references in a dynamically loaded library.
>
> flag must be either RTLD_LAZY, meaning resolve undefined
> symbols as code from the dynamic library is executed, or
> RTLD_NOW, meaning resolve all undefined symbols before
> dlopen returns, and fail if this cannot be done. Option-
> ally, RTLD_GLOBAL may be or'ed with flag, in which case
> the external symbols defined in the library will be made
> available to subsequently loaded libraries.
>
> If the library exports a routine named _init, then that
> code is executed before dlopen returns. If the same
> library is loaded twice with dlopen(), the same file han-
> dle is returned. The dl library maintains link counts for
> dynamic file handles, so a dynamic library is not deallo-
> cated until dlclose has been called on it as many times as
> dlopen has succeeded on it.
>
> Linux 16 May 1995 1
>
> If dlopen fails for any reason, it returns NULL. A human
> readable string describing the most recent error that
> occurred from any of the dl routines (dlopen, dlsym or
> dlclose) can be extracted with dlerror(). dlerror returns
> NULL if no errors have occurred since initialization or
> since it was last called. (Calling dlerror() twice con-
> secutively, will always result in the second call return-
> ing NULL.)
>
> dlsym takes a "handle" of a dynamic library returned by
> dlopen and the null terminated symbol name, returning the
> address where that symbol is loaded. If the symbol is not
> found, dlsym returns NULL; however, the correct way to
> test for an error from dlsym is to save the result of
> dlerror into a variable, and then check if saved value is
> not NULL. This is because the value of the symbol could
> actually be NULL. It is also necessary to save the
> results of dlerror into a variable because if dlerror is
> called again, it will return NULL.
>
> dlclose decrements the reference count on the dynamic
> library handle handle. If the reference count drops to
> zero and no other loaded libraries use symbols in it, then
> the dynamic library is unloaded. If the dynamic library
> exports a routine named _fini, then that routine is called
> just before the library is unloaded.
>
> EXAMPLES
> Load the math library, and print the cosine of 2.0:
> #include <dlfcn.h>
>
> int main(int argc, char **argv) {
> void *handle = dlopen ("/lib/libm.so", RTLD_LAZY);
> double (*cosine)(double) = dlsym(handle, "cos");
> printf ("%f\n", (*cosine)(2.0));
> dlclose(handle);
> }
>
> If this program were in a file named "foo.c", you
> would build the program with the following command:
>
> gcc -rdynamic -o foo foo.c -ldl
>
> Do the same thing, but check for errors at every step:
> #include <stdio.h>
> #include <dlfcn.h>
>
> int main(int argc, char **argv) {
> void *handle;
> double (*cosine)(double);
> char *error;
>
> handle = dlopen ("/lib/libm.so", RTLD_LAZY);
> if (!handle) {
>
> Linux 16 May 1995 2
>
> fputs (dlerror(), stderr);
> exit(1);
> }
>
> cosine = dlsym(handle, "cos");
> if ((error = dlerror()) != NULL) {
> fputs(error, stderr);
> exit(1);
> }
>
> printf ("%f\n", (*cosine)(2.0));
> dlclose(handle);
> }
>
> ACKNOWLEDGEMENTS
> The dlopen interface standard comes from Solaris. The
> Linux dlopen implementation was primarily written by Eric
> Youngdale with help from Mitch D'Souza, David Engel,
> Hongjiu Lu, Andreas Schwab and others. The manual page
> was written by Adam Richter.
>
> SEE ALSO
> ld(1), ld.so(8), ldconfig(8), ldd(1), ld.so.info.
>
> Linux 16 May 1995 3
>
> -- Jim
>
> James Cownie <[EMAIL PROTECTED]>
> Etnus, LLC. +44 117 9071438
> http://www.etnus.com
------------------------------
From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Subject: Re: /proc file system help
Date: Tue, 03 Oct 2000 09:21:19 +0200
Hi Keith,
The proc fs works like making a char special device in proc,
you will have operations like read and write that come in,
you must fill these buffers.
To explain it best look at zorros code in the kernel,
./linux/drivers/zorro/proc.c , I think.
Anyway hope this helps,
Richard.
Keith wrote:
> I have a structure that is being implemented in KLIPS (add on to the kernel
> which supports IPSec stuff) and I want to be able to access this information
> using the /proc file system. How would I go about doing this? How does /proc
> work so that it can access it.
>
> I would really appreciate the help guys
>
> Thanks,
> Keith
------------------------------
From: "Jasiu" <[EMAIL PROTECTED]>
Subject: "su" inside program
Date: Tue, 3 Oct 2000 10:11:21 +0200
I want to write little program witch logs into the system as root,
and execute script. How can I do "su" command inside programm ?
--
Marcin
------------------------------
From: NortonNg <[EMAIL PROTECTED]>
Subject: Re: extend ethernet header to 18 bytes?
Date: Tue, 3 Oct 2000 08:35:17 +0000 (UTC)
Kaz Kylheku <[EMAIL PROTECTED]> wrote:
> On Mon, 2 Oct 2000 17:21:40 +0000 (UTC), NortonNg <[EMAIL PROTECTED]> wrote:
> > According to RFC 894 Ethernet Encapsulation header is 14 bytes,
> >but i need to extend it to 18 bytes for setting some flag for local
> >communication. Is it possbile? How can i do it? modify the device driver
> >codes??
> You can do that, but then you have to convince every other host on the network
> that headers are 18 bytes. Hosts that are not aware of your scheme will simply
> see four extra bytes of payload and get confused.
> What you should do when you do something like that is use a separate ethernet
> protocol number for these special packets. Hosts which don't understand the
> modified scheme will just drop such packets, should they ever receive them, due
> to their unknown protocol number. The machines that do participate in the
> scheme have a way of telling apart regular packets and ``doctored'' packets
> based on the protocol num.
I have to describe more detail about my application, the architecture is
depict below:
Internet
|
router
|
|
--+------------+--------+----------+ ethernet subnet
| | | |
dispatcher real real real
server A server B server C
The dispatcher need to forward some packets to real server A,B,C ,
and it needs to tell those real server the packets order, otherwise the real
server don't know how to process it(out of order). It is a my load balancing
scheme for IP packets, not for TCP,UDP. Therefore i think it should add
sequence number along with the forwarded packets.
The modified ethernet header should be used only for dispatcher to
forward packets to real server. The ethernet header of packet forward by
dispatcher to router should be the normal ethernet header.
Therefore i need to check the destination of MAC address before sending the
modified ethernet frame, is it efficient to do it?
My another idea is to add the extra 4 bytes( use as sequence number)
after the ethernet header but before the IP header, because i think it is
more easy to check the destination IP address to determine whether i need to
add the 4 bytes sequence number. Furthermore, i need to define another
ethernet type for receiver to recognize the modified frame type.
any wrong to my idea? how can i pass the sequence number of each packet
to upper network layer?
jkng
------------------------------
From: Jerome Corre <[EMAIL PROTECTED]>
Subject: NFS question
Date: Tue, 03 Oct 2000 10:28:16 GMT
Hi I was just wondering a few sing about NFS:
I have been playing with nfs for a few weeks, but i am still wondering
what happen if the client does not unmount the nfs when rebooting? can
the filesystem on the server be damaged or does the nfs deamond has a
protection agains that?
thanks in advance for any help
--
Jerome Corre
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
** 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
******************************