/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifdef _FILE_OFFSET_BITS
#endif /* _FILE_OFFSET_BITS */
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <libcontract.h>
#include <libcontract_priv.h>
#include <libuutil.h>
#include <limits.h>
#include <procfs.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include "startd.h"
void
{
int err;
if (err)
"failed to abandon contract %ld: %s\n", ctid,
}
int
{
"%s: Could not signal all contract members: %s\n", fmri,
return (-1);
}
return (0);
}
{
ct_stathdl_t s;
uint_t n;
int err;
/*
* 2. Acquire any contracts we should have inherited. First, find the
* contract we belong to, then get its status.
*/
return (-1);
}
"unable to adopt contracts: %s\n",
return (-1);
}
return (-1);
}
/* 3. Go about adopting our member list. */
if (err) {
return (-1);
}
ct_status_free(s);
return (-1);
}
if (nctids == 0) {
/*
* We're booting, as a svc.startd which managed to fork a
* child will always have a svc.configd contract to adopt.
*/
ct_status_free(s);
return (-1);
}
/*
* We're restarting after an interruption of some kind.
*/
st->st_initial = 0;
/*
* 3'. Loop through the array, adopting them all where possible, and
* noting which one contains svc.configd (via a cookie vlaue of
* CONFIGD_COOKIE).
*/
for (n = 0; n < nctids; n++) {
int ccfd;
O_WRONLY)) < 0) {
continue;
}
O_RDONLY)) < 0) {
continue;
}
continue;
}
"status; unable to fetch cookie: %s\n", ctids[n],
continue;
}
configd_ctid = ctids[n];
}
ct_status_free(s);
return (configd_ctid);
}
int
{
int fd;
int ret;
if (fd < 0)
return (1);
if (ret != 0)
return (1);
if (ret != 0)
return (1);
if (num == 0)
return (1);
else
return (0);
}
typedef struct contract_bucket {
/*
* contract_hash is a hash table of contract ids to restarter instance
* IDs. It can be used for quick lookups when processing contract events,
* because the restarter instance lock doesn't need to be held to access
* its entries.
*/
static contract_bucket_t *
{
int hash;
return (bp);
}
static void
{
}
static contract_entry_t *
{
return (NULL);
return (ce);
}
return (NULL);
}
static void
{
int r;
assert(r == 0);
}
void
{
int i;
for (i = 0; i < CI_HASH_SIZE; i++)
&mutex_attrs);
}
void
{
}
void
{
}
}
/*
* int lookup_inst_by_contract()
* Lookup the instance id in the hash table by the contract id.
* Returns instid if found, -1 if not. Doesn't do a hold on the
* instance, so a check for continued existence is required.
*/
int
{
return (id);
}