From guest  Thu Nov  4 13:28:37 1993
Return-Path: <granieri@babar.cis.upenn.edu>
Posted-Date: Thu, 04 Nov 93 16:27:44 -0500
Message-Id: <9311042127.AA23405@graphics.cis.upenn.edu>
To: info-performer
Cc: Jim Helman <jimh@surreal>
Subject: using a pfNewDPool between unrelated processes 
Date: Thu, 04 Nov 93 16:27:44 -0500
From: John Granieri <granieri@babar.cis.upenn.edu>
Status: OR


Hello:

I'm trying to use a datapool between two unrelated processes (one is
just a slightly modified version of perfly, the other is a 3D GL
program). My problem is this:

the perfly process creates the datapool correctly, but the other
process can't attach to it. errno is "Device or resource busy" after
calling pfAttachDPool in the other process. 

Here's the code:

in modified perfly:
....
    /* create shared memory */	
    jackpool = pfNewDPool(32*1024, "jackperf");
    
    jackup = (JackUpdate*)pfDPoolAlloc(jackpool,sizeof(JackUpdate), 1);
    jackup->frame = -1;
    jackfigs = (FigureUpdate*)pfDPoolAlloc(jackpool,
					sizeof(FigureUpdate)*MAX_FIGURE, 2);
    jackjoints = (JointUpdate*)pfDPoolAlloc(jackpool, 
					sizeof(JointUpdate)*MAX_JOINT, 3);
    pfDPoolUnlock((void*)jackup);
    pfDPoolUnlock((void*)jackfigs);
    pfDPoolUnlock((void*)jackjoints);

This seems to work, and the arena file is created rw-rw-rw- in
/usr/tmp

Then, in other process: (the other process is a GL-based program, with
it's own run-time database, not using Performer)

    static int p=0;

    if (!p) {
	pfInit();
	p = 1;
    }
    if ((jackpool=pfAttachDPool("jackperf"))==NULL) {
	printf("\ncan't attach to performer datapool\n");
	return 0;
    }


It never attaches, even after repeatedly calling the above code. Any
ideas?
Thanks

-John




From guest  Thu Nov  4 14:12:59 1993
Message-Id: <9311042212.AA27860@surreal.asd.sgi.com>
To: John Granieri <granieri@babar.cis.upenn.edu>
Cc: info-performer
Subject: Re: using a pfNewDPool between unrelated processes 
In-Reply-To: Your message of "Thu, 04 Nov 93 16:27:44 EST."
             <9311042127.AA23405@graphics.cis.upenn.edu> 
Date: Thu, 04 Nov 93 14:12:55 -0800
From: Jim Helman <jimh@surreal>
Status: O


It should work.  Try the following simple test program.

	dpool create &
	dpool attach &

Also check the permissions on the file created in /usr/tmp or
try running as root.  It could be a umask issue.

rgds,

-jim helman

jimh@surreal.asd.sgi.com
415/390-1151



#include <stdio.h>
#include "pr.h"

int
main(int argc, char *argv[])
{
    pfDataPool *dpool;
    char *name = "dpooltest";
    long *ptr;

    if (argc < 2)
	goto usage;

    if (argv[1][0] == 'c')
    {
	printf("creating dpool %s\n", name);
	dpool = pfNewDPool(1024, name);
	if (dpool == NULL)
	{
	    perror("couldn't create dpool");
	    exit(-1);
	}
	ptr = (long *) pfDPoolAlloc(dpool, 16, 5);
	if (ptr == NULL)
	{
	    perror("couldn't alloc from dpool");
	    exit(-1);
	}
	while (1)
	{
	    pfDPoolLock(ptr);
	    (*ptr)++;
	    pfDPoolUnlock(ptr);
	    fprintf(stderr, "%d\n", *ptr);
	}
	exit(0);
    }
    else if (argv[1][0] == 'a')
    {
	printf("attaching to dpool %s\n", name);
	dpool = pfAttachDPool(name);
	if (dpool == NULL)
	{
	    perror("couldn't attach to dpool");
	    exit(-1);
	}
	ptr = (long *)pfDPoolFind(dpool, 5);
	if (ptr == NULL)
	{
	    perror("couldn't find ID in dpool");
	    exit(-1);
	}
	while (1)
	{
	    pfDPoolLock(ptr);
	    *ptr = - *ptr;
	    pfDPoolUnlock(ptr);
	}
	exit(0);
    }
    else
    {
    usage:
	printf("usage: dpool.fun [create|attach]\n");
	exit(-1);
    }
}




From guest  Fri Nov  5 16:18:14 1993
Date: Fri, 5 Nov 1993 16:18:41 -0800
From: hitchner@netcom.com (Lew Hitchner)
Message-Id: <199311060018.QAA09042@mail.netcom.com>
To: granieri@babar.cis.upenn.edu, info-performer
Subject: Re:  using a pfNewDPool between unrelated processes
Status: OR

This might seem obvious or silly, but are you running both processes in
the same working directory?  If not, then they are each using the file
"./jackperf" which will not be the same for each process.  Try
something like "/usr/tmp/jackperf" instead.  I made the same mistake
myself when I first tried it.

	Lew Hitchner
	Xtensory Inc.
	Scotts Valley, CA



From guest  Fri Jul  1 11:10:35 1994
From: greg@vsl.ist.ucf.edu (Greg Wiatroski)
Message-Id: <9407011810.AA25811@onyx.vsl.ist.ucf.edu>
To: info-performer@sgi.sgi.com
Subject: pfDataPools
Status: OR


I've been having some problems using pfDataPools.  In most cases I get an error 
telling me that the pfDataPoolAttach call failed.  The only way I can successfully attach is if the "attach" call is made before pfInit() (which is a violatioin of Performer rules), and if I am not using a loadFlt or loadFile call.  Has any one been able 
to use this function successfully?  I've tried on both Irix 4 and 5 versions of 
the os.  I also passed a sample program demonstrating my problem to the Performer info hotline team, but it's been over a month and a half and they still t returned an answer.
Can anybody help me out here?


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Greg Wiatroski													
Institute for Simulation and Training
University of Central Florida
<greg@vsl.ist.ucf.edu>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=




