<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>thank you for all your answerts.<BR>
<BR>
I try Paul sugesstion and use the waitpid funtions... <BR>
unfortunately it just success the first time after that waitpid alsways says Illegal seek ?????<BR>
<BR>
what do I wrong?<BR>
<BR>
thank you<BR>
<BR>
// -----------<BR>
// code...<BR>
<BR>
#include <signal.h><BR>#include <stdio.h><BR>#include <sys/types.h><BR>#include <sys/wait.h><BR>#include <sched.h><BR>#include <unistd.h><BR>#include <syscall.h> // for syscall(SYS_getpid)<BR>#include <syslog.h><BR>#include <errno.h><BR>#include <fcntl.h><BR>#include <sys/stat.h><BR>
#include "logCtrl.h" // printLog function<BR>
int transProcessId=0;<BR>char transStack[0x40000];<BR>
pid_t mypid;<BR>pid_t transpid;<BR>
<BR>int transProcess(){<BR> <BR> transpid = getpid();<BR>
int i;<BR> for(i=0;i<15;i++){<BR> printLog(logTRANS,"transProc: %i",transpid); <BR> sleep(1); <BR> } <BR> printLog(logTRANS,"bye!"); <BR> <BR> return 0;<BR>}<BR>
void startTransProcess(){<BR> <BR> mypid = getppid();<BR> printLog(logTRANS,"parent process ID: %i",mypid); <BR> if(transProcessId>0) transProcessId=0; // transProcessId initialisieren<BR>
transProcessId=clone(transProcess, &transStack[sizeof(transStack)-10],CLONE_VM|CLONE_FILES|CLONE_FS , 0);<BR>
if(transProcessId>0){ <BR> printLog(logMODUL1,"transProc started (PID: %d)",transProcessId); <BR> <BR> }<BR> else {<BR> printLog(logMODUL1,"transProc not started (PID: %d)",transProcessId); <BR> }<BR>};<BR>
<BR>void modul1()<BR>{<BR> <BR> if (!transProcessId) startTransProcess(); <BR>
if(transProcessId>0){<BR> <BR> if (waitpid (transProcessId, NULL, WNOHANG | __WCLONE) != 0) {<BR> perror("waitpid()"); <BR> printLog(logMODUL1,"transProc (PID: %d)",transProcessId); <BR> transProcessId=0; <BR> printLog(logMODUL1,"start new transProc");<BR> }<BR> }<BR> <BR> <BR>}<BR>
<BR>
int mainprog()<BR>{<BR> printLog(logMAIN,"Program start"); <BR>
while(1) { <BR> <BR> modul1();<BR> <BR> usleep(20*1000);<BR> <BR> }<BR> <BR> return 0; <BR>
}<BR>
<BR>// *******************************************************************************************<BR>
<BR>// -------------------------------------------------------------------------<BR>// <BR>// -------------------------------------------------------------------------<BR>//<BR>//<BR>// *******************************************************************************************<BR>//<BR>//<BR>// *******************************************************************************************<BR>//<BR>int main (int argc,char *argv[]){<BR> <BR> initLogCtrl();<BR>
mainprog(); <BR> <BR> return 0;<BR> <BR>}<BR><BR><BR><BR><BR><BR>
<HR id=stopSpelling>
<BR>
> From: linuxcprogramming-request@lists.linux.org.au<BR>> To: linuxcprogramming@lists.linux.org.au<BR>> Date: Wed, 14 Nov 2007 20:20:11 +0000<BR>> Subject: linuxCprogramming Digest, Vol 2, Issue 1<BR>> <BR>> Send linuxCprogramming mailing list submissions to<BR>> linuxcprogramming@lists.linux.org.au<BR>> <BR>> To subscribe or unsubscribe via the World Wide Web, visit<BR>> http://lists.linux.org.au/listinfo/linuxcprogramming<BR>> or, via email, send a message with subject or body 'help' to<BR>> linuxcprogramming-request@lists.linux.org.au<BR>> <BR>> You can reach the person managing the list at<BR>> linuxcprogramming-owner@lists.linux.org.au<BR>> <BR>> When replying, please edit your Subject line so it is more specific<BR>> than "Re: Contents of linuxCprogramming digest..."<BR>> <BR>> <BR>> Today's Topics:<BR>> <BR>> 1. Re: Debugging a core dump (Zach)<BR>> 2. Re: Debugging a core dump (DR. N. B. Venkat Nagasuri)<BR>> 3. Re: Debugging a core dump (Zach)<BR>> 4. Re: Questions regarding message queue (Paul Gearon)<BR>> 5. Questions Regarding FIFO (Ludwig Isaac Lim)<BR>> 6. Re: Questions Regarding FIFO (Steve Baker)<BR>> 7. best ipc mechanism (vineeth saraschandran)<BR>> 8. Re: best ipc mechanism (Kim Hawtin)<BR>> 9. SPI driver development questions (Shi ZeQin)<BR>> 10. SPI driver development questions (haqin)<BR>> 11. zombie process... (Sayang Oin)<BR>> 12. Re: zombie process... (Paul Gearon)<BR>> <BR>> <BR>> ----------------------------------------------------------------------<BR>> <BR>> Message: 1<BR>> Date: Thu, 26 Jul 2007 06:06:40 -0400<BR>> From: Zach <netrek@gmail.com><BR>> Subject: Re: [LCP] Debugging a core dump<BR>> To: "Linux C Programming" <linuxcprogramming@lists.linux.org.au><BR>> Message-ID:<BR>> <ecfa260c0707260306w6e49202ch518b86449197c766@mail.gmail.com><BR>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed<BR>> <BR>> I have had the same problem. Hope someone answers.<BR>> <BR>> Zach<BR>> <BR>> On 7/26/07, Ludwig Isaac Lim <ludz_lim@yahoo.com> wrote:<BR>> ><BR>> > Hi:<BR>> ><BR>> > I'm trying to debug a program which dumps a core file (<BR>> > I compiled the program with a "-g" flag). I tried setting<BR>> > the core size by using the following command:<BR>> ><BR>> > ulimit -c 1000<BR>> ><BR>> > I tried debugging it by :<BR>> > gdb <program name> <name of the core><BR>> ><BR>> ><BR>> > gdb gives me the following error message :<BR>> > <core file> is not a core dump: file format not<BR>> > recognized.<BR>> ><BR>> > What is should be ideal size of a core dump for it be<BR>> > helpful in debugging a program?<BR>> ><BR>> > Many thanks!<BR>> ><BR>> > ludwig<BR>> ><BR>> ><BR>> ><BR>> > ____________________________________________________________________________________<BR>> > Get the free Yahoo! toolbar and rest assured with the added security of spyware protection.<BR>> > http://new.toolbar.yahoo.com/toolbar/features/norton/index.php<BR>> ><BR>> > _______________________________________________<BR>> > This is the Linux C Programming List<BR>> > : http://lists.linux.org.au/listinfo/linuxcprogramming List<BR>> ><BR>> <BR>> <BR>> <BR>> ------------------------------<BR>> <BR>> Message: 2<BR>> Date: Thu, 26 Jul 2007 03:41:46 -0700 (PDT)<BR>> From: "DR. N. B. Venkat Nagasuri" <venkat_ritch@yahoo.com><BR>> Subject: Re: [LCP] Debugging a core dump<BR>> To: Linux C Programming <linuxcprogramming@lists.linux.org.au><BR>> Message-ID: <626153.67864.qm@web51109.mail.re2.yahoo.com><BR>> Content-Type: text/plain; charset="iso-8859-1"<BR>> <BR>> Try<BR>> ulimit -S -c 100000<BR>> ./yourprogram (which is compiled using -g option)<BR>> gdb -q yourprogram corefile<BR>> <BR>> Venkat<BR>> <BR>> Zach <netrek@gmail.com> wrote:<BR>> I have had the same problem. Hope someone answers.<BR>> <BR>> Zach<BR>> <BR>> On 7/26/07, Ludwig Isaac Lim wrote:<BR>> ><BR>> > Hi:<BR>> ><BR>> > I'm trying to debug a program which dumps a core file (<BR>> > I compiled the program with a "-g" flag). I tried setting<BR>> > the core size by using the following command:<BR>> ><BR>> > ulimit -c 1000<BR>> ><BR>> > I tried debugging it by :<BR>> > gdb <BR>> <BR>> ><BR>> ><BR>> > gdb gives me the following error message :<BR>> > is not a core dump: file format not<BR>> > recognized.<BR>> ><BR>> > What is should be ideal size of a core dump for it be<BR>> > helpful in debugging a program?<BR>> ><BR>> > Many thanks!<BR>> ><BR>> > ludwig<BR>> ><BR>> ><BR>> ><BR>> > ____________________________________________________________________________________<BR>> > Get the free Yahoo! toolbar and rest assured with the added security of spyware protection.<BR>> > http://new.toolbar.yahoo.com/toolbar/features/norton/index.php<BR>> ><BR>> > _______________________________________________<BR>> > This is the Linux C Programming List<BR>> > : http://lists.linux.org.au/listinfo/linuxcprogramming List<BR>> ><BR>> <BR>> _______________________________________________<BR>> This is the Linux C Programming List<BR>> : http://lists.linux.org.au/listinfo/linuxcprogramming List<BR>> <BR>> <BR>> <BR>> Prof NB Venkateswarlu<BR>> B.Tech(SVU), M.Tech(IIT-Kanpur), Ph.D(BITS,Pilani), PDF(U of Leeds,UK)<BR>> Visit My Home at: www.ritchcenter.com/nbv<BR>> <BR>> <BR>> ---------------------------------<BR>> Shape Yahoo! in your own image. Join our Network Research Panel today!<BR>> -------------- next part --------------<BR>> An HTML attachment was scrubbed...<BR>> URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20070726/943d126f/attachment.htm <BR>> <BR>> ------------------------------<BR>> <BR>> Message: 3<BR>> Date: Thu, 26 Jul 2007 20:37:52 -0400<BR>> From: Zach <netrek@gmail.com><BR>> Subject: Re: [LCP] Debugging a core dump<BR>> To: "Linux C Programming" <linuxcprogramming@lists.linux.org.au><BR>> Message-ID:<BR>> <ecfa260c0707261737vf1128f6jde882aef027cc435@mail.gmail.com><BR>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed<BR>> <BR>> Thank you Dr. Nagasuri.<BR>> <BR>> Zach<BR>> <BR>> On 7/26/07, DR. N. B. Venkat Nagasuri <venkat_ritch@yahoo.com> wrote:<BR>> > Try<BR>> > ulimit -S -c 100000<BR>> > ./yourprogram (which is compiled using -g option)<BR>> > gdb -q yourprogram corefile<BR>> ><BR>> > Venkat<BR>> ><BR>> > Zach <netrek@gmail.com> wrote:<BR>> > I have had the same problem. Hope someone answers.<BR>> ><BR>> > Zach<BR>> ><BR>> > On 7/26/07, Ludwig Isaac Lim wrote:<BR>> > ><BR>> > > Hi:<BR>> > ><BR>> > > I'm trying to debug a program which dumps a core file (<BR>> > > I compiled the program with a "-g" flag). I tried setting<BR>> > > the core size by using the following command:<BR>> > ><BR>> > > ulimit -c 1000<BR>> > ><BR>> > > I tried debugging it by :<BR>> > > gdb<BR>> > ><BR>> > ><BR>> > > gdb gives me the following error message :<BR>> > > is not a core dump: file format not<BR>> > > recognized.<BR>> > ><BR>> > > What is should be ideal size of a core dump for it be<BR>> > > helpful in debugging a program?<BR>> > ><BR>> > > Many thanks!<BR>> > ><BR>> > > ludwig<BR>> > ><BR>> > ><BR>> > ><BR>> > ><BR>> > ____________________________________________________________________________________<BR>> > > Get the free Yahoo! toolbar and rest assured with the added security of<BR>> > spyware protection.<BR>> > ><BR>> > http://new.toolbar.yahoo.com/toolbar/features/norton/index.php<BR>> > ><BR>> > > _______________________________________________<BR>> > > This is the Linux C Programming List<BR>> > > : http://lists.linux.org.au/listinfo/linuxcprogramming<BR>> > List<BR>> > ><BR>> ><BR>> > _______________________________________________<BR>> > This is the Linux C Programming List<BR>> > : http://lists.linux.org.au/listinfo/linuxcprogramming List<BR>> ><BR>> ><BR>> ><BR>> > Prof NB Venkateswarlu<BR>> > B.Tech(SVU), M.Tech(IIT-Kanpur), Ph.D(BITS,Pilani), PDF(U of Leeds,UK)<BR>> > Visit My Home at: www.ritchcenter.com/nbv<BR>> ><BR>> > ________________________________<BR>> > Shape Yahoo! in your own image. Join our Network Research Panel today!<BR>> ><BR>> ><BR>> > _______________________________________________<BR>> > This is the Linux C Programming List<BR>> > : http://lists.linux.org.au/listinfo/linuxcprogramming<BR>> > List<BR>> ><BR>> ><BR>> <BR>> <BR>> <BR>> ------------------------------<BR>> <BR>> Message: 4<BR>> Date: Fri, 3 Aug 2007 00:36:22 -0500<BR>> From: Paul Gearon <gearon@ieee.org><BR>> Subject: Re: [LCP] Questions regarding message queue<BR>> To: Linux C Programming <linuxcprogramming@lists.linux.org.au><BR>> Message-ID: <ACBD76F8-C4FB-479E-B95F-48B039666A95@ieee.org><BR>> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed<BR>> <BR>> Hi,<BR>> <BR>> Catching up on a backlog of email, I realized that I missed this one...<BR>> <BR>> On Jul 22, 2007, at 11:45 PM, Ludwig Isaac Lim wrote:<BR>> > Hi:<BR>> ><BR>> > I have 2 questions regarding message queue IPCs:<BR>> ><BR>> > 1) What is the standard way of generating a queue id? I<BR>> > usually do the following:<BR>> ><BR>> > key = ftok(<name of the executable file>,..);<BR>> > id = msgget(key,...);<BR>> ><BR>> > I can see problems arising when I move the executable<BR>> > to another directory.<BR>> <BR>> Actually, while this is theoretically bad, it will often work. The <BR>> reason is because the key is generated from the inode of the file. <BR>> If you do a simple mv (as opposed to a cp;rm) then the inode won't <BR>> change, and hence the value will be the same.<BR>> <BR>> > Does a better alternative exist? Is the code below much<BR>> > better<BR>> ><BR>> > touch(<name of a temporary file>);<BR>> ><BR>> > key = ftok(<name of the temporary file>):<BR>> ><BR>> > since "touch" was called prior to ftok, then mostly<BR>> > likely, calls to ftok will always be successfull.<BR>> <BR>> Well, there's no "touch" call (unless you use system(3)), but you can <BR>> easily use creat(2) or open(2). This approach works just fine.<BR>> <BR>> What you're doing here is essentially registering a service for <BR>> clients to connect to. You need some kind of "address" for this <BR>> service, otherwise clients won't know how to find you. In the world <BR>> of sockets, this is typically done by using a predefined port <BR>> number. This is subject to collision, but for well known services <BR>> the port number is reserved for that protocol only (eg. port 80 is <BR>> http).<BR>> <BR>> You should be safe with a name like:<BR>> /tmp/my.program.name.and.a.service.number.1234<BR>> <BR>> Anyone colliding with this name is just asking for <BR>> difficulties. :-) Besides, the algorithm *can* lead to collisions <BR>> anyway - though these are unlikely.<BR>> <BR>> > Supposing somebody deletes the temporary file AFTER the<BR>> > message queue has been created. Will it affect the message<BR>> > queue?<BR>> <BR>> Not the queue itself, but now that the file is gone, it will not be <BR>> possible for any clients to generate the same key again, even if they <BR>> re-create the file (since the inode may be different). Any clients <BR>> that are already connected to the shared memory won't notice a problem.<BR>> <BR>> > 2) Is message queue always a better alternative to FIFO?<BR>> > The only foreseable problem with message queues if the<BR>> > message size larger than msgmax. When is FIFO preferred<BR>> > over message queues? It seems that FIFO is much better is<BR>> > the message size is very large. Any other opinion?<BR>> <BR>> FIFOs are good for transferring data from one process to another, <BR>> particularly large amounts (though if it's big and needs to be <BR>> updated, then consider shared memory, and if it's REALLY big then use <BR>> mmap). Message queues are a little different:<BR>> - Messages have limited size.<BR>> - They can be received out of order (controlled with the message type)<BR>> - Multiple processes can write to the queue.<BR>> - Multiple processes can read from the queue (though this needs to be <BR>> synchronized)<BR>> <BR>> In other words, message queues are good for sending messages. :-)<BR>> <BR>> Regards,<BR>> Paul<BR>> <BR>> <BR>> <BR>> ------------------------------<BR>> <BR>> Message: 5<BR>> Date: Wed, 8 Aug 2007 05:52:01 -0700 (PDT)<BR>> From: Ludwig Isaac Lim <ludz_lim@yahoo.com><BR>> Subject: [LCP] Questions Regarding FIFO<BR>> To: linuxcprogramming@lists.linux.org.au<BR>> Message-ID: <495247.68184.qm@web31907.mail.mud.yahoo.com><BR>> Content-Type: text/plain; charset=iso-8859-1<BR>> <BR>> Hi:<BR>> <BR>> According to Linux man pages fifo(7), when processes<BR>> exchange data using a fifo, the kernel passes all data<BR>> internaly without writing to a file.<BR>> <BR>> Supposing I have a "producer" process which passes data<BR>> to "consumer" process using a fifo, and the consumer<BR>> process is slower than the producer. Where does the kernel<BR>> store the unprocessed messages? Assuming the kernel stored<BR>> it in the memory. Is there a limitation on the size of the<BR>> "backlog"? Is there something like message queue's MSGMAX<BR>> and MSGMNB parameters?<BR>> <BR>> Many thanks,<BR>> <BR>> ludwig lim<BR>> <BR>> <BR>> <BR>> ____________________________________________________________________________________<BR>> Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.<BR>> http://smallbusiness.yahoo.com/webhosting <BR>> <BR>> <BR>> <BR>> ------------------------------<BR>> <BR>> Message: 6<BR>> Date: Wed, 08 Aug 2007 09:25:31 -0400<BR>> From: Steve Baker <ice@mama.indstate.edu><BR>> Subject: Re: [LCP] Questions Regarding FIFO<BR>> To: linuxcprogramming@lists.linux.org.au<BR>> Message-ID: <200708081325.l78DPVUa013032@mama.indstate.edu><BR>> Content-Type: text/plain; charset=us-ascii<BR>> <BR>> Ludwig Isaac Lim <ludz_lim@yahoo.com> wrote:<BR>> > According to Linux man pages fifo(7), when processes<BR>> > exchange data using a fifo, the kernel passes all data<BR>> > internaly without writing to a file.<BR>> ><BR>> > Supposing I have a "producer" process which passes data<BR>> > to "consumer" process using a fifo, and the consumer<BR>> > process is slower than the producer. Where does the kernel<BR>> > store the unprocessed messages? Assuming the kernel stored<BR>> > it in the memory. Is there a limitation on the size of the<BR>> > "backlog"? Is there something like message queue's MSGMAX<BR>> > and MSGMNB parameters?<BR>> <BR>> When the producer produces more than the consumer processes, then it will<BR>> simply block on writing to the fifo/pipe, or in otherwords, stop writing, when<BR>> the pipe has become full. That is unless O_NONBLOCK was set when the<BR>> fifo/pipe was opened, in which case it will write as much data as will fill<BR>> the pipe and then return with an EAGAIN error (in which case the producer will<BR>> need to re-write the data not written).<BR>> <BR>> Linux pipes are hardwired to be a single page in size (4096 bytes). However<BR>> according to the man page (man 7 pipe), since kernel 2.6.11, fifo/pipes are<BR>> hardwired to 64K in size. The fifo/pipe buffer size should be available in<BR>> the external define PIPE_BUF, but it seems to still be 4096 in all the kernel<BR>> sources > 2.6.11 that I have.<BR>> <BR>> Read the man pages on pipe and fifo in section 7 for more complete<BR>> information (ex: man 7 pipe fifo).<BR>> <BR>> - Steve<BR>> <BR>> <BR>> <BR>> ------------------------------<BR>> <BR>> Message: 7<BR>> Date: Fri, 31 Aug 2007 02:31:14 +0000<BR>> From: vineeth saraschandran <vineethsaraschandran@hotmail.com><BR>> Subject: [LCP] best ipc mechanism<BR>> To: <linuxcprogramming@lists.linux.org.au><BR>> Message-ID: <BLU111-W139BB99C8B5E58B01B0A38CDCE0@phx.gbl><BR>> Content-Type: text/plain; charset="iso-8859-1"<BR>> <BR>> Hi<BR>> <BR>> I know there are many different ipc mechanism to communicate between different process running on a same local machine.<BR>> I am trying to figure out which one will be the best possible method for my application.<BR>> <BR>> The requirements for my application are:<BR>> 1.I need to transfer around 40,000 bytes of data from one process to another. This data transfer will occur at a very frequent time interval.(Can I use local unix socket to transfer these data or shared memory is better approach?).<BR>> <BR>> <BR>> _________________________________________________________________<BR>> Download the latest version of Windows Live Messenger NOW!<BR>> http://get.live.com/en-ie/messenger/overview<BR>> -------------- next part --------------<BR>> An HTML attachment was scrubbed...<BR>> URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20070831/8badceea/attachment-0001.htm <BR>> <BR>> ------------------------------<BR>> <BR>> Message: 8<BR>> Date: Mon, 03 Sep 2007 09:48:28 +0930<BR>> From: Kim Hawtin <kim.hawtin@adelaide.edu.au><BR>> Subject: Re: [LCP] best ipc mechanism<BR>> To: linuxcprogramming@lists.linux.org.au<BR>> Message-ID: <46DB52D4.7040101@adelaide.edu.au><BR>> Content-Type: text/plain; charset=ISO-8859-1<BR>> <BR>> hi vineeth,<BR>> <BR>> vineeth saraschandran wrote:<BR>> > I know there are many different ipc mechanism to communicate between different process running on a same local machine.<BR>> > I am trying to figure out which one will be the best possible method for my application.<BR>> > <BR>> > The requirements for my application are:<BR>> > 1.I need to transfer around 40,000 bytes of data from one process to another. This data transfer will occur at a very frequent time interval.(Can I use local unix socket to transfer these data or shared memory is better approach?).<BR>> <BR>> sysv shared memory is one way, mmap'ing files, or UDP streams another<BR>> <BR>> have a look at the comp.lang.c faq;<BR>> http://c-faq.com/<BR>> <BR>> this socket programming howto is in python, but the concepts are the same;<BR>> http://www.amk.ca/python/howto/sockets/<BR>> <BR>> and some interesting stuff in the secure programing howto;<BR>> http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/features.html<BR>> <BR>> cheers,<BR>> <BR>> kim<BR>> <BR>> <BR>> <BR>> ------------------------------<BR>> <BR>> Message: 9<BR>> Date: Thu, 20 Sep 2007 11:18:57 +0800 (CST)<BR>> From: "Shi ZeQin" <haqin@126.com><BR>> Subject: [LCP] SPI driver development questions<BR>> To: linuxcprogramming@lists.linux.org.au<BR>> Message-ID:<BR>> <17048860.720121190258337440.JavaMail.coremail@bj126app62.126.com><BR>> Content-Type: text/plain; charset="gbk"<BR>> <BR>> I have to develop an SPI device driver to make a at91sam9261 custom board "talk" to an at89s53 in order to receive data from it when needed.<BR>> I'm using 2.6.14 kernel with support for the spi subsystem enabled. The tree below are files that come with kernel in driver/spi/.<BR>> <BR>> <BR>> ------------------------------<BR>> <BR>> Message: 10<BR>> Date: Thu, 20 Sep 2007 14:09:01 +0800<BR>> From: "haqin" <haqin@126.com><BR>> Subject: [LCP] SPI driver development questions<BR>> To: "Linux C Programming" <linuxcprogramming@lists.linux.org.au><BR>> Message-ID: <200709201408591090423@126.com><BR>> Content-Type: text/plain; charset="gb2312"<BR>> <BR>> Sorry, there may be some problem with my network that half of the letter I sent several hours ago is cut off.<BR>> <BR>> <BR>> I have to develop a SPI device driver to make a at91sam9261 custom board "talk" to an at89s53 in order to receive data from it when needed.<BR>> <BR>> I'm using 2.6.14 kernel with support for the spi subsystem enabled. <BR>> <BR>> Could anyone tell me how to write a dirve base on the sp isubsystem support of the Linux kernel.<BR>> <BR>> Let me repeat. I wonder how to write a driver base on the spi subsystem, to communciate with a spi slave. <BR>> Could any one give me an esay example that even without irq ?<BR>> <BR>> <BR>> <BR>> Thank you all.<BR>> <BR>> Shi ZeQin<BR>> -------------- next part --------------<BR>> An HTML attachment was scrubbed...<BR>> URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20070920/3435b3cb/attachment-0001.htm <BR>> <BR>> ------------------------------<BR>> <BR>> Message: 11<BR>> Date: Wed, 14 Nov 2007 16:30:34 +0100<BR>> From: Sayang Oin <sayangoin@hotmail.com><BR>> Subject: [LCP] zombie process...<BR>> To: <linuxcprogramming@lists.linux.org.au><BR>> Message-ID: <BAY128-W32E9FDB727DDECDA83FDC5A4810@phx.gbl><BR>> Content-Type: text/plain; charset="iso-8859-1"<BR>> <BR>> Hello,<BR>> <BR>> can someone help me?<BR>> <BR>> I start a process via clone function but I don't know how to exit my child process without get a zombie...<BR>> <BR>> thank you in addvance<BR>> Sayangoin<BR>> <BR>> <BR>> <BR>> // source code.................<BR>> <BR>> #include <signal.h>#include <stdio.h>#include <sys/types.h>#include <sys/wait.h>#include <sched.h>#include <unistd.h>#include <syscall.h> // for syscall(SYS_getpid)#include <syslog.h>#include <errno.h>#include <fcntl.h>#include <sys/stat.h><BR>> #include "logCtrl.h"<BR>> int transProcessId=0;char transStack[0x40000];<BR>> pid_t mypid;<BR>> int transProcess(){ mypid = syscall(SYS_getpid);<BR>> printLog(logTRANS,"create transProc %i",mypid); <BR>> return 0;}<BR>> void startTransProcess(){ mypid = syscall(SYS_getpid);<BR>> printLog(logMODUL1,"create transProc %i",mypid);<BR>> if(transProcessId>0) transProcessId=0; // transProcessId initialisieren<BR>> transProcessId=clone(transProcess, &transStack[sizeof(transStack)-10],CLONE_VM|CLONE_FILES|CLONE_FS , 0);<BR>> if(transProcessId>0){ printLog(logMODUL1,"transProc gestartet (PID: %d)",transProcessId); } else { printLog(logMODUL1,"transProc nicht startet (PID: %d)",transProcessId); }};<BR>> void modul1(){ //printLog(logMODUL1,"Modul1"); if (!transProcessId) startTransProcess(); }<BR>> <BR>> int mainprog(){ printLog(logMAIN,"Programm start"); <BR>> while(1) { modul1(); usleep(10*1000); } return 0; <BR>> }<BR>> <BR>> // -------------------------------------------------------------------------// // -------------------------------------------------------------------------////// *******************************************************************************************////// *******************************************************************************************//int main (int argc,char *argv[]){ initLogCtrl();<BR>> mainprog(); return 0; }<BR>> _________________________________________________________________<BR>> Windows Live Writer Beta - Ver?ffentlichen Sie Multimediainhalte in Ihrem Blog!<BR>> http://get.live.com/betas/writer_betas<BR>> -------------- next part --------------<BR>> An HTML attachment was scrubbed...<BR>> URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20071114/839bdea3/attachment-0001.htm <BR>> <BR>> ------------------------------<BR>> <BR>> Message: 12<BR>> Date: Wed, 14 Nov 2007 13:53:07 -0600<BR>> From: "Paul Gearon" <gearon@ieee.org><BR>> Subject: Re: [LCP] zombie process...<BR>> To: "Linux C Programming" <linuxcprogramming@lists.linux.org.au><BR>> Message-ID:<BR>> <a25ac1f0711141153i5e5c8661g5c3e1385726052e0@mail.gmail.com><BR>> Content-Type: text/plain; charset=ISO-8859-1<BR>> <BR>> I should point out that you shouldn't be using system calls to do<BR>> simple things like getting your pid. That's what glibc is for. It<BR>> wraps all those system calls up into standard POSIX functions that you<BR>> *should* be calling. In this case, use getpid(2). For details type:<BR>> man getpid<BR>> <BR>> As for your zombie problem, they're waiting to be reaped. The parent<BR>> can choose to read the exit status at any time, so the OS *must* keep<BR>> this info until the parent has collected it. This is called reaping.<BR>> It's a simple matter of calling one of the synchronous wait()<BR>> functions. On Linux these are wait, waitpid and waitid. See wait(2)<BR>> for the details:<BR>> man 2 wait<BR>> <BR>> Regards,<BR>> Paul<BR>> <BR>> On Nov 14, 2007 9:30 AM, Sayang Oin <sayangoin@hotmail.com> wrote:<BR>> ><BR>> > Hello,<BR>> ><BR>> > can someone help me?<BR>> ><BR>> > I start a process via clone function but I don't know how to exit my child<BR>> > process without get a zombie...<BR>> ><BR>> > thank you in addvance<BR>> > Sayangoin<BR>> ><BR>> ><BR>> ><BR>> > // source code.................<BR>> ><BR>> > #include <signal.h><BR>> > #include <stdio.h><BR>> > #include <sys/types.h><BR>> > #include <sys/wait.h><BR>> > #include <sched.h><BR>> > #include <unistd.h><BR>> > #include <syscall.h> // for syscall(SYS_getpid)<BR>> > #include <syslog.h><BR>> > #include <errno.h><BR>> > #include <fcntl.h><BR>> > #include <sys/stat.h><BR>> ><BR>> > #include "logCtrl.h"<BR>> > int transProcessId=0;<BR>> > char transStack[0x40000];<BR>> > pid_t mypid;<BR>> ><BR>> > int transProcess(){<BR>> ><BR>> > mypid = syscall(SYS_getpid);<BR>> > printLog(logTRANS,"create transProc %i",mypid);<BR>> > return 0;<BR>> > }<BR>> > void startTransProcess(){<BR>> ><BR>> > mypid = syscall(SYS_getpid);<BR>> > printLog(logMODUL1,"create transProc %i",mypid);<BR>> > if(transProcessId>0) transProcessId=0; // transProcessId initialisieren<BR>> > transProcessId=clone(transProcess,<BR>> > &transStack[sizeof(transStack)-10],CLONE_VM|CLONE_FILES|CLONE_FS , 0);<BR>> > if(transProcessId>0){<BR>> > printLog(logMODUL1,"transProc gestartet (PID: %d)",transProcessId);<BR>> > }<BR>> > else {<BR>> > printLog(logMODUL1,"transProc nicht startet (PID: %d)",transProcessId);<BR>> > }<BR>> > };<BR>> ><BR>> > void modul1()<BR>> > {<BR>> > //printLog(logMODUL1,"Modul1");<BR>> ><BR>> > if (!transProcessId) startTransProcess();<BR>> ><BR>> > }<BR>> ><BR>> > int mainprog()<BR>> > {<BR>> > printLog(logMAIN,"Programm start");<BR>> > while(1) {<BR>> ><BR>> > modul1();<BR>> ><BR>> > usleep(10*1000);<BR>> ><BR>> > }<BR>> ><BR>> > return 0;<BR>> > }<BR>> ><BR>> ><BR>> > //<BR>> > -------------------------------------------------------------------------<BR>> > //<BR>> > // -------------------------------------------------------------------------<BR>> > //<BR>> > //<BR>> > //<BR>> > *******************************************************************************************<BR>> > //<BR>> > //<BR>> > //<BR>> > *******************************************************************************************<BR>> > //<BR>> > int main (int argc,char *argv[]){<BR>> ><BR>> > initLogCtrl();<BR>> > mainprog();<BR>> > return 0;<BR>> ><BR>> > }<BR>> ><BR>> ><BR>> > ________________________________<BR>> > Schon gesehen? Tolle Bilder von Sarah Connor gibt es hier! Live Search<BR>> > _______________________________________________<BR>> > This is the Linux C Programming List<BR>> > : http://lists.linux.org.au/listinfo/linuxcprogramming List<BR>> ><BR>> ><BR>> <BR>> <BR>> <BR>> ------------------------------<BR>> <BR>> _______________________________________________<BR>> linuxCprogramming mailing list<BR>> linuxCprogramming@lists.linux.org.au<BR>> http://lists.linux.org.au/listinfo/linuxcprogramming<BR>> <BR>> <BR>> End of linuxCprogramming Digest, Vol 2, Issue 1<BR>> ***********************************************<BR><BR><br /><hr />Machen Sie Ihre E-Mail-Kontakte zu Messenger-Freunden! <a href='http://redirect.gimas.net/?cat=hmtl&n=M1007AI&d=http://messenger.live.de/ersteschritte_adressimport.html' target='_new'>Einfacher Adressimport!</a></body>
</html>