Linux-Development-Sys Digest #750, Volume #8 Fri, 25 May 01 22:13:09 EDT
Contents:
Re: passing messages to a forked thread (bill davidsen)
Re: Mr kdb, I suppose ("Doug Reiland")
Re: Preprocessor symbols automatically defined by gcc ([EMAIL PROTECTED])
C++ linux server to java client: connection problem ("Somkith Chai")
Re: thundering-herd vs wake-one ([EMAIL PROTECTED])
Re: recompilation of glib-1.2.8, gtk+1.2.8 for Redhat 6.2 ("Frank")
Re: passing messages to a forked thread ("Darren LS")
Re: Version error when installing module ([EMAIL PROTECTED])
fast disk writes (Federico David Sacerdoti)
Re: fast disk writes ("Karl Heyes")
Re: fast disk writes (Alexander Viro)
Re: ext2 limitations ("Jason Kusar")
----------------------------------------------------------------------------
From: [EMAIL PROTECTED] (bill davidsen)
Subject: Re: passing messages to a forked thread
Date: Fri, 25 May 2001 16:13:22 +0000 (UTC)
In article <DeiM6.16656$[EMAIL PROTECTED]>,
Darren LS <[EMAIL PROTECTED]> wrote:
| Hello all. I have a nice little socket programmed than runs transparently
| due to the fork command thanks to the advice of many wonderful people on
| these newsgroups. However now I need to do some manipulation to the
| currently running process. I appreciate any advice on the following
|
| 1. this thread must be able to detect if it is the only instance running and
| if not then it needs to be able to get the process handle of other instances
| so it can communicate with them
|
| 2. Active instances must be able to take signals of other threads, processes
| or even programs
|
| 3. must be able to send signals to other processes both local and remote
Having already specified "signals" you limit your implementation and
make it complex. This sounds like a perfect use for SysV message queue,
which would provide the IPC you need.
| 4. must be able to ignore SIGTERM and should SIGKILL be thrown at it then it
| needs to survive long enough to fill in a log entry before it goes down. I
| appreciate any ideas.
You can't do that, SIGKILL is not advisory. And if you persist in an
implementation which ignores SIGTERM you will most definitely get a
SIGKILL sometime. If you need a process which runs the whole machine and
can't be externally killed, it's called a kernel. Other than that you
will save a lot of pain using signals in the normal way.
Your only way to get that log entry is to have the parent write it
after your process is killed.
--
bill davidsen <[EMAIL PROTECTED]> CTO, TMR Associates, Inc
At LinuxExpo Sun was showing Linux applications running on Solaris.
They don't get it, the arrow points the other way. There's a reason why
there's no SolarisExpo, Solaris is a tool; Linux is a philosophy, a
religion, a way of life, and only incidentally an operating system.
------------------------------
From: "Doug Reiland" <[EMAIL PROTECTED]>
Subject: Re: Mr kdb, I suppose
Date: Fri, 25 May 2001 12:15:42 -0400
Hit the break key to get into kdb.
I don't think kdb is taking any action when you do a insmod. Also, I hope
you got put into kdb when you get your OOPS. From there you can debug.
What was happening before you configured in kdb?
"Massimiliano Caovilla" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> OK, so I finally got kdb running on a kernel 2.2.18 on top of my redhat
> 7.0 (bleah! for the 7.0, not for kdb :-P)
> I have some problems:
> each driver I insmod, 4 exemple my via-rhine ethernet or initio for my
> scsi host adapter triggers an Oops.
> Can this be kdb's fault?
> Another question is: How I get into kdb WITHOUT triggering an Oops??? I
> could't find a manual!
> The final question is: was't I supposed to get a /proc/sys/kernel/kdb
> file/directory/whatever to interface with the debugger?
> I've heard that kdb is not well mantained for 2.2 kernel, maybe these
> are problems related to this?
>
> Thanks for any suggestion, bye to all
>
> Massi
------------------------------
Subject: Re: Preprocessor symbols automatically defined by gcc
From: [EMAIL PROTECTED]
Date: 25 May 2001 13:31:33 -0500
>>>>> "nix" == xinix <Nix> writes:
nix> Don't. It is almost always a mistake; you should use feature
nix> tests instead. (This is, after all, what autoconf is for.)
nix> If you *must* do it --- if you've got platform-specific
nix> assembler to build or something --- then it is best to split
nix> the system-specificities out into separate files and build them
nix> separately, using AC_CONFIG_LINKS() or something similar; see
nix> the node in the autoconf manual `Using the System Type'.
nix> If you *must*, you can use the system-specific #defines; a
nix> particularly horrible example of this, to use as a reason to
nix> *avoid* this technique, rather than as a source to emulate, is
nix> gcc-2.95.3/gcc/libgcc2.c...
Thanks for the informative reply.
What I am trying to do is to come up with a header file that contains
typedefs for various fundamental scalar types ie 32 bit signed/unsigned
ints, 64 bit signed/unsigned ints, etc.
The system that we are developing may possibly require certain portions
of code to be backported to Windows and may possibly be 'ported' to UNIX
platforms other than Linux.
I was originally using the types defined in <stdint.h> and <sys/types.h>
but we need to keep in mind systems (ie Windows) that don't have ISO C99
or POSIX headers.
And we need the ability to control from one include file the
representation(s) of the various fundamental scalar types.
--
Salman Ahmed
To reply, remove "nospam." from my email address
ssahmed AT pathcom DOT com
------------------------------
From: "Somkith Chai" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: C++ linux server to java client: connection problem
Date: Fri, 25 May 2001 13:33:26 -0400
Hello,
I'm running into problems sending data between my server and client. My
server is compiled using Linux C++ and my client is on java. I'm getting a
Connection refused on the java side. I've also seen situations with the
error Connection reset by peer. Similar server code compiled on Solaris
works fine. It looks like the close() is terminating the connection
prematurely on Linux. If I put a sleep just before the close() statement,
the data is sent. Can anyone tell me what is going on? I've copied my
code below.
My Linux is Red Hat 6.2 and I am using jdk1.3.0_02.
Any help would be appreciated.
Thanks,
Somkith Chai
Server Code (C++):
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <stdio.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
int ret, sd, sd_out;
struct linger l;
l.l_onoff = 1;
l.l_linger = 100;
printf("Starting program!\n");
sd = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
printf("Creating socket descriptor: %d\n", sd);
struct sockaddr_in addr;
memset ((char*)&addr, 0, sizeof (struct sockaddr_in));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = INADDR_ANY;
addr.sin_port = 56325;
ret = bind(sd, (struct sockaddr *)&addr, sizeof (struct sockaddr_in));
printf("bind returned %d...\n", ret);
ret = listen (sd, 10);
printf("listen returned %d...\n", ret);
struct sockaddr_in addr_out;
sd_out = accept(sd, (struct sockaddr *)&addr_out, (socklen_t *) sizeof
(struct sockaddr));
ret = setsockopt(sd_out, SOL_SOCKET, SO_LINGER, (char *) &l, sizeof(l));
printf("setsockopt returned %d...\n", ret);
char buf[50001];
memset(&buf[0], (int)'1', 50000);
ret = write(sd_out, buf, 50000);
printf("write returned %d...\n", ret);
close(sd_out);
close(sd);
printf("Ending program!\n");
return 0;
}
Client Code (java):
import java.util.*;
import java.io.*;
import java.net.*;
class myClient
{
public static void main( String[] args )
{
try
{
String hostname = "puppy";
int hostport = 1500;
URL url = new URL("http", hostname, hostport, "service");
HttpURLConnection c = (HttpURLConnection)url.openConnection();
c.setRequestMethod("POST");
c.setDoOutput(true);
c.connect();
OutputStream os = c.getOutputStream();
PrintStream ps = new PrintStream(os);
ps.println(" ");
os.close();
InputStream is = c.getInputStream();
BufferedReader dis = new BufferedReader(new InputStreamReader(is));
String buffer = "";
int contentLength = 50000;
System.out.println("contentLength = " + contentLength);
char[] buf = new char[contentLength + 1];
int resul = dis.read(buf,0,contentLength);
buf[contentLength] = '\0';
System.out.println("resul = " + resul);
System.out.println("buffer content...");
System.out.println(buf);
dis.close();
is.close();
c.disconnect();
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}
------------------------------
From: [EMAIL PROTECTED]
Crossposted-To: comp.unix.bsd.freebsd.misc
Subject: Re: thundering-herd vs wake-one
Date: 25 May 2001 16:59:14 GMT
In comp.os.linux.development.system Malcolm Beattie <[EMAIL PROTECTED]> wrote:
| In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote:
|>In comp.os.linux.development.system Linus Torvalds <[EMAIL PROTECTED]>
|wrote:
|>| What 2.4.x has is the notion of the _waiters_ (who _do_ know what they
|>| are doing) saying "I'm an exclusive waiter, once you wake me up there's
|>| no point in waking any other exclusive waiters". That's very different
|>| from "wake_one()", although it also avoids the herd behaviour when used
|>| correctly.
|>
|>So how do waiters say this (I'm assuming they say it to the kernel in
|>some way)? I looked for a description in the kernel Documentation tree
|>but didn't find any.
|
| They use add_wait_queue_exclusive() instead of add_wait_queue(). That
| sets WQ_FLAG_EXCLUSIVE in the wait flags. For waking, the API seems to
| be that that wake_up_nr() and friends can specify a number argument
| that gets passed through to __wake_up_common() in kernel/sched.c.
| Ordinary wakeups pass zero through which means everything on the wait
| queue is woken. If a non-zero number is passed then only that number of
| exclusive waiters are woken. The fact that WQ_FLAG_EXCLUSIVE isn't
| explicitly mentioned (well, not in 2.4.2 anyway) makes it harder to
| track down: the test is simply
| if (try_to_wake_up(p, sync) && curr->flags && !--nr_exclusive)
| break;
|
| rather than ... (curr->flags & WQ_FLAG_EXCLUSIVE) ...
How do I have a _process_ tell the kernel this? I want to have many
processes in select() or poll() with more than one listen socket
selected for read, but only have one of those processes wake up so
only one tries to call accept(). Because there are also other
descriptors the processes need to able to wake up on in select() or
poll(), I cannot use a semaphore to hold all but one process out of
the select/poll loop.
--
=================================================================
| Phil Howard - KA9WGN | Dallas | http://linuxhomepage.com/ |
| [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/ |
=================================================================
------------------------------
Reply-To: "Frank" <[EMAIL PROTECTED]>
From: "Frank" <[EMAIL PROTECTED]>
Subject: Re: recompilation of glib-1.2.8, gtk+1.2.8 for Redhat 6.2
Date: Fri, 25 May 2001 23:42:18 +0200
Hi!
Do anyone have a suggestion on where I could continue from here?
Frank
Frank <[EMAIL PROTECTED]> wrote in message
news:MPeN6.774$[EMAIL PROTECTED]...
> Hi!
> Trying this newsgroup as I didn't get any response in alt.os.linux:
> Im new to recompiling downloaded source code in Linux.
>
> I have Redhat 6.2, and have rpm-ed glib-1.2.8 and gtk-1.2.8 on it.
> I have to recompile glib/gtk in order to achieve something else in Ada.
> I have downloaded the tar.gz files for glib/gtk 1.2.8, and put them on
> /root/prog, and untared them there.
>
> What I experience is that the glib/gtk compiling/installing leaves no
error
> messages (as far as I can tell),
> but when I progress to the Ada recompiling, that recompiling asks for
files
> with the pattern:
> gdk*.o, gtk*.o and glib*.o
> to be linked in during the process.
>
> In the Gtk installing directory I find several gtk/gdk-*.o files that I
have
> copied in to the directory that the Ada installations expects and the Ada
> installations looks happier, but I can't find any file with the pattern
with
> the pattern glib*.o so it still doesn't succed.
>
> My question in this forum is; should there be some glib*.o files after the
> installation of glib based on the tar.gz files?
> Do anyone have a good suggestion as to why I don't get any such files?
>
>
> Frank
>
------------------------------
From: "Darren LS" <[EMAIL PROTECTED]>
Subject: Re: passing messages to a forked thread
Date: Fri, 25 May 2001 22:38:54 +0100
bill davidsen <[EMAIL PROTECTED]> wrote in message
news:9em0b2$a622$[EMAIL PROTECTED]...
> In article <DeiM6.16656$[EMAIL PROTECTED]>,
> Darren LS <[EMAIL PROTECTED]> wrote:
> | Hello all. I have a nice little socket programmed than runs
transparently
> | due to the fork command thanks to the advice of many wonderful people on
> | these newsgroups. However now I need to do some manipulation to the
> | currently running process. I appreciate any advice on the following
> |
> | 1. this thread must be able to detect if it is the only instance running
and
> | if not then it needs to be able to get the process handle of other
instances
> | so it can communicate with them
> |
> | 2. Active instances must be able to take signals of other threads,
processes
> | or even programs
> |
> | 3. must be able to send signals to other processes both local and remote
>
> Having already specified "signals" you limit your implementation and
> make it complex. This sounds like a perfect use for SysV message queue,
> which would provide the IPC you need.
>
> | 4. must be able to ignore SIGTERM and should SIGKILL be thrown at it
then it
> | needs to survive long enough to fill in a log entry before it goes down.
I
> | appreciate any ideas.
>
> You can't do that, SIGKILL is not advisory. And if you persist in an
> implementation which ignores SIGTERM you will most definitely get a
> SIGKILL sometime. If you need a process which runs the whole machine and
> can't be externally killed, it's called a kernel. Other than that you
> will save a lot of pain using signals in the normal way.
>
> Your only way to get that log entry is to have the parent write it
> after your process is killed.
then that is what I am looking for. I have no desire to break the rules of
the os but if I can get my results by juggling them then that is good for me
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: Version error when installing module
Date: 25 May 2001 22:41:50 GMT
David Cheng <[EMAIL PROTECTED]> wrote:
> Please help! We are having an error that we can't get past:
> We have been working on the linux scheduler and finished the code (and
> successfully compiled), but when we try to install the module we keep
> getting this error "*.o was compiled for version 2.4.0 while this
> kernal is version 2.2.16". We are unable to get past this error and
> need help. As far as we can tell, we should only have version 2.2.16
> of the kernel. We can't figure out where 2.4.0 is coming from. Any
> help would be much appreciated. Thank you!
One reason: Look what's in /usr/include/linux/version.h on the first line
after after "#define UTS_RELEASE". If there is 2.4.0 instead of 2.2.16
the symbolic link /usr/include/linux points to the wrong source directory.
Delete /usr/include/linux and recreate it pointing to the sources of the
kernel you're running, i.e. do
ln -s /usr/src/linux-2.2.16 /usr/include/linux
(replace /usr/src/linux-2.2.16 with the place where you have the sources
for the kernel you're running) and recompile the module. Hopefully, your
problem will go away.
Alternatively (and probably better) remove the link /usr/src/linux in
/usr/src and have it point to the real kernel sources instead. This way
you only have to change one single symbolic link whenever you update to
a new kernel.
HTH, Jens
--
_ _____ _____
| ||_ _||_ _| [EMAIL PROTECTED]
_ | | | | | | AG Moebius, Institut fuer Molekuelphysik
| |_| | | | | | Fachbereich Physik, Freie Universitaet Berlin
\___/ens|_|homs|_|oerring Tel: ++49 (0)30 838 - 53394 / FAX: - 56046
------------------------------
From: Federico David Sacerdoti <[EMAIL PROTECTED]>
Subject: fast disk writes
Date: Fri, 25 May 2001 15:49:42 -0700
For large writes is fwrite() faster than raw write()? I seem to remember from
my OS class that with the Unix FFS (which I believe ext2 is based on) writes
need to come in a special order with a special size for maximum performance.
The professor said that fwrite() does this while write() does not.
Does it make a difference?
Thanks
Dave
PS by large writes I mean around 256MB or so per call.
------------------------------
From: "Karl Heyes" <[EMAIL PROTECTED]>
Subject: Re: fast disk writes
Date: Sat, 26 May 2001 00:19:53 +0100
In article <[EMAIL PROTECTED]>, "Federico David Sacerdoti"
<[EMAIL PROTECTED]> wrote:
> For large writes is fwrite() faster than raw write()? I seem to remember
> from my OS class that with the Unix FFS (which I believe ext2 is based on)
> writes need to come in a special order with a special size for maximum
> performance. The professor said that fwrite() does this while write() does
> not. Does it make a difference?
> Thanks
> Dave
> PS by large writes I mean around 256MB or so per call.
Nope. fwrite is a library call wrapped around write which is a syscall.
256MB is one hell of a write buffer, with multiple calls you'll be hitting
the memory system hard, but it would be tied to disk speed in the end.
As far as I know ext2 is not based on FFS
kar.
------------------------------
From: [EMAIL PROTECTED] (Alexander Viro)
Subject: Re: fast disk writes
Date: 25 May 2001 21:01:11 -0400
In article <[EMAIL PROTECTED]>,
Karl Heyes <[EMAIL PROTECTED]> wrote:
>Nope. fwrite is a library call wrapped around write which is a syscall.
>256MB is one hell of a write buffer, with multiple calls you'll be hitting
... so win from the submitting the data in block-aligned chunks is pretty
much noise.
>the memory system hard, but it would be tied to disk speed in the end.
>
>As far as I know ext2 is not based on FFS
It certainly is. Take descriptions and compare.
--
"You're one of those condescending Unix computer users!"
"Here's a nickel, kid. Get yourself a better computer" - Dilbert.
------------------------------
From: "Jason Kusar" <[EMAIL PROTECTED]>
Subject: Re: ext2 limitations
Date: Fri, 25 May 2001 22:06:32 -0400
What am I looking at, the inode count?? what tells me the max entries??
"Karl Heyes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> In article <SUuP6.12333$[EMAIL PROTECTED]>, "Jason
Kusar"
> <[EMAIL PROTECTED]> wrote:
>
>
> > Does anyone know what the maximum number of entries is on an ext2
partition?
> > Thanks,
> > Jason
>
> use tune2fs -l /dev/XXXXX
>
> karl.
>
------------------------------
** 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.system 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-System Digest
******************************