uadmin.h revision 753a6d457b330b1b29b2d3eefcd0831116ce950d
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest/*
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * CDDL HEADER START
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest *
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * The contents of this file are subject to the terms of the
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * Common Development and Distribution License (the "License").
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * You may not use this file except in compliance with the License.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest *
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * or http://www.opensolaris.org/os/licensing.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * See the License for the specific language governing permissions
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * and limitations under the License.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest *
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * When distributing Covered Code, include this CDDL HEADER in each
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * If applicable, add the following below this CDDL HEADER, with the
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * fields enclosed by brackets "[]" replaced with your own identifying
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * information: Portions Copyright [yyyy] [name of copyright owner]
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest *
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * CDDL HEADER END
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest */
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest/*
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * Use is subject to license terms.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest/* All Rights Reserved */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
89c76a8c99f25ef6d24c3642f95dde19c5fd4d05Phill Cunnington#ifndef _SYS_UADMIN_H
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest#define _SYS_UADMIN_H
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#if !defined(_ASM)
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#include <sys/types.h>
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest#include <sys/cred.h>
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#endif
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#ifdef __cplusplus
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrestextern "C" {
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#endif
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define A_REBOOT 1
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define A_SHUTDOWN 2
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define A_FREEZE 3 /* For freeze and thaw */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define A_REMOUNT 4
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define A_DUMP 5
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define A_FTRACE 15
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define A_SWAPCTL 16
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest/* 17-21 reserved for obsolete interface */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define A_SDTTEST 22 /* DTrace sdt:::test */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define A_CONFIG 23 /* For system configuration */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_UNKNOWN -1 /* no method */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_HALT 0 /* halt the processor */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_BOOT 1 /* multi-user reboot */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_IBOOT 2 /* multi-user reboot, ask for name of file */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_SBOOT 3 /* single-user reboot */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_SIBOOT 4 /* single-user reboot, ask for name of file */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_POWEROFF 6 /* software poweroff */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_NOSYNC 7 /* do not sync filesystems on next A_DUMP */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_FASTREBOOT 8 /* bypass firmware and boot loader */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_FASTREBOOT_DRYRUN 9 /* Fast reboot Dry run */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest/*
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * Functions reserved for A_FREEZE (may not be available on all platforms)
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * Note: AD_COMPRESS, AD_CHECK and AD_FORCE are now obsolete
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * The first two are succeeded by AD_SUSPEND_TO_DISK and
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * AD_CHECK_SUSPEND_TO_DISK respectively.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * AD_FORCE should not be used by any new application
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest *
6197cac1b7f675588382db0a6f279614032b5568David Luna * We maintain compatibility with the earlier interfaces:
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * AD_COMPRESS and AD_CHECK, by preserving those values
6197cac1b7f675588382db0a6f279614032b5568David Luna * in the corresponding new interfaces
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_COMPRESS 0 /* store state file compressed during CPR */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_FORCE 1 /* force to do AD_COMPRESS */
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest#define AD_CHECK 2 /* test if CPR module is available */
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest#define AD_SUSPEND_TO_DISK AD_COMPRESS /* A_FREEZE, CPR or ACPI S4 */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_CHECK_SUSPEND_TO_DISK AD_CHECK /* A_FREEZE, CPR/S4 capable? */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_SUSPEND_TO_RAM 20 /* A_FREEZE, S3 */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_CHECK_SUSPEND_TO_RAM 21 /* A_FREEZE, S3 capable? */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest/*
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * NOTE: the following defines comprise an Unstable interface. Their semantics
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * may change or they may be removed completely in a later release
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_REUSEINIT 3 /* prepare for AD_REUSABLE */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_REUSABLE 4 /* create reusable statefile */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_REUSEFINI 5 /* revert to normal CPR mode (not reusable) */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_FTRACE_START 1
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_FTRACE_STOP 2
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest/*
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * Functions of A_CONFIG. Unstable interface.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define AD_UPDATE_BOOT_CONFIG 1 /* Update boot config variables */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest/*
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * When 'mdep' (the second argument to uadmin(2)) is initialized for A_REBOOT,
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * A_SHUTDOWN or A_DUMP, it represents the boot arguments string of at most
6197cac1b7f675588382db0a6f279614032b5568David Luna * 256 characters.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define BOOTARGS_MAX 256
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#if !defined(_KERNEL)
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest/*
ece5a262d20a50d0abf584d0f7ec73929ede9cfdJaco Jooste * FMRI for boot-config service.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define FMRI_BOOT_CONFIG \
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest "svc:/system/boot-config:default"
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest/*
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * Property group that contains all Fast Reboot configuration properties.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest */
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest#define BOOT_CONFIG_PG_PARAMS "config"
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest/*
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest * Property group that contains all Fast Reboot blacklisting information.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define BOOT_CONFIG_PG_FBBLACKLIST "fastreboot_blacklist"
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#endif /* _KERNEL */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest/*
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest * Flag representations of fastboot configuration.
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define UA_FASTREBOOT_DEFAULT 0x01
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define UA_FASTREBOOT_ONPANIC 0x02
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define FASTREBOOT_ONPANIC "fastreboot_onpanic"
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define FASTREBOOT_ONPANIC_CMDLINE "fastreboot_onpanic_cmdline"
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define FASTREBOOT_ONPANIC_NOTSET(p) \
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest (strcmp((p), "false") == 0 || \
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest strcmp((p), "no") == 0 || \
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest strcmp((p), "0") == 0)
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#define FASTREBOOT_ONPANIC_ISSET(p) \
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest (strcmp((p), "true") == 0 || \
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest strcmp((p), "yes") == 0 || \
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest strcmp((p), "1") == 0)
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#if !defined(_ASM)
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#if defined(_KERNEL)
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrestextern kmutex_t ualock;
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrestextern void mdboot(int, int, char *, boolean_t);
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrestextern void mdpreboot(int, int, char *);
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrestextern int kadmin(int, int, void *, cred_t *);
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrestextern void killall(zoneid_t);
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#endif
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest#if defined(__STDC__)
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrestextern int uadmin(int, int, uintptr_t);
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#else
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrestextern int uadmin();
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest#endif
919ca0cd7bf1dee3c8021e1c80bd699c7a386001Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#endif /* _ASM */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
f52ca8f9ce43f7765e8c5959e45a667b496526eeAndrew Forrest#ifdef __cplusplus
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest}
60d290d5a2f0643d86ef3f8eb5d4381022cdfa68Jaco Jooste#endif
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest#endif /* _SYS_UADMIN_H */
864e2a74d7dc5e572cd895466611cc57e3523083Andrew Forrest