home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi.bugs
- Path: sparky!uunet!think.com!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!TheImprov!amys
- From: amys@TheImprov.ncsa.uiuc.edu (Amy Swanson)
- Subject: m_fork() failure under 4.0.5
- Message-ID: <C1F1t1.43H@news.cso.uiuc.edu>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: University of Illinois at Urbana
- Date: Mon, 25 Jan 1993 15:31:49 GMT
- Lines: 86
-
-
- 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
-