[comp.unix.ultrix] nfs-mount c-call problem on Ultrix 4.1

olivert@glance.ch (Oliver Tschichold) (02/13/91)

We are using a uVAX II and a DECsystem 5100 both running Ultrix 4.1.
I would like to mount and umount NFS-directories in a C program.
This is what I have done:


----------cut here------------

#include <stdio.h>
#include <sys/types.h>
#include <sys/fs_types.h>
#include <errno.h>

int i;
char foreign[]="otherhost:/", local[]="/mnt", para[]="";

main()
{
  i=mount(foreign,local,0,GT_NFS,para);
  fprintf(stderr,"mount returned %i, error=%i \n",i,errno);
  perror("mount_test");
};

--------end cut here----------

I compile with
cc -o mount_test mount_test.c
(VAX C)

What's happening?
When I start the program as root, I get the following output:

----------cut here------------
mount returned -1, error=14 
mount_test: Bad address
--------end cut here----------

This happens on both the uVAX II and the DECsystem 5100 trying to
mount the other's root directory. Both servers export their root 
directories in /etc/exports.

Here are some results of my own research:
- The manual mount(2nfs) lists GT_NFS as 0x04. The actual value as
  defined in <sys/fs_types.h> is 0x05, however. Changing this value 
  does not make it work, although the error code changes.
- Adding parameters to the parameter string does not have any impact.

What do I do wrong? Please respond via email. If the responses are
numerous, I'll post a summary.

Thanx -- Oliver

      _______
_____/ _____  \    Glance Ltd.  Software Engineering
______/ / \ \__    
      \_\_/_/      Glance Ltd.
       / /||       Gewerbestrasse 4
    __/ / ||       CH-8162 Steinmaur      Telephone: 41-1-853-3949
   |___/  ||       Switzerland            Telefax:   41-1-853-0809


Oliver Tschichold
dipl. Informatik-Ing. ETH (M. Computer Sci.)
System-Administrator

-- 
Oliver Tschichold					Glance Ltd.
olivert@glance.ch					Gewerbestrasse 4
UUCP: {...}!{uunet,mcsun}!vichy!olivert			8162 Steinmaur
X.400: S=olivert;O=glance;P=switch;A=arCom;C=ch		Switzerland