specials.c revision 21d7f835c9bac5f9e80c72fc972ee5b288845983
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* specials.c - knowledge of special services
*
* svc.startd(1M) has duties that cannot be carried out without knowledge of the
* transition of various services, such as the milestones, to their online
* states. Hooks are called with the restarter instance's ri_lock held, so
* operations on all instances (or on the graph) should be performed
* asynchronously.
*/
#include <assert.h>
#include <errno.h>
#include <libintl.h>
#include <limits.h>
#include <locale.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <time.h>
#include <zone.h>
#include "startd.h"
void
{
}
static void
{
static int once;
char *locale;
/*
* /usr, with timezone and locale data, is now available.
*/
if (!st->st_log_timezone_known) {
tzset();
}
if (!st->st_log_locale_known) {
} else {
}
(void) textdomain(TEXT_DOMAIN);
}
if (once)
return;
/*
* ctime(3C) ends with '\n\0'.
*/
once++;
}
static void
{
"executed\n");
/*
* Are / and /var really writeable?
*/
case 1:
return; /* still read-only: install / ro root */
case 0:
break;
case -1:
default:
break;
}
case 1:
"read-only after system/filesystem/minimal\n");
if (fs_remount("/var"))
"filesystem remount failed\n");
}
break;
case 0:
break;
case -1:
default:
break;
}
/*
* Clear (dead) entries and record boot time.
*/
/*
* Reinitialize the logs to point to LOG_PREFIX_NORMAL.
*/
log_init();
/*
*/
} else {
switch (errno) {
case EPERM:
case ESRCH:
"Could not signal init: %s.\n",
break;
case EINVAL:
default:
}
}
}
/*
* Take pending snapshots and create a svc.startd instance.
*/
}
static void
{
int r;
/*
* Un-set the special reconfig reboot property.
*/
r = libscf_set_reconfig(0);
switch (r) {
case 0:
case ENOENT:
break;
case EPERM:
case EACCES:
case EROFS:
"property: %s.\n", strerror(r));
break;
default:
bad_error("libscf_set_reconfig", r);
}
}
static service_hook_assn_t special_svcs[] = {
{ "svc:/system/filesystem/root:default",
{ "svc:/system/filesystem/minimal:default",
{ "svc:/milestone/single-user:default",
};
void
{
int i;
for (i = 0; i < sizeof (special_svcs) / sizeof (service_hook_assn_t);
i++)
return;
}
}