/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* misc.c - miscellaneous and utility functions
*/
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <libscf_priv.h>
#include <libuutil.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <syslog.h>
#include <unistd.h>
#include "startd.h"
void
{
return;
abort();
}
void
{
return;
abort();
}
/*
* Canonify fmri. On success, sets *retp to a string which should be freed
* with startd_free( , max_scf_fmri_size) and returns 0. On failure returns
* EINVAL.
*
* If 'isinstance' is non-zero, then return EINVAL if the FMRI specificies
* anything other than an instance.
*/
int
{
char *cf;
if (isinstance) {
/*
* Verify that this fmri specifies an instance, using
* scf_parse_svc_fmri().
*/
NULL) != 0) {
return (EINVAL);
}
return (EINVAL);
}
}
return (EINVAL);
}
return (0);
}
/*
* int fs_is_read_only(char *, ulong_t *)
* Returns 1 if the given path is that of a filesystem with the ST_RDONLY flag
* set. 0 if ST_RDONLY is unset. -1 if the statvfs(2) call failed. If the
* second parameter is non-NULL, the fsid for the requested filesystem is
* written to the given address on success.
*/
int
{
int err;
do {
if (err)
return (-1);
return (1);
return (0);
}
/*
* int fs_remount(char *)
* Attempt to remount the given filesystem read-write, so that we can unlock
* the repository (or handle other similar failures).
*
* Returns 0 on success, -1 on failure.
*/
int
{
return (-1);
return (0);
}
/*
* void xstr_sanitize(char *s)
* In-place transform any non-alphanumeric characters (or '_') to '_'
* characters.
*/
void
xstr_sanitize(char *s)
{
for (; *s != '\0'; s++)
if (!isalnum(*s) && *s != '_')
*s = '_';
}