Linux-Development-Apps Digest #292, Volume #7    Wed, 21 Mar 01 22:13:13 EST

Contents:
  Re: GPL (Nate Eldredge)
  Re: sizeof returns wrong structure size ("Joseph A. Knapka")
  question about xtime (Tong Li)
  Re: sizeof returns wrong structure size (anthony stuckey)
  Re: library dependancies (Roland Smith)
  Re: sizeof returns wrong structure size (Grant Edwards)
  Re: Running MSC6/MSC7 under linux? (Micah Cowan)
  Re: Could I program the system shutdown? (Juergen Heinzl)
  Re: kernel 2.4.2 (ted)
  Re: internet connection? (Paul Kimoto)
  seg fault when creating new objects under linux ("grant")
  Re: Processor ID (Doug Hutcheson)
  Re: seg fault when creating new objects under linux ("D. Stimits")
  signals via screen saver? ("D. Stimits")
  Re: Could I program the system shutdown? (Nate Eldredge)
  Re: seg fault when creating new objects under linux ("grant")

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

From: Nate Eldredge <[EMAIL PROTECTED]>
Subject: Re: GPL
Date: 21 Mar 2001 10:47:33 -0800

Josef Allen <[EMAIL PROTECTED]> writes:

> What does the acronym GPL standard for?

General Public License.

http://www.gnu.org/copyleft/gpl.txt

-- 

Nate Eldredge
[EMAIL PROTECTED]

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

From: "Joseph A. Knapka" <[EMAIL PROTECTED]>
Subject: Re: sizeof returns wrong structure size
Date: Wed, 21 Mar 2001 18:52:18 GMT

Rolf Magnus wrote:
> 
> Joseph A. Knapka wrote:
> 
> > ... which is essentialy what the compiler would have to transform
> > your layout specification into anyway. I'd rather have the bugs
> > in my own code where I can fix them, than in the compiler where
> > I have to wait for the next release :-)
> 
> Then write in assembler.

Sometimes I do.

But then I have to wait for the next release for assembler bugs
to be fixed :--(   I *could* write binary code directly... oh wait,
then I'd have to wait for the hardware manufacturer to fix the
bugs in the silicon.

Oh well, those chips are too damned small anyway; I don't trust 'em.
I mean, how could anything that little *possibly* do anything useful?
It's a conspiracy by Intel et al - they get the computational work done
by Satan's minions, and sell us inert chunks of rock and tell
us they're CPUs. None of that for me!

A soldering iron is the programmer's best friend.

-- Joe Knapka
"It was just a maddened crocodile hidden in a flower bed. It could
 have happened to anyone." -- Pratchett
// Linux MM Documentation in progress:
// http://home.earthlink.net/~jknapka/linux-mm/vmoutline.html
* Evolution is an "unproven theory" in the same sense that gravity is. *

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

From: [EMAIL PROTECTED] (Tong Li)
Subject: question about xtime
Date: 21 Mar 2001 18:54:42 GMT

Hello there, Any one here can tell me in which directory and which
file I can find system time variable. 
Thanks in advance!

TL

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

Subject: Re: sizeof returns wrong structure size
From: [EMAIL PROTECTED] (anthony stuckey)
Date: Wed, 21 Mar 2001 21:01:33 GMT

[EMAIL PROTECTED] (Grant Edwards) writes:
>I see.  Then bitfields are right out?  No CPU I've ever seen
>could do bitfields.  How can we have them in C?

        Depending on what exactly you mean, I beleive that the Motorola 68K
line does.  It doesn't have arbitrary "this field is 47 bits wide, do
standard add/subtract/multiply/divide, etc" instructions, but it does have
packing, unpacking, etc instructions that deal with arbitrary fields.

>From the 68000 Microprocessor Reference Manual, available in PDF form on
Motorola's web site:

: 3.1.6 Bit Field Instructions
: The M68000 family architecture supports variable-length bit field
: operations on fields of up to 32 bits. The BFINS instruction inserts a
: value into a bit field. BFEXTU and BFEXTS extract a value from the field.
: BFFFO finds the first set bit in a bit field. Also included are
: instructions analogous to the bit manipulation operations: BFTST, BFSET,
: BFCLR, and BFCHG. Table 3-7 summarizes bit field operations.

>I'm not asking _hardware_ support for arbitrary alignemnt.  I'm
>asking for _compiler_ support for arbitrary alignment.  It's no
>different than bitfields.  Hardware doesn't support bitfields
>so the compiler generates code to access bitfields using the
>access methods the hardware _does_ support.

        Right.  If this requires massive shifting and masking, so be it.

>When C was standardized, there were no (or darned few) CPUs
>that implimented bitfields either.

        If you're talking about the original work in the 70's, that's probably
true.
--
Anthony Stuckey                                 [EMAIL PROTECTED]
System Administrator, students.uiuc.edu

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

Subject: Re: library dependancies
From: Roland Smith <[EMAIL PROTECTED]>
Date: 21 Mar 2001 22:26:57 +0100

"TheMartian" <[EMAIL PROTECTED]> writes:

> Hi
> 
> Does anyone know of a quick way to get a full dependancy list from app
> source?

Look at the Makefile(s), not the source itself. Search for the rule that
links the program, and see which libraries it links with.
 
> My problem is I have a system without gnome that some apps will not build
> on, even though the published requirements are all there.

Maybe the libraries are just not found. In that case, either add the -L
option to gcc's linking stage, or set the environment variable LIBRARY_PATH,
e.g:

LIBRARY_PATH=/usr/local/lib:/usr/X11R6/lib:/usr/local/gnu/lib

While you're at it also set the include file path (or use the gcc -I option):

C_INCLUDE_PATH=/usr/local/include:/usr/X11R6/include

It could also be that the libraries and object files are present in the
wrong order on the link command line. This can also produce linker
errors. With the 'ldd' program you can see which other libraries a library
depends on.

Roland
-- 
Roland Smith                          "Traveler, there is no path.
r s m i t h @ x s 4 a l l . n l        You make the path as you walk."
http://www.xs4all.nl/~rsmith/

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

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: sizeof returns wrong structure size
Date: Wed, 21 Mar 2001 21:29:37 GMT

In article <NE8u6.11680$[EMAIL PROTECTED]>, anthony stuckey wrote:

>>I see.  Then bitfields are right out?  No CPU I've ever seen
>>could do bitfields.  How can we have them in C?
>
>Depending on what exactly you mean, I beleive that the Motorola
>68K line does.  It doesn't have arbitrary "this field is 47
>bits wide, do standard add/subtract/multiply/divide, etc"
>instructions, but it does have packing, unpacking, etc
>instructions that deal with arbitrary fields.

That's pretty much what I meant.  I should have known that:
I'm pretty sure we discussed that in a microprocessor
architecture class many years ago.

>>I'm not asking _hardware_ support for arbitrary alignemnt.  I'm
>>asking for _compiler_ support for arbitrary alignment.  It's no
>>different than bitfields.  Hardware doesn't support bitfields
>>so the compiler generates code to access bitfields using the
>>access methods the hardware _does_ support.
>
> Right. If this requires massive shifting and masking, so be it.

And accessing other misaligned data is no worse. Though
compilers are (I think) allowed to store each bit-field on a
word boundary if they want (thus eliminating both the
shifting/masking and the space savings).

>>When C was standardized, there were no (or darned few) CPUs
>>that implimented bitfields either.
>
>If you're talking about the original work in the 70's, that's
>probably true.

-- 
Grant Edwards                   grante             Yow!  You can't hurt
                                  at               me!! I have an ASSUMABLE
                               visi.com            MORTGAGE!!

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

Crossposted-To: comp.os.linux.development.system
Subject: Re: Running MSC6/MSC7 under linux?
From: Micah Cowan <[EMAIL PROTECTED]>
Date: 21 Mar 2001 13:59:19 -0800

[EMAIL PROTECTED] (Bernd Melchers) writes:

> my experiences in ancient times (kernel 1.2.13) are, that msc 6 is
> good with dosemu but msc 7 works not reliable.

If it was that long ago, dosemu very likely wasn't at version 1.0.0
yet, either.  Still, I can't say if it works or not, since I use
neither dosemu nor msc.

> 
> Ciao
> Bernd

Micah

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

From: [EMAIL PROTECTED] (Juergen Heinzl)
Subject: Re: Could I program the system shutdown?
Date: Wed, 21 Mar 2001 22:11:53 GMT

In article <[EMAIL PROTECTED]>, Afonso Sam wrote:
>Could I shutdown the system by my program? Is there any Linux-api for
>system shutdown available? or any simple way to call KDE's system
>shutdown?
[-]
shutdown(2), but beware -- shutdown(8) does a bit more for you
then just shooting down the kernel, so an explicit fork() / exec(),
I'd avoid system() for security reasons here, is probably the
right thing to do.

You may want to re-direct stdin and stdout to some file, too. Just
in case something goes wrong, although if it's an X application
it'd be okay of course since nothing could mess up your screen.

Cheers,
Juergen

-- 
\ Real name     : Juergen Heinzl                \       no flames      /
 \ EMail Private : [EMAIL PROTECTED] \ send money instead /

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

From: ted <[EMAIL PROTECTED]>
Subject: Re: kernel 2.4.2
Date: Wed, 21 Mar 2001 16:17:22 -0700

-rw-r--r--    1 ted      ted      25295341 Mar 17 19:44 linux-2.4.2.tar.gz

its pretty close to 25mb

Binary011010 wrote:

> this isn't specifiically a development question. I just want to know how large
> kernel-version 2.4.2 should be when downloaded as a tar.gz file. I never seem
> to get the whole thing, and I think it's because I'm using AOHell for
> internet(It's the only way I can  get internet access for free!). Thanks


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

From: [EMAIL PROTECTED] (Paul Kimoto)
Subject: Re: internet connection?
Date: 21 Mar 2001 19:10:34 -0500
Reply-To: [EMAIL PROTECTED]

In article <HLUt6.80573$[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> "Emilien Arino" <[EMAIL PROTECTED]> writes:
>> So I would like to know if there is a "clean" way to detect if a computer
>> running linux is connected to internet.

> Are you looking for a very general answer?  Or one that will suffice
> for your immediate purpose?
> 
> For instance, if this program _only_ need run on your computer, you
> might determine what connection has to be "live" in order for you to
> be online, e.g. the ppp0 network interface.
> 
> If that suffices, then you might open the file /proc/net/dev for
> input, and read through it, looking to see if a ppp device (e.g.  ppp0
> or ppp1) is available.  If so, then likely the network connection is
> alive.  Alternatively, look for "ppp" in /proc/net/route.

What about looking for "default" in the output of /sbin/route (or some
appropriate equivalent in /proc/net/*)?  That would seem to embody one
functional definition of "connected to the internet".

-- 
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: "grant" <[EMAIL PROTECTED]>
Subject: seg fault when creating new objects under linux
Date: 22 Mar 2001 01:34:43 GMT

i've seen a lot of posts where people are complaining of seg faults
when calling malloc directly under linux.

however, i'm experiencing something a bit different..in my multithreaded
program,
i'm getting a seg fault in malloc after calling new to create an object.
i'm running linux red-hat 6.2 and have compiled everything correctly..

source code looks like this:

m_data.m_pString = new char[strlen(val) + 1];

i've confirmed that strlen(val) is 4. there's no reason (not that i know of)
that the OS shouldn't be able to allocate the character array for me. i've
topped
my machine, memory and CPU usage look fine.


i get crash stack like this (this is with electric fence linked in):
#0  0x8072255 in memalign () at main.cpp:164
#1  0x8072637 in malloc () at main.cpp:164
#2  0x400781e6 in __builtin_new (sz=5) from
/usr/lib/libstdc++-libc6.1-1.so.2
#3  0x400783bc in __builtin_vec_new (sz=5)
   from /usr/lib/libstdc++-libc6.1-1.so.2
#4  0x804c478 in TupleElement::TupleElement (this=0x4034dfe0,
    val=0x40251f7f "temp") at ../Network/Message.cpp:47
#5  0x804d17c in TupleMessage::addArgument (this=0x40233fe8,
    arg=0x40251f7f "temp") at ../Network/Message.h:249
#6  0x80771af in LogMessageEvent::LogMessageEvent (this=0x40233fe8,
    module=0x40251f7f "temp", messageType=1, sessionID=0, verbosity=10,
    errorCode=0, message=0xbfffe280) at ../Network/GeneratedMessages.h:1141

also, the seg fault doens't just happen there...
it happens ALL OVER THE PLACE - whenever i call new for char, int, etc even
when the size of the object is very small (4 bytes, 48 bytes etc).. i seg
fault all
over. also, seg faults happen on subsequent calls to "delete"

ugh. any idea??? thanks.




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

From: Doug Hutcheson <[EMAIL PROTECTED]>
Subject: Re: Processor ID
Date: Thu, 22 Mar 2001 11:34:36 +1000

As far as I can determine, they are rapidly increasing the number of
people dumping Windows in favour of Linux / Unix / Mac / ... heavens,
even CP/M - anything but stay with the megalomania.
I am one such. Made a nice living from building / supporting Windoze
apps for nearly 10 years, but I cannot see the commercial advantage of
.NYET to my cutomers, so I'm changing course.

...to linux, of course ...

"8-)

Rolf Magnus wrote:
> 
<snip>
> And what is Microsoft currently doing with Windows XP?

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

Date: Wed, 21 Mar 2001 19:27:06 -0700
From: "D. Stimits" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Re: seg fault when creating new objects under linux

grant wrote:
> 
> i've seen a lot of posts where people are complaining of seg faults
> when calling malloc directly under linux.
> 
> however, i'm experiencing something a bit different..in my multithreaded
> program,
> i'm getting a seg fault in malloc after calling new to create an object.
> i'm running linux red-hat 6.2 and have compiled everything correctly..
> 
> source code looks like this:
> 
> m_data.m_pString = new char[strlen(val) + 1];

Since strlen() requires a null terminated string, is there any
possibility that "val" is improperly terminated? Try echoing the return
of strlen(val) just prior to the new assignment. FYI, what is the
declaration of member pointer m_pString? The declaration might make a
difference.

> 
> i've confirmed that strlen(val) is 4. there's no reason (not that i know of)
> that the OS shouldn't be able to allocate the character array for me. i've
> topped
> my machine, memory and CPU usage look fine.
> 
> i get crash stack like this (this is with electric fence linked in):
> #0  0x8072255 in memalign () at main.cpp:164
> #1  0x8072637 in malloc () at main.cpp:164
> #2  0x400781e6 in __builtin_new (sz=5) from
> /usr/lib/libstdc++-libc6.1-1.so.2
> #3  0x400783bc in __builtin_vec_new (sz=5)
>    from /usr/lib/libstdc++-libc6.1-1.so.2
> #4  0x804c478 in TupleElement::TupleElement (this=0x4034dfe0,
>     val=0x40251f7f "temp") at ../Network/Message.cpp:47
> #5  0x804d17c in TupleMessage::addArgument (this=0x40233fe8,
>     arg=0x40251f7f "temp") at ../Network/Message.h:249
> #6  0x80771af in LogMessageEvent::LogMessageEvent (this=0x40233fe8,
>     module=0x40251f7f "temp", messageType=1, sessionID=0, verbosity=10,
>     errorCode=0, message=0xbfffe280) at ../Network/GeneratedMessages.h:1141
> 
> also, the seg fault doens't just happen there...
> it happens ALL OVER THE PLACE - whenever i call new for char, int, etc even
> when the size of the object is very small (4 bytes, 48 bytes etc).. i seg
> fault all
> over. also, seg faults happen on subsequent calls to "delete"
> 
> ugh. any idea??? thanks.

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

Date: Wed, 21 Mar 2001 19:28:18 -0700
From: "D. Stimits" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: signals via screen saver?

Does anyone know here what signals are generated when a screen saver
starts or finishes? Is it just an expose event, or something more
general? I'm using X11 4.x with gnome.

D. Stimits, [EMAIL PROTECTED]

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

From: Nate Eldredge <[EMAIL PROTECTED]>
Subject: Re: Could I program the system shutdown?
Date: 21 Mar 2001 18:30:14 -0800

[EMAIL PROTECTED] (Juergen Heinzl) writes:

> In article <[EMAIL PROTECTED]>, Afonso Sam wrote:
> >Could I shutdown the system by my program? Is there any Linux-api for
> >system shutdown available? or any simple way to call KDE's system
> >shutdown?
> [-]
> shutdown(2), but beware -- shutdown(8) does a bit more for you

That would be reboot(2).  shutdown(2) closes sockets.

> then just shooting down the kernel, so an explicit fork() / exec(),
> I'd avoid system() for security reasons here, is probably the
> right thing to do.

Indeed.  Actually, what it does is instruct init to take down the
system (init is the only process that can do it properly).  init then
kills all other processes, umounts file systems, and so on, and *then*
calls reboot(2).

-- 

Nate Eldredge
[EMAIL PROTECTED]

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

From: "grant" <[EMAIL PROTECTED]>
Subject: Re: seg fault when creating new objects under linux
Date: 22 Mar 2001 02:41:28 GMT

hmm.. val is defintely NULL terminated.
also, the declaration of member pointer m_pString is:

char *m_pstring;

which is certainly correct...

keep in mind, these seg faults when calling the new operator
are happening all over the place - not just at that one line of
code, which makes me think as to whether or not tehre's a bigger (more
insidious) form of general memory corruption going on.... does this look
linux specific somehow? perhaps there's a malloc patch that we're missing???

thanks.


D. Stimits <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> grant wrote:
> >
> > i've seen a lot of posts where people are complaining of seg faults
> > when calling malloc directly under linux.
> >
> > however, i'm experiencing something a bit different..in my multithreaded
> > program,
> > i'm getting a seg fault in malloc after calling new to create an object.
> > i'm running linux red-hat 6.2 and have compiled everything correctly..
> >
> > source code looks like this:
> >
> > m_data.m_pString = new char[strlen(val) + 1];
>
> Since strlen() requires a null terminated string, is there any
> possibility that "val" is improperly terminated? Try echoing the return
> of strlen(val) just prior to the new assignment. FYI, what is the
> declaration of member pointer m_pString? The declaration might make a
> difference.
>
> >
> > i've confirmed that strlen(val) is 4. there's no reason (not that i know
of)
> > that the OS shouldn't be able to allocate the character array for me.
i've
> > topped
> > my machine, memory and CPU usage look fine.
> >
> > i get crash stack like this (this is with electric fence linked in):
> > #0  0x8072255 in memalign () at main.cpp:164
> > #1  0x8072637 in malloc () at main.cpp:164
> > #2  0x400781e6 in __builtin_new (sz=5) from
> > /usr/lib/libstdc++-libc6.1-1.so.2
> > #3  0x400783bc in __builtin_vec_new (sz=5)
> >    from /usr/lib/libstdc++-libc6.1-1.so.2
> > #4  0x804c478 in TupleElement::TupleElement (this=0x4034dfe0,
> >     val=0x40251f7f "temp") at ../Network/Message.cpp:47
> > #5  0x804d17c in TupleMessage::addArgument (this=0x40233fe8,
> >     arg=0x40251f7f "temp") at ../Network/Message.h:249
> > #6  0x80771af in LogMessageEvent::LogMessageEvent (this=0x40233fe8,
> >     module=0x40251f7f "temp", messageType=1, sessionID=0, verbosity=10,
> >     errorCode=0, message=0xbfffe280) at
../Network/GeneratedMessages.h:1141
> >
> > also, the seg fault doens't just happen there...
> > it happens ALL OVER THE PLACE - whenever i call new for char, int, etc
even
> > when the size of the object is very small (4 bytes, 48 bytes etc).. i
seg
> > fault all
> > over. also, seg faults happen on subsequent calls to "delete"
> >
> > ugh. any idea??? thanks.



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


** 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.apps 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-Apps Digest
******************************

Reply via email to