systm.h revision ae46e4c775f2becc5343ff90b60a95acb79735f9
/*
* 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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SYSTM_H
#define _SYS_SYSTM_H
#include <sys/dditypes.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The pc_t is the type of the kernel's program counter. In general, a
* pc_t is a uintptr_t -- except for a sparcv9 kernel, in which case all
* instruction text is below 4G, and a pc_t is thus a uint32_t.
*/
#ifdef __sparcv9
#else
#endif
/*
* Random set of variables used by more than one routine.
*/
#ifdef _KERNEL
extern int hz; /* system clock rate */
extern int interrupts_unleashed; /* set after the spl0() in main() */
extern char runin; /* scheduling flag */
extern char runout; /* scheduling flag */
extern char wake_sched; /* causes clock to wake swapper on next tick */
extern char wake_sched_sec; /* causes clock to wake swapper after a sec */
/* memory in pages. */
extern char *volatile panicstr; /* panic string pointer */
extern volatile int quiesce_active; /* quiesce(9E) is in progress */
extern int rstchown; /* 1 ==> restrictive chown(2) semantics */
extern int klustsize;
extern int abort_enable; /* Platform input-device abort policy */
extern int audit_active; /* Solaris Auditing active 1, absent 0. */
extern int avenrun[]; /* array of load averages */
extern char *isa_list; /* For sysinfo's isalist option */
extern int noexec_user_stack; /* patchable via /etc/system */
extern int noexec_user_stack_log; /* patchable via /etc/system */
/*
* Use NFS client operations in the global zone only. Under contract with
*/
extern int nfs_global_client_only;
extern void startup(void);
extern void clkstart(void);
extern void post_startup(void);
extern void kern_setup1(void);
extern void ka_init(void);
extern void nodename_set(void);
/*
* for tod fault detection
*/
enum tod_fault_type {
TOD_REVERSED = 0,
};
extern void tod_fault_reset(void);
extern void plat_tod_fault(enum tod_fault_type);
#ifndef _LP64
#ifndef min
int min(int, int);
#endif
#ifndef max
int max(int, int);
#endif
#endif /* !_LP64 */
typedef uint64_t callout_id_t;
/*
* The last argument to timeout_generic() is flags. See callo.h for the
* flags definitions.
*/
int);
/*
* The last argument to untimeout_generic() is flags. See callout.c for the
* use.
*/
int nodev();
int nulldev();
int stoi(char **);
char *kmem_asprintf(const char *fmt, ...);
int strident_valid(const char *);
void strident_canon(char *, size_t);
char *append_subopt(const char *, size_t, char *, const char *);
void copyin_noerr(const void *, void *, size_t);
int xcopyin_nta(const void *, void *, size_t, int);
void copyout_noerr(const void *, void *, size_t);
int xcopyout_nta(const void *, void *, size_t, int);
void fuword8_noerr(const void *, uint8_t *);
void fuword16_noerr(const void *, uint16_t *);
void fuword32_noerr(const void *, uint32_t *);
void fulword_noerr(const void *, ulong_t *);
#ifdef _LP64
void fuword64_noerr(const void *, uint64_t *);
#endif
void subyte_noerr(void *, uint8_t);
void suword8_noerr(void *, uint8_t);
void suword16_noerr(void *, uint16_t);
void suword32_noerr(void *, uint32_t);
void sulword_noerr(void *, ulong_t);
#ifdef _LP64
void suword64_noerr(void *, uint64_t);
#endif
#if !defined(_BOOT)
#pragma unknown_control_flow(setjmp)
#endif
void prefetch_read_once(void *);
void prefetch_write_once(void *);
void prefetch_read_many(void *);
void prefetch_write_many(void *);
int getpcstack(pc_t *, int);
void no_fault(void);
void halt(char *);
int splr(int);
int splhigh(void);
int splhi(void);
int splzs(void);
int spl0(void);
int spl6(void);
int spl7(void);
int spl8(void);
void splx(int);
void set_base_spl(void);
int __ipltospl(int);
void softcall_init(void);
void softcall(void (*)(void *), void *);
void softint(void);
/* casts to keep lint happy */
#pragma unknown_control_flow(on_fault)
struct timeval;
struct timeval32;
extern void uniqtime32(struct timeval32 *);
uint_t page_num_pagesizes(void);
extern int maxusers;
extern int pidmax;
extern void param_preset(void);
extern void param_calc(int);
extern void param_init(void);
extern void param_check(void);
#endif /* _KERNEL */
/*
* Structure of the system-entry table.
*
* Changes to struct sysent should maintain binary compatibility with
* loadable system calls, although the interface is currently private.
*
* This means it should only be expanded on the end, and flag values
* should not be reused.
*
* It is desirable to keep the size of this struct a power of 2 for quick
* indexing.
*/
struct sysent {
char sy_narg; /* total number of arguments */
#ifdef _LP64
unsigned short sy_flags; /* various flags as defined below */
#else
unsigned char sy_flags; /* various flags as defined below */
#endif
int (*sy_call)(); /* argp, rvalp-style handler */
};
#ifdef _SYSCALL32_IMPL
#endif
/*
* sy_flags values
* Values 1, 2, and 4 were used previously for SETJUMP, ASYNC, and IOSYS.
*/
/*
* Structure of the return-value parameter passed by reference to
* system entries.
*/
union rval {
struct {
int r_v1;
int r_v2;
} r_v;
};
#ifdef _KERNEL
extern void reset_syscall_args(void);
extern int save_syscall_args(void);
#ifdef _SYSCALL32_IMPL
#endif
#pragma rarely_called(set_errno)
extern int64_t syscall_ap(void);
extern int64_t loadable_syscall(long, long, long, long, long, long, long, long);
extern void swtch(void);
/*
* initname holds the path to init and is used as a point of rendezvous
* between krtld (which processes the boot arguments) and the kernel.
*/
#define INITNAME_SZ 32
extern char initname[INITNAME_SZ];
/*
* initargs holds the arguments to init (such as -v, -s, -r, -m verbose) and
* is a point of rendezvous between krtld (which processes the boot arguments)
* and the kernel.
*/
extern char initargs[BOOTARGS_MAX];
extern int exec_init(const char *, const char *);
extern int start_init_common(void);
#endif /* _KERNEL */
char *strcat(char *, const char *);
char *strcpy(char *, const char *);
/* Need to be consistent with <string.h> C++ definitions */
#if __cplusplus >= 199711L
extern const char *strchr(const char *, int);
#ifndef _STRCHR_INLINE
#define _STRCHR_INLINE
extern "C++" {
}
}
#endif /* _STRCHR_INLINE */
extern const char *strrchr(const char *, int);
#ifndef _STRRCHR_INLINE
#define _STRRCHR_INLINE
extern "C++" {
}
}
#endif /* _STRRCHR_INLINE */
extern const char *strstr(const char *, const char *);
#ifndef _STRSTR_INLINE
#define _STRSTR_INLINE
extern "C++" {
}
}
#endif /* _STRSTR_INLINE */
#else /* __cplusplus >= 199711L */
char *strchr(const char *, int);
char *strrchr(const char *, int);
char *strstr(const char *, const char *);
#endif /* __cplusplus >= 199711L */
int strcasecmp(const char *, const char *) __PURE;
/* Need to be consistent with <string.h> C++ definitions */
#if __cplusplus >= 199711L
extern const char *strpbrk(const char *, const char *);
#ifndef _STRPBRK_INLINE
#define _STRPBRK_INLINE
extern "C++" {
}
}
#endif /* _STRPBRK_INLINE */
#else /* __cplusplus >= 199711L */
char *strpbrk(const char *, const char *);
#endif /* __cplusplus >= 199711L */
#ifdef __lint
extern int __lintzero; /* for spoofing lint */
#else /* __lint */
#define __lintzero 0
#endif /* __lint */
#endif /* _KERNEL || _BOOT */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SYSTM_H */