*BSD News Article 80903


Return to BSD News archive

Newsgroups: comp.unix.bsd.netbsd.misc
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!metro!metro!asstdc.scgt.oz.au!nsw.news.telstra.net!act.news.telstra.net!psgrain!quack!quack.kfu.com!nsayer
From: nsayer@quack.kfu.com (Nick Sayer)
Subject: Running networker (backups) on NB-sparc
Message-ID: <nCgkY3L@quack.kfu.com>
Sender: news@quack.kfu.com (0000-News(0000))
Organization: The Duck Pond public unix, +1 408 249 9630, log in as guest.
Date: Wed, 16 Oct 1996 23:39:51 UTC
Lines: 81

I have a NetBSD-sparc machine at the office and have successfully (so far
as I can tell) gotten networker to run using the SunOS binary compatability
stuff.

You have to run this little program right before nsrexecd and send the
output to /etc/mtab. This makes the illusion of a SunOS machine complete.
So far as I know, this was the only real magic required.

/*
 * list_fs
 *
 * Copyright 1996, Nick Sayer
 *
 * Redistribution permitted so long as this notice remains.
 * NO WARRANTIES! This code is probably wrong and it is not
 * my fault if it totally destroys your computer or the solar system.
 *
 * Creates a dummy /etc/mtab for networker SunOS 4.x binary running under
 * binary compatability on NetBSD-sparc
 *
 * Run this at boot before networker and perhaps every once in a while
 * from cron.
 *
 * It prints a line for all ffs filesystems in the SunOS mtab
 * format, including the mount device name, mount point, and device
 * major/minor pair.
 *
 */

#include <stdio.h>
#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>
#include <sys/stat.h>

#define MAX_MOUNTS 128


main()
{
  struct statfs filesys[MAX_MOUNTS];
  struct stat st;
  int i,count;

  count=getfsstat(filesys,sizeof(filesys),MNT_NOWAIT);

  printf("#\n# note: This file is used only by networker.\n# It is \
generated by list_fs\n#\n");
  if (count<0)
  {
    perror("getfssstat()");
    exit(1);
  }
  for(i=0;i<count;i++)
  {
    if (strcmp(filesys[i].f_fstypename,"ffs"))
      continue;
    if (stat(filesys[i].f_mntfromname,&st)<0)
    {
      perror("stat()");
      exit(1);
    }
    if (!(st.st_mode&S_IFBLK))
    {
      fprintf(stderr,"Warning! %s is ffs mount from non-block device!\n",
        filesys[i].f_mntonname);
      continue;
    }
    printf("%s\t%s\t4.2\trw,dev=%02x%02x 1 1\n",
      filesys[i].f_mntfromname,
      filesys[i].f_mntonname,
      major(st.st_rdev),
      minor(st.st_rdev));
  }
}

-- 
Nick Sayer <nsayer@quack.kfu.com>  | 
N6QQQ @ N0ARY.#NORCAL.CA.USA.NOAM  | Live Long and Procreate
+1 408 249 9630, log in as 'guest' | 
URL: http://www.kfu.com/~nsayer/   |