From: UnixOS2 Archive To: "UnixOS2 Archive" Date: Mon, 13 Jan 2003 04:48:19 EST-10EDT,10,-1,0,7200,3,-1,0,7200,3600 Subject: [UnixOS2_Archive] No. 12 ************************************************** Sunday 12 January 2003 Number 12 ************************************************** Subjects for today 1 Re: detach : Thomas E. Dickey" 2 Re: UnixOS2 "enhancements" : Adrian Gschwend" 3 Re: detach : Dave Saville" 4 Re: detach : Dave Saville" 5 Re: detach : Dave Saville" 6 Re: ANN: Pine 4.52 : John Poltorak 7 Re: detach : Dave Saville" 8 Re: isc DHCP client : John Poltorak 9 test : Bart van Leeuwen" 10 isc DHCP client : Bart van Leeuwen" 11 Re: Python home directory : Ted Sikora 12 SYSLOG : John Poltorak 13 Python home directory : John Poltorak 14 Re: Python home directory : Steve Wendt 15 GNU utils : Steve Wendt 16 Re: detach : Csaba" 17 Re: ANN: Pine 4.52 : Nicholas Sheppard 18 Re: ANN: Pine 4.52 : Nicholas Sheppard 19 Re: Python MYSQLdb : G Hudson 20 Re: detach : xyzyx" **= Email 1 ==========================** Date: Mon, 13 Jan 2003 05:59:03 -0500 (EST) From: "Thomas E. Dickey" Subject: Re: detach On Mon, 13 Jan 2003, Dave Saville wrote: > On Sun, 12 Jan 2003 16:52:13 -0500, Thomas Dickey wrote: > > Yeah but...... > > process starts - call it P > > Forks - now have P & P1 > > P1 forks P P1 P2 > > P1 is waiting for P2 (you say) > > P exits - so who is waiting for P1? Whatever you do you will have one > left over so why double fork in the first place? On Solaris at least > the session bounces to init for P1. I'm looking at the quoted fragment of code keeping in mind the way I've used that sort of thing (it looks incomplete, btw). What I've seen (and reading code ;-): p forks, creating p1. p1 forks, creating p2. p2 execs the child (which should be in a new process group for signal-handling). It can run for a while. We don't want to wait. p1 exits as soon as it can - without waiting, leaving p2 an orphan. p waits for the exit status of p1, which is received "soon". Solaris is a special case btw, if you wait for a child process and happen to miss one's exit-status, an orphaned process is created. The double-forking (with waits) is what's generally needed. -- T.E.Dickey http://invisible-island.net ftp://invisible-island.net **= Email 2 ==========================** Date: Mon, 13 Jan 2003 09:39:46 +0100 (CET) From: "Adrian Gschwend" Subject: Re: UnixOS2 "enhancements" On Sat, 11 Jan 2003 15:42:46 +0000, John Poltorak wrote: >> As, I think others have implied, the latest version is not >> always the one you need. > >Well there is no need for UnixOS/2 to include the latest version of an app >if it does not work. That fact that a particular version is included >should indicate that it is, to some extent, 'approved'. I don't take that argument simply because what is good for you might not be good for me. As I pointed out people *will* run into problems with several versions of autoconf for example so sometimes you simply don't have a choice. When you want to compile application x you might need autoconf version 1.2.3 and unfortunately application y needs autoconf version 1.2.4 so what do you want to do? The last version will be lost as soon as you download the latest package. cu Adrian -- Adrian Gschwend at netlabs.org ktk [a t] netlabs.org ------- Free Software for OS/2 and eCS http://www.netlabs.org **= Email 3 ==========================** Date: Mon, 13 Jan 2003 09:48:11 +0000 (GMT) From: "Dave Saville" Subject: Re: detach On Sun, 12 Jan 2003 15:59:59 +0100, Holger Veit wrote: >On Sun, Jan 12, 2003 at 02:16:12PM +0000, Dave Saville wrote: >> Anyone know what the detach command does? I have a problem program >> that works fine if you detach it - so I want to do it myself. >> >> In *nix one would: >> >> close(0) >> close(1) >> close(2) >> >> /* and possibly re-assign */ >> >> if ( fork != 0) >> { >> exit(0) >> } >> >> /* rest of code here */ >> >> But I still get a problem - what am I missing? > >You obviously want a daemon process. Detach - I suppose you mean the CMD >command - starts a new program with a "no_wait" option, so that the parent >process does no longer feel responsible for its child. One part is that >they do no longer share the common "controlling terminal", this is what you >attempt by closing stdin, stdout, and stderr, and then start the child. >In Unix, this is not enough, because there is still the bonding between >parent and child, which is in Unix terminology called a session (the parent >is the "session leader", i.e. responsible for all processes belonging to >its session). As a recipe from Stevens "Unix network programming", the >correct way to create a daemon is the following skeleton: Thanks Holger - Never seen the double fork trick and not sure it buys anything. As for sessions etc. if the "parent" dies then the "child" will revert its session parent to pid 1 (init). At least that's how it works on Solaris and I have written several daemons that seem to work fine with the code I gave. Maybe I should describe the problem :-) I am writing some extensions to ClipView that will ultimately allow cut n paste across machines and OSs. The number of times I have wanted to do that is legion. As clipboards on X are a bit of a pain I am writing the OS/2 code first to get the basics in place. I have a server that takes whatever it gets and stuffs it into the clipboard. That works fine. The client has to run as one of those fake PM processes using DosGetInfoBlocks( &ptib, &ppib); ppib->pib_ultype = 3; Running from a command prompt it works *unless* you try and copy from the same or another vio window at which point I get a semi WPS hang/slow down and cannot kill either my program or the window I tried to copy from. Running from a command prompt with 'detach myprog' cures the problem so, as I cannot rely on someone not invoking the program directly, I decided to try and do whatever detach does internally. Forking and closing 0-2 does not fix it. I am going to try closing everything as per your example next. If I can't get it to work I will have to convert it to a "real" PM process. Thanks for your input and nice to see you back on the list again. -- Regards Dave Saville **= Email 4 ==========================** Date: Mon, 13 Jan 2003 10:01:57 +0000 (GMT) From: "Dave Saville" Subject: Re: detach Just tried closing all handles to FOPEN_MAX 1) Copy from VIO no longer causes problem 2) I get "IFNET$ does not recognise command" popup messages 3) I don't get back the command prompt when the parent exits. We are getting there :-) -- Regards Dave Saville **= Email 5 ==========================** Date: Mon, 13 Jan 2003 10:05:23 +0000 (GMT) From: "Dave Saville" Subject: Re: detach On Sun, 12 Jan 2003 16:52:13 -0500, Thomas Dickey wrote: >On Sun, Jan 12, 2003 at 10:06:38PM +0100, Stefan Neis wrote: >> On Sun, 12 Jan 2003, Holger Veit wrote: >> >> > if ((pid=fork()) != 0) exit(0); /* parent terminates, first child continues */ >> > setsid(); /* become session leader of a new session */ >> > signal(SIGHUP,SIG_IGN); /* make resistent against hangup */ >> > if ((pid=fork()) != 0) exit(0); /* first child terminates, second continues */ >> > chdir("/"); /* optional: set a defined environment */ >> > umask(0); /* optional: set a defined environment */ >> > for (int i=0; i> > close(i); /* close all handles */ >> >> >> Anybody knows what benefit the second fork is supposed to give me? >> So far, I just see it as creating an unwanted bond between the new >> session leader and its child for no visible (to me) benefit? >> > >That's a technique used to create an in-between process which waits for >the exit status of the "real" child, allowing the parent to go off and >not have to worry about waiting for it. On Unix, if you don't wait for >the exit-status from a child process, the result is an orphaned process >which uses up some resources. Yeah but...... process starts - call it P Forks - now have P & P1 P1 forks P P1 P2 P1 is waiting for P2 (you say) P exits - so who is waiting for P1? Whatever you do you will have one left over so why double fork in the first place? On Solaris at least the session bounces to init for P1. -- Regards Dave Saville **= Email 6 ==========================** Date: Mon, 13 Jan 2003 10:14:07 +0000 From: John Poltorak Subject: Re: ANN: Pine 4.52 On Mon, Jan 13, 2003 at 08:48:21PM +1100, Nicholas Sheppard wrote: > On Sun, 12 Jan 2003, John Poltorak wrote: > > > Just for aesthetic reasons, and possibly for any analysis program which > > expects things in a standard format, it would be preferable to have the > > output slightly re-arranged. Here's the sort of output I got:- > > ipop3d's format is the prerogative of the folks at the University of > Washington; if you want something different you have to either convince > them that it should be changed or compile your own special version. Sorry, I didn't realise that you were using standard code. Do you have contact details for the ipop3d developers? BTW one thing I have noticed is that ipop3d leaves a zero length file called 10000001.tmp after it has been called. The number in the file name gets incremented after each call so you could end up with a large number of such files on a busy system. > Nicholas S. > > |\ Location: Wollongong, Australia | CONSERVATIVE, n. A statesman who is > |\ E-mail: nps at zeta.org.au | enamored of existing evils, as > | WWW: http://www.zeta.org.au/~nps | distinguished from the Liberal, who > | ---> Cynicism & Negativity | wishes to replace them with others. > > - Ambrose Bierce -- John **= Email 7 ==========================** Date: Mon, 13 Jan 2003 11:34:42 +0000 (GMT) From: "Dave Saville" Subject: Re: detach On Mon, 13 Jan 2003 05:59:03 -0500 (EST), Thomas E. Dickey wrote: >On Mon, 13 Jan 2003, Dave Saville wrote: > >> On Sun, 12 Jan 2003 16:52:13 -0500, Thomas Dickey wrote: >> >> Yeah but...... >> >> process starts - call it P >> >> Forks - now have P & P1 >> >> P1 forks P P1 P2 >> >> P1 is waiting for P2 (you say) >> >> P exits - so who is waiting for P1? Whatever you do you will have one >> left over so why double fork in the first place? On Solaris at least >> the session bounces to init for P1. > >I'm looking at the quoted fragment of code keeping in mind the way I've >used that sort of thing (it looks incomplete, btw). What I've seen (and >reading code ;-): > p forks, creating p1. > p1 forks, creating p2. > p2 execs the child (which should be in a new process group for > signal-handling). It can run for a while. We don't want > to wait. > p1 exits as soon as it can - without waiting, leaving p2 an > orphan. > p waits for the exit status of p1, which is received "soon". > >Solaris is a special case btw, if you wait for a child process and happen >to miss one's exit-status, an orphaned process is created. The >double-forking (with waits) is what's generally needed. So in your example p2 is left orphaned. If you just do one fork p1 is left as an orphan - I fail to see the difference. (I am not doing a fork exec BTW is all one lump of C) -- Regards Dave Saville **= Email 8 ==========================** Date: Mon, 13 Jan 2003 11:55:13 +0000 From: John Poltorak Subject: Re: isc DHCP client On Mon, Jan 13, 2003 at 12:38:29PM +0100, Bart van Leeuwen wrote: > > Hi folks, > > now that I finaly can post.... > > I'm using unixos2 to port the dhcp client/server from http://www.isc.org, > so far I'm quiet happy with it.. Excellent! If you manage to get it working, you may be able to make some progress with another ISC program - BIND... > but I run into missing library functions, I've looked into the libc sources > and found out that the missing functions are really simple, > compiled them created my own lib and it 'worked' as in I got the stuff > compiled, I'm not ready for testing yet, but its a start.. > but my question now, how is adding of missing libc functions coordinated ? > because like this we end up having private implementations of missing > functions which is not a good idea I think. This is a major problem when we have to many devlopers working in isolation. My personal view is that we should try to incorporate missing libc functions into Posix/2... Of course that puts the burden of maintaining these functions on Stefan, and it may well be a time consuming task. I can't think how else to manage ot maintain them. > With Regards > Bart van Leeuwen -- John **= Email 9 ==========================** Date: Mon, 13 Jan 2003 12:22:08 +0100 From: "Bart van Leeuwen" Subject: test Sory guys for this useless message just want to test if I finaly can post.. With Regards Bart van Leeuwen **= Email 10 ==========================** Date: Mon, 13 Jan 2003 12:38:29 +0100 From: "Bart van Leeuwen" Subject: isc DHCP client Hi folks, now that I finaly can post.... I'm using unixos2 to port the dhcp client/server from http://www.isc.org, so far I'm quiet happy with it.. but I run into missing library functions, I've looked into the libc sources and found out that the missing functions are really simple, compiled them created my own lib and it 'worked' as in I got the stuff compiled, I'm not ready for testing yet, but its a start.. but my question now, how is adding of missing libc functions coordinated ? because like this we end up having private implementations of missing functions which is not a good idea I think. With Regards Bart van Leeuwen **= Email 11 ==========================** Date: Mon, 13 Jan 2003 15:40:24 -0500 From: Ted Sikora Subject: Re: Python home directory John Poltorak wrote: > Where does Python normally get installed on a Unix system? I'm assuming an > FHS compliant location, BTW. /usr > > Is there any reason why the OS/2 port would not work if installed in the > same location? - given that the DLL is on the libpath and the required > environment variables are set correctly... > None provided the env settings reflect this. .. but Andrew prefers /Apps as does Apache so it just made things neater. I have Zope and MySQL there too. Makes backups and migrations a snap. Unzip and run. -- Ted Sikora tsikora at ntplx.net **= Email 12 ==========================** Date: Mon, 13 Jan 2003 16:29:47 +0000 From: John Poltorak Subject: SYSLOG Does anyone know where I can find the definitive home of SYSLOG? -- John **= Email 13 ==========================** Date: Mon, 13 Jan 2003 17:37:48 +0000 From: John Poltorak Subject: Python home directory Where does Python normally get installed on a Unix system? I'm assuming an FHS compliant location, BTW. Is there any reason why the OS/2 port would not work if installed in the same location? - given that the DLL is on the libpath and the required environment variables are set correctly... -- John **= Email 14 ==========================** Date: Mon, 13 Jan 2003 17:50:08 -0800 (PST) From: Steve Wendt Subject: Re: Python home directory On Mon, 13 Jan 2003, John Poltorak wrote: > Where does Python normally get installed on a Unix system? I'm assuming an > FHS compliant location, BTW. /usr/bin/python **= Email 15 ==========================** Date: Mon, 13 Jan 2003 18:05:44 -0800 (PST) From: Steve Wendt Subject: GNU utils Looks like the GNU fileutils, shellutils, and textutils have all been merged into the GNU core utils: http://www.gnu.org/software/coreutils/ Something similar has been done with the various internet utils: http://www.gnu.org/software/inetutils/inetutils.html **= Email 16 ==========================** Date: Mon, 13 Jan 2003 19:43:30 -0000 From: "Csaba" Subject: Re: detach On 13 Jan 2003, at 11:34, Dave Saville wrote: > On Mon, 13 Jan 2003 05:59:03 -0500 (EST), Thomas E. Dickey wrote: [snip] > > > >I'm looking at the quoted fragment of code keeping in mind the way I've > >used that sort of thing (it looks incomplete, btw). What I've seen (and > >reading code ;-): > > p forks, creating p1. > > p1 forks, creating p2. > > p2 execs the child (which should be in a new process group for > > signal-handling). It can run for a while. We don't want > > to wait. > > p1 exits as soon as it can - without waiting, leaving p2 an > > orphan. > > p waits for the exit status of p1, which is received "soon". > > [snip] > > So in your example p2 is left orphaned. If you just do one fork p1 is > left as an orphan - I fail to see the difference. (I am not doing a > fork exec BTW is all one lump of C) > I'm quoting from "Advanced Programming in the Unix environment" by Stevens: 1. The first thing to do is call fork and have the parent exit. This does several things. First, if the daemon was started as a simple shell command, having the parent terminate makes the shell think that the command is done. (He's talking about "p1" here, i.e. a daemon that is started by another process. The "double fork" trick is needed when a process makes a daemon of itself.) The difference is that in your example (one fork) p1 may or may not be orphaned, depending on the behaviour of p (which may or may not terminate). If p continues to run (maybe because it's a shell), p1 will *not* become an orphan. If p1 terminates while p still runs, the system has to keep its exit status; p1 becomes a zombie. Therefore, the "double fork" is a way to avoid _zombies_ . Disclaimer: I'm not an Unix programmer, I only play one on weekends. -- Ceci n'est pas un .signature **= Email 17 ==========================** Date: Mon, 13 Jan 2003 20:48:21 +1100 (AED) From: Nicholas Sheppard Subject: Re: ANN: Pine 4.52 On Sun, 12 Jan 2003, John Poltorak wrote: > Just for aesthetic reasons, and possibly for any analysis program which > expects things in a standard format, it would be preferable to have the > output slightly re-arranged. Here's the sort of output I got:- ipop3d's format is the prerogative of the folks at the University of Washington; if you want something different you have to either convince them that it should be changed or compile your own special version. > I wondered if there was anything like a debug flag which would generate a > lot of msgs for syslog, such as number of emails transferred. Nope. ipop3d has pretty much no configuration options. Nicholas S. |\ Location: Wollongong, Australia | CONSERVATIVE, n. A statesman who is |\ E-mail: nps at zeta.org.au | enamored of existing evils, as | WWW: http://www.zeta.org.au/~nps | distinguished from the Liberal, who | ---> Cynicism & Negativity | wishes to replace them with others. - Ambrose Bierce **= Email 18 ==========================** Date: Mon, 13 Jan 2003 21:38:09 +1100 (AED) From: Nicholas Sheppard Subject: Re: ANN: Pine 4.52 On Mon, 13 Jan 2003, John Poltorak wrote: > Do you have contact details for the ipop3d developers? http://www.cac.washington.edu/pine or comp.mail.pine on Usenet. > BTW one thing I have noticed is that ipop3d leaves a zero length file > called 10000001.tmp after it has been called. The number in the file name > gets incremented after each call so you could end up with a large number > of such files on a busy system. Has been put on my list to be fixed. Nicholas S. |\ Location: Wollongong, Australia | CONSERVATIVE, n. A statesman who is |\ E-mail: nps at zeta.org.au | enamored of existing evils, as | WWW: http://www.zeta.org.au/~nps | distinguished from the Liberal, who | ---> Cynicism & Negativity | wishes to replace them with others. - Ambrose Bierce **= Email 19 ==========================** Date: Mon, 13 Jan 2003 22:22:44 -0500 From: G Hudson Subject: Re: Python MYSQLdb Does anyone know where I can find a binary MYSQLdb? **= Email 20 ==========================** Date: Mon, 13 Jan 2003 22:41:05 -0600 (CST) From: "xyzyx" Subject: Re: detach On Sun, 12 Jan 2003 14:16:12 +0000 (GMT), Dave Saville wrote: >Anyone know what the detach command does? I have a problem program >that works fine if you detach it - so I want to do it myself. 4os2 is open source now, maybe you can check how they implemented the DETACH command. paul