Linux-Development-Sys Digest #921, Volume #6 Thu, 1 Jul 99 17:14:36 EDT
Contents:
Re: Why not C++ (Ed Bruce)
select always modifies fd sets (Nico Tranquilli)
Re: need # for unix socket (Dr. Charles E. Campbell)
usleep() (Daniel R. Grayson)
Re: Timer precision (Konrad Mieredorff)
Re: select always modifies fd sets (=?iso-8859-1?Q?Bj=F8rn?= Reese)
Re: Why not C++ (Greg Comeau)
Re: RAID-1 and 2.2.9 revisited (patman)
Re: Why not C++ (Greg Comeau)
CLONE_PID flag (Vincent Danjean)
need # for unix socket (John Jacques)
Re: Why not C++ (Greg Comeau)
Re: Postgresql Success rate (Don Baccus)
Re: select always modifies fd sets (Scott Lanning)
Re: Why not C++ (Algis Rudys)
----------------------------------------------------------------------------
From: Ed Bruce <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Why not C++
Date: Thu, 01 Jul 1999 09:38:07 -0500
Reply-To: [EMAIL PROTECTED]
Johan Kullstam wrote:
> > a) type checking at compile time (and checking should be done as early
> > as possible. of course design time would be better...)
>
> this is a dubious advantage and far from universally accepted. static
> typing is an expedient to the compiler writer. type agreement is no
> guarentee of correctness.
Hmm. I am guessing you have developed a system where lives depend on the
correct operation of your code.
Type agreement is one step in proving correctness. It helps when
reviewing code to understand what the author of the code was attempting
to do. Without it I can not easily determine by examination of the code
if a String being assigned to an integer is correct. I have to ask the
question is this what was really intended or a mistake.
With a strongly typed language I know that one can't assign a string to
an integer. It won't compile. The string must be explictly typed to an
integer. Know I now it wasn't a mistake. I now know the author of the
code is deliberately treating this string as an integer and can then
ask the question is this valid logic vs. is this not a mistake and is it
valid logic.
Strong typing doesn't guarantee correctness, it assist reviewers in
making that determination.
later,
Ed
------------------------------
From: Nico Tranquilli <[EMAIL PROTECTED]>
Crossposted-To: comp.unix.programmer,comp.os.linux.networking
Subject: select always modifies fd sets
Date: Thu, 01 Jul 1999 16:51:59 +0200
select on a non-blocking socket doesn't seem to work exactly as it
should
under Linux. The man page says:
"... On error, -1 is returned, and errno is set appropriately; the
sets and timeout become undefined, so do not rely on their
contents after an error."
Now, if the timeout value is 0 (which causes select to return
immediately)
and select is used to watch if the socket is ready for writing,
it seems that the file descriptor sets are _ALWAYS_ modified on return,
even if the call returns as the result of a timeout.
This piece of code would loop forever (unless I uncomment the // lines)
:
...
... create socket s
... set s to be non-blocking
tv.tv_sec = 0;
tv.tv_usec = 0;
FD_ZERO(&set_wr);
FD_SET(s,&set_wr);
do {
//FD_ZERO(&set_wr);
//FD_SET(s,&set_wr);
totdes=select (s+1,NULL,&set_wr,NULL,&tv);
printf("totdes wr=%d,FD_ISSET(s,&set_wr)=%d\n",totdes,FD_ISSET(s,
&set_wr));
perror("select");
} while (!totdes);
Is this a normal behaviour ?
Thanks.
nico.
--
Nico Tranquilli
------------------------------
From: [EMAIL PROTECTED] (Dr. Charles E. Campbell)
Crossposted-To: comp.unix.programmer
Subject: Re: need # for unix socket
Date: 1 Jul 1999 17:51:31 GMT
=====BEGIN PGP SIGNED MESSAGE=====
In article <[EMAIL PROTECTED]>,
John Jacques <[EMAIL PROTECTED]> wrote:
>Hello, I am running linux slackware 4.0 on a Pentium.
>
>I want to run to different database servers and they both seem to be
>using the same UNIX socket.
>When both of them are running, only the first one started will connect
>to programs.
>
>The mSQL.sock and MySQL.sock are both zero length and are owned by the
>system. How can I change a UNIX socket #? I can choose it installing
>mSQL, but, I have no idea of what the UNIX socket is or what it should
>be set to.
IF your database server has its port number as a startup parameter
(whether file-based or command line option), then you can change
it to something within 1024-65535. You should be able to find
a free port somewhere!
IF you happen to have source code to the server, then you can dig
on in, find the port number one or the other is using, and likewise
change it.
However, I suspect that you're stuck. Its because of this sort of
problem that the Simple Sockets Library uses a PortMaster; servers
have names and get assigned ports by the o/s to one that's available.
(see http://kipper.york.ac.uk/~vic/sock-faq/ssl.tar.gz or
http://www.erols.com/astronaut/ssl/ssl.tar.gz). The PortMaster itself
does have a fixed port (IANA registered), but no other server written
to use the Simple Sockets Library needs to. (to open a server:
srvr= Sopen("pick a name","s");
Regards,
Dr C
=====BEGIN PGP SIGNATURE=====
Version: 2.6.2
iQCVAwUBN3urUNgdtXCdbCHhAQHb5QQAtS1NEPU6yw8rWgY6cNIcj1oOiPn1arF9
BHqpeLnI7cScC1RnoOYJK+AGr2XrLQlncakxiHZlqIGELjpMhBqLzBRmRw6xuM7v
mW+4+rn0IBHu4eBAvyl+ogUBi+8lPUtvqEzwdBfGRWN8fdFKiSHQdT1STkdmw8WO
IZ8K6Tkz0xg=
=FOEs
=====END PGP SIGNATURE=====
--
Charles E Campbell, Jr, PhD _ __ __
Goddard Space Flight Center / /_/\_\_/ /
[EMAIL PROTECTED] /_/ \/_//_/
finger [EMAIL PROTECTED] for PGP public key
------------------------------
From: [EMAIL PROTECTED] (Daniel R. Grayson)
Subject: usleep()
Date: 01 Jul 1999 10:44:53 -0500
Calls to usleep() take a lot longer than they need to (20000 microseconds
instead of 1 microsecond on my system). Has anyone thought of improving the
accuracy of usleep() in Linux? It's possible, because select() can do it.
% gcc foo.c
% time a.out
real 0m5.006s
user 0m0.000s
sys 0m0.000s
% cat foo.c
#include <unistd.h>
int main() {
int i;
for (i=0; i<250; i++) usleep(1);
return 0;
}
% w
10:41am up 1:43, 0 users, load average: 0.09, 0.07, 0.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
>From man usleep:
SYNOPSIS
#include <unistd.h>
void usleep(unsigned long usec);
DESCRIPTION
The usleep() function suspends execution of the calling
process for usec microseconds. The sleep may be lengthened
slightly by any system activity or by the time spent
processing the call.
------------------------------
From: Konrad Mieredorff <[EMAIL PROTECTED]>
Subject: Re: Timer precision
Date: Thu, 01 Jul 1999 17:47:11 +0200
Serge Wagener wrote:
>
> Hi !
>
> What is the timer precision in Linux ?
1/100 seconds
------------------------------
From: =?iso-8859-1?Q?Bj=F8rn?= Reese <[EMAIL PROTECTED]>
Crossposted-To: comp.unix.programmer,comp.os.linux.networking
Subject: Re: select always modifies fd sets
Date: Thu, 01 Jul 1999 16:06:36 +0000
Nico Tranquilli wrote:
> Is this a normal behaviour ?
Yes.
------------------------------
From: [EMAIL PROTECTED] (Greg Comeau)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Why not C++
Date: 1 Jul 1999 12:04:50 -0400
Reply-To: [EMAIL PROTECTED]
In article <[EMAIL PROTECTED]>
[EMAIL PROTECTED] writes:
>In my opinion C++ is not the most powerful, but the first hyped OOPL.
Wow, if there ever was a statement that was wrong, this is it.
This completely ignores the history of OOPL's and C++.
This does not consider the OOPL's at the time there _were_ hyped.
C++ had _every_ opportunity to fail, exactly because it was NOT hyped.
It was strictly though it's own merits that it is where is it today.
- Greg
--
Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418-3214
Producers of Comeau C/C++ 4.2.38 -- New Release! We now do Windows too.
Email: [EMAIL PROTECTED] / Voice:718-945-0009 / Fax:718-441-2310
*** WEB: http://www.comeaucomputing.com ***
------------------------------
From: patman <[EMAIL PROTECTED]>
Subject: Re: RAID-1 and 2.2.9 revisited
Date: Thu, 01 Jul 1999 18:27:38 GMT
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Az0th) wrote:
> The short version: the current RAID development including the
raidtools
> works fine up to 2.2.6, and the RAID patches can be applied to 2.2.7
> with one manual addition. 2.2.8/9 are broken WRT RAID in a way which
> causes resync to fail, and should not be used until this is resolved.
I think I have a fix for the resync problem:
Following the lead from ([EMAIL PROTECTED]) in the linux-raid
mailing list, I edited /usr/src/linux/drivers/block/md.c, and changed
the TWO occurrances of "current->priority = 0" to "current->priority =
1", and resync started working just fine. As a nice side effect, I can
reboot the system cleanly now (was hanging up waiting for the resync
process to die off)
System:
RedHat 5.2 installation, upgraded to 2.2.9 kernel, knfsd 1.4.1
(with nfsd-2.2.7-3.patch and linux-2.2.7-sunrpc.patch), raidtools-0.90,
raid0145-19990421-2_2_6 patch.
RAID-5 on 4 8.7G SCSI drives.
The resync process took about 90 minutes to get to 100%, and seems to be
happy now. "ps lax | grep raid" shows the nice level at 19 now (instead
of 20).
Pat
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
From: [EMAIL PROTECTED] (Greg Comeau)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Why not C++
Date: 1 Jul 1999 12:14:23 -0400
Reply-To: [EMAIL PROTECTED]
In article <[EMAIL PROTECTED]>
[EMAIL PROTECTED] writes:
>Johan Kullstam wrote:
>> > a) type checking at compile time (and checking should be done as early
>> > as possible. of course design time would be better...)
>>
>> this is a dubious advantage and far from universally accepted. static
>> typing is an expedient to the compiler writer. type agreement is no
>> guarentee of correctness.
>
>Hmm. I am guessing you have developed a system where lives depend on the
>correct operation of your code.
>
>Type agreement is one step in proving correctness. It helps when
>reviewing code to understand what the author of the code was attempting
>to do. Without it I can not easily determine by examination of the code
>if a String being assigned to an integer is correct. I have to ask the
>question is this what was really intended or a mistake.
>
>With a strongly typed language I know that one can't assign a string to
>an integer. It won't compile. The string must be explictly typed to an
>integer. Know I now it wasn't a mistake. I now know the author of the
>code is deliberately treating this string as an integer and can then
>ask the question is this valid logic vs. is this not a mistake and is it
>valid logic.
>
>Strong typing doesn't guarantee correctness, it assist reviewers in
>making that determination.
I like the capability above no matter what we call it. However, --
I may be misunderstanding your point -- but I'm not convinced that you
don't know it wasn't a mistake. All you know is that it wasn't
that mistake. And that's a step in the right direction.
I don't think seeing string explicitly typed to an integer means
you know the author deliberately did something sensible.
You would be amazed to know that the reason most C and C++ programmers
add a cast to their code is because the compiler issued a diagnostic
about it previously. No other thought process takes place for
most of these programmers.
- Greg
--
Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418-3214
Producers of Comeau C/C++ 4.2.38 -- New Release! We now do Windows too.
Email: [EMAIL PROTECTED] / Voice:718-945-0009 / Fax:718-441-2310
*** WEB: http://www.comeaucomputing.com ***
------------------------------
From: Vincent Danjean <[EMAIL PROTECTED]>
Subject: CLONE_PID flag
Date: Thu, 1 Jul 1999 18:01:55 +0200
Hi,
I am looking for information about the CLONE_PID flag (in the
clone() system call). More precisely, I would know what appends when a
signal is send to a pid shared between several threads. Does it depend on
the signal sent ?
So, is there information about this elsewhere than in the kernel
sources ?
Vincent Danjean
------------------------------
From: John Jacques <[EMAIL PROTECTED]>
Crossposted-To: comp.unix.programmer
Subject: need # for unix socket
Date: Thu, 01 Jul 1999 12:44:47 -0400
Hello, I am running linux slackware 4.0 on a Pentium.
I want to run to different database servers and they both seem to be
using the same UNIX socket.
When both of them are running, only the first one started will connect
to programs.
The mSQL.sock and MySQL.sock are both zero length and are owned by the
system. How can I change a UNIX socket #? I can choose it installing
mSQL, but, I have no idea of what the UNIX socket is or what it should
be set to.
thanks
John Jacques
[EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED] (Greg Comeau)
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.networking
Subject: Re: Why not C++
Date: 1 Jul 1999 12:58:52 -0400
Reply-To: [EMAIL PROTECTED]
In article <[EMAIL PROTECTED]> Algis Rudys <[EMAIL PROTECTED]>
writes:
>Nathan Myers wrote:
>>
>> Johan Kullstam <[EMAIL PROTECTED]> wrote:
>> >[EMAIL PROTECTED] (Nathan Myers) writes:
>> >> [Templates] solve a problem that exists because C++ offers static
>> >> typing, a feature of profound importance for rigorous engineering.
>> >
>> >some would say static typing is a burden.
>>
>> Many people are either unwilling or unable to assume the burden of
>> rigorous engineering. In fact, they are overwhelmingly in the
>> majority.
>>
>> For easy problems, any language will do. For problems where the
>> answer doesn't matter much, almost any language will do.
>>
>> Still, rigorous engineering is needed in many places, and languages
>> that support it are needed in those places. C++ is currently the
>> most powerful of such languages.
>
>I'm wondering what you mean by "rigorous engineering". I ask because,
>although this term sounds important, still I've never seen anything done
>in C++ that could not be done in any other programming language I'm
>familiar with. There is something called Turing completeness, and any
>language that possesses this property is no more or less powerful than
>any other. C++ is Turing complete. So are C, Pascal, Perl, Postscript
>(IIRC), Python, Scheme, LISP, ML, Java, .....
That's not true: you cannot do // comments in C :)
>It strikes me that typing is a matter of preference. Some people prefer
>the typing provided by C and C++. Others prefer languages such as Perl,
>Python, or Scheme, which are untyped.
I agree. In fact, a bunch can be said about typing and non-typing.
However, it's not a preference or style issue like whether to add
a space somewhere or not (not saying you said it did, just expounding
further). And it has definite implications higher up.
>Another issue that (I don't believe) has been addressed in this thread
>is safety (ie memory protection, type safety for typed languages, among
>other things). Nothing prevents me from casting a char * as struct foo *
>in C++ or vice versa.
Correct, with a cast it's allowed.
>While the compiler may issue a warning, it is
>legal syntactically and semantically in C++. And this could mean bad
>things, depending on the case.
Yes.
>This would not be allowed in a safe languages.
Fine. But too: Pure safety rarely exists.
- Greg
--
Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418-3214
Producers of Comeau C/C++ 4.2.38 -- New Release! We now do Windows too.
Email: [EMAIL PROTECTED] / Voice:718-945-0009 / Fax:718-441-2310
*** WEB: http://www.comeaucomputing.com ***
------------------------------
Crossposted-To: ahn.tech.linux,alt.os.linux,comp.os.linux.development.apps
Subject: Re: Postgresql Success rate
From: [EMAIL PROTECTED] (Don Baccus)
Date: 1 Jul 1999 13:34:44 PST
In article <7ldkt9$26kc$[EMAIL PROTECTED]>,
Alexander F. Hartner <[EMAIL PROTECTED]> wrote:
>Has anybody experienced serious problems using Postgresql 6.4 with Java
>(JDBC) on a medium size network. Is Datacorruption a problem. From what I
>have experienced in the short time that I have been using Postgresql it is
>the best thing since sliced bread, but people seem unsure to use it.
6.4 has a bunch of problems. 6.5, just released, is a great
improvement. I highly recommend you get the new version.
If you like 6.4, you'll really, really like 6.5.
--
- Don Baccus, Portland OR <[EMAIL PROTECTED]>
Nature photos, on-line guides, at http://donb.photo.net
------------------------------
From: [EMAIL PROTECTED] (Scott Lanning)
Crossposted-To: comp.unix.programmer,comp.os.linux.networking
Subject: Re: select always modifies fd sets
Date: 1 Jul 1999 17:01:41 GMT
=?iso-8859-1?Q?Bj=F8rn?= Reese ([EMAIL PROTECTED]) wrote:
: Nico Tranquilli wrote:
: > Is this a normal behaviour ?
:
: Yes.
I remember in some Stevens book (must be one of APUE or UNP1)
it mentions this as a common pitfall. It said the file descriptor
sets are.... "value-return", "value-result", "reset-value" ....??
something like that, and it implied that they're reset each time.
I remember he also said he spent a couple hours debugging a problem
caused by not adding one to the number of file descriptors.
(I like anecdotes like that in a book; it helps me to remember.
I'm reading Abrash's big black graphics programming bible right
now, and I love it for all the anecdotes.)
But <sigh> I don't feel like looking it up right now.
--
Scott Lanning: [EMAIL PROTECTED], http://physics.bu.edu/~slanning
"Besides a mathematical inclination, an exceptionally good mastery of
one's native tongue is the most vital asset of a competent programmer."
--Edsger Dijkstra
------------------------------
From: Algis Rudys <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.networking
Subject: Re: Why not C++
Date: Thu, 01 Jul 1999 12:20:26 -0400
Nathan Myers wrote:
>
> Johan Kullstam <[EMAIL PROTECTED]> wrote:
> >[EMAIL PROTECTED] (Nathan Myers) writes:
> >> [Templates] solve a problem that exists because C++ offers static
> >> typing, a feature of profound importance for rigorous engineering.
> >
> >some would say static typing is a burden.
>
> Many people are either unwilling or unable to assume the burden of
> rigorous engineering. In fact, they are overwhelmingly in the
> majority.
>
> For easy problems, any language will do. For problems where the
> answer doesn't matter much, almost any language will do.
>
> Still, rigorous engineering is needed in many places, and languages
> that support it are needed in those places. C++ is currently the
> most powerful of such languages.
Hello.
I'm wondering what you mean by "rigorous engineering". I ask because,
although this term sounds important, still I've never seen anything done
in C++ that could not be done in any other programming language I'm
familiar with. There is something called Turing completeness, and any
language that possesses this property is no more or less powerful than
any other. C++ is Turing complete. So are C, Pascal, Perl, Postscript
(IIRC), Python, Scheme, LISP, ML, Java, .....
It strikes me that typing is a matter of preference. Some people prefer
the typing provided by C and C++. Others prefer languages such as Perl,
Python, or Scheme, which are untyped.
Another issue that (I don't believe) has been addressed in this thread
is safety (ie memory protection, type safety for typed languages, among
other things). Nothing prevents me from casting a char * as struct foo *
in C++ or vice versa. While the compiler may issue a warning, it is
legal syntactically and semantically in C++. And this could mean bad
things, depending on the case.
This would not be allowed in a safe languages.
bye then,
Algis R
--
Algis Rudys
remove "NOSPAM" from my e-mail address to use it.
------------------------------
** 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
******************************