/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <assert.h>
#include <errno.h>
#include <libintl.h>
#include <libcontract.h>
#include <libcontract_priv.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "inetd_impl.h"
/*
* Creates and configures the the contract template used for all inetd's
* methods.
* Returns -1 on error, else the fd of the created template.
*/
static int
create_contract_template(void)
{
int fd;
int err;
return (-1);
}
/*
* Make contract inheritable and make hardware errors fatal.
* We also limit the scope of fatal events to the process
* group. In order of preference we would have contract-aware
* login services or a property indicating which services need
* such scoping, but for the time being we'll assume that most
* non login-style services run in a single process group.
*/
CT_PR_INHERIT|CT_PR_PGRPONLY)) != 0) ||
"Failed to set parameter for contract template: %s"),
return (-1);
}
return (fd);
}
/* Returns -1 on error, else 0. */
int
contract_init(void)
{
return (-1);
}
return (0);
}
void
contract_fini(void)
{
if (active_tmpl_fd != -1) {
(void) close(active_tmpl_fd);
active_tmpl_fd = -1;
}
}
/*
* To be called directly before a service method is forked, this function
* results in the method process being in a new contract based on the active
* contract template.
*/
int
{
int err;
return (-1);
}
return (-1);
}
return (-1);
}
return (0);
}
/*
* To be called in both processes directly after a service method is forked,
* this function results in switching off contract creation for any
* forks done by either process, unless contract_prefork() is called beforehand.
*/
void
contract_postfork(void)
{
int err;
error_msg("Failed to clear active contract template: %s",
}
/*
* Fetch the latest created contract id into the space referenced by 'cid'.
* Returns -1 on error, else 0.
*/
int
{
return (-1);
}
return (0);
}
/* Returns -1 on error (with errno set), else fd. */
static int
{
}
/*
* Adopt a contract. Emits an error message and returns -1 on failure, else
* 0.
*/
int
{
int fd;
int err;
int ret = 0;
/*
* We must not have inherited this contract. That can
* happen if we were disabled and restarted.
*/
debug_msg("Could not adopt contract %ld for %s "
"(could not open ctl file: permission denied).\n",
return (-1);
}
"with %s (could not open ctl file: %s). Events will be "
return (-1);
}
ret = -1;
}
if (err != 0)
return (ret);
}
/* Returns -1 on error, else 0. */
int
{
int fd;
int err;
return (-1);
}
return (-1);
}
return (0);
}