Linux-Development-Sys Digest #290, Volume #8     Mon, 20 Nov 00 13:13:16 EST

Contents:
  Re: Interprocess Communication ... ("Lee Ho")
  Converting rdtsc() deltas to elapsed msec? (Kaelin Colclasure)
  [Q] thread monitoring program ("Jinyoun Park")
  Re: Annotated assembler source from gcc??? (Peter Pointner)
  Re: Can't find regcmp command (Josef Moellers)
  Re: Annotated assembler source from gcc??? (Andi Kleen)
  IPC bug? (Janne Himanka)
  UDP packet create: How to? (Maurizio Piana)
  Re: kernel module memory usage (Arnaud Westenberg)
  Re: Can't find regcmp command ([EMAIL PROTECTED])
  Re: IPC bug? (Andi Kleen)
  thread priority using pthread... (Engineer)
  Re: Preemption within the kernel? (Mathias Waack)
  Re: What distro does Linus Torvalds use? (Erik Hensema)
  Using semaphores in kernel driver ("Bernhard Drixler")
  Developing kernel  (Peter Larance)
  Changing the Block size (Marty)
  2.4.0-test10/test11-pre7 loosing nntp connection (leafnode/tin) (Michael Mauch)
  Re: Annotated assembler source from gcc??? (Grant Edwards)

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

From: "Lee Ho" <[EMAIL PROTECTED]>
Subject: Re: Interprocess Communication ...
Date: Mon, 20 Nov 2000 04:59:47 GMT


[EMAIL PROTECTED] writes:
> I am a new bie to Linux and couldnot find answers to the following
>questions. So please respond if you know any of them.
>  Does Linux(RedHat 6.1 or 6.2) have the following IPC's :
>
>1. POSIX Message Queues
>2. POSIX Shared Memory
>3. POSIX Semaphores.
>4. Mutex that can be shared across PROCESSES.

Linux System V IPC supports all of the above, but Linux shared memory
is not compatible with POSIX in 2.2 kernel. In 2.4 kernel Linux shared memory
is POSIX compatible.

see Linux Programmer's Guide (http://linuxdoc.org/LPD/lpg/)


*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Lee, Ho. Software Engineer, Embedded Linux Dep, LinuxOne
Mail : [EMAIL PROTECTED] (work), [EMAIL PROTECTED] (personal)
Homepage : http://flyduck.com, http://linuxkernel.to




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

From: Kaelin Colclasure <[EMAIL PROTECTED]>
Subject: Converting rdtsc() deltas to elapsed msec?
Date: 19 Nov 2000 21:42:41 -0800

My OpenTNF project is inching along, and I now have trace data
extracted from the kernel with timestamps filled in by rdtscll().
Now the obvious question is, how to I turn clock-cycle counts into
standard time units like msec? I tried poking around in the kernel
source a bit -- enough to know that Linux "calibrates" the clock
interval to some sort of standard unit (jiffies?), but not enough to
figure out where I can grab that information or how to apply it once I
do.

After I work out this and a few more details, I'll be putting an
opentnf-0.1 development snapshot up on Sourceforge. (I've already
registered the project there, but there's nothing to see yet.)

-- Kaelin

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

From: "Jinyoun Park" <[EMAIL PROTECTED]>
Subject: [Q] thread monitoring program
Date: Mon, 20 Nov 2000 14:46:34 +0900

I am seeking thread monitoring program

In current system, I want to know current thread number, thread state, and
parent processes, etc.

Help me.!!!

I apologize for poor English.



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

From: Peter Pointner <[EMAIL PROTECTED]>
Subject: Re: Annotated assembler source from gcc???
Date: 20 Nov 2000 07:27:31 +0100

Kaelin Colclasure <[EMAIL PROTECTED]> wrote:
> A feature that I have found useful from time to time is to generate
> the assembler source from one of my .c files. In the past when I've
> done this I've seen the original C code interspersed as comments in
> the generated assembler source. But gcc's -S option doesn't seem to do
> this. And the only hopeful-looking option I saw on the man page was
> -fverbose-asm -- which doesn't do it either.

> Is there an option for getting this kind of annotated listing from
> gcc?

Try the following and see if you like what you get:
  cc -c -g foo.c
  objdump --source foo.o > foo.lst

Peter


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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: Can't find regcmp command
Date: Mon, 20 Nov 2000 10:40:14 +0100

[EMAIL PROTECTED] wrote:
> =

> I'm porting an app which runs on Unixware and Solaris. On those
> platforms there is a command /bin/regcmp which compiles regular
> expressions and outputs them as C character array assignments - for
> example:
> =

> /* ".*([0-9][a-zA-Z]{3}[0-9]{5}[a-zA-Z]{3})$0$" */
> char COMMON_CODE[] =3D {
> 0101,074,00,0120,04,060,020,071,0123,07,0141,020,
> 0172,0101,020,0132,03,03,0123,04,060,020,071,05,
> 05,0123,07,0141,020,0172,0101,020,0132,03,03,014,
> 00,00,034,064,
> 0};
> =

> Adding these to your program's source code means that you don't have to=

> call regex in your program.
> =

> However I can't find the regcmp command on RedHat Linux 6.2.
> Furthermore the definitions of the compiled expression (which is passed=

> to regex) seems to be a structure with several elements, whereas on
> Unixware and Solaris it just appears to be a simple character array.
> =

> If there is no regcmp command in Linux, how do I precompile regular
> expressions so that they can be added to my source code and passed into=

> regex() calls?

As Kaz already pointed out, the regcmp command does not exist under
Linux.
One reason for this may be that e.g. under SVR4, the regcmp/regex
functions just handle char* to contain the compiled regular expression,
so you just have one single character array you have to pass around.
When you look at the regcomp/regexec under Linux, you'll find that they
work on "regex_t"s, which are complex structures contianing more than
just the precompiled pattern, e.g. the "Syntax setting with which the
pattern was compiled".
Even when this is known, it would be bad programming style to assume
that these fields will exist in future implementations.

I seconds Kaz' suggestion: compile in your program.

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
        If failure had no penalty success would not be a prize (T.  Pratchett)

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

From: Andi Kleen <[EMAIL PROTECTED]>
Subject: Re: Annotated assembler source from gcc???
Date: 20 Nov 2000 12:10:08 +0100

Kaelin Colclasure <[EMAIL PROTECTED]> writes:

> David Wragg <[EMAIL PROTECTED]> writes:
> 
> > Martin von Loewis <[EMAIL PROTECTED]> writes:
> > > What is preserved is line information as offered to debuggers. So the
> > > back-end generator *could* go back and look into the source files, to
> > > insert the original source code line.
> > > 
> > > It seems that this feature is too rarely request/too difficult to
> > > implement so that it is not available in gcc.
> > 
> > Or perhaps because compiling with -g then using objdump -S already
> > does this?
> 
> Ah, so it does! And this is actually more convenient than having the
> compiler do it -- you don't have to mess with your Makefiles. Thanks
> for the tip, David!

Another way is to use 

-g -Wa,-aldhf   or -g -Wa,-aldhf=listingname

-Andi


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

Subject: IPC bug?
From: Janne Himanka <[EMAIL PROTECTED]>
Date: Mon, 20 Nov 2000 11:38:47 GMT

I tried to install the Perl IPC::Shareable module, which uses SYSV
IPC. I have SYSV IPC configured in the kernel, and /dev/shm is
mounted. When I run "make test", it spits this in /var/log/messages:

Nov 17 15:11:27 kyklos kernel: kernel BUG at sem.c:926!
Nov 17 15:11:27 kyklos kernel: invalid operand: 0000
Nov 17 15:11:27 kyklos kernel: CPU:    0
Nov 17 15:11:27 kyklos kernel: EIP:    0010:[sys_semop+863/1072]
Nov 17 15:11:27 kyklos kernel: EFLAGS: 00210286
Nov 17 15:11:27 kyklos kernel: eax: 00000019   ebx: c7888000   ecx: 00000000   edx: 
00000000
Nov 17 15:11:27 kyklos kernel: esi: 00000001   edi: cda9ecc0   ebp: 00050000   esp: 
c7889da4
Nov 17 15:11:27 kyklos kernel: ds: 0018   es: 0018   ss: 0018
Nov 17 15:11:27 kyklos kernel: Process perl (pid: 3778, stackpage=c7889000)
Nov 17 15:11:27 kyklos kernel: Stack: c01f6e65 c01f6ef1 0000039e c7889e08 00000002 
00000001 00000000 00000002 
Nov 17 15:11:27 kyklos kernel:        c7889dfc ca7f9d60 00000000 00000000 c7888000 
ca7f9d60 00000ec2 00000000 
Nov 17 15:11:27 kyklos kernel:        cda9ecc0 00050000 c7889dfc 00000002 00000000 
c7889e2c 00000000 00001000 
Nov 17 15:11:27 kyklos kernel: Call Trace: [tvecs+41693/50360] [tvecs+41833/50360] 
[speedo_interrupt+785/912] [avl_remove+193/208] [handle_mm_fault+225/352] 
[free_page_and_swap_cache+137/144] [zap_page_range+378/544] 
Nov 17 15:11:27 kyklos kernel:        [unmap_fixup+99/288] [do_munmap+669/688] 
[sys_shmdt+93/128] [sys_ipc+65/512] [system_call+51/56] 
Nov 17 15:11:27 kyklos kernel: Code: 0f 0b 83 c4 0c 31 ff be d5 ff ff ff 89 bb 54 02 
00 00 e9 98 

Machine is Intel PIII 866 MHz, kernel 2.4.0test10, kernel was
compiled with the stock redhat 7.0 gcc (the controversial version
2.96). Anybody know a fix for this?

Janne
--
Lone Ranger  and  Tonto were riding down the line, + [EMAIL PROTECTED]
fixing everybody's troubles, everybody's but mine, + Learning & Res. Services
someone must have told them that I was doing fine. + Oulu University, Finland



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

From: Maurizio Piana <[EMAIL PROTECTED]>
Subject: UDP packet create: How to?
Date: 20 Nov 2000 11:57:56 GMT

Hi all, I _MUST_ understand how to output an udp packet from some data input,
using _DIRECTLY_ the functions contained in the file /net/ipv4/udp.c.
I presume the two I need are "udp_sendmsg" and "udp_recvmsg" [for outputting
original data from the udp packet]. I think that there are some steps I ignore
that must be done before using these functions. I only _must_ create an UDP
packet from data input [and reverse].

Can any of you help me?

Many thanx


MAURIZIO

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

Date: Mon, 20 Nov 2000 13:21:34 +0100
From: Arnaud Westenberg <[EMAIL PROTECTED]>
Subject: Re: kernel module memory usage

Stupid question?


Arnaud

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

From: [EMAIL PROTECTED]
Subject: Re: Can't find regcmp command
Date: Mon, 20 Nov 2000 14:08:28 GMT

Thanks Kaz & Josef. That's the conclusion I was coming to.

Regards

Colin

In article <[EMAIL PROTECTED]>,
  Josef Moellers <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > =
>
> > I'm porting an app which runs on Unixware and Solaris. On those
> > platforms there is a command /bin/regcmp which compiles regular
> > expressions and outputs them as C character array assignments - for
> > example:
> > =
>
> > /* ".*([0-9][a-zA-Z]{3}[0-9]{5}[a-zA-Z]{3})$0$" */
> > char COMMON_CODE[] =3D {
> > 0101,074,00,0120,04,060,020,071,0123,07,0141,020,
> > 0172,0101,020,0132,03,03,0123,04,060,020,071,05,
> > 05,0123,07,0141,020,0172,0101,020,0132,03,03,014,
> > 00,00,034,064,
> > 0};
> > =
>
> > Adding these to your program's source code means that you don't
have to=
>
> > call regex in your program.
> > =
>
> > However I can't find the regcmp command on RedHat Linux 6.2.
> > Furthermore the definitions of the compiled expression (which is
passed=
>
> > to regex) seems to be a structure with several elements, whereas on
> > Unixware and Solaris it just appears to be a simple character array.
> > =
>
> > If there is no regcmp command in Linux, how do I precompile regular
> > expressions so that they can be added to my source code and passed
into=
>
> > regex() calls?
>
> As Kaz already pointed out, the regcmp command does not exist under
> Linux.
> One reason for this may be that e.g. under SVR4, the regcmp/regex
> functions just handle char* to contain the compiled regular
expression,
> so you just have one single character array you have to pass around.
> When you look at the regcomp/regexec under Linux, you'll find that
they
> work on "regex_t"s, which are complex structures contianing more than
> just the precompiled pattern, e.g. the "Syntax setting with which the
> pattern was compiled".
> Even when this is known, it would be bad programming style to assume
> that these fields will exist in future implementations.
>
> I seconds Kaz' suggestion: compile in your program.
>
> -- =
>
> Josef M=F6llers (Pinguinpfleger bei FSC)
>       If failure had no penalty success would not be a prize (T.
Pratchett)
>


Sent via Deja.com http://www.deja.com/
Before you buy.

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

From: Andi Kleen <[EMAIL PROTECTED]>
Subject: Re: IPC bug?
Date: 20 Nov 2000 15:17:38 +0100

Janne Himanka <[EMAIL PROTECTED]> writes:
> 
> Machine is Intel PIII 866 MHz, kernel 2.4.0test10, kernel was
> compiled with the stock redhat 7.0 gcc (the controversial version
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 2.96). Anybody know a fix for this?
^^^^^^^

You probably just discovered one of the reasons why it is controversal. Try
not doing it when it hurts. When the program still occurrs with kgcc 
run the oops through ksymoops and send it to [EMAIL PROTECTED]


-Andi

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

From: Engineer <[EMAIL PROTECTED]>
Subject: thread priority using pthread...
Date: Mon, 20 Nov 2000 09:38:43 -0500

I am trying to use interrupts by creating a thread as my isr
dispatcher.  Problem is, interrupt occurs way to fast.  The interrupt
occurs before the thread creates and starts blocking.  Solution would be
the increase the thread priority to its max.  Read about using sched....
functions but cant figure it out.......can anyone give me source or
point me to source to increase the priority of a thread to its max.  The
thread is in user space....

Thanx....

-Michael Randazzo
Data Device Corp.


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

From: Mathias Waack <[EMAIL PROTECTED]>
Subject: Re: Preemption within the kernel?
Date: 20 Nov 2000 15:38:39 +0100

[EMAIL PROTECTED] (Kaz Kylheku) writes:

> I don't believe that Solaris has a preemptable kernel, but you better
> ask in a Solaris newsgroup.

Solaris 8 has a preemtable kernel. IMHO this is true for Solaris 7 too. 

Mathias

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

From: [EMAIL PROTECTED] (Erik Hensema)
Subject: Re: What distro does Linus Torvalds use?
Date: Mon, 20 Nov 2000 16:26:56 +0100
Reply-To: [EMAIL PROTECTED]

Michael V. Ferranti ([EMAIL PROTECTED]) wrote:
>       TSIA.  He's writing the kernel, so I figure what better flavor
>of distro to use than what he's got running...

Linus uses whatever he likes to use. You'd better do that too.

-- 
Erik Hensema ([EMAIL PROTECTED])
This signature is generated by siggen.pl v0.1
Available soon at http://www.xs4all.nl/~hensema

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

From: "Bernhard Drixler" <[EMAIL PROTECTED]>
Subject: Using semaphores in kernel driver
Date: Mon, 20 Nov 2000 17:01:54 +0100

Hi,

I am trying to port an existing device driver implementation to Linux. The
current implementation does not dstinguish between user and kernel space. It
creates Events, Mutexes and Semaphores ( in Linux user space) and passes
their IDs to the driver (kernel space) where they shall be locked until they
are unlocked by the ISR. Which is the best way to port such an
implementation to Linux ? How can the kenel handle semaphores created by an
application ? I would like to avoid to completely re-implement this driver.

Thanks !!!
-Bernhard Drixler



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

From: Peter Larance <[EMAIL PROTECTED]>
Subject: Developing kernel 
Date: Mon, 20 Nov 2000 15:57:10 GMT

Hi all

I am student working on a  program (module) in Linux to control the
communication between two computers ( like changing  bandwidth  and
generating packet loss and delay ).

Some friends of mine, who has  more experience on protocol design,
adviceing me to passes all received packet from net cards through a
queue and modify IP and IPchain implementation to feet my application.


I will be very be happy if somebody give me some idea, and show me some
direction to do this work. I have also some question to ask:

1- what is the good way to this work and where should i start.
2- How could i develop this program and put it in kernel without
damaging or causing the kernel to crash.

3- Are there any tools in Linux that could already to this work ?

Thanks allot Peter



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

From: Marty <[EMAIL PROTECTED]>
Subject: Changing the Block size
Date: Tue, 21 Nov 2000 00:12:27 +0800

I would like to ask are there any existing file system that have block
size as large as 512K bytes?

Besides, is it feasible to change the block size to 512KB in the linux
kernel ??

Thanks.

Marty




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

From: [EMAIL PROTECTED] (Michael Mauch)
Subject: 2.4.0-test10/test11-pre7 loosing nntp connection (leafnode/tin)
Date: Mon, 20 Nov 2000 00:52:25 +0100

Hi,

after upgrading to kernel 2.4.0-test10 I experienced problems with tin
and leafnode. When I have not been using tin for about 20 minutes, it
has problems reconnecting to leafnode and says "Article unavailable",
"Can't open /active" or "Network error: No such file or directory" /
"Network error: permission denied", depending on where I left tin. After
this first try it works just fine again.

I upgraded nearly everything (no PCMCIA e.g., as I don't have PCMCIA)
recommended in Documentation/Changes before compiling the new kernel.

So I recompiled glibc-2.1.3, upgraded to tin-1.5.7, leafnode-2.0b5_ma2,
and recompiled a newer version of inetd. The problem persists.

Perhaps I got one of these hundreds of networking options in the kernel
config wrong?

I turned on the debugging modes of leafnode and tin and looked into
"netstat -a":

when everything works fine, I see:

root> netstat -a|grep nntp
tcp        0      0 *:nntp                  *:*                     LISTEN
tcp        0      0 localhost:1334          localhost:nntp          ESTABLISHED
tcp        0      0 localhost:nntp          localhost:1334          ESTABLISHED
tcp        0      1 p3E9BA39D.dip.t-di:1483 news.fu-berlin.de:nntp  FIN_WAIT1

After not using tin for at least 20 minutes, I see:

root> netstat -a|grep nntp
tcp        0      0 *:nntp                  *:*                     LISTEN
tcp       59      0 localhost:1334          localhost:nntp          CLOSE_WAIT

That's when tin will fail to connect to leafnode. After that, it's:

root> netstat -a|grep nntp
zsh: correct 'nntp' to 'NNTP' [nyae]? n
tcp        0      0 *:nntp                  *:*                     LISTEN

Leafnode's log doesn't even show a connection attempt when tin tries
connecting for the first time (after the break).


Does anybody have some clue what I should do next? Provide more info,
e.g. excerpts from /proc/net/*? Send this question to lkml? Send an even
longer bug report to the maintainer of the networking stuff, like I'm
told in REPORTING-BUGS?

Regards...
                Michael

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

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: Annotated assembler source from gcc???
Date: Mon, 20 Nov 2000 17:45:28 GMT

In article <[EMAIL PROTECTED]>, Kaelin Colclasure wrote:
>David Wragg <[EMAIL PROTECTED]> writes:
>
>> Martin von Loewis <[EMAIL PROTECTED]> writes:
>> > What is preserved is line information as offered to debuggers. So the
>> > back-end generator *could* go back and look into the source files, to
>> > insert the original source code line.
>> > 
>> > It seems that this feature is too rarely request/too difficult to
>> > implement so that it is not available in gcc.
>> 
>> Or perhaps because compiling with -g then using objdump -S already
>> does this?
>
>Ah, so it does! And this is actually more convenient than having the
>compiler do it -- you don't have to mess with your Makefiles. Thanks
>for the tip, David!

I've always had spotty luck with objdump --source.  Sometimes
it works, sometimes it doesn't (even with -O0).  It seems to do
OK on small files with few functions, but it seems to sometimes
loose track in larger files built from multiple sources.

-- 
Grant Edwards                   grante             Yow!  A dwarf is passing
                                  at               out somewhere in Detroit!
                               visi.com            

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


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

Reply via email to