Linux-Development-Sys Digest #7, Volume #8       Mon, 10 Jul 00 15:13:17 EDT

Contents:
  Re: CHILD_MAX: can't limit the number of processes per real UID (Olivier ROBERT)
  Re: Threads in kernel modules (Mathias Waack)
  Re: Sockets in kernel module (Mathias Waack)
  Re: I/O programming problem (Mathias Waack)
  Re: RedHat 6.1 kernel module oddities (Villy Kruse)
  Tape Emulator ([EMAIL PROTECTED])
  Possible bug in insmod (RH5.2) ("Norm Dresner")
  Re: I/O programming problem ("Chun Seong Ng")
  How to port MSVC++ app to Linux? (Gene Montgomery)
  sizeof() in gcc ("Norm Dresner")
  Re: sizeof() in gcc (Grant Edwards)
  Re: sizeof() in gcc (Kaz Kylheku)
  Re: sizeof() in gcc ("Norm Dresner")
  keyboard with additional function keys ("LY")
  Re: is there a port to windows media player? (Stewart Honsberger)
  Re: is there a port to windows media player? (Stewart Honsberger)
  Re: RedHat 6.1 kernel module oddities (Richard Bonomo)
  Re: C++ linking (John Gluck)
  Re: 2.4.0test2 and pppd (John Gluck)
  Re: keyboard with additional function keys (Jan Panteltje)
  Re: RedHat 6.1 kernel module oddities (Bill Waddington)

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

From: Olivier ROBERT <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.setup,comp.os.linux.misc
Subject: Re: CHILD_MAX: can't limit the number of processes per real UID
Date: Mon, 10 Jul 2000 13:30:30 +0200

Ross Crawford wrote:
> Did you make clean before recompiling?
> 

Yes, I've even made a make mrproper!

O.R.

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

From: Mathias Waack <[EMAIL PROTECTED]>
Subject: Re: Threads in kernel modules
Date: 10 Jul 2000 13:13:22 +0200

"Sake" <[EMAIL PROTECTED]> writes:

> I'm new to the kernel modules. I want to write a module (or device
> driver) that needs to have two threads of controls. I don't know what
> kernel routines are available for this purpose 

kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)

fn: entry point (start function of the thread)
arg: argument for the function


> and how I can do the
> mutex like inter-locking in kernel module.

see Documentation/spinlock.txt

Mathias

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

From: Mathias Waack <[EMAIL PROTECTED]>
Subject: Re: Sockets in kernel module
Date: 10 Jul 2000 13:15:24 +0200

"Sake" <[EMAIL PROTECTED]> writes:

> What are the set of routines can be used to do socket operations from
> within a kernel module or a device driver.

First remark you shouldn't do that. If you still want do that: 

Open the socket from user space and pass the fd throw an ioctl-call 
to your driver. No you can use it. 

Mathias

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

From: Mathias Waack <[EMAIL PROTECTED]>
Subject: Re: I/O programming problem
Date: 10 Jul 2000 13:21:26 +0200

"Chun Seong Ng" <[EMAIL PROTECTED]> writes:

> My problem is I cannot compile simple I/O program. The error message
> came out was:
> 
> In file included from try2.c:3: /usr/include/asm/io.h:78: syntax error
> before `extern'
> 
> My codes was:
[snip]

> My questions are: What does it means "syntax error before 'extern'"?

Don't know, I don't get this error. On my box the program compiles 
without errors. I've replaced asm/io.h by sys/io.h. Did you used the 
-O2 flag for the gcc?

Mathias

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

From: [EMAIL PROTECTED] (Villy Kruse)
Subject: Re: RedHat 6.1 kernel module oddities
Date: 10 Jul 2000 11:58:04 GMT

On Fri, 07 Jul 2000 17:39:31 -0500, Richard Bonomo <[EMAIL PROTECTED]> wrote:
>
>I am writing a device driver for RehHat 6.1
>(kernel version 2.2.12).
>
>I have found, so far that:
>
>"ioremap" is not recognized.  I have to 
>call "__ioremap" with an additional parameter.
>For some reason the definition is not taking.
>
>While calls to "inb" and "outb" worked just fine
>in a privileged user program, and while gcc -c <name>
>produces no errors, attempts to load the module
>(with insmod) immediately generates messages to the
>effect that outb and inb are not recognized symbols (!!).
>
>Can anyone enlighten me?
>




ioremap is an inline function, and that works only if you
compile with -O2.  Same for inb and outb.

These inline functions are defined in <asm/io.h>.  




Villy

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

From: [EMAIL PROTECTED]
Subject: Tape Emulator
Date: Mon, 10 Jul 2000 12:24:00 GMT

Hi there,

I'm looking for a tape emulator in C, ie something that emulate a tape
device and respond correctly to ioctl calls with mtio parameter (to do
rewind, step block, etc ...).

Thanks for any help,

Christophe
[EMAIL PROTECTED]


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

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

Reply-To: "Norm Dresner" <[EMAIL PROTECTED]>
From: "Norm Dresner" <[EMAIL PROTECTED]>
Crossposted-To: comp.arch.embedded,linux.redhat.development
Subject: Possible bug in insmod (RH5.2)
Date: Mon, 10 Jul 2000 14:14:37 GMT

I�m having a problem because INSMOD is not loading one module correctly.
Here�s the system:
 RH 5.2 w/Real-Time Linux 0.9J extensions to the kernel
 gcc-2.7.2.3-14
 binutils (ld) 2.9.1.0.15-1
 modutils  (insmod) 2.1.85-9

An interface board I�m using has its 64K dual-ported segment located in
PC-address space at 0x000D0000, so I�m trying to get the module compiled so
that a particular `segment� falls at that address so I can use direct
addressing of registers instead of having to dereference pointers for every
access.

Here�s how the memory is declared in the C-function that uses it:

 unsigned char   DualPortedMemory[2]
          __attribute__ ((section (".DPM" ) ) )
                   ={0x68,0x89};

and here�s the loader command-file (invoked with -T load_cmds) on the
ld-line of the make-file:


MEMORY
     {
      DUALPORT (rw)  :  ORIGIN = 0x000D0000   , LENGTH = 64K
      }


SECTIONS
    {
    .bss     : { *(.bss) }
    .text    : { *(.text) }
    .data    : { *(.data) }
    .note    : { *(.note) }
    .comment    : { *(.comment) }
    .rodata    : { *(.rodata)  }
    .DPM 0x000D0000 (NOLOAD) :   { *(.DPM) }   >DUALPORT :NONE
    }

The headers of the linked-moduel (as examined with objdump) show that the
segment .DPM is located at the right address:

dummy.o:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
   . . .
  6 .DPM          00000002  000d0000  000d0000  00001218  2**0
                  ALLOC

and the load-map from the insmod command has the following:

 Sections:       Size      Address   Align
 .moduse    00000004  0807a000  2**2
 .text          0000088e  0807a004  2**2
 .rodata      00000358  0807a892  2**0
 .data         0000050c  0807abec  2**2
 .bss           0000009c  0807b0f8  2**2
 .DPM        00000002  0807b194  2**0

showing that, despite everything I�ve tried, insmod insists on loading the
module without properly relocating the .DPM-segment to 0x000D0000.

I�ve tried just about every possible combination of things in the loader
command-file, but that doesn�t seem to be the problem since the disassemby
of the loader�s output shows that references to array DualPortedMemory[] are
being correctly relocated to the .DPM segment located at the correct
address.

I�ve scanned the code for an older version of insmod (which is all I could
find quickly) and it looks like it was never designed to do what I want it
do.

1. Is there something obvious I�m missing?
2. Has anyone every done this successfully before?
3. Can anyone confirm this "bug"?

I�d like to exhaust all possible approaches before I start creating dozens
of pointers � an error-prone approach if the underlying structures change
radically.

Thanks.

 Norm




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

From: "Chun Seong Ng" <[EMAIL PROTECTED]>
Subject: Re: I/O programming problem
Date: Mon, 10 Jul 2000 13:29:20 +0100

Hey Mathias, thanks for answering my question. I've replaced the asm/io.h
with sys/io.h and compiled with

gcc -O -o try try.c
gcc -O2 try try.c

But the same problem happen, i.e. "In file included from try2.c:3:
/usr/include/asm/io.h:78: syntax error before `extern'"

By the way, I'm using Red Hat 6.1 with Linux 2.2.12 kernel and egcs-1.1.2
release.

Regards,
Chun Seong

Mathias Waack wrote in message ...
>"Chun Seong Ng" <[EMAIL PROTECTED]> writes:
>
>> My problem is I cannot compile simple I/O program. The error message
>> came out was:
>>
>> In file included from try2.c:3: /usr/include/asm/io.h:78: syntax error
>> before `extern'
>>
>> My codes was:
>[snip]
>
>> My questions are: What does it means "syntax error before 'extern'"?
>
>Don't know, I don't get this error. On my box the program compiles
>without errors. I've replaced asm/io.h by sys/io.h. Did you used the
>-O2 flag for the gcc?
>
>Mathias



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

From: Gene Montgomery <[EMAIL PROTECTED]>
Subject: How to port MSVC++ app to Linux?
Date: Mon, 10 Jul 2000 15:53:25 GMT

Hi,
        I am a reasonably seasoned software developer who uses GNU and Linux
pretty much entirely.  However, I want to port a windoze app developed
under MSVC++ version 5, apparently.  One of the first problems I see is
something called "archive".  It appears that the code was written using
Microsoft-provided libraries (perhaps Microsoft Foundation Class
libraries).  I don't have those, and would prefer to bypass learning
much about them.  However, the code does not provide clues as to how
this "archive" function or "serialization" works.  The application
produces "archive" files which are binary, and therefore undecipherable
without documentation.

        I would like to find only as much information as is required to port
this application over to the GNU Linux environment.  I have already
rejected trying to get it up under WINE, as that does not let me alter
the functionality without installing Microsoft's development
environment.  I want to stay away from Microsoft stuff as much as I can.

        I would appreciate hearing any tips regarding porting MS-dependent code
to the Linux/GNU world, or a steer to a web site with such information.  

TIA,
        Gene Montgomery

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

Reply-To: "Norm Dresner" <[EMAIL PROTECTED]>
From: "Norm Dresner" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: sizeof() in gcc
Date: Mon, 10 Jul 2000 16:37:15 GMT

I'm getting a "parse error" on the (simplified) line
    #if    ( sizeof(int) ) != 4

Is this really illegal?

Is there any other way to do size comparisons in the pre-processor?

    Norm



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

From: [EMAIL PROTECTED] (Grant Edwards)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: sizeof() in gcc
Date: Mon, 10 Jul 2000 16:46:52 GMT

In article <%Yma5.4066$[EMAIL PROTECTED]>, Norm Dresner 
wrote:

>I'm getting a "parse error" on the (simplified) line
>    #if    ( sizeof(int) ) != 4
>
>Is this really illegal?

Yes.  

sizeof is a C language operator implimented in the compiler.
It is not a pre-processor operator.

>Is there any other way to do size comparisons in the pre-processor?

Not that I know of.  That's one of the reasons that gnu
autoconf was invented: to figure out and set preprocessor
options based on stuff you can't figure out until compile time.

-- 
Grant Edwards                   grante             Yow!  -- I love KATRINKA
                                  at               because she drives a
                               visi.com            PONTIAC. We're going
                                                   awaynow. I fed the cat.

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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: sizeof() in gcc
Reply-To: [EMAIL PROTECTED]
Date: Mon, 10 Jul 2000 16:47:50 GMT

On Mon, 10 Jul 2000 16:37:15 GMT, Norm Dresner <[EMAIL PROTECTED]> wrote:
>I'm getting a "parse error" on the (simplified) line
>    #if    ( sizeof(int) ) != 4
>
>Is this really illegal?

Yes. The ANSI C preprocessor expression syntax does not have the sizeof
operator.

>Is there any other way to do size comparisons in the pre-processor?

No. One solution is not to write code which has dependencies on the
representation of data types.

The other is to simply do the comparison using an ordinary selection statement.
If the compiler is any good, it will remove the unreachable code.

-- 
#exclude <windows.h>

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

Reply-To: "Norm Dresner" <[EMAIL PROTECTED]>
From: "Norm Dresner" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: sizeof() in gcc
Date: Mon, 10 Jul 2000 17:25:35 GMT


Kaz Kylheku <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> On Mon, 10 Jul 2000 16:37:15 GMT, Norm Dresner <[EMAIL PROTECTED]> wrote:
> >I'm getting a "parse error" on the (simplified) line
> >    #if    ( sizeof(int) ) != 4
> >
> >Is this really illegal?
>
> Yes. The ANSI C preprocessor expression syntax does not have the sizeof
> operator.
>
> >Is there any other way to do size comparisons in the pre-processor?
>
> No. One solution is not to write code which has dependencies on the
> representation of data types.
>
> The other is to simply do the comparison using an ordinary selection
statement.
> If the compiler is any good, it will remove the unreachable code.
>

I truth, in the original -- unsimplified -- file, the sizeof() operator was
used (in Borland C) to verify that two different data structures would, when
combined in any order, yield the same memory layout, i.e. that two different
ways of setting up the FIFOs in a communications channel would ultimately
take the same space so the memory could be pre-allocated and the user could
dynamically define the channel's characteristics.

There are obviously many other ways to perform the same check, but we felt
that doing this at compile-time would make the system the most robust
against unintentional changes later.  I agree that sizeof() is a C-operator,
but when the Borland-C implementation had it I thought (obviously
incorrectly) that I could also use it in the Linux version.

    Norm



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

From: "LY" <[EMAIL PROTECTED]>
Crossposted-To: 
comp.os.linux.development.apps,comp.os.linux.development,comp.os.linux.hardware
Subject: keyboard with additional function keys
Date: Mon, 10 Jul 2000 19:12:35 +0200

Hi!

Can someone help me!

I have a keyboard with about 30 additional function keys. If I press one key
it gives me for example a double "4" or "a" ... (44, aa, ...). It means that
I get double scancodes. These parts of this sequence of scancodes are the
same and they are known.
Do someone know how to change this sequence of double scancodes in a unique
scancode? Or can somebody write a program for solving this problem?

If someone can really solve this problem, then please contact me!!! I would
give a little pocket money (allowance)!


Sincerely,

LY



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

From: [EMAIL PROTECTED] (Stewart Honsberger)
Crossposted-To: 
comp.os.linux.development.apps,comp.os.linux.misc,comp.os.linux.setup,comp.os.linux.x
Subject: Re: is there a port to windows media player?
Reply-To: [EMAIL PROTECTED]
Date: Mon, 10 Jul 2000 17:27:06 GMT

On Sat, 08 Jul 2000 18:14:19 GMT, C.J. wrote:
>>That part of the thread I must have missed. By identical functionality,
>>do you mean "can handle streaming audio?" Certainly xmms can do it with
>>mp3, and real can do it with .ram's. But, do you mean 'can handle .asp
>>files? THAT would be news! :-)
>
>Why?  The sound quality of .asp sucks seriously.

Not to mention the video quality. Pixelization something fierce on a
450MHz system, 192M RAM, VooDoo 3 2000 16M vid card, and 17" monitor.

Squares about 1" across at times. Frames that move in jerks and jumps.
Sound that follows video at 1 or 2 second intervals, sometimes worse.

ASF may generate files 1/2 the size of MPEGs, but I'm not sure the quality
is worth the savings in media costs and storage space.

-- 
Stewart Honsberger (AKA Blackdeath) @ http://sprk.com/blackdeath/
[EMAIL PROTECTED]  (Remove 'thirteen' to reply privately)
Humming along under SuSE 6.4, Linux 2.2.14

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

From: [EMAIL PROTECTED] (Stewart Honsberger)
Crossposted-To: 
comp.os.linux.development.apps,comp.os.linux.misc,comp.os.linux.setup,comp.os.linux.x
Subject: Re: is there a port to windows media player?
Reply-To: [EMAIL PROTECTED]
Date: Mon, 10 Jul 2000 17:30:07 GMT

On Sat, 08 Jul 2000 18:21:55 GMT, Mike Frisch wrote:
>Perhaps, but there are plenty of .asp only sources on the net.

Check http://www.shoutcast.com - you'll find literally hundreds of streaming
MP3 servers. Pick and choose according to genre, bandwidth, and bitrate.

>My local radio station only supports Windows Media Player which leaves me
>high and dry in Linux.

Suggest a streaming Shoutcast server. Plenty exist for all platforms, and
I believe there are even a few OSS servers available.

Tell 'em it'll likely save bandwidth, increase quality, and increase
listenership.

-- 
Stewart Honsberger (AKA Blackdeath) @ http://sprk.com/blackdeath/
[EMAIL PROTECTED]  (Remove 'thirteen' to reply privately)
Humming along under SuSE 6.4, Linux 2.2.14

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

From: Richard Bonomo <[EMAIL PROTECTED]>
Subject: Re: RedHat 6.1 kernel module oddities
Date: Mon, 10 Jul 2000 12:24:08 -0500

Villy Kruse wrote:
> 
> On Fri, 07 Jul 2000 17:39:31 -0500, Richard Bonomo <[EMAIL PROTECTED]> wrote:
> >
> >I am writing a device driver for RehHat 6.1
> >(kernel version 2.2.12).
> >
> >I have found, so far that:
> >
> >"ioremap" is not recognized.  I have to
> >call "__ioremap" with an additional parameter.
> >For some reason the definition is not taking.
> >
> >While calls to "inb" and "outb" worked just fine
> >in a privileged user program, and while gcc -c <name>
> >produces no errors, attempts to load the module
> >(with insmod) immediately generates messages to the
> >effect that outb and inb are not recognized symbols (!!).
> >
> >Can anyone enlighten me?
> >
> 
> ioremap is an inline function, and that works only if you
> compile with -O2.  Same for inb and outb.
> 
> These inline functions are defined in <asm/io.h>.
> 
> Villy

Yes, I know they are defined in <asm/io.h>, but the
subtlety about -O being REQUIRED had escaped me.
This explains much.  Thank you very much!

Rich

P.S. Do you know if there is a "sleep" or "usleep"
function (or equivalent) available to the kernel, or
is it necessary to employ a do-nothing loop to put
in a delay?

RB
-- 
************************************************
Richard Bonomo
UW Space Astronomy Laboratory
ph: (608) 263-4683 telefacsimile: (608) 263-0361
SAL-related email: [EMAIL PROTECTED]
all other email: [EMAIL PROTECTED]
web page URL: http://www.cae.wisc.edu/~bonomo
************************************************

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

From: John Gluck <[EMAIL PROTECTED]>
Subject: Re: C++ linking
Date: Mon, 10 Jul 2000 14:11:35 -0400

[EMAIL PROTECTED] wrote:

> Hi everybody,
> i'm new in here, can anyone explain how to
> write a C++ program in Linux Redhat 6.2.
> i can compiled it and how can i link it and
> execute it.
>
> by the way, what is the best way to write C++,
> in command prompt?
>
> thanks in advance anthony
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

It appears from your post that you are new to programming.

You  should spend a little time with a good book, study a couple of
small programs.
Learn how to use make.

Your last question, I think you mean which editor to use but the
question makes no sense...

--
John Gluck  (Passport Kernel Design Group)

(613) 765-8392  ESN 395-8392

Unless otherwise stated, any opinions expressed here are strictly my own
and do not reflect any official position of Nortel Networks.




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

From: John Gluck <[EMAIL PROTECTED]>
Subject: Re: 2.4.0test2 and pppd
Date: Mon, 10 Jul 2000 14:14:08 -0400

"[EMAIL PROTECTED]" wrote:

> I have installed the newest "stable" devel. kernel. I still cannot get
> pppd working. ppp.txt which is supposed to be included does not seem to
> be there (find has not found it). In /var/log/messages I get input/ouput
> errors and during boot I get ip_always_defrag not found. Can anyone give
> me the documentation needed? By reading the files included w/ ppp-2.4.0,
> I think I need to use ppp-on (edited) in conjunction w/
> ppp-dialing-scripts (or some such, edited as well). Can anyone give me
> some pointers? Merci beaucoup.

I was going to send you a meaningful reply, however the vulgarity of your
return address told me not to bother

--
John Gluck  (Passport Kernel Design Group)

(613) 765-8392  ESN 395-8392

Unless otherwise stated, any opinions expressed here are strictly my own
and do not reflect any official position of Nortel Networks.




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

From: [EMAIL PROTECTED] (Jan Panteltje)
Crossposted-To: 
comp.os.linux.development.apps,comp.os.linux.development,comp.os.linux.hardware
Subject: Re: keyboard with additional function keys
Date: Mon, 10 Jul 2000 18:56:41 GMT

Someone mentioned this site, a little while ago here:
http://www.kettering.edu/~ormb7576/linux.html#tip5

Pocket money hey:-)?
How'bout giving everyone here an icecream?
Jan

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

From: Bill Waddington <[EMAIL PROTECTED]>
Subject: Re: RedHat 6.1 kernel module oddities
Date: Mon, 10 Jul 2000 18:51:47 GMT

In article <[EMAIL PROTECTED]>,
  Richard Bonomo <[EMAIL PROTECTED]> wrote:
> Villy Kruse wrote:
> >
> > On Fri, 07 Jul 2000 17:39:31 -0500, Richard Bonomo
<[EMAIL PROTECTED]> wrote:
> > >
> > >I am writing a device driver for RehHat 6.1
> > >(kernel version 2.2.12).
> > >
> > >I have found, so far that:
> > >
> > >"ioremap" is not recognized.  I have to
> > >call "__ioremap" with an additional parameter.
> > >For some reason the definition is not taking.
> > >
> > >While calls to "inb" and "outb" worked just fine
> > >in a privileged user program, and while gcc -c <name>
> > >produces no errors, attempts to load the module
> > >(with insmod) immediately generates messages to the
> > >effect that outb and inb are not recognized symbols (!!).
> > >
> > >Can anyone enlighten me?
> > >
> >
> > ioremap is an inline function, and that works only if you
> > compile with -O2.  Same for inb and outb.
> >
> > These inline functions are defined in <asm/io.h>.
> >
> > Villy
>
> Yes, I know they are defined in <asm/io.h>, but the
> subtlety about -O being REQUIRED had escaped me.
> This explains much.  Thank you very much!
>
> Rich
>
> P.S. Do you know if there is a "sleep" or "usleep"
> function (or equivalent) available to the kernel, or
> is it necessary to employ a do-nothing loop to put
> in a delay?
>

Hello,

If you aren't worried about the delay being longer than requested, this
at least lets other processes have a slice while you are "doing
nothing":


        /*
         * wait ...
         */

        wait_j = jiffies + desired_delay_in_jiffies;

        while (jiffies < wait_j)
                schedule();

Perhaps there are better ways of doing this ....

Bill
--
Bill Waddington
[EMAIL PROTECTED]
[EMAIL PROTECTED]


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

Reply via email to