Linux-Development-Sys Digest #763, Volume #8     Thu, 31 May 01 09:13:09 EDT

Contents:
  Linux IP layer ([EMAIL PROTECTED])
  Re: Porting Linux to a new arch ("Johan Wikman")
  Re: pthread_rwlock_wrlock() across processes on LINUX (Nithyanandham)
  Re: environment variable confusion (Villy Kruse)
  Re: Newbie question about PPCLinux distribution package (Kirk Lee)
  Re: environment variable confusion ([EMAIL PROTECTED])
  Re: chainge in struct sk_buff doesn't quite work ([EMAIL PROTECTED])
  Re: accessing memory and IO space (=?iso-8859-1?Q?Andr=E9?= David)
  Re: lspci & setpci (=?iso-8859-1?Q?Andr=E9?= David)
  Re: Where can I get a PCI Card (=?iso-8859-1?Q?Andr=E9?= David)
  Q: EXPORT_SYMBOL (Holger Eitzenberger)
  Kernel Threads (Somya)
  Driver Debugging (Men Muheim)
  XWindows event handling ("Aleksey Mazhelis")
  Re: /proc/stat disk_io (Adam Fineman)
  Re: /proc/stat disk_io ("Nils O. Selåsdal")

----------------------------------------------------------------------------

From: [EMAIL PROTECTED]
Subject: Linux IP layer
Date: Thu, 31 May 2001 06:30:19 GMT

Hello!

Does anybody know how to put hook in Linux 2.4.x IP layer? I need to process
outbound packages just before they enter IP layer. I cannot find an entry point.

-- 
Alexey

------------------------------

From: "Johan Wikman" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.embedded
Subject: Re: Porting Linux to a new arch
Date: Thu, 31 May 2001 06:30:25 GMT

Hi,

> We intend to port the linux kernel to an unsuopported processor. While
> searching the web, we didn't find anything useful information (like a
> 'porting guide' or something like that). I'd like to ask you if someone
> knows how to start working on this stuff. Are there any 'rules' to start
> with porting procedures (web site, papers, etc).

There's a nice article - Linux Porting Guide - in the February/2001
issue of Embedded Systems. You might want to check that one out.
Here're also a few links to articles describing Linux porting projects.

http://noframes.linuxjournal.com/lj-issues/issue66/3591.html
http://roadrunner.swansea.uk.linux.org/macpaper.html
http://developer.intel.com/design/Ia-64/portToLinux/
http://www.hpl.hp.com/techreports/1999/HPL-1999-83.html

In case you find more such war-stories, I'd be interested in hearing
about them.

/Johan






------------------------------

From: Nithyanandham <[EMAIL PROTECTED]>
Crossposted-To: comp.unix.programmer
Subject: Re: pthread_rwlock_wrlock() across processes on LINUX
Date: Thu, 31 May 2001 12:14:03 +0530



Sandeep Mirchandani wrote:

> I was wondering if anyone had used pthread_rwlock_wrlock() on LINUX
> across processes and seen any problems with it? I am using
> PTHREAD_PROCESS_SHARED from a call to pthread_rwlockattr_setpshared()
> so as to enable inter-process synchronization.   But the behavior of this
> seems flaky.  This seems to work more predictably on solaris though.
>
> Has pthread read write locks been known to work correctly on LINUX across
> processes?  Is there a better way of doing the same thing?  Any help would
> be appreciated.

add "-D_XOPEN_SOURCE=500" flag during compilation. .

--Nithyanand.
  Siemens, Bangalore, India.


------------------------------

From: [EMAIL PROTECTED] (Villy Kruse)
Subject: Re: environment variable confusion
Date: 31 May 2001 07:05:14 GMT

On Wed, 30 May 2001 17:41:04 GMT, Eric Taylor <[EMAIL PROTECTED]> wrote:
>
>
>[EMAIL PROTECTED] wrote:
>
>I looked at exec.c and I see calls to copy_string, which
>copies (i think) the environment up into kernel space. Then,
>later, I guess it copies it back into the new process (is this
>right?).
>
>Since environ is a pointer to an array of pointers, I take it that
>this same procedure must re-create this pointer array. Is this
>array also at the top of the stack, and do these 2 items (the
>strings themselves and the pointer array) both end up at the top
>of the stack?
>

That is correct.


>Is there anything on the stack below this that has to point to
>something in the environment, since my restore is failing
>if I change the environment and then try to restore the program
>stack.
>

Anytime you modify the environment the environment address array
may be moved from its original location, especialy if you add new
variables and thus increase the size of the invironment pointer
array.



>Are there any guard pages that might cause a segment fault
>if I go messing around here?
>

The main program stack frame follows directly below the environment
and argument values found in the top of the stack.  No free space
goes in between here.  If you mess around here you might destroy
some stackframes with unpredictable results.  


>And lastly, when I add an environment variable, how and who
>determines where these go; is memory moved up/down to make room,
>or recover room.
>



Could be anywhere.  As you cannot move the stackframe for the main
program then any additional environment variables most go into
malloced space and the same for the array of environmen variable
pointers.  Thus the third argument to main will become invalid
when you add new environment variables.


Villy

------------------------------

From: Kirk Lee <[EMAIL PROTECTED]>
Subject: Re: Newbie question about PPCLinux distribution package
Date: Thu, 31 May 2001 15:27:12 +0800

Really sorry!!
I typed the wrong mail address.......
Sorry!!!!
Just forget this stupid mail!!

> Dear All:
>
>   Excuse me, if this question is off topic!!
>
>   We want to install a PPCLinux distribution package, like RedHat,
>    into a PowerMac G4/Cube set.
>   This is the first time we touch PowerMac, so we have no idea about
> this.
>
>   Could anyone recommend a nice PPCLinux distribution package???


------------------------------

From: [EMAIL PROTECTED]
Subject: Re: environment variable confusion
Date: 31 May 2001 00:26:12 -0700

In article <[EMAIL PROTECTED]>,
Eric Taylor  <[EMAIL PROTECTED]> wrote:
>
>
>[EMAIL PROTECTED] wrote:
>
>I looked at exec.c and I see calls to copy_string, which
>copies (i think) the environment up into kernel space. Then,
>later, I guess it copies it back into the new process (is this
>right?).

I'm not sure of the exact sequence, but the kernel does copy it to the
stack area of the new process.

>Since environ is a pointer to an array of pointers, I take it that
>this same procedure must re-create this pointer array. Is this
>array also at the top of the stack, and do these 2 items (the
>strings themselves and the pointer array) both end up at the top
>of the stack?

The kernel does this also, although I think the code is separated from
the part copying the strings.

The arrays (argv and envv) are definitely not at the top of the stack.
(See below.)

>Is there anything on the stack below this that has to point to
>something in the environment, since my restore is failing
>if I change the environment and then try to restore the program
>stack.

I'm not sure what you mean by "change the environment" here.  Is the
change done within the program-to-be-restored, or by the restorer?

The restored stack must obviously be exactly aligned with its earlier
state, since it contains variables and pointers into itself.

>Are there any guard pages that might cause a segment fault
>if I go messing around here?

The kernel automatically extends the stack downward on SIGSEGV-s that
are "sufficiently" close.  I don't know what the exact rule is here,
but you could be sure you have enough space by writing words downward
into the stack area with a stride equal to (or smaller than) the page
size.

>And lastly, when I add an environment variable, how and who
>determines where these go; is memory moved up/down to make room,
>or recover room.

I assume you mean something like putenv() here, i.e., a program is
changing its own environment.  If you delete a variable, the array
entries are simply moved down to remove the dead pointer.  If you add
an entry, the entire pointer array is copied to allocated space and
adjusted as needed.  The strings themselves are not moved.

If the restorer is trying to change the environment, this will get
messy, as you can't reliably find the active pointer array, since it
may or may not still be on the stack.  Probably the only reasonably
safe thing you could do is modify an existing string in-place, such
that it does not grow.

The following as a somewhat annotated dump of an i586 stack.

envp = 0xbffffc84
argv = 0xbffffc7c
bffffc14 00000001 ~~~~
bffffc18 bffffc7c |~~~
bffffc1c bffffc84 ~~~~
bffffc20 08048564 d~~~
bffffc24 00000004 ~~~~
bffffc28 bffffc48 H~~~
bffffc2c 4003c208 ~~~@
bffffc30 40016db4 ~m~@
bffffc34 00000001 ~~~~
bffffc38 08048350 P~~~
bffffc3c bffffc7c |~~~
bffffc40 4003c174 t~~@
bffffc44 4012daa0 ~~~@
bffffc48 00000000 ~~~~
bffffc4c 08048371 q~~~
bffffc50 08048440 @~~~
bffffc54 00000001 ~~~~
bffffc58 bffffc7c |~~~          **argv
bffffc5c 080482c0 ~~~~
bffffc60 08048564 d~~~
bffffc64 4000d6d0 ~~~@
bffffc68 bffffc6c l~~~
bffffc6c 4001739c ~s~@
bffffc70 40001fb1 ~~~@
bffffc74 bffffc84 ~~~~          **envp

Startup stack pointer seems to be here.  Everything beyond here is
set up by the kernel.

bffffc78 00000001 ~~~~          argc
bffffc7c bffffd9e ~~~~          argv[0]
bffffc80 00000000 ~~~~
bffffc84 bffffda5 ~~~~          envp[0] PWD=...
bffffc88 bffffdbc ~~~~          HOSTNAME=...
bffffc8c bffffdc9 ~~~~          MOZILLA_HOME=...

[ ... ]

bffffcf4 bfffffba ~~~~          LESSCHARSET=...
bffffcf8 bfffffcd ~~~~          DEBUG_REDIRECT...
bffffcfc bfffffe8 ~~~~          _=./dstack
bffffd00 00000000 ~~~~          

The following is a set of elf-setup parameters.  Some entries are
omitted for static programs.

bffffd04 00000003 ~~~~          phdr
bffffd08 08048034 4~~~
bffffd0c 00000004 ~~~~          phent
bffffd10 00000020  ~~~
bffffd14 00000005 ~~~~          phnum
bffffd18 00000006 ~~~~
bffffd1c 00000007 ~~~~          base
bffffd20 40000000 ~~~@
bffffd24 00000008 ~~~~          flags
bffffd28 00000000 ~~~~
bffffd2c 00000009 ~~~~          entry
bffffd30 08048350 P~~~
bffffd34 0000000b ~~~~          uid
bffffd38 000003e9 ~~~~
bffffd3c 0000000c ~~~~          euid
bffffd40 000003e9 ~~~~
bffffd44 0000000d ~~~~          gid
bffffd48 00000006 ~~~~
bffffd4c 0000000e ~~~~          egid
bffffd50 00000006 ~~~~
bffffd54 00000010 ~~~~          hw capabilities
bffffd58 008001a5 ~~~~
bffffd5c 00000006 ~~~~          page size
bffffd60 00001000 ~~~~
bffffd64 00000011 ~~~~          tick
bffffd68 00000064 d~~~
bffffd6c 0000000f ~~~~          platform (= i586)
bffffd70 bffffd99 ~~~~
bffffd74 00000000 ~~~~
bffffd78 00000000 ~~~~
bffffd7c 00000000 ~~~~
bffffd80 00000000 ~~~~
bffffd84 00000000 ~~~~
bffffd88 00000000 ~~~~
bffffd8c 00000000 ~~~~
bffffd90 00000000 ~~~~
bffffd94 00000000 ~~~~
bffffd98 38356900 ~i58          (platform string)
bffffd9c 73640036 6~ds          argv strings
bffffda0 6b636174 tack
bffffda4 44575000 ~PWD          env strings
bffffda8 6f682f3d =/ho
bffffdac 622f656d me/b
bffffdb0 732f6564 de/s
bffffdb4 6a2f6372 rc/j
bffffdb8 006b6e75 unk~
bffffdbc 54534f48 HOST
bffffdc0 454d414e NAME
bffffdc4 7868703d =phx
bffffdc8 5a4f4d00 ~MOZ
bffffdcc 414c4c49 ILLA
bffffdd0 4d4f485f _HOM

[ ... ]

bfffffb8 454c002e .~LE
bfffffbc 48435353 SSCH
bfffffc0 45535241 ARSE
bfffffc4 616c3d54 T=la
bfffffc8 316e6974 tin1
bfffffcc 42454400 ~DEB
bfffffd0 525f4755 UG_R
bfffffd4 52494445 EDIR
bfffffd8 5f544345 ECT_
bfffffdc 41574d58 XMWA
bfffffe0 4e494e52 RNIN
bfffffe4 00313d47 G=1~
bfffffe8 2f2e3d5f _=./
bfffffec 61747364 dsta
bffffff0 2e006b63 ck~.
bffffff4 7473642f /dst
bffffff8 006b6361 ack~
bffffffc 00000000 ~~~~
-- 
B. D. Elliott   [EMAIL PROTECTED]

------------------------------

From: [EMAIL PROTECTED]
Subject: Re: chainge in struct sk_buff doesn't quite work
Date: Thu, 31 May 2001 09:11:31 GMT

On Wed, 30 May 2001 13:57:45 GMT, [EMAIL PROTECTED] wrote:

>On Wed, 30 May 2001 10:18:19 +0400, Vyacheslav Burdjanadze
><[EMAIL PROTECTED]> wrote:
>
>>> Because it oopses everytime (shortly or directly after the login
>>Did you rebuild entire kernel and all modules?
>yes, I did
>make mrproper dep bzImage modules modules_install
problem solved, sorry *-*

------------------------------

From: =?iso-8859-1?Q?Andr=E9?= David <[EMAIL PROTECTED]>
Subject: Re: accessing memory and IO space
Date: Thu, 31 May 2001 11:30:44 +0200

This is a multi-part message in MIME format.
==============E39D8B7E3AFB646A42DD3643
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Ken Whaley wrote:

> A quicker/dirtier approach is to write a peek/poke program that mmaps
> /dev/mem.  Has to run as root, but will do just what you want (for
> memory mapped ranges of a PCI device).

Well.. you can also remove a line asking for RAW_IO in
/driver/char/mem.c and everyone can R/W from the whole memory. If
security does not matter :)


Cheers,

Andre
-- 

 "Share the code. If you hide it ain't good."
                                                Popular knowledge
==============E39D8B7E3AFB646A42DD3643
Content-Type: text/x-vcard; charset=us-ascii;
 name="Andre.David.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for André David
Content-Disposition: attachment;
 filename="Andre.David.vcf"

begin:vcard 
n:David;André
tel;cell:+41792013849
tel;work:+41227676147
x-mozilla-html:FALSE
org:CERN - European Centre for Nuclear Research;EP/NA60
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
note:Geneva, Switzerland
x-mozilla-cpt:;-16000
fn:André David
end:vcard

==============E39D8B7E3AFB646A42DD3643==


------------------------------

From: =?iso-8859-1?Q?Andr=E9?= David <[EMAIL PROTECTED]>
Subject: Re: lspci & setpci
Date: Thu, 31 May 2001 11:29:03 +0200

This is a multi-part message in MIME format.
==============0F1E7DC2FC05D34EBDE9EF7D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

[EMAIL PROTECTED] wrote:
> 
> Gentlemen:
>     Where might I find the source to lspci and setpci??
> Charles

look for pciutils on google.com

-- 

 "Share the code. If you hide it ain't good."
                                                Popular knowledge
==============0F1E7DC2FC05D34EBDE9EF7D
Content-Type: text/x-vcard; charset=us-ascii;
 name="Andre.David.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for André David
Content-Disposition: attachment;
 filename="Andre.David.vcf"

begin:vcard 
n:David;André
tel;cell:+41792013849
tel;work:+41227676147
x-mozilla-html:FALSE
org:CERN - European Centre for Nuclear Research;EP/NA60
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
note:Geneva, Switzerland
x-mozilla-cpt:;-16000
fn:André David
end:vcard

==============0F1E7DC2FC05D34EBDE9EF7D==


------------------------------

From: =?iso-8859-1?Q?Andr=E9?= David <[EMAIL PROTECTED]>
Subject: Re: Where can I get a PCI Card
Date: Thu, 31 May 2001 11:36:28 +0200

This is a multi-part message in MIME format.
==============735280B2205F5907E71477D8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

k wrote:
> 
> >I have a request. Do You know from where i may be able to get a PCI
> >demo
> >card which is 64/66Mhz, and has memory in it or fpga.
> >thanks,
> >Divyadeep Wadhwa
> 
> PLX Technologies->www.plxtech.com has PCI Demo cards.
> 
> later,
> k

Check the OR3LP26B at

http://www.lucent.com/micro/netcom/platform/fpsc.html#or

Cheers
-- 

 "Share the code. If you hide it ain't good."
                                                Popular knowledge
==============735280B2205F5907E71477D8
Content-Type: text/x-vcard; charset=us-ascii;
 name="Andre.David.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for André David
Content-Disposition: attachment;
 filename="Andre.David.vcf"

begin:vcard 
n:David;André
tel;cell:+41792013849
tel;work:+41227676147
x-mozilla-html:FALSE
org:CERN - European Centre for Nuclear Research;EP/NA60
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
note:Geneva, Switzerland
x-mozilla-cpt:;-16000
fn:André David
end:vcard

==============735280B2205F5907E71477D8==


------------------------------

From: [EMAIL PROTECTED] (Holger Eitzenberger)
Subject: Q: EXPORT_SYMBOL
Date: Thu, 31 May 2001 10:51:44 +0000 (UTC)

Ok, before you will ask: i am waiting for the Rubini Book 2nd Edition.

Why and when do i need to use

    EXPORT_SYMBOL(function);

The driver i have works obviously without it.

Thanks in advance.

Holger


------------------------------

From: [EMAIL PROTECTED] (Somya)
Subject: Kernel Threads
Date: 31 May 2001 04:06:22 -0700

Hello Everybody,
                i am writing a kernel module which requires 
  reader and writer threads to be written.Kindly help me out
 as to from where i can get information regarding kernel threads
 and  also to execute the same.I am working on Red hat Linux(6.2)
 kernel(2.2.14). 

thanks in advance,
somya

------------------------------

Date: Thu, 31 May 2001 13:09:03 +0200
From: Men Muheim <[EMAIL PROTECTED]>
Subject: Driver Debugging

I know this question has been asked before, but maybe there is a new
answer?...

My network-driver produces a kernel panic within a interrupt procedure.
I have inserted printk() statements which would help me to find the
error, but these messages are not logged by klogd (probably the process
is not running any more when the kernel hangs;-) and I cannot see the
messages because the kernel prints out many panic messages. 

but I guess the messages are still print to the LOG_BUF. Is there any
way to inspect the LOG_BUF after system crash? could sysRq maybe help?
(it is still running)

Appreciate your help!

Men

------------------------------

From: "Aleksey Mazhelis" <[EMAIL PROTECTED]>
Subject: XWindows event handling
Date: Thu, 31 May 2001 15:37:15 +0300

Hi!

Does anyone have any clue about event handling inside XWindow?

The point is - how to handle ALL the events of a certain type NOT
depending on the application.



------------------------------

From: Adam Fineman <[EMAIL PROTECTED]>
Subject: Re: /proc/stat disk_io
Date: Thu, 31 May 2001 08:55:07 -0400

Pirabhu wrote:
> 
> hi,
>   I am Pirabhu Raman, a graduate student at the University of Florida.
> I am working on a load balancing project in which i need the system
> data of all processors. I would be glad if somebody could explain the
> exact details of /proc/stat file especially the disk_io entry. I
> checked the man file but it doesnt provide much help.
> Thanks
> Pirabhu Raman

The best way to understand any /proc fs entry is to do a little source
diving.  From the top of your linux kernel source tree, check out:

fs/proc/array.c: static int get_kstat(char * buffer)

anything that #includes <kernel_stat.h>
find <top_of_kernel_source_tree> -name "*.[ch]" -print |xargs grep -l
"kernel_stat\.h"

Hope that helped,

--
Adam

------------------------------

From: "Nils O. Selåsdal" <[EMAIL PROTECTED]>
Subject: Re: /proc/stat disk_io
Date: Thu, 31 May 2001 14:55:05 +0200


"Pirabhu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> hi,
>   I am Pirabhu Raman, a graduate student at the University of Florida.
> I am working on a load balancing project in which i need the system
> data of all processors. I would be glad if somebody could explain the
> exact details of /proc/stat file especially the disk_io entry. I
> checked the man file but it doesnt provide much help.
if you install the kernel sources, the
<kernel-source>/Documentation/filesystems/proc.txt might help you.
It's located in /usr/src/linux/Documentation/filesystems/proc.txt on my
installation.





------------------------------


** 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
******************************

Reply via email to