/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#include "lint.h"
#include <mtlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <thread.h>
#include <synch.h>
#include <libc.h>
#include <unistd.h>
#include "tsd.h"
#include <atomic.h>
#include <strings.h>
return (MNT_TOOFEW);\
typedef struct {
char *buf;
static void
{
}
thread_data->buflen = 0;
}
static char *
{
sizeof (thread_data_t), destroy_thread_data);
if (thread_data == NULL)
return (NULL);
thread_data->buflen = 0;
return (NULL);
}
return (thread_data->buf);
}
static int
{
/*
* Ignore specials that don't correspond to real devices to avoid doing
* unnecessary lookups in stat64().
*/
bstat = 1;
} else {
bstat = 0;
}
DIFF(mnt_mountp) ||
DIFF(mnt_fstype) ||
DIFF(mnt_mntopts) ||
;
return (ret);
}
int
{
int ret;
/*
* We collect all of the text strings pointed to by members of the
* user's preferences struct into a single buffer. At the same time
* populate the members of the results struct to point to the
* corresponding words. We then ask the kernel to figure out the
* rest; if this is a non-mntfs file then we handover to
* getmntany_compat().
*/
return (-1);
}
if (mrefp->mnt_special) {
}
if (mrefp->mnt_mountp) {
}
if (mrefp->mnt_fstype) {
}
if (mrefp->mnt_mntopts) {
}
}
case 0:
/* Success. */
return (0);
case MNTFS_EOF:
return (-1);
case MNTFS_TOOLONG:
return (MNT_TOOLONG);
default:
/* A failure of some kind. */
else
return (ret);
}
}
/*
* Common code for getmntent() and getextmntent().
*
* These functions serve to populate a structure supplied by the user. Common
* to both struct mnttab and struct extmnttab is a set of pointers to the
* text itself to be stored in some thread-local storage, and for the kernel to
* populate both this buffer and the structure directly.
*
* If getmntent() passes a file that isn't provided by mntfs then we assume that
* it is a simple text file and give it to getmntent_compat() to parse. For
* getextmntent() we give up; it requires major and minor numbers that only the
* kernel can provide.
*/
static int
{
int ret;
return (-1);
}
/* The buffer wasn't large enough. */
(void) atomic_swap_ulong((unsigned long *)&bufsize,
return (-1);
}
}
switch (ret) {
case 0:
/*
* We were successful, but we may have to enforce getmntent()'s
* documented limit on the line length.
*/
if (command == MNTIOC_GETMNTENT &&
return (MNT_TOOLONG);
else
return (0);
case MNTFS_EOF:
/* EOF. */
return (-1);
default:
/* A non-mntfs file. */
if (command == MNTIOC_GETMNTENT)
else
return (ret);
}
}
int
{
}
/*ARGSUSED*/
int
{
}
char *
mntopt(char **p)
{
char *cp = *p;
char *retstr;
cp++;
cp++;
if (*cp) {
*cp = '\0';
cp++;
}
*p = cp;
return (retstr);
}
char *
{
return (NULL);
/*
* Match only complete substrings. For options
* which use a delimiter (such as 'retry=3'),
* treat the delimiter as the end of the substring.
*/
}
return (NULL);
}
void
{
}
/*
* Compatibility for non-mntfs files. For backwards compatibility, we continue
* to have to support this broken interface. Note that getextmntent() has
* an ioctl() call.
*/
static int
{
char *cp;
return (MNT_TOOLONG);
;
return (0);
}
return (-1);
}
static int
{
int ret;
char *tmp;
return (-1);
}
/* skip leading spaces and comments */
return (ret);
/* split up each field */
/* check for too many fields */
return (MNT_TOOMANY);
return (0);
}