


MOUNT(2V)                 SYSTEM CALLS                  MOUNT(2V)



NAME
     mount - mount file system

SYNOPSIS
     #include <sys/mount.h>

     int mount(type, dir, M_NEWTYPE|flags, data)
     char *type;
     char *dir;
     int flags;
     caddr_t data;

SYSTEM V SYNOPSIS
     int mount(spec, dir, rdonly)
     char *spec;
     char *dir;
     int rdonly;

DESCRIPTION
     mount() attaches a file system to a directory.  After a suc-
     cessful  return,  references  to directory _d_i_r will refer to
     the root directory on the newly mounted file system.  _d_i_r is
     a  pointer  to  a  null-terminated  string containing a path
     name.  _d_i_r must exist already, and must be a directory.  Its
     old  contents  are  inaccessible  while  the  file system is
     mounted.

     mount() may be invoked only by the super-user.

     The _f_l_a_g_s argument is constructed by the logical OR  of  the
     following bits (defined in <sys/mount.h>):

     M_RDONLY       mount filesystem read-only.

     M_NOSUID       ignore set-uid bit on execution.

     M_NEWTYPE      this flag must always be set.

     M_GRPID        use   BSD   file-creation   semantics    (see
                    open(2V)).

     M_REMOUNT      change options on an existing mount.

     M_NOSUB        disallow mounts beneath this filesystem.

     Physically write-protected and magnetic  tape  file  systems
     must  be  mounted read-only or errors will occur when access
     times are updated, whether or  not  any  explicit  write  is
     attempted.

     The _t_y_p_e string indicates the type of the filesystem.   _d_a_t_a
     is a pointer to a structure which contains the type specific



Sun Release 4.1     Last change: 5 July 1990                    1






MOUNT(2V)                 SYSTEM CALLS                  MOUNT(2V)



     arguments to mount.  Below is a list of the filesystem types
     supported and the type specific arguments to each:

          4.2
              struct ufs_args {
                      char       *fspec;     /* Block special file to mount */
              };

          "lo"
              struct lo_args {
                      char       *fsdir;     /* Pathname of directory to mount */
              };

          "nfs"
              #include           <nfs/nfs.h>
              #include           <netinet/in.h>
              struct nfs_args {
                      struct sockaddr_in  *addr; /* file server address */
                      fhandle_t  *fh;        /* File handle to be mounted */
                      int        flags;      /* flags */
                      int        wsize;      /* write size in bytes */
                      int        rsize;      /* read size in bytes */
                      int        timeo;      /* initial timeout in .1 secs */
                      int        retrans;    /* times to retry send */
                      char       *hostname;  /* server's hostname */
                      int        acregmin;   /* attr cache file min secs */
                      int        acregmax;   /* attr cache file max secs */
                      int        acdirmin;   /* attr cache dir min secs */
                      int        acdirmax;   /* attr cache dir max secs */
                      char       *netname;   /* server's netname */

              };

          rfs
              struct rfs_args {
                      char       *rmtfs      /* name of remote resource */
                      struct token {
                                 int         t_id;/* token id */
                                 char        t_uname[64];/* domain.machine name */
                      }          *token;     /* Identifier of remote machine */
              };

SYSTEM V DESCRIPTION
     mount() requests that a file system contained on  the  block
     special  file identified by _s_p_e_c be mounted on the directory
     identified by _d_i_r.  _s_p_e_c and _d_i_r point to path names.   When
     mount() succeeds, subsequent references to the file named by
     _d_i_r refer to the root directory on the mounted file system.

     The M_RDONLY bit of _r_d_o_n_l_y is used to control write  permis-
     sion on the mounted file system.  If the bit is set, writing
     is not allowed.  Otherwise, writing is  permitted  according



Sun Release 4.1     Last change: 5 July 1990                    2






MOUNT(2V)                 SYSTEM CALLS                  MOUNT(2V)



     to the access permissions of individual files.

RETURN VALUES
     mount() returns:

     0    on success.

     -1   on failure and sets errno to indicate the error.

ERRORS
     EACCES              Search permission is denied for  a  com-
                         ponent of the path prefix of _d_i_r.

     EBUSY               Another process currently holds a refer-
                         ence to _d_i_r.

     EFAULT              _d_i_r points outside the  process's  allo-
                         cated address space.

     EIO                 The UFS file system has  been  tuned  to
                         use  contiguous  blocks  that are larger
                         than the maximum  block  size  than  the
                         device drivers can support.

     ELOOP               Too many symbolic links were encountered
                         in translating the path name of _d_i_r.

     ENAMETOOLONG        The length of the path argument  exceeds
                         {PATH_MAX}.

                         A  pathname  component  is  longer  than
                         {NAME_MAX}   (see   sysconf(2V))   while
                         {_POSIX_NO_TRUNC}  is  in  effect   (see
                         pathconf(2V)).

     ENODEV              The file system type specified  by  _t_y_p_e
                         is  not  valid or is not configured into
                         the system.

     ENOENT              A component of _d_i_r does not exist.

     ENOTDIR             The file named by _d_i_r is  not  a  direc-
                         tory.

     EPERM               The caller is not the super-user.

     For a 4.2 file system, mount() fails when one of the follow-
     ing occurs:

     EACCES              Search permission is denied for  a  com-
                         ponent of the path prefix of _f_s_p_e_c.




Sun Release 4.1     Last change: 5 July 1990                    3






MOUNT(2V)                 SYSTEM CALLS                  MOUNT(2V)



     EFAULT              _f_s_p_e_c points outside the process's allo-
                         cated address space.

     EINVAL              The super block for the file system  had
                         a  bad  magic  number or an out of range
                         block size.

     EIO                 An I/O error occurred while reading from
                         or writing to the file system.

     ELOOP               Too many symbolic links were encountered
                         in translating the path name of _f_s_p_e_c.

     EMFILE              No space remains in the mount table.

     ENAMETOOLONG        The length of the path argument  exceeds
                         {PATH_MAX}.

                         A  pathname  component  is  longer  than
                         {NAME_MAX}   (see   sysconf(2V))   while
                         {_POSIX_NO_TRUNC}  is  in  effect   (see
                         pathconf(2V)).

     ENOENT              A component of _f_s_p_e_c does not exist.

     ENOMEM              Not enough memory was available to  read
                         the  cylinder  group information for the
                         file system.

     ENOTBLK             _f_s_p_e_c is not a block device.

     ENOTDIR             A component of the path prefix of  _f_s_p_e_c
                         is not a directory.

     ENXIO               The major device number of _f_s_p_e_c is  out
                         of   range  (this  indicates  no  device
                         driver   exists   for   the   associated
                         hardware).

SYSTEM V ERRORS
     EBUSY               The  device  referred  to  by  _s_p_e_c   is
                         currently mounted.

                         There are no more mount table entries.

     ENOENT              The file referred to by _s_p_e_c or _d_i_r does
                         not exist.

     ENOTBLK             _s_p_e_c is not a block special device.

     ENOTDIR             A component of the path prefix of _d_i_r or
                         _s_p_e_c is not a directory.



Sun Release 4.1     Last change: 5 July 1990                    4






MOUNT(2V)                 SYSTEM CALLS                  MOUNT(2V)



     ENXIO               The device referred to by _s_p_e_c does  not
                         exist.

SEE ALSO
     unmount(2V), open(2V), lofs(4S), fstab(5), mount(8)

BUGS
     Some of the error codes need  translation  to  more  obvious
     messages.














































Sun Release 4.1     Last change: 5 July 1990                    5



