Linux-Development-Sys Digest #313, Volume #8     Thu, 30 Nov 00 19:13:11 EST

Contents:
  Re: Compilation problem for module on Linux 7.0 (Anders Larsen)
  Re: Help me . I don't understand this definiiton . (Josef Moellers)
  Global constructors in ELF so libs NOT CALLED! (Erik Westlin)
  Re: Global constructors in ELF so libs NOT CALLED! ("Z")
  Re: Global constructors in ELF so libs NOT CALLED! ("John C. Griggs")
  Re: Module Compilation Problems (Rand Simberg)
  Re: Compilation problem for module on Linux 7.0 (Paul Kimoto)
  open ttyS0 from kernel ([EMAIL PROTECTED])
  Re: Help me . I don't understand this definiiton . (Kaz Kylheku)
  Re: Help me . I don't understand this definiiton . (Kaz Kylheku)
  Re: Problem: sigaction with SI_SIGINFO flag (Anton Ertl)
  how to rebuild tcp code (Eric Taylor)
  Re: how to rebuild tcp code (Rex Dieter)
  config for pre-built kernel (RH 6.2) (Brian Horton)
  THANKS!!!! Re: how to rebuild tcp code (Eric Taylor)
  Re: Linux and RAID ("Carbon")
  Re: gcc-2.95.2 forces ALL c++ programs to be GPL !!??!# (Stefaan A Eeckels)
  Re: gcc-2.95.2 forces ALL c++ programs to be GPL !!??!# (Nix)
  Re: Runtime file size modifying (Nix)
  Re: WHAT "void value not ignored as it ought to be" means when I try to  complie a 
file? (Nix)

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

From: Anders Larsen <[EMAIL PROTECTED]>
Subject: Re: Compilation problem for module on Linux 7.0
Date: Thu, 30 Nov 2000 14:28:36 +0100

[EMAIL PROTECTED] wrote:
> 
> hi
> I am getting the following warning when I compile my kernel module on
> redhat linux 7.0
> 
> /tmp/ccmIsPtz.s: Assembler messages
> /tmp/ccmIsPtz.s:Warning: Ignoring changed section attributes
> for .modinfo
> 
> I am compiling the module using
> gcc -c O6 Wall -D_KERNEL_ -DMODULE -DLINUX_ -I/usr/src/linux/include
> modulename.c
> 
> If I try compiling the same module using the same flags on Linux 6.1 it
> dosen't give any problem. Any idea why this should happen?

On RH 7.0 you must use kgcc (not gcc) to compile the kernel & modules
(Unfortunately, the kgcc package is not installed per default).
You'll have to edit /usr/src/linux/Makefile to reflect this.

-- 
Anders Larsen

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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: Help me . I don't understand this definiiton .
Date: Thu, 30 Nov 2000 15:31:02 +0100

Harry Xia wrote:
> =

> Hello , I often see the definition like below :
> =

> struct
> {
>     int a;
>     char ch_buf[1];  // I don't understand
> }foo;
> =

> Why define like char ch_buf[1] ? I think it can
> be defined to pointer: char * ch_buf, or
> char ch_buf[MAX_NUMBER] .
> =

> In fact , 'char ch_buf[1]' is used as an array
> which buffer is more than 1 .
> I don't know how to use ch_buf . I can't assign
> a buffer pointer to it .  How can I let the ch_buf
>  point to another buffer

C does not do any bounds checking. So even if there is only one array
element, foo->ch_buf[0], you will get no error message when you access
e.g. foo->ch_buf[1]. If you carefully allocate a piece of memory which
is larger than the structure defined above, you can use the excess
memory as the additional elements of the ch_buf array:

    struct bar {
        int a;
        char ch_buf[1];
    } *foo;

    int size_minus_1 =3D 9;
    foo =3D (struct bar *) malloc(sizeof(struct bar) + size_minus_1);

You now have the quivalent of
    struct bar {
        int a;
        char ch_buf[10];
    } *foo;

By using different values for "size_minus_1" you can allocate as much
memory for ch_buf as you need:

    int datasize;

    datasize =3D howmuchneeded(socket);
    foo =3D (struct bar *) malloc(sizeof(struct bar) + datasize - 1);
    if (foo !=3D (struct bar *) NULL)
        recieve_buffer(foo);

If you had written

# define        MAX_NUMBER      100
    struct bar {
        int a;
        char ch_buf[MAX_NUMBER];
    } *foo;

you'd have enough space for 100 characters, no more (what if you need
more?) no less (what if you only need 5?).

It's not a trick, it's a ... valid C construct!

Hope this helps,

-- =

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

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

From: Erik Westlin <[EMAIL PROTECTED]>
Subject: Global constructors in ELF so libs NOT CALLED!
Date: Thu, 30 Nov 2000 16:21:26 +0100
Reply-To: [EMAIL PROTECTED]

Or am i wrong? 
Then how to do it please?
Thank you!
=====================================================================

       Erik Westlin                   Manne Siegbahn Laboratory
       email: [EMAIL PROTECTED]

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

From: "Z" <[EMAIL PROTECTED]>
Subject: Re: Global constructors in ELF so libs NOT CALLED!
Date: Thu, 30 Nov 2000 16:36:16 +0100

Once upon a while "Erik Westlin" <[EMAIL PROTECTED]> wrote:

> Or am i wrong? 
> Then how to do it please?
> Thank you!
> ---------------------------------------------------------------------
> 
>        Erik Westlin                   Manne Siegbahn Laboratory
>        email: [EMAIL PROTECTED]

Helloooo!

Are you able to write in whole senteces? 
I can't understand your question, and I suppose that most readers
can't.

-- 
Z ([EMAIL PROTECTED])
"LISP  is worth learning for  the profound enlightenment  experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days."   -- Eric S. Raymond

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

Date: Thu, 30 Nov 2000 10:56:58 -0500
From: "John C. Griggs" <[EMAIL PROTECTED]>
Subject: Re: Global constructors in ELF so libs NOT CALLED!

Erik Westlin wrote:
> 
> Or am i wrong?

Yes, you are wrong.

> Then how to do it please?

Tell us how you're doing it now and we can help.  Otherwise it is
impossible to guess what the problem might be.

> Thank you!

You are welcome.

Regards,
        John Griggs

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

From: [EMAIL PROTECTED] (Rand Simberg)
Subject: Re: Module Compilation Problems
Date: Thu, 30 Nov 2000 16:29:34 GMT

On Thu, 30 Nov 2000 10:52:20 +0800, in a place far, far away, "Brian"
<[EMAIL PROTECTED]> made the phosphor on my monitor glow in such
a way as to indicate that:

>> Yes, I did that, at the suggestion of another poster, and it worked.
>> My question now is, why did it formerly work without that path?  That
>> command is the one in the source itself, and I've always used it
>> successfully in the past.  Is it a kgcc thing?
>
>I think the default search path for include files is /usr/include. In RedHat
>6.x, there is a link in that directory: linux -> ../src/linux/include/linux,
>so you don't have to specify the include path in command line. The link no
>longer exists in RH 7.0.

Is there some reason that I shouldn't just restore that link?

************************************************************************
simberg.interglobal.org  * 310 372-7963 (CA) 307 739-1296 (Jackson Hole)  
interglobal space lines  * 307 733-1715 (Fax) http://www.interglobal.org 

"Extraordinary launch vehicles require extraordinary markets..."
Replace first . with @ and throw out the "@trash." to email me.  
Here's my email address for autospammers: [EMAIL PROTECTED]

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

From: [EMAIL PROTECTED] (Paul Kimoto)
Subject: Re: Compilation problem for module on Linux 7.0
Date: 30 Nov 2000 11:49:43 -0500
Reply-To: [EMAIL PROTECTED]

In article <905ckt$p8f$[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote:
> /tmp/ccmIsPtz.s: Assembler messages
> /tmp/ccmIsPtz.s:Warning: Ignoring changed section attributes
> for .modinfo

I believe that this is just a new binutils warning message and does not
mean that there will be a functional problem with the module.

-- 
Paul Kimoto
This message was originally posted on Usenet in plain text.  Any images, 
hyperlinks, or the like shown here have been added without my consent,
and may be a violation of international copyright law.

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

From: [EMAIL PROTECTED]
Subject: open ttyS0 from kernel
Date: Thu, 30 Nov 2000 16:41:38 GMT



I'm constructing a kernel module (software modem) that must open the a
serial port (ttyS?).
The construction looks like:
<user mode app> | <modem driver> | <ttyS> | <serial driver> | hardware

I don't want to implement the whole serial driver my self (yes, I
could, but that is not the design choosen) instead I want to use it as
I would from user mode.

The problem is: How do I open and read/write to it? I've tried
both "open" (which fails) and "filp_open".
filp_open() succeeds, and I get a lot of pointer to read/write.

However, when I call write I get -29 in return, and nothing is written.

Have anybody done somwthing like this before, and if so, what am I
doing wrong?

Finally, NO - the driver needs to be in the kernel, so I can't
implement it as a user mode program.

Thanks,
Eric



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

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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Help me . I don't understand this definiiton .
Reply-To: [EMAIL PROTECTED]
Date: Thu, 30 Nov 2000 17:59:06 GMT

On Thu, 30 Nov 2000 21:08:32 +0800, Harry Xia <[EMAIL PROTECTED]> wrote:
>Hello , I often see the definition like below :
>
>struct
>{
>    int a;
>    char ch_buf[1];  // I don't understand
>}foo;
>
>Why define like char ch_buf[1] ? I think it can
>be defined to pointer: char * ch_buf, or
>char ch_buf[MAX_NUMBER] .

This is known as the ``struct hack''. The intent is that the structure type is
used as an lvalue to designate the first few bytes of a much larger object.
The array can then be safely accessed beyond the boundary.  Note that C
implementations that perform array bounds checking may diagnose the problem if
array subscripting is used to access beyond the bounds of the array directly,
but access through a pointer is okay.

>a buffer pointer to it .  How can I let the ch_buf
> point to another buffer

By redeclaring it as a pointer type, obviously. Then you have to hunt down all
the places in the code which use the struct and ensure that the pointer is
properly initialized.

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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Help me . I don't understand this definiiton .
Reply-To: [EMAIL PROTECTED]
Date: Thu, 30 Nov 2000 18:07:54 GMT

On Thu, 30 Nov 2000 15:31:02 +0100, Josef Moellers
<[EMAIL PROTECTED]> wrote:
>Harry Xia wrote:
>> 
>> Hello , I often see the definition like below :
>> 
>> struct
>> {
>>     int a;
>>     char ch_buf[1];  // I don't understand
>> }foo;
>> 
>> Why define like char ch_buf[1] ? I think it can
>> be defined to pointer: char * ch_buf, or
>> char ch_buf[MAX_NUMBER] .
>> 
>> In fact , 'char ch_buf[1]' is used as an array
>> which buffer is more than 1 .
>> I don't know how to use ch_buf . I can't assign
>> a buffer pointer to it .  How can I let the ch_buf
>>  point to another buffer
>
>C does not do any bounds checking. So even if there is only one array
>element, foo->ch_buf[0], you will get no error message when you access
>e.g. foo->ch_buf[1].

Actually this is undefined behavior. Although foo->ch_buf[2] is equivalent to
*(foo->ch_buf + 2)  that equivalence only holds when the array bound is not
violated. Implementations are allowed to diagnose out-of-bounds array
references, even if these are confined to within some larger object.

I'm using [2] because the lvalue expression foo->ch_buf[1] is permitted,
provided that it's subject to the & or sizeof operator (i.e. no attempt is made
to convert the lvalue to a stored value), since it's okay to point one past the
last element in an array.

Interestingly, C99 has some new provisions for struct hacks. In the new
language, it is permitted to declare array elements within structs without
specifying a dimension. (Previously, this was a constraint violation: member
shall not have incomplete type). An array member thus declared is the basis for
an ISO-blessed struct hack. Disclaimer: the precise details escape me now
and I don't have the document handy.

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

From: [EMAIL PROTECTED] (Anton Ertl)
Subject: Re: Problem: sigaction with SI_SIGINFO flag
Date: 30 Nov 2000 18:59:22 GMT

In article <[EMAIL PROTECTED]>,
 Petr Bavorovsky <[EMAIL PROTECTED]> writes:
>Man page of sigaction says, that SIGIO (synonyms SIGPOLL, SIGURG) fills
>si_fd field.

The man page you use is not necessarily in sync with the kernel and
the libraries.  In the 2.2 kernels (at least up to 2.2.14) the siginfo
stuff is only supported for a few signals (apparently the POSIX
real-time signals).  2.4.0-test11 supports more (at least SIGSEGV and
SIGFPE, which gforth uses), but I don't know about SIGIO.  I think you
also need glibc-2.1 to get the appropriate include files.

>It seems difficult to find soft which uses sigaction call with
>SI_SIGINFO flag

Get gforth-0.5.0 from your closest GNU or sunsite mirror, and look at
engine/signals.c for an example involving SIGSEGV and SIGFPE.

- anton
-- 
M. Anton Ertl                    Some things have to be seen to be believed
[EMAIL PROTECTED] Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html

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

From: Eric Taylor <[EMAIL PROTECTED]>
Subject: how to rebuild tcp code
Date: Thu, 30 Nov 2000 20:17:13 GMT

Hi:

Is the tcp code in the kernel?

I want to try a change in a 
retry count (TCP_RETR2). It's
in tcp.h 

Can I just change this and build
a new kernel?

thanks
Eric

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

From: Rex Dieter <[EMAIL PROTECTED]>
Subject: Re: how to rebuild tcp code
Date: Thu, 30 Nov 2000 15:12:45 -0600

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

Eric Taylor wrote:

> Is the tcp code in the kernel?
> 
> I want to try a change in a
> retry count (TCP_RETR2). It's
> in tcp.h
> 
> Can I just change this and build
> a new kernel?

How about

to read:
cat /proc/sys/net/ipv4/tcp_retries2

to set
echo 42 > /proc/sys/net/ipv4/tcp_retries2

-- 
Rex A. Dieter                   [EMAIL PROTECTED] 
Computer System Administrator   http://www.math.unl.edu/~rdieter/
Mathematics and Statistics               
University of Nebraska Lincoln
==============AC39FA57423121C141D75CE7
Content-Type: text/x-vcard; charset=us-ascii;
 name="rdieter.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Rex Dieter
Content-Disposition: attachment;
 filename="rdieter.vcf"

begin:vcard 
n:Dieter;Rex
tel;fax:402-472-8466
tel;work:402-472-9747
x-mozilla-html:FALSE
url:http://www.math.unl.edu/~rdieter/
org:University of Nebraska Lincoln;Mathematics and Statistics
adr:;;817 Oldfather Hall;Lincoln;NE;68588-0323;USA
version:2.1
email;internet:[EMAIL PROTECTED]
title:Computer System Administrator
x-mozilla-cpt:;0
fn:Rex Dieter
end:vcard

==============AC39FA57423121C141D75CE7==


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

From: Brian Horton <[EMAIL PROTECTED]>
Subject: config for pre-built kernel (RH 6.2)
Date: Thu, 30 Nov 2000 13:16:05 -0600

Is there a way to tell what set of config settings where used for my RH
6.2 kernel? I want to build my own but with as little different from the
one that's already installed as possible.

thx.bri.

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

From: Eric Taylor <[EMAIL PROTECTED]>
Subject: THANKS!!!! Re: how to rebuild tcp code
Date: Thu, 30 Nov 2000 21:35:03 GMT

Damn! You da MAN!!!

Thanks
Eric

(Hmmm... lots of other interesting values there :-)


Rex Dieter wrote:
> 
> Eric Taylor wrote:
> 
> > Is the tcp code in the kernel?
> >
> > I want to try a change in a
> > retry count (TCP_RETR2). It's
> > in tcp.h
> >
> > Can I just change this and build
> > a new kernel?
> 
> How about
> 
> to read:
> cat /proc/sys/net/ipv4/tcp_retries2
> 
> to set
> echo 42 > /proc/sys/net/ipv4/tcp_retries2
> 
> --
> Rex A. Dieter                   [EMAIL PROTECTED]
> Computer System Administrator   http://www.math.unl.edu/~rdieter/
> Mathematics and Statistics
> University of Nebraska Lincoln
> 
>     ---------------------------------------------------------------
> 
>                                 Name: rdieter.vcf
>                Part 1.2         Type: text/x-vcard
>                             Encoding: 7bit
>                          Description: Card for Rex Dieter

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

From: "Carbon" <[EMAIL PROTECTED]>
Subject: Re: Linux and RAID
Crossposted-To: alt.linux,alt.os.linux
Date: Thu, 30 Nov 2000 13:39:45 -0800

In article <900jp9$sk0$[EMAIL PROTECTED]>, "webbgroup" <[EMAIL PROTECTED]>
wrote:

> DO you guys agree with the software raid HOW-TO configuration?
> 
> disk partition mount pt.  size    device
>   1      1       /        300M   /dev/hda1
>   1      2       swap      64M   /dev/hda2
>   1      3       /home    800M   /dev/hda3
>   1      4       /var     900M   /dev/hda4
>   2      1       /root    300M   /dev/hdc1
>   2      2       swap      64M   /dev/hdc2
>   2      3       /home    800M   /dev/hdc3
>   2      4       /var     900M   /dev/hdc4
> 
> In this HOW-TO they talk about the mounting configuration. I am
> wondering why they don't make a mirror image of the /,/root

I'm not sure because I haven't read the HOW-TO, but I'm guessing this
setup is for a striped array.  In that case, not including / and /root
makes sense because the computer will still be bootable if the arrays
fail.  

Imho whatever performance you gain from striping just 2 drives isn't
worth the risk, because if either disk fails you're in big trouble.  On
my server I used two 8 gig hard drives to make a mirrored array on
/dev/hda and /dev/hdc. I didn't bother mirroring the swap partition, and
I left /boot out so I could still boot from the hard drive. I set this
up using the redhat 6.2 gui installer.  I was amazed at how easy it was.

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

From: [EMAIL PROTECTED] (Stefaan A Eeckels)
Subject: Re: gcc-2.95.2 forces ALL c++ programs to be GPL !!??!#
Date: Thu, 30 Nov 2000 22:52:30 +0100

In article <902jk7$17e$[EMAIL PROTECTED]>,
        [EMAIL PROTECTED] (Philip Armstrong) writes:
> In article <[EMAIL PROTECTED]>,
> Stefaan A Eeckels <[EMAIL PROTECTED]> wrote:
> 
> If you even link dynamically to a GPLd piece of code then you're
> affected by the GPL. Thats why the LGPL exists.
You are not. In case of dynamic linking, the only thing that
gets distributed is your (compiled) code, hence the GPL does
not apply. 
The idea that the "user does the link" is equivalent to static
linking is wishful thinking, and dangerous. It would make
every application a derivative of the OS it runs on, which
is so clearly nonsensical that it would never hold in -even
a technology challenged- court.

Take care,

-- 
Stefaan
-- 
Ninety-Ninety Rule of Project Schedules:
        The first ninety percent of the task takes ninety percent of
the time, and the last ten percent takes the other ninety percent.

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

From: Nix <$}xinix{[email protected]>
Subject: Re: gcc-2.95.2 forces ALL c++ programs to be GPL !!??!#
Date: 30 Nov 2000 20:39:57 +0000

[EMAIL PROTECTED] writes:

> The engineers I work with are now discovering that in fact they don't
> need to link libstdc++ statically which would solve the licensing
> problem.
> 
> Perhaps the need to link libstdc++ statically in C++ programs is an
> urban legend (at least within the group I work with).

It's curious that it is; isn't the fact that libstdc++ is linked
dynamically by default enough of a hint?

(Note, though, that many platforms still have trouble unwinding
exceptions thrown across shared library boundaries.)

> Separately I've also emailed [EMAIL PROTECTED] to see if not including
> the special exception in the 2 LGPL'd and 2 GPL'd files within libstdc++
> was just an oversight (or not).

[...]

> The discussion there says the libstdc++ code is all licensed under the
> "special exceptions" clause.  However my current research shows that
> this is not the case -- there are 2 files which are LGPL'd and 2 that
> are GPL'd.

This is unlikely to have any conclusion; the libstdc++ within GCC-2.95.2
is dead. libstdc++ has been rewritten from scratch. Looking at the new
library (in GCC snapshots and CVS) is probably a more productive use of
your time.

-- 
`The phrase `causes storage to be reserved', doesn't mean that it causes
 storage to be reserved.  This is a fundamental misunderstanding of
 Standardeze.' --- Mike Stump on the GCC list

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

From: Nix <$}xinix{[email protected]>
Subject: Re: Runtime file size modifying
Date: 30 Nov 2000 20:53:22 +0000

David Wragg <[EMAIL PROTECTED]> writes:

> But the presentation and structure of the C standard has lots of
> problems, which make it hard to use and in some cases open to multiple
> interpretations.

Agreed; the standard is too legalistic. (But this may be de-facto
required by ISO; I am not sure. I've certainly never seen an ISO
standard that was not written in a sort of overblown parody of
standardese.)

>                  It's much better than no standard at all, so in that
> sense the committee (or rather the C90 and C99 committees) did a good
> job, but I have far too many misgivings about both versions of the
> standard to agree that they got it right.

I don't think they got it right either. But `pretty much' so, given that
it was meant for compiler implementors to reference, not for everyday
programmers.

> In contrast, it is quite possible to use POSIX.1 as an everyday
> programming reference (using it instead of man pages), and the

... and as a result it has *lots* of ambiguities, doesn't specify
anywhere near enough (no symlinks? Some common denominators can
be too low!)

> > (And even they
> > tried the `add new bits' trick; remember `noalias'? *shudder*)
> 
> Remember?  C99 has restrict, which is basically son-of-noalias.

Son-of-noalias that works. You couldn't even have written the portable
parts of the C library in standard C if noalias had gone in --- but I'm
sure you've seen dmr's `noalias must go' screed...

> (Though the only unpleasant experience I have had with the fairly
> complete restrict support in glibc-2.1.9x and gcc-2.9x was due to a
> compiler bug).

restrict is definitely not fully functional in 2.95.x :( but it is
nearly there. The snapshots should be much better in this area (alias
sets are built in a much more consistent way).

-- 
`The phrase `causes storage to be reserved', doesn't mean that it causes
 storage to be reserved.  This is a fundamental misunderstanding of
 Standardeze.' --- Mike Stump on the GCC list

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

From: Nix <$}xinix{[email protected]>
Subject: Re: WHAT "void value not ignored as it ought to be" means when I try to  
complie a file?
Date: 30 Nov 2000 22:26:29 +0000

Josef Moellers <[EMAIL PROTECTED]> writes:

> Any piece of source code that triggers this warning will be appreciated.
> 
> A wild guess:
> 
> void function();
> ...
> if (function())
> 
> But that's what it is ... a wild guess.

Just about right; the error is produced if a type is converted from void
(in gcc/c-convert.c:convert()) or if a default conversion (in
gcc/c-typeck.c:default_conversion()) or assignment (in
gcc/c-typeck.c:convert_for_assignment()) requires such a conversion.

-- 
`The phrase `causes storage to be reserved', doesn't mean that it causes
 storage to be reserved.  This is a fundamental misunderstanding of
 Standardeze.' --- Mike Stump on the GCC list

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


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