Linux-Development-Sys Digest #197, Volume #8 Fri, 6 Oct 00 20:13:11 EDT
Contents:
threads and wait conditions... ("Arint�")
Re: Text-based user interface development (Lew Pitcher)
Re: Safe mail (Johan Kullstam)
Re: upgrade kernel (Paul Kimoto)
Re: depmod not work in Kernel 2.4.0-test9 (Paul Kimoto)
Re: threads and wait conditions... (Kaz Kylheku)
Re: Text-based user interface development (Neal Tucker)
Re: depmod not work in Kernel 2.4.0-test9 (Philip Armstrong)
Re: Safe mail (Philip Armstrong)
Re: threads and wait conditions... ("Arint�")
Re: ioremap not in namespce...? (Gunnar Proppe)
Re: threads and wait conditions... (Kaz Kylheku)
ppp and 2.2.17 (Ulrich Lauther)
Re: Red Hat 7.0 and Kernel 2.4.0-test9 question? ("Jo l'Indien")
In sched.c, is the run_queue circular? (Chuck Wu)
----------------------------------------------------------------------------
From: "Arint�" <[EMAIL PROTECTED]>
Subject: threads and wait conditions...
Date: Fri, 06 Oct 2000 18:39:14 GMT
I am trying to run this on Redhat 6.2. When I have Wait and mutex as global
it works fine, but when it is a member variable the pthread_cond_broadcast
call never returns. What am I doing wrong???
...
pthread_cond_t Wait;
pthread_mutex_t mutex;
class Waiter{
// pthread_cond_t Wait;
// pthread_mutex_t mutex;
public:
Waiter()
{
int ret(pthread_mutex_init(&mutex,NULL));
if(ret!=0)
throw (double)9.1;
ret = pthread_cond_init(&Wait,NULL);
if(ret!=0)
throw false;
}
void wait()
{
cout<<"wait";
cout<<pthread_cond_wait(&Wait,&mutex)<<"\n";
}
void lock(string cl)
{
cout<<cl<<"lock\n";
int r = pthread_mutex_lock(&mutex);
if(r!=0)
perror("Shizer");
}
void unlock()
{
cout<<"unlock\n";
pthread_mutex_unlock(&mutex);
}
void notify(){
cout<<"broadcast\n";
cout<<"sig"<<pthread_cond_broadcast(&Wait);
}
};
typedef void* (*THREADPROC)(void*);
void* server(void* arg){
Waiter *wait = (Waiter*)arg;
wait->lock("server");
wait->notify();
wait->unlock();
cout<<"start serloop";
while(1)
cout<<"server"<<endl;
pthread_exit(NULL);
}
void* client(void* arg){
Waiter *wait = (Waiter*)arg;
while(1)
cout<<"client"<<endl;
pthread_exit(NULL);
}
int main(void){
pthread_t id;
Waiter *wait;
try{
wait = new Waiter;
}
catch(double i){
cout<<"1";
return 1;
}
catch(bool x)
{
cout<<"2";
return 1;
}
catch(...)
{
cout<<"huh";
return 1;
}
pthread_create(&id,NULL,server,(void*)&wait);
cout<<"wait on server"<<endl;
wait->lock("main");
wait->wait();
wait->unlock();
...
}
Thanks...
------------------------------
From: [EMAIL PROTECTED] (Lew Pitcher)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Text-based user interface development
Reply-To: [EMAIL PROTECTED]
Date: Fri, 06 Oct 2000 18:43:41 GMT
On Fri, 06 Oct 2000 17:09:31 GMT, Larry Blanchard <[EMAIL PROTECTED]>
wrote:
>Neal Tucker wrote:
>>
>> Lew Pitcher <[EMAIL PROTECTED]> wrote:
>> >Davide Dozza <[EMAIL PROTECTED]> wrote:
>> >
>> >>I am developing applications written in C/C++
>> >
>> >There is no such language as C/C++. There are two seperate,
>> >independant, and sometimes incompatable languages, one called C, and
>> >the other called C++.
>>
>> Thanks for enlightening us, Pedantry Man! Hey, I think I heard someone
>> say "centrifugal force" in another newsgroup...
You'd be surprised how many arguments break out on comp.lang.c when
someone says that C is a subset of C++, then complains that we cheated
and used C++ keywords as variables when we point out that
{
int new, class;
new = class = 10;
}
is legal C code _and_ illegal C++ code.
Calling it 'C/C++' only continues the incorrect belief that C and C++
are one language. It is bad practice derived from the advertising copy
of 'Integrated Development Environment' developers who produce a
product that will allow you to code and compile either language in a
common environment. Using this reasoning, it would be just as valid an
argument to say that C and C++ are subsets of COBOL, because I have an
IDE that permits me to develop and compile programs written in any of
these languages, and the IDE _says_ that it is C/C++/COBOL <g>.
>> -Neal Tucker
>
>So you wouldn't object if I said Spanish and Portuguese were the same?
>
>Or German and Yiddish? Or American and English?
>
>Yes, we have a living language that grows and changes. But some of us
>object when the growth gets cancerous :-). Lew's comment was proper.
Thank you, sir
>--
>Larry Blanchard
>"Anyone who wants to be elected shouldn't be" - Will Rogers
Lew Pitcher
Information Technology Consultant
Toronto Dominion Bank Financial Group
([EMAIL PROTECTED])
(Opinions expressed are my own, not my employer's.)
------------------------------
Subject: Re: Safe mail
From: Johan Kullstam <[EMAIL PROTECTED]>
Date: 06 Oct 2000 14:53:53 -0400
[EMAIL PROTECTED] writes:
> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] wrote:
> > >Second, what is the safest [and best] way to send an email from
> within a
> > >program to a user? I am hoping to find a way that is not overly
> > >complicated but doesn't keep me up at night because of security
> issues.
> >
> > Huh? Most of the problems I've seen with email are on the receiving
> > end, not the sending end. In shell scripts you can send a message by
> > piping the body into sendmail (or its replacement). The destination
> > person is specified on the sendmail command side. If you are writing
> > perl, there is a module which can be used to send generic SMTP mail.
> > It works very nicely.
>
> Well, this is a PAM module so sh and perl aren't really options.
how about using the network stuff to talk to the localhost smtp port?
--
J o h a n K u l l s t a m
[[EMAIL PROTECTED]]
sysengr
------------------------------
From: [EMAIL PROTECTED] (Paul Kimoto)
Subject: Re: upgrade kernel
Date: 6 Oct 2000 15:17:35 -0500
Reply-To: [EMAIL PROTECTED]
In article <Pine.SOL.4.10.10010061224120.23360-100000@robert>, Bo - Sun wrote:
> I am trying to upgrade the kernel from 2.2.14 to 2.3
The current development kernel is 2.4.0-test9. 2.3.* is obsolete.
> make bzImage;
>
> after these, I copy the generated "vmlinux" to /boot, and modify the
> /etc/lilo.conf, but after I run lilo command, I was told that the
> "vmlinux" is too large?
You need to use the bootable, compressed kernel image at
arch/i386/boot/bzImage.
--
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] (Paul Kimoto)
Subject: Re: depmod not work in Kernel 2.4.0-test9
Date: 6 Oct 2000 15:18:06 -0500
Reply-To: [EMAIL PROTECTED]
In article <8rl36o$4c0$[EMAIL PROTECTED]>, Chirok Han wrote:
> When I tried to install Kernel 2.4.0-test9, everything worked fine but
> the installation of modules.
Did you read Documentation/Changes and upgrade the modutils accordingly?
--
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] (Kaz Kylheku)
Subject: Re: threads and wait conditions...
Reply-To: [EMAIL PROTECTED]
Date: Fri, 06 Oct 2000 19:21:14 GMT
On Fri, 06 Oct 2000 18:39:14 GMT, Arint� <[EMAIL PROTECTED]> wrote:
>I am trying to run this on Redhat 6.2. When I have Wait and mutex as global
>it works fine, but when it is a member variable the pthread_cond_broadcast
>call never returns. What am I doing wrong???
What you are doing wrong is that you have no predicate. Condition variables
must be used with a predicate as in:
waiter.lock();
while (!predicate())
waiter.wait();
// okay, predicate is true now
waiter.unlock();
If you don't do this, then your server thread can race ahead and do the
broadcast before the main thread has executed the wait(). This is known as
``the lost wakeup problem'' in concurrent programming. Condition variables rely
on the predicate in order to solve the lost wakeup problem; in addition to
signalling the condition, the broadcaster must record something in the shared
state; the thread which waits has to look at the shared state and avoid calling
the wait operation if what it is waiting for is already true.
--
Any hyperlinks appearing in this article were inserted by the unscrupulous
operators of a Usenet-to-web gateway, without obtaining the proper permission
of the author, who does not endorse any of the linked-to products or services.
------------------------------
From: [EMAIL PROTECTED] (Neal Tucker)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Text-based user interface development
Date: 6 Oct 2000 12:59:50 -0700
Larry Blanchard <[EMAIL PROTECTED]> wrote:
>Neal Tucker wrote:
>>
>> Lew Pitcher <[EMAIL PROTECTED]> wrote:
>> >Davide Dozza <[EMAIL PROTECTED]> wrote:
>> >
>> >>I am developing applications written in C/C++
>> >
>> >There is no such language as C/C++. There are two seperate,
>> >independant, and sometimes incompatable languages, one called C, and
>> >the other called C++.
>>
>> Thanks for enlightening us, Pedantry Man! Hey, I think I heard someone
>> say "centrifugal force" in another newsgroup...
>
>So you wouldn't object if I said Spanish and Portuguese were the same?
Since the original poster didn't claim that C and C++ were the same,
it's a moot point, isn't it? Would you object if someone said "I write
books in English/French"? Would you jump at the chance to prove what
a smart guy you are by pointing out that those are seperate languages?
Yes, you probably would. Thanks for battling this insidious plague for
us.
-Neal Tucker
------------------------------
From: [EMAIL PROTECTED] (Philip Armstrong)
Subject: Re: depmod not work in Kernel 2.4.0-test9
Date: 6 Oct 2000 20:50:29 +0100
In article <8rl36o$4c0$[EMAIL PROTECTED]>,
Chirok Han <[EMAIL PROTECTED]> wrote:
>When I tried to install Kernel 2.4.0-test9, everything worked fine but
>the installation of modules. As I do 'make modules_install', I got
>error that the flag -F in
>/sbin/depmod -ae -F System.map Kernel-2.4.0-test9
>is invalid. So I tried 'depmod -a' after booting in the new kernel,
>but it just made an empty file '/lib/modules/2.4.0-test9/modules.dep'
>whose size is 0. As I issue 'depmod -a', it finishes in no time and
>the resulting file size is just 0.
>Please help me.
You need a new modutils package. At least version 2.3.15
You *did* read /usr/src/linux-2.4.0-test9/Documentation/Changes first
didn't you?
Phil
--
http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt
------------------------------
From: [EMAIL PROTECTED] (Philip Armstrong)
Subject: Re: Safe mail
Date: 6 Oct 2000 20:52:37 +0100
In article <[EMAIL PROTECTED]>,
Johan Kullstam <[EMAIL PROTECTED]> wrote:
>> Well, this is a PAM module so sh and perl aren't really options.
>
>how about using the network stuff to talk to the localhost smtp port?
Yeah, I thought of that too; after all its what fetchmail does. But
I'm not sure that having an smtp daemon listening on localhost:25 can
always be expected.
I guess it depends on the details of the guys application...
Phil
--
http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt
------------------------------
From: "Arint�" <[EMAIL PROTECTED]>
Subject: Re: threads and wait conditions...
Date: Fri, 06 Oct 2000 20:34:35 GMT
You missed something it is the broadcast call that is freezing.
cout<<"broadcast\n"; <---I get this cout
cout<<"sig"<<pthread_cond_broadcast(&Wait); <---but never this one
And why would having Wait and mutex global or in a class have any effect on
this.
------------------------------
From: Gunnar Proppe <[EMAIL PROTECTED]>
Subject: Re: ioremap not in namespce...?
Date: Fri, 06 Oct 2000 14:01:08 -0700
Oh yes, I forgot something. The optimization level is also important, since ioremap
is an inline
function and inlining is only active with higher optimizations. In my case, I had to
choose -O3.
>From the gcc man page:
-O3 Optimize yet more. This turns on everything -O2
does, along with also turning on -finline-func�
tions.
I haven't tried it, but it seems like you could just turn on -finline-functions.
Gunnar
[EMAIL PROTECTED] wrote:
> Gunnar Proppe wrote:
>
> > I am a module newbie as well, using the Rubini book. Had the same problem, a
>friend and I did
> > some grepping around the kernel source and determined that you need to include
><asm/io.h> to map
> > ioremap() to __ioremap().
> >
> > Eg:
> >
> > #include <asm/io.h> /*for ioremap()*/
> >
> > This did the trick. Hope it works for you. The Rubini book is nice, but very
>much out of date.
> >
> > Gunnar
> >
> > Sean Patrick McNamee wrote:
> >
> > > Arne Driescher wrote:
> > >
> > > > > OK> I added the -a option to my ksyms, and now I'm seeing a symbol
> > > > > __ioremap_R9eac042a
> > > > >
> > > > > This looks almost like mangling to me. I am still having the problem with
>the unresolved
> > > > > symbol when I try to load the driver, so I'm wondering if something weird is
>up with my
> > > > > kernel or what???
> > > > I wouldn't say weird. Depending on which options you have used
> > > > to compile your kernel, some symbols are exported and others
> > > > are not. Lets a look at the Makefile:
> > > > vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
> > > > $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
> > > > --start-group \
> > > > $(CORE_FILES) \
> > > > $(FILESYSTEMS) \
> > > > $(NETWORKS) \
> > > > $(DRIVERS) \
> > > > $(LIBS) \
> > > > --end-group \
> > > > -o vmlinux
> > > > $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU]
> > > > \)\|\(\.\.ng$$
> > > > \)\|\(LASH[RL]DI\)' | sort > System.map
> > > >
> > > > As u can see, the target vmlinux is build by linking all
> > > > object files into the kernel. In the next step nm (see man nm)
> > > > gets all the symbols from the object file and put the result in
> > > > System.map.
> > > > Exported symbols defined in you kernel should be in System.map.
> > > >
> > > > Ok, u have the symbol in you kernel but not in System.map. This means
> > > > that your System.map is not from the same build as your kernel.
> > > > Have you simply forgotten to copy your System.map to you boot
> > > > partition? If u built your own kernel: Have you used make install?
> > > > (From the Makefile:)
> > > > install: $(CONFIGURE) $(BOOTIMAGE)
> > > > sh -x ./install.sh $(KERNELRELEASE) $(BOOTIMAGE)
> > > > "$(INSTALL_PATH)"
> > > > sh -x ./install.sh $(TOPDIR)/System.map
> > > > "$(INSTALL_PATH)"/System.map-$(KERNELRELEASE)
> > > >
> > > > -Arne
> > >
> > > Well, I have recompiled the kernel, using make install (before I did it
>manually), and still
> > > no luck. One thing I did notice, however is that while my ksyms output shows the
>symbol
> > > ___ioremap_R9eac042a
> > > and the System.map shows simply __ioremap, they are both listed as being at the
>same address.
> > >
> > > Why the hell does my kernel insist on calling it this?
> > > Maybe I should just try referencing this symbol in my driver...
>
> OK> I have rebuilt the kernel WITHOUT the CONFIG_MODVERSIONS, and gotten ksyms to
>spit out
> __ioremap - YEAH!
> But, I still get the 'unresolved symbol ioremap' error; I have the #include
><asm/io.h>, and have
> looked at this file:
> It doesn't #define ioremap into __ioremap, (as some have suggested), but rather
>declares it as an
> extern.
>
> I HAVE gotten this to load, though, by inserting my own #define ioremap ...
>__ioremap statement.
> I'm pretty sure I shouldn't have to do this, but I still don't understand...
>
> Thanks again!
> Sean
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: threads and wait conditions...
Reply-To: [EMAIL PROTECTED]
Date: Fri, 06 Oct 2000 22:06:32 GMT
On Fri, 06 Oct 2000 20:34:35 GMT, Arint� <[EMAIL PROTECTED]> wrote:
>You missed something it is the broadcast call that is freezing.
> cout<<"broadcast\n"; <---I get this cout
> cout<<"sig"<<pthread_cond_broadcast(&Wait); <---but never this one
Your only evidence that it's freezing is that the output is not produced. That
is not conclusive. The reason the output is not produced because you did not
send a newline to cout, nor use the flush() method, nor the endl manipulator.
I wouldn't use naked cout from multiple threads by the way. There isn't any
interface standard which requires iostreams to be thread safe. POSIX requires
<stdio.h> to be thread-safe, but it doesn't have any requirements against C++
libraries.
--
Any hyperlinks appearing in this article were inserted by the unscrupulous
operators of a Usenet-to-web gateway, without obtaining the proper permission
of the author, who does not endorse any of the linked-to products or services.
------------------------------
From: Ulrich Lauther <[EMAIL PROTECTED]>
Subject: ppp and 2.2.17
Date: 6 Oct 2000 22:16:33 GMT
Reply-To: [EMAIL PROTECTED]
I upgraded my kernel from 2.2.16 to 2.2.17 using make oldconfig, so
all configurations should be the same.
Since then, ppp over phone does not work any more.
My dip-script starts ppp, but ifconfig shows no ppp0 interface.
Going back to 2.2.16, everything works fine.
Any ideas?
------------------------------
From: "Jo l'Indien" <[EMAIL PROTECTED]>
Subject: Re: Red Hat 7.0 and Kernel 2.4.0-test9 question?
Date: Sat, 07 Oct 2000 01:36:03 +0100
Dans l'article <8riskc$[EMAIL PROTECTED]>, "E-mu"
<[EMAIL PROTECTED]> a �crit :
> Red hat 7.0 does use Xfree86 4.0
>
> But I still had a problem with Red Hat 6.2 and Kernel 2.4.0-test8.
>
> I am just asking basically if anyone has tried test9 with Red Hat 7.0.
> I have not myself yet tried it.
>
>
I have somethng based on a RedHat (not a 7.0),
and I have problems with test8 and test9-pre... kernels.
I know there are some bugs in quota parts
and scsi drivers in test8.
I have a lot of problems with test9...
and more and more since the test9-pre6 version...
So, I think we have to wait for the "real" test9 version...
Regards...
--
Jo l'Iindien
------------------------------
From: Chuck Wu <[EMAIL PROTECTED]>
Subject: In sched.c, is the run_queue circular?
Date: Fri, 06 Oct 2000 19:52:49 -0400
I am modifying the sched.c to a pure round robin scheduler.
However, I am confused by the run_queue in sched.c
It seems that this double linked run queue is circular, i.e., the last
process's next
is &init_task. However, when testing my modification, it seems this run
queue is
not organized as circular.
The scenario of my test is:
I always select the next process on the run queue to execute:
next = (prev->next == &init_task)?&init_task.next_run:prev->next;
However, after installing this kernel and reboot, the kernel crashes
says:
Unable to Handle NULL Pointer
I used printk to print out the value of prev->next. It shows somehow the
value
of prev->next is NULL when crashes, which is impossible in a circular
queue.
So, I am confused. Who can answer my question, please?
(Now I filter out the NULL pointer. Then, the modified kernel works.)
Thanks. Have a nice weekend.
------------------------------
** 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
******************************