/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#include <atomic.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <locale.h>
#include <libintl.h>
#include <zone.h>
#include <libzonecfg.h>
#include <dlfcn.h>
static void init_file(void);
static void counter_set(int fd);
static void walk_zones(int get);
/*
* There are undocumeted command line options:
* -l list the value of semaphore.
*/
int
{
int arg;
(void) textdomain(TEXT_DOMAIN);
switch (arg) {
case 'a':
all = 1;
break;
case 'l':
get = 1;
break;
case 'I':
init = 1;
break;
default:
gettext("Usage: tzreload [-a]\n"));
exit(1);
}
}
if (init) {
init_file();
return (0);
}
if (all)
else
return (0);
}
/*
*
* that the file is created but no disk block is allocated (empty file).
* If apps mmap'ed the file at the very moment, it succeeds but accessing
* the memory page causes a segfault since disk block isn't yet allocated.
* To avoid this situation, we create a temp file which has pagesize block
* assigned, and then rename it to tzsync.
*/
static void
init_file(void)
{
char *buf;
/* We don't allow to re-create the file */
exit(1);
}
gettext("failed to create a temporary file.\n"));
exit(1);
}
exit(1);
}
gettext("failed to create tzsync file, %s\n"),
goto errout;
}
/* link it */
} else {
}
exit(1);
}
/*
* Unplivileged apps may fail to open the file until the chmod
* below succeeds. However, it's okay as long as open() fails;
* ctime() won't cache zoneinfo until file is opened and mmap'd.
*/
gettext("failed to change permission of %s\n"),
(void) unlink(TZSYNC_FILE);
exit(1);
}
}
/*
*
* zname name of zone (NULL if no need to consider zones)
* zroot zone's root path
*/
static void
{
int fd;
exit(1);
}
gettext("Can't open file %s, %s\n"),
exit(1);
}
if (get) {
} else {
/* let cron reschedule events */
}
}
/*
* Get semaphore value and print.
*/
static void
{
if (addr == MAP_FAILED) {
gettext("Error mapping semaphore: %s\n"),
exit(1);
}
else
}
/*
* Increment semaphore value.
*/
static void
{
MAP_SHARED, fd, 0);
if (addr == MAP_FAILED) {
gettext("Error mapping semaphore: %s\n"),
exit(1);
}
/*LINTED*/
}
/*
* Walk through running zones and call doit() for each zones.
*
* Note: we call zone_get_rootpath() indirectly using dlopen().
* This is because tzreload resides under /sbin and needs to run
* without /usr (ie /usr/lib/libzonecfg.so.1). The reason tzreload
* being in /sbin is that tzreload -I may be called to create
* isn't necessary. Therefore, libzonecfg is dlopen'd when required
* rather than having static linkage to it which would make tzreload
* unable to run without /usr.
*/
static void
{
if (getzoneid() != GLOBAL_ZONEID) {
exit(1);
}
void *hdl;
gettext("unable to get zone configuration.\n"));
exit(1);
}
gettext("unable to get zone configuration.\n"));
exit(1);
}
}
nzents = 0;
gettext("failed to get zoneid list\n"));
exit(1);
}
if (nzents == 0)
return;
exit(1);
}
gettext("failed to get zoneid list\n"));
exit(1);
}
/* zone increased while doing zone_list() */
goto again;
}
sizeof (zbrand)) < 0) {
gettext("failed to get zone attribute\n"));
exit(1);
}
/* We only take care of native zones */
continue;
gettext("failed to get zone name\n"));
exit(1);
}
zroot[0] = '\0';
} else {
gettext("failed to get zone's root\n"));
exit(1);
}
}
}
}
#include "cron.h"
/*
* Send REFRESH event to cron.
*/
static void
{
int msgfd;
exit(1);
}
"cron isn't running in %s zone.\n"), zname);
} else {
gettext("cron isn't running.\n"));
}
} else {
"failed to send message to cron "
"in %s zone.\n"), zname);
} else {
"failed to send message to cron.\n"));
}
}
return;
}
}
}