DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T s

⟦eb3e947c7⟧ TextFile

    Length: 1557 (0x615)
    Types: TextFile
    Names: »sons.c«

Derivation

└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦038380b96⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦038380b96⟧ 
            └─ ⟦this⟧ »sons.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦0732ea0cf⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦0732ea0cf⟧ 
            └─ ⟦this⟧ »../../dtia/release_apollo_2.1/sons.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦25fab149a⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦25fab149a⟧ 
            └─ ⟦this⟧ »../../dtia/release_sun_2.1/sons.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦be254d495⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦be254d495⟧ 
            └─ ⟦this⟧ »../../dtia/release_aix_2.1/sons.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦c67979795⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦c67979795⟧ 
            └─ ⟦this⟧ »../../dtia/release_hp_2.1/sons.c« 

TextFile

#ifndef	lint
#ifndef	DEBUG
static char SCCS_id[] = "@(#)sons.c 2.1 90/08/02 19:05:17  Copyright(c) 1990 by Rational.";
#else
static char SCCS_id[] = "@(#)sons.c DEBUG 2.1 90/08/02 19:05:17  Copyright(c) 1990 by Rational.";
#endif
#endif

#include	"dtia_server.h"


static	int	n_sons=0;
static	int	pid_sons[MAX_CONNECTIONS];
static	int	fd_sons[MAX_CONNECTIONS];
				/*
				 * contain the pid (resp file descriptors)
				 * of all the associated sons.
				 */

void	init_sons()
{
	n_sons=0;
}

int	too_many_sons() {
	return (n_sons == MAX_CONNECTIONS) ;
}

void	look_at_sons() {
	int	pid,found,closed,i;
#ifdef	AIX
	int	status;
#else
	union	wait status;
#endif
	while ((pid=wait3(&status,WNOHANG,(struct rusage *)NULL))>0) {
/*
		fprintf(log_file,"Process %d terminated (status %d): %s",pid,
#ifdef	AIX
		    status,get_time());
#else
		    status.w_status,get_time());
#endif
		fflush(log_file);
*/
					/*
					 * Remove pid (resp fd) from the
					 * set of pids (resp fds). Just a
					 * sequential search and shift one by
					 * one when found. Does not need to
					 * be smarter here because 5 entries
					 * maximum so ....
					 */
		closed = found = FALSE;
		for (i=0;i<n_sons;i++) {
			if (found) {
				pid_sons[i-1]=pid_sons[i];
				fd_sons[i-1]=fd_sons[i];
			}
			found = (pid_sons[i]==pid);
			if ((found)&&(!closed)) {
				close(fd_sons[i]);
				closed=TRUE;
			}
		}
		n_sons--;
	}
}

void	add_son(pid,fd)
int	pid,fd;
{
	if (n_sons<MAX_CONNECTIONS)	{
		pid_sons[n_sons]=pid;
		fd_sons[n_sons++]=fd;
	}
}

int	nb_sons() {
	return n_sons;
}