getmntent.c revision 74ed3e963b20ba6344270ca5163d3cfb1565c0c6
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#include "synonyms.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"
return (MNT_TOOFEW);\
static const char sepstr[] = " \t\n";
static const char dash[] = "-";
typedef struct {
char *buf;
static void
destroy_thread_data(void *arg)
{
}
thread_data->buflen = 0;
}
static char *
{
if (size < MNT_LINE_MAX)
size = MNT_LINE_MAX;
sizeof (thread_data_t), destroy_thread_data);
if (thread_data == NULL)
return (NULL);
thread_data->buflen = 0;
return (NULL);
}
return (thread_data->buf);
}
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;
switch (ret) {
case 0:
case 1:
return (-1);
default:
}
}
char *
mntopt(char **p)
{
char *cp = *p;
char *retstr;
cp++;
cp++;
if (*cp) {
*cp = '\0';
cp++;
}
*p = cp;
return (retstr);
}
char *
{
char tmpopts[MNT_LINE_MAX];
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);
}
/*ARGSUSED*/
int
{
int ret;
switch (ret) {
case 0:
case 1:
return (-1);
default:
return (ret);
}
}
void
{
}
/*
* This is a horrible function, necessary to support this broken interface.
* Some callers of get(ext)mntent assume that the memory is valid even after the
* file is closed. Since we switched to a direct ioctl() interface, this is no
* longer true. In order to support these apps, we have to put the data into a
* thread specific buffer.
*/
static int
{
char *buf;
return (-1);
}
if (isext) {
}
return (0);
}
/*
* 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);
}