[OpenAFS-devel] Re: OpenAFS: conventions for new @sys? (rs_aix43 s390_linux22)

Chas Williams chas@cmf.nrl.navy.mil
Tue, 07 Nov 2000 08:32:46 -0500


In message <ylg0l4e8z9.fsf@windlord.stanford.edu>,Russ Allbery writes:
>sys is, as near as I've been able to tell, the binary equivalent of:
>    echo '<sysname>'

it is.

>It doesn't change based on fs sysname changes, which is what's wanted.

try this (i borrowed it from the openafs fs.c)  perhaps we could change
sys to do this instead of the just echoing the compiled sysname.  not sure
if anything in the build system relies on sys.

/* cc -I dest/include sys.c -Ldest/lib -Ldest/lib/afs -lsys -lrx -llwp -lcom_err dest/lib/afs/util.a */

#include <stdio.h>
#include <afs/param.h>
#include <netinet/in.h>
#include <afs/vice.h>
#include <afs/venus.h>
#include <errno.h>

#define MAXSIZE 128
char space[MAXSIZE];

int
main()
{
    afs_int32 code;
    struct ViceIoctl blob;
    char *p = space;
    afs_int32 setp = 0;

    blob.in = space;
    blob.in_size = sizeof(afs_int32);
    bcopy(&setp, space, sizeof(afs_int32));
    blob.out = space;
    blob.out_size = MAXSIZE;

    code = pioctl(0, VIOC_AFS_SYSNAME, &blob, 1);
    if (code) {
        fprintf(stderr, "%s\n", error_message(code));
        return 1;
    }
    p = space;
    bcopy(p, &setp, sizeof(afs_int32));
    p += sizeof(afs_int32);
    if (!setp) {
        fprintf(stderr, "sysname name value was found\n");
        return 1;
    }
    printf("%s\n", p);
    return 0;
}