Jim Helman (jimh++at++surreal)
Thu, 04 Nov 93 14:12:55 -0800
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++at++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);
}
}
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:05 PDT