4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  24  */
  25 
  26 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  27 /*        All Rights Reserved   */
  28 
  29 
  30 /*
  31  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  32  * Use is subject to license terms.
  33  */
  34 
  35 #include        <stdio.h>
  36 #include        <stdio_ext.h>
  37 #include        <limits.h>
  38 #include        <fcntl.h>
  39 #include        <unistd.h>
  40 #include        <stdlib.h>
  41 #include        <string.h>
  42 #include        <stdarg.h>
  43 #include        <sys/types.h>
  44 #include        <sys/stat.h>
  45 #include        <sys/statvfs.h>
  46 #include        <errno.h>
  47 #include        <sys/mnttab.h>
  48 #include        <sys/mntent.h>
  49 #include        <sys/mount.h>
  50 #include        <sys/vfstab.h>
  51 #include        <sys/param.h>
  52 #include        <sys/wait.h>
  53 #include        <sys/signal.h>
  54 #include        <sys/resource.h>
  55 #include        <stropts.h>
  56 #include        <sys/conf.h>
  57 #include        <locale.h>
  58 #include        "fslib.h"
  59 
  60 #define VFS_PATH        "/usr/lib/fs"
  61 #define ALT_PATH        "/etc/fs"
  62 #define REMOTE          "/etc/dfs/fstypes"
  63 
  64 #define ARGV_MAX        16
  65 #define TIME_MAX        50
  66 #define FSTYPE_MAX      8
  67 #define REMOTE_MAX      64
  68 
  69 #define OLD     0
  70 #define NEW     1
  71 
  72 #define READONLY        0
  73 #define READWRITE       1
  74 #define SUID            2
  75 #define NOSUID          3
  76 #define SETUID          4
  77 #define NOSETUID        5
 
 
 784                     gettext("%s: Line in mnttab exceeds %d characters\n"),
 785                     myname, MNT_LINE_MAX-2);
 786                 break;
 787         case MNT_TOOFEW:
 788                 fprintf(stderr,
 789                     gettext("%s: Line in mnttab has too few entries\n"),
 790                     myname);
 791                 break;
 792         case MNT_TOOMANY:
 793                 fprintf(stderr,
 794                     gettext("%s: Line in mnttab has too many entries\n"),
 795                     myname);
 796                 break;
 797         }
 798         exit(1);
 799 }
 800 
 801 void
 802 doexec(char *fstype, char *newargv[])
 803 {
 804         char    full_path[PATH_MAX];
 805         char    alter_path[PATH_MAX];
 806         char    *vfs_path = VFS_PATH;
 807         char    *alt_path = ALT_PATH;
 808         int     i;
 809 
 810         /* build the full pathname of the fstype dependent command. */
 811         sprintf(full_path, "%s/%s/%s", vfs_path, fstype, myname);
 812         sprintf(alter_path, "%s/%s/%s", alt_path, fstype, myname);
 813         newargv[1] = myname;
 814 
 815         if (Vflg) {
 816                 printf("%s -F %s", newargv[1], fstype);
 817                 for (i = 2; newargv[i]; i++)
 818                         printf(" %s", newargv[i]);
 819                 printf("\n");
 820                 fflush(stdout);
 821                 exit(0);
 822         }
 823 
 824         /*
 825          * Try to exec the fstype dependent portion of the mount.
 826          * See if the directory is there before trying to exec dependent
 827          * portion.  This is only useful for eliminating the
 828          * '..mount: not found' message when '/usr' is mounted
 829          */
 830         if (access(full_path, 0) == 0) {
 831                 execv(full_path, &newargv[1]);
 
 | 
 
 
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  24  * Copyright 2016 Joyent, Inc.
  25  */
  26 
  27 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  28 /*        All Rights Reserved   */
  29 
  30 
  31 /*
  32  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  33  * Use is subject to license terms.
  34  */
  35 
  36 #include        <stdio.h>
  37 #include        <stdio_ext.h>
  38 #include        <limits.h>
  39 #include        <fcntl.h>
  40 #include        <unistd.h>
  41 #include        <stdlib.h>
  42 #include        <string.h>
  43 #include        <stdarg.h>
  44 #include        <sys/types.h>
  45 #include        <sys/stat.h>
  46 #include        <sys/statvfs.h>
  47 #include        <errno.h>
  48 #include        <sys/mnttab.h>
  49 #include        <sys/mntent.h>
  50 #include        <sys/mount.h>
  51 #include        <sys/vfstab.h>
  52 #include        <sys/param.h>
  53 #include        <sys/wait.h>
  54 #include        <sys/signal.h>
  55 #include        <sys/resource.h>
  56 #include        <stropts.h>
  57 #include        <sys/conf.h>
  58 #include        <locale.h>
  59 #include        <zone.h>
  60 #include        "fslib.h"
  61 
  62 #define VFS_PATH        "/usr/lib/fs"
  63 #define ALT_PATH        "/etc/fs"
  64 #define REMOTE          "/etc/dfs/fstypes"
  65 
  66 #define ARGV_MAX        16
  67 #define TIME_MAX        50
  68 #define FSTYPE_MAX      8
  69 #define REMOTE_MAX      64
  70 
  71 #define OLD     0
  72 #define NEW     1
  73 
  74 #define READONLY        0
  75 #define READWRITE       1
  76 #define SUID            2
  77 #define NOSUID          3
  78 #define SETUID          4
  79 #define NOSETUID        5
 
 
 786                     gettext("%s: Line in mnttab exceeds %d characters\n"),
 787                     myname, MNT_LINE_MAX-2);
 788                 break;
 789         case MNT_TOOFEW:
 790                 fprintf(stderr,
 791                     gettext("%s: Line in mnttab has too few entries\n"),
 792                     myname);
 793                 break;
 794         case MNT_TOOMANY:
 795                 fprintf(stderr,
 796                     gettext("%s: Line in mnttab has too many entries\n"),
 797                     myname);
 798                 break;
 799         }
 800         exit(1);
 801 }
 802 
 803 void
 804 doexec(char *fstype, char *newargv[])
 805 {
 806         const char *zroot = zone_get_nroot();
 807         char    full_path[PATH_MAX];
 808         char    alter_path[PATH_MAX];
 809         char    *vfs_path = VFS_PATH;
 810         char    *alt_path = ALT_PATH;
 811         int     i;
 812 
 813         /* build the full pathname of the fstype dependent command. */
 814         (void) snprintf(full_path, sizeof (full_path), "%s/%s/%s/%s",
 815             (zroot != NULL ? zroot : ""), vfs_path, fstype, myname);
 816         sprintf(alter_path, "%s/%s/%s", alt_path, fstype, myname);
 817         newargv[1] = myname;
 818 
 819         if (Vflg) {
 820                 printf("%s -F %s", newargv[1], fstype);
 821                 for (i = 2; newargv[i]; i++)
 822                         printf(" %s", newargv[i]);
 823                 printf("\n");
 824                 fflush(stdout);
 825                 exit(0);
 826         }
 827 
 828         /*
 829          * Try to exec the fstype dependent portion of the mount.
 830          * See if the directory is there before trying to exec dependent
 831          * portion.  This is only useful for eliminating the
 832          * '..mount: not found' message when '/usr' is mounted
 833          */
 834         if (access(full_path, 0) == 0) {
 835                 execv(full_path, &newargv[1]);
 
 |