/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include "startd.h"
/*
* The service deathrow mechanism addresses the problem of removing services
* from a non accessible SMF repository. In this case, we can't simply use the
* "SVCCFG_REPOSITORY=$ROOT/etc/svc/repository.db svccfg delete service_fmri"
* command as the alternate repository format is not committed and could be
* incompatible with the local SMF commands version.
*
* directory that lists the FMRIs that need to disappear from the repository
* when the system that uses this root directory boots up.
* root case.
*
* and for all FMRIs listed in this file, the service is not configured and
* dependencies on it are forced satisfied (during svc.startd init time only).
*
* Than manifest-import service will actually, as first task, delete the
* manifest hash entry from the repository.
*
*/
/*
* These data structures are unprotected because they
* are modified by a single thread, at startup time.
* After initialization, these data structures are
* used only in read mode, thus requiring no protection.
*/
/* list of deathrow fmris, created from the file SVC_DEATHROW_FILE */
typedef struct deathrow {
char *fmri;
} deathrow_t;
static deathrow_t *fmri_in_deathrow_internal(const char *);
static void deathrow_add(const char *);
static void
{
}
static void
{
}
void
{
char *line;
char *fmri;
char *manifest;
char *pkgname;
unsigned int line_parsed = 0;
continue;
}
"Deathrow not processed. "
"Error opening file (%s): %s\n",
}
return;
}
if (deathrow_pool == NULL) {
uu_die("deathrow_init couldn't create deathrow_pool");
}
if (deathrow_list == NULL) {
uu_die("deathrow_init couldn't create deathrow_list");
}
/*
* A deathrow file line looks like:
* <fmri>< ><manifest path>< ><package name><\n>
* (field separator is a space character)
*/
*line = '\0';
line_parsed++;
if (sz > 0) {
/* remove linefeed */
}
*manifest = '\0';
manifest++;
*pkgname = '\0';
pkgname++;
}
}
}
"Deathrow parser <%s><%s><%s>\n",
/* fmri is not in list, add fmri */
}
} else {
"Deathrow error processing file (%s). "
"Skipping line %u.\n",
}
*line = '\0';
}
}
}
void
{
deathrow_t *d;
if (deathrow_handling_status == B_FALSE) {
return;
}
startd_free(d, sizeof (deathrow_t));
}
}
static void
{
deathrow_t *d;
d = startd_alloc(sizeof (deathrow_t));
}
static deathrow_t *
{
deathrow_t *d;
d = uu_list_next(deathrow_list, d)) {
return (d);
}
}
return (NULL);
}
{
if (deathrow_handling_status == B_FALSE) {
return (B_FALSE);
}
}