Garrett D'Amore writes:
> Therefore I presume that I am doing something incorrect in my setup of this
> structure when I make the call, or that I am interepreting the the returned
> values incorrectly.  Any advice anyone can give would be very greatly
> appreciated.  I was unable to find any sample code that actually uses this
> particular pioctl call to use as a sample.
> 

Ah yes, the lovely VIOC_AFS_SYSNAME call, I know it well...
The trick is the input *and* output buffer for SYSNAME is a pointer to:

+------+-----------------------+
|4bytes|NULL terminated string |
+------+-----------------------+

If the 4byte value is 0 you are doing a get, and the result ends up
at buffer+sizeof(int32). If you are doing a set, then the 4byte value
is a 1 and the string is the value you are setting sysname to.

thus you need to change:

        result = pioctl(NULL, VIOC_AFS_SYSNAME, &afsparams, 0);
        printf("result = %d, sysname = %s\n", result, sysname);
 
To:
        result = pioctl(NULL, VIOC_AFS_SYSNAME, &afsparams, 0);
        printf("result = %d, sysname = %s\n", result, sysname+sizeof(int32));

Pretty gross, huh? :-)

roland

btw. There are a bunch of examples on how to use pioctl and friends in:

/afs/ir.stanford.edu/users/s/c/schemers/WWW/dist/AFSperl.tar.Z

That is my Perl5 AFS module. I actually got it to build under Perl 5.003
a few weeks back, but it still needs cleaning up and testing under AFS 3.4x
and Perl 5.003. I basically have all the pts/kas/fs commands done, just need
someone to do the vos/bos commands. I can't do much typing these days
(or my wrists will fall off :-), so if someone wants to "own" that module
I'll be glad to help them get it going...

Reply via email to