HDTenEightyP/NetNews huggingface dataset:
From: jth@infodyn.com (Jabba The Hutt)
Newsgroups: comp.unix.wizards
Subject: Re: fork() and forget..How?
Keywords: fork() wait() getpid() getppid()
Date: 8 Oct 92 23:02:59 GMT
Article-I.D.: infodyn.1992Oct8.230259.1749
Organization: Information Dynamics, Saratoga, CA, USA

In article <1992Oct07.194020.14527@ctms.gwinnett.com> kirk@ctms.gwinnett.com (R. Kirk Waterhouse) writes:
>
>I am looking for a way to fork() a process and forget about it.
>
>Here is the scenario: 
	.
	.
	.
>-----------     P      ----------- fork()---> Channel 3 }  These are not so much
>|  Main   | --->I      |   My    | fork()---> Channel 2 }  channels, as they are
>| Process |     P ---> | Process | fork()---> Channel 4 }  independtly running
>-----------     E      ----------- fork()---> Channel 1 }  processes that die
>                                   fork()---> Channel x }  when complete.
	.
	.
	.
>-- 
> kirk@ctms.gwinnett.com            |  R. Kirk Waterhouse    DoD# 0626    KD4NKD
>                                   |     It was one of those nights
> if (opinions != employer)         |     when you turn out the lights  
>    must_be(mine);                 |     and everything comes into view - AC/DC


Kirk,

You should learn about a couple of wonderful keys on your keyboard...
the space bar and the Return key.  This article is more than a little
confusing when every time i resize the window, the picture changes!!!

-- 
===============================================================================
                      The ideas and concepts expressed herein
                    are neither those of my employer nor my own
-------------------------------------------------------------------------------
	Michael A. George		Information Dynamics
	jth@infodyn.COM			18337 Swarthmore Drive
	(Voice) 408-370-1572		Saratoga, California 95070
	(Fax)   408-370-1809
		=> World Class Products For World Class Companies <=
===============================================================================
Newsgroups: comp.unix.wizards
From: wieck@jwminhh.hanse.de (Jan Wieck)
Subject: Re: fork() and forget..How?
Organization: Private Site under Mach386
Date: Sat, 10 Oct 1992 02:23:24 GMT

From article <1992Oct07.194020.14527@ctms.gwinnett.com>, by kirk@ctms.gwinnett.com (R. Kirk Waterhouse):
> 
> I am looking for a way to fork() a process and forget about it.
> 
> [...]
>
> won't quite work.
> 
>    if (fork()) {
>       if(child) {
>          ...
>          process_data_and_die();
>          exit(1);
>       }
>       else
>       if (parent) {
>          wait()
>       }
>    }

This wouldn't work in most UNIX-implementations. The reason is the
exit-value of your child. A terminating process has an exit-value.
The father-process can get this using the wait(2).

Most UNIX-implementations store this value in the process-table until
the father get's it. So if you do not use wait(2), the process table
would overrun.

If a father process dies, its childs get INIT as father. INIT normally
is blocked 99.99% of its time on a wait(2). So the only process, that
will become a zombie, is your first one. 

Just change the activities of father and child, and everything's
fine. A good example of that is found in the unbatching process of
bnews.

If this wouldn't fit to you, there is another choice. It seems, that
the exit-value of your child's doesn't matter. So why not using
SIGCHLD? 


Until later, Jan


-- 
# Any language keeps its own misunderstandings; #
# why shouldn't programming languages do?       #
#                                               #
#            wieck@jwminhh.hanse.de (Jan Wieck) #
Newsgroups: comp.unix.wizards
From: jeffj@krfiny.uucp (J. Jonas)
Subject: Re: Disk leakage?
Summary: good point there (zombie vs. exiting)
Organization: Jeff's house of computer pieces
Date: Tue, 13 Oct 1992 15:58:07 GMT

In article <1992Oct12.011446.2336@ulysses.att.com> smb@ulysses.att.com
	(Steven Bellovin) writes:
>In article <1992Oct11.153657.29059@netcom.com>, jtk@netcom.com
	(Jane Valencia) writes:
>> I think you need to start listing particular operating systems.  On
>> the (BSD-based) operating systems I've worked on, the exiting process
>> closes all its files before becoming a zombie.
>
>Note the difference between a zombie process and one that's exiting --
>the latter indicates one that is closing its files.  If one close
>hangs -- and I've seen that happen *many* times -- later file descriptors
>will still be open.

That's a good point.
My understanding from all those UNIX internals courses is that
a Zombie process exists solely to retain its exit status
for the process that will wait(2) for it.
It's a process slot with the exit status and nothing more.
After it has been waited for, the slot is freed and the PID can be
reclaimed.

A process that is "exiting" is busy releaseing all its resources -
files, memory, semaphores, file locks, shared memory, etc.
If the parent process is ignoring sigchild,
it doesn't create a zombie, it vanishes without passing its status
to anybody (see signal(2) for SIGCLD, wait(2)).

If zombie processes could retain resources such as semaphores or
file locks, it could easily lead to deadlock.
When I log out of a system, I certainly want the shell to close all
files and twiddle the status on the serial port to hang up the modem.
That's why I cannot accept the idea of zombie processes
hogging resources.


- Jeffrey Jonas
jeffj@panix.com
-- 
-- 
Jeffrey Jonas

jeffj@synsys.uucp
Newsgroups: comp.unix.wizards
From: jle9162@zeus.tamu.edu (ECKHARDT, JASON LEE)
Subject: vfork
News-Software: VAX/VMS VNEWS 1.41    
Organization: Texas A&M University, Academic Computing Services
Distribution: usa
Date: Wed, 14 Oct 1992 18:34:00 GMT

 I understand why vfork() is "extremely efficient" but why is
it an "architectural blemish?"

Jason.

Newsgroups: comp.unix.wizards
From: cwikla@morrison.wri.com (John Cwikla)
Subject: ndbm help...
Summary: best way to read/write/update files
Keywords: ndbm
Organization: Wolfram Research, Inc.
Date: Fri, 16 Oct 1992 20:56:51 GMT

		I have the following problem.  I am using ndbm to store structures of the following
type as the content.dptr:

typedef struct _IndexType
{
  long index;
  long size;
} IndexType;

  Where index is the offset into another file, and size is the size of the data
located there (in the other file).  I have no problem until I want to replace
the data in the other file.   The data in the other file can be anything, but
consider the case when it is a string.  If I want  to replace the string in the
file with a newer, longer string but store it under the same key, then I have
to move the string in the file to somewhere else.  I would like to keep the size
of the second file to a minimum, so when I do this, I would like to traverse
through the dbm file getting the data in the second and then writing the data
as compact as possible.  This of course requires that I update the contents.dptr's
index field of each key.

  So my problem is the following, according to the man pages, there is no
interlock on the file, so reading and updating is a problem.   What is the
best way to do this?  Should I just create a temporary database write the
changes to that one and then mv the file somehow?  (This brings up the problem
of filling in the .pag files "holes" -- Is the only way to avoid this is to
copy the file myself using fread/fwrite?)

  Any help would be greatly appreciated.

--
o  John L. Cwikla          o
 o  X Programmer            o
  o  Wolfram Research, Inc.  o
   o cwikla@wri.com           o
From: luochen@screen.Princeton.EDU (Luoqi Chen)
Newsgroups: comp.unix.wizards
Subject: Re: how to get a signal when a non-child process dies
Date: 12 Oct 92 16:44:59 GMT
Organization: Princeton University

From article <Bw0Grz.28C@wldelft.nl>, by kool@ws01cso.wldelft.nl (Marc H. Kool):
> What I want is to be able to leave the `master' process, (re)start it
> at a later time and to get a signal when a ``child process'' 
> (which I created with the previous master process) dies.
>
If you are working with SUNOS 4.x, you can attach the 'slave' processes
using the ptrace system call, the master process will be signaled when any of
these slave processes dies. This trick will also work on other flavors of unix
which allow to attach any running process for debugging, IRIX 4.x is one of
them. Unfortunately, BSD4.x and ULTRIX are not in this catagory.

-lq
Newsgroups: comp.unix.wizards
From: oliverm@nevada.edu (Moises Oliveira )
Subject: Mounting with an alternate super block
Keywords: Optical, filesystem, superblock
Organization: Organization? Ha, don't make me laugh
Date: Tue, 13 Oct 1992 20:48:45 GMT

First post to c.u.w.  Let's hope I don't get flamed....

I have a optical disk that contains a large amount of valuable information.
There are no backups. (again no flames, please).  The superblock at
block 8 is no longer readable or writable.

The alternate superblock at block 16 appears to be ok.  I was able to 
fsck the disk using fsck -b 16

fsck scanned the disk and found no problems.  fsck also reported 
generally accurate numbers for files and amount of free sapce.  So I 
believe that the actual files and the alternate superblock are OK.

fsck then tried to copy the alternate superblock at 16 to the 
superblock at 8.  Since block 8 cannot be written to, fsck reports:

CANNOT WRITE: BLK 8
CONTINUE? 

Any attempt to mount the disk involves looking at the superblock.  How can
I mount this disk?  I would think that there would be a way to mount 
using an alternate superblock, but I can't seem to find it.  

My last resort seems to be copying the optical block by block onto an 
optical with a valid block 16.

Is there any hope?  Or will I be spending tomorrow copying an optical block 
by block?
Newsgroups: comp.unix.wizards
From: johnh@nnshh127.uucp (John Hawkins)
Subject: micro or terminal to Unix
Organization: Northern Telecom Inc., Nashville, TN
Distribution: usa
Date: Thu, 15 Oct 1992 20:31:40 GMT

I am interested in finding an 'optimal' way to connect some sort
of pc - DOS - MAC - to a host hp 800 series over a WAN. 
Hmmm well optimal means (in this particular case) the least # 
of packets sent over the WAN, while still having the ability
to function sometimes on a character by character basis. say
running a script remotely that prompts for a char.

I have tried using telnet packages ->ncsa etc. however it seems
that the pc sends every single key press in a packet of ~80 some bytes.
Note:packet size and info from using etherpeek software....

Wish I knew more 'bout these protocols... we are using tcp/ip
over the ethernet WAN.

Any suggestions, leads, flames, yes any reply would be appreciated
as internal charges are based on # of packets sent...
And I always thought that was just funny money....
some people take it seriously....

Thanks
	 
	 John      nvjhh01@NT.COM
	 

-- 
John Hawkins       }) #define disclaimer(x) fprintf(stderr," x\n");
Northern Telecom   }) Communication: Voice 615 734 4468   /* Able was I ere */
200 Athens Way     {)                Fax   615 734 4771   /* I saw Elba     */
Nashville TN 37728 {) Internet:  nvjhh01@NT.COM           /* Columbus ~1492 */
Newsgroups: comp.unix.wizards
From: peter@ferranti.com (peter da silva)
Subject: Re: init output to console - why not?
Organization: Xenix Support, FICC
Date: Thu, 15 Oct 1992 21:44:57 GMT

In article <32943@adm.brl.mil> Perry_Hutchison.Portland@xerox.com writes:
> I think init wants to avoid getting the console (or anything) as its
> controlling terminal, because it doesn't want it or its children (like
> inetd) to receive signals when someone hits ^C while using the console
> as a login terminal.

More importantly, if it gets the console then whoever logs *in* on the console
can't!
-- 
Peter da Silva                                         `-_-'
Ferranti Intl. Ctls. Corp.                              'U` 
Sugar Land, TX  77487-5012           "Heeft u vandaag al uw wolf geknuffeld?"
+1 713 274 5180                       "Tjener, denne ret er stadig levende."
Newsgroups: comp.unix.wizards
From: robert@charon.jpl.nasa.gov (Robert Angelino)
Subject: Makefile Help needed...
Reply-To: robert@triton.Jpl.Nasa.Gov
Organization: Jet Propulsion Laboratory, Pasadena CA
Date: Mon, 12 Oct 1992 19:14:07 GMT

I'm trying to create a makefile that creates a static library that
is dependent on source files that reside in a SCCS directory.  I'm
trying to make it so that make gets the c source, compiles it, and
adds it to the library.	

I have so far failed miserably.  If someone out there has a sample makefile
in which I can go by, I would greatly appreciate it..

thanks


-robert
From: starkg@argon.gas.uug.arizona.edu (Gavin E Stark )
Newsgroups: comp.unix.wizards
Subject: A tape backup question.
Date: 16 Oct 92 23:00:44 GMT
Organization: University of Arizona - Tucson, Arizona


I'd like to be able to backup files one after another by doing something
like the following:


machine% starttape
machine% addtape file1
machine% addtape file2
machine% addtape file3
         .
         .
         .
machine% addtape fileN
machine% endtape


Well, not really like this, it will actually be within a PERL script.  I
need to ensure that each file will be written to the tape before the next
"addtape" (or whatever)   The other reason I need this is because I do not
know all the names of the files I will be backing up beforehand so I cannot
send a filelist to "tar"  I would also like to delete each file as it is
written to tape!

One idea I've had is to take apart the source code to tar and make the
procedures that start an archive, add to an archive, and end an archive into
individual programs.  Is this possible?

ANY help would be greatly appreciated!

-Gavin Stark
starkg@gas.uug.arizona.edu
Newsgroups: comp.unix.wizards
From: subbarao@tex.Princeton.EDU (Kartik Subbarao)
Subject: Re: fork() and forget..How?
Reply-To: subbarao@fc.hp.com
Organization: putchar('I'); for (i = 0; i < 3; i++) putchar('E');
Date: Fri, 9 Oct 1992 14:52:48 GMT

In article <1992Oct8.230259.1749@infodyn.com> jth@infodyn.com (Jabba The Hutt) spews::

>Kirk,
>
>You should learn about a couple of wonderful keys on your keyboard...
>the space bar and the Return key.  This article is more than a little
>confusing when every time i resize the window, the picture changes!!!

Jabba The Hutt,

	You should learn about a wonderful thing known as waste of bandwidth. If 
you don't have the intelligence to comprehend what Kirk was saying, then
don't reply. Go back to slave trade.

	-Kartik
Newsgroups: comp.unix.wizards
From: tym@dibbler.cs.monash.edu.au (Tim MacKenzie)
Subject: Re: Splitting the connect
Organization: Computer Science, Monash University, Australia
X-Newsreader: TIN [version 1.1 PL6]
Date: Sat, 10 Oct 1992 02:12:10 GMT

Mauricio Fernandez (mauricio@DCC.UNICAMP.BR) wrote:
>Hello, I'm trying to split the connect in two phases, first I request
>the connection to an existing socket, and second I wait for its
>confirmation.
>
>Following Stevens I fcntl the socket inmedeatly after creating it with 
>F_SETFL, FCNTL. After that I should obtain an EINPROGRESS errno if the connect
>were to block my process. To find out the connection was accepted I should 
>select my socket for writing. So let's see the code.
>
>
>    sok = socket(AF_INET, SOCK_STREAM, 0);
>    fv = fcntl(sok, F_SETFL, FNDELAY);
>    if(connect(sok, &TheServer, sizeof TheServer) < 0)
>      if(errno == EINPROGRESS){
>	  if(select(MaxFiles, NULL, &Files, NULL, NULL, NULL) < 0){
>	      perror("select");
>	      exit(2);
>	  }
>	  else if(FD_ISSET(sok, &Files))
>	    printf("Connection established\n");

Barry Margolin's followup was also correct, but it did not address what
happens if the connect actually fails...

I recently had some code like this... It didn't work. What
happens if the connection is refused at the other end? (if the server
does not exist). In my experience, the select succeeds, and your code will
give a "Connection established" message. But when you write you will
probably get a SIGPIPE. The only reliable way to find out if you are actaully
connected is to do _another_ connect. This will always give an error (as
far as I could tell), and if the error is EISCONN then you have a connection.

The reason I used a non-blocking connect was to avoid the huge timeout when
a machine goes down and you attempt to connect to it. Is there any other way to
modify the timeout?
-- 
-Tim MacKenzie (tym@dibbler.cs.monash.edu.au)
From: joseph@joebloe.maple-shade.nj.us (Joseph Nathan Hall)
Newsgroups: comp.unix.wizards
Subject: Re: Help : Copy protection
Date: Wed, 14 Oct 92 18:21:06 EDT
Organization: 5 Sigma Software
Reply-To: joseph@joebloe.maple-shade.nj.us
X-Mailer: uAccess - Macintosh Release: 1.5v5


In article <16874@ksr.com> (comp.unix.wizards), dean@ksr.com (Dean Anderson) writes:
) This is nice.  Do you have a weekend/24 hour number?  Is it really 
) necessary?  I have had experience with this kind of protection. I
) came in on the weekend to install it, only to find they weren't
) open on the weekend to give out the code.  I admit, I should have 
) read the fine print before coming in on the weekend, but it still 
) was a pain in my ass.
) I would prefer a help line number that I could call only when I really
) needed help.

But even then ....

It was a weekday, the day before a customer was coming in with some  
software to compile/demonstrate using the Quest Motif that was installed on 
our SPARC.  Most of our users preferred OpenWindows, so it wasn't often
used.  What a nice surprise it was to find that the license we were
running under was a temporary license that had expired.  What an even
nicer surprise it was when we called Quest for the new password and
were told that their "computer was down" and they couldn't give it
to us right away.

We got it squared away about 5 or 6 PM, after hours of haggling. 
By that time there were 4 or 5 of us who were both worried and furious,
including the two salesmen who had come in to help us out.

And still the license daemons continue to proliferate.

I dislike any feature of a product that at best only inconveniences
dishonest folks once (they fail to copy it at all), that at worst doesn't
inconvenience them (they succeed), but which invariably inconveniences 
honest folks like me so long as I own and use that product.

uunet!joebloe!joseph   (609) 273-8200 day   joseph%joebloe@uunet.uu.net
2102 Ryan's Run East        Rt 38 & 41             Maple Shade NJ 08052
-----My employer isn't paying for this, and my opinions are my own-----
Newsgroups: comp.unix.wizards
From: skseo@dbserver.kaist.ac.kr (Seo Sang-Koo)
Subject: Re: Help : Copy protection
Organization: KAIST
X-Newsreader: Tin 1.1 PL5
Date: Wed, 14 Oct 92 03:45:03 GMT

Dean Anderson (dean@ksr.com) wrote:
: [...] 
: The professional pirate sells your software (say in taiwan, korea, europe
: etc).  These are the people who really hurt sales. They resell the software 
: and take sales you should have made, for only the cost of advertising. 
: They are not going to be stopped by copyprotection schemes.  Spend your 
: time finding and prosecuting these folks.
: [...] 

It's not intended to miss the topic of this newsgroup, but I can't 
allow readers of your article to believe as if there are professional pirates
who resell the software in Korea.  It is not true.
Anyway, I don't think it's sane to refer specific name of country. :)

--
Sang-Koo Seo

Database Systems Lab. 		    
Computer Science Dept., KAIST        | Internet: skseo@dbserver.kaist.ac.kr
373-1 Kusong-dong, Yusong-gu, Taejon | Phone   : +82-42-869-5570
305-701, Korea			     | FAX     : +82-42-869-3510
From: terry@cs.weber.edu (A Wizard of Earth C)
Subject: Re: vfork
Organization: Weber State University  (Ogden, UT)
Distribution: usa
Date: Fri, 16 Oct 92 03:51:26 GMT

In article <14OCT199213343576@zeus.tamu.edu> jle9162@zeus.tamu.edu (ECKHARDT, JASON LEE) writes:
> I understand why vfork() is "extremely efficient" but why is
>it an "architectural blemish?"

It's dirty, because it assumes the user will "do the right thing" and exec
afterwards.  It also has the distinct "advantage" of the environment malloc()
for the exec taking place in the parents address space.  Since this address
space is still going to be used by the parent, it is, in effect, a "memory
leak" that persists until the parent exits (under most memory allocation
schemes for UNIX, but not under UNIX-like OS's like MACH and 386BSD, both
of which use the rewritten VM routines).  Under a normal fork, the forking
process "exits" as it is replaced by the exec'ed program, which causes a
resource-track cleanup of memory associated with the "parent" of the
exec'ed process, including the constructed environment for the child used
during the exec call.


					Terry Lambert
					terry@icarus.weber.edu
					terry_lambert@novell.com
---
Any opinions in this posting are my own and not those of my present
or previous employers.
-- 
-------------------------------------------------------------------------------
                                        "I have an 8 user poetic license" - me
 Get the 386bsd FAQ from agate.berkeley.edu:/pub/386BSD/386bsd-0.1/unofficial
-------------------------------------------------------------------------------
Newsgroups: comp.unix.wizards
From: tym@dibbler.cs.monash.edu.au (Tim MacKenzie)
Subject: Re: malloc() and free ()
Organization: Computer Science, Monash University, Australia
X-Newsreader: TIN [version 1.1 PL6]
Date: Sun, 11 Oct 1992 03:19:54 GMT

Rajnish Joshi (c23rrj@kocrsv01.delcoelect.com) wrote:
>  " Yes, in most Unix implementations of free(3), the memory is not returned to
>    the OS. Future malloc(3) calls by that process may reuse 
>    this freed memory."
>MY Question: Since no followup (flames) for the above statement was received,
>              is the above statement TRUE?

Distressingly (sometimes) yes. GNU malloc (with binutils I think) does return
the memory to the system if you don't keep chunks that are at the top of the 
heap...
eg. main(){free(malloc(1000000)); pause();} 
	will allow you to see if your free actually frees.
eg. char *a,*b; a = malloc(1000000); b = malloc(1); free(a); 
	will (usually) not be able to return memory to the system since *b is at
	the top of the heap.

Unfortunately, quite a few programs out there will break if you put in a
smarter malloc since they rely on being able to access free'd memory, or go
over the amount of memory asked for. [SunOS 4.1's ctime() does this :( ]

>     If the above statement is TRUE then why am I able to allocate the entire
>       memory to my application, free half of it back, and make the application
>       wait for some input and still run some other application 
>       that mallocs () ?

What you mean here is not clear... are you allocating all the virtual memory,
all the real memory, or up to the system imposed maximum (which may be
different again). You may just be lucky to have a malloc that 'works'.
--
-Tim MacKenzie (tym@dibbler.cs.monash.edu.au)
From: das@eplunix.UUCP (David Steffens)
Newsgroups: comp.unix.wizards
Subject: Re: DAMN: deleted all my files; saved partition tho'
Date: 8 Oct 92 20:39:59 GMT
Organization: Eaton-Peabody Lab, Boston, MA

In article <1992Oct7.222514.29935@nntpd2.cxo.dec.com>,
alan@nabeth.enet.dec.com (Alan Rollow) writes:
> ... each cylinder group should have a bit map or something to indicate
> which blocks are free.  Only examine those.

Eh?  If the partition was completely wiped, then _all_ the blocks should
be on the free list and the bit map should show all 1's.  How can this help
to figure out which blocks were once allocated, but have since been freed?
-- 
David Allan Steffens       | I believe in learning from past mistakes...
Eaton-Peabody Laboratory   | but why does a good education require so many?
Mass. Eye & Ear Infirmary, 243 Charles Street, Boston, MA 02114
{harvard,mit-eddie}!eplunix!das    Tel (617) 573-3748    Fax (617) 720-4408
Newsgroups: comp.unix.wizards