Linux-Development-Sys Digest #614, Volume #8 Thu, 5 Apr 01 11:13:14 EDT
Contents:
Re: How can I use the SCI inside linux module for DSM?? (Emmanuel CECCHET)
Re: pthread - threads and semaphores - help! ("Ivor Cox")
Re: Zombies and daemons ("Hubert")
Re: pthread - threads and semaphores - help! ("Hubert")
Re: file reading from kernel again (Kasper Dupont)
Re: Kernel Panic in Network Interface (Kasper Dupont)
Re: file reading from kernel again ("tlin")
Re: difference between ext2fs and reiserfs (Joshua Baker-LePain)
Re: How to communicate with COM port? (Iwo Mergler)
Re: the kernel size ??? ("hushui")
Re: LILO & bootsect.S ("hushui")
question about linux kernel source (setup.S)? ("hushui")
Re: Zombies and daemons (Josef Moellers)
Mmap Latency after kernel 2.3.10 ("Joe Schmeltzer")
----------------------------------------------------------------------------
From: Emmanuel CECCHET <[EMAIL PROTECTED]>
Subject: Re: How can I use the SCI inside linux module for DSM??
Date: Thu, 05 Apr 2001 13:05:37 +0200
This is a multi-part message in MIME format.
==============F24EBF770EC0501289B77903
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi Khaled,
> When I wrote your pice of code I received segmentation fault error
> (Unable to heandle kerenel pointer ..)
> Please found a part of my code :
> char *tmp, *tmp1
> struct file *f;
> int e;
> sprintf(tmp1,"/dev/SCI/0");
Where do you allocate tmp1 ?
> tmp = getname(tmp1);
You can directly use tmp = getname("/dev/SCI/0"); and get rid
of tmp1.
>
> if (!IS_ERR(tmp))
> {
> f = filp_open(tmp,O_RDWR , 3);
> e = PTR_ERR(f);
> if (!IS_ERR(f))
> {
> printk("File was opened successfuly..\n"); return ;
> }
> }else
> {
> printk("open failed\n"); return;
> }
You can try to add several printk statements to try to find out
at which point your program fails.
Good luck
Emmanuel
==============F24EBF770EC0501289B77903
Content-Type: text/x-vcard; charset=us-ascii;
name="Emmanuel.Cecchet.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Emmanuel CECCHET
Content-Disposition: attachment;
filename="Emmanuel.Cecchet.vcf"
begin:vcard
n:CECCHET;Emmanuel
tel;fax:04.76.61.52.52
tel;work:04.76.61.52.63
x-mozilla-html:FALSE
url:http://sirac.inrialpes.fr/~cecchet
org:INRIA Rh�ne-Alpes;Is�re (38)
adr:;;655, Avenue de l'Europe;Montbonnot St Martin;;38330;FRANCE
version:2.1
email;internet:[EMAIL PROTECTED]
title:Ph.D Student/Doctorant
x-mozilla-cpt:;-3808
fn:Emmanuel CECCHET
end:vcard
==============F24EBF770EC0501289B77903==
------------------------------
From: "Ivor Cox" <[EMAIL PROTECTED]>
Subject: Re: pthread - threads and semaphores - help!
Date: Thu, 5 Apr 2001 09:10:34 +0100
Hi Norman,
Apologies, I did mean to say recursive mutex - and I mean one that allows
the owning thread to nest calls to reserve it and releases it only when the
appropriate number of release calls have been received.
I have since found that -D_GNU_SOURCE, I think, will permit recursive
mutexes (by looking at pthread.h) but am not using it so far. I found no way
of specifying recursion with the default compile.
My programs works ok so far (a lot more modules to go yet!) using the
defaults (as you suggest) for stack and mutex_attr.
However, any thread finishing will stop the whole program. The 'man' implies
exit from the thread function given in start thread just finishes the
thread. I tried pthread_exit(0) to no avail. I suspect a simple 'error' -
perhaps you can suggest something?
Many thanks for your assistance
Ivor
"Norman Black" <[EMAIL PROTECTED]> wrote in message
news:9afvt1$ato$[EMAIL PROTECTED]...
> > 3. I need a recursive semaphore and 'man' documentation seems to support
> > this. However the compile will not work as the recursive bits of the
> header
>
> There is no such thing as a recursive semaphore. Semaphores are not
"owned"
> by any thread. Mutexes are owned and can be recursive or not.
>
> Did you intend to say "mutex" instead of semaphore, or what exactly do you
> mean by recursive.
>
> > 2. the app compiles but either crashes with seg violation with no set
> stack
> > size for the threads, or the thread start is failed (1) if I set a stack
>
> I do not set a stack size for my threads. I just take the Linux pthreads
> default, which I believe is 2MB, from a gander at the source code. What
does
> your pthread_create call look like.
>
> --
> Norman Black
> Stony Brook Software
> the reply, fubar => ix.netcom
>
> "Ivor Cox" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > Hi,
> > I am porting a multi-thread application to linux. The app is stable and
> > gives no nasties under windows and also QNX-neutrino.
> >
> > I am using Red Hat purchased in December.
> >
> > I am in the first stages of compilation and have some problems:
> >
> > 1. I am not sure if I need special compile flags for multi-thread
> > (reentrant)
> > 2. the app compiles but either crashes with seg violation with no set
> stack
> > size for the threads, or the thread start is failed (1) if I set a stack
> > size. (app running at normal user level - not root)
> > 3. I need a recursive semaphore and 'man' documentation seems to support
> > this. However the compile will not work as the recursive bits of the
> header
> > are conditional on __USE_GNU. I can't set this, it seems, unless I copy
> the
> > header and edit it (as an experiment - this can't be expected to be
> right.)
> >
> > Can anyone advise me - I am a linux newbie - on the basics for threads
in
> > linux. I understand threads in principle and have a working app for
> > win/neutrino - I need to know the basics for linux re recursive
semahores
> > and compiler options etc for multi-thread.
> >
> > (I do read the documentation, but it does not always stack!)
> >
> > Cheers
> >
> > Ivor Cox
> >
> >
> >
>
------------------------------
From: "Hubert" <[EMAIL PROTECTED]>
Subject: Re: Zombies and daemons
Date: Thu, 5 Apr 2001 14:14:45 +0200
"Hubert" <[EMAIL PROTECTED]> wrote in message
news:9ahdvf$8gf$[EMAIL PROTECTED]...
> Hi all,
>
> I cannot remove a zombie created by a daemon from the process list.
>
> My daemon (using pthreads) creates a child process within one of its
threads
> by calling vfork() and execv(). After the child process terminates, it is
> converted to a zombie.
> The same thread that creates the child process tries to remove the zombie
by
> calling waitpid(pid_t,&status,0) but always gets a return value of -1.
> I also tried to call vfork() twice (found this described in some manuals)
to
> make the init process responsable for the zombie, but it did not work.
>
> How can I remove a zombie created by a daemon? Should I also daemonize the
> child or is there a better way?
>
> Thank you
>
> Hubert
>
>
I just discovered a way how it works for me, because I do not really want to
wait for the child, just eliminate the zombies.
if ((pid = fork()) == 0)
{ //child
if ((pid = fork()) == 0)
{ // grand child
Do your work
}
else if (pid > 0)
{ // child is parent now
exit(0); // child exits and makes
} // its parent's waitpid() return
immediately
else
{
printf("fork failed\n");
}
}
else if (pid > 0)
{
int status;
waitpid(pid,&status,0);
}
else
{
printf("fork failed\n");
}
I am almost sure, that there are more (perhaps more sophisticated) ways to
achieve this. Does anybody have a better way? I still do not understand,
why in my first tries calling waitpid() returns -1.
Regards
Hubert
------------------------------
From: "Hubert" <[EMAIL PROTECTED]>
Subject: Re: pthread - threads and semaphores - help!
Date: Thu, 5 Apr 2001 15:03:39 +0200
"Ivor Cox" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Hi Norman,
>
> Apologies, I did mean to say recursive mutex - and I mean one that allows
> the owning thread to nest calls to reserve it and releases it only when
the
> appropriate number of release calls have been received.
>
> I have since found that -D_GNU_SOURCE, I think, will permit recursive
> mutexes (by looking at pthread.h) but am not using it so far. I found no
way
> of specifying recursion with the default compile.
>
Recursive Mutexes? Try this, but compile with -D_GNU_SOURCE
//#################################################
void InitializeCriticalSection(pthread_mutex_t * cs)
{
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
pthread_mutex_init(cs, &attr);
pthread_mutexattr_destroy(&attr);
}
//#################################################
void DeleteCriticalSection(pthread_mutex_t * cs)
{
pthread_mutex_destroy(cs);
}
//#################################################
void LeaveCriticalSection(pthread_mutex_t * cs)
{
pthread_mutex_unlock(cs);
}
//#################################################
void EnterCriticalSection(pthread_mutex_t * cs)
{
pthread_mutex_lock(cs);
}
Regards
Hubert
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: file reading from kernel again
Date: Thu, 05 Apr 2001 13:12:14 +0000
Emmanuel CECCHET wrote:
>
> Massimiliano Caovilla wrote:
>
> > Hello
> > I have module that REALLY NEEDS to read/write files from within the
> > kernel: I actually do that by calling directly the file operations from
> > the file * I get with a filp_open. It works well, but I can't find a way
> > to check its error return. Actually, I do a comparison between the
> > size_t returned by read and the size_t I requested to be read> anyway,
> > it seems it dosn't work if I open a file in O_CREAT and then try to read
> > from the file! How should I check in another way?
>
> Filesystems using the generic_file_read(...) operation usually
> return -EFAULT as ssize_t if read failed. It's true for
> ext2 and nfs, I haven't check for the others.
> Let me know if it doesn't work.
>
Actually -EFAULT is only returned to buggy programs,
there are lot of other posible error codes that can
be returned even to programs without bugs. You should
not check against EFAULT but rather check against all
errors, I think the IS_ERR macro would work.
If you get -EFAULT from a read call within a module,
it is usually because you give code a kernel pointer,
but it expects a userspace pointer. I think the usual
way to solve this kind of problems is by messing
around with get_fs() and set_fs().
> Emmanuel
>
> ---------------------------------------------------------------
>
> Name: Emmanuel.Cecchet.vcf
> Part 1.2 Type: text/x-vcard
> Encoding: 7bit
> Description: Card for Emmanuel CECCHET
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Kernel Panic in Network Interface
Date: Thu, 05 Apr 2001 13:24:57 +0000
James Stephens wrote:
>
> Orig posting on comp.os.linux.networking but I thought someone
> viewwing this list may have an idea... thanks
>
> Problem : when I attempt to use the route command, loopback works BUT
> the route to the gateway MOST
> (90%) often chokes... and crashes the entire box with the following
> error...
>
> Kernel Panic: skput: over: d0070fe4: 4096 put 4096 dev:tr0
> In swapper task - not syncing
>
> Details : I have a dual processor box running Linux kernel version
> 2.2.16 and a token ring adapter. I can
> ping the lo device just fine, but when I ping anything outside the box
> I get a crash or sometimes Network
> unreachable. I believe I have correctly configured the box using
> ifconfig and route. My hosts and host.conf
> file pretty much just says "go talk to DNS" and the resolv.conf file
> reads
>
> nameserver aa.bb.cc.dd
> nameserver ee.ff.gg.hh
>
> where there letters are the correct ip addresses for DNS servers.
> Ofcourse, if I ping those DNS servers I
> get a crash. BTW, all of theses addresses (except the server with the
> tr0 problem) can be hit by my
> workstation (the gateway->dnsserver-> target)
>
> If anyone has a suggestion, I would appreciate the idea(s)...
>
> Thanks,
>
> James
>
> e-mail: [EMAIL PROTECTED]
Maybee the token ring driver is not SMP
safe. Does it work with a UP-kernel?
--
Kasper Dupont
------------------------------
From: "tlin" <[EMAIL PROTECTED]>
Subject: Re: file reading from kernel again
Date: Thu, 5 Apr 2001 09:52:02 -0600
Suggestion: Use module and Character Device.
You can easily do that by Character Device (search on the web)
Massimiliano Caovilla <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Hello
> I have module that REALLY NEEDS to read/write files from within the
> kernel: I actually do that by calling directly the file operations from
> the file * I get with a filp_open. It works well, but I can't find a way
> to check its error return. Actually, I do a comparison between the
> size_t returned by read and the size_t I requested to be read> anyway,
> it seems it dosn't work if I open a file in O_CREAT and then try to read
> from the file! How should I check in another way?
> Thanks, Massi
------------------------------
From: Joshua Baker-LePain <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.misc
Subject: Re: difference between ext2fs and reiserfs
Date: 5 Apr 2001 14:40:20 GMT
In comp.os.linux.misc [EMAIL PROTECTED] wrote:
> Mind you, NFS2 only supports exporting 32 bit file sizes, so NFS will
> cause this limitation to still be visible here and there for a while
> yet...
Ah, but starting with 2.2.18, NFSv3 is supported...
--
Joshua Baker-LePain
Department of Biomedical Engineering
Duke University
------------------------------
From: Iwo Mergler <[EMAIL PROTECTED]>
Subject: Re: How to communicate with COM port?
Date: Thu, 05 Apr 2001 15:43:07 +0100
Reply-To: [EMAIL PROTECTED]
Kamp Huang wrote:
>
> Can you give me some information and tips, special some samples.
>
> Thanks in ahead!
Try this one:
http://www.linuxdoc.org/HOWTO/Serial-Programming-HOWTO.html
Iwo
------------------------------
From: "hushui" <[EMAIL PROTECTED]>
Subject: Re: the kernel size ???
Date: Thu, 5 Apr 2001 22:20:06 +0800
bzImage is often loaded in 0x100000 ( physical address ) by new loader( I
think it often is lilo which can access 1M when run in real mode under x86)
.
zImage is loaded in 0x10000 , then move to 0x01000 (all are physical
address ) by the code setup.
I am also a new learner to linux souce .
My opinion maybe has mistakes.
"vishwanath parakala" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> How is bzImgae different from zImage ?
> Just mmore compression ?
>
> Organization:
>
> Kasper Dupont <[EMAIL PROTECTED]> wrote:
> > hushui wrote:
> >>
> >> in boot.h ,it defines the kernel size by the following :
> >> boot.h
> >> /* Don't touch these, unless you really know what you're doing. */
> >> #define DEF_INITSEG 0x9000
> >> #define DEF_SYSSEG 0x1000
> >> #define DEF_SETUPSEG 0x9020
> >> #define DEF_SYSSIZE 0x7F00
> >>
> >> 7f00 ,what is its unit ??? the number of sectors ???
> >> It is written when compile the kernel????????
> >> what is the actual kernel size in bytes ???
> >> I am confused about.
> >> I use redhat 6.2 (kernel 2.1.14)
> >> I make config to add ntfs file system supported in my kernel.
> >> And it runs.
> >> But I find the time of the file (boot.h ) is still 1997 ,not the time
when
> >> I compile the kernel (2001).
> >> Why ???? The kernel size is only written in the file of vmlinuz??????
>
> > The value is used in the file arch/i386/boot/bootsect.S.
> > In that file you can also read that it is 16-byte units.
> > It does not mean that the kernel is exactly 508KB, it is
> > an upper limit. I think it is the upper limit on the
> > size of a zImage, while a bzImage can be larger.
>
> > --
> > Kasper Dupont
>
> --
> VISHWANATH PARAKALA
> __________________________________________________________________________
> Home Page: http://www.cs.colostate.edu/~vishu
> finger : [EMAIL PROTECTED]
------------------------------
From: "hushui" <[EMAIL PROTECTED]>
Subject: Re: LILO & bootsect.S
Date: Thu, 5 Apr 2001 22:27:48 +0800
When using lilo,I think lilo takes place of bootsect.S .
Lilo use map file which stand for the position of the begining sectors of
kernel .
I think so .
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Hi,
>
> I'm a little bit confused with LILO and bootsect.S and their
> relationship. My understanding is that bootsect.S is used to boot linux
> from a floppy. This is probably the reason why there is a code in the
> bootsect.S that initialize the FDC and then read the 1st 2 sectors from
it.
>
> It is also my understanding that the bootsect.S is part of the 1st 512
> bytes of the kernel image.
>
> My qustions now are:
>
> 1)If LILO is to boot the kernel image, will bootsect.S be loaded and
> executed ? If so then what happen to the part where it tries to read the
> floppy drive?
>
> 2)If bootsect.S is not loaded then how can LILO find setup.S ?
>
> Tks.
>
> AL
> (a linux newbie)
>
> --
> Posted via CNET Help.com
> http://www.help.com/
------------------------------
From: "hushui" <[EMAIL PROTECTED]>
Subject: question about linux kernel source (setup.S)?
Date: Thu, 5 Apr 2001 22:46:43 +0800
I know that the CX register contains the count for the following movesw
instruction .
I want to know what is the exatly number of CX .
In bootsect.S , we know 0x9000:[497] is the sector number of setup code . I
have seen that it is 4.
Than "sub bx,#4 ! LILO loads 4 sectors of setup "
bx=0???? What and where is the rest of setup???
Those following codes are executed when there is "bad_sig" .
LILO loads 4 sectors of setup ??? Is the sectors numbers of setup.S is big
than 4 ?? In bootset.c , it is defined as 4.
When we use lilo ,lilo load its bootsect ( lilo's bootsect ) and setup.S
,does the lilo load all the sector of the sect.S ????
When the task of lilo is completed , it give the control to setup.S or the
kernel start code ?????
Is the kernel Image including the code of bootsect.S and setup.S ????
Thank you all .
The codes in setup.S that confuse me are the following :
...........
! We now have to find the rest of the setup code/data
bad_sig:
mov ax,cs ! aka #SETUPSEG
sub ax,#DELTA_INITSEG ! aka #INITSEG
mov ds,ax
xor bh,bh
mov bl,[497] ! get setup sects from boot sector
sub bx,#4 ! LILO loads 4 sectors of setup
shl bx,#8 ! convert to words
mov cx,bx
shr bx,#3 ! convert to segment
add bx,#SYSSEG
seg cs
mov start_sys_seg,bx
! Move rest of setup code/data to here !
mov di,#2048 ! four sectors loaded by LILO !
sub si,si
mov ax,cs ! aka #SETUPSEG
mov es,ax
mov ax,#SYSSEG
mov ds,ax
rep
movsw
...............
------------------------------
From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: Zombies and daemons
Date: Thu, 05 Apr 2001 16:46:33 +0200
Hubert wrote:
> I am almost sure, that there are more (perhaps more sophisticated) ways=
to
> achieve this. Does anybody have a better way? I still do not understan=
d,
> why in my first tries calling waitpid() returns -1.
One can set up a signal handler for SIGCHLD which then calls wait() to
eliminate the zombie.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
From: [EMAIL PROTECTED] ("Joe Schmeltzer")
Subject: Mmap Latency after kernel 2.3.10
Date: Thu, 5 Apr 2001 14:48:03 +0000 (UTC)
This is a multi-part message in MIME format.
=======_NextPart_000_0005_01C0BDBD.ED0E9B80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Does anyone know why the mmap latency times drop drastically around =
kernel 2.3.10? I am benchmarking the linux kernels and noticed this =
drastic change. Linus claims that Mmap Latency using lmbench is not an =
actual benchmark, but from the graphs I have compiled there is a =
definite change in the kernel sometime around 2.3.10. The Latency times =
dropped from around 6000 microseconds to around 150 microseconds. Here =
are links to the graph
http://euclid.nmu.edu/~benchmark/MmapGraph.gif
If anyone can help, it would be greatly appreciated and duely noted in =
my our article in Linux Journal.
Joe Schmeltzer
[EMAIL PROTECTED]
=======_NextPart_000_0005_01C0BDBD.ED0E9B80
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2> Does anyone know why =
the mmap=20
latency times drop drastically around kernel 2.3.10? I am =
benchmarking the=20
linux kernels and noticed this drastic change. Linus claims that =
Mmap=20
Latency using lmbench is not an actual benchmark, but from the graphs I =
have=20
compiled there is a definite change in the kernel sometime around =
2.3.10. =20
The Latency times dropped from around 6000 microseconds to around 150=20
microseconds. Here are links to the graph</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://euclid.nmu.edu/~benchmark/MmapGraph.gif">http://euclid.nmu=
.edu/~benchmark/MmapGraph.gif</A></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>If anyone can help, it would be greatly =
appreciated=20
and duely noted in my our article in Linux Journal.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Joe Schmeltzer</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>[EMAIL PROTECTED]</FONT></DIV></BODY></HTML>
=======_NextPart_000_0005_01C0BDBD.ED0E9B80==
--
Posted from VM.NMU.EDU [198.110.200.34]
via Mailgate.ORG Server - http://www.Mailgate.ORG
------------------------------
** 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
******************************