🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.sgi.bugs
1 messages
1 total messages Started by Amy Swanson Mon, 25 Jan 1993 15:31
m_fork() failure under 4.0.5
#90
Author: Amy Swanson
Date: Mon, 25 Jan 1993 15:31
86 lines
1982 bytes
One of my user's has run into a problem since we upgraded our OS to
IRIX 4.0.5C - is this a bug? 

Thanks,
Amy

=====================
Has anybody had any problems with the subroutine m_fork() since the upgrade
of the OS? I have a simple test program that used to work but failed after 
the upgrade. The source code is included at the end.  Any help would be 
appreciated.


Chris

----------------------------- test_mfork.c ------------------------------
#include <stdio.h>
#include <sys/types.h>
#include <sys/prctl.h>
#include <ulocks.h>
#include <task.h>
#include <errno.h>

#define Min(X,Y) ( (X) < (Y) ? (X) : (Y) )
#define NUM	200000

static void compute();

static int f[NUM];

static int nprocs, chunk;

main()
{
	int	i, ret; 

	for (i=0; i<NUM; i++)
	    f[i] = i;

	print_array(f);

	nprocs = prctl(PR_MAXPPROCS);
	ret = m_set_procs(nprocs);
	if (ret != 0)
	{
	    fprintf(stderr, "m_set_procs returned errno(%d)\n", errno); 
	    exit (-1);
	}
	chunk = NUM/nprocs;

    	ret = m_fork(compute);
	if (ret != 0)
	{
	    fprintf(stderr, "m_fork returned errno(%d)\n", errno); 
	    exit (-1);
	}
    	m_kill_procs();

	print_array(f);
}

static void compute()
{
	int	i, j, start, end;

	while ( (i = m_next()) < nprocs)
	{
	    start = i*chunk;
	    end = Min((i+1)*chunk, NUM);
	    for (j=start; j<end; j++)
		f[j] = j;
	}
}

print_array(f)
int *f;
{
	printf("f[] = (%d ... %d)\n", f[0], f[NUM-1]);
}

--
=========
Amy K. Swanson
SGI Systems Administrator, NCSA
amys@ncsa.uiuc.edu
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads