diff options
author | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
---|---|---|
committer | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
commit | 7c478bd95313f5f23a4c958a745db2134aa03244 (patch) | |
tree | c871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/head | |
download | illumos-gate-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz |
OpenSolaris Launch
Diffstat (limited to 'usr/src/head')
237 files changed, 43385 insertions, 0 deletions
diff --git a/usr/src/head/Makefile b/usr/src/head/Makefile new file mode 100644 index 0000000000..4c1ae87327 --- /dev/null +++ b/usr/src/head/Makefile @@ -0,0 +1,498 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (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 +# or http://www.opensolaris.org/os/licensing. +# 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 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +# head/Makefile +# +# include global definitions +include ../Makefile.master + +sparc_HDRS= +i386_HDRS= stack_unwind.h + +# Headers are listed one per line so that TeamWare can auto-merge most changes + +KRB5HDRS= mit_copyright.h mit-sipb-copyright.h + +ATTRDB_HDRS= secdb.h auth_attr.h exec_attr.h prof_attr.h user_attr.h \ + auth_list.h + +HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \ + aio.h \ + alloca.h \ + apptrace.h \ + apptrace_impl.h \ + ar.h \ + archives.h \ + assert.h \ + atomic.h \ + config_admin.h \ + cpio.h \ + crypt.h \ + ctype.h \ + deflt.h \ + devid.h \ + devmgmt.h \ + devpoll.h \ + dial.h \ + dirent.h \ + dlfcn.h \ + door.h \ + elf.h \ + errno.h \ + euc.h \ + exacct.h \ + exacct_impl.h \ + fatal.h \ + fcntl.h \ + float.h \ + fmtmsg.h \ + fnmatch.h \ + ftw.h \ + gelf.h \ + getopt.h \ + getwidth.h \ + glob.h \ + grp.h \ + iconv.h \ + ieeefp.h \ + inttypes.h \ + iso646.h \ + langinfo.h \ + lastlog.h \ + lber.h \ + ldap.h \ + libelf.h \ + libgen.h \ + libintl.h \ + libw.h \ + libzonecfg.h \ + limits.h \ + linenum.h \ + link.h \ + listen.h \ + locale.h \ + macros.h \ + malloc.h \ + md5.h \ + mdmn_changelog.h \ + memory.h \ + meta.h \ + meta_runtime.h \ + metadyn.h \ + mon.h \ + monetary.h \ + mp.h \ + mqueue.h \ + nan.h \ + ndbm.h \ + netconfig.h \ + netdb.h \ + netdir.h \ + nl_types.h \ + nlist.h \ + note.h \ + nsswitch.h \ + nss_common.h \ + nss_dbdefs.h \ + nss_netdir.h \ + pcsample.h \ + pfmt.h \ + pkgdev.h \ + pkginfo.h \ + pkglocs.h \ + pkgstrct.h \ + pkgtrans.h \ + poll.h \ + port.h \ + priv.h \ + priv_utils.h \ + proc_service.h \ + procfs.h \ + prof.h \ + project.h \ + pthread.h \ + pw.h \ + pwd.h \ + rctl.h \ + re_comp.h \ + regex.h \ + regexp.h \ + resolv.h \ + rje.h \ + rtld_db.h \ + rmmount.h \ + sac.h \ + sched.h \ + schedctl.h \ + sdssc.h \ + search.h \ + semaphore.h \ + setjmp.h \ + sgtty.h \ + shadow.h \ + siginfo.h \ + signal.h \ + spawn.h \ + stdarg.h \ + stdbool.h \ + stddef.h \ + stdint.h \ + stdio.h \ + stdio_ext.h \ + stdio_tag.h \ + stdio_impl.h \ + stdlib.h \ + storclass.h \ + string.h \ + strings.h \ + stropts.h \ + synch.h \ + sysexits.h \ + syslog.h \ + syms.h \ + tar.h \ + termio.h \ + termios.h \ + thread.h \ + thread_db.h \ + time.h \ + tiuser.h \ + tzfile.h \ + ucontext.h \ + ucred.h \ + ulimit.h \ + unistd.h \ + userdefs.h \ + ustat.h \ + utime.h \ + utmp.h \ + utmpx.h \ + valtools.h \ + values.h \ + varargs.h \ + wait.h \ + wchar.h \ + wchar_impl.h \ + wctype.h \ + widec.h \ + wordexp.h \ + xti.h \ + xti_inet.h \ + zone.h + +ISOHDRS = \ + ctype_c99.h \ + ctype_iso.h \ + limits_iso.h \ + locale_iso.h \ + setjmp_iso.h \ + signal_iso.h \ + stdarg_c99.h \ + stdarg_iso.h \ + stddef_iso.h \ + stdio_c99.h \ + stdio_iso.h \ + stdlib_c99.h \ + stdlib_iso.h \ + string_iso.h \ + time_iso.h \ + wchar_c99.h \ + wchar_iso.h \ + wctype_c99.h \ + wctype_iso.h + +ARPAHDRS = \ + ftp.h \ + inet.h \ + nameser.h \ + telnet.h \ + tftp.h \ + nameser_compat.h + +AUDIOHDRS = \ + au.h + +UUIDHDRS = \ + uuid.h + +# rpcsvc headers which are just headers (not derived from a .x file) +RPCSVC_SRC_HDRS = \ + bootparam.h \ + daemon_utils.h \ + dbm.h \ + nis_db.h \ + nis_tags.h \ + nislib.h \ + yp_prot.h \ + ypclnt.h \ + yppasswd.h \ + ypupd.h \ + rpc_sztypes.h + +# rpcsvc headers which are generated from .x files +RPCSVC_GEN_HDRS = \ + bootparam_prot.h \ + mount.h \ + nfs_prot.h \ + nfs4_prot.h \ + nis.h \ + nis_cache.h \ + nis_callback.h \ + nlm_prot.h \ + rex.h \ + rquota.h \ + rstat.h \ + rusers.h \ + rwall.h \ + spray.h \ + nispasswd.h \ + ufs_prot.h \ + nfs_acl.h + +LVMRPCHDRS = \ +mhdx.h mdiox.h meta_basic.h metad.h metamed.h metamhd.h metacl.h + +SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h +SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h +SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h +SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h + +RPCGENFLAGS = -C -h +rpcsvc/nispasswd.h := RPCGENFLAGS += -M +rpcsvc/rwall.h := RPCGENFLAGS += -M +meta_basic.h := RPCGENFLAGS += -M +metad.h := RPCGENFLAGS += -M +metamed.h := RPCGENFLAGS += -M +mhdx.h := RPCGENFLAGS += -M +mdiox.h := RPCGENFLAGS += -M +metamhd.h := RPCGENFLAGS += -M +metacl.h := RPCGENFLAGS += -M + +# rpcsvc rpcgen source (.x files) +# +# yp.x is an attempt at codifying what was hand coded in RPCL. +# Unfortunately it doesn't quite work. (The handcoded stuff isn't +# expressable in RPCL) this is due to the fact that YP was written +# before rpcgen existed. Hence, yp_prot.h cannot be derived from yp.x +# +# There is no `.h' for nis_object.x because it is included by nis.x and +# the resulting .h is nis.h. + +RPCSVCPROTS = \ +$(RPCSVC_GEN_HDRS:%.h=%.x) nis_object.x yp.x + +LVMSVCPROTS = \ +$(LVMRPCHDRS:%.h=%.x) + +RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS) + +PROTOHDRS= dumprestore.h routed.h ripngd.h rwhod.h timed.h + +ROOTHDRS= $(HDRS:%=$(ROOT)/usr/include/%) \ + $(KRB5HDRS:%=$(ROOT)/usr/include/kerberosv5/%) \ + $(ISOHDRS:%=$(ROOT)/usr/include/iso/%) \ + $(ARPAHDRS:%=$(ROOT)/usr/include/arpa/%) \ + $(AUDIOHDRS:%=$(ROOT)/usr/include/audio/%) \ + $(UUIDHDRS:%=$(ROOT)/usr/include/uuid/%) \ + $(RPCSVCHDRS:%=$(ROOT)/usr/include/rpcsvc/%) \ + $(RPCSVCPROTS:%=$(ROOT)/usr/include/rpcsvc/%) \ + $(LVMRPCHDRS:%=$(ROOT)/usr/include/%) \ + $(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%) + +DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5 +ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%) + +SED= sed + +# check files really don't exist +# +# should do something with the rpcsvc headers + +iso/%.check: iso/%.h + $(DOT_H_CHECK) + +arpa/%.check: arpa/%.h + $(DOT_H_CHECK) + +audio/%.check: audio/%.h + $(DOT_H_CHECK) + +rpcsvc/%.check: rpcsvc/%.h + $(DOT_H_CHECK) + +rpcsvc/%.check: rpcsvc/%.x + $(DOT_X_CHECK) + +protocols/%.check: protocols/%.h + $(DOT_H_CHECK) + +kerberosv5/%.check: kerberosv5/%.h + $(DOT_H_CHECK) + +uuid/%.check: uuid/%.h + $(DOT_H_CHECK) + +# Note that the derived headers (rpcgen) are not checked at this time. These +# need work at the source level and rpcgen itself has a bug which causes a +# cstyle violation. Furthermore, there seems to be good reasons for the +# generated headers to not pass all of the hdrchk rules. +# +# Add the following to the CHECKHDRS list to activate the .x checks: +# $(RPCSVCPROTS:%.x=rpcsvc/%.check) \ +# +CHECKHDRS= $(HDRS:%.h=%.check) \ + $(KRB5HDRS:%.h=kerberosv5/%.check) \ + $(ISOHDRS:%.h=iso/%.check) \ + $(ARPAHDRS:%.h=arpa/%.check) \ + $(AUDIOHDRS:%.h=audio/%.check) \ + $(UUIDHDRS:%.h=uuid/%.check) \ + $(RPCSVC_SRC_HDRS:%.h=rpcsvc/%.check) \ + $(PROTOHDRS:%.h=protocols/%.check) + +# headers which won't quite meet the standards... +# +# assert.h is required by ansi-c to *not* be idempotent (section 4.1.2). +# Hence the trailing guard is not the last thing in the file nor can it +# be without playing silly games. + +assert.check := HDRCHK_TAIL = | grep -v "end guard wrong" | true + +# install rules + +$(ROOT)/usr/include/security/%: security/% + $(INS.file) + +$(ROOT)/usr/include/protocols/%: protocols/% + $(INS.file) + +$(ROOT)/usr/include/rpcsvc/%: rpcsvc/% + $(INS.file) + +$(ROOT)/usr/include/kerberosv5/%: kerberosv5/% + $(INS.file) + +$(ROOT)/usr/include/arpa/%: arpa/% + $(INS.file) + +$(ROOT)/usr/include/audio/%: audio/% + $(INS.file) + +$(ROOT)/usr/include/iso/%: iso/% + $(INS.file) + +$(ROOT)/usr/include/uuid/%: uuid/% + $(INS.file) + +$(ROOT)/usr/include/%: % + $(INS.file) + +.KEEP_STATE: + +.PARALLEL: $(ROOTHDRS) $(CHECKHDRS) + +install_h: $(ROOTDIRS) .WAIT $(ROOTHDRS) $(SYMHDRASSERT) $(SYMHDRERRNO) \ + $(SYMHDRFLOAT) $(SYMHDRISO646) + +check: $(CHECKHDRS) + +clean clobber: + $(RM) $(LVMRPCHDRS); + cd rpcsvc ; $(RM) $(RPCSVC_GEN_HDRS) + +$(ROOTDIRS): + $(INS.dir) + +$(SYMHDRASSERT): + -$(RM) $@; $(SYMLINK) ../assert.h $@ + +$(SYMHDRERRNO): + -$(RM) $@; $(SYMLINK) ../errno.h $@ + +$(SYMHDRFLOAT): + -$(RM) $@; $(SYMLINK) ../float.h $@ + +$(SYMHDRISO646): + -$(RM) $@; $(SYMLINK) ../iso646.h $@ + +rpcsvc/%.h: rpcsvc/%.x + $(RPCGEN) $(RPCGENFLAGS) $< -o $@ + +rpcsvc/nis.h: rpcsvc/nis.x + $(RPCGEN) $(RPCGENFLAGS) rpcsvc/nis.x |\ + $(SED) -e '/EDIT_START/,$$ d' > $@ + +meta_basic.h: ../uts/common/sys/lvm/meta_basic.x + $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/meta_basic.x | \ + awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + { print $0 } \ + ' > $@ + +metad.h: metad.x + $(RPCGEN) $(RPCGENFLAGS) metad.x | \ + awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + { print $0 } \ + ' > $@ + +mhdx.h: ../uts/common/sys/lvm/mhdx.x + $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mhdx.x | \ + awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + { print $0 } \ + ' > $@ + +mdiox.h: ../uts/common/sys/lvm/mdiox.x + $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mdiox.x | \ + nawk '{sub(/sys\/lvm\/md_mhdx/, "mhdx"); print $$0}' | \ + nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \ + awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + { print $0 } \ + ' > $@ + +metamed.h: ../uts/common/sys/lvm/metamed.x + $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/metamed.x | \ + nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \ + awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + { print $0 } \ + ' > $@ + +metamhd.h: metamhd.x + $(RPCGEN) $(RPCGENFLAGS) metamhd.x | \ + awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + { print $0 } \ + ' > $@ + +metacl.h: metacl.x + $(RPCGEN) $(RPCGENFLAGS) metacl.x | \ + awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ + { print $0 } \ + ' > $@ diff --git a/usr/src/head/aio.h b/usr/src/head/aio.h new file mode 100644 index 0000000000..0a6d035461 --- /dev/null +++ b/usr/src/head/aio.h @@ -0,0 +1,170 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _AIO_H +#define _AIO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/types.h> +#include <sys/fcntl.h> +#include <sys/siginfo.h> +#include <sys/aiocb.h> +#include <time.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if (_POSIX_C_SOURCE - 0 > 0) && (_POSIX_C_SOURCE - 0 <= 2) +#error "POSIX Asynchronous I/O is not supported in POSIX.1-1990" +#endif + +/* large file compilation environment setup */ +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname aio_read aio_read64 +#pragma redefine_extname aio_write aio_write64 +#pragma redefine_extname lio_listio lio_listio64 +#pragma redefine_extname aio_error aio_error64 +#pragma redefine_extname aio_return aio_return64 +#pragma redefine_extname aio_cancel aio_cancel64 +#pragma redefine_extname aio_suspend aio_suspend64 +#pragma redefine_extname aio_fsync aio_fsync64 +#pragma redefine_extname aio_waitn aio_waitn64 +#else +#define aiocb aiocb64 +#define aiocb_t aiocb64_t +#define aio_read aio_read64 +#define aio_write aio_write64 +#define lio_listio lio_listio64 +#define aio_error aio_error64 +#define aio_return aio_return64 +#define aio_cancel aio_cancel64 +#define aio_suspend aio_suspend64 +#define aio_fsync aio_fsync64 +#define aio_waitn aio_waitn64 +#endif +#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ + +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +/* + * In the LP64 compilation environment, map the 64-bit-explicit versions + * back to the generic versions: all i/o operations are already "large file" + */ +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname aio_read64 aio_read +#pragma redefine_extname aio_write64 aio_write +#pragma redefine_extname lio_listio64 lio_listio +#pragma redefine_extname aio_error64 aio_error +#pragma redefine_extname aio_return64 aio_return +#pragma redefine_extname aio_cancel64 aio_cancel +#pragma redefine_extname aio_suspend64 aio_suspend +#pragma redefine_extname aio_fsync64 aio_fsync +#pragma redefine_extname aio_waitn64 aio_waitn +#else +#define aiocb64 aiocb +#define aiocb64_t aiocb_t +#define aio_read64 aio_read +#define aio_write64 aio_write +#define lio_listio64 lio_listio +#define aio_error64 aio_error +#define aio_return64 aio_return +#define aio_cancel64 aio_cancel +#define aio_suspend64 aio_suspend +#define aio_fsync64 aio_fsync +#define aio_waitn64 aio_waitn +#endif +#endif /* _LP64 && _LARGEFILE64_SOURCE */ + +/* + * function prototypes + */ +#if defined(__STDC__) +extern int aio_read(aiocb_t *); +extern int aio_write(aiocb_t *); +extern int lio_listio(int, + aiocb_t *_RESTRICT_KYWD const *_RESTRICT_KYWD, + int, struct sigevent *_RESTRICT_KYWD); +extern int aio_error(const aiocb_t *); +extern ssize_t aio_return(aiocb_t *); +extern int aio_cancel(int, aiocb_t *); +extern int aio_suspend(const aiocb_t *const[], int, + const struct timespec *); +extern int aio_fsync(int, aiocb_t *); +extern int aio_waitn(aiocb_t *[], uint_t, uint_t *, + const struct timespec *); + + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern int aio_read64(aiocb64_t *); +extern int aio_write64(aiocb64_t *); +extern int lio_listio64(int, + aiocb64_t *_RESTRICT_KYWD const *_RESTRICT_KYWD, + int, struct sigevent *_RESTRICT_KYWD); +extern int aio_error64(const aiocb64_t *); +extern ssize_t aio_return64(aiocb64_t *); +extern int aio_cancel64(int, aiocb64_t *); +extern int aio_suspend64(const aiocb64_t *const[], int, + const struct timespec *); +extern int aio_fsync64(int, aiocb64_t *); +extern int aio_waitn64(aiocb64_t *[], uint_t, uint_t *, + const struct timespec *); +#endif /* _LARGEFILE64_SOURCE */ + +#else +extern int aio_read(); +extern int aio_write(); +extern int lio_listio(); +extern int aio_error(); +extern ssize_t aio_return(); +extern int aio_cancel(); +extern int aio_suspend(); +extern int aio_fsync(); +extern int aio_waitn(); + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern int aio_read64(); +extern int aio_write64(); +extern int lio_listio64(); +extern int aio_error64(); +extern ssize_t aio_return64(); +extern int aio_cancel64(); +extern int aio_suspend64(); +extern int aio_fsync64(); +extern int aio_waitn64(); +#endif /* _LARGEFILE64_SOURCE */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _AIO_H */ diff --git a/usr/src/head/alloca.h b/usr/src/head/alloca.h new file mode 100644 index 0000000000..29fe0fed76 --- /dev/null +++ b/usr/src/head/alloca.h @@ -0,0 +1,79 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _ALLOCA_H +#define _ALLOCA_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Many compilation systems depend upon the use of special functions + * built into the the compilation system to handle variable argument + * lists and stack allocations. The method to obtain this in SunOS + * is to define the feature test macro "__BUILTIN_VA_ARG_INCR" which + * enables the following special built-in functions: + * __builtin_alloca + * __builtin_va_alist + * __builtin_va_arg_incr + * It is intended that the compilation system define this feature test + * macro, not the user of the system. + * + * The tests on the processor type are to provide a transitional period + * for existing compilation systems, and may be removed in a future + * release. + */ + +#if defined(__BUILTIN_VA_ARG_INCR) || \ + defined(__sparc) || defined(__i386) || defined(__amd64) +#define alloca(x) __builtin_alloca(x) + +#ifdef __STDC__ +extern void *__builtin_alloca(size_t); +#else +extern void *__builtin_alloca(); +#endif + +#else + +#ifdef __STDC__ +extern void *alloca(size_t); +#else +extern void *alloca(); +#endif + +#endif /* defined(__BUILTIN_VA_ARG_INCR) || defined(__sparc) ... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ALLOCA_H */ diff --git a/usr/src/head/apptrace.h b/usr/src/head/apptrace.h new file mode 100644 index 0000000000..e2427f38a2 --- /dev/null +++ b/usr/src/head/apptrace.h @@ -0,0 +1,122 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1998-2000 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _APPTRACE_H +#define _APPTRACE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <stdio.h> +#include <string.h> +#include <stdarg.h> +#include <dlfcn.h> +#include <link.h> +#include <signal.h> +#include <synch.h> +#include <wchar.h> +#include <thread.h> +#include <apptrace_impl.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Extract the verbosity flag. + */ +#define ABI_VFLAG(lib, symbol) \ + __abi_ ## lib ## _ ## symbol ## _sym.a_vflag + +/* + * Extract the function pointer to the real ABI function. + */ +#define ABI_REAL(lib, symbol) \ + __abi_ ## lib ## _ ## symbol ## _sym.a_real + +/* + * Macro to create the part of a function call prior + * to the arg list. + * cast is a full cast expression for a _pointer_ to + * the ABI function being called. + * + * e.g. ABI_CALL_REAL(libc, getpid, (pid_t (*)(void))) (); + */ +#define ABI_CALL_REAL(lib, sym, cast) \ + (cast __abi_ ## lib ## _ ## sym ## _sym.a_real) + +#define ABISTREAM __abi_outfile +#define ABIPUTS(x) (void) fputs((x), ABISTREAM) + +/* + * The following declarations and macros are needed for + * anybody needing the vprintf family of calls where they + * MUST come from the BASE link map instead of the auditing + * link map. + */ +#define ABI_VSNPRINTF __abi_real_vsnprintf +#define ABI_VSWPRINTF __abi_real_vswprintf +#define ABI_VWPRINTF __abi_real_vwprintf +#define ABI_VFPRINTF __abi_real_vfprintf +#define ABI_VFWPRINTF __abi_real_vfwprintf +#define ABI_VPRINTF __abi_real_vprintf +#define ABI_VSPRINTF __abi_real_vsprintf +#define ABI_ERRNO (*(__abi_real_errno())) + +/* From libstabspf */ +typedef enum { + STAB_SUCCESS = 0, /* All is well. */ + STAB_FAIL = -1, /* Parsing error. */ + STAB_NA = -2, /* Information is Not Applicable. */ + STAB_NOMEM = -3 /* Out of Memory! */ +} stabsret_t; + +extern int (*ABI_VFPRINTF)(FILE *, const char *, va_list); +extern int (*ABI_VFWPRINTF)(FILE *, const wchar_t *, va_list); +extern int (*ABI_VPRINTF)(const char *, va_list); +extern int (*ABI_VSNPRINTF)(char *, size_t, const char *, va_list); +extern int (*ABI_VSPRINTF)(char *, const char *, va_list); +extern int (*ABI_VSWPRINTF)(wchar_t *, size_t, const wchar_t *, va_list); +extern int (*ABI_VWPRINTF)(const wchar_t *, va_list); +extern int *(*__abi_real_errno)(void); + +extern void *abi_malloc(size_t); +extern void *abi_calloc(size_t, size_t); +extern void *abi_realloc(void *, size_t); +extern int abi_putc(int, FILE *); +extern int abi_fputs(const char *, FILE *); +extern void abi_free(void *); + +/* From libstabspf */ +extern stabsret_t spf_load_stabs(const char *); +extern int spf_prtype(FILE *, char const *, int, void const *); + +extern int abi_strpsz; /* size constraint for string printing */ + +#ifdef __cplusplus +} +#endif + +#endif /* _APPTRACE_H */ diff --git a/usr/src/head/apptrace_impl.h b/usr/src/head/apptrace_impl.h new file mode 100644 index 0000000000..82c22e8a98 --- /dev/null +++ b/usr/src/head/apptrace_impl.h @@ -0,0 +1,84 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1998-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _APPTRACE_IMPL_H +#define _APPTRACE_IMPL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct abisym { + void *a_real; + int a_vflag; + int a_tflag; +} abisym_t; + +/* + * From the apptrace auditing object + */ +extern FILE *__abi_outfile; +extern struct liblist *__abi_pflib_list; + +extern sigset_t abisigset; + +#ifdef __STDC__ + +extern void abilock(sigset_t *); +extern void abiunlock(sigset_t *); + +extern size_t strnlen(char const *, size_t); +extern int is_empty_string(char const *); + +extern int (*abi_thr_main)(void); +extern thread_t (*abi_thr_self)(void); +extern int (*abi_sigsetmask)(int, const sigset_t *, sigset_t *); +extern int (*abi_sigaction)(int, const struct sigaction *, struct sigaction *); +extern int (*abi_mutex_lock)(mutex_t *); +extern int (*abi_mutex_unlock)(mutex_t *); + +#else /* __STDC__ */ + +extern void abilock(); +extern void abiunlock(); +extern size_t strnlen(); +extern int is_empty_string(); +extern int (*abi_thr_main)(); +extern thread_t (*abi_thr_self)(); +extern int (*abi_sigsetmask)(); +extern int (*abi_sigaction)(); +extern int (*abi_mutex_lock)(); +extern int (*abi_mutex_unlock)(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _APPTRACE_IMPL_H */ diff --git a/usr/src/head/ar.h b/usr/src/head/ar.h new file mode 100644 index 0000000000..dab1f47477 --- /dev/null +++ b/usr/src/head/ar.h @@ -0,0 +1,85 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _AR_H +#define _AR_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2.12 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * COMMON ARCHIVE FORMAT + * + * ARCHIVE File Organization: + * _________________________________________________ + * |__________ARCHIVE_MAGIC_STRING_________________| + * |__________ARCHIVE_FILE_MEMBER_1________________| + * | | + * | Archive File Header "ar_hdr" | + * |...............................................| + * | Member Contents | + * | 1. External symbol directory | + * | 2. Text file | + * |_______________________________________________| + * |________ARCHIVE_FILE_MEMBER_2__________________| + * | "ar_hdr" | + * |...............................................| + * | Member Contents (.o or text file) | + * |_______________________________________________| + * | . . . | + * | . . . | + * | . . . | + * |_______________________________________________| + * |________ARCHIVE_FILE_MEMBER_n__________________| + * | "ar_hdr" | + * |...............................................| + * | Member Contents | + * |_______________________________________________| + * + */ + +#define ARMAG "!<arch>\n" +#define SARMAG 8 +#define ARFMAG "`\n" + +struct ar_hdr /* archive file member header - printable ascii */ +{ + char ar_name[16]; /* file member name - `/' terminated */ + char ar_date[12]; /* file member date - decimal */ + char ar_uid[6]; /* file member user id - decimal */ + char ar_gid[6]; /* file member group id - decimal */ + char ar_mode[8]; /* file member mode - octal */ + char ar_size[10]; /* file member size - decimal */ + char ar_fmag[2]; /* ARFMAG - string to end header */ +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _AR_H */ diff --git a/usr/src/head/archives.h b/usr/src/head/archives.h new file mode 100644 index 0000000000..cd303130db --- /dev/null +++ b/usr/src/head/archives.h @@ -0,0 +1,287 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988,1997-1998,2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ifndef _ARCHIVES_H +#define _ARCHIVES_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */ + +#include <tar.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Magic numbers */ + +#define CMN_ASC 0x070701 /* Cpio Magic Number for ASCii header */ +#define CMN_BIN 070707 /* Cpio Magic Number for Binary header */ +#define CMN_BBS 0143561 /* Cpio Magic Number for Byte-Swap header */ +#define CMN_CRC 0x070702 /* Cpio Magic Number for CRC header */ +#define CMS_ASC "070701" /* Cpio Magic String for ASCii header */ +#define CMS_CHR "070707" /* Cpio Magic String for CHR (-c) header */ +#define CMS_CRC "070702" /* Cpio Magic String for CRC header */ +#define CMS_LEN 6 /* Cpio Magic String LENgth */ + +/* Various header and field lengths */ + +#define CHRSZ 76 /* -c hdr size minus filename field */ +#define ASCSZ 110 /* ASC and CRC hdr size minus filename field */ +#define TARSZ 512 /* TAR hdr size */ + +#define HNAMLEN 256 /* maximum filename length for binary and -c headers */ +#define EXPNLEN 1024 /* maximum filename length for ASC and CRC headers */ +#define HTIMLEN 2 /* length of modification time field */ +#define HSIZLEN 2 /* length of file size field */ + +/* cpio binary header definition */ + +struct hdr_cpio { + short h_magic, /* magic number field */ + h_dev; /* file system of file */ + ushort_t h_ino, /* inode of file */ + h_mode, /* modes of file */ + h_uid, /* uid of file */ + h_gid; /* gid of file */ + short h_nlink, /* number of links to file */ + h_rdev, /* maj/min numbers for special files */ + h_mtime[HTIMLEN], /* modification time of file */ + h_namesize, /* length of filename */ + h_filesize[HSIZLEN]; /* size of file */ + char h_name[HNAMLEN]; /* filename */ +}; + +/* cpio ODC header format */ + +struct c_hdr { + char c_magic[CMS_LEN], + c_dev[6], + c_ino[6], + c_mode[6], + c_uid[6], + c_gid[6], + c_nlink[6], + c_rdev[6], + c_mtime[11], + c_namesz[6], + c_filesz[11], + c_name[HNAMLEN]; +}; + +/* -c and CRC header format */ + +struct Exp_cpio_hdr { + char E_magic[CMS_LEN], + E_ino[8], + E_mode[8], + E_uid[8], + E_gid[8], + E_nlink[8], + E_mtime[8], + E_filesize[8], + E_maj[8], + E_min[8], + E_rmaj[8], + E_rmin[8], + E_namesize[8], + E_chksum[8], + E_name[EXPNLEN]; +}; + +/* Tar header structure and format */ + +#define TBLOCK 512 /* length of tar header and data blocks */ +#define TNAMLEN 100 /* maximum length for tar file names */ +#define TMODLEN 8 /* length of mode field */ +#define TUIDLEN 8 /* length of uid field */ +#define TGIDLEN 8 /* length of gid field */ +#define TSIZLEN 12 /* length of size field */ +#define TTIMLEN 12 /* length of modification time field */ +#define TCRCLEN 8 /* length of header checksum field */ + +/* tar header definition */ + +union tblock { + char dummy[TBLOCK]; + struct tar_hdr { + char t_name[TNAMLEN], /* name of file */ + t_mode[TMODLEN], /* mode of file */ + t_uid[TUIDLEN], /* uid of file */ + t_gid[TGIDLEN], /* gid of file */ + t_size[TSIZLEN], /* size of file in bytes */ + t_mtime[TTIMLEN], /* modification time of file */ + t_cksum[TCRCLEN], /* checksum of header */ + t_typeflag, + t_linkname[TNAMLEN], /* file this file linked with */ + t_magic[TMAGLEN], + t_version[TVERSLEN], + t_uname[32], + t_gname[32], + t_devmajor[8], + t_devminor[8], + t_prefix[155]; + } tbuf; +}; + +/* volcopy tape label format and structure */ + +#define VMAGLEN 8 +#define VVOLLEN 6 +#define VFILLEN 464 + +struct volcopy_label { + char v_magic[VMAGLEN], + v_volume[VVOLLEN], + v_reels, + v_reel; + int v_time, + v_length, + v_dens, + v_reelblks, /* u370 added field */ + v_blksize, /* u370 added field */ + v_nblocks; /* u370 added field */ + char v_fill[VFILLEN]; + int v_offset; /* used with -e and -reel options */ + int v_type; /* does tape have nblocks field? */ +}; + +/* + * Define archive formats for extended attributes. + * + * Extended attributes are stored in two pieces. + * 1. An attribute header which has information about + * what file the attribute is for and what the attribute + * is named. + * 2. The attribute record itself. Stored as a normal file type + * of entry. + * Both the header and attribute record have special modes/typeflags + * associated with them. + * + * The names of the header in the archive look like: + * /dev/null/attr.hdr + * + * The name of the attribute looks like: + * /dev/null/attr. + * + * This is done so that an archiver that doesn't understand these formats + * can just dispose of the attribute records unless the user chooses to + * rename them via cpio -r or pax -i + * + * The format is composed of a fixed size header followed + * by a variable sized xattr_buf. If the attribute is a hard link + * to another attribute, then another xattr_buf section is included + * for the link. + * + * The xattr_buf is used to define the necessary "pathing" steps + * to get to the extended attribute. This is necessary to support + * a fully recursive attribute model where an attribute may itself + * have an attribute. + * + * The basic layout looks like this. + * + * -------------------------------- + * | | + * | xattr_hdr | + * | | + * -------------------------------- + * -------------------------------- + * | | + * | xattr_buf | + * | | + * -------------------------------- + * -------------------------------- + * | | + * | (optional link info) | + * | | + * -------------------------------- + * -------------------------------- + * | | + * | attribute itself | + * | stored as normal tar | + * | or cpio data with | + * | special mode or | + * | typeflag | + * | | + * -------------------------------- + * + */ +#define XATTR_ARCH_VERS "1.0" + +/* + * extended attribute fixed header + * + * h_version format version. + * h_size size of header + variable sized data sections. + * h_component_len Length of entire pathing section. + * h_link_component_len Length of link component section. Again same definition + * as h_component_len. + */ +struct xattr_hdr { + char h_version[7]; + char h_size[10]; + char h_component_len[10]; /* total length of path component */ + char h_link_component_len[10]; +}; + +/* + * The name is encoded like this: + * filepathNULattrpathNUL[attrpathNULL]... + */ +struct xattr_buf { + char h_namesz[7]; /* length of h_names */ + char h_typeflag; /* actual typeflag of file being archived */ + char h_names[1]; /* filepathNULattrpathNUL... */ +}; + +/* + * Special values for tar archives + */ + +/* + * typeflag for tar archives. + */ + +/* + * Attribute hdr and attribute files have the following typeflag + */ +#define _XATTR_HDRTYPE 'E' + +/* + * For cpio archives the header and attribute have + * _XATTR_CPIO_MODE ORED into the mode field in both + * character and binary versions of the archive format + */ +#define _XATTR_CPIO_MODE 0xB000 + +#ifdef __cplusplus +} +#endif + +#endif /* _ARCHIVES_H */ diff --git a/usr/src/head/arpa/ftp.h b/usr/src/head/arpa/ftp.h new file mode 100644 index 0000000000..4550b71e09 --- /dev/null +++ b/usr/src/head/arpa/ftp.h @@ -0,0 +1,148 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _ARPA_FTP_H +#define _ARPA_FTP_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Definitions for FTP + * See RFC-765 + */ + +/* + * Reply codes. + */ +#define PRELIM 1 /* positive preliminary */ +#define COMPLETE 2 /* positive completion */ +#define CONTINUE 3 /* positive intermediate */ +#define TRANSIENT 4 /* transient negative completion */ +#define ERROR 5 /* permanent negative completion */ + +/* + * Type codes + */ +#define TYPE_A 1 /* ASCII */ +#define TYPE_E 2 /* EBCDIC */ +#define TYPE_I 3 /* image */ +#define TYPE_L 4 /* local byte size */ +#ifdef FTP_NAMES +char *typenames[] = +{"0", "ASCII", "EBCDIC", "Image", "Local"}; +#endif + +/* + * Form codes + */ +#define FORM_N 1 /* non-print */ +#define FORM_T 2 /* telnet format effectors */ +#define FORM_C 3 /* carriage control (ASA) */ +#ifdef FTP_NAMES +char *formnames[] = +{"0", "Nonprint", "Telnet", "Carriage-control"}; +#endif + +/* + * Structure codes + */ +#define STRU_F 1 /* file (no record structure) */ +#define STRU_R 2 /* record structure */ +#define STRU_P 3 /* page structure */ +#ifdef FTP_NAMES +char *strunames[] = +{"0", "File", "Record", "Page"}; +#endif + +/* + * Mode types + */ +#define MODE_S 1 /* stream */ +#define MODE_B 2 /* block */ +#define MODE_C 3 /* compressed */ +#ifdef FTP_NAMES +char *modenames[] = +{"0", "Stream", "Block", "Compressed"}; +#endif + +/* + * Authentication types + */ +#define AUTHTYPE_NONE 0 +#define AUTHTYPE_GSSAPI 1 +#ifdef FTP_NAMES +char *authtypenames[] = { + "NONE", "GSSAPI", 0 +}; +#define GSS_AUTHTYPE_NAME(x) authtypenames[x] +#endif + +/* + * Protection levels + */ +#define PROT_C 1 /* no integrity; no encryption */ +#define PROT_S 2 /* integrity; no encryption */ +#define PROT_P 3 /* integrity; encryption */ +#define PROT_E 4 /* no integrity; encryption */ +#ifdef FTP_NAMES +char *protnames[] = + {"0", "Clear", "Safe", "Private", "Confidential"}; +#endif + +/* + * Record Tokens + */ +#define REC_ESC '\377' /* Record-mode Escape */ +#define REC_EOR '\001' /* Record-mode End-of-Record */ +#define REC_EOF '\002' /* Record-mode End-of-File */ + +/* + * Block Header + */ +#define BLK_EOR 0x80 /* Block is End-of-Record */ +#define BLK_EOF 0x40 /* Block is End-of-File */ +#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define BLK_BYTECOUNT 2 /* Bytes in this block */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ARPA_FTP_H */ diff --git a/usr/src/head/arpa/inet.h b/usr/src/head/arpa/inet.h new file mode 100644 index 0000000000..94fe089f8e --- /dev/null +++ b/usr/src/head/arpa/inet.h @@ -0,0 +1,94 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _ARPA_INET_H +#define _ARPA_INET_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) +#include <sys/socket.h> +#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */ + +#include <netinet/in.h> +#if defined(_XPG4_2) && !defined(__EXTENSIONS__) +#include <sys/byteorder.h> +#endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * External definitions for + * functions in inet(3N) + */ +#ifdef __STDC__ +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int inet_net_pton(int, const char *, void *, size_t); +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) +extern int inet_pton(int, const char *_RESTRICT_KYWD, void *_RESTRICT_KYWD); +extern const char *inet_ntop(int, const void *_RESTRICT_KYWD, + char *_RESTRICT_KYWD, socklen_t); +#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */ + +extern in_addr_t inet_addr(const char *); + +extern in_addr_t inet_lnaof(struct in_addr); +extern struct in_addr inet_makeaddr(in_addr_t, in_addr_t); +extern in_addr_t inet_netof(struct in_addr); +extern in_addr_t inet_network(const char *); +extern char *inet_ntoa(struct in_addr); +extern int inet_aton(const char *, struct in_addr *); +#else +unsigned long inet_addr(); +char *inet_ntoa(); +struct in_addr inet_makeaddr(); +unsigned long inet_network(); +extern unsigned long inet_lnaof(); +extern unsigned long inet_netof(); +extern int inet_pton(); +extern const char *inet_ntop(); +extern int inet_aton(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _ARPA_INET_H */ diff --git a/usr/src/head/arpa/nameser.h b/usr/src/head/arpa/nameser.h new file mode 100644 index 0000000000..60b8734b63 --- /dev/null +++ b/usr/src/head/arpa/nameser.h @@ -0,0 +1,608 @@ +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * $Id: nameser.h,v 8.50 2003/05/27 23:36:52 marka Exp $ + */ + +#ifndef _ARPA_NAMESER_H +#define _ARPA_NAMESER_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/isa_defs.h> + + +#ifdef __cplusplus +extern "C" { +#endif + +#define BIND_4_COMPAT + +/* + * Revision information. This is the release date in YYYYMMDD format. + * It can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__NAMESER > 19931104)". Do not + * compare for equality; rather, use it to determine whether your libresolv + * contains a new enough lib/nameser/ to support the feature you need. + */ + +#define __NAMESER 19991006 /* New interface version stamp. */ + +/* + * Define constants based on RFC 883, RFC 1034, RFC 1035 + */ +#define NS_PACKETSZ 512 /* default UDP packet size */ +#define NS_MAXDNAME 1025 /* maximum domain name */ +#define NS_MAXMSG 65535 /* maximum message size */ +#define NS_MAXCDNAME 255 /* maximum compressed domain name */ +#define NS_MAXLABEL 63 /* maximum length of domain label */ +#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ +#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ +#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */ +#define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */ +#define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */ +#define NS_INADDRSZ 4 /* IPv4 T_A */ +#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */ +#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ +#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ + +/* + * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord() + * in synch with it. + */ +typedef enum __ns_sect { + ns_s_qd = 0, /* Query: Question. */ + ns_s_zn = 0, /* Update: Zone. */ + ns_s_an = 1, /* Query: Answer. */ + ns_s_pr = 1, /* Update: Prerequisites. */ + ns_s_ns = 2, /* Query: Name servers. */ + ns_s_ud = 2, /* Update: Update. */ + ns_s_ar = 3, /* Query|Update: Additional records. */ + ns_s_max = 4 +} ns_sect; + +/* + * This is a message handle. It is caller allocated and has no dynamic data. + * This structure is intended to be opaque to all but ns_parse.c, thus the + * leading _'s on the member names. Use the accessor functions, not the _'s. + */ +typedef struct __ns_msg { + const uchar_t *_msg, *_eom; + uint16_t _id, _flags, _counts[ns_s_max]; + const uchar_t *_sections[ns_s_max]; + ns_sect _sect; + int _rrnum; + const uchar_t *_msg_ptr; +} ns_msg; + +/* Private data structure - do not use from outside library. */ +struct _ns_flagdata { int mask, shift; }; +extern struct _ns_flagdata _ns_flagdata[]; + +/* Accessor macros - this is part of the public interface. */ +#define ns_msg_id(handle) ((handle)._id + 0) +#define ns_msg_base(handle) ((handle)._msg + 0) +#define ns_msg_end(handle) ((handle)._eom + 0) +#define ns_msg_size(handle) ((handle)._eom - (handle)._msg) +#define ns_msg_count(handle, section) ((handle)._counts[section] + 0) + +/* + * This is a parsed record. It is caller allocated and has no dynamic data. + */ +typedef struct __ns_rr { + char name[NS_MAXDNAME]; + uint16_t type; + uint16_t rr_class; + uint32_t ttl; + uint16_t rdlength; + const uchar_t *rdata; +} ns_rr; + +/* Accessor macros - this is part of the public interface. */ +#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") +#define ns_rr_type(rr) ((ns_type)((rr).type + 0)) +#define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0)) +#define ns_rr_ttl(rr) ((rr).ttl + 0) +#define ns_rr_rdlen(rr) ((rr).rdlength + 0) +#define ns_rr_rdata(rr) ((rr).rdata + 0) + +/* + * These don't have to be in the same order as in the packet flags word, + * and they can even overlap in some cases, but they will need to be kept + * in synch with ns_parse.c:ns_flagdata[]. + */ +typedef enum __ns_flag { + ns_f_qr, /* Question/Response. */ + ns_f_opcode, /* Operation code. */ + ns_f_aa, /* Authoritative Answer. */ + ns_f_tc, /* Truncation occurred. */ + ns_f_rd, /* Recursion Desired. */ + ns_f_ra, /* Recursion Available. */ + ns_f_z, /* MBZ. */ + ns_f_ad, /* Authentic Data (DNSSEC). */ + ns_f_cd, /* Checking Disabled (DNSSEC). */ + ns_f_rcode, /* Response code. */ + ns_f_max +} ns_flag; + +/* + * Currently defined opcodes. + */ +typedef enum __ns_opcode { + ns_o_query = 0, /* Standard query. */ + ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ + ns_o_status = 2, /* Name server status query (unsupported). */ + /* Opcode 3 is undefined/reserved. */ + ns_o_notify = 4, /* Zone change notification. */ + ns_o_update = 5, /* Zone update message. */ + ns_o_max = 6 +} ns_opcode; + +/* + * Currently defined response codes. + */ +typedef enum __ns_rcode { + ns_r_noerror = 0, /* No error occurred. */ + ns_r_formerr = 1, /* Format error. */ + ns_r_servfail = 2, /* Server failure. */ + ns_r_nxdomain = 3, /* Name error. */ + ns_r_notimpl = 4, /* Unimplemented. */ + ns_r_refused = 5, /* Operation refused. */ + /* these are for BIND_UPDATE */ + ns_r_yxdomain = 6, /* Name exists */ + ns_r_yxrrset = 7, /* RRset exists */ + ns_r_nxrrset = 8, /* RRset does not exist */ + ns_r_notauth = 9, /* Not authoritative for zone */ + ns_r_notzone = 10, /* Zone of record different from zone section */ + ns_r_max = 11, + /* The following are EDNS extended rcodes */ + ns_r_badvers = 16, + /* The following are TSIG errors */ + ns_r_badsig = 16, + ns_r_badkey = 17, + ns_r_badtime = 18 +} ns_rcode; + +/* BIND_UPDATE */ +typedef enum __ns_update_operation { + ns_uop_delete = 0, + ns_uop_add = 1, + ns_uop_max = 2 +} ns_update_operation; + +/* + * This RR-like structure is particular to UPDATE. + */ +struct ns_updrec { + struct ns_updrec *r_prev; /* prev record */ + struct ns_updrec *r_next; /* next record */ + uint8_t r_section; /* ZONE/PREREQUISITE/UPDATE */ + char *r_dname; /* owner of the RR */ + uint16_t r_class; /* class number */ + uint16_t r_type; /* type number */ + uint32_t r_ttl; /* time to live */ + uchar_t *r_data; /* rdata fields as text string */ + uint16_t r_size; /* size of r_data field */ + int r_opcode; /* type of operation */ + /* following fields for private use by the resolver/server routines */ + struct ns_updrec *r_grpnext; /* next record when grouped */ + struct databuf *r_dp; /* databuf to process */ + struct databuf *r_deldp; /* databuf's deleted/overwritten */ + uint16_t r_zone; /* zone number on server */ +}; +typedef struct ns_updrec ns_updrec; + +/* + * This structure is used for TSIG authenticated messages + */ +struct ns_tsig_key { + char name[NS_MAXDNAME], alg[NS_MAXDNAME]; + unsigned char *data; + int len; +}; +typedef struct ns_tsig_key ns_tsig_key; + +/* + * This structure is used for TSIG authenticated TCP messages + */ +struct ns_tcp_tsig_state { + int counter; + struct dst_key *key; + void *ctx; + unsigned char sig[NS_PACKETSZ]; + int siglen; +}; +typedef struct ns_tcp_tsig_state ns_tcp_tsig_state; + +#define NS_TSIG_FUDGE 300 +#define NS_TSIG_TCP_COUNT 100 +#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT" + +#define NS_TSIG_ERROR_NO_TSIG -10 +#define NS_TSIG_ERROR_NO_SPACE -11 +#define NS_TSIG_ERROR_FORMERR -12 + +/* + * Currently defined type values for resources and queries. + */ +typedef enum __ns_type { + ns_t_invalid = 0, /* Cookie. */ + ns_t_a = 1, /* Host address. */ + ns_t_ns = 2, /* Authoritative server. */ + ns_t_md = 3, /* Mail destination. */ + ns_t_mf = 4, /* Mail forwarder. */ + ns_t_cname = 5, /* Canonical name. */ + ns_t_soa = 6, /* Start of authority zone. */ + ns_t_mb = 7, /* Mailbox domain name. */ + ns_t_mg = 8, /* Mail group member. */ + ns_t_mr = 9, /* Mail rename name. */ + ns_t_null = 10, /* Null resource record. */ + ns_t_wks = 11, /* Well known service. */ + ns_t_ptr = 12, /* Domain name pointer. */ + ns_t_hinfo = 13, /* Host information. */ + ns_t_minfo = 14, /* Mailbox information. */ + ns_t_mx = 15, /* Mail routing information. */ + ns_t_txt = 16, /* Text strings. */ + ns_t_rp = 17, /* Responsible person. */ + ns_t_afsdb = 18, /* AFS cell database. */ + ns_t_x25 = 19, /* X_25 calling address. */ + ns_t_isdn = 20, /* ISDN calling address. */ + ns_t_rt = 21, /* Router. */ + ns_t_nsap = 22, /* NSAP address. */ + ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ + ns_t_sig = 24, /* Security signature. */ + ns_t_key = 25, /* Security key. */ + ns_t_px = 26, /* X.400 mail mapping. */ + ns_t_gpos = 27, /* Geographical position (withdrawn). */ + ns_t_aaaa = 28, /* IPv6 Address. */ + ns_t_loc = 29, /* Location Information. */ + ns_t_nxt = 30, /* Next domain (security). */ + ns_t_eid = 31, /* Endpoint identifier. */ + ns_t_nimloc = 32, /* Nimrod Locator. */ + ns_t_srv = 33, /* Server Selection. */ + ns_t_atma = 34, /* ATM Address */ + ns_t_naptr = 35, /* Naming Authority PoinTeR */ + ns_t_kx = 36, /* Key Exchange */ + ns_t_cert = 37, /* Certification record */ + ns_t_a6 = 38, /* IPv6 address (deprecated) */ + ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ + ns_t_sink = 40, /* Kitchen sink (experimentatl) */ + ns_t_opt = 41, /* EDNS0 option (meta-RR) */ + ns_t_apl = 42, /* Address prefix list (RFC 3123) */ + ns_t_tkey = 249, /* Transaction key */ + ns_t_tsig = 250, /* Transaction signature. */ + ns_t_ixfr = 251, /* Incremental zone transfer. */ + ns_t_axfr = 252, /* Transfer zone of authority. */ + ns_t_mailb = 253, /* Transfer mailbox records. */ + ns_t_maila = 254, /* Transfer mail agent records. */ + ns_t_any = 255, /* Wildcard match. */ + ns_t_zxfr = 256, /* BIND-specific, nonstandard. */ + ns_t_max = 65536 +} ns_type; + +/* Exclusively a QTYPE? (not also an RTYPE) */ +#define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \ + (t) == ns_t_mailb || (t) == ns_t_maila) +/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */ +#define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt) +/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */ +#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t)) +#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr) +#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \ + (t) == ns_t_zxfr) + +/* + * Values for class field + */ +typedef enum __ns_class { + ns_c_invalid = 0, /* Cookie. */ + ns_c_in = 1, /* Internet. */ + ns_c_2 = 2, /* unallocated/unsupported. */ + ns_c_chaos = 3, /* MIT Chaos-net. */ + ns_c_hs = 4, /* MIT Hesiod. */ + /* Query class values which do not appear in resource records */ + ns_c_none = 254, /* for prereq. sections in update requests */ + ns_c_any = 255, /* Wildcard match. */ + ns_c_max = 65536 +} ns_class; + +/* DNSSEC constants. */ + +typedef enum __ns_key_types { + ns_kt_rsa = 1, /* key type RSA/MD5 */ + ns_kt_dh = 2, /* Diffie Hellman */ + ns_kt_dsa = 3, /* Digital Signature Standard (MANDATORY) */ + ns_kt_private = 254 /* Private key type starts with OID */ +} ns_key_types; + +typedef enum __ns_cert_types { + cert_t_pkix = 1, /* PKIX (X.509v3) */ + cert_t_spki = 2, /* SPKI */ + cert_t_pgp = 3, /* PGP */ + cert_t_url = 253, /* URL private type */ + cert_t_oid = 254 /* OID private type */ +} ns_cert_types; + +/* Flags field of the KEY RR rdata. */ +#define NS_KEY_TYPEMASK 0xC000 /* Mask for "type" bits */ +#define NS_KEY_TYPE_AUTH_CONF 0x0000 /* Key usable for both */ +#define NS_KEY_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */ +#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */ +#define NS_KEY_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */ +/* The type bits can also be interpreted independently, as single bits: */ +#define NS_KEY_NO_AUTH 0x8000 /* Key unusable for authentication */ +#define NS_KEY_NO_CONF 0x4000 /* Key unusable for confidentiality */ +#define NS_KEY_RESERVED2 0x2000 /* Security is *mandatory* if bit=0 */ +#define NS_KEY_EXTENDED_FLAGS 0x1000 /* reserved - must be zero */ +#define NS_KEY_RESERVED4 0x0800 /* reserved - must be zero */ +#define NS_KEY_RESERVED5 0x0400 /* reserved - must be zero */ +#define NS_KEY_NAME_TYPE 0x0300 /* these bits determine the type */ +#define NS_KEY_NAME_USER 0x0000 /* key is assoc. with user */ +#define NS_KEY_NAME_ENTITY 0x0200 /* key is assoc. with entity eg host */ +#define NS_KEY_NAME_ZONE 0x0100 /* key is zone key */ +#define NS_KEY_NAME_RESERVED 0x0300 /* reserved meaning */ +#define NS_KEY_RESERVED8 0x0080 /* reserved - must be zero */ +#define NS_KEY_RESERVED9 0x0040 /* reserved - must be zero */ +#define NS_KEY_RESERVED10 0x0020 /* reserved - must be zero */ +#define NS_KEY_RESERVED11 0x0010 /* reserved - must be zero */ +#define NS_KEY_SIGNATORYMASK 0x000F /* key can sign RR's of same name */ +#define NS_KEY_RESERVED_BITMASK (NS_KEY_RESERVED2 | \ + NS_KEY_RESERVED4 | \ + NS_KEY_RESERVED5 | \ + NS_KEY_RESERVED8 | \ + NS_KEY_RESERVED9 | \ + NS_KEY_RESERVED10 | \ + NS_KEY_RESERVED11) +#define NS_KEY_RESERVED_BITMASK2 0xFFFF /* no bits defined here */ + +/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */ +#define NS_ALG_MD5RSA 1 /* MD5 with RSA */ +#define NS_ALG_DH 2 /* Diffie Hellman KEY */ +#define NS_ALG_DSA 3 /* DSA KEY */ +#define NS_ALG_DSS NS_ALG_DSA +#define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */ +#define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */ + +/* Protocol values */ +/* value 0 is reserved */ +#define NS_KEY_PROT_TLS 1 +#define NS_KEY_PROT_EMAIL 2 +#define NS_KEY_PROT_DNSSEC 3 +#define NS_KEY_PROT_IPSEC 4 +#define NS_KEY_PROT_ANY 255 + +/* Signatures */ +#define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */ +#define NS_MD5RSA_MAX_BITS 4096 + /* Total of binary mod and exp */ +#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3) + /* Max length of text sig block */ +#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES+2)/3)*4) +#define NS_MD5RSA_MIN_SIZE ((NS_MD5RSA_MIN_BITS+7)/8) +#define NS_MD5RSA_MAX_SIZE ((NS_MD5RSA_MAX_BITS+7)/8) + +#define NS_DSA_SIG_SIZE 41 +#define NS_DSA_MIN_SIZE 213 +#define NS_DSA_MAX_BYTES 405 + +/* Offsets into SIG record rdata to find various values */ +#define NS_SIG_TYPE 0 /* Type flags */ +#define NS_SIG_ALG 2 /* Algorithm */ +#define NS_SIG_LABELS 3 /* How many labels in name */ +#define NS_SIG_OTTL 4 /* Original TTL */ +#define NS_SIG_EXPIR 8 /* Expiration time */ +#define NS_SIG_SIGNED 12 /* Signature time */ +#define NS_SIG_FOOT 16 /* Key footprint */ +#define NS_SIG_SIGNER 18 /* Domain name of who signed it */ + +/* How RR types are represented as bit-flags in NXT records */ +#define NS_NXT_BITS 8 +#define NS_NXT_BIT_SET(n, p) \ + (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS))) +#define NS_NXT_BIT_CLEAR(n, p) \ + (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS))) +#define NS_NXT_BIT_ISSET(n, p) \ + (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS))) +#define NS_NXT_MAX 127 + +/* + * EDNS0 extended flags, host order. + */ +#define NS_OPT_DNSSEC_OK 0x8000U + +/* + * Inline versions of get/put short/long. Pointer is advanced. + */ +#define NS_GET16(s, cp) do { \ + register const uchar_t *t_cp = (const uchar_t *)(cp); \ + (s) = ((uint16_t)t_cp[0] << 8) \ + | ((uint16_t)t_cp[1]) \ + ; \ + (cp) += NS_INT16SZ; \ +} while (0) + +#define NS_GET32(l, cp) do { \ + register const uchar_t *t_cp = (const uchar_t *)(cp); \ + (l) = ((uint32_t)t_cp[0] << 24) \ + | ((uint32_t)t_cp[1] << 16) \ + | ((uint32_t)t_cp[2] << 8) \ + | ((uint32_t)t_cp[3]) \ + ; \ + (cp) += NS_INT32SZ; \ +} while (0) + +#define NS_PUT16(s, cp) do { \ + register uint16_t t_s = (uint16_t)(s); \ + register uchar_t *t_cp = (uchar_t *)(cp); \ + *t_cp++ = t_s >> 8; \ + *t_cp = t_s; \ + (cp) += NS_INT16SZ; \ +} while (0) + +#define NS_PUT32(l, cp) do { \ + register uint32_t t_l = (uint32_t)(l); \ + register uchar_t *t_cp = (uchar_t *)(cp); \ + *t_cp++ = t_l >> 24; \ + *t_cp++ = t_l >> 16; \ + *t_cp++ = t_l >> 8; \ + *t_cp = t_l; \ + (cp) += NS_INT32SZ; \ +} while (0) + +/* + * ANSI C identifier hiding. + */ +#define ns_msg_getflag __ns_msg_getflag +#define ns_get16 __ns_get16 +#define ns_get32 __ns_get32 +#define ns_put16 __ns_put16 +#define ns_put32 __ns_put32 +#define ns_initparse __ns_initparse +#define ns_skiprr __ns_skiprr +#define ns_parserr __ns_parserr +#define ns_sprintrr __ns_sprintrr +#define ns_sprintrrf __ns_sprintrrf +#define ns_format_ttl __ns_format_ttl +#define ns_parse_ttl __ns_parse_ttl +#define ns_datetosecs __ns_datetosecs +#define ns_name_ntol __ns_name_ntol +#define ns_name_ntop __ns_name_ntop +#define ns_name_pton __ns_name_pton +#define ns_name_unpack __ns_name_unpack +#define ns_name_pack __ns_name_pack +#define ns_name_compress __ns_name_compress +#define ns_name_uncompress __ns_name_uncompress +#define ns_name_skip __ns_name_skip +#define ns_name_rollback __ns_name_rollback +#define ns_sign __ns_sign +#define ns_sign2 __ns_sign2 +#define ns_sign_tcp __ns_sign_tcp +#define ns_sign_tcp2 __ns_sign_tcp2 +#define ns_sign_tcp_init __ns_sign_tcp_init +#define ns_find_tsig __ns_find_tsig +#define ns_verify __ns_verify +#define ns_verify_tcp __ns_verify_tcp +#define ns_verify_tcp_init __ns_verify_tcp_init +#define ns_samedomain __ns_samedomain +#define ns_subdomain __ns_subdomain +#define ns_makecanon __ns_makecanon +#define ns_samename __ns_samename + +int ns_msg_getflag(ns_msg, int); +uint_t ns_get16(const uchar_t *); +ulong_t ns_get32(const uchar_t *); +void ns_put16(uint_t, uchar_t *); +void ns_put32(ulong_t, uchar_t *); +int ns_initparse(const uchar_t *, int, ns_msg *); +int ns_skiprr(const uchar_t *, const uchar_t *, ns_sect, int); +int ns_parserr(ns_msg *, ns_sect, int, ns_rr *); +int ns_sprintrr(const ns_msg *, const ns_rr *, + const char *, const char *, char *, size_t); +int ns_sprintrrf(const uchar_t *, size_t, const char *, + ns_class, ns_type, ulong_t, const uchar_t *, + size_t, const char *, const char *, + char *, size_t); +int ns_format_ttl(ulong_t, char *, size_t); +int ns_parse_ttl(const char *, ulong_t *); +uint32_t ns_datetosecs(const char *cp, int *errp); +int ns_name_ntol(const uchar_t *, uchar_t *, size_t); +int ns_name_ntop(const uchar_t *, char *, size_t); +int ns_name_pton(const char *, uchar_t *, size_t); +int ns_name_unpack(const uchar_t *, const uchar_t *, + const uchar_t *, uchar_t *, size_t); +int ns_name_pack(const uchar_t *, uchar_t *, int, + const uchar_t **, const uchar_t **); +int ns_name_uncompress(const uchar_t *, const uchar_t *, + const uchar_t *, char *, size_t); +int ns_name_compress(const char *, uchar_t *, size_t, + const uchar_t **, const uchar_t **); +int ns_name_skip(const uchar_t **, const uchar_t *); +void ns_name_rollback(const uchar_t *, const uchar_t **, + const uchar_t **); +int ns_sign(uchar_t *, int *, int, int, void *, + const uchar_t *, int, uchar_t *, int *, time_t); +int ns_sign2(uchar_t *, int *, int, int, void *, + const uchar_t *, int, uchar_t *, int *, time_t, + uchar_t **, uchar_t **); +int ns_sign_tcp(uchar_t *, int *, int, int, + ns_tcp_tsig_state *, int); +int ns_sign_tcp2(uchar_t *, int *, int, int, + ns_tcp_tsig_state *, int, + uchar_t **, uchar_t **); +int ns_sign_tcp_init(void *, const uchar_t *, int, + ns_tcp_tsig_state *); +uchar_t *ns_find_tsig(uchar_t *, uchar_t *); +int ns_verify(uchar_t *, int *, void *, + const uchar_t *, int, uchar_t *, int *, + time_t *, int); +int ns_verify_tcp(uchar_t *, int *, ns_tcp_tsig_state *, int); +int ns_verify_tcp_init(void *, const uchar_t *, int, + ns_tcp_tsig_state *); +int ns_samedomain(const char *, const char *); +int ns_subdomain(const char *, const char *); +int ns_makecanon(const char *, char *, size_t); +int ns_samename(const char *, const char *); + +#ifdef BIND_4_COMPAT +#include <arpa/nameser_compat.h> +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !_ARPA_NAMESER_H */ diff --git a/usr/src/head/arpa/nameser_compat.h b/usr/src/head/arpa/nameser_compat.h new file mode 100644 index 0000000000..fc773d7397 --- /dev/null +++ b/usr/src/head/arpa/nameser_compat.h @@ -0,0 +1,273 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright(c) 1983, 1989 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * from nameser.h 8.1 (Berkeley) 6/2/93 + * $Id: nameser_compat.h,v 8.15 2002/07/17 07:01:02 marka Exp $ + */ + +#ifndef _ARPA_NAMESER_COMPAT_H +#define _ARPA_NAMESER_COMPAT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define __BIND 19950621 /* (DEAD) interface version stamp. */ + +#ifndef BYTE_ORDER +#if (BSD >= 199103) +#include <machine/endian.h> +#else +#ifdef linux +#include <endian.h> +#else +#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */ +#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ + +#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \ + defined(__i386) || defined(__ia64) || defined(__amd64) || \ + defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ + defined(__alpha__) || defined(__alpha) || \ + (defined(__Lynx__) && defined(__x86__)) +#define BYTE_ORDER LITTLE_ENDIAN +#endif + +#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ + defined(__sparc) || \ + defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ + defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\ + defined(apollo) || defined(__convex__) || defined(_CRAY) || \ + defined(__hppa) || defined(__hp9000) || \ + defined(__hp9000s300) || defined(__hp9000s700) || \ + defined(__hp3000s900) || defined(MPE) || \ + defined(BIT_ZERO_ON_LEFT) || defined(m68k) || \ + (defined(__Lynx__) && \ + (defined(__68k__) || defined(__sparc__) || defined(__powerpc__))) +#define BYTE_ORDER BIG_ENDIAN +#endif +#endif /* linux */ +#endif /* BSD */ +#endif /* BYTE_ORDER */ + +#if !defined(BYTE_ORDER) || \ + (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \ + BYTE_ORDER != PDP_ENDIAN) + /* + * you must determine what the correct bit order is for + * your compiler - the next line is an intentional error + * which will force your compiles to bomb until you fix + * the above macros. + */ + error "Undefined or invalid BYTE_ORDER"; +#endif + +/* + * Structure for query header. The order of the fields is machine- and + * compiler-dependent, depending on the byte/bit order and the layout + * of bit fields. We use bit fields only in int variables, as this + * is all ANSI requires. This requires a somewhat confusing rearrangement. + */ + +typedef struct { + unsigned id :16; /* query identification number */ +#if BYTE_ORDER == BIG_ENDIAN + /* fields in third byte */ + unsigned qr: 1; /* response flag */ + unsigned opcode: 4; /* purpose of message */ + unsigned aa: 1; /* authoritive answer */ + unsigned tc: 1; /* truncated message */ + unsigned rd: 1; /* recursion desired */ + /* fields in fourth byte */ + unsigned ra: 1; /* recursion available */ + unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned ad: 1; /* authentic data from named */ + unsigned cd: 1; /* checking disabled by resolver */ + unsigned rcode :4; /* response code */ +#endif +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN + /* fields in third byte */ + unsigned rd :1; /* recursion desired */ + unsigned tc :1; /* truncated message */ + unsigned aa :1; /* authoritive answer */ + unsigned opcode :4; /* purpose of message */ + unsigned qr :1; /* response flag */ + /* fields in fourth byte */ + unsigned rcode :4; /* response code */ + unsigned cd: 1; /* checking disabled by resolver */ + unsigned ad: 1; /* authentic data from named */ + unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned ra :1; /* recursion available */ +#endif + /* remaining bytes */ + unsigned qdcount :16; /* number of question entries */ + unsigned ancount :16; /* number of answer entries */ + unsigned nscount :16; /* number of authority entries */ + unsigned arcount :16; /* number of resource entries */ +} HEADER; + +#define PACKETSZ NS_PACKETSZ +#define MAXDNAME NS_MAXDNAME +#define MAXCDNAME NS_MAXCDNAME +#define MAXLABEL NS_MAXLABEL +#define HFIXEDSZ NS_HFIXEDSZ +#define QFIXEDSZ NS_QFIXEDSZ +#define RRFIXEDSZ NS_RRFIXEDSZ +#define INT32SZ NS_INT32SZ +#define INT16SZ NS_INT16SZ +#define INT8SZ NS_INT8SZ +#define INADDRSZ NS_INADDRSZ +#define IN6ADDRSZ NS_IN6ADDRSZ +#define INDIR_MASK NS_CMPRSFLGS +#define NAMESERVER_PORT NS_DEFAULTPORT + +#define S_ZONE ns_s_zn +#define S_PREREQ ns_s_pr +#define S_UPDATE ns_s_ud +#define S_ADDT ns_s_ar + +#define QUERY ns_o_query +#define IQUERY ns_o_iquery +#define STATUS ns_o_status +#define NS_NOTIFY_OP ns_o_notify +#define NS_UPDATE_OP ns_o_update + +#define NOERROR ns_r_noerror +#define FORMERR ns_r_formerr +#define SERVFAIL ns_r_servfail +#define NXDOMAIN ns_r_nxdomain +#define NOTIMP ns_r_notimpl +#define REFUSED ns_r_refused +#define YXDOMAIN ns_r_yxdomain +#define YXRRSET ns_r_yxrrset +#define NXRRSET ns_r_nxrrset +#define NOTAUTH ns_r_notauth +#define NOTZONE ns_r_notzone +/* #define BADSIG ns_r_badsig */ +/* #define BADKEY ns_r_badkey */ +/* #define BADTIME ns_r_badtime */ + +#define DELETE ns_uop_delete +#ifndef ADD +#define ADD ns_uop_add +#endif + +#define T_A ns_t_a +#define T_NS ns_t_ns +#define T_MD ns_t_md +#define T_MF ns_t_mf +#define T_CNAME ns_t_cname +#define T_SOA ns_t_soa +#define T_MB ns_t_mb +#define T_MG ns_t_mg +#define T_MR ns_t_mr +#define T_NULL ns_t_null +#define T_WKS ns_t_wks +#define T_PTR ns_t_ptr +#define T_HINFO ns_t_hinfo +#define T_MINFO ns_t_minfo +#define T_MX ns_t_mx +#define T_TXT ns_t_txt +#define T_RP ns_t_rp +#define T_AFSDB ns_t_afsdb +#define T_X25 ns_t_x25 +#define T_ISDN ns_t_isdn +#define T_RT ns_t_rt +#define T_NSAP ns_t_nsap +#define T_NSAP_PTR ns_t_nsap_ptr +#define T_SIG ns_t_sig +#define T_KEY ns_t_key +#define T_PX ns_t_px +#define T_GPOS ns_t_gpos +#define T_AAAA ns_t_aaaa +#define T_LOC ns_t_loc +#define T_NXT ns_t_nxt +#define T_EID ns_t_eid +#define T_NIMLOC ns_t_nimloc +#define T_SRV ns_t_srv +#define T_ATMA ns_t_atma +#define T_NAPTR ns_t_naptr +#define T_A6 ns_t_a6 +#define T_TSIG ns_t_tsig +#define T_IXFR ns_t_ixfr +#define T_AXFR ns_t_axfr +#define T_MAILB ns_t_mailb +#define T_MAILA ns_t_maila +#define T_ANY ns_t_any + +#define C_IN ns_c_in +#define C_CHAOS ns_c_chaos +#define C_HS ns_c_hs +/* BIND_UPDATE */ +#define C_NONE ns_c_none +#define C_ANY ns_c_any + +#define GETSHORT NS_GET16 +#define GETLONG NS_GET32 +#define PUTSHORT NS_PUT16 +#define PUTLONG NS_PUT32 + +#ifdef __cplusplus +} +#endif + +#endif /* _ARPA_NAMESER_COMPAT_H */ diff --git a/usr/src/head/arpa/telnet.h b/usr/src/head/arpa/telnet.h new file mode 100644 index 0000000000..b6aa889e10 --- /dev/null +++ b/usr/src/head/arpa/telnet.h @@ -0,0 +1,432 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _ARPA_TELNET_H +#define _ARPA_TELNET_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Definitions for the TELNET protocol. + */ +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ +#define EOR 239 /* end of record (transparent mode) */ +#define ABORT 238 /* Abort process */ +#define SUSP 237 /* Suspend process */ +#define xEOF 236 /* End of file: EOF is already used... */ + +#define SYNCH 242 /* for telfunc calls */ + +#ifdef TELCMDS +char *telcmds[] = { + "EOF", "SUSP", "ABORT", "EOR", + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0 +}; +#endif + +#define TELCMD_FIRST xEOF +#define TELCMD_LAST IAC +#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ + (unsigned int)(x) >= TELCMD_FIRST) +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] + +/* telnet options */ +#define TELOPT_BINARY 0 /* 8-bit data path */ +#define TELOPT_ECHO 1 /* echo */ +#define TELOPT_RCP 2 /* prepare to reconnect */ +#define TELOPT_SGA 3 /* suppress go ahead */ +#define TELOPT_NAMS 4 /* approximate message size */ +#define TELOPT_STATUS 5 /* give status */ +#define TELOPT_TM 6 /* timing mark */ +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define TELOPT_NAOL 8 /* negotiate about output line width */ +#define TELOPT_NAOP 9 /* negotiate about output page size */ +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_LOGOUT 18 /* force logout */ +#define TELOPT_BM 19 /* byte macro */ +#define TELOPT_DET 20 /* data entry terminal */ +#define TELOPT_SUPDUP 21 /* supdup protocol */ +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define TELOPT_SNDLOC 23 /* send location */ +#define TELOPT_TTYPE 24 /* terminal type */ +#define TELOPT_EOR 25 /* end or record */ +#define TELOPT_TUID 26 /* TACACS user identification */ +#define TELOPT_OUTMRK 27 /* output marking */ +#define TELOPT_TTYLOC 28 /* terminal location number */ +#define TELOPT_3270REGIME 29 /* 3270 regime */ +#define TELOPT_X3PAD 30 /* X.3 PAD */ +#define TELOPT_NAWS 31 /* window size */ +#define TELOPT_TSPEED 32 /* terminal speed */ +#define TELOPT_LFLOW 33 /* remote flow control */ +#define TELOPT_LINEMODE 34 /* Linemode option */ +#define TELOPT_XDISPLOC 35 /* X Display Location */ +#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ +#define TELOPT_AUTHENTICATION 37 /* Authenticate */ +#define TELOPT_ENCRYPT 38 /* Encryption option */ +#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ +#define TELOPT_EXOPL 255 /* extended-options-list */ + +#ifdef TELOPTS +#define NTELOPTS (1+TELOPT_NEW_ENVIRON) +char *telopts[NTELOPTS+1] = { + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", + "TACACS UID", "OUTPUT MARKING", "TTYLOC", + "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", + "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", + "ENCRYPT", "NEW-ENVIRON", + 0, +}; +#endif /* TELOPTS */ +#define TELOPT_FIRST TELOPT_BINARY +#define TELOPT_LAST TELOPT_NEW_ENVIRON +#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) +#define TELOPT(x) telopts[(x)-TELOPT_FIRST] + +/* sub-option qualifiers */ +#define TELQUAL_IS 0 /* option is... */ +#define TELQUAL_SEND 1 /* send option */ +#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ +#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ +#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ + +#define LFLOW_OFF 0 /* Disable remote flow control */ +#define LFLOW_ON 1 /* Enable remote flow control */ +#define LFLOW_RESTART_ANY 2 /* Restart output on any char */ +#define LFLOW_RESTART_XON 3 /* Restart output only on XON */ + +/* + * LINEMODE suboptions + */ + +#define LM_MODE 1 +#define LM_FORWARDMASK 2 +#define LM_SLC 3 + +#define MODE_EDIT 0x01 +#define MODE_TRAPSIG 0x02 +#define MODE_ACK 0x04 +#define MODE_SOFT_TAB 0x08 +#define MODE_LIT_ECHO 0x10 + +#define MODE_MASK 0x1f + +/* Not part of protocol, but needed to simplify things... */ +#define MODE_FLOW 0x0100 +#define MODE_ECHO 0x0200 +#define MODE_INBIN 0x0400 +#define MODE_OUTBIN 0x0800 +#define MODE_FORCE 0x1000 + +#define SLC_SYNCH 1 +#define SLC_BRK 2 +#define SLC_IP 3 +#define SLC_AO 4 +#define SLC_AYT 5 +#define SLC_EOR 6 +#define SLC_ABORT 7 +#define SLC_EOF 8 +#define SLC_SUSP 9 +#define SLC_EC 10 +#define SLC_EL 11 +#define SLC_EW 12 +#define SLC_RP 13 +#define SLC_LNEXT 14 +#define SLC_XON 15 +#define SLC_XOFF 16 +#define SLC_FORW1 17 +#define SLC_FORW2 18 + +#define NSLC 18 + +/* + * For backwards compatability, we define SLC_NAMES to be the + * list of names if SLC_NAMES is not defined. + */ +#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ + "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, +#ifdef SLC_NAMES +char *slc_names[] = { + SLC_NAMELIST +}; +#else +extern char *slc_names[]; +#define SLC_NAMES SLC_NAMELIST +#endif + +#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) +#define SLC_NAME(x) slc_names[x] + +#define SLC_NOSUPPORT 0 +#define SLC_CANTCHANGE 1 +#define SLC_VARIABLE 2 +#define SLC_DEFAULT 3 +#define SLC_LEVELBITS 0x03 + +#define SLC_FUNC 0 +#define SLC_FLAGS 1 +#define SLC_VALUE 2 + +#define SLC_ACK 0x80 +#define SLC_FLUSHIN 0x40 +#define SLC_FLUSHOUT 0x20 + +#define OLD_ENV_VAR 1 +#define OLD_ENV_VALUE 0 +#define NEW_ENV_VAR 0 +#define NEW_ENV_VALUE 1 +#define ENV_ESC 2 +#define ENV_USERVAR 3 + +/* + * AUTHENTICATION suboptions + */ +#define AUTH_REJECT 0 /* Rejected */ +#define AUTH_UNKNOWN 1 /* We don't know who he is, but he's okay */ +#define AUTH_OTHER 2 /* We know him, but not his name */ +#define AUTH_USER 3 /* We know his name */ +#define AUTH_VALID 4 /* We know him, and he needs no password */ + +/* + * Who is authenticating who ... + */ +#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ +#define AUTH_WHO_SERVER 1 /* Server authenticating client */ +#define AUTH_WHO_MASK 1 + +#ifdef AUTHWHO_STR +char *authwho_str[] = { + "CLIENT", "SERVER" }; +#define AUTHWHO_NAME(x) authwho_str[x] +#endif /* AUTHWHO_STR */ + +/* + * amount of authentication done + */ +#define AUTH_HOW_ONE_WAY 0 +#define AUTH_HOW_MUTUAL 2 +#define AUTH_HOW_MASK 2 + +/* + * should we be encrypting? (not yet formally standardized) + */ +#define AUTH_ENCRYPT_OFF 0 +#define AUTH_ENCRYPT_ON 4 +#define AUTH_ENCRYPT_MASK 4 + +#define AUTHTYPE_NULL 0 +#define AUTHTYPE_KERBEROS_V4 1 /* not supported */ +#define AUTHTYPE_KERBEROS_V5 2 +#define AUTHTYPE_CNT 3 + +#define OPTS_FORWARD_CREDS 0x00000002 +#define OPTS_FORWARDABLE_CREDS 0x00000001 + +#ifdef AUTHTYPE_NAMES +char *authtype_names[] = { + "NULL", "KERBEROS_V4", "KERBEROS_V5", 0, +}; +#else +extern char *authtype_names[]; +#endif /* AUTHTYPE_NAMES */ + +#define AUTHTYPE_NAME(x) authtype_names[x] +#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) + +#ifdef AUTHHOW_NAMES +char *authhow_names[] = { + "ONE-WAY", "[undefined]", "MUTUAL" }; +#endif /* AUTHHOW_NAMES */ + +#define AUTHHOW_NAME(x) authhow_names[x] + +#define KRB_AUTH 0 /* Authentication data follows */ +#define KRB_REJECT 1 /* Rejected (reason might follow) */ +#define KRB_ACCEPT 2 /* Accepted */ +#define KRB_RESPONSE 3 /* Response for mutual auth. */ +#define KRB_FORWARD 4 /* Forwarded credentials follow */ +#define KRB_FORWARD_ACCEPT 5 /* Forwarded credentials accepted */ +#define KRB_FORWARD_REJECT 6 /* Forwarded credentials rejected */ + +#ifdef AUTHRSP_NAMES +char *authrsp_names[] = { + "AUTH", "REJECT", "ACCEPT", "RESPONSE", "FORWARD", + "FORWARD_ACCEPT", "FORWARD_REJECT" }; +#define AUTHRSP_NAME(x) authrsp_names[x] +#endif /* AUTHRSP_NAMES */ + +#define AUTH_MODE_REQUIRE 0 +#define AUTH_MODE_PROMPT 1 +#define AUTH_MODE_WARN 2 +#define AUTH_MODE_REJECT 3 + + +/* + * Encryption suboptions. See RFC 2946. + */ +#define ENCRYPT_IS 0 /* I pick encryption type ... */ +#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ +#define ENCRYPT_REPLY 2 /* Initial setup response */ +#define ENCRYPT_START 3 /* Starting encrypting output */ +#define ENCRYPT_END 4 /* End encrypting output */ +#define ENCRYPT_REQSTART 5 /* Request to start encrypting output */ +#define ENCRYPT_REQEND 6 /* Request to stop encrypting output */ +#define ENCRYPT_ENC_KEYID 7 /* Negotiate encryption key */ +#define ENCRYPT_DEC_KEYID 8 /* Negotiate decryption key */ +#define ENCRYPT_CNT 9 /* marks the maximum ENCRYPT value */ + +#define TELOPT_ENCTYPE_NULL 0 +#define TELOPT_ENCTYPE_DES_CFB64 1 /* 64-bit Cipher Feedback Mode */ +#define TELOPT_ENCTYPE_CNT 2 + +#define CFB64_IV 1 +#define CFB64_IV_OK 2 +#define CFB64_IV_BAD 3 + +#define FB64_IV CFB64_IV +#define FB64_IV_OK CFB64_IV_OK +#define FB64_IV_BAD CFB64_IV_BAD + +#ifdef ENCRYPT_NAMES +char *encrypt_names[] = { + "IS", "SUPPORT", "REPLY", "START", "END", + "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", + 0, +}; + +char *enctype_names[] = { + "ANY", "DES_CFB64", 0, +}; +#else +extern char *encrypt_names[]; +extern char *enctype_names[]; +#endif /* ENCRYPT_NAMES */ + +#define ENCRYPT_NAME(x) encrypt_names[x] +#define ENCTYPE_NAME(x) enctype_names[x] + +#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) +#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < TELOPT_ENCTYPE_CNT) + +#define SK_DES 1 /* Matched Kerberos v5 ENCTYPE_DES */ + +#ifndef DES_BLOCKSIZE +#define DES_BLOCKSIZE 8 +#endif /* DES_BLOCKSIZE */ + +#define TELNET_MAXNUMKEYS 64 +#define TELNET_MAXKEYIDLEN 16 + +#define CFB 0 + +#define ENCR_STATE_FAILED -1 +#define ENCR_STATE_OK 0x00 +#define ENCR_STATE_NO_SEND_IV 0x01 +#define ENCR_STATE_NO_RECV_IV 0x02 +#define ENCR_STATE_NO_KEYID 0x04 +#define ENCR_STATE_NOT_READY 0x08 +#define ENCR_STATE_IN_PROGRESS \ + (ENCR_STATE_NO_SEND_IV|ENCR_STATE_NO_RECV_IV|ENCR_STATE_NO_KEYID) +#define TELNET_DIR_ENCRYPT 0 +#define TELNET_DIR_DECRYPT 1 + +typedef unsigned char Block[DES_BLOCKSIZE]; +typedef unsigned char *BlockT; +typedef struct { Block _; } Schedule[16]; + +typedef struct { + short type; + int length; + unsigned char *data; +} Session_Key; + +typedef struct { + unsigned char need_start; + unsigned char autoflag; /* automatically start operation */ + unsigned char setup; + unsigned char type; + unsigned int state; + unsigned char keyid[TELNET_MAXNUMKEYS]; + int keyidlen; + Block ivec; + Block krbdes_key; +} cipher_info_t; + +typedef struct { + cipher_info_t encrypt; + cipher_info_t decrypt; +} telnet_enc_data_t; + +/* A valid key has no "0" bytes */ +#define VALIDKEY(key) (key[0] | key[1] | key[2] | key[3] | \ + key[4] | key[5] | key[6] | key[7]) + + +#ifdef __cplusplus +} +#endif + +#endif /* _ARPA_TELNET_H */ diff --git a/usr/src/head/arpa/tftp.h b/usr/src/head/arpa/tftp.h new file mode 100644 index 0000000000..01f74ee61c --- /dev/null +++ b/usr/src/head/arpa/tftp.h @@ -0,0 +1,87 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2001 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _ARPA_TFTP_H +#define _ARPA_TFTP_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Trivial File Transfer Protocol (RFC 1350, RFC 2347) + */ +#define SEGSIZE 512 /* data segment size */ + +/* + * Packet types. + */ +#define RRQ 01 /* read request */ +#define WRQ 02 /* write request */ +#define DATA 03 /* data packet */ +#define ACK 04 /* acknowledgement */ +#define ERROR 05 /* error code */ +#define OACK 06 /* option acknowledgement */ + +struct tftphdr { + short th_opcode; /* packet type */ + ushort_t th_block; /* block # */ + char th_data[1]; /* data or error string */ +}; + +#define th_code th_block /* error code overlay on tu_block */ +#define th_stuff th_block /* ditto */ + +#define th_msg th_data + +/* + * Error codes. + */ +#define EUNDEF 0 /* not defined */ +#define ENOTFOUND 1 /* file not found */ +#define EACCESS 2 /* access violation */ +#define ENOSPACE 3 /* disk full or allocation exceeded */ +#define EBADOP 4 /* illegal TFTP operation */ +#define EBADID 5 /* unknown transfer ID */ +#define EEXISTS 6 /* file already exists */ +#define ENOUSER 7 /* no such user */ +#define EOPTNEG 8 /* option negotiation error */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ARPA_TFTP_H */ diff --git a/usr/src/head/assert.h b/usr/src/head/assert.h new file mode 100644 index 0000000000..b088033ef6 --- /dev/null +++ b/usr/src/head/assert.h @@ -0,0 +1,82 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _ASSERT_H +#define _ASSERT_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6.1.4 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) +#if __STDC_VERSION__ - 0 >= 199901L +extern void __assert_c99(const char *, const char *, int, const char *); +#else +extern void __assert(const char *, const char *, int); +#endif /* __STDC_VERSION__ - 0 >= 199901L */ +#else +extern void _assert(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _ASSERT_H */ + +/* + * Note that the ANSI C Standard requires all headers to be idempotent except + * <assert.h> which is explicitly required not to be idempotent (section 4.1.2). + * Therefore, it is by intent that the header guards (#ifndef _ASSERT_H) do + * not span this entire file. + */ + +#undef assert + +#ifdef NDEBUG + +#define assert(EX) ((void)0) + +#else + +#if defined(__STDC__) +#if __STDC_VERSION__ - 0 >= 199901L +#define assert(EX) (void)((EX) || \ + (__assert_c99(#EX, __FILE__, __LINE__, __func__), 0)) +#else +#define assert(EX) (void)((EX) || (__assert(#EX, __FILE__, __LINE__), 0)) +#endif /* __STDC_VERSION__ - 0 >= 199901L */ +#else +#define assert(EX) (void)((EX) || (_assert("EX", __FILE__, __LINE__), 0)) +#endif /* __STDC__ */ + +#endif /* NDEBUG */ diff --git a/usr/src/head/atomic.h b/usr/src/head/atomic.h new file mode 100644 index 0000000000..00c947604e --- /dev/null +++ b/usr/src/head/atomic.h @@ -0,0 +1,34 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _ATOMIC_H +#define _ATOMIC_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/atomic.h> + +#endif /* _ATOMIC_H */ diff --git a/usr/src/head/audio/au.h b/usr/src/head/audio/au.h new file mode 100644 index 0000000000..4579e7daa3 --- /dev/null +++ b/usr/src/head/audio/au.h @@ -0,0 +1,136 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _AUDIO_AU_H +#define _AUDIO_AU_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/isa_defs.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Define an on-disk audio file header for the AU file format. + * + * Note that there is an optional 'info' field that immediately follows this + * structure in the file. It is an optional length field that is sometimes + * used to store additional information. At the minimum, it is at + * least 4 bytes. + * + * The offset field is problematic in the general case because the + * field is really "data location", which does not ensure that all + * the bytes between the header and the data are really 'info'. + * Further, there are no absolute guarantees that the info is ASCII text. + * + * When audio files are passed through pipes, the au_data_size field may + * not be known in advance. In such cases, au_data_size should be + * set to AUDIO_AU_UNKNOWN_SIZE. + */ + +struct au_filehdr { + uint32_t au_magic; /* magic number */ + uint32_t au_offset; /* size of this header */ + uint32_t au_data_size; /* length of data */ + uint32_t au_encoding; /* data encoding format */ + uint32_t au_sample_rate; /* samples per second */ + uint32_t au_channels; /* number of interleaved channels */ +}; +typedef struct au_filehdr au_filehdr_t; + + /* + * This is the appearance of a typical AU audio file as described + * by this structure. + * + * ------------------------------------------------------------ + * | | | | + * | AU Audio Header | Info | Audio Data | + * | | (optional) | | + * | | | | + * | 24 bytes | 4 bytes (min) | n bytes | + * | | | | + * ------------------------------------------------------------ + */ + +/* Define the magic number */ +#define AUDIO_AU_FILE_MAGIC ((uint32_t)0x2e736e64) /* ".snd" */ + +/* Unknown header size */ +#define AUDIO_AU_UNKNOWN_SIZE ((unsigned)(~0)) /* (unsigned) -1 */ + +/* Define the AU encoding fields */ +#define AUDIO_AU_ENCODING_ULAW (1) /* 8-bit u-law */ +#define AUDIO_AU_ENCODING_LINEAR_8 (2) /* 8-bit linear PCM */ +#define AUDIO_AU_ENCODING_LINEAR_16 (3) /* 16-bit linear PCM */ +#define AUDIO_AU_ENCODING_LINEAR_24 (4) /* 24-bit linear PCM */ +#define AUDIO_AU_ENCODING_LINEAR_32 (5) /* 32-bit linear PCM */ +#define AUDIO_AU_ENCODING_FLOAT (6) /* 32-bit IEEE floating point */ +#define AUDIO_AU_ENCODING_DOUBLE (7) /* 64-bit IEEE double */ + /* precision float */ +#define AUDIO_AU_ENCODING_FRAGMENTED (8) /* Fragmented sample data */ +#define AUDIO_AU_ENCODING_DSP (10) /* DSP program */ +#define AUDIO_AU_ENCODING_FIXED_8 (11) /* 8-bit fixed point */ +#define AUDIO_AU_ENCODING_FIXED_16 (12) /* 16-bit fixed point */ +#define AUDIO_AU_ENCODING_FIXED_24 (13) /* 24-bit fixed point */ +#define AUDIO_AU_ENCODING_FIXED_32 (14) /* 32-bit fixed point */ +#define AUDIO_AU_ENCODING_EMPHASIS (18) /* 16-bit linear with */ + /* emphasis */ +#define AUDIO_AU_ENCODING_COMPRESSED (19) /* 16-bit linear compressed */ +#define AUDIO_AU_ENCODING_EMP_COMP (20) /* 16-bit linear with */ + /* emphasis and compression */ +#define AUDIO_AU_ENCODING_MUSIC_KIT (21) /* Music kit DSP commands */ +#define AUDIO_AU_ENCODING_ADPCM_G721 (23) /* 4-bit CCITT G.721 ADPCM */ +#define AUDIO_AU_ENCODING_ADPCM_G722 (24) /* CCITT G.722 ADPCM */ +#define AUDIO_AU_ENCODING_ADPCM_G723_3 (25) /* CCITT G.723.3 ADPCM */ +#define AUDIO_AU_ENCODING_ADPCM_G723_5 (26) /* CCITT G.723.5 ADPCM */ +#define AUDIO_AU_ENCODING_ALAW (27) /* 8-bit A-law G.711 */ + + +/* Byte swapping routines */ +#if defined(_BIG_ENDIAN) +#define AUDIO_AU_FILE2HOST(from, to) *((long *)(to)) = *((long *)(from)) +#else +#define AUDIO_AU_FILE2HOST(from, to) \ + ((char *)(to))[0] = ((char *)(from))[3]; \ + ((char *)(to))[1] = ((char *)(from))[2]; \ + ((char *)(to))[2] = ((char *)(from))[1]; \ + ((char *)(to))[3] = ((char *)(from))[0]; +#endif /* byte swapping */ + +#if defined(__sparc) || defined(__i386) || defined(__amd64) +#define AUDIO_AU_HOST2FILE(from, to) AUDIO_AU_FILE2HOST((from), (to)) +#else +#error unknown machine type; +#endif /* encode */ + +#ifdef __cplusplus +} +#endif + +#endif /* _AUDIO_AU_H */ diff --git a/usr/src/head/auth_attr.h b/usr/src/head/auth_attr.h new file mode 100644 index 0000000000..eee56faaac --- /dev/null +++ b/usr/src/head/auth_attr.h @@ -0,0 +1,115 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1999 by Sun Microsystems, Inc. All rights reserved. + */ + +#ifndef _AUTH_ATTR_H +#define _AUTH_ATTR_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/types.h> +#include <secdb.h> + +/* + * Some macros used internally by the nsswitch code + */ +#define AUTH_MMAPLEN 1024 +#define AUTH_POLICY "/etc/security/policy.conf" +#define DEF_AUTH "AUTHS_GRANTED=" +#define AUTHATTR_FILENAME "/etc/security/auth_attr" +#define AUTHATTR_DB_NAME "auth_attr.org_dir" +#define AUTHATTR_DB_NCOL 6 /* total columns */ +#define AUTHATTR_DB_NKEYCOL 1 /* total searchable columns */ +#define AUTHATTR_DB_TBLT "auth_attr_tbl" +#define AUTHATTR_NAME_DEFAULT_KW "nobody" + +#define AUTHATTR_COL0_KW "name" +#define AUTHATTR_COL1_KW "res1" +#define AUTHATTR_COL2_KW "res2" +#define AUTHATTR_COL3_KW "short_desc" +#define AUTHATTR_COL4_KW "long_desc" +#define AUTHATTR_COL5_KW "attr" + +/* + * indices of searchable columns + */ +#define AUTHATTR_KEYCOL0 0 /* name */ + + +/* + * Key words used in the auth_attr database + */ +#define AUTHATTR_HELP_KW "help" + +/* + * Nsswitch internal representation of authorization attributes. + */ +typedef struct authstr_s { + char *name; /* authorization name */ + char *res1; /* reserved for future use */ + char *res2; /* reserved for future use */ + char *short_desc; /* short description */ + char *long_desc; /* long description */ + char *attr; /* string of key-value pair attributes */ +} authstr_t; + +/* + * API representation of authorization attributes. + */ +typedef struct authattr_s { + char *name; /* authorization name */ + char *res1; /* reserved for future use */ + char *res2; /* reserved for future use */ + char *short_desc; /* short description */ + char *long_desc; /* long description */ + kva_t *attr; /* array of key-value pair attributes */ +} authattr_t; + +#ifdef __STDC__ +extern authattr_t *getauthnam(const char *); +extern authattr_t *getauthattr(void); +extern void setauthattr(void); +extern void endauthattr(void); +extern void free_authattr(authattr_t *); +extern int chkauthattr(const char *, const char *); + +#else /* not __STDC__ */ + +extern authattr_t *getauthnam(); +extern authattr_t *getauthattr(); +extern void setauthattr(); +extern void endauthattr(); +extern void free_authattr(); +extern int chkauthattr(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _AUTH_ATTR_H */ diff --git a/usr/src/head/auth_list.h b/usr/src/head/auth_list.h new file mode 100644 index 0000000000..79b1cfb14e --- /dev/null +++ b/usr/src/head/auth_list.h @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 2001 by Sun Microsystems, Inc. All rights reserved. + * + * This is an internal header file. Not to be shipped. + */ + +#ifndef _AUTH_LIST_H +#define _AUTH_LIST_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Names of authorizations currently in use in the system + */ + +#define CDRW_AUTH "solaris.device.cdrw" +#define CRONADMIN_AUTH "solaris.jobs.admin" +#define CRONUSER_AUTH "solaris.jobs.user" +#define DEFAULT_DEV_ALLOC_AUTH "solaris.device.allocate" +#define DEVICE_REVOKE_AUTH "solaris.device.revoke" +#define MAILQ_AUTH "solaris.mail.mailq" +#define SET_DATE_AUTH "solaris.system.date" + +#ifdef __cplusplus +} +#endif + +#endif /* _AUTH_LIST_H */ diff --git a/usr/src/head/config_admin.h b/usr/src/head/config_admin.h new file mode 100644 index 0000000000..aec3197179 --- /dev/null +++ b/usr/src/head/config_admin.h @@ -0,0 +1,270 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1998-2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_CONFIG_ADMIN_H +#define _SYS_CONFIG_ADMIN_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * config_admin.h + * + * this file supports usage of the interfaces defined in + * config_admin.3x. which are contained in /usr/lib/libcfgadm.so.1 + */ + +#include <sys/param.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Defined constants + */ +#define CFGA_AP_LOG_ID_LEN 20 +#define CFGA_AP_PHYS_ID_LEN MAXPATHLEN +#define CFGA_INFO_LEN 4096 +#define CFGA_TYPE_LEN 12 + +#define CFGA_CLASS_LEN 12 +#define CFGA_LOG_EXT_LEN 30 + +#define CFGA_DYN_SEP "::" +#define CFGA_PHYS_EXT_LEN (CFGA_AP_PHYS_ID_LEN + CFGA_LOG_EXT_LEN) + + +/* + * Configuration change state commands + */ +typedef enum { + CFGA_CMD_NONE = 0, + CFGA_CMD_LOAD, + CFGA_CMD_UNLOAD, + CFGA_CMD_CONNECT, + CFGA_CMD_DISCONNECT, + CFGA_CMD_CONFIGURE, + CFGA_CMD_UNCONFIGURE +} cfga_cmd_t; + +/* + * Configuration states + */ +typedef enum { + CFGA_STAT_NONE = 0, + CFGA_STAT_EMPTY, + CFGA_STAT_DISCONNECTED, + CFGA_STAT_CONNECTED, + CFGA_STAT_UNCONFIGURED, + CFGA_STAT_CONFIGURED +} cfga_stat_t; + +/* + * Configuration conditions + */ +typedef enum { + CFGA_COND_UNKNOWN = 0, + CFGA_COND_OK, + CFGA_COND_FAILING, + CFGA_COND_FAILED, + CFGA_COND_UNUSABLE +} cfga_cond_t; + +/* + * Flags + */ +#define CFGA_FLAG_FORCE 1 +#define CFGA_FLAG_VERBOSE 2 +#define CFGA_FLAG_LIST_ALL 4 + +typedef char cfga_ap_log_id_t[CFGA_AP_LOG_ID_LEN]; +typedef char cfga_ap_phys_id_t[CFGA_AP_PHYS_ID_LEN]; +typedef char cfga_info_t[CFGA_INFO_LEN]; +typedef char cfga_type_t[CFGA_TYPE_LEN]; +typedef int cfga_flags_t; +typedef int cfga_busy_t; + + +typedef char cfga_log_ext_t[CFGA_LOG_EXT_LEN]; +typedef char cfga_phys_ext_t[CFGA_PHYS_EXT_LEN]; +typedef char cfga_class_t[CFGA_CLASS_LEN]; + +typedef struct cfga_list_data { + cfga_log_ext_t ap_log_id; /* Attachment point logical id */ + cfga_phys_ext_t ap_phys_id; /* Attachment point physical id */ + cfga_class_t ap_class; /* Attachment point class */ + cfga_stat_t ap_r_state; /* Receptacle state */ + cfga_stat_t ap_o_state; /* Occupant state */ + cfga_cond_t ap_cond; /* Attachment point condition */ + cfga_busy_t ap_busy; /* Busy indicators */ + time_t ap_status_time; /* Attachment point last change */ + cfga_info_t ap_info; /* Miscellaneous information */ + cfga_type_t ap_type; /* Occupant type */ +} cfga_list_data_t; + +/* + * The following structure is retained for backward compatibility + */ +typedef struct cfga_stat_data { + cfga_ap_log_id_t ap_log_id; /* Attachment point logical id */ + cfga_ap_phys_id_t ap_phys_id; /* Attachment point physical id */ + cfga_stat_t ap_r_state; /* Receptacle state */ + cfga_stat_t ap_o_state; /* Occupant state */ + cfga_cond_t ap_cond; /* Attachment point condition */ + cfga_busy_t ap_busy; /* Busy indicators */ + time_t ap_status_time; /* Attachment point last change */ + cfga_info_t ap_info; /* Miscellaneous information */ + cfga_type_t ap_type; /* Occupant type */ +} cfga_stat_data_t; + + +struct cfga_confirm { + int (*confirm)(void *appdata_ptr, const char *message); + void *appdata_ptr; +}; + +struct cfga_msg { + int (*message_routine)(void *appdata_ptr, const char *message); + void *appdata_ptr; +}; + +/* + * Library function error codes returned by all functions below + * except config_strerror which is used to decode the error + * codes. + */ +typedef enum { + CFGA_OK = 0, + CFGA_NACK, + CFGA_NOTSUPP, + CFGA_OPNOTSUPP, + CFGA_PRIV, + CFGA_BUSY, + CFGA_SYSTEM_BUSY, + CFGA_DATA_ERROR, + CFGA_LIB_ERROR, + CFGA_NO_LIB, + CFGA_INSUFFICENT_CONDITION, + CFGA_INVAL, + CFGA_ERROR, + CFGA_APID_NOEXIST, + CFGA_ATTR_INVAL +} cfga_err_t; + + +#if defined(__STDC__) + +/* + * config_admin.3x library interfaces + */ + +cfga_err_t config_change_state(cfga_cmd_t state_change_cmd, int num_ap_ids, + char *const *ap_ids, const char *options, struct cfga_confirm *confp, + struct cfga_msg *msgp, char **errstring, cfga_flags_t flags); + +cfga_err_t config_private_func(const char *function, int num_ap_ids, + char *const *ap_ids, const char *options, struct cfga_confirm *confp, + struct cfga_msg *msgp, char **errstring, cfga_flags_t flags); + +cfga_err_t config_test(int num_ap_ids, char *const *ap_ids, + const char *options, struct cfga_msg *msgp, char **errstring, + cfga_flags_t flags); + +cfga_err_t config_list_ext(int num_ap_ids, char *const *ap_ids, + struct cfga_list_data **ap_id_list, int *nlist, const char *options, + const char *listopts, char **errstring, cfga_flags_t flags); + +cfga_err_t config_help(int num_ap_ids, char *const *ap_ids, + struct cfga_msg *msgp, const char *options, cfga_flags_t flags); + +const char *config_strerror(cfga_err_t cfgerrnum); + +int config_ap_id_cmp(const cfga_ap_log_id_t ap_id1, + const cfga_ap_log_id_t ap_id2); + +void config_unload_libs(); + +/* + * The following two routines are retained only for backward compatibility + */ +cfga_err_t config_stat(int num_ap_ids, char *const *ap_ids, + struct cfga_stat_data *buf, const char *options, char **errstring); + +cfga_err_t config_list(struct cfga_stat_data **ap_di_list, int *nlist, + const char *options, char **errstring); + + +#ifdef CFGA_PLUGIN_LIB +/* + * Plugin library routine hooks - only to be used by the generic + * library and plugin libraries (who must define CFGA_PLUGIN_LIB + * prior to the inclusion of this header). + */ + +cfga_err_t cfga_change_state(cfga_cmd_t, const char *, const char *, + struct cfga_confirm *, struct cfga_msg *, char **, cfga_flags_t); +cfga_err_t cfga_private_func(const char *, const char *, const char *, + struct cfga_confirm *, struct cfga_msg *, char **, cfga_flags_t); +cfga_err_t cfga_test(const char *, const char *, struct cfga_msg *, + char **, cfga_flags_t); +cfga_err_t cfga_list_ext(const char *, struct cfga_list_data **, int *, + const char *, const char *, char **, cfga_flags_t); +cfga_err_t cfga_help(struct cfga_msg *, const char *, cfga_flags_t); +int cfga_ap_id_cmp(const cfga_ap_log_id_t, + const cfga_ap_log_id_t); + + +/* + * Plugin version information. + */ +#define CFGA_HSL_V1 1 +#define CFGA_HSL_V2 2 +#define CFGA_HSL_VERS CFGA_HSL_V2 + +/* + * The following two routines are retained only for backward compatibility. + */ +cfga_err_t cfga_stat(const char *, struct cfga_stat_data *, + const char *, char **); +cfga_err_t cfga_list(const char *, struct cfga_stat_data **, int *, + const char *, char **); + + +#endif /* CFGA_PLUGIN_LIB */ + +#else /* !defined __STDC__ */ + +extern const char *config_strerror(); +extern int config_ap_id_cmp(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_CONFIG_ADMIN_H */ diff --git a/usr/src/head/cpio.h b/usr/src/head/cpio.h new file mode 100644 index 0000000000..19195a8b62 --- /dev/null +++ b/usr/src/head/cpio.h @@ -0,0 +1,66 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _CPIO_H +#define _CPIO_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The following are values used by c_mode field of the cpio archive. + */ + +#define C_IRUSR 0000400 +#define C_IWUSR 0000200 +#define C_IXUSR 0000100 +#define C_IRGRP 0000040 +#define C_IWGRP 0000020 +#define C_IXGRP 0000010 +#define C_IROTH 0000004 +#define C_IWOTH 0000002 +#define C_IXOTH 0000001 +#define C_ISUID 0004000 +#define C_ISGID 0002000 +#define C_ISVTX 0001000 +#define C_ISDIR 0040000 +#define C_ISFIFO 0010000 +#define C_ISREG 0100000 +#define C_ISBLK 0060000 +#define C_ISCHR 0020000 +#define C_ISCTG 0110000 +#define C_ISLNK 0120000 +#define C_ISSOCK 0140000 + +#define MAGIC "070707" + +#ifdef __cplusplus +} +#endif + +#endif /* _CPIO_H */ diff --git a/usr/src/head/crypt.h b/usr/src/head/crypt.h new file mode 100644 index 0000000000..718bb89507 --- /dev/null +++ b/usr/src/head/crypt.h @@ -0,0 +1,80 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2001-2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _CRYPT_H +#define _CRYPT_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +#include <pwd.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Password and file encryption functions */ + +#define CRYPT_MAXCIPHERTEXTLEN 100 + +#if defined(__STDC__) +extern char *crypt(const char *, const char *); +extern char *crypt_gensalt(const char *, const struct passwd *); +extern char *crypt_genhash_impl(char *, size_t, const char *, + const char *, const char **); +extern char *crypt_gensalt_impl(char *, size_t, const char *, + const struct passwd *, const char **); +extern int crypt_close(int *); +extern char *des_crypt(const char *, const char *); +extern void des_encrypt(char *, int); +extern void des_setkey(const char *); +extern void encrypt(char *, int); +extern int run_crypt(long, char *, unsigned, int *); +extern int run_setkey(int *, const char *); +extern void setkey(const char *); +#else +extern char *crypt(); +extern char *crypt_gensalt(); +extern char *crypt_genhash_impl(); +extern char *crytp_gensalt_impl(); +extern int crypt_close(); +extern char *des_crypt(); +extern void des_encrypt(); +extern void des_setkey(); +extern void encrypt(); +extern int run_crypt(); +extern int run_setkey(); +extern void setkey(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _CRYPT_H */ diff --git a/usr/src/head/ctype.h b/usr/src/head/ctype.h new file mode 100644 index 0000000000..04d2e4552f --- /dev/null +++ b/usr/src/head/ctype.h @@ -0,0 +1,112 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _CTYPE_H +#define _CTYPE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <iso/ctype_iso.h> +#include <iso/ctype_c99.h> + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/ctype_iso.h>. + */ +#if __cplusplus >= 199711L +using std::isalnum; +using std::isalpha; +using std::iscntrl; +using std::isdigit; +using std::isgraph; +using std::islower; +using std::isprint; +using std::ispunct; +using std::isspace; +using std::isupper; +using std::isxdigit; +using std::tolower; +using std::toupper; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) + +#if defined(__EXTENSIONS__) || \ + ((!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \ + defined(_XOPEN_SOURCE)) + +extern int isascii(int); +extern int toascii(int); +extern int _tolower(int); +extern int _toupper(int); + +#endif /* defined(__EXTENSIONS__) || ((!defined(_STRICT_STDC) ... */ + +#if !defined(__lint) + +#if defined(__EXTENSIONS__) || \ + ((!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \ + defined(_XOPEN_SOURCE)) || defined(__XPG4_CHAR_CLASS__) +#define isascii(c) (!(((int)(c)) & ~0177)) +#define toascii(c) (((int)(c)) & 0177) +#if defined(__XPG4_CHAR_CLASS__) || defined(_XPG4) +#define _toupper(c) (__trans_upper[(int)(c)]) +#define _tolower(c) (__trans_lower[(int)(c)]) +#else +#define _toupper(c) ((__ctype + 258)[(int)(c)]) +#define _tolower(c) ((__ctype + 258)[(int)(c)]) +#endif /* defined(__XPG4_CHAR_CLASS__) || defined(_XPG4) */ + +#endif /* defined(__EXTENSIONS__) || ((!defined(_STRICT_STDC) ... */ + +#endif /* !defined(__lint) */ + +#else /* defined(__STDC__) */ + +#if !defined(__lint) + +#define isascii(c) (!(((int)(c)) & ~0177)) +#define _toupper(c) ((_ctype + 258)[(int)(c)]) +#define _tolower(c) ((_ctype + 258)[(int)(c)]) +#define toascii(c) (((int)(c)) & 0177) + +#endif /* !defined(__lint) */ + +#endif /* defined(__STDC__) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _CTYPE_H */ diff --git a/usr/src/head/deflt.h b/usr/src/head/deflt.h new file mode 100644 index 0000000000..6c9faabb7e --- /dev/null +++ b/usr/src/head/deflt.h @@ -0,0 +1,84 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* Copyright (c) 1987, 1988 Microsoft Corporation */ +/* All Rights Reserved */ + +#ifndef _DEFLT_H +#define _DEFLT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEFLT "/etc/default" + +/* + * Following for defcntl(3). + * If you add new args, make sure that the default is: + * OFF new-improved-feature-off, i.e. current state of affairs + * ON new-improved-feature-on + * or that you change the code for deflt(3) to have the old value as the + * default. (for compatibility). + */ + +/* ... cmds */ +#define DC_GETFLAGS 0 /* get current flags */ +#define DC_SETFLAGS 1 /* set flags */ + +/* ... args */ +#define DC_CASE 0001 /* ON: respect case; OFF: ignore case */ +#define DC_NOREWIND 0002 /* ON: don't rewind in defread */ + /* OFF: do rewind in defread */ +#define DC_STRIP_QUOTES 0004 /* ON: strip quotes; OFF: leave quotes */ + +#define DC_STD ((0) | (DC_CASE)) + +#ifdef __STDC__ +extern int defcntl(int, int); +extern int defopen(char *); +extern char *defread(char *); +#else +extern int defcntl(); +extern int defopen(); +extern char *defread(); +#endif + +#define TURNON(flags, mask) ((flags) |= (mask)) +#define TURNOFF(flags, mask) ((flags) &= ~(mask)) +#define ISON(flags, mask) (((flags) & (mask)) == (mask)) +#define ISOFF(flags, mask) (((flags) & (mask)) != (mask)) + +#ifdef __cplusplus +} +#endif + +#endif /* _DEFLT_H */ diff --git a/usr/src/head/devid.h b/usr/src/head/devid.h new file mode 100644 index 0000000000..8ead804a18 --- /dev/null +++ b/usr/src/head/devid.h @@ -0,0 +1,71 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _DEVID_H +#define _DEVID_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _KERNEL +#include <sys/types.h> +#endif /* _KERNEL */ + +#include <sys/sunddi.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct devid_nmlist { + char *devname; + dev_t dev; +} devid_nmlist_t; + +extern int devid_get(int fd, ddi_devid_t *retdevid); +extern void devid_free(ddi_devid_t devid); +extern int devid_get_minor_name(int fd, char **retminor_name); +extern size_t devid_sizeof(ddi_devid_t devid); +extern int devid_compare(ddi_devid_t devid1, ddi_devid_t devid2); +extern int devid_deviceid_to_nmlist(char *search_path, ddi_devid_t devid, + char *minor_name, devid_nmlist_t **retlist); +extern void devid_free_nmlist(devid_nmlist_t *list); +extern int devid_valid(ddi_devid_t devid); +extern char *devid_str_encode(ddi_devid_t devid, char *minor_name); +extern int devid_str_decode(char *devidstr, + ddi_devid_t *retdevid, char **retminor_name); +extern void devid_str_free(char *devidstr); +extern int devid_scsi_encode(int version, char *driver_name, + uchar_t *inq, size_t inq_len, uchar_t *inq80, + size_t inq80_len, uchar_t *inq83, size_t inq83_len, + ddi_devid_t *ret_devid); +extern char *devid_to_guid(ddi_devid_t devid); +extern void devid_free_guid(char *guid); + +#ifdef __cplusplus +} +#endif + +#endif /* _DEVID_H */ diff --git a/usr/src/head/devmgmt.h b/usr/src/head/devmgmt.h new file mode 100644 index 0000000000..142d31a5d1 --- /dev/null +++ b/usr/src/head/devmgmt.h @@ -0,0 +1,178 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _DEVMGMT_H +#define _DEVMGMT_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.12 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * devmgmt.h + * + * Contents: + * - Device Management definitions, + * - getvol() definitions + */ + +/* + * Device management definitions + * - Default pathnames (relative to installation point) + * - Environment variable namess + * - Standard field names in the device table + * - Flags + * - Miscellaneous definitions + */ + + +/* + * Default pathnames (relative to the package installation + * point) to the files used by Device Management: + * + * DTAB_PATH Device table + * DGRP_PATH Device group table + * DVLK_PATH Device reservation table + */ + +#define DTAB_PATH "/etc/device.tab" +#define DGRP_PATH "/etc/dgroup.tab" +#define DVLK_PATH "/etc/devlkfile" + + +/* + * Names of environment variables + * + * OAM_DEVTAB Name of variable that defines the pathname to + * the device-table file + * OAM_DGROUP Name of variable that defines the pathname to + * the device-group table file + * OAM_DEVLKTAB Name of variable that defines the pathname to + * the device-reservation table file + */ + +#define OAM_DEVTAB "OAM_DEVTAB" +#define OAM_DGROUP "OAM_DGROUP" +#define OAM_DEVLKTAB "OAM_DEVLKTAB" + + +/* + * Standard field names in the device table + */ + +#define DTAB_ALIAS "alias" +#define DTAB_CDEVICE "cdevice" +#define DTAB_BDEVICE "bdevice" +#define DTAB_PATHNAME "pathname" + + +/* + * Flags: + * For getdev() and getdgrp(): + * DTAB_ANDCRITERIA Devices must meet all criteria + * instead of any of the criteria + * DTAB_EXCLUDEFLAG The list of devices or device groups + * is the list that is to be excluded, + * not those to select from. + * DTAB_LISTALL List all device groups, even those that + * have no valid members (getdgrp() only). + */ + +#define DTAB_ANDCRITERIA 0x01 +#define DTAB_EXCLUDEFLAG 0x02 +#define DTAB_LISTALL 0x04 + + +/* + * Miscellaneous Definitions + * + * DTAB_MXALIASLN Maximum alias length + */ + +#define DTAB_MXALIASLN 14 + +/* + * Device Management Structure definitions + * reservdev Reserved device description + */ + +/* + * struct reservdev + * + * Structure describes a reserved device. + * + * Elements: + * char *devname Alias of the reserved device + * pid_t key Key used to reserve the device + */ + +struct reservdev { + char *devname; + pid_t key; +}; + +/* + * Device Management Functions: + * + * devattr() Returns a device's attribute + * devreserv() Reserves a device + * devfree() Frees a reserved device + * reservdev() Return list of reserved devices + * getdev() Get devices that match criteria + * getdgrp() Get device-groups containing devices + * that match criteria + * listdev() List attributes defined for a device + * listdgrp() List members of a device-group + */ + + char *devattr(char *, char *); + int devfree(int, char *); + char **devreserv(int, char ***); + char **getdev(char **, char **, int); + char **getdgrp(char **, char **, int); + char **listdev(char *); + char **listdgrp(char *); + struct reservdev **reservdev(void); + +/* + * getvol() definitions + */ + +#define DM_BATCH 0x0001 +#define DM_ELABEL 0x0002 +#define DM_FORMAT 0x0004 +#define DM_FORMFS 0x0008 +#define DM_WLABEL 0x0010 +#define DM_OLABEL 0x0020 + + int getvol(char *, char *, int, char *); + +#ifdef __cplusplus +} +#endif + +#endif /* _DEVMGMT_H */ diff --git a/usr/src/head/devpoll.h b/usr/src/head/devpoll.h new file mode 100644 index 0000000000..e8aa0b7e5b --- /dev/null +++ b/usr/src/head/devpoll.h @@ -0,0 +1,34 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1998 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _DEVPOLL_H +#define _DEVPOLL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/devpoll.h> + +#endif /* _DEVPOLL_H */ diff --git a/usr/src/head/dial.h b/usr/src/head/dial.h new file mode 100644 index 0000000000..d3cb004644 --- /dev/null +++ b/usr/src/head/dial.h @@ -0,0 +1,95 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _DIAL_H +#define _DIAL_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ + +#ifndef IUCLC +#include <sys/termio.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* uucico routines need these */ +#define DIAL + +/* The following are no longer used by dial() and may be out of date. */ +/* They are included here only to maintain source compatibility. */ +#define STANDALONE +#define DEVDIR "/dev/" /* device path */ +#define LOCK "/usr/spool/uucp/LCK.." /* lock file semaphore */ +#define DVC_LEN 80 /* max NO of chars in TTY-device path name */ +/* End of unused definitions */ + + /* error mnemonics */ + +#define TRUE 1 +#define FALSE 0 +#define INTRPT (-1) /* interrupt occured */ +#define D_HUNG (-2) /* dialer hung (no return from write) */ +#define NO_ANS (-3) /* no answer (caller script failed) */ +#define ILL_BD (-4) /* illegal baud-rate */ +#define A_PROB (-5) /* acu problem (open() failure) */ +#define L_PROB (-6) /* line problem (open() failure) */ +#define NO_Ldv (-7) /* can't open Devices file */ +#define DV_NT_A (-8) /* requested device not available */ +#define DV_NT_K (-9) /* requested device not known */ +#define NO_BD_A (-10) /* no device available at requested baud */ +#define NO_BD_K (-11) /* no device known at requested baud */ +#define DV_NT_E (-12) /* requested speed does not match */ +#define BAD_SYS (-13) /* system not in Systems file */ + +typedef struct { + struct termio *attr; /* ptr to termio attribute struct */ + int baud; /* unused */ + int speed; /* 212A modem: low=300, high=1200 */ + char *line; /* device name for out-going line */ + char *telno; /* ptr to tel-no/system name string */ + int modem; /* unused */ + char *device; /* unused */ + int dev_len; /* unused */ +} CALL; + +#if defined(__STDC__) + +extern int dial(CALL); +extern void undial(int); + +#else + +extern int dial(); +extern void undial(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _DIAL_H */ diff --git a/usr/src/head/dirent.h b/usr/src/head/dirent.h new file mode 100644 index 0000000000..b4e32d9719 --- /dev/null +++ b/usr/src/head/dirent.h @@ -0,0 +1,311 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _DIRENT_H +#define _DIRENT_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6.1.5 */ + +#include <sys/feature_tests.h> + +#include <sys/types.h> +#include <sys/dirent.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) + +#define MAXNAMLEN 512 /* maximum filename length */ +#define DIRBUF 8192 /* buffer size for fs-indep. dirs */ + +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */ + +#if !defined(__XOPEN_OR_POSIX) + +typedef struct { + int dd_fd; /* file descriptor */ + int dd_loc; /* offset in block */ + int dd_size; /* amount of valid data */ + char *dd_buf; /* directory block */ +} DIR; /* stream data from opendir() */ + + +#else + +typedef struct { + int d_fd; /* file descriptor */ + int d_loc; /* offset in block */ + int d_size; /* amount of valid data */ + char *d_buf; /* directory block */ +} DIR; /* stream data from opendir() */ + +#endif /* !defined(__XOPEN_OR_POSIX) */ + +#if defined(__STDC__) + +/* large file compilation environment setup */ +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname readdir readdir64 +#pragma redefine_extname scandir scandir64 +#pragma redefine_extname alphasort alphasort64 +#else +#define readdir readdir64 +#define scandir scandir64 +#define alphasort alphasort64 +#endif +#endif /* _FILE_OFFSET_BITS == 64 */ + +/* In the LP64 compilation environment, all APIs are already large file */ +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname readdir64 readdir +#pragma redefine_extname scandir64 scandir +#pragma redefine_extname alphasort64 alphasort +#else +#define readdir64 readdir +#define scandir64 scandir +#define alphsort64 alphasort +#endif +#endif /* _LP64 && _LARGEFILE64_SOURCE */ + +extern DIR *opendir(const char *); +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_ATFILE_SOURCE) +extern DIR *fdopendir(int); +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +extern int scandir(const char *, struct dirent *(*[]), + int (*)(const struct dirent *), + int (*)(const struct dirent **, + const struct dirent **)); +extern int alphasort(const struct dirent **, + const struct dirent **); +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */ +extern struct dirent *readdir(DIR *); +#if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || \ + defined(_XOPEN_SOURCE) +extern long telldir(DIR *); +extern void seekdir(DIR *, long); +#endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) ... */ +extern void rewinddir(DIR *); +extern int closedir(DIR *); + +/* transitional large file interface */ +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern struct dirent64 *readdir64(DIR *); +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +extern int scandir64(const char *, struct dirent64 *(*[]), + int (*)(const struct dirent64 *), + int (*)(const struct dirent64 **, + const struct dirent64 **)); +extern int alphasort64(const struct dirent64 **, const struct dirent64 **); +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */ +#endif + +#else + +extern DIR *opendir(); +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_ATFILE_SOURCE) +extern DIR *fdopendir(); +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ +extern struct dirent *readdir(); +#if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || \ + defined(_XOPEN_SOURCE) +extern long telldir(); +extern void seekdir(); +#endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) ... */ +extern void rewinddir(); +extern int closedir(); + +/* transitional large file interface */ +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern struct dirent64 *readdir64(); +#endif + +#endif + +#if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || \ + defined(_XOPEN_SOURCE) +#define rewinddir(dirp) seekdir(dirp, 0L) +#endif + +/* + * readdir_r() prototype is defined here. + * + * There are several variations, depending on whether compatibility with old + * POSIX draft specifications or the final specification is desired and on + * whether the large file compilation environment is active. To combat a + * combinatorial explosion, enabling large files implies using the final + * specification (since the definition of the large file environment + * considerably postdates that of the final readdir_r specification). + * + * In the LP64 compilation environment, all APIs are already large file, + * and since there are no 64-bit applications that can have seen the + * draft implementation, again, we use the final POSIX specification. + */ + +#if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ + !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L) || \ + defined(_POSIX_PTHREAD_SEMANTICS) + +#if defined(__STDC__) + +#if !defined(_LP64) && _FILE_OFFSET_BITS == 32 + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname readdir_r __posix_readdir_r +extern int readdir_r(DIR *_RESTRICT_KYWD, struct dirent *_RESTRICT_KYWD, + struct dirent **_RESTRICT_KYWD); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern int __posix_readdir_r(DIR *_RESTRICT_KYWD, + struct dirent *_RESTRICT_KYWD, struct dirent **_RESTRICT_KYWD); + +#ifdef __lint +#define readdir_r __posix_readdir_r +#else /* !__lint */ + +static int +readdir_r(DIR *_RESTRICT_KYWD __dp, struct dirent *_RESTRICT_KYWD __ent, + struct dirent **_RESTRICT_KYWD __res) { + return (__posix_readdir_r(__dp, __ent, __res)); +} + +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern struct dirent *readdir_r(DIR *__dp, struct dirent *__ent); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +#else /* !_LP64 && _FILE_OFFSET_BITS == 32 */ + +#if defined(_LP64) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname readdir64_r readdir_r +#else +#define readdir64_r readdir_r +#endif +#else /* _LP64 */ +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname readdir_r readdir64_r +#else +#define readdir_r readdir64_r +#endif +#endif /* _LP64 */ +extern int readdir_r(DIR *_RESTRICT_KYWD, struct dirent *_RESTRICT_KYWD, + struct dirent **_RESTRICT_KYWD); + +#endif /* !_LP64 && _FILE_OFFSET_BITS == 32 */ + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +/* transitional large file interface */ +extern int readdir64_r(DIR *_RESTRICT_KYWD, struct dirent64 *_RESTRICT_KYWD, + struct dirent64 **_RESTRICT_KYWD); +#endif + +#else /* __STDC__ */ + +#if !defined(_LP64) && _FILE_OFFSET_BITS == 32 + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname readdir_r __posix_readdir_r +extern int readdir_r(); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern int __posix_readdir_r(); + +#ifdef __lint +#define readdir_r __posix_readdir_r +#else /* !__lint */ + +static int +readdir_r(DIR *_RESTRICT_KYWD __dp, struct dirent *_RESTRICT_KYWD __ent, + struct dirent **_RESTRICT_KYWD __res) +{ + return (__posix_readdir_r(__dp, __ent, __res)); +} + +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern struct dirent *readdir_r(); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +#else /* !_LP64 && _FILE_OFFSET_BITS == 32 */ + +#if defined(_LP64) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname readdir64_r readdir_r +#else +#define readdir64_r readdir +#endif +#else /* _LP64 */ +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname readdir_r readdir64_r +#else +#define readdir_r readdir64_r +#endif +#endif /* _LP64 */ +extern int readdir_r(); + +#endif /* !_LP64 && _FILE_OFFSET_BITS == 32 */ + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +/* transitional large file interface */ +extern int readdir64_r(); +#endif + +#endif /* __STDC__ */ + +#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _DIRENT_H */ diff --git a/usr/src/head/dlfcn.h b/usr/src/head/dlfcn.h new file mode 100644 index 0000000000..d9deb7573a --- /dev/null +++ b/usr/src/head/dlfcn.h @@ -0,0 +1,232 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 1989 AT&T + * All Rights Reserved + * + */ + +#ifndef _DLFCN_H +#define _DLFCN_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ + +#include <sys/feature_tests.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Information structure for libpath dlinfo() and dlamd64getunwind() request. + */ +#if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) +#ifdef __STDC__ +typedef struct dl_info { + const char *dli_fname; /* file containing address range */ + void *dli_fbase; /* base address of file image */ + const char *dli_sname; /* symbol name */ + void *dli_saddr; /* symbol address */ +} Dl_info; +#else +typedef struct dl_info { + char *dli_fname; + void *dli_fbase; + char *dli_sname; + void *dli_saddr; +} Dl_info; +#endif /* __STDC__ */ +#endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */ + + +/* + * Information structure for libpath dlinfo() request. + */ +#if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) +typedef struct dl_serpath { + char *dls_name; /* library search path name */ + uint_t dls_flags; /* path information */ +} Dl_serpath; + +typedef struct dl_serinfo { + size_t dls_size; /* total buffer size */ + uint_t dls_cnt; /* number of path entries */ + Dl_serpath dls_serpath[1]; /* there may be more than one */ +} Dl_serinfo; + +typedef struct { + uint_t dlui_version; /* version # */ + uint_t dlui_flags; /* flags */ + char *dlui_objname; /* path to object */ + void *dlui_unwindstart; /* star of unwind hdr */ + void *dlui_unwindend; /* end of unwind hdr */ + void *dlui_segstart; /* start of segment described */ + /* by unwind block */ + void *dlui_segend; /* end of segment described */ + /* by unwind block */ +} Dl_amd64_unwindinfo; +#endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */ + + +typedef ulong_t Lmid_t; + +/* + * Declarations used for dynamic linking support routines. + */ +#ifdef __STDC__ +extern void *dlopen(const char *, int); +extern void *dlsym(void *_RESTRICT_KYWD, const char *_RESTRICT_KYWD); +extern int dlclose(void *); +extern char *dlerror(void); +#if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) +extern void *dlmopen(Lmid_t, const char *, int); +extern int dladdr(void *, Dl_info *); +extern int dladdr1(void *, Dl_info *, void **, int); +extern int dldump(const char *, const char *, int); +extern int dlinfo(void *, int, void *); +extern Dl_amd64_unwindinfo *dlamd64getunwind(void *, Dl_amd64_unwindinfo *); +#endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */ +#else +extern void *dlopen(); +extern void *dlsym(); +extern int dlclose(); +extern char *dlerror(); +#if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) +extern void *dlmopen(); +extern int dladdr(); +extern int dladdr1(); +extern int dldump(); +extern int dlinfo(); +extern Dl_amd64_unwindinfo *dlamd64getunwind(); +#endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */ +#endif /* __STDC__ */ + +#pragma unknown_control_flow(dlopen, dlsym, dlclose, dlerror) +#if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) +#pragma unknown_control_flow(dlmopen, dladdr, dladdr1, dldump, dlinfo) +#endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */ + +/* + * Valid values for handle argument to dlsym(3x). + */ +#define RTLD_NEXT (void *)-1 /* look in `next' dependency */ +#define RTLD_DEFAULT (void *)-2 /* look up symbol from scope */ + /* of current object */ +#define RTLD_SELF (void *)-3 /* look in `ourself' */ +#define RTLD_PROBE (void *)-4 /* look up symbol from scope */ + /* of current object, */ + /* using currently */ + /* loaded objects only. */ +/* + * Valid values for mode argument to dlopen. + */ +#define RTLD_LAZY 0x00001 /* deferred function binding */ +#define RTLD_NOW 0x00002 /* immediate function binding */ +#define RTLD_NOLOAD 0x00004 /* don't load object */ + +#define RTLD_GLOBAL 0x00100 /* export symbols to others */ +#define RTLD_LOCAL 0x00000 /* symbols are only available */ + /* to group members */ +#define RTLD_PARENT 0x00200 /* add parent (caller) to */ + /* a group dependencies */ +#define RTLD_GROUP 0x00400 /* resolve symbols within */ + /* members of the group */ +#define RTLD_WORLD 0x00800 /* resolve symbols within */ + /* global objects */ +#define RTLD_NODELETE 0x01000 /* do not remove members */ +#define RTLD_FIRST 0x02000 /* only first object is */ + /* available for dlsym */ +#define RTLD_CONFGEN 0x10000 /* crle(1) config generation */ + /* internal use only */ + +/* + * Valid values for flag argument to dldump. + */ +#define RTLD_REL_RELATIVE 0x00001 /* apply relative relocs */ +#define RTLD_REL_EXEC 0x00002 /* apply symbolic relocs that */ + /* bind to main */ +#define RTLD_REL_DEPENDS 0x00004 /* apply symbolic relocs that */ + /* bind to dependencies */ +#define RTLD_REL_PRELOAD 0x00008 /* apply symbolic relocs that */ + /* bind to preload objs */ +#define RTLD_REL_SELF 0x00010 /* apply symbolic relocs that */ + /* bind to ourself */ +#define RTLD_REL_WEAK 0x00020 /* apply symbolic weak relocs */ + /* even if unresolved */ +#define RTLD_REL_ALL 0x00fff /* apply all relocs */ + +#define RTLD_MEMORY 0x01000 /* use memory sections */ +#define RTLD_STRIP 0x02000 /* retain allocable sections */ + /* only */ +#define RTLD_NOHEAP 0x04000 /* do no save any heap */ +#define RTLD_CONFSET 0x10000 /* crle(1) config generation */ + /* internal use only */ + +/* + * Valid values for dladdr1() flags. + */ +#define RTLD_DL_SYMENT 1 /* return symbol table entry */ +#define RTLD_DL_LINKMAP 2 /* return public link-map */ +#define RTLD_DL_MASK 0xffff + + +/* + * Arguments for dlinfo() + */ +#define RTLD_DI_LMID 1 /* obtain link-map id */ +#define RTLD_DI_LINKMAP 2 /* obtain link-map */ +#define RTLD_DI_CONFIGADDR 3 /* obtain config addr */ +#define RTLD_DI_SERINFO 4 /* obtain search path info or */ +#define RTLD_DI_SERINFOSIZE 5 /* associated info size */ +#define RTLD_DI_ORIGIN 6 /* obtain objects origin */ +#define RTLD_DI_PROFILENAME 7 /* obtain profile object name */ + /* internal use only */ +#define RTLD_DI_PROFILEOUT 8 /* obtain profile output name */ + /* internal use only */ +#define RTLD_DI_GETSIGNAL 9 /* get termination signal */ +#define RTLD_DI_SETSIGNAL 10 /* set termination signal */ +#define RTLD_DI_MAX 10 + +#if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) +/* + * Version information for Dl_amd64_unwindinfo.dlui_version + */ +#define DLUI_VERS_1 1 +#define DLUI_VERS_CURRENT DLUI_VERS_1 + +/* + * Valid flags for Dl_amd64_unwindinfo.dlfi_flags + */ +#define DLUI_FLG_NOUNWIND 0x0001 /* object has no Unwind info */ +#define DLUI_FLG_NOOBJ 0x0002 /* no object was found */ + /* matching the pc provided */ +#endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _DLFCN_H */ diff --git a/usr/src/head/door.h b/usr/src/head/door.h new file mode 100644 index 0000000000..091f552d1d --- /dev/null +++ b/usr/src/head/door.h @@ -0,0 +1,67 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _DOOR_H +#define _DOOR_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <sys/door.h> +#include <ucred.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASM + +/* + * Doors API + */ +int door_create(void (*)(void *, char *, size_t, door_desc_t *, uint_t), + void *, uint_t); +int door_revoke(int); +int door_info(int, door_info_t *); +int door_call(int, door_arg_t *); +int door_return(char *, size_t, door_desc_t *, uint_t); +int door_cred(door_cred_t *); +int door_ucred(ucred_t **); +int door_bind(int); +int door_unbind(void); +int door_getparam(int, int, size_t *); +int door_setparam(int, int, size_t); + +typedef void door_server_func_t(door_info_t *); +door_server_func_t *door_server_create(door_server_func_t *); + +#endif /* _ASM */ + +#ifdef __cplusplus +} +#endif + +#endif /* _DOOR_H */ diff --git a/usr/src/head/elf.h b/usr/src/head/elf.h new file mode 100644 index 0000000000..c1fe477152 --- /dev/null +++ b/usr/src/head/elf.h @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _ELF_H +#define _ELF_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */ + +#include <sys/elf.h> + +#endif /* _ELF_H */ diff --git a/usr/src/head/errno.h b/usr/src/head/errno.h new file mode 100644 index 0000000000..cfabb2716b --- /dev/null +++ b/usr/src/head/errno.h @@ -0,0 +1,69 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + + +#ifndef _ERRNO_H +#define _ERRNO_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4.1.5 */ + +/* + * Error codes + */ + +#include <sys/errno.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_LP64) +/* + * The symbols _sys_errlist and _sys_nerr are not visible in the + * LP64 libc. Use strerror(3C) instead. + */ +#endif /* _LP64 */ + +#if defined(_REENTRANT) || defined(_TS_ERRNO) || _POSIX_C_SOURCE - 0 >= 199506L +extern int *___errno(); +#define errno (*(___errno())) +#else +extern int errno; +/* ANSI C++ requires that errno be a macro */ +#if __cplusplus >= 199711L +#define errno errno +#endif +#endif /* defined(_REENTRANT) || defined(_TS_ERRNO) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ERRNO_H */ diff --git a/usr/src/head/euc.h b/usr/src/head/euc.h new file mode 100644 index 0000000000..4e6d4f90a9 --- /dev/null +++ b/usr/src/head/euc.h @@ -0,0 +1,77 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _EUC_H +#define _EUC_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/euc.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __STDC__ +extern int csetcol(int n); /* Returns # of columns for codeset n. */ +extern int csetlen(int n); /* Returns # of bytes excluding SSx. */ +extern int euclen(const unsigned char *s); +extern int euccol(const unsigned char *s); +extern int eucscol(const unsigned char *str); +#else /* __STDC__ */ +extern int csetlen(), csetcol(); +extern int euclen(), euccol(), eucscol(); +#endif /* __STDC__ */ + +/* Returns code set number for the first byte of an EUC char. */ +#define csetno(c) \ + (((c)&0x80)?(((c)&0xff) == SS2)?2:((((c)&0xff) == SS3)?3:1):0) + +/* + * Copied from _wchar.h of SVR4 + */ +#if defined(__STDC__) +#define multibyte (__ctype[520] > 1) +#define eucw1 __ctype[514] +#define eucw2 __ctype[515] +#define eucw3 __ctype[516] +#define scrw1 __ctype[517] +#define scrw2 __ctype[518] +#define scrw3 __ctype[519] +#else +#define multibyte (_ctype[520] > 1) +#define eucw1 _ctype[514] +#define eucw2 _ctype[515] +#define eucw3 _ctype[516] +#define scrw1 _ctype[517] +#define scrw2 _ctype[518] +#define scrw3 _ctype[519] +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _EUC_H */ diff --git a/usr/src/head/exacct.h b/usr/src/head/exacct.h new file mode 100644 index 0000000000..45161068a5 --- /dev/null +++ b/usr/src/head/exacct.h @@ -0,0 +1,90 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _EXACCT_H +#define _EXACCT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * exacct item, group, and object definitions as well as structure manipulation + * and conversion routines are given in sys/exacct.h. + */ +#include <sys/exacct.h> +#include <sys/exacct_catalog.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * ea_open positioning options: passed in via the aflags argument, these flags + * determine whether the newly opened file is positioned for reading prior to + * its first record, or after its last. + */ +#define EO_HEAD 0x0 /* open file positioned at first object */ +#define EO_TAIL 0x1 /* open file positioned at last object */ +#define EO_POSN_MSK 0x1 + +/* + * ea_open validation options: passed in via the aflags argument, these flags + * specify whether the open operation should validate the header on the input + * file. The EO_NO_VALID_HDR is useful in the case that no header is present on + * the file, but the version and file type checks are omitted, meaning that + * incompatibilities might not be caught immediately. + */ +#define EO_VALID_HDR 0x0 /* validate header on opening file */ +#define EO_NO_VALID_HDR 0x2 /* omit header validation */ +#define EO_VALIDATE_MSK 0x2 + +typedef struct _ea_file { + void *ef_opaque_ptr[8]; + offset_t ef_opaque_off[3]; + int ef_opaque_int[6]; +} ea_file_t; + +extern int ea_error(void); +extern int ea_open(ea_file_t *, const char *, const char *, int, int, mode_t); +extern int ea_fdopen(ea_file_t *, int, const char *, int, int); +extern void ea_clear(ea_file_t *); +extern int ea_close(ea_file_t *); +extern int ea_match_object_catalog(ea_object_t *, ea_catalog_t); +extern ea_object_type_t ea_next_object(ea_file_t *, ea_object_t *); +extern ea_object_type_t ea_previous_object(ea_file_t *, ea_object_t *); +extern ea_object_type_t ea_get_object(ea_file_t *, ea_object_t *); +extern ea_object_type_t ea_unpack_object(ea_object_t **, int, void *, size_t); +extern int ea_write_object(ea_file_t *, ea_object_t *); +extern const char *ea_get_creator(ea_file_t *); +extern const char *ea_get_hostname(ea_file_t *); +extern ea_object_t *ea_copy_object(const ea_object_t *); +extern ea_object_t *ea_copy_object_tree(const ea_object_t *); +extern ea_object_t *ea_get_object_tree(ea_file_t *, uint32_t); + +#ifdef __cplusplus +} +#endif + +#endif /* _EXACCT_H */ diff --git a/usr/src/head/exacct_impl.h b/usr/src/head/exacct_impl.h new file mode 100644 index 0000000000..8ade514ea0 --- /dev/null +++ b/usr/src/head/exacct_impl.h @@ -0,0 +1,67 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1999-2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _EXACCT_IMPL_H +#define _EXACCT_IMPL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/exacct.h> +#include <stdio.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _ea_file_depth { + int efd_nobjs; /* number of objects in group */ + int efd_obj; /* index of curr object within group */ +} ea_file_depth_t; + +typedef struct _ea_file_impl { + char *ef_filename; /* file name */ + char *ef_creator; /* file creator */ + char *ef_hostname; /* file hostname */ + FILE *ef_fp; /* file stream pointer */ + ea_file_depth_t *ef_depth; /* pointer to depth stack */ + char *ef_buf; /* pointer for buffer consumption */ + ssize_t ef_bufsize; /* remaining bytes in buffer */ + void *ef_lpad[1]; + offset_t ef_advance; /* bytes to advance on next op */ + offset_t ef_opad[2]; + mode_t ef_oflags; /* flags to open(2) */ + int ef_fd; /* file descriptor */ + int ef_version; /* exacct file version */ + int ef_ndeep; /* current depth in allocated stack */ + int ef_mxdeep; /* maximum depth of allocated stack */ + int ef_ipad[1]; +} ea_file_impl_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _EXACCT_IMPL_H */ diff --git a/usr/src/head/exec_attr.h b/usr/src/head/exec_attr.h new file mode 100644 index 0000000000..75692a7690 --- /dev/null +++ b/usr/src/head/exec_attr.h @@ -0,0 +1,143 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1999-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _EXEC_ATTR_H +#define _EXEC_ATTR_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + + +#include <sys/types.h> +#include <secdb.h> + + +#define EXECATTR_FILENAME "/etc/security/exec_attr" +#define EXECATTR_DB_NAME "exec_attr.org_dir" +#define EXECATTR_DB_NCOL 7 /* total columns */ +#define EXECATTR_DB_NKEYCOL 3 /* total searchable columns */ +#define EXECATTR_DB_TBLT "exec_attr_tbl" +#define EXECATTR_NAME_DEFAULT_KW "nobody" + +#define EXECATTR_COL0_KW "name" +#define EXECATTR_COL1_KW "policy" +#define EXECATTR_COL2_KW "type" +#define EXECATTR_COL3_KW "res1" +#define EXECATTR_COL4_KW "res2" +#define EXECATTR_COL5_KW "id" +#define EXECATTR_COL6_KW "attr" + +/* + * indices of searchable columns + */ +#define EXECATTR_KEYCOL0 0 /* name */ +#define EXECATTR_KEYCOL1 1 /* policy */ +#define EXECATTR_KEYCOL2 5 /* id */ + + +/* + * Some macros used internally by the nsswitch code + */ + +#define GET_ONE 0 /* get only one exec_attr from list */ +#define GET_ALL 1 /* get all matching exec_attrs in list */ + + +/* + * Key words used in the exec_attr database + */ +#define EXECATTR_EUID_KW "euid" +#define EXECATTR_EGID_KW "egid" +#define EXECATTR_UID_KW "uid" +#define EXECATTR_GID_KW "gid" +#define EXECATTR_LPRIV_KW "limitprivs" +#define EXECATTR_IPRIV_KW "privs" + +/* + * Nsswitch representation of execution attributes. + */ +typedef struct execstr_s { + char *name; /* profile name */ + char *policy; /* suser/rbac/tsol */ + char *type; /* cmd/act */ + char *res1; /* reserved for future use */ + char *res2; /* reserved for future use */ + char *id; /* unique ID */ + char *attr; /* string of key-value pair attributes */ + struct execstr_s *next; /* pointer to next entry */ +} execstr_t; + +typedef struct execattr_s { + char *name; /* profile name */ + char *policy; /* suser/rbac/tsol */ + char *type; /* cmd/act */ + char *res1; /* reserved for future use */ + char *res2; /* reserved for future use */ + char *id; /* unique ID */ + kva_t *attr; /* array of key-value pair attributes */ + struct execattr_s *next; /* pointer to next entry */ +} execattr_t; + +typedef struct __private_execattr { + const char *name; + const char *type; + const char *id; + const char *policy; + int search_flag; + execstr_t *head_exec; + execstr_t *prev_exec; +} _priv_execattr; /* Un-supported. For Sun internal use only */ + + +#ifdef __STDC__ +extern execattr_t *getexecattr(void); +extern execattr_t *getexecuser(const char *, const char *, const char *, int); +extern execattr_t *getexecprof(const char *, const char *, const char *, int); +extern execattr_t *match_execattr(execattr_t *, const char *, const char *, \ + const char *); +extern void free_execattr(execattr_t *); +extern void setexecattr(void); +extern void endexecattr(void); + +#else /* not __STDC__ */ + +extern execattr_t *getexecattr(); +extern execattr_t *getexecuser(); +extern execattr_t *getexecprof(); +extern execattr_t *match_execattr(); +extern void setexecattr(); +extern void endexecattr(); +extern void free_execattr(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _EXEC_ATTR_H */ diff --git a/usr/src/head/fatal.h b/usr/src/head/fatal.h new file mode 100644 index 0000000000..1d168aeafe --- /dev/null +++ b/usr/src/head/fatal.h @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _FATAL_H +#define _FATAL_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4.1.1 */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int Fflags; +extern char *Ffile; +extern int Fvalue; +extern int (*Ffunc)(); +extern int Fjmp[10]; + +#define FTLMSG 0100000 +#define FTLCLN 0040000 +#define FTLFUNC 0020000 +#define FTLACT 0000077 +#define FTLJMP 0000002 +#define FTLEXIT 0000001 +#define FTLRET 0000000 + +#define FSAVE(val) SAVE(Fflags, old_Fflags); Fflags = val; +#define FRSTR() RSTR(Fflags, old_Fflags); + +#ifdef __cplusplus +} +#endif + +#endif /* _FATAL_H */ diff --git a/usr/src/head/fcntl.h b/usr/src/head/fcntl.h new file mode 100644 index 0000000000..b0023d57c1 --- /dev/null +++ b/usr/src/head/fcntl.h @@ -0,0 +1,175 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _FCNTL_H +#define _FCNTL_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6.1.7 */ + +#include <sys/feature_tests.h> +#if defined(__EXTENSIONS__) || defined(_XPG4) +#include <sys/stat.h> +#endif +#include <sys/types.h> +#include <sys/fcntl.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__EXTENSIONS__) || defined(_XPG4) + +/* Symbolic constants for the "lseek" routine. */ + +#ifndef SEEK_SET +#define SEEK_SET 0 /* Set file pointer to "offset" */ +#endif + +#ifndef SEEK_CUR +#define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ +#endif + +#ifndef SEEK_END +#define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#endif /* defined(__EXTENSIONS__) || defined(_XPG4) */ + +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +#ifndef SEEK_DATA +#define SEEK_DATA 3 /* Set file pointer to next data past offset */ +#endif + +#ifndef SEEK_HOLE +#define SEEK_HOLE 4 /* Set file pointer to next hole past offset */ +#endif +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ + + +/* large file compilation environment setup */ +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname open open64 +#pragma redefine_extname creat creat64 +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_ATFILE_SOURCE) +#pragma redefine_extname openat openat64 +#pragma redefine_extname attropen attropen64 +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ +#else +#define open open64 +#define creat creat64 +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_ATFILE_SOURCE) +#define openat openat64 +#define attropen attropen64 +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ +#endif +#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ + +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname open64 open +#pragma redefine_extname creat64 creat +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_ATFILE_SOURCE) +#pragma redefine_extname openat64 openat +#pragma redefine_extname attropen64 attropen +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ +#else +#define open64 open +#define creat64 creat +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_ATFILE_SOURCE) +#define openat64 openat +#define attropen64 attropen +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ +#endif +#endif /* _LP64 && _LARGEFILE64_SOURCE */ + +#if defined(__STDC__) + +extern int fcntl(int, int, ...); +extern int open(const char *, int, ...); +extern int creat(const char *, mode_t); +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_ATFILE_SOURCE) +extern int openat(int, const char *, int, ...); +extern int attropen(const char *, const char *, int, ...); +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +extern int directio(int, int); +#endif + +/* transitional large file interface versions */ +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern int open64(const char *, int, ...); +extern int creat64(const char *, mode_t); +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_ATFILE_SOURCE) +extern int openat64(int, const char *, int, ...); +extern int attropen64(const char *, const char *, int, ...); +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ +#endif + +#else /* defined(__STDC__) */ + +extern int fcntl(); +extern int open(); +extern int creat(); +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_ATFILE_SOURCE) +extern int openat(); +extern int attropen(); +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +extern int directio(); +#endif + +/* transitional large file interface versions */ +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern int open64(); +extern int creat64(); +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_ATFILE_SOURCE) +extern int openat64(); +extern int attropen64(); +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ +#endif + +#endif /* defined(__STDC__) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _FCNTL_H */ diff --git a/usr/src/head/float.h b/usr/src/head/float.h new file mode 100644 index 0000000000..a3e2dd6c4f --- /dev/null +++ b/usr/src/head/float.h @@ -0,0 +1,145 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _FLOAT_H +#define _FLOAT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__sparc) + +#if defined(__STDC__) +extern int __flt_rounds(void); +#else /* defined(__STDC__) */ +extern int __flt_rounds(); +#endif /* defined(__STDC__) */ +#define FLT_ROUNDS __flt_rounds() + +#else /* defined(__sparc) */ + +#if defined(__STDC__) +extern int __fltrounds(void); +#else /* defined (__STDC__) */ +extern int __fltrounds(); +#endif /* defined(__STDC__) */ +#if defined(__amd64) +#define FLT_ROUNDS __fltrounds() +#else /* defined(__amd64) */ +extern int __flt_rounds; +#define FLT_ROUNDS __flt_rounds +#endif /* defined(__amd64) */ +#endif /* defined(__sparc) */ + +/* Introduced in ISO/IEC 9899:1999 standard */ +#if defined(__EXTENSIONS__) || defined(_STDC_C99) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) +#if defined(__FLT_EVAL_METHOD__) +#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ +#else +#define FLT_EVAL_METHOD -1 +#endif /* defined(__FLT_EVAL_METHOD__) */ +#endif /* defined(__EXTENSIONS__) || defined(_STDC_C99)... */ + +#define FLT_RADIX 2 +#define FLT_MANT_DIG 24 +#define FLT_EPSILON 1.1920928955078125000000E-07F +#define FLT_DIG 6 +#define FLT_MIN_EXP (-125) +#define FLT_MIN 1.1754943508222875079688E-38F +#define FLT_MIN_10_EXP (-37) +#define FLT_MAX_EXP (+128) +#define FLT_MAX 3.4028234663852885981170E+38F +#define FLT_MAX_10_EXP (+38) + +#define DBL_MANT_DIG 53 +#define DBL_EPSILON 2.2204460492503130808473E-16 +#define DBL_DIG 15 +#define DBL_MIN_EXP (-1021) +#define DBL_MIN 2.2250738585072013830903E-308 +#define DBL_MIN_10_EXP (-307) +#define DBL_MAX_EXP (+1024) +#define DBL_MAX 1.7976931348623157081452E+308 +#define DBL_MAX_10_EXP (+308) + +/* Introduced in ISO/IEC 9899:1999 standard */ +#if defined(__EXTENSIONS__) || defined(_STDC_C99) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) +#if defined(__sparc) +#define DECIMAL_DIG 36 +#elif defined(__i386) || defined(__amd64) +#define DECIMAL_DIG 21 +#endif +#endif /* defined(__EXTENSIONS__) || defined(_STDC_C99)... */ + + +#if defined(__i386) || defined(__amd64) + +/* Follows IEEE standards for 80-bit floating point */ +#define LDBL_MANT_DIG 64 +#define LDBL_EPSILON 1.0842021724855044340075E-19L +#define LDBL_DIG 18 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MIN 3.3621031431120935062627E-4932L +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_EXP (+16384) +#define LDBL_MAX 1.1897314953572317650213E+4932L +#define LDBL_MAX_10_EXP (+4932) + +#elif defined(__sparc) + +/* Follows IEEE standards for 128-bit floating point */ +#define LDBL_MANT_DIG 113 +#define LDBL_EPSILON 1.925929944387235853055977942584927319E-34L +#define LDBL_DIG 33 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MIN 3.362103143112093506262677817321752603E-4932L +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_EXP (+16384) +#define LDBL_MAX 1.189731495357231765085759326628007016E+4932L +#define LDBL_MAX_10_EXP (+4932) + +#else + +#error "Unknown architecture!" + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _FLOAT_H */ diff --git a/usr/src/head/fmtmsg.h b/usr/src/head/fmtmsg.h new file mode 100644 index 0000000000..de78bc53a9 --- /dev/null +++ b/usr/src/head/fmtmsg.h @@ -0,0 +1,218 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _FMTMSG_H +#define _FMTMSG_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */ + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * fmtmsg.h + * + * The <fmtmsg.h> header file contains the definitions needed + * to use the fmtmsg() function. This function writes messages + * in a standard format to the standard error stream (stderr) + * and to the system console. + */ + +/* + * Define the value "NULL" if it hasn't been defined already. + * NULL breaks namespace so we define _NULL + */ +#if defined(_LP64) +#define _NULL 0L +#else +#define _NULL 0 +#endif + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +#ifndef NULL +#define NULL _NULL +#endif +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + + +/* + * Constraint definitions: + * MM_MXLABELLN Maximum size of a "label" in a message + * MM_MXTAGLN Maximum size of a "tag" in a message + * MM_MXTXTLN Maximum size of a text string + * MM_MXACTLN Maximum size of an action string + */ + +#define MM_MXLABELLN 25 +#define MM_MXTAGLN 32 +#define MM_MXTXTLN 512 +#define MM_MXACTLN 512 + +/* + * Environment variable names used by fmtmsg(): + * MSGVERB Tells fmtmsg() which components it is to write + * to the standard error stream + */ + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +#define MSGVERB "MSGVERB" +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +/* + * Classification information + * - Definition of classifications + * - Definition of recoverability + * - Definition of source classifications + */ + +/* + * Definition of the "null" classification + * MM_NULL Indicates that the classification has been omitted + */ + +#define MM_NULL 0L + +/* + * Definitions of type classifications: + * MM_HARD Hardware + * MM_SOFT Software + * MM_FIRM Firmware + */ + +#define MM_HARD 0x00000001L +#define MM_SOFT 0x00000002L +#define MM_FIRM 0x00000004L + +/* + * Definitions of recoverability subclassification + * MM_RECOVER Recoverable + * MM_NRECOV Non-recoverable + */ + +#define MM_RECOVER 0x00000100L +#define MM_NRECOV 0x00000200L + +/* + * Definitions of source subclassification + * MM_APPL Application + * MM_UTIL Utility + * MM_OPSYS Kernel + */ + +#define MM_APPL 0x00000008L +#define MM_UTIL 0x00000010L +#define MM_OPSYS 0x00000020L + +/* + * Definitions for the action to take with the message: + * MM_PRINT Write to the standard error stream + * MM_CONSOLE Treat the message as a console message + */ + +#define MM_PRINT 0x00000040L +#define MM_CONSOLE 0x00000080L + +/* + * Constants for severity values + * + * SEV_LEVEL Names the env variable that defines severities + * + * MM_NOSEV Message has no severity + * MM_HALT Message describes a severe error condition + * MM_ERROR Message describes an error condition + * MM_WARNING Message tells of probable error condition + * MM_INFO Message informs, not in error + */ + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +#define SEV_LEVEL "SEV_LEVEL" +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#define MM_NOSEV 0 +#define MM_HALT 1 +#define MM_ERROR 2 +#define MM_WARNING 3 +#define MM_INFO 4 + +/* + * Null values for message components + * MM_NULLLBL Null value for the label-component + * MM_NULLSEV Null value for the severity-component + * MM_NULLMC Null value for the classification-component + * MM_NULLTXT Null value for the text-component + * MM_NULLACT Null value for the action-component + * MM_NULLTAG Null value for the tag-component + */ + +#define MM_NULLLBL ((char *)_NULL) +#define MM_NULLSEV MM_NOSEV +#define MM_NULLMC MM_NULL +#define MM_NULLTXT ((char *)_NULL) +#define MM_NULLACT ((char *)_NULL) +#define MM_NULLTAG ((char *)_NULL) + +/* + * Values returned by fmtmsg() + * + * MM_NOTOK None of the requested messages were generated + * MM_NOMSG No message was written to stderr + * MM_NOCON No console message was generated + */ + +#define MM_NOTOK -1 +#define MM_OK 0x00 +#define MM_NOMSG 0x01 +#define MM_NOCON 0x04 + +/* Function definition */ + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +#if defined(__STDC__) +int addseverity(int, const char *); +#else /* __STDC__ */ +int addseverity(); +#endif /* __STDC__ */ +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#if defined(__STDC__) +int fmtmsg(long, const char *, int, const char *, const char *, + const char *); +#else /* __STDC__ */ +int fmtmsg(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _FMTMSG_H */ diff --git a/usr/src/head/fnmatch.h b/usr/src/head/fnmatch.h new file mode 100644 index 0000000000..b03dda5470 --- /dev/null +++ b/usr/src/head/fnmatch.h @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1994 by Sun Microsystems, Inc. + * Copyright 1985, 1994 by Mortice Kern Systems Inc. All rights reserved. + */ + +#ifndef _FNMATCH_H +#define _FNMATCH_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define FNM_PATHNAME 0x01 /* Slash in str only matches slash in pattern */ +#define FNM_NOESCAPE 0x02 /* Disable '\'-quoting of metacharacters */ +#define FNM_PERIOD 0x04 /* Leading period in string must be exactly */ + /* matched by period in pattern */ +#define FNM_IGNORECASE 0x08 /* Ignore case when making comparisons */ + +#define FNM_NOMATCH 1 /* string doesnt match the specified pattern */ +#define FNM_ERROR 2 /* error occured */ +#define FNM_NOSYS 3 /* Function (XPG4) not supported */ + +#if defined(__STDC__) +extern int fnmatch(const char *, const char *, int); +#else +extern int fnmatch(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _FNMATCH_H */ diff --git a/usr/src/head/ftw.h b/usr/src/head/ftw.h new file mode 100644 index 0000000000..ba6f535dd7 --- /dev/null +++ b/usr/src/head/ftw.h @@ -0,0 +1,186 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _FTW_H +#define _FTW_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#include <sys/types.h> +#include <sys/stat.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Codes for the third argument to the user-supplied function + * which is passed as the second argument to ftwalk + */ + +#define FTW_F 0 /* file */ +#define FTW_D 1 /* directory */ +#define FTW_DNR 2 /* directory without read permission */ +#define FTW_NS 3 /* unknown type, stat failed */ +#define FTW_SL 4 /* symbolic link */ +#define FTW_DP 6 /* directory */ +#define FTW_SLN 7 /* symbolic link that points to nonexistent file */ + +/* + * Codes for the fourth argument to ftwalk. You can specify the + * union of these flags. + */ + +#define FTW_PHYS 01 /* use lstat instead of stat */ +#define FTW_MOUNT 02 /* do not cross a mount point */ +#define FTW_CHDIR 04 /* chdir to each directory before reading */ +#define FTW_DEPTH 010 /* call descendents before calling the parent */ +#define FTW_ANYERR 020 /* return FTW_NS on any stat failure */ +#define FTW_HOPTION 040 /* private interface for find utility */ + +#if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || defined(_XPG4_2) +struct FTW +{ +#if defined(_XPG4_2) + int __quit; +#else + int quit; +#endif + int base; + int level; +}; +#endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) ... */ + +/* + * legal values for quit + */ + +#define FTW_SKD 1 +#define FTW_FOLLOW 2 +#define FTW_PRUNE 4 + +/* large file compilation environment setup */ +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname _xftw _xftw64 +#pragma redefine_extname _ftw _ftw64 +#if !defined(_XOPEN_SOURCE) || defined(_XPG5) +#pragma redefine_extname nftw nftw64 +#endif +#else /* __PRAGMA_REDEFINE_EXTNAME */ +#define _xftw _xftw64 +#define _ftw _ftw64 +#if !defined(_XOPEN_SOURCE) || defined(_XPG5) +#define nftw nftw64 +#endif +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ + +/* In the LP64 compilation environment, all APIs are already large file */ +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname _xftw64 _xftw +#pragma redefine_extname _ftw64 _ftw +#if !defined(_XOPEN_SOURCE) || defined(_XPG5) +#pragma redefine_extname nftw64 nftw +#endif +#else /* __PRAGMA_REDEFINE_EXTNAME */ +#define _xftw64 _xftw +#define _ftw64 _ftw +#if !defined(_XOPEN_SOURCE) || defined(_XPG5) +#define nftw64 nftw +#endif +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* _LP64 && _LARGEFILE64_SOURCE */ + +#if defined(__STDC__) + +extern int ftw(const char *, + int (*)(const char *, const struct stat *, int), int); +extern int _xftw(int, const char *, + int (*)(const char *, const struct stat *, int), int); +#if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || defined(_XPG4_2) +extern int nftw(const char *, + int (*)(const char *, const struct stat *, int, struct FTW *), + int, int); +#endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) ... */ + +/* + * transitional large file interface versions + */ +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern int ftw64(const char *, + int (*)(const char *, const struct stat64 *, int), int); +extern int _xftw64(int, const char *, + int (*)(const char *, const struct stat64 *, int), int); +#if !defined(_XOPEN_SOURCE) +extern int nftw64(const char *, + int (*)(const char *, const struct stat64 *, int, struct FTW *), + int, int); +#endif /* !defined(_XOPEN_SOURCE) */ +#endif /* _LARGEFILE64_SOURCE .. */ + +#else /* __STDC__ */ + +extern int ftw(), _xftw(); + +#if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || defined(_XPG4_2) +extern int nftw(); +#endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) ... */ + +/* transitional large file interface versions */ +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern int ftw64(); +extern int _xftw64(); +#if !defined(_XOPEN_SOURCE) +extern int nftw64(); +#endif /* !defined(_XOPEN_SOURCE) */ +#endif /* _LARGEFILE64_SOURCE .. */ + +#endif /* __STDC__ */ + +#define _XFTWVER 2 /* version of file tree walk */ + +#define ftw(path, fn, depth) _xftw(_XFTWVER, (path), (fn), (depth)) + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +#define ftw64(path, fn, depth) _xftw64(_XFTWVER, (path), (fn), (depth)) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _FTW_H */ diff --git a/usr/src/head/gelf.h b/usr/src/head/gelf.h new file mode 100644 index 0000000000..7bf1b3c6ec --- /dev/null +++ b/usr/src/head/gelf.h @@ -0,0 +1,147 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _GELF_H +#define _GELF_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#include <libelf.h> +#include <sys/link.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +#if !defined(_INT64_TYPE) +#error "64-bit integer types are required by gelf." +#endif + +/* + * Class-independent ELF API for Elf utilities. This is + * for manipulating Elf32 and Elf64 specific information + * in a format common to both classes. + */ + +typedef Elf64_Addr GElf_Addr; +typedef Elf64_Half GElf_Half; +typedef Elf64_Off GElf_Off; +typedef Elf64_Sword GElf_Sword; +typedef Elf64_Sxword GElf_Sxword; +typedef Elf64_Word GElf_Word; +typedef Elf64_Xword GElf_Xword; + +typedef Elf64_Ehdr GElf_Ehdr; +typedef Elf64_Move GElf_Move; +typedef Elf64_Phdr GElf_Phdr; +typedef Elf64_Shdr GElf_Shdr; +typedef Elf64_Sym GElf_Sym; +typedef Elf64_Syminfo GElf_Syminfo; +typedef Elf64_Rela GElf_Rela; +typedef Elf64_Rel GElf_Rel; +typedef Elf64_Dyn GElf_Dyn; +typedef Elf64_Cap GElf_Cap; + +/* + * The processing of versioning information can stay the + * same because both the Elf32 and Elf64 structures are + * of equal sizes. + */ +typedef Elf64_Verdef GElf_Verdef; +typedef Elf64_Verdaux GElf_Verdaux; +typedef Elf64_Verneed GElf_Verneed; +typedef Elf64_Vernaux GElf_Vernaux; +typedef Elf64_Versym GElf_Versym; + +/* + * move.m_info is encoded using the 64bit fields in Gelf. + */ +#define GELF_M_SYM ELF64_M_SYM +#define GELF_M_SIZE ELF64_M_SIZE + +/* + * sym.st_info field is same size for Elf32 and Elf64. + */ +#define GELF_ST_BIND ELF64_ST_BIND +#define GELF_ST_TYPE ELF64_ST_TYPE +#define GELF_ST_INFO ELF64_ST_INFO + + +/* + * Elf64 r_info may have data field in type id's word, + * so GELF_R_TYPE is defined as ELF64_R_TYPE_ID in order + * to isolate the proper bits for the true type id. + */ +#define GELF_R_TYPE ELF64_R_TYPE_ID +#define GELF_R_SYM ELF64_R_SYM +#define GELF_R_INFO ELF64_R_INFO +#define GELF_R_TYPE_DATA ELF64_R_TYPE_DATA +#define GELF_R_TYPE_ID ELF64_R_TYPE_ID +#define GELF_R_TYPE_INFO ELF64_R_TYPE_INFO + + + +int gelf_getclass(Elf*); +size_t gelf_fsize(Elf *, Elf_Type, size_t, uint_t); +GElf_Ehdr * gelf_getehdr(Elf *, GElf_Ehdr *); +int gelf_update_ehdr(Elf *, GElf_Ehdr *); +unsigned long gelf_newehdr(Elf *, int); +GElf_Phdr * gelf_getphdr(Elf *, int, GElf_Phdr *); +int gelf_update_phdr(Elf *, int, GElf_Phdr *); +unsigned long gelf_newphdr(Elf *, size_t); +GElf_Shdr * gelf_getshdr(Elf_Scn *, GElf_Shdr *); +int gelf_update_shdr(Elf_Scn *, GElf_Shdr *); +Elf_Data * gelf_xlatetof(Elf *, Elf_Data *, const Elf_Data *, uint_t); +Elf_Data * gelf_xlatetom(Elf *, Elf_Data *, const Elf_Data *, uint_t); +GElf_Sym * gelf_getsym(Elf_Data *, int, GElf_Sym *); +int gelf_update_sym(Elf_Data *, int, GElf_Sym *); +GElf_Sym * gelf_getsymshndx(Elf_Data *, Elf_Data *, int, GElf_Sym *, + Elf32_Word *); +int gelf_update_symshndx(Elf_Data *, Elf_Data *, int, GElf_Sym *, + Elf32_Word); +GElf_Syminfo * gelf_getsyminfo(Elf_Data *, int, GElf_Syminfo *); +int gelf_update_syminfo(Elf_Data *, int, GElf_Syminfo *); +GElf_Move * gelf_getmove(Elf_Data *, int, GElf_Move *); +int gelf_update_move(Elf_Data *, int, GElf_Move *); +GElf_Dyn * gelf_getdyn(Elf_Data *, int, GElf_Dyn *); +int gelf_update_dyn(Elf_Data *, int, GElf_Dyn *); +GElf_Rela * gelf_getrela(Elf_Data *, int, GElf_Rela *); +int gelf_update_rela(Elf_Data *, int, GElf_Rela *); +GElf_Rel * gelf_getrel(Elf_Data *, int, GElf_Rel *); +int gelf_update_rel(Elf_Data *, int, GElf_Rel *); +long gelf_checksum(Elf *); +GElf_Cap * gelf_getcap(Elf_Data *, int, GElf_Cap *); +int gelf_update_cap(Elf_Data *, int, GElf_Cap *); + + +#ifdef __cplusplus +} +#endif + +#endif /* _GELF_H */ diff --git a/usr/src/head/getopt.h b/usr/src/head/getopt.h new file mode 100644 index 0000000000..c8b6db4f75 --- /dev/null +++ b/usr/src/head/getopt.h @@ -0,0 +1,87 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * GNU-like getopt_long(), getopt_long_only(). + * Solaris-specific getopt_clip(). + */ + +#ifndef _GETOPT_H +#define _GETOPT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Values for has_arg field. + * + * optional_argument is not supported by getopt_clip() + */ +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +struct option { + char *name; /* name of long option */ + int has_arg; /* whether option takes an argument */ + int *flag; /* if not NULL, set *flag to val when option found */ + int val; /* if flag is not NULL, value to set *flag to. */ + /* if flag is NULL, return value */ +}; + +/* + * External variables used by these routines. + */ +extern char *optarg; +extern int opterr; +extern int optind; +extern int optopt; + +/* + * The use of getopt_long_only in new development is strongly discouraged. + */ +#ifdef __STDC__ +extern int getopt_long(int, char * const *, const char *, + const struct option *, int *); +extern int getopt_long_only(int, char * const *, const char *, + const struct option *, int *); +extern int getopt_clip(int, char * const *, const char *, + const struct option *, int *); +#else /* __STDC__ */ +extern int getopt_long(); +extern int getopt_long_only(); +extern int getopt_clip(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ diff --git a/usr/src/head/getwidth.h b/usr/src/head/getwidth.h new file mode 100644 index 0000000000..2670d18cc8 --- /dev/null +++ b/usr/src/head/getwidth.h @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1989 by Sun Microsystems, Inc. + * Copyright (c) 1989 by Nihon Sun Microsystems K.K. + */ + +#ifndef _GETWIDTH_H +#define _GETWIDTH_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <euc.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __STDC__ +extern void getwidth(eucwidth_t *); +#else /* __STDC__ */ +extern void getwidth(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETWIDTH_H */ diff --git a/usr/src/head/glob.h b/usr/src/head/glob.h new file mode 100644 index 0000000000..c10629850e --- /dev/null +++ b/usr/src/head/glob.h @@ -0,0 +1,84 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright 1985, 1992 by Mortice Kern Systems Inc. All rights reserved. + */ + +#ifndef _GLOB_H +#define _GLOB_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct glob_t { + size_t gl_pathc; /* Count of paths matched by pattern */ + char **gl_pathv; /* List of matched pathnames */ + size_t gl_offs; /* # of slots reserved in gl_pathv */ + /* following are internal to the implementation */ + char **gl_pathp; /* gl_pathv + gl_offs */ + int gl_pathn; /* # of elements allocated */ +} glob_t; + +/* + * "flags" argument to glob function. + */ +#define GLOB_ERR 0x0001 /* Don't continue on directory error */ +#define GLOB_MARK 0x0002 /* Mark directories with trailing / */ +#define GLOB_NOSORT 0x0004 /* Don't sort pathnames */ +#define GLOB_NOCHECK 0x0008 /* Return unquoted arg if no match */ +#define GLOB_DOOFFS 0x0010 /* Ignore gl_offs unless set */ +#define GLOB_APPEND 0x0020 /* Append to previous glob_t */ +#define GLOB_NOESCAPE 0x0040 /* Backslashes do not quote M-chars */ + +/* + * Error returns from "glob" + */ +#define GLOB_NOSYS (-4) /* function not supported (XPG4) */ +#define GLOB_NOMATCH (-3) /* Pattern does not match */ +#define GLOB_NOSPACE (-2) /* Not enough memory */ +#define GLOB_ABORTED (-1) /* GLOB_ERR set or errfunc return!=0 */ + +#if defined(__STDC__) +extern int glob(const char *_RESTRICT_KYWD, int, int(*)(const char *, int), + glob_t *_RESTRICT_KYWD); +extern void globfree(glob_t *); +#else +extern int glob(); +extern void globfree(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _GLOB_H */ diff --git a/usr/src/head/grp.h b/usr/src/head/grp.h new file mode 100644 index 0000000000..947328f912 --- /dev/null +++ b/usr/src/head/grp.h @@ -0,0 +1,243 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _GRP_H +#define _GRP_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3.3.1 */ + +#include <sys/feature_tests.h> + +#include <sys/types.h> + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +#include <stdio.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct group { /* see getgrent(3C) */ + char *gr_name; + char *gr_passwd; + gid_t gr_gid; + char **gr_mem; +}; + +#if defined(__STDC__) + +extern struct group *getgrgid(gid_t); /* MT-unsafe */ +extern struct group *getgrnam(const char *); /* MT-unsafe */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +extern struct group *getgrent_r(struct group *, char *, int); +extern struct group *fgetgrent_r(FILE *, struct group *, char *, int); + + +extern struct group *fgetgrent(FILE *); /* MT-unsafe */ +extern int initgroups(const char *, gid_t); +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) +extern void endgrent(void); +extern void setgrent(void); +extern struct group *getgrent(void); /* MT-unsafe */ +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)... */ + +#else + +extern struct group *getgrgid(); /* MT-unsafe */ +extern struct group *getgrnam(); /* MT-unsafe */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +extern struct group *getgrent_r(); +extern struct group *fgetgrent_r(); + +extern struct group *fgetgrent(); /* MT-unsafe */ +extern int initgroups(); +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) +extern void endgrent(); +extern void setgrent(); +extern struct group *getgrent(); /* MT-unsafe */ +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)... */ + +#endif /* __STDC__ */ + + +/* + * getgrgid_r() & getgrnam_r() prototypes are defined here. + */ + +/* + * Previous releases of Solaris, starting at 2.3, provided definitions of + * various functions as specified in POSIX.1c, Draft 6. For some of these + * functions, the final POSIX 1003.1c standard had a different number of + * arguments and return values. + * + * The following segment of this header provides support for the standard + * interfaces while supporting applications written under earlier + * releases. The application defines appropriate values of the feature + * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate + * whether it was written to expect the Draft 6 or standard versions of + * these interfaces, before including this header. This header then + * provides a mapping from the source version of the interface to an + * appropriate binary interface. Such mappings permit an application + * to be built from libraries and objects which have mixed expectations + * of the definitions of these functions. + * + * For applications using the Draft 6 definitions, the binary symbol is the + * same as the source symbol, and no explicit mapping is needed. For the + * standard interface, the function func() is mapped to the binary symbol + * _posix_func(). The preferred mechanism for the remapping is a compiler + * #pragma. If the compiler does not provide such a #pragma, the header file + * defines a static function func() which calls the _posix_func() version; + * this has to be done instead of #define since POSIX specifies that an + * application can #undef the symbol and still be bound to the correct + * implementation. Unfortunately, the statics confuse lint so we fallback to + * #define in that case. + * + * NOTE: Support for the Draft 6 definitions is provided for compatibility + * only. New applications/libraries should use the standard definitions. + */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#if defined(__STDC__) + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname getgrgid_r __posix_getgrgid_r +#pragma redefine_extname getgrnam_r __posix_getgrnam_r +extern int getgrgid_r(gid_t, struct group *, char *, int, struct group **); +extern int getgrnam_r(const char *, struct group *, char *, int, + struct group **); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern int __posix_getgrgid_r(gid_t, struct group *, char *, size_t, + struct group **); +extern int __posix_getgrnam_r(const char *, struct group *, char *, size_t, + struct group **); + +#ifdef __lint + +#define getgrgid_r __posix_getgrgid_r +#define getgrnam_r __posix_getgrnam_r + +#else /* !__lint */ + +static int +getgrgid_r(gid_t __gid, struct group *__grp, char *__buf, int __len, + struct group **__res) +{ + return (__posix_getgrgid_r(__gid, __grp, __buf, __len, __res)); +} +static int +getgrnam_r(const char *__cb, struct group *__grp, char *__buf, int __len, + struct group **__res) +{ + return (__posix_getgrnam_r(__cb, __grp, __buf, __len, __res)); +} + +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern struct group *getgrgid_r(gid_t, struct group *, char *, int); +extern struct group *getgrnam_r(const char *, struct group *, char *, int); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +#else /* __STDC__ */ + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname getgrgid_r __posix_getgrgid_r +#pragma redefine_extname getgrnam_r __posix_getgrnam_r +extern int getgrgid_r(); +extern int getgrnam_r(); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern int __posix_getgrgid_r(); +extern int __posix_getgrnam_r(); + +#ifdef __lint + +#define getgrgid_r __posix_getgrgid_r +#define getgrnam_r __posix_getgrnam_r + +#else /* !__lint */ + +static int +getgrgid_r(__gid, __grp, __buf, __len, __res) + gid_t __gid; + struct group *__grp; + char *__buf; + int __len; + struct group **__res; +{ + return (__posix_getgrgid_r(__gid, __grp, __buf, __len, __res)); +} +static int +getgrnam_r(__cb, __grp, __buf, __len, __res) + char *__cb; + struct group *__grp; + char *__buf; + int __len; + struct group **__res; +{ + return (__posix_getgrnam_r(__cb, __grp, __buf, __len, __res)); +} + +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern struct group *getgrgid_r(); +extern struct group *getgrnam_r(); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +#endif /* __STDC__ */ + +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GRP_H */ diff --git a/usr/src/head/iconv.h b/usr/src/head/iconv.h new file mode 100644 index 0000000000..9fb7e62d77 --- /dev/null +++ b/usr/src/head/iconv.h @@ -0,0 +1,63 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _ICONV_H +#define _ICONV_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _iconv_info *iconv_t; + +#if defined(__STDC__) +extern iconv_t iconv_open(const char *, const char *); +#ifdef _XPG6 +extern size_t iconv(iconv_t, char **_RESTRICT_KYWD, + size_t *_RESTRICT_KYWD, char **_RESTRICT_KYWD, + size_t *_RESTRICT_KYWD); +#else +extern size_t iconv(iconv_t, const char **_RESTRICT_KYWD, + size_t *_RESTRICT_KYWD, char **_RESTRICT_KYWD, + size_t *_RESTRICT_KYWD); +#endif +extern int iconv_close(iconv_t); +#else /* __STDC__ */ +extern iconv_t iconv_open(); +extern size_t iconv(); +extern int iconv_close(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _ICONV_H */ diff --git a/usr/src/head/ieeefp.h b/usr/src/head/ieeefp.h new file mode 100644 index 0000000000..ab582df519 --- /dev/null +++ b/usr/src/head/ieeefp.h @@ -0,0 +1,327 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _IEEEFP_H +#define _IEEEFP_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Floating point enviornment for machines that support + * the IEEE 754 floating-point standard. This file currently + * supports the 80*87, and SPARC families. + * + * This header defines the following interfaces: + * 1) Classes of floating point numbers + * 2) Rounding Control + * 3) Exception Control + * 4) Exception Handling + * 5) Utility Macros + * 6) Full Exception Environment Control + */ + +/* + * CLASSES of floating point numbers ************************* + * IEEE floating point values fall into 1 of the following 10 + * classes + */ +typedef enum fpclass_t { + FP_SNAN = 0, /* signaling NaN */ + FP_QNAN = 1, /* quiet NaN */ + FP_NINF = 2, /* negative infinity */ + FP_PINF = 3, /* positive infinity */ + FP_NDENORM = 4, /* negative denormalized non-zero */ + FP_PDENORM = 5, /* positive denormalized non-zero */ + FP_NZERO = 6, /* -0.0 */ + FP_PZERO = 7, /* +0.0 */ + FP_NNORM = 8, /* negative normalized non-zero */ + FP_PNORM = 9 /* positive normalized non-zero */ +} fpclass_t; + +#if defined(__STDC__) +extern fpclass_t fpclass(double); /* get class of double value */ +extern int finite(double); +extern int unordered(double, double); +#else +extern fpclass_t fpclass(); /* get class of double value */ +#endif + +/* + * ROUNDING CONTROL ****************************************** + * + * At all times, floating-point math is done using one of four + * mutually-exclusive rounding modes. + */ + +#if defined(__i386) || defined(__amd64) + +/* + * NOTE: the values given are chosen to match those used by the + * 80*87 rounding mode field in the control word. + */ +typedef enum fp_rnd { + FP_RN = 0, /* round to nearest representable number, tie -> even */ + FP_RM = 1, /* round toward minus infinity */ + FP_RP = 2, /* round toward plus infinity */ + FP_RZ = 3 /* round toward zero (truncate) */ +} fp_rnd; + +#endif + +#if defined(__sparc) + +/* + * NOTE: the values given are chosen to match those used by the + * RD (Round Direction) field of the FSR (Floating Point State Register). + */ +typedef enum fp_rnd { + FP_RN = 0, /* round to nearest representable number, tie -> even */ + FP_RZ = 1, /* round toward zero (truncate) */ + FP_RP = 2, /* round toward plus infinity */ + FP_RM = 3 /* round toward minus infinity */ +} fp_rnd; + +#endif + +#if defined(__STDC__) +extern fp_rnd fpsetround(fp_rnd); /* set rounding mode, return previous */ +extern fp_rnd fpgetround(void); /* return current rounding mode */ + +#else +extern fp_rnd fpsetround(); /* set rounding mode, return previous */ +extern fp_rnd fpgetround(); /* return current rounding mode */ + +#endif + +/* + * EXCEPTION CONTROL ***************************************** + * + */ + +#define fp_except int + +#define FP_DISABLE 0 /* exception will be ignored */ +#define FP_ENABLE 1 /* exception will cause SIGFPE */ +#define FP_CLEAR 0 /* exception has not occurred */ +#define FP_SET 1 /* exception has occurred */ + +#if defined(__i386) || defined(__amd64) + +/* + * There are six floating point exceptions, which can be individually + * ENABLED (== 1) or DISABLED (== 0). When an exception occurs + * (ENABLED or not), the fact is noted by changing an associated + * "sticky bit" from CLEAR (==0) to SET (==1). + * + * NOTE: the bit positions in fp_except are chosen to match those of + * the 80*87 control word mask bits. Although the 87 chips actually + * ENABLE exceptions with a mask value of 0 (not 1, as on the 3b), it + * is felt that switching these values may create more problems than + * it solves. + */ + +/* an fp_except can have the following (not exclusive) values: */ +#define FP_X_INV 0x01 /* invalid operation exception */ +#define FP_X_DNML 0x02 /* denormalization exception */ +#define FP_X_DZ 0x04 /* divide-by-zero exception */ +#define FP_X_OFL 0x08 /* overflow exception */ +#define FP_X_UFL 0x10 /* underflow exception */ +#define FP_X_IMP 0x20 /* imprecise (loss of precision) */ + +#endif + +#if defined(__sparc) + +/* + * There are five floating-point exceptions, which can be individually + * ENABLED (== 1) or DISABLED (== 0). When an exception occurs + * (ENABLED or not), the fact is noted by changing an associated + * "sticky bit" from CLEAR (==0) to SET (==1). + * + * NOTE: the bit positions in an fp_except are chosen to match that in + * the Trap Enable Mask of the FSR (Floating Point State Register). + */ + +/* an fp_except can have the following (not exclusive) values: */ +#define FP_X_INV 0x10 /* invalid operation exception */ +#define FP_X_OFL 0x08 /* overflow exception */ +#define FP_X_UFL 0x04 /* underflow exception */ +#define FP_X_DZ 0x02 /* divide-by-zero exception */ +#define FP_X_IMP 0x01 /* imprecise (loss of precision) */ + +#endif + +#if defined(__STDC__) +extern fp_except fpgetmask(void); /* current exception mask */ +extern fp_except fpsetmask(fp_except); /* set mask, return previous */ +extern fp_except fpgetsticky(void); /* return logged exceptions */ +extern fp_except fpsetsticky(fp_except); /* change logged exceptions */ + +#else +extern fp_except fpgetmask(); /* current exception mask */ +extern fp_except fpsetmask(); /* set mask, return previous */ +extern fp_except fpgetsticky(); /* return logged exceptions */ +extern fp_except fpsetsticky(); /* change logged exceptions */ + +#endif + +/* + * UTILITY MACROS ******************************************** + */ + +#if defined(__STDC__) +extern int isnanf(float); +extern int isnand(double); + +#else +extern int isnand(); +#define isnanf(x) (((*(long *)&(x) & 0x7f800000L) == 0x7f800000L) && \ + ((*(long *)&(x) & 0x007fffffL) != 0x00000000L)) +#endif + +#if defined(__i386) || defined(__amd64) + +/* + * EXCEPTION HANDLING **************************************** + * + * When a signal handler catches an FPE, it will have a freshly initialized + * coprocessor. This allows signal handling routines to make use of + * floating point arithmetic, if need be. The previous state of the 87 + * chip is available, however. There are two ways to get at this information, + * depending on how the signal handler was set up. + * + * If the handler was set via signal() or sigset(), the old, SVR3, method + * should be used: the signal handler assumes that it has a single parameter, + * which is of type struct _fpstackframe, defined below. By investigating + * this parameter, the cause of the FPE may be determined. By modifying it, + * the state of the coprocessor can be changed upon return to the main task. + * THIS METHOD IS OBSOLETE, AND MAY NOT BE SUPPORTED IN FUTURE RELEASES. + * + * If the handler was set via sigaction(), the new, SVR4, method should be + * used: the third argument to the handler will be a pointer to a ucontext + * structure (see sys/ucontext.h). The uc_mcontext.fpregs member of the + * ucontext structure holds the saved floating-point registers. This can be + * examined and/or modified. By modifying it, the state of the coprocessor + * can be changed upon return to the main task. + */ + +struct _fpreg { /* structure of a temp real fp register */ + unsigned short significand[4]; /* 64 bit mantissa value */ + unsigned short exponent; /* 15 bit exponent and sign bit */ +}; + +#if defined(__i386) + +/* + * AMD64 users should use sigaction() as described above. + */ + +struct _fpstackframe { /* signal handler's argument */ + long signo; /* signal number arg */ + long regs[19]; /* all registers */ + struct _fpstate *fpsp; /* address of saved 387 state */ + char *wsp; /* address of saved Weitek state */ +}; + +#endif + +#if defined(__i386) || defined(__amd64) + +#if defined(__amd64) +#define _fpstate _fpstate32 +#endif + +struct _fpstate { /* saved state info from an exception */ + unsigned int cw, /* control word */ + sw, /* status word after fnclex-not useful */ + tag, /* tag word */ + ipoff, /* %eip register */ + cssel, /* code segment selector */ + dataoff, /* data operand address */ + datasel; /* data operand selector */ + struct _fpreg _st[8]; /* saved register stack */ + unsigned int status; /* status word saved at exception */ + unsigned int mxcsr; + unsigned int xstatus; /* status word saved at exception */ + unsigned int __pad[2]; + unsigned int xmm[8][4]; +}; + +#if defined(__amd64) +#undef _fpstate +#endif + +#endif /* __i386 || __amd64 */ + +/* + * The structure of the 80*87 status and control words, and the mxcsr + * register are given by the following structures. + */ +struct _cw87 { + unsigned + mask: 6, /* exception masks */ + res1: 2, /* not used */ + prec: 2, /* precision control field */ + rnd: 2, /* rounding control field */ + inf: 1, /* infinity control (not on 387) */ + res2: 3; /* not used */ +}; + +struct _sw87 { + unsigned + excp: 6, /* exception sticky bits */ + res1: 1, /* not used */ + errs: 1, /* error summary-set if unmasked excp */ + c012: 3, /* condition code bits 0..2 */ + stkt: 3, /* stack top pointer */ + c3: 1, /* condition code bit 3 */ + busy: 1; /* coprocessor busy */ +}; + +struct _mxcsr { + unsigned + excp: 6, /* exception sticky bits */ + daz: 1, /* denormals are zeroes */ + mask: 6, /* exception masks */ + rnd: 2, /* rounding control */ + fzero: 1; /* flush to zero */ +}; + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _IEEEFP_H */ diff --git a/usr/src/head/inttypes.h b/usr/src/head/inttypes.h new file mode 100644 index 0000000000..4be889c3d2 --- /dev/null +++ b/usr/src/head/inttypes.h @@ -0,0 +1,134 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _INTTYPES_H +#define _INTTYPES_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * This file, <inttypes.h>, is specified by the ISO C standard, + * standard, ISO/IEC 9899:1999 Programming language - C and is + * also defined by SUSv3. + * + * ISO International Organization for Standardization. + * SUSv3 Single Unix Specification, Version 3 + */ + +#include <sys/feature_tests.h> +#include <sys/inttypes.h> + +#if (!defined(_XOPEN_SOURCE) || defined(_XPG6)) || defined(_STDC_C99) || \ + defined(__EXTENSIONS__) +#include <sys/stdint.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Inclusion of <stddef.h> breaks namespace, therefore define wchar_t */ + +/* + * wchar_t is a built-in type in standard C++ and as such is not + * defined here when using standard C++. However, the GNU compiler + * fixincludes utility nonetheless creates it's own version of this + * header for use by gcc and g++. In that version it adds a redundant + * guard for __cplusplus. To avoid the creation of a gcc/g++ specific + * header we need to include the following magic comment: + * + * we must use the C++ compiler's type + * + * The above comment should not be removed or changed until GNU + * gcc/fixinc/inclhack.def is updated to bypass this header. + */ +#if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__)) +#ifndef _WCHAR_T +#define _WCHAR_T +#if defined(_LP64) +typedef int wchar_t; +#else +typedef long wchar_t; +#endif +#endif /* !_WCHAR_T */ +#endif /* !__cplusplus || (__cplusplus < 199711L && !__GNUG__) */ + +#if (!defined(_XOPEN_SOURCE) || defined(_XPG6)) || defined(_STDC_C99) || \ + defined(__EXTENSIONS__) +typedef struct { + intmax_t quot; + intmax_t rem; +} imaxdiv_t; +#endif /* (!defined(_XOPEN_SOURCE) || defined(_XPG6)) ... */ + +#if !defined(_LP64) && !defined(_LONGLONG_TYPE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname imaxabs _imaxabs_c89 +#pragma redefine_extname imaxdiv _imaxdiv_c89 +#pragma redefine_extname strtoimax _strtoimax_c89 +#pragma redefine_extname strtoumax _strtoumax_c89 +#pragma redefine_extname wcstoimax _wcstoimax_c89 +#pragma redefine_extname wcstoumax _wcstoumax_c89 +#else +#define imaxabs _imaxabs_c89 +#define imaxdiv _imaxdiv_c89 +#define strtoimax _strtoimax_c89 +#define strtoumax _strtoumax_c89 +#define wcstoimax _wcstoimax_c89 +#define wcstoumax _wcstoumax_c89 +#endif +#endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */ + +#if (!defined(_XOPEN_SOURCE) || defined(_XPG6)) || defined(_STDC_C99) || \ + defined(__EXTENSIONS__) + +#ifdef __STDC__ +extern intmax_t imaxabs(intmax_t); +extern imaxdiv_t imaxdiv(intmax_t, intmax_t); +extern intmax_t strtoimax(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD, + int); +extern uintmax_t strtoumax(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD, + int); +extern intmax_t wcstoimax(const wchar_t *_RESTRICT_KYWD, + wchar_t **_RESTRICT_KYWD, int); +extern uintmax_t wcstoumax(const wchar_t *_RESTRICT_KYWD, + wchar_t **_RESTRICT_KYWD, int); +#else +extern intmax_t imaxabs(); +extern imaxdiv_t imaxdiv(); +extern intmax_t strtoimax(); +extern uintmax_t strtoumax(); +extern intmax_t wcstoimax(); +extern uintmax_t wcstoumax(); +#endif + +#endif /* (!defined(_XOPEN_SOURCE) || defined(_XPG6)) ... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _INTTYPES_H */ diff --git a/usr/src/head/iso/ctype_c99.h b/usr/src/head/iso/ctype_c99.h new file mode 100644 index 0000000000..f6edbc2b8c --- /dev/null +++ b/usr/src/head/iso/ctype_c99.h @@ -0,0 +1,86 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of <ctype.h>. + * + * The contents of this header is limited to identifiers specified in + * the C99 standard and in conflict with the C++ implementation of the + * standard header. The C++ standard may adopt the C99 standard at + * which point it is expected that the symbols included here will + * become part of the C++ std namespace. + */ + +#ifndef _ISO_CTYPE_C99_H +#define _ISO_CTYPE_C99_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The following have been added as a result of the ISO/IEC 9899:1999 + * standard. For a strictly conforming C application, visibility is + * contingent on the value of __STDC_VERSION__ (see sys/feature_tests.h). + * For non-strictly conforming C applications, there are no restrictions + * on the C namespace. + */ + +#if defined(__STDC__) + +#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_XPG6) || defined(_STDC_C99) || defined(__EXTENSIONS__) +extern int isblank(int); +#endif + +#if !defined(__lint) + +#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_XPG6) || defined(_STDC_C99) || \ + defined(__XPG4_CHAR_CLASS__) || defined(__EXTENSIONS__) +#define isblank(c) (__ctype_mask[(int)(c)] & _ISBLANK) +#endif + +#endif /* !defined(__lint) */ + +#else /* defined(__STDC__) */ + +#if !defined(__lint) + +#define isblank(c) ((_ctype + 1)[(int)(c)] & _B) + +#endif /* !defined(__lint) */ + +#endif /* defined(__STDC__) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_CTYPE_C99_H */ diff --git a/usr/src/head/iso/ctype_iso.h b/usr/src/head/iso/ctype_iso.h new file mode 100644 index 0000000000..31aa478288 --- /dev/null +++ b/usr/src/head/iso/ctype_iso.h @@ -0,0 +1,205 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <ctype.h>. + */ + +#ifndef _ISO_CTYPE_ISO_H +#define _ISO_CTYPE_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define _U 0x00000001 /* Upper case */ +#define _L 0x00000002 /* Lower case */ +#define _N 0x00000004 /* Numeral (digit) */ +#define _S 0x00000008 /* Spacing character */ +#define _P 0x00000010 /* Punctuation */ +#define _C 0x00000020 /* Control character */ +#define _B 0x00000040 /* Blank */ +#define _X 0x00000080 /* heXadecimal digit */ + +#define _ISUPPER _U +#define _ISLOWER _L +#define _ISDIGIT _N +#define _ISSPACE _S +#define _ISPUNCT _P +#define _ISCNTRL _C +#define _ISBLANK _B +#define _ISXDIGIT _X +#define _ISGRAPH 0x00002000 +#define _ISALPHA 0x00004000 +#define _ISPRINT 0x00008000 +#define _ISALNUM (_ISALPHA | _ISDIGIT) + + +#if defined(__STDC__) + +#if __cplusplus < 199711L /* Use inline functions instead for ANSI C++ */ + +extern int isalnum(int); +extern int isalpha(int); +extern int iscntrl(int); +extern int isdigit(int); +extern int isgraph(int); +extern int islower(int); +extern int isprint(int); +extern int ispunct(int); +extern int isspace(int); +extern int isupper(int); +extern int isxdigit(int); + +#endif /* __cplusplus < 199711L */ + +#if __cplusplus >= 199711L +namespace std { +#endif + +extern int tolower(int); +extern int toupper(int); + +#if __cplusplus >= 199711L +} /* end of namespace std */ +#endif + +extern unsigned char __ctype[]; +extern unsigned int *__ctype_mask; +extern int *__trans_upper; +extern int *__trans_lower; + +#if !defined(__lint) + +#if __cplusplus >= 199711L +namespace std { + +#if defined(__XPG4_CHAR_CLASS__) || defined(_XPG4) + +inline int isalpha(int c) { return (__ctype_mask[c] & _ISALPHA); } +inline int isupper(int c) { return (__ctype_mask[c] & _ISUPPER); } +inline int islower(int c) { return (__ctype_mask[c] & _ISLOWER); } +inline int isdigit(int c) { return (__ctype_mask[c] & _ISDIGIT); } +inline int isxdigit(int c) { return (__ctype_mask[c] & _ISXDIGIT); } +inline int isalnum(int c) { return (__ctype_mask[c] & _ISALNUM); } +inline int isspace(int c) { return (__ctype_mask[c] & _ISSPACE); } +inline int ispunct(int c) { return (__ctype_mask[c] & _ISPUNCT); } +inline int isprint(int c) { return (__ctype_mask[c] & _ISPRINT); } +inline int isgraph(int c) { return (__ctype_mask[c] & _ISGRAPH); } +inline int iscntrl(int c) { return (__ctype_mask[c] & _ISCNTRL); } +#else +inline int isalpha(int c) { return ((__ctype + 1)[c] & (_U | _L)); } +inline int isupper(int c) { return ((__ctype + 1)[c] & _U); } +inline int islower(int c) { return ((__ctype + 1)[c] & _L); } +inline int isdigit(int c) { return ((__ctype + 1)[c] & _N); } +inline int isxdigit(int c) { return ((__ctype + 1)[c] & _X); } +inline int isalnum(int c) { return ((__ctype + 1)[c] & (_U | _L | _N)); } +inline int isspace(int c) { return ((__ctype + 1)[c] & _S); } +inline int ispunct(int c) { return ((__ctype + 1)[c] & _P); } +inline int isprint(int c) { + return ((__ctype + 1)[c] & (_P | _U | _L | _N | _B)); } +inline int isgraph(int c) { return ((__ctype + 1)[c] & (_P | _U | _L | _N)); } +inline int iscntrl(int c) { return ((__ctype + 1)[c] & _C); } +#endif /* defined(__XPG4_CHAR_CLASS__) || defined(_XPG4) */ + +} /* end of namespace std */ + +#else /* __cplusplus >= 199711L */ + +#if defined(__XPG4_CHAR_CLASS__) || defined(_XPG4) +#define isalpha(c) (__ctype_mask[(int)(c)] & _ISALPHA) +#define isupper(c) (__ctype_mask[(int)(c)] & _ISUPPER) +#define islower(c) (__ctype_mask[(int)(c)] & _ISLOWER) +#define isdigit(c) (__ctype_mask[(int)(c)] & _ISDIGIT) +#define isxdigit(c) (__ctype_mask[(int)(c)] & _ISXDIGIT) +#define isalnum(c) (__ctype_mask[(int)(c)] & _ISALNUM) +#define isspace(c) (__ctype_mask[(int)(c)] & _ISSPACE) +#define ispunct(c) (__ctype_mask[(int)(c)] & _ISPUNCT) +#define isprint(c) (__ctype_mask[(int)(c)] & _ISPRINT) +#define isgraph(c) (__ctype_mask[(int)(c)] & _ISGRAPH) +#define iscntrl(c) (__ctype_mask[(int)(c)] & _ISCNTRL) +#else +#define isalpha(c) ((__ctype + 1)[(int)(c)] & (_U | _L)) +#define isupper(c) ((__ctype + 1)[(int)(c)] & _U) +#define islower(c) ((__ctype + 1)[(int)(c)] & _L) +#define isdigit(c) ((__ctype + 1)[(int)(c)] & _N) +#define isxdigit(c) ((__ctype + 1)[(int)(c)] & _X) +#define isalnum(c) ((__ctype + 1)[(int)(c)] & (_U | _L | _N)) +#define isspace(c) ((__ctype + 1)[(int)(c)] & _S) +#define ispunct(c) ((__ctype + 1)[(int)(c)] & _P) +#define isprint(c) ((__ctype + 1)[(int)(c)] & (_P | _U | _L | _N | _B)) +#define isgraph(c) ((__ctype + 1)[(int)(c)] & (_P | _U | _L | _N)) +#define iscntrl(c) ((__ctype + 1)[(int)(c)] & _C) + +#endif /* defined(__XPG4_CHAR_CLASS__) || defined(_XPG4) */ + +#endif /* __cplusplus >= 199711L */ + +#endif /* !defined(__lint) */ + +#else /* defined(__STDC__) */ + +extern unsigned char _ctype[]; + +#if !defined(__lint) + +#define isalpha(c) ((_ctype + 1)[(int)(c)] & (_U | _L)) +#define isupper(c) ((_ctype + 1)[(int)(c)] & _U) +#define islower(c) ((_ctype + 1)[(int)(c)] & _L) +#define isdigit(c) ((_ctype + 1)[(int)(c)] & _N) +#define isxdigit(c) ((_ctype + 1)[(int)(c)] & _X) +#define isalnum(c) ((_ctype + 1)[(int)(c)] & (_U | _L | _N)) +#define isspace(c) ((_ctype + 1)[(int)(c)] & _S) +#define ispunct(c) ((_ctype + 1)[(int)(c)] & _P) +#define isprint(c) ((_ctype + 1)[(int)(c)] & (_P | _U | _L | _N | _B)) +#define isgraph(c) ((_ctype + 1)[(int)(c)] & (_P | _U | _L | _N)) +#define iscntrl(c) ((_ctype + 1)[(int)(c)] & _C) + +#endif /* !defined(__lint) */ + +#endif /* defined(__STDC__) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_CTYPE_ISO_H */ diff --git a/usr/src/head/iso/limits_iso.h b/usr/src/head/iso/limits_iso.h new file mode 100644 index 0000000000..4d979cab1f --- /dev/null +++ b/usr/src/head/iso/limits_iso.h @@ -0,0 +1,104 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <limits.h>. + */ + +#ifndef _ISO_LIMITS_ISO_H +#define _ISO_LIMITS_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.34 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Sizes of integral types + */ +#define CHAR_BIT 8 /* max # of bits in a "char" */ +#define SCHAR_MIN (-128) /* min value of a "signed char" */ +#define SCHAR_MAX 127 /* max value of a "signed char" */ +#define UCHAR_MAX 255 /* max value of an "unsigned char" */ + +#define MB_LEN_MAX 5 + +#if defined(_CHAR_IS_SIGNED) +#define CHAR_MIN SCHAR_MIN /* min value of a "char" */ +#define CHAR_MAX SCHAR_MAX /* max value of a "char" */ +#elif defined(_CHAR_IS_UNSIGNED) +#define CHAR_MIN 0 /* min value of a "char" */ +#define CHAR_MAX UCHAR_MAX /* max value of a "char" */ +#else +#error "chars are signed or unsigned" +#endif + +#define SHRT_MIN (-32768) /* min value of a "short int" */ +#define SHRT_MAX 32767 /* max value of a "short int" */ +#define USHRT_MAX 65535 /* max value of "unsigned short int" */ +#define INT_MIN (-2147483647-1) /* min value of an "int" */ +#define INT_MAX 2147483647 /* max value of an "int" */ +#define UINT_MAX 4294967295U /* max value of an "unsigned int" */ +#if defined(_LP64) +#define LONG_MIN (-9223372036854775807L-1L) + /* min value of a "long int" */ +#define LONG_MAX 9223372036854775807L + /* max value of a "long int" */ +#define ULONG_MAX 18446744073709551615UL + /* max value of "unsigned long int" */ +#else /* _ILP32 */ +#define LONG_MIN (-2147483647L-1L) + /* min value of a "long int" */ +#define LONG_MAX 2147483647L /* max value of a "long int" */ +#define ULONG_MAX 4294967295UL /* max value of "unsigned long int" */ +#endif +#if !defined(_STRICT_STDC) || defined(_STDC_C99) || defined(__EXTENSIONS__) +#define LLONG_MIN (-9223372036854775807LL-1LL) + /* min value of a long long */ +#define LLONG_MAX 9223372036854775807LL + /* max value of a long long */ +#define ULLONG_MAX 18446744073709551615ULL + /* max value of "unsigned long long */ +#endif /* !defined(_STRICT_STDC) || defined(_STDC_C99)... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_LIMITS_ISO_H */ diff --git a/usr/src/head/iso/locale_iso.h b/usr/src/head/iso/locale_iso.h new file mode 100644 index 0000000000..36a3d083f1 --- /dev/null +++ b/usr/src/head/iso/locale_iso.h @@ -0,0 +1,126 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <locale.h>. + */ + +#ifndef _ISO_LOCALE_ISO_H +#define _ISO_LOCALE_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if __cplusplus >= 199711L +namespace std { +#endif + +struct lconv { + char *decimal_point; + char *thousands_sep; + char *grouping; + char *int_curr_symbol; + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + +/* + * New in IEEE Std 1003.1-2001 for alignment with the ISO/IEC 9899:1999 + * standard. Namespace and binary compatibility dictate that visibility + * of these new members be limited. Visibility is limited to a strictly + * conforming ANSI C environment (-Xc) or if _LCONV_C99 is defined. + */ +#if (defined(_STRICT_STDC) && defined(_STDC_C99)) || defined(_LCONV_C99) + char int_p_cs_precedes; + char int_p_sep_by_space; + char int_n_cs_precedes; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; +#endif +}; + +#define LC_CTYPE 0 +#define LC_NUMERIC 1 +#define LC_TIME 2 +#define LC_COLLATE 3 +#define LC_MONETARY 4 +#define LC_MESSAGES 5 +#define LC_ALL 6 + +#ifndef NULL +#if defined(_LP64) +#define NULL 0L +#else +#define NULL 0 +#endif +#endif + +#if defined(__STDC__) +extern char *setlocale(int, const char *); +extern struct lconv *localeconv(void); +#else +extern char *setlocale(); +extern struct lconv *localeconv(); +#endif + +#if __cplusplus >= 199711L +} +#endif /* end of namespace std */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_LOCALE_ISO_H */ diff --git a/usr/src/head/iso/setjmp_iso.h b/usr/src/head/iso/setjmp_iso.h new file mode 100644 index 0000000000..5edbdf4ecf --- /dev/null +++ b/usr/src/head/iso/setjmp_iso.h @@ -0,0 +1,131 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <setjmp.h>. + */ + +#ifndef _ISO_SETJMP_ISO_H +#define _ISO_SETJMP_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" +/* SVr4.0 1.9.2.9 */ + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _JBLEN + +/* + * The sizes of the jump-buffer (_JBLEN) and the sigjump-buffer + * (_SIGJBLEN) are defined by the appropriate, processor specific, + * ABI. + */ +#if defined(__amd64) +#define _JBLEN 8 /* ABI value */ +#define _SIGJBLEN 128 /* ABI value */ +#elif defined(__i386) +#define _JBLEN 10 /* ABI value */ +#define _SIGJBLEN 128 /* ABI value */ +#elif defined(__sparcv9) +#define _JBLEN 12 /* ABI value */ +#define _SIGJBLEN 19 /* ABI value */ +#elif defined(__sparc) +#define _JBLEN 12 /* ABI value */ +#define _SIGJBLEN 19 /* ABI value */ +#else +#error "ISA not supported" +#endif + +#if __cplusplus >= 199711L +namespace std { +#endif + +#if defined(__i386) || defined(__amd64) || \ + defined(__sparc) || defined(__sparcv9) +#if defined(_LP64) || defined(_I32LPx) +typedef long jmp_buf[_JBLEN]; +#else +typedef int jmp_buf[_JBLEN]; +#endif +#else +#error "ISA not supported" +#endif + +#if defined(__STDC__) + +extern int setjmp(jmp_buf); +#pragma unknown_control_flow(setjmp) +extern int _setjmp(jmp_buf); +#pragma unknown_control_flow(_setjmp) +extern void longjmp(jmp_buf, int) __NORETURN; +extern void _longjmp(jmp_buf, int) __NORETURN; + +#else + +extern int setjmp(); +#pragma unknown_control_flow(setjmp) +extern int _setjmp(); +#pragma unknown_control_flow(_setjmp) +extern void longjmp(); +extern void _longjmp(); + +#endif /* __STDC__ */ + +#if __cplusplus >= 199711L +} +#endif /* end of namespace std */ + +#if __cplusplus >= 199711L +using std::setjmp; +#endif + +#if defined(_STRICT_STDC) || __cplusplus >= 199711L +#define setjmp(env) setjmp(env) +#endif + +#endif /* _JBLEN */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_SETJMP_ISO_H */ diff --git a/usr/src/head/iso/signal_iso.h b/usr/src/head/iso/signal_iso.h new file mode 100644 index 0000000000..592da4585b --- /dev/null +++ b/usr/src/head/iso/signal_iso.h @@ -0,0 +1,85 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1998-1999, by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <signal.h>. + */ + +#ifndef _ISO_SIGNAL_ISO_H +#define _ISO_SIGNAL_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" +/* SVr4.0 1.5.3.4 */ + +#include <sys/iso/signal_iso.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if __cplusplus >= 199711L +namespace std { +#endif + +typedef int sig_atomic_t; + +#if defined(__STDC__) + +#ifdef __cplusplus +extern "C" SIG_PF signal(int, SIG_PF); +#else +extern void (*signal(int, void (*)(int)))(int); +#endif +extern int raise(int); + +#else /* __STDC__ */ + +extern void(*signal())(); +extern int raise(); + +#endif /* __STDC__ */ + +#if __cplusplus >= 199711L +} +#endif /* end of namespace std */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_SIGNAL_ISO_H */ diff --git a/usr/src/head/iso/stdarg_c99.h b/usr/src/head/iso/stdarg_c99.h new file mode 100644 index 0000000000..628f555b4e --- /dev/null +++ b/usr/src/head/iso/stdarg_c99.h @@ -0,0 +1,75 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _ISO_STDARG_C99_H +#define _ISO_STDARG_C99_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * This header defines the va_copy variable argument macro, which is + * new in ISO C 1999, and thus not present in ISO C 1989 and ISO C++ + * 1998. Because this macro is a long-standing Solaris extension, it + * is also permitted in other contexts. + * + * The varargs definitions within this header are defined in terms of + * implementation definitions. These implementation definitions reside + * in <sys/va_list.h>. This organization enables protected use of + * the implementation by other standard headers without introducing + * names into the users' namespace. + */ + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * va_copy was initially a Solaris extension to provide a portable + * way to perform a variable argument list ``bookmarking'' function. + * It is now specified in the ISO/IEC 9899:1999 standard. + */ +#if defined(__EXTENSIONS__) || defined(_STDC_C99) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_XPG6) + +#define va_copy(to, from) __va_copy(to, from) + +#endif /* defined(__EXTENSIONS__) || defined(_STDC_C99)... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_STDARG_C99_H */ diff --git a/usr/src/head/iso/stdarg_iso.h b/usr/src/head/iso/stdarg_iso.h new file mode 100644 index 0000000000..abc0fed4ac --- /dev/null +++ b/usr/src/head/iso/stdarg_iso.h @@ -0,0 +1,82 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <stdarg.h>. + */ + +#ifndef _ISO_STDARG_ISO_H +#define _ISO_STDARG_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */ + +/* + * This header defines the ISO C 1989 and ISO C++ 1998 variable + * argument definitions. + * + * The varargs definitions within this header are defined in terms of + * implementation definitions. These implementation definitions reside + * in <sys/va_impl.h>. This organization enables protected use of + * the implementation by other standard headers without introducing + * names into the users' namespace. + */ + +#include <sys/va_impl.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if __cplusplus >= 199711L +namespace std { +typedef __va_list va_list; +} +#elif !defined(_VA_LIST) +#define _VA_LIST +typedef __va_list va_list; +#endif + +#define va_start(list, name) __va_start(list, name) +#define va_arg(list, type) __va_arg(list, type) +#define va_end(list) __va_end(list) + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_STDARG_ISO_H */ diff --git a/usr/src/head/iso/stddef_iso.h b/usr/src/head/iso/stddef_iso.h new file mode 100644 index 0000000000..48a7ed6875 --- /dev/null +++ b/usr/src/head/iso/stddef_iso.h @@ -0,0 +1,98 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <stddef.h.h>. + */ + +#ifndef _ISO_STDDEF_ISO_H +#define _ISO_STDDEF_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */ + +#include <sys/isa_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if __cplusplus >= 199711L +namespace std { +#endif + +#ifndef NULL +#if defined(_LP64) +#define NULL 0L +#else +#define NULL 0 +#endif +#endif + +#if !defined(_PTRDIFF_T) || __cplusplus >= 199711L +#define _PTRDIFF_T +#if defined(_LP64) || defined(_I32LPx) +typedef long ptrdiff_t; /* pointer difference */ +#else +typedef int ptrdiff_t; /* (historical version) */ +#endif +#endif /* !_PTRDIFF_T */ + +#if !defined(_SIZE_T) || __cplusplus >= 199711L +#define _SIZE_T +#if defined(_LP64) || defined(_I32LPx) +typedef unsigned long size_t; /* size of something in bytes */ +#else +typedef unsigned int size_t; /* (historical version) */ +#endif +#endif /* !_SIZE_T */ + +#if __cplusplus >= 199711L +} +#endif /* end of namespace std */ + +#if __cplusplus >= 199711L +#define offsetof(s, m) (std::size_t)(&(((s *)0)->m)) +#else +#define offsetof(s, m) (size_t)(&(((s *)0)->m)) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_STDDEF_ISO_H */ diff --git a/usr/src/head/iso/stdio_c99.h b/usr/src/head/iso/stdio_c99.h new file mode 100644 index 0000000000..59a6dda327 --- /dev/null +++ b/usr/src/head/iso/stdio_c99.h @@ -0,0 +1,104 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in + * the C99 standard and in conflict with the C++ implementation of the + * standard header. The C++ standard may adopt the C99 standard at + * which point it is expected that the symbols included here will + * become part of the C++ std namespace. + */ + +#ifndef _ISO_STDIO_C99_H +#define _ISO_STDIO_C99_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The following have been added as a result of the ISO/IEC 9899:1999 + * standard. For a strictly conforming C application, visibility is + * contingent on the value of __STDC_VERSION__ (see sys/feature_tests.h). + * For non-strictly conforming C applications, there are no restrictions + * on the C namespace. + */ + +#if defined(__EXTENSIONS__) || defined(_STDC_C99) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) + +#if !defined(_LP64) && !defined(_LONGLONG_TYPE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname snprintf _snprintf_c89 +#pragma redefine_extname vsnprintf _vsnprintf_c89 +#pragma redefine_extname vfscanf _vfscanf_c89 +#pragma redefine_extname vscanf _vscanf_c89 +#pragma redefine_extname vsscanf _vsscanf_c89 +#else +#define snprintf _snprintf_c89 +#define vsnprintf _vsnprintf_c89 +#define vfscanf _vfscanf_c89 +#define vscanf _vscanf_c89 +#define vsscanf _vsscanf_c89 +#endif +#endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */ + +#ifdef __STDC__ +extern int vfscanf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, __va_list); +extern int vscanf(const char *_RESTRICT_KYWD, __va_list); +extern int vsscanf(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, + __va_list); +#else +extern int vfscanf(); +extern int vscanf(); +extern int vsscanf(); +#endif /* __STDC__ */ +#endif /* defined(__EXTENSIONS__) ... */ +#if defined(__EXTENSIONS__) || defined(_STDC_C99) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_XPG5) +#ifdef __STDC__ +extern int snprintf(char *_RESTRICT_KYWD, size_t, const char *_RESTRICT_KYWD, + ...); +extern int vsnprintf(char *_RESTRICT_KYWD, size_t, const char *_RESTRICT_KYWD, + __va_list); +#else +extern int snprintf(); +extern int vsnprintf(); +#endif /* __STDC__ */ + +#endif /* defined(__EXTENSIONS__) || defined(_STDC_C99) ... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_STDIO_C99_H */ diff --git a/usr/src/head/iso/stdio_iso.h b/usr/src/head/iso/stdio_iso.h new file mode 100644 index 0000000000..0ab2ff0927 --- /dev/null +++ b/usr/src/head/iso/stdio_iso.h @@ -0,0 +1,391 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <stdio.h>. + */ + +/* + * User-visible pieces of the ANSI C standard I/O package. + */ + +#ifndef _ISO_STDIO_ISO_H +#define _ISO_STDIO_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/va_list.h> +#include <stdio_tag.h> +#include <stdio_impl.h> + +/* + * If feature test macros are set that enable interfaces that use types + * defined in <sys/types.h>, get those types by doing the include. + * + * Note that in asking for the interfaces associated with this feature test + * macro one also asks for definitions of the POSIX types. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_LP64) && (_FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE)) +/* + * The following typedefs are adopted from ones in <sys/types.h> (with leading + * underscores added to avoid polluting the ANSI C name space). See the + * commentary there for further explanation. + */ +#if defined(_LONGLONG_TYPE) +typedef long long __longlong_t; +#else +/* used to reserve space and generate alignment */ +typedef union { + double _d; + int _l[2]; +} __longlong_t; +#endif +#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE) */ + +#if __cplusplus >= 199711L +namespace std { +#endif + +#if !defined(_FILEDEFED) || __cplusplus >= 199711L +#define _FILEDEFED +typedef __FILE FILE; +#endif + +#if !defined(_SIZE_T) || __cplusplus >= 199711L +#define _SIZE_T +#if defined(_LP64) || defined(_I32LPx) +typedef unsigned long size_t; /* size of something in bytes */ +#else +typedef unsigned int size_t; /* (historical version) */ +#endif +#endif /* !_SIZE_T */ + +#if defined(_LP64) || _FILE_OFFSET_BITS == 32 +typedef long fpos_t; +#else +typedef __longlong_t fpos_t; +#endif + +#if __cplusplus >= 199711L +} +#endif /* end of namespace std */ + +#ifndef NULL +#if defined(_LP64) +#define NULL 0L +#else +#define NULL 0 +#endif +#endif + +#define BUFSIZ 1024 + +/* + * The value of _NFILE is defined in the Processor Specific ABI. The value + * is chosen for historical reasons rather than for truly processor related + * attribute. Note that the SPARC Processor Specific ABI uses the common + * UNIX historical value of 20 so it is allowed to fall through. + */ +#if defined(__i386) +#define _NFILE 60 /* initial number of streams: Intel x86 ABI */ +#else +#define _NFILE 20 /* initial number of streams: SPARC ABI and default */ +#endif + +#define _SBFSIZ 8 /* compatibility with shared libs */ + +#define _IOFBF 0000 /* full buffered */ +#define _IOLBF 0100 /* line buffered */ +#define _IONBF 0004 /* not buffered */ +#define _IOEOF 0020 /* EOF reached on read */ +#define _IOERR 0040 /* I/O error from system */ + +#define _IOREAD 0001 /* currently reading */ +#define _IOWRT 0002 /* currently writing */ +#define _IORW 0200 /* opened for reading and writing */ +#define _IOMYBUF 0010 /* stdio malloc()'d buffer */ + +#ifndef EOF +#define EOF (-1) +#endif + +#define FOPEN_MAX _NFILE +#define FILENAME_MAX 1024 /* max # of characters in a path name */ + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 +#define TMP_MAX 17576 /* 26 * 26 * 26 */ + +#define L_tmpnam 25 /* (sizeof(P_tmpdir) + 15) */ + +#if defined(__STDC__) +extern __FILE __iob[_NFILE]; +#define stdin (&__iob[0]) +#define stdout (&__iob[1]) +#define stderr (&__iob[2]) +#else +extern __FILE _iob[_NFILE]; +#define stdin (&_iob[0]) +#define stdout (&_iob[1]) +#define stderr (&_iob[2]) +#endif /* __STDC__ */ + +#if __cplusplus >= 199711L +namespace std { +#endif + +#if !defined(_LP64) && !defined(_LONGLONG_TYPE) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname fprintf _fprintf_c89 +#pragma redefine_extname printf _printf_c89 +#pragma redefine_extname sprintf _sprintf_c89 +#pragma redefine_extname vfprintf _vfprintf_c89 +#pragma redefine_extname vprintf _vprintf_c89 +#pragma redefine_extname vsprintf _vsprintf_c89 +#pragma redefine_extname fscanf _fscanf_c89 +#pragma redefine_extname scanf _scanf_c89 +#pragma redefine_extname sscanf _sscanf_c89 +#else +#define fprintf _fprintf_c89 +#define printf _printf_c89 +#define sprintf _sprintf_c89 +#define vfprintf _vfprintf_c89 +#define vprintf _vprintf_c89 +#define vsprintf _vsprintf_c89 +#define fscanf _fscanf_c89 +#define scanf _scanf_c89 +#define sscanf _sscanf_c89 +#endif + +#endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */ + +#if defined(__STDC__) + +extern int remove(const char *); +extern int rename(const char *, const char *); +extern FILE *tmpfile(void); +extern char *tmpnam(char *); +extern int fclose(FILE *); +extern int fflush(FILE *); +extern FILE *fopen(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD); +extern FILE *freopen(const char *_RESTRICT_KYWD, + const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD); +extern void setbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD); +extern int setvbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD, int, + size_t); +/* PRINTFLIKE2 */ +extern int fprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...); +/* SCANFLIKE2 */ +extern int fscanf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...); +/* PRINTFLIKE1 */ +extern int printf(const char *_RESTRICT_KYWD, ...); +/* SCANFLIKE1 */ +extern int scanf(const char *_RESTRICT_KYWD, ...); +/* PRINTFLIKE2 */ +extern int sprintf(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...); +/* SCANFLIKE2 */ +extern int sscanf(const char *_RESTRICT_KYWD, + const char *_RESTRICT_KYWD, ...); +extern int vfprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, + __va_list); +extern int vprintf(const char *_RESTRICT_KYWD, __va_list); +extern int vsprintf(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, + __va_list); +extern int fgetc(FILE *); +extern char *fgets(char *_RESTRICT_KYWD, int, FILE *_RESTRICT_KYWD); +extern int fputc(int, FILE *); +extern int fputs(const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD); +#if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \ + __cplusplus < 199711L +extern int getc(FILE *); +extern int putc(int, FILE *); +#endif +#if (__cplusplus >= 199711L && defined(_REENTRANT)) || \ + __cplusplus < 199711L +extern int getchar(void); +extern int putchar(int); +#endif +extern char *gets(char *); +extern int puts(const char *); +extern int ungetc(int, FILE *); +extern size_t fread(void *_RESTRICT_KYWD, size_t, size_t, + FILE *_RESTRICT_KYWD); +extern size_t fwrite(const void *_RESTRICT_KYWD, size_t, size_t, + FILE *_RESTRICT_KYWD); +#if !defined(__lint) || defined(_LP64) || _FILE_OFFSET_BITS == 32 +extern int fgetpos(FILE *_RESTRICT_KYWD, fpos_t *_RESTRICT_KYWD); +extern int fsetpos(FILE *, const fpos_t *); +#endif +extern int fseek(FILE *, long, int); +extern long ftell(FILE *); +extern void rewind(FILE *); +#if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \ + __cplusplus < 199711L +extern void clearerr(FILE *); +extern int feof(FILE *); +extern int ferror(FILE *); +#endif +extern void perror(const char *); + +#ifndef _LP64 +extern int __filbuf(FILE *); +extern int __flsbuf(int, FILE *); +#endif /* _LP64 */ + +#else /* !defined __STDC__ */ + +extern int remove(); +extern int rename(); +extern FILE *tmpfile(); +extern char *tmpnam(); +extern int fclose(); +extern int fflush(); +extern FILE *fopen(); +extern FILE *freopen(); +extern void setbuf(); +extern int setvbuf(); +extern int fprintf(); +extern int fscanf(); +extern int printf(); +extern int scanf(); +extern int sprintf(); +extern int sscanf(); +extern int vfprintf(); +extern int vprintf(); +extern int vsprintf(); +extern int fgetc(); +extern char *fgets(); +extern int fputc(); +extern int fputs(); +extern int getc(); +extern int getchar(); +extern char *gets(); +extern int putc(); +extern int putchar(); +extern int puts(); +extern int ungetc(); +extern size_t fread(); +extern size_t fwrite(); +extern int fgetpos(); +extern int fseek(); +extern int fsetpos(); +extern long ftell(); +extern void rewind(); +extern void clearerr(); +extern int feof(); +extern int ferror(); +extern void perror(); + +#ifndef _LP64 +extern int _filbuf(); +extern int _flsbuf(); +#endif /* _LP64 */ + +#endif /* __STDC__ */ + +#if __cplusplus >= 199711L +} +#endif /* end of namespace std */ + +#if !defined(__lint) + +#ifndef _REENTRANT + +#ifndef _LP64 +#ifdef __STDC__ +#if __cplusplus >= 199711L +namespace std { +inline int getc(FILE *_p) { + return (--_p->_cnt < 0 ? __filbuf(_p) : (int)*_p->_ptr++); } +inline int putc(int _x, FILE *_p) { + return (--_p->_cnt < 0 ? __flsbuf(_x, _p) + : (int)(*_p->_ptr++ = (unsigned char) _x)); } +} +#else /* __cplusplus >= 199711L */ +#define getc(p) (--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++) +#define putc(x, p) (--(p)->_cnt < 0 ? __flsbuf((x), (p)) \ + : (int)(*(p)->_ptr++ = (unsigned char) (x))) +#endif /* __cplusplus >= 199711L */ +#else /* __STDC__ */ +#define getc(p) (--(p)->_cnt < 0 ? _filbuf(p) : (int)*(p)->_ptr++) +#define putc(x, p) (--(p)->_cnt < 0 ? _flsbuf((x), (p)) : \ + (int)(*(p)->_ptr++ = (unsigned char) (x))) +#endif /* __STDC__ */ +#endif /* _LP64 */ + +#if __cplusplus >= 199711L +namespace std { +inline int getchar() { return getc(stdin); } +inline int putchar(int _x) { return putc(_x, stdout); } +} +#else +#define getchar() getc(stdin) +#define putchar(x) putc((x), stdout) +#endif /* __cplusplus >= 199711L */ + +#ifndef _LP64 +#if __cplusplus >= 199711L +namespace std { +inline void clearerr(FILE *_p) { _p->_flag &= ~(_IOERR | _IOEOF); } +inline int feof(FILE *_p) { return _p->_flag & _IOEOF; } +inline int ferror(FILE *_p) { return _p->_flag & _IOERR; } +} +#else /* __cplusplus >= 199711L */ +#define clearerr(p) ((void)((p)->_flag &= ~(_IOERR | _IOEOF))) +#define feof(p) ((p)->_flag & _IOEOF) +#define ferror(p) ((p)->_flag & _IOERR) +#endif /* __cplusplus >= 199711L */ +#endif /* _LP64 */ + +#endif /* _REENTRANT */ + +#endif /* !defined(__lint) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_STDIO_ISO_H */ diff --git a/usr/src/head/iso/stdlib_c99.h b/usr/src/head/iso/stdlib_c99.h new file mode 100644 index 0000000000..7877c21e38 --- /dev/null +++ b/usr/src/head/iso/stdlib_c99.h @@ -0,0 +1,107 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in + * the C99 standard and in conflict with the C++ implementation of the + * standard header. The C++ standard may adopt the C99 standard at + * which point it is expected that the symbols included here will + * become part of the C++ std namespace. + */ + +#ifndef _ISO_STDLIB_C99_H +#define _ISO_STDLIB_C99_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The following have been added as a result of the ISO/IEC 9899:1999 + * standard. For a strictly conforming C application, visibility is + * contingent on the value of __STDC_VERSION__ (see sys/feature_tests.h). + * For non-strictly conforming C applications, there are no restrictions + * on the C namespace. + */ + +#if defined(_LONGLONG_TYPE) +typedef struct { + long long quot; + long long rem; +} lldiv_t; +#endif /* defined(_LONGLONG_TYPE) */ + +#ifdef __STDC__ + +#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_STDC_C99) || defined(__EXTENSIONS__) + +extern void _Exit(int); +extern float strtof(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD); +extern long double strtold(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD); + +#if defined(_LONGLONG_TYPE) +extern long long atoll(const char *); +extern long long llabs(long long); +extern lldiv_t lldiv(long long, long long); +extern long long strtoll(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD, + int); +extern unsigned long long strtoull(const char *_RESTRICT_KYWD, + char **_RESTRICT_KYWD, int); +#endif /* defined(_LONGLONG_TYPE) */ + +#endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) ... */ + +#else /* __STDC__ */ + +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) + +extern void _Exit(); +extern float strtof(); +extern long double strtold(); + +#if defined(_LONGLONG_TYPE) +extern long long atoll(); +extern long long llabs(); +extern lldiv_t lldiv(); +extern long long strtoll(); +extern unsigned long long strtoull(); +#endif /* defined(_LONGLONG_TYPE) */ + +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6)... */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_STDLIB_C99_H */ diff --git a/usr/src/head/iso/stdlib_iso.h b/usr/src/head/iso/stdlib_iso.h new file mode 100644 index 0000000000..293cf10fea --- /dev/null +++ b/usr/src/head/iso/stdlib_iso.h @@ -0,0 +1,216 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <locale.h>. + */ + +#ifndef _ISO_STDLIB_ISO_H +#define _ISO_STDLIB_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) +extern unsigned char __ctype[]; +#define MB_CUR_MAX __ctype[520] +#else +extern unsigned char _ctype[]; +#define MB_CUR_MAX _ctype[520] +#endif + +#if __cplusplus >= 199711L +namespace std { +#endif + +typedef struct { + int quot; + int rem; +} div_t; + +typedef struct { + long quot; + long rem; +} ldiv_t; + +#if !defined(_SIZE_T) || __cplusplus >= 199711L +#define _SIZE_T +#if defined(_LP64) || defined(_I32LPx) +typedef unsigned long size_t; /* size of something in bytes */ +#else +typedef unsigned int size_t; /* (historical version) */ +#endif +#endif /* !_SIZE_T */ + +#ifndef NULL +#if defined(_LP64) +#define NULL 0L +#else +#define NULL 0 +#endif +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#define RAND_MAX 32767 + +/* + * wchar_t is a built-in type in standard C++ and as such is not + * defined here when using standard C++. However, the GNU compiler + * fixincludes utility nonetheless creates it's own version of this + * header for use by gcc and g++. In that version it adds a redundant + * guard for __cplusplus. To avoid the creation of a gcc/g++ specific + * header we need to include the following magic comment: + * + * we must use the C++ compiler's type + * + * The above comment should not be removed or changed until GNU + * gcc/fixinc/inclhack.def is updated to bypass this header. + */ +#if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__)) +#ifndef _WCHAR_T +#define _WCHAR_T +#if defined(_LP64) +typedef int wchar_t; +#else +typedef long wchar_t; +#endif +#endif /* !_WCHAR_T */ +#endif /* !defined(__cplusplus) ... */ + +#if defined(__STDC__) + +extern void abort(void) __NORETURN; +extern int abs(int); +extern int atexit(void (*)(void)); +extern double atof(const char *); +extern int atoi(const char *); +extern long int atol(const char *); +extern void *bsearch(const void *, const void *, size_t, size_t, + int (*)(const void *, const void *)); +#if __cplusplus >= 199711L +extern "C++" { + void *bsearch(const void *, const void *, size_t, size_t, + int (*)(const void *, const void *)); +} +#endif /* __cplusplus >= 199711L */ +extern void *calloc(size_t, size_t); +extern div_t div(int, int); +extern void exit(int) + __NORETURN; +extern void free(void *); +extern char *getenv(const char *); +extern long int labs(long); +extern ldiv_t ldiv(long, long); +extern void *malloc(size_t); +extern int mblen(const char *, size_t); +extern size_t mbstowcs(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, + size_t); +extern int mbtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t); +extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); +#if __cplusplus >= 199711L +extern "C++" { + void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); +} +#endif /* __cplusplus >= 199711L */ +extern int rand(void); +extern void *realloc(void *, size_t); +extern void srand(unsigned int); +extern double strtod(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD); +extern long int strtol(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD, int); +extern unsigned long int strtoul(const char *_RESTRICT_KYWD, + char **_RESTRICT_KYWD, int); +extern int system(const char *); +extern int wctomb(char *, wchar_t); +extern size_t wcstombs(char *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, + size_t); + +#if __cplusplus >= 199711L +extern "C++" { + inline long abs(long _l) { return labs(_l); } + inline ldiv_t div(long _l1, long _l2) { return ldiv(_l1, _l2); } +} +#endif /* __cplusplus */ + +#else /* not __STDC__ */ + +extern void abort(); +extern int abs(); +extern int atexit(); +extern double atof(); +extern int atoi(); +extern long int atol(); +extern void *bsearch(); +extern void *calloc(); +extern div_t div(); +extern void exit(); +extern void free(); +extern char *getenv(); +extern long int labs(); +extern ldiv_t ldiv(); +extern void *malloc(); +extern int mblen(); +extern size_t mbstowcs(); +extern int mbtowc(); +extern void qsort(); +extern int rand(); +extern void *realloc(); +extern void srand(); +extern double strtod(); +extern long int strtol(); +extern unsigned long strtoul(); +extern int system(); +extern int wctomb(); +extern size_t wcstombs(); + +#endif /* __STDC__ */ + +#if __cplusplus >= 199711L +} +#endif /* end of namespace std */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_STDLIB_ISO_H */ diff --git a/usr/src/head/iso/string_iso.h b/usr/src/head/iso/string_iso.h new file mode 100644 index 0000000000..02b4c59b7c --- /dev/null +++ b/usr/src/head/iso/string_iso.h @@ -0,0 +1,189 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <string.h>. + */ + +#ifndef _ISO_STRING_ISO_H +#define _ISO_STRING_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if __cplusplus >= 199711L +namespace std { +#endif + +#if !defined(_SIZE_T) || __cplusplus >= 199711L +#define _SIZE_T +#if defined(_LP64) || defined(_I32LPx) +typedef unsigned long size_t; /* size of something in bytes */ +#else +typedef unsigned int size_t; /* (historical version) */ +#endif +#endif /* !_SIZE_T */ + +#ifndef NULL +#if defined(_LP64) +#define NULL 0L +#else +#define NULL 0 +#endif +#endif + +#if defined(__STDC__) + +extern int memcmp(const void *, const void *, size_t); +extern void *memcpy(void *_RESTRICT_KYWD, const void *_RESTRICT_KYWD, size_t); +extern void *memmove(void *, const void *, size_t); +extern void *memset(void *, int, size_t); +extern char *strcat(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD); +extern int strcmp(const char *, const char *); +extern char *strcpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD); +extern int strcoll(const char *, const char *); +extern size_t strcspn(const char *, const char *); +extern char *strerror(int); +extern size_t strlen(const char *); +extern char *strncat(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t); +extern int strncmp(const char *, const char *, size_t); +extern char *strncpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t); +extern size_t strspn(const char *, const char *); +extern char *strtok(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD); +extern size_t strxfrm(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t); + +/* + * The C++ Standard (ISO/IEC 14882:1998) specifies that each of the + * function signatures for the following functions be replaced by + * two declarations, both of which have the same behavior. + */ +#if __cplusplus >= 199711L +extern const void *memchr(const void *, int, size_t); +#ifndef _MEMCHR_INLINE +#define _MEMCHR_INLINE +extern "C++" { + inline void *memchr(void * __s, int __c, size_t __n) { + return (void *)memchr((const void *)__s, __c, __n); + } +} +#endif /* _MEMCHR_INLINE */ +extern const char *strchr(const char *, int); +#ifndef _STRCHR_INLINE +#define _STRCHR_INLINE +extern "C++" { + inline char *strchr(char *__s, int __c) { + return (char *)strchr((const char *)__s, __c); + } +} +#endif /* _STRCHR_INLINE */ +extern const char *strpbrk(const char *, const char *); +#ifndef _STRPBRK_INLINE +#define _STRPBRK_INLINE +extern "C++" { + inline char *strpbrk(char *__s1, const char *__s2) { + return (char *)strpbrk((const char *)__s1, __s2); + } +} +#endif /* _STRPBRK_INLINE */ +extern const char *strrchr(const char *, int); +#ifndef _STRRCHR_INLINE +#define _STRRCHR_INLINE +extern "C++" { + inline char *strrchr(char *__s, int __c) { + return (char *)strrchr((const char *)__s, __c); + } +} +#endif /* _STRRCHR_INLINE */ +extern const char *strstr(const char *, const char *); +#ifndef _STRSTR_INLINE +#define _STRSTR_INLINE +extern "C++" { + inline char *strstr(char *__s1, const char *__s2) { + return (char *)strstr((const char *)__s1, __s2); + } +} +#endif /* _STRSTR_INLINE */ +#else /* __cplusplus >= 199711L */ +extern void *memchr(const void *, int, size_t); +extern char *strchr(const char *, int); +extern char *strpbrk(const char *, const char *); +extern char *strrchr(const char *, int); +extern char *strstr(const char *, const char *); +#endif /* __cplusplus >= 199711L */ + +#else /* __STDC__ */ + +extern void *memchr(); +extern int memcmp(); +extern void *memcpy(); +extern void *memmove(); +extern void *memset(); +extern char *strcat(); +extern char *strchr(); +extern int strcmp(); +extern int strcoll(); +extern char *strcpy(); +extern size_t strcspn(); +extern char *strerror(); +extern size_t strlen(); +extern char *strncat(); +extern int strncmp(); +extern char *strncpy(); +extern char *strpbrk(); +extern char *strrchr(); +extern size_t strspn(); +extern char *strstr(); +extern char *strtok(); +extern size_t strxfrm(); + +#endif /* __STDC__ */ + +#if __cplusplus >= 199711L +} +#endif /* end of namespace std */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_STRING_ISO_H */ diff --git a/usr/src/head/iso/time_iso.h b/usr/src/head/iso/time_iso.h new file mode 100644 index 0000000000..07baaa5ccd --- /dev/null +++ b/usr/src/head/iso/time_iso.h @@ -0,0 +1,135 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <time.h.h>. + */ + +#ifndef _ISO_TIME_ISO_H +#define _ISO_TIME_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.18 */ + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if __cplusplus >= 199711L +namespace std { +#endif + +#ifndef NULL +#if defined(_LP64) +#define NULL 0L +#else +#define NULL 0 +#endif +#endif + +#if !defined(_SIZE_T) || __cplusplus >= 199711L +#define _SIZE_T +#if defined(_LP64) || defined(_I32LPx) +typedef unsigned long size_t; /* size of something in bytes */ +#else +typedef unsigned size_t; /* (historical version) */ +#endif +#endif /* !_SIZE_T */ + +#if !defined(_CLOCK_T) || __cplusplus >= 199711L +#define _CLOCK_T +typedef long clock_t; +#endif /* !_CLOCK_T */ + +#if !defined(_TIME_T) || __cplusplus >= 199711L +#define _TIME_T +typedef long time_t; +#endif /* !_TIME_T */ + +#define CLOCKS_PER_SEC 1000000L + +struct tm { /* see ctime(3) */ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + + +#if defined(__STDC__) + +extern char *asctime(const struct tm *); +extern clock_t clock(void); +extern char *ctime(const time_t *); +extern double difftime(time_t, time_t); +extern struct tm *gmtime(const time_t *); +extern struct tm *localtime(const time_t *); +extern time_t mktime(struct tm *); +extern time_t time(time_t *); +extern size_t strftime(char *_RESTRICT_KYWD, size_t, const char *_RESTRICT_KYWD, + const struct tm *_RESTRICT_KYWD); + +#else /* __STDC__ */ + +extern char *asctime(); +extern clock_t clock(); +extern char *ctime(); +extern double difftime(); +extern struct tm *gmtime(); +extern struct tm *localtime(); +extern time_t mktime(); +extern time_t time(); +extern size_t strftime(); + +#endif /* __STDC__ */ + +#if __cplusplus >= 199711L +} +#endif /* end of namespace std */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_TIME_ISO_H */ diff --git a/usr/src/head/iso/wchar_c99.h b/usr/src/head/iso/wchar_c99.h new file mode 100644 index 0000000000..5234eb1adf --- /dev/null +++ b/usr/src/head/iso/wchar_c99.h @@ -0,0 +1,102 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in + * the C99 standard and in conflict with the C++ implementation of the + * standard header. The C++ standard may adopt the C99 standard at + * which point it is expected that the symbols included here will + * become part of the C++ std namespace. + */ + +#ifndef _ISO_WCHAR_C99_H +#define _ISO_WCHAR_C99_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Introduced in ISO/IEC 9899:1999 standard */ + +#if !defined(_LP64) && !defined(_LONGLONG_TYPE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname vfwscanf _vfwscanf_c89 +#pragma redefine_extname vswscanf _vswscanf_c89 +#pragma redefine_extname vwscanf _vwscanf_c89 +#else +#define vfwscanf _vfwscanf_c89 +#define vswscanf _vswscanf_c89 +#define vwscanf _vwscanf_c89 +#endif +#endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */ + +#ifdef __STDC__ + +#if defined(_STDC_C99) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_XPG6) || defined(__EXTENSIONS__) +extern int vfwscanf(__FILE *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, + __va_list); +extern int vswscanf(const wchar_t *_RESTRICT_KYWD, + const wchar_t *_RESTRICT_KYWD, __va_list); +extern int vwscanf(const wchar_t *_RESTRICT_KYWD, __va_list); +extern float wcstof(const wchar_t *_RESTRICT_KYWD, + wchar_t **_RESTRICT_KYWD); +#if defined(_LONGLONG_TYPE) +extern long double wcstold(const wchar_t *_RESTRICT_KYWD, + wchar_t **_RESTRICT_KYWD); +extern long long wcstoll(const wchar_t *_RESTRICT_KYWD, + wchar_t **_RESTRICT_KYWD, int); +extern unsigned long long wcstoull(const wchar_t *_RESTRICT_KYWD, + wchar_t **_RESTRICT_KYWD, int); +#endif /* defined(_LONGLONG_TYPE) */ + +#endif /* defined(_STDC_C99) || (!defined(_STRICT_STDC)... */ + +#else /* __STDC__ */ + +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) +extern int vfwscanf(); +extern int vswscanf(); +extern int vwscanf(); +extern float wcstof(); +extern long double wcstold(); +extern long int wcstoll(); +extern long int wcstoull(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_WCHAR_C99_H */ diff --git a/usr/src/head/iso/wchar_iso.h b/usr/src/head/iso/wchar_iso.h new file mode 100644 index 0000000000..27e0b5988f --- /dev/null +++ b/usr/src/head/iso/wchar_iso.h @@ -0,0 +1,440 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <wchar.h>. + */ + +#ifndef _ISO_WCHAR_ISO_H +#define _ISO_WCHAR_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <stdio_tag.h> +#include <wchar_impl.h> +#include <iso/time_iso.h> + +#if (defined(__cplusplus) && (__cplusplus - 0 < 54321L)) || \ + (!defined(__cplusplus) && !defined(_STRICT_STDC)) || \ + defined(__EXTENSIONS__) +#include <stdio.h> +#endif /* (defined(__cplusplus) && (__cplusplus - 0 < 54321L)) ... */ + +#if !defined(_STRICT_STDC) || defined(__EXTENSIONS__) +#include <ctype.h> +#include <stddef.h> +#endif /* !defined(_STRICT_STDC) || defined(__EXTENSIONS__) */ + +#include <sys/va_list.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if __cplusplus >= 199711L +namespace std { +#endif + +/* + * wchar_t is a built-in type in standard C++ and as such is not + * defined here when using standard C++. However, the GNU compiler + * fixincludes utility nonetheless creates it's own version of this + * header for use by gcc and g++. In that version it adds a redundant + * guard for __cplusplus. To avoid the creation of a gcc/g++ specific + * header we need to include the following magic comment: + * + * we must use the C++ compiler's type + * + * The above comment should not be removed or changed until GNU + * gcc/fixinc/inclhack.def is updated to bypass this header. + */ +#if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__)) +#ifndef _WCHAR_T +#define _WCHAR_T +#if defined(_LP64) +typedef int wchar_t; +#else +typedef long wchar_t; +#endif +#endif /* !_WCHAR_T */ +#endif /* !defined(__cplusplus) ... */ + +#if !defined(_WINT_T) || __cplusplus >= 199711L +#define _WINT_T +#if defined(_LP64) +typedef int wint_t; +#else +typedef long wint_t; +#endif +#endif /* !defined(_WINT_T) || __cplusplus >= 199711L */ + +#if !defined(_SIZE_T) || __cplusplus >= 199711L +#define _SIZE_T +#if defined(_LP64) || defined(_I32LPx) +typedef unsigned long size_t; /* size of something in bytes */ +#else +typedef unsigned int size_t; /* (historical version) */ +#endif +#endif /* !defined(_SIZE_T) || __cplusplus >= 199711L */ + +#ifndef NULL +#if defined(_LP64) +#define NULL 0L +#else +#define NULL 0 +#endif +#endif /* !NULL */ + +#ifndef WEOF +#define WEOF ((wint_t)(-1)) +#endif + +/* not XPG4 and not XPG4v2 */ +#if !defined(_XPG4) || defined(_XPG5) +#ifndef WCHAR_MAX +#define WCHAR_MAX 2147483647 +#endif +#ifndef WCHAR_MIN +#define WCHAR_MIN (-2147483647-1) +#endif +#endif /* not XPG4 and not XPG4v2 */ + +#if !defined(_MBSTATE_T) || __cplusplus >= 199711L +#define _MBSTATE_T +typedef __mbstate_t mbstate_t; +#endif /* _MBSTATE_T */ + +#if defined(_XPG4) && !defined(_FILEDEFED) || __cplusplus >= 199711L +#define _FILEDEFED +typedef __FILE FILE; +#endif + +#if !defined(_LP64) && !defined(_LONGLONG_TYPE) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname fwprintf _fwprintf_c89 +#pragma redefine_extname swprintf _swprintf_c89 +#pragma redefine_extname vfwprintf _vfwprintf_c89 +#pragma redefine_extname vswprintf _vswprintf_c89 +#pragma redefine_extname vwprintf _vwprintf_c89 +#pragma redefine_extname wprintf _wprintf_c89 +#pragma redefine_extname fwscanf _fwscanf_c89 +#pragma redefine_extname swscanf _swscanf_c89 +#pragma redefine_extname wscanf _wscanf_c89 +#else +#define fwprintf _fwprintf_c89 +#define swprintf _swprintf_c89 +#define vfwprintf _vfwprintf_c89 +#define vswprintf _vswprintf_c89 +#define vwprintf _vwprintf_c89 +#define wprintf _wprintf_c89 +#define fwscanf _fwscanf_c89 +#define swscanf _swscanf_c89 +#define wscanf _wscanf_c89 +#endif + +#endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */ + +#if (!defined(_MSE_INT_H)) +/* not XPG4 and not XPG4v2 */ +#if !defined(_XPG4) || defined(_XPG5) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname fgetwc __fgetwc_xpg5 +#pragma redefine_extname getwc __getwc_xpg5 +#pragma redefine_extname getwchar __getwchar_xpg5 +#pragma redefine_extname fputwc __fputwc_xpg5 +#pragma redefine_extname putwc __putwc_xpg5 +#pragma redefine_extname putwchar __putwchar_xpg5 +#pragma redefine_extname fgetws __fgetws_xpg5 +#pragma redefine_extname fputws __fputws_xpg5 +#pragma redefine_extname ungetwc __ungetwc_xpg5 +#else /* __PRAGMA_REDEFINE_EXTNAME */ +#ifdef __STDC__ +extern wint_t __fgetwc_xpg5(__FILE *); +extern wint_t __getwc_xpg5(__FILE *); +extern wint_t __getwchar_xpg5(void); +extern wint_t __fputwc_xpg5(wint_t, __FILE *); +extern wint_t __putwc_xpg5(wint_t, __FILE *); +extern wint_t __putwchar_xpg5(wint_t); +extern wchar_t *__fgetws_xpg5(wchar_t *_RESTRICT_KYWD, int, + __FILE *_RESTRICT_KYWD); +extern int __fputws_xpg5(const wchar_t *_RESTRICT_KYWD, __FILE *_RESTRICT_KYWD); +extern wint_t __ungetwc_xpg5(wint_t, __FILE *); +#else +extern wint_t __fgetwc_xpg5(); +extern wint_t __getwc_xpg5(); +extern wint_t __getwchar_xpg5(); +extern wint_t __fputwc_xpg5(); +extern wint_t __putwc_xpg5(); +extern wint_t __putwchar_xpg5(); +extern wchar_t *__fgetws_xpg5(); +extern int __fputws_xpg5(); +extern wint_t __ungetwc_xpg5(); +#endif /* __STDC__ */ +#define fgetwc __fgetwc_xpg5 +#define getwc __getwc_xpg5 +#define getwchar __getwchar_xpg5 +#define fputwc __fputwc_xpg5 +#define putwc __putwc_xpg5 +#define putwchar __putwchar_xpg5 +#define fgetws __fgetws_xpg5 +#define fputws __fputws_xpg5 +#define ungetwc __ungetwc_xpg5 +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* not XPG4 and not XPG4v2 */ +#endif /* defined(_MSE_INT_H) */ + +#ifdef __STDC__ + +extern wint_t fgetwc(__FILE *); +extern wchar_t *fgetws(wchar_t *_RESTRICT_KYWD, int, __FILE *_RESTRICT_KYWD); +extern wint_t fputwc(wint_t, __FILE *); +extern int fputws(const wchar_t *_RESTRICT_KYWD, __FILE *_RESTRICT_KYWD); +extern wint_t ungetwc(wint_t, __FILE *); +extern wint_t getwc(__FILE *); +extern wint_t getwchar(void); +extern wint_t putwc(wint_t, __FILE *); +extern wint_t putwchar(wint_t); +extern double wcstod(const wchar_t *_RESTRICT_KYWD, wchar_t **_RESTRICT_KYWD); +extern long wcstol(const wchar_t *_RESTRICT_KYWD, wchar_t **_RESTRICT_KYWD, + int); +extern unsigned long wcstoul(const wchar_t *_RESTRICT_KYWD, + wchar_t **_RESTRICT_KYWD, int); +extern wchar_t *wcscat(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD); +extern int wcscmp(const wchar_t *, const wchar_t *); +extern int wcscoll(const wchar_t *, const wchar_t *); +extern wchar_t *wcscpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD); +extern size_t wcscspn(const wchar_t *, const wchar_t *); +extern size_t wcslen(const wchar_t *); +extern wchar_t *wcsncat(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, + size_t); +extern int wcsncmp(const wchar_t *, const wchar_t *, size_t); +extern wchar_t *wcsncpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, + size_t); +extern size_t wcsspn(const wchar_t *, const wchar_t *); +extern size_t wcsxfrm(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, + size_t); +#if __cplusplus >= 199711L +extern const wchar_t *wcschr(const wchar_t *, wchar_t); +extern "C++" { + inline wchar_t *wcschr(wchar_t *__ws, wchar_t __wc) { + return (wchar_t *)wcschr((const wchar_t *)__ws, __wc); + } +} +extern const wchar_t *wcspbrk(const wchar_t *, const wchar_t *); +extern "C++" { + inline wchar_t *wcspbrk(wchar_t *__ws1, const wchar_t *__ws2) { + return (wchar_t *)wcspbrk((const wchar_t *)__ws1, __ws2); + } +} +extern const wchar_t *wcsrchr(const wchar_t *, wchar_t); +extern "C++" { + inline wchar_t *wcsrchr(wchar_t *__ws, wchar_t __wc) { + return (wchar_t *)wcsrchr((const wchar_t *)__ws, __wc); + } +} +#else /* __cplusplus >= 199711L */ +extern wchar_t *wcschr(const wchar_t *, wchar_t); +extern wchar_t *wcspbrk(const wchar_t *, const wchar_t *); +extern wchar_t *wcsrchr(const wchar_t *, wchar_t); +#endif /* __cplusplus >= 199711L */ + +#if (!defined(_MSE_INT_H)) +#if defined(_XPG4) && !defined(_XPG5) /* XPG4 or XPG4v2 */ +extern wchar_t *wcstok(wchar_t *, const wchar_t *); +extern size_t wcsftime(wchar_t *, size_t, const char *, const struct tm *); +#else /* XPG4 or XPG4v2 */ +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname wcstok __wcstok_xpg5 +#pragma redefine_extname wcsftime __wcsftime_xpg5 +extern wchar_t *wcstok(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, + wchar_t **_RESTRICT_KYWD); +extern size_t wcsftime(wchar_t *_RESTRICT_KYWD, size_t, + const wchar_t *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD); +#else /* __PRAGMA_REDEFINE_EXTNAME */ +extern wchar_t *__wcstok_xpg5(wchar_t *_RESTRICT_KYWD, + const wchar_t *_RESTRICT_KYWD, wchar_t **_RESTRICT_KYWD); +extern size_t __wcsftime_xpg5(wchar_t *_RESTRICT_KYWD, size_t, + const wchar_t *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD); +#define wcstok __wcstok_xpg5 +#define wcsftime __wcsftime_xpg5 +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* XPG4 or XPG4v2 */ +#endif /* !defined(_MSE_INT_H) */ + +/* not XPG4 and not XPG4v2 */ +#if !defined(_XPG4) || defined(_XPG5) +extern wint_t btowc(int); +extern int fwprintf(__FILE *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, + ...); +extern int fwscanf(__FILE *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, + ...); +extern int fwide(__FILE *, int); +extern int mbsinit(const mbstate_t *); +extern size_t mbrlen(const char *_RESTRICT_KYWD, size_t, + mbstate_t *_RESTRICT_KYWD); +extern size_t mbrtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, + size_t, mbstate_t *_RESTRICT_KYWD); +extern size_t mbsrtowcs(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD, + size_t, mbstate_t *_RESTRICT_KYWD); +extern int swprintf(wchar_t *_RESTRICT_KYWD, size_t, + const wchar_t *_RESTRICT_KYWD, ...); +extern int swscanf(const wchar_t *_RESTRICT_KYWD, + const wchar_t *_RESTRICT_KYWD, ...); +extern int vfwprintf(__FILE *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, + __va_list); +extern int vwprintf(const wchar_t *_RESTRICT_KYWD, __va_list); +extern int vswprintf(wchar_t *_RESTRICT_KYWD, size_t, + const wchar_t *_RESTRICT_KYWD, __va_list); +extern size_t wcrtomb(char *_RESTRICT_KYWD, wchar_t, + mbstate_t *_RESTRICT_KYWD); +extern size_t wcsrtombs(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD, + size_t, mbstate_t *_RESTRICT_KYWD); +extern int wctob(wint_t); +extern int wmemcmp(const wchar_t *, const wchar_t *, size_t); +extern wchar_t *wmemcpy(wchar_t *_RESTRICT_KYWD, + const wchar_t *_RESTRICT_KYWD, size_t); +extern wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); +extern wchar_t *wmemset(wchar_t *, wchar_t, size_t); +extern int wprintf(const wchar_t *_RESTRICT_KYWD, ...); +extern int wscanf(const wchar_t *_RESTRICT_KYWD, ...); +#if __cplusplus >= 199711L +extern const wchar_t *wcsstr(const wchar_t *, const wchar_t *); +extern "C++" { + inline wchar_t *wcsstr(wchar_t *__ws1, const wchar_t *__ws2) { + return (wchar_t *)wcsstr((const wchar_t *)__ws1, __ws2); + } +} +extern const wchar_t *wmemchr(const wchar_t *, wchar_t, size_t); +extern "C++" { + inline wchar_t *wmemchr(wchar_t *__ws, wchar_t __wc, size_t __n) { + return (wchar_t *)wmemchr((const wchar_t *)__ws, __wc, __n); + } +} +#else /* __cplusplus >= 199711L */ +extern wchar_t *wcsstr(const wchar_t *_RESTRICT_KYWD, + const wchar_t *_RESTRICT_KYWD); +extern wchar_t *wmemchr(const wchar_t *, wchar_t, size_t); +#endif /* __cplusplus >= 199711L */ +#endif /* not XPG4 and not XPG4v2 */ + +#else /* __STDC__ */ + +extern wint_t fgetwc(); +extern wchar_t *fgetws(); +extern wint_t fputwc(); +extern int fputws(); +extern wint_t ungetwc(); +extern wint_t getwc(); +extern wint_t getwchar(); +extern wint_t putwc(); +extern wint_t putwchar(); +extern wint_t ungetwc(); +extern double wcstod(); +extern long wcstol(); +extern unsigned long wcstoul(); +extern wchar_t *wcscat(); +extern wchar_t *wcschr(); +extern int wcscmp(); +extern int wcscoll(); +extern wchar_t *wcscpy(); +extern size_t wcscspn(); +extern size_t wcslen(); +extern wchar_t *wcsncat(); +extern int wcsncmp(); +extern wchar_t *wcsncpy(); +extern wchar_t *wcspbrk(); +extern wchar_t *wcsrchr(); +extern size_t wcsspn(); +extern size_t wcsxfrm(); + +#if (!defined(_MSE_INT_H)) +#if defined(_XPG4) && !defined(_XPG5) /* XPG4 or XPG4v2 */ +extern wchar_t *wcstok(); +extern size_t wcsftime(); +#else /* XPG4 or XPG4v2 */ +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname wcstok __wcstok_xpg5 +#pragma redefine_extname wcsftime __wcsftime_xpg5 +extern wchar_t *wcstok(); +extern size_t wcsftime(); +#else /* __PRAGMA_REDEFINE_EXTNAME */ +extern wchar_t *__wcstok_xpg5(); +extern size_t __wcsftime_xpg5(); +#define wcstok __wcstok_xpg5 +#define wcsftime __wcsftime_xpg5 +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* XPG4 or XPG4v2 */ +#endif /* defined(_MSE_INT_H) */ + +/* not XPG4 and not XPG4v2 */ +#if (!defined(_XPG4) && !defined(_XPG4_2) || defined(_XPG5)) +extern wint_t btowc(); +extern int fwprintf(); +extern int fwscanf(); +extern int fwide(); +extern int mbsinit(); +extern size_t mbrlen(); +extern size_t mbrtowc(); +extern size_t mbsrtowcs(); +extern int swprintf(); +extern int swscanf(); +extern int vfwprintf(); +extern int vwprintf(); +extern int vswprintf(); +extern size_t wcrtomb(); +extern size_t wcsrtombs(); +extern wchar_t *wcsstr(); +extern int wctob(); +extern wchar_t *wmemchr(); +extern int wmemcmp(); +extern wchar_t *wmemcpy(); +extern wchar_t *wmemmove(); +extern wchar_t *wmemset(); +extern int wprintf(); +extern int wscanf(); +#endif /* not XPG4 and not XPG4v2 */ + +#endif /* __STDC__ */ + +#if __cplusplus >= 199711L +} +#endif /* end of namespace std */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_WCHAR_ISO_H */ diff --git a/usr/src/head/iso/wctype_c99.h b/usr/src/head/iso/wctype_c99.h new file mode 100644 index 0000000000..89a47feddb --- /dev/null +++ b/usr/src/head/iso/wctype_c99.h @@ -0,0 +1,79 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in + * the C99 standard and in conflict with the C++ implementation of the + * standard header. The C++ standard may adopt the C99 standard at + * which point it is expected that the symbols included here will + * become part of the C++ std namespace. + */ + +#ifndef _ISO_WCTYPE_C99_H +#define _ISO_WCTYPE_C99_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The following have been added as a result of the ISO/IEC 9899:1999 + * standard. For a strictly conforming C application, visibility is + * contingent on the value of __STDC_VERSION__ (see sys/feature_tests.h). + * For non-strictly conforming C applications, there are no restrictions + * on the C namespace. + */ + +/* + * Visibility of the iswblank() function is not allowed in the X/Open + * or POSIX namespace prior to SUSv3. However, since SUSv3 aligns + * with the C99 standard, visibility is controlled by the version of + * the C standard as indicated by the value of __STDC_VERSION__ (see + * sys/feature_tests.h and _STDC_C99) rather than if the X/Open or POSIX + * feature test macros are used. Conforming SUSv3 applications are + * required to use c99, therefore, iswblank() will be made visible by + * default. + */ + +#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_STDC_C99) || defined(__EXTENSIONS__) +#ifdef __STDC__ +extern int iswblank(wint_t); +#else +extern int iswblank(); +#endif +#endif /* defined(__EXTENSIONS__)... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_WCTYPE_C99_H */ diff --git a/usr/src/head/iso/wctype_iso.h b/usr/src/head/iso/wctype_iso.h new file mode 100644 index 0000000000..567d802844 --- /dev/null +++ b/usr/src/head/iso/wctype_iso.h @@ -0,0 +1,157 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* wctype.h 1.13 89/11/02 SMI; JLE */ +/* from AT&T JAE 2.1 */ +/* definitions for international functions */ + +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * An application should not include this header directly. Instead it + * should be included only through the inclusion of other Sun headers. + * + * The contents of this header is limited to identifiers specified in the + * C Standard. Any new identifiers specified in future amendments to the + * C Standard must be placed in this header. If these new identifiers + * are required to also be in the C++ Standard "std" namespace, then for + * anything other than macro definitions, corresponding "using" directives + * must also be added to <wctype.h>. + */ + +#ifndef _ISO_WCTYPE_ISO_H +#define _ISO_WCTYPE_ISO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if __cplusplus >= 199711L +namespace std { +#endif + +#if !defined(_WINT_T) || __cplusplus >= 199711L +#define _WINT_T +#if defined(_LP64) +typedef int wint_t; +#else +typedef long wint_t; +#endif +#endif /* !defined(_WINT_T) || __cplusplus >= 199711L */ + +#if !defined(_WCTYPE_T) || __cplusplus >= 199711L +#define _WCTYPE_T +typedef int wctype_t; +#endif + +typedef unsigned int wctrans_t; + +/* not XPG4 and not XPG4v2 */ +#if !defined(_XPG4) || defined(_XPG5) +#ifndef WEOF +#define WEOF ((wint_t)(-1)) +#endif +#endif /* not XPG4 and not XPG4v2 */ + +#ifdef __STDC__ +extern int iswalnum(wint_t); +extern int iswalpha(wint_t); +extern int iswcntrl(wint_t); +extern int iswdigit(wint_t); +extern int iswgraph(wint_t); +extern int iswlower(wint_t); +extern int iswprint(wint_t); +extern int iswpunct(wint_t); +extern int iswspace(wint_t); +extern int iswupper(wint_t); +extern int iswxdigit(wint_t); +/* tow* also become functions */ +extern wint_t towlower(wint_t); +extern wint_t towupper(wint_t); +extern wctrans_t wctrans(const char *); +extern wint_t towctrans(wint_t, wctrans_t); +extern int iswctype(wint_t, wctype_t); +extern wctype_t wctype(const char *); +#else +extern int iswalnum(); +extern int iswalpha(); +extern int iswcntrl(); +extern int iswdigit(); +extern int iswgraph(); +extern int iswlower(); +extern int iswprint(); +extern int iswpunct(); +extern int iswspace(); +extern int iswupper(); +extern int iswxdigit(); +/* tow* also become functions */ +extern wint_t towlower(); +extern wint_t towupper(); +extern wctrans_t wctrans(); +extern wint_t towctrans(); +extern int iswctype(); +extern wctype_t wctype(); +#endif + +/* bit definition for character class */ + +#define _E1 0x00000100 /* phonogram (international use) */ +#define _E2 0x00000200 /* ideogram (international use) */ +#define _E3 0x00000400 /* English (international use) */ +#define _E4 0x00000800 /* number (international use) */ +#define _E5 0x00001000 /* special (international use) */ +#define _E6 0x00002000 /* other characters (international use) */ +#define _E7 0x00004000 /* reserved (international use) */ +#define _E8 0x00008000 /* reserved (international use) */ + +#define _E9 0x00010000 +#define _E10 0x00020000 +#define _E11 0x00040000 +#define _E12 0x00080000 +#define _E13 0x00100000 +#define _E14 0x00200000 +#define _E15 0x00400000 +#define _E16 0x00800000 +#define _E17 0x01000000 +#define _E18 0x02000000 +#define _E19 0x04000000 +#define _E20 0x08000000 +#define _E21 0x10000000 +#define _E22 0x20000000 +#define _E23 0x40000000 +#define _E24 0x80000000 + +#if __cplusplus >= 199711L +} +#endif /* end of namespace std */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO_WCTYPE_ISO_H */ diff --git a/usr/src/head/iso646.h b/usr/src/head/iso646.h new file mode 100644 index 0000000000..651cdb1f74 --- /dev/null +++ b/usr/src/head/iso646.h @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _ISO646_H +#define _ISO646_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Introduced in ISO/IEC 9899:1990/Ammendment 1:1995 (C Standard). + * In ISO/IEC 14882:1998 (C++ Standard), these tokens are keywords + * rather than macro names. + */ + +#if !defined(__cplusplus) || __cplusplus < 199711L +#define and && +#define and_eq &= +#define bitand & +#define bitor | +#define compl ~ +#define not ! +#define not_eq != +#define or || +#define or_eq |= +#define xor ^ +#define xor_eq ^= +#endif /* !defined(__cplusplus) || __cplusplus < 199711 */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ISO646_H */ diff --git a/usr/src/head/kerberosv5/mit-sipb-copyright.h b/usr/src/head/kerberosv5/mit-sipb-copyright.h new file mode 100644 index 0000000000..ce840c0d54 --- /dev/null +++ b/usr/src/head/kerberosv5/mit-sipb-copyright.h @@ -0,0 +1,59 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1998, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _MIT_SIPB_COPYRIGHT_H +#define _MIT_SIPB_COPYRIGHT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * + * Copyright 1987 by the Student Information Processing Board + * of the Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the names of M.I.T. and the M.I.T. S.I.P.B. not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * M.I.T. and the M.I.T. S.I.P.B. make no representations about + * the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty. + * + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _MIT_SIPB_COPYRIGHT_H */ diff --git a/usr/src/head/kerberosv5/mit_copyright.h b/usr/src/head/kerberosv5/mit_copyright.h new file mode 100644 index 0000000000..1bffed91ec --- /dev/null +++ b/usr/src/head/kerberosv5/mit_copyright.h @@ -0,0 +1,125 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1998, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _MIT_COPYRIGHT_H +#define _MIT_COPYRIGHT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Copyright (C) 1996 by the Massachusetts Institute of Technology + */ + +/* + * Copyright 1994 Cygnus Support + * Mark W. Eichin + */ + +/* + * Copyright (c) 1990 Regents of the University of Michigan. + * All Rights Reserved. + */ + +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + */ + +/* + * Copyright 1987, 1998 by the Student Informatiion Processing Board + * of the Massachusetts Institute of Technology + */ + +/* + * Copyright (c) 1993, 1994 C Consortium + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation file (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OF OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the X Consortium shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from the X Consortium. + */ + +/* + * Copyright 1992 Network Computing Devices, Inc. + */ + +/* + * Copyright 1995 by Richard P. Basch. All Rights Reserved. + * Copyright 1995 by Lehman Brotchers, Inc. All Rights Reserved. + */ + +/* + * Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. + * + * License to copy and use this software is granted provided that + * it is identified as the "RSA Data Security, Inc. MD5 Message + * Digest Algorithm" in all material mentioning or referencing this + * software or this function. + * + * License is also granted to make and use derivative works + * provided that such works are identified as "derived from the RSA + * Data Security, Inc. MD4 Message Digest Algorithm" in all + * material mentioning or referencing the derived work. + * + * RSA Data Security, Inc. make no representations concerning + * either the merchantability of this software or the suitability + * of this software for any particular purpose. It is provided "as + * is" without express or implied warranty of any kind. + * + * These notices must be retained in any copies of any part of this + * documentation and/or software. + * + */ + + + + +#ifdef __cplusplus +} +#endif + + +#endif /* _MIT_COPYRIGHT_H */ diff --git a/usr/src/head/langinfo.h b/usr/src/head/langinfo.h new file mode 100644 index 0000000000..2e73cfbae7 --- /dev/null +++ b/usr/src/head/langinfo.h @@ -0,0 +1,157 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _LANGINFO_H +#define _LANGINFO_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ + +#include <sys/feature_tests.h> +#include <nl_types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The seven days of the week in their full beauty + */ + +#define DAY_1 1 /* sunday */ +#define DAY_2 2 /* monday */ +#define DAY_3 3 /* tuesday */ +#define DAY_4 4 /* wednesday */ +#define DAY_5 5 /* thursday */ +#define DAY_6 6 /* friday */ +#define DAY_7 7 /* saturday */ + +/* + * The abbreviated seven days of the week + */ + +#define ABDAY_1 8 /* sun */ +#define ABDAY_2 9 /* mon */ +#define ABDAY_3 10 /* tue */ +#define ABDAY_4 11 /* wed */ +#define ABDAY_5 12 /* thu */ +#define ABDAY_6 13 /* fri */ +#define ABDAY_7 14 /* sat */ + +/* + * The full names of the twelve months... + */ + +#define MON_1 15 /* january */ +#define MON_2 16 /* february */ +#define MON_3 17 /* march */ +#define MON_4 18 /* april */ +#define MON_5 19 /* may */ +#define MON_6 20 /* june */ +#define MON_7 21 /* july */ +#define MON_8 22 /* august */ +#define MON_9 23 /* september */ +#define MON_10 24 /* october */ +#define MON_11 25 /* november */ +#define MON_12 26 /* december */ + +/* + * ... and their abbreviated form + */ + +#define ABMON_1 27 /* jan */ +#define ABMON_2 28 /* feb */ +#define ABMON_3 29 /* mar */ +#define ABMON_4 30 /* apr */ +#define ABMON_5 31 /* may */ +#define ABMON_6 32 /* jun */ +#define ABMON_7 33 /* jul */ +#define ABMON_8 34 /* aug */ +#define ABMON_9 35 /* sep */ +#define ABMON_10 36 /* oct */ +#define ABMON_11 37 /* nov */ +#define ABMON_12 38 /* dec */ + +/* + * plus some special strings you might need to know + */ + +#define RADIXCHAR 39 /* radix character */ +#define THOUSEP 40 /* separator for thousand */ +/* YESSTR and NOSTR marked as legacy in XPG5 and removed in SUSv3 */ +#if !defined(_XPG6) || defined(__EXTENSIONS__) +#define YESSTR 41 /* affirmative response for yes/no queries */ +#define NOSTR 42 /* negative response for yes/no queries */ +#endif /* !defined(_XPG6) || defined(__EXTENSIONS__ */ +#define CRNCYSTR 43 /* currency symbol */ + +/* + * Default string used to format date and time + * e.g. Sunday, August 24 21:08:38 MET 1986 + */ + +#define D_T_FMT 44 /* string for formatting date and time */ +#define D_FMT 45 /* date format */ +#define T_FMT 46 /* time format */ +#define AM_STR 47 /* am string */ +#define PM_STR 48 /* pm string */ + +/* + * Additions for XPG4 (XSH4) Compliance + */ + +#define CODESET 49 /* codeset name */ +#define T_FMT_AMPM 50 /* am or pm time format string */ +#define ERA 51 /* era description segments */ +#define ERA_D_FMT 52 /* era date format string */ +#define ERA_D_T_FMT 53 /* era date and time format string */ +#define ERA_T_FMT 54 /* era time format string */ +#define ALT_DIGITS 55 /* alternative symbols for digits */ +#define YESEXPR 56 /* affirmative response expression */ +#define NOEXPR 57 /* negative response expression */ +#define _DATE_FMT 58 /* strftime format for date(1) */ + +#if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) +#define MAXSTRMSG 58 /* Maximum number of strings in langinfo */ +#endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */ + +/* + * and the definitions of functions langinfo(3C) + */ +#if defined(__STDC__) +char *nl_langinfo(nl_item); /* get a string from the database */ +#else +char *nl_langinfo(); /* get a string from the database */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _LANGINFO_H */ diff --git a/usr/src/head/lastlog.h b/usr/src/head/lastlog.h new file mode 100644 index 0000000000..3a4e336c1c --- /dev/null +++ b/usr/src/head/lastlog.h @@ -0,0 +1,62 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1989 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _LASTLOG_H +#define _LASTLOG_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _LP64 +#include <sys/types32.h> +#endif + +struct lastlog { +#ifdef _LP64 + time32_t ll_time; +#else + time_t ll_time; +#endif + char ll_line[8]; + char ll_host[16]; /* same as in utmp */ +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _LASTLOG_H */ diff --git a/usr/src/head/lber.h b/usr/src/head/lber.h new file mode 100644 index 0000000000..a125f5bc2d --- /dev/null +++ b/usr/src/head/lber.h @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0(the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http:/ /www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright(C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef _LBER_H +#define _LBER_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _SOLARIS_SDK +#define _SOLARIS_SDK +#endif + +#include <stdlib.h> /* to pick up size_t typedef */ + +#ifdef _SOLARIS_SDK +#ifdef sunos4 +#define SAFEMEMCPY(d, s, n) bcopy(s, d, n) +#else /* sunos4 */ +#define SAFEMEMCPY(d, s, n) memmove(d, s, n) +#endif /* sunos4 */ +#endif /* _SOLARIS_SDK */ +/* + * Note that LBER_ERROR and LBER_DEFAULT are values that can never appear + * as valid BER tags, and so it is safe to use them to report errors. In + * fact, any tag for which the following is true is invalid: + * (( tag & 0x00000080 ) != 0 ) && (( tag & 0xFFFFFF00 ) != 0 ) + */ +#define LBER_ERROR 0xffffffffU +#define LBER_DEFAULT 0xffffffffU +#define LBER_END_OF_SEQORSET 0xfffffffeU +/* BER classes and mask */ +#define LBER_CLASS_UNIVERSAL 0x00 +#define LBER_CLASS_APPLICATION 0x40 +#define LBER_CLASS_CONTEXT 0x80 +#define LBER_CLASS_PRIVATE 0xc0 +#define LBER_CLASS_MASK 0xc0 + +/* BER encoding type and mask */ +#define LBER_PRIMITIVE 0x00 +#define LBER_CONSTRUCTED 0x20 +#define LBER_ENCODING_MASK 0x20 + +#define LBER_BIG_TAG_MASK 0x1f +#define LBER_MORE_TAG_MASK 0x80 + +/* general BER types we know about */ +#define LBER_BOOLEAN 0x01 +#define LBER_INTEGER 0x02 +#define LBER_BITSTRING 0x03 +#define LBER_OCTETSTRING 0x04 +#define LBER_NULL 0x05 +#define LBER_ENUMERATED 0x0a +#define LBER_SEQUENCE 0x30 +#define LBER_SET 0x31 + + +typedef unsigned int ber_len_t; /* for BER len */ +typedef unsigned int ber_tag_t; /* for BER tags */ +typedef int ber_int_t; /* for BER ints, enums, and Booleans */ +typedef unsigned int ber_uint_t; /* unsigned equivalent of ber_int_t */ +typedef int ber_slen_t; /* signed equivalent of ber_len_t */ + +typedef struct berval { + ber_len_t bv_len; + char *bv_val; +} BerValue; + +typedef struct berelement BerElement; + +#ifdef _SOLARIS_SDK +#define NULLBER ((BerElement *)NULL) +#endif + +typedef int (*BERTranslateProc)(char **bufp, ber_uint_t *buflenp, + int free_input); +#ifndef macintosh +#if defined(_WINDOWS) || defined(_WIN32) || defined(_CONSOLE) +#include <winsock.h> /* for SOCKET */ +typedef SOCKET LBER_SOCKET; +#else +typedef int LBER_SOCKET; +#endif /* _WINDOWS */ +#else /* macintosh */ +typedef void *LBER_SOCKET; +#endif /* macintosh */ + +/* calling conventions used by library */ +#ifndef LDAP_CALL +#if defined(_WINDOWS) || defined(_WIN32) +#define LDAP_C __cdecl +#ifndef _WIN32 +#define __stdcall _far _pascal +#define LDAP_CALLBACK _loadds +#else +#define LDAP_CALLBACK +#endif /* _WIN32 */ +#define LDAP_PASCAL __stdcall +#define LDAP_CALL LDAP_PASCAL +#else /* _WINDOWS */ +#define LDAP_C +#define LDAP_CALLBACK +#define LDAP_PASCAL +#define LDAP_CALL +#endif /* _WINDOWS */ +#endif /* LDAP_CALL */ + +/* + * function prototypes for lber library + */ +#ifndef LDAP_API +#if defined(_WINDOWS) || defined(_WIN32) +#define LDAP_API(rt) rt +#else /* _WINDOWS */ +#define LDAP_API(rt) rt +#endif /* _WINDOWS */ +#endif /* LDAP_API */ + +/* + * decode routines + */ +ber_tag_t LDAP_CALL ber_get_tag(BerElement *ber); +ber_tag_t LDAP_CALL ber_skip_tag(BerElement *ber, + ber_len_t *len); +ber_tag_t LDAP_CALL ber_peek_tag(BerElement *ber, + ber_len_t *len); +ber_tag_t LDAP_CALL ber_get_int(BerElement *ber, ber_int_t *num); +ber_tag_t LDAP_CALL ber_get_stringb(BerElement *ber, char *buf, + ber_len_t *len); +ber_tag_t LDAP_CALL ber_get_stringa(BerElement *ber, + char **buf); +ber_tag_t LDAP_CALL ber_get_stringal(BerElement *ber, + struct berval **bv); +ber_tag_t ber_get_bitstringa(BerElement *ber, + char **buf, ber_len_t *len); +ber_tag_t LDAP_CALL ber_get_null(BerElement *ber); +ber_tag_t LDAP_CALL ber_get_boolean(BerElement *ber, + int *boolval); +ber_tag_t LDAP_CALL ber_first_element(BerElement *ber, + ber_len_t *len, char **last); +ber_tag_t LDAP_CALL ber_next_element(BerElement *ber, + ber_len_t *len, char *last); +ber_tag_t LDAP_C ber_scanf(BerElement *ber, const char *fmt, + ...); +LDAP_API(void) LDAP_CALL ber_bvfree(struct berval *bv); +LDAP_API(void) LDAP_CALL ber_bvecfree(struct berval **bv); +struct berval *LDAP_CALL ber_bvdup(const struct berval *bv); +LDAP_API(void) LDAP_CALL ber_set_string_translators(BerElement *ber, + BERTranslateProc encode_proc, BERTranslateProc decode_proc); +LDAP_API(BerElement *) LDAP_CALL ber_init(const struct berval *bv); + +/* + * encoding routines + */ +int LDAP_CALL ber_put_enum(BerElement *ber, ber_int_t num, + ber_tag_t tag); +int LDAP_CALL ber_put_int(BerElement *ber, ber_int_t num, + ber_tag_t tag); +int LDAP_CALL ber_put_ostring(BerElement *ber, char *str, + ber_len_t len, ber_tag_t tag); +int LDAP_CALL ber_put_string(BerElement *ber, char *str, + ber_tag_t tag); +int LDAP_CALL ber_put_bitstring(BerElement *ber, char *str, + ber_len_t bitlen, ber_tag_t tag); +int LDAP_CALL ber_put_null(BerElement *ber, ber_tag_t tag); +int LDAP_CALL ber_put_boolean(BerElement *ber, int boolval, + ber_tag_t tag); +int LDAP_CALL ber_start_seq(BerElement *ber, ber_tag_t tag); +int LDAP_CALL ber_start_set(BerElement *ber, ber_tag_t tag); +int LDAP_CALL ber_put_seq(BerElement *ber); +int LDAP_CALL ber_put_set(BerElement *ber); +int LDAP_C ber_printf(BerElement *ber, const char *fmt, ...); +int LDAP_CALL ber_flatten(BerElement *ber, + struct berval **bvPtr); + +/* + * miscellaneous routines + */ +LDAP_API(void) LDAP_CALL ber_free(BerElement *ber, int freebuf); +LDAP_API(BerElement*) LDAP_CALL ber_alloc(void); +LDAP_API(BerElement*) LDAP_CALL der_alloc(void); +LDAP_API(BerElement*) LDAP_CALL ber_alloc_t(int options); +LDAP_API(BerElement*) LDAP_CALL ber_dup(BerElement *ber); +ber_int_t LDAP_CALL ber_read(BerElement *ber, char *buf, + ber_len_t len); +ber_int_t LDAP_CALL ber_write(BerElement *ber, char *buf, + ber_len_t len, int nosos); +LDAP_API(void) LDAP_CALL ber_reset(BerElement *ber, int was_writing); + +#ifdef __cplusplus +} +#endif + +#endif /* _LBER_H */ diff --git a/usr/src/head/ldap.h b/usr/src/head/ldap.h new file mode 100644 index 0000000000..9c4bbed4aa --- /dev/null +++ b/usr/src/head/ldap.h @@ -0,0 +1,1608 @@ +/* + * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998-1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#ifndef _LDAP_H +#define _LDAP_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _SOLARIS_SDK +#define _SOLARIS_SDK +#endif + +#ifndef LDAP_TYPE_TIMEVAL_DEFINED +#include <sys/time.h> +#endif +#ifndef LDAP_TYPE_SOCKET_DEFINED /* API extension */ +#include <sys/types.h> +#include <sys/socket.h> +#endif + +#include <lber.h> + +#define LDAP_PORT 389 +#define LDAPS_PORT 636 +#define LDAP_PORT_MAX 65535 /* API extension */ +#define LDAP_VERSION1 1 /* API extension */ +#define LDAP_VERSION2 2 +#define LDAP_VERSION3 3 +#define LDAP_VERSION LDAP_VERSION2 /* API extension */ +#define LDAP_VERSION_MIN LDAP_VERSION3 +#define LDAP_VERSION_MAX LDAP_VERSION3 + +#define LDAP_VENDOR_VERSION 500 /* version # * 100 */ +#define LDAP_VENDOR_NAME "Sun Microsystems Inc." +/* + * The following will be an RFC number once the LDAP C API Internet Draft + * is published as a Proposed Standard RFC. For now we use 2000 + the + * draft revision number (currently 5) since we are close to compliance + * with revision 5 of the draft. + */ +#define LDAP_API_VERSION 2005 + +/* + * C LDAP features we support that are not (yet) part of the LDAP C API + * Internet Draft. Use the ldap_get_option() call with an option value of + * LDAP_OPT_API_FEATURE_INFO to retrieve information about a feature. + * + * Note that this list is incomplete; it includes only the most widely + * used extensions. Also, the version is 1 for all of these for now. + */ +#define LDAP_API_FEATURE_SERVER_SIDE_SORT 1 +#define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW 1 +#define LDAP_API_FEATURE_PERSISTENT_SEARCH 1 +#define LDAP_API_FEATURE_PROXY_AUTHORIZATION 1 +#define LDAP_API_FEATURE_X_LDERRNO 1 +#define LDAP_API_FEATURE_X_MEMCACHE 1 +#define LDAP_API_FEATURE_X_IO_FUNCTIONS 1 +#define LDAP_API_FEATURE_X_EXTIO_FUNCTIONS 1 +#define LDAP_API_FEATURE_X_DNS_FUNCTIONS 1 +#define LDAP_API_FEATURE_X_MEMALLOC_FUNCTIONS 1 +#define LDAP_API_FEATURE_X_THREAD_FUNCTIONS 1 +#define LDAP_API_FEATURE_X_EXTHREAD_FUNCTIONS 1 +#define LDAP_API_FEATURE_X_GETLANGVALUES 1 +#define LDAP_API_FEATURE_X_CLIENT_SIDE_SORT 1 +#define LDAP_API_FEATURE_X_URL_FUNCTIONS 1 +#define LDAP_API_FEATURE_X_FILTER_FUNCTIONS 1 + +#define LDAP_ROOT_DSE "" /* API extension */ +#define LDAP_NO_ATTRS "1.1" +#define LDAP_ALL_USER_ATTRS "*" + +/* + * Standard options (used with ldap_set_option() and ldap_get_option): + */ +#define LDAP_OPT_API_INFO 0x00 /* 0 */ +#define LDAP_OPT_DESC 0x01 /* 1 */ +#define LDAP_OPT_DEREF 0x02 /* 2 */ +#define LDAP_OPT_SIZELIMIT 0x03 /* 3 */ +#define LDAP_OPT_TIMELIMIT 0x04 /* 4 */ +#define LDAP_OPT_REFERRALS 0x08 /* 8 */ +#define LDAP_OPT_RESTART 0x09 /* 9 */ +#define LDAP_OPT_PROTOCOL_VERSION 0x11 /* 17 */ +#define LDAP_OPT_SERVER_CONTROLS 0x12 /* 18 */ +#define LDAP_OPT_CLIENT_CONTROLS 0x13 /* 19 */ +#define LDAP_OPT_API_FEATURE_INFO 0x15 /* 21 */ +#define LDAP_OPT_HOST_NAME 0x30 /* 48 */ +#define LDAP_OPT_ERROR_NUMBER 0x31 /* 49 */ +#define LDAP_OPT_ERROR_STRING 0x32 /* 50 */ +#define LDAP_OPT_MATCHED_DN 0x33 /* 51 */ + +/* + * Well-behaved private and experimental extensions will use option values + * between 0x4000 (16384) and 0x7FFF (32767) inclusive. + */ +#define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x4000 /* to 0x7FFF inclusive */ +/* + * Special timeout values for poll and connect: + */ +#define LDAP_X_IO_TIMEOUT_NO_WAIT 0 /* return immediately */ +#define LDAP_X_IO_TIMEOUT_NO_TIMEOUT (-1) /* block indefinitely */ +/* + * Timeout value for nonblocking connect call + */ +#define LDAP_X_OPT_CONNECT_TIMEOUT (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F01) + /* 0x4000 + 0x0F01 = 0x4F01 = 20225 - API extension */ + +/* for on/off options */ +#define LDAP_OPT_ON ((void *)1) +#define LDAP_OPT_OFF ((void *)0) + +typedef struct ldap LDAP; /* opaque connection handle */ +typedef struct ldapmsg LDAPMessage; /* opaque result/entry handle */ + +#define NULLMSG ((LDAPMessage *)0) + +/* structure representing an LDAP modification */ +typedef struct ldapmod { + int mod_op; /* kind of mod + form of values */ +#define LDAP_MOD_ADD 0x00 +#define LDAP_MOD_DELETE 0x01 +#define LDAP_MOD_REPLACE 0x02 +#define LDAP_MOD_BVALUES 0x80 + char *mod_type; /* attribute name to modify */ + union mod_vals_u { + char **modv_strvals; + struct berval **modv_bvals; + } mod_vals; /* values to add/delete/replace */ +#define mod_values mod_vals.modv_strvals +#define mod_bvalues mod_vals.modv_bvals +} LDAPMod; + + +/* + * structure for holding ldapv3 controls + */ +typedef struct ldapcontrol { + char *ldctl_oid; + struct berval ldctl_value; + char ldctl_iscritical; +} LDAPControl; + + +/* + * LDAP API information. Can be retrieved by using a sequence like: + * + * LDAPAPIInfo ldai; + * ldai.ldapai_info_version = LDAP_API_INFO_VERSION; + * if ( ldap_get_option( NULL, LDAP_OPT_API_INFO, &ldia ) == 0 ) ... + */ +#define LDAP_API_INFO_VERSION 1 +typedef struct ldapapiinfo { + int ldapai_info_version; /* version of this struct (1) */ + int ldapai_api_version; /* revision of API supported */ + int ldapai_protocol_version; /* highest LDAP version supported */ + char **ldapai_extensions; /* names of API extensions */ + char *ldapai_vendor_name; /* name of supplier */ + int ldapai_vendor_version; /* supplier-specific version times 100 */ +} LDAPAPIInfo; + + +/* + * LDAP API extended features info. Can be retrieved by using a sequence like: + * + * LDAPAPIFeatureInfo ldfi; + * ldfi.ldapaif_info_version = LDAP_FEATURE_INFO_VERSION; + * ldfi.ldapaif_name = "VIRTUAL_LIST_VIEW"; + * if ( ldap_get_option( NULL, LDAP_OPT_API_FEATURE_INFO, &ldfi ) == 0 ) ... + */ +#define LDAP_FEATURE_INFO_VERSION 1 +typedef struct ldap_apifeature_info { + int ldapaif_info_version; /* version of this struct (1) */ + char *ldapaif_name; /* name of supported feature */ + int ldapaif_version; /* revision of supported feature */ +} LDAPAPIFeatureInfo; + + +/* possible result types a server can return */ +#define LDAP_RES_BIND 0x61 /* 97 */ +#define LDAP_RES_SEARCH_ENTRY 0x64 /* 100 */ +#define LDAP_RES_SEARCH_RESULT 0x65 /* 101 */ +#define LDAP_RES_MODIFY 0x67 /* 103 */ +#define LDAP_RES_ADD 0x69 /* 105 */ +#define LDAP_RES_DELETE 0x6b /* 107 */ +#define LDAP_RES_MODDN 0x6d /* 109 */ +#define LDAP_RES_COMPARE 0x6f /* 111 */ +#define LDAP_RES_SEARCH_REFERENCE 0x73 /* 115 */ +#define LDAP_RES_EXTENDED 0x78 /* 120 */ + +/* Special values for ldap_result() "msgid" parameter */ +#define LDAP_RES_ANY (-1) +#define LDAP_RES_UNSOLICITED 0 + +/* built-in SASL methods */ +#define LDAP_SASL_SIMPLE 0 /* special value used for simple bind */ +#define LDAP_SASL_EXTERNAL "EXTERNAL" /* TLS/SSL extension */ + +#ifdef _SOLARIS_SDK +#define LDAP_SASL_CRAM_MD5 "CRAM-MD5" +#define LDAP_SASL_DIGEST_MD5 "DIGEST-MD5" +#define LDAP_SASL_BIND_INPROGRESS 0x0e /* for backward compatibility */ +#endif + +/* search scopes */ +#define LDAP_SCOPE_BASE 0x00 +#define LDAP_SCOPE_ONELEVEL 0x01 +#define LDAP_SCOPE_SUBTREE 0x02 + +/* alias dereferencing */ +#define LDAP_DEREF_NEVER 0 +#define LDAP_DEREF_SEARCHING 1 +#define LDAP_DEREF_FINDING 2 +#define LDAP_DEREF_ALWAYS 3 + +/* predefined size/time limits */ +#define LDAP_NO_LIMIT 0 + +/* allowed values for "all" ldap_result() parameter */ +#define LDAP_MSG_ONE 0 +#define LDAP_MSG_ALL 1 +#define LDAP_MSG_RECEIVED 2 + +/* possible error codes we can be returned */ +#define LDAP_SUCCESS 0x00 /* 0 */ +#define LDAP_OPERATIONS_ERROR 0x01 /* 1 */ +#define LDAP_PROTOCOL_ERROR 0x02 /* 2 */ +#define LDAP_TIMELIMIT_EXCEEDED 0x03 /* 3 */ +#define LDAP_SIZELIMIT_EXCEEDED 0x04 /* 4 */ +#define LDAP_COMPARE_FALSE 0x05 /* 5 */ +#define LDAP_COMPARE_TRUE 0x06 /* 6 */ +#define LDAP_STRONG_AUTH_NOT_SUPPORTED 0x07 /* 7 */ +#define LDAP_STRONG_AUTH_REQUIRED 0x08 /* 8 */ +#define LDAP_PARTIAL_RESULTS 0x09 /* 9 (UMich LDAPv2 extn) */ +#define LDAP_REFERRAL 0x0a /* 10 - LDAPv3 */ +#define LDAP_ADMINLIMIT_EXCEEDED 0x0b /* 11 - LDAPv3 */ +#define LDAP_UNAVAILABLE_CRITICAL_EXTENSION 0x0c /* 12 - LDAPv3 */ +#define LDAP_CONFIDENTIALITY_REQUIRED 0x0d /* 13 */ +#define LDAP_SASL_BIND_IN_PROGRESS 0x0e /* 14 - LDAPv3 */ + +#define LDAP_NO_SUCH_ATTRIBUTE 0x10 /* 16 */ +#define LDAP_UNDEFINED_TYPE 0x11 /* 17 */ +#define LDAP_INAPPROPRIATE_MATCHING 0x12 /* 18 */ +#define LDAP_CONSTRAINT_VIOLATION 0x13 /* 19 */ +#define LDAP_TYPE_OR_VALUE_EXISTS 0x14 /* 20 */ +#define LDAP_INVALID_SYNTAX 0x15 /* 21 */ + +#define LDAP_NO_SUCH_OBJECT 0x20 /* 32 */ +#define LDAP_ALIAS_PROBLEM 0x21 /* 33 */ +#define LDAP_INVALID_DN_SYNTAX 0x22 /* 34 */ +#define LDAP_IS_LEAF 0x23 /* 35 (not used in LDAPv3) */ +#define LDAP_ALIAS_DEREF_PROBLEM 0x24 /* 36 */ + +#define NAME_ERROR(n) ((n & 0xf0) == 0x20) + +#define LDAP_INAPPROPRIATE_AUTH 0x30 /* 48 */ +#define LDAP_INVALID_CREDENTIALS 0x31 /* 49 */ +#define LDAP_INSUFFICIENT_ACCESS 0x32 /* 50 */ +#define LDAP_BUSY 0x33 /* 51 */ +#define LDAP_UNAVAILABLE 0x34 /* 52 */ +#define LDAP_UNWILLING_TO_PERFORM 0x35 /* 53 */ +#define LDAP_LOOP_DETECT 0x36 /* 54 */ + +#define LDAP_SORT_CONTROL_MISSING 0x3C /* 60 (server side sort extn) */ +#define LDAP_INDEX_RANGE_ERROR 0x3D /* 61 (VLV extn) */ + +#define LDAP_NAMING_VIOLATION 0x40 /* 64 */ +#define LDAP_OBJECT_CLASS_VIOLATION 0x41 /* 65 */ +#define LDAP_NOT_ALLOWED_ON_NONLEAF 0x42 /* 66 */ +#define LDAP_NOT_ALLOWED_ON_RDN 0x43 /* 67 */ +#define LDAP_ALREADY_EXISTS 0x44 /* 68 */ +#define LDAP_NO_OBJECT_CLASS_MODS 0x45 /* 69 */ +#define LDAP_RESULTS_TOO_LARGE 0x46 /* 70 - CLDAP */ +#define LDAP_AFFECTS_MULTIPLE_DSAS 0x47 /* 71 */ + +#define LDAP_OTHER 0x50 /* 80 */ +#define LDAP_SERVER_DOWN 0x51 /* 81 */ +#define LDAP_LOCAL_ERROR 0x52 /* 82 */ +#define LDAP_ENCODING_ERROR 0x53 /* 83 */ +#define LDAP_DECODING_ERROR 0x54 /* 84 */ +#define LDAP_TIMEOUT 0x55 /* 85 */ +#define LDAP_AUTH_UNKNOWN 0x56 /* 86 */ +#define LDAP_FILTER_ERROR 0x57 /* 87 */ +#define LDAP_USER_CANCELLED 0x58 /* 88 */ +#define LDAP_PARAM_ERROR 0x59 /* 89 */ +#define LDAP_NO_MEMORY 0x5a /* 90 */ +#define LDAP_CONNECT_ERROR 0x5b /* 91 */ +#define LDAP_NOT_SUPPORTED 0x5c /* 92 - LDAPv3 */ +#define LDAP_CONTROL_NOT_FOUND 0x5d /* 93 - LDAPv3 */ +#define LDAP_NO_RESULTS_RETURNED 0x5e /* 94 - LDAPv3 */ +#define LDAP_MORE_RESULTS_TO_RETURN 0x5f /* 95 - LDAPv3 */ +#define LDAP_CLIENT_LOOP 0x60 /* 96 - LDAPv3 */ +#define LDAP_REFERRAL_LIMIT_EXCEEDED 0x61 /* 97 - LDAPv3 */ + +/* + * LDAPv3 unsolicited notification messages we know about + */ +#define LDAP_NOTICE_OF_DISCONNECTION "1.3.6.1.4.1.1466.20036" + +/* + * LDAPv3 server controls we know about + */ +#define LDAP_CONTROL_MANAGEDSAIT "2.16.840.1.113730.3.4.2" +#define LDAP_CONTROL_SORTREQUEST "1.2.840.113556.1.4.473" +#define LDAP_CONTROL_SORTRESPONSE "1.2.840.113556.1.4.474" +#define LDAP_CONTROL_PERSISTENTSEARCH "2.16.840.1.113730.3.4.3" +#define LDAP_CONTROL_ENTRYCHANGE "2.16.840.1.113730.3.4.7" +#define LDAP_CONTROL_VLVREQUEST "2.16.840.1.113730.3.4.9" +#define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10" +#define LDAP_CONTROL_PROXYAUTH "2.16.840.1.113730.3.4.12" + /* version 1 */ +#define LDAP_CONTROL_PROXIEDAUTH "2.16.840.1.113730.3.4.18" + /* version 2 */ + +#ifdef _SOLARIS_SDK +/* + * Simple Page control OID + */ +#define LDAP_CONTROL_SIMPLE_PAGE "1.2.840.113556.1.4.319" + +/* + * Begin LDAP Display Template Definitions + */ +#define LDAP_TEMPLATE_VERSION 1 + +/* + * general types of items (confined to most significant byte) + */ +#define LDAP_SYN_TYPE_TEXT 0x01000000L +#define LDAP_SYN_TYPE_IMAGE 0x02000000L +#define LDAP_SYN_TYPE_BOOLEAN 0x04000000L +#define LDAP_SYN_TYPE_BUTTON 0x08000000L +#define LDAP_SYN_TYPE_ACTION 0x10000000L + +/* + * syntax options (confined to second most significant byte) + */ +#define LDAP_SYN_OPT_DEFER 0x00010000L + +/* + * display template item syntax ids (defined by common agreement) + * these are the valid values for the ti_syntaxid of the tmplitem + * struct (defined below). A general type is encoded in the + * most-significant 8 bits, and some options are encoded in the next + * 8 bits. The lower 16 bits are reserved for the distinct types. + */ +#define LDAP_SYN_CASEIGNORESTR (1 | LDAP_SYN_TYPE_TEXT) +#define LDAP_SYN_MULTILINESTR (2 | LDAP_SYN_TYPE_TEXT) +#define LDAP_SYN_DN (3 | LDAP_SYN_TYPE_TEXT) +#define LDAP_SYN_BOOLEAN (4 | LDAP_SYN_TYPE_BOOLEAN) +#define LDAP_SYN_JPEGIMAGE (5 | LDAP_SYN_TYPE_IMAGE) +#define LDAP_SYN_JPEGBUTTON (6 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER) +#define LDAP_SYN_FAXIMAGE (7 | LDAP_SYN_TYPE_IMAGE) +#define LDAP_SYN_FAXBUTTON (8 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER) +#define LDAP_SYN_AUDIOBUTTON (9 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER) +#define LDAP_SYN_TIME (10 | LDAP_SYN_TYPE_TEXT) +#define LDAP_SYN_DATE (11 | LDAP_SYN_TYPE_TEXT) +#define LDAP_SYN_LABELEDURL (12 | LDAP_SYN_TYPE_TEXT) +#define LDAP_SYN_SEARCHACTION (13 | LDAP_SYN_TYPE_ACTION) +#define LDAP_SYN_LINKACTION (14 | LDAP_SYN_TYPE_ACTION) +#define LDAP_SYN_ADDDNACTION (15 | LDAP_SYN_TYPE_ACTION) +#define LDAP_SYN_VERIFYDNACTION (16 | LDAP_SYN_TYPE_ACTION) +#define LDAP_SYN_RFC822ADDR (17 | LDAP_SYN_TYPE_TEXT) + +/* + * handy macros + */ +#define LDAP_GET_SYN_TYPE(syid) ((syid) & 0xFF000000UL) +#define LDAP_GET_SYN_OPTIONS(syid) ((syid) & 0x00FF0000UL) + + +/* + * display options for output routines (used by entry2text and friends) + */ +/* + * use calculated label width (based on length of longest label in + * template) instead of contant width + */ +#define LDAP_DISP_OPT_AUTOLABELWIDTH 0x00000001L +#define LDAP_DISP_OPT_HTMLBODYONLY 0x00000002L + +/* + * perform search actions (applies to ldap_entry2text_search only) + */ +#define LDAP_DISP_OPT_DOSEARCHACTIONS 0x00000002L + +/* + * include additional info. relevant to "non leaf" entries only + * used by ldap_entry2html and ldap_entry2html_search to include "Browse" + * and "Move Up" HREFs + */ +#define LDAP_DISP_OPT_NONLEAF 0x00000004L + +/* + * display template item options (may not apply to all types) + * if this bit is set in ti_options, it applies. + */ +#define LDAP_DITEM_OPT_READONLY 0x00000001L +#define LDAP_DITEM_OPT_SORTVALUES 0x00000002L +#define LDAP_DITEM_OPT_SINGLEVALUED 0x00000004L +#define LDAP_DITEM_OPT_HIDEIFEMPTY 0x00000008L +#define LDAP_DITEM_OPT_VALUEREQUIRED 0x00000010L +#define LDAP_DITEM_OPT_HIDEIFFALSE 0x00000020L /* booleans only */ + +#endif /* _SOLARIS_SDK */ + +/* Authentication request and response controls */ +#define LDAP_CONTROL_AUTH_REQUEST "2.16.840.1.113730.3.4.16" +#define LDAP_CONTROL_AUTH_RESPONSE "2.16.840.1.113730.3.4.15" + +/* Password information sent back to client */ +#define LDAP_CONTROL_PWEXPIRED "2.16.840.1.113730.3.4.4" +#define LDAP_CONTROL_PWEXPIRING "2.16.840.1.113730.3.4.5" + + +/* + * Client controls we know about + */ +#define LDAP_CONTROL_REFERRALS "1.2.840.113556.1.4.616" + + +/* + * LDAP_API macro definition: + */ +#ifndef LDAP_API +#define LDAP_API(rt) rt +#endif /* LDAP_API */ + +#ifdef _SOLARIS_SDK +/* Simple Page Control functions for Solaris SDK */ +int ldap_create_page_control(LDAP *ld, unsigned int pagesize, + struct berval *cookie, char isCritical, LDAPControl **output); +int ldap_parse_page_control(LDAP *ld, LDAPControl **controls, + unsigned int *totalcount, struct berval **cookie); + +/* CRAM-MD5 functions */ +int ldap_sasl_cram_md5_bind_s(LDAP *ld, char *dn, + struct berval *cred, LDAPControl **serverctrls, + LDAPControl **clientctrls); +/* DIGEST-MD5 Function */ +int ldap_x_sasl_digest_md5_bind_s(LDAP *ld, char *dn, + struct berval *cred, LDAPControl **serverctrls, + LDAPControl **clientctrls); +int ldap_x_sasl_digest_md5_bind(LDAP *ld, char *dn, + struct berval *cred, LDAPControl **serverctrls, + LDAPControl **clientctrls, struct timeval *timeout, + LDAPMessage **result); + +#endif /* _SOLARIS_SDK */ + +LDAP_API(LDAP *) LDAP_CALL ldap_open(const char *host, int port); +LDAP_API(LDAP *) LDAP_CALL ldap_init(const char *defhost, int defport); +int LDAP_CALL ldap_set_option(LDAP *ld, int option, + const void *optdata); +int LDAP_CALL ldap_get_option(LDAP *ld, int option, void *optdata); +int LDAP_CALL ldap_unbind(LDAP *ld); +int LDAP_CALL ldap_unbind_s(LDAP *ld); + +/* + * perform ldap operations and obtain results + */ +int LDAP_CALL ldap_abandon(LDAP *ld, int msgid); +int LDAP_CALL ldap_add(LDAP *ld, const char *dn, LDAPMod **attrs); +int LDAP_CALL ldap_add_s(LDAP *ld, const char *dn, LDAPMod **attrs); +int LDAP_CALL ldap_simple_bind(LDAP *ld, const char *who, + const char *passwd); +int LDAP_CALL ldap_simple_bind_s(LDAP *ld, const char *who, + const char *passwd); +int LDAP_CALL ldap_modify(LDAP *ld, const char *dn, LDAPMod **mods); +int LDAP_CALL ldap_modify_s(LDAP *ld, const char *dn, + LDAPMod **mods); +int LDAP_CALL ldap_modrdn(LDAP *ld, const char *dn, + const char *newrdn); +int LDAP_CALL ldap_modrdn_s(LDAP *ld, const char *dn, + const char *newrdn); + +/* The following 2 functions are deprecated */ +int LDAP_CALL ldap_modrdn2(LDAP *ld, const char *dn, + const char *newrdn, int deleteoldrdn); +int LDAP_CALL ldap_modrdn2_s(LDAP *ld, const char *dn, + const char *newrdn, int deleteoldrdn); + +int LDAP_CALL ldap_compare(LDAP *ld, const char *dn, + const char *attr, const char *value); +int LDAP_CALL ldap_compare_s(LDAP *ld, const char *dn, + const char *attr, const char *value); +int LDAP_CALL ldap_delete(LDAP *ld, const char *dn); +int LDAP_CALL ldap_delete_s(LDAP *ld, const char *dn); +int LDAP_CALL ldap_search(LDAP *ld, const char *base, int scope, + const char *filter, char **attrs, int attrsonly); +int LDAP_CALL ldap_search_s(LDAP *ld, const char *base, int scope, + const char *filter, char **attrs, int attrsonly, LDAPMessage **res); +int LDAP_CALL ldap_search_st(LDAP *ld, const char *base, int scope, + const char *filter, char **attrs, int attrsonly, + struct timeval *timeout, LDAPMessage **res); +int LDAP_CALL ldap_result(LDAP *ld, int msgid, int all, + struct timeval *timeout, LDAPMessage **result); +int LDAP_CALL ldap_msgfree(LDAPMessage *lm); +int LDAP_CALL ldap_msgid(LDAPMessage *lm); +int LDAP_CALL ldap_msgtype(LDAPMessage *lm); + + +/* + * Routines to parse/deal with results and errors returned + */ +int LDAP_CALL ldap_result2error(LDAP *ld, LDAPMessage *r, + int freeit); +char *LDAP_CALL ldap_err2string(int err); +LDAP_API(void) LDAP_CALL ldap_perror(LDAP *ld, const char *s); +LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_entry(LDAP *ld, + LDAPMessage *chain); +LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_entry(LDAP *ld, + LDAPMessage *entry); +int LDAP_CALL ldap_count_entries(LDAP *ld, LDAPMessage *chain); +char *LDAP_CALL ldap_get_dn(LDAP *ld, LDAPMessage *entry); +char *LDAP_CALL ldap_dn2ufn(const char *dn); +char **LDAP_CALL ldap_explode_dn(const char *dn, + const int notypes); +char **LDAP_CALL ldap_explode_rdn(const char *rdn, + const int notypes); +char *LDAP_CALL ldap_first_attribute(LDAP *ld, LDAPMessage *entry, + BerElement **ber); +char *LDAP_CALL ldap_next_attribute(LDAP *ld, LDAPMessage *entry, + BerElement *ber); + +/* The following function is deprecated */ +LDAP_API(void) LDAP_CALL ldap_ber_free(BerElement *ber, int freebuf); + +char **LDAP_CALL ldap_get_values(LDAP *ld, LDAPMessage *entry, + const char *target); +struct berval **LDAP_CALL ldap_get_values_len(LDAP *ld, + LDAPMessage *entry, const char *target); +int LDAP_CALL ldap_count_values(char **vals); +int LDAP_CALL ldap_count_values_len(struct berval **vals); +LDAP_API(void) LDAP_CALL ldap_value_free(char **vals); +LDAP_API(void) LDAP_CALL ldap_value_free_len(struct berval **vals); +LDAP_API(void) LDAP_CALL ldap_memfree(void *p); + + +/* + * LDAPv3 extended operation calls + */ +/* + * Note: all of the new asynchronous calls return an LDAP error code, + * not a message id. A message id is returned via the int *msgidp + * parameter (usually the last parameter) if appropriate. + */ +int LDAP_CALL ldap_abandon_ext(LDAP *ld, int msgid, + LDAPControl **serverctrls, LDAPControl **clientctrls); +int LDAP_CALL ldap_add_ext(LDAP *ld, const char *dn, LDAPMod **attrs, + LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); +int LDAP_CALL ldap_add_ext_s(LDAP *ld, const char *dn, + LDAPMod **attrs, LDAPControl **serverctrls, LDAPControl **clientctrls); +int LDAP_CALL ldap_sasl_bind(LDAP *ld, const char *dn, + const char *mechanism, const struct berval *cred, + LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); +int LDAP_CALL ldap_sasl_bind_s(LDAP *ld, const char *dn, + const char *mechanism, const struct berval *cred, + LDAPControl **serverctrls, LDAPControl **clientctrls, + struct berval **servercredp); +int LDAP_CALL ldap_modify_ext(LDAP *ld, const char *dn, + LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls, + int *msgidp); +int LDAP_CALL ldap_modify_ext_s(LDAP *ld, const char *dn, + LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls); +int LDAP_CALL ldap_rename(LDAP *ld, const char *dn, + const char *newrdn, const char *newparent, int deleteoldrdn, + LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); +int LDAP_CALL ldap_rename_s(LDAP *ld, const char *dn, + const char *newrdn, const char *newparent, int deleteoldrdn, + LDAPControl **serverctrls, LDAPControl **clientctrls); +int LDAP_CALL ldap_compare_ext(LDAP *ld, const char *dn, + const char *attr, const struct berval *bvalue, + LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); +int LDAP_CALL ldap_compare_ext_s(LDAP *ld, const char *dn, + const char *attr, const struct berval *bvalue, + LDAPControl **serverctrls, LDAPControl **clientctrls); +int LDAP_CALL ldap_delete_ext(LDAP *ld, const char *dn, + LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); +int LDAP_CALL ldap_delete_ext_s(LDAP *ld, const char *dn, + LDAPControl **serverctrls, LDAPControl **clientctrls); +int LDAP_CALL ldap_search_ext(LDAP *ld, const char *base, + int scope, const char *filter, char **attrs, int attrsonly, + LDAPControl **serverctrls, LDAPControl **clientctrls, + struct timeval *timeoutp, int sizelimit, int *msgidp); +int LDAP_CALL ldap_search_ext_s(LDAP *ld, const char *base, + int scope, const char *filter, char **attrs, int attrsonly, + LDAPControl **serverctrls, LDAPControl **clientctrls, + struct timeval *timeoutp, int sizelimit, LDAPMessage **res); +int LDAP_CALL ldap_extended_operation(LDAP *ld, + const char *requestoid, const struct berval *requestdata, + LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); +int LDAP_CALL ldap_extended_operation_s(LDAP *ld, + const char *requestoid, const struct berval *requestdata, + LDAPControl **serverctrls, LDAPControl **clientctrls, + char **retoidp, struct berval **retdatap); +int LDAP_CALL ldap_unbind_ext(LDAP *ld, LDAPControl **serverctrls, + LDAPControl **clientctrls); + + +/* + * LDAPv3 extended parsing / result handling calls + */ +int LDAP_CALL ldap_parse_sasl_bind_result(LDAP *ld, + LDAPMessage *res, struct berval **servercredp, int freeit); +int LDAP_CALL ldap_parse_result(LDAP *ld, LDAPMessage *res, + int *errcodep, char **matcheddnp, char **errmsgp, char ***referralsp, + LDAPControl ***serverctrlsp, int freeit); +int LDAP_CALL ldap_parse_extended_result(LDAP *ld, LDAPMessage *res, + char **retoidp, struct berval **retdatap, int freeit); +LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_message(LDAP *ld, + LDAPMessage *res); +LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_message(LDAP *ld, + LDAPMessage *msg); +int LDAP_CALL ldap_count_messages(LDAP *ld, LDAPMessage *res); +LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_reference(LDAP *ld, + LDAPMessage *res); +LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_reference(LDAP *ld, + LDAPMessage *ref); +int LDAP_CALL ldap_count_references(LDAP *ld, LDAPMessage *res); +int LDAP_CALL ldap_parse_reference(LDAP *ld, LDAPMessage *ref, + char ***referralsp, LDAPControl ***serverctrlsp, int freeit); +int LDAP_CALL ldap_get_entry_controls(LDAP *ld, LDAPMessage *entry, + LDAPControl ***serverctrlsp); +LDAP_API(void) LDAP_CALL ldap_control_free(LDAPControl *ctrl); +LDAP_API(void) LDAP_CALL ldap_controls_free(LDAPControl **ctrls); + +#ifdef _SOLARIS_SDK +char ** ldap_get_reference_urls(LDAP *ld, LDAPMessage *res); +#endif + + +/* End of core standard C LDAP API definitions */ + +/* + * Server side sorting of search results (an LDAPv3 extension -- + * LDAP_API_FEATURE_SERVER_SIDE_SORT) + */ +typedef struct LDAPsortkey { /* structure for a sort-key */ + char *sk_attrtype; + char *sk_matchruleoid; + int sk_reverseorder; +} LDAPsortkey; + +int LDAP_CALL ldap_create_sort_control(LDAP *ld, + LDAPsortkey **sortKeyList, const char ctl_iscritical, + LDAPControl **ctrlp); +int LDAP_CALL ldap_parse_sort_control(LDAP *ld, + LDAPControl **ctrls, unsigned long *result, char **attribute); + +LDAP_API(void) LDAP_CALL ldap_free_sort_keylist(LDAPsortkey **sortKeyList); +int LDAP_CALL ldap_create_sort_keylist(LDAPsortkey ***sortKeyList, + const char *string_rep); + + +/* + * Virtual list view (an LDAPv3 extension -- LDAP_API_FEATURE_VIRTUAL_LIST_VIEW) + */ +/* + * structure that describes a VirtualListViewRequest control. + * note that ldvlist_index and ldvlist_size are only relevant to + * ldap_create_virtuallist_control() if ldvlist_attrvalue is NULL. + */ +typedef struct ldapvirtuallist { + unsigned long ldvlist_before_count; /* # entries before target */ + unsigned long ldvlist_after_count; /* # entries after target */ + char *ldvlist_attrvalue; /* jump to this value */ + unsigned long ldvlist_index; /* list offset */ + unsigned long ldvlist_size; /* number of items in vlist */ + void *ldvlist_extradata; /* for use by application */ +} LDAPVirtualList; + +/* + * VLV functions: + */ +int LDAP_CALL ldap_create_virtuallist_control(LDAP *ld, + LDAPVirtualList *ldvlistp, LDAPControl **ctrlp); + +int LDAP_CALL ldap_parse_virtuallist_control(LDAP *ld, + LDAPControl **ctrls, unsigned long *target_posp, + unsigned long *list_sizep, int *errcodep); + + +/* + * Routines for creating persistent search controls and for handling + * "entry changed notification" controls (an LDAPv3 extension -- + * LDAP_API_FEATURE_PERSISTENT_SEARCH) + */ +#define LDAP_CHANGETYPE_ADD 1 +#define LDAP_CHANGETYPE_DELETE 2 +#define LDAP_CHANGETYPE_MODIFY 4 +#define LDAP_CHANGETYPE_MODDN 8 +#define LDAP_CHANGETYPE_ANY (1|2|4|8) +int LDAP_CALL ldap_create_persistentsearch_control(LDAP *ld, + int changetypes, int changesonly, int return_echg_ctls, + char ctl_iscritical, LDAPControl **ctrlp); +int LDAP_CALL ldap_parse_entrychange_control(LDAP *ld, + LDAPControl **ctrls, int *chgtypep, char **prevdnp, + int *chgnumpresentp, ber_int_t *chgnump); + + +/* + * Routines for creating Proxied Authorization controls (an LDAPv3 + * extension -- LDAP_API_FEATURE_PROXY_AUTHORIZATION) + * ldap_create_proxyauth_control() is for the old (version 1) control. + * ldap_create_proxiedauth_control() is for the newer (version 2) control. + * Version 1 is supported by iPlanet Directory Server 4.1 and later. + * Version 2 is supported by iPlanet Directory Server 5.0 and later. + */ +int LDAP_CALL ldap_create_proxyauth_control(LDAP *ld, + const char *dn, const char ctl_iscritical, LDAPControl **ctrlp); +int LDAP_CALL ldap_create_proxiedauth_control(LDAP *ld, + const char *authzid, LDAPControl **ctrlp); + + +/* + * Functions to get and set LDAP error information (API extension -- + * LDAP_API_FEATURE_X_LDERRNO ) + */ +int LDAP_CALL ldap_get_lderrno(LDAP *ld, char **m, char **s); +int LDAP_CALL ldap_set_lderrno(LDAP *ld, int e, char *m, char *s); + + +/* + * LDAP URL functions and definitions (an API extension -- + * LDAP_API_FEATURE_X_URL_FUNCTIONS) + */ +/* + * types for ldap URL handling + */ +typedef struct ldap_url_desc { + char *lud_host; + int lud_port; + char *lud_dn; + char **lud_attrs; + int lud_scope; + char *lud_filter; + unsigned long lud_options; +#define LDAP_URL_OPT_SECURE 0x01 + char *lud_string; /* for internal use only */ +} LDAPURLDesc; + +#define NULLLDAPURLDESC ((LDAPURLDesc *)NULL) + +/* + * possible errors returned by ldap_url_parse() + */ +#define LDAP_URL_ERR_NOTLDAP 1 /* URL doesn't begin with "ldap://" */ +#define LDAP_URL_ERR_NODN 2 /* URL has no DN (required) */ +#define LDAP_URL_ERR_BADSCOPE 3 /* URL scope string is invalid */ +#define LDAP_URL_ERR_MEM 4 /* can't allocate memory space */ +#define LDAP_URL_ERR_PARAM 5 /* bad parameter to an URL function */ +#define LDAP_URL_ERR_HOSTPORT 6 /* URL hostcode is invalid */ + +/* + * URL functions: + */ +int LDAP_CALL ldap_is_ldap_url(const char *url); +int LDAP_CALL ldap_url_parse(const char *url, LDAPURLDesc **ludpp); +int LDAP_CALL ldap_url_parse_nodn(const char *url, LDAPURLDesc **ludpp); +LDAP_API(void) LDAP_CALL ldap_free_urldesc(LDAPURLDesc *ludp); +int LDAP_CALL ldap_url_search(LDAP *ld, const char *url, + int attrsonly); +int LDAP_CALL ldap_url_search_s(LDAP *ld, const char *url, + int attrsonly, LDAPMessage **res); +int LDAP_CALL ldap_url_search_st(LDAP *ld, const char *url, + int attrsonly, struct timeval *timeout, LDAPMessage **res); + +#ifdef _SOLARIS_SDK +/* + * Additional URL functions plus Character set, Search Preference + * and Display Template functions moved from internal header files + */ + +/* + * URL functions + */ +char *ldap_dns_to_url(LDAP *ld, char *dns_name, char *attrs, + char *scope, char *filter); +char *ldap_dn_to_url(LDAP *ld, char *dn, int nameparts); + +/* + * Character set functions + */ +#ifdef STR_TRANSLATION +void ldap_set_string_translators(LDAP *ld, + BERTranslateProc encode_proc, BERTranslateProc decode_proc); +int ldap_translate_from_t61(LDAP *ld, char **bufp, + unsigned long *lenp, int free_input); +int ldap_translate_to_t61(LDAP *ld, char **bufp, + unsigned long *lenp, int free_input); +void ldap_enable_translation(LDAP *ld, LDAPMessage *entry, + int enable); +#ifdef LDAP_CHARSET_8859 +int ldap_t61_to_8859(char **bufp, unsigned long *buflenp, + int free_input); +int ldap_8859_to_t61(char **bufp, unsigned long *buflenp, + int free_input); +#endif /* LDAP_CHARSET_8859 */ +#endif /* STR_TRANSLATION */ + +/* + * Display Temple functions/structures + */ +/* + * display template item structure + */ +struct ldap_tmplitem { + unsigned long ti_syntaxid; + unsigned long ti_options; + char *ti_attrname; + char *ti_label; + char **ti_args; + struct ldap_tmplitem *ti_next_in_row; + struct ldap_tmplitem *ti_next_in_col; + void *ti_appdata; +}; + +#define NULLTMPLITEM ((struct ldap_tmplitem *)0) + +#define LDAP_SET_TMPLITEM_APPDATA(ti, datap) \ + (ti)->ti_appdata = (void *)(datap) + +#define LDAP_GET_TMPLITEM_APPDATA(ti, type) \ + (type)((ti)->ti_appdata) + +#define LDAP_IS_TMPLITEM_OPTION_SET(ti, option) \ + (((ti)->ti_options & option) != 0) + +/* + * object class array structure + */ +struct ldap_oclist { + char **oc_objclasses; + struct ldap_oclist *oc_next; +}; + +#define NULLOCLIST ((struct ldap_oclist *)0) + + +/* + * add defaults list + */ +struct ldap_adddeflist { + int ad_source; +#define LDAP_ADSRC_CONSTANTVALUE 1 +#define LDAP_ADSRC_ADDERSDN 2 + char *ad_attrname; + char *ad_value; + struct ldap_adddeflist *ad_next; +}; + +#define NULLADLIST ((struct ldap_adddeflist *)0) + + +/* + * display template global options + * if this bit is set in dt_options, it applies. + */ +/* + * users should be allowed to try to add objects of these entries + */ +#define LDAP_DTMPL_OPT_ADDABLE 0x00000001L + +/* + * users should be allowed to do "modify RDN" operation of these entries + */ +#define LDAP_DTMPL_OPT_ALLOWMODRDN 0x00000002L + +/* + * this template is an alternate view, not a primary view + */ +#define LDAP_DTMPL_OPT_ALTVIEW 0x00000004L + + +/* + * display template structure + */ +struct ldap_disptmpl { + char *dt_name; + char *dt_pluralname; + char *dt_iconname; + unsigned long dt_options; + char *dt_authattrname; + char *dt_defrdnattrname; + char *dt_defaddlocation; + struct ldap_oclist *dt_oclist; + struct ldap_adddeflist *dt_adddeflist; + struct ldap_tmplitem *dt_items; + void *dt_appdata; + struct ldap_disptmpl *dt_next; +}; + +#define NULLDISPTMPL ((struct ldap_disptmpl *)0) + +#define LDAP_SET_DISPTMPL_APPDATA(dt, datap) \ + (dt)->dt_appdata = (void *)(datap) + +#define LDAP_GET_DISPTMPL_APPDATA(dt, type) \ + (type)((dt)->dt_appdata) + +#define LDAP_IS_DISPTMPL_OPTION_SET(dt, option) \ + (((dt)->dt_options & option) != 0) + +#define LDAP_TMPL_ERR_VERSION 1 +#define LDAP_TMPL_ERR_MEM 2 +#define LDAP_TMPL_ERR_SYNTAX 3 +#define LDAP_TMPL_ERR_FILE 4 + +/* + * buffer size needed for entry2text and vals2text + */ +#define LDAP_DTMPL_BUFSIZ 8192 + +typedef int (*writeptype)(void *writeparm, char *p, int len); + +LDAP_API(int) +LDAP_CALL +ldap_init_templates(char *file, struct ldap_disptmpl **tmpllistp); + +LDAP_API(int) +LDAP_CALL +ldap_init_templates_buf(char *buf, long buflen, + struct ldap_disptmpl **tmpllistp); + +LDAP_API(void) +LDAP_CALL +ldap_free_templates(struct ldap_disptmpl *tmpllist); + +LDAP_API(struct ldap_disptmpl *) +LDAP_CALL +ldap_first_disptmpl(struct ldap_disptmpl *tmpllist); + +LDAP_API(struct ldap_disptmpl *) +LDAP_CALL +ldap_next_disptmpl(struct ldap_disptmpl *tmpllist, + struct ldap_disptmpl *tmpl); + +LDAP_API(struct ldap_disptmpl *) +LDAP_CALL +ldap_name2template(char *name, struct ldap_disptmpl *tmpllist); + +LDAP_API(struct ldap_disptmpl *) +LDAP_CALL +ldap_oc2template(char **oclist, struct ldap_disptmpl *tmpllist); + +LDAP_API(char **) +LDAP_CALL +ldap_tmplattrs(struct ldap_disptmpl *tmpl, char **includeattrs, int exclude, + unsigned long syntaxmask); + +LDAP_API(struct ldap_tmplitem *) +LDAP_CALL +ldap_first_tmplrow(struct ldap_disptmpl *tmpl); + +LDAP_API(struct ldap_tmplitem *) +LDAP_CALL +ldap_next_tmplrow(struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row); + +LDAP_API(struct ldap_tmplitem *) +LDAP_CALL +ldap_first_tmplcol(struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row); + +LDAP_API(struct ldap_tmplitem *) +LDAP_CALL +ldap_next_tmplcol(struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row, + struct ldap_tmplitem *col); + +LDAP_API(int) +LDAP_CALL +ldap_entry2text(LDAP *ld, char *buf, LDAPMessage *entry, + struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, + writeptype writeproc, void *writeparm, char *eol, int rdncount, + unsigned long opts); + +LDAP_API(int) +LDAP_CALL +ldap_vals2text(LDAP *ld, char *buf, char **vals, char *label, int labelwidth, + unsigned long syntaxid, writeptype writeproc, void *writeparm, + char *eol, int rdncount); + +LDAP_API(int) +LDAP_CALL +ldap_entry2text_search(LDAP *ld, char *dn, char *base, LDAPMessage *entry, + struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals, + writeptype writeproc, void *writeparm, char *eol, int rdncount, + unsigned long opts); + +LDAP_API(int) +LDAP_CALL +ldap_entry2html(LDAP *ld, char *buf, LDAPMessage *entry, + struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, + writeptype writeproc, void *writeparm, char *eol, int rdncount, + unsigned long opts, char *urlprefix, char *base); + +LDAP_API(int) +LDAP_CALL +ldap_vals2html(LDAP *ld, char *buf, char **vals, char *label, int labelwidth, + unsigned long syntaxid, writeptype writeproc, void *writeparm, + char *eol, int rdncount, char *urlprefix); + +LDAP_API(int) +LDAP_CALL +ldap_entry2html_search(LDAP *ld, char *dn, char *base, LDAPMessage *entry, + struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals, + writeptype writeproc, void *writeparm, char *eol, int rdncount, + unsigned long opts, char *urlprefix); + +/* + * Search Preference Definitions + */ + +struct ldap_searchattr { + char *sa_attrlabel; + char *sa_attr; + /* max 32 matchtypes for now */ + unsigned long sa_matchtypebitmap; + char *sa_selectattr; + char *sa_selecttext; + struct ldap_searchattr *sa_next; +}; + +struct ldap_searchmatch { + char *sm_matchprompt; + char *sm_filter; + struct ldap_searchmatch *sm_next; +}; + +struct ldap_searchobj { + char *so_objtypeprompt; + unsigned long so_options; + char *so_prompt; + short so_defaultscope; + char *so_filterprefix; + char *so_filtertag; + char *so_defaultselectattr; + char *so_defaultselecttext; + struct ldap_searchattr *so_salist; + struct ldap_searchmatch *so_smlist; + struct ldap_searchobj *so_next; +}; + +#define NULLSEARCHOBJ ((struct ldap_searchobj *)0) + +/* + * global search object options + */ +#define LDAP_SEARCHOBJ_OPT_INTERNAL 0x00000001 + +#define LDAP_IS_SEARCHOBJ_OPTION_SET(so, option) \ + (((so)->so_options & option) != 0) + +#define LDAP_SEARCHPREF_VERSION_ZERO 0 +#define LDAP_SEARCHPREF_VERSION 1 + +#define LDAP_SEARCHPREF_ERR_VERSION 1 +#define LDAP_SEARCHPREF_ERR_MEM 2 +#define LDAP_SEARCHPREF_ERR_SYNTAX 3 +#define LDAP_SEARCHPREF_ERR_FILE 4 + +LDAP_API(int) +LDAP_CALL +ldap_init_searchprefs(char *file, struct ldap_searchobj **solistp); + +LDAP_API(int) +LDAP_CALL +ldap_init_searchprefs_buf(char *buf, long buflen, + struct ldap_searchobj **solistp); + +LDAP_API(void) +LDAP_CALL +ldap_free_searchprefs(struct ldap_searchobj *solist); + +LDAP_API(struct ldap_searchobj *) +LDAP_CALL +ldap_first_searchobj(struct ldap_searchobj *solist); + +LDAP_API(struct ldap_searchobj *) +LDAP_CALL +ldap_next_searchobj(struct ldap_searchobj *sollist, +struct ldap_searchobj *so); + +/* + * specific LDAP instantiations of BER types we know about + */ + +/* general stuff */ +#define LDAP_TAG_MESSAGE 0x30 /* tag is 16 + constructed bit */ +#define LDAP_TAG_MSGID 0x02 /* INTEGER */ +#define LDAP_TAG_CONTROLS 0xa0 /* context specific + constructed + 0 */ +#define LDAP_TAG_REFERRAL 0xa3 /* context specific + constructed + 3 */ +#define LDAP_TAG_NEWSUPERIOR 0x80 /* context specific + primitive + 0 */ +#define LDAP_TAG_SASL_RES_CREDS 0x87 /* context specific + primitive + 7 */ +#define LDAP_TAG_VLV_BY_INDEX 0xa0 /* context specific + constructed + 0 */ +#define LDAP_TAG_VLV_BY_VALUE 0x81 /* context specific + primitive + 1 */ +/* tag for sort control */ +#define LDAP_TAG_SK_MATCHRULE 0x80L /* context specific + primitive + 0 */ +#define LDAP_TAG_SK_REVERSE 0x81L /* context specific + primitive + 1 */ +#define LDAP_TAG_SR_ATTRTYPE 0x80L /* context specific + primitive + 0 */ + +/* possible operations a client can invoke */ +#define LDAP_REQ_BIND 0x60 /* application + constructed + 0 */ +#define LDAP_REQ_UNBIND 0x42 /* application + primitive + 2 */ +#define LDAP_REQ_SEARCH 0x63 /* application + constructed + 3 */ +#define LDAP_REQ_MODIFY 0x66 /* application + constructed + 6 */ +#define LDAP_REQ_ADD 0x68 /* application + constructed + 8 */ +#define LDAP_REQ_DELETE 0x4a /* application + primitive + 10 */ +#define LDAP_REQ_MODRDN 0x6c /* application + constructed + 12 */ +#define LDAP_REQ_MODDN 0x6c /* application + constructed + 12 */ +#define LDAP_REQ_RENAME 0x6c /* application + constructed + 12 */ +#define LDAP_REQ_COMPARE 0x6e /* application + constructed + 14 */ +#define LDAP_REQ_ABANDON 0x50 /* application + primitive + 16 */ +#define LDAP_REQ_EXTENDED 0x77 /* application + constructed + 23 */ + +/* U-M LDAP release 3.0 compatibility stuff */ +#define LDAP_REQ_UNBIND_30 0x62 +#define LDAP_REQ_DELETE_30 0x6a +#define LDAP_REQ_ABANDON_30 0x70 + +/* U-M LDAP 3.0 compatibility auth methods */ +#define LDAP_AUTH_SIMPLE_30 0xa0 /* context specific + constructed */ +#define LDAP_AUTH_KRBV41_30 0xa1 /* context specific + constructed */ +#define LDAP_AUTH_KRBV42_30 0xa2 /* context specific + constructed */ + +/* filter types */ +#define LDAP_FILTER_AND 0xa0 /* context specific + constructed + 0 */ +#define LDAP_FILTER_OR 0xa1 /* context specific + constructed + 1 */ +#define LDAP_FILTER_NOT 0xa2 /* context specific + constructed + 2 */ +#define LDAP_FILTER_EQUALITY 0xa3 /* context specific + constructed + 3 */ +#define LDAP_FILTER_SUBSTRINGS 0xa4 /* context specific + constructed + 4 */ +#define LDAP_FILTER_GE 0xa5 /* context specific + constructed + 5 */ +#define LDAP_FILTER_LE 0xa6 /* context specific + constructed + 6 */ +#define LDAP_FILTER_PRESENT 0x87 /* context specific + primitive + 7 */ +#define LDAP_FILTER_APPROX 0xa8 /* context specific + constructed + 8 */ +#define LDAP_FILTER_EXTENDED 0xa9 /* context specific + constructed + 0 */ + +/* U-M LDAP 3.0 compatibility filter types */ +#define LDAP_FILTER_PRESENT_30 0xa7 /* context specific + constructed */ + +/* substring filter component types */ +#define LDAP_SUBSTRING_INITIAL 0x80 /* context specific + primitive + 0 */ +#define LDAP_SUBSTRING_ANY 0x81 /* context specific + primitive + 1 */ +#define LDAP_SUBSTRING_FINAL 0x82 /* context specific + primitive + 2 */ + +/* U-M LDAP 3.0 compatibility substring filter component types */ +#define LDAP_SUBSTRING_INITIAL_30 0xa0 /* context specific */ +#define LDAP_SUBSTRING_ANY_30 0xa1 /* context specific */ +#define LDAP_SUBSTRING_FINAL_30 0xa2 /* context specific */ + +#endif /* _SOLARIS_SDK */ + +/* + * Function to dispose of an array of LDAPMod structures (an API extension). + * Warning: don't use this unless the mods array was allocated using the + * same memory allocator as is being used by libldap. + */ +LDAP_API(void) LDAP_CALL ldap_mods_free(LDAPMod **mods, int freemods); + +/* + * Preferred language and get_lang_values (an API extension -- + * LDAP_API_FEATURE_X_GETLANGVALUES) + * + * The following two APIs are deprecated + */ + +char **LDAP_CALL ldap_get_lang_values(LDAP *ld, LDAPMessage *entry, + const char *target, char **type); +struct berval **LDAP_CALL ldap_get_lang_values_len(LDAP *ld, + LDAPMessage *entry, const char *target, char **type); + + +/* + * Rebind callback function (an API extension) + */ +#define LDAP_OPT_REBIND_FN 0x06 /* 6 - API extension */ +#define LDAP_OPT_REBIND_ARG 0x07 /* 7 - API extension */ +typedef int (LDAP_CALL LDAP_CALLBACK LDAP_REBINDPROC_CALLBACK)(LDAP *ld, + char **dnp, char **passwdp, int *authmethodp, int freeit, void *arg); +LDAP_API(void) LDAP_CALL ldap_set_rebind_proc(LDAP *ld, + LDAP_REBINDPROC_CALLBACK *rebindproc, void *arg); + +/* + * Thread function callbacks (an API extension -- + * LDAP_API_FEATURE_X_THREAD_FUNCTIONS). + */ +#define LDAP_OPT_THREAD_FN_PTRS 0x05 /* 5 - API extension */ + +/* + * Thread callback functions: + */ +typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_ALLOC_CALLBACK)(void); +typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_FREE_CALLBACK)(void *m); +typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_LOCK_CALLBACK)(void *m); +typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_UNLOCK_CALLBACK)(void *m); +typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_GET_ERRNO_CALLBACK)(void); +typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SET_ERRNO_CALLBACK)(int e); +typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_GET_LDERRNO_CALLBACK)( + char **matchedp, char **errmsgp, void *arg); +typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SET_LDERRNO_CALLBACK)(int err, + char *matched, char *errmsg, void *arg); + +/* + * Structure to hold thread function pointers: + */ +struct ldap_thread_fns { + LDAP_TF_MUTEX_ALLOC_CALLBACK *ltf_mutex_alloc; + LDAP_TF_MUTEX_FREE_CALLBACK *ltf_mutex_free; + LDAP_TF_MUTEX_LOCK_CALLBACK *ltf_mutex_lock; + LDAP_TF_MUTEX_UNLOCK_CALLBACK *ltf_mutex_unlock; + LDAP_TF_GET_ERRNO_CALLBACK *ltf_get_errno; + LDAP_TF_SET_ERRNO_CALLBACK *ltf_set_errno; + LDAP_TF_GET_LDERRNO_CALLBACK *ltf_get_lderrno; + LDAP_TF_SET_LDERRNO_CALLBACK *ltf_set_lderrno; + void *ltf_lderrno_arg; +}; + +/* + * Client side sorting of entries (an API extension -- + * LDAP_API_FEATURE_X_CLIENT_SIDE_SORT) + */ +/* + * Client side sorting callback functions: + */ +typedef const struct berval *(LDAP_C LDAP_CALLBACK + LDAP_KEYGEN_CALLBACK)(void *arg, LDAP *ld, LDAPMessage *entry); +typedef int (LDAP_C LDAP_CALLBACK + LDAP_KEYCMP_CALLBACK)(void *arg, const struct berval *, + const struct berval *); +typedef void (LDAP_C LDAP_CALLBACK + LDAP_KEYFREE_CALLBACK)(void *arg, const struct berval *); +typedef int (LDAP_C LDAP_CALLBACK + LDAP_CMP_CALLBACK)(const char *val1, const char *val2); +typedef int (LDAP_C LDAP_CALLBACK + LDAP_VALCMP_CALLBACK)(const char **val1p, const char **val2p); + +/* + * Client side sorting functions: + */ +int LDAP_CALL ldap_multisort_entries(LDAP *ld, LDAPMessage **chain, + char **attr, LDAP_CMP_CALLBACK *cmp); +int LDAP_CALL ldap_sort_entries(LDAP *ld, LDAPMessage **chain, + char *attr, LDAP_CMP_CALLBACK *cmp); +int LDAP_CALL ldap_sort_values(LDAP *ld, char **vals, + LDAP_VALCMP_CALLBACK *cmp); +int LDAP_C LDAP_CALLBACK ldap_sort_strcasecmp(const char **a, + const char **b); + + +/* + * Filter functions and definitions (an API extension -- + * LDAP_API_FEATURE_X_FILTER_FUNCTIONS) + */ +/* + * Structures, constants, and types for filter utility routines: + */ +typedef struct ldap_filt_info { + char *lfi_filter; + char *lfi_desc; + int lfi_scope; /* LDAP_SCOPE_BASE, etc */ + int lfi_isexact; /* exact match filter? */ + struct ldap_filt_info *lfi_next; +} LDAPFiltInfo; + +#define LDAP_FILT_MAXSIZ 1024 + +typedef struct ldap_filt_list LDAPFiltList; /* opaque filter list handle */ +typedef struct ldap_filt_desc LDAPFiltDesc; /* opaque filter desc handle */ + +/* + * Filter utility functions: + */ +LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_init_getfilter(char *fname); +LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_init_getfilter_buf(char *buf, + ssize_t buflen); +LDAP_API(LDAPFiltInfo *) LDAP_CALL ldap_getfirstfilter(LDAPFiltDesc *lfdp, + char *tagpat, char *value); +LDAP_API(LDAPFiltInfo *) LDAP_CALL ldap_getnextfilter(LDAPFiltDesc *lfdp); +int LDAP_CALL ldap_set_filter_additions(LDAPFiltDesc *lfdp, + char *prefix, char *suffix); +int LDAP_CALL ldap_create_filter(char *buf, unsigned long buflen, + char *pattern, char *prefix, char *suffix, char *attr, + char *value, char **valwords); +LDAP_API(void) LDAP_CALL ldap_getfilter_free(LDAPFiltDesc *lfdp); + + +/* + * Friendly mapping structure and routines (an API extension) + */ +typedef struct friendly { + char *f_unfriendly; + char *f_friendly; +} *FriendlyMap; +char *LDAP_CALL ldap_friendly_name(char *filename, char *name, + FriendlyMap *map); +LDAP_API(void) LDAP_CALL ldap_free_friendlymap(FriendlyMap *map); + + +/* + * In Memory Cache (an API extension -- LDAP_API_FEATURE_X_MEMCACHE) + */ +typedef struct ldapmemcache LDAPMemCache; /* opaque in-memory cache handle */ + +int LDAP_CALL ldap_memcache_init(unsigned long ttl, + unsigned long size, char **baseDNs, struct ldap_thread_fns *thread_fns, + LDAPMemCache **cachep); +int LDAP_CALL ldap_memcache_set(LDAP *ld, LDAPMemCache *cache); +int LDAP_CALL ldap_memcache_get(LDAP *ld, LDAPMemCache **cachep); +LDAP_API(void) LDAP_CALL ldap_memcache_flush(LDAPMemCache *cache, char *dn, + int scope); +LDAP_API(void) LDAP_CALL ldap_memcache_destroy(LDAPMemCache *cache); +LDAP_API(void) LDAP_CALL ldap_memcache_update(LDAPMemCache *cache); + +/* + * Server reconnect (an API extension). + */ +#define LDAP_OPT_RECONNECT 0x62 /* 98 - API extension */ + +/* + * Asynchronous I/O (an API extension). + */ +/* + * This option enables completely asynchronous IO. It works by using ioctl() + * on the fd, (or tlook()) + */ +#define LDAP_OPT_ASYNC_CONNECT 0x63 /* 99 - API extension */ + +/* + * I/O function callbacks option (an API extension -- + * LDAP_API_FEATURE_X_IO_FUNCTIONS). + * Use of the extended I/O functions instead is recommended; see above. + */ +#define LDAP_OPT_IO_FN_PTRS 0x0B /* 11 - API extension */ + +/* + * Extended I/O function callbacks option (an API extension -- + * LDAP_API_FEATURE_X_EXTIO_FUNCTIONS). + */ +#define LDAP_X_OPT_EXTIO_FN_PTRS (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F00) + /* 0x4000 + 0x0F00 = 0x4F00 = 20224 - API extension */ + + + +/* + * generalized bind + */ +/* + * Authentication methods: + */ +#define LDAP_AUTH_NONE 0x00 +#define LDAP_AUTH_SIMPLE 0x80 +#define LDAP_AUTH_SASL 0xa3 +int LDAP_CALL ldap_bind(LDAP *ld, const char *who, + const char *passwd, int authmethod); +int LDAP_CALL ldap_bind_s(LDAP *ld, const char *who, + const char *cred, int method); + +/* + * experimental DN format support + */ +char **LDAP_CALL ldap_explode_dns(const char *dn); +int LDAP_CALL ldap_is_dns_dn(const char *dn); + +#ifdef _SOLARIS_SDK +char *ldap_dns_to_dn(char *dns_name, int *nameparts); +#endif + + +/* + * user friendly naming/searching routines + */ +typedef int (LDAP_C LDAP_CALLBACK LDAP_CANCELPROC_CALLBACK)(void *cl); +int LDAP_CALL ldap_ufn_search_c(LDAP *ld, char *ufn, + char **attrs, int attrsonly, LDAPMessage **res, + LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm); +int LDAP_CALL ldap_ufn_search_ct(LDAP *ld, char *ufn, + char **attrs, int attrsonly, LDAPMessage **res, + LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm, + char *tag1, char *tag2, char *tag3); +int LDAP_CALL ldap_ufn_search_s(LDAP *ld, char *ufn, + char **attrs, int attrsonly, LDAPMessage **res); +LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_ufn_setfilter(LDAP *ld, char *fname); +LDAP_API(void) LDAP_CALL ldap_ufn_setprefix(LDAP *ld, char *prefix); +int LDAP_C ldap_ufn_timeout(void *tvparam); + +/* + * functions and definitions that have been replaced by new improved ones + */ +/* + * Use ldap_get_option() with LDAP_OPT_API_INFO and an LDAPAPIInfo structure + * instead of ldap_version(). The use of this API is deprecated. + */ +typedef struct _LDAPVersion { + int sdk_version; /* Version of the SDK, * 100 */ + int protocol_version; /* Highest protocol version supported, * 100 */ + int SSL_version; /* SSL version if this SDK supports it, * 100 */ + int security_level; /* highest level available */ + int reserved[4]; +} LDAPVersion; +#define LDAP_SECURITY_NONE 0 +int LDAP_CALL ldap_version(LDAPVersion *ver); + +/* use ldap_create_filter() instead of ldap_build_filter() */ +LDAP_API(void) LDAP_CALL ldap_build_filter(char *buf, size_t buflen, + char *pattern, char *prefix, char *suffix, char *attr, + char *value, char **valwords); +/* use ldap_set_filter_additions() instead of ldap_setfilteraffixes() */ +LDAP_API(void) LDAP_CALL ldap_setfilteraffixes(LDAPFiltDesc *lfdp, + char *prefix, char *suffix); + +/* older result types a server can return -- use LDAP_RES_MODDN instead */ +#define LDAP_RES_MODRDN LDAP_RES_MODDN +#define LDAP_RES_RENAME LDAP_RES_MODDN + +/* older error messages */ +#define LDAP_AUTH_METHOD_NOT_SUPPORTED LDAP_STRONG_AUTH_NOT_SUPPORTED + +/* end of unsupported functions */ + +#ifdef _SOLARIS_SDK + +/* SSL Functions */ + +/* + * these three defines resolve the SSL strength + * setting auth weak, diables all cert checking + * the CNCHECK tests for the man in the middle hack + */ +#define LDAPSSL_AUTH_WEAK 0 +#define LDAPSSL_AUTH_CERT 1 +#define LDAPSSL_AUTH_CNCHECK 2 + +/* + * Initialize LDAP library for SSL + */ +LDAP * LDAP_CALL ldapssl_init(const char *defhost, int defport, + int defsecure); + +/* + * Install I/O routines to make SSL over LDAP possible. + * Use this after ldap_init() or just use ldapssl_init() instead. + */ +int LDAP_CALL ldapssl_install_routines(LDAP *ld); + + +/* + * The next three functions initialize the security code for SSL + * The first one ldapssl_client_init() does initialization for SSL only + * The next one supports ldapssl_clientauth_init() intializes security + * for SSL for client authentication. The third function initializes + * security for doing SSL with client authentication, and PKCS, that is, + * the third function initializes the security module database(secmod.db). + * The parameters are as follows: + * const char *certdbpath - path to the cert file. This can be a shortcut + * to the directory name, if so cert7.db will be postfixed to the string. + * void *certdbhandle - Normally this is NULL. This memory will need + * to be freed. + * int needkeydb - boolean. Must be ! = 0 if client Authentification + * is required + * char *keydbpath - path to the key database. This can be a shortcut + * to the directory name, if so key3.db will be postfixed to the string. + * void *keydbhandle - Normally this is NULL, This memory will need + * to be freed + * int needsecmoddb - boolean. Must be ! = 0 to assure that the correct + * security module is loaded into memory + * char *secmodpath - path to the secmod. This can be a shortcut to the + * directory name, if so secmod.db will be postfixed to the string. + * + * These three functions are mutually exclusive. You can only call + * one. This means that, for a given process, you must call the + * appropriate initialization function for the life of the process. + */ + + +/* + * Initialize the secure parts (Security and SSL) of the runtime for use + * by a client application. This is only called once. + */ +int LDAP_CALL ldapssl_client_init( + const char *certdbpath, void *certdbhandle); + +/* + * Initialize the secure parts (Security and SSL) of the runtime for use + * by a client application that may want to do SSL client authentication. + */ +int LDAP_CALL ldapssl_clientauth_init( + const char *certdbpath, void *certdbhandle, + const int needkeydb, const char *keydbpath, void *keydbhandle); + +/* + * Initialize the secure parts (Security and SSL) of the runtime for use + * by a client application that may want to do SSL client authentication. + */ +int LDAP_CALL ldapssl_advclientauth_init( + const char *certdbpath, void *certdbhandle, + const int needkeydb, const char *keydbpath, void *keydbhandle, + const int needsecmoddb, const char *secmoddbpath, + const int sslstrength); + +/* + * get a meaningful error string back from the security library + * this function should be called, if ldap_err2string doesn't + * identify the error code. + */ +const char *LDAP_CALL ldapssl_err2string(const int prerrno); + +/* + * Enable SSL client authentication on the given ld. + */ +int LDAP_CALL ldapssl_enable_clientauth(LDAP *ld, char *keynickname, + char *keypasswd, char *certnickname); + +typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_TOKEN_CALLBACK) + (void *context, char **tokenname); +typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_PIN_CALLBACK) + (void *context, const char *tokenname, char **tokenpin); +typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTPATH_CALLBACK) + (void *context, char **certpath); +typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_KEYPATH_CALLBACK) + (void *context, char **keypath); +typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_MODPATH_CALLBACK) + (void *context, char **modulepath); +typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTNAME_CALLBACK) + (void *context, char **certname); +typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK) + (void *context, char **filename); + +#define PKCS_STRUCTURE_ID 1 +struct ldapssl_pkcs_fns { + int local_structure_id; + void *local_data; + LDAP_PKCS_GET_CERTPATH_CALLBACK *pkcs_getcertpath; + LDAP_PKCS_GET_CERTNAME_CALLBACK *pkcs_getcertname; + LDAP_PKCS_GET_KEYPATH_CALLBACK *pkcs_getkeypath; + LDAP_PKCS_GET_MODPATH_CALLBACK *pkcs_getmodpath; + LDAP_PKCS_GET_PIN_CALLBACK *pkcs_getpin; + LDAP_PKCS_GET_TOKEN_CALLBACK *pkcs_gettokenname; + LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK *pkcs_getdonglefilename; + +}; + + +int LDAP_CALL ldapssl_pkcs_init(const struct ldapssl_pkcs_fns *pfns); + +/* end of SSL functions */ +#endif /* _SOLARIS_SDK */ + +/* SASL options */ +#define LDAP_OPT_X_SASL_MECH 0x6100 +#define LDAP_OPT_X_SASL_REALM 0x6101 +#define LDAP_OPT_X_SASL_AUTHCID 0x6102 +#define LDAP_OPT_X_SASL_AUTHZID 0x6103 +#define LDAP_OPT_X_SASL_SSF 0x6104 /* read-only */ +#define LDAP_OPT_X_SASL_SSF_EXTERNAL 0x6105 /* write-only */ +#define LDAP_OPT_X_SASL_SECPROPS 0x6106 /* write-only */ +#define LDAP_OPT_X_SASL_SSF_MIN 0x6107 +#define LDAP_OPT_X_SASL_SSF_MAX 0x6108 +#define LDAP_OPT_X_SASL_MAXBUFSIZE 0x6109 + +/* + * ldap_interactive_bind_s Interaction flags + * Interactive: prompt always - REQUIRED + */ +#define LDAP_SASL_INTERACTIVE 1U + +/* + * V3 SASL Interaction Function Callback Prototype + * when using SASL, interact is pointer to sasl_interact_t + * should likely passed in a control (and provided controls) + */ +typedef int (LDAP_SASL_INTERACT_PROC) + (LDAP *ld, unsigned flags, void* defaults, void *interact); + +int LDAP_CALL ldap_sasl_interactive_bind_s(LDAP *ld, const char *dn, + const char *saslMechanism, LDAPControl **serverControls, + LDAPControl **clientControls, unsigned flags, + LDAP_SASL_INTERACT_PROC *proc, void *defaults); + +#ifdef __cplusplus +} +#endif + +#endif /* _LDAP_H */ diff --git a/usr/src/head/libelf.h b/usr/src/head/libelf.h new file mode 100644 index 0000000000..7193a508ad --- /dev/null +++ b/usr/src/head/libelf.h @@ -0,0 +1,235 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _LIBELF_H +#define _LIBELF_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */ + +#include <sys/types.h> +#include <sys/elf.h> + + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined(_ILP32) && (_FILE_OFFSET_BITS != 32) +#error "large files are not supported by libelf" +#endif + + +#undef _ +#ifdef __STDC__ +typedef void Elf_Void; +#define _(a) a +#else +typedef char Elf_Void; +#define _(a) () +#undef const +#define const +#endif + + +/* + * Commands + */ +typedef enum { + ELF_C_NULL = 0, /* must be first, 0 */ + ELF_C_READ, + ELF_C_WRITE, + ELF_C_CLR, + ELF_C_SET, + ELF_C_FDDONE, + ELF_C_FDREAD, + ELF_C_RDWR, + ELF_C_WRIMAGE, + ELF_C_IMAGE, + ELF_C_NUM /* must be last */ +} Elf_Cmd; + + +/* + * Flags + */ +#define ELF_F_DIRTY 0x1 +#define ELF_F_LAYOUT 0x4 + + +/* + * File types + */ +typedef enum { + ELF_K_NONE = 0, /* must be first, 0 */ + ELF_K_AR, + ELF_K_COFF, + ELF_K_ELF, + ELF_K_NUM /* must be last */ +} Elf_Kind; + + +/* + * Translation types + */ +typedef enum { + ELF_T_BYTE = 0, /* must be first, 0 */ + ELF_T_ADDR, + ELF_T_DYN, + ELF_T_EHDR, + ELF_T_HALF, + ELF_T_OFF, + ELF_T_PHDR, + ELF_T_RELA, + ELF_T_REL, + ELF_T_SHDR, + ELF_T_SWORD, + ELF_T_SYM, + ELF_T_WORD, + ELF_T_VDEF, + ELF_T_VNEED, + ELF_T_SXWORD, + ELF_T_XWORD, + ELF_T_SYMINFO, + ELF_T_NOTE, + ELF_T_MOVE, + ELF_T_MOVEP, + ELF_T_CAP, + ELF_T_NUM /* must be last */ +} Elf_Type; + + +typedef struct Elf Elf; +typedef struct Elf_Scn Elf_Scn; + + +/* + * Archive member header + */ +typedef struct { + char *ar_name; + time_t ar_date; + uid_t ar_uid; + gid_t ar_gid; + mode_t ar_mode; + off_t ar_size; + char *ar_rawname; +} Elf_Arhdr; + + +/* + * Archive symbol table + */ +typedef struct { + char *as_name; + size_t as_off; + unsigned long as_hash; +} Elf_Arsym; + + +/* + * Data descriptor + */ +typedef struct { + Elf_Void *d_buf; + Elf_Type d_type; + size_t d_size; + off_t d_off; /* offset into section */ + size_t d_align; /* alignment in section */ + unsigned d_version; /* elf version */ +} Elf_Data; + + +/* + * Function declarations + */ +Elf *elf_begin _((int, Elf_Cmd, Elf *)); +int elf_cntl _((Elf *, Elf_Cmd)); +int elf_end _((Elf *)); +const char *elf_errmsg _((int)); +int elf_errno _((void)); +void elf_fill _((int)); +unsigned elf_flagdata _((Elf_Data *, Elf_Cmd, unsigned)); +unsigned elf_flagehdr _((Elf *, Elf_Cmd, unsigned)); +unsigned elf_flagelf _((Elf *, Elf_Cmd, unsigned)); +unsigned elf_flagphdr _((Elf *, Elf_Cmd, unsigned)); +unsigned elf_flagscn _((Elf_Scn *, Elf_Cmd, unsigned)); +unsigned elf_flagshdr _((Elf_Scn *, Elf_Cmd, unsigned)); +size_t elf32_fsize _((Elf_Type, size_t, unsigned)); +Elf_Arhdr *elf_getarhdr _((Elf *)); +Elf_Arsym *elf_getarsym _((Elf *, size_t *)); +off_t elf_getbase _((Elf *)); +Elf_Data *elf_getdata _((Elf_Scn *, Elf_Data *)); +Elf32_Ehdr *elf32_getehdr _((Elf *)); +char *elf_getident _((Elf *, size_t *)); +Elf32_Phdr *elf32_getphdr _((Elf *)); +Elf_Scn *elf_getscn _((Elf *elf, size_t)); +Elf32_Shdr *elf32_getshdr _((Elf_Scn *)); +int elf_getshnum _((Elf *, size_t *)); +int elf_getshstrndx _((Elf *, size_t *)); +unsigned long elf_hash _((const char *)); +long elf32_checksum _((Elf *)); +Elf_Kind elf_kind _((Elf *)); +Elf *elf_memory _((char *, size_t)); +size_t elf_ndxscn _((Elf_Scn *)); +Elf_Data *elf_newdata _((Elf_Scn *)); +Elf32_Ehdr *elf32_newehdr _((Elf *)); +Elf32_Phdr *elf32_newphdr _((Elf *, size_t)); +Elf_Scn *elf_newscn _((Elf *)); +Elf_Scn *elf_nextscn _((Elf *, Elf_Scn *)); +Elf_Cmd elf_next _((Elf *)); +size_t elf_rand _((Elf *, size_t)); +Elf_Data *elf_rawdata _((Elf_Scn *, Elf_Data *)); +char *elf_rawfile _((Elf *, size_t *)); +char *elf_strptr _((Elf *, size_t, size_t)); +off_t elf_update _((Elf *, Elf_Cmd)); +unsigned elf_version _((unsigned)); +Elf_Data *elf32_xlatetof _((Elf_Data *, const Elf_Data *, unsigned)); +Elf_Data *elf32_xlatetom _((Elf_Data *, const Elf_Data *, unsigned)); + +#if defined(_LP64) || defined(_LONGLONG_TYPE) +size_t elf64_fsize _((Elf_Type, size_t, unsigned)); +Elf64_Ehdr *elf64_getehdr _((Elf *)); +Elf64_Phdr *elf64_getphdr _((Elf *)); +Elf64_Shdr *elf64_getshdr _((Elf_Scn *)); +long elf64_checksum _((Elf *)); +Elf64_Ehdr *elf64_newehdr _((Elf *)); +Elf64_Phdr *elf64_newphdr _((Elf *, size_t)); +Elf_Data *elf64_xlatetof _((Elf_Data *, const Elf_Data *, unsigned)); +Elf_Data *elf64_xlatetom _((Elf_Data *, const Elf_Data *, unsigned)); +#endif /* (defined(_LP64) || defined(_LONGLONG_TYPE) */ + +#undef _ + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBELF_H */ diff --git a/usr/src/head/libgen.h b/usr/src/head/libgen.h new file mode 100644 index 0000000000..bded08539a --- /dev/null +++ b/usr/src/head/libgen.h @@ -0,0 +1,240 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * declarations of functions found in libgen + */ + +#ifndef _LIBGEN_H +#define _LIBGEN_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2.4.2.8 */ + +#include <sys/feature_tests.h> + +#include <sys/types.h> +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +#include <time.h> +#include <stdio.h> +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __STDC__ +extern char *basename(char *); +#else +extern char *basename(); +#endif + +#ifdef __STDC__ +extern char *dirname(char *); +#else +extern char *dirname(); +#endif + +#if !defined(_XPG6) || defined(__EXTENSIONS__) + +#ifdef __STDC__ +extern char *regcmp(const char *, ...); +#else +extern char *regcmp(); +#endif + +#ifdef __STDC__ +extern char *regex(const char *, const char *, ...); +#else +extern char *regex(); +#endif + +#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ + +#ifdef _REENTRANT + +#ifdef __STDC__ +extern char **____loc1(void); +#else +extern char **____loc1(); +#endif /* __STDC__ */ +#define __loc1 (*(____loc1())) +#elif !defined(_XPG6) || defined(__EXTENSIONS__) +extern char *__loc1; /* Marked LEGACY in XPG5 and removed in XPG6 */ +#endif /* _REENTRANT */ + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) + +#ifdef __STDC__ +extern char *bgets(char *, size_t, FILE *, char *); +#else +extern char *bgets(); +#endif + +#ifdef __STDC__ +extern size_t bufsplit(char *, size_t, char **); +#else +extern size_t bufsplit(); +#endif + +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname copylist copylist64 +#else +#define copylist copylist64 +#endif +#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ + +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname copylist64 copylist +#else +#define copylist64 copylist +#endif +#endif /* _LP64 && _LARGEFILE64_SOURCE */ + +#ifdef __STDC__ +extern char *copylist(const char *, off_t *); +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern char *copylist64(const char *, off64_t *); +#endif /* _LARGEFILE64_SOURCE... */ +#else +extern char *copylist(); +#ifdef _LARGEFILE64_SOURCE +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern char *copylist64(); +#endif /* _LARGEFILE64_SOURCE... */ +#endif +#endif + +#ifdef __STDC__ +extern int eaccess(const char *, int); +#else +extern int eaccess(); +#endif + +#ifdef __STDC__ +extern int gmatch(const char *, const char *); +#else +extern int gmatch(); +#endif + +#ifdef __STDC__ +extern int isencrypt(const char *, size_t); +#else +extern int isencrypt(); +#endif + +#ifdef __STDC__ +extern int mkdirp(const char *, mode_t); +#else +extern int mkdirp(); +#endif + +#ifdef __STDC__ +extern int p2open(const char *, FILE *[2]); +#else +extern int p2open(); +#endif + +#ifdef __STDC__ +extern int p2close(FILE *[2]); +#else +extern int p2close(); +#endif + +#ifdef __STDC__ +extern char *pathfind(const char *, const char *, const char *); +#else +extern char *pathfind(); +#endif + +#ifdef _REENTRANT +#define __i_size (*(___i_size())) +#else +extern int __i_size; +#endif + +#ifdef __STDC__ +extern int rmdirp(char *, char *); +#else +extern int rmdirp(); +#endif + +#ifdef __STDC__ +extern char *strcadd(char *, const char *); +#else +extern char *strcadd(); +#endif + +#ifdef __STDC__ +extern char *strccpy(char *, const char *); +#else +extern char *strccpy(); +#endif + +#ifdef __STDC__ +extern char *streadd(char *, const char *, const char *); +#else +extern char *streadd(); +#endif + +#ifdef __STDC__ +extern char *strecpy(char *, const char *, const char *); +#else +extern char *strecpy(); +#endif + +#ifdef __STDC__ +extern int strfind(const char *, const char *); +#else +extern int strfind(); +#endif + +#ifdef __STDC__ +extern char *strrspn(const char *, const char *); +#else +extern char *strrspn(); +#endif + +#ifdef __STDC__ +extern char *strtrns(const char *, const char *, const char *, char *); +#else +extern char *strtrns(); +#endif + +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBGEN_H */ diff --git a/usr/src/head/libintl.h b/usr/src/head/libintl.h new file mode 100644 index 0000000000..9c8ca23cf5 --- /dev/null +++ b/usr/src/head/libintl.h @@ -0,0 +1,124 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Libintl is a library of advanced internationalization functions. */ + +#ifndef _LIBINTL_H +#define _LIBINTL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/isa_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * wchar_t is a built-in type in standard C++ and as such is not + * defined here when using standard C++. However, the GNU compiler + * fixincludes utility nonetheless creates it's own version of this + * header for use by gcc and g++. In that version it adds a redundant + * guard for __cplusplus. To avoid the creation of a gcc/g++ specific + * header we need to include the following magic comment: + * + * we must use the C++ compiler's type + * + * The above comment should not be removed or changed until GNU + * gcc/fixinc/inclhack.def is updated to bypass this header. + */ +#if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__)) +#ifndef _WCHAR_T +#define _WCHAR_T +#if defined(_LP64) +typedef int wchar_t; +#else +typedef long wchar_t; +#endif +#endif /* !_WCHAR_T */ +#endif /* !defined(__cplusplus) ... */ + +#define TEXTDOMAINMAX 256 + +#ifdef __STDC__ +extern char *dcgettext(const char *, const char *, const int); +extern char *dgettext(const char *, const char *); +extern char *gettext(const char *); +extern char *textdomain(const char *); +extern char *bindtextdomain(const char *, const char *); + +/* + * LI18NUX 2000 Globalization Specification Version 1.0 + * with Amendment 2 + */ +extern char *dcngettext(const char *, const char *, + const char *, unsigned long int, int); +extern char *dngettext(const char *, const char *, + const char *, unsigned long int); +extern char *ngettext(const char *, const char *, unsigned long int); +extern char *bind_textdomain_codeset(const char *, const char *); + +/* Word handling functions --- requires dynamic linking */ +/* Warning: these are experimental and subject to change. */ +extern int wdinit(void); +extern int wdchkind(wchar_t); +extern int wdbindf(wchar_t, wchar_t, int); +extern wchar_t *wddelim(wchar_t, wchar_t, int); +extern wchar_t mcfiller(void); +extern int mcwrap(void); + +#else +extern char *dcgettext(); +extern char *dgettext(); +extern char *gettext(); +extern char *textdomain(); +extern char *bindtextdomain(); + +/* + * LI18NUX 2000 Globalization Specification Version 1.0 + * with Amendment 2 + */ +extern char *dcngettext(); +extern char *dngettext(); +extern char *ngettext(); +extern char *bind_textdomain_codeset(); + +/* Word handling functions --- requires dynamic linking */ +/* Warning: these are experimental and subject to change. */ +extern int wdinit(); +extern int wdchkind(); +extern int wdbindf(); +extern wchar_t *wddelim(); +extern wchar_t mcfiller(); +extern int mcwrap(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBINTL_H */ diff --git a/usr/src/head/libw.h b/usr/src/head/libw.h new file mode 100644 index 0000000000..5203bb2ef5 --- /dev/null +++ b/usr/src/head/libw.h @@ -0,0 +1,57 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _LIBW_H +#define _LIBW_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +#include <stdlib.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _EUCWIDTH_T +#define _EUCWIDTH_T +typedef struct { + short int _eucw1, _eucw2, _eucw3; /* EUC width */ + short int _scrw1, _scrw2, _scrw3; /* screen width */ + short int _pcw; /* WIDE_CHAR width */ + char _multibyte; /* 1=multi-byte, 0=single-byte */ +} eucwidth_t; +#endif + +#ifdef __STDC__ +void getwidth(eucwidth_t *); +#else +void getwidth(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBW_H */ diff --git a/usr/src/head/libzonecfg.h b/usr/src/head/libzonecfg.h new file mode 100644 index 0000000000..e5c3f9a451 --- /dev/null +++ b/usr/src/head/libzonecfg.h @@ -0,0 +1,329 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _LIBZONECFG_H +#define _LIBZONECFG_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Zone configuration header file. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* sys/socket.h is required by net/if.h, which has a constant needed here */ +#include <sys/param.h> +#include <sys/fstyp.h> +#include <sys/mount.h> +#include <priv.h> +#include <netinet/in.h> +#include <sys/socket.h> +#include <net/if.h> +#include <stdio.h> +#include <rctl.h> +#include <zone.h> + +#define ZONE_ID_UNDEFINED -1 + +#define Z_OK 0 +#define Z_EMPTY_DOCUMENT 1 /* XML doc root element is null */ +#define Z_WRONG_DOC_TYPE 2 /* top-level XML doc element != zone */ +#define Z_BAD_PROPERTY 3 /* libxml-level property problem */ +#define Z_TEMP_FILE 4 /* problem creating temporary file */ +#define Z_SAVING_FILE 5 /* libxml error saving or validating */ +#define Z_NO_ENTRY 6 /* no such entry */ +#define Z_BOGUS_ZONE_NAME 7 /* illegal zone name */ +#define Z_REQD_RESOURCE_MISSING 8 /* required resource missing */ +#define Z_REQD_PROPERTY_MISSING 9 /* required property missing */ +#define Z_BAD_HANDLE 10 /* bad document handle */ +#define Z_NOMEM 11 /* out of memory (like ENOMEM) */ +#define Z_INVAL 12 /* invalid argument (like EINVAL) */ +#define Z_ACCES 13 /* permission denied (like EACCES) */ +#define Z_TOO_BIG 14 /* string won't fit in char array */ +#define Z_MISC_FS 15 /* miscellaneous file-system error */ +#define Z_NO_ZONE 16 /* no such zone */ +#define Z_NO_RESOURCE_TYPE 17 /* no/wrong resource type */ +#define Z_NO_RESOURCE_ID 18 /* no/wrong resource id */ +#define Z_NO_PROPERTY_TYPE 19 /* no/wrong property type */ +#define Z_NO_PROPERTY_ID 20 /* no/wrong property id */ +#define Z_RESOURCE_EXISTS 21 /* resource already exists */ +#define Z_INVALID_DOCUMENT 22 /* libxml can't validate against DTD */ +#define Z_ID_IN_USE 23 /* add_index conflict */ +#define Z_NO_SUCH_ID 24 /* delete_index: no old ID */ +#define Z_UPDATING_INDEX 25 /* add/modify/delete_index problem */ +#define Z_LOCKING_FILE 26 /* problem locking index file */ +#define Z_UNLOCKING_FILE 27 /* problem unlocking index file */ +#define Z_SYSTEM 28 /* consult errno instead */ +#define Z_INSUFFICIENT_SPEC 29 /* resource insufficiently specified */ +#define Z_RESOLVED_PATH 34 /* resolved path mismatch */ +#define Z_IPV6_ADDR_PREFIX_LEN 35 /* IPv6 address prefix length needed */ +#define Z_BOGUS_ADDRESS 36 /* not IPv[4|6] address or host name */ + +#define ZONE_STATE_CONFIGURED 0 +#define ZONE_STATE_INCOMPLETE 1 +#define ZONE_STATE_INSTALLED 2 +#define ZONE_STATE_READY 3 +#define ZONE_STATE_RUNNING 4 +#define ZONE_STATE_SHUTTING_DOWN 5 +#define ZONE_STATE_DOWN 6 + +#define ZONE_STATE_MAXSTRLEN 14 + +#define LIBZONECFG_PATH "libzonecfg.so.1" + +#define ZONE_CONFIG_ROOT "/etc/zones" +#define ZONE_INDEX_FILE ZONE_CONFIG_ROOT "/index" + +/* + * The integer field expresses the current values on a get. + * On a put, it represents the new values if >= 0 or "don't change" if < 0. + */ +struct zoneent { + char zone_name[ZONENAME_MAX]; /* name of the zone */ + int zone_state; /* configured | incomplete | installed */ + char zone_path[MAXPATHLEN]; +}; + +typedef struct zone_dochandle *zone_dochandle_t; /* opaque handle */ + +typedef uint_t zone_state_t; + +typedef struct zone_fsopt { + struct zone_fsopt *zone_fsopt_next; + char zone_fsopt_opt[MAX_MNTOPT_STR]; +} zone_fsopt_t; + +struct zone_fstab { + char zone_fs_special[MAXPATHLEN]; /* special file */ + char zone_fs_dir[MAXPATHLEN]; /* mount point */ + char zone_fs_type[FSTYPSZ]; /* e.g. ufs */ + zone_fsopt_t *zone_fs_options; /* mount options */ + char zone_fs_raw[MAXPATHLEN]; /* device to fsck */ +}; + +struct zone_nwiftab { + char zone_nwif_address[INET6_ADDRSTRLEN]; + char zone_nwif_physical[LIFNAMSIZ]; +}; + +struct zone_devtab { + char zone_dev_match[MAXPATHLEN]; +}; + +struct zone_rctlvaltab { + char zone_rctlval_priv[MAXNAMELEN]; + char zone_rctlval_limit[MAXNAMELEN]; + char zone_rctlval_action[MAXNAMELEN]; + struct zone_rctlvaltab *zone_rctlval_next; +}; + +struct zone_rctltab { + char zone_rctl_name[MAXNAMELEN]; + struct zone_rctlvaltab *zone_rctl_valptr; +}; + +struct zone_attrtab { + char zone_attr_name[MAXNAMELEN]; + char zone_attr_type[MAXNAMELEN]; + char zone_attr_value[2 * BUFSIZ]; +}; + +/* + * Basic configuration management routines. + */ +extern zone_dochandle_t zonecfg_init_handle(void); +extern int zonecfg_get_handle(char *, zone_dochandle_t); +extern int zonecfg_get_snapshot_handle(char *, zone_dochandle_t); +extern int zonecfg_check_handle(zone_dochandle_t); +extern void zonecfg_fini_handle(zone_dochandle_t); +extern int zonecfg_destroy(const char *); +extern int zonecfg_destroy_snapshot(char *); +extern int zonecfg_save(zone_dochandle_t); +extern int zonecfg_create_snapshot(char *); +extern char *zonecfg_strerror(int); +extern int zonecfg_access(const char *, int); + +/* + * Zone name, path to zone directory, autoboot setting and pool. + */ +extern int zonecfg_get_name(zone_dochandle_t, char *, size_t); +extern int zonecfg_set_name(zone_dochandle_t, char *); +extern int zonecfg_get_zonepath(zone_dochandle_t, char *, size_t); +extern int zonecfg_set_zonepath(zone_dochandle_t, char *); +extern int zonecfg_get_autoboot(zone_dochandle_t, boolean_t *); +extern int zonecfg_set_autoboot(zone_dochandle_t, boolean_t); +extern int zonecfg_get_pool(zone_dochandle_t, char *, size_t); +extern int zonecfg_set_pool(zone_dochandle_t, char *); + +/* + * Filesystem configuration. + */ +extern int zonecfg_add_filesystem(zone_dochandle_t, struct zone_fstab *); +extern int zonecfg_delete_filesystem(zone_dochandle_t, + struct zone_fstab *); +extern int zonecfg_modify_filesystem(zone_dochandle_t, + struct zone_fstab *, struct zone_fstab *); +extern int zonecfg_lookup_filesystem(zone_dochandle_t, + struct zone_fstab *); +extern int zonecfg_add_ipd(zone_dochandle_t, struct zone_fstab *); +extern int zonecfg_delete_ipd(zone_dochandle_t, struct zone_fstab *); +extern int zonecfg_modify_ipd(zone_dochandle_t, + struct zone_fstab *, struct zone_fstab *); +extern int zonecfg_lookup_ipd(zone_dochandle_t, struct zone_fstab *); +extern int zonecfg_add_fs_option(struct zone_fstab *, char *); +extern int zonecfg_remove_fs_option(struct zone_fstab *, char *); +extern void zonecfg_free_fs_option_list(zone_fsopt_t *); +extern int zonecfg_find_mounts(char *, int(*)(const char *, void *), + void *); + +/* + * Network interface configuration. + */ +extern int zonecfg_add_nwif(zone_dochandle_t, struct zone_nwiftab *); +extern int zonecfg_delete_nwif(zone_dochandle_t, struct zone_nwiftab *); +extern int zonecfg_modify_nwif(zone_dochandle_t, struct zone_nwiftab *, + struct zone_nwiftab *); +extern int zonecfg_lookup_nwif(zone_dochandle_t, struct zone_nwiftab *); + +/* + * Device configuration and rule matching. + */ +extern int zonecfg_add_dev(zone_dochandle_t, struct zone_devtab *); +extern int zonecfg_delete_dev(zone_dochandle_t, struct zone_devtab *); +extern int zonecfg_modify_dev(zone_dochandle_t, struct zone_devtab *, + struct zone_devtab *); +extern int zonecfg_lookup_dev(zone_dochandle_t, struct zone_devtab *); +extern int zonecfg_match_dev(zone_dochandle_t, char *, + struct zone_devtab *); + +/* + * Resource control configuration. + */ +extern int zonecfg_add_rctl(zone_dochandle_t, struct zone_rctltab *); +extern int zonecfg_delete_rctl(zone_dochandle_t, struct zone_rctltab *); +extern int zonecfg_modify_rctl(zone_dochandle_t, struct zone_rctltab *, + struct zone_rctltab *); +extern int zonecfg_lookup_rctl(zone_dochandle_t, struct zone_rctltab *); +extern int zonecfg_add_rctl_value(struct zone_rctltab *, + struct zone_rctlvaltab *); +extern int zonecfg_remove_rctl_value(struct zone_rctltab *, + struct zone_rctlvaltab *); +extern void zonecfg_free_rctl_value_list(struct zone_rctlvaltab *); + +/* + * Generic attribute configuration and type/value extraction. + */ +extern int zonecfg_add_attr(zone_dochandle_t, struct zone_attrtab *); +extern int zonecfg_delete_attr(zone_dochandle_t, struct zone_attrtab *); +extern int zonecfg_modify_attr(zone_dochandle_t, struct zone_attrtab *, + struct zone_attrtab *); +extern int zonecfg_lookup_attr(zone_dochandle_t, struct zone_attrtab *); +extern int zonecfg_get_attr_boolean(const struct zone_attrtab *, + boolean_t *); +extern int zonecfg_get_attr_int(const struct zone_attrtab *, int64_t *); +extern int zonecfg_get_attr_string(const struct zone_attrtab *, char *, + size_t); +extern int zonecfg_get_attr_uint(const struct zone_attrtab *, uint64_t *); + +/* + * '*ent' iterator routines. + */ +extern int zonecfg_setfsent(zone_dochandle_t); +extern int zonecfg_getfsent(zone_dochandle_t, struct zone_fstab *); +extern int zonecfg_endfsent(zone_dochandle_t); +extern int zonecfg_setipdent(zone_dochandle_t); +extern int zonecfg_getipdent(zone_dochandle_t, struct zone_fstab *); +extern int zonecfg_endipdent(zone_dochandle_t); +extern int zonecfg_setnwifent(zone_dochandle_t); +extern int zonecfg_getnwifent(zone_dochandle_t, struct zone_nwiftab *); +extern int zonecfg_endnwifent(zone_dochandle_t); +extern int zonecfg_setdevent(zone_dochandle_t); +extern int zonecfg_getdevent(zone_dochandle_t, struct zone_devtab *); +extern int zonecfg_enddevent(zone_dochandle_t); +extern int zonecfg_setattrent(zone_dochandle_t); +extern int zonecfg_getattrent(zone_dochandle_t, struct zone_attrtab *); +extern int zonecfg_endattrent(zone_dochandle_t); +extern int zonecfg_setrctlent(zone_dochandle_t); +extern int zonecfg_getrctlent(zone_dochandle_t, struct zone_rctltab *); +extern int zonecfg_endrctlent(zone_dochandle_t); + +/* + * Privilege-related functions. + */ +extern int zonecfg_get_privset(priv_set_t *); + +/* + * Index update routines. + */ +extern int zonecfg_add_index(char *, char *); +extern int zonecfg_delete_index(char *); + +/* + * Higher-level routines. + */ +extern int zone_get_rootpath(char *, char *, size_t); +extern int zone_get_zonepath(char *, char *, size_t); +extern int zone_get_state(char *, zone_state_t *); +extern int zone_set_state(char *, zone_state_t); +extern char *zone_state_str(zone_state_t); + +/* + * Iterator for configured zones. + */ +extern FILE *setzoneent(void); +extern char *getzoneent(FILE *); +extern struct zoneent *getzoneent_private(FILE *); +extern void endzoneent(FILE *); + +/* + * File-system-related convenience functions. + */ +extern boolean_t zonecfg_valid_fs_type(const char *); + +/* + * Network-related convenience functions. + */ +extern boolean_t zonecfg_same_net_address(char *, char *); +extern int zonecfg_valid_net_address(char *, struct lifreq *); + +/* + * Rctl-related common functions. + */ +extern boolean_t zonecfg_is_rctl(const char *); +extern boolean_t zonecfg_valid_rctlname(const char *); +extern boolean_t zonecfg_valid_rctlblk(const rctlblk_t *); +extern boolean_t zonecfg_valid_rctl(const char *, const rctlblk_t *); +extern int zonecfg_construct_rctlblk(const struct zone_rctlvaltab *, + rctlblk_t *); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBZONECFG_H */ diff --git a/usr/src/head/limits.h b/usr/src/head/limits.h new file mode 100644 index 0000000000..ac026c1c02 --- /dev/null +++ b/usr/src/head/limits.h @@ -0,0 +1,327 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _LIMITS_H +#define _LIMITS_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.34 */ + +#include <sys/feature_tests.h> +#include <sys/isa_defs.h> +#include <iso/limits_iso.h> + +/* + * Include fixed width type limits as proposed by the ISO/JTC1/SC22/WG14 C + * committee's working draft for the revision of the current ISO C standard, + * ISO/IEC 9899:1990 Programming language - C. These are not currently + * required by any standard but constitute a useful, general purpose set + * of type definitions and limits which is namespace clean with respect to + * all standards. + */ +#if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ + defined(__XOPEN_OR_POSIX) +#include <sys/int_limits.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ + defined(__XOPEN_OR_POSIX) + +#define SSIZE_MAX LONG_MAX /* max value of an "ssize_t" */ + +/* + * ARG_MAX is calculated as follows: + * NCARGS - space for other stuff on initial stack + * like aux vectors, saved registers, etc.. + */ +#define _ARG_MAX32 1048320 /* max length of args to exec 32-bit program */ +#define _ARG_MAX64 2096640 /* max length of args to exec 64-bit program */ +#ifdef _LP64 +#define ARG_MAX _ARG_MAX64 /* max length of arguments to exec */ +#else /* _LP64 */ +#define ARG_MAX _ARG_MAX32 /* max length of arguments to exec */ +#endif /* _LP64 */ + +#ifndef MAX_CANON +#define MAX_CANON 256 /* max bytes in line for canonical processing */ +#endif + +#ifndef MAX_INPUT +#define MAX_INPUT 512 /* max size of a char input buffer */ +#endif + +#define NGROUPS_MAX 16 /* max number of groups for a user */ + +#ifndef PATH_MAX +#define PATH_MAX 1024 /* max # of characters in a path name */ +#endif + +#define SYMLINK_MAX 1024 /* max # of characters a symlink can contain */ + +#define PIPE_BUF 5120 /* max # bytes atomic in write to a pipe */ + +#ifndef TMP_MAX +#define TMP_MAX 17576 /* 26 * 26 * 26 */ +#endif + +/* + * POSIX conformant definitions - An implementation may define + * other symbols which reflect the actual implementation. Alternate + * definitions may not be as restrictive as the POSIX definitions. + */ +#define _POSIX_AIO_LISTIO_MAX 2 +#define _POSIX_AIO_MAX 1 +#define _POSIX_ARG_MAX 4096 +#ifdef _XPG6 +#define _POSIX_CHILD_MAX 25 +#else +#define _POSIX_CHILD_MAX 6 /* POSIX.1-1990 default */ +#endif +#define _POSIX_CLOCKRES_MIN 20000000 +#define _POSIX_DELAYTIMER_MAX 32 +#define _POSIX_LINK_MAX 8 +#define _POSIX_MAX_CANON 255 +#define _POSIX_MAX_INPUT 255 +#define _POSIX_MQ_OPEN_MAX 8 +#define _POSIX_MQ_PRIO_MAX 32 +#define _POSIX_NAME_MAX 14 +#ifdef _XPG6 +#define _POSIX_NGROUPS_MAX 8 +#define _POSIX_OPEN_MAX 20 +#define _POSIX_PATH_MAX 256 +#else /* POSIX.1-1990 defaults */ +#define _POSIX_NGROUPS_MAX 0 +#define _POSIX_OPEN_MAX 16 +#define _POSIX_PATH_MAX 255 +#endif +#define _POSIX_PIPE_BUF 512 +#define _POSIX_RTSIG_MAX 8 +#define _POSIX_SEM_NSEMS_MAX 256 +#define _POSIX_SEM_VALUE_MAX 32767 +#define _POSIX_SIGQUEUE_MAX 32 +#define _POSIX_SSIZE_MAX 32767 +#define _POSIX_STREAM_MAX 8 +#define _POSIX_TIMER_MAX 32 +#ifdef _XPG6 +#define _POSIX_TZNAME_MAX 6 +#else +#define _POSIX_TZNAME_MAX 3 /* POSIX.1-1990 default */ +#endif +/* POSIX.1c conformant */ +#define _POSIX_LOGIN_NAME_MAX 9 +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +#define _POSIX_THREAD_KEYS_MAX 128 +#define _POSIX_THREAD_THREADS_MAX 64 +#define _POSIX_TTY_NAME_MAX 9 +/* UNIX 03 conformant */ +#define _POSIX_HOST_NAME_MAX 255 +#define _POSIX_RE_DUP_MAX 255 +#define _POSIX_SYMLINK_MAX 255 +#define _POSIX_SYMLOOP_MAX 8 + +/* + * POSIX.2 and XPG4-XSH4 conformant definitions + */ + +#define _POSIX2_BC_BASE_MAX 99 +#define _POSIX2_BC_DIM_MAX 2048 +#define _POSIX2_BC_SCALE_MAX 99 +#define _POSIX2_BC_STRING_MAX 1000 +#define _POSIX2_COLL_WEIGHTS_MAX 2 +#define _POSIX2_EXPR_NEST_MAX 32 +#define _POSIX2_LINE_MAX 2048 +#define _POSIX2_RE_DUP_MAX 255 +/* UNIX 03 conformant */ +#define _POSIX2_CHARCLASS_NAME_MAX 14 + +#define BC_BASE_MAX _POSIX2_BC_BASE_MAX +#define BC_DIM_MAX _POSIX2_BC_DIM_MAX +#define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX +#define BC_STRING_MAX _POSIX2_BC_STRING_MAX +#define COLL_WEIGHTS_MAX 10 +#define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX +#define LINE_MAX _POSIX2_LINE_MAX +#if !defined(_XPG6) +#define RE_DUP_MAX _POSIX2_RE_DUP_MAX +#else +#define RE_DUP_MAX _POSIX_RE_DUP_MAX +#endif /* !defined(_XPG6) */ + +#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \ + defined(_XOPEN_SOURCE) + +/* + * For dual definitions for PASS_MAX and sysconf.c + */ +#define _PASS_MAX_XPG 8 /* old standards PASS_MAX */ +#define _PASS_MAX 256 /* modern Solaris PASS_MAX */ + +#if defined(_XPG3) && !defined(_XPG6) +#define PASS_MAX _PASS_MAX_XPG /* max # of characters in a password */ +#else /* XPG6 or just Solaris */ +#define PASS_MAX _PASS_MAX /* max # of characters in a password */ +#endif /* defined(_XPG3) && !defined(_XPG6) */ + +#define CHARCLASS_NAME_MAX _POSIX2_CHARCLASS_NAME_MAX + +#define NL_ARGMAX 9 /* max value of "digit" in calls to the */ + /* NLS printf() and scanf() */ +#define NL_LANGMAX 14 /* max # of bytes in a LANG name */ +#define NL_MSGMAX 32767 /* max message number */ +#define NL_NMAX 1 /* max # bytes in N-to-1 mapping characters */ +#define NL_SETMAX 255 /* max set number */ +#define NL_TEXTMAX 2048 /* max set number */ +#define NZERO 20 /* default process priority */ + +#define WORD_BIT 32 /* # of bits in a "word" or "int" */ +#if defined(_LP64) +#define LONG_BIT 64 /* # of bits in a "long" */ +#else /* _ILP32 */ +#define LONG_BIT 32 /* # of bits in a "long" */ +#endif + +/* Marked as LEGACY in SUSv2 and removed in UNIX 03 */ +#ifndef _XPG6 +#define DBL_DIG 15 /* digits of precision of a "double" */ +#define DBL_MAX 1.7976931348623157081452E+308 /* max decimal value */ + /* of a double */ +#define FLT_DIG 6 /* digits of precision of a "float" */ +#define FLT_MAX 3.4028234663852885981170E+38F /* max decimal value */ + /* of a "float" */ +#endif + +/* Marked as LEGACY in SUSv1 and removed in SUSv2 */ +#ifndef _XPG5 +#define DBL_MIN 2.2250738585072013830903E-308 /* min decimal value */ + /* of a double */ +#define FLT_MIN 1.1754943508222875079688E-38F /* min decimal value */ + /* of a float */ +#endif + +#endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */ + +#define _XOPEN_IOV_MAX 16 /* max # iovec/process with readv()/writev() */ +#define _XOPEN_NAME_MAX 255 /* max # bytes in filename excluding null */ +#define _XOPEN_PATH_MAX 1024 /* max # bytes in a pathname */ + +#define IOV_MAX _XOPEN_IOV_MAX + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) + +#define FCHR_MAX 1048576 /* max size of a file in bytes */ +#define PID_MAX 999999 /* max value for a process ID */ + +/* + * POSIX 1003.1a, section 2.9.5, table 2-5 contains [NAME_MAX] and the + * related text states: + * + * A definition of one of the values from Table 2-5 shall be omitted from the + * <limits.h> on specific implementations where the corresponding value is + * equal to or greater than the stated minimum, but where the value can vary + * depending on the file to which it is applied. The actual value supported for + * a specific pathname shall be provided by the pathconf() (5.7.1) function. + * + * This is clear that any machine supporting multiple file system types + * and/or a network can not include this define, regardless of protection + * by the _POSIX_SOURCE and _POSIX_C_SOURCE flags. + * + * #define NAME_MAX 14 + */ + +#define CHILD_MAX 25 /* max # of processes per user id */ +#ifndef OPEN_MAX +#define OPEN_MAX 256 /* max # of files a process can have open */ +#endif + +#define PIPE_MAX 5120 /* max # bytes written to a pipe in a write */ + +#define STD_BLK 1024 /* # bytes in a physical I/O block */ +#define UID_MAX 2147483647 /* max value for a user or group ID */ +#define USI_MAX 4294967295 /* max decimal value of an "unsigned" */ +#define SYSPID_MAX 1 /* max pid of system processes */ + +#ifndef SYS_NMLN /* also defined in sys/utsname.h */ +#define SYS_NMLN 257 /* 4.0 size of utsname elements */ +#endif + +#ifndef CLK_TCK + +#if !defined(_CLOCK_T) || __cplusplus >= 199711L +#define _CLOCK_T +typedef long clock_t; +#endif /* !_CLOCK_T */ + +extern long _sysconf(int); /* System Private interface to sysconf() */ +#define CLK_TCK ((clock_t)_sysconf(3)) /* 3 is _SC_CLK_TCK */ + +#endif /* CLK_TCK */ + +#define LOGNAME_MAX 8 /* max # of characters in a login name */ +#define TTYNAME_MAX 128 /* max # of characters in a tty name */ + +#endif /* if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */ + +/* + * POSIX.1c Note: + * PTHREAD_STACK_MIN is also defined in <pthread.h>. + */ +#if defined(__EXTENSIONS__) || (_POSIX_C_SOURCE >= 199506L) +#include <sys/unistd.h> + +#if !defined(_SIZE_T) || __cplusplus >= 199711L +#define _SIZE_T +#if defined(_LP64) || defined(_I32LPx) +typedef unsigned long size_t; /* size of something in bytes */ +#else +typedef unsigned int size_t; /* (historical version) */ +#endif +#endif /* _SIZE_T */ + +extern long _sysconf(int); /* System Private interface to sysconf() */ + +#define PTHREAD_STACK_MIN ((size_t)_sysconf(_SC_THREAD_STACK_MIN)) +/* Added for UNIX98 conformance */ +#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS +#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX +#define PTHREAD_THREADS_MAX _POSIX_THREAD_THREADS_MAX +#endif /* defined(__EXTENSIONS__) || (_POSIX_C_SOURCE >= 199506L) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _LIMITS_H */ diff --git a/usr/src/head/linenum.h b/usr/src/head/linenum.h new file mode 100644 index 0000000000..1229ab529d --- /dev/null +++ b/usr/src/head/linenum.h @@ -0,0 +1,62 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _LINENUM_H +#define _LINENUM_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * There is one line number entry for every + * "breakpointable" source line in a section. + * Line numbers are grouped on a per function + * basis; the first entry in a function grouping + * will have l_lnno = 0 and in place of physical + * address will be the symbol table index of + * the function name. + */ +struct lineno +{ + union + { + long l_symndx; /* sym. table index of function name */ + /* iff l_lnno == 0 */ + long l_paddr; /* (physical) address of line number */ + } l_addr; + unsigned short l_lnno; /* line number */ +}; + +#define LINENO struct lineno +#define LINESZ 6 /* sizeof(LINENO) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _LINENUM_H */ diff --git a/usr/src/head/link.h b/usr/src/head/link.h new file mode 100644 index 0000000000..8fd331466c --- /dev/null +++ b/usr/src/head/link.h @@ -0,0 +1,264 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _LINK_H +#define _LINK_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/link.h> + +#ifndef _ASM +#include <libelf.h> +#include <sys/types.h> +#include <dlfcn.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASM +/* + * ld support library calls + */ +#ifdef __STDC__ +extern uint_t ld_version(uint_t); +extern void ld_start(const char *, const Elf32_Half, const char *); +extern void ld_atexit(int); +extern void ld_file(const char *, const Elf_Kind, int, Elf *); +extern void ld_input_section(const char *, Elf32_Shdr **, Elf32_Word, + Elf_Data *, Elf *, uint_t *); +extern void ld_input_done(uint_t *); +extern void ld_section(const char *, Elf32_Shdr *, Elf32_Word, + Elf_Data *, Elf *); + +#if defined(_LP64) || defined(_LONGLONG_TYPE) +extern void ld_start64(const char *, const Elf64_Half, const char *); +extern void ld_atexit64(int); +extern void ld_file64(const char *, const Elf_Kind, int, Elf *); +extern void ld_input_section64(const char *, Elf64_Shdr **, Elf64_Word, + Elf_Data *, Elf *, uint_t *); +extern void ld_section64(const char *, Elf64_Shdr *, Elf64_Word, + Elf_Data *, Elf *); + +#endif /* (defined(_LP64) || defined(_LONGLONG_TYPE) */ +#else +extern void ld_version(); +extern void ld_start(); +extern void ld_atexit(); +extern void ld_file(); +extern void ld_input_section(); +extern void ld_input_done(); +extern void ld_section(); + +#if defined(_LP64) || defined(_LONGLONG_TYPE) +extern void ld_start64(); +extern void ld_atexit64(); +extern void ld_file64(); +extern void ld_section64(); + +#endif /* (defined(_LP64) || defined(_LONGLONG_TYPE) */ +#endif /* __STDC__ */ + +/* + * ld_version() version values + */ +#define LD_SUP_VNONE 0 +#define LD_SUP_VERSION1 1 +#define LD_SUP_VERSION2 2 +#define LD_SUP_VCURRENT LD_SUP_VERSION2 + + +/* + * flags passed to ld support calls + */ +#define LD_SUP_DERIVED 0x1 /* derived filename */ +#define LD_SUP_INHERITED 0x2 /* file inherited from .so DT_NEEDED */ +#define LD_SUP_EXTRACTED 0x4 /* file extracted from archive */ +#endif + +#define LM_ID_BASE 0x00 +#define LM_ID_LDSO 0x01 +#define LM_ID_NUM 2 + +#define LM_ID_NEWLM 0xff /* create a new link-map */ + + +/* + * Run-Time Link-Edit Auditing + */ +#define LAV_NONE 0 +#define LAV_VERSION1 1 +#define LAV_VERSION2 2 +#define LAV_VERSION3 3 +#define LAV_CURRENT LAV_VERSION3 +#define LAV_NUM 4 + +/* + * Flags that can be or'd into the la_objopen() return code + */ +#define LA_FLG_BINDTO 0x0001 /* audit symbinds TO this object */ +#define LA_FLG_BINDFROM 0x0002 /* audit symbinding FROM this object */ + +/* + * Flags that can be or'd into the 'flags' argument of la_symbind() + */ +#define LA_SYMB_NOPLTENTER 0x0001 /* disable pltenter for this symbol */ +#define LA_SYMB_NOPLTEXIT 0x0002 /* disable pltexit for this symbol */ +#define LA_SYMB_STRUCTCALL 0x0004 /* this function call passes a */ + /* structure as it's return code */ +#define LA_SYMB_DLSYM 0x0008 /* this symbol bindings is due to */ + /* a call to dlsym() */ +#define LA_SYMB_ALTVALUE 0x0010 /* alternate symbol binding returned */ + /* by la_symbind() */ + +/* + * Flags that describe the object passed to la_objsearch() + */ +#define LA_SER_ORIG 0x001 /* original (needed) name */ +#define LA_SER_LIBPATH 0x002 /* LD_LIBRARY_PATH entry prepended */ +#define LA_SER_RUNPATH 0x004 /* runpath entry prepended */ +#define LA_SER_CONFIG 0x008 /* configuration entry prepended */ +#define LA_SER_DEFAULT 0x040 /* default path prepended */ +#define LA_SER_SECURE 0x080 /* default (secure) path prepended */ + +#define LA_SER_MASK 0xfff /* mask of known flags */ + +/* + * Flags that describe the la_activity() + */ +#define LA_ACT_CONSISTENT 0x00 /* add/deletion of objects complete */ +#define LA_ACT_ADD 0x01 /* objects being added */ +#define LA_ACT_DELETE 0x02 /* objects being deleted */ + + +#ifndef _KERNEL +#ifndef _ASM + +#if defined(_LP64) +typedef long lagreg_t; +#else +typedef int lagreg_t; +#endif + +struct _la_sparc_regs { + lagreg_t lr_rego0; + lagreg_t lr_rego1; + lagreg_t lr_rego2; + lagreg_t lr_rego3; + lagreg_t lr_rego4; + lagreg_t lr_rego5; + lagreg_t lr_rego6; + lagreg_t lr_rego7; +}; + +#if defined(_LP64) +typedef struct _la_sparc_regs La_sparcv9_regs; +typedef struct { + lagreg_t lr_rsp; + lagreg_t lr_rbp; + lagreg_t lr_rdi; /* arg1 */ + lagreg_t lr_rsi; /* arg2 */ + lagreg_t lr_rdx; /* arg3 */ + lagreg_t lr_rcx; /* arg4 */ + lagreg_t lr_r8; /* arg5 */ + lagreg_t lr_r9; /* arg6 */ +} La_amd64_regs; +#else +typedef struct _la_sparc_regs La_sparcv8_regs; +typedef struct { + lagreg_t lr_esp; + lagreg_t lr_ebp; +} La_i86_regs; +#endif + +#if !defined(_SYS_INT_TYPES_H) +#if defined(_LP64) || defined(_I32LPx) +typedef unsigned long uintptr_t; +#else +typedef unsigned int uintptr_t; +#endif +#endif + + +#ifdef __STDC__ +extern uint_t la_version(uint_t); +extern void la_activity(uintptr_t *, uint_t); +extern void la_preinit(uintptr_t *); +extern char *la_objsearch(const char *, uintptr_t *, uint_t); +extern uint_t la_objopen(Link_map *, Lmid_t, uintptr_t *); +extern uint_t la_objclose(uintptr_t *); +extern int la_objfilter(uintptr_t *, const char *, uintptr_t *, + uint_t); +#if defined(_LP64) +extern uintptr_t la_amd64_pltenter(Elf64_Sym *, uint_t, uintptr_t *, + uintptr_t *, La_amd64_regs *, uint_t *, + const char *); +extern uintptr_t la_symbind64(Elf64_Sym *, uint_t, uintptr_t *, + uintptr_t *, uint_t *, const char *); +extern uintptr_t la_sparcv9_pltenter(Elf64_Sym *, uint_t, uintptr_t *, + uintptr_t *, La_sparcv9_regs *, uint_t *, + const char *); +extern uintptr_t la_pltexit64(Elf64_Sym *, uint_t, uintptr_t *, + uintptr_t *, uintptr_t, const char *); +#else /* !defined(_LP64) */ +extern uintptr_t la_symbind32(Elf32_Sym *, uint_t, uintptr_t *, + uintptr_t *, uint_t *); +extern uintptr_t la_sparcv8_pltenter(Elf32_Sym *, uint_t, uintptr_t *, + uintptr_t *, La_sparcv8_regs *, uint_t *); +extern uintptr_t la_i86_pltenter(Elf32_Sym *, uint_t, uintptr_t *, + uintptr_t *, La_i86_regs *, uint_t *); +extern uintptr_t la_pltexit(Elf32_Sym *, uint_t, uintptr_t *, + uintptr_t *, uintptr_t); +#endif /* _LP64 */ +#else /* __STDC__ */ +extern uint_t la_version(); +extern void la_preinit(); +extern uint_t la_objopen(); +extern uint_t la_objclose(); +extern int la_objfilter(); +#if defined(_LP64) +extern uintptr_t la_sparcv9_pltenter(); +extern uintptr_t la_pltexit64(); +extern uintptr_t la_symbind64(); +#else /* _ILP32 */ +extern uintptr_t la_sparcv8_pltenter(); +extern uintptr_t la_i86_pltenter(); +extern uintptr_t la_pltexit(); +extern uintptr_t la_symbind32(); +#endif /* _LP64 */ +#endif /* __STDC__ */ + + +#endif /* _ASM */ +#endif /* _KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _LINK_H */ diff --git a/usr/src/head/listen.h b/usr/src/head/listen.h new file mode 100644 index 0000000000..983fe5c266 --- /dev/null +++ b/usr/src/head/listen.h @@ -0,0 +1,138 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _LISTEN_H +#define _LISTEN_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4.3.1 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * listen.h: Include file for network listener related user programs + * + */ + +/* + * The NLPS (Network Listener Process Service) + * protocol message sent by client machines to + * a listener process to request a service on the listener's + * machine. The message is sent to "netnodename(r_nodename)" + * where r_nodename is the nodename (see uname(2)) of the + * remote host. Note that client's need not know (or care) + * about the details of this message. They use the "nls_connect(3)" + * library routine which uses this message. + * + * msg format: + * + * "id:low:high:service_code" + * + * id = "NLPS" + * low:high = version number of listener (see prot msg) + * service_code is ASCII/decimal + * + * the following prot string can be run through sprintf with a service code + * to generate the message: + * + * len = sprintf(buf,nls_prot_msg,svc_code); + * t_snd(fd, buf, len, ...); + * + * See also: listen(1), nlsrequest(3) + * + * and on the UNIX PC STARLAN NETWORK: + * See also: nlsname(3), nlsconnect(3), nlsestablish(3) + */ + +/* + * defines for compatability purposes + */ + +#define nls_prot_msg nls_v0_d +#define nls_v2_msg nls_v2_s + +static char *nls_v0_d = "NLPS:000:001:%d"; +static char *nls_v0_s = "NLPS:000:001:%s"; +static char *nls_v2_d = "NLPS:002:002:%d"; +static char *nls_v2_s = "NLPS:002:002:%s"; + +#define NLSSTART 0 +#define NLSFORMAT 2 +#define NLSUNKNOWN 3 +#define NLSDISABLED 4 + +#define SVC_CODE_SZ 14 + +/* + * Structure for handling multiple connection requests on the same stream. + */ + +struct callsave { + struct t_call *c_cp; + struct callsave *c_np; +}; + +struct call_list { + struct callsave *cl_head; + struct callsave *cl_tail; +}; + + +#define EMPTYLIST(p) (p->cl_head == (struct callsave *) NULL) + +/* + * Ridiculously high value for maximum number of connects per stream. + * Transport Provider will determine actual maximum to be used. + */ + +#define MAXCON 100 + +/* + * these are names of environment variables that the listener + * adds to the servers environment before the exec(2). + * + * the variables should be accessed via library routines. + * + * see nlsgetcall(3X) and nlsprovider(3X). + */ + +#define NLSADDR "NLSADDR" +#define NLSOPT "NLSOPT" +#define NLSUDATA "NLSUDATA" +#define NLSPROVIDER "NLSPROVIDER" + +/* + * the following variables can be accessed "normally" + */ + +#define HOME "HOME" +#define PATH "PATH" + +#ifdef __cplusplus +} +#endif + +#endif /* _LISTEN_H */ diff --git a/usr/src/head/locale.h b/usr/src/head/locale.h new file mode 100644 index 0000000000..7f6f323e2b --- /dev/null +++ b/usr/src/head/locale.h @@ -0,0 +1,63 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _LOCALE_H +#define _LOCALE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <iso/locale_iso.h> + +#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(__EXTENSIONS__) +#include <libintl.h> +#endif + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/locale_iso.h>. + */ +#if __cplusplus >= 199711L +using std::lconv; +using std::setlocale; +using std::localeconv; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define _LastCategory LC_MESSAGES /* This must be last category */ + +#define _ValidCategory(c) \ + (((int)(c) >= LC_CTYPE) && ((int)(c) <= _LastCategory) || \ + ((int)c == LC_ALL)) + +#ifdef __cplusplus +} +#endif + +#endif /* _LOCALE_H */ diff --git a/usr/src/head/macros.h b/usr/src/head/macros.h new file mode 100644 index 0000000000..6f85520caa --- /dev/null +++ b/usr/src/head/macros.h @@ -0,0 +1,111 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _MACROS_H +#define _MACROS_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3.1.7 */ + +#include <sys/types.h> +#include <sys/stat.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * numeric() is useful in while's, if's, etc., but don't use *p++ + * max() and min() depend on the types of the operands + * abs() is absolute value + */ +#define numeric(c) ((c) >= '0' && (c) <= '9') +#define max(a, b) ((a) < (b) ? (b) : (a)) +#define min(a, b) ((a) > (b) ? (b) : (a)) +#define abs(x) ((x) >= 0 ? (x) : -(x)) + +#define compare(str1, str2) strcmp((str1), (str2)) +#define equal(str1, str2) (strcmp((str1), (str2)) == 0) +#define length(str) strlen(str) +#define size(str) (strlen(str) + 1) + +/* + * The global variable Statbuf is available for use as a stat(II) + * structure. Note that "stat.h" is included here and should + * not be included elsewhere. + * Exists(file) returns 0 if the file does not exist; + * the flags word if it does (the flags word is always non-zero). + */ + +extern struct stat Statbuf; +#define exists(file) (stat(file, &Statbuf) < 0 ? 0 : Statbuf.st_mode) + +/* + * SAVE() and RSTR() use local data in nested blocks. + * Make sure that they nest cleanly. + */ +#define SAVE(name, place) { int place = name; +#define RSTR(name, place) name = place; } + +/* + * Use: DEBUG(sum,d) which becomes fprintf(stderr,"sum = %d\n",sum) + * + * Note: Sccsid[] strings are still supported but not the prefered + * method of labeling files. Use #ident. + */ +#ifdef __STDC__ +#define DEBUG(var, type) fprintf(stderr, #var "= %" #type "\n", var) +#define SCCSID(arg) static char Sccsid[] = #arg +#else +#define DEBUG(var, type) fprintf(stderr, "var = %type\n", var) +#define SCCSID(arg) static char Sccsid[] = "arg" +#endif + +/* + * Use of ERRABORT() will cause libS.a internal + * errors to cause aborts + */ +#define ERRABORT() _error() { abort(); } + +/* + * Use of USXALLOC() is required to force all calls to alloc() + * (e.g., from libS.a) to call xalloc(). + */ +#define NONBLANK(p) while (*(p) == ' ' || *(p) == '\t') (p)++ + +/* + * A global null string. + */ +extern char Null[1]; + +/* + * A global error message string. + */ +extern char Error[128]; + +#ifdef __cplusplus +} +#endif + +#endif /* _MACROS_H */ diff --git a/usr/src/head/malloc.h b/usr/src/head/malloc.h new file mode 100644 index 0000000000..bfb44b801e --- /dev/null +++ b/usr/src/head/malloc.h @@ -0,0 +1,86 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _MALLOC_H +#define _MALLOC_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */ + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Constants defining mallopt operations + */ +#define M_MXFAST 1 /* set size of blocks to be fast */ +#define M_NLBLKS 2 /* set number of block in a holding block */ +#define M_GRAIN 3 /* set number of sizes mapped to one, for */ + /* small blocks */ +#define M_KEEP 4 /* retain contents of block after a free */ + /* until another allocation */ +/* + * structure filled by + */ +struct mallinfo { + unsigned long arena; /* total space in arena */ + unsigned long ordblks; /* number of ordinary blocks */ + unsigned long smblks; /* number of small blocks */ + unsigned long hblks; /* number of holding blocks */ + unsigned long hblkhd; /* space in holding block headers */ + unsigned long usmblks; /* space in small blocks in use */ + unsigned long fsmblks; /* space in free small blocks */ + unsigned long uordblks; /* space in ordinary blocks in use */ + unsigned long fordblks; /* space in free ordinary blocks */ + unsigned long keepcost; /* cost of enabling keep option */ +}; + +#if defined(__STDC__) + +void *malloc(size_t); +void free(void *); +void *realloc(void *, size_t); +int mallopt(int, int); +struct mallinfo mallinfo(void); +void *calloc(size_t, size_t); + +#else + +void *malloc(); +void free(); +void *realloc(); +int mallopt(); +struct mallinfo mallinfo(); +void *calloc(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _MALLOC_H */ diff --git a/usr/src/head/md5.h b/usr/src/head/md5.h new file mode 100644 index 0000000000..9bedcd435a --- /dev/null +++ b/usr/src/head/md5.h @@ -0,0 +1,71 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1999 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _MD5_H +#define _MD5_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * MD5.H - header file for MD5C.C + */ + +/* + * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + * rights reserved. + * + * License to copy and use this software is granted provided that it + * is identified as the "RSA Data Security, Inc. MD5 Message-Digest + * Algorithm" in all material mentioning or referencing this software + * or this function. + * + * License is also granted to make and use derivative works provided + * that such works are identified as "derived from the RSA Data + * Security, Inc. MD5 Message-Digest Algorithm" in all material + * mentioning or referencing the derived work. + * + * RSA Data Security, Inc. makes no representations concerning either + * the merchantability of this software or the suitability of this + * software for any particular purpose. It is provided "as is" + * without express or implied warranty of any kind. + * + * These notices must be retained in any copies of any part of this + * documentation and/or software. + */ + +#include <sys/md5.h> + +#ifdef __cplusplus +extern "C" { +#endif + +void md5_calc(unsigned char *, unsigned char *, unsigned int); + +#ifdef __cplusplus +} +#endif + +#endif /* _MD5_H */ diff --git a/usr/src/head/mdmn_changelog.h b/usr/src/head/mdmn_changelog.h new file mode 100644 index 0000000000..950c4f33c5 --- /dev/null +++ b/usr/src/head/mdmn_changelog.h @@ -0,0 +1,91 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _MDMN_CHANGELOG_H +#define _MDMN_CHANGELOG_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/lvm/mdmn_commd.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define MD_MN_CHANGELOG_RECORD_REVISION 0x00010000; + +/* flags for log record entries */ +#define MD_MN_LR_INUSE 0x00000001U /* Log entry is in use */ + +#define MDMN_CLF_SNARFED 0x1 +#define MDMN_CLF_RESETCACHE 0x2 +#define MDMN_CLF_RESETLOG 0x4 +#define MDMN_CLF_RESETALL (MDMN_CLF_RESETCACHE | MDMN_CLF_RESETLOG) + + +/* changelog record entry */ +typedef struct mdmn_changelog_record { + uint_t lr_revision; + uint_t lr_flags; + mddb_recid_t lr_selfid; + md_mn_msgclass_t lr_class; + size32_t lr_msglen; + md_mn_msg_t lr_msg; +} mdmn_changelog_record_t; + +#define lr_msgtype lr_msg.msg_type +#define lr_msgid lr_msg.msg_msgid +#define lr_setno lr_msg.msg_setno + +/* ondisk version */ +typedef struct mdmn_changelog_record_od { + uint_t lr_revision; + uint_t lr_flags; + mddb_recid_t lr_selfid; + md_mn_msgclass_t lr_class; + size32_t lr_msglen; + int spare[5]; + md_mn_msg_od_t lr_od_msg; +} mdmn_changelog_record_od_t; + +#define lr_od_msgtype lr_od_msg.msg_type +#define lr_od_msgid lr_od_msg.msg_msgid +#define lr_od_setno lr_od_msg.msg_setno + + +extern int mdmn_allocate_changelog(mdsetname_t *, md_error_t *); +extern int mdmn_reset_changelog(mdsetname_t *, md_error_t *, int flags); +extern int mdmn_log_msg(md_mn_msg_t *); +extern int mdmn_unlog_msg(md_mn_msg_t *); +extern int mdmn_snarf_changelog(set_t, md_error_t *); +extern mdmn_changelog_record_t *mdmn_get_changelogrec(set_t, + md_mn_msgclass_t); + +#ifdef __cplusplus +} +#endif + +#endif /* _MDMN_CHANGELOG_H */ diff --git a/usr/src/head/memory.h b/usr/src/head/memory.h new file mode 100644 index 0000000000..a3d873719c --- /dev/null +++ b/usr/src/head/memory.h @@ -0,0 +1,70 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _MEMORY_H +#define _MEMORY_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4.1.2 */ + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) +extern void *memccpy(void *, const void *, int, size_t); +#if __cplusplus >= 199711L +namespace std { +extern const void *memchr(const void *, int, size_t); +#ifndef _MEMCHR_INLINE +#define _MEMCHR_INLINE +extern "C++" { + inline void *memchr(void * __s, int __c, size_t __n) { + return (void*)memchr((const void *) __s, __c, __n); + } +} +#endif /* _MEMCHR_INLINE */ +} /* end of namespace std */ +using std::memchr; +#else +extern void *memchr(const void *, int, size_t); +#endif +extern void *memcpy(void *, const void *, size_t); +extern void *memset(void *, int, size_t); +extern int memcmp(const void *, const void *, size_t); +#else +extern void *memccpy(); +extern void *memchr(); +extern void *memcpy(); +extern void *memset(); +extern int memcmp(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _MEMORY_H */ diff --git a/usr/src/head/meta.h b/usr/src/head/meta.h new file mode 100644 index 0000000000..1afba6cfb9 --- /dev/null +++ b/usr/src/head/meta.h @@ -0,0 +1,1866 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _META_H +#define _META_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> +#include <unistd.h> +#include <libgen.h> +#include <locale.h> +#include <time.h> +#include <assert.h> +#include <stdarg.h> +#include <signal.h> +#include <devid.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/sysmacros.h> +#include <sys/mkdev.h> +#include <sys/time.h> +#include <sys/dkio.h> +#include <sys/vtoc.h> +#include <sys/efi_partition.h> +#include <meta_basic.h> +#include <mdiox.h> +#include <metamed.h> +#include <sys/lvm/mdio.h> +#include <sys/lvm/md_mddb.h> +#include <sys/lvm/md_sp.h> +#include <sys/lvm/mdmn_commd.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* debug malloc include */ +#ifdef DEBUG_MALLOC +#ifdef _REENTRANT +die right now +#endif +#include <../lib/malloclib/malloc.h> +#endif + +/* + * useful macros + */ +#ifndef min +#define min(x, y) (((x) < (y)) ? (x) : (y)) +#endif +#ifndef max +#define max(x, y) (((x) > (y)) ? (x) : (y)) +#endif +#ifndef rounddown +#define rounddown(x, y) (((x) / (y)) * (y)) +#endif + +/* + * external names + */ + +#define METATAB "/etc/lvm/md.tab" +#define METACONF "/etc/lvm/md.cf" +#define METACONFTMP "/etc/lvm/md.cf.new" +#define META_DBCONF "/etc/lvm/mddb.cf" +#define META_DBCONFTMP "/etc/lvm/mddb.cf.new" +#define META_MNSET_NODELIST "/var/run/nodelist" +#define METALOG "/etc/lvm/md.log" +#define METALOCK "/etc/lvm/lock" +#define METADEVPATH "/etc/lvm/devpath" +#define METALOGENV "MD_LOG" +#define METAPKGROOT "/usr" +#define ADMSPECIAL "/dev/md/admin" + +#define MDB_STR "metadevice state database" + +/* default database size (4MB) */ +#define MD_DBSIZE (8192) + +/* default Multinode database size (16MB) */ +#define MD_MN_DBSIZE (32768) + +/* disk label size */ +#define VTOC_SIZE (16) + +/* maximum ctd name size (in # of digits) for printing out */ +#define CTD_FORMAT_LEN 6 + +/* Recommend timeout in seconds for RPC client creation. */ +#define MD_CLNT_CREATE_TOUT (60) + +/* + * metaclust verbosity levels and what they are for. Messages upto MC_LOG2 + * will also be logged in syslog. + */ +#define MC_LOG0 0 /* special class. log messages regardless of */ + /* debug level */ +#define MC_LOG1 1 /* log standard error messages */ +#define MC_LOG2 2 /* log metaclust step level timing messages */ +#define MC_LOG3 3 /* log per set level timing messages */ + /* intended for use in loops walking mn sets */ +#define MC_LOG4 4 /* log per device level timing messages */ + /* intended for use in loops walking devices */ +#define MC_LOG5 5 /* typically for use in deep nested loops */ + /* or in libmeta routines */ + +/* + * for meta_print* options + */ +typedef uint_t mdprtopts_t; +#define PRINT_SHORT 0x00000001 +#define PRINT_SUBDEVS 0x00000002 +#define PRINT_HEADER 0x00000004 +#define PRINT_DEBUG 0x00000008 +#define PRINT_TIMES 0x00000010 +#define PRINT_SETSTAT 0x00000020 +#define PRINT_SETSTAT_ONLY 0x00000040 +#define PRINT_FAST 0x00000080 +#define PRINT_DEVID 0x00000100 +#define PRINT_LARGEDEVICES 0x00000200 + +/* + * for meta_devadm options + */ +typedef uint_t mddevopts_t; +#define DEV_VERBOSE 0x00000001 +#define DEV_NOACTION 0x00000002 +#define DEV_LOG 0x00000004 +#define DEV_RELOAD 0x00000008 +#define DEV_UPDATE 0x00000010 +#define DEV_LOCAL_SET 0x00000020 /* update only MD_LOCAL_SET */ + +/* + * return values for meta_devadm operations + */ +#define METADEVADM_SUCCESS 0 +#define METADEVADM_ERR 1 +#define METADEVADM_DEVIDINVALID 2 +#define METADEVADM_DSKNAME_ERR 3 +#define METADEVADM_DISKMOVE 4 + +/* + * meta_check* options + */ +typedef uint_t mdchkopts_t; +#define MDCHK_ALLOW_MDDB 0x01 /* allows repliica in md's (metainit) */ +#define MDCHK_ALLOW_HS 0x02 /* allows hs in multiple hsp's (hs) */ +#define MDCHK_ALLOW_LOG 0x04 /* allows sharing of logs (trans) */ +#define MDCHK_ALLOW_REPSLICE 0x08 /* allow replica slice to be used */ +#define MDCHK_ALLOW_NODBS 0x10 /* no db replicas allowed (metadb) */ +#define MDCHK_DRVINSET 0x20 /* drive is in set (metaset) */ +#define MDCHK_SET_LOCKED 0x40 /* The set is locked */ +#define MDCHK_SET_FORCE 0x80 /* This is a forced operation */ + +/* + * meta_check_inuse options + */ +typedef uint_t mdinuseopts_t; +#define MDCHK_SWAP 0x01 /* check swap & overlap w/swap */ +#define MDCHK_DUMP 0x02 /* check dump & overlap w/dump */ +#define MDCHK_MOUNTED 0x04 /* check mounted & overlap w/mounted */ +#define MDCHK_INUSE 0xff /* check all */ + +/* + * meta* force options + */ +typedef uint_t mdforceopts_t; +#define MDFORCE_NONE 0x01 /* no extra force used */ +#define MDFORCE_LOCAL 0x02 /* force from metadb command line */ +#define MDFORCE_DS 0x04 /* force from metaset library */ +#define MDFORCE_SET_LOCKED 0x10 /* The set is locked */ + + +/* + * meta* options + */ +typedef uint_t mdcmdopts_t; +#define MDCMD_DOIT 0x0001 /* really do operation */ +#define MDCMD_FORCE 0x0002 /* force operation */ +#define MDCMD_PRINT 0x0004 /* print success messages to stdout */ +#define MDCMD_RECURSE 0x0008 /* recursive operation */ +#define MDCMD_INIT 0x0010 /* init operation */ +#define MDCMD_UPDATE 0x0020 /* update sizes used w/o DOIT mostly */ +#define MDCMD_NOLOCK 0x0040 /* lock already held, DONT acquire */ +#define MDCMD_CLUSTER_REPLACE 0x0080 /* don't resync raid */ +#define MDCMD_VERBOSE 0x0100 /* be verbose */ +#define MDCMD_USE_WHOLE_DISK 0x0200 /* repartition disk */ +#define MDCMD_DIRECT 0x0400 /* extents specified directly */ +#define MDCMD_ALLOPTION 0x0800 /* the all option is being used */ +#define MDCMD_MN_OPEN_CHECK 0x1000 /* Perform open check on all nodes */ + +/* + * meta_tab* definitions + */ +#define TAB_ARG_ALLOC 5 +#define TAB_LINE_ALLOC 10 + +typedef uint_t mdinittypes_t; +#define TAB_UNKNOWN 0x0000 +#define TAB_MDDB 0x0001 +#define TAB_HSP 0x0002 +#define TAB_STRIPE 0x0004 +#define TAB_MIRROR 0x0008 +#define TAB_RAID 0x0010 +#define TAB_TRANS 0x0020 +#define TAB_SP 0x0040 +#define TAB_MD (TAB_STRIPE | TAB_MIRROR | TAB_RAID |\ + TAB_TRANS | TAB_SP) +#define TAB_MD_HSP (TAB_MD | TAB_HSP) + +typedef struct { + mdinittypes_t type; + char *context; + char *cname; + int argc; + char **argv; + size_t alloc; + uint_t flags; /* for application use */ +} md_tab_line_t; + +typedef struct { + char *filename; + char *data; + size_t total; + size_t nlines; + md_tab_line_t *lines; + size_t alloc; +} md_tab_t; + +/* + * disk status definitions + */ +typedef struct md_disk_status_list { + struct md_disk_status_list *next; + mddrivename_t *drivenamep; + md_error_t status; +} md_disk_status_list_t; + +/* + * module name list used by meta_patch_root & meta_systemfile + */ +struct modname { + char *name; + struct modname *next; +}; + +/* + * list to be used for printing Device Relocation Information + */ +typedef struct mddevid_t { + struct mddevid_t *next; + char *ctdname; + mdkey_t key; +} mddevid_t; + +/* + * Multi-Node Diskset List + * + * we either store the IP address of the private interconnect or its name + * in the msl_node_addr member + */ +typedef struct mndiskset_membershiplist { + uint_t msl_node_id; + md_mnnode_nm_t msl_node_name; + md_mnnode_nm_t msl_node_addr; + struct mndiskset_membershiplist *next; +} mndiskset_membershiplist_t; + +/* + * client pool for rpc calls to mdcommd + */ +typedef struct md_mn_client_list { + CLIENT *mcl_clnt; + struct md_mn_client_list *mcl_next; +} md_mn_client_list_t; + +/* + * Resync thread manipulation commands. + * + * The resync thread can now be started, blocked, unblocked or killed. + * This typedef specifies the action to be taken by meta_resync.c + * routines. + */ +typedef enum { + MD_RESYNC_START = 1, + MD_RESYNC_BLOCK, + MD_RESYNC_UNBLOCK, + MD_RESYNC_KILL, + MD_RESYNC_KILL_NO_WAIT, + MD_RESYNC_FORCE_MNSTART +} md_resync_cmd_t; + + +/* + * rpc.metad macro definitions. + */ +#define METAD_SETUP_DR(cmd, id) \ + { \ + req.ur_cmd = cmd; \ + req.ur_setno = MD_LOCAL_SET; \ + req.ur_type = MDDB_USER; \ + req.ur_type2 = MDDB_UR_DR; \ + req.ur_recid = id; \ + } + +#define METAD_SETUP_NR(cmd, id) \ + { \ + req.ur_cmd = cmd; \ + req.ur_setno = MD_LOCAL_SET; \ + req.ur_type = MDDB_USER; \ + req.ur_type2 = MDDB_UR_NR; \ + req.ur_recid = id; \ + } + +#define METAD_SETUP_SR(cmd, id) \ + { \ + req.ur_cmd = cmd; \ + req.ur_setno = MD_LOCAL_SET; \ + req.ur_type = MDDB_USER; \ + req.ur_type2 = MDDB_UR_SR; \ + req.ur_recid = id; \ + } + +#define METAD_SETUP_UR(cmd, type2, id) \ + { \ + req.ur_cmd = cmd; \ + req.ur_setno = MD_LOCAL_SET; \ + req.ur_type = MDDB_USER; \ + req.ur_type2 = type2; \ + req.ur_recid = id; \ + } + +#define METAD_SETUP_LR(cmd, setno, id) \ + { \ + req.ur_cmd = cmd; \ + req.ur_setno = setno; \ + req.ur_type = MDDB_USER; \ + req.ur_type2 = MDDB_UR_LR; \ + req.ur_recid = id; \ + } + +/* + * This typedef specifies the signature of a function that + * meta_client_create_retry can use to establish an rpc connection. + * private is used to pass data from the caller of meta_client_create_retry + * to clnt_create_func. + */ +typedef CLIENT *(*clnt_create_func_t)(char *hostname, + void *private, + struct timeval *time_out); + +/* definition of the table for the different message types */ +typedef struct md_mn_msg_tbl_entry { + md_mn_msgclass_t mte_class; + void (*mte_handler) + (md_mn_msg_t *msg, uint_t flags, md_mn_result_t *res); + int (*mte_smgen) + (md_mn_msg_t *msg, md_mn_msg_t **msglist); + time_t mte_timeout; /* seconds before msg times out */ + uint_t mte_retry1; /* nretries in case of class busy */ + uint_t mte_ticks1; /* sleep nticks before retry */ + uint_t mte_retry2; /* nretries in case of comm fail */ + uint_t mte_ticks2; /* sleep nticks before retry */ +} md_mn_msg_tbl_entry_t; + +/* + * Flags for the take command + */ +#define TAKE_FORCE 0x0001 +#define TAKE_USETAG 0x0002 +#define TAKE_USEIT 0x0004 + +/* + * ignore gettext for lint so we check printf args + */ +#ifdef __lint +#define dgettext(d, s) s +#define gettext(s) s +#endif + +/* + * Defines for enabling/disabling SVM services in SMF. + */ +#define META_SMF_CORE 0x01 +#define META_SMF_DISKSET 0x02 +#define META_SMF_MN_DISKSET 0x04 +#define META_SMF_ALL 0xFF + +/* + * Defines to send/not_send addition of mddb sidenames to + * rpc.mdcommd for MN disksets. + */ +#define DB_ADDSIDENMS_NO_BCAST 0 +#define DB_ADDSIDENMS_BCAST 1 + +/* + * Defines and structures to support rpc.mdcommd. + * RPC routines in rpc.metad will be used to suspend, resume + * and reinitialize the rpc.mdcommd running on that node. + * These actions are needed when the nodelist is changing. + */ +#define COMMDCTL_SUSPEND 1 +#define COMMDCTL_RESUME 2 +#define COMMDCTL_REINIT 3 + +/* + * Defines used when joining a node to a MN diskset. + * A MN diskset is stale if < 50% mddbs are available when the first node + * joins the set. A MN diskset is stale when 50% mddbs are available when + * the first node joins the set if the mediator is unable to provide an + * extra vote. + * Once a MN set is marked stale, it stays in the stale state (even if > 50% + * mddbs are available) until all nodes are withdrawn from the diskset. + * Any new nodes joining a stale MN diskset are marked stale regardless of + * the availability of mddbs in order to keep the diskset consistent across + * all nodes. + * + * If a reconfig cycle is underway, set the reconfig flag so that rpc.metad + * clnt_locks are not enforced. Since the reconfig cycle has locked out the + * meta* commands, this is safe to do. + */ +#define MNSET_IS_STALE 1 /* Is MN set stale? */ +#define MNSET_IN_RECONFIG 2 /* Is MN set in reconfig? */ + +/* + * Structure used during reconfig step2 to aid in sychronization + * of the drives in a diskset. + */ +typedef struct md_mnsr_node { + md_mnset_record *mmn_mnsr; + md_mnnode_nm_t mmn_nodename; + int mmn_numdrives; + md_drive_desc *mmn_dd; + struct md_mnsr_node *mmn_next; +} md_mnsr_node_t; + + +/* + * meta events definitions ("meta_notify.h") + */ + +/* + * event flags + * meta_notify_createq(), (EXISTERR, PERMANENT) + * meta_notify_getev(), (WAIT) + * meta_notify_getevlist() (WAIT) + */ +#define EVFLG_WAIT 0x00000001 /* block until events are pending */ +#define EVFLG_EXISTERR 0x00000002 /* if q exists, return an error */ +#define EVFLG_PERMANENT 0x00000004 /* queue persists after process exit */ + +/* + * events are always associated with an underlying object + * This object is of one of the following types. + */ +typedef enum md_ev_objtype_t { + EVO_EMPTY = 0, + EVO_METADEV, + EVO_MIRROR, + EVO_STRIPE, + EVO_RAID5, + EVO_TRANS, + EVO_REPLICA, + EVO_HSP, + EVO_HS, + EVO_SET, + EVO_DRIVE, + EVO_HOST, + EVO_MEDIATOR, + EVO_UNSPECIFIED, + EVO_LAST +} ev_obj_t; + +/* + * Specific events are sent upon state changes + * in the underlying devices or when sent by + * user applications. These events have a unique + * type. These types map to kernel event types (sys/md_notify.h) + * + * When updating these UPDATE THE TABLE in lib/config/config.c + */ +typedef enum md_ev_id_t { + EV_UNK = 0, + EV_EMPTY, + EV_CREATE, + EV_DELETE, + EV_ADD, + EV_REMOVE, + EV_REPLACE, + EV_GROW, + EV_RENAME_SRC, + EV_RENAME_DST, + EV_MEDIATOR_ADD, + EV_MEDIATOR_DELETE, + EV_HOST_ADD, + EV_HOST_DELETE, + EV_DRIVE_ADD, + EV_DRIVE_DELETE, + EV_INIT_START, + EV_INIT_FAILED, + EV_INIT_FATAL, + EV_INIT_SUCCESS, + EV_IOERR, + EV_ERRED, + EV_LASTERRED, + EV_OK, + EV_ENABLE, + EV_RESYNC_START, + EV_RESYNC_FAILED, + EV_RESYNC_SUCCESS, + EV_RESYNC_DONE, + EV_HOTSPARED, + EV_HS_FREED, + EV_HS_CHANGED, + EV_TAKEOVER, + EV_RELEASE, + EV_OPEN_FAIL, + EV_OFFLINE, + EV_ONLINE, + EV_GROW_PENDING, + EV_DETACH, + EV_DETACHING, + EV_ATTACH, + EV_ATTACHING, + EV_CHANGE, + EV_EXCHANGE, + EV_REGEN_START, + EV_REGEN_DONE, + EV_REGEN_FAILED, + EV_USER, + EV_NOTIFY_LOST, + EV_LAST +} evid_t; + +#define EV_ALLOBJS (~0ULL) +#define EV_ALLSETS ((set_t)(~0)) + +#if !defined(_KERNEL) + +#define NOTIFY_MD(tag, set, dev, ev) \ + (void) meta_notify_sendev((tag), (set), (dev), (ev)) + +#define SE_NOTIFY(se_class, se_subclass, tag, set, dev) \ + meta_svm_sysevent((se_class), (se_subclass), (tag), (set), (dev)) + +#endif /* _KERNEL */ + +typedef struct md_ev { + ev_obj_t obj_type; + set_t setno; + evid_t ev; + u_longlong_t obj; /* usually md_dev64_t or hsp id */ + u_longlong_t uev; /* for (EV_USER) user-defined events */ +} md_ev_t; + +typedef struct md_evlist { + struct md_evlist *next; + md_ev_t *evp; +} md_evlist_t; + +/* end of meta event definitions ("meta_notify.h") */ + + +/* meta_admin.c */ +extern int open_admin(md_error_t *ep); +extern int close_admin(md_error_t *ep); +extern int meta_dev_ismeta(md_dev64_t dev); +extern int meta_get_nunits(md_error_t *ep); +extern md_dev64_t metamakedev(minor_t mnum); + +/* meta_attach.c */ +extern int meta_concat_generic(mdsetname_t *sp, mdname_t *namep, + u_longlong_t big_or_little, md_error_t *ep); +extern int meta_concat_parent(mdsetname_t *sp, mdname_t *childnp, + md_error_t *ep); + +/* meta_check.c */ +extern int meta_check_inuse(mdsetname_t *sp, mdname_t *np, + mdinuseopts_t inuse_flag, md_error_t *ep); +extern int meta_check_driveinset(mdsetname_t *sp, + mddrivename_t *dnp, md_error_t *ep); +extern int meta_check_drivemounted(mdsetname_t *sp, + mddrivename_t *dnp, md_error_t *ep); +extern int meta_check_driveswapped(mdsetname_t *sp, + mddrivename_t *dnp, md_error_t *ep); +extern int meta_check_samedrive(mdname_t *np1, mdname_t *np2, + md_error_t *ep); +extern int meta_check_overlap(char *uname, mdname_t *np1, + diskaddr_t slblk1, diskaddr_t nblks1, mdname_t *np2, + diskaddr_t slblk2, diskaddr_t nblks2, + md_error_t *ep); +extern int meta_check_inmeta(mdsetname_t *sp, mdname_t *np, + mdchkopts_t options, diskaddr_t slblk, + diskaddr_t nblks, + md_error_t *ep); +extern int meta_check_inset(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern int meta_check_root(md_error_t *ep); + + +/* meta_db.c */ +extern char *meta_devid_encode_str(ddi_devid_t devid, + char *minor_name); +extern void meta_devid_encode_str_free(char *devidstr); +extern int meta_devid_decode_str(char *devidstr, + ddi_devid_t *devidp, char **minor_namep); +extern int meta_check_inreplica(mdsetname_t *sp, mdname_t *np, + diskaddr_t slblk, diskaddr_t nblks, md_error_t *ep); +extern int meta_check_replica(mdsetname_t *sp, mdname_t *np, + mdchkopts_t options, diskaddr_t slblk, + diskaddr_t nblks, md_error_t *ep); +extern int meta_db_addsidenms(mdsetname_t *sp, mdname_t *np, + daddr_t blkno, int bcast, md_error_t *ep); +extern int meta_db_delsidenm(mdsetname_t *sp, side_t sideno, + mdname_t *np, daddr_t blkno, md_error_t *ep); +extern int meta_db_patch(char *sname, char *cname, int patch, + md_error_t *ep); +extern int meta_db_attach(mdsetname_t *sp, mdnamelist_t *db_nlp, + mdchkopts_t options, md_timeval32_t *timeval, + int dbcnt, int dbsize, char *sysfilename, + md_error_t *ep); +extern int meta_db_detach(mdsetname_t *sp, mdnamelist_t *db_nlp, + mdforceopts_t force, char *sysfilename, + md_error_t *ep); +extern void metafreereplicalist(md_replicalist_t *rlp); +extern int metareplicalist(mdsetname_t *sp, int flags, + md_replicalist_t **rlpp, md_error_t *ep); +extern void meta_sync_db_locations(mdsetname_t *sp, + md_error_t *ep); +extern int meta_setup_db_locations(md_error_t *ep); +extern daddr_t meta_db_minreplica(mdsetname_t *sp, md_error_t *ep); +extern int meta_get_replica_names(mdsetname_t *, + mdnamelist_t **, int options, md_error_t *); +extern void meta_mkdummymaster(mdsetname_t *sp, int fd, + daddr_t firstblk); +extern md_timeval32_t meta_get_lb_inittime(mdsetname_t *sp, md_error_t *ep); + +/* meta_db_balance.c */ +extern int meta_db_balance(mdsetname_t *sp, md_drive_desc *opdd, + md_drive_desc *curdd, daddr_t dbsize, + md_error_t *ep); + +/* metadevstamp.c */ +extern int getdevstamp(mddrivename_t *dnp, time_t *stamp, + md_error_t *ep); +extern int setdevstamp(mddrivename_t *dnp, time_t *stamp, + md_error_t *ep); + +/* meta_error.c */ +extern int metaioctl(int cmd, void *data, md_error_t *ep, + char *name); +extern void md_logpfx(FILE *fp); +/* PRINTFLIKE2 */ +extern char *mde_sperror(md_error_t *mdep, const char *fmt, ...); +/* PRINTFLIKE2 */ +extern void mde_perror(md_error_t *mdep, const char *fmt, ...); +/* PRINTFLIKE1 */ +extern void md_perror(const char *fmt, ...); +/* PRINTFLIKE1 */ +extern void md_eprintf(const char *fmt, ...); +extern void meta_mc_log(int level, const char *fmt, ...); + +/* meta_getdevs.c */ +extern minor_t meta_getminor(md_dev64_t dev64); +extern major_t meta_getmajor(md_dev64_t dev64); +extern md_dev64_t meta_expldev(md_dev64_t dev); +extern dev32_t meta_cmpldev(md_dev64_t dev64); + +extern int meta_getdevs(mdsetname_t *sp, mdname_t *namep, + mdnamelist_t **nlpp, md_error_t *ep); +extern int meta_getalldevs(mdsetname_t *sp, mdnamelist_t **nlpp, + int check_db, md_error_t *ep); +extern int meta_getvtoc(int fd, char *devname, + struct vtoc *vtocbufp, int *partno, + md_error_t *ep); +extern int meta_setvtoc(int fd, char *devname, + struct vtoc *vtocbufp, md_error_t *ep); +extern int meta_setmdvtoc(int fd, char *devname, + mdvtoc_t *mdvtocbufp, md_error_t *ep); +extern int meta_get_names(char *drivername, mdsetname_t *sp, + mdnamelist_t **nlpp, mdprtopts_t options, + md_error_t *ep); +extern int meta_deviceid_to_nmlist(char *search_path, + ddi_devid_t devid, char *minor_name, + devid_nmlist_t **retlist); + +/* meta_hotspares.c */ +extern int meta_get_hsp_names(mdsetname_t *sp, + mdhspnamelist_t **hspnlpp, int options, + md_error_t *ep); +extern void meta_free_hsp(md_hsp_t *hspp); +extern void meta_invalidate_hsp(mdhspname_t *hspnp); +extern md_hsp_t *meta_get_hsp(mdsetname_t *sp, mdhspname_t *hspnp, + md_error_t *ep); +extern md_hsp_t *meta_get_hsp_common(mdsetname_t *sp, + mdhspname_t *hspnp, int fast, md_error_t *ep); +extern int meta_check_inhsp(mdsetname_t *sp, mdname_t *np, + diskaddr_t slblk, diskaddr_t nblks, md_error_t *ep); +extern int meta_check_hotspare(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern char *hs_state_to_name(md_hs_t *hsp, + md_timeval32_t *tvp); +extern int meta_hsp_print(mdsetname_t *sp, mdhspname_t *hspnp, + mdnamelist_t **nlpp, char *fname, FILE *fp, + mdprtopts_t options, md_error_t *ep); +extern int metachkhsp(mdsetname_t *sp, mdhspname_t *hspnp, + md_error_t *ep); +extern int meta_hs_add(mdsetname_t *sp, mdhspname_t *hspnp, + mdnamelist_t *nlp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_hs_delete(mdsetname_t *sp, mdhspname_t *hspnp, + mdnamelist_t *nlp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_hs_replace(mdsetname_t *sp, mdhspname_t *hspnp, + mdname_t *oldnp, mdname_t *newnp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_hs_enable(mdsetname_t *sp, mdnamelist_t *nlp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_check_hsp(mdsetname_t *sp, md_hsp_t *hspp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_create_hsp(mdsetname_t *sp, md_hsp_t *hspp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_init_hsp(mdsetname_t **spp, + int argc, char *argv[], mdcmdopts_t options, + md_error_t *ep); +extern int meta_hsp_reset(mdsetname_t *sp, mdhspname_t *hspnp, + mdcmdopts_t options, md_error_t *ep); + +/* meta_init.c */ +extern int parse_interlace(char *uname, char *name, + diskaddr_t *interlacep, md_error_t *ep); +extern int meta_cook_syntax(md_error_t *ep, + md_void_errno_t errcode, char *uname, + int argc, char *argv[]); +extern int meta_setup_geom(md_unit_t *md, mdname_t *np, + mdgeom_t *geomp, uint_t write_reinstruct, + uint_t read_reinstruct, uint_t round_cyl, + md_error_t *ep); +extern int meta_adjust_geom(md_unit_t *md, mdname_t *np, + uint_t write_reinstruct, uint_t read_reinstruct, + uint_t round_cyl, md_error_t *ep); +extern int meta_init_name(mdsetname_t **spp, + int argc, char *argv[], mdcmdopts_t options, + md_error_t *ep); +extern int meta_check_devicesize(diskaddr_t total_blocks); +extern int meta_init_make_device(mdsetname_t **spp, char *uname, + md_error_t *ep); +extern mdinittypes_t meta_get_init_type(int argc, char *argv[]); + +/* meta_mdcf.c */ +extern int meta_update_md_cf(mdsetname_t *sp, md_error_t *ep); + +/* meta_med.c */ +extern int meddstealerror(md_error_t *ep, med_err_t *medep); +extern int clnt_med_null(char *hostname, md_error_t *ep); +extern int clnt_med_upd_data(md_h_t *mdhp, mdsetname_t *sp, + med_data_t *meddp, md_error_t *ep); +extern int clnt_med_get_data(md_h_t *mdhp, mdsetname_t *sp, + med_data_t *meddp, md_error_t *ep); +extern int clnt_med_get_rec(md_h_t *mdhp, mdsetname_t *sp, + med_rec_t *medrp, md_error_t *ep); +extern int clnt_med_upd_rec(md_h_t *mdhp, mdsetname_t *sp, + med_rec_t *medrp, md_error_t *ep); +extern int clnt_med_hostname(char *hostname, char **ret_hostname, + md_error_t *ep); + +extern int meta_med_hnm2ip(md_hi_arr_t *mp, md_error_t *ep); +extern int meta_h2hi(md_h_arr_t *mdhp, md_hi_arr_t *mdhip, + md_error_t *ep); +extern int meta_hi2h(md_hi_arr_t *mdhip, md_h_arr_t *mdhp, + md_error_t *ep); +extern int setup_med_cfg(mdsetname_t *sp, mddb_config_t *cp, + int force, md_error_t *ep); + +/* meta_mem.c */ +#ifdef _DEBUG_MALLOC_INC +extern void *_Malloc(char *file, int line, size_t s); +extern void *_Zalloc(char *file, int line, size_t s); +extern void *_Realloc(char *file, int line, void *p, size_t s); +extern void *_Calloc(char *file, int line, size_t n, size_t s); +extern char *_Strdup(char *file, int line, char *p); +extern void _Free(char *file, int line, void *p); +#define Malloc(s) _Malloc(__FILE__, __LINE__, (s)) +#define Zalloc(s) _Zalloc(__FILE__, __LINE__, (s)) +#define Realloc(p, s) _Realloc(__FILE__, __LINE__, (p), (s)) +#define Calloc(n, s) _Calloc(__FILE__, __LINE__, (n), (s)) +#define Strdup(p) _Strdup(__FILE__, __LINE__, (p)) +#define Free(p) _Free(__FILE__, __LINE__, (p)) +#else /* ! _DEBUG_MALLOC_INC */ +extern void *Malloc(size_t s); +extern void *Zalloc(size_t s); +extern void *Realloc(void *p, size_t s); +extern void *Calloc(size_t n, size_t s); +extern char *Strdup(char *p); +extern void Free(void *p); +#endif /* ! _DEBUG_MALLOC_INC */ + +/* meta_metad.c */ +extern int clnt_adddrvs(char *hostname, mdsetname_t *sp, + md_drive_desc *dd, md_timeval32_t timestamp, + ulong_t genid, md_error_t *ep); +extern int clnt_addhosts(char *hostname, mdsetname_t *sp, + int node_c, char **node_v, md_error_t *ep); +extern int clnt_update_namespace(char *hostname, mdsetname_t *sp, + side_t side, mddrivename_t *dnp, char *newname, + md_error_t *ep); +extern int clnt_add_drv_sidenms(char *hostname, char *this_host, + mdsetname_t *sp, md_set_desc *sd, int node_c, + char **node_v, md_error_t *ep); +extern int clnt_createset(char *hostname, mdsetname_t *sp, + md_node_nm_arr_t nodes, md_timeval32_t timestamp, + ulong_t genid, md_error_t *ep); +extern int clnt_mncreateset(char *hostname, mdsetname_t *sp, + md_mnnode_desc *nodelist, md_timeval32_t timestamp, + ulong_t genid, md_node_nm_t master_nodenm, + int master_nodeid, md_error_t *ep); +extern int clnt_joinset(char *hostname, mdsetname_t *sp, + int flags, md_error_t *ep); +extern int clnt_withdrawset(char *hostname, mdsetname_t *sp, + md_error_t *ep); +extern int clnt_deldrvs_by_devid(char *hostname, mdsetname_t *sp, + md_drive_desc *dd, md_error_t *ep); +extern int clnt_deldrvs(char *hostname, mdsetname_t *sp, + md_drive_desc *dd, md_error_t *ep); +extern int clnt_delhosts(char *hostname, mdsetname_t *sp, + int node_c, char **node_v, md_error_t *ep); +extern int clnt_delset(char *hostname, mdsetname_t *sp, + md_error_t *ep); +extern int clnt_del_drv_sidenms(char *hostname, mdsetname_t *sp, + md_error_t *ep); +extern int clnt_devinfo(char *hostname, mdsetname_t *sp, + mddrivename_t *dp, md_dev64_t *ret_dev, + time_t *ret_timestamp, md_error_t *ep); +extern int clnt_devid(char *hostname, mdsetname_t *sp, + mddrivename_t *dp, char **ret_encdevid, + md_error_t *ep); +extern int clnt_devinfo_by_devid(char *hostname, mdsetname_t *sp, + char *devidstr, md_dev64_t *retdev, + char *orig_devname, char **ret_devname, + char **ret_driver, md_error_t *ep); +extern int clnt_drvused(char *hostname, mdsetname_t *sp, + mddrivename_t *dp, md_error_t *ep); +extern void free_sr(md_set_record *sr); +extern int clnt_getset(char *hostname, char *setname, set_t setno, + md_set_record **sr, md_error_t *ep); +extern int clnt_mngetset(char *hostname, char *setname, + set_t setno, md_mnset_record **mnsr, + md_error_t *ep); +extern int clnt_hostname(char *hostname, char **ret_hostname, + md_error_t *ep); +extern int clnt_nullproc(char *hostname, md_error_t *ep); +extern int clnt_ownset(char *hostname, mdsetname_t *sp, + int *ret_bool, md_error_t *ep); +extern int clnt_setnameok(char *hostname, mdsetname_t *sp, + int *ret_bool, md_error_t *ep); +extern int clnt_setnumbusy(char *hostname, set_t setno, + int *ret_bool, md_error_t *ep); +extern int clnt_upd_dr_dbinfo(char *hostname, mdsetname_t *sp, + md_drive_desc *dd, md_error_t *ep); +extern int clnt_stimeout(char *hostname, mdsetname_t *sp, + mhd_mhiargs_t *mhiargsp, md_error_t *ep); +extern int clnt_gtimeout(char *hostname, mdsetname_t *sp, + mhd_mhiargs_t *ret_mhiargs, md_error_t *ep); +extern int clnt_upd_dr_flags(char *hostname, mdsetname_t *sp, + md_drive_desc *dd, uint_t new_flags, + md_error_t *ep); +extern int clnt_enable_sr_flags(char *hostname, mdsetname_t *sp, + uint_t new_flags, md_error_t *ep); +extern int clnt_disable_sr_flags(char *hostname, mdsetname_t *sp, + uint_t new_flags, md_error_t *ep); +extern int clnt_upd_sr_flags(char *hostname, mdsetname_t *sp, + uint_t new_flags, md_error_t *ep); +extern int clnt_upd_nr_flags(char *hostname, mdsetname_t *sp, + md_mnnode_desc *nd, uint_t flag_action, + uint_t flags, md_error_t *ep); +extern int clnt_unlock_set(char *hostname, md_setkey_t *cl_sk, + md_error_t *ep); +extern int clnt_lock_set(char *hostname, mdsetname_t *sp, + md_error_t *ep); +extern int clnt_updmeds(char *hostname, mdsetname_t *sp, + md_h_arr_t *meddp, md_error_t *ep); +extern int clnt_resnarf_set(char *hostname, set_t setno, + md_error_t *ep); +extern md_setkey_t *cl_get_setkey(set_t setno, char *setname); +extern void cl_set_setkey(md_setkey_t *cl_sk); +extern void meta_conv_drvname_new2old(o_mddrivename_t *, + mddrivename_t *); +extern void meta_conv_drvname_old2new(o_mddrivename_t *, + mddrivename_t *); +extern void meta_conv_drvdesc_new2old(o_md_drive_desc *, + md_drive_desc *); +extern void meta_conv_drvdesc_old2new(o_md_drive_desc *, + md_drive_desc *); +extern void alloc_olddrvdesc(o_md_drive_desc **, md_drive_desc *); +extern void alloc_newdrvdesc(o_md_drive_desc *, md_drive_desc **); +extern void free_olddrvdesc(o_md_drive_desc *); +extern void free_newdrvdesc(md_drive_desc *); +extern char *meta_get_devid(char *); +extern int clnt_mnsetmaster(char *hostname, mdsetname_t *sp, + md_node_nm_t master_nodenm, int master_nodeid, + md_error_t *ep); +extern int clnt_clr_mnsetlock(char *hostname, md_error_t *ep); +extern int clnt_mdcommdctl(char *hostname, int flag_action, + mdsetname_t *sp, md_mn_msgclass_t class, + uint_t flags, md_error_t *ep); +extern int clnt_mn_is_stale(char *hostname, mdsetname_t *sp, + int *ret_bool, md_error_t *ep); +extern int clnt_getdrivedesc(char *hostname, mdsetname_t *sp, + md_drive_desc **dd, md_error_t *ep); +extern void free_rem_dd(md_drive_desc *dd); +extern int clnt_upd_dr_reconfig(char *hostname, mdsetname_t *sp, + md_drive_desc *dd, md_error_t *ep); +extern int clnt_reset_mirror_owner(char *hostname, mdsetname_t *sp, + int node_c, int *node_id, md_error_t *ep); +extern int clnt_mn_susp_res_io(char *hostname, set_t setno, + int flag, md_error_t *ep); +extern int clnt_mn_mirror_resync_all(char *hostname, set_t setno, + md_error_t *ep); +extern int clnt_mn_sp_update_abr(char *hostname, set_t setno, + md_error_t *ep); + +/* meta_metad_subr.c */ +extern mddb_userreq_t *get_db_rec(md_ur_get_cmd_t cmd, set_t setno, + mddb_type_t type, uint_t type2, mddb_recid_t *idp, + md_error_t *ep); +extern void *get_ur_rec(set_t setno, md_ur_get_cmd_t cmd, + uint_t type2, mddb_recid_t *idp, md_error_t *ep); +extern void sr_validate(void); +extern void sr_del_drv(md_set_record *sr, mddb_recid_t recid); +extern int set_snarf(md_error_t *ep); +extern void sr_cache_add(md_set_record *sr); +extern void sr_cache_del(mddb_recid_t recid); +extern void dr_cache_add(md_set_record *sr, md_drive_record *dr); +extern void dr_cache_del(md_set_record *sr, mddb_recid_t recid); +extern void mnnr_cache_add(md_mnset_record *sr, + md_mnnode_record *nr); +extern void mnnr_cache_del(md_mnset_record *sr, mddb_recid_t recid); +extern int metad_isautotakebyname(char *setname); +extern int metad_isautotakebynum(set_t setno); +extern md_set_record *metad_getsetbyname(char *setname, md_error_t *ep); +extern md_set_record *metad_getsetbynum(set_t setno, md_error_t *ep); +extern void commitset(md_set_record *sr, int inc_genid, + md_error_t *ep); +extern md_set_record *setdup(md_set_record *sr); +extern md_mnset_record *mnsetdup(md_mnset_record *mnsr); +extern md_drive_record *drdup(md_drive_record *dr); +extern md_mnnode_record *nrdup(md_mnnode_record *nr); +extern md_drive_desc *dd_list_dup(md_drive_desc *dd); +extern void sr_cache_flush(int flushnames); +extern void sr_cache_flush_setno(set_t setno); +extern void s_delset(char *setname, md_error_t *ep); +extern void s_delrec(mddb_recid_t recid, md_error_t *ep); +extern int s_ownset(set_t setno, md_error_t *ep); +extern int resnarf_set(set_t setno, md_error_t *ep); + +/* meta_mh.c */ +extern mhd_mhiargs_t defmhiargs; +extern int meta_take_own(char *sname, mddrivenamelist_t *dnlp, + mhd_mhiargs_t *mhiargsp, int partial_set, + md_error_t *ep); +extern int tk_own_bydd(mdsetname_t *sp, md_drive_desc *dd, + mhd_mhiargs_t *mhiargsp, int partial_set, + md_error_t *ep); +extern int meta_rel_own(char *sname, mddrivenamelist_t *dnlp, + int partial_set, md_error_t *ep); +extern int rel_own_bydd(mdsetname_t *sp, md_drive_desc *dd, + int partial_set, md_error_t *ep); +extern int meta_status_own(char *sname, + md_disk_status_list_t *dslp, int partial_set, + md_error_t *ep); +extern md_disk_status_list_t *meta_drive_to_disk_status_list( + mddrivenamelist_t *dnlp); +extern void meta_free_disk_status_list(md_disk_status_list_t *dslp); +extern void meta_free_drive_info_list(mhd_drive_info_list_t *listp); +extern int meta_list_drives(char *hostname, char *path, + mhd_did_flags_t flags, + mhd_drive_info_list_t *listp, md_error_t *ep); +extern int meta_get_drive_names(mdsetname_t *sp, + mddrivenamelist_t **dnlpp, int options, + md_error_t *ep); + +/* meta_mirror.c */ +extern int meta_get_mirror_names(mdsetname_t *sp, + mdnamelist_t **nlpp, int options, md_error_t *ep); +extern void meta_free_mirror(md_mirror_t *mirrorp); +extern md_mirror_t *meta_get_mirror(mdsetname_t *sp, mdname_t *mirnp, + md_error_t *ep); +extern int meta_check_inmirror(mdsetname_t *sp, mdname_t *np, + diskaddr_t slblk, diskaddr_t nblks, md_error_t *ep); +extern int meta_check_submirror(mdsetname_t *sp, mdname_t *np, + mdname_t *mirnp, int force, md_error_t *ep); +extern char *rd_opt_to_name(mm_rd_opt_t opt); +extern int name_to_rd_opt(char *uname, char *name, + mm_rd_opt_t *optp, md_error_t *ep); +extern char *wr_opt_to_name(mm_wr_opt_t opt); +extern int name_to_wr_opt(char *uname, char *name, + mm_wr_opt_t *optp, md_error_t *ep); +extern int name_to_pass_num(char *uname, char *name, + mm_pass_num_t *passp, md_error_t *ep); +extern char *sm_state_to_name(md_submirror_t *mdsp, + md_status_t mirror_status, md_timeval32_t *tvp, + uint_t tstate); +extern int sm_state_to_action(mdsetname_t *sp, + md_submirror_t *mdsp, md_status_t mirror_status, + md_mirror_t *mirrorp, char **actionp, + md_error_t *ep); +extern int meta_print_mirror_options(mm_rd_opt_t read_options, + mm_wr_opt_t write_option, mm_pass_num_t pass_num, + uint_t tstate, char *fname, + mdsetname_t *sp, FILE *fp, md_error_t *ep); +extern int meta_mirror_print(mdsetname_t *sp, mdname_t *mirnp, + mdnamelist_t **nlpp, char *fname, FILE *fp, + mdprtopts_t options, md_error_t *ep); +extern int meta_mirror_online(mdsetname_t *sp, mdname_t *mirnp, + mdname_t *submirnp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_mirror_offline(mdsetname_t *sp, mdname_t *mirnp, + mdname_t *submirnp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_mirror_attach(mdsetname_t *sp, mdname_t *mirnp, + mdname_t *submirnp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_mirror_detach(mdsetname_t *sp, mdname_t *mirnp, + mdname_t *submirnp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_mirror_get_params(mdsetname_t *sp, + mdname_t *mirnp, mm_params_t *paramsp, + md_error_t *ep); +extern int meta_mirror_set_params(mdsetname_t *sp, + mdname_t *mirnp, mm_params_t *paramsp, + md_error_t *ep); +extern int meta_mirror_replace(mdsetname_t *sp, mdname_t *mirnp, + mdname_t *oldnp, mdname_t *newnp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_mirror_enable(mdsetname_t *sp, mdname_t *mirnp, + mdname_t *compnp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_check_mirror(mdsetname_t *sp, + md_mirror_t *mirrorp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_create_mirror(mdsetname_t *sp, + md_mirror_t *mirrorp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_init_mirror(mdsetname_t **spp, + int argc, char *argv[], mdcmdopts_t options, + md_error_t *ep); +extern int meta_mirror_reset(mdsetname_t *sp, mdname_t *mirnp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_mirror_anycomp_is_err(mdsetname_t *, + mdnamelist_t *); + +/* meta_mirror_resync.c */ +extern int meta_mirror_resync(mdsetname_t *sp, mdname_t *mirnp, + daddr_t size, md_error_t *ep, md_resync_cmd_t cmd); +extern int meta_mirror_resync_all(mdsetname_t *sp, daddr_t size, + md_error_t *ep); +extern void *meta_mn_mirror_resync_all(void *arg); +extern void meta_mirror_resync_kill_all(void); +extern void meta_mirror_resync_block_all(void); +extern void meta_mirror_resync_unblock_all(void); +extern void meta_mirror_resync_unblock(mdsetname_t *sp); +extern void meta_mirror_resync_kill(mdsetname_t *sp); + +/* meta_mount.c */ +extern char *meta_get_mountp(mdsetname_t *, mdname_t *, + md_error_t *); + +/* meta_name.c */ +extern char *meta_name_getname(mdsetname_t **spp, char *uname, + md_error_t *ep); +extern char *meta_canonicalize(mdsetname_t *sp, char *uname); +extern int is_metaname(char *uname); +extern int is_hspname(char *uname); +extern int parse_ctd(char *uname, uint_t *slice); +extern md_set_desc *sr2setdesc(md_set_record *sr); +extern mdsetname_t *metasetname(char *sname, md_error_t *ep); +extern mdsetname_t *metasetnosetname(set_t setno, md_error_t *ep); +extern mdsetname_t *metafakesetname(set_t setno, char *sname); +extern md_set_desc *metaget_setdesc(mdsetname_t *sp, md_error_t *ep); +extern void metaflushsetname(mdsetname_t *sp); +extern int metaislocalset(mdsetname_t *sp); +extern int metaissameset(mdsetname_t *sp1, mdsetname_t *sp2); +extern void metaflushsidenames(mddrivename_t *dnp); +extern char *metadiskname(char *name); +extern mddrivename_t *metadrivename(mdsetname_t **spp, char *uname, + md_error_t *ep); +extern mdname_t *metaslicename(mddrivename_t *dnp, uint_t sliceno, + md_error_t *ep); +extern void metafreedrivename(mddrivename_t *dnp); +extern void metafreedrivenamelist(mddrivenamelist_t *dnlp); +extern int metadrivenamelist(mdsetname_t **spp, + mddrivenamelist_t **dnlpp, + int argc, char *argv[], md_error_t *ep); +extern mddrivename_t *metadrivenamelist_append(mddrivenamelist_t **dnlpp, + mddrivename_t *dnp); +extern mddrivenamelist_t **meta_drivenamelist_append_wrapper( + mddrivenamelist_t **dnlpp, + mddrivename_t *dnp); +extern int meta_getdev(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern mdname_t *metaname_fast(mdsetname_t **spp, char *uname, + md_error_t *ep); +extern mdname_t *metaname(mdsetname_t **spp, char *uname, + md_error_t *ep); +extern mdname_t *metamnumname(mdsetname_t **spp, minor_t mnum, + int fast, md_error_t *ep); +extern char *get_mdname(minor_t mnum); +extern int metaismeta(mdname_t *np); +extern int metachkmeta(mdname_t *np, md_error_t *ep); +extern int metachkdisk(mdname_t *np, md_error_t *ep); +extern int metachkcomp(mdname_t *np, md_error_t *ep); +extern void metafreenamelist(mdnamelist_t *nlp); +extern int metanamelist(mdsetname_t **spp, mdnamelist_t **nlpp, + int argc, char *argv[], md_error_t *ep); +extern mdname_t *metanamelist_append(mdnamelist_t **nlpp, + mdname_t *np); +extern mdnamelist_t **meta_namelist_append_wrapper(mdnamelist_t **nlpp, + mdname_t *np); +extern mdhspname_t *metahspname(mdsetname_t **spp, + char *uname, md_error_t *ep); +extern mdhspname_t *metahsphspname(mdsetname_t **spp, + hsp_t hsp, md_error_t *ep); +extern char *get_hspname(hsp_t mnum); +extern void metafreehspnamelist(mdhspnamelist_t *hspnlp); +extern int metahspnamelist(mdsetname_t **spp, + mdhspnamelist_t **hspnlpp, + int argc, char *argv[], md_error_t *ep); +extern mdhspname_t *metahspnamelist_append(mdhspnamelist_t **hspnlp, + mdhspname_t *hspnp); +extern mdname_t *metadevname(mdsetname_t **spp, + md_dev64_t dev, md_error_t *ep); +extern char *get_devname(set_t setno, md_dev64_t dev); +extern mdname_t *metakeyname(mdsetname_t **spp, + mdkey_t key, int fast, md_error_t *ep); +extern void metaflushnames(int flush_sr_cache); +extern int meta_get_hotspare_names(mdsetname_t *sp, + mdnamelist_t **nlpp, int options, md_error_t *ep); +extern void meta_create_non_dup_list(mdname_t *mdnp, + mddevid_t **ldevidpp); + +/* meta_nameinfo.c */ +extern mdsetname_t *metagetset(mdname_t *np, int bypass_daemon, + md_error_t *ep); +extern void metafreevtoc(mdvtoc_t *vtocp); +extern int meta_match_enclosure(mdname_t *, mdcinfo_t *, + md_error_t *); +extern mdvtoc_t *metagetvtoc(mdname_t *np, int nocache, uint_t *partnop, + md_error_t *ep); +extern int metasetvtoc(mdname_t *np, md_error_t *ep); +extern void metaflushctlrcache(void); +extern mdgeom_t *metagetgeom(mdname_t *np, md_error_t *ep); +extern mdcinfo_t *metagetcinfo(mdname_t *np, md_error_t *ep); +extern int metagetpartno(mdname_t *np, md_error_t *ep); +extern diskaddr_t metagetsize(mdname_t *np, md_error_t *ep); +extern diskaddr_t metagetlabel(mdname_t *np, md_error_t *ep); +extern diskaddr_t metagetstart(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern int metahasmddb(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern char *metagetdevicesname(mdname_t *np, md_error_t *ep); +extern char *metagetmiscname(mdname_t *np, md_error_t *ep); +extern md_unit_t *meta_get_mdunit(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern void meta_free_unit(mddrivename_t *dnp); +extern void meta_invalidate_name(mdname_t *np); +extern md_common_t *meta_get_unit(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern int meta_isopen(mdsetname_t *sp, mdname_t *np, + md_error_t *ep, mdcmdopts_t options); + +/* meta_namespace.c */ +extern char *meta_getnmbykey(set_t setno, side_t sideno, + mdkey_t key, md_error_t *ep); +extern char *meta_getnmentbykey(set_t setno, side_t sideno, + mdkey_t key, char **drvnm, minor_t *mnum, + md_dev64_t *dev, md_error_t *ep); +extern char *meta_getnmentbydev(set_t setno, side_t sideno, + md_dev64_t dev, char **drvnm, minor_t *mnum, + mdkey_t *key, md_error_t *ep); +extern char *meta_getdidminorbykey(set_t setno, side_t sideno, + mdkey_t key, md_error_t *ep); +extern ddi_devid_t meta_getdidbykey(set_t setno, side_t sideno, + mdkey_t key, md_error_t *ep); +extern int meta_setdid(set_t setno, side_t sideno, mdkey_t key, + md_error_t *ep); +extern int add_name(mdsetname_t *sp, side_t sideno, mdkey_t key, + char *dname, minor_t mnum, char *bname, + md_error_t *ep); +extern int del_name(mdsetname_t *sp, side_t sideno, mdkey_t key, + md_error_t *ep); +extern int add_key_name(mdsetname_t *sp, mdname_t *np, + mdnamelist_t **nlpp, md_error_t *ep); +extern int del_key_name(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern int del_key_names(mdsetname_t *sp, mdnamelist_t *nlp, + md_error_t *ep); + +/* meta_patch.c */ +extern int meta_patch_vfstab(char *cmpname, mdname_t *fsnp, + char *vname, char *old_bdevname, int doit, + int verbose, char **tname, md_error_t *ep); +extern int meta_patch_fsdev(char *fsname, mdname_t *fsnp, + char *vname, md_error_t *ep); +extern int meta_patch_swapdev(mdname_t *fsnp, + char *vname, char *old_bdevname, md_error_t *ep); +extern int meta_patch_mddb(char *sname, char *cname, int patch, + md_error_t *ep); + +/* meta_patch_root.c */ +extern int meta_patch_rootdev(mdname_t *np, char *sname, + char *vname, char *cname, char *dbname, int doit, + int verbose, md_error_t *ep); + +/* meta_print.c */ +extern int meta_print_name(mdsetname_t *sp, mdname_t *namep, + mdnamelist_t **nlpp, char *fname, FILE *fp, + mdprtopts_t options, mdnamelist_t **lognlpp, + md_error_t *ep); +extern int meta_print_all(mdsetname_t *sp, char *fname, + mdnamelist_t **nlpp, FILE *fp, + mdprtopts_t options, int *meta_print_trans_msgp, + md_error_t *ep); +extern char *meta_print_time(md_timeval32_t *timep); +extern char *meta_print_hrtime(hrtime_t secs); +extern int meta_prbits(FILE *fp, const char *fmt, ...); +extern char *meta_number_to_string(diskaddr_t number, + u_longlong_t blk_sz); +extern int meta_get_tstate(md_dev64_t dev64, uint_t *tstatep, + md_error_t *ep); +extern int meta_print_devid(mdsetname_t *sp, FILE *fp, + mddevid_t *mddevidp, md_error_t *ep); + +/* meta_raid.c */ +extern int meta_get_raid_names(mdsetname_t *sp, + mdnamelist_t **nlpp, int options, md_error_t *ep); +extern void meta_free_raid(md_raid_t *raidp); +extern md_raid_t *meta_get_raid_common(mdsetname_t *sp, mdname_t *raidnp, + int fast, md_error_t *ep); +extern md_raid_t *meta_get_raid(mdsetname_t *sp, mdname_t *raidnp, + md_error_t *ep); +extern int meta_check_inraid(mdsetname_t *sp, mdname_t *np, + diskaddr_t slblk, diskaddr_t nblks, md_error_t *ep); +extern int meta_check_column(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern char *raid_state_to_name(md_raid_t *raidp, + md_timeval32_t *tvp, uint_t tstate); +extern char *raid_state_to_action(md_raid_t *raidp); +extern char *raid_col_state_to_name(md_raidcol_t *colp, + md_timeval32_t *tvp, uint_t tstate); +extern int meta_print_raid_options(mdhspname_t *hspnamep, + char *fname, FILE *fp, md_error_t *ep); +extern int meta_raid_print(mdsetname_t *sp, mdname_t *raidnp, + mdnamelist_t **nlpp, char *fname, FILE *fp, + mdprtopts_t options, md_error_t *ep); +extern int meta_raid_attach(mdsetname_t *sp, mdname_t *raidnp, + mdnamelist_t *nlp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_raid_get_params(mdsetname_t *sp, mdname_t *raidnp, + mr_params_t *paramsp, md_error_t *ep); +extern int meta_raid_set_params(mdsetname_t *sp, mdname_t *raidnp, + mr_params_t *paramsp, md_error_t *ep); +extern int meta_raid_replace(mdsetname_t *sp, mdname_t *raidnp, + mdname_t *oldnp, mdname_t *newnp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_raid_enable(mdsetname_t *sp, mdname_t *raidnp, + mdname_t *compnp, mdcmdopts_t options, + md_error_t *ep); +extern diskaddr_t meta_default_raid_interlace(void); +extern int meta_raid_check_interlace(diskaddr_t interlace, + char *uname, md_error_t *ep); +extern int meta_check_raid(mdsetname_t *sp, md_raid_t *raidp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_create_raid(mdsetname_t *sp, md_raid_t *raidp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_init_raid(mdsetname_t **spp, + int argc, char *argv[], mdcmdopts_t options, + md_error_t *ep); +extern int meta_raid_reset(mdsetname_t *sp, mdname_t *np, + mdcmdopts_t options, md_error_t *ep); +extern int meta_raid_anycomp_is_err(mdsetname_t *, mdnamelist_t *); + +/* meta_raid_resync.c */ +extern int meta_raid_resync(mdsetname_t *sp, mdname_t *raidnp, + daddr_t size, md_error_t *ep); +extern int meta_raid_resync_all(mdsetname_t *sp, daddr_t size, + md_error_t *ep); + +extern int meta_raid_regen_byname(mdsetname_t *sp, + mdname_t *raidnp, diskaddr_t size, md_error_t *ep); + +/* meta_repartition.c */ +extern int meta_replicaslice(mddrivename_t *dnp, + uint_t *slicep, md_error_t *ep); + +/* meta_replace.c */ +extern int meta_replace(mdsetname_t *sp, mdname_t *metanp, + mdname_t *oldnp, + mdname_t *newnp, char *uname, mdcmdopts_t options, + md_error_t *ep); +extern int meta_replace_byname(mdsetname_t *sp, mdname_t *namep, + mdname_t *oldnp, mdname_t *newnp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_enable_byname(mdsetname_t *sp, mdname_t *namep, + mdname_t *compnp, mdcmdopts_t options, + md_error_t *ep); + +/* meta_reset.c */ +extern int meta_reset(mdsetname_t *sp, mdname_t *np, + mdcmdopts_t options, md_error_t *ep); +extern int meta_reset_all(mdsetname_t *sp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_reset_by_name(mdsetname_t *sp, mdname_t *np, + mdcmdopts_t options, md_error_t *ep); + +/* meta_resync.c */ +extern int meta_resync_byname(mdsetname_t *sp, mdname_t *np, + daddr_t size, md_error_t *ep, md_resync_cmd_t cmd); +extern int meta_resync_all(mdsetname_t *sp, daddr_t size, + md_error_t *ep); + +/* meta_set.c */ +extern set_t get_max_sets(md_error_t *ep); +extern int get_max_meds(md_error_t *ep); +extern side_t getmyside(mdsetname_t *sp, md_error_t *ep); +extern md_set_record *getsetbyname(char *setname, md_error_t *ep); +extern md_set_record *getsetbynum(set_t setno, md_error_t *ep); +extern int meta_check_drive_inuse(mdsetname_t *sp, + mddrivename_t *dnp, int check_db, md_error_t *ep); +extern int meta_check_ownership(mdsetname_t *sp, md_error_t *ep); +extern int meta_check_ownership_on_host(mdsetname_t *sp, + char *hostname, md_error_t *ep); +extern int meta_is_member(char *node_name, md_mn_nodeid_t node_id, + mndiskset_membershiplist_t *nl); +extern int meta_getnextside_devinfo(mdsetname_t *sp, char *bname, + side_t *sideno, char **ret_bname, char **ret_dname, + minor_t *ret_mnum, md_error_t *ep); +extern int meta_getside_devinfo(mdsetname_t *sp, char *bname, + side_t sideno, char **ret_bname, char **ret_dname, + minor_t *ret_mnum, md_error_t *ep); +extern int meta_is_drive_in_anyset(mddrivename_t *dnp, + mdsetname_t **spp, int bypass_daemon, + md_error_t *ep); +extern int meta_is_drive_in_thisset(mdsetname_t *sp, + mddrivename_t *dnp, int bypass_daemon, + md_error_t *ep); +extern int meta_set_balance(mdsetname_t *sp, md_error_t *ep); +extern int meta_set_destroy(mdsetname_t *sp, int lock_set, + md_error_t *ep); +extern int meta_set_purge(mdsetname_t *sp, int bypass_cluster, + int forceflg, md_error_t *ep); +extern int meta_set_query(mdsetname_t *sp, mddb_dtag_lst_t **dtlpp, + md_error_t *ep); +extern mddrivename_t *metadrivename_withdrkey(mdsetname_t *sp, + side_t sideno, mdkey_t key, int flags, + md_error_t *ep); +extern void metafreedrivedesc(md_drive_desc **dd); +extern md_drive_desc *metaget_drivedesc(mdsetname_t *sp, int flags, + md_error_t *ep); +extern md_drive_desc *metaget_drivedesc_fromnamelist(mdsetname_t *sp, + mdnamelist_t *nlp, md_error_t *ep); +extern md_drive_desc *metaget_drivedesc_sideno(mdsetname_t *sp, + side_t sideno, int flags, md_error_t *ep); +extern int metaget_setownership(mdsetname_t *sp, md_error_t *ep); +extern char *mynode(void); +extern int strinlst(char *str, int cnt, char **lst); +extern int meta_get_reserved_names(mdsetname_t *sp, + mdnamelist_t **nlpp, int options, md_error_t *ep); +extern int meta_set_join(mdsetname_t *sp, md_error_t *ep); +extern int meta_set_withdraw(mdsetname_t *sp, md_error_t *ep); +extern int meta_reconfig_choose_master(); +extern int meta_mnsync_user_records(mdsetname_t *sp, + md_error_t *ep); +extern int meta_mnsync_diskset_mddbs(mdsetname_t *sp, + md_error_t *ep); +extern int meta_mnjoin_all(mdsetname_t *sp, md_error_t *ep); +extern int meta_getandsetmaster(mdsetname_t *sp, + md_mnset_record *mnsr, md_set_desc *sd, + md_error_t *ep); +extern int meta_devid_use(md_error_t *ep); + +/* meta_set_drv.c */ +extern int meta_make_sidenmlist(mdsetname_t *, + mddrivename_t *, md_error_t *); +extern int meta_set_adddrives(mdsetname_t *sp, + mddrivenamelist_t *dnlp, daddr_t dbsize, + int force_label, md_error_t *ep); +extern int meta_set_deletedrives(mdsetname_t *sp, + mddrivenamelist_t *dnlp, int forceflg, + md_error_t *ep); + +/* meta_set_hst.c */ +extern int meta_set_checkname(char *setname, md_error_t *ep); +extern int meta_set_addhosts(mdsetname_t *sp, int multi_node, + int node_c, char **node_v, int auto_take, + md_error_t *ep); +extern int meta_set_deletehosts(mdsetname_t *sp, int node_c, + char **node_v, int forceflg, md_error_t *ep); +extern int meta_set_auto_take(mdsetname_t *sp, int take_val, + md_error_t *ep); + +/* meta_set_med.c */ +extern int meta_set_addmeds(mdsetname_t *sp, int node_c, + char **node_v, md_error_t *ep); +extern int meta_set_deletemeds(mdsetname_t *sp, int node_c, + char **node_v, int forceflg, md_error_t *ep); + +/* meta_set_tkr.c */ +extern int meta_set_take(mdsetname_t *sp, mhd_mhiargs_t *mhiargsp, + int flags, int usetag, md_error_t *ep); +extern int meta_set_release(mdsetname_t *sp, md_error_t *ep); +extern int meta_update_mb(mdsetname_t *sp, md_drive_desc *dd, + md_error_t *ep); + +/* meta_setup.c */ +extern char *myname; +extern FILE *metalogfp; +extern int metasyslog; +extern uint_t verbosity; +extern hrtime_t start_time; +extern sigset_t allsigs; +#define ANYSIG allsigs +extern char *meta_lock_name(set_t setno); +extern int meta_unlock(mdsetname_t *sp, md_error_t *ep); +extern int meta_lock(mdsetname_t *sp, int print_status, + md_error_t *ep); +extern int meta_lock_nowait(mdsetname_t *sp, md_error_t *ep); +extern int meta_lock_status(mdsetname_t *sp, md_error_t *ep); +extern int md_daemonize(mdsetname_t *sp, md_error_t *ep); +extern void md_exit(mdsetname_t *sp, int eval); +extern void md_post_sig(int sig); +extern int md_got_sig(void); +extern int md_which_sig(void); +extern void md_rb_sig_handling_on(void); +extern void md_rb_sig_handling_off(int sig_seen, int sig); +extern void setup_mc_log(uint_t level); +extern int md_init(int argc, char *argv[], + int dosyslog, int doadmin, md_error_t *ep); +extern int md_init_nosig(int argc, char *argv[], + int dosyslog, int doadmin, md_error_t *ep); + +extern int md_init_daemon(char *name, md_error_t *ep); + +/* meta_smf.c */ +extern int meta_smf_enable(uint_t flags, md_error_t *ep); +extern int meta_smf_disable(uint_t flags, md_error_t *ep); +extern int meta_smf_isonline(uint_t flags, md_error_t *ep); +extern int meta_smf_getmask(); + +/* meta_sp.c */ +extern int meta_get_sp_names(mdsetname_t *sp, mdnamelist_t **nlpp, + int options, md_error_t *ep); +extern int meta_check_insp(mdsetname_t *sp, mdname_t *np, + diskaddr_t slblk, diskaddr_t nblks, md_error_t *ep); +extern int meta_sp_print(mdsetname_t *sp, mdname_t *np, + mdnamelist_t **nlpp, char *fname, FILE *fp, + mdprtopts_t options, md_error_t *ep); +extern md_sp_t *meta_get_sp_common(mdsetname_t *sp, mdname_t *np, + int fast, md_error_t *ep); +extern md_sp_t *meta_get_sp(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern int meta_init_sp(mdsetname_t **spp, int argc, char *argv[], + mdcmdopts_t options, md_error_t *ep); +extern void meta_free_sp(md_sp_t *spp); +extern int meta_sp_issp(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern int meta_sp_reset(mdsetname_t *sp, mdname_t *np, + mdcmdopts_t options, md_error_t *ep); +extern int meta_sp_reset_component(mdsetname_t *sp, char *name, + mdcmdopts_t options, md_error_t *ep); +extern int meta_sp_attach(mdsetname_t *sp, mdname_t *np, + char *addsize, mdcmdopts_t options, + sp_ext_length_t alignment, md_error_t *ep); +extern int meta_recover_sp(mdsetname_t *sp, mdname_t *np, int argc, + char *argv[], mdcmdopts_t options, md_error_t *ep); +extern boolean_t meta_sp_can_create_sps(mdsetname_t *mdsetnamep, + mdname_t *mdnamep, int number_of_sps, + blkcnt_t sp_size); +extern boolean_t meta_sp_can_create_sps_on_drive(mdsetname_t *mdsetnamep, + mddrivename_t *mddrivenamep, int number_of_sps, + blkcnt_t sp_size); +extern blkcnt_t meta_sp_get_free_space(mdsetname_t *mdsetnamep, + mdname_t *mdnamep); +extern blkcnt_t meta_sp_get_free_space_on_drive(mdsetname_t *mdsetnamep, + mddrivename_t *mddrivenamep); +extern int meta_sp_get_number_of_possible_sps( + mdsetname_t *mdsetnamep, mdname_t *mdnamep, + blkcnt_t sp_size); +extern int meta_sp_get_number_of_possible_sps_on_drive( + mdsetname_t *mdsetnamep, + mddrivename_t *mddrivenamep, blkcnt_t sp_size); +extern blkcnt_t meta_sp_get_possible_sp_size(mdsetname_t *mdsetnamep, + mdname_t *mdnamep, int number_of_sps); +extern blkcnt_t meta_sp_get_possible_sp_size_on_drive( + mdsetname_t *mdsetnamep, + mddrivename_t *mddrivenamep, int number_of_sps); +extern int meta_sp_setstatus(mdsetname_t *sp, minor_t *minors, + int num_units, sp_status_t status, md_error_t *ep); +extern int meta_sp_parsesize(char *s, sp_ext_length_t *szp); +extern int meta_sp_update_abr(mdsetname_t *sp, md_error_t *ep); +extern void *meta_mn_sp_update_abr(void *arg); + +/* meta_stat.c */ +extern int meta_stat(const char *, struct stat *); +extern void metaflushstatcache(void); + +/* meta_stripe.c */ +extern int meta_stripe_replace(mdsetname_t *sp, mdname_t *stripenp, + mdname_t *oldnp, mdname_t *newnp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_get_stripe_names(mdsetname_t *sp, + mdnamelist_t **nlpp, int options, md_error_t *ep); +extern void meta_free_stripe(md_stripe_t *stripep); +extern md_stripe_t *meta_get_stripe_common(mdsetname_t *sp, + mdname_t *stripenp, int fast, md_error_t *ep); +extern md_stripe_t *meta_get_stripe(mdsetname_t *sp, mdname_t *stripenp, + md_error_t *ep); +extern int meta_check_instripe(mdsetname_t *sp, mdname_t *np, + diskaddr_t slblk, diskaddr_t nblks, md_error_t *ep); +extern int meta_check_component(mdsetname_t *sp, mdname_t *np, + int force, md_error_t *ep); +extern char *comp_state_to_name(md_comp_t *mdcp, + md_timeval32_t *tvp, uint_t tstate); +extern int meta_print_stripe_options(mdhspname_t *hspnamep, + char *fname, FILE *fp, md_error_t *ep); +extern int meta_stripe_print(mdsetname_t *sp, mdname_t *stripenp, + mdnamelist_t **nlpp, char *fname, FILE *fp, + mdprtopts_t options, md_error_t *ep); +extern int meta_find_erred_comp(mdsetname_t *sp, + mdname_t *stripenp, mdname_t **compnpp, + comp_state_t *compstate, md_error_t *ep); +extern int meta_stripe_attach(mdsetname_t *sp, mdname_t *stripenp, + mdnamelist_t *nlp, diskaddr_t interlace, + mdcmdopts_t options, md_error_t *ep); +extern int meta_stripe_get_params(mdsetname_t *sp, + mdname_t *stripenp, ms_params_t *paramsp, + md_error_t *ep); +extern int meta_stripe_set_params(mdsetname_t *sp, + mdname_t *stripenp, ms_params_t *paramsp, + md_error_t *ep); +extern diskaddr_t meta_default_stripe_interlace(void); +extern int meta_stripe_check_interlace(diskaddr_t interlace, + char *uname, md_error_t *ep); +extern int meta_check_stripe(mdsetname_t *sp, + md_stripe_t *stripep, mdcmdopts_t options, + md_error_t *ep); +extern int meta_create_stripe(mdsetname_t *sp, + md_stripe_t *stripep, mdcmdopts_t options, + md_error_t *ep); +extern int meta_init_stripe(mdsetname_t **spp, + int argc, char *argv[], mdcmdopts_t options, + md_error_t *ep); +extern int meta_stripe_reset(mdsetname_t *sp, mdname_t *stripenp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_stripe_anycomp_is_err(mdsetname_t *, + mdnamelist_t *); + +/* meta_systemfile.c */ +extern int meta_systemfile_copy(char *sname, int doroot, + int domddb, int doit, int verbose, char **tname, + FILE **tfp, md_error_t *ep); +extern int meta_systemfile_append_mdroot(mdname_t *rootnp, + char *sname, char *tname, FILE *tfp, int ismeta, + int doit, int verbose, md_error_t *ep); +extern int meta_systemfile_append_mddb(char *cname, char *sname, + char *tname, FILE *tfp, int doit, int verbose, + md_error_t *ep); + +/* meta_tab.c */ +extern void meta_tab_dump(md_tab_t *tabp, FILE *fp); +extern void meta_tab_free(md_tab_t *tabp); +extern md_tab_t *meta_tab_parse(char *filename, md_error_t *ep); +extern md_tab_line_t *meta_tab_find(mdsetname_t *sp, md_tab_t *tabp, + char *name, mdinittypes_t type); + +/* meta_trans.c */ +extern int meta_trans_replace(mdsetname_t *sp, mdname_t *transnp, + mdname_t *oldnp, mdname_t *newnp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_get_trans_names(mdsetname_t *sp, + mdnamelist_t **nlpp, int options, md_error_t *ep); +extern void meta_free_trans(md_trans_t *transp); +extern md_trans_t *meta_get_trans(mdsetname_t *sp, mdname_t *transnp, + md_error_t *ep); +extern md_trans_t *meta_get_trans_common(mdsetname_t *sp, + mdname_t *transnp, int fast, md_error_t *ep); +extern int meta_check_intrans(mdsetname_t *sp, mdname_t *np, + mdchkopts_t options, diskaddr_t slblk, + diskaddr_t nblks, md_error_t *ep); +extern int meta_check_master(mdsetname_t *sp, mdname_t *np, + int force, md_error_t *ep); +extern int meta_check_log(mdsetname_t *sp, mdname_t *np, + md_error_t *ep); +extern char *mt_l_error_to_name(md_trans_t *transp, + md_timeval32_t *tvp, uint_t tstate); +extern char *mt_flags_to_name(md_trans_t *transp, + md_timeval32_t *tvp, uint_t tstate); +extern char *mt_flags_to_action(md_trans_t *transp); +extern char *mt_l_error_to_action( + mdsetname_t *sp, + mdnamelist_t *transnlp, + mdname_t *lognamep, + md_error_t *ep); +extern int meta_trans_print(mdsetname_t *sp, mdname_t *transnp, + mdnamelist_t **nlistpp, char *fname, FILE *fp, + mdprtopts_t options, int *meta_print_trans_msgp, + mdnamelist_t **lognlpp, md_error_t *ep); +extern int meta_logs_print(mdsetname_t *sp, mdnamelist_t *lognlp, + mdnamelist_t **nlistpp, char *fname, FILE *fp, + mdprtopts_t options, md_error_t *ep); +extern int meta_trans_attach(mdsetname_t *sp, mdname_t *transnp, + mdname_t *lognp, mdcmdopts_t options, + md_error_t *ep); +extern int meta_trans_detach(mdsetname_t *sp, mdname_t *transnp, + mdcmdopts_t options, int *delayed, md_error_t *ep); +extern int meta_check_trans(mdsetname_t *sp, md_trans_t *transp, + mdcmdopts_t options, md_error_t *ep); +extern int meta_create_trans(mdsetname_t *sp, md_trans_t *transp, + mdcmdopts_t options, char *uname, md_error_t *ep); +extern int meta_init_trans(mdsetname_t **spp, + int argc, char *argv[], mdcmdopts_t options, + md_error_t *ep); +extern int meta_trans_reset(mdsetname_t *sp, mdname_t *transnp, + mdcmdopts_t options, md_error_t *ep); + +/* meta_userflags.c */ +extern int meta_getuserflags(mdsetname_t *sp, mdname_t *np, + uint_t *userflags, md_error_t *ep); +extern int meta_setuserflags(mdsetname_t *sp, mdname_t *np, + uint_t userflags, md_error_t *ep); + +/* metarpcopen.c */ +extern CLIENT *meta_client_create_retry(char *hostname, + clnt_create_func_t func, void *data, + time_t tout, md_error_t *ep); +extern CLIENT *meta_client_create(char *host, rpcprog_t prognum, + rpcvers_t version, char *nettype); +extern CLIENT *metarpcopen(char *hostname, long time_out, + md_error_t *ep); +extern void metarpcclose(CLIENT *clntp); +extern void metarpccloseall(void); + +/* metasplitname.c */ +extern int splitname(char *devname, md_splitname *splitname); +extern char *splicename(md_splitname *splitname); + +/* meta_notify.c */ +extern int meta_notify_createq(char *qname, ulong_t flags, + md_error_t *ep); +extern int meta_notify_deleteq(char *qname, md_error_t *ep); +extern int meta_notify_validq(char *qname, md_error_t *ep); +extern int meta_notify_listq(char ***qnames, md_error_t *ep); +extern int meta_notify_flushq(char *qname, md_error_t *ep); + +extern int meta_notify_getev(char *qname, ulong_t flags, + md_ev_t *evp, md_error_t *ep); +extern int meta_notify_getevlist(char *qname, ulong_t flags, + md_evlist_t **evlpp, md_error_t *ep); +extern int meta_notify_putev(md_ev_t *evp, md_error_t *ep); +extern int meta_notify_putevlist(md_evlist_t *evlistp, + md_error_t *ep); +extern void meta_notify_freeevlist(md_evlist_t *evlp); + +extern int meta_notify_sendev(ev_obj_t tag, set_t set, + md_dev64_t dev, evid_t event); + +extern int meta_exchange(mdsetname_t *, mdname_t *, mdname_t *, + mdcmdopts_t, md_error_t *); +extern int meta_rename(mdsetname_t *, mdname_t *, mdname_t *, + mdcmdopts_t, md_error_t *); +/* meta_se_notify.c */ +extern void meta_svm_sysevent(char *se_class, char *se_subclass, + uint32_t tag, set_t setno, md_dev64_t devid); + +/* metgetroot.c */ +extern void *meta_get_current_root(md_error_t *ep); +extern mdname_t *meta_get_current_root_dev(mdsetname_t *sp, + md_error_t *ep); + +/* meta_time.c */ +extern int meta_gettimeofday(md_timeval32_t *tv); + +/* meta_devadm.c */ +extern int meta_fixdevid(mdsetname_t *sp, mddevopts_t options, + char *diskname, md_error_t *ep); +extern int meta_upd_ctdnames(mdsetname_t **sp, set_t setno, + side_t sideno, mddrivename_t *dnp, char **newname, + md_error_t *ep); +extern int pathname_reload(mdsetname_t **sp, set_t setno, + md_error_t *ep); + +/* meta_mn_comm.c */ +extern int mdmn_send_message(set_t setno, md_mn_msgtype_t type, + uint_t flags, char *data, int size, + md_mn_result_t **resp, md_error_t *ep); +extern int mdmn_send_message_with_msgid(set_t setno, + md_mn_msgtype_t type, uint_t flags, char *data, + int size, md_mn_result_t **resp, + md_mn_msgid_t *msgid, md_error_t *ep); +extern int mdmn_create_msgid(md_mn_msgid_t *id); +extern int mdmn_reinit_set(set_t setno); +extern int mdmn_resume(set_t setno, md_mn_msgclass_t class, + uint_t flags); +extern int mdmn_suspend(set_t setno, md_mn_msgclass_t class); +extern int mdmn_msgtype_lock(md_mn_msgtype_t msgtype, + uint_t locktype); +extern void mdmn_abort(void); +extern md_mn_result_t *copy_result(md_mn_result_t *res); +extern void free_result(md_mn_result_t *res); +extern md_mn_msg_t *copy_msg(md_mn_msg_t *src, md_mn_msg_t *dest); + +/* meta_import.c */ +extern int read_master_block(md_error_t *ep, int fd, void *bp, + int bsize); +typedef struct md_im_names { + int min_count; + char **min_names; +} md_im_names_t; + +/* Values for replica info status */ +#define MD_IM_REPLICA_SCANNED (0x01) +#define MD_IM_REPLICA_VALID (0x02) + +typedef struct md_im_replica_info { + struct md_im_replica_info *mir_next; + int mir_status; + int mir_flags; + daddr32_t mir_offset; + daddr32_t mir_length; + md_timeval32_t mir_timestamp; +} md_im_replica_info_t; + +typedef struct md_im_drive_info { + struct md_im_drive_info *mid_next; /* next drive in this set */ + mddrivename_t *mid_dnp; + void *mid_devid; + void *mid_o_devid; + int mid_devid_sz; + int mid_o_devid_sz; + char mid_minor_name[MDDB_MINOR_NAME_MAX]; + md_timeval32_t mid_setcreatetimestamp; + md_im_replica_info_t *mid_replicas; + struct md_im_drive_info *overlap; /* chain of overlap disks */ +} md_im_drive_info_t; + +/* Values for set descriptor flags */ +#define MD_IM_SET_INVALID 0x01 +#define MD_IM_SET_REPLICATED 0x02 + +typedef struct md_im_set_desc { + struct md_im_set_desc *mis_next; + int mis_flags; + int mis_oldsetno; + md_im_drive_info_t *mis_drives; + int mis_active_replicas; +} md_im_set_desc_t; + +extern int meta_list_disks(md_error_t *, md_im_names_t *); +extern mddrivenamelist_t *meta_prune_cnames(md_error_t *, + md_im_names_t *, int); +extern int meta_get_set_info(mddrivenamelist_t *, + md_im_set_desc_t **, int, md_error_t *); +extern int meta_imp_set(md_im_set_desc_t *, + char *, int, bool_t, md_error_t *); +extern int meta_imp_drvused(mdsetname_t *sp, + mddrivename_t *dnp, md_error_t *ep); + +/* Flags for direction in copy_msg_1 */ +#define MD_MN_COPY_TO_ONDISK 0x0001 +#define MD_MN_COPY_TO_INCORE 0x0002 + +extern void copy_msg_1(md_mn_msg_t *incorep, + md_mn_msg_od_t *ondiskp, int direction); +extern void free_msg(md_mn_msg_t *msg); + +extern md_mn_msgclass_t mdmn_get_message_class(md_mn_msgtype_t msgtype); +extern void (*mdmn_get_handler(md_mn_msgtype_t msgtype)) + (md_mn_msg_t *msg, uint_t flags, + md_mn_result_t *res); +extern int (*mdmn_get_submessage_generator(md_mn_msgtype_t type)) + (md_mn_msg_t *msg, md_mn_msg_t **msglist); +extern time_t mdmn_get_timeout(md_mn_msgtype_t msgtype); + +extern int meta_read_nodelist(int *nodecnt, + mndiskset_membershiplist_t **nl, md_error_t *ep); +extern int meta_write_nodelist(int nodecnt, char **nids, + md_error_t *ep); +extern void meta_free_nodelist(mndiskset_membershiplist_t *nl); + +/* Values for set descriptor flags */ +#define MD_IM_SET_INVALID 0x01 + +/* meta_mn_subr.c */ +/* defines for flags argument for meta_mn_send_command() */ +#define MD_DISP_STDERR 0x0000 +#define MD_IGNORE_STDERR 0x0001 +#define MD_DRYRUN 0x0002 +#define MD_RETRY_BUSY 0x0004 +#define MD_NOLOG 0x0008 +#define MD_PANIC_WHEN_INCONSISTENT 0x0010 + +/* define for initall_context argument for meta_mn_send_command() */ +#define NO_CONTEXT_STRING NULL + +extern int meta_is_mn_set(mdsetname_t *sp, md_error_t *ep); +extern int meta_is_mn_name(mdsetname_t **sp, char *name, + md_error_t *ep); +extern void meta_ping_mnset(set_t setno); +extern int meta_mn_send_command(mdsetname_t *sp, int argc, + char *argv[], int flags, char *initall_context, + md_error_t *ep); +extern int meta_mn_send_suspend_writes(minor_t mnum, + md_error_t *ep); +extern int meta_mn_send_setsync(mdsetname_t *sp, + mdname_t *mirnp, daddr_t size, md_error_t *ep); +extern int meta_mn_send_metaclear_command(mdsetname_t *sp, + char *name, mdcmdopts_t options, int pflag, + md_error_t *ep); +extern int meta_mn_send_resync_starting(mdname_t *mirnp, + md_error_t *ep); +extern int meta_mn_change_owner(md_set_mmown_params_t **opp, + set_t setno, uint_t mnum, uint_t owner, + uint_t flags); +extern int meta_mn_singlenode(void); +extern int meta_mn_send_get_tstate(md_dev64_t dev, uint_t *tstatep, + md_error_t *ep); +/* meta_set_prv.c */ +extern int setup_db_bydd(mdsetname_t *sp, md_drive_desc *dd, + int force, md_error_t *ep); +extern int snarf_set(mdsetname_t *sp, bool_t stale_bool, + md_error_t *ep); +extern int halt_set(mdsetname_t *sp, md_error_t *ep); + +#ifdef __cplusplus +} +#endif + +#endif /* _META_H */ diff --git a/usr/src/head/meta_runtime.h b/usr/src/head/meta_runtime.h new file mode 100644 index 0000000000..525ad77346 --- /dev/null +++ b/usr/src/head/meta_runtime.h @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1998 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _META_RUNTIME_H +#define _META_RUNTIME_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Declares functions that return the values of runtime + * parameters set in /etc/lvm/runtime.cf. All + * the functions declared in this file are defined in + * SUNWmd/lib/libmeta/meta_runtime.c unless otherwise + * noted. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/types.h> + +extern +boolean_t +do_owner_ioctls(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _META_RUNTIME_H */ diff --git a/usr/src/head/metacl.x b/usr/src/head/metacl.x new file mode 100644 index 0000000000..a692196f9b --- /dev/null +++ b/usr/src/head/metacl.x @@ -0,0 +1,159 @@ +%/* +% * Copyright 2005 Sun Microsystems, Inc. All rights reserved. +% * Use is subject to license terms. +% * +% * CDDL HEADER START +% * +% * The contents of this file are subject to the terms of the +% * Common Development and Distribution License, Version 1.0 only +% * (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 +% * or http://www.opensolaris.org/os/licensing. +% * 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 +% */ +% +%#pragma ident "%Z%%M% %I% %E% SMI" +% + +#ifdef RPC_SVC +% +%int mdc_in_daemon = 1; +%#include <signal.h> +#endif /* RPC_SVC */ + +#ifdef RPC_HDR +%#ifndef STRINGARRAY +#endif +typedef string stringarray<>; +#ifdef RPC_HDR +%#define STRINGARRAY +%#endif +#endif + +struct mdc_err_t { + int mdc_errno; /* errno or negative error code */ + int mdc_exitcode; /* child exit code. */ + string mdc_node<>; /* associated node */ + string mdc_misc<>; /* misc text */ +}; + +% +%/* +% * rpc argument and response structures +% */ +struct mdc_bind_res_t { + mdc_err_t mdc_status; /* status of RPC call */ +}; + +struct mdcrpc_proxy_args_t { + stringarray argvlist<>; + stringarray environment<>; +}; + +#ifdef RPC_CLNT +%int _mdc_in_daemon = 0; +%#pragma weak mdc_in_daemon = _mdc_in_daemon +%void mdc_clrerror(mdc_err_t *mdcep); + +#endif /* RPC_CLNT */ + +#ifdef RPC_HDR +% +%extern int mdc_in_daemon; +% +%/* +% * Null error structure initializer. +% */ +%#define MDC_NULL_ERR { 0, NULL, NULL } +%#define MD_MDC_DEF_TO {5, 0} /* 5 seconds */ +%#define MD_MDC_PMAP_TO {35, 0} /* 35 seconds */ +%#define MD_MDC_PROXY_TO {60 * 60, 0 } /* 1hr */ +% +%/* +% * various cluster errors, definition of MDC_NOTINCLUSTER must be changed +% * when new errors are added, since MDC_NOERROR has to come out to +% * be zero! +% */ +enum mdc_errno_t { + MDC_PROXYKILLED = -13, /* remote was killed by signal */ + MDC_PROXYNOFORK, /* could not fork remote */ + MDC_PROXYFAILED, /* remote exited non-zero */ + MDC_NOTINCLUSTER, /* host is not a node */ + MDC_NOACCESS, + MDC_NOACCESS_CCR, + MDC_RPCFAILED, + BIND_LINKISDIR, + BIND_NOACCESS_SHARED, + BIND_LOCALSET, + BIND_NODISKSETCLASS, + BIND_NOACCESS_DEVICE, + BIND_BADDEVICE, + MDC_NOERROR +}; + +% +%/* +% * Set MDC_THISVERS to the newest version of the protocol +% * This allows the preprocessor to force an error if the +% * protocol changes, since the kernel xdr routines may need to be +% * recoded. Note that we can't explicitly set the version to a +% * symbol as rpcgen will then create erroneous routine names. +% */ +%#define MDC_V1 1 +%#define MDC_ORIGVERS MDC_V1 +%#define MDC_THISVERS 1 +% +%/* All powerful group 14 */ +%#define MDC_GID 14 +% +%/* +% * External reference to constant null error struct. (declared in med_xdr.c) +% */ +%extern const mdc_err_t mdc_null_err; +%extern const struct timeval md_mdc_def_timeout; +%extern const struct timeval md_mdc_pmap_timeout; +%extern const struct timeval md_mdc_proxy_timeout; +% +%/* +% * Some useful defines +% */ +%#define MDC_SERVNAME "rpc.metacld" +%#define MDC_SVC "metacl" +% +#endif /* RPC_HDR */ + +#ifdef RPC_XDR +% +%/* +% * Constant null error struct. +% */ +%const mdc_err_t mdc_null_err = MDC_NULL_ERR; +%const struct timeval md_mdc_def_timeout = MD_MDC_DEF_TO; +%const struct timeval md_mdc_pmap_timeout = MD_MDC_PMAP_TO; +%const struct timeval md_mdc_proxy_timeout = MD_MDC_PROXY_TO; + +#endif /* RPC_XDR */ + + +% +%/* +% * services available +% */ +program MDC_PROG { + version MDC_VERS { + mdc_bind_res_t mdc_null(void) = 0; + mdc_bind_res_t mdc_bind_devs(void) = 1; + mdc_bind_res_t mdc_proxy(mdcrpc_proxy_args_t) = 2; + } = 1; +} = 100281; diff --git a/usr/src/head/metad.x b/usr/src/head/metad.x new file mode 100644 index 0000000000..6754f4b121 --- /dev/null +++ b/usr/src/head/metad.x @@ -0,0 +1,977 @@ +%/* +% * Copyright 2005 Sun Microsystems, Inc. All rights reserved. +% * Use is subject to license terms. +% * +% * CDDL HEADER START +% * +% * The contents of this file are subject to the terms of the +% * Common Development and Distribution License, Version 1.0 only +% * (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 +% * or http://www.opensolaris.org/os/licensing. +% * 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 +% */ +% +%#pragma ident "%Z%%M% %I% %E% SMI" +% + +%#include <mdiox.h> +%#include <meta_basic.h> +%#include <sys/lvm/mdmn_commd.h> + +#ifdef RPC_SVC +% +%int md_in_daemon = 1; +%#include <signal.h> +#endif /* RPC_SVC */ + +#ifdef RPC_CLNT +%int _md_in_daemon = 0; +%#pragma weak md_in_daemon = _md_in_daemon +#endif /* RPC_CLNT */ + +#ifdef RPC_HDR +% +%extern int md_in_daemon; +%/* +% * There are too many external factors that affect the timing of the +% * operations, so we set the timeout to a very large value, in this +% * case 1 day, which should handle HW timeouts, large configurations, +% * and other potential delays. +% */ +%#define CL_LONG_TMO 86400L +#endif /* RPC_HDR */ + +#ifdef RPC_XDR +% +%/* Start - Avoid duplicate definitions, but get the xdr calls right */ +%#if 0 +#include "../uts/common/sys/lvm/meta_arr.x" +%#endif /* 0 */ +%/* End - Avoid duplicate definitions, but get the xdr calls right */ +% +#endif /* RPC_XDR */ + +% +%/* +% * Structure Revisions +% */ +enum mdrpc_metad_args_rev { + MD_METAD_ARGS_REV_1 = 1 /* Revision 1 */ +}; + +% +%/* +% * device id +% */ +struct mdrpc_devid_res { + string enc_devid<>; /* encoded device id */ + md_error_t status; /* status of RPC call */ +}; + +% +%/* +% * svm rpc version 2 device id arguments +% * (member union in mdrpc_devid_2_args) +% */ +struct mdrpc_devid_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + mddrivename_t *drivenamep; +}; + +% +%/* +% * svm rpc version 2 device id arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_devid_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_devid_args rev1; + default: + void; +}; + +% +%/* +% * For getting the devinfo based upon devid +% */ +struct mdrpc_devidstr_args { + mdsetname_t *sp; + string enc_devid<>; /* encoded device id */ + md_error_t status; /* status of RPC call */ +}; + +% +%/* +% * For getting the devinfo based upon devid/devname +% */ +struct mdrpc_devid_name_args { + mdsetname_t *sp; + string orig_devname<>; /* devname on orig node */ + string enc_devid<>; /* encoded device id */ +}; + +% +%/* +% * svm rpc version 2 devinfo based upon devid/devname +% * (union of all version 2 revisions) +% */ +union mdrpc_devid_name_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_devid_name_args rev1; + default: + void; +}; + +% +%/* +% * version 1 device info +% */ +struct mdrpc_devinfo_res { + dev_t dev; /* major.minor */ + int vtime; /* vtoc timestamp */ + md_error_t status; /* status of RPC call */ +}; + +% +%/* +% * version 2 device info. dev_t is always 64-bit +% */ +struct mdrpc_devinfo_2_res { + md_dev64_t dev; /* major.minor */ + int vtime; /* vtoc timestamp */ + string enc_devid<>; /* encoded device id */ + string devname<>; /* name of the device */ + string drivername<>; /* name of the driver */ + md_error_t status; /* status of RPC call */ +}; + +% +%/* +% * svm rpc version 1 device info arguments +% */ +struct mdrpc_devinfo_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + o_mddrivename_t *drivenamep; +}; + +% +%/* +% * svm rpc version 2 (revision 1) device info arguments +% * (member of union in mdrpc_devinfo_2_args) +% */ +struct mdrpc_devinfo_2_args_r1 { + md_setkey_t *cl_sk; + mdsetname_t *sp; + mddrivename_t *drivenamep; + string enc_devid<>; /* encoded device id */ +}; + +% +%/* +% * svm rpc version 2 device info arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_devinfo_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_devinfo_2_args_r1 rev1; + default: + void; +}; + +struct mdrpc_hostname_res { + string hostname<>; + md_error_t status; +}; + +% +%/* +% * svm rpc version 1 and version 2 (revision 1) getset arguments +% */ +struct mdrpc_getset_args { + string setname<>; + set_t setno; +}; + +% +%/* +% * svm rpc version 2 getset arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_getset_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_getset_args rev1; + default: + void; +}; + +% +%/* NOTE: if you add to this struct, then fix the clnt_getset() */ +%/* to prevent memory leaks */ +struct mdrpc_getset_res { + md_set_record *sr; + md_error_t status; +}; + +% +%/* NOTE: if you add to this struct, then fix the clnt_mngetset() */ +%/* to prevent memory leaks */ +struct mdrpc_mngetset_res { + md_mnset_record *mnsr; + md_error_t status; +}; + +% +%/* NOTE: if you add to this struct, then fix the clnt_getdrivedesc() */ +%/* to prevent memory leaks */ +struct mdrpc_getdrivedesc_res { + md_drive_desc *dd; + md_error_t status; +}; + +#ifdef RPC_HDR +%#ifndef STRINGARRAY +#endif +typedef string stringarray<>; +#ifdef RPC_HDR +%#define STRINGARRAY +%#endif +#endif + +% +%/* +% * svm rpc version 1 and version 2 (revision 1) createset arguments +% */ +struct mdrpc_createset_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + md_node_nm_arr_t nodes; + md_timeval32_t timestamp; + u_long genid; +}; + +% +%/* +% * svm rpc version 2 createset arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_createset_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_createset_args rev1; + default: + void; +}; + +struct mdrpc_mncreateset_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + md_mnnode_desc *nodelist; + md_timeval32_t timestamp; + u_long genid; + md_node_nm_t master_nodenm; + int master_nodeid; +}; + +% +%/* +% * svm rpc version 2 mncreateset arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_mncreateset_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_mncreateset_args rev1; + default: + void; +}; + + +struct mdrpc_bool_res { + int value; + md_error_t status; +}; + +% +%/* +% * svm rpc version 1 drive arguments +% */ +struct mdrpc_drives_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + o_md_drive_desc *drivedescs; + md_timeval32_t timestamp; + u_long genid; +}; + +% +%/* +% * svm rpc version 2 (revision 1) drive arguments +% * (member of union in mrpc_drives_2_args) +% */ +struct mdrpc_drives_2_args_r1 { + md_setkey_t *cl_sk; + mdsetname_t *sp; + md_drive_desc *drivedescs; + md_timeval32_t timestamp; + u_long genid; +}; + +% +%/* +% * svm rpc version 2 drive arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_drives_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_drives_2_args_r1 rev1; + default: + void; +}; + +% +%/* +% * svm rpc version 1 sidename arguments +% */ +struct mdrpc_drv_sidenm_args { + md_setkey_t *cl_sk; + string hostname<>; + mdsetname_t *sp; + o_md_set_desc *sd; + stringarray node_v<>; +}; + +% +%/* +% * svm rpc version 2 (revision 1) sidename arguments +% * (member of union in mdrpc_drv_sidenm_2_args) +% */ +struct mdrpc_drv_sidenm_2_args_r1 { + md_setkey_t *cl_sk; + string hostname<>; + mdsetname_t *sp; + md_set_desc *sd; + stringarray node_v<>; +}; + +% +%/* +% * svm rpc version 2 sidename arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_drv_sidenm_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_drv_sidenm_2_args_r1 rev1; + default: + void; +}; + +% +%/* +% * svm rpc version 1 drvused arguments +% */ +struct mdrpc_drvused_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + o_mddrivename_t *drivenamep; +}; + +% +%/* +% * svm rpc version 2 (revision 1) drvused arguments +% * (member of union in mdrpc_drvused_2_args) +% */ +struct mdrpc_drvused_2_args_r1 { + md_setkey_t *cl_sk; + mdsetname_t *sp; + mddrivename_t *drivenamep; +}; + +% +%/* +% * svm rpc version 2 drvused arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_drvused_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_drvused_2_args_r1 rev1; + default: + void; +}; + +% +%/* +% * svm rpc version 1 and version 2 (revision 1) host arguments +% */ +struct mdrpc_host_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + stringarray hosts<>; +}; + +% +%/* +% * svm rpc version 2 host arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_host_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_host_args rev1; + default: + void; +}; + +struct mdrpc_gtimeout_res { + md_error_t status; + mhd_mhiargs_t *mhiargsp; +}; + +% +%/* +% * svm rpc version 1 and version 2 (revision 1) set timeout arguments +% */ +struct mdrpc_stimeout_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + mhd_mhiargs_t *mhiargsp; +}; + +% +%/* +% * svm rpc version 2 set timeout arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_stimeout_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_stimeout_args rev1; + default: + void; +}; + +% +%/* +% * svm rpc version 1 arguments +% */ +struct mdrpc_upd_dr_flags_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + o_md_drive_desc *drivedescs; + u_int new_flags; +}; + +% +%/* +% * svm rpc version 2 (revision 1) arguments +% * (member of union in mdrpc_upd_dr_flags_2_args) +% */ +struct mdrpc_upd_dr_flags_2_args_r1 { + md_setkey_t *cl_sk; + mdsetname_t *sp; + md_drive_desc *drivedescs; + u_int new_flags; +}; + +% +%/* +% * svm rpc version 2 arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_upd_dr_flags_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_upd_dr_flags_2_args_r1 rev1; + default: + void; +}; + +% +%/* +% * svm rpc version 1 and version 2 (revision 1) arguments +% */ +struct mdrpc_upd_sr_flags_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + u_int new_flags; +}; + +% +%/* +% * svm rpc version 2 arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_upd_sr_flags_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_upd_sr_flags_args rev1; + default: + void; +}; + +% +%/* +% * svm rpc version 2 (revision 1) arguments +% */ +struct mdrpc_upd_nr_flags_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + md_mnnode_desc *nodedescs; + u_int flag_action; + u_int flags; +}; + +% +%/* +% * svm rpc version 2 arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_upd_nr_flags_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_upd_nr_flags_args rev1; + default: + void; +}; + + +struct mdrpc_setlock_res { + md_setkey_t *cl_sk; + md_error_t status; +}; + +struct mdrpc_generic_res { + md_error_t status; +}; + +% +%/* +% * svm rpc version 1 and version 2 (revision 1) set arguments +% */ +struct mdrpc_setno_args { + md_setkey_t *cl_sk; + set_t setno; +}; + +% +%/* +% * svm rpc version 2 set arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_setno_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_setno_args rev1; + default: + void; +}; + +struct mdrpc_null_args { + md_setkey_t *cl_sk; +}; + +% +%/* +% * svm rpc version 1 and version 2 (revision 1) arguments +% */ +struct mdrpc_sp_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; +}; + +% +%/* +% * svm rpc version 2 arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_sp_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_sp_args rev1; + default: + void; +}; + +% +%/* +% * svm rpc version 2 (revision 1) arguments +% */ +struct mdrpc_sp_flags_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + int flags; +}; + +% +%/* +% * svm rpc version 2 arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_sp_flags_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_sp_flags_args rev1; + default: + void; +}; + +% +%/* +% * svm rpc version 1 and version 2 (revision 1) arguments +% */ +struct mdrpc_updmeds_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + md_h_arr_t meds; +}; + +% +%/* +% * svm rpc version 2 arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_updmeds_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_updmeds_args rev1; + default: + void; +}; + +struct mdrpc_mnsetmaster_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + md_node_nm_t master_nodenm; + int master_nodeid; +}; + +% +%/* +% * svm rpc version 2 arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_mnsetmaster_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_mnsetmaster_args rev1; + default: + void; +}; + +/* + * Defines and structures to support rpc.mdcommd. + * RPC routines in rpc.metad will be used to suspend, resume + * and reinitialize the rpc.mdcommd running on that node. + * These actions are needed when the nodelist is changing. + */ +%#define COMMDCTL_SUSPEND 1 +%#define COMMDCTL_RESUME 2 +%#define COMMDCTL_REINIT 3 + +struct mdrpc_mdcommdctl_args { + int flag_action; + set_t setno; + md_mn_msgclass_t class; + int flags; +}; + +% +% +%/* +% * svm rpc version 2 arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_mdcommdctl_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_mdcommdctl_args rev1; + default: + void; +}; + +% +%/* +% * svm rpc version 2 (revision 1) nodeid arguments +% */ +struct mdrpc_nodeid_args { + md_setkey_t *cl_sk; + mdsetname_t *sp; + int nodeid<>; +}; + +% +%/* +% * svm rpc version 2 nodeid arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_nodeid_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_nodeid_args rev1; + default: + void; +}; + +% +%/* +% * Defines and structures to support suspend and resume I/O +% * driven by a remote node. +% */ +%#define MN_SUSP_IO 1 +%#define MN_RES_IO 2 +% +%/* +% * svm rpc version 2 (revision 1) mn_susp_res_io arguments +% * setno of 0 represents all disksets. +% */ +struct mdrpc_mn_susp_res_io_args { + md_setkey_t *susp_res_l_sk; + set_t susp_res_setno; + int susp_res_cmd; +}; + +% +%/* +% * svm rpc version 2 nodeid arguments +% * (union of all version 2 revisions) +% */ +union mdrpc_mn_susp_res_io_2_args switch (mdrpc_metad_args_rev rev) { + case MD_METAD_ARGS_REV_1: + mdrpc_mn_susp_res_io_args rev1; + default: + void; +}; + +#ifdef RPC_HDR +% +%/* +% * authorization info +% */ +const METAD_GID = 14; /* magic sysadmin group */ +#endif /* RPC_HDR */ + +% +%/* +% * services available +% */ +program METAD { + version METAD_VERSION { + md_error_t + mdrpc_nullproc(void) = 0; + + mdrpc_hostname_res + mdrpc_hostname(mdrpc_null_args) = 1; + + mdrpc_generic_res + mdrpc_addhosts(mdrpc_host_args) = 2; + + mdrpc_generic_res + mdrpc_delhosts(mdrpc_host_args) = 3; + + mdrpc_generic_res + mdrpc_createset(mdrpc_createset_args) = 4; + + mdrpc_generic_res + mdrpc_delset(mdrpc_sp_args) = 5; + + mdrpc_getset_res + mdrpc_getset(mdrpc_getset_args) = 6; + + mdrpc_bool_res + mdrpc_setnumbusy(mdrpc_setno_args) = 7; + + mdrpc_bool_res + mdrpc_setnameok(mdrpc_sp_args) = 8; + + mdrpc_bool_res + mdrpc_ownset(mdrpc_sp_args) = 9; + + mdrpc_generic_res + mdrpc_adddrvs(mdrpc_drives_args) = 10; + + mdrpc_generic_res + mdrpc_deldrvs(mdrpc_drives_args) = 11; + + mdrpc_generic_res + mdrpc_upd_dr_dbinfo(mdrpc_drives_args) = 12; + + mdrpc_devinfo_res + mdrpc_devinfo(mdrpc_devinfo_args) = 13; + + mdrpc_generic_res + mdrpc_drvused(mdrpc_drvused_args) = 14; + + mdrpc_generic_res + mdrpc_add_drv_sidenms(mdrpc_drv_sidenm_args) = 15; + + mdrpc_generic_res + mdrpc_del_drv_sidenms(mdrpc_sp_args) = 16; + + mdrpc_gtimeout_res + mdrpc_gtimeout(mdrpc_sp_args) = 17; + + mdrpc_generic_res + mdrpc_stimeout(mdrpc_stimeout_args) = 18; + + mdrpc_generic_res + mdrpc_upd_dr_flags(mdrpc_upd_dr_flags_args) = 19; + + mdrpc_generic_res + mdrpc_upd_sr_flags(mdrpc_upd_sr_flags_args) = 20; + + mdrpc_setlock_res + mdrpc_unlock_set(mdrpc_null_args) = 21; + + mdrpc_setlock_res + mdrpc_lock_set(mdrpc_null_args) = 22; + + mdrpc_generic_res + mdrpc_updmeds(mdrpc_updmeds_args) = 23; + + mdrpc_generic_res + mdrpc_flush_internal(mdrpc_null_args) = 24; + + } = 1; + + version METAD_VERSION_DEVID { + md_error_t + mdrpc_nullproc(void) = 0; + + mdrpc_hostname_res + mdrpc_hostname(mdrpc_null_args) = 1; + + mdrpc_generic_res + mdrpc_addhosts(mdrpc_host_2_args) = 2; + + mdrpc_generic_res + mdrpc_delhosts(mdrpc_host_2_args) = 3; + + mdrpc_generic_res + mdrpc_createset(mdrpc_createset_2_args) = 4; + + mdrpc_generic_res + mdrpc_delset(mdrpc_sp_2_args) = 5; + + mdrpc_getset_res + mdrpc_getset(mdrpc_getset_2_args) = 6; + + mdrpc_bool_res + mdrpc_setnumbusy(mdrpc_setno_2_args) = 7; + + mdrpc_bool_res + mdrpc_setnameok(mdrpc_sp_2_args) = 8; + + mdrpc_bool_res + mdrpc_ownset(mdrpc_sp_2_args) = 9; + + mdrpc_generic_res + mdrpc_adddrvs(mdrpc_drives_2_args) = 10; + + mdrpc_generic_res + mdrpc_deldrvs(mdrpc_drives_2_args) = 11; + + mdrpc_generic_res + mdrpc_upd_dr_dbinfo(mdrpc_drives_2_args) = 12; + + mdrpc_devinfo_2_res + mdrpc_devinfo(mdrpc_devinfo_2_args) = 13; + + mdrpc_generic_res + mdrpc_drvused(mdrpc_drvused_2_args) = 14; + + mdrpc_generic_res + mdrpc_add_drv_sidenms(mdrpc_drv_sidenm_2_args) = 15; + + mdrpc_generic_res + mdrpc_del_drv_sidenms(mdrpc_sp_2_args) = 16; + + mdrpc_gtimeout_res + mdrpc_gtimeout(mdrpc_sp_2_args) = 17; + + mdrpc_generic_res + mdrpc_stimeout(mdrpc_stimeout_2_args) = 18; + + mdrpc_generic_res + mdrpc_upd_dr_flags(mdrpc_upd_dr_flags_2_args) = 19; + + mdrpc_generic_res + mdrpc_upd_sr_flags(mdrpc_upd_sr_flags_2_args) = 20; + + mdrpc_setlock_res + mdrpc_unlock_set(mdrpc_null_args) = 21; + + mdrpc_setlock_res + mdrpc_lock_set(mdrpc_null_args) = 22; + + mdrpc_generic_res + mdrpc_updmeds(mdrpc_updmeds_2_args) = 23; + + mdrpc_generic_res + mdrpc_flush_internal(mdrpc_null_args) = 24; + + mdrpc_devid_res + mdrpc_devid(mdrpc_devid_2_args) = 25; + + mdrpc_devinfo_2_res + mdrpc_devinfo_by_devid(mdrpc_devidstr_args) = 26; + + mdrpc_generic_res + mdrpc_resnarf_set(mdrpc_setno_2_args) = 27; + + mdrpc_generic_res + mdrpc_mncreateset(mdrpc_mncreateset_2_args) = 28; + + mdrpc_mngetset_res + mdrpc_mngetset(mdrpc_getset_2_args) = 29; + + mdrpc_generic_res + mdrpc_mnsetmaster(mdrpc_mnsetmaster_2_args) = 30; + + mdrpc_generic_res + mdrpc_joinset(mdrpc_sp_flags_2_args) = 31; + + mdrpc_generic_res + mdrpc_withdrawset(mdrpc_sp_2_args) = 32; + + mdrpc_generic_res + mdrpc_upd_nr_flags(mdrpc_upd_nr_flags_2_args) = 33; + + mdrpc_bool_res + mdrpc_mn_is_stale(mdrpc_setno_2_args) = 34; + + mdrpc_generic_res + mdrpc_mdcommdctl(mdrpc_mdcommdctl_2_args) = 35; + + mdrpc_generic_res + mdrpc_clr_mnsetlock(mdrpc_null_args) = 36; + + mdrpc_getdrivedesc_res + mdrpc_getdrivedesc(mdrpc_sp_2_args) = 37; + + mdrpc_generic_res + mdrpc_upd_dr_reconfig(mdrpc_upd_dr_flags_2_args) = 38; + + mdrpc_generic_res + mdrpc_reset_mirror_owner(mdrpc_nodeid_2_args) = 39; + + mdrpc_generic_res + mdrpc_mn_susp_res_io(mdrpc_mn_susp_res_io_2_args) = 40; + + mdrpc_generic_res + mdrpc_mn_mirror_resync_all(mdrpc_setno_2_args) = 41; + + mdrpc_devinfo_2_res + mdrpc_devinfo_by_devid_name(mdrpc_devid_name_2_args) = 42; + + mdrpc_generic_res + mdrpc_mn_sp_update_abr(mdrpc_setno_2_args) = 43; + + } = 2; +} = 100229; + +#ifdef RPC_HDR +% +%extern void short_circuit_getset(mdrpc_getset_args *args, +% mdrpc_getset_res *res); +%extern void short_circuit_mngetset(mdrpc_getset_args *args, +% mdrpc_mngetset_res *res); +#endif /* RPC_HDR */ diff --git a/usr/src/head/metadyn.h b/usr/src/head/metadyn.h new file mode 100644 index 0000000000..b26606845c --- /dev/null +++ b/usr/src/head/metadyn.h @@ -0,0 +1,111 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1998, 2000 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _METADYN_H +#define _METADYN_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define METALDPATH_DEFAULT "/usr/lib" +#define METATOOLLDPATH_DEFAULT "/usr/sadm/lib/lvm" + +typedef enum { + /* + * Conversion of driver name from cinfo should have occurred, + * but something prevented that from taking place. + */ + Convert_Error, + + /* + * The library being called doesn't handle this driver so nothing + * was done. + */ + Convert_Noop, + + /* + * Conversion completed without errors. + */ + Convert_Okay +} meta_convert_e; + +meta_convert_e convert_path(mdname_t *, struct dk_cinfo *, mdcinfo_t *, + md_error_t *); + +typedef enum { + /* + * While trying to determine information regarding the enclosure, + * such as tray, bus, or world wide number and error occurred. + */ + Enclosure_Error, + + /* + * This library doesn't handle this device name. No changes have been + * made to the structures. + */ + Enclosure_Noop, + + /* + * Successfully determined all pertinent information regarding + * the enclosure. + */ + Enclosure_Okay +} meta_enclosure_e; + +meta_enclosure_e get_enclosure(mdname_t *, mdcinfo_t *, md_error_t *); + +typedef enum { + /* + * When one library tries to load another and finds the second + * library already locked, lock_and_load will return this value. + */ + Library_Locked, + + /* + * If all goes well during a library load we'll receive this + * return code. + */ + Library_Unlocked, + + /* + * Failed to even open the requested library + */ + Library_Open_Error +} meta_library_e; + +meta_library_e lock_and_load(const char *, void **); +void unlock_and_unload(void *); + +char *get_phys_name(char *); + +#ifdef __cplusplus +} +#endif + +#endif /* _METADYN_H */ diff --git a/usr/src/head/metamhd.x b/usr/src/head/metamhd.x new file mode 100644 index 0000000000..43acb23770 --- /dev/null +++ b/usr/src/head/metamhd.x @@ -0,0 +1,183 @@ +%/* +% * Copyright 2005 Sun Microsystems, Inc. All rights reserved. +% * Use is subject to license terms. +% * +% * CDDL HEADER START +% * +% * The contents of this file are subject to the terms of the +% * Common Development and Distribution License, Version 1.0 only +% * (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 +% * or http://www.opensolaris.org/os/licensing. +% * 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 +% */ +% +%#pragma ident "%Z%%M% %I% %E% SMI" +% + +/* pick up multihost ioctl definitions */ +%#include <mhdx.h> + +#ifdef RPC_SVC +% +%#include <signal.h> +#endif /* RPC_SVC */ + +#ifdef RPC_HDR +% +%/* +% * error info +% */ +%#define MHD_E_MAJORITY -1 /* couldn't get majority reservation */ +%#define MHD_E_RESERVED -2 /* drive is reserved */ +#endif /* RPC_HDR */ +struct mhd_error_t { + int errnum; /* errno or negative error code */ + string name<>; /* associated name */ +}; + +#ifdef RPC_HDR +% +%/* +% * null error constant +% */ +%#define MHD_NULL_ERROR { 0, NULL } +#endif /* RPC_HDR */ + +#ifdef RPC_XDR +% +%/* +% * Constant null error struct. +% */ +%const mhd_error_t mhd_null_error = MHD_NULL_ERROR; +#endif /* RPC_XDR */ + +#ifdef RPC_HDR +% +%/* +% * External reference to constant null error struct. (decl. in metamhd_xdr.c) +% */ +%extern const mhd_error_t mhd_null_error; +#endif /* RPC_HDR */ + + +% +%/* +% * drivename type +% */ +typedef string mhd_drivename_t<>; + +% +%/* +% * set definition +% */ +struct mhd_set_t { + string setname<>; /* set name */ + mhd_drivename_t drives<>; /* drive names */ +}; + +% +%/* +% * common options +% */ +typedef u_int mhd_opts_t; +#ifdef RPC_HDR +% +%#define MHD_PARTIAL_SET 0x01 /* partial set definition */ +%#define MHD_SERIAL 0x02 /* process disks serially */ +#endif /* RPC_HDR */ + +% +%/* +% * take ownership +% */ +enum mhd_ff_mode_t { + MHD_FF_NONE, /* no failfast */ + MHD_FF_DRIVER, /* set failfast on each drive */ + MHD_FF_DEBUG, /* use /dev/ff debug mode */ + MHD_FF_HALT, /* use /dev/ff halt mode */ + MHD_FF_PANIC /* use /dev/ff panic mode */ +}; +struct mhd_tkown_args_t { + mhd_set_t set; /* set definition */ + mhd_mhiargs_t timeouts; /* timeout values */ + mhd_ff_mode_t ff_mode; /* failfast mode */ + mhd_opts_t options; /* options */ +}; + +% +%/* +% * release ownership +% */ +struct mhd_relown_args_t { + mhd_set_t set; /* set definition */ + mhd_opts_t options; /* options */ +}; + +% +%/* +% * inquire status +% */ +struct mhd_status_args_t { + mhd_set_t set; /* set definition */ + mhd_opts_t options; /* options */ +}; +struct mhd_drive_status_t { + mhd_drivename_t drive; /* drive name */ + int errnum; /* drive status */ +}; +struct mhd_status_res_t { + mhd_error_t status; /* status of command */ + mhd_drive_status_t results<>; /* drive status */ +}; + +%/* +% * get local drives +% */ +struct mhd_list_args_t { + string path<>; /* where to look (or NULL) */ + mhd_did_flags_t flags; /* what to get */ +}; +struct mhd_list_res_t { + mhd_error_t status; /* status of command */ + mhd_drive_info_list_t results; /* drive info list */ +}; + +% +%/* +% * authorization info +% */ +const METAMHD_GID = 14; /* magic sysadmin group */ + +% +%/* +% * services available +% */ +program METAMHD { + version METAMHD_VERSION { + + mhd_error_t + mhd_tkown(mhd_tkown_args_t) = 1; + + mhd_error_t + mhd_relown(mhd_relown_args_t) = 2; + + mhd_status_res_t + mhd_status(mhd_status_args_t) = 3; + + mhd_list_res_t + mhd_list(mhd_list_args_t) = 4; + + } = 1; +} = 100230; diff --git a/usr/src/head/mon.h b/usr/src/head/mon.h new file mode 100644 index 0000000000..4b9264cc66 --- /dev/null +++ b/usr/src/head/mon.h @@ -0,0 +1,88 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _MON_H +#define _MON_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Inclusion of <sys/types.h> will break SVID namespace, hence only + * the size_t type is defined in this header. + */ +#if !defined(_SIZE_T) || __cplusplus >= 199711L +#define _SIZE_T +#if defined(_LP64) || defined(_I32LPx) +typedef unsigned long size_t; /* size of something in bytes */ +#else +typedef unsigned int size_t; /* (historical version) */ +#endif +#endif /* _SIZE_T */ + +struct hdr { + char *lpc; + char *hpc; + size_t nfns; +}; + +struct cnt { + char *fnpc; + long mcnt; +}; + +typedef unsigned short WORD; + +#define MON_OUT "mon.out" +#define MPROGS0 (150 * sizeof (WORD)) /* 300 for pdp11, 600 for 32-bits */ +#define MSCALE0 4 + +#ifndef NULL +#if defined(_LP64) +#define NULL 0L +#else +#define NULL 0 +#endif +#endif + +#if defined(__STDC__) +extern void monitor(int (*)(void), int (*)(void), WORD *, size_t, size_t); +#else +extern void monitor(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _MON_H */ diff --git a/usr/src/head/monetary.h b/usr/src/head/monetary.h new file mode 100644 index 0000000000..6c190a7a44 --- /dev/null +++ b/usr/src/head/monetary.h @@ -0,0 +1,50 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _MONETARY_H +#define _MONETARY_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) +extern ssize_t strfmon(char *_RESTRICT_KYWD, size_t, + const char *_RESTRICT_KYWD, ...); +#else +extern ssize_t strfmon(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _MONETARY_H */ diff --git a/usr/src/head/mp.h b/usr/src/head/mp.h new file mode 100644 index 0000000000..4360a3f62f --- /dev/null +++ b/usr/src/head/mp.h @@ -0,0 +1,93 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1989 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _MP_H +#define _MP_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +struct mint { + int len; + short *val; +}; +typedef struct mint MINT; + + +#ifdef __STDC__ +extern void mp_gcd(MINT *, MINT *, MINT *); +extern void mp_madd(MINT *, MINT *, MINT *); +extern void mp_msub(MINT *, MINT *, MINT *); +extern void mp_mdiv(MINT *, MINT *, MINT *, MINT *); +extern void mp_sdiv(MINT *, short, MINT *, short *); +extern int mp_min(MINT *); +extern void mp_mout(MINT *); +extern int mp_msqrt(MINT *, MINT *, MINT *); +extern void mp_mult(MINT *, MINT *, MINT *); +extern void mp_pow(MINT *, MINT *, MINT *, MINT *); +extern void mp_rpow(MINT *, short, MINT *); +extern MINT *mp_itom(short); +extern int mp_mcmp(MINT *, MINT *); +extern MINT *mp_xtom(char *); +extern char *mp_mtox(MINT *); +extern void mp_mfree(MINT *); +#else +extern void mp_gcd(); +extern void mp_madd(); +extern void mp_msub(); +extern void mp_mdiv(); +extern void mp_sdiv(); +extern int mp_min(); +extern void mp_mout(); +extern int mp_msqrt(); +extern void mp_mult(); +extern void mp_pow(); +extern void mp_rpow(); +extern MINT *mp_itom(); +extern int mp_mcmp(); +extern MINT *mp_xtom(); +extern char *mp_mtox(); +extern void mp_mfree(); +#endif + +#define FREE(x) _mp_xfree(&(x)) /* Compatibility */ + +#ifdef __cplusplus +} +#endif + +#endif /* _MP_H */ diff --git a/usr/src/head/mqueue.h b/usr/src/head/mqueue.h new file mode 100644 index 0000000000..b56a6242be --- /dev/null +++ b/usr/src/head/mqueue.h @@ -0,0 +1,99 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _MQUEUE_H +#define _MQUEUE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/types.h> +#include <sys/fcntl.h> +#include <sys/signal.h> +#include <sys/siginfo.h> +#include <time.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *mqd_t; /* opaque message queue descriptor */ + +struct mq_attr { + long mq_flags; /* message queue flags */ + long mq_maxmsg; /* maximum number of messages */ + long mq_msgsize; /* maximum message size */ + long mq_curmsgs; /* number of messages currently queued */ + int mq_pad[12]; +}; + +/* + * function prototypes + */ +#if defined(__STDC__) +#if (_POSIX_C_SOURCE - 0 > 0) && (_POSIX_C_SOURCE - 0 <= 2) +#error "POSIX Message Passing is not supported in POSIX.1-1990" +#endif +#include <sys/siginfo.h> +mqd_t mq_open(const char *, int, ...); +int mq_close(mqd_t); +int mq_unlink(const char *); +int mq_send(mqd_t, const char *, size_t, unsigned int); +int mq_timedsend(mqd_t, const char *, size_t, unsigned int, + const struct timespec *); +int mq_reltimedsend_np(mqd_t, const char *, size_t, unsigned int, + const struct timespec *); +ssize_t mq_receive(mqd_t, char *, size_t, unsigned int *); +ssize_t mq_timedreceive(mqd_t, char *_RESTRICT_KYWD, size_t, + unsigned int *_RESTRICT_KYWD, + const struct timespec *_RESTRICT_KYWD); +ssize_t mq_reltimedreceive_np(mqd_t, char *_RESTRICT_KYWD, size_t, + unsigned int *_RESTRICT_KYWD, + const struct timespec *_RESTRICT_KYWD); +int mq_notify(mqd_t, const struct sigevent *); +int mq_getattr(mqd_t, struct mq_attr *); +int mq_setattr(mqd_t, const struct mq_attr *_RESTRICT_KYWD, + struct mq_attr *_RESTRICT_KYWD); +#else +mqd_t mq_open(); +int mq_close(); +int mq_unlink(); +int mq_send(); +int mq_timedsend(); +int mq_reltimedsend_np(); +ssize_t mq_receive(); +ssize_t mq_timedreceive(); +ssize_t mq_reltimedreceive_np(); +int mq_notify(); +int mq_getattr(); +int mq_setattr(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _MQUEUE_H */ diff --git a/usr/src/head/nan.h b/usr/src/head/nan.h new file mode 100644 index 0000000000..52f870b859 --- /dev/null +++ b/usr/src/head/nan.h @@ -0,0 +1,140 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1996, by Sun Microsystems, Inc. + * All Rights Reserved + */ + +#ifndef _NAN_H +#define _NAN_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Handling of Not_a_Number's (only in IEEE floating-point standard) + */ + +#include <sys/isa_defs.h> +#include <values.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_IEEE_754) +/* + * Structure order is endian dependent. Only the common variants of + * big and little endian are supported. + */ + +#if defined(_BIG_ENDIAN) + +typedef union +{ + struct + { + unsigned sign : 1; + unsigned exponent :11; + unsigned bits :20; + unsigned fraction_low :32; + } inf_parts; + struct + { + unsigned sign : 1; + unsigned exponent :11; + unsigned qnan_bit : 1; + unsigned bits :19; + unsigned fraction_low :32; + } nan_parts; + double d; + +} dnan; + +#else /* Must be _LITTLE_ENDIAN */ + +typedef union +{ + struct { + unsigned fraction_low :32; + unsigned bits :20; + unsigned exponent :11; + unsigned sign : 1; + } inf_parts; + struct { + unsigned fraction_low :32; + unsigned bits :19; + unsigned qnan_bit : 1; + unsigned exponent :11; + unsigned sign : 1; + } nan_parts; + double d; +} dnan; + +#endif /* Endian based selection */ + +/* + * IsNANorINF checks that exponent of double == 2047 + * i.e. that number is a NaN or an infinity + */ +#define IsNANorINF(X) (((dnan *)&(X))->nan_parts.exponent == 0x7ff) + +/* + * IsINF must be used after IsNANorINF has checked the exponent + */ +#define IsINF(X) (((dnan *)&(X))->inf_parts.bits == 0 && \ + ((dnan *)&(X))->inf_parts.fraction_low == 0) + +/* + * IsPosNAN and IsNegNAN can be used to check the sign of infinities too + */ +#define IsPosNAN(X) (((dnan *)&(X))->nan_parts.sign == 0) + +#define IsNegNAN(X) (((dnan *)&(X))->nan_parts.sign == 1) + +/* + * GETNaNPC gets the leftmost 32 bits of the fraction part + */ +#define GETNaNPC(dval) (((dnan *)&(dval))->inf_parts.bits << 12 | \ + ((dnan *)&(dval))->nan_parts.fraction_low >> 20) + +#if defined(__STDC__) +#define KILLFPE() (void) _kill(_getpid(), 8) +#else +#define KILLFPE() (void) kill(getpid(), 8) +#endif +#define NaN(X) (((dnan *)&(X))->nan_parts.exponent == 0x7ff) +#define KILLNaN(X) if (NaN(X)) KILLFPE() + +#else /* defined(_IEEE_754) */ +/* #error is strictly ansi-C, but works as well as anything for K&R systems. */ +#error ISA not supported +#endif /* defined(_IEEE_754) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NAN_H */ diff --git a/usr/src/head/ndbm.h b/usr/src/head/ndbm.h new file mode 100644 index 0000000000..8fa2b8666f --- /dev/null +++ b/usr/src/head/ndbm.h @@ -0,0 +1,130 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1989 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +/* + * Hashed key data base library. + */ + +#ifndef _NDBM_H +#define _NDBM_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * flags to dbm_store() + */ +#define DBM_INSERT 0 +#define DBM_REPLACE 1 + +#define _PBLKSIZ 1024 +#define _DBLKSIZ 4096 + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +#define PBLKSIZ _PBLKSIZ +#define DBLKSIZ _DBLKSIZ +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +typedef struct { + int dbm_dirf; /* open directory file */ + int dbm_pagf; /* open page file */ + int dbm_flags; /* flags, see below */ + long dbm_maxbno; /* last ``bit'' in dir file */ + long dbm_bitno; /* current bit number */ + long dbm_hmask; /* hash mask */ + long dbm_blkptr; /* current block for dbm_nextkey */ + int dbm_keyptr; /* current key for dbm_nextkey */ + long dbm_blkno; /* current page to read/write */ + long dbm_pagbno; /* current page in pagbuf */ + char dbm_pagbuf[_PBLKSIZ]; /* page file block buffer */ + long dbm_dirbno; /* current block in dirbuf */ + char dbm_dirbuf[_DBLKSIZ]; /* directory file block buffer */ +} DBM; + +#if defined(_XPG4_2) +typedef struct { + void *dptr; + size_t dsize; +} datum; +#else +typedef struct { + char *dptr; + long dsize; +} datum; +#endif + +#ifdef __STDC__ +DBM *dbm_open(const char *, int, mode_t); +void dbm_close(DBM *); +datum dbm_fetch(DBM *, datum); +datum dbm_firstkey(DBM *); +datum dbm_nextkey(DBM *); +int dbm_delete(DBM *, datum); +int dbm_store(DBM *, datum, datum, int); +int dbm_clearerr(DBM *); +int dbm_error(DBM *); +#else +DBM *dbm_open(); +void dbm_close(); +datum dbm_fetch(); +datum dbm_firstkey(); +datum dbm_nextkey(); +int dbm_delete(); +int dbm_store(); +int dbm_clearerr(); +int dbm_error(); +#endif + +#define _DBM_RDONLY 0x1 /* data base open read-only */ +#define _DBM_IOERR 0x2 /* data base I/O error */ + +#define dbm_rdonly(__db) ((__db)->dbm_flags & _DBM_RDONLY) +#define dbm_error(__db) ((__db)->dbm_flags & _DBM_IOERR) +/* use this one at your own risk! */ +#define dbm_clearerr(__db) ((__db)->dbm_flags &= ~_DBM_IOERR) +/* for fstat(2) */ +#define dbm_dirfno(__db) ((__db)->dbm_dirf) +#define dbm_pagfno(__db) ((__db)->dbm_pagf) + +#ifdef __cplusplus +} +#endif + +#endif /* _NDBM_H */ diff --git a/usr/src/head/netconfig.h b/usr/src/head/netconfig.h new file mode 100644 index 0000000000..66ca62717a --- /dev/null +++ b/usr/src/head/netconfig.h @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _NETCONFIG_H +#define _NETCONFIG_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */ + +#include <sys/netconfig.h> + +#endif /* _NETCONFIG_H */ diff --git a/usr/src/head/netdb.h b/usr/src/head/netdb.h new file mode 100644 index 0000000000..666b0a7cce --- /dev/null +++ b/usr/src/head/netdb.h @@ -0,0 +1,464 @@ +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * BIND 4.9.3: + * + * Copyright (c) 1980, 1983, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * --Copyright-- + * + * End BIND 4.9.3 + */ + +/* + * Structures returned by network data base library. + * All addresses are supplied in host order, and + * returned in network order (suitable for use in system calls). + */ + +#ifndef _NETDB_H +#define _NETDB_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <netinet/in.h> +#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) +#include <sys/socket.h> +#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */ +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define _PATH_HEQUIV "/etc/hosts.equiv" +#define _PATH_HOSTS "/etc/hosts" +#define _PATH_IPNODES "/etc/inet/ipnodes" +#define _PATH_IPSECALGS "/etc/inet/ipsecalgs" +#define _PATH_NETMASKS "/etc/netmasks" +#define _PATH_NETWORKS "/etc/networks" +#define _PATH_PROTOCOLS "/etc/protocols" +#define _PATH_SERVICES "/etc/services" + +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + + +/* + * addrinfo introduced with IPv6 for Protocol-Independent Hostname + * and Service Name Translation. + */ + +#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME, ... */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ +#ifdef __sparcv9 + int _ai_pad; /* for backwards compat with old size_t */ +#endif /* __sparcv9 */ + socklen_t ai_addrlen; + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; +/* addrinfo flags */ +#define AI_PASSIVE 0x0008 /* intended for bind() + listen() */ +#define AI_CANONNAME 0x0010 /* return canonical version of host */ +#define AI_NUMERICHOST 0x0020 /* use numeric node address string */ +#define AI_NUMERICSERV 0x0040 /* servname is assumed numeric */ + +/* getipnodebyname() flags */ +#define AI_V4MAPPED 0x0001 /* IPv4 mapped addresses if no IPv6 */ +#define AI_ALL 0x0002 /* IPv6 and IPv4 mapped addresses */ +#define AI_ADDRCONFIG 0x0004 /* AAAA or A records only if IPv6/IPv4 cnfg'd */ + +/* + * These were defined in RFC 2553 but not SUSv3 + * or RFC 3493 which obsoleted 2553. + */ +#if !defined(_XPG6) || defined(__EXTENSIONS__) +#define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG) + +/* addrinfo errors */ +#define EAI_ADDRFAMILY 1 /* address family not supported */ +#define EAI_NODATA 7 /* no address */ +#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ +#define EAI_AGAIN 2 /* DNS temporary failure */ +#define EAI_BADFLAGS 3 /* invalid ai_flags */ +#define EAI_FAIL 4 /* DNS non-recoverable failure */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +#define EAI_NONAME 8 /* host/servname not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error in errno */ +#define EAI_OVERFLOW 12 /* argument buffer overflow */ + +/* getnameinfo flags */ +#define NI_NOFQDN 0x0001 +#define NI_NUMERICHOST 0x0002 /* return numeric form of address */ +#define NI_NAMEREQD 0x0004 /* request DNS name */ +#define NI_NUMERICSERV 0x0008 +#define NI_DGRAM 0x0010 + +#if !defined(_XPG6) || defined(__EXTENSIONS__) +/* Not listed in any standards document */ +#define NI_WITHSCOPEID 0x0020 +#define NI_NUMERICSCOPE 0x0040 + +/* getnameinfo max sizes as defined in RFC 2553 obsoleted in RFC 3493 */ +#define NI_MAXHOST 1025 +#define NI_MAXSERV 32 +#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ +#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */ + +/* + * Algorithm entry for /etc/inet/ipsecalgs which defines IPsec protocols + * and algorithms. + */ +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +typedef struct ipsecalgent { + char **a_names; /* algorithm names */ + int a_proto_num; /* protocol number */ + int a_alg_num; /* algorithm number */ + char *a_mech_name; /* encryption framework mechanism name */ + int *a_block_sizes; /* supported block sizes */ + int *a_key_sizes; /* supported key sizes */ + int a_key_increment; /* key size increment */ +} ipsecalgent_t; + +/* well-known IPsec protocol numbers */ + +#define IPSEC_PROTO_AH 2 +#define IPSEC_PROTO_ESP 3 +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + int n_addrtype; /* net address type */ + in_addr_t n_net; /* network # */ +}; + +struct protoent { + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol # */ +}; + +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; + +#ifdef __STDC__ +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +struct hostent *gethostbyname_r + (const char *, struct hostent *, char *, int, int *h_errnop); +struct hostent *gethostbyaddr_r + (const char *, int, int, struct hostent *, char *, int, int *h_errnop); +struct hostent *getipnodebyname(const char *, int, int, int *); +struct hostent *getipnodebyaddr(const void *, size_t, int, int *); +void freehostent(struct hostent *); +struct hostent *gethostent_r(struct hostent *, char *, int, int *h_errnop); + +struct servent *getservbyname_r + (const char *name, const char *, struct servent *, char *, int); +struct servent *getservbyport_r + (int port, const char *, struct servent *, char *, int); +struct servent *getservent_r(struct servent *, char *, int); + +struct netent *getnetbyname_r + (const char *, struct netent *, char *, int); +struct netent *getnetbyaddr_r(long, int, struct netent *, char *, int); +struct netent *getnetent_r(struct netent *, char *, int); + +struct protoent *getprotobyname_r + (const char *, struct protoent *, char *, int); +struct protoent *getprotobynumber_r + (int, struct protoent *, char *, int); +struct protoent *getprotoent_r(struct protoent *, char *, int); + +int getnetgrent_r(char **, char **, char **, char *, int); +int innetgr(const char *, const char *, const char *, const char *); +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +/* Old interfaces that return a pointer to a static area; MT-unsafe */ +struct hostent *gethostbyname(const char *); +struct hostent *gethostent(void); +struct netent *getnetbyaddr(in_addr_t, int); +struct netent *getnetbyname(const char *); +struct netent *getnetent(void); +struct protoent *getprotobyname(const char *); +struct protoent *getprotobynumber(int); +struct protoent *getprotoent(void); +struct servent *getservbyname(const char *, const char *); +struct servent *getservbyport(int, const char *); +struct servent *getservent(void); + +/* gethostbyaddr() second argument is a size_t only in unix95/unix98 */ +#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) +struct hostent *gethostbyaddr(const void *, socklen_t, int); +#else +struct hostent *gethostbyaddr(const void *, size_t, int); +#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */ + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +int endhostent(void); +int endnetent(void); +int endprotoent(void); +int endservent(void); +int sethostent(int); +int setnetent(int); +int setprotoent(int); +int setservent(int); +#else +void endhostent(void); +void endnetent(void); +void endprotoent(void); +void endservent(void); +void sethostent(int); +void setnetent(int); +void setprotoent(int); +void setservent(int); +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) + +#ifdef _XPG6 +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname getaddrinfo __xnet_getaddrinfo +#else /* __PRAGMA_REDEFINE_EXTNAME */ +#define getaddrinfo __xnet_getaddrinfo +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* _XPG6 */ + +int getaddrinfo(const char *_RESTRICT_KYWD, + const char *_RESTRICT_KYWD, + const struct addrinfo *_RESTRICT_KYWD, + struct addrinfo **_RESTRICT_KYWD); +void freeaddrinfo(struct addrinfo *); +const char *gai_strerror(int); +int getnameinfo(const struct sockaddr *_RESTRICT_KYWD, + socklen_t, char *_RESTRICT_KYWD, socklen_t, + char *_RESTRICT_KYWD, socklen_t, int); +#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */ + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +int getnetgrent(char **, char **, char **); +int setnetgrent(const char *); +int endnetgrent(void); +int rcmd(char **, unsigned short, + const char *, const char *, const char *, int *); +int rcmd_af(char **, unsigned short, + const char *, const char *, const char *, int *, int); +int rresvport_af(int *, int); +int rresvport_addr(int *, struct sockaddr_storage *); +int rexec(char **, unsigned short, + const char *, const char *, const char *, int *); +int rexec_af(char **, unsigned short, + const char *, const char *, const char *, int *, int); +int rresvport(int *); +int ruserok(const char *, int, const char *, const char *); +/* BIND */ +struct hostent *gethostbyname2(const char *, int); +void herror(const char *); +const char *hstrerror(int); +/* End BIND */ + +/* IPsec algorithm prototype definitions */ +struct ipsecalgent *getipsecalgbyname(const char *, int, int *); +struct ipsecalgent *getipsecalgbynum(int, int, int *); +int getipsecprotobyname(const char *doi_name); +char *getipsecprotobynum(int doi_domain); +void freeipsecalgent(struct ipsecalgent *ptr); +/* END IPsec algorithm prototype definitions */ + +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ +#else /* __STDC__ */ +struct hostent *gethostbyname_r(); +struct hostent *gethostbyaddr_r(); +struct hostent *getipnodebyname(); +struct hostent *getipnodebyaddr(); +void freehostent(); +struct hostent *gethostent_r(); +struct servent *getservbyname_r(); +struct servent *getservbyport_r(); +struct servent *getservent_r(); +struct netent *getnetbyname_r(); +struct netent *getnetbyaddr_r(); +struct netent *getnetent_r(); +struct protoent *getprotobyname_r(); +struct protoent *getprotobynumber_r(); +struct protoent *getprotoent_r(); +int getnetgrent_r(); +int innetgr(); + +/* Old interfaces that return a pointer to a static area; MT-unsafe */ +struct hostent *gethostbyname(); +struct hostent *gethostbyaddr(); +struct hostent *gethostent(); +struct netent *getnetbyname(); +struct netent *getnetbyaddr(); +struct netent *getnetent(); +struct servent *getservbyname(); +struct servent *getservbyport(); +struct servent *getservent(); +struct protoent *getprotobyname(); +struct protoent *getprotobynumber(); +struct protoent *getprotoent(); +int getnetgrent(); + +int sethostent(); +int endhostent(); +int setnetent(); +int endnetent(); +int setservent(); +int endservent(); +int setprotoent(); +int endprotoent(); +int setnetgrent(); +int endnetgrent(); +int rcmd(); +int rcmd_af(); +int rexec(); +int rexec_af(); +int rresvport(); +int rresvport_af(); +int rresvport_addr(); +int ruserok(); +/* BIND */ +struct hostent *gethostbyname2(); +void herror(); +char *hstrerror(); +/* IPv6 prototype definitons */ +int getaddrinfo(); +void freeaddrinfo(); +const char *gai_strerror(); +int getnameinfo(); +/* END IPv6 prototype definitions */ +/* End BIND */ + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +/* IPsec algorithm prototype definitions */ +struct ipsecalgent *getalgbyname(); +struct ipsecalgent *getalgbydoi(); +int getdoidomainbyname(); +const char *getdoidomainbynum(); +void freealgent(); +/* END IPsec algorithm prototype definitions */ +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#endif /* __STDC__ */ + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (when using the resolver) + */ + +extern int h_errno; + +#ifdef _REENTRANT +#ifdef __STDC__ +extern int *__h_errno(void); +#else +extern int *__h_errno(); +#endif /* __STDC__ */ + +/* Only #define h_errno if there is no conflict with other use */ +#ifdef H_ERRNO_IS_FUNCTION +#define h_errno (*__h_errno()) +#endif /* NO_H_ERRNO_DEFINE */ +#endif /* _REENTRANT */ + +#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + +/* BIND */ +#define NETDB_INTERNAL -1 /* see errno */ +#define NETDB_SUCCESS 0 /* no problem */ +/* End BIND */ + +#define MAXHOSTNAMELEN 256 + +#define MAXALIASES 35 +#define MAXADDRS 35 +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NETDB_H */ diff --git a/usr/src/head/netdir.h b/usr/src/head/netdir.h new file mode 100644 index 0000000000..694390ee1c --- /dev/null +++ b/usr/src/head/netdir.h @@ -0,0 +1,189 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1992 Sun Microsystems, Inc. */ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +/* + * netdir.h + * + * This is the include file that defines various structures and + * constants used by the netdir routines. + */ + +#ifndef _NETDIR_H +#define _NETDIR_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */ + +/* + * This files uses struct netconfig, and netconfig.h must be included + * before this to avoid warnings. + */ + +#include <netconfig.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct nd_addrlist { + int n_cnt; /* number of netbufs */ + struct netbuf *n_addrs; /* the netbufs */ +}; + +struct nd_hostservlist { + int h_cnt; /* number of nd_hostservs */ + struct nd_hostserv *h_hostservs; /* the entries */ +}; + +struct nd_hostserv { + char *h_host; /* the host name */ + char *h_serv; /* the service name */ +}; + +struct nd_mergearg { + char *s_uaddr; /* servers universal address */ + char *c_uaddr; /* clients universal address */ + char *m_uaddr; /* merged universal address */ +}; + +/* + * _nderror is a private variable to the netdir system. + */ +#ifdef _REENTRANT +extern int *__nderror(); +#define _nderror (*(__nderror())) +#else +extern int _nderror; +#endif /* _REENTRANT */ + + +#ifdef __STDC__ + +int netdir_options(struct netconfig *, int option, int fd, char *par); +int netdir_getbyname(struct netconfig *, struct nd_hostserv *, + struct nd_addrlist **); +int netdir_getbyaddr(struct netconfig *, struct nd_hostservlist **, + struct netbuf *); +int __netdir_getbyaddr_nosrv(struct netconfig *, struct nd_hostservlist **, + struct netbuf *); +int netdir_mergeaddr(struct netconfig *, char **muaddr, char *uaddr, + char *ruaddr); +void netdir_free(void *, int); +struct netbuf *uaddr2taddr(struct netconfig *, char *); +char *taddr2uaddr(struct netconfig *, struct netbuf *); +void netdir_perror(char *); +char *netdir_sperror(); +struct nd_addrlist *_netdir_getbyname(struct netconfig *, struct nd_hostserv *); +struct nd_hostservlist *_netdir_getbyaddr(struct netconfig *, struct netbuf *); +struct netbuf *_uaddr2taddr(struct netconfig *, char *); +char *_taddr2uaddr(struct netconfig *, struct netbuf *); +char *_netdir_mergeaddr(struct netconfig *, char *uaddr, char *ruaddr); + +#else /* __STDC__ */ + +int netdir_options(); +int netdir_getbyname(); +int netdir_getbyaddr(); +int netdir_mergeaddr(); +void netdir_free(); +struct netbuf *uaddr2taddr(); +void netdir_perror(); +char *netdir_sperror(); +char *taddr2uaddr(); +struct nd_addrlist *_netdir_getbyname(); +struct nd_hostservlist *_netdir_getbyaddr(); +char *_netdir_mergeaddr(); +struct netbuf *_uaddr2taddr(); +char *_taddr2uaddr(); + +#endif /* __STDC__ */ + +/* + * These are all objects that can be freed by netdir_free + */ +#define ND_HOSTSERV 0 +#define ND_HOSTSERVLIST 1 +#define ND_ADDR 2 +#define ND_ADDRLIST 3 + +/* + * These are the various errors that can be encountered while attempting + * to translate names to addresses. Note that none of them (except maybe + * no memory) are truely fatal unless the ntoa deamon is on its last attempt + * to translate the name. First four errors are to failitate return values + * from DNS, that are used by mail and others. + * + * Negative errors terminate the search resolution process, positive errors + * are treated as warnings. + */ + +#define ND_TRY_AGAIN -5 /* Non-Authoritive Host not found, or */ + /* SERVERFAIL */ +#define ND_NO_RECOVERY -4 /* Non recoverable errors, FORMERR, REFUSED, */ + /* NOTIMP */ +#define ND_NO_DATA -3 /* Valid name, no data record of requested */ + /* type */ +#define ND_NO_ADDRESS ND_NO_DATA /* no address, look for MX record */ +#define ND_BADARG -2 /* Bad arguments passed */ +#define ND_NOMEM -1 /* No virtual memory left */ +#define ND_OK 0 /* Translation successful */ +#define ND_NOHOST 1 /* Hostname was not resolvable */ +#define ND_NOSERV 2 /* Service was unknown */ +#define ND_NOSYM 3 /* Couldn't resolve symbol */ +#define ND_OPEN 4 /* File couldn't be opened */ +#define ND_ACCESS 5 /* File is not accessable */ +#define ND_UKNWN 6 /* Unknown object to be freed */ +#define ND_NOCTRL 7 /* Unknown option passed to netdir_options */ +#define ND_FAILCTRL 8 /* Option failed in netdir_options */ +#define ND_SYSTEM 9 /* Other System error */ + +/* + * The following netdir_options commands can be given to the fd. These is + * a way of providing for any transport specific action which the caller + * may want to initiate on his transport. It is up to the trasport provider + * to support the netdir_options he wants to support. + */ + +#define ND_SET_BROADCAST 1 /* Do t_optmgmt to support broadcast */ +#define ND_SET_RESERVEDPORT 2 /* bind it to reserve address */ +#define ND_CHECK_RESERVEDPORT 3 /* check if address is reserved */ +#define ND_MERGEADDR 4 /* Merge universal address */ + +/* + * The following special case host names are used to give the underlying + * transport provides a clue as to the intent of the request. + */ + +#define HOST_SELF "\\1" +#define HOST_ANY "\\2" +#define HOST_BROADCAST "\\3" +#define HOST_SELF_BIND HOST_SELF +#define HOST_SELF_CONNECT "\\4" + +#ifdef __cplusplus +} +#endif + +#endif /* _NETDIR_H */ diff --git a/usr/src/head/nl_types.h b/usr/src/head/nl_types.h new file mode 100644 index 0000000000..aa1615519c --- /dev/null +++ b/usr/src/head/nl_types.h @@ -0,0 +1,122 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* + * nl_types.h + * + * Copyright (c) 1991,1997,2000 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +#ifndef _NL_TYPES_H +#define _NL_TYPES_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/isa_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define NL_SETD 1 /* XPG3 Conformant Default set number. */ +#define NL_CAT_LOCALE (-1) /* XPG4 requirement */ + +#define _CAT_MAGIC 0xFF88FF89 +#define _CAT_HDR_SIZE sizeof (struct _cat_hdr) +#define _CAT_SET_HDR_SIZE sizeof (struct _cat_set_hdr) +#define _CAT_MSG_HDR_SIZE sizeof (struct _cat_msg_hdr) + +struct _cat_hdr +{ +#if !defined(_LP64) + long __hdr_magic; /* must contain CAT_MAGIC */ +#else + int __hdr_magic; /* must contain CAT_MAGIC */ +#endif + int __nsets; /* the number of sets in the catalogue */ + int __mem; /* the size of the catalogue; the size */ + /* does not include the size of the header */ +#if !defined(_LP64) + long __msg_hdr_offset; /* the byte offset of the first message */ + /* header */ + long __msg_text_offset; /* the byte offset of the message text area */ +#else + int __msg_hdr_offset; /* the byte offset of the first message */ + /* header */ + int __msg_text_offset; /* the byte offset of the message text area */ +#endif +}; + +struct _cat_set_hdr +{ + int __set_no; /* the set number; must be greater than 0; */ + /* should be less than or equal to NL_SETMAX */ + int __nmsgs; /* the number of msgs in the set */ + int __first_msg_hdr; /* the index of the first message header in */ + /* the set; the value is not a byte offset, */ + /* it is a 0-based index */ +}; + +struct _cat_msg_hdr +{ + int __msg_no; /* the message number; must be greater than 0; */ + /* should be less than or equal to NL_MSGMAX */ + int __msg_len; /* the length of the message; must be greater */ + /* than or equal to zero; should be less than */ + /* or equal to NL_TEXTMAX */ + int __msg_offset; /* the byte offset of the message in the message */ + /* area; the offset is relative to the start of */ + /* the message area, not to the start of the */ + /* catalogue. */ +}; + +struct _nl_catd_struct { + void *__content; /* mmaped catalogue contents */ + int __size; /* Size of catalogue file */ + int __trust; /* File is from a trusted location */ +}; + +typedef struct _nl_catd_struct *nl_catd; +typedef int nl_item; /* XPG3 Conformant for nl_langinfo(). */ + +/* The following is just for the compatibility between OSF and Solaris */ +/* Need to be removed later */ +typedef nl_item __nl_item; + +#ifdef __STDC__ +int catclose(nl_catd); +char *catgets(nl_catd, int, int, const char *); +nl_catd catopen(const char *, int); +#else +int catclose(); +char *catgets(); +nl_catd catopen(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NL_TYPES_H */ diff --git a/usr/src/head/nlist.h b/usr/src/head/nlist.h new file mode 100644 index 0000000000..ea1bd203bb --- /dev/null +++ b/usr/src/head/nlist.h @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _NLIST_H +#define _NLIST_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8.2.4 */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct nlist { + char *n_name; /* symbol name */ + long n_value; /* value of symbol */ + short n_scnum; /* section number */ + unsigned short n_type; /* type and derived type */ + char n_sclass; /* storage class */ + char n_numaux; /* number of aux. entries */ +}; + +#if defined(__STDC__) +extern int nlist(const char *, struct nlist *); +#else /* __STDC__ */ +extern int nlist(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NLIST_H */ diff --git a/usr/src/head/note.h b/usr/src/head/note.h new file mode 100644 index 0000000000..6c73867a02 --- /dev/null +++ b/usr/src/head/note.h @@ -0,0 +1,55 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1994 by Sun Microsystems, Inc. + */ + +/* + * note.h: interface for annotating source with info for tools + * + * NOTE is the default interface, but if the identifier NOTE is in use for + * some other purpose, you may prepare a similar header file using your own + * identifier, mapping that identifier to _NOTE. Also, exported header + * files should *not* use NOTE, since the name may already be in use in + * a program's namespace. Rather, exported header files should include + * sys/note.h directly and use _NOTE. For consistency, all kernel source + * should use _NOTE. + */ + +#ifndef _NOTE_H +#define _NOTE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/note.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define NOTE _NOTE + +#ifdef __cplusplus +} +#endif + +#endif /* _NOTE_H */ diff --git a/usr/src/head/nss_common.h b/usr/src/head/nss_common.h new file mode 100644 index 0000000000..5582bacd48 --- /dev/null +++ b/usr/src/head/nss_common.h @@ -0,0 +1,394 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1992-1999 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * + * NOTE: The interfaces documented in this file may change in a minor + * release. It is intended that in the future a stronger committment + * will be made to these interface definitions which will guarantee + * them across minor releases. + */ + +#ifndef _NSS_COMMON_H +#define _NSS_COMMON_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <synch.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The name-service switch + * ----------------------- + * + * From nsswitch.conf(4): + * + * The operating system uses a number of ``databases'' of information + * about hosts, users (passwd/shadow), groups and so forth. Data for + * these can come from a variety of ``sources'': host-names and + * -addresses, for example, may be found in /etc/hosts, NIS, NIS+ or + * DNS. One or more sources may be used for each database; the + * sources and their lookup order are specified in the + * /etc/nsswitch.conf file. + * + * The implementation of this consists of: + * + * - a ``frontend'' for each database, which provides a programming + * interface for that database [for example, the "passwd" frontend + * consists of getpwnam_r(), getpwuid_r(), getpwent_r(), setpwent(), + * endpwent(), and the old MT-unsafe routines getpwnam() and getpwuid()] + * and is implemented by calls to... + * + * - the common core of the switch (``switch engine''); it determines + * which sources to use and invokes... + * + * - A ``backend'' for each useful <database, source> pair. Each backend + * consists of whatever private data it needs and a set of functions + * that the switch engine may invoke on behalf of the frontend + * [e.g. the "nis" backend for "passwd" provides routines to lookup + * by name and by uid, as well as set/get/end iterator routines]. + * The set of functions, and their expected arguments and results, + * constitutes a (database-specific) interface between a frontend and + * all its backends. The switch engine knows as little as possible + * about these interfaces. + * + * (The term ``backend'' is used ambiguously; it may also refer to a + * particular instantiation of a backend, or to the set of all backends + * for a particular source, e.g. "the nis backend"). + * + * This header file defines the interface between the switch engine and the + * frontends and backends. Interfaces between specific frontends and + * backends are defined elsewhere; many are in <nss_dbdefs.h>. + * + * + * Switch-engine outline + * --------------------- + * + * Frontends may call the following routines in the switch engine: + * + * nss_search() does getXXXbyYYY, e.g. getpwnam_r(), getpwuid_r() + * nss_getent() does getXXXent, e.g. getpwent_r() + * nss_setent() does setXXXent, e.g. setpwent() + * nss_endent() does endXXXent, e.g. endpwent() + * nss_delete() releases resources, in the style of endpwent(). + * + * A getpwnam_r() call might proceed thus (with many details omitted): + * + * (1) getpwnam_r fills in (getpwnam-specific) argument/result struct, + * calls nss_search(), + * (2) nss_search looks up configuration info, gets "passwd: files nis", + * (3) nss_search decides to try first source ("files"), + * (a) nss_search locates code for <"passwd", "files"> backend, + * (b) nss_search creates instance of backend, + * (c) nss_search calls get-by-name routine in backend, + * (d) backend searches /etc/passwd, doesn't find the name, + * returns "not found" status to nss_search, + * (4) nss_search examines status and config info, decides to try + * next source ("nis"), + * (a) nss_search locates code for <"passwd", "nis"> backend, + * (b) nss_search creates instance of backend, + * (c) nss_search calls get-by-name routine in backend, + * (d) backend searches passwd.byname, finds the desired entry, + * fills in the result part of the getpwnam-specific + * struct, returns "success" status to nss_search, + * (5) nss_search examines status and config info, decides to return + * to caller, + * (6) getpwnam_r extracts result from getpwnam-specific struct, + * returns to caller. + * + * + * Data structures + * --------------- + * + * Both databases and sources are represented by case-sensitive strings + * (the same strings that appear in the configuration file). + * + * The switch engine maintains a per-frontend data structure so that the + * results of steps (2), (a) and (b) can be cached. The frontend holds a + * handle (nss_db_root_t) to this structure and passes it in to the + * nss_*() routines. + * + * The nss_setent(), nss_getent() and nss_endent() routines introduce another + * variety of state (the current position in the enumeration process). + * Within a single source, this information is maintained by private data + * in the backend instance -- but, in the presence of multiple sources, the + * switch engine must keep track of the current backend instance [e.g either + * <"passwd", "files"> or <"passwd", "nis"> instances]. The switch engine + * has a separate per-enumeration data structure for this; again, the + * frontend holds a handle (nss_getent_t) and passes it in, along with the + * nss_db_root_t handle, to nss_setent(), nss_getent() and nss_endent(). + * + * + * Multithreading + * -------------- + * + * The switch engine takes care of locking; frontends should be written to + * be reentrant, and a backend instance may assume that all calls to it are + * serialized. + * + * If multiple threads simultaneously want to use a particular backend, the + * switch engine creates multiple backend instances (up to some limit + * specified by the frontend). Backends must of course lock any state that + * is shared between instances, and must serialize calls to any MT-unsafe + * code. + * + * The switch engine has no notion of per-thread state. + * + * Frontends can use the nss_getent_t handle to define the scope of the + * enumeration (set/get/endXXXent) state: a static handle gives global state + * (which is what Posix has specified for the getXXXent_r routines), handles + * in Thread-Specific Data give per-thread state, and handles on the stack + * give per-invocation state. + */ + + +/* + * Backend instances + * ----------------- + * + * As far as the switch engine is concerned, an instance of a backend is a + * struct whose first two members are: + * - A pointer to a vector of function pointers, one for each + * database-specific function, + * - The length of the vector (an int), used for bounds-checking. + * There are four well-known function slots in the vector: + * [0] is a destructor for the backend instance, + * [1] is the endXXXent routine, + * [2] is the setXXXent routine, + * [3] is the getXXXent routine. + * Any other slots are database-specific getXXXbyYYY routines; the frontend + * specifies a slot-number to nss_search(). + * + * The functions take two arguments: + * - a pointer to the backend instance (like a C++ "this" pointer) + * - a single (void *) pointer to the database-specific argument/result + * structure (the contents are opaque to the switch engine). + * The four well-known functions ignore the (void *) pointer. + * + * Backend routines return one of five status codes to the switch engine: + * SUCCESS, UNAVAIL, NOTFOUND, TRYAGAIN (these are the same codes that may + * be specified in the config information; see nsswitch.conf(4)), or + * NSS_NISSERVDNS_TRYAGAIN (should only be used by the NIS backend for + * NIS server in DNS forwarding mode to indicate DNS server non-response). + */ + +typedef enum { + NSS_SUCCESS, + NSS_NOTFOUND, + NSS_UNAVAIL, + NSS_TRYAGAIN, + NSS_NISSERVDNS_TRYAGAIN +} nss_status_t; + +struct nss_backend; + +#if defined(__STDC__) +typedef nss_status_t (*nss_backend_op_t)(struct nss_backend *, void *args); +#else +typedef nss_status_t (*nss_backend_op_t)(); +#endif + +struct nss_backend { + nss_backend_op_t *ops; + int n_ops; +}; +typedef struct nss_backend nss_backend_t; +typedef int nss_dbop_t; + +#define NSS_DBOP_DESTRUCTOR 0 +#define NSS_DBOP_ENDENT 1 +#define NSS_DBOP_SETENT 2 +#define NSS_DBOP_GETENT 3 +#define NSS_DBOP_next_iter (NSS_DBOP_GETENT + 1) +#define NSS_DBOP_next_noiter (NSS_DBOP_DESTRUCTOR + 1) +#define NSS_DBOP_next_ipv6_iter (NSS_DBOP_GETENT + 3) + +#define NSS_LOOKUP_DBOP(instp, n) \ + (((n) >= 0 && (n) < (instp)->n_ops) ? (instp)->ops[n] : 0) + +#define NSS_INVOKE_DBOP(instp, n, argp) (\ + ((n) >= 0 && (n) < (instp)->n_ops && (instp)->ops[n] != 0) \ + ? (*(instp)->ops[n])(instp, argp) \ + : NSS_UNAVAIL) + +/* + * Locating and instantiating backends + * ----------------------------------- + * + * To perform step (a), the switch consults a list of backend-finder routines, + * passing a <database, source> pair. + * + * There is a standard backend-finder; frontends may augment or replace this + * in order to, say, indicate that some backends are "compiled in" with the + * frontend. + * + * Backend-finders return a pointer to a constructor function for the backend. + * (or NULL if they can't find the backend). The switch engine caches these + * function pointers; when it needs to perform step (b), it calls the + * constructor function, which returns a pointer to a new instance of the + * backend, properly initialized (or returns NULL). + */ + +#if defined(__STDC__) +typedef nss_backend_t * (*nss_backend_constr_t)(const char *db_name, + const char *src_name, +/* Hook for (unimplemented) args in nsswitch.conf */ const char *cfg_args); +#else +typedef nss_backend_t * (*nss_backend_constr_t)(); +#endif + +struct nss_backend_finder { +#if defined(__STDC__) + nss_backend_constr_t (*lookup) + (void *lkp_priv, const char *, const char *, void **del_privp); + void (*delete) + (void *del_priv, nss_backend_constr_t); +#else + nss_backend_constr_t (*lookup)(); + void (*delete)(); +#endif + struct nss_backend_finder *next; + void *lookup_priv; +}; + +typedef struct nss_backend_finder nss_backend_finder_t; + +extern nss_backend_finder_t *nss_default_finders; + +/* + * Frontend parameters + * ------------------- + * + * The frontend must tell the switch engine: + * - the database name, + * - the compiled-in default configuration entry. + * It may also override default values for: + * - the database name to use when looking up the configuration + * information (e.g. "shadow" uses the config entry for "passwd"), + * - a limit on the number of instances of each backend that are + * simultaneously active, + * - a limit on the number of instances of each backend that are + * simultaneously dormant (waiting for new requests), + * - a flag that tells the switch engine to use the default configuration + * entry and ignore any other config entry for this database, + * - backend-finders (see above) + * - a cleanup routine that should be called when these parameters are + * about to be deleted. + * + * In order to do this, the frontend includes a pointer to an initialization + * function (nss_db_initf_t) in every nss_*() call. When necessary (normally + * just on the first invocation), the switch engine allocates a parameter + * structure (nss_db_params_t), fills in the default values, then calls + * the initialization function, which should update the parameter structure + * as necessary. + * + * (This might look more natural if we put nss_db_initf_t in nss_db_root_t, + * or abolished nss_db_initf_t and put nss_db_params_t in nss_db_root_t. + * It's done the way it is for shared-library efficiency, namely: + * - keep the unshared data (nss_db_root_t) to a minimum, + * - keep the symbol lookups and relocations to a minimum. + * In particular this means that non-null pointers, e.g. strings and + * function pointers, in global data are a bad thing). + */ + +enum nss_dbp_flags { + NSS_USE_DEFAULT_CONFIG = 0x1 +}; + +struct nss_db_params { + const char *name; /* Mandatory: database name */ + const char *config_name; /* config-file database name */ + const char *default_config; /* Mandatory: default config */ + unsigned max_active_per_src; + unsigned max_dormant_per_src; + enum nss_dbp_flags flags; + nss_backend_finder_t *finders; + void *private; /* Not used by switch */ + void (*cleanup)(struct nss_db_params *); +}; + +typedef struct nss_db_params nss_db_params_t; + +#if defined(__STDC__) +typedef void (*nss_db_initf_t)(nss_db_params_t *); +#else +typedef void (*nss_db_initf_t)(); +#endif + +/* + * These structures are defined inside the implementation of the switch + * engine; the interface just holds pointers to them. + */ +struct nss_db_state; +struct nss_getent_context; + +/* + * Finally, the two handles that frontends hold: + */ + +struct nss_db_root { + struct nss_db_state *s; + mutex_t lock; +}; +typedef struct nss_db_root nss_db_root_t; +#define NSS_DB_ROOT_INIT { 0, DEFAULTMUTEX } +#define DEFINE_NSS_DB_ROOT(name) nss_db_root_t name = NSS_DB_ROOT_INIT + + +typedef struct { + struct nss_getent_context *ctx; + mutex_t lock; +} nss_getent_t; + +#define NSS_GETENT_INIT { 0, DEFAULTMUTEX } +#define DEFINE_NSS_GETENT(name) nss_getent_t name = NSS_GETENT_INIT + +#if defined(__STDC__) +extern nss_status_t nss_search(nss_db_root_t *, nss_db_initf_t, + int search_fnum, void *search_args); +extern nss_status_t nss_getent(nss_db_root_t *, nss_db_initf_t, nss_getent_t *, + void *getent_args); +extern void nss_setent(nss_db_root_t *, nss_db_initf_t, nss_getent_t *); + +extern void nss_endent(nss_db_root_t *, nss_db_initf_t, nss_getent_t *); + /* ^^ superfluous but consistent */ +extern void nss_delete(nss_db_root_t *); +#else +extern nss_status_t nss_search(); +extern nss_status_t nss_getent(); +extern void nss_setent(); +extern void nss_endent(); +extern void nss_delete(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _NSS_COMMON_H */ diff --git a/usr/src/head/nss_dbdefs.h b/usr/src/head/nss_dbdefs.h new file mode 100644 index 0000000000..c3a3323b57 --- /dev/null +++ b/usr/src/head/nss_dbdefs.h @@ -0,0 +1,569 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * + * Database-speficic definitions for the getXXXbyYYY routines + * (e.g getpwuid_r(), ether_ntohost()) that use the name-service switch. + * Database-independent definitions are in <nss_common.h> + * + * Ideally, this is the only switch header file one would add things + * to in order to support a new database. + * + * NOTE: The interfaces documented in this file may change in a minor + * release. It is intended that in the future a stronger committment + * will be made to these interface definitions which will guarantee + * them across minor releases. + */ + +#ifndef _NSS_DBDEFS_H +#define _NSS_DBDEFS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <errno.h> +#include <netdb.h> /* MAXALIASES, MAXADDRS */ +#include <limits.h> /* LOGNAME_MAX */ +#include <nss_common.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NSS_INCLUDE_UNSAFE +#define NSS_INCLUDE_UNSAFE 1 /* Build old, MT-unsafe interfaces, */ +#endif /* NSS_INCLUDE_UNSAFE */ /* e.g. getpwnam (c.f. getpwnam_r) */ + +/* + * Names of the well-known databases. + */ + +#define NSS_DBNAM_ALIASES "aliases" /* E-mail aliases, that is */ +#define NSS_DBNAM_AUTOMOUNT "automount" +#define NSS_DBNAM_BOOTPARAMS "bootparams" +#define NSS_DBNAM_ETHERS "ethers" +#define NSS_DBNAM_GROUP "group" +#define NSS_DBNAM_HOSTS "hosts" +#define NSS_DBNAM_IPNODES "ipnodes" +#define NSS_DBNAM_NETGROUP "netgroup" +#define NSS_DBNAM_NETMASKS "netmasks" +#define NSS_DBNAM_NETWORKS "networks" +#define NSS_DBNAM_PASSWD "passwd" +#define NSS_DBNAM_PRINTERS "printers" +#define NSS_DBNAM_PROJECT "project" +#define NSS_DBNAM_PROTOCOLS "protocols" +#define NSS_DBNAM_PUBLICKEY "publickey" +#define NSS_DBNAM_RPC "rpc" +#define NSS_DBNAM_SERVICES "services" +#define NSS_DBNAM_AUDITUSER "audit_user" +#define NSS_DBNAM_AUTHATTR "auth_attr" +#define NSS_DBNAM_EXECATTR "exec_attr" +#define NSS_DBNAM_PROFATTR "prof_attr" +#define NSS_DBNAM_USERATTR "user_attr" + +/* getspnam() et al use the "passwd" config entry but the "shadow" backend */ +#define NSS_DBNAM_SHADOW "shadow" + +/* The "compat" backend gets config entries for these pseudo-databases */ +#define NSS_DBNAM_PASSWD_COMPAT "passwd_compat" +#define NSS_DBNAM_GROUP_COMPAT "group_compat" + +/* + * Default switch configuration, compiled into the front-ends. + * + * Absent good reasons to the contrary, this should be compatible with the + * default /etc/nsswitch.conf file. + */ +#define NSS_FILES_ONLY "files" +#define NSS_FILES_NS "files nis" +#define NSS_NS_FALLBACK "nis [NOTFOUND=return] files" +#define NSS_NS_ONLY "nis" + +#define NSS_DEFCONF_ALIASES NSS_FILES_NS +#define NSS_DEFCONF_AUTOMOUNT NSS_FILES_NS +#define NSS_DEFCONF_BOOTPARAMS NSS_NS_FALLBACK +#define NSS_DEFCONF_ETHERS NSS_NS_FALLBACK +#define NSS_DEFCONF_GROUP NSS_FILES_NS +#define NSS_DEFCONF_HOSTS NSS_NS_FALLBACK +#define NSS_DEFCONF_IPNODES NSS_NS_FALLBACK +#define NSS_DEFCONF_NETGROUP NSS_NS_ONLY +#define NSS_DEFCONF_NETMASKS NSS_NS_FALLBACK +#define NSS_DEFCONF_NETWORKS NSS_NS_FALLBACK +#define NSS_DEFCONF_PASSWD NSS_FILES_NS +#define NSS_DEFCONF_PRINTERS "user files nis nisplus" +#define NSS_DEFCONF_PROJECT NSS_FILES_NS +#define NSS_DEFCONF_PROTOCOLS NSS_NS_FALLBACK +#define NSS_DEFCONF_PUBLICKEY NSS_FILES_NS +#define NSS_DEFCONF_RPC NSS_NS_FALLBACK +#define NSS_DEFCONF_SERVICES NSS_FILES_NS /* speeds up byname() */ + +#define NSS_DEFCONF_GROUP_COMPAT NSS_NS_ONLY +#define NSS_DEFCONF_PASSWD_COMPAT NSS_NS_ONLY + +#define NSS_DEFCONF_ATTRDB NSS_FILES_NS + +#define NSS_DEFCONF_AUDITUSER NSS_DEFCONF_PASSWD +#define NSS_DEFCONF_USERATTR NSS_DEFCONF_PASSWD +#define NSS_DEFCONF_AUTHATTR NSS_DEFCONF_ATTRDB +#define NSS_DEFCONF_PROFATTR NSS_DEFCONF_ATTRDB +#define NSS_DEFCONF_EXECATTR NSS_DEFCONF_PROFATTR + +/* + * Line-lengths that the "files" and "compat" backends will try to support. + * It may be reasonable (even advisable) to use smaller values than these. + */ + +#define NSS_BUFSIZ 1024 + +#define NSS_LINELEN_GROUP ((NSS_BUFSIZ) * 4) +#define NSS_LINELEN_HOSTS ((NSS_BUFSIZ) * 8) +#define NSS_LINELEN_IPNODES ((NSS_BUFSIZ) * 8) +#define NSS_LINELEN_NETMASKS NSS_BUFSIZ +#define NSS_LINELEN_NETWORKS NSS_BUFSIZ +#define NSS_LINELEN_PASSWD NSS_BUFSIZ +#define NSS_LINELEN_PRINTERS NSS_BUFSIZ +#define NSS_LINELEN_PROJECT ((NSS_BUFSIZ) * 4) +#define NSS_LINELEN_PROTOCOLS NSS_BUFSIZ +#define NSS_LINELEN_PUBLICKEY NSS_BUFSIZ +#define NSS_LINELEN_RPC NSS_BUFSIZ +#define NSS_LINELEN_SERVICES NSS_BUFSIZ +#define NSS_LINELEN_SHADOW NSS_BUFSIZ +#define NSS_LINELEN_ETHERS NSS_BUFSIZ +#define NSS_LINELEN_BOOTPARAMS NSS_BUFSIZ + +#define NSS_LINELEN_ATTRDB NSS_BUFSIZ + +#define NSS_LINELEN_AUDITUSER NSS_LINELEN_ATTRDB +#define NSS_LINELEN_AUTHATTR NSS_LINELEN_ATTRDB +#define NSS_LINELEN_EXECATTR NSS_LINELEN_ATTRDB +#define NSS_LINELEN_PROFATTR NSS_LINELEN_ATTRDB +#define NSS_LINELEN_USERATTR NSS_LINELEN_ATTRDB + +#define NSS_MMAPLEN_EXECATTR NSS_LINELEN_EXECATTR * 8 + +/* + * Reasonable defaults for 'buflen' values passed to _r functions. The BSD + * and SunOS 4.x implementations of the getXXXbyYYY() functions used hard- + * coded array sizes; the values here are meant to handle anything that + * those implementations handled. + * === These might more reasonably go in <pwd.h>, <netdb.h> et al + */ + +#define NSS_BUFLEN_GROUP (NSS_LINELEN_GROUP + 800 * sizeof (char *)) +#define NSS_BUFLEN_HOSTS \ + (NSS_LINELEN_HOSTS + (MAXALIASES + MAXADDRS + 2) * sizeof (char *)) +#define NSS_BUFLEN_IPNODES \ + (NSS_LINELEN_IPNODES + (MAXALIASES + MAXADDRS + 2) * sizeof (char *)) +#define NSS_BUFLEN_NETGROUP (MAXHOSTNAMELEN * 2 + LOGNAME_MAX + 3) +#define NSS_BUFLEN_NETWORKS NSS_LINELEN_NETWORKS /* === ? + 35 * 4 */ +#define NSS_BUFLEN_PASSWD NSS_LINELEN_PASSWD +#define NSS_BUFLEN_PROJECT (NSS_LINELEN_PROJECT + 800 * sizeof (char *)) +#define NSS_BUFLEN_PROTOCOLS NSS_LINELEN_PROTOCOLS /* === ? + 35 * 4 */ +#define NSS_BUFLEN_PUBLICKEY NSS_LINELEN_PUBLICKEY +#define NSS_BUFLEN_RPC NSS_LINELEN_RPC /* === ? + 35 * 4 */ +#define NSS_BUFLEN_SERVICES NSS_LINELEN_SERVICES /* === ? + 35 * 4 */ +#define NSS_BUFLEN_SHADOW NSS_LINELEN_SHADOW +#define NSS_BUFLEN_ETHERS NSS_LINELEN_ETHERS +#define NSS_BUFLEN_BOOTPARAMS NSS_LINELEN_BOOTPARAMS + +#define NSS_BUFLEN_ATTRDB NSS_LINELEN_ATTRDB + +#define NSS_BUFLEN_AUDITUSER NSS_BUFLEN_ATTRDB +#define NSS_BUFLEN_AUTHATTR NSS_BUFLEN_ATTRDB +#define NSS_BUFLEN_EXECATTR NSS_BUFLEN_ATTRDB +#define NSS_BUFLEN_PROFATTR NSS_BUFLEN_ATTRDB +#define NSS_BUFLEN_USERATTR NSS_BUFLEN_ATTRDB + + +/* + * Arguments and results, passed between the frontends and backends for + * the well-known databases. The getXbyY_r() and getXent_r() routines + * use a common format that is further described below; other routines + * use their own formats. + */ + +/* + * The initgroups() function [see initgroups(3c)] needs to find all the + * groups to which a given user belongs. To do this it calls + * _getgroupsbymember(), which is part of the frontend for the "group" + * database. + * We want the same effect as if we used getgrent_r() to enumerate the + * entire groups database (possibly from multiple sources), but getgrent_r() + * is too inefficient. Most backends can do better if they know they're + * meant to scan all groups; hence there's a separate backend operation, + * NSS_DBOP_GROUP_BYMEMBER, which uses the nss_groupsbymem struct. + * Note that the normal return-value from such a backend, even when it + * successfully finds matching group entries, is NSS_NOTFOUND, because + * this tells the switch engine to keep searching in any more sources. + * In fact, the backends only return NSS_SUCCESS if they find enough + * matching entries that the gid_array is completely filled, in which + * case the switch engine should stop searching. + * If the force_slow_way field is set, the backend should eschew any cached + * information (e.g. the YP netid.byname map or the NIS+ cred.org_dir table) + * and should instead grind its way through the group map/table/whatever. + */ + +struct nss_groupsbymem { /* For _getgroupsbymember() */ +/* in: */ + const char *username; + gid_t *gid_array; + int maxgids; + int force_slow_way; + /* + * The process_cstr() routine does the real work for any backend + * that can supply a group entry as a string in /etc/group format + */ +#if defined(__STDC__) + int (*str2ent) (const char *instr, + int instr_len, + void *ent, char *buffer, int buflen); + nss_status_t (*process_cstr) (const char *instr, + int instr_len, + struct nss_groupsbymem *); +#else + int (*str2ent)(); + nss_status_t (*process_cstr)(); +#endif + +/* in_out: */ + int numgids; +}; + +/* + * The netgroup routines are handled as follows: + * + * Policy decision: + * If netgroup A refers to netgroup B, both must occur in the same + * source (other choices give very confusing semantics). This + * assumption is deeply embedded in the frontend and backends. + * + * - setnetgrent(), despite its name, is really a getXXXbyYYY operation: + * it takes a name and finds a netgroup with that name (see the + * nss_setnetgrent_args struct below). The "result" that it returns + * to the frontend is an nss_backend_t for a pseudo-backend that allows + * one to enumerate the members of that netgroup. + * + * - getnetgrent() calls the 'getXXXent' function in the pseudo-backend; + * it doesn't go through the switch engine at all. It uses the + * nss_getnetgrent_args struct below. + * + * - innetgr() is implemented on top of __multi_innetgr(), which replaces + * each (char *) argument of innetgr() with a counted vector of (char *). + * The semantics are the same as an OR of the results of innetgr() + * operations on each possible 4-tuple picked from the arguments, but + * it's possible to implement some cases more efficiently. This is + * important for mountd, which used to read YP netgroup.byhost directly + * in order to determine efficiently whether a given host belonged to any + * one of a long list of netgroups. Wildcarded arguments are indicated + * by a count of zero. + * + * - __multi_innetgr() uses the nss_innetgr_args struct. A backend whose + * source contains at least one of the groups listed in the 'groups' + * vector will return NSS_SUCCESS and will set the 'status' field to + * indicate whether any 4-tuple was satisfied. A backend will only + * return NSS_NOTFOUND if the source contained none of the groups + * listed in the 'groups' vector. + */ + +enum nss_netgr_argn { /* We need (machine, user, domain) triples */ + NSS_NETGR_MACHINE, + NSS_NETGR_USER, + NSS_NETGR_DOMAIN, + NSS_NETGR_N +}; + +enum nss_netgr_status { /* Status from setnetgrent, multi_innetgr */ + NSS_NETGR_FOUND, + NSS_NETGR_NO, + NSS_NETGR_NOMEM +}; + +struct nss_setnetgrent_args { +/* in: */ + const char *netgroup; +/* out: */ + nss_backend_t *iterator; /* <==== Explain */ +}; + +struct nss_getnetgrent_args { +/* in: */ + char *buffer; + int buflen; +/* out: */ + enum nss_netgr_status status; + char *retp[NSS_NETGR_N]; +}; + +typedef unsigned nss_innetgr_argc; /* 0 means wildcard */ +typedef char ** nss_innetgr_argv; /* === Do we really need these? */ + +struct nss_innetgr_1arg { + nss_innetgr_argc argc; + nss_innetgr_argv argv; +}; + +struct nss_innetgr_args { +/* in: */ + struct nss_innetgr_1arg arg[NSS_NETGR_N]; + struct nss_innetgr_1arg groups; +/* out: */ + enum nss_netgr_status status; +}; + + +/* + * nss_XbyY_buf_t -- structure containing the generic arguments passwd to + * getXXXbyYYY_r() and getXXXent_r() routines. The (void *) value points to + * a struct of the appropriate type, e.g. struct passwd or struct hostent. + * + * The functions that allocate and free these structures do no locking at + * all, since the routines that use them are inherently MT-unsafe anyway. + */ + +typedef struct { + void *result; /* "result" parameter to getXbyY_r() */ + char *buffer; /* "buffer" " " */ + int buflen; /* "buflen" " " */ +} nss_XbyY_buf_t; + +#if defined(__STDC__) +extern nss_XbyY_buf_t *_nss_XbyY_buf_alloc(int struct_size, int buffer_size); +extern void _nss_XbyY_buf_free(nss_XbyY_buf_t *); +#else +extern nss_XbyY_buf_t *_nss_XbyY_buf_alloc(); +extern void _nss_XbyY_buf_free(); +#endif + +#define NSS_XbyY_ALLOC(bufpp, str_size, buf_size) (\ + (*bufpp) == 0 \ + ? (*bufpp) = _nss_XbyY_buf_alloc(str_size, buf_size) \ + : (*bufpp)) \ + +#define NSS_XbyY_FREE(bufpp) (_nss_XbyY_buf_free(*bufpp), (*bufpp) = 0) + +/* + * The nss_XbyY_args_t struct contains all the information passed between + * frontends and backends for the getXbyY_r() and getXent() routines, + * including an nss_XbyY_buf_t and the lookup key (unused for getXXXent_r). + * + * The (*str2ent)() member converts a single XXXent from ASCII text to the + * appropriate struct, storing any pointer data (strings, in_addrs, arrays + * of these) in the buffer. The ASCII text is a counted string (*not* a + * zero-terminated string) whose length is specified by the instr_len + * parameter. The text is found at the address specified by instr and + * the string is treated as readonly. buffer and instr must be non- + * intersecting memory areas. + * + * With the exception of passwd, shadow and group, the text form for these + * databases allows trailing comments and arbitrary whitespace. The + * corresponding str2ent routine assumes that comments, leading whitespace + * and trailing whitespace have been stripped (and thus assumes that entries + * consisting only of these have been discarded). + * + * The text entries for "rpc" and for the databases described in <netdb.h> + * follow a common format (a canonical name with a possibly empty list + * of aliases, and some other value), albeit with minor variations. + * The function _nss_netdb_aliases() does most of the generic work involved + * in parsing and marshalling these into the buffer. + */ + +union nss_XbyY_key { /* No tag; backend should know what to expect */ + uid_t uid; + gid_t gid; + projid_t projid; + const char *name; + int number; + struct { + int net; + int type; + } netaddr; + struct { + const char *addr; + int len; + int type; + } hostaddr; + struct { + union { + const char *name; + int port; + } serv; + const char *proto; + } serv; + void *ether; + struct { + const char *name; + const char *keytype; + } pkey; + struct { + const char *name; + int af_family; + int flags; + } ipnode; + void *attrp; /* for the new attr databases */ +}; + +typedef struct nss_XbyY_args { + +/* IN */ + nss_XbyY_buf_t buf; + int stayopen; + /* + * Support for setXXXent(stayopen) + * Used only in hosts, protocols, + * networks, rpc, and services. + */ +#if defined(__STDC__) + int (*str2ent) (const char *instr, + int instr_len, + void *ent, char *buffer, int buflen); +#else + int (*str2ent)(); +#endif + union nss_XbyY_key key; + +/* OUT */ + void *returnval; + int erange; + int h_errno; /* For gethost*_r() */ + nss_status_t status; /* from the backend last called */ +} nss_XbyY_args_t; + +/* status returned by the str2ent parsing routines */ +#define NSS_STR_PARSE_SUCCESS 0 +#define NSS_STR_PARSE_PARSE 1 +#define NSS_STR_PARSE_ERANGE 2 + +#define NSS_XbyY_INIT(str, res, bufp, len, func) (\ + (str)->buf.result = (res), \ + (str)->buf.buffer = (bufp), \ + (str)->buf.buflen = (len), \ + (str)->stayopen = 0, \ + (str)->str2ent = (func), \ + (str)->returnval = 0, \ + (str)->erange = 0) + +#define NSS_XbyY_FINI(str) (\ + (str)->returnval == 0 && (str)->erange && (errno = ERANGE), \ + (str)->returnval) + +#if defined(__STDC__) +extern char **_nss_netdb_aliases + (const char *, int, char *, int); +#else +extern char **_nss_netdb_aliases(); +#endif + +/* + * nss_dbop_t values for searches with various keys; values for + * destructor/endent/setent/getent are defined in <nss_common.h> + */ + +#define NSS_DBOP_GROUP_BYNAME (NSS_DBOP_next_iter) +#define NSS_DBOP_GROUP_BYGID (NSS_DBOP_GROUP_BYNAME + 1) +#define NSS_DBOP_GROUP_BYMEMBER (NSS_DBOP_GROUP_BYGID + 1) + +#define NSS_DBOP_PASSWD_BYNAME (NSS_DBOP_next_iter) +#define NSS_DBOP_PASSWD_BYUID (NSS_DBOP_PASSWD_BYNAME + 1) + +/* The "compat" backend requires that PASSWD_BYNAME == SHADOW_BYNAME */ +/* (it also requires that both use key.name to pass the username). */ +#define NSS_DBOP_SHADOW_BYNAME (NSS_DBOP_PASSWD_BYNAME) + +#define NSS_DBOP_PROJECT_BYNAME (NSS_DBOP_next_iter) +#define NSS_DBOP_PROJECT_BYID (NSS_DBOP_PROJECT_BYNAME + 1) + +#define NSS_DBOP_HOSTS_BYNAME (NSS_DBOP_next_iter) +#define NSS_DBOP_HOSTS_BYADDR (NSS_DBOP_HOSTS_BYNAME + 1) + +#define NSS_DBOP_IPNODES_BYNAME (NSS_DBOP_next_iter) +#define NSS_DBOP_IPNODES_BYADDR (NSS_DBOP_IPNODES_BYNAME + 1) + +/* + * NSS_DBOP_NAME_2ADDR + * NSS_DBOP_ADDR_2NAME + * : are defines for ipv6 api's + */ + +#define NSS_DBOP_NAME_2ADDR (NSS_DBOP_next_ipv6_iter) +#define NSS_DBOP_ADDR_2NAME (NSS_DBOP_NAME_2ADDR + 1) + +#define NSS_DBOP_RPC_BYNAME (NSS_DBOP_next_iter) +#define NSS_DBOP_RPC_BYNUMBER (NSS_DBOP_RPC_BYNAME + 1) + +#define NSS_DBOP_NETWORKS_BYNAME (NSS_DBOP_next_iter) +#define NSS_DBOP_NETWORKS_BYADDR (NSS_DBOP_NETWORKS_BYNAME + 1) + +#define NSS_DBOP_SERVICES_BYNAME (NSS_DBOP_next_iter) +#define NSS_DBOP_SERVICES_BYPORT (NSS_DBOP_SERVICES_BYNAME + 1) + +#define NSS_DBOP_PROTOCOLS_BYNAME (NSS_DBOP_next_iter) +#define NSS_DBOP_PROTOCOLS_BYNUMBER (NSS_DBOP_PROTOCOLS_BYNAME + 1) + +#define NSS_DBOP_ETHERS_HOSTTON (NSS_DBOP_next_noiter) +#define NSS_DBOP_ETHERS_NTOHOST (NSS_DBOP_ETHERS_HOSTTON + 1) + +#define NSS_DBOP_BOOTPARAMS_BYNAME (NSS_DBOP_next_noiter) +#define NSS_DBOP_NETMASKS_BYNET (NSS_DBOP_next_noiter) + +#define NSS_DBOP_PRINTERS_BYNAME (NSS_DBOP_next_iter) + +/* + * The "real" backend for netgroup (__multi_innetgr, setnetgrent) + */ +#define NSS_DBOP_NETGROUP_IN (NSS_DBOP_next_iter) +#define NSS_DBOP_NETGROUP_SET (NSS_DBOP_NETGROUP_IN + 1) + +/* + * The backend for getpublickey and getsecretkey (getkeys) + */ +#define NSS_DBOP_KEYS_BYNAME (NSS_DBOP_next_iter) + +/* + * The pseudo-backend for netgroup (returned by setnetgrent) doesn't have + * any getXXXbyYYY operations, just the usual destr/end/set/get ops, + * so needs no definitions here. + */ + +#define NSS_DBOP_ATTRDB_BYNAME (NSS_DBOP_next_iter) + +#define NSS_DBOP_AUDITUSER_BYNAME NSS_DBOP_ATTRDB_BYNAME +#define NSS_DBOP_AUTHATTR_BYNAME NSS_DBOP_ATTRDB_BYNAME +#define NSS_DBOP_EXECATTR_BYNAME NSS_DBOP_ATTRDB_BYNAME +#define NSS_DBOP_EXECATTR_BYID (NSS_DBOP_EXECATTR_BYNAME + 1) +#define NSS_DBOP_EXECATTR_BYNAMEID (NSS_DBOP_EXECATTR_BYID + 1) +#define NSS_DBOP_PROFATTR_BYNAME NSS_DBOP_ATTRDB_BYNAME +#define NSS_DBOP_USERATTR_BYNAME NSS_DBOP_ATTRDB_BYNAME + +/* + * Used all over in the switch code. The best home for it I can think of. + * Power-of-two alignments only. + */ +#define ROUND_DOWN(n, align) (((uintptr_t)n) & ~((align) - 1l)) +#define ROUND_UP(n, align) ROUND_DOWN(((uintptr_t)n) + (align) - 1l, \ + (align)) + +#ifdef __cplusplus +} +#endif + +#endif /* _NSS_DBDEFS_H */ diff --git a/usr/src/head/nss_netdir.h b/usr/src/head/nss_netdir.h new file mode 100644 index 0000000000..f84bc07657 --- /dev/null +++ b/usr/src/head/nss_netdir.h @@ -0,0 +1,158 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1993-94, 1999, 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * nss_netdir.h + * + * Defines structures that are shared between the OSNET-private + * _get_hostserv_inetnetdir_byYY() interfaces and the public + * interfaces gethostbyYY()/getservbyYY() and netdir_getbyYY(). + * Ideally, this header file should never be visible to developers + * outside of the OSNET build. + */ + +#ifndef _NSS_NETDIR_H +#define _NSS_NETDIR_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + NSS_HOST, + NSS_SERV, + NETDIR_BY, + NETDIR_BY_NOSRV, /* bypass service lookup */ + NETDIR_BY6, + NETDIR_BY_NOSRV6, /* bypass service lookup */ + NSS_HOST6 +} nss_netdir_op_t; + +struct nss_netdirbyname_in { + nss_netdir_op_t op_t; + union { + struct nd_hostserv *nd_hs; + union { + struct { + const char *name; + char *buf; + int buflen; + } host; + struct { + const char *name; + char *buf; + int buflen; + int af_family; /* for ipnode */ + int flags; /* for ipnode */ + } host6; + struct { + const char *name; + const char *proto; + char *buf; + int buflen; + } serv; + } nss; + } arg; +}; + +union nss_netdirbyname_out { + struct nd_addrlist **nd_alist; + union { + struct { + struct hostent *hent; + int *herrno_p; + } host; + struct servent *serv; + } nss; +}; + +struct nss_netdirbyaddr_in { + nss_netdir_op_t op_t; + union { + struct netbuf *nd_nbuf; + union { + struct { + const char *addr; + int len; + int type; + char *buf; + int buflen; + } host; + struct { + int port; + const char *proto; + char *buf; + int buflen; + } serv; + } nss; + } arg; +}; + +union nss_netdirbyaddr_out { + struct nd_hostservlist **nd_hslist; + union { + struct { + struct hostent *hent; + int *herrno_p; + } host; + struct servent *serv; + } nss; +}; + +#ifdef __STDC__ + +int __classic_netdir_getbyname(struct netconfig *, + struct nd_hostserv *, struct nd_addrlist **); +int __classic_netdir_getbyaddr(struct netconfig *, + struct nd_hostservlist **, struct netbuf *); +int _get_hostserv_inetnetdir_byname(struct netconfig *, + struct nss_netdirbyname_in *, union nss_netdirbyname_out *); +int _get_hostserv_inetnetdir_byaddr(struct netconfig *, + struct nss_netdirbyaddr_in *, union nss_netdirbyaddr_out *); +int __inet_netdir_options(struct netconfig *, + int option, int fd, char *par); +struct netbuf *__inet_uaddr2taddr(struct netconfig *, char *); +char *__inet_taddr2uaddr(struct netconfig *, struct netbuf *); + +#else + +int __classic_netdir_getbyname(); +int __classic_netdir_getbyaddr(); +int _get_hostserv_inetnetdir_byname(); +int _get_hostserv_inetnetdir_byaddr(); +int __inet_netdir_options(); +struct netbuf *__inet_uaddr2taddr(); +char *__inet_taddr2uaddr(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NSS_NETDIR_H */ diff --git a/usr/src/head/nsswitch.h b/usr/src/head/nsswitch.h new file mode 100644 index 0000000000..ecf4841cf9 --- /dev/null +++ b/usr/src/head/nsswitch.h @@ -0,0 +1,147 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1991-2000 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * nsswitch.h + * + * Low-level interface to the name-service switch. The interface defined + * in <nss_common.h> should be used in preference to this. + * + * This is a Project Private interface. It may change in future releases. + * ==== ^^^^^^^^^^^^^^^ ? + */ + +#ifndef _NSSWITCH_H +#define _NSSWITCH_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NSW_CONFIG_FILE "/etc/nsswitch.conf" +#define __NSW_DEFAULT_FILE "/etc/default/nss" + +#define __NSW_HOSTS_DB "hosts" +#define __NSW_PASSWD_DB "passwd" +#define __NSW_GROUP_DB "group" +#define __NSW_NETGROUP_DB "netgroup" +#define __NSW_NETWORKS_DB "networks" +#define __NSW_PROTOCOLS_DB "protocols" +#define __NSW_RPC_DB "rpc" +#define __NSW_SERVICES_DB "services" +#define __NSW_ETHERS_DB "ethers" +#define __NSW_BOOTPARAMS_DB "bootparams" +#define __NSW_NETMASKS_DB "netmasks" +#define __NSW_BROADCASTADDRS_DB "broadcastaddrs" +#define __NSW_MAIL_ALIASES_DB "aliases" +#define __NSW_AUDITUSER_DB "audit_user" +#define __NSW_AUTHATTR_DB "auth_attr" +#define __NSW_EXECATTR_DB "exec_attr" +#define __NSW_PROFATTR_DB "prof_attr" +#define __NSW_USERATTR_DB "user_attr" +#define __NSW_PROJECT_DB "project" + +#define __NSW_STD_ERRS 4 /* number of reserved errors that follow */ + +#define __NSW_SUCCESS 0 /* found the required data */ +#define __NSW_NOTFOUND 1 /* the naming service returned lookup failure */ +#define __NSW_UNAVAIL 2 /* could not call the naming service */ +#define __NSW_TRYAGAIN 3 /* bind error to suggest a retry */ + +typedef unsigned char action_t; +#define __NSW_CONTINUE 0 /* the action is to continue to next service */ +#define __NSW_RETURN 1 /* the action is to return to the user */ + +#define __NSW_STR_RETURN "return" +#define __NSW_STR_CONTINUE "continue" +#define __NSW_STR_SUCCESS "success" +#define __NSW_STR_NOTFOUND "notfound" +#define __NSW_STR_UNAVAIL "unavail" +#define __NSW_STR_TRYAGAIN "tryagain" + +/* prefix for all switch shared objects */ +#define __NSW_LIB "nsw" + +enum __nsw_parse_err { + __NSW_CONF_PARSE_SUCCESS = 0, /* parser found the required policy */ + __NSW_CONF_PARSE_NOFILE = 1, /* the policy files does not exist */ + __NSW_CONF_PARSE_NOPOLICY = 2, /* the required policy is not set */ + /* in the file */ + __NSW_CONF_PARSE_SYSERR = 3 /* system error in the parser */ +}; + + +struct __nsw_long_err { + int nsw_errno; + action_t action; + struct __nsw_long_err *next; +}; + +struct __nsw_lookup { + char *service_name; + action_t actions[__NSW_STD_ERRS]; + struct __nsw_long_err *long_errs; + struct __nsw_lookup *next; +}; + +struct __nsw_switchconfig { + int vers; + char *dbase; + int num_lookups; + struct __nsw_lookup *lookups; +}; + +#define __NSW_ACTION(lkp, err) \ + ((lkp)->next == NULL ? \ + __NSW_RETURN \ + : \ + ((err) >= 0 && (err) < __NSW_STD_ERRS ? \ + (lkp)->actions[err] \ + : \ + __nsw_extended_action(lkp, err))) + +#ifdef __STDC__ + +struct __nsw_switchconfig *__nsw_getconfig + (const char *, enum __nsw_parse_err *); +int __nsw_freeconfig(struct __nsw_switchconfig *); +action_t __nsw_extended_action(struct __nsw_lookup *, int); + +#else + +struct __nsw_switchconfig *__nsw_getconfig(); +int __nsw_freeconfig(); +action_t __nsw_extended_action(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NSSWITCH_H */ diff --git a/usr/src/head/pcsample.h b/usr/src/head/pcsample.h new file mode 100644 index 0000000000..c30b33d3d5 --- /dev/null +++ b/usr/src/head/pcsample.h @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1998 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _PCSAMPLE_H +#define _PCSAMPLE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * PC sampling profiling + */ +#ifdef __STDC__ +long pcsample(uintptr_t [], long); +#else +long pcsample(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _PCSAMPLE_H */ diff --git a/usr/src/head/pfmt.h b/usr/src/head/pfmt.h new file mode 100644 index 0000000000..332f2ab0e8 --- /dev/null +++ b/usr/src/head/pfmt.h @@ -0,0 +1,92 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _PFMT_H +#define _PFMT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <stdio.h> +#ifndef va_args +#include <stdarg.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define MM_STD 0 +#define MM_NOSTD 0x100 +#define MM_GET 0 +#define MM_NOGET 0x200 + +#define MM_ACTION 0x400 + +#define MM_NOCONSOLE 0 +#define MM_CONSOLE 0x800 + +/* Classification */ +#define MM_NULLMC 0 +#define MM_HARD 0x1000 +#define MM_SOFT 0x2000 +#define MM_FIRM 0x4000 +#define MM_APPL 0x8000 +#define MM_UTIL 0x10000 +#define MM_OPSYS 0x20000 + +/* Most commonly used combinations */ +#define MM_SVCMD MM_UTIL|MM_SOFT + +#define MM_ERROR 0 +#define MM_HALT 1 +#define MM_WARNING 2 +#define MM_INFO 3 + +#ifdef __STDC__ +int pfmt(FILE *, long, const char *, ...); +int lfmt(FILE *, long, const char *, ...); +int vpfmt(FILE *, long, const char *, va_list); +int vlfmt(FILE *, long, const char *, va_list); +const char *setcat(const char *); +int setlabel(const char *); +int addsev(int, const char *); +#else +int pfmt(); +int lfmt(); +int vpfmt(); +int vlfmt(); +char *setcat(); +int setlabel(); +int addsev(); +#endif + +#define DB_NAME_LEN 15 +#define MAXLABEL 25 + +#ifdef __cplusplus +} +#endif + +#endif /* _PFMT_H */ diff --git a/usr/src/head/pkgdev.h b/usr/src/head/pkgdev.h new file mode 100644 index 0000000000..a41793c9e8 --- /dev/null +++ b/usr/src/head/pkgdev.h @@ -0,0 +1,55 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _PKGDEV_H +#define _PKGDEV_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2.1.1 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/types.h> + +struct pkgdev { + int rdonly; + int mntflg; + longlong_t capacity; /* number of 512-blocks on device */ + char *name; + char *dirname; + char *pathname; + char *mount; + char *fstyp; + char *cdevice; + char *bdevice; + char *norewind; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _PKGDEV_H */ diff --git a/usr/src/head/pkginfo.h b/usr/src/head/pkginfo.h new file mode 100644 index 0000000000..4e0af291c1 --- /dev/null +++ b/usr/src/head/pkginfo.h @@ -0,0 +1,68 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _PKGINFO_H +#define _PKGINFO_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5.1.2 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define PI_INSTALLED 0 +#define PI_PARTIAL 1 +#define PI_PRESVR4 2 +#define PI_UNKNOWN 3 +#define PI_SPOOLED 4 + +struct pkginfo { + char *pkginst; + char *name; + char *arch; + char *version; + char *vendor; + char *basedir; + char *catg; + char status; +}; + +extern char *pkgdir; + +#ifdef __STDC__ +extern char *pkgparam(char *, char *); +extern int pkginfo(struct pkginfo *, char *, ...), + pkgnmchk(char *, char *, int); +#else +extern char *pkgparam(); +extern int pkginfo(), + pkgnmchk(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _PKGINFO_H */ diff --git a/usr/src/head/pkglocs.h b/usr/src/head/pkglocs.h new file mode 100644 index 0000000000..7260d8f61b --- /dev/null +++ b/usr/src/head/pkglocs.h @@ -0,0 +1,45 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _PKGLOCS_H +#define _PKGLOCS_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define PKGOLD "/usr/options" +#define PKGLOC "/var/sadm/pkg" +#define PKGADM "/var/sadm/install" +#define PKGBIN "/usr/sadm/install/bin" +#define PKGSCR "/usr/sadm/install/scripts" + +#ifdef __cplusplus +} +#endif + +#endif /* _PKGLOCS_H */ diff --git a/usr/src/head/pkgstrct.h b/usr/src/head/pkgstrct.h new file mode 100644 index 0000000000..ae68e53a21 --- /dev/null +++ b/usr/src/head/pkgstrct.h @@ -0,0 +1,106 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 (c) 1994, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _PKGSTRCT_H +#define _PKGSTRCT_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */ + +#include <time.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define CLSSIZ 64 +#define PKGSIZ 64 +#define ATRSIZ 64 + +#define BADFTYPE '?' +#define BADMODE (mode_t)ULONG_MAX +#define BADOWNER "?" +#define BADGROUP "?" +#define BADMAJOR (major_t)ULONG_MAX +#define BADMINOR (minor_t)ULONG_MAX +#define BADCLASS "none" +#define BADINPUT 1 /* not EOF */ +#define BADCONT (-1L) + +extern char *errstr; + +struct ainfo { + char *local; + mode_t mode; + char owner[ATRSIZ+1]; + char group[ATRSIZ+1]; + major_t major; + minor_t minor; +}; + +struct cinfo { + long cksum; + long size; + time_t modtime; +}; + +struct pinfo { + char status; + char pkg[PKGSIZ+1]; + char editflag; + char aclass[ATRSIZ+1]; + struct pinfo + *next; +}; + +struct cfent { + short volno; + char ftype; + char pkg_class[CLSSIZ+1]; + int pkg_class_idx; + char *path; + struct ainfo ainfo; + struct cinfo cinfo; + short npkgs; + struct pinfo + *pinfo; +}; + +/* averify() & cverify() error codes */ +#define VE_EXIST 0x0001 +#define VE_FTYPE 0x0002 +#define VE_ATTR 0x0004 +#define VE_CONT 0x0008 +#define VE_FAIL 0x0010 +#define VE_TIME 0x0020 + +#ifdef __cplusplus +} +#endif + +#endif /* _PKGSTRCT_H */ diff --git a/usr/src/head/pkgtrans.h b/usr/src/head/pkgtrans.h new file mode 100644 index 0000000000..63f9bab500 --- /dev/null +++ b/usr/src/head/pkgtrans.h @@ -0,0 +1,46 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _PKGTRANS_H +#define _PKGTRANS_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2.1.1 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define PT_OVERWRITE 0x01 +#define PT_INFO_ONLY 0x02 +#define PT_RENAME 0x04 +#define PT_DEBUG 0x08 +#define PT_SILENT 0x10 +#define PT_ODTSTREAM 0x40 + +#ifdef __cplusplus +} +#endif + +#endif /* _PKGTRANS_H */ diff --git a/usr/src/head/poll.h b/usr/src/head/poll.h new file mode 100644 index 0000000000..cc3094be98 --- /dev/null +++ b/usr/src/head/poll.h @@ -0,0 +1,37 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _POLL_H +#define _POLL_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ + +/* + * Poll system call interface definitions. + */ + +#include <sys/poll.h> + +#endif /* _POLL_H */ diff --git a/usr/src/head/port.h b/usr/src/head/port.h new file mode 100644 index 0000000000..8b09b39c8b --- /dev/null +++ b/usr/src/head/port.h @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _PORT_H +#define _PORT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <sys/port.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * ports API + */ + +int port_create(void); +int port_associate(int, int, uintptr_t, int, void *); +int port_dissociate(int, int, uintptr_t); +int port_send(int, int, void *); +int port_sendn(int [], int [], uint_t, int, void *); +int port_get(int, port_event_t *, struct timespec *); +int port_getn(int, port_event_t [], uint_t, uint_t *, struct timespec *); +int port_alert(int, int, int, void *); + +#ifdef __cplusplus +} +#endif + +#endif /* _PORT_H */ diff --git a/usr/src/head/priv.h b/usr/src/head/priv.h new file mode 100644 index 0000000000..a4dc840537 --- /dev/null +++ b/usr/src/head/priv.h @@ -0,0 +1,126 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2002-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _PRIV_H_ +#define _PRIV_H_ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/priv.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define PRIV_STR_PORT 0x00 /* portable output */ +#define PRIV_STR_LIT 0x01 /* literal output */ +#define PRIV_STR_SHORT 0x02 /* shortest output */ + +#define PRIV_ALLSETS ((priv_ptype_t)0) /* for priv_set() */ + +/* + * library functions prototype. + */ +#if defined(__STDC__) + +extern int setppriv(priv_op_t, priv_ptype_t, const priv_set_t *); +extern int getppriv(priv_ptype_t, priv_set_t *); +extern int setpflags(uint_t, uint_t); +extern uint_t getpflags(uint_t); +extern const priv_impl_info_t *getprivimplinfo(void); + +extern int priv_set(priv_op_t, priv_ptype_t, ...); +extern boolean_t priv_ineffect(const char *); +extern priv_set_t *priv_str_to_set(const char *, const char *, const char **); +extern char *priv_set_to_str(const priv_set_t *, char, int); + +extern int priv_getbyname(const char *); +extern const char *priv_getbynum(int); +extern int priv_getsetbyname(const char *); +extern const char *priv_getsetbynum(int); +extern char *priv_gettext(const char *); + +extern priv_set_t *priv_allocset(void); +extern void priv_freeset(priv_set_t *); + +extern void priv_emptyset(priv_set_t *); +extern void priv_fillset(priv_set_t *); +extern boolean_t priv_isemptyset(const priv_set_t *); +extern boolean_t priv_isfullset(const priv_set_t *); +extern boolean_t priv_isequalset(const priv_set_t *, const priv_set_t *); +extern boolean_t priv_issubset(const priv_set_t *, const priv_set_t *); +extern void priv_intersect(const priv_set_t *, priv_set_t *); +extern void priv_union(const priv_set_t *, priv_set_t *); +extern void priv_inverse(priv_set_t *); +extern int priv_addset(priv_set_t *, const char *); +extern void priv_copyset(const priv_set_t *, priv_set_t *); +extern int priv_delset(priv_set_t *, const char *); +extern boolean_t priv_ismember(const priv_set_t *, const char *); + +#else /* Non ANSI */ + +extern int setppriv(/* priv_op_t, priv_ptype_t, const priv_set_t * */); +extern int getppriv(/* priv_ptype_t, priv_set_t * */); +extern int setpflags(/* uint_t, uint_t */); +extern uint_t getpflags(/* uint_t */); +extern priv_impl_info_t *getprivimplinfo(/* void */); + +extern int priv_set(/* priv_op_t, priv_ptype_t, ... */); +extern boolean_t priv_ineffect(/* const char * */); +extern priv_set_t *priv_str_to_set(/* + const char *, const char *, const char ** */); +extern char *priv_set_to_str(/* const priv_set_t *, char, int */); + +extern int priv_getbyname(/* const char * */); +extern char *priv_getbynum(/* int */); +extern int priv_getsetbyname(/* const char * */); +extern char *priv_getsetbynum(/* int */); +extern char *priv_gettext(/* const char * */); + +extern priv_set_t *priv_allocset(/* void */); +extern void priv_freeset(/* priv_set_t * */); + +extern void priv_emptyset(/* priv_set_t * */); +extern void priv_fillset(/* priv_set_t * */); +extern boolean_t priv_isemptyset(/* const priv_set_t * */); +extern boolean_t priv_isfullset(/* const priv_set_t * */); +extern boolean_t priv_isequalset(/* const priv_set_t *, const priv_set_t * */); +extern boolean_t priv_issubset(/* const priv_set_t *, const priv_set_t * */); +extern void priv_intersect(/* const priv_set_t *, priv_set_t * */); +extern void priv_union(/* const priv_set_t *, priv_set_t * */); +extern void priv_inverse(/* priv_set_t * */); +extern int priv_addset(/* priv_set_t *, const char * */); +extern void priv_copyset(/* const priv_set_t *, priv_set_t * */); +extern int priv_delset(/* priv_set_t *, const char * */); +extern boolean_t priv_ismember(/* const priv_set_t *, const char * */); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _PRIV_H_ */ diff --git a/usr/src/head/priv_utils.h b/usr/src/head/priv_utils.h new file mode 100644 index 0000000000..f32b81791c --- /dev/null +++ b/usr/src/head/priv_utils.h @@ -0,0 +1,96 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * + * This is a private header file. The interfaces in this header are + * subject to change or removal without notice. + * The Sun classification is "Project Private". + */ + +#ifndef _PRIV_UTILS_H +#define _PRIV_UTILS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <priv.h> + + +#ifdef __cplusplus +extern "C" { +#endif + +#define PU_RESETGROUPS 0x0001 /* Remove supplemental groups */ +#define PU_LIMITPRIVS 0x0002 /* L=P */ +#define PU_INHERITPRIVS 0x0004 /* I=P */ +#define PU_CLEARLIMITSET 0x0008 /* L=0 */ + +/* + * Should be run at the start of a set-uid root program; + * if the effective uid == 0 and the real uid != 0, + * the specified privileges X are assigned as follows: + * + * P = I + X + B (B added insofar allowable from L) + * E = I + * (i.e., the requested privileges are dormant, not active) + * Then resets all uids to the invoking uid; no-op if euid == uid == 0. + * + * flags: PU_LIMITPRIVS, PU_CLEARLIMITSET, PU_CLEARINHERITABLE + * + * Caches the required privileges for use by __priv_bracket(). + * + */ +extern int __init_suid_priv(int, ...); + +/* + * After calling __init_suid_priv we can __priv_bracket(PRIV_ON) and + * __priv_bracket(PRIV_OFF) and __priv_relinquish to get rid of the + * privileges forever. + */ +extern int __priv_bracket(priv_op_t); +extern void __priv_relinquish(void); + +/* + * Runs at the start of a daemon, assuming euid=uid=0. + * + * P = E = B + X + * + * Then resets uids. + * + * Flags: all + * + */ +extern int __init_daemon_priv(int, uid_t, gid_t, ...); + +/* + * Runs after the daemon is initialized, and gives up the privileges + * passed in as argument because they are no longer needed. + * Reenables core dumps. + */ +extern void __fini_daemon_priv(const char *, ...); + +#ifdef __cplusplus +} +#endif + +#endif /* _PRIV_UTILS_H */ diff --git a/usr/src/head/proc_service.h b/usr/src/head/proc_service.h new file mode 100644 index 0000000000..85cbd1c0f1 --- /dev/null +++ b/usr/src/head/proc_service.h @@ -0,0 +1,146 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _PROC_SERVICE_H +#define _PROC_SERVICE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Description: + * Types, global variables, and function definitions for provider + * of import functions for users of libc_db and librtld_db. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/types.h> +#include <sys/procfs_isa.h> +#include <sys/lwp.h> +#include <sys/auxv.h> +#include <elf.h> +#if defined(__i386) || defined(__amd64) /* for struct ssd */ +#include <sys/segments.h> +#include <sys/sysi86.h> +#endif + + +typedef unsigned long psaddr_t; + +typedef enum { + PS_OK, /* generic "call succeeded" */ + PS_ERR, /* generic error */ + PS_BADPID, /* bad process handle */ + PS_BADLID, /* bad lwp identifier */ + PS_BADADDR, /* bad address */ + PS_NOSYM, /* p_lookup() could not find given symbol */ + PS_NOFREGS /* FPU register set not available for given lwp */ +} ps_err_e; + +struct ps_prochandle; + +/* + * See <sys/procfs_isa.h> for possible values of data_model. + */ +extern ps_err_e ps_pdmodel(struct ps_prochandle *, int *data_model); + +/* + * Special values for 'object_name' to refer to certain well-known objects. + */ +#define PS_OBJ_EXEC ((const char *)0x0) /* the executable file */ +#define PS_OBJ_LDSO ((const char *)0x1) /* the dynamic linker */ + +extern ps_err_e ps_pglobal_lookup(struct ps_prochandle *, + const char *object_name, const char *sym_name, psaddr_t *sym_addr); + +#ifdef _LP64 +typedef Elf64_Sym ps_sym_t; +#else +typedef Elf32_Sym ps_sym_t; +#endif +extern ps_err_e ps_pglobal_sym(struct ps_prochandle *, + const char *object_name, const char *sym_name, ps_sym_t *sym); + +/* + * To read and write the process's address space. + */ +extern ps_err_e ps_pread(struct ps_prochandle *, + psaddr_t, void *, size_t); +extern ps_err_e ps_pwrite(struct ps_prochandle *, + psaddr_t, const void *, size_t); +/* + * The following four functions can be implemented as simple aliases for + * the corresponding primary two functions above (#pragma weak ...). + * They are artifacts of history that must be maintained. + */ +extern ps_err_e ps_pdread(struct ps_prochandle *, + psaddr_t, void *, size_t); +extern ps_err_e ps_pdwrite(struct ps_prochandle *, + psaddr_t, const void *, size_t); +extern ps_err_e ps_ptread(struct ps_prochandle *, + psaddr_t, void *, size_t); +extern ps_err_e ps_ptwrite(struct ps_prochandle *, + psaddr_t, const void *, size_t); + +extern ps_err_e ps_pstop(struct ps_prochandle *); +extern ps_err_e ps_pcontinue(struct ps_prochandle *); +extern ps_err_e ps_lstop(struct ps_prochandle *, lwpid_t); +extern ps_err_e ps_lcontinue(struct ps_prochandle *, lwpid_t); + +extern ps_err_e ps_lgetregs(struct ps_prochandle *, + lwpid_t, prgregset_t); +extern ps_err_e ps_lsetregs(struct ps_prochandle *, + lwpid_t, const prgregset_t); +extern ps_err_e ps_lgetfpregs(struct ps_prochandle *, + lwpid_t, prfpregset_t *); +extern ps_err_e ps_lsetfpregs(struct ps_prochandle *, + lwpid_t, const prfpregset_t *); + +#if defined(__sparc) || defined(__sparcv9) +extern ps_err_e ps_lgetxregsize(struct ps_prochandle *, lwpid_t, int *); +extern ps_err_e ps_lgetxregs(struct ps_prochandle *, lwpid_t, caddr_t); +extern ps_err_e ps_lsetxregs(struct ps_prochandle *, lwpid_t, caddr_t); +#endif + +#if defined(__i386) || defined(__amd64) +extern ps_err_e ps_lgetLDT(struct ps_prochandle *, lwpid_t, struct ssd *); +#endif + +extern ps_err_e ps_pauxv(struct ps_prochandle *, const auxv_t **); + +extern ps_err_e ps_kill(struct ps_prochandle *, int sig); +extern ps_err_e ps_lrolltoaddr(struct ps_prochandle *, + lwpid_t, psaddr_t go_addr, psaddr_t stop_addr); + +extern void ps_plog(const char *fmt, ...); + +#ifdef __cplusplus +} +#endif + +#endif /* _PROC_SERVICE_H */ diff --git a/usr/src/head/procfs.h b/usr/src/head/procfs.h new file mode 100644 index 0000000000..08092ef464 --- /dev/null +++ b/usr/src/head/procfs.h @@ -0,0 +1,57 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1996, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _PROCFS_H +#define _PROCFS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This include file forces the new structured /proc definitions. + * The structured /proc interface is the preferred API, and the + * older ioctl()-based /proc interface will be removed in a future + * version of Solaris. + */ +#ifdef _STRUCTURED_PROC +#undef _STRUCTURED_PROC +#endif +#define _STRUCTURED_PROC 1 + +#include <sys/procfs.h> + +/* + * libproc API + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _PROCFS_H */ diff --git a/usr/src/head/prof.h b/usr/src/head/prof.h new file mode 100644 index 0000000000..792fd2137b --- /dev/null +++ b/usr/src/head/prof.h @@ -0,0 +1,103 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1996-1999 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _PROF_H +#define _PROF_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.10.1.4 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MARK +#define MARK(K) {} +#else +#undef MARK + +#if defined(__STDC__) + +#if defined(__i386) +#define MARK(K) {\ + asm(" .data"); \ + asm(" .align 4"); \ + asm("."#K".:"); \ + asm(" .long 0"); \ + asm(" .text"); \ + asm("M."#K":"); \ + asm(" movl $."#K"., %edx"); \ + asm(" call _mcount"); \ + } +#endif + +#if defined(__sparc) +#define MARK(K) {\ + asm(" .reserve ."#K"., 4, \".bss\", 4"); \ + asm("M."#K":"); \ + asm(" sethi %hi(."#K".), %o0"); \ + asm(" call _mcount"); \ + asm(" or %o0, %lo(."#K".), %o0"); \ + } +#endif + +#else /* __STDC__ */ + +#if defined(__i386) +#define MARK(K) {\ + asm(" .data"); \ + asm(" .align 4"); \ + asm(".K.:"); \ + asm(" .long 0"); \ + asm(" .text"); \ + asm("M.K:"); \ + asm(" movl $.K., %edx"); \ + asm(" call _mcount"); \ + } +#endif + +#if defined(__sparc) +#define MARK(K) {\ + asm(" .reserve .K., 4, \".bss\", 4"); \ + asm("M.K:"); \ + asm(" sethi %hi(.K.), %o0"); \ + asm(" call _mcount"); \ + asm(" or %o0, %lo(.K.), %o0"); \ + } +#endif + +#endif /* __STDC__ */ + +#endif /* MARK */ + +#ifdef __cplusplus +} +#endif + +#endif /* _PROF_H */ diff --git a/usr/src/head/prof_attr.h b/usr/src/head/prof_attr.h new file mode 100644 index 0000000000..2acac51cc7 --- /dev/null +++ b/usr/src/head/prof_attr.h @@ -0,0 +1,117 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1999,2002-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _PROF_ATTR_H +#define _PROF_ATTR_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + + +#include <sys/types.h> +#include <secdb.h> + + +#define PROFATTR_FILENAME "/etc/security/prof_attr" +#define PROFATTR_DB_NAME "prof_attr.org_dir" +#define PROFATTR_DB_NCOL 5 /* total columns */ +#define PROFATTR_DB_NKEYCOL 1 /* total searchable columns */ +#define PROFATTR_DB_TBLT "prof_attr_tbl" +#define PROFATTR_NAME_DEFAULT_KW "nobody" + +#define PROFATTR_COL0_KW "name" +#define PROFATTR_COL1_KW "res1" +#define PROFATTR_COL2_KW "res2" +#define PROFATTR_COL3_KW "desc" +#define PROFATTR_COL4_KW "attr" + +#define DEF_PROF "PROFS_GRANTED=" + +#define MAXPROFS 4096 + +/* + * indices of searchable columns + */ +#define PROFATTR_KEYCOL0 0 /* name */ + + +/* + * Key words used in the prof_attr database + */ +#define PROFATTR_AUTHS_KW "auths" +#define PROFATTR_PROFS_KW "profiles" +#define PROFATTR_PRIVS_KW "privs" + + +/* + * Nsswitch representation of profile attributes. + */ + +typedef struct profstr_s { + char *name; /* proforization name */ + char *res1; /* RESERVED */ + char *res2; /* RESERVED */ + char *desc; /* description */ + char *attr; /* string of key-value pair attributes */ +} profstr_t; + +typedef struct profattr_s { + char *name; /* proforization name */ + char *res1; /* RESERVED */ + char *res2; /* RESERVED */ + char *desc; /* description */ + kva_t *attr; /* array of key-value pair attributes */ +} profattr_t; + +#ifdef __STDC__ +extern profattr_t *getprofnam(const char *); +extern profattr_t *getprofattr(void); +extern void getproflist(const char *, char **, int *); +extern void setprofattr(void); +extern void endprofattr(void); +extern void free_profattr(profattr_t *); +extern void free_proflist(char **, int); + +#else /* not __STDC__ */ + +extern profattr_t *getprofnam(); +extern profattr_t *getprofattr(); +extern void getproflist(); +extern int setprofattr(); +extern int endprofattr(); +extern void free_profattr(); +extern void free_proflist(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _PROF_ATTR_H */ diff --git a/usr/src/head/project.h b/usr/src/head/project.h new file mode 100644 index 0000000000..06f64da056 --- /dev/null +++ b/usr/src/head/project.h @@ -0,0 +1,76 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1999-2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _PROJECT_H +#define _PROJECT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <stdio.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define PROJF_PATH "/etc/project" /* pathname of the "project" file */ +#define PROJNAME_MAX 64 /* maximum project name size */ +#define PROJECT_BUFSZ 4096 /* default buffer size */ + +#define SETPROJ_ERR_TASK (-1) /* error creating new task */ +#define SETPROJ_ERR_POOL (-2) /* error binding to pool */ + +struct project { + char *pj_name; /* name of the project */ + projid_t pj_projid; /* numerical project id */ + char *pj_comment; /* project description */ + char **pj_users; /* vector of pointers to project user names */ + char **pj_groups; /* vector of pointers to project group names */ + char *pj_attr; /* project attributes string */ +}; + +extern void setprojent(void); +extern void endprojent(void); +extern struct project *getprojent(struct project *, void *, size_t); +extern struct project *getprojbyname(const char *, + struct project *, void *, size_t); +extern struct project *getprojbyid(projid_t, struct project *, void *, size_t); +extern struct project *getdefaultproj(const char *, + struct project *, void *, size_t); +extern struct project *fgetprojent(FILE *, struct project *, void *, size_t); +extern int inproj(const char *, const char *, void *, size_t); +extern projid_t getprojidbyname(const char *); + +extern projid_t getprojid(void); + +extern projid_t setproject(const char *, const char *, int); +extern int project_walk(int (*)(projid_t, void *), void *); + +#ifdef __cplusplus +} +#endif + +#endif /* _PROJECT_H */ diff --git a/usr/src/head/protocols/dumprestore.h b/usr/src/head/protocols/dumprestore.h new file mode 100644 index 0000000000..029f5cbbe5 --- /dev/null +++ b/usr/src/head/protocols/dumprestore.h @@ -0,0 +1,186 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. */ +/* All rights reserved. */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _PROTOCOLS_DUMPRESTORE_H +#define _PROTOCOLS_DUMPRESTORE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This header file defines two different versions of the + * ufsdump/ufsrestore interface. If the defined constant + * SUPPORTS_MTB_TAPE_FORMAT is set, the data structures in + * this header file will support backups of more than 2 terabytes + * of data. + * + * In the old format (the format that only supports dumps + * of less than 2 terabytes), TP_BSIZE is the size of file blocks + * on the dump tapes. + * Note that TP_BSIZE must be a multiple of DEV_BSIZE. + * + * In the new format, tp_bsize is used to store the + * tape block size, which is variable. The tape block size + * is like 'fragsize', in that 'c_tapea' in each tape record + * contains the 'tape block record' number in a signed int. + * We set TP_BSIZE_MAX to 65536, which will handle 128TB + * of data. The new format is indicated by a magic number + * in the tape header of MTB_MAGIC. The new format is only + * used when the size of the backup exceeds 2 TB. If the + * backup can be stored in less thatn 2 TB, ufsdump still + * uses the format indicated by the NFS_MAGIC magic number. + * Therefore, backups of less than 2 TB are still readable + * by earlier versions of ufsrestore. + * + * NTREC is the number of TP_BSIZE blocks that are written + * in each tape record. HIGHDENSITYTREC is the number of + * TP_BSIZE blocks that are written in each tape record on + * 6250 BPI or higher density tapes. CARTRIDGETREC is the + * number of TP_BSIZE (or tp_bsize) blocks that are written + * in each tape record on cartridge tapes. + * + * TP_NINDIR is the number of indirect pointers in a TS_INODE + * or TS_ADDR record. Note that it must be a power of two. + * + */ +#define TP_BSIZE_MAX 65536 +#define TP_BSIZE_MIN 1024 +#define ESIZE_SHIFT_MAX 6 /* shift TP_BSIZE_MIN to TP_BSIZE_MAX */ + +#ifdef SUPPORTS_MTB_TAPE_FORMAT +#define TP_BUFSIZE TP_BSIZE_MAX +extern int32_t tp_bsize; +#else +#define TP_BSIZE 1024 +#define TP_BUFSIZE TP_BSIZE +#endif /* SUPPORTS_MTB_TAPE_FORMAT */ + +#define NTREC 10 +#define HIGHDENSITYTREC 32 +#define CARTRIDGETREC 63 +#define TP_NINDIR (TP_BSIZE_MIN/2) +#define TP_NINOS (TP_NINDIR / sizeof (long)) +#define LBLSIZE 16 +#define NAMELEN 64 + +#define OFS_MAGIC (int)60011 +#define NFS_MAGIC (int)60012 +#define MTB_MAGIC (int)60013 +#define CHECKSUM (int)84446 + +union u_data { + char s_addrs[TP_NINDIR]; /* 1 => data; 0 => hole in inode */ + int32_t s_inos[TP_NINOS]; /* starting inodes on tape */ +}; + +union u_shadow { + struct s_nonsh { + int32_t c_level; /* level of this dump */ + char c_filesys[NAMELEN]; /* dumpped file system name */ + char c_dev[NAMELEN]; /* name of dumpped device */ + char c_host[NAMELEN]; /* name of dumpped host */ + } c_nonsh; + char c_shadow[1]; +}; + +/* if you change anything here, be sure to change normspcl in byteorder.c */ + +union u_spcl { + char dummy[TP_BUFSIZE]; + struct s_spcl { + int32_t c_type; /* record type (see below) */ + time32_t c_date; /* date of previous dump */ + time32_t c_ddate; /* date of this dump */ + int32_t c_volume; /* dump volume number */ + daddr32_t c_tapea; /* logical block of this record */ + ino32_t c_inumber; /* number of inode */ + int32_t c_magic; /* magic number (see above) */ + int32_t c_checksum; /* record checksum */ + struct dinode c_dinode; /* ownership and mode of inode */ + int32_t c_count; /* number of valid c_addr entries */ + union u_data c_data; /* see union above */ + char c_label[LBLSIZE]; /* dump label */ + union u_shadow c_shadow; /* see union above */ + int32_t c_flags; /* additional information */ + int32_t c_firstrec; /* first record on volume */ +#ifdef SUPPORTS_MTB_TAPE_FORMAT + int32_t c_tpbsize; /* tape block size */ + int32_t c_spare[31]; /* reserved for future uses */ +#else + int32_t c_spare[32]; +#endif /* SUPPORTS_MTB_TAPE_FORMAT */ + } s_spcl; +} u_spcl; +#define spcl u_spcl.s_spcl +#define c_addr c_data.s_addrs +#define c_inos c_data.s_inos +#define c_level c_shadow.c_nonsh.c_level +#define c_filesys c_shadow.c_nonsh.c_filesys +#define c_dev c_shadow.c_nonsh.c_dev +#define c_host c_shadow.c_nonsh.c_host + +/* + * special record types + */ +#define TS_TAPE 1 /* dump tape header */ +#define TS_INODE 2 /* beginning of file record */ +#define TS_ADDR 4 /* continuation of file record */ +#define TS_BITS 3 /* map of inodes on tape */ +#define TS_CLRI 6 /* map of inodes deleted since last dump */ +#define TS_END 5 /* end of volume marker */ +#define TS_EOM 7 /* floppy EOM - restore compat w/ old dump */ + +/* + * flag values + */ +#define DR_NEWHEADER 1 /* new format tape header */ +#define DR_INODEINFO 2 /* header contains starting inode info */ +#define DR_REDUMP 4 /* dump contains recopies of active files */ +#define DR_TRUEINC 8 /* dump is a "true incremental" */ +#define DR_HASMETA 16 /* metadata in this header */ + + + +#define DUMPOUTFMT "%-32s %c %s" /* for printf */ + /* name, incno, ctime(date) */ +#define DUMPINFMT "%258s %c %128[^\n]\n" /* inverse for scanf */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_PROTOCOLS_DUMPRESTORE_H */ diff --git a/usr/src/head/protocols/ripngd.h b/usr/src/head/protocols/ripngd.h new file mode 100644 index 0000000000..a566d597bd --- /dev/null +++ b/usr/src/head/protocols/ripngd.h @@ -0,0 +1,77 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1999 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +/* + * Routing Information Protocol for IPv6 (RIPng) + * as specfied by RFC 2080. + */ + +#ifndef _PROTOCOLS_RIPNGD_H +#define _PROTOCOLS_RIPNGD_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +struct netinfo6 { + struct in6_addr rip6_prefix; /* destination prefix */ + uint16_t rip6_route_tag; /* route tag */ + uint8_t rip6_prefix_length; /* destination prefix length */ + uint8_t rip6_metric; /* cost of route */ +}; + +struct rip6 { + uint8_t rip6_cmd; /* request/response */ + uint8_t rip6_vers; /* protocol version # */ + uint16_t rip6_res1; /* pad to 32-bit boundary */ + struct netinfo6 rip6_nets[1]; /* variable length... */ +}; + +#define RIPVERSION6 1 + +/* + * Packet types. + */ +#define RIPCMD6_REQUEST 1 /* want info - from suppliers */ +#define RIPCMD6_RESPONSE 2 /* responding to request */ + +#define IPPORT_ROUTESERVER6 521 + +#ifdef __cplusplus +} +#endif + +#endif /* _PROTOCOLS_RIPNGD_H */ diff --git a/usr/src/head/protocols/routed.h b/usr/src/head/protocols/routed.h new file mode 100644 index 0000000000..d4ca467878 --- /dev/null +++ b/usr/src/head/protocols/routed.h @@ -0,0 +1,189 @@ +/* + * Copyright 2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Routing Information Protocol + * + * Derived from Xerox NS Routing Information Protocol + * by changing 32-bit net numbers to sockaddr's and + * padding stuff to 32-bit boundaries. + */ + +#ifndef _PROTOCOLS_ROUTED_H +#define _PROTOCOLS_ROUTED_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* The RIPv2 protocol is described in RFC 2453 */ + +#define RIPv1 1 +#define RIPv2 2 +#ifndef RIPVERSION +#define RIPVERSION RIPv1 +#endif + +#define RIP_PORT 520 + +#if RIPVERSION == RIPv1 +struct netinfo { + struct sockaddr rip_dst; /* destination net/host */ + uint32_t rip_metric; /* cost of route */ +}; +#else +struct netinfo { + uint16_t n_family; +#define RIP_AF_INET htons(AF_INET) +#define RIP_AF_UNSPEC 0 +#define RIP_AF_AUTH 0xffff + uint16_t n_tag; /* optional in RIPv2 */ + uint32_t n_dst; /* destination net or host */ +#define RIP_DEFAULT 0 + uint32_t n_mask; /* netmask in RIPv2 */ + uint32_t n_nhop; /* optional next hop in RIPv2 */ + uint32_t n_metric; /* cost of route */ +}; +#endif /* RIPv1 */ + +/* RIPv2 authentication */ +struct netauth { + uint16_t a_family; /* always RIP_AF_AUTH */ + uint16_t a_type; +#define RIP_AUTH_NONE 0 +#define RIP_AUTH_TRAILER htons(1) /* authentication data */ +#define RIP_AUTH_PW htons(2) /* password type */ +#define RIP_AUTH_MD5 htons(3) /* Keyed MD5 */ + union { +#define RIP_AUTH_PW_LEN 16 + uint8_t au_pw[RIP_AUTH_PW_LEN]; + struct a_md5 { + int16_t md5_pkt_len; /* RIP-II packet length */ + int8_t md5_keyid; /* key ID and auth data len */ + int8_t md5_auth_len; /* 16 */ + uint32_t md5_seqno; /* sequence number */ + uint32_t rsvd[2]; /* must be 0 */ +#define RIP_AUTH_MD5_LEN RIP_AUTH_PW_LEN + } a_md5; + } au; +}; + +struct rip { + uint8_t rip_cmd; /* request/response */ + uint8_t rip_vers; /* protocol version # */ + uint16_t rip_res1; /* pad to 32-bit boundary */ + union { /* variable length... */ + struct netinfo ru_nets[1]; /* variable length... */ + char ru_tracefile[1]; /* ditto ... */ + struct netauth ru_auth[1]; + } ripun; +#define rip_nets ripun.ru_nets +#define rip_tracefile ripun.ru_tracefile +#define rip_auths ripun.ru_auth +}; + +struct entryinfo { + struct sockaddr rtu_dst; + struct sockaddr rtu_router; + short rtu_flags; + short rtu_state; + int rtu_timer; + int rtu_metric; + int int_flags; + char int_name[16]; +}; + +/* + * Packet types. + */ +#define RIPCMD_REQUEST 1 /* want info - from suppliers */ +#define RIPCMD_RESPONSE 2 /* responding to request */ +#define RIPCMD_TRACEON 3 /* turn tracing on */ +#define RIPCMD_TRACEOFF 4 /* turn it off */ + +/* + * Gated extended RIP to include a "poll" command instead of using + * RIPCMD_REQUEST with (RIP_AF_UNSPEC, RIP_DEFAULT). RFC 1058 says + * command 5 is used by Sun Microsystems for its own purposes. + */ +#define RIPCMD_POLL 5 /* like request, but anyone answers */ +#define RIPCMD_POLLENTRY 6 /* like poll, but for entire entry */ + +#define RIPCMD_MAX 7 + +#define HOPCNT_INFINITY 16 /* per Xerox NS */ +#define MAXPACKETSIZE 512 /* max broadcast size */ +#define NETS_LEN ((MAXPACKETSIZE - sizeof (struct rip)) \ + / sizeof (struct netinfo) +1) + +#define INADDR_RIP_GROUP 0xe0000009U /* 224.0.0.9 */ + +/* + * Timer values used in managing the routing table. + * + * Complete tables are broadcast every SUPPLY_INTERVAL seconds. + * If changes occur between updates, dynamic updates containing only changes + * may be sent. When these are sent, a timer is set for a random value + * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates + * are sent until the timer expires. + * + * Every update of a routing entry forces an entry's timer to be reset. + * After EXPIRE_TIME without updates, the entry is marked invalid, + * but held onto until GARBAGE_TIME so that others may see it, to + * "poison" the bad route. + */ +#define TIMER_RATE 30 /* alarm clocks every 30 seconds */ + +#define SUPPLY_INTERVAL 30 /* time to supply tables */ +#define MIN_WAITTIME 2 /* min sec until next flash updates */ +#define MAX_WAITTIME 5 /* max sec until flash update */ + +#define STALE_TIME 90 /* switch to a new gateway */ +#define EXPIRE_TIME 180 /* time to mark entry invalid */ +#define GARBAGE_TIME 300 /* time to garbage collect */ + +#ifdef __cplusplus +} +#endif + +#endif /* _PROTOCOLS_ROUTED_H */ diff --git a/usr/src/head/protocols/rwhod.h b/usr/src/head/protocols/rwhod.h new file mode 100644 index 0000000000..72e012d737 --- /dev/null +++ b/usr/src/head/protocols/rwhod.h @@ -0,0 +1,76 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1989 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +/* + * rwho protocol packet format. + */ + +#ifndef _PROTOCOLS_RWHOD_H +#define _PROTOCOLS_RWHOD_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +struct outmp { + char out_line[8]; /* tty name */ + char out_name[8]; /* user id */ + long out_time; /* time on */ +}; + +struct whod { + char wd_vers; /* protocol version # */ + char wd_type; /* packet type, see below */ + char wd_pad[2]; + int wd_sendtime; /* time stamp by sender */ + int wd_recvtime; /* time stamp applied by receiver */ + char wd_hostname[32]; /* hosts's name */ + int wd_loadav[3]; /* load average as in uptime */ + int wd_boottime; /* time system booted */ + struct whoent { + struct outmp we_utmp; /* active tty info */ + int we_idle; /* tty idle time */ + } wd_we[1024 / sizeof (struct whoent)]; +}; + +#define WHODVERSION 1 +#define WHODTYPE_STATUS 1 /* host status */ + +#ifdef __cplusplus +} +#endif + +#endif /* _PROTOCOLS_RWHOD_H */ diff --git a/usr/src/head/protocols/timed.h b/usr/src/head/protocols/timed.h new file mode 100644 index 0000000000..1a67941021 --- /dev/null +++ b/usr/src/head/protocols/timed.h @@ -0,0 +1,99 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1998 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +/* + * Time Synchronization Protocol + */ + +#ifndef _PROTOCOLS_TIMED_H +#define _PROTOCOLS_TIMED_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define TSPVERSION 1 +#define ANYADDR NULL + +struct tsp { + uchar_t tsp_type; + uchar_t tsp_vers; + short tsp_seq; + struct timeval tsp_time; + char tsp_name[MAXHOSTNAMELEN]; +}; + +/* + * Command types. + */ +#define TSP_ANY 0 /* match any types */ +#define TSP_ADJTIME 1 /* send adjtime */ +#define TSP_ACK 2 /* generic acknowledgement */ +#define TSP_MASTERREQ 3 /* ask for master's name */ +#define TSP_MASTERACK 4 /* acknowledge master request */ +#define TSP_SETTIME 5 /* send network time */ +#define TSP_MASTERUP 6 /* inform slaves that master is up */ +#define TSP_SLAVEUP 7 /* slave is up but not polled */ +#define TSP_ELECTION 8 /* advance candidature for master */ +#define TSP_ACCEPT 9 /* support candidature of master */ +#define TSP_REFUSE 10 /* reject candidature of master */ +#define TSP_CONFLICT 11 /* two or more masters present */ +#define TSP_RESOLVE 12 /* masters' conflict resolution */ +#define TSP_QUIT 13 /* reject candidature if master is up */ +#define TSP_DATE 14 /* reset the time (date command) */ +#define TSP_DATEREQ 15 /* remote request to reset the time */ +#define TSP_DATEACK 16 /* acknowledge time setting */ +#define TSP_TRACEON 17 /* turn tracing on */ +#define TSP_TRACEOFF 18 /* turn tracing off */ +#define TSP_MSITE 19 /* find out master's site */ +#define TSP_MSITEREQ 20 /* remote master's site request */ +#define TSP_TEST 21 /* for testing election algo */ + +#define TSPTYPENUMBER 22 + +#ifdef TSPTYPES +char *tsptype[TSPTYPENUMBER] = + {"ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", + "MASTERUP", "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", + "RESOLVE", "QUIT", "DATE", "DATEREQ", "DATEACK", "TRACEON", + "TRACEOFF", "MSITE", "MSITEREQ", "TEST"}; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _PROTOCOLS_TIMED_H */ diff --git a/usr/src/head/pthread.h b/usr/src/head/pthread.h new file mode 100644 index 0000000000..44ff4e6b4c --- /dev/null +++ b/usr/src/head/pthread.h @@ -0,0 +1,451 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _PTHREAD_H +#define _PTHREAD_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#ifndef _ASM +#include <sys/types.h> +#include <time.h> +#include <sched.h> +#endif /* _ASM */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Thread related attribute values defined as in thread.h. + * These are defined as bit pattern in thread.h. + * Any change here should be reflected in thread.h. + */ +/* detach */ +#define PTHREAD_CREATE_DETACHED 0x40 /* = THR_DETACHED */ +#define PTHREAD_CREATE_JOINABLE 0 +/* scope */ +#define PTHREAD_SCOPE_SYSTEM 0x01 /* = THR_BOUND */ +#define PTHREAD_SCOPE_PROCESS 0 + +/* + * Other attributes which are not defined in thread.h + */ +/* inherit */ +#define PTHREAD_INHERIT_SCHED 1 +#define PTHREAD_EXPLICIT_SCHED 0 + +/* + * Value of process-shared attribute + * These are defined as values defined in sys/synch.h + * Any change here should be reflected in sys/synch.h. + */ +#define PTHREAD_PROCESS_SHARED 1 /* = USYNC_PROCESS */ +#define PTHREAD_PROCESS_PRIVATE 0 /* = USYNC_THREAD */ + +#define _DEFAULT_TYPE PTHREAD_PROCESS_PRIVATE +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +#define DEFAULT_TYPE _DEFAULT_TYPE +#endif + +/* + * mutex types + * keep these in synch which sys/synch.h lock flags + */ +#define PTHREAD_MUTEX_NORMAL 0x0 +#define PTHREAD_MUTEX_ERRORCHECK 0x2 +#define PTHREAD_MUTEX_RECURSIVE 0x4 +#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL + +/* + * Mutex protocol values. Keep these in synch with sys/synch.h lock types. + */ +#define PTHREAD_PRIO_NONE 0x0 +#define PTHREAD_PRIO_INHERIT 0x10 +#define PTHREAD_PRIO_PROTECT 0x20 + +/* + * Mutex robustness attribute values. The robustness attribute is a + * Solaris specific extension to support robust mutexes. Note the _NP suffix + * to indicate these are not part of the current POSIX spec (POSIX 1003.1 1996), + * but are platform specific non-portable extensions. Keep these in synch + * with sys/synch.h lock types. + */ +#define PTHREAD_MUTEX_STALL_NP 0x0 +#define PTHREAD_MUTEX_ROBUST_NP 0x40 + +/* + * macros - default initializers defined as in synch.h + * Any change here should be reflected in synch.h. + * + * NOTE: + * Make sure that any change in the macros is consistent with the definition + * of the corresponding types in sys/types.h (e.g. PTHREAD_MUTEX_INITIALIZER + * should be consistent with the definition for pthread_mutex_t). + */ +#define PTHREAD_MUTEX_INITIALIZER /* = DEFAULTMUTEX */ \ + {{0, 0, 0, _DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0} + +#define PTHREAD_COND_INITIALIZER /* = DEFAULTCV */ \ + {{{0, 0, 0, 0}, _DEFAULT_TYPE, _COND_MAGIC}, 0} + +#define PTHREAD_RWLOCK_INITIALIZER /* = DEFAULTRWLOCK */ \ + {0, _DEFAULT_TYPE, _RWL_MAGIC, PTHREAD_MUTEX_INITIALIZER, \ + PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER} + +/* cancellation type and state */ +#define PTHREAD_CANCEL_ENABLE 0x00 +#define PTHREAD_CANCEL_DISABLE 0x01 +#define PTHREAD_CANCEL_DEFERRED 0x00 +#define PTHREAD_CANCEL_ASYNCHRONOUS 0x02 +#define PTHREAD_CANCELED (void *)-19 + +/* pthread_once related values */ +#define PTHREAD_ONCE_NOTDONE 0 +#define PTHREAD_ONCE_DONE 1 +#define PTHREAD_ONCE_INIT {0, 0, 0, PTHREAD_ONCE_NOTDONE} + +/* barriers */ +#define PTHREAD_BARRIER_SERIAL_THREAD -2 + +#ifndef _ASM + +/* + * cancellation cleanup structure + */ +typedef struct _cleanup { + uintptr_t pthread_cleanup_pad[4]; +} _cleanup_t; + +#ifdef __STDC__ + +void __pthread_cleanup_push(void (*)(void *), void *, caddr_t, _cleanup_t *); +void __pthread_cleanup_pop(int, _cleanup_t *); +caddr_t _getfp(void); + +#else /* __STDC__ */ + +void __pthread_cleanup_push(); +void __pthread_cleanup_pop(); +caddr_t _getfp(); + +#endif /* __STDC__ */ + +#if __cplusplus +extern "C" { +#endif + +typedef void (*_Voidfp)(void*); /* pointer to extern "C" function */ + +#if __cplusplus +} /* extern "C" */ +#endif + +#define pthread_cleanup_push(routine, args) { \ + _cleanup_t _cleanup_info; \ + __pthread_cleanup_push((_Voidfp)(routine), (void *)(args), \ + (caddr_t)_getfp(), &_cleanup_info); + +#define pthread_cleanup_pop(ex) \ + __pthread_cleanup_pop(ex, &_cleanup_info); \ +} + +#ifdef __STDC__ + +/* + * function prototypes - thread related calls + */ + +/* + * pthread_atfork() is also declared in <unistd.h> as per SUSv2. The + * declarations are identical. A change to either one may also require + * appropriate namespace updates in order to avoid redeclaration + * warnings in the case where both prototypes are exposed via inclusion + * of both <pthread.h> and <unistd.h>. + */ +extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void)); +extern int pthread_attr_init(pthread_attr_t *); +extern int pthread_attr_destroy(pthread_attr_t *); +extern int pthread_attr_setstack(pthread_attr_t *, void *, size_t); +extern int pthread_attr_getstack(const pthread_attr_t *_RESTRICT_KYWD, + void **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD); +extern int pthread_attr_setstacksize(pthread_attr_t *, size_t); +extern int pthread_attr_getstacksize(const pthread_attr_t *_RESTRICT_KYWD, + size_t *_RESTRICT_KYWD); +extern int pthread_attr_setstackaddr(pthread_attr_t *, void *); +extern int pthread_attr_getstackaddr(const pthread_attr_t *_RESTRICT_KYWD, + void **_RESTRICT_KYWD); +extern int pthread_attr_setdetachstate(pthread_attr_t *, int); +extern int pthread_attr_getdetachstate(const pthread_attr_t *, int *); +extern int pthread_attr_setscope(pthread_attr_t *, int); +extern int pthread_attr_getscope(const pthread_attr_t *_RESTRICT_KYWD, + int *_RESTRICT_KYWD); +extern int pthread_attr_setinheritsched(pthread_attr_t *, int); +extern int pthread_attr_getinheritsched(const pthread_attr_t *_RESTRICT_KYWD, + int *_RESTRICT_KYWD); +extern int pthread_attr_setschedpolicy(pthread_attr_t *, int); +extern int pthread_attr_getschedpolicy(const pthread_attr_t *_RESTRICT_KYWD, + int *_RESTRICT_KYWD); +extern int pthread_attr_setschedparam(pthread_attr_t *_RESTRICT_KYWD, + const struct sched_param *_RESTRICT_KYWD); +extern int pthread_attr_getschedparam(const pthread_attr_t *_RESTRICT_KYWD, + struct sched_param *_RESTRICT_KYWD); +extern int pthread_create(pthread_t *_RESTRICT_KYWD, + const pthread_attr_t *_RESTRICT_KYWD, void * (*)(void *), + void *_RESTRICT_KYWD); +extern int pthread_once(pthread_once_t *, void (*)(void)); +extern int pthread_join(pthread_t, void **); +extern int pthread_detach(pthread_t); +extern void pthread_exit(void *) __NORETURN; +extern int pthread_cancel(pthread_t); +extern int pthread_setschedparam(pthread_t, int, const struct sched_param *); +extern int pthread_getschedparam(pthread_t, int *_RESTRICT_KYWD, + struct sched_param *_RESTRICT_KYWD); +extern int pthread_setschedprio(pthread_t, int); +extern int pthread_setcancelstate(int, int *); +extern int pthread_setcanceltype(int, int *); +extern void pthread_testcancel(void); +extern int pthread_equal(pthread_t, pthread_t); +extern int pthread_key_create(pthread_key_t *, void (*)(void *)); +extern int pthread_key_delete(pthread_key_t); +extern int pthread_setspecific(pthread_key_t, const void *); +extern void *pthread_getspecific(pthread_key_t); +extern pthread_t pthread_self(void); + +/* + * function prototypes - synchronization related calls + */ +extern int pthread_mutexattr_init(pthread_mutexattr_t *); +extern int pthread_mutexattr_destroy(pthread_mutexattr_t *); +extern int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); +extern int pthread_mutexattr_getpshared( + const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); +extern int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); +extern int pthread_mutexattr_getprotocol( + const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); +extern int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); +extern int pthread_mutexattr_getprioceiling( + const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); +extern int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *, int); +extern int pthread_mutexattr_getrobust_np( + const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); +extern int pthread_mutex_init(pthread_mutex_t *_RESTRICT_KYWD, + const pthread_mutexattr_t *_RESTRICT_KYWD); +extern int pthread_mutex_consistent_np(pthread_mutex_t *); +extern int pthread_mutex_destroy(pthread_mutex_t *); +extern int pthread_mutex_lock(pthread_mutex_t *); +extern int pthread_mutex_timedlock(pthread_mutex_t *_RESTRICT_KYWD, + const struct timespec *_RESTRICT_KYWD); +extern int pthread_mutex_reltimedlock_np(pthread_mutex_t *_RESTRICT_KYWD, + const struct timespec *_RESTRICT_KYWD); +extern int pthread_mutex_unlock(pthread_mutex_t *); +extern int pthread_mutex_trylock(pthread_mutex_t *); +extern int pthread_mutex_setprioceiling(pthread_mutex_t *_RESTRICT_KYWD, + int, int *_RESTRICT_KYWD); +extern int pthread_mutex_getprioceiling(const pthread_mutex_t *_RESTRICT_KYWD, + int *_RESTRICT_KYWD); +extern int pthread_condattr_init(pthread_condattr_t *); +extern int pthread_condattr_destroy(pthread_condattr_t *); +extern int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); +extern int pthread_condattr_getclock(const pthread_condattr_t *_RESTRICT_KYWD, + clockid_t *_RESTRICT_KYWD); +extern int pthread_condattr_setpshared(pthread_condattr_t *, int); +extern int pthread_condattr_getpshared(const pthread_condattr_t *_RESTRICT_KYWD, + int *_RESTRICT_KYWD); +extern int pthread_cond_init(pthread_cond_t *_RESTRICT_KYWD, + const pthread_condattr_t *_RESTRICT_KYWD); +extern int pthread_cond_destroy(pthread_cond_t *); +extern int pthread_cond_broadcast(pthread_cond_t *); +extern int pthread_cond_signal(pthread_cond_t *); +extern int pthread_cond_wait(pthread_cond_t *_RESTRICT_KYWD, + pthread_mutex_t *_RESTRICT_KYWD); +extern int pthread_cond_timedwait(pthread_cond_t *_RESTRICT_KYWD, + pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD); +extern int pthread_cond_reltimedwait_np(pthread_cond_t *_RESTRICT_KYWD, + pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD); +extern int pthread_attr_getguardsize(const pthread_attr_t *_RESTRICT_KYWD, + size_t *_RESTRICT_KYWD); +extern int pthread_attr_setguardsize(pthread_attr_t *, size_t); +extern int pthread_getconcurrency(void); +extern int pthread_setconcurrency(int); +extern int pthread_mutexattr_settype(pthread_mutexattr_t *, int); +extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *_RESTRICT_KYWD, + int *_RESTRICT_KYWD); +extern int pthread_rwlock_init(pthread_rwlock_t *_RESTRICT_KYWD, + const pthread_rwlockattr_t *_RESTRICT_KYWD); +extern int pthread_rwlock_destroy(pthread_rwlock_t *); +extern int pthread_rwlock_rdlock(pthread_rwlock_t *); +extern int pthread_rwlock_timedrdlock(pthread_rwlock_t *_RESTRICT_KYWD, + const struct timespec *_RESTRICT_KYWD); +extern int pthread_rwlock_reltimedrdlock_np(pthread_rwlock_t *_RESTRICT_KYWD, + const struct timespec *_RESTRICT_KYWD); +extern int pthread_rwlock_tryrdlock(pthread_rwlock_t *); +extern int pthread_rwlock_wrlock(pthread_rwlock_t *); +extern int pthread_rwlock_timedwrlock(pthread_rwlock_t *_RESTRICT_KYWD, + const struct timespec *_RESTRICT_KYWD); +extern int pthread_rwlock_reltimedwrlock_np(pthread_rwlock_t *_RESTRICT_KYWD, + const struct timespec *_RESTRICT_KYWD); +extern int pthread_rwlock_trywrlock(pthread_rwlock_t *); +extern int pthread_rwlock_unlock(pthread_rwlock_t *); +extern int pthread_rwlockattr_init(pthread_rwlockattr_t *); +extern int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); +extern int pthread_rwlockattr_getpshared( + const pthread_rwlockattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); +extern int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); +extern int pthread_spin_init(pthread_spinlock_t *, int); +extern int pthread_spin_destroy(pthread_spinlock_t *); +extern int pthread_spin_lock(pthread_spinlock_t *); +extern int pthread_spin_trylock(pthread_spinlock_t *); +extern int pthread_spin_unlock(pthread_spinlock_t *); +extern int pthread_barrierattr_init(pthread_barrierattr_t *); +extern int pthread_barrierattr_destroy(pthread_barrierattr_t *); +extern int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); +extern int pthread_barrierattr_getpshared( + const pthread_barrierattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); +extern int pthread_barrier_init(pthread_barrier_t *_RESTRICT_KYWD, + const pthread_barrierattr_t *_RESTRICT_KYWD, uint_t); +extern int pthread_barrier_destroy(pthread_barrier_t *); +extern int pthread_barrier_wait(pthread_barrier_t *); + +#else /* __STDC__ */ + +/* + * function prototypes - thread related calls + */ +extern int pthread_atfork(); +extern int pthread_attr_init(); +extern int pthread_attr_destroy(); +extern int pthread_attr_setstack(); +extern int pthread_attr_getstack(); +extern int pthread_attr_setstacksize(); +extern int pthread_attr_getstacksize(); +extern int pthread_attr_setstackaddr(); +extern int pthread_attr_getstackaddr(); +extern int pthread_attr_setdetachstate(); +extern int pthread_attr_getdetachstate(); +extern int pthread_attr_setscope(); +extern int pthread_attr_getscope(); +extern int pthread_attr_setinheritsched(); +extern int pthread_attr_getinheritsched(); +extern int pthread_attr_setschedpolicy(); +extern int pthread_attr_getschedpolicy(); +extern int pthread_attr_setschedparam(); +extern int pthread_attr_getschedparam(); +extern int pthread_create(); +extern int pthread_once(); +extern int pthread_join(); +extern int pthread_detach(); +extern void pthread_exit(); +extern int pthread_cancel(); +extern int pthread_setschedparam(); +extern int pthread_getschedparam(); +extern int pthread_setschedprio(); +extern int pthread_setcancelstate(); +extern int pthread_setcanceltype(); +extern void pthread_testcancel(); +extern int pthread_equal(); +extern int pthread_key_create(); +extern int pthread_key_delete(); +extern int pthread_setspecific(); +extern void *pthread_getspecific(); +extern pthread_t pthread_self(); +/* + * function prototypes - synchronization related calls + */ +extern int pthread_mutexattr_init(); +extern int pthread_mutexattr_destroy(); +extern int pthread_mutexattr_setpshared(); +extern int pthread_mutexattr_getpshared(); +extern int pthread_mutexattr_setprotocol(); +extern int pthread_mutexattr_getprotocol(); +extern int pthread_mutexattr_setprioceiling(); +extern int pthread_mutexattr_getprioceiling(); +extern int pthread_mutexattr_setrobust_np(); +extern int pthread_mutexattr_getrobust_np(); +extern int pthread_mutex_init(); +extern int pthread_mutex_consistent_np(); +extern int pthread_mutex_destroy(); +extern int pthread_mutex_lock(); +extern int pthread_mutex_timedlock(); +extern int pthread_mutex_reltimedlock_np(); +extern int pthread_mutex_unlock(); +extern int pthread_mutex_trylock(); +extern int pthread_mutex_setprioceiling(); +extern int pthread_mutex_getprioceiling(); +extern int pthread_condattr_init(); +extern int pthread_condattr_destroy(); +extern int pthread_condattr_setclock(); +extern int pthread_condattr_getclock(); +extern int pthread_condattr_setpshared(); +extern int pthread_condattr_getpshared(); +extern int pthread_cond_init(); +extern int pthread_cond_destroy(); +extern int pthread_cond_broadcast(); +extern int pthread_cond_signal(); +extern int pthread_cond_wait(); +extern int pthread_cond_timedwait(); +extern int pthread_cond_reltimedwait_np(); +extern int pthread_attr_getguardsize(); +extern int pthread_attr_setguardsize(); +extern int pthread_getconcurrency(); +extern int pthread_setconcurrency(); +extern int pthread_mutexattr_settype(); +extern int pthread_mutexattr_gettype(); +extern int pthread_rwlock_init(); +extern int pthread_rwlock_destroy(); +extern int pthread_rwlock_rdlock(); +extern int pthread_rwlock_tryrdlock(); +extern int pthread_rwlock_wrlock(); +extern int pthread_rwlock_trywrlock(); +extern int pthread_rwlock_unlock(); +extern int pthread_rwlockattr_init(); +extern int pthread_rwlockattr_destroy(); +extern int pthread_rwlockattr_getpshared(); +extern int pthread_rwlockattr_setpshared(); +extern int pthread_spin_init(); +extern int pthread_spin_destroy(); +extern int pthread_spin_lock(); +extern int pthread_spin_trylock(); +extern int pthread_spin_unlock(); +extern int pthread_barrierattr_init(); +extern int pthread_barrierattr_destroy(); +extern int pthread_barrierattr_setpshared(); +extern int pthread_barrierattr_getpshared(); +extern int pthread_barrier_init(); +extern int pthread_barrier_destroy(); +extern int pthread_barrier_wait(); + +#endif /* __STDC__ */ + +#endif /* _ASM */ + +#ifdef __cplusplus +} +#endif + +#endif /* _PTHREAD_H */ diff --git a/usr/src/head/pw.h b/usr/src/head/pw.h new file mode 100644 index 0000000000..4b6c9de8d4 --- /dev/null +++ b/usr/src/head/pw.h @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _PW_H +#define _PW_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) + +extern char *logname(void); +extern char *regcmp(const char *, ...); +extern char *regex(const char *, const char *, ...); +#else +extern char *logname(); +extern char *regcmp(); +extern char *regex(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _PW_H */ diff --git a/usr/src/head/pwd.h b/usr/src/head/pwd.h new file mode 100644 index 0000000000..47dc2f136b --- /dev/null +++ b/usr/src/head/pwd.h @@ -0,0 +1,256 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _PWD_H +#define _PWD_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3.1.9 */ + +#include <sys/feature_tests.h> + +#include <sys/types.h> + +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +#include <stdio.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct passwd { + char *pw_name; + char *pw_passwd; + uid_t pw_uid; + gid_t pw_gid; + char *pw_age; + char *pw_comment; + char *pw_gecos; + char *pw_dir; + char *pw_shell; +}; + +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +struct comment { + char *c_dept; + char *c_name; + char *c_acct; + char *c_bin; +}; +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ + +#if defined(__STDC__) + +extern struct passwd *getpwuid(uid_t); /* MT-unsafe */ +extern struct passwd *getpwnam(const char *); /* MT-unsafe */ + +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern struct passwd *getpwent_r(struct passwd *, char *, int); +extern struct passwd *fgetpwent_r(FILE *, struct passwd *, char *, int); +extern struct passwd *fgetpwent(FILE *); /* MT-unsafe */ +extern int putpwent(const struct passwd *, FILE *); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ + +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ + defined(__EXTENSIONS__) +extern void endpwent(void); +extern struct passwd *getpwent(void); /* MT-unsafe */ +extern void setpwent(void); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */ + +#else /* (__STDC__) */ + +extern struct passwd *getpwuid(); /* MT-unsafe */ +extern struct passwd *getpwnam(); /* MT-unsafe */ + +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern struct passwd *getpwent_r(); +extern struct passwd *fgetpwent_r(); + +extern struct passwd *fgetpwent(); /* MT-unsafe */ +extern int putpwent(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ + +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ + defined(__EXTENSIONS__) +extern void endpwent(); +extern struct passwd *getpwent(); /* MT-unsafe */ +extern void setpwent(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */ + +#endif /* (__STDC__) */ + +/* + * getpwuid_r() & getpwnam_r() prototypes are defined here. + */ + +/* + * Previous releases of Solaris, starting at 2.3, provided definitions of + * various functions as specified in POSIX.1c, Draft 6. For some of these + * functions, the final POSIX 1003.1c standard had a different number of + * arguments and return values. + * + * The following segment of this header provides support for the standard + * interfaces while supporting applications written under earlier + * releases. The application defines appropriate values of the feature + * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate + * whether it was written to expect the Draft 6 or standard versions of + * these interfaces, before including this header. This header then + * provides a mapping from the source version of the interface to an + * appropriate binary interface. Such mappings permit an application + * to be built from libraries and objects which have mixed expectations + * of the definitions of these functions. + * + * For applications using the Draft 6 definitions, the binary symbol is the + * same as the source symbol, and no explicit mapping is needed. For the + * standard interface, the function func() is mapped to the binary symbol + * _posix_func(). The preferred mechanism for the remapping is a compiler + * #pragma. If the compiler does not provide such a #pragma, the header file + * defines a static function func() which calls the _posix_func() version; + * this has to be done instead of #define since POSIX specifies that an + * application can #undef the symbol and still be bound to the correct + * implementation. Unfortunately, the statics confuse lint so we fallback to + * #define in that case. + * + * NOTE: Support for the Draft 6 definitions is provided for compatibility + * only. New applications/libraries should use the standard definitions. + */ + +#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L) || \ + defined(_POSIX_PTHREAD_SEMANTICS) || defined(__EXTENSIONS__) + +#if defined(__STDC__) + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname getpwuid_r __posix_getpwuid_r +#pragma redefine_extname getpwnam_r __posix_getpwnam_r +extern int getpwuid_r(uid_t, struct passwd *, char *, int, struct passwd **); +extern int getpwnam_r(const char *, struct passwd *, char *, + int, struct passwd **); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern int __posix_getpwuid_r(uid_t, struct passwd *, char *, size_t, + struct passwd **); +extern int __posix_getpwnam_r(const char *, struct passwd *, char *, + size_t, struct passwd **); + +#ifdef __lint + +#define getpwuid_r __posix_getpwuid_r +#define getpwnam_r __posix_getpwnam_r + +#else /* !__lint */ + +static int +getpwuid_r(uid_t __uid, struct passwd *__pwd, char *__buf, int __len, + struct passwd **__res) +{ + return (__posix_getpwuid_r(__uid, __pwd, __buf, __len, __res)); +} +static int +getpwnam_r(const char *__cb, struct passwd *__pwd, char *__buf, int __len, + struct passwd **__res) +{ + return (__posix_getpwnam_r(__cb, __pwd, __buf, __len, __res)); +} + +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern struct passwd *getpwuid_r(uid_t, struct passwd *, char *, int); +extern struct passwd *getpwnam_r(const char *, struct passwd *, char *, int); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +#else /* __STDC__ */ + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname getpwuid_r __posix_getpwuid_r +#pragma redefine_extname getpwnam_r __posix_getpwnam_r +extern int getpwuid_r(); +extern int getpwnam_r(); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern int __posix_getpwuid_r(); +extern int __posix_getpwnam_r(); + +#ifdef __lint + +#define getpwuid_r __posix_getpwuid_r +#define getpwnam_r __posix_getpwnam_r + +#else /* !__lint */ + +static int +getpwuid_r(__uid, __pwd, __buf, __len, __res) + uid_t __uid; + struct passwd *__pwd; + char *__buf; + int __len; + struct passwd **__res; +{ + return (__posix_getpwuid_r(__uid, __pwd, __buf, __len, __res)); +} +static int +getpwnam_r(__cb, __pwd, __buf, __len, __res) + char *__cb; + struct passwd *__pwd; + char *__buf; + int __len; + struct passwd **__res; +{ + return (__posix_getpwnam_r(__cb, __pwd, __buf, __len, __res)); +} + +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern struct passwd *getpwuid_r(); +extern struct passwd *getpwnam_r(); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +#endif /* __STDC__ */ + +#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L)... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _PWD_H */ diff --git a/usr/src/head/rctl.h b/usr/src/head/rctl.h new file mode 100644 index 0000000000..6bc8b9e9be --- /dev/null +++ b/usr/src/head/rctl.h @@ -0,0 +1,63 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _RCTL_H +#define _RCTL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/rctl.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +int rctl_walk(int (*)(const char *, void *), void *); + +hrtime_t rctlblk_get_firing_time(rctlblk_t *); +uint_t rctlblk_get_global_action(rctlblk_t *); +uint_t rctlblk_get_global_flags(rctlblk_t *); +uint_t rctlblk_get_local_action(rctlblk_t *, int *); +uint_t rctlblk_get_local_flags(rctlblk_t *); +id_t rctlblk_get_recipient_pid(rctlblk_t *); +rctl_priv_t rctlblk_get_privilege(rctlblk_t *); +rctl_qty_t rctlblk_get_value(rctlblk_t *); +rctl_qty_t rctlblk_get_enforced_value(rctlblk_t *); + +void rctlblk_set_local_action(rctlblk_t *, uint_t, int); +void rctlblk_set_local_flags(rctlblk_t *, uint_t); +void rctlblk_set_recipient_pid(rctlblk_t *, id_t); +void rctlblk_set_privilege(rctlblk_t *, rctl_priv_t); +void rctlblk_set_value(rctlblk_t *, rctl_qty_t); + +size_t rctlblk_size(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _RCTL_H */ diff --git a/usr/src/head/re_comp.h b/usr/src/head/re_comp.h new file mode 100644 index 0000000000..9fecbfbb7c --- /dev/null +++ b/usr/src/head/re_comp.h @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1995, 2000 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _RE_COMP_H +#define _RE_COMP_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) + +extern char *re_comp(const char *); +extern int re_exec(const char *); + +#else + +extern char *re_comp(); +extern int re_exec(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _RE_COMP_H */ diff --git a/usr/src/head/regex.h b/usr/src/head/regex.h new file mode 100644 index 0000000000..6c20c3a802 --- /dev/null +++ b/usr/src/head/regex.h @@ -0,0 +1,170 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright 1989, 1994 by Mortice Kern Systems Inc. + * All rights reserved. + */ + +#ifndef _REGEX_H +#define _REGEX_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * wchar_t is a built-in type in standard C++ and as such is not + * defined here when using standard C++. However, the GNU compiler + * fixincludes utility nonetheless creates it's own version of this + * header for use by gcc and g++. In that version it adds a redundant + * guard for __cplusplus. To avoid the creation of a gcc/g++ specific + * header we need to include the following magic comment: + * + * we must use the C++ compiler's type + * + * The above comment should not be removed or changed until GNU + * gcc/fixinc/inclhack.def is updated to bypass this header. + */ +#if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__)) +#ifndef _WCHAR_T +#define _WCHAR_T +#if defined(_LP64) +typedef int wchar_t; +#else +typedef long wchar_t; +#endif +#endif /* !_WCHAR_T */ +#endif /* !defined(__cplusplus) ... */ + +typedef ssize_t regoff_t; + +/* regcomp flags */ +#define REG_EXTENDED 0x01 /* Use Extended Regular Expressions */ +#define REG_NEWLINE 0x08 /* Treat \n as regular character */ +#define REG_ICASE 0x04 /* Ignore case in match */ +#define REG_NOSUB 0x02 /* Don't set subexpression */ +#define REG_EGREP 0x1000 /* running as egrep(1) */ + +/* non-standard flags */ +#define REG_DELIM 0x10 /* string[0] is delimiter */ +#define REG_DEBUG 0x20 /* Debug recomp and regexec */ +#define REG_ANCHOR 0x40 /* Implicit ^ and $ */ +#define REG_WORDS 0x80 /* \< and \> match word boundries */ + +/* internal flags */ +#define REG_MUST 0x100 /* check for regmust substring */ + +/* regexec flags */ +#define REG_NOTBOL 0x200 /* string is not BOL */ +#define REG_NOTEOL 0x400 /* string has no EOL */ +#define REG_NOOPT 0x800 /* don't do regmust optimization */ + +/* regcomp and regexec return codes */ +#define REG_OK 0 /* success (non-standard) */ +#define REG_NOMATCH 1 /* regexec failed to match */ +#define REG_ECOLLATE 2 /* invalid collation element ref. */ +#define REG_EESCAPE 3 /* trailing \ in pattern */ +#define REG_ENEWLINE 4 /* \n found before end of pattern */ +#define REG_ENSUB 5 /* more than 9 \( \) pairs (OBS) */ +#define REG_ESUBREG 6 /* number in \[0-9] invalid */ +#define REG_EBRACK 7 /* [ ] imbalance */ +#define REG_EPAREN 8 /* ( ) imbalance */ +#define REG_EBRACE 9 /* \{ \} imbalance */ +#define REG_ERANGE 10 /* invalid endpoint in range */ +#define REG_ESPACE 11 /* no memory for compiled pattern */ +#define REG_BADRPT 12 /* invalid repetition */ +#define REG_ECTYPE 13 /* invalid char-class type */ +#define REG_BADPAT 14 /* syntax error */ +#define REG_BADBR 15 /* \{ \} contents bad */ +#define REG_EFATAL 16 /* internal error, not POSIX.2 */ +#define REG_ECHAR 17 /* invalid mulitbyte character */ +#define REG_STACK 18 /* backtrack stack overflow */ +#define REG_ENOSYS 19 /* function not supported (XPG4) */ +#define REG__LAST 20 /* first unused code */ +#define REG_EBOL 21 /* ^ anchor and not BOL */ +#define REG_EEOL 22 /* $ anchor and not EOL */ +#define _REG_BACKREF_MAX 9 /* Max # of subexp. backreference */ + +typedef struct { /* regcomp() data saved for regexec() */ + size_t re_nsub; /* # of subexpressions in RE pattern */ + + /* + * Internal use only + */ + void *re_comp; /* compiled RE; freed by regfree() */ + int re_cflags; /* saved cflags for regexec() */ + size_t re_erroff; /* RE pattern error offset */ + size_t re_len; /* # wchar_t chars in compiled pattern */ + struct _regex_ext_t *re_sc; /* for binary compatibility */ +} regex_t; + +/* subexpression positions */ +typedef struct { +#ifdef __STDC__ + const char *rm_sp, *rm_ep; /* Start pointer, end pointer */ +#else + char *rm_sp, *rm_ep; /* Start pointer, end pointer */ +#endif + regoff_t rm_so, rm_eo; /* Start offset, end offset */ + int rm_ss, rm_es; /* Used internally */ +} regmatch_t; + + +/* + * Additional API and structs to support regular expression manipulations + * on wide characters. + */ + +#if defined(__STDC__) + +extern int regcomp(regex_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, int); +extern int regexec(const regex_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, + size_t, regmatch_t *_RESTRICT_KYWD, int); +extern size_t regerror(int, const regex_t *_RESTRICT_KYWD, + char *_RESTRICT_KYWD, size_t); +extern void regfree(regex_t *); + +#else /* defined(__STDC__) */ + +extern int regcomp(); +extern int regexec(); +extern size_t regerror(); +extern void regfree(); + +#endif /* defined(__STDC__) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _REGEX_H */ diff --git a/usr/src/head/regexp.h b/usr/src/head/regexp.h new file mode 100644 index 0000000000..05f6012f59 --- /dev/null +++ b/usr/src/head/regexp.h @@ -0,0 +1,592 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 1997-2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _REGEXP_H +#define _REGEXP_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */ + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define CBRA 2 +#define CCHR 4 +#define CDOT 8 +#define CCL 12 +#define CXCL 16 +#define CDOL 20 +#define CCEOF 22 +#define CKET 24 +#define CBACK 36 +#define NCCL 40 + +#define STAR 01 +#define RNGE 03 + +#define NBRA 9 + +#define PLACE(c) ep[c >> 3] |= bittab[c & 07] +#define ISTHERE(c) (ep[c >> 3] & bittab[c & 07]) +#define ecmp(s1, s2, n) (strncmp(s1, s2, n) == 0) + +static char *braslist[NBRA]; +static char *braelist[NBRA]; +int sed, nbra; +char *loc1, *loc2, *locs; +static int nodelim; + +int circf; +static int low; +static int size; + +static unsigned char bittab[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; + +#ifdef __STDC__ +int advance(const char *lp, const char *ep); +static void getrnge(const char *str); +#else +int advance(); +static void getrnge(); +#endif + +char * +#ifdef __STDC__ +compile(char *instring, char *ep, const char *endbuf, int seof) +#else +compile(instring, ep, endbuf, seof) +register char *ep; +char *instring, *endbuf; +int seof; +#endif +{ + INIT /* Dependent declarations and initializations */ + register int c; + register int eof = seof; + char *lastep; + int cclcnt; + char bracket[NBRA], *bracketp; + int closed; + int neg; + int lc; + int i, cflg; + int iflag; /* used for non-ascii characters in brackets */ + + lastep = NULL; + if ((c = GETC()) == eof || c == '\n') { + if (c == '\n') { + UNGETC(c); + nodelim = 1; + } + if (*ep == 0 && !sed) + ERROR(41); + RETURN(ep); + } + bracketp = bracket; + circf = closed = nbra = 0; + if (c == '^') + circf++; + else + UNGETC(c); + while (1) { + if (ep >= endbuf) + ERROR(50); + c = GETC(); + if (c != '*' && ((c != '\\') || (PEEKC() != '{'))) + lastep = ep; + if (c == eof) { + *ep++ = CCEOF; + if (bracketp != bracket) + ERROR(42); + RETURN(ep); + } + switch (c) { + + case '.': + *ep++ = CDOT; + continue; + + case '\n': + if (!sed) { + UNGETC(c); + *ep++ = CCEOF; + nodelim = 1; + if (bracketp != bracket) + ERROR(42); + RETURN(ep); + } else ERROR(36); + case '*': + if (lastep == NULL || *lastep == CBRA || + *lastep == CKET) + goto defchar; + *lastep |= STAR; + continue; + + case '$': + if (PEEKC() != eof && PEEKC() != '\n') + goto defchar; + *ep++ = CDOL; + continue; + + case '[': + if (&ep[17] >= endbuf) + ERROR(50); + + *ep++ = CCL; + lc = 0; + for (i = 0; i < 16; i++) + ep[i] = 0; + + neg = 0; + if ((c = GETC()) == '^') { + neg = 1; + c = GETC(); + } + iflag = 1; + do { + c &= 0377; + if (c == '\0' || c == '\n') + ERROR(49); + if ((c & 0200) && iflag) { + iflag = 0; + if (&ep[32] >= endbuf) + ERROR(50); + ep[-1] = CXCL; + for (i = 16; i < 32; i++) + ep[i] = 0; + } + if (c == '-' && lc != 0) { + if ((c = GETC()) == ']') { + PLACE('-'); + break; + } + if ((c & 0200) && iflag) { + iflag = 0; + if (&ep[32] >= endbuf) + ERROR(50); + ep[-1] = CXCL; + for (i = 16; i < 32; i++) + ep[i] = 0; + } + while (lc < c) { + PLACE(lc); + lc++; + } + } + lc = c; + PLACE(c); + } while ((c = GETC()) != ']'); + + if (iflag) + iflag = 16; + else + iflag = 32; + + if (neg) { + if (iflag == 32) { + for (cclcnt = 0; cclcnt < iflag; + cclcnt++) + ep[cclcnt] ^= 0377; + ep[0] &= 0376; + } else { + ep[-1] = NCCL; + /* make nulls match so test fails */ + ep[0] |= 01; + } + } + + ep += iflag; + + continue; + + case '\\': + switch (c = GETC()) { + + case '(': + if (nbra >= NBRA) + ERROR(43); + *bracketp++ = (char)nbra; + *ep++ = CBRA; + *ep++ = (char)nbra++; + continue; + + case ')': + if (bracketp <= bracket) + ERROR(42); + *ep++ = CKET; + *ep++ = *--bracketp; + closed++; + continue; + + case '{': + if (lastep == NULL) + goto defchar; + *lastep |= RNGE; + cflg = 0; + nlim: + c = GETC(); + i = 0; + do { + if ('0' <= c && c <= '9') + i = 10 * i + c - '0'; + else + ERROR(16); + } while (((c = GETC()) != '\\') && (c != ',')); + if (i >= 255) + ERROR(11); + *ep++ = (char)i; + if (c == ',') { + if (cflg++) + ERROR(44); + if ((c = GETC()) == '\\') + *ep++ = (char)255; + else { + UNGETC(c); + goto nlim; + /* get 2'nd number */ + } + } + if (GETC() != '}') + ERROR(45); + if (!cflg) /* one number */ + *ep++ = (char)i; + else if ((ep[-1] & 0377) < (ep[-2] & 0377)) + ERROR(46); + continue; + + case '\n': + ERROR(36); + + case 'n': + c = '\n'; + goto defchar; + + default: + if (c >= '1' && c <= '9') { + if ((c -= '1') >= closed) + ERROR(25); + *ep++ = CBACK; + *ep++ = (char)c; + continue; + } + } + /* Drop through to default to use \ to turn off special chars */ + + defchar: + default: + lastep = ep; + *ep++ = CCHR; + *ep++ = (char)c; + } + } +} + +#ifdef __STDC__ +int +step(const char *p1, const char *p2) +#else +int +step(p1, p2) +register char *p1, *p2; +#endif +{ + char c; + + + if (circf) { + loc1 = (char *)p1; + return (advance(p1, p2)); + } + /* fast check for first character */ + if (*p2 == CCHR) { + c = p2[1]; + do { + if (*p1 != c) + continue; + if (advance(p1, p2)) { + loc1 = (char *)p1; + return (1); + } + } while (*p1++); + return (0); + } + /* regular algorithm */ + do { + if (advance(p1, p2)) { + loc1 = (char *)p1; + return (1); + } + } while (*p1++); + return (0); +} + +int +#ifdef __STDC__ +advance(const char *lp, const char *ep) +#else +advance(lp, ep) +register char *lp, *ep; +#endif +{ +#ifdef __STDC__ + const char *curlp; +#else + register char *curlp; +#endif + int c; + char *bbeg; + register char neg; + size_t ct; + + while (1) { + neg = 0; + switch (*ep++) { + + case CCHR: + if (*ep++ == *lp++) + continue; + return (0); + /*FALLTHRU*/ + + case CDOT: + if (*lp++) + continue; + return (0); + /*FALLTHRU*/ + + case CDOL: + if (*lp == 0) + continue; + return (0); + /*FALLTHRU*/ + + case CCEOF: + loc2 = (char *)lp; + return (1); + /*FALLTHRU*/ + + case CXCL: + c = (unsigned char)*lp++; + if (ISTHERE(c)) { + ep += 32; + continue; + } + return (0); + /*FALLTHRU*/ + + case NCCL: + neg = 1; + /*FALLTHRU*/ + + case CCL: + c = *lp++; + if (((c & 0200) == 0 && ISTHERE(c)) ^ neg) { + ep += 16; + continue; + } + return (0); + /*FALLTHRU*/ + + case CBRA: + braslist[*ep++] = (char *)lp; + continue; + /*FALLTHRU*/ + + case CKET: + braelist[*ep++] = (char *)lp; + continue; + /*FALLTHRU*/ + + case CCHR | RNGE: + c = *ep++; + getrnge(ep); + while (low--) + if (*lp++ != c) + return (0); + curlp = lp; + while (size--) + if (*lp++ != c) + break; + if (size < 0) + lp++; + ep += 2; + goto star; + /*FALLTHRU*/ + + case CDOT | RNGE: + getrnge(ep); + while (low--) + if (*lp++ == '\0') + return (0); + curlp = lp; + while (size--) + if (*lp++ == '\0') + break; + if (size < 0) + lp++; + ep += 2; + goto star; + /*FALLTHRU*/ + + case CXCL | RNGE: + getrnge(ep + 32); + while (low--) { + c = (unsigned char)*lp++; + if (!ISTHERE(c)) + return (0); + } + curlp = lp; + while (size--) { + c = (unsigned char)*lp++; + if (!ISTHERE(c)) + break; + } + if (size < 0) + lp++; + ep += 34; /* 32 + 2 */ + goto star; + /*FALLTHRU*/ + + case NCCL | RNGE: + neg = 1; + /*FALLTHRU*/ + + case CCL | RNGE: + getrnge(ep + 16); + while (low--) { + c = *lp++; + if (((c & 0200) || !ISTHERE(c)) ^ neg) + return (0); + } + curlp = lp; + while (size--) { + c = *lp++; + if (((c & 0200) || !ISTHERE(c)) ^ neg) + break; + } + if (size < 0) + lp++; + ep += 18; /* 16 + 2 */ + goto star; + /*FALLTHRU*/ + + case CBACK: + bbeg = braslist[*ep]; + ct = braelist[*ep++] - bbeg; + + if (ecmp(bbeg, lp, ct)) { + lp += ct; + continue; + } + return (0); + /*FALLTHRU*/ + + case CBACK | STAR: + bbeg = braslist[*ep]; + ct = braelist[*ep++] - bbeg; + curlp = lp; + while (ecmp(bbeg, lp, ct)) + lp += ct; + + while (lp >= curlp) { + if (advance(lp, ep)) + return (1); + lp -= ct; + } + return (0); + /*FALLTHRU*/ + + case CDOT | STAR: + curlp = lp; + while (*lp++); + goto star; + /*FALLTHRU*/ + + case CCHR | STAR: + curlp = lp; + while (*lp++ == *ep); + ep++; + goto star; + /*FALLTHRU*/ + + case CXCL | STAR: + curlp = lp; + do { + c = (unsigned char)*lp++; + } while (ISTHERE(c)); + ep += 32; + goto star; + /*FALLTHRU*/ + + case NCCL | STAR: + neg = 1; + /*FALLTHRU*/ + + case CCL | STAR: + curlp = lp; + do { + c = *lp++; + } while (((c & 0200) == 0 && ISTHERE(c)) ^ neg); + ep += 16; + goto star; + /*FALLTHRU*/ + + star: + do { + if (--lp == locs) + break; + if (advance(lp, ep)) + return (1); + } while (lp > curlp); + return (0); + + } + } +} + +static void +#ifdef __STDC__ +getrnge(const char *str) +#else +getrnge(str) +register char *str; +#endif +{ + low = *str++ & 0377; + size = ((*str & 0377) == 255)? 20000: (*str &0377) - low; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _REGEXP_H */ diff --git a/usr/src/head/resolv.h b/usr/src/head/resolv.h new file mode 100644 index 0000000000..235af69e0b --- /dev/null +++ b/usr/src/head/resolv.h @@ -0,0 +1,446 @@ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T + * All Rights Reserved + * + * Portions of this source code were derived from Berkeley + * 4.3 BSD under license from the regents of the University of + * California. + */ + +/* + * BIND 4.9.4: + */ + +/* + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * --Copyright-- + * + * End BIND 4.9.4 + */ + +/* + * Copyright (c) 1983, 1987, 1989 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Portions Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * @(#)resolv.h 8.1 (Berkeley) 6/2/93 + * $Id: resolv.h,v 8.52 2003/04/29 02:27:03 marka Exp $ + */ + +#ifndef _RESOLV_H_ +#define _RESOLV_H_ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/param.h> + +#include <stdio.h> +#include <arpa/nameser.h> +#include <sys/socket.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Revision information. This is the release date in YYYYMMDD format. + * It can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__RES > 19931104)". Do not + * compare for equality; rather, use it to determine whether your resolver + * is new enough to contain a certain feature. + */ + +#define __RES 20030124 + +#define RES_SET_H_ERRNO(r, x) __h_errno_set(r, x) +struct __res_state; /* forward */ + +void __h_errno_set(struct __res_state *res, int err); + +/* + * Resolver configuration file. + * Normally not present, but may contain the address of the + * initial name server(s) to query and the domain search list. + */ + +#ifndef _PATH_RESCONF +#define _PATH_RESCONF "/etc/resolv.conf" +#endif + +#ifdef __STDC__ +#ifndef __P +#define __P(x) x +#endif +#else +#ifndef __P +#define __P(x) () +#endif +#endif /* __STDC__ */ + +typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } + res_sendhookact; + +typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr * const *ns, + const uchar_t **query, + int *querylen, + uchar_t *ans, + int anssiz, + int *resplen)); + +typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr *ns, + const uchar_t *query, + int querylen, + uchar_t *ans, + int anssiz, + int *resplen)); + +struct res_sym { + int number; /* Identifying number, like T_MX */ + const char *name; /* Its symbolic name, like "MX" */ + const char *humanname; /* Its fun name, like "mail exchanger" */ +}; + +/* + * Global defines and variables for resolver stub. + */ +/* ADDRSORT and MAXADDR retained for compatibility; not used */ +#define ADDRSORT 1 /* enable the address-sorting option */ +#define MAXADDR 10 /* max # addresses to sort by */ + +#define MAXNS 3 /* max # name servers we'll track */ +#define MAXDFLSRCH 3 /* # default domain levels to try */ +#define MAXDNSRCH 6 /* max # domains in search path */ +#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ + +#define RES_TIMEOUT 5 /* min. seconds between retries */ +#define MAXRESOLVSORT 10 /* number of net to sort on */ +#define RES_MAXNDOTS 15 /* should reflect bit field size */ +#define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ +#define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ +#define RES_DFLRETRY 2 /* Default #/tries. */ +#define RES_MAXTIME 65535 /* Infinity, in milliseconds. */ + +struct __res_state_ext; + +struct __res_state { + int retrans; /* retransmission time interval */ + int retry; /* number of times to retransmit */ +#ifdef __sun + uint_t options; /* option flags - see below. */ +#else + ulong_t options; /* option flags - see below. */ +#endif + int nscount; /* number of name servers */ + struct sockaddr_in + nsaddr_list[MAXNS]; /* address of name server */ +#define nsaddr nsaddr_list[0] /* for backward compatibility */ + ushort_t id; /* current packet id */ + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ + char defdname[256]; /* default domain (deprecated) */ +#ifdef __sun + uint_t pfcode; /* RES_PRF_ flags - see below. */ +#else + ulong_t pfcode; /* RES_PRF_ flags - see below. */ +#endif + unsigned ndots:4; /* threshold for initial abs. query */ + unsigned nsort:4; /* number of elements in sort_list[] */ + char unused[3]; + struct { + struct in_addr addr; + unsigned int mask; + } sort_list[MAXRESOLVSORT]; + res_send_qhook qhook; /* query hook */ + res_send_rhook rhook; /* response hook */ + int res_h_errno; /* last one set for this context */ + int _vcsock; /* PRIVATE: for res_send VC i/o */ + uint_t _flags; /* PRIVATE: see below */ + uint_t _pad; /* make _u 64 bit aligned */ + union { + /* On an 32-bit arch this means 512b total. */ + char pad[72 - 4*sizeof (int) - 2*sizeof (void *)]; + struct { + uint16_t nscount; + uint16_t nstimes[MAXNS]; /* ms. */ + int nssocks[MAXNS]; + struct __res_state_ext *ext; /* extention for IPv6 */ + } _ext; + } _u; +}; + +typedef struct __res_state *res_state; + +union res_sockaddr_union { + struct sockaddr_in sin; +#ifdef IN6ADDR_ANY_INIT + struct sockaddr_in6 sin6; +#endif +#ifdef ISC_ALIGN64 + int64_t __align64; /* 64bit alignment */ +#else + int32_t __align32; /* 32bit alignment */ +#endif + char __space[128]; /* max size */ +}; + +/* + * Resolver flags (used to be discrete per-module statics ints). + */ +#define RES_F_VC 0x00000001 /* socket is TCP */ +#define RES_F_CONN 0x00000002 /* socket is connected */ +#define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors */ +#define RES_F__UNUSED 0x00000008 /* (unused) */ +#define RES_F_LASTMASK 0x000000F0 /* ordinal server of last res_nsend */ +#define RES_F_LASTSHIFT 4 /* bit position of LASTMASK "flag" */ +#define RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT) + +/* res_findzonecut2() options */ +#define RES_EXHAUSTIVE 0x00000001 /* always do all queries */ +#define RES_IPV4ONLY 0x00000002 /* IPv4 only */ +#define RES_IPV6ONLY 0x00000004 /* IPv6 only */ + +/* + * Resolver options (keep these in synch with res_debug.c, please) + */ +#define RES_INIT 0x00000001 /* address initialized */ +#define RES_DEBUG 0x00000002 /* print debug messages */ +#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL) */ +#define RES_USEVC 0x00000008 /* use virtual circuit */ +#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ +#define RES_IGNTC 0x00000020 /* ignore trucation errors */ +#define RES_RECURSE 0x00000040 /* recursion desired */ +#define RES_DEFNAMES 0x00000080 /* use default domain name */ +#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x00000200 /* search up local domain tree */ +#define RES_INSECURE1 0x00000400 /* type 1 security disabled */ +#define RES_INSECURE2 0x00000800 /* type 2 security disabled */ +#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ +#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ +#define RES_ROTATE 0x00004000 /* rotate ns list after each query */ +#define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */ +#define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */ +#define RES_BLAST 0x00020000 /* blast all recursive servers */ +#define RES_NO_NIBBLE 0x00040000 /* disable IPv6 nibble mode reverse */ +#define RES_NO_BITSTRING 0x00080000 /* disable IPv6 bitstring mode revrse */ +#define RES_NOTLDQUERY 0x00100000 /* don't unqualified name as a tld */ +#define RES_USE_DNSSEC 0x00200000 /* use DNSSEC using OK bit in OPT */ +/* KAME extensions: use higher bit to avoid conflict with ISC use */ +#define RES_USE_DNAME 0x10000000 /* use DNAME */ +#define RES_USE_EDNS0 0x40000000 /* use EDNS0 if configured */ +#define RES_NO_NIBBLE2 0x80000000 /* disable alternate nibble lookup */ + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) + +/* + * Resolver "pfcode" values. Used by dig. + */ +#define RES_PRF_STATS 0x00000001 +#define RES_PRF_UPDATE 0x00000002 +#define RES_PRF_CLASS 0x00000004 +#define RES_PRF_CMD 0x00000008 +#define RES_PRF_QUES 0x00000010 +#define RES_PRF_ANS 0x00000020 +#define RES_PRF_AUTH 0x00000040 +#define RES_PRF_ADD 0x00000080 +#define RES_PRF_HEAD1 0x00000100 +#define RES_PRF_HEAD2 0x00000200 +#define RES_PRF_TTLID 0x00000400 +#define RES_PRF_HEADX 0x00000800 +#define RES_PRF_QUERY 0x00001000 +#define RES_PRF_REPLY 0x00002000 +#define RES_PRF_INIT 0x00004000 +#define RES_PRF_TRUNC 0x00008000 +/* 0x00010000 */ + +/* Things involving an internal (static) resolver context. */ +#ifdef _REENTRANT +extern struct __res_state *__res_state(void); +#define _res (*__res_state()) +#else +#ifndef __BIND_NOSTATIC +extern struct __res_state _res; +#endif +#endif + +#ifndef __BIND_NOSTATIC +void fp_nquery __P((const uchar_t *, int, FILE *)); +void fp_query __P((const uchar_t *, FILE *)); +const char *hostalias __P((const char *)); +void p_query __P((const uchar_t *)); +void res_close __P((void)); +int res_init __P((void)); +int res_isourserver __P((const struct sockaddr_in *)); +int res_mkquery __P((int, const char *, int, int, const uchar_t *, + int, const uchar_t *, uchar_t *, int)); +int res_query __P((const char *, int, int, uchar_t *, int)); +int res_querydomain __P((const char *, const char *, int, int, + uchar_t *, int)); +int res_search __P((const char *, int, int, uchar_t *, int)); +int res_send __P((const uchar_t *, int, uchar_t *, int)); +int res_sendsigned __P((const uchar_t *, int, ns_tsig_key *, + uchar_t *, int)); +#endif /* __BIND_NOSTATIC */ + +extern const struct res_sym __p_key_syms[]; +extern const struct res_sym __p_cert_syms[]; +extern const struct res_sym __p_class_syms[]; +extern const struct res_sym __p_type_syms[]; +extern const struct res_sym __p_rcode_syms[]; + +int res_hnok __P((const char *)); +int res_ownok __P((const char *)); +int res_mailok __P((const char *)); +int res_dnok __P((const char *)); +int sym_ston __P((const struct res_sym *, const char *, int *)); +const char *sym_ntos __P((const struct res_sym *, int, int *)); +const char *sym_ntop __P((const struct res_sym *, int, int *)); +int b64_ntop __P((uchar_t const *, size_t, char *, size_t)); +int b64_pton __P((char const *, uchar_t *, size_t)); +int loc_aton __P((const char *ascii, uchar_t *binary)); +const char *loc_ntoa __P((const uchar_t *binary, char *ascii)); +int dn_skipname __P((const uchar_t *, const uchar_t *)); +void putlong __P((unsigned int, uchar_t *)); +void putshort __P((unsigned short, uchar_t *)); +const char *p_class __P((int)); +const char *p_time __P((unsigned int)); +const char *p_type __P((int)); +const char *p_rcode __P((int)); +const char *p_sockun __P((union res_sockaddr_union, char *, size_t)); +const uchar_t *p_cdnname __P((const uchar_t *, const uchar_t *, int, + FILE *)); +const uchar_t *p_cdname __P((const uchar_t *, const uchar_t *, FILE *)); +const uchar_t *p_fqnname __P((const uchar_t *cp, const uchar_t *msg, + int, char *, int)); +const uchar_t *p_fqname __P((const uchar_t *, const uchar_t *, FILE *)); +const char *p_option __P((uint_t option)); +char *p_secstodate __P((uint_t)); +int dn_count_labels __P((const char *)); +int dn_comp __P((const char *, uchar_t *, int, + uchar_t **, uchar_t **)); +int dn_expand __P((const uchar_t *, const uchar_t *, + const uchar_t *, char *, int)); +uint_t res_randomid __P((void)); +int res_nameinquery __P((const char *, int, int, + const uchar_t *, const uchar_t *)); +int res_queriesmatch __P((const uchar_t *, const uchar_t *, + const uchar_t *, const uchar_t *)); +const char *p_section __P((int section, int opcode)); + + +/* Things involving a resolver context. */ +int res_ninit __P((res_state)); +int res_nisourserver __P((const res_state, + const struct sockaddr_in *)); +void fp_resstat __P((const res_state, FILE *)); +void res_pquery __P((const res_state, const uchar_t *, int, FILE *)); +const char *res_hostalias __P((const res_state, const char *, + char *, size_t)); +int res_nquery __P((res_state, + const char *, int, int, uchar_t *, int)); +int res_nsearch __P((res_state, const char *, int, + int, uchar_t *, int)); +int res_nquerydomain __P((res_state, + const char *, const char *, int, int, + uchar_t *, int)); +int res_nmkquery __P((res_state, + int, const char *, int, int, const uchar_t *, + int, const uchar_t *, uchar_t *, int)); +int res_nsend __P((res_state, const uchar_t *, int, uchar_t *, + int)); +int res_nsendsigned __P((res_state, const uchar_t *, int, + ns_tsig_key *, uchar_t *, int)); +int res_findzonecut __P((res_state, const char *, ns_class, int, + char *, size_t, struct in_addr *, int)); +int res_findzonecut2 __P((res_state, const char *, ns_class, int, + char *, size_t, union res_sockaddr_union *, + int)); +void res_nclose __P((res_state)); +int res_nopt __P((res_state, int, uchar_t *, int, int)); +void res_send_setqhook __P((res_send_qhook hook)); +void res_send_setrhook __P((res_send_rhook hook)); +int __res_vinit __P((res_state, int)); +void res_destroyservicelist __P((void)); +const char *res_servicename __P((uint16_t port, const char *proto)); +const char *res_protocolname __P((int num)); +void res_destroyprotolist __P((void)); +void res_buildprotolist __P((void)); +const char *res_get_nibblesuffix __P((res_state)); +const char *res_get_nibblesuffix2 __P((res_state)); +void res_ndestroy __P((res_state)); +uint16_t res_nametoclass __P((const char *buf, int *success)); +uint16_t res_nametotype __P((const char *buf, int *success)); +void res_setservers __P((res_state, + const union res_sockaddr_union *, int)); +int res_getservers __P((res_state, + union res_sockaddr_union *, int)); + + +#ifdef __cplusplus +} +#endif + +#endif /* !_RESOLV_H_ */ diff --git a/usr/src/head/rje.h b/usr/src/head/rje.h new file mode 100644 index 0000000000..f3dbb0f72c --- /dev/null +++ b/usr/src/head/rje.h @@ -0,0 +1,119 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _RJE_H +#define _RJE_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4.1.1 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAXDEVS 7 /* Maximum number of devices (readers, etc.) */ +#define LINEFIL "/usr/rje/lines" + +#define RJECU "/dev/dn2" /* Dial-up RJE device */ +#define RJELOGIN "rje" /* rje login name */ +#define RJEUID 68 /* User-Id for "rje" */ +#define SHQUID 69 /* User-Id for "shqer" */ +#define RJEGID 8 /* Group-Id for "rje" and "shqer" */ +#define QUEDIR "/usr/rje/sque" /* shqer directory */ +#define QUELOG "log" /* shqer log file name */ +#define QUELEN 50 /* Length of a shqer log entry */ +#define QDELAY 180 /* Delay time for shqer */ +#define QNICE 0 +#define BOOTDLY 60 /* Reboot delay time (seconds) */ +#define RESPMAX 70000 /* Max resp file size */ + +#define DEVFD 0 /* KMC device file descriptor */ +#define XMTRD 1 /* xmit read file descriptor */ +#define ERRFD 2 /* errors file descriptor */ +#define XMTWR 3 /* xmit write file descriptor */ +#define DSPRD 4 /* disp read file descriptor */ +#define DSPWR 5 /* disp write file descriptor */ +#define JBLOG 6 /* joblog file descriptor */ + +#define NAMESZ 8 + +struct joblog { + char j_file[NAMESZ]; /* Name of file to be sent */ + unsigned j_uid; /* User ID of owner */ + int j_lvl; /* Message level */ + long j_cnt; /* Number of "cards" */ +}; + + /* joblog header info */ + +struct loghdr { + int h_pgrp; /* Process group Id */ +}; +#define LBUFMAX 100 +#define MAXLNS 6 +struct lines { + char *l_host; /* RJE host machine */ + char *l_sys; /* This system */ + char *l_dir; /* home directory */ + char *l_prefix; /* rje prefix */ + char *l_dev; /* device for transfer */ + char *l_peri; /* Peripherals field */ + char *l_parm; /* Parameters field */ + char l_buf[LBUFMAX]; /* buffer for fields */ +}; + +struct dsplog { + int d_type; /* Type of record */ + union { + struct { /* record from xmit */ + char d_file[NAMESZ]; /* file sent */ + long d_cnt; /* no. of cards sent */ + unsigned d_uid; /* who sent the file */ + int d_lvl; /* message level */ + int d_rdr; /* reader sent from (0-6) */ + } x; + struct { /* record from recv */ + char d_file[NAMESZ]; /* file received */ + long d_cnt; /* no. of records */ + int d_trunc; /* file truncation flag */ + } r; + } d_un; +}; + +struct sque { + char sq_exfil[140]; /* Executable file */ + char sq_infil[48]; /* Input file */ + char sq_jobnm[9]; /* Remote job name */ + char sq_pgrmr[25]; /* Programmer name */ + char sq_jobno[9]; /* Remote job number */ + char sq_login[9]; /* Login name from usr= */ + char sq_homed[48]; /* Login directory */ + long sq_min; /* Minimum file system space */ +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _RJE_H */ diff --git a/usr/src/head/rmmount.h b/usr/src/head/rmmount.h new file mode 100644 index 0000000000..ffd36eef65 --- /dev/null +++ b/usr/src/head/rmmount.h @@ -0,0 +1,71 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1992, by Sun Microsystems, Inc. + */ + +#ifndef _RMMOUNT_H +#define _RMMOUNT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * For the "action" function(s). + */ +struct action_arg { + char *aa_path; /* special device in question (block) */ + char *aa_rawpath; /* character special of above */ + char *aa_type; /* file system type */ + char *aa_media; /* type of media */ + char *aa_partname; /* iff a partition, partition name */ + char *aa_mountpoint; /* path this file system mounted on */ + int aa_clean; /* does filesystem need fsck? (TRUE | FALSE) */ + int aa_mnt; /* was it mounted? (TRUE | FALSE) */ +}; + +/* + * The "action" function is passed a null terminated array of + * action_arg structures. The last array entry denoted by + * aa_path == NULL. Argc and argv are the arguments from + * the configuration file. argv[0] == the name of the dso of + * this action. + */ +int action(struct action_arg **aa, int argc, char **argv); + +/* + * The ident_fs function is passed an open file descriptor to the block + * device and the pathname of the character device if it can be + * discovered. Otherwise "rawpath" is NULL. + * it is to return TRUE if the data that can be read through + * fd represents a file system that it recognizes. + */ +int ident_fs(int fd, char *rawpath, int *clean, int verbose); + +#ifdef __cplusplus +} +#endif + +#endif /* _RMMOUNT_H */ diff --git a/usr/src/head/rpcsvc/bootparam.h b/usr/src/head/rpcsvc/bootparam.h new file mode 100644 index 0000000000..47f9c0fb2a --- /dev/null +++ b/usr/src/head/rpcsvc/bootparam.h @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1993, by Sun Microsystems, Inc. + */ + +#ifndef _RPCSVC_BOOTPARAM_H +#define _RPCSVC_BOOTPARAM_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <rpcsvc/bootparam_prot.h> + +#endif /* _RPCSVC_BOOTPARAM_H */ diff --git a/usr/src/head/rpcsvc/bootparam_prot.x b/usr/src/head/rpcsvc/bootparam_prot.x new file mode 100644 index 0000000000..609c834b37 --- /dev/null +++ b/usr/src/head/rpcsvc/bootparam_prot.x @@ -0,0 +1,91 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. +% * Use is subject to license terms. +% */ + +%/* from bootparam_prot.x */ + +#ifdef RPC_HDR +% +%#pragma ident "%Z%%M% %I% %E% SMI" +% +#endif + +/* + * RPC for bootparms service. + * There are two procedures: + * WHOAMI takes a net address and returns a client name and also a + * likely net address for routing + * GETFILE takes a client name and file identifier and returns the + * server name, server net address and pathname for the file. + * file identifiers typically include root, swap, pub and dump + */ +const MAX_MACHINE_NAME = 255; +const MAX_PATH_LEN = 1024; +const MAX_FILEID = 32; +const IP_ADDR_TYPE = 1; + +typedef string bp_machine_name_t<MAX_MACHINE_NAME>; +typedef string bp_path_t<MAX_PATH_LEN>; +typedef string bp_fileid_t<MAX_FILEID>; + +struct ip_addr_t { + char net; + char host; + char lh; + char impno; +}; + +union bp_address switch (int address_type) { + case IP_ADDR_TYPE: + ip_addr_t ip_addr; +}; + +struct bp_whoami_arg { + bp_address client_address; +}; + +struct bp_whoami_res { + bp_machine_name_t client_name; + bp_machine_name_t domain_name; + bp_address router_address; +}; + +struct bp_getfile_arg { + bp_machine_name_t client_name; + bp_fileid_t file_id; +}; + +struct bp_getfile_res { + bp_machine_name_t server_name; + bp_address server_address; + bp_path_t server_path; +}; + +program BOOTPARAMPROG { + version BOOTPARAMVERS { + bp_whoami_res BOOTPARAMPROC_WHOAMI(bp_whoami_arg) = 1; + bp_getfile_res BOOTPARAMPROC_GETFILE(bp_getfile_arg) = 2; + } = 1; +} = 100026; diff --git a/usr/src/head/rpcsvc/daemon_utils.h b/usr/src/head/rpcsvc/daemon_utils.h new file mode 100644 index 0000000000..8ba538fe81 --- /dev/null +++ b/usr/src/head/rpcsvc/daemon_utils.h @@ -0,0 +1,62 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _DAEMON_UTILS_H +#define _DAEMON_UTILS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/stat.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define AUTOMOUNTD "svc:/system/filesystem/autofs:default" +#define LOCKD "svc:/network/nfs/nlockmgr:default" +#define STATD "svc:/network/nfs/status:default" +#define NFSD "svc:/network/nfs/server:default" +#define MOUNTD "svc:/network/nfs/mountd:default" +#define NFS4CBD "svc:/network/nfs/cbd:default" +#define NFSMAPID "svc:/network/nfs/mapid:default" +#define RQUOTAD "svc:/network/nfs/rquota:default" + +#define DAEMON_UID 1 +#define DAEMON_GID 12 + +#define DAEMON_DIR "/var/run/daemon" +#define DAEMON_DIR_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) + +extern void _check_services(char **); +extern int _check_daemon_lock(const char *); +extern int _create_daemon_lock(const char *, uid_t, gid_t); +extern pid_t _enter_daemon_lock(const char *); + +#ifdef __cplusplus +} +#endif + +#endif /* _DAEMON_UTILS_H */ diff --git a/usr/src/head/rpcsvc/dbm.h b/usr/src/head/rpcsvc/dbm.h new file mode 100644 index 0000000000..110d8b990d --- /dev/null +++ b/usr/src/head/rpcsvc/dbm.h @@ -0,0 +1,91 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1989 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _RPCSVC_DBM_H +#define _RPCSVC_DBM_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define PBLKSIZ 1024 +#define DBLKSIZ 4096 +#define BYTESIZ 8 +#ifndef NULL +#define NULL ((char *)0) +#endif + +long bitno; +long maxbno; +long blkno; +long hmask; + +char pagbuf[PBLKSIZ]; +char dirbuf[DBLKSIZ]; + +int dirf; +int pagf; +int dbrdonly; + +typedef struct +{ + char *dptr; + int dsize; +} datum; + +#ifdef __STDC_ +datum fetch(datum); +datum makdatum(char *, int); +datum firstkey(void); +datum nextkey(datum); +datum firsthash(long); +long calchash(datum); +long hashinc(long); +#else +datum fetch(); +datum makdatum(); +datum firstkey(); +datum nextkey(); +datum firsthash(); +long calchash(); +long hashinc(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _RPCSVC_DBM_H */ diff --git a/usr/src/head/rpcsvc/mount.x b/usr/src/head/rpcsvc/mount.x new file mode 100644 index 0000000000..b47b8385c8 --- /dev/null +++ b/usr/src/head/rpcsvc/mount.x @@ -0,0 +1,382 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* ident "%Z%%M% %I% %E% SMI" */ + +/* + * Copyright (c) 1988,1990-1992,1998 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * Protocol description for the mount program + */ + +const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */ +const MNTNAMLEN = 255; /* maximum bytes in a name argument */ +const FHSIZE = 32; /* size in bytes of a v2 file handle */ +const FHSIZE3 = 64; /* " " " " " v3 " " */ + +/* + * The fhandle is the file handle that the server passes to the client. + * All file operations are done using the file handles to refer to a file + * or a directory. The file handle can contain whatever information the + * server needs to distinguish an individual file. + * + * Versions 1 and 2 of the protocol share a filehandle of 32 bytes. + * + * Version 3 supports a 64 byte filehandle that can be used only + * with version 3 of the NFS protocol. + */ + +typedef opaque fhandle[FHSIZE]; +typedef opaque fhandle3<FHSIZE3>; + +/* + * If a V2 status of zero is returned, the call completed successfully, and + * a file handle for the directory follows. A non-zero status indicates + * some sort of error. The status corresponds with UNIX error numbers. + */ +union fhstatus switch (unsigned fhs_status) { +case 0: + fhandle fhs_fhandle; +default: + void; +}; + +/* + * This #define is added for backwards compatability with applications + * which reference the old style fhstatus. The second element of that + * structure was called fhs_fh, instead of the current fhs_fhandle. + */ +% +%#define fhs_fh fhstatus_u.fhs_fhandle + +/* + * The following status codes are defined for the V3 mount service: + * Note that the precise enum encoding must be followed; the values + * are derived from existing implementation practice, and there is + * no good reason to disturb them. + */ +enum mountstat3 { + MNT_OK= 0, /* no error */ + MNT3ERR_PERM=1, /* Not owner */ + MNT3ERR_NOENT=2, /* No such file or directory */ + MNT3ERR_IO=5, /* I/O error */ + MNT3ERR_ACCES=13, /* Permission denied */ + MNT3ERR_NOTDIR=20, /* Not a directory*/ + MNT3ERR_INVAL=22, /* Invalid argument.*/ + MNT3ERR_NAMETOOLONG=63, /* File name too long */ + MNT3ERR_NOTSUPP=10004, /* operation not supported */ + MNT3ERR_SERVERFAULT=10006 /* An i/o or similar failure caused */ + /* the server to abandon the request */ + /* No attributes can be returned. The */ + /* client should translate this into EIO */ +}; + +/* + * A V3 server returns a file handle and a list of the authentication + * flavors that the server will accept for this mount. If the list + * is empty, AUTH_UNIX is required. Otherwise, any of the flavors + * listed in auth_flavors<> may be used (but no others). + * The values of the authentication flavors are defined in the + * underlying RPC protocol. + */ +struct mountres3_ok { + fhandle3 fhandle; + int auth_flavors<>; +}; + +/* + * If a V3 status of MNT_OK is returned, the call completed successfully, and + * a file handle for the directory follows. Any other status indicates + * some sort of error. + */ + +union mountres3 switch (mountstat3 fhs_status) { +case MNT_OK: + mountres3_ok mountinfo; +default: + void; +}; + +/* + * The type dirpath is the pathname of a directory + */ +typedef string dirpath<MNTPATHLEN>; + +/* + * The type name is used for arbitrary names (hostnames, groupnames) + */ +typedef string name<MNTNAMLEN>; + +/* + * A list of who has what mounted. This information is + * strictly advisory, since there is no mechanism to + * enforce the removal of stale information. The strongest + * assertion that can be made is that if a hostname:directory + * pair appears in the list, the server has exported the + * directory to that client at some point since the server + * export data base was (re)initialized. Note also that there + * is no limit on the length of the information returned + * in this structure, and this may cause problems if the + * mount service is accessed via a connectionless transport. + * + * The ifdef will ensure that these are only carried over to + * mount.h - no xdr routines will be generated. We want to + * do these by hand, to avoid the recursive stack-blowing ones + * that rpcgen will generate. + */ +#ifdef RPC_HDR +typedef struct mountbody *mountlist; +struct mountbody { + name ml_hostname; + dirpath ml_directory; + mountlist ml_next; +}; +#endif /* RPC_HDR */ + +/* + * A list of netgroups + */ +typedef struct groupnode *groups; +struct groupnode { + name gr_name; + groups gr_next; +}; + +/* + * A list of what is exported and to whom + */ +typedef struct exportnode *exports; +struct exportnode { + dirpath ex_dir; + groups ex_groups; + exports ex_next; +}; + +/* + * POSIX pathconf information + */ +struct ppathcnf { + int pc_link_max; /* max links allowed */ + short pc_max_canon; /* max line len for a tty */ + short pc_max_input; /* input a tty can eat all at once */ + short pc_name_max; /* max file name length (dir entry) */ + short pc_path_max; /* max path name length (/x/y/x/.. ) */ + short pc_pipe_buf; /* size of a pipe (bytes) */ + u_char pc_vdisable; /* safe char to turn off c_cc[i] */ + char pc_xxx; /* alignment padding; cc_t == char */ + short pc_mask[2]; /* validity and boolean bits */ +}; + +program MOUNTPROG { + /* + * Version one of the mount protocol communicates with version two + * of the NFS protocol. The only connecting point is the fhandle + * structure, which is the same for both protocols. + */ + version MOUNTVERS { + /* + * Does no work. It is made available in all RPC services + * to allow server reponse testing and timing + */ + void + MOUNTPROC_NULL(void) = 0; + + /* + * If fhs_status is 0, then fhs_fhandle contains the + * file handle for the directory. This file handle may + * be used in the NFS protocol. This procedure also adds + * a new entry to the mount list for this client mounting + * the directory. + * Unix authentication required. + */ + fhstatus + MOUNTPROC_MNT(dirpath) = 1; + + /* + * Returns the list of remotely mounted filesystems. The + * mountlist contains one entry for each hostname and + * directory pair. + */ + mountlist + MOUNTPROC_DUMP(void) = 2; + + /* + * Removes the mount list entry for the directory + * Unix authentication required. + */ + void + MOUNTPROC_UMNT(dirpath) = 3; + + /* + * Removes all of the mount list entries for this client + * Unix authentication required. + */ + void + MOUNTPROC_UMNTALL(void) = 4; + + /* + * Returns a list of all the exported filesystems, and which + * machines are allowed to import it. + */ + exports + MOUNTPROC_EXPORT(void) = 5; + + /* + * Identical to MOUNTPROC_EXPORT above + */ + exports + MOUNTPROC_EXPORTALL(void) = 6; + } = 1; + + /* + * Version two of the mount protocol communicates with version two + * of the NFS protocol. It is identical to version one except for a + * new procedure call for posix. + */ + version MOUNTVERS_POSIX { + /* + * Does no work. It is made available in all RPC services + * to allow server reponse testing and timing + */ + void + MOUNTPROC_NULL(void) = 0; + + /* + * If fhs_status is 0, then fhs_fhandle contains the + * file handle for the directory. This file handle may + * be used in the NFS protocol. This procedure also adds + * a new entry to the mount list for this client mounting + * the directory. + * Unix authentication required. + */ + fhstatus + MOUNTPROC_MNT(dirpath) = 1; + + /* + * Returns the list of remotely mounted filesystems. The + * mountlist contains one entry for each hostname and + * directory pair. + */ + mountlist + MOUNTPROC_DUMP(void) = 2; + + /* + * Removes the mount list entry for the directory + * Unix authentication required. + */ + void + MOUNTPROC_UMNT(dirpath) = 3; + + /* + * Removes all of the mount list entries for this client + * Unix authentication required. + */ + void + MOUNTPROC_UMNTALL(void) = 4; + + /* + * Returns a list of all the exported filesystems, and which + * machines are allowed to import it. + */ + exports + MOUNTPROC_EXPORT(void) = 5; + + /* + * Identical to MOUNTPROC_EXPORT above + */ + exports + MOUNTPROC_EXPORTALL(void) = 6; + + /* + * Posix info over the wire isn't supported in NFS version 2 + * so we get it here at mount time. + */ + ppathcnf + MOUNTPROC_PATHCONF(dirpath) = 7; + } = 2; + + /* + * Version 3 of the mount protocol communicates with version 3 + * of the NFS protocol. The only connecting point is the nfs_fh3 + * structure, which is the same for both protocols. + * + * The only significant change over version 2 is that MOUNTPROC_MNT + * returns a longer filehandle (64 bytes instead of 32) as well + * as authentication information. MOUNTPROC_PATHCONF is subsumed + * into V3 of the NFS protocol and MOUNTPROC_EXPORTALL is eliminated. + */ + version MOUNTVERS3 { + /* + * Does no work. It is made available in all RPC services + * to allow server reponse testing and timing + */ + void + MOUNTPROC_NULL(void) = 0; + + /* + * Mount a file system. + * + * If mountres.fhs_status is NFS_OK, then mountres.mountinfo + * contains the file handle for the directory and + * a list of acceptable authentication flavors. This file + * handle may only be used in version 3 of the NFS protocol. + * This procedure also results in the server adding a new + * entry to its mount list recording that this client has + * mounted the directory. Unix authentication or better + * is required. + */ + mountres3 + MOUNTPROC_MNT(dirpath) = 1; + + /* + * Returns the list of remotely mounted filesystems. The + * mountlist contains one entry for each hostname and + * directory pair. + */ + mountlist + MOUNTPROC_DUMP(void) = 2; + + /* + * Removes the mount list entry for the directory + * Unix authentication or better is required. + */ + void + MOUNTPROC_UMNT(dirpath) = 3; + + /* + * Removes all of the mount list entries for this client + * Unix authentication or better is required. + */ + void + MOUNTPROC_UMNTALL(void) = 4; + + /* + * Returns a list of all the exported filesystems, and which + * machines are allowed to import each one. + */ + exports + MOUNTPROC_EXPORT(void) = 5; + + } = 3; +} = 100005; diff --git a/usr/src/head/rpcsvc/nfs4_prot.x b/usr/src/head/rpcsvc/nfs4_prot.x new file mode 100644 index 0000000000..770784fa10 --- /dev/null +++ b/usr/src/head/rpcsvc/nfs4_prot.x @@ -0,0 +1,1658 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) The Internet Society (1998-2003). + * All Rights Reserved. + */ + +/* + * nfs4_prot.x + */ + +%#pragma ident "@(#)nfs4_prot.x 1.122" + +/* + * Basic typedefs for RFC 1832 data type definitions + */ + +/* + * typedef int int32_t; + * typedef unsigned int uint32_t; + * typedef hyper int64_t; + * typedef unsigned hyper uint64_t; + */ + +/* + * Sizes + */ +const NFS4_FHSIZE = 128; +const NFS4_VERIFIER_SIZE = 8; +const NFS4_OPAQUE_LIMIT = 1024; + +/* + * File types + */ +enum nfs_ftype4 { + NF4REG = 1, /* Regular File */ + NF4DIR = 2, /* Directory */ + NF4BLK = 3, /* Special File - block device */ + NF4CHR = 4, /* Special File - character device */ + NF4LNK = 5, /* Symbolic Link */ + NF4SOCK = 6, /* Special File - socket */ + NF4FIFO = 7, /* Special File - fifo */ + NF4ATTRDIR = 8, /* Attribute Directory */ + NF4NAMEDATTR = 9 /* Named Attribute */ +}; + +/* + * Error status + */ +enum nfsstat4 { + NFS4_OK = 0, /* everything is okay */ + NFS4ERR_PERM = 1, /* caller not privileged */ + NFS4ERR_NOENT = 2, /* no such file/directory */ + NFS4ERR_IO = 5, /* hard I/O error */ + NFS4ERR_NXIO = 6, /* no such device */ + NFS4ERR_ACCESS = 13, /* access denied */ + NFS4ERR_EXIST = 17, /* file already exists */ + NFS4ERR_XDEV = 18, /* different filesystems */ + /* Unused/reserved 19 */ + NFS4ERR_NOTDIR = 20, /* should be a directory */ + NFS4ERR_ISDIR = 21, /* should not be directory */ + NFS4ERR_INVAL = 22, /* invalid argument */ + NFS4ERR_FBIG = 27, /* file exceeds server max */ + NFS4ERR_NOSPC = 28, /* no space on filesystem */ + NFS4ERR_ROFS = 30, /* read-only filesystem */ + NFS4ERR_MLINK = 31, /* too many hard links */ + NFS4ERR_NAMETOOLONG = 63, /* name exceeds server max */ + NFS4ERR_NOTEMPTY = 66, /* directory not empty */ + NFS4ERR_DQUOT = 69, /* hard quota limit reached*/ + NFS4ERR_STALE = 70, /* file no longer exists */ + NFS4ERR_BADHANDLE = 10001,/* Illegal filehandle */ + NFS4ERR_BAD_COOKIE = 10003,/* READDIR cookie is stale */ + NFS4ERR_NOTSUPP = 10004,/* operation not supported */ + NFS4ERR_TOOSMALL = 10005,/* response limit exceeded */ + NFS4ERR_SERVERFAULT = 10006,/* undefined server error */ + NFS4ERR_BADTYPE = 10007,/* type invalid for CREATE */ + NFS4ERR_DELAY = 10008,/* file "busy" - retry */ + NFS4ERR_SAME = 10009,/* nverify says attrs same */ + NFS4ERR_DENIED = 10010,/* lock unavailable */ + NFS4ERR_EXPIRED = 10011,/* lock lease expired */ + NFS4ERR_LOCKED = 10012,/* I/O failed due to lock */ + NFS4ERR_GRACE = 10013,/* in grace period */ + NFS4ERR_FHEXPIRED = 10014,/* filehandle expired */ + NFS4ERR_SHARE_DENIED = 10015,/* share reserve denied */ + NFS4ERR_WRONGSEC = 10016,/* wrong security flavor */ + NFS4ERR_CLID_INUSE = 10017,/* clientid in use */ + NFS4ERR_RESOURCE = 10018,/* resource exhaustion */ + NFS4ERR_MOVED = 10019,/* filesystem relocated */ + NFS4ERR_NOFILEHANDLE = 10020,/* current FH is not set */ + NFS4ERR_MINOR_VERS_MISMATCH = 10021,/* minor vers not supp */ + NFS4ERR_STALE_CLIENTID = 10022,/* server has rebooted */ + NFS4ERR_STALE_STATEID = 10023,/* server has rebooted */ + NFS4ERR_OLD_STATEID = 10024,/* state is out of sync */ + NFS4ERR_BAD_STATEID = 10025,/* incorrect stateid */ + NFS4ERR_BAD_SEQID = 10026,/* request is out of seq. */ + NFS4ERR_NOT_SAME = 10027,/* verify - attrs not same */ + NFS4ERR_LOCK_RANGE = 10028,/* lock range not supported*/ + NFS4ERR_SYMLINK = 10029,/* should be file/directory*/ + NFS4ERR_RESTOREFH = 10030,/* no saved filehandle */ + NFS4ERR_LEASE_MOVED = 10031,/* some filesystem moved */ + NFS4ERR_ATTRNOTSUPP = 10032,/* recommended attr not sup*/ + NFS4ERR_NO_GRACE = 10033,/* reclaim outside of grace*/ + NFS4ERR_RECLAIM_BAD = 10034,/* reclaim error at server */ + NFS4ERR_RECLAIM_CONFLICT = 10035,/* conflict on reclaim */ + NFS4ERR_BADXDR = 10036,/* XDR decode failed */ + NFS4ERR_LOCKS_HELD = 10037,/* file locks held at CLOSE*/ + NFS4ERR_OPENMODE = 10038,/* conflict in OPEN and I/O*/ + NFS4ERR_BADOWNER = 10039,/* owner translation bad */ + NFS4ERR_BADCHAR = 10040,/* utf-8 char not supported*/ + NFS4ERR_BADNAME = 10041,/* name not supported */ + NFS4ERR_BAD_RANGE = 10042,/* lock range not supported*/ + NFS4ERR_LOCK_NOTSUPP = 10043,/* no atomic up/downgrade */ + NFS4ERR_OP_ILLEGAL = 10044,/* undefined operation */ + NFS4ERR_DEADLOCK = 10045,/* file locking deadlock */ + NFS4ERR_FILE_OPEN = 10046,/* open file blocks op. */ + NFS4ERR_ADMIN_REVOKED = 10047,/* lockowner state revoked */ + NFS4ERR_CB_PATH_DOWN = 10048 /* callback path down */ +}; + +/* + * Basic data types + */ +typedef uint32_t bitmap4<>; +typedef uint64_t offset4; +typedef uint32_t count4; +typedef uint64_t length4; +typedef uint64_t clientid4; +typedef uint32_t seqid4; +typedef opaque utf8string<>; +typedef utf8string utf8str_cis; +typedef utf8string utf8str_cs; +typedef utf8string utf8str_mixed; +typedef utf8str_cs component4; +typedef component4 pathname4<>; +typedef uint64_t nfs_lockid4; +typedef uint64_t nfs_cookie4; +typedef utf8str_cs linktext4; +typedef opaque sec_oid4<>; +typedef uint32_t qop4; +typedef uint32_t mode4; +typedef uint64_t changeid4; +typedef opaque verifier4[NFS4_VERIFIER_SIZE]; + +/* + * Timeval + */ +struct nfstime4 { + int64_t seconds; + uint32_t nseconds; +}; + +enum time_how4 { + SET_TO_SERVER_TIME4 = 0, + SET_TO_CLIENT_TIME4 = 1 +}; + +union settime4 switch (time_how4 set_it) { + case SET_TO_CLIENT_TIME4: + nfstime4 time; + default: + void; +}; + +/* + * File access handle + */ +typedef opaque nfs_fh4<NFS4_FHSIZE>; + + +/* + * File attribute definitions + */ + +/* + * FSID structure for major/minor + */ +struct fsid4 { + uint64_t major; + uint64_t minor; +}; + +/* + * Filesystem locations attribute for relocation/migration + */ +struct fs_location4 { + utf8str_cis server<>; + pathname4 rootpath; +}; + +struct fs_locations4 { + pathname4 fs_root; + fs_location4 locations<>; +}; + +/* + * Various Access Control Entry definitions + */ + +/* + * Mask that indicates which Access Control Entries are supported. + * Values for the fattr4_aclsupport attribute. + */ +const ACL4_SUPPORT_ALLOW_ACL = 0x00000001; +const ACL4_SUPPORT_DENY_ACL = 0x00000002; +const ACL4_SUPPORT_AUDIT_ACL = 0x00000004; +const ACL4_SUPPORT_ALARM_ACL = 0x00000008; + + +typedef uint32_t acetype4; + +/* + * acetype4 values, others can be added as needed. + */ +const ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000; +const ACE4_ACCESS_DENIED_ACE_TYPE = 0x00000001; +const ACE4_SYSTEM_AUDIT_ACE_TYPE = 0x00000002; +const ACE4_SYSTEM_ALARM_ACE_TYPE = 0x00000003; + + +/* + * ACE flag + */ +typedef uint32_t aceflag4; + +/* + * ACE flag values + */ +const ACE4_FILE_INHERIT_ACE = 0x00000001; +const ACE4_DIRECTORY_INHERIT_ACE = 0x00000002; +const ACE4_NO_PROPAGATE_INHERIT_ACE = 0x00000004; +const ACE4_INHERIT_ONLY_ACE = 0x00000008; +const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG = 0x00000010; +const ACE4_FAILED_ACCESS_ACE_FLAG = 0x00000020; +const ACE4_IDENTIFIER_GROUP = 0x00000040; + + +/* + * ACE mask + */ +typedef uint32_t acemask4; + +/* + * ACE mask values + */ +const ACE4_READ_DATA = 0x00000001; +const ACE4_LIST_DIRECTORY = 0x00000001; +const ACE4_WRITE_DATA = 0x00000002; +const ACE4_ADD_FILE = 0x00000002; +const ACE4_APPEND_DATA = 0x00000004; +const ACE4_ADD_SUBDIRECTORY = 0x00000004; +const ACE4_READ_NAMED_ATTRS = 0x00000008; +const ACE4_WRITE_NAMED_ATTRS = 0x00000010; +const ACE4_EXECUTE = 0x00000020; +const ACE4_DELETE_CHILD = 0x00000040; +const ACE4_READ_ATTRIBUTES = 0x00000080; +const ACE4_WRITE_ATTRIBUTES = 0x00000100; + +const ACE4_DELETE = 0x00010000; +const ACE4_READ_ACL = 0x00020000; +const ACE4_WRITE_ACL = 0x00040000; +const ACE4_WRITE_OWNER = 0x00080000; +const ACE4_SYNCHRONIZE = 0x00100000; + +/* + * ACE4_GENERIC_READ -- defined as combination of + * ACE4_READ_ACL | + * ACE4_READ_DATA | + * ACE4_READ_ATTRIBUTES | + * ACE4_SYNCHRONIZE + */ + +const ACE4_GENERIC_READ = 0x00120081; + +/* + * ACE4_GENERIC_WRITE -- defined as combination of + * ACE4_READ_ACL | + * ACE4_WRITE_DATA | + * ACE4_WRITE_ATTRIBUTES | + * ACE4_WRITE_ACL | + * ACE4_APPEND_DATA | + * ACE4_SYNCHRONIZE + */ +const ACE4_GENERIC_WRITE = 0x00160106; + + +/* + * ACE4_GENERIC_EXECUTE -- defined as combination of + * ACE4_READ_ACL + * ACE4_READ_ATTRIBUTES + * ACE4_EXECUTE + * ACE4_SYNCHRONIZE + */ +const ACE4_GENERIC_EXECUTE = 0x001200A0; + + +/* + * Access Control Entry definition + */ +struct nfsace4 { + acetype4 type; + aceflag4 flag; + acemask4 access_mask; + utf8str_mixed who; +}; + +/* + * Field definitions for the fattr4_mode attribute + */ +const MODE4_SUID = 0x800; /* set user id on execution */ +const MODE4_SGID = 0x400; /* set group id on execution */ +const MODE4_SVTX = 0x200; /* save text even after use */ +const MODE4_RUSR = 0x100; /* read permission: owner */ +const MODE4_WUSR = 0x080; /* write permission: owner */ +const MODE4_XUSR = 0x040; /* execute permission: owner */ +const MODE4_RGRP = 0x020; /* read permission: group */ +const MODE4_WGRP = 0x010; /* write permission: group */ +const MODE4_XGRP = 0x008; /* execute permission: group */ +const MODE4_ROTH = 0x004; /* read permission: other */ +const MODE4_WOTH = 0x002; /* write permission: other */ +const MODE4_XOTH = 0x001; /* execute permission: other */ + +/* + * Special data/attribute associated with + * file types NF4BLK and NF4CHR. + */ +struct specdata4 { + uint32_t specdata1; /* major device number */ + uint32_t specdata2; /* minor device number */ +}; + +/* + * Values for fattr4_fh_expire_type + */ +const FH4_PERSISTENT = 0x00000000; +const FH4_NOEXPIRE_WITH_OPEN = 0x00000001; +const FH4_VOLATILE_ANY = 0x00000002; +const FH4_VOL_MIGRATION = 0x00000004; +const FH4_VOL_RENAME = 0x00000008; + + +typedef bitmap4 fattr4_supported_attrs; +typedef nfs_ftype4 fattr4_type; +typedef uint32_t fattr4_fh_expire_type; +typedef changeid4 fattr4_change; +typedef uint64_t fattr4_size; +typedef bool fattr4_link_support; +typedef bool fattr4_symlink_support; +typedef bool fattr4_named_attr; +typedef fsid4 fattr4_fsid; +typedef bool fattr4_unique_handles; +typedef uint32_t fattr4_lease_time; +typedef nfsstat4 fattr4_rdattr_error; + +typedef nfsace4 fattr4_acl<>; +typedef uint32_t fattr4_aclsupport; +typedef bool fattr4_archive; +typedef bool fattr4_cansettime; +typedef bool fattr4_case_insensitive; +typedef bool fattr4_case_preserving; +typedef bool fattr4_chown_restricted; +typedef uint64_t fattr4_fileid; +typedef uint64_t fattr4_files_avail; +typedef nfs_fh4 fattr4_filehandle; +typedef uint64_t fattr4_files_free; +typedef uint64_t fattr4_files_total; +typedef fs_locations4 fattr4_fs_locations; +typedef bool fattr4_hidden; +typedef bool fattr4_homogeneous; +typedef uint64_t fattr4_maxfilesize; +typedef uint32_t fattr4_maxlink; +typedef uint32_t fattr4_maxname; +typedef uint64_t fattr4_maxread; +typedef uint64_t fattr4_maxwrite; +typedef utf8str_cs fattr4_mimetype; +typedef mode4 fattr4_mode; +typedef uint64_t fattr4_mounted_on_fileid; +typedef bool fattr4_no_trunc; +typedef uint32_t fattr4_numlinks; +typedef utf8str_mixed fattr4_owner; +typedef utf8str_mixed fattr4_owner_group; +typedef uint64_t fattr4_quota_avail_hard; +typedef uint64_t fattr4_quota_avail_soft; +typedef uint64_t fattr4_quota_used; +typedef specdata4 fattr4_rawdev; +typedef uint64_t fattr4_space_avail; +typedef uint64_t fattr4_space_free; +typedef uint64_t fattr4_space_total; +typedef uint64_t fattr4_space_used; +typedef bool fattr4_system; +typedef nfstime4 fattr4_time_access; +typedef settime4 fattr4_time_access_set; +typedef nfstime4 fattr4_time_backup; +typedef nfstime4 fattr4_time_create; +typedef nfstime4 fattr4_time_delta; +typedef nfstime4 fattr4_time_metadata; +typedef nfstime4 fattr4_time_modify; +typedef settime4 fattr4_time_modify_set; + + +/* + * Mandatory Attributes + */ +const FATTR4_SUPPORTED_ATTRS = 0; +const FATTR4_TYPE = 1; +const FATTR4_FH_EXPIRE_TYPE = 2; +const FATTR4_CHANGE = 3; +const FATTR4_SIZE = 4; +const FATTR4_LINK_SUPPORT = 5; +const FATTR4_SYMLINK_SUPPORT = 6; +const FATTR4_NAMED_ATTR = 7; +const FATTR4_FSID = 8; +const FATTR4_UNIQUE_HANDLES = 9; +const FATTR4_LEASE_TIME = 10; +const FATTR4_RDATTR_ERROR = 11; +const FATTR4_FILEHANDLE = 19; + +/* + * Recommended Attributes + */ +const FATTR4_ACL = 12; +const FATTR4_ACLSUPPORT = 13; +const FATTR4_ARCHIVE = 14; +const FATTR4_CANSETTIME = 15; +const FATTR4_CASE_INSENSITIVE = 16; +const FATTR4_CASE_PRESERVING = 17; +const FATTR4_CHOWN_RESTRICTED = 18; +const FATTR4_FILEID = 20; +const FATTR4_FILES_AVAIL = 21; +const FATTR4_FILES_FREE = 22; +const FATTR4_FILES_TOTAL = 23; +const FATTR4_FS_LOCATIONS = 24; +const FATTR4_HIDDEN = 25; +const FATTR4_HOMOGENEOUS = 26; +const FATTR4_MAXFILESIZE = 27; +const FATTR4_MAXLINK = 28; +const FATTR4_MAXNAME = 29; +const FATTR4_MAXREAD = 30; +const FATTR4_MAXWRITE = 31; +const FATTR4_MIMETYPE = 32; +const FATTR4_MODE = 33; +const FATTR4_NO_TRUNC = 34; +const FATTR4_NUMLINKS = 35; +const FATTR4_OWNER = 36; +const FATTR4_OWNER_GROUP = 37; +const FATTR4_QUOTA_AVAIL_HARD = 38; +const FATTR4_QUOTA_AVAIL_SOFT = 39; +const FATTR4_QUOTA_USED = 40; +const FATTR4_RAWDEV = 41; +const FATTR4_SPACE_AVAIL = 42; +const FATTR4_SPACE_FREE = 43; +const FATTR4_SPACE_TOTAL = 44; +const FATTR4_SPACE_USED = 45; +const FATTR4_SYSTEM = 46; +const FATTR4_TIME_ACCESS = 47; +const FATTR4_TIME_ACCESS_SET = 48; +const FATTR4_TIME_BACKUP = 49; +const FATTR4_TIME_CREATE = 50; +const FATTR4_TIME_DELTA = 51; +const FATTR4_TIME_METADATA = 52; +const FATTR4_TIME_MODIFY = 53; +const FATTR4_TIME_MODIFY_SET = 54; +const FATTR4_MOUNTED_ON_FILEID = 55; + +typedef opaque attrlist4<>; + +/* + * File attribute container + */ +struct fattr4 { + bitmap4 attrmask; + attrlist4 attr_vals; +}; + +/* + * Change info for the client + */ +struct change_info4 { + bool atomic; + changeid4 before; + changeid4 after; +}; + +struct clientaddr4 { + /* see struct rpcb in RFC 1833 */ + string r_netid<>; /* network id */ + string r_addr<>; /* universal address */ +}; + +/* + * Callback program info as provided by the client + */ +struct cb_client4 { + uint32_t cb_program; + clientaddr4 cb_location; +}; + +/* + * Stateid + */ +struct stateid4 { + uint32_t seqid; + opaque other[12]; +}; + +/* + * Client ID + */ +struct nfs_client_id4 { + verifier4 verifier; + opaque id<NFS4_OPAQUE_LIMIT>; +}; + +struct open_owner4 { + clientid4 clientid; + opaque owner<NFS4_OPAQUE_LIMIT>; +}; + +struct lock_owner4 { + clientid4 clientid; + opaque owner<NFS4_OPAQUE_LIMIT>; +}; + +enum nfs_lock_type4 { + READ_LT = 1, + WRITE_LT = 2, + READW_LT = 3, /* blocking read */ + WRITEW_LT = 4 /* blocking write */ +}; + +/* + * ACCESS: Check access permission + */ +const ACCESS4_READ = 0x00000001; +const ACCESS4_LOOKUP = 0x00000002; +const ACCESS4_MODIFY = 0x00000004; +const ACCESS4_EXTEND = 0x00000008; +const ACCESS4_DELETE = 0x00000010; +const ACCESS4_EXECUTE = 0x00000020; + +struct ACCESS4args { + /* CURRENT_FH: object */ + uint32_t access; +}; + +struct ACCESS4resok { + uint32_t supported; + uint32_t access; +}; + +union ACCESS4res switch (nfsstat4 status) { + case NFS4_OK: + ACCESS4resok resok4; + default: + void; +}; + +/* + * CLOSE: Close a file and release share reservations + */ +struct CLOSE4args { + /* CURRENT_FH: object */ + seqid4 seqid; + stateid4 open_stateid; +}; + +union CLOSE4res switch (nfsstat4 status) { + case NFS4_OK: + stateid4 open_stateid; + default: + void; +}; + +/* + * COMMIT: Commit cached data on server to stable storage + */ +struct COMMIT4args { + /* CURRENT_FH: file */ + offset4 offset; + count4 count; +}; + +struct COMMIT4resok { + verifier4 writeverf; +}; + + +union COMMIT4res switch (nfsstat4 status) { + case NFS4_OK: + COMMIT4resok resok4; + default: + void; +}; + +/* + * CREATE: Create a non-regular file + */ +union createtype4 switch (nfs_ftype4 type) { + case NF4LNK: + linktext4 linkdata; + case NF4BLK: + case NF4CHR: + specdata4 devdata; + case NF4SOCK: + case NF4FIFO: + case NF4DIR: + void; + default: + void; /* server should return NFS4ERR_BADTYPE */ +}; + +struct CREATE4args { + /* CURRENT_FH: directory for creation */ + createtype4 objtype; + component4 objname; + fattr4 createattrs; +}; + +struct CREATE4resok { + change_info4 cinfo; + bitmap4 attrset; /* attributes set */ +}; + +union CREATE4res switch (nfsstat4 status) { + case NFS4_OK: + CREATE4resok resok4; + default: + void; +}; + +/* + * DELEGPURGE: Purge Delegations Awaiting Recovery + */ +struct DELEGPURGE4args { + clientid4 clientid; +}; + +struct DELEGPURGE4res { + nfsstat4 status; +}; + +/* + * DELEGRETURN: Return a delegation + */ +struct DELEGRETURN4args { + /* CURRENT_FH: delegated file */ + stateid4 deleg_stateid; +}; + +struct DELEGRETURN4res { + nfsstat4 status; +}; + +/* + * GETATTR: Get file attributes + */ +struct GETATTR4args { + /* CURRENT_FH: directory or file */ + bitmap4 attr_request; +}; + +struct GETATTR4resok { + fattr4 obj_attributes; +}; + +union GETATTR4res switch (nfsstat4 status) { + case NFS4_OK: + GETATTR4resok resok4; + default: + void; +}; + +/* + * GETFH: Get current filehandle + */ +struct GETFH4resok { + nfs_fh4 object; +}; + +union GETFH4res switch (nfsstat4 status) { + case NFS4_OK: + GETFH4resok resok4; + default: + void; +}; + +/* + * LINK: Create link to an object + */ +struct LINK4args { + /* SAVED_FH: source object */ + /* CURRENT_FH: target directory */ + component4 newname; +}; + +struct LINK4resok { + change_info4 cinfo; +}; + +union LINK4res switch (nfsstat4 status) { + case NFS4_OK: + LINK4resok resok4; + default: + void; +}; + +/* + * For LOCK, transition from open_owner to new lock_owner + */ +struct open_to_lock_owner4 { + seqid4 open_seqid; + stateid4 open_stateid; + seqid4 lock_seqid; + lock_owner4 lock_owner; +}; + +/* + * For LOCK, existing lock_owner continues to request file locks + */ +struct exist_lock_owner4 { + stateid4 lock_stateid; + seqid4 lock_seqid; +}; + +union locker4 switch (bool new_lock_owner) { + case TRUE: + open_to_lock_owner4 open_owner; + case FALSE: + exist_lock_owner4 lock_owner; +}; + +/* + * LOCK/LOCKT/LOCKU: Record lock management + */ +struct LOCK4args { + /* CURRENT_FH: file */ + nfs_lock_type4 locktype; + bool reclaim; + offset4 offset; + length4 length; + locker4 locker; +}; + +struct LOCK4denied { + offset4 offset; + length4 length; + nfs_lock_type4 locktype; + lock_owner4 owner; +}; + +struct LOCK4resok { + stateid4 lock_stateid; +}; + +union LOCK4res switch (nfsstat4 status) { + case NFS4_OK: + LOCK4resok resok4; + case NFS4ERR_DENIED: + LOCK4denied denied; + default: + void; +}; + +struct LOCKT4args { + /* CURRENT_FH: file */ + nfs_lock_type4 locktype; + offset4 offset; + length4 length; + lock_owner4 owner; +}; + +union LOCKT4res switch (nfsstat4 status) { + case NFS4ERR_DENIED: + LOCK4denied denied; + case NFS4_OK: + void; + default: + void; +}; + +struct LOCKU4args { + /* CURRENT_FH: file */ + nfs_lock_type4 locktype; + seqid4 seqid; + stateid4 lock_stateid; + offset4 offset; + length4 length; +}; + +union LOCKU4res switch (nfsstat4 status) { + case NFS4_OK: + stateid4 lock_stateid; + default: + void; +}; + +/* + * LOOKUP: Lookup filename + */ +struct LOOKUP4args { + /* CURRENT_FH: directory */ + component4 objname; +}; + +struct LOOKUP4res { + /* CURRENT_FH: object */ + nfsstat4 status; +}; + +/* + * LOOKUPP: Lookup parent directory + */ +struct LOOKUPP4res { + /* CURRENT_FH: directory */ + nfsstat4 status; +}; + +/* + * NVERIFY: Verify attributes different + */ +struct NVERIFY4args { + /* CURRENT_FH: object */ + fattr4 obj_attributes; +}; + +struct NVERIFY4res { + nfsstat4 status; +}; + +/* + * Various definitions for OPEN + */ +enum createmode4 { + UNCHECKED4 = 0, + GUARDED4 = 1, + EXCLUSIVE4 = 2 +}; + +union createhow4 switch (createmode4 mode) { + case UNCHECKED4: + case GUARDED4: + fattr4 createattrs; + case EXCLUSIVE4: + verifier4 createverf; +}; + +enum opentype4 { + OPEN4_NOCREATE = 0, + OPEN4_CREATE = 1 +}; + +union openflag4 switch (opentype4 opentype) { + case OPEN4_CREATE: + createhow4 how; + default: + void; +}; + +/* Next definitions used for OPEN delegation */ +enum limit_by4 { + NFS_LIMIT_SIZE = 1, + NFS_LIMIT_BLOCKS = 2 + /* others as needed */ +}; + +struct nfs_modified_limit4 { + uint32_t num_blocks; + uint32_t bytes_per_block; +}; + +union nfs_space_limit4 switch (limit_by4 limitby) { + /* limit specified as file size */ + case NFS_LIMIT_SIZE: + uint64_t filesize; + /* limit specified by number of blocks */ + case NFS_LIMIT_BLOCKS: + nfs_modified_limit4 mod_blocks; +} ; + +/* + * Share Access and Deny constants for open argument + */ +const OPEN4_SHARE_ACCESS_READ = 0x00000001; +const OPEN4_SHARE_ACCESS_WRITE = 0x00000002; +const OPEN4_SHARE_ACCESS_BOTH = 0x00000003; + +const OPEN4_SHARE_DENY_NONE = 0x00000000; +const OPEN4_SHARE_DENY_READ = 0x00000001; +const OPEN4_SHARE_DENY_WRITE = 0x00000002; +const OPEN4_SHARE_DENY_BOTH = 0x00000003; + +enum open_delegation_type4 { + OPEN_DELEGATE_NONE = 0, + OPEN_DELEGATE_READ = 1, + OPEN_DELEGATE_WRITE = 2 +}; + +enum open_claim_type4 { + CLAIM_NULL = 0, + CLAIM_PREVIOUS = 1, + CLAIM_DELEGATE_CUR = 2, + CLAIM_DELEGATE_PREV = 3 +}; + +struct open_claim_delegate_cur4 { + stateid4 delegate_stateid; + component4 file; +}; + +union open_claim4 switch (open_claim_type4 claim) { + /* + * No special rights to file. Ordinary OPEN of the specified file. + */ + case CLAIM_NULL: + /* CURRENT_FH: directory */ + component4 file; + + /* + * Right to the file established by an open previous to server + * reboot. File identified by filehandle obtained at that time + * rather than by name. + */ + case CLAIM_PREVIOUS: + /* CURRENT_FH: file being reclaimed */ + open_delegation_type4 delegate_type; + + /* + * Right to file based on a delegation granted by the server. + * File is specified by name. + */ + case CLAIM_DELEGATE_CUR: + /* CURRENT_FH: directory */ + open_claim_delegate_cur4 delegate_cur_info; + + /* Right to file based on a delegation granted to a previous boot + * instance of the client. File is specified by name. + */ + case CLAIM_DELEGATE_PREV: + /* CURRENT_FH: directory */ + component4 file_delegate_prev; +}; + +/* + * OPEN: Open a file, potentially receiving an open delegation + */ +struct OPEN4args { + seqid4 seqid; + uint32_t share_access; + uint32_t share_deny; + open_owner4 owner; + openflag4 openhow; + open_claim4 claim; +}; + +struct open_read_delegation4 { + stateid4 stateid; /* Stateid for delegation*/ + bool recall; /* Pre-recalled flag for + delegations obtained + by reclaim + (CLAIM_PREVIOUS) */ + nfsace4 permissions; /* Defines users who don't + need an ACCESS call to + open for read */ +}; + +struct open_write_delegation4 { + stateid4 stateid; /* Stateid for delegation */ + bool recall; /* Pre-recalled flag for + delegations obtained + by reclaim + (CLAIM_PREVIOUS) */ + nfs_space_limit4 space_limit; /* Defines condition that + the client must check to + determine whether the + file needs to be flushed + to the server on close. + */ + nfsace4 permissions; /* Defines users who don't + need an ACCESS call as + part of a delegated + open. */ +}; + +union open_delegation4 +switch (open_delegation_type4 delegation_type) { + case OPEN_DELEGATE_NONE: + void; + case OPEN_DELEGATE_READ: + open_read_delegation4 read; + case OPEN_DELEGATE_WRITE: + open_write_delegation4 write; +}; + +/* + * Result flags + */ +/* Client must confirm open */ +const OPEN4_RESULT_CONFIRM = 0x00000002; +/* Type of file locking behavior at the server */ +const OPEN4_RESULT_LOCKTYPE_POSIX = 0x00000004; + +struct OPEN4resok { + stateid4 stateid; /* Stateid for open */ + change_info4 cinfo; /* Directory Change Info */ + uint32_t rflags; /* Result flags */ + bitmap4 attrset; /* attribute set for create*/ + open_delegation4 delegation; /* Info on any open + delegation */ +}; + +union OPEN4res switch (nfsstat4 status) { + case NFS4_OK: + /* CURRENT_FH: opened file */ + OPEN4resok resok4; + default: + void; +}; + +/* + * OPENATTR: open named attributes directory + */ +struct OPENATTR4args { + /* CURRENT_FH: object */ + bool createdir; +}; + +struct OPENATTR4res { + /* CURRENT_FH: named attr directory */ + nfsstat4 status; +}; + +/* + * OPEN_CONFIRM: confirm the open + */ +struct OPEN_CONFIRM4args { + /* CURRENT_FH: opened file */ + stateid4 open_stateid; + seqid4 seqid; +}; + +struct OPEN_CONFIRM4resok { + stateid4 open_stateid; +}; + +union OPEN_CONFIRM4res switch (nfsstat4 status) { + case NFS4_OK: + OPEN_CONFIRM4resok resok4; + default: + void; +}; + +/* + * OPEN_DOWNGRADE: downgrade the access/deny for a file + */ +struct OPEN_DOWNGRADE4args { + /* CURRENT_FH: opened file */ + stateid4 open_stateid; + seqid4 seqid; + uint32_t share_access; + uint32_t share_deny; +}; + +struct OPEN_DOWNGRADE4resok { + stateid4 open_stateid; +}; + +union OPEN_DOWNGRADE4res switch(nfsstat4 status) { + case NFS4_OK: + OPEN_DOWNGRADE4resok resok4; + default: + void; +}; + +/* + * PUTFH: Set current filehandle + */ +struct PUTFH4args { + nfs_fh4 object; +}; + +struct PUTFH4res { + /* CURRENT_FH: */ + nfsstat4 status; +}; + +/* + * PUTPUBFH: Set public filehandle + */ +struct PUTPUBFH4res { + /* CURRENT_FH: public fh */ + nfsstat4 status; +}; + +/* + * PUTROOTFH: Set root filehandle + */ +struct PUTROOTFH4res { + /* CURRENT_FH: root fh */ + nfsstat4 status; +}; + +/* + * READ: Read from file + */ +struct READ4args { + /* CURRENT_FH: file */ + stateid4 stateid; + offset4 offset; + count4 count; +}; + +struct READ4resok { + bool eof; + opaque data<>; +}; + +union READ4res switch (nfsstat4 status) { + case NFS4_OK: + READ4resok resok4; + default: + void; +}; + +/* + * READDIR: Read directory + */ +struct READDIR4args { + /* CURRENT_FH: directory */ + nfs_cookie4 cookie; + verifier4 cookieverf; + count4 dircount; + count4 maxcount; + bitmap4 attr_request; +}; + +struct entry4 { + nfs_cookie4 cookie; + component4 name; + fattr4 attrs; + entry4 *nextentry; +}; + +struct dirlist4 { + entry4 *entries; + bool eof; +}; + +struct READDIR4resok { + verifier4 cookieverf; + dirlist4 reply; +}; + + +union READDIR4res switch (nfsstat4 status) { + case NFS4_OK: + READDIR4resok resok4; + default: + void; +}; + + +/* + * READLINK: Read symbolic link + */ +struct READLINK4resok { + linktext4 link; +}; + +union READLINK4res switch (nfsstat4 status) { + case NFS4_OK: + READLINK4resok resok4; + default: + void; +}; + +/* + * REMOVE: Remove filesystem object + */ +struct REMOVE4args { + /* CURRENT_FH: directory */ + component4 target; +}; + +struct REMOVE4resok { + change_info4 cinfo; +}; + +union REMOVE4res switch (nfsstat4 status) { + case NFS4_OK: + REMOVE4resok resok4; + default: + void; +}; + +/* + * RENAME: Rename directory entry + */ +struct RENAME4args { + /* SAVED_FH: source directory */ + component4 oldname; + /* CURRENT_FH: target directory */ + component4 newname; +}; + +struct RENAME4resok { + change_info4 source_cinfo; + change_info4 target_cinfo; +}; + +union RENAME4res switch (nfsstat4 status) { + case NFS4_OK: + RENAME4resok resok4; + default: + void; +}; + +/* + * RENEW: Renew a Lease + */ +struct RENEW4args { + clientid4 clientid; +}; + +struct RENEW4res { + nfsstat4 status; +}; + +/* + * RESTOREFH: Restore saved filehandle + */ + +struct RESTOREFH4res { + /* CURRENT_FH: value of saved fh */ + nfsstat4 status; +}; + +/* + * SAVEFH: Save current filehandle + */ +struct SAVEFH4res { + /* SAVED_FH: value of current fh */ + nfsstat4 status; +}; + +/* + * SECINFO: Obtain Available Security Mechanisms + */ +struct SECINFO4args { + /* CURRENT_FH: directory */ + component4 name; +}; + +/* + * From RFC 2203 + */ +enum rpc_gss_svc_t { + RPC_GSS_SVC_NONE = 1, + RPC_GSS_SVC_INTEGRITY = 2, + RPC_GSS_SVC_PRIVACY = 3 +}; + +struct rpcsec_gss_info { + sec_oid4 oid; + qop4 qop; + rpc_gss_svc_t service; +}; + +/* RPCSEC_GSS has a value of '6' - See RFC 2203 */ +union secinfo4 switch (uint32_t flavor) { + case RPCSEC_GSS: + rpcsec_gss_info flavor_info; + default: + void; +}; + +typedef secinfo4 SECINFO4resok<>; + +union SECINFO4res switch (nfsstat4 status) { + case NFS4_OK: + SECINFO4resok resok4; + default: + void; +}; + +/* + * SETATTR: Set attributes + */ +struct SETATTR4args { + /* CURRENT_FH: target object */ + stateid4 stateid; + fattr4 obj_attributes; +}; + +struct SETATTR4res { + nfsstat4 status; + bitmap4 attrsset; +}; + +/* + * SETCLIENTID + */ +struct SETCLIENTID4args { + nfs_client_id4 client; + cb_client4 callback; + uint32_t callback_ident; +}; + +struct SETCLIENTID4resok { + clientid4 clientid; + verifier4 setclientid_confirm; +}; + +union SETCLIENTID4res switch (nfsstat4 status) { + case NFS4_OK: + SETCLIENTID4resok resok4; + case NFS4ERR_CLID_INUSE: + clientaddr4 client_using; + default: + void; +}; + +struct SETCLIENTID_CONFIRM4args { + clientid4 clientid; + verifier4 setclientid_confirm; +}; + +struct SETCLIENTID_CONFIRM4res { + nfsstat4 status; +}; + +/* + * VERIFY: Verify attributes same + */ +struct VERIFY4args { + /* CURRENT_FH: object */ + fattr4 obj_attributes; +}; + +struct VERIFY4res { + nfsstat4 status; +}; + +/* + * WRITE: Write to file + */ +enum stable_how4 { + UNSTABLE4 = 0, + DATA_SYNC4 = 1, + FILE_SYNC4 = 2 +}; + +struct WRITE4args { + /* CURRENT_FH: file */ + stateid4 stateid; + offset4 offset; + stable_how4 stable; + opaque data<>; +}; + +struct WRITE4resok { + count4 count; + stable_how4 committed; + verifier4 writeverf; +}; + +union WRITE4res switch (nfsstat4 status) { + case NFS4_OK: + WRITE4resok resok4; + default: + void; +}; + +/* + * RELEASE_LOCKOWNER: Notify server to release lockowner + */ +struct RELEASE_LOCKOWNER4args { + lock_owner4 lock_owner; +}; + +struct RELEASE_LOCKOWNER4res { + nfsstat4 status; +}; + +/* + * ILLEGAL: Response for illegal operation numbers + */ +struct ILLEGAL4res { + nfsstat4 status; +}; + +/* + * Operation arrays + */ + +enum nfs_opnum4 { + OP_ACCESS = 3, + OP_CLOSE = 4, + OP_COMMIT = 5, + OP_CREATE = 6, + OP_DELEGPURGE = 7, + OP_DELEGRETURN = 8, + OP_GETATTR = 9, + OP_GETFH = 10, + OP_LINK = 11, + OP_LOCK = 12, + OP_LOCKT = 13, + OP_LOCKU = 14, + OP_LOOKUP = 15, + OP_LOOKUPP = 16, + OP_NVERIFY = 17, + OP_OPEN = 18, + OP_OPENATTR = 19, + OP_OPEN_CONFIRM = 20, + OP_OPEN_DOWNGRADE = 21, + OP_PUTFH = 22, + OP_PUTPUBFH = 23, + OP_PUTROOTFH = 24, + OP_READ = 25, + OP_READDIR = 26, + OP_READLINK = 27, + OP_REMOVE = 28, + OP_RENAME = 29, + OP_RENEW = 30, + OP_RESTOREFH = 31, + OP_SAVEFH = 32, + OP_SECINFO = 33, + OP_SETATTR = 34, + OP_SETCLIENTID = 35, + OP_SETCLIENTID_CONFIRM = 36, + OP_VERIFY = 37, + OP_WRITE = 38, + OP_RELEASE_LOCKOWNER = 39, + OP_ILLEGAL = 10044 +}; + +union nfs_argop4 switch (nfs_opnum4 argop) { + case OP_ACCESS: ACCESS4args opaccess; + case OP_CLOSE: CLOSE4args opclose; + case OP_COMMIT: COMMIT4args opcommit; + case OP_CREATE: CREATE4args opcreate; + case OP_DELEGPURGE: DELEGPURGE4args opdelegpurge; + case OP_DELEGRETURN: DELEGRETURN4args opdelegreturn; + case OP_GETATTR: GETATTR4args opgetattr; + case OP_GETFH: void; + case OP_LINK: LINK4args oplink; + case OP_LOCK: LOCK4args oplock; + case OP_LOCKT: LOCKT4args oplockt; + case OP_LOCKU: LOCKU4args oplocku; + case OP_LOOKUP: LOOKUP4args oplookup; + case OP_LOOKUPP: void; + case OP_NVERIFY: NVERIFY4args opnverify; + case OP_OPEN: OPEN4args opopen; + case OP_OPENATTR: OPENATTR4args opopenattr; + case OP_OPEN_CONFIRM: OPEN_CONFIRM4args opopen_confirm; + case OP_OPEN_DOWNGRADE: OPEN_DOWNGRADE4args opopen_downgrade; + case OP_PUTFH: PUTFH4args opputfh; + case OP_PUTPUBFH: void; + case OP_PUTROOTFH: void; + case OP_READ: READ4args opread; + case OP_READDIR: READDIR4args opreaddir; + case OP_READLINK: void; + case OP_REMOVE: REMOVE4args opremove; + case OP_RENAME: RENAME4args oprename; + case OP_RENEW: RENEW4args oprenew; + case OP_RESTOREFH: void; + case OP_SAVEFH: void; + case OP_SECINFO: SECINFO4args opsecinfo; + case OP_SETATTR: SETATTR4args opsetattr; + case OP_SETCLIENTID: SETCLIENTID4args opsetclientid; + case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4args + opsetclientid_confirm; + case OP_VERIFY: VERIFY4args opverify; + case OP_WRITE: WRITE4args opwrite; + case OP_RELEASE_LOCKOWNER: RELEASE_LOCKOWNER4args + oprelease_lockowner; + case OP_ILLEGAL: void; +}; + +union nfs_resop4 switch (nfs_opnum4 resop){ + case OP_ACCESS: ACCESS4res opaccess; + case OP_CLOSE: CLOSE4res opclose; + case OP_COMMIT: COMMIT4res opcommit; + case OP_CREATE: CREATE4res opcreate; + case OP_DELEGPURGE: DELEGPURGE4res opdelegpurge; + case OP_DELEGRETURN: DELEGRETURN4res opdelegreturn; + case OP_GETATTR: GETATTR4res opgetattr; + case OP_GETFH: GETFH4res opgetfh; + case OP_LINK: LINK4res oplink; + case OP_LOCK: LOCK4res oplock; + case OP_LOCKT: LOCKT4res oplockt; + case OP_LOCKU: LOCKU4res oplocku; + case OP_LOOKUP: LOOKUP4res oplookup; + case OP_LOOKUPP: LOOKUPP4res oplookupp; + case OP_NVERIFY: NVERIFY4res opnverify; + case OP_OPEN: OPEN4res opopen; + case OP_OPENATTR: OPENATTR4res opopenattr; + case OP_OPEN_CONFIRM: OPEN_CONFIRM4res opopen_confirm; + case OP_OPEN_DOWNGRADE: OPEN_DOWNGRADE4res opopen_downgrade; + case OP_PUTFH: PUTFH4res opputfh; + case OP_PUTPUBFH: PUTPUBFH4res opputpubfh; + case OP_PUTROOTFH: PUTROOTFH4res opputrootfh; + case OP_READ: READ4res opread; + case OP_READDIR: READDIR4res opreaddir; + case OP_READLINK: READLINK4res opreadlink; + case OP_REMOVE: REMOVE4res opremove; + case OP_RENAME: RENAME4res oprename; + case OP_RENEW: RENEW4res oprenew; + case OP_RESTOREFH: RESTOREFH4res oprestorefh; + case OP_SAVEFH: SAVEFH4res opsavefh; + case OP_SECINFO: SECINFO4res opsecinfo; + case OP_SETATTR: SETATTR4res opsetattr; + case OP_SETCLIENTID: SETCLIENTID4res opsetclientid; + case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4res + opsetclientid_confirm; + case OP_VERIFY: VERIFY4res opverify; + case OP_WRITE: WRITE4res opwrite; + case OP_RELEASE_LOCKOWNER: RELEASE_LOCKOWNER4res + oprelease_lockowner; + case OP_ILLEGAL: ILLEGAL4res opillegal; +}; + +struct COMPOUND4args { + utf8str_cs tag; + uint32_t minorversion; + nfs_argop4 argarray<>; +}; + +struct COMPOUND4res { + nfsstat4 status; + utf8str_cs tag; + nfs_resop4 resarray<>; +}; + +/* + * Remote file service routines + */ +program NFS4_PROGRAM { + version NFS_V4 { + void + NFSPROC4_NULL(void) = 0; + + COMPOUND4res + NFSPROC4_COMPOUND(COMPOUND4args) = 1; + + } = 4; +} = 100003; + + + +/* + * NFS4 Callback Procedure Definitions and Program + */ + +/* + * CB_GETATTR: Get Current Attributes + */ +struct CB_GETATTR4args { + nfs_fh4 fh; + bitmap4 attr_request; +}; + +struct CB_GETATTR4resok { + fattr4 obj_attributes; +}; + +union CB_GETATTR4res switch (nfsstat4 status) { + case NFS4_OK: + CB_GETATTR4resok resok4; + default: + void; +}; + +/* + * CB_RECALL: Recall an Open Delegation + */ +struct CB_RECALL4args { + stateid4 stateid; + bool truncate; + nfs_fh4 fh; +}; + +struct CB_RECALL4res { + nfsstat4 status; +}; + +/* + * CB_ILLEGAL: Response for illegal operation numbers + */ +struct CB_ILLEGAL4res { + nfsstat4 status; +}; + +/* + * Various definitions for CB_COMPOUND + */ +enum nfs_cb_opnum4 { + OP_CB_GETATTR = 3, + OP_CB_RECALL = 4, + OP_CB_ILLEGAL = 10044 +}; + +union nfs_cb_argop4 switch (unsigned argop) { + case OP_CB_GETATTR: CB_GETATTR4args opcbgetattr; + case OP_CB_RECALL: CB_RECALL4args opcbrecall; + case OP_CB_ILLEGAL: void; +}; + +union nfs_cb_resop4 switch (unsigned resop){ + case OP_CB_GETATTR: CB_GETATTR4res opcbgetattr; + case OP_CB_RECALL: CB_RECALL4res opcbrecall; + case OP_CB_ILLEGAL: CB_ILLEGAL4res opcbillegal; +}; + +struct CB_COMPOUND4args { + utf8str_cs tag; + uint32_t minorversion; + uint32_t callback_ident; + nfs_cb_argop4 argarray<>; +}; + +struct CB_COMPOUND4res { + nfsstat4 status; + utf8str_cs tag; + nfs_cb_resop4 resarray<>; +}; + + +/* + * Program number is in the transient range since the client + * will assign the exact transient program number and provide + * that to the server via the SETCLIENTID operation. + */ +program NFS4_CALLBACK { + version NFS_CB { + void + CB_NULL(void) = 0; + CB_COMPOUND4res + CB_COMPOUND(CB_COMPOUND4args) = 1; + } = 1; +} = 0x40000000; diff --git a/usr/src/head/rpcsvc/nfs_acl.x b/usr/src/head/rpcsvc/nfs_acl.x new file mode 100644 index 0000000000..9a33fb5288 --- /dev/null +++ b/usr/src/head/rpcsvc/nfs_acl.x @@ -0,0 +1,383 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1994,2001-2003 Sun Microsystems, Inc. + * All rights reserved. + * Use is subject to license terms. + */ + +/* + * ident "%Z%%M% %I% %E% SMI" + */ + +const NFS_ACL_MAX_ENTRIES = 1024; + +typedef int uid; +typedef unsigned short o_mode; + +/* + * This is the format of an ACL which is passed over the network. + */ +struct aclent { + int type; + uid id; + o_mode perm; +}; + +/* + * The values for the type element of the aclent structure. + */ +const NA_USER_OBJ = 0x1; /* object owner */ +const NA_USER = 0x2; /* additional users */ +const NA_GROUP_OBJ = 0x4; /* owning group of the object */ +const NA_GROUP = 0x8; /* additional groups */ +const NA_CLASS_OBJ = 0x10; /* file group class and mask entry */ +const NA_OTHER_OBJ = 0x20; /* other entry for the object */ +const NA_ACL_DEFAULT = 0x1000; /* default flag */ + +/* + * The bit field values for the perm element of the aclent + * structure. The three values can be combined to form any + * of the 8 combinations. + */ +const NA_READ = 0x4; /* read permission */ +const NA_WRITE = 0x2; /* write permission */ +const NA_EXEC = 0x1; /* exec permission */ + +/* + * This is the structure which contains the ACL entries for a + * particular entity. It contains the ACL entries which apply + * to this object plus any default ACL entries which are + * inherited by its children. + * + * The values for the mask field are defined below. + */ +struct secattr { + u_int mask; + int aclcnt; + aclent aclent<NFS_ACL_MAX_ENTRIES>; + int dfaclcnt; + aclent dfaclent<NFS_ACL_MAX_ENTRIES>; +}; + +/* + * The values for the mask element of the secattr struct as well + * as for the mask element in the arguments in the GETACL2 and + * GETACL3 procedures. + */ +const NA_ACL = 0x1; /* aclent contains a valid list */ +const NA_ACLCNT = 0x2; /* the number of entries in the aclent list */ +const NA_DFACL = 0x4; /* dfaclent contains a valid list */ +const NA_DFACLCNT = 0x8; /* the number of entries in the dfaclent list */ + +/* + * This the definition for the GETACL procedure which applies to + * NFS Version 2. + */ +struct GETACL2args { + fhandle_t fh; + u_int mask; +}; + +struct GETACL2resok { + struct nfsfattr attr; + secattr acl; +}; + +union GETACL2res switch (enum nfsstat status) { +case ACL2_OK: + GETACL2resok resok; +default: + void; +}; + +/* + * This is the definition for the SETACL procedure which applies + * NFS Version 2. + */ +struct SETACL2args { + fhandle_t fh; + secattr acl; +}; + +struct SETACL2resok { + struct nfsfattr attr; +}; + +union SETACL2res switch (enum nfsstat status) { +case ACL2_OK: + SETACL2resok resok; +default: + void; +}; + +/* + * This is the definition for the GETATTR procedure which can be + * used as an alternative to the GETATTR in NFS Version 2. The + * main difference between this GETATTR and the NFS GETATTR is + * that this GETATTR returns the mode of the file without it being + * changed to match the min/max permissions mapping that the NFS + * Version 2 server does. + */ +struct GETATTR2args { + fhandle_t fh; +}; + +struct GETATTR2resok { + struct nfsfattr attr; +}; + +union GETATTR2res switch (enum nfsstat status) { +case ACL2_OK: + GETATTR2resok resok; +default: + void; +}; + +/* + * This is the definition for the ACCESS procedure which applies + * to NFS Version 2. + */ +struct ACCESS2args { + fhandle_t fh; + uint32 access; +}; + +/* + * The following access permissions may be requested: + */ +const ACCESS2_READ = 0x1; /* read data or readdir a directory */ +const ACCESS2_LOOKUP = 0x2; /* lookup a name in a directory */ +const ACCESS2_MODIFY = 0x4; /* rewrite existing file data or */ + /* modify existing directory entries */ +const ACCESS2_EXTEND = 0x8; /* write new data or add directory entries */ +const ACCESS2_DELETE = 0x10; /* delete existing directory entry */ +const ACCESS2_EXECUTE = 0x20; /* execute file (no meaning for a directory) */ + +struct ACCESS2resok { + struct nfsfattr attr; + uint32 access; +}; + +union ACCESS2res switch (enum nfsstat status) { +case ACL2_OK: + ACCESS2resok resok; +default: + void; +}; + +/* + * This is the definition for the GETXATTRDIR procedure which applies + * to NFS Version 2 files. + */ +struct GETXATTRDIR2args { + fhandle_t fh; + bool create; +}; + +struct GETXATTRDIR2resok { + fhandle_t fh; + struct nfsfattr attr; +}; + +union GETXATTRDIR2res switch (enum nfsstat status) { +case ACL2_OK: + GETXATTRDIR2resok resok; +default: + void; +}; + +/* + * This is the definition for the GETACL procedure which applies + * to NFS Version 3 files. + */ +struct GETACL3args { + nfs_fh3 fh; + u_int mask; +}; + +struct GETACL3resok { + post_op_attr attr; + secattr acl; +}; + +struct GETACL3resfail { + post_op_attr attr; +}; + +union GETACL3res switch (nfsstat3 status) { +case ACL3_OK: + GETACL3resok resok; +default: + GETACL3resfail resfail; +}; + +/* + * This is the definition for the SETACL procedure which applies + * to NFS Version 3 files. + */ +struct SETACL3args { + nfs_fh3 fh; + secattr acl; +}; + +struct SETACL3resok { + post_op_attr attr; +}; + +struct SETACL3resfail { + post_op_attr attr; +}; + +union SETACL3res switch (nfsstat3 status) { +case ACL3_OK: + SETACL3resok resok; +default: + SETACL3resfail resfail; +}; + +/* + * This is the definition for the GETXATTRDIR procedure which applies + * to NFS Version 3 files. + */ +struct GETXATTRDIR3args { + nfs_fh3 fh; + bool create; +}; + +struct GETXATTRDIR3resok { + nfs_fh3 fh; + post_op_attr attr; +}; + +union GETXATTRDIR3res switch (nfsstat3 status) { +case ACL3_OK: + GETXATTRDIR3resok resok; +default: + void; +}; + +/* + * XXX { + * This is a transitional interface to enable Solaris NFSv4 + * clients to manipulate ACLs on Solaris servers until the + * spec is complete enough to implement this inside the + * NFSv4 protocol itself. NFSv4 does handle extended + * attributes in-band. + */ + +/* + * This is the definition for the GETACL procedure which applies + * to NFS Version 4 files. + */ +struct GETACL4args { + nfs_fh4 fh; + u_int mask; +}; + +struct GETACL4resok { + post_op_attr attr; + secattr acl; +}; + +struct GETACL4resfail { + post_op_attr attr; +}; + +union GETACL4res switch (nfsstat3 status) { +case ACL4_OK: + GETACL4resok resok; +default: + GETACL4resfail resfail; +}; + +/* + * This is the definition for the SETACL procedure which applies + * to NFS Version 4 files. + */ +struct SETACL4args { + nfs_fh4 fh; + secattr acl; +}; + +struct SETACL4resok { + post_op_attr attr; +}; + +struct SETACL4resfail { + post_op_attr attr; +}; + +union SETACL4res switch (nfsstat3 status) { +case ACL4_OK: + SETACL4resok resok; +default: + SETACL4resfail resfail; +}; + +/* XXX } */ + +/* + * Share the port with the NFS service. NFS has to be running + * in order for this service to be useful anyway. + */ +const NFS_ACL_PORT = 2049; + +/* + * This is the definition for the ACL network protocol which is used + * to provide support for Solaris ACLs for files which are accessed + * via NFS Version 2 and NFS Version 3. + */ +program NFS_ACL_PROGRAM { + version NFS_ACL_V2 { + void + ACLPROC2_NULL(void) = 0; + GETACL2res + ACLPROC2_GETACL(GETACL2args) = 1; + SETACL2res + ACLPROC2_SETACL(SETACL2args) = 2; + GETATTR2res + ACLPROC2_GETATTR(GETATTR2args) = 3; + ACCESS2res + ACLPROC2_ACCESS(ACCESS2args) = 4; + GETXATTRDIR2res + ACLPROC2_GETXATTRDIR(GETXATTRDIR2args) = 5; + } = 2; + version NFS_ACL_V3 { + void + ACLPROC3_NULL(void) = 0; + GETACL3res + ACLPROC3_GETACL(GETACL3args) = 1; + SETACL3res + ACLPROC3_SETACL(SETACL3args) = 2; + GETXATTRDIR3res + ACLPROC3_GETXATTRDIR(GETXATTRDIR3args) = 3; + } = 3; + version NFS_ACL_V4 { + void + ACLPROC4_NULL(void) = 0; + GETACL4res + ACLPROC4_GETACL(GETACL4args) = 1; + SETACL4res + ACLPROC4_SETACL(SETACL4args) = 2; + } = 4; +} = 100227; diff --git a/usr/src/head/rpcsvc/nfs_prot.x b/usr/src/head/rpcsvc/nfs_prot.x new file mode 100644 index 0000000000..1601ccb9f9 --- /dev/null +++ b/usr/src/head/rpcsvc/nfs_prot.x @@ -0,0 +1,1265 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +%#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef RPC_HDR +% +%/* +% * Definitions for uint64, int64, uint32, and int32 +% */ +%#include <rpc/rpc_sztypes.h> +% +#endif + +const NFS_PORT = 2049; +const NFS_MAXDATA = 8192; +const NFS_MAXPATHLEN = 1024; +const NFS_MAXNAMLEN = 255; +const NFS_FHSIZE = 32; +const NFS_COOKIESIZE = 4; +const NFS_FIFO_DEV = -1; /* size kludge for named pipes */ + +/* + * File types + */ +const NFSMODE_FMT = 0170000; /* type of file */ +const NFSMODE_DIR = 0040000; /* directory */ +const NFSMODE_CHR = 0020000; /* character special */ +const NFSMODE_BLK = 0060000; /* block special */ +const NFSMODE_REG = 0100000; /* regular */ +const NFSMODE_LNK = 0120000; /* symbolic link */ +const NFSMODE_SOCK = 0140000; /* socket */ +const NFSMODE_FIFO = 0010000; /* fifo */ + +/* + * Error status + */ +enum nfsstat { + NFS_OK= 0, /* no error */ + NFSERR_PERM=1, /* Not owner */ + NFSERR_NOENT=2, /* No such file or directory */ + NFSERR_IO=5, /* I/O error */ + NFSERR_NXIO=6, /* No such device or address */ + NFSERR_ACCES=13, /* Permission denied */ + NFSERR_EXIST=17, /* File exists */ + NFSERR_XDEV=18, /* Cross-device link */ + NFSERR_NODEV=19, /* No such device */ + NFSERR_NOTDIR=20, /* Not a directory*/ + NFSERR_ISDIR=21, /* Is a directory */ + NFSERR_INVAL=22, /* Invalid argument */ + NFSERR_FBIG=27, /* File too large */ + NFSERR_NOSPC=28, /* No space left on device */ + NFSERR_ROFS=30, /* Read-only file system */ + NFSERR_OPNOTSUPP=45, /* Operation not supported */ + NFSERR_NAMETOOLONG=63, /* File name too long */ + NFSERR_NOTEMPTY=66, /* Directory not empty */ + NFSERR_DQUOT=69, /* Disc quota exceeded */ + NFSERR_STALE=70, /* Stale NFS file handle */ + NFSERR_REMOTE=71, /* Object is remote */ + NFSERR_WFLUSH=72 /* write cache flushed */ +}; + +/* + * File types + */ +enum ftype { + NFNON = 0, /* non-file */ + NFREG = 1, /* regular file */ + NFDIR = 2, /* directory */ + NFBLK = 3, /* block special */ + NFCHR = 4, /* character special */ + NFLNK = 5, /* symbolic link */ + NFSOCK = 6, /* unix domain sockets */ + NFBAD = 7, /* unused */ + NFFIFO = 8 /* named pipe */ +}; + +/* + * File access handle + */ +struct nfs_fh { + opaque data[NFS_FHSIZE]; +}; + +/* + * Timeval + */ +struct nfstime { + unsigned seconds; + unsigned useconds; +}; + + +/* + * File attributes + */ +struct fattr { + ftype type; /* file type */ + unsigned mode; /* protection mode bits */ + unsigned nlink; /* # hard links */ + unsigned uid; /* owner user id */ + unsigned gid; /* owner group id */ + unsigned size; /* file size in bytes */ + unsigned blocksize; /* prefered block size */ + unsigned rdev; /* special device # */ + unsigned blocks; /* Kb of disk used by file */ + unsigned fsid; /* device # */ + unsigned fileid; /* inode # */ + nfstime atime; /* time of last access */ + nfstime mtime; /* time of last modification */ + nfstime ctime; /* time of last change */ +}; + +/* + * File attributes which can be set + */ +struct sattr { + unsigned mode; /* protection mode bits */ + unsigned uid; /* owner user id */ + unsigned gid; /* owner group id */ + unsigned size; /* file size in bytes */ + nfstime atime; /* time of last access */ + nfstime mtime; /* time of last modification */ +}; + + +typedef string filename<NFS_MAXNAMLEN>; +typedef string nfspath<NFS_MAXPATHLEN>; + +/* + * Reply status with file attributes + */ +union attrstat switch (nfsstat status) { +case NFS_OK: + fattr attributes; +default: + void; +}; + +struct sattrargs { + nfs_fh file; + sattr attributes; +}; + +/* + * Arguments for directory operations + */ +struct diropargs { + nfs_fh dir; /* directory file handle */ + filename name; /* name (up to NFS_MAXNAMLEN bytes) */ +}; + +struct diropokres { + nfs_fh file; + fattr attributes; +}; + +/* + * Results from directory operation + */ +union diropres switch (nfsstat status) { +case NFS_OK: + diropokres diropres; +default: + void; +}; + +union readlinkres switch (nfsstat status) { +case NFS_OK: + nfspath data; +default: + void; +}; + +/* + * Arguments to remote read + */ +struct readargs { + nfs_fh file; /* handle for file */ + unsigned offset; /* byte offset in file */ + unsigned count; /* immediate read count */ + unsigned totalcount; /* total read count (from this offset)*/ +}; + +/* + * Status OK portion of remote read reply + */ +struct readokres { + fattr attributes; /* attributes, need for pagin*/ + opaque data<NFS_MAXDATA>; +}; + +union readres switch (nfsstat status) { +case NFS_OK: + readokres reply; +default: + void; +}; + +/* + * Arguments to remote write + */ +struct writeargs { + nfs_fh file; /* handle for file */ + unsigned beginoffset; /* beginning byte offset in file */ + unsigned offset; /* current byte offset in file */ + unsigned totalcount; /* total write count (to this offset)*/ + opaque data<NFS_MAXDATA>; +}; + +struct createargs { + diropargs where; + sattr attributes; +}; + +struct renameargs { + diropargs from; + diropargs to; +}; + +struct linkargs { + nfs_fh from; + diropargs to; +}; + +struct symlinkargs { + diropargs from; + nfspath to; + sattr attributes; +}; + + +typedef opaque nfscookie[NFS_COOKIESIZE]; + +/* + * Arguments to readdir + */ +struct readdirargs { + nfs_fh dir; /* directory handle */ + nfscookie cookie; + unsigned count; /* number of directory bytes to read */ +}; + +struct entry { + unsigned fileid; + filename name; + nfscookie cookie; + entry *nextentry; +}; + +struct dirlist { + entry *entries; + bool eof; +}; + +union readdirres switch (nfsstat status) { +case NFS_OK: + dirlist reply; +default: + void; +}; + +struct statfsokres { + unsigned tsize; /* preferred transfer size in bytes */ + unsigned bsize; /* fundamental file system block size */ + unsigned blocks; /* total blocks in file system */ + unsigned bfree; /* free blocks in fs */ + unsigned bavail; /* free blocks avail to non-superuser */ +}; + +union statfsres switch (nfsstat status) { +case NFS_OK: + statfsokres reply; +default: + void; +}; + +/* + * Remote file service routines + */ +program NFS_PROGRAM { + version NFS_VERSION { + void + NFSPROC_NULL(void) = 0; + + attrstat + NFSPROC_GETATTR(nfs_fh) = 1; + + attrstat + NFSPROC_SETATTR(sattrargs) = 2; + + void + NFSPROC_ROOT(void) = 3; + + diropres + NFSPROC_LOOKUP(diropargs) = 4; + + readlinkres + NFSPROC_READLINK(nfs_fh) = 5; + + readres + NFSPROC_READ(readargs) = 6; + + void + NFSPROC_WRITECACHE(void) = 7; + + attrstat + NFSPROC_WRITE(writeargs) = 8; + + diropres + NFSPROC_CREATE(createargs) = 9; + + nfsstat + NFSPROC_REMOVE(diropargs) = 10; + + nfsstat + NFSPROC_RENAME(renameargs) = 11; + + nfsstat + NFSPROC_LINK(linkargs) = 12; + + nfsstat + NFSPROC_SYMLINK(symlinkargs) = 13; + + diropres + NFSPROC_MKDIR(createargs) = 14; + + nfsstat + NFSPROC_RMDIR(diropargs) = 15; + + readdirres + NFSPROC_READDIR(readdirargs) = 16; + + statfsres + NFSPROC_STATFS(nfs_fh) = 17; + } = 2; +} = 100003; + +/* + * Version 3 declarations and definitions. + */ + +/* + * Sizes + */ +const NFS3_FHSIZE = 64; +const NFS3_COOKIEVERFSIZE = 8; +const NFS3_CREATEVERFSIZE = 8; +const NFS3_WRITEVERFSIZE = 8; + +/* + * Basic data types + */ +typedef string filename3<>; +typedef string nfspath3<>; +typedef uint64 fileid3; +typedef uint64 cookie3; +typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE]; +typedef opaque createverf3[NFS3_CREATEVERFSIZE]; +typedef opaque writeverf3[NFS3_WRITEVERFSIZE]; +typedef uint32 uid3; +typedef uint32 gid3; +typedef uint64 size3; +typedef uint64 offset3; +typedef uint32 mode3; +typedef uint32 count3; + +/* + * Error status + */ +enum nfsstat3 { + NFS3_OK = 0, + NFS3ERR_PERM = 1, + NFS3ERR_NOENT = 2, + NFS3ERR_IO = 5, + NFS3ERR_NXIO = 6, + NFS3ERR_ACCES = 13, + NFS3ERR_EXIST = 17, + NFS3ERR_XDEV = 18, + NFS3ERR_NODEV = 19, + NFS3ERR_NOTDIR = 20, + NFS3ERR_ISDIR = 21, + NFS3ERR_INVAL = 22, + NFS3ERR_FBIG = 27, + NFS3ERR_NOSPC = 28, + NFS3ERR_ROFS = 30, + NFS3ERR_MLINK = 31, + NFS3ERR_NAMETOOLONG = 63, + NFS3ERR_NOTEMPTY = 66, + NFS3ERR_DQUOT = 69, + NFS3ERR_STALE = 70, + NFS3ERR_REMOTE = 71, + NFS3ERR_BADHANDLE = 10001, + NFS3ERR_NOT_SYNC = 10002, + NFS3ERR_BAD_COOKIE = 10003, + NFS3ERR_NOTSUPP = 10004, + NFS3ERR_TOOSMALL = 10005, + NFS3ERR_SERVERFAULT = 10006, + NFS3ERR_BADTYPE = 10007, + NFS3ERR_JUKEBOX = 10008 +}; + +/* + * File types + */ +enum ftype3 { + NF3REG = 1, + NF3DIR = 2, + NF3BLK = 3, + NF3CHR = 4, + NF3LNK = 5, + NF3SOCK = 6, + NF3FIFO = 7 +}; + +struct specdata3 { + uint32 specdata1; + uint32 specdata2; +}; + +/* + * File access handle + */ +struct nfs_fh3 { + opaque data<NFS3_FHSIZE>; +}; + +/* + * Timeval + */ +struct nfstime3 { + uint32 seconds; + uint32 nseconds; +}; + +/* + * File attributes + */ +struct fattr3 { + ftype3 type; + mode3 mode; + uint32 nlink; + uid3 uid; + gid3 gid; + size3 size; + size3 used; + specdata3 rdev; + uint64 fsid; + fileid3 fileid; + nfstime3 atime; + nfstime3 mtime; + nfstime3 ctime; +}; + +/* + * File attributes + */ +union post_op_attr switch (bool attributes_follow) { +case TRUE: + fattr3 attributes; +case FALSE: + void; +}; + +struct wcc_attr { + size3 size; + nfstime3 mtime; + nfstime3 ctime; +}; + +union pre_op_attr switch (bool attributes_follow) { +case TRUE: + wcc_attr attributes; +case FALSE: + void; +}; + +struct wcc_data { + pre_op_attr before; + post_op_attr after; +}; + +union post_op_fh3 switch (bool handle_follows) { +case TRUE: + nfs_fh3 handle; +case FALSE: + void; +}; + +enum time_how { + DONT_CHANGE = 0, + SET_TO_SERVER_TIME = 1, + SET_TO_CLIENT_TIME = 2 +}; + +union set_mode3 switch (bool set_it) { +case TRUE: + mode3 mode; +default: + void; +}; + +union set_uid3 switch (bool set_it) { +case TRUE: + uid3 uid; +default: + void; +}; + +union set_gid3 switch (bool set_it) { +case TRUE: + gid3 gid; +default: + void; +}; + +union set_size3 switch (bool set_it) { +case TRUE: + size3 size; +default: + void; +}; + +union set_atime switch (time_how set_it) { +case SET_TO_CLIENT_TIME: + nfstime3 atime; +default: + void; +}; + +union set_mtime switch (time_how set_it) { +case SET_TO_CLIENT_TIME: + nfstime3 mtime; +default: + void; +}; + +struct sattr3 { + set_mode3 mode; + set_uid3 uid; + set_gid3 gid; + set_size3 size; + set_atime atime; + set_mtime mtime; +}; + +struct diropargs3 { + nfs_fh3 dir; + filename3 name; +}; + +/* + * GETATTR: Get file attributes + */ +struct GETATTR3args { + nfs_fh3 object; +}; + +struct GETATTR3resok { + fattr3 obj_attributes; +}; + +union GETATTR3res switch (nfsstat3 status) { +case NFS3_OK: + GETATTR3resok resok; +default: + void; +}; + +/* + * SETATTR: Set file attributes + */ +union sattrguard3 switch (bool check) { +case TRUE: + nfstime3 obj_ctime; +case FALSE: + void; +}; + +struct SETATTR3args { + nfs_fh3 object; + sattr3 new_attributes; + sattrguard3 guard; +}; + +struct SETATTR3resok { + wcc_data obj_wcc; +}; + +struct SETATTR3resfail { + wcc_data obj_wcc; +}; + +union SETATTR3res switch (nfsstat3 status) { +case NFS3_OK: + SETATTR3resok resok; +default: + SETATTR3resfail resfail; +}; + +/* + * LOOKUP: Lookup filename + */ +struct LOOKUP3args { + diropargs3 what; +}; + +struct LOOKUP3resok { + nfs_fh3 object; + post_op_attr obj_attributes; + post_op_attr dir_attributes; +}; + +struct LOOKUP3resfail { + post_op_attr dir_attributes; +}; + +union LOOKUP3res switch (nfsstat3 status) { +case NFS3_OK: + LOOKUP3resok resok; +default: + LOOKUP3resfail resfail; +}; + +/* + * ACCESS: Check access permission + */ +const ACCESS3_READ = 0x0001; +const ACCESS3_LOOKUP = 0x0002; +const ACCESS3_MODIFY = 0x0004; +const ACCESS3_EXTEND = 0x0008; +const ACCESS3_DELETE = 0x0010; +const ACCESS3_EXECUTE = 0x0020; + +struct ACCESS3args { + nfs_fh3 object; + uint32 access; +}; + +struct ACCESS3resok { + post_op_attr obj_attributes; + uint32 access; +}; + +struct ACCESS3resfail { + post_op_attr obj_attributes; +}; + +union ACCESS3res switch (nfsstat3 status) { +case NFS3_OK: + ACCESS3resok resok; +default: + ACCESS3resfail resfail; +}; + +/* + * READLINK: Read from symbolic link + */ +struct READLINK3args { + nfs_fh3 symlink; +}; + +struct READLINK3resok { + post_op_attr symlink_attributes; + nfspath3 data; +}; + +struct READLINK3resfail { + post_op_attr symlink_attributes; +}; + +union READLINK3res switch (nfsstat3 status) { +case NFS3_OK: + READLINK3resok resok; +default: + READLINK3resfail resfail; +}; + +/* + * READ: Read from file + */ +struct READ3args { + nfs_fh3 file; + offset3 offset; + count3 count; +}; + +struct READ3resok { + post_op_attr file_attributes; + count3 count; + bool eof; + opaque data<>; +}; + +struct READ3resfail { + post_op_attr file_attributes; +}; + +union READ3res switch (nfsstat3 status) { +case NFS3_OK: + READ3resok resok; +default: + READ3resfail resfail; +}; + +/* + * WRITE: Write to file + */ +enum stable_how { + UNSTABLE = 0, + DATA_SYNC = 1, + FILE_SYNC = 2 +}; + +struct WRITE3args { + nfs_fh3 file; + offset3 offset; + count3 count; + stable_how stable; + opaque data<>; +}; + +struct WRITE3resok { + wcc_data file_wcc; + count3 count; + stable_how committed; + writeverf3 verf; +}; + +struct WRITE3resfail { + wcc_data file_wcc; +}; + +union WRITE3res switch (nfsstat3 status) { +case NFS3_OK: + WRITE3resok resok; +default: + WRITE3resfail resfail; +}; + +/* + * CREATE: Create a file + */ +enum createmode3 { + UNCHECKED = 0, + GUARDED = 1, + EXCLUSIVE = 2 +}; + +union createhow3 switch (createmode3 mode) { +case UNCHECKED: +case GUARDED: + sattr3 obj_attributes; +case EXCLUSIVE: + createverf3 verf; +}; + +struct CREATE3args { + diropargs3 where; + createhow3 how; +}; + +struct CREATE3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; + +struct CREATE3resfail { + wcc_data dir_wcc; +}; + +union CREATE3res switch (nfsstat3 status) { +case NFS3_OK: + CREATE3resok resok; +default: + CREATE3resfail resfail; +}; + +/* + * MKDIR: Create a directory + */ +struct MKDIR3args { + diropargs3 where; + sattr3 attributes; +}; + +struct MKDIR3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; + +struct MKDIR3resfail { + wcc_data dir_wcc; +}; + +union MKDIR3res switch (nfsstat3 status) { +case NFS3_OK: + MKDIR3resok resok; +default: + MKDIR3resfail resfail; +}; + +/* + * SYMLINK: Create a symbolic link + */ +struct symlinkdata3 { + sattr3 symlink_attributes; + nfspath3 symlink_data; +}; + +struct SYMLINK3args { + diropargs3 where; + symlinkdata3 symlink; +}; + +struct SYMLINK3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; + +struct SYMLINK3resfail { + wcc_data dir_wcc; +}; + +union SYMLINK3res switch (nfsstat3 status) { +case NFS3_OK: + SYMLINK3resok resok; +default: + SYMLINK3resfail resfail; +}; + +/* + * MKNOD: Create a special file + */ +struct devicedata3 { + sattr3 dev_attributes; + specdata3 spec; +}; + +union mknoddata3 switch (ftype3 type) { +case NF3CHR: +case NF3BLK: + devicedata3 device; +case NF3SOCK: +case NF3FIFO: + sattr3 pipe_attributes; +default: + void; +}; + +struct MKNOD3args { + diropargs3 where; + mknoddata3 what; +}; + +struct MKNOD3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; + +struct MKNOD3resfail { + wcc_data dir_wcc; +}; + +union MKNOD3res switch (nfsstat3 status) { +case NFS3_OK: + MKNOD3resok resok; +default: + MKNOD3resfail resfail; +}; + +/* + * REMOVE: Remove a file + */ +struct REMOVE3args { + diropargs3 object; +}; + +struct REMOVE3resok { + wcc_data dir_wcc; +}; + +struct REMOVE3resfail { + wcc_data dir_wcc; +}; + +union REMOVE3res switch (nfsstat3 status) { +case NFS3_OK: + REMOVE3resok resok; +default: + REMOVE3resfail resfail; +}; + +/* + * RMDIR: Remove a directory + */ +struct RMDIR3args { + diropargs3 object; +}; + +struct RMDIR3resok { + wcc_data dir_wcc; +}; + +struct RMDIR3resfail { + wcc_data dir_wcc; +}; + +union RMDIR3res switch (nfsstat3 status) { +case NFS3_OK: + RMDIR3resok resok; +default: + RMDIR3resfail resfail; +}; + +/* + * RENAME: Rename a file or directory + */ +struct RENAME3args { + diropargs3 from; + diropargs3 to; +}; + +struct RENAME3resok { + wcc_data fromdir_wcc; + wcc_data todir_wcc; +}; + +struct RENAME3resfail { + wcc_data fromdir_wcc; + wcc_data todir_wcc; +}; + +union RENAME3res switch (nfsstat3 status) { +case NFS3_OK: + RENAME3resok resok; +default: + RENAME3resfail resfail; +}; + +/* + * LINK: Create link to an object + */ +struct LINK3args { + nfs_fh3 file; + diropargs3 link; +}; + +struct LINK3resok { + post_op_attr file_attributes; + wcc_data linkdir_wcc; +}; + +struct LINK3resfail { + post_op_attr file_attributes; + wcc_data linkdir_wcc; +}; + +union LINK3res switch (nfsstat3 status) { +case NFS3_OK: + LINK3resok resok; +default: + LINK3resfail resfail; +}; + +/* + * READDIR: Read from directory + */ +struct READDIR3args { + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 count; +}; + +struct entry3 { + fileid3 fileid; + filename3 name; + cookie3 cookie; + entry3 *nextentry; +}; + +struct dirlist3 { + entry3 *entries; + bool eof; +}; + +struct READDIR3resok { + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlist3 reply; +}; + +struct READDIR3resfail { + post_op_attr dir_attributes; +}; + +union READDIR3res switch (nfsstat3 status) { +case NFS3_OK: + READDIR3resok resok; +default: + READDIR3resfail resfail; +}; + +/* + * READDIRPLUS: Extended read from a directory + */ +struct READDIRPLUS3args { + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 dircount; + count3 maxcount; +}; + +struct entryplus3 { + fileid3 fileid; + filename3 name; + cookie3 cookie; + post_op_attr name_attributes; + post_op_fh3 name_handle; + entryplus3 *nextentry; +}; + +struct dirlistplus3 { + entryplus3 *entries; + bool eof; +}; + +struct READDIRPLUS3resok { + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlistplus3 reply; +}; + +struct READDIRPLUS3resfail { + post_op_attr dir_attributes; +}; + +union READDIRPLUS3res switch (nfsstat3 status) { +case NFS3_OK: + READDIRPLUS3resok resok; +default: + READDIRPLUS3resfail resfail; +}; + +/* + * FSSTAT: Get dynamic file system information + */ +struct FSSTAT3args { + nfs_fh3 fsroot; +}; + +struct FSSTAT3resok { + post_op_attr obj_attributes; + size3 tbytes; + size3 fbytes; + size3 abytes; + size3 tfiles; + size3 ffiles; + size3 afiles; + uint32 invarsec; +}; + +struct FSSTAT3resfail { + post_op_attr obj_attributes; +}; + +union FSSTAT3res switch (nfsstat3 status) { +case NFS3_OK: + FSSTAT3resok resok; +default: + FSSTAT3resfail resfail; +}; + +/* + * FSINFO: Get static file system information + */ + +const FSF3_LINK = 0x0001; +const FSF3_SYMLINK = 0x0002; +const FSF3_HOMOGENEOUS = 0x0008; +const FSF3_CANSETTIME = 0x0010; + +struct FSINFO3args { + nfs_fh3 fsroot; +}; + +struct FSINFO3resok { + post_op_attr obj_attributes; + uint32 rtmax; + uint32 rtpref; + uint32 rtmult; + uint32 wtmax; + uint32 wtpref; + uint32 wtmult; + uint32 dtpref; + size3 maxfilesize; + nfstime3 time_delta; + uint32 properties; +}; + +struct FSINFO3resfail { + post_op_attr obj_attributes; +}; + +union FSINFO3res switch (nfsstat3 status) { +case NFS3_OK: + FSINFO3resok resok; +default: + FSINFO3resfail resfail; +}; + +/* + * PATHCONF: Retrieve POSIX information + */ +struct PATHCONF3args { + nfs_fh3 object; +}; + +struct PATHCONF3resok { + post_op_attr obj_attributes; + uint32 linkmax; + uint32 name_max; + bool no_trunc; + bool chown_restricted; + bool case_insensitive; + bool case_preserving; +}; + +struct PATHCONF3resfail { + post_op_attr obj_attributes; +}; + +union PATHCONF3res switch (nfsstat3 status) { +case NFS3_OK: + PATHCONF3resok resok; +default: + PATHCONF3resfail resfail; +}; + +/* + * COMMIT: Commit cached data on a server to stable storage + */ +struct COMMIT3args { + nfs_fh3 file; + offset3 offset; + count3 count; +}; + +struct COMMIT3resok { + wcc_data file_wcc; + writeverf3 verf; +}; + +struct COMMIT3resfail { + wcc_data file_wcc; +}; + +union COMMIT3res switch (nfsstat3 status) { +case NFS3_OK: + COMMIT3resok resok; +default: + COMMIT3resfail resfail; +}; + +/* + * Remote file service routines + */ +program NFS3_PROGRAM { + version NFS_V3 { + void + NFSPROC3_NULL(void) = 0; + + GETATTR3res + NFSPROC3_GETATTR(GETATTR3args) = 1; + + SETATTR3res + NFSPROC3_SETATTR(SETATTR3args) = 2; + + LOOKUP3res + NFSPROC3_LOOKUP(LOOKUP3args) = 3; + + ACCESS3res + NFSPROC3_ACCESS(ACCESS3args) = 4; + + READLINK3res + NFSPROC3_READLINK(READLINK3args) = 5; + + READ3res + NFSPROC3_READ(READ3args) = 6; + + WRITE3res + NFSPROC3_WRITE(WRITE3args) = 7; + + CREATE3res + NFSPROC3_CREATE(CREATE3args) = 8; + + MKDIR3res + NFSPROC3_MKDIR(MKDIR3args) = 9; + + SYMLINK3res + NFSPROC3_SYMLINK(SYMLINK3args) = 10; + + MKNOD3res + NFSPROC3_MKNOD(MKNOD3args) = 11; + + REMOVE3res + NFSPROC3_REMOVE(REMOVE3args) = 12; + + RMDIR3res + NFSPROC3_RMDIR(RMDIR3args) = 13; + + RENAME3res + NFSPROC3_RENAME(RENAME3args) = 14; + + LINK3res + NFSPROC3_LINK(LINK3args) = 15; + + READDIR3res + NFSPROC3_READDIR(READDIR3args) = 16; + + READDIRPLUS3res + NFSPROC3_READDIRPLUS(READDIRPLUS3args) = 17; + + FSSTAT3res + NFSPROC3_FSSTAT(FSSTAT3args) = 18; + + FSINFO3res + NFSPROC3_FSINFO(FSINFO3args) = 19; + + PATHCONF3res + NFSPROC3_PATHCONF(PATHCONF3args) = 20; + + COMMIT3res + NFSPROC3_COMMIT(COMMIT3args) = 21; + } = 3; +} = 100003; diff --git a/usr/src/head/rpcsvc/nis.x b/usr/src/head/rpcsvc/nis.x new file mode 100644 index 0000000000..5dfc5c4c68 --- /dev/null +++ b/usr/src/head/rpcsvc/nis.x @@ -0,0 +1,502 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* + * RPC Language Protocol description file for NIS Plus + * + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * + * ident "%Z%%M% %I% %E% SMI" + * + * From 4.1 : @(#)nis.x 1.61 Copyright 1989 Sun Microsystems + */ +#ifdef RPC_HDR +%/* +% * nis.h +% * +% * This file is the main include file for NIS clients. It contains +% * both the client library function defines and the various data +% * structures used by the NIS service. It includes the file nis_tags.h +% * which defines the tag values. This allows the tags to change without +% * having to change the nis.x file. +% * +% * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when +% * rpcgen is run on the nis.x file. Note that there is a +% * simple sed script to remove some unneeded lines. (See the +% * Makefile target nis.h) +% * +% */ +%#include <rpcsvc/nis_tags.h> +#endif + +/* This gets stuffed into the source files. */ +#if RPC_HDR +%#include <rpc/xdr.h> +#endif +#if defined(RPC_XDR) || defined(RPC_CLNT) || defined(RPC_SVC) +%#ifndef xdr_uint32_t +%#define xdr_uint32_t xdr_u_int +%#endif +%#ifndef xdr_uint_t +%#define xdr_uint_t xdr_u_int +%#endif +#endif +#if RPC_SVC +%#include "nis_svc.h" +#endif + +/* Include the RPC Language description of NIS objects */ +#include "nis_object.x" + +/* Errors that can be returned by the service */ +enum nis_error { + NIS_SUCCESS = 0, /* A-ok, let's rock n roll */ + NIS_S_SUCCESS = 1, /* Name found (maybe) */ + NIS_NOTFOUND = 2, /* Name definitely not found */ + NIS_S_NOTFOUND = 3, /* Name maybe not found */ + NIS_CACHEEXPIRED = 4, /* Name exists but cache out of date */ + NIS_NAMEUNREACHABLE = 5, /* Can't get there from here */ + NIS_UNKNOWNOBJ = 6, /* Object type is bogus */ + NIS_TRYAGAIN = 7, /* I'm busy, call back */ + NIS_SYSTEMERROR = 8, /* Generic system error */ + NIS_CHAINBROKEN = 9, /* First/Next warning */ + NIS_PERMISSION = 10, /* Not enough permission to access */ + NIS_NOTOWNER = 11, /* You don't own it, sorry */ + NIS_NOT_ME = 12, /* I don't serve this name */ + NIS_NOMEMORY = 13, /* Outta VM! Help! */ + NIS_NAMEEXISTS = 14, /* Can't create over another name */ + NIS_NOTMASTER = 15, /* I'm justa secondaray, don't ask me */ + NIS_INVALIDOBJ = 16, /* Object is broken somehow */ + NIS_BADNAME = 17, /* Unparsable name */ + NIS_NOCALLBACK = 18, /* Couldn't talk to call back proc */ + NIS_CBRESULTS = 19, /* Results being called back to you */ + NIS_NOSUCHNAME = 20, /* Name unknown */ + NIS_NOTUNIQUE = 21, /* Value is not uniques (entry) */ + NIS_IBMODERROR = 22, /* Inf. Base. Modify error. */ + NIS_NOSUCHTABLE = 23, /* Name for table was wrong */ + NIS_TYPEMISMATCH = 24, /* Entry and table type mismatch */ + NIS_LINKNAMEERROR = 25, /* Link points to bogus name */ + NIS_PARTIAL = 26, /* Partial success, found table */ + NIS_TOOMANYATTRS = 27, /* Too many attributes */ + NIS_RPCERROR = 28, /* RPC error encountered */ + NIS_BADATTRIBUTE = 29, /* Bad or invalid attribute */ + NIS_NOTSEARCHABLE = 30, /* Non-searchable object searched */ + NIS_CBERROR = 31, /* Error during callback (svc crash) */ + NIS_FOREIGNNS = 32, /* Foreign Namespace */ + NIS_BADOBJECT = 33, /* Malformed object structure */ + NIS_NOTSAMEOBJ = 34, /* Object swapped during deletion */ + NIS_MODFAIL = 35, /* Failure during a Modify. */ + NIS_BADREQUEST = 36, /* Illegal query for table */ + NIS_NOTEMPTY = 37, /* Attempt to remove a non-empty tbl */ + NIS_COLDSTART_ERR = 38, /* Error accesing the cold start file */ + NIS_RESYNC = 39, /* Transaction log too far out of date */ + NIS_FAIL = 40, /* NIS operation failed. */ + NIS_UNAVAIL = 41, /* NIS+ service is unavailable (client) */ + NIS_RES2BIG = 42, /* NIS+ result too big for datagram */ + NIS_SRVAUTH = 43, /* NIS+ server wasn't authenticated. */ + NIS_CLNTAUTH = 44, /* NIS+ Client wasn't authenticated. */ + NIS_NOFILESPACE = 45, /* NIS+ server ran out of disk space */ + NIS_NOPROC = 46, /* NIS+ server couldn't create new proc */ + NIS_DUMPLATER = 47 /* NIS+ server already has dump child */ +}; + + +/* + * Structure definitions for the parameters and results of the actual + * NIS RPC calls. + * + * This is the standard result (in the protocol) of most of the nis + * requests. + */ + +struct nis_result { + nis_error status; /* Status of the response */ + nis_object objects<>; /* objects found */ + netobj cookie; /* Cookie Data */ + uint32_t zticks; /* server ticks */ + uint32_t dticks; /* DBM ticks. */ + uint32_t aticks; /* Cache (accel) ticks */ + uint32_t cticks; /* Client ticks */ +}; + +/* + * A Name Service request + * This request is used to access the name space, ns_name is the name + * of the object within the namespace and the object is it's value, for + * add/modify, a copy of the original for remove. + */ + +struct ns_request { + nis_name ns_name; /* Name in the NIS name space */ + nis_object ns_object<1>; /* Optional Object (add/remove) */ +}; + +/* + * An information base request + * This request includes the NIS name of the table we wish to search, the + * search criteria in the form of attribute/value pairs and an optional + * callback program number. If the callback program number is provided + * the server will send back objects one at a time, otherwise it will + * return them all in the response. + */ + +struct ib_request { + nis_name ibr_name; /* The name of the Table */ + nis_attr ibr_srch<>; /* The search critereia */ + u_int ibr_flags; /* Optional flags */ + nis_object ibr_obj<1>; /* optional object (add/modify) */ + nis_server ibr_cbhost<1>; /* Optional callback info */ + u_int ibr_bufsize; /* Optional first/next bufsize */ + netobj ibr_cookie; /* The first/next cookie */ +}; + +/* + * This argument to the PING call notifies the replicas that something in + * a directory has changed and this is it's timestamp. The replica will use + * the timestamp to determine if its resync operation was successful. + */ +struct ping_args { + nis_name dir; /* Directory that had the change */ + uint32_t stamp; /* timestamp of the transaction */ +}; + +/* + * These are the type of entries that are stored in the transaction log, + * note that modifications will appear as two entries, for names, they have + * a "OLD" entry followed by a "NEW" entry. For entries in tables, there + * is a remove followed by an add. It is done this way so that we can read + * the log backwards to back out transactions and forwards to propogate + * updated. + */ +enum log_entry_t { + LOG_NOP = 0, + ADD_NAME = 1, /* Name Added to name space */ + REM_NAME = 2, /* Name removed from name space */ + MOD_NAME_OLD = 3, /* Name was modified in the name space */ + MOD_NAME_NEW = 4, /* Name was modified in the name space */ + ADD_IBASE = 5, /* Entry added to information base */ + REM_IBASE = 6, /* Entry removed from information base */ + MOD_IBASE = 7, /* Entry was modified in information base */ + UPD_STAMP = 8 /* Update timestamp (used as fenceposts) */ +}; + +/* + * This result is returned from the name service when it is requested to + * dump logged entries from its transaction log. Information base updates + * will have the name of the information base in the le_name field and + * a canonical set of attribute/value pairs to fully specify the entry's + * 'name'. + */ +struct log_entry { + uint32_t le_time; /* Time in seconds */ + log_entry_t le_type; /* Type of log entry */ + nis_name le_princp; /* Principal making the change */ + nis_name le_name; /* Name of table/dir involved */ + nis_attr le_attrs<>; /* List of AV pairs. */ + nis_object le_object; /* Actual object value */ +}; + +struct log_result { + nis_error lr_status; /* The status itself */ + netobj lr_cookie; /* Used by the dump callback */ + log_entry lr_entries<>; /* zero or more entries */ +}; + +struct cp_result { + nis_error cp_status; /* Status of the checkpoint */ + uint32_t cp_zticks; /* Service 'ticks' */ + uint32_t cp_dticks; /* Database 'ticks' */ +}; + +/* + * This structure defines a generic NIS tag list. The taglist contains + * zero or tags, each of which is a type and a value. (u_int). + * These are used to report statistics (see tag definitions below) + * and to set or reset state variables. + */ +struct nis_tag { + u_int tag_type; /* Statistic tag (may vary) */ + string tag_val<>; /* Statistic value may also vary */ +}; + +struct nis_taglist { + nis_tag tags<>; /* List of tags */ +}; + +struct dump_args { + nis_name da_dir; /* Directory to dump */ + uint32_t da_time; /* From this timestamp */ + nis_server da_cbhost<1>; /* Callback to use. */ +}; + +struct fd_args { + nis_name dir_name; /* The directory we're looking for */ + nis_name requester; /* Host principal name for signature */ +}; + +struct fd_result { + nis_error status; /* Status returned by function */ + nis_name source; /* Source of this answer */ + opaque dir_data<>; /* Directory Data (XDR'ed) */ + opaque signature<>; /* Signature of the source */ +}; + +%/* +% * Structures used for server binding. +% */ +struct nis_bound_endpoint { + endpoint ep; + int generation; + int rank; + u_int flags; + int hostnum; + int epnum; + nis_name uaddr; + endpoint cbep; +}; +typedef struct nis_bound_endpoint nis_bound_endpoint; + +struct nis_bound_directory { + int generation; + int min_rank; /* minimum rank of bound endpoints */ + int optimal_rank; /* best possible rank of all endpoints */ + directory_obj dobj; + nis_bound_endpoint BEP<>; +}; +typedef struct nis_bound_directory nis_bound_directory; +%#define bep_len BEP.BEP_len +%#define bep_val BEP.BEP_val + +struct nis_active_endpoint { + endpoint ep; + nis_name hostname; + int rank; + int uaddr_generation; + nis_name uaddr; + int cbep_generation; + endpoint cbep; +}; +typedef struct nis_active_endpoint nis_active_endpoint; + +%/* defines for nis_bound_endpoint.flags */ +%#define NIS_BOUND 0x1 +%#define NIS_TRANSIENT_ERRORS 0x2 + + + +/* + * What's going on here? Well, it's like this. When the service + * is being compiled it wants to have the service definition specific + * info included, and when the client is being compiled it wants that + * info. This includes the appropriate file which was generated by + * make in the protocols directory (probably /usr/include/rpcsvc). + */ +#ifdef RPC_SVC +%#include "nis_svc.h" +#endif +#ifdef RPC_CLNT +%#include "nis_clnt.h" +#endif + +program NIS_PROG { + + /* RPC Language description of the NIS+ protocol */ + version NIS_VERSION { + /* The name service functions */ + nis_result NIS_LOOKUP(ns_request) = 1; + nis_result NIS_ADD(ns_request) = 2; + nis_result NIS_MODIFY(ns_request) = 3; + nis_result NIS_REMOVE(ns_request) = 4; + + /* The information base functions */ + nis_result NIS_IBLIST(ib_request) = 5; + nis_result NIS_IBADD(ib_request) = 6; + nis_result NIS_IBMODIFY(ib_request) = 7; + nis_result NIS_IBREMOVE(ib_request) = 8; + nis_result NIS_IBFIRST(ib_request) = 9; + nis_result NIS_IBNEXT(ib_request) = 10; + + /* NIS Administrative functions */ + fd_result NIS_FINDDIRECTORY(fd_args) = 12; + + /* If fetch and optionally reset statistics */ + nis_taglist NIS_STATUS(nis_taglist) = 14; + + /* Dump changes to directory since time in da_time */ + log_result NIS_DUMPLOG(dump_args) = 15; + + /* Dump contents of directory named */ + log_result NIS_DUMP(dump_args) = 16; + + /* Check status of callback thread */ + bool NIS_CALLBACK(netobj) = 17; + + /* Return last update time for named dir */ + uint32_t NIS_CPTIME(nis_name) = 18; + + /* Checkpoint directory or table named */ + cp_result NIS_CHECKPOINT(nis_name) = 19; + + /* Send 'status changed' ping to replicates */ + void NIS_PING(ping_args) = 20; + + /* Modify server behaviour (such as debugging) */ + nis_taglist NIS_SERVSTATE(nis_taglist) = 21; + + /* Create a Directory */ + nis_error NIS_MKDIR(nis_name) = 22; + + /* Remove a Directory */ + nis_error NIS_RMDIR(nis_name) = 23; + + /* Update public keys of a directory object */ + nis_error NIS_UPDKEYS(nis_name) = 24; + } = 3; +} = 100300; + +/* + * Included below are the defines that become part of nis.h, + * they are technically not part of the protocol, but do define + * key aspects of the implementation and are therefore useful + * in building a conforming server or client. + */ +#if RPC_HDR +%/* +% * Generic "hash" datastructures, used by all types of hashed data. +% */ +%struct nis_hash_data { +% nis_name name; /* NIS name of hashed item */ +% int keychain; /* It's hash key (for pop) */ +% struct nis_hash_data *next; /* Hash collision pointer */ +% struct nis_hash_data *prv_item; /* A serial, doubly linked list */ +% struct nis_hash_data *nxt_item; /* of items in the hash table */ +%}; +%typedef struct nis_hash_data NIS_HASH_ITEM; +% +%struct nis_hash_table { +% NIS_HASH_ITEM *keys[64]; /* A hash table of items */ +% NIS_HASH_ITEM *first; /* The first "item" in serial list */ +%}; +%typedef struct nis_hash_table NIS_HASH_TABLE; +% +%/* Structure for storing dynamically allocated static data */ +%struct nis_sdata { +% void *buf; /* Memory allocation pointer */ +% u_int size; /* Buffer size */ +%}; +% +%/* Generic client creating flags */ +%#define ZMH_VC 1 +%#define ZMH_DG 2 +%#define ZMH_AUTH 4 +%#define ZMH_NOFALLBACK 8 +% +%/* Testing Access rights for objects */ +% +%#define NIS_READ_ACC 1 +%#define NIS_MODIFY_ACC 2 +%#define NIS_CREATE_ACC 4 +%#define NIS_DESTROY_ACC 8 +%/* Test macros. a == access rights, m == desired rights. */ +%#define NIS_WORLD(a, m) (((a) & (m)) != 0) +%#define NIS_GROUP(a, m) (((a) & ((m) << 8)) != 0) +%#define NIS_OWNER(a, m) (((a) & ((m) << 16)) != 0) +%#define NIS_NOBODY(a, m) (((a) & ((m) << 24)) != 0) +%/* +% * EOL Alert - The following non-prefixed test macros are +% * here for backward compatability, and will be not be present +% * in future releases - use the NIS_*() macros above. +% */ +%#define WORLD(a, m) (((a) & (m)) != 0) +%#define GROUP(a, m) (((a) & ((m) << 8)) != 0) +%#define OWNER(a, m) (((a) & ((m) << 16)) != 0) +%#define NOBODY(a, m) (((a) & ((m) << 24)) != 0) +% +%#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype) +%#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights) +%#define WORLD_DEFAULT (NIS_READ_ACC) +%#define GROUP_DEFAULT (NIS_READ_ACC << 8) +%#define OWNER_DEFAULT ((NIS_READ_ACC +\ +% NIS_MODIFY_ACC +\ +% NIS_CREATE_ACC +\ +% NIS_DESTROY_ACC) << 16) +%#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT) +% +%/* Result manipulation defines ... */ +%#define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len) +%#define NIS_RES_OBJECT(x) ((x)->objects.objects_val) +%#define NIS_RES_COOKIE(x) ((x)->cookie) +%#define NIS_RES_STATUS(x) ((x)->status) +% +%/* These defines make getting at the variant part of the object easier. */ +%#define TA_data zo_data.objdata_u.ta_data +%#define EN_data zo_data.objdata_u.en_data +%#define DI_data zo_data.objdata_u.di_data +%#define LI_data zo_data.objdata_u.li_data +%#define GR_data zo_data.objdata_u.gr_data +% +%#define __type_of(o) ((o)->zo_data.zo_type) +% +%/* Declarations for the internal subroutines in nislib.c */ +%enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME}; +%typedef enum name_pos name_pos; +% +%/* +% * Defines for getting at column data in entry objects. Because RPCGEN +% * generates some rather wordy structures, we create some defines that +% * collapse the needed keystrokes to access a particular value using +% * these definitions they take an nis_object *, and an int and return +% * a u_char * for Value, and an int for length. +% */ +%#define ENTRY_VAL(obj, col) \ +% (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val +%#define ENTRY_LEN(obj, col) \ +% (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len +% +% +% +%#ifdef __cplusplus +%} +%#endif +% +%/* Prototypes, and extern declarations for the NIS library functions. */ +%#include <rpcsvc/nislib.h> +%#endif /* __NIS_RPCGEN_H */ +%/* EDIT_START */ +% +%/* +% * nis_3.h +% * +% * This file contains definitions that are only of interest to the actual +% * service daemon and client stubs. Normal users of NIS will not include +% * this file. +% * +% * NOTE : This include file is automatically created by a combination +% * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead +% * and then remake this file. +% */ +%#ifndef __nis_3_h +%#define __nis_3_h +%#ifdef __cplusplus +%extern "C" { +%#endif +#endif diff --git a/usr/src/head/rpcsvc/nis_cache.x b/usr/src/head/rpcsvc/nis_cache.x new file mode 100644 index 0000000000..32a448ae90 --- /dev/null +++ b/usr/src/head/rpcsvc/nis_cache.x @@ -0,0 +1,68 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* + * nis_cache.x + * + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +%#pragma ident "%Z%%M% %I% %E% SMI" + + +#ifdef RPC_HDR +%#define NIS_DIRECTORY "/var/nis" +%#define CACHE_FILE "/var/nis/NIS_SHARED_DIRCACHE" +%#define PRIVATE_CACHE_FILE "/var/nis/.NIS_PRIVATE_DIRCACHE" +%#define TMP_CACHE_FILE "/var/nis/.NIS_TEMPORARY_DIRCACHE" +%#define COLD_START_FILE "/var/nis/NIS_COLD_START" +%#define DOT_FILE "/var/nis/.pref_servers" +%#include <rpc/types.h> +%#include <rpcsvc/nis.h> +%#include "nis_clnt.h" +#endif + +struct bind_server_arg { + nis_server *srv; + int nsrv; +}; + +struct refresh_res { + int changed; + endpoint ep; +}; + +program CACHEPROG { + version CACHE_VER_2 { + void NIS_CACHE_ADD_ENTRY(fd_result) = 1; + void NIS_CACHE_REMOVE_ENTRY(directory_obj) = 2; + void NIS_CACHE_READ_COLDSTART(void) = 3; + void NIS_CACHE_REFRESH_ENTRY(string<>) = 4; + + nis_error NIS_CACHE_BIND_REPLICA(string<>) = 5; + nis_error NIS_CACHE_BIND_MASTER(string<>) = 6; + nis_error NIS_CACHE_BIND_SERVER(bind_server_arg) = 7; + refresh_res NIS_CACHE_REFRESH_BINDING(nis_bound_directory) = 8; + refresh_res NIS_CACHE_REFRESH_ADDRESS(nis_bound_endpoint) = 9; + refresh_res NIS_CACHE_REFRESH_CALLBACK(nis_bound_endpoint) = 10; + } = 2; +} = 100301; diff --git a/usr/src/head/rpcsvc/nis_callback.x b/usr/src/head/rpcsvc/nis_callback.x new file mode 100644 index 0000000000..c390c4dbdb --- /dev/null +++ b/usr/src/head/rpcsvc/nis_callback.x @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* + * nis_callback.x + * + * Copyright (c) 1988-1992 Sun Microsystems Inc + * All Rights Reserved. + */ + +%#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * "@(#)zns_cback.x 1.2 90/09/10 Copyr 1990 Sun Micro" + * + * RPCL description of the Callback Service. + */ + +#ifdef RPC_HDR +%#include <rpcsvc/nis.h> +#endif +#ifdef RPC_XDR +%#include "nis_clnt.h" +#endif + +typedef nis_object *obj_p; + +struct cback_data { + obj_p entries<>; /* List of objects */ +}; + +program CB_PROG { + version CB_VERS { + bool CBPROC_RECEIVE(cback_data) = 1; + void CBPROC_FINISH(void) = 2; + void CBPROC_ERROR(nis_error) = 3; + } = 1; +} = 100302; diff --git a/usr/src/head/rpcsvc/nis_db.h b/usr/src/head/rpcsvc/nis_db.h new file mode 100644 index 0000000000..ff4b1a24a6 --- /dev/null +++ b/usr/src/head/rpcsvc/nis_db.h @@ -0,0 +1,132 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1991,1997-1998 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * This header file defines the interface to the NIS database. All + * implementations of the database must export at least these routines. + * They must also follow the conventions set herein. See the implementors + * guide for specific semantics that are required. + */ + +#ifndef _RPCSVC_NIS_DB_H +#define _RPCSVC_NIS_DB_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <rpc/rpc.h> +#include <rpcsvc/nis.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum db_status { + DB_SUCCESS = 0, + DB_NOTFOUND = 1, + DB_NOTUNIQUE = 2, + DB_BADTABLE = 3, + DB_BADQUERY = 4, + DB_BADOBJECT = 5, + DB_MEMORY_LIMIT = 6, + DB_STORAGE_LIMIT = 7, + DB_INTERNAL_ERROR = 8 +}; +typedef enum db_status db_status; + +enum db_action { + DB_LOOKUP = 0, + DB_REMOVE = 1, + DB_ADD = 2, + DB_FIRST = 3, + DB_NEXT = 4, + DB_ALL = 5, + DB_RESET_NEXT = 6 +}; +typedef enum db_action db_action; + +typedef entry_obj *entry_object_p; + +typedef struct { + uint_t db_next_desc_len; + char *db_next_desc_val; +} db_next_desc; + +struct db_result { + db_status status; + db_next_desc nextinfo; + struct { + uint_t objects_len; + entry_object_p *objects_val; + } objects; + long ticks; +}; +typedef struct db_result db_result; + +/* + * Prototypes for the database functions. + */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern bool_t db_initialize(char *); +extern db_status db_create_table(char *, table_obj *); +extern db_status db_destroy_table(char *); +extern db_result *db_first_entry(char *, int, nis_attr *); +extern db_result *db_next_entry(char *, db_next_desc *); +extern db_result *db_reset_next_entry(char *, db_next_desc *); +extern db_result *db_list_entries(char *, int, nis_attr *); +extern db_result *db_add_entry(char *, int, nis_attr *, entry_obj *); +extern db_result *db_remove_entry(char *, int, nis_attr *); +extern db_status db_checkpoint(char *); +extern db_status db_standby(char *); +extern db_status db_table_exists(char *); +extern db_status db_unload_table(char *); +extern void db_free_result(db_result *); + +#else /* Non-prototype definitions */ + +extern bool_t db_initialize(); +extern db_status db_create_table(); +extern db_status db_destroy_table(); +extern db_result *db_first_entry(); +extern db_result *db_next_entry(); +extern db_result *db_reset_next_entry(); +extern db_result *db_list_entries(); +extern db_result *db_add_entry(); +extern db_result *db_remove_entry(); +extern db_status db_checkpoint(); +extern db_status db_standby(); +extern db_status db_table_exists(); +extern db_status db_unload_table(); +extern void db_free_result(); + +#endif /* defined(__STDC__) || defined(__cplusplus) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _RPCSVC_NIS_DB_H */ diff --git a/usr/src/head/rpcsvc/nis_object.x b/usr/src/head/rpcsvc/nis_object.x new file mode 100644 index 0000000000..d30bd8afdf --- /dev/null +++ b/usr/src/head/rpcsvc/nis_object.x @@ -0,0 +1,332 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* + * nis_object.x + * + * Copyright (c) 1988-1992 Sun Microsystems Inc + * All Rights Reserved. + */ + +%#pragma ident "%Z%%M% %I% %E% SMI" + +#if RPC_HDR +% +%#ifndef __nis_object_h +%#define __nis_object_h +% +#endif +/* + * This file defines the format for a NIS object in RPC language. + * It is included by the main .x file and the database access protocol + * file. It is common because both of them need to deal with the same + * type of object. Generating the actual code though is a bit messy because + * the nis.x file and the nis_dba.x file will generate xdr routines to + * encode/decode objects when only one set is needed. Such is life when + * one is using rpcgen. + * + * Note, the protocol doesn't specify any limits on such things as + * maximum name length, number of attributes, etc. These are enforced + * by the database backend. When you hit them you will no. Also see + * the db_getlimits() function for fetching the limit values. + * + */ + +#if defined(RPC_XDR) || defined(RPC_SVC) || defined(RPC_CLNT) +%#ifndef xdr_uint32_t +%#define xdr_uint32_t xdr_u_int +%#endif +%#ifndef xdr_uint_t +%#define xdr_uint_t xdr_u_int +%#endif +#endif + +/* Some manifest constants, chosen to maximize flexibility without + * plugging the wire full of data. + */ +const NIS_MAXSTRINGLEN = 255; +const NIS_MAXNAMELEN = 1024; +const NIS_MAXATTRNAME = 32; +const NIS_MAXATTRVAL = 2048; +const NIS_MAXCOLUMNS = 64; +const NIS_MAXATTR = 16; +const NIS_MAXPATH = 1024; +const NIS_MAXREPLICAS = 128; +const NIS_MAXLINKS = 16; + +const NIS_PK_NONE = 0; /* no public key (unix/sys auth) */ +const NIS_PK_DH = 1; /* Public key is Diffie-Hellman type */ +const NIS_PK_RSA = 2; /* Public key if RSA type */ +const NIS_PK_KERB = 3; /* Use kerberos style authentication */ +const NIS_PK_DHEXT = 4; /* Extended Diffie-Hellman for RPC-GSS */ + +/* + * The fundamental name type of NIS. The name may consist of two parts, + * the first being the fully qualified name, and the second being an + * optional set of attribute/value pairs. + */ +struct nis_attr { + string zattr_ndx<>; /* name of the index */ + opaque zattr_val<>; /* Value for the attribute. */ +}; + +typedef string nis_name<>; /* The NIS name itself. */ + +/* NIS object types are defined by the following enumeration. The numbers + * they use are based on the following scheme : + * 0 - 1023 are reserved for Sun, + * 1024 - 2047 are defined to be private to a particular tree. + * 2048 - 4095 are defined to be user defined. + * 4096 - ... are reserved for future use. + * + * EOL Alert - The non-prefixed names are present for backward + * compatability only, and will not exist in future releases. Use + * the NIS_* names for future compatability. + */ + +enum zotypes { + + BOGUS_OBJ = 0, /* Uninitialized object structure */ + NO_OBJ = 1, /* NULL object (no data) */ + DIRECTORY_OBJ = 2, /* Directory object describing domain */ + GROUP_OBJ = 3, /* Group object (a list of names) */ + TABLE_OBJ = 4, /* Table object (a database schema) */ + ENTRY_OBJ = 5, /* Entry object (a database record) */ + LINK_OBJ = 6, /* A name link. */ + PRIVATE_OBJ = 7, /* Private object (all opaque data) */ + + NIS_BOGUS_OBJ = 0, /* Uninitialized object structure */ + NIS_NO_OBJ = 1, /* NULL object (no data) */ + NIS_DIRECTORY_OBJ = 2, /* Directory object describing domain */ + NIS_GROUP_OBJ = 3, /* Group object (a list of names) */ + NIS_TABLE_OBJ = 4, /* Table object (a database schema) */ + NIS_ENTRY_OBJ = 5, /* Entry object (a database record) */ + NIS_LINK_OBJ = 6, /* A name link. */ + NIS_PRIVATE_OBJ = 7 /* Private object (all opaque data) */ +}; + +/* + * The types of Name services NIS knows about. They are enumerated + * here. The Binder code will use this type to determine if it has + * a set of library routines that will access the indicated name service. + */ +enum nstype { + UNKNOWN = 0, + NIS = 1, /* Nis Plus Service */ + SUNYP = 2, /* Old NIS Service */ + IVY = 3, /* Nis Plus Plus Service */ + DNS = 4, /* Domain Name Service */ + X500 = 5, /* ISO/CCCIT X.500 Service */ + DNANS = 6, /* Digital DECNet Name Service */ + XCHS = 7, /* Xerox ClearingHouse Service */ + CDS= 8 +}; + +/* + * DIRECTORY - The name service object. These objects identify other name + * servers that are serving some portion of the name space. Each has a + * type associated with it. The resolver library will note whether or not + * is has the needed routines to access that type of service. + * The oarmask structure defines an access rights mask on a per object + * type basis for the name spaces. The only bits currently used are + * create and destroy. By enabling or disabling these access rights for + * a specific object type for a one of the accessor entities (owner, + * group, world) the administrator can control what types of objects + * may be freely added to the name space and which require the + * administrator's approval. + */ +struct oar_mask { + uint_t oa_rights; /* Access rights mask */ + zotypes oa_otype; /* Object type */ +}; + +struct endpoint { + string uaddr<>; + string family<>; /* Transport family (INET, OSI, etc) */ + string proto<>; /* Protocol (TCP, UDP, CLNP, etc) */ +}; + +/* + * Note: pkey is a netobj which is limited to 1024 bytes which limits the + * keysize to 8192 bits. This is consider to be a reasonable limit for + * the expected lifetime of this service. + */ +struct nis_server { + nis_name name; /* Principal name of the server */ + endpoint ep<>; /* Universal addr(s) for server */ + uint_t key_type; /* Public key type */ + netobj pkey; /* server's public key */ +}; + +struct directory_obj { + nis_name do_name; /* Name of the directory being served */ + nstype do_type; /* one of NIS, DNS, IVY, YP, or X.500 */ + nis_server do_servers<>; /* <0> == Primary name server */ + uint32_t do_ttl; /* Time To Live (for caches) */ + oar_mask do_armask<>; /* Create/Destroy rights by object type */ +}; + +/* + * ENTRY - This is one row of data from an information base. + * The type value is used by the client library to convert the entry to + * it's internal structure representation. The Table name is a back pointer + * to the table where the entry is stored. This allows the client library + * to determine where to send a request if the client wishes to change this + * entry but got to it through a LINK rather than directly. + * If the entry is a "standalone" entry then this field is void. + */ +const EN_BINARY = 1; /* Indicates value is binary data */ +const EN_CRYPT = 2; /* Indicates the value is encrypted */ +const EN_XDR = 4; /* Indicates the value is XDR encoded */ +const EN_MODIFIED = 8; /* Indicates entry is modified. */ +const EN_ASN1 = 64; /* Means contents use ASN.1 encoding */ + +struct entry_col { + uint_t ec_flags; /* Flags for this value */ + opaque ec_value<>; /* It's textual value */ +}; + +struct entry_obj { + string en_type<>; /* Type of entry such as "passwd" */ + entry_col en_cols<>; /* Value for the entry */ +}; + +/* + * GROUP - The group object contains a list of NIS principal names. Groups + * are used to authorize principals. Each object has a set of access rights + * for members of its group. Principal names in groups are in the form + * name.directory and recursive groups are expressed as @groupname.directory + */ +struct group_obj { + uint_t gr_flags; /* Flags controlling group */ + nis_name gr_members<>; /* List of names in group */ +}; + +/* + * LINK - This is the LINK object. It is quite similar to a symbolic link + * in the UNIX filesystem. The attributes in the main object structure are + * relative to the LINK data and not what it points to (like the file system) + * "modify" privleges here indicate the right to modify what the link points + * at and not to modify that actual object pointed to by the link. + */ +struct link_obj { + zotypes li_rtype; /* Real type of the object */ + nis_attr li_attrs<>; /* Attribute/Values for tables */ + nis_name li_name; /* The object's real NIS name */ +}; + +/* + * TABLE - This is the table object. It implements a simple + * data base that applications and use for configuration or + * administration purposes. The role of the table is to group together + * a set of related entries. Tables are the simple database component + * of NIS. Like many databases, tables are logically divided into columns + * and rows. The columns are labeled with indexes and each ENTRY makes + * up a row. Rows may be addressed within the table by selecting one + * or more indexes, and values for those indexes. Each row which has + * a value for the given index that matches the desired value is returned. + * Within the definition of each column there is a flags variable, this + * variable contains flags which determine whether or not the column is + * searchable, contains binary data, and access rights for the entry objects + * column value. + */ + +const TA_BINARY = 1; /* Means table data is binary */ +const TA_CRYPT = 2; /* Means value should be encrypted */ +const TA_XDR = 4; /* Means value is XDR encoded */ +const TA_SEARCHABLE = 8; /* Means this column is searchable */ +const TA_CASE = 16; /* Means this column is Case Sensitive */ +const TA_MODIFIED = 32; /* Means this columns attrs are modified*/ +const TA_ASN1 = 64; /* Means contents use ASN.1 encoding */ + +struct table_col { + string tc_name<64>; /* Column Name */ + uint_t tc_flags; /* control flags */ + uint_t tc_rights; /* Access rights mask */ +}; + +struct table_obj { + string ta_type<64>; /* Table type such as "passwd" */ + int ta_maxcol; /* Total number of columns */ + u_char ta_sep; /* Separator character */ + table_col ta_cols<>; /* The number of table indexes */ + string ta_path<>; /* A search path for this table */ +}; + +/* + * This union joins together all of the currently known objects. + */ +union objdata switch (zotypes zo_type) { + case NIS_DIRECTORY_OBJ : + struct directory_obj di_data; + case NIS_GROUP_OBJ : + struct group_obj gr_data; + case NIS_TABLE_OBJ : + struct table_obj ta_data; + case NIS_ENTRY_OBJ: + struct entry_obj en_data; + case NIS_LINK_OBJ : + struct link_obj li_data; + case NIS_PRIVATE_OBJ : + opaque po_data<>; + case NIS_NO_OBJ : + void; + case NIS_BOGUS_OBJ : + void; + default : + void; +}; + +/* + * This is the basic NIS object data type. It consists of a generic part + * which all objects contain, and a specialized part which varies depending + * on the type of the object. All of the specialized sections have been + * described above. You might have wondered why they all start with an + * integer size, followed by the useful data. The answer is, when the + * server doesn't recognize the type returned it treats it as opaque data. + * And the definition for opaque data is {int size; char *data;}. In this + * way, servers and utility routines that do not understand a given type + * may still pass it around. One has to be careful in setting + * this variable accurately, it must take into account such things as + * XDR padding of structures etc. The best way to set it is to note one's + * position in the XDR encoding stream, encode the structure, look at the + * new position and calculate the size. + */ +struct nis_oid { + uint32_t ctime; /* Time of objects creation */ + uint32_t mtime; /* Time of objects modification */ +}; + +struct nis_object { + nis_oid zo_oid; /* object identity verifier. */ + nis_name zo_name; /* The NIS name for this object */ + nis_name zo_owner; /* NIS name of object owner. */ + nis_name zo_group; /* NIS name of access group. */ + nis_name zo_domain; /* The administrator for the object */ + uint_t zo_access; /* Access rights (owner, group, world) */ + uint32_t zo_ttl; /* Object's time to live in seconds. */ + objdata zo_data; /* Data structure for this type */ +}; +#if RPC_HDR +% +%#endif /* if __nis_object_h */ +% +#endif diff --git a/usr/src/head/rpcsvc/nis_tags.h b/usr/src/head/rpcsvc/nis_tags.h new file mode 100644 index 0000000000..015aaf7c7a --- /dev/null +++ b/usr/src/head/rpcsvc/nis_tags.h @@ -0,0 +1,121 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1991, Sun Microsystems Inc. + */ + +/* + * nis_tags.h + * + * This file contains the tags and statistics definitions. It is + * automatically included by nis.h + */ + +#ifndef _RPCSVC_NIS_TAGS_H +#define _RPCSVC_NIS_TAGS_H + +#pragma ident "%Z%%M% %I% %E% SMI" +/* from file: zns_tags.h 1.7 Copyright (c) 1990 Sun Microsystems */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#define NIS_DIR "data" + +/* Lookup and List function flags */ +#define FOLLOW_LINKS (1<<0) /* Follow link objects */ +#define FOLLOW_PATH (1<<1) /* Follow the path in a table */ +#define HARD_LOOKUP (1<<2) /* Block until successful */ +#define ALL_RESULTS (1<<3) /* Retrieve all results */ +#define NO_CACHE (1<<4) /* Do not return 'cached' results */ +#define MASTER_ONLY (1<<5) /* Get value only from master server */ +#define EXPAND_NAME (1<<6) /* Expand partitially qualified names */ + +/* Semantic modification for table operations flags */ +#define RETURN_RESULT (1<<7) /* Return resulting object to client */ +#define ADD_OVERWRITE (1<<8) /* Allow overwrites on ADD */ +#define REM_MULTIPLE (1<<9) /* Allow wildcard deletes */ +#define MOD_SAMEOBJ (1<<10) /* Check modified object before write */ +#define ADD_RESERVED (1<<11) /* Spare ADD semantic */ +#define REM_RESERVED (1<<12) /* Spare REM semantic */ +#define MOD_EXCLUSIVE (1<<13) /* Modify no overwrite on modified keys */ + +/* Lookup and List function flags (continued) */ +#define SOFT_LOOKUP (1<<14) /* The "old default" return on failure */ + +/* Transport specific modifications to the operation */ +#define USE_DGRAM (1<<16) /* Use a datagram transport */ +#define NO_AUTHINFO (1<<17) /* Don't bother attaching auth info */ + +/* + * Declarations for "standard" NIS+ tags + * State variable tags have values 0 - 2047 + * Statistic tags have values 2048 - 65535 + * User Tags have values >2^16 + */ +#define TAG_DEBUG 1 /* set debug level */ +#define TAG_STATS 2 /* Enable/disable statistics */ +#define TAG_GCACHE 3 /* Flush the Group Cache */ +#define TAG_GCACHE_ALL TAG_GCACHE +#define TAG_DCACHE 4 /* Flush the directory cache */ +#define TAG_DCACHE_ONE TAG_DCACHE +#define TAG_OCACHE 5 /* Flush the Object Cache */ +#define TAG_SECURE 6 /* Set the security level */ +#define TAG_TCACHE_ONE 7 /* Flush the table cache */ +#define TAG_DCACHE_ALL 8 /* Flush entire directory cache */ +#define TAG_TCACHE_ALL 9 /* Flush entire table cache */ +#define TAG_GCACHE_ONE 10 /* Flush one group object */ +#define TAG_DCACHE_ONE_REFRESH 11 /* Flush and refresh one DO */ +#define TAG_READONLY 12 /* Set read only mode */ +#define TAG_READWRITE 14 /* Reset read-write mode */ + +#define TAG_OPSTATS 2048 /* NIS+ operations statistics */ +#define TAG_THREADS 2049 /* Child process/thread status */ +#define TAG_HEAP 2050 /* Heap usage statistics */ +#define TAG_UPDATES 2051 /* Updates to this service */ +#define TAG_VISIBLE 2052 /* First update that isn't replicated */ +#define TAG_S_DCACHE 2053 /* Directory cache statistics */ +#define TAG_S_OCACHE 2054 /* Object cache statistics */ +#define TAG_S_GCACHE 2055 /* Group cache statistics */ +#define TAG_S_STORAGE 2056 /* Group cache statistics */ +#define TAG_UPTIME 2057 /* Time that server has been up */ +#define TAG_DIRLIST 2058 /* Dir served by this server */ +#define TAG_NISCOMPAT 2059 /* Whether supports NIS compat mode */ +#define TAG_DNSFORWARDING 2060 /* Whether DNS forwarding supported */ +#define TAG_SECURITY_LEVEL 2061 /* Security level of the server */ +#define TAG_ROOTSERVER 2062 /* Whether root server */ + +/* + * Declarations for the Group object flags. Currently + * there are only 3. + */ +#define IMPMEM_GROUPS 1 /* Implicit Membership allowed */ +#define RECURS_GROUPS 2 /* Recursive Groups allowed */ +#define NEGMEM_GROUPS 4 /* Negative Groups allowed */ + +#ifdef __cplusplus +} +#endif + +#endif /* _RPCSVC_NIS_TAGS_H */ diff --git a/usr/src/head/rpcsvc/nislib.h b/usr/src/head/rpcsvc/nislib.h new file mode 100644 index 0000000000..8274123267 --- /dev/null +++ b/usr/src/head/rpcsvc/nislib.h @@ -0,0 +1,365 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1991-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * nislib.h + * + * This file contains the interfaces that are visible in the SunOS 5.x + * implementation of NIS Plus. When using C++ the defined __cplusplus and + * __STDC__ should both be true. + */ + +#ifndef _RPCSVC_NISLIB_H +#define _RPCSVC_NISLIB_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __STDC__ +extern void nis_freeresult(nis_result *); +extern nis_result *nis_lookup(nis_name, uint_t); +extern nis_result *nis_list(nis_name, uint_t, + int (*)(nis_name, nis_object *, void *), void *); +extern nis_result *nis_add(nis_name, nis_object *); +extern nis_result *nis_remove(nis_name, nis_object *); +extern nis_result *nis_modify(nis_name, nis_object *); + +extern nis_result *nis_add_entry(nis_name, nis_object *, uint_t); +extern nis_result *nis_remove_entry(nis_name, nis_object *, uint_t); +extern nis_result *nis_modify_entry(nis_name, nis_object *, uint_t); +extern nis_result *nis_first_entry(nis_name); +extern nis_result *nis_next_entry(nis_name, netobj *); + +extern nis_error nis_mkdir(nis_name, nis_server *); +extern nis_error nis_rmdir(nis_name, nis_server *); +extern name_pos nis_dir_cmp(nis_name, nis_name); + +extern nis_name *nis_getnames(nis_name); +extern void nis_freenames(nis_name *); +extern nis_name nis_domain_of(nis_name); +extern nis_name nis_leaf_of(nis_name); +extern nis_name nis_leaf_of_r(const nis_name, char *, size_t); +extern nis_name nis_name_of(nis_name); +extern nis_name nis_local_group(void); +extern nis_name nis_local_directory(void); +extern nis_name nis_local_principal(void); +extern nis_name nis_local_host(void); + +extern void nis_destroy_object(nis_object *); +extern nis_object *nis_clone_object(nis_object *, nis_object *); +extern void nis_print_object(nis_object *o); + +extern char *nis_sperrno(nis_error); +extern void nis_perror(nis_error, char *); +extern char *nis_sperror(nis_error, char *); +extern char *nis_sperror_r(nis_error, char *, char *, int len); +extern void nis_lerror(nis_error, char *); + +extern void nis_print_group_entry(nis_name); +extern bool_t nis_ismember(nis_name, nis_name); +extern nis_error nis_creategroup(nis_name, uint_t); +extern nis_error nis_destroygroup(nis_name); +extern nis_error nis_addmember(nis_name, nis_name); +extern nis_error nis_removemember(nis_name, nis_name); +extern nis_error nis_verifygroup(nis_name); + +extern void nis_freeservlist(nis_server **); +extern nis_server **nis_getservlist(nis_name); +extern nis_error nis_stats(nis_server *, nis_tag *, int, nis_tag **); +extern nis_error nis_servstate(nis_server *, nis_tag *, int, nis_tag **); +extern void nis_freetags(nis_tag *, int); + +extern nis_result *nis_checkpoint(nis_name); +extern void nis_ping(nis_name, uint32_t, nis_object *); + +/* + * XXX: PLEASE NOTE THAT THE FOLLOWING FUNCTIONS ARE INTERNAL + * TO NIS+ AND SHOULD NOT BE USED BY ANY APPLICATION PROGRAM. + * THEIR SEMANTICS AND/OR SIGNATURE CAN CHANGE WITHOUT NOTICE. + * SO, PLEASE DO NOT USE THEM. YOU ARE WARNED!!!! + */ + +extern char **__break_name(nis_name, int *); +extern int __name_distance(char **, char **); +extern nis_result *nis_make_error(nis_error, uint32_t, uint32_t, uint32_t, + uint32_t); +extern nis_attr *__cvt2attr(int *, char **); +extern void nis_free_request(ib_request *); +extern nis_error nis_get_request(nis_name, nis_object *, netobj*, ib_request*); +extern nis_object *nis_read_obj(char *); +extern int nis_write_obj(char *, nis_object *); +extern int nis_in_table(nis_name, NIS_HASH_TABLE *, int *); +extern int nis_insert_item(NIS_HASH_ITEM *, NIS_HASH_TABLE *); +extern NIS_HASH_ITEM *nis_find_item(nis_name, NIS_HASH_TABLE *); +extern NIS_HASH_ITEM *nis_remove_item(nis_name, NIS_HASH_TABLE *); +extern void nis_insert_name(nis_name, NIS_HASH_TABLE *); +extern void nis_remove_name(nis_name, NIS_HASH_TABLE *); +extern CLIENT *nis_make_rpchandle(nis_server *, int, rpcprog_t, rpcvers_t, + uint_t, int, int); +extern void *nis_get_static_storage(struct nis_sdata *, uint_t, uint_t); +extern char *nis_data(char *); +extern char *nis_old_data(char *); +extern void nis_print_rights(uint_t); +extern void nis_print_directory(directory_obj *); +extern void nis_print_group(group_obj *); +extern void nis_print_table(table_obj *); +extern void nis_print_link(link_obj *); +extern void nis_print_entry(entry_obj *); +extern nis_server *__nis_init_callback(CLIENT *, + int (*)(nis_name, nis_object *, void *), void *); +extern int __nis_run_callback(netobj *, rpcproc_t, struct timeval *, CLIENT *); + +extern log_result *nis_dumplog(nis_server *, nis_name, uint32_t); +extern log_result *nis_dump(nis_server *, nis_name, + int (*)(nis_name, nis_object *, void *)); +extern nis_name __nis_rpc_domain(void); + +extern bool_t __do_ismember(nis_name, nis_object *, + nis_result *(*)(nis_name, uint_t)); +extern nis_name __nis_map_group(nis_name); +extern nis_name __nis_map_group_r(const nis_name, char *, size_t); + +void __nis_CacheStart(void); +nis_error __nis_CacheBind(char *dname, directory_obj *dobj); +bool_t __nis_CacheRemoveEntry(directory_obj *dobj); +nis_error __nis_CacheSearch(char *dname, directory_obj *dobj); +void __nis_CacheRestart(void); +void __nis_CachePrint(void); +void __nis_CachePrintDir(char *); +bool_t __nis_CacheAddEntry(fd_result *, directory_obj *); +void __nis_CacheRefreshEntry(char *); +nis_error __nis_CacheBindDir(char *dname, + nis_bound_directory **binding, int flags); +nis_error __nis_CacheBindMaster(char *dname, nis_bound_directory **binding); +nis_error __nis_CacheBindServer(nis_server *srv, int nsrv, + nis_bound_directory **binding); +int __nis_CacheRefreshBinding(nis_bound_directory *binding); +int __nis_CacheRefreshAddress(nis_bound_endpoint *bep); +int __nis_CacheRefreshCallback(nis_bound_endpoint *bep); +nis_error __nis_CacheLocalInit(uint32_t *exp_time); +uint32_t __nis_CacheLocalLoadPref(void); +nis_error __nis_CacheMgrInit(void); +void __nis_CacheMgrCleanup(void); +void __nis_CacheMgrReadColdstart(void); +nis_error __nis_CacheMgrBindReplica(char *dname); +nis_error __nis_CacheMgrBindMaster(char *dname); +nis_error __nis_CacheMgrBindServer(nis_server *srv, int nsrv); +int __nis_CacheMgrRefreshBinding(nis_bound_directory *binding); +int __nis_CacheMgrRefreshAddress(nis_bound_endpoint *bep); +int __nis_CacheMgrRefreshCallback(nis_bound_endpoint *bep); +int __nis_CacheMgrUpdateUaddr(char *uaddr); +void __nis_CacheMgrMarkUp(void); +uint32_t __nis_CacheMgrTimers(void); +uint32_t __nis_CacheMgrRefreshCache(void); +uint32_t __nis_serverRefreshCache(void); + +extern CLIENT *__get_ti_clnt(char *, CLIENT *, char **, pid_t *, dev_t *); +extern int __strcmp_case_insens(char *, char *); +extern int __strncmp_case_insens(char *, char *); + +extern fd_result *nis_finddirectory(directory_obj *, nis_name); +extern int __start_clock(int); +extern uint32_t __stop_clock(int); + +fd_result *__nis_finddirectory(nis_bound_directory **, char *dname); +int __dir_prefix(char **, char **); +void __free_break_name(char **, int); +void __broken_name_print(char **, int); +void __free_fdresult(fd_result *res); +nis_error __nis_ping_servers(nis_bound_directory *, int, int); +struct netconfig *__nis_get_netconfig(endpoint *ep); +int __dir_same(char **, char **); +void nis_free_binding(nis_bound_directory *); +char *__nis_xdr_dup(xdrproc_t, char *, char *); + +CLIENT *__nis_clnt_create(int, struct netconfig *, char *, struct netbuf *, + int, int, int, int, int); + +#else + +/* Non-prototype definitions (old fashioned C) */ + +extern void nis_freeresult(); +extern nis_result *nis_lookup(); +extern nis_result *nis_list(); +extern nis_result *nis_add(); +extern nis_result *nis_remove(); +extern nis_result *nis_modify(); + +extern nis_result *nis_add_entry(); +extern nis_result *nis_remove_entry(); +extern nis_result *nis_modify_entry(); +extern nis_result *nis_first_entry(); +extern nis_result *nis_next_entry(); + +extern nis_error nis_mkdir(); +extern nis_error nis_rmdir(); +extern name_pos nis_dir_cmp(); + +extern nis_name *nis_getnames(); +extern void nis_freenames(); +extern nis_name nis_domain_of(); +extern nis_name nis_leaf_of(); +extern nis_name nis_leaf_of_r(); +extern nis_name nis_name_of(); +extern nis_name nis_local_group(); +extern nis_name nis_local_directory(); +extern nis_name nis_local_principal(); +extern nis_name nis_local_host(); + +extern void nis_destroy_object(); +extern nis_object *nis_clone_object(); +extern void nis_print_object(); + +extern char *nis_sperrno(); +extern void nis_perror(); +extern char *nis_sperror(); +extern char *nis_sperror_r(); +extern void nis_lerror(); + +extern void nis_print_group_entry(); +extern bool_t nis_ismember(); +extern nis_error nis_creategroup(); +extern nis_error nis_destroygroup(); +extern nis_error nis_addmember(); +extern nis_error nis_removemember(); +extern nis_error nis_verifygroup(); + +extern void nis_freeservlist(); +extern nis_server **nis_getservlist(); +extern nis_error nis_stats(); +extern nis_error nis_servstate(); +extern void nis_freetags(); + +extern nis_result *nis_checkpoint(); +extern void nis_ping(); + +/* + * XXX: PLEASE NOTE THAT THE FOLLOWING FUNCTIONS ARE INTERNAL + * TO NIS+ AND SHOULD NOT BE USED BY ANY APPLICATION PROGRAM. + * THEIR SEMANTICS AND/OR SIGNATURE CAN CHANGE WITHOUT NOTICE. + * SO, PLEASE DO NOT USE THEM. YOU ARE WARNED!!!! + */ +extern char **__break_name(); +extern int __name_distance(); +extern nis_result *nis_make_error(); +extern nis_attr *__cvt2attr(); +extern void nis_free_request(); +extern nis_error nis_get_request(); +extern nis_object *nis_read_obj(); +extern int nis_write_obj(); +extern int nis_in_table(); +extern int nis_insert_item(); +extern NIS_HASH_ITEM *nis_find_item(); +extern NIS_HASH_ITEM *nis_remove_item(); +extern void nis_insert_name(); +extern void nis_remove_name(); +extern CLIENT *nis_make_rpchandle(); +extern void *nis_get_static_storage(); +extern char *nis_data(); +extern char *nis_old_data(); + +extern void nis_print_rights(); +extern void nis_print_directory(); +extern void nis_print_group(); +extern void nis_print_table(); +extern void nis_print_link(); +extern void nis_print_entry(); + +extern nis_server *__nis_init_callback(); +extern int __nis_run_callback(); + +extern log_result *nis_dump(); +extern log_result *nis_dumplog(); +extern nis_name __nis_rpc_domain(); + +extern bool_t __do_ismember(); +extern nis_name __nis_map_group(); +extern nis_name __nis_map_group_r(); + +void __nis_CacheStart(); +nis_error __nis_CacheBind(); +bool_t __nis_CacheRemoveEntry(); +nis_error __nis_CacheSearch(); +void __nis_CacheRestart(); +void __nis_CachePrint(); +void __nis_CachePrintDir(); +bool_t __nis_CacheAddEntry(); +void __nis_CacheRefreshEntry(); +nis_error __nis_CacheBindDir(); +nis_error __nis_CacheBindMaster(); +nis_error __nis_CacheBindServer(); +int __nis_CacheRefreshBinding(); +int __nis_CacheRefreshAddress(); +int __nis_CacheRefreshCallback(); +nis_error __nis_CacheLocalInit(); +uint32_t __nis_CacheLocalLoadPref(); +nis_error __nis_CacheMgrInit(); +void __nis_CacheMgrCleanup(); +void __nis_CacheMgrReadColdstart(); +nis_error __nis_CacheMgrBindReplica(); +nis_error __nis_CacheMgrBindMaster(); +nis_error __nis_CacheMgrBindServer(); +int __nis_CacheMgrRefreshBinding(); +int __nis_CacheMgrRefreshAddress(); +int __nis_CacheMgrRefreshCallback(); +int __nis_CacheMgrUpdateUaddr(); +void __nis_CacheMgrMarkUp(); +uint32_t __nis_CacheMgrTimers(); +uint32_t __nis_CacheMgrRefreshCache(); +uint32_t __nis_serverRefreshCache(); + +extern CLIENT *__get_ti_clnt(); +extern int __strcmp_case_insens(); +extern int __strncmp_case_insens(); + +extern fd_result *nis_finddirectory(); +extern int __start_clock(); +extern uint32_t __stop_clock(); + +fd_result *__nis_finddirectory(); +int __dir_prefix(); +void __free_break_name(); +void __broken_name_print(); +void __free_fdresult(); +nis_error __nis_ping_servers(); +struct netconfig *__nis_get_netconfig(); +int __dir_same(); +void nis_free_binding(); +char *__nis_xdr_dup(); + +CLIENT *__nis_clnt_create(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _RPCSVC_NISLIB_H */ diff --git a/usr/src/head/rpcsvc/nispasswd.x b/usr/src/head/rpcsvc/nispasswd.x new file mode 100644 index 0000000000..daf37385c0 --- /dev/null +++ b/usr/src/head/rpcsvc/nispasswd.x @@ -0,0 +1,194 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* + * NIS+ password update protocol + * + * Copyright (c) 1994, 1997 by Sun Microsystems Inc + * All Rights Reserved. + * + * ident "%Z%%M% %I% %E% SMI" + */ + +/* + * Protocol description: + * Request from client: + * Key_type = DES; CK = common DES key generated from Pub.D and Sec.C + * Response from daemon: + * Key_type = DES; CK = common DES key generated from Pub.C and Sec.D + * + * Client Daemon + * + * -------------------------------------------------------------------> + * [ Username, Domain, Key_type, Publickey.C, CK(clear_password), ID ] + * + * + * <------------------------------------------------------------------- + * [NPD_SUCCESS, CK(ID, Random_value) ] + * [NPD_TRYAGAIN, CK(ID, Random_value) ] + * [NPD_FAILED, <code> ] + * + * { repeat above req/resp as necessary } + * + * --------------------------------------------------------------------> + * [ ID, CK(R, clear_new_passwd), other_passwd_info ] + * + * + * <-------------------------------------------------------------------- + * [NPD_SUCCESS] + * [NPD_PARTIALSUCCESS, <field>/<code> ] + * [NPD_FAILED, <code> ] + * + */ + +/* + * status of operation, NPD = NIS+ PASSWD DAEMON + */ +enum nispasswd_status { + NPD_SUCCESS, /* operation succeeded */ + NPD_TRYAGAIN, /* passwd incorrect, try again */ + NPD_PARTIALSUCCESS, /* failed to update all the info */ + NPD_FAILED /* operation failed */ +}; + +/* + * error codes + */ +enum nispasswd_code { + NPD_NOTMASTER, /* server is not master of this domain */ + NPD_NOSUCHENTRY, /* no passwd entry exists for this user */ + NPD_IDENTINVALID, /* identifier invalid */ + NPD_NOPASSWD, /* no password stored */ + NPD_NOSHDWINFO, /* no shadow information stored */ + NPD_SHDWCORRUPT, /* shadow information corrupted */ + NPD_NOTAGED, /* passwd has not aged sufficiently */ + NPD_CKGENFAILED, /* common key could not be generated */ + NPD_VERFINVALID, /* verifier mismatch */ + NPD_PASSINVALID, /* all auth attempts incorrect */ + NPD_ENCRYPTFAIL, /* encryption failed */ + NPD_DECRYPTFAIL, /* decryption failed */ + NPD_KEYSUPDATED, /* new key-pair generated for user */ + NPD_KEYNOTREENC, /* could not reencrypt secret key */ + NPD_PERMDENIED, /* permission denied */ + NPD_SRVNOTRESP, /* server not responding */ + NPD_NISERROR, /* NIS+ server error */ + NPD_SYSTEMERR, /* system error */ + NPD_BUFTOOSMALL, /* buffer too small */ + NPD_INVALIDARGS /* invalid args to function */ + + /* others */ +}; + +/* + * other passwd fields that change and secretkey + */ +enum nispasswd_field { + NPD_PASSWD, /* password field */ + NPD_GECOS, /* gecos field */ + NPD_SHELL, /* shell field */ + NPD_SECRETKEY /* secret key */ +}; + +/* + * error reason + */ + +struct nispasswd_error { + nispasswd_field npd_field; /* field type */ + nispasswd_code npd_code; /* error code */ + struct nispasswd_error *next; /* next pair */ +}; + +/* + * other passwd information + */ +struct passwd_info { + string pw_gecos<>; /* in real life name */ + string pw_shell<>; /* default shell */ +}; + +struct npd_request { + string username<>; /* update req. for username */ + string domain<>; /* update in domain */ + string key_type<>; /* DES, RSA, KERB */ + unsigned char user_pub_key<>; /* generated publickey */ + unsigned char npd_authpass<>; /* encrypted passwd */ + unsigned int ident; /* identifier */ +}; + +/* + * encrypted passwd information + */ +const __NPD_MAXPASSBYTES = 12; +typedef opaque passbuf[__NPD_MAXPASSBYTES]; /* store encrypted pass */ + +struct npd_newpass { + unsigned int npd_xrandval; /* R */ + passbuf pass; /* "clear" new passwd */ +}; + +struct npd_update { + unsigned int ident; /* identifier */ + npd_newpass xnewpass; /* encrypted */ + passwd_info pass_info; /* other information */ +}; + +struct nispasswd_verf { + unsigned int npd_xid; /* encrypted identifier */ + unsigned int npd_xrandval; /* encrypted R */ +}; + +/* + * authentication result + */ +union nispasswd_authresult switch (nispasswd_status status) { +case NPD_SUCCESS: +case NPD_TRYAGAIN: + nispasswd_verf npd_verf; /* verifier */ +default: + nispasswd_code npd_err; /* error */ +}; + +/* + * update result + */ +union nispasswd_updresult switch (nispasswd_status status) { +case NPD_PARTIALSUCCESS: + nispasswd_error reason; /* field/code */ +case NPD_FAILED: + nispasswd_code npd_err; /* error */ +default: + void; +}; + +program NISPASSWD_PROG { + version NISPASSWD_VERS { + /* + * authenticate passwd update request + */ + nispasswd_authresult NISPASSWD_AUTHENTICATE(npd_request) = 1; + + /* + * send new passwd information + */ + nispasswd_updresult NISPASSWD_UPDATE(npd_update) = 2; + } = 1; +} = 100303; diff --git a/usr/src/head/rpcsvc/nlm_prot.x b/usr/src/head/rpcsvc/nlm_prot.x new file mode 100644 index 0000000000..1583fead44 --- /dev/null +++ b/usr/src/head/rpcsvc/nlm_prot.x @@ -0,0 +1,452 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* + * Network lock manager protocol definition + * Copyright (C) 1986, 1992, 1993, 1997, 1999 by Sun Microsystems, Inc. + * All rights reserved. + * + * Protocol used between local lock manager and remote lock manager. + * + * There are currently 3 versions of the protocol in use. Versions 1 + * and 3 are used with NFS version 2. Version 4 is used with NFS + * version 3. + * + * (Note: there is also a version 2, but it defines an orthogonal set of + * procedures that the status monitor uses to notify the lock manager of + * changes in monitored systems.) + */ + +%#pragma ident "%Z%%M% %I% %E% SMI" + +#if RPC_HDR +% +%#include <rpc/rpc_sztypes.h> +% +#endif + +#ifdef RPC_HDR +%#define LM_MAXSTRLEN 1024 +%#define LM_MAXNAMELEN (LM_MAXSTRLEN + 1) +#endif + +/* + * Types for versions 1 and 3. + */ + +/* + * Status of a call to the lock manager. The lower case enums violate the + * current style guide, but we're stuck with 'em. + */ + +enum nlm_stats { + nlm_granted = 0, + nlm_denied = 1, + nlm_denied_nolocks = 2, + nlm_blocked = 3, + nlm_denied_grace_period = 4, + nlm_deadlck = 5 +}; + +/* + * The holder of a conflicting lock. + */ + +struct nlm_holder { + bool exclusive; + int svid; + netobj oh; + unsigned l_offset; + unsigned l_len; +}; + +union nlm_testrply switch (nlm_stats stat) { + case nlm_denied: + struct nlm_holder holder; + default: + void; +}; + +struct nlm_stat { + nlm_stats stat; +}; + +struct nlm_res { + netobj cookie; + nlm_stat stat; +}; + +struct nlm_testres { + netobj cookie; + nlm_testrply stat; +}; + +struct nlm_lock { + string caller_name<LM_MAXSTRLEN>; + netobj fh; /* identify a file */ + netobj oh; /* identify owner of a lock */ + int svid; /* generated from pid for svid */ + unsigned l_offset; + unsigned l_len; +}; + +struct nlm_lockargs { + netobj cookie; + bool block; + bool exclusive; + struct nlm_lock alock; + bool reclaim; /* used for recovering locks */ + int state; /* specify local status monitor state */ +}; + +struct nlm_cancargs { + netobj cookie; + bool block; + bool exclusive; + struct nlm_lock alock; +}; + +struct nlm_testargs { + netobj cookie; + bool exclusive; + struct nlm_lock alock; +}; + +struct nlm_unlockargs { + netobj cookie; + struct nlm_lock alock; +}; + +#ifdef RPC_HDR +%/* +% * The following enums are actually bit encoded for efficient +% * boolean algebra.... DON'T change them..... +% * The mixed-case enums violate the present style guide, but we're +% * stuck with 'em. +% */ +#endif + +enum fsh_mode { + fsm_DN = 0, /* deny none */ + fsm_DR = 1, /* deny read */ + fsm_DW = 2, /* deny write */ + fsm_DRW = 3 /* deny read/write */ +}; + +enum fsh_access { + fsa_NONE = 0, /* for completeness */ + fsa_R = 1, /* read only */ + fsa_W = 2, /* write only */ + fsa_RW = 3 /* read/write */ +}; + +struct nlm_share { + string caller_name<LM_MAXSTRLEN>; + netobj fh; + netobj oh; + fsh_mode mode; + fsh_access access; +}; + +struct nlm_shareargs { + netobj cookie; + nlm_share share; + bool reclaim; +}; + +struct nlm_shareres { + netobj cookie; + nlm_stats stat; + int sequence; +}; + +struct nlm_notify { + string name<LM_MAXNAMELEN>; + int state; +}; + +/* + * Types for version 4. + * + * This revision is designed to work with NFS V3. The main changes from + * NFS V2 to V3 that affect the NLM protocol are that all file offsets + * and sizes are now unsigned 64-bit ints, and file handles are now + * variable length. In NLM V1 and V3, the fixed-length V2 file handle + * was encoded as a 'netobj', which is a count followed by the data + * bytes. For NLM 4, the file handle is already a count followed by + * data bytes, so the handle is copied directly into the netobj, rather + * than being encoded with an additional byte count. + */ + +/* + * Status of a call to the lock manager. + */ + +enum nlm4_stats { + NLM4_GRANTED = 0, /* lock was granted */ + NLM4_DENIED = 1, /* lock was not granted, usually */ + /* due to conflicting lock */ + NLM4_DENIED_NOLOCKS = 2, /* not granted: out of resources */ + NLM4_BLOCKED = 3, /* not granted: expect callback */ + /* when granted */ + NLM4_DENIED_GRACE_PERIOD = 4, /* not granted: server is */ + /* reestablishing old locks */ + NLM4_DEADLCK = 5, /* not granted: deadlock detected */ + NLM4_ROFS = 6, /* not granted: read-only filesystem */ + NLM4_STALE_FH = 7, /* not granted: stale file handle */ + NLM4_FBIG = 8, /* not granted: offset or length */ + /* too big */ + NLM4_FAILED = 9 /* not granted: some other error */ +}; + +/* + * The holder of a conflicting lock. + */ + +struct nlm4_holder { + bool exclusive; + int32 svid; + netobj oh; + uint64 l_offset; + uint64 l_len; +}; + +union nlm4_testrply switch (nlm4_stats stat) { + case NLM4_DENIED: + struct nlm4_holder holder; + default: + void; +}; + +struct nlm4_stat { + nlm4_stats stat; +}; + +struct nlm4_res { + netobj cookie; + nlm4_stat stat; +}; + +struct nlm4_testres { + netobj cookie; + nlm4_testrply stat; +}; + +struct nlm4_lock { + string caller_name<LM_MAXSTRLEN>; + netobj fh; /* identify a file */ + netobj oh; /* identify owner of a lock */ + int32 svid; /* generated from pid for svid */ + uint64 l_offset; + uint64 l_len; +}; + +struct nlm4_lockargs { + netobj cookie; + bool block; + bool exclusive; + struct nlm4_lock alock; + bool reclaim; /* used for recovering locks */ + int32 state; /* specify local status monitor state */ +}; + +struct nlm4_cancargs { + netobj cookie; + bool block; + bool exclusive; + struct nlm4_lock alock; +}; + +struct nlm4_testargs { + netobj cookie; + bool exclusive; + struct nlm4_lock alock; +}; + +struct nlm4_unlockargs { + netobj cookie; + struct nlm4_lock alock; +}; + +#ifdef RPC_HDR +%/* +% * The following enums are actually bit encoded for efficient +% * boolean algebra.... DON'T change them..... +% */ +#endif + +enum fsh4_mode { + FSM_DN = 0, /* deny none */ + FSM_DR = 1, /* deny read */ + FSM_DW = 2, /* deny write */ + FSM_DRW = 3 /* deny read/write */ +}; + +enum fsh4_access { + FSA_NONE = 0, /* for completeness */ + FSA_R = 1, /* read only */ + FSA_W = 2, /* write only */ + FSA_RW = 3 /* read/write */ +}; + +struct nlm4_share { + string caller_name<LM_MAXSTRLEN>; + netobj fh; + netobj oh; + fsh4_mode mode; + fsh4_access access; +}; + +struct nlm4_shareargs { + netobj cookie; + nlm4_share share; + bool reclaim; +}; + +struct nlm4_shareres { + netobj cookie; + nlm4_stats stat; + int32 sequence; +}; + +struct nlm4_notify { + string name<LM_MAXNAMELEN>; + int32 state; +}; + +/* + * Over-the-wire protocol used between the network lock managers + */ + +program NLM_PROG { + version NLM_VERS { + + nlm_testres + NLM_TEST(nlm_testargs) = 1; + + nlm_res + NLM_LOCK(nlm_lockargs) = 2; + + nlm_res + NLM_CANCEL(nlm_cancargs) = 3; + + nlm_res + NLM_UNLOCK(nlm_unlockargs) = 4; + /* + * remote lock manager call-back to grant lock + */ + nlm_res + NLM_GRANTED(nlm_testargs) = 5; + + /* + * message passing style of requesting lock + */ + + void + NLM_TEST_MSG(nlm_testargs) = 6; + void + NLM_LOCK_MSG(nlm_lockargs) = 7; + void + NLM_CANCEL_MSG(nlm_cancargs) = 8; + void + NLM_UNLOCK_MSG(nlm_unlockargs) = 9; + void + NLM_GRANTED_MSG(nlm_testargs) = 10; + void + NLM_TEST_RES(nlm_testres) = 11; + void + NLM_LOCK_RES(nlm_res) = 12; + void + NLM_CANCEL_RES(nlm_res) = 13; + void + NLM_UNLOCK_RES(nlm_res) = 14; + void + NLM_GRANTED_RES(nlm_res) = 15; + } = 1; + + version NLM_VERSX { + nlm_shareres + NLM_SHARE(nlm_shareargs) = 20; + nlm_shareres + NLM_UNSHARE(nlm_shareargs) = 21; + nlm_res + NLM_NM_LOCK(nlm_lockargs) = 22; + void + NLM_FREE_ALL(nlm_notify) = 23; + } = 3; + + version NLM4_VERS { + void + NLMPROC4_NULL(void) = 0; + nlm4_testres + NLMPROC4_TEST(nlm4_testargs) = 1; + nlm4_res + NLMPROC4_LOCK(nlm4_lockargs) = 2; + nlm4_res + NLMPROC4_CANCEL(nlm4_cancargs) = 3; + nlm4_res + NLMPROC4_UNLOCK(nlm4_unlockargs) = 4; + /* + * remote lock manager call-back to grant lock + */ + nlm4_res + NLMPROC4_GRANTED(nlm4_testargs) = 5; + + /* + * message passing style of requesting lock + */ + + void + NLMPROC4_TEST_MSG(nlm4_testargs) = 6; + void + NLMPROC4_LOCK_MSG(nlm4_lockargs) = 7; + void + NLMPROC4_CANCEL_MSG(nlm4_cancargs) = 8; + void + NLMPROC4_UNLOCK_MSG(nlm4_unlockargs) = 9; + void + NLMPROC4_GRANTED_MSG(nlm4_testargs) = 10; + void + NLMPROC4_TEST_RES(nlm4_testres) = 11; + void + NLMPROC4_LOCK_RES(nlm4_res) = 12; + void + NLMPROC4_CANCEL_RES(nlm4_res) = 13; + void + NLMPROC4_UNLOCK_RES(nlm4_res) = 14; + void + NLMPROC4_GRANTED_RES(nlm4_res) = 15; + + /* + * DOS-style file sharing + */ + + nlm4_shareres + NLMPROC4_SHARE(nlm4_shareargs) = 20; + nlm4_shareres + NLMPROC4_UNSHARE(nlm4_shareargs) = 21; + nlm4_res + NLMPROC4_NM_LOCK(nlm4_lockargs) = 22; + void + NLMPROC4_FREE_ALL(nlm4_notify) = 23; + } = 4; + +} = 100021; diff --git a/usr/src/head/rpcsvc/rex.x b/usr/src/head/rpcsvc/rex.x new file mode 100644 index 0000000000..8e137ce871 --- /dev/null +++ b/usr/src/head/rpcsvc/rex.x @@ -0,0 +1,230 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1987 by Sun Microsystems, Inc. +% */ + +%/* from rex.x */ + +#ifdef RPC_HDR +% +%#pragma ident "%Z%%M% %I% %E% SMI" +% +#endif + +/* + * Remote execution (rex) protocol specification + */ + +const STRINGSIZE = 1024; +typedef string rexstring<1024>; + +/* + * values to pass to REXPROC_SIGNAL + */ +const SIGINT = 2; /* interrupt */ + +/* + * Values for rst_flags, below + */ +const REX_INTERACTIVE = 1; /* interactive mode */ + +struct rex_start { + rexstring rst_cmd<>; /* list of command and args */ + rexstring rst_host; /* working directory host name */ + rexstring rst_fsname; /* working directory file system name */ + rexstring rst_dirwithin;/* working directory within file system */ + rexstring rst_env<>; /* list of environment */ + unsigned int rst_port0; /* port for stdin */ + unsigned int rst_port1; /* port for stdout */ + unsigned int rst_port2; /* port for stderr */ + unsigned int rst_flags; /* options - see const above */ +}; + +struct rex_result { + int rlt_stat; /* integer status code */ + rexstring rlt_message; /* string message for human consumption */ +}; + + +struct sgttyb { + unsigned four; /* always equals 4 */ + opaque chars[4]; + /* chars[0] == input speed */ + /* chars[1] == output speed */ + /* chars[2] == kill character */ + /* chars[3] == erase character */ + unsigned flags; +}; +/* values for speeds above (baud rates) */ +const B0 = 0; +const B50 = 1; +const B75 = 2; +const B110 = 3; +const B134 = 4; +const B150 = 5; +const B200 = 6; +const B300 = 7; +const B600 = 8; +const B1200 = 9; +const B1800 = 10; +const B2400 = 11; +const B4800 = 12; +const B9600 = 13; +const B19200 = 14; +const B38400 = 15; + +/* values for flags above */ +const TANDEM = 0x00000001; /* send stopc on out q full */ +const CBREAK = 0x00000002; /* half-cooked mode */ +const LCASE = 0x00000004; /* simulate lower case */ +const ECHO = 0x00000008; /* echo input */ +const CRMOD = 0x00000010; /* map \r to \r\n on output */ +const RAW = 0x00000020; /* no i/o processing */ +const ODDP = 0x00000040; /* get/send odd parity */ +const EVENP = 0x00000080; /* get/send even parity */ +const ANYP = 0x000000c0; /* get any parity/send none */ +const NLDELAY = 0x00000300; /* \n delay */ +const NL0 = 0x00000000; +const NL1 = 0x00000100; /* tty 37 */ +const NL2 = 0x00000200; /* vt05 */ +const NL3 = 0x00000300; +const TBDELAY = 0x00000c00; /* horizontal tab delay */ +const TAB0 = 0x00000000; +const TAB1 = 0x00000400; /* tty 37 */ +const TAB2 = 0x00000800; +const XTABS = 0x00000c00; /* expand tabs on output */ +const CRDELAY = 0x00003000; /* \r delay */ +const CR0 = 0x00000000; +const CR1 = 0x00001000; /* tn 300 */ +const CR2 = 0x00002000; /* tty 37 */ +const CR3 = 0x00003000; /* concept 100 */ +const VTDELAY = 0x00004000; /* vertical tab delay */ +const FF0 = 0x00000000; +const FF1 = 0x00004000; /* tty 37 */ +const BSDELAY = 0x00008000; /* \b delay */ +const BS0 = 0x00000000; +const BS1 = 0x00008000; +const CRTBS = 0x00010000; /* do backspacing for crt */ +const PRTERA = 0x00020000; /* \ ... / erase */ +const CRTERA = 0x00040000; /* " \b " to wipe out char */ +const TILDE = 0x00080000; /* hazeltine tilde kludge */ +const MDMBUF = 0x00100000; /* start/stop output on carrier intr */ +const LITOUT = 0x00200000; /* literal output */ +const TOSTOP = 0x00400000; /* SIGTTOU on background output */ +const FLUSHO = 0x00800000; /* flush output to terminal */ +const NOHANG = 0x01000000; /* no SIGHUP on carrier drop */ +const L001000 = 0x02000000; +const CRTKIL = 0x04000000; /* kill line with " \b " */ +const PASS8 = 0x08000000; +const CTLECH = 0x10000000; /* echo control chars as ^X */ +const PENDIN = 0x20000000; /* tp->t_rawq needs reread */ +const DECCTQ = 0x40000000; /* only ^Q starts after ^S */ +const NOFLSH = 0x80000000; /* no output flush on signal */ + +struct tchars { + unsigned six; /* always equals 6 */ + opaque chars[6]; + /* chars[0] == interrupt char */ + /* chars[1] == quit char */ + /* chars[2] == start output char */ + /* chars[3] == stop output char */ + /* chars[4] == end-of-file char */ + /* chars[5] == input delimeter (like nl) */ +}; + +struct ltchars { + unsigned six; /* always equals 6 */ + opaque chars[6]; + /* chars[0] == stop process signal */ + /* chars[1] == delayed stop process signal */ + /* chars[2] == reprint line */ + /* chars[3] == flush output */ + /* chars[4] == word erase */ + /* chars[5] == literal next character */ + unsigned mode; +}; + +struct rex_ttysize { + int ts_lines; + int ts_cols; +}; + +struct rex_ttymode { + sgttyb basic; /* standard unix tty flags */ + tchars more; /* interrupt, kill characters, etc. */ + ltchars yetmore; /* special Berkeley characters */ + unsigned andmore; /* and Berkeley modes */ +}; + +/* values for andmore above */ +const LCRTBS = 0x0001; /* do backspacing for crt */ +const LPRTERA = 0x0002; /* \ ... / erase */ +const LCRTERA = 0x0004; /* " \b " to wipe out char */ +const LTILDE = 0x0008; /* hazeltine tilde kludge */ +const LMDMBUF = 0x0010; /* start/stop output on carrier intr */ +const LLITOUT = 0x0020; /* literal output */ +const LTOSTOP = 0x0040; /* SIGTTOU on background output */ +const LFLUSHO = 0x0080; /* flush output to terminal */ +const LNOHANG = 0x0100; /* no SIGHUP on carrier drop */ +const LL001000 = 0x0200; +const LCRTKIL = 0x0400; /* kill line with " \b " */ +const LPASS8 = 0x0800; +const LCTLECH = 0x1000; /* echo control chars as ^X */ +const LPENDIN = 0x2000; /* needs reread */ +const LDECCTQ = 0x4000; /* only ^Q starts after ^S */ +const LNOFLSH = 0x8000; /* no output flush on signal */ + +program REXPROG { + version REXVERS { + + /* + * Start remote execution + */ + rex_result + REXPROC_START(rex_start) = 1; + + /* + * Wait for remote execution to terminate + */ + rex_result + REXPROC_WAIT(void) = 2; + + /* + * Send tty modes + */ + void + REXPROC_MODES(rex_ttymode) = 3; + + /* + * Send window size change + */ + void + REXPROC_WINCH(rex_ttysize) = 4; + + /* + * Send other signal + */ + void + REXPROC_SIGNAL(int) = 5; + } = 1; +} = 100017; diff --git a/usr/src/head/rpcsvc/rpc_sztypes.h b/usr/src/head/rpcsvc/rpc_sztypes.h new file mode 100644 index 0000000000..3161bb7e54 --- /dev/null +++ b/usr/src/head/rpcsvc/rpc_sztypes.h @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1994, by Sun Microsystems, Inc. + */ + +#ifndef _RPCSVC_RPC_SZTYPES_H +#define _RPCSVC_RPC_SZTYPES_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <rpc/rpc_sztypes.h> + +#endif /* _RPCSVC_RPC_SZTYPES_H */ diff --git a/usr/src/head/rpcsvc/rquota.x b/usr/src/head/rpcsvc/rquota.x new file mode 100644 index 0000000000..2b1a677aee --- /dev/null +++ b/usr/src/head/rpcsvc/rquota.x @@ -0,0 +1,85 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1987 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* #ident "%Z%%M% %I% %E% SMI" */ + +/* + * Remote quota protocol + * Requires unix authentication + */ + +const RQ_PATHLEN = 1024; + +struct getquota_args { + string gqa_pathp<RQ_PATHLEN>; /* path to filesystem of interest */ + int32_t gqa_uid; /* inquire about quota for uid */ +}; + +/* + * remote quota structure + */ +struct rquota { + int32_t rq_bsize; /* block size for block counts */ + bool rq_active; /* indicates whether quota is active */ + uint32_t rq_bhardlimit; /* absolute limit on disk blks alloc */ + uint32_t rq_bsoftlimit; /* preferred limit on disk blks */ + uint32_t rq_curblocks; /* current block count */ + uint32_t rq_fhardlimit; /* absolute limit on allocated files */ + uint32_t rq_fsoftlimit; /* preferred file limit */ + uint32_t rq_curfiles; /* current # allocated files */ + uint32_t rq_btimeleft; /* time left for excessive disk use */ + uint32_t rq_ftimeleft; /* time left for excessive files */ +}; + +enum gqr_status { + Q_OK = 1, /* quota returned */ + Q_NOQUOTA = 2, /* noquota for uid */ + Q_EPERM = 3 /* no permission to access quota */ +}; + +union getquota_rslt switch (gqr_status status) { +case Q_OK: + rquota gqr_rquota; /* valid if status == Q_OK */ +case Q_NOQUOTA: + void; +case Q_EPERM: + void; +}; + +program RQUOTAPROG { + version RQUOTAVERS { + /* + * Get all quotas + */ + getquota_rslt + RQUOTAPROC_GETQUOTA(getquota_args) = 1; + + /* + * Get active quotas only + */ + getquota_rslt + RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2; + } = 1; +} = 100011; diff --git a/usr/src/head/rpcsvc/rstat.x b/usr/src/head/rpcsvc/rstat.x new file mode 100644 index 0000000000..3a0cfa5170 --- /dev/null +++ b/usr/src/head/rpcsvc/rstat.x @@ -0,0 +1,178 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1985, 1990, 1991 by Sun Microsystems, Inc. +% */ + +%/* from rstat.x */ + +/* + * Gather statistics on remote machines + */ + +#ifdef RPC_HDR +% +%#pragma ident "%Z%%M% %I% %E% SMI" +% +%/* +% * Scale factor for scaled integers used to count load averages. +% */ +%#ifndef FSCALE +%#define FSHIFT 8 /* bits to right of fixed binary point */ +%#define FSCALE (1<<FSHIFT) +%#endif /* ndef FSCALE */ +% +%#ifndef DST_NONE +%#include <sys/time.h> /* The time struct defined below is */ +%#endif /* meant to match struct timeval. */ +% +% +% +% +% +% +#elif RPC_SVC +% +%/* +% * Server side stub routines for the rstat daemon +% */ +% +#elif RPC_CLNT +% +%/* +% * Client side stub routines for the rstat daemon +% */ +% +#elif RPC_XDR +%/* +% * XDR routines for the rstat daemon, rup and perfmeter. +% */ +% +%/* +% * xdr_timeval was used in previous releases. +% */ +% +%bool_t +%#ifdef __STDC__ +%xdr_timeval(XDR *xdrs, struct timeval *tvp) +%#else /* K&R C */ +%xdr_timeval(xdrs, tvp) +% XDR *xdrs; +% struct timeval *tvp; +%#endif /* K&R C */ +%{ +% return (xdr_rstat_timeval(xdrs, (rstat_timeval *)tvp)); +%} + +% +#endif + +const RSTAT_CPUSTATES = 4; +const RSTAT_DK_NDRIVE = 4; + +/* + * the cpu stat values + */ + +const RSTAT_CPU_USER = 0; +const RSTAT_CPU_NICE = 1; +const RSTAT_CPU_SYS = 2; +const RSTAT_CPU_IDLE = 3; + +/* + * GMT since 0:00, January 1, 1970 + */ +struct rstat_timeval { + int tv_sec; /* seconds */ + int tv_usec; /* and microseconds */ +}; + +struct statsvar { /* RSTATVERS_VAR */ + int cp_time<>; /* variable number of CPU states */ + int dk_xfer<>; /* variable number of disks */ + unsigned v_pgpgin; /* these are cumulative sum */ + unsigned v_pgpgout; + unsigned v_pswpin; + unsigned v_pswpout; + unsigned v_intr; + int if_ipackets; + int if_ierrors; + int if_opackets; + int if_oerrors; + int if_collisions; + unsigned v_swtch; + int avenrun[3]; + rstat_timeval boottime; + rstat_timeval curtime; +}; + +struct statstime { /* RSTATVERS_TIME */ + int cp_time[RSTAT_CPUSTATES]; + int dk_xfer[RSTAT_DK_NDRIVE]; + unsigned int v_pgpgin; /* these are cumulative sum */ + unsigned int v_pgpgout; + unsigned int v_pswpin; + unsigned int v_pswpout; + unsigned int v_intr; + int if_ipackets; + int if_ierrors; + int if_oerrors; + int if_collisions; + unsigned int v_swtch; + int avenrun[3]; + rstat_timeval boottime; + rstat_timeval curtime; + int if_opackets; +}; + +program RSTATPROG { + /* + * Version 4 allows for variable number of disk and RSTAT_CPU states. + */ + version RSTATVERS_VAR { + statsvar + RSTATPROC_STATS (void) = 1; + unsigned int + RSTATPROC_HAVEDISK (void) = 2; + } = 4; + /* + * Newest version includes current time and context switching info + */ + version RSTATVERS_TIME { + statstime + RSTATPROC_STATS(void) = 1; + unsigned int + RSTATPROC_HAVEDISK(void) = 2; + } = 3; +} = 100001; + +#ifdef RPC_HDR +% +%#if defined(__STDC__) || defined(__cplusplus) +%enum clnt_stat rstat(char *, struct statstime *); +%int havedisk(char *); +%#else +%enum clnt_stat rstat(); +%int havedisk(); +%#endif +% +#endif diff --git a/usr/src/head/rpcsvc/rusers.x b/usr/src/head/rpcsvc/rusers.x new file mode 100644 index 0000000000..4a44ca3da6 --- /dev/null +++ b/usr/src/head/rpcsvc/rusers.x @@ -0,0 +1,122 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1991 Sun Microsystems, Inc. + * #ident "%Z%%M% %I% %E% SMI" + */ + +%/* +% * Find out about remote users +% */ + +const RUSERS_MAXUSERLEN = 32; +const RUSERS_MAXLINELEN = 32; +const RUSERS_MAXHOSTLEN = 257; + +struct rusers_utmp { + string ut_user<RUSERS_MAXUSERLEN>; /* aka ut_name */ + string ut_line<RUSERS_MAXLINELEN>; /* device */ + string ut_host<RUSERS_MAXHOSTLEN>; /* host user logged on from */ + int ut_type; /* type of entry */ + int ut_time; /* time entry was made */ + unsigned int ut_idle; /* minutes idle */ +}; + +typedef rusers_utmp utmp_array<>; + +#ifdef RPC_HDR +% +%/* +% * Values for ut_type field above. +% */ +#endif +const RUSERS_EMPTY = 0; +const RUSERS_RUN_LVL = 1; +const RUSERS_BOOT_TIME = 2; +const RUSERS_OLD_TIME = 3; +const RUSERS_NEW_TIME = 4; +const RUSERS_INIT_PROCESS = 5; +const RUSERS_LOGIN_PROCESS = 6; +const RUSERS_USER_PROCESS = 7; +const RUSERS_DEAD_PROCESS = 8; +const RUSERS_ACCOUNTING = 9; + +program RUSERSPROG { + + version RUSERSVERS_3 { + int + RUSERSPROC_NUM(void) = 1; + + utmp_array + RUSERSPROC_NAMES(void) = 2; + + utmp_array + RUSERSPROC_ALLNAMES(void) = 3; + } = 3; + +} = 100002; + +#ifdef RPC_HDR +% +% +% +%/* +% * The following structures are used by version 2 of the rusersd protocol. +% * They were not developed with rpcgen, so they do not appear as RPCL. +% */ +% +%#define RUSERSVERS_IDLE 2 +%#define RUSERSVERS 3 /* current version */ +%#define MAXUSERS 100 +% +%/* +% * This is the structure used in version 2 of the rusersd RPC service. +% * It corresponds to the utmp structure for BSD sytems. +% */ +%struct ru_utmp { +% char ut_line[8]; /* tty name */ +% char ut_name[8]; /* user id */ +% char ut_host[16]; /* host name, if remote */ +% time_t ut_time; /* time on */ +%}; +% +%struct utmpidle { +% struct ru_utmp ui_utmp; +% unsigned ui_idle; +%}; +% +%struct utmpidlearr { +% struct utmpidle **uia_arr; +% int uia_cnt; +%}; +% +%int xdr_utmpidlearr(); +% +%#if defined(__STDC__) || defined(__cplusplus) +%enum clnt_stat rusers(char *host, struct utmpidlearr *up); +%int rnusers(char *host); +%#else +%enum clnt_stat rusers(); +%int rnusers(); +%#endif +% +#endif diff --git a/usr/src/head/rpcsvc/rwall.x b/usr/src/head/rpcsvc/rwall.x new file mode 100644 index 0000000000..6cc2416735 --- /dev/null +++ b/usr/src/head/rpcsvc/rwall.x @@ -0,0 +1,69 @@ +%/* +% * Copyright 2005 Sun Microsystems, Inc. All rights reserved. +% * Use is subject to license terms. +% * +% * CDDL HEADER START +% * +% * The contents of this file are subject to the terms of the +% * Common Development and Distribution License, Version 1.0 only +% * (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 +% * or http://www.opensolaris.org/os/licensing. +% * 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 +% */ + +%/* from rwall.x */ +% +%/* +% * Remote write-all ONC service +% */ + +#ifdef RPC_HDR +% +#elif RPC_SVC +% +%/* +% * Server side stub routines for the rpc.rwalld daemon +% */ +% +#elif RPC_CLNT +% +%/* +% * Client side stub routines for the rwall program +% */ +% +#endif + +typedef string wrapstring<>; /* Define for RPC library's xdr_wrapstring */ + +program WALLPROG { + version WALLVERS { + /* + * There is no procedure 1 + */ + void + WALLPROC_WALL (wrapstring) = 2; + } = 1; +} = 100008; + +#ifdef RPC_HDR +% +% +%#if defined(__STDC__) || defined(__cplusplus) +%enum clnt_stat rwall(char *, char *); +%#else +%enum clnt_stat rwall(); +%#endif +% +#endif diff --git a/usr/src/head/rpcsvc/spray.x b/usr/src/head/rpcsvc/spray.x new file mode 100644 index 0000000000..765264994a --- /dev/null +++ b/usr/src/head/rpcsvc/spray.x @@ -0,0 +1,85 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1987, 1991 by Sun Microsystems, Inc. +% */ + +%/* from spray.x */ + +#ifdef RPC_HDR +% +%#pragma ident "%Z%%M% %I% %E% SMI" +% +#endif + +/* + * Spray a server with packets + * Useful for testing flakiness of network interfaces + */ + +const SPRAYMAX = 8845; /* max amount can spray */ + +/* + * GMT since 0:00, 1 January 1970 + */ +struct spraytimeval { + unsigned int sec; + unsigned int usec; +}; + +/* + * spray statistics + */ +struct spraycumul { + unsigned int counter; + spraytimeval clock; +}; + +/* + * spray data + */ +typedef opaque sprayarr<SPRAYMAX>; + +program SPRAYPROG { + version SPRAYVERS { + /* + * Just throw away the data and increment the counter + * This call never returns, so the client should always + * time it out. + */ + void + SPRAYPROC_SPRAY(sprayarr) = 1; + + /* + * Get the value of the counter and elapsed time since + * last CLEAR. + */ + spraycumul + SPRAYPROC_GET(void) = 2; + + /* + * Clear the counter and reset the elapsed time + */ + void + SPRAYPROC_CLEAR(void) = 3; + } = 1; +} = 100012; diff --git a/usr/src/head/rpcsvc/ufs_prot.x b/usr/src/head/rpcsvc/ufs_prot.x new file mode 100644 index 0000000000..4bc2d67bea --- /dev/null +++ b/usr/src/head/rpcsvc/ufs_prot.x @@ -0,0 +1,156 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1994 by Sun Microsystems, Inc. + * All Rights Reserved + */ + +%#pragma ident "%Z%%M% %I% %E% SMI" + +%#include <sys/fs/ufs_fs.h> +%#include <sys/types.h> +%#include <sys/errno.h> + +enum ufsdrc_t { + UFSDRC_OK = 0, + UFSDRC_NOENT = ENOENT, /* can't find fsck */ + UFSDRC_PERM = EPERM, /* no permissions */ + UFSDRC_INVAL = EINVAL, /* poorly formed args */ + UFSDRC_NOEXEC = ENOEXEC, /* can't exec fsck */ + UFSDRC_NODEV = ENODEV, /* invalid file system id */ + UFSDRC_NXIO = ENXIO, /* bad special device */ + UFSDRC_BUSY = EBUSY, /* another fsck in progress */ + UFSDRC_OPNOTSUP = EOPNOTSUPP, /* daemons mode makes this unfeasible */ + UFSDRC_EXECERR = 254, /* fsck/child ran but had an error */ + UFSDRC_ERR = 255 /* generic error */ +}; + +struct fs_identity_t { + dev_t fs_dev; + string fs_name<MAXMNTLEN>; +}; + +struct ufsd_repairfs_args_t { + fs_identity_t ua_fsid; + unsigned int ua_attempts; +}; + +struct ufsd_repairfs_list_t { + int ual_listlen; + ufsd_repairfs_args_t *ual_list; +}; + +enum ufsd_event_t { + UFSDEV_NONE = 0, + UFSDEV_REBOOT, + UFSDEV_FSCK, + UFSDEV_LOG_OP +}; + +enum ufsd_boot_type_t { + UFSDB_NONE = 0, + UFSDB_CLEAN, + UFSDB_POSTPANIC +}; + +enum ufsd_log_op_t { + UFSDLO_NONE = 0, + UFSDLO_COMMIT, + UFSDLO_GET, + UFSDLO_PUT, + UFSDLO_RESET +}; + +enum ufsd_fsck_state_t { + UFSDFS_NONE = 0, + UFSDFS_DISPATCH, + UFSDFS_ERREXIT, + UFSDFS_SUCCESS +}; + +const UFSD_VARMSGMAX = 1024; +const UFSD_SPAREMSGBYTES = 4; +struct ufsd_log_data_t { + int umld_eob; + int umld_seq; + char umld_buf<UFSD_VARMSGMAX>; + +}; + +union ufsd_log_msg_t switch (ufsd_log_op_t um_lop) { +case UFSDLO_COMMIT: + void; +case UFSDLO_GET: + void; +case UFSDLO_PUT: + ufsd_log_data_t um_logdata; +case UFSDLO_RESET: + void; +default: + void; +}; + +union ufsd_msg_vardata_t switch (ufsd_event_t umv_ev) { +case UFSDEV_NONE: + void; +case UFSDEV_REBOOT: + ufsd_boot_type_t umv_b; +case UFSDEV_FSCK: + ufsd_fsck_state_t umv_fs; +case UFSDEV_LOG_OP: + ufsd_log_msg_t umv_lm; +default: + void; +}; + +struct ufsd_msg_t { + time_t um_time; + unsigned int um_from; + char um_spare<UFSD_SPAREMSGBYTES>; + ufsd_msg_vardata_t um_var; +}; + +%#define UFSD_SERVNAME "ufsd" +%#define xdr_dev_t xdr_u_int +%#define xdr_time_t xdr_int + +%/* +% * Set UFSD_THISVERS to the newest version of the protocol +% * This allows the preprocessor to force an error if the +% * protocol changes, since the kernel xdr routines may need to be +% * recoded. Note that we can't explicitly set the version to a +% * symbol as rpcgen will then create erroneous routine names. +% */ +%#define UFSD_V1 1 +%#define UFSD_ORIGVERS UFSD_V1 +%#define UFSD_THISVERS 1 + +program UFSD_PROG { + version UFSD_VERS { + ufsdrc_t UFSD_NULL(void) = 0; + ufsdrc_t UFSD_REPAIRFS(ufsd_repairfs_args_t) = 1; + ufsdrc_t UFSD_REPAIRFSLIST(ufsd_repairfs_list_t) = 2; + ufsdrc_t UFSD_SEND(ufsd_msg_t) = 3; + ufsdrc_t UFSD_RECV(ufsd_msg_t) = 4; + ufsdrc_t UFSD_EXIT(void) = 5; + } = 1; +} = 100233; diff --git a/usr/src/head/rpcsvc/yp.x b/usr/src/head/rpcsvc/yp.x new file mode 100644 index 0000000000..4f8f934465 --- /dev/null +++ b/usr/src/head/rpcsvc/yp.x @@ -0,0 +1,290 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* + * yp.x + * + * Copyright (c) 1988-1992 Sun Microsystems Inc + * All Rights Reserved. + */ + +%#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Protocol description file for the Network Information Services + */ + +const YPMAXRECORD = 1024; +const YPMAXDOMAIN = 256; +const YPMAXMAP = 64; +const YPMAXPEER = 64; + + +enum ypstat { + YP_TRUE = 1, + YP_NOMORE = 2, + YP_FALSE = 0, + YP_NOMAP = -1, + YP_NODOM = -2, + YP_NOKEY = -3, + YP_BADOP = -4, + YP_BADDB = -5, + YP_YPERR = -6, + YP_BADARGS = -7, + YP_VERS = -8 +}; + + +enum ypxfrstat { + YPXFR_SUCC = 1, + YPXFR_AGE = 2, + YPXFR_NOMAP = -1, + YPXFR_NODOM = -2, + YPXFR_RSRC = -3, + YPXFR_RPC = -4, + YPXFR_MADDR = -5, + YPXFR_YPERR = -6, + YPXFR_BADARGS = -7, + YPXFR_DBM = -8, + YPXFR_FILE = -9, + YPXFR_SKEW = -10, + YPXFR_CLEAR = -11, + YPXFR_FORCE = -12, + YPXFR_XFRERR = -13, + YPXFR_REFUSED = -14 +}; + + +typedef string domainname<YPMAXDOMAIN>; +typedef string mapname<YPMAXMAP>; +typedef string peername<YPMAXPEER>; +typedef opaque keydat<YPMAXRECORD>; +typedef opaque valdat<YPMAXRECORD>; + + +struct ypmap_parms { + domainname domain; + mapname map; + unsigned int ordernum; + peername peer; +}; + +struct ypreq_key { + domainname domain; + mapname map; + keydat key; +}; + +struct ypreq_nokey { + domainname domain; + mapname map; +}; + +struct ypreq_xfr { + ypmap_parms map_parms; + unsigned int transid; + unsigned int prog; + unsigned int port; +}; + + +struct ypresp_val { + ypstat stat; + valdat val; +}; + +struct ypresp_key_val { + ypstat stat; + valdat val; + keydat key; +}; + + +struct ypresp_master { + ypstat stat; + peername peer; +}; + +struct ypresp_order { + ypstat stat; + unsigned int ordernum; +}; + +union ypresp_all switch (bool more) { +case TRUE: + ypresp_key_val val; +case FALSE: + void; +}; + +struct ypresp_xfr { + unsigned int transid; + ypxfrstat xfrstat; +}; + +struct ypmaplist { + mapname map; + ypmaplist *next; +}; + +struct ypresp_maplist { + ypstat stat; + ypmaplist *maps; +}; + +enum yppush_status { + YPPUSH_SUCC = 1, /* Success */ + YPPUSH_AGE = 2, /* Master's version not newer */ + YPPUSH_NOMAP = -1, /* Can't find server for map */ + YPPUSH_NODOM = -2, /* Domain not supported */ + YPPUSH_RSRC = -3, /* Local resource alloc failure */ + YPPUSH_RPC = -4, /* RPC failure talking to server */ + YPPUSH_MADDR = -5, /* Can't get master address */ + YPPUSH_YPERR = -6, /* NIS server/map db error */ + YPPUSH_BADARGS = -7, /* Request arguments bad */ + YPPUSH_DBM = -8, /* Local dbm operation failed */ + YPPUSH_FILE = -9, /* Local file I/O operation failed */ + YPPUSH_SKEW = -10, /* Map version skew during transfer */ + YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */ + YPPUSH_FORCE = -12, /* No local order number in map use -f flag. */ + YPPUSH_XFRERR = -13, /* ypxfr error */ + YPPUSH_REFUSED = -14 /* Transfer request refused by ypserv */ +}; + +struct yppushresp_xfr { + unsigned transid; + yppush_status status; +}; + +/* + * Response structure and overall result status codes. Success and failure + * represent two separate response message types. + */ + +enum ypbind_resptype { + YPBIND_SUCC_VAL = 1, + YPBIND_FAIL_VAL = 2 +}; + +struct ypbind_binding { + opaque ypbind_binding_addr[4]; /* In network order */ + opaque ypbind_binding_port[2]; /* In network order */ +}; + +union ypbind_resp switch (ypbind_resptype ypbind_status) { +case YPBIND_FAIL_VAL: + unsigned ypbind_error; +case YPBIND_SUCC_VAL: + ypbind_binding ypbind_bindinfo; +}; + +/* Detailed failure reason codes for response field ypbind_error*/ + +const YPBIND_ERR_ERR = 1; /* Internal error */ +const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */ +const YPBIND_ERR_RESC = 3; /* System resource allocation failure */ + + +/* + * Request data structure for ypbind "Set domain" procedure. + */ +struct ypbind_setdom { + domainname ypsetdom_domain; + ypbind_binding ypsetdom_binding; + unsigned ypsetdom_vers; +}; + + +/* + * NIS access protocol + */ +program YPPROG { + version YPVERS { + void + YPPROC_NULL(void) = 0; + + bool + YPPROC_DOMAIN(domainname) = 1; + + bool + YPPROC_DOMAIN_NONACK(domainname) = 2; + + ypresp_val + YPPROC_MATCH(ypreq_key) = 3; + + ypresp_key_val + YPPROC_FIRST(ypreq_key) = 4; + + ypresp_key_val + YPPROC_NEXT(ypreq_key) = 5; + + ypresp_xfr + YPPROC_XFR(ypreq_xfr) = 6; + + void + YPPROC_CLEAR(void) = 7; + + ypresp_all + YPPROC_ALL(ypreq_nokey) = 8; + + ypresp_master + YPPROC_MASTER(ypreq_nokey) = 9; + + ypresp_order + YPPROC_ORDER(ypreq_nokey) = 10; + + ypresp_maplist + YPPROC_MAPLIST(domainname) = 11; + } = 2; +} = 100004; + + +/* + * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR + */ +program YPPUSH_XFRRESPPROG { + version YPPUSH_XFRRESPVERS { + void + YPPUSHPROC_NULL(void) = 0; + + yppushresp_xfr + YPPUSHPROC_XFRRESP(void) = 1; + } = 1; +} = 0x40000000; /* transient: could be anything up to 0x5fffffff */ + + +/* + * NIS binding protocol + */ +program YPBINDPROG { + version YPBINDVERS { + void + YPBINDPROC_NULL(void) = 0; + + ypbind_resp + YPBINDPROC_DOMAIN(domainname) = 1; + + void + YPBINDPROC_SETDOM(ypbind_setdom) = 2; + } = 2; +} = 100007; + + diff --git a/usr/src/head/rpcsvc/yp_prot.h b/usr/src/head/rpcsvc/yp_prot.h new file mode 100644 index 0000000000..5a9bb75164 --- /dev/null +++ b/usr/src/head/rpcsvc/yp_prot.h @@ -0,0 +1,406 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _RPCSVC_YP_PROT_H +#define _RPCSVC_YP_PROT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <rpc/rpc.h> +#include <rpcsvc/ypclnt.h> +#include <ndbm.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains symbols and structures defining the rpc protocol + * between the YP clients and the YP servers. The servers are the YP + * database servers, and the YP. + */ + +/* + * The following procedures are supported by the protocol: + * + * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates + * that the yp server is alive. + * + * YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the + * responding yp server does serve the named domain; FALSE indicates no + * support. + * + * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the yp server does serve + * the named domain, otherwise does not return. Used in the broadcast case. + * + * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the + * right-hand value for a passed left-hand key, within a named map and + * domain. + * + * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val). + * Returns the first key-value pair from a named domain and map. + * + * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns + * the key-value pair following a passed key-value pair within a named + * domain and map. + * + * YPPROC_XFR (struct ypreq_xfr) returns nothing. Indicates to a server that + * a map should be updated. + * + * YPPROC_NEWXFR (struct ypreq_newxfr) returns nothing. Indicates to a server + * that a map should be updated. Uses protocol independent request struct. + * + * YPPROC_CLEAR takes nothing, returns nothing. Instructs a yp server to + * close the current map, so that old versions of the disk file don't get + * held open. + * + * YPPROC_ALL (struct ypreq_nokey), returns + * union switch (bool more) { + * TRUE: (struct ypresp_key_val); + * FALSE: (struct) {}; + * } + * + * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master) + * + * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order) + * + * YPPROC_MAPLIST (char *), returns (struct ypmaplist *) + */ + +/* 'bool' is a built-in type for g++ */ +#if !(defined(__cplusplus) && defined(_BOOL)) && !defined(__GNUG__) +#ifndef BOOL_DEFINED +typedef unsigned int bool; +#define BOOL_DEFINED +#endif +#endif + +/* Program and version symbols, magic numbers */ + +#define YPPROG ((rpcprog_t)100004) +#define YPVERS ((rpcvers_t)2) +#define YPVERS_ORIG ((rpcvers_t)1) +#define YPMAXRECORD ((uint_t)1024) +#define YPMAXDOMAIN ((uint_t)256) +#define YPMAXMAP ((uint_t)64) +#define YPMAXPEER ((uint_t)256) + +/* byte size of a large yp packet */ +#define YPMSGSZ 1600 + +struct ypmap_parms { + char *domain; /* Null string means not available */ + char *map; /* Null string means not available */ + unsigned int ordernum; /* 0 means not available */ + char *owner; /* Null string means not available */ +}; + +/* + * Request parameter structures + */ + +struct ypreq_key { + char *domain; + char *map; + datum keydat; +}; + +struct ypreq_nokey { + char *domain; + char *map; +}; + +struct ypreq_xfr { + struct ypmap_parms map_parms; + unsigned int transid; + unsigned int proto; + unsigned short port; +}; + +struct ypreq_newxfr { + struct ypmap_parms map_parms; + unsigned int transid; + unsigned int proto; + char *name; +}; + +#define ypxfr_domain map_parms.domain +#define ypxfr_map map_parms.map +#define ypxfr_ordernum map_parms.ordernum +#define ypxfr_owner map_parms.owner + +/* + * Response parameter structures + */ + +struct ypresp_val { + unsigned int status; + datum valdat; +}; + +struct ypresp_key_val { + unsigned int status; + datum valdat; + datum keydat; +}; + +struct ypresp_master { + unsigned int status; + char *master; +}; + +struct ypresp_order { + unsigned int status; + unsigned int ordernum; +}; + +struct ypmaplist { + char ypml_name[YPMAXMAP + 1]; + struct ypmaplist *ypml_next; +}; + +struct ypresp_maplist { + unsigned int status; + struct ypmaplist *list; +}; + +/* + * Procedure symbols. YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK + * must keep the same values (0, 1, and 2) that they had in the first version + * of the protocol. + */ + +#define YPPROC_NULL ((rpcproc_t)0) +#define YPPROC_DOMAIN ((rpcproc_t)1) +#define YPPROC_DOMAIN_NONACK ((rpcproc_t)2) +#define YPPROC_MATCH ((rpcproc_t)3) +#define YPPROC_FIRST ((rpcproc_t)4) +#define YPPROC_NEXT ((rpcproc_t)5) +#define YPPROC_XFR ((rpcproc_t)6) +#define YPPROC_NEWXFR ((rpcproc_t)12) +#define YPPROC_CLEAR ((rpcproc_t)7) +#define YPPROC_ALL ((rpcproc_t)8) +#define YPPROC_MASTER ((rpcproc_t)9) +#define YPPROC_ORDER ((rpcproc_t)10) +#define YPPROC_MAPLIST ((rpcproc_t)11) + +/* Return status values */ + +#define YP_TRUE (1) /* General purpose success code */ +#define YP_NOMORE (2) /* No more entries in map */ +#define YP_FALSE (0) /* General purpose failure code */ +#define YP_NOMAP (-1) /* No such map in domain */ +#define YP_NODOM (-2) /* Domain not supported */ +#define YP_NOKEY (-3) /* No such key in map */ +#define YP_BADOP (-4) /* Invalid operation */ +#define YP_BADDB (-5) /* Server data base is bad */ +#define YP_YPERR (-6) /* YP server error */ +#define YP_BADARGS (-7) /* Request arguments bad */ +#define YP_VERS (-8) /* YP server vers. mismatch - server */ + /* can't supply requested service. */ + +enum ypreqtype {YPREQ_KEY = 1, YPREQ_NOKEY = 2, YPREQ_MAP_PARMS = 3}; +struct yprequest { + enum ypreqtype yp_reqtype; + union { + struct ypreq_key yp_req_keytype; + struct ypreq_nokey yp_req_nokeytype; + struct ypmap_parms yp_req_map_parmstype; + }yp_reqbody; +}; + +#define YPMATCH_REQTYPE YPREQ_KEY +#define ypmatch_req_domain yp_reqbody.yp_req_keytype.domain +#define ypmatch_req_map yp_reqbody.yp_req_keytype.map +#define ypmatch_req_keydat yp_reqbody.yp_req_keytype.keydat +#define ypmatch_req_keyptr yp_reqbody.yp_req_keytype.keydat.dptr +#define ypmatch_req_keysize yp_reqbody.yp_req_keytype.keydat.dsize + +#define YPFIRST_REQTYPE YPREQ_NOKEY +#define ypfirst_req_domain yp_reqbody.yp_req_nokeytype.domain +#define ypfirst_req_map yp_reqbody.yp_req_nokeytype.map + +#define YPNEXT_REQTYPE YPREQ_KEY +#define ypnext_req_domain yp_reqbody.yp_req_keytype.domain +#define ypnext_req_map yp_reqbody.yp_req_keytype.map +#define ypnext_req_keydat yp_reqbody.yp_req_keytype.keydat +#define ypnext_req_keyptr yp_reqbody.yp_req_keytype.keydat.dptr +#define ypnext_req_keysize yp_reqbody.yp_req_keytype.keydat.dsize + +#define YPPUSH_REQTYPE YPREQ_NOKEY +#define yppush_req_domain yp_reqbody.yp_req_nokeytype.domain +#define yppush_req_map yp_reqbody.yp_req_nokeytype.map + +#define YPPULL_REQTYPE YPREQ_NOKEY +#define yppull_req_domain yp_reqbody.yp_req_nokeytype.domain +#define yppull_req_map yp_reqbody.yp_req_nokeytype.map + +#define YPPOLL_REQTYPE YPREQ_NOKEY +#define yppoll_req_domain yp_reqbody.yp_req_nokeytype.domain +#define yppoll_req_map yp_reqbody.yp_req_nokeytype.map + +#define YPGET_REQTYPE YPREQ_MAP_PARMS +#define ypget_req_domain yp_reqbody.yp_req_map_parmstype.domain +#define ypget_req_map yp_reqbody.yp_req_map_parmstype.map +#define ypget_req_ordernum yp_reqbody.yp_req_map_parmstype.ordernum +#define ypget_req_owner yp_reqbody.yp_req_map_parmstype.owner + +enum ypresptype {YPRESP_VAL = 1, YPRESP_KEY_VAL = 2, YPRESP_MAP_PARMS = 3}; +struct ypresponse { + enum ypresptype yp_resptype; + union { + struct ypresp_val yp_resp_valtype; + struct ypresp_key_val yp_resp_key_valtype; + struct ypmap_parms yp_resp_map_parmstype; + } yp_respbody; +}; + +#define YPMATCH_RESPTYPE YPRESP_VAL +#define ypmatch_resp_status yp_respbody.yp_resp_valtype.status +#define ypmatch_resp_valdat yp_respbody.yp_resp_valtype.valdat +#define ypmatch_resp_valptr yp_respbody.yp_resp_valtype.valdat.dptr +#define ypmatch_resp_valsize yp_respbody.yp_resp_valtype.valdat.dsize + +#define YPFIRST_RESPTYPE YPRESP_KEY_VAL +#define ypfirst_resp_status yp_respbody.yp_resp_key_valtype.status +#define ypfirst_resp_keydat yp_respbody.yp_resp_key_valtype.keydat +#define ypfirst_resp_keyptr yp_respbody.yp_resp_key_valtype.keydat.dptr +#define ypfirst_resp_keysize yp_respbody.yp_resp_key_valtype.keydat.dsize +#define ypfirst_resp_valdat yp_respbody.yp_resp_key_valtype.valdat +#define ypfirst_resp_valptr yp_respbody.yp_resp_key_valtype.valdat.dptr +#define ypfirst_resp_valsize yp_respbody.yp_resp_key_valtype.valdat.dsize + +#define YPNEXT_RESPTYPE YPRESP_KEY_VAL +#define ypnext_resp_status yp_respbody.yp_resp_key_valtype.status +#define ypnext_resp_keydat yp_respbody.yp_resp_key_valtype.keydat +#define ypnext_resp_keyptr yp_respbody.yp_resp_key_valtype.keydat.dptr +#define ypnext_resp_keysize yp_respbody.yp_resp_key_valtype.keydat.dsize +#define ypnext_resp_valdat yp_respbody.yp_resp_key_valtype.valdat +#define ypnext_resp_valptr yp_respbody.yp_resp_key_valtype.valdat.dptr +#define ypnext_resp_valsize yp_respbody.yp_resp_key_valtype.valdat.dsize + +#define YPPOLL_RESPTYPE YPRESP_MAP_PARMS +#define yppoll_resp_domain yp_respbody.yp_resp_map_parmstype.domain +#define yppoll_resp_map yp_respbody.yp_resp_map_parmstype.map +#define yppoll_resp_ordernum yp_respbody.yp_resp_map_parmstype.ordernum +#define yppoll_resp_owner yp_respbody.yp_resp_map_parmstype.owner + + +extern bool _xdr_yprequest(); +extern bool _xdr_ypresponse(); +/* + * Protocol between clients (ypxfr, only) and yppush + * yppush speaks a protocol in the transient range, which + * is supplied to ypxfr as a command-line parameter when it + * is activated by ypserv. + */ +#define YPPUSHVERS ((rpcvers_t)1) +#define YPPUSHVERS_ORIG ((rpcvers_t)1) + +/* Procedure symbols */ + +#define YPPUSHPROC_NULL ((rpcproc_t)0) +#define YPPUSHPROC_XFRRESP ((rpcproc_t)1) + +struct yppushresp_xfr { + unsigned int transid; + unsigned int status; +}; + +/* Status values for yppushresp_xfr.status */ + +#define YPPUSH_SUCC (1) /* Success */ +#define YPPUSH_AGE (2) /* Master's version not newer */ +#define YPPUSH_NOMAP (-1) /* Can't find server for map */ +#define YPPUSH_NODOM (-2) /* Domain not supported */ +#define YPPUSH_RSRC (-3) /* Local resouce alloc failure */ +#define YPPUSH_RPC (-4) /* RPC failure talking to server */ +#define YPPUSH_MADDR (-5) /* Can't get master address */ +#define YPPUSH_YPERR (-6) /* YP server/map db error */ +#define YPPUSH_BADARGS (-7) /* Request arguments bad */ +#define YPPUSH_DBM (-8) /* Local dbm operation failed */ +#define YPPUSH_FILE (-9) /* Local file I/O operation failed */ +#define YPPUSH_SKEW (-10) /* Map version skew during transfer */ +#define YPPUSH_CLEAR (-11) /* Can't send "Clear" req to local */ + /* ypserv */ +#define YPPUSH_FORCE (-12) /* No local order number in map - */ + /* use -f flag. */ +#define YPPUSH_XFRERR (-13) /* ypxfr error */ +#define YPPUSH_REFUSED (-14) /* Transfer request refused by ypserv */ +#define YPPUSH_NOALIAS (-15) /* Alias not found for map or domain */ + +#ifdef __STDC__ +extern bool xdr_datum(XDR *, datum *); +extern bool xdr_ypdomain_wrap_string(XDR *, char **); +extern bool xdr_ypmap_wrap_string(XDR *, char **); +extern bool xdr_ypreq_key(XDR *, struct ypreq_key *); +extern bool xdr_ypreq_nokey(XDR *, struct ypreq_nokey *); +extern bool xdr_ypreq_xfr(XDR *, struct ypreq_xfr *); +extern bool xdr_ypreq_newxfr(XDR *, struct ypreq_newxfr *); +extern bool xdr_ypresp_val(XDR *, struct ypresp_val *); +extern bool xdr_ypresp_key_val(XDR *, struct ypresp_key_val *); +extern bool xdr_ypmap_parms(XDR *, struct ypmap_parms *); +extern bool xdr_ypowner_wrap_string(XDR *, char **); +extern bool xdr_yppushresp_xfr(XDR *, struct yppushresp_xfr *); +extern bool xdr_ypresp_order(XDR *, struct ypresp_order *); +extern bool xdr_ypresp_master(XDR *, struct ypresp_master *); +extern bool xdr_ypall(XDR *, struct ypall_callback *); +extern bool xdr_ypresp_maplist(XDR *, struct ypresp_maplist *); + +#else + +extern bool xdr_datum(); +extern bool xdr_ypdomain_wrap_string(); +extern bool xdr_ypmap_wrap_string(); +extern bool xdr_ypreq_key(); +extern bool xdr_ypreq_nokey(); +extern bool xdr_ypreq_xfr(); +extern bool xdr_ypreq_newxfr(); +extern bool xdr_ypresp_val(); +extern bool xdr_ypresp_key_val(); +extern bool xdr_yp_inaddr(); +extern bool xdr_ypmap_parms(); +extern bool xdr_ypowner_wrap_string(); +extern bool xdr_yppushresp_xfr(); +extern bool xdr_ypresp_order(); +extern bool xdr_ypresp_master(); +extern bool xdr_ypall(); +extern bool xdr_ypresp_maplist(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _RPCSVC_YP_PROT_H */ diff --git a/usr/src/head/rpcsvc/ypclnt.h b/usr/src/head/rpcsvc/ypclnt.h new file mode 100644 index 0000000000..d80cf82a62 --- /dev/null +++ b/usr/src/head/rpcsvc/ypclnt.h @@ -0,0 +1,142 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1989 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _RPCSVC_YPCLNT_H +#define _RPCSVC_YPCLNT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * ypclnt.h + * This defines the symbols used in the c language + * interface to the yp client functions. A description of this interface + * can be read in ypclnt(3N). + */ + +/* + * Failure reason codes. The success condition is indicated by a functional + * value of "0". + */ +#define YPERR_BADARGS 1 /* Args to function are bad */ +#define YPERR_RPC 2 /* RPC failure */ +#define YPERR_DOMAIN 3 /* Can't bind to a server which */ + /* serves this domain. */ +#define YPERR_MAP 4 /* No such map in server's domain */ +#define YPERR_KEY 5 /* No such key in map */ +#define YPERR_YPERR 6 /* Internal yp server or client */ + /* interface error */ +#define YPERR_RESRC 7 /* Local resource allocation failure */ +#define YPERR_NOMORE 8 /* No more records in map database */ +#define YPERR_PMAP 9 /* Can't communicate with portmapper */ +#define YPERR_YPBIND 10 /* Can't communicate with ypbind */ +#define YPERR_YPSERV 11 /* Can't communicate with ypserv */ +#define YPERR_NODOM 12 /* Local domain name not set */ +#define YPERR_BADDB 13 /* yp data base is bad */ +#define YPERR_VERS 14 /* YP version mismatch */ +#define YPERR_ACCESS 15 /* Access violation */ +#define YPERR_BUSY 16 /* Database is busy */ + +/* + * Types of update operations + */ +#define YPOP_CHANGE 1 /* change, do not add */ +#define YPOP_INSERT 2 /* add, do not change */ +#define YPOP_DELETE 3 /* delete this entry */ +#define YPOP_STORE 4 /* add, or change */ + + + +/* + * Data definitions + */ + +/* + * struct ypall_callback * is the arg which must be passed to yp_all + */ + +struct ypall_callback { + int (*foreach)(); /* Return non-0 to stop getting */ + /* called */ + char *data; /* Opaque pointer for use of callback */ + /* function */ +}; + +/* + * External yp client function references. + */ + +#ifdef __STDC__ +extern int yp_bind(char *); +extern void yp_unbind(char *); +extern int yp_get_default_domain(char **); +extern int yp_match(char *, char *, char *, int, char **, int *); +extern int yp_first(char *, char *, char **, int *, char **, int *); +extern int yp_next(char *, char *, char *, int, char **, int *, char **, int *); +extern int yp_master(char *, char *, char **); +extern int yp_order(char *, char *, unsigned long *); +extern int yp_all(char *, char *, struct ypall_callback *); +extern char *yperr_string(int); +extern int ypprot_err(int); +extern int yp_update(char *, char *, unsigned, char *, int, char *, int); + +#else + +extern int yp_bind(); +extern int __yp_dobind(); +extern void yp_unbind(); +extern int yp_get_default_domain(); +extern int yp_match(); +extern int yp_first(); +extern int yp_next(); +extern int yp_master(); +extern int yp_order(); +extern int yp_all(); +extern char *yperr_string(); +extern int ypprot_err(); +extern int yp_update(); +#endif /* __STDC__ */ + +/* + * Global yp data structures + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _RPCSVC_YPCLNT_H */ diff --git a/usr/src/head/rpcsvc/yppasswd.h b/usr/src/head/rpcsvc/yppasswd.h new file mode 100644 index 0000000000..c7816d197e --- /dev/null +++ b/usr/src/head/rpcsvc/yppasswd.h @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1985 by Sun Microsystems, Inc. + * + */ + + +#ifndef _RPCSVC_YPPASSWD_H +#define _RPCSVC_YPPASSWD_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _PWD_H +#include <pwd.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define YPPASSWDPROG ((rpcprog_t)100009) +#define YPPASSWDVERS ((rpcvers_t)1) +#define YPPASSWDPROC_UPDATE ((rpcproc_t)1) + +struct yppasswd { + char *oldpass; /* old (unencrypted) password */ + struct passwd newpw; /* new pw structure */ +}; + +int xdr_yppasswd(); + +#ifdef __cplusplus +} +#endif + +#endif /* !_RPCSVC_YPPASSWD_H */ diff --git a/usr/src/head/rpcsvc/ypupd.h b/usr/src/head/rpcsvc/ypupd.h new file mode 100644 index 0000000000..fde3c2507b --- /dev/null +++ b/usr/src/head/rpcsvc/ypupd.h @@ -0,0 +1,96 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1998 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _RPCSVC_YPUPD_H +#define _RPCSVC_YPUPD_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Compiled from ypupdate_prot.x using rpcgen + * This is NOT source code! + * DO NOT EDIT THIS FILE! + */ +#define MAXMAPNAMELEN 255 +#define MAXYPDATALEN 1023 +#define MAXERRMSGLEN 255 + +#define YPU_PROG ((ulong_t)100028) +#define YPU_VERS ((ulong_t)1) +#define YPU_CHANGE ((ulong_t)1) +extern uint_t *ypu_change_1(); +#define YPU_INSERT ((ulong_t)2) +extern uint_t *ypu_insert_1(); +#define YPU_DELETE ((ulong_t)3) +extern uint_t *ypu_delete_1(); +#define YPU_STORE ((ulong_t)4) +extern uint_t *ypu_store_1(); + +typedef struct { + uint_t yp_buf_len; + char *yp_buf_val; +} yp_buf; +bool_t xdr_yp_buf(); + +struct ypupdate_args { + char *mapname; + yp_buf key; + yp_buf datum; +}; +typedef struct ypupdate_args ypupdate_args; +bool_t xdr_ypupdate_args(); + +struct ypdelete_args { + char *mapname; + yp_buf key; +}; +typedef struct ypdelete_args ypdelete_args; +bool_t xdr_ypdelete_args(); + +#ifdef __cplusplus +} +#endif + +#endif /* _RPCSVC_YPUPD_H */ diff --git a/usr/src/head/rtld_db.h b/usr/src/head/rtld_db.h new file mode 100644 index 0000000000..f3e7f9cacd --- /dev/null +++ b/usr/src/head/rtld_db.h @@ -0,0 +1,207 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _RTLD_DB_H +#define _RTLD_DB_H + +#pragma ident "%Z%%M% %I% %E% SMI" + + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/types.h> +#include <sys/lwp.h> +#include <link.h> +#include <proc_service.h> + + +/* + * librtld_db interface versions + */ +#define RD_VERSION1 1 +#define RD_VERSION2 2 +#define RD_VERSION3 3 +#define RD_VERSION4 4 +#define RD_VERSION RD_VERSION4 + +typedef enum { + RD_ERR, /* generic */ + RD_OK, /* generic "call" succeeded */ + RD_NOCAPAB, /* capability not available */ + RD_DBERR, /* import service failed */ + RD_NOBASE, /* 5.x: aux tag AT_BASE not found */ + RD_NODYNAM, /* symbol 'DYNAMIC' not found */ + RD_NOMAPS /* link-maps are not yet available */ +} rd_err_e; + + +/* + * ways that the event notification can take place: + */ +typedef enum { + RD_NOTIFY_BPT, /* set break-point at address */ + RD_NOTIFY_AUTOBPT, /* 4.x compat. not used in 5.x */ + RD_NOTIFY_SYSCALL /* watch for syscall */ +} rd_notify_e; + +/* + * information on ways that the event notification can take place: + */ +typedef struct rd_notify { + rd_notify_e type; + union { + psaddr_t bptaddr; /* break point address */ + long syscallno; /* system call id */ + } u; +} rd_notify_t; + +/* + * information about event instance: + */ +typedef enum { + RD_NOSTATE = 0, /* no state information */ + RD_CONSISTENT, /* link-maps are stable */ + RD_ADD, /* currently adding object to link-maps */ + RD_DELETE /* currently deleteing object from link-maps */ +} rd_state_e; + +typedef struct rd_event_msg { + rd_event_e type; + union { + rd_state_e state; /* for DLACTIVITY */ + } u; +} rd_event_msg_t; + + +/* + * iteration over load objects + */ +typedef struct rd_loadobj { + psaddr_t rl_nameaddr; /* address of the name in user space */ + unsigned rl_flags; + psaddr_t rl_base; /* base of address of code */ + psaddr_t rl_data_base; /* base of address of data */ + Lmid_t rl_lmident; /* ident of link map */ + psaddr_t rl_refnameaddr; /* reference name of filter in user */ + /* space. If non null object is a */ + /* filter. */ + psaddr_t rl_plt_base; /* These fields are present for 4.x */ + unsigned rl_plt_size; /* compatibility and are not */ + /* currently used in SunOS5.x */ + psaddr_t rl_bend; /* end of image (text+data+bss) */ + psaddr_t rl_padstart; /* start of padding */ + psaddr_t rl_padend; /* end of image after padding */ + psaddr_t rl_dynamic; /* points to the DYNAMIC section */ + /* in the target process */ + unsigned long rl_tlsmodid; /* module ID for TLS references */ +} rd_loadobj_t; + +/* + * Values for rl_flags + */ +#define RD_FLG_MEM_OBJECT 0x0001 /* Identifies this object as */ + /* originating from a relocatable */ + /* module which was dynamically */ + /* loaded */ + + +typedef struct rd_agent rd_agent_t; +#ifdef __STDC__ +typedef int rl_iter_f(const rd_loadobj_t *, void *); +#else +typedef int rl_iter_f(); +#endif + + +/* + * PLT skipping + */ +typedef enum { + RD_RESOLVE_NONE, /* don't do anything special */ + RD_RESOLVE_STEP, /* step 'pi_nstep' instructions */ + RD_RESOLVE_TARGET, /* resolved target is in 'pi_target' */ + RD_RESOLVE_TARGET_STEP /* put a bpt on target, then step nstep times */ +} rd_skip_e; + + +typedef struct rd_plt_info { + rd_skip_e pi_skip_method; + long pi_nstep; + psaddr_t pi_target; + psaddr_t pi_baddr; + unsigned int pi_flags; +} rd_plt_info_t; + +/* + * Values for pi_flags + */ +#define RD_FLG_PI_PLTBOUND 0x0001 /* Indicates that the PLT */ + /* has been bound - and that */ + /* pi_baddr will contain it's */ + /* destination address */ + +struct ps_prochandle; + +/* + * librtld_db.so entry points + */ +#ifdef __STDC__ +extern void rd_delete(rd_agent_t *); +extern char * rd_errstr(rd_err_e rderr); +extern rd_err_e rd_event_addr(rd_agent_t *, rd_event_e, rd_notify_t *); +extern rd_err_e rd_event_enable(rd_agent_t *, int); +extern rd_err_e rd_event_getmsg(rd_agent_t *, rd_event_msg_t *); +extern rd_err_e rd_init(int); +extern rd_err_e rd_loadobj_iter(rd_agent_t *, rl_iter_f *, + void *); +extern void rd_log(const int); +extern rd_agent_t * rd_new(struct ps_prochandle *); +extern rd_err_e rd_objpad_enable(struct rd_agent *, size_t); +extern rd_err_e rd_plt_resolution(rd_agent_t *, psaddr_t, lwpid_t, + psaddr_t, rd_plt_info_t *); +extern rd_err_e rd_reset(struct rd_agent *); +#else +extern void rd_delete(); +extern char * rd_errstr(); +extern rd_err_e rd_event_addr(); +extern rd_err_e rd_event_enable(); +extern rd_err_e rd_event_getmsg(); +extern rd_err_e rd_init(); +extern rd_err_e rd_loadobj_iter(); +extern void rd_log(); +extern rd_agent_t * rd_new(); +extern rd_err_e rd_objpad_enable(); +extern rd_err_e rd_plt_resolution(); +extern rd_err_e rd_reset(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _RTLD_DB_H */ diff --git a/usr/src/head/sac.h b/usr/src/head/sac.h new file mode 100644 index 0000000000..7d205380e8 --- /dev/null +++ b/usr/src/head/sac.h @@ -0,0 +1,156 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1997-1998 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ifndef _SAC_H +#define _SAC_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */ + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define IDLEN 4 /* length in bytes of a utmp id */ +#define SC_WILDC 0xff /* wild character for utmp ids */ +#define PMTAGSIZE 14 /* maximum length in bytes for */ + /* a port monitor tag */ + +/* + * values for rflag in doconfig() + */ + +#define NOASSIGN 0x1 /* don't allow assign operations */ +#define NORUN 0x2 /* don't allow run or runwait operations */ + + +/* + * message to SAC (header only). This header is forever fixed. The + * size field (pm_size) defines the size of the data portion of the + * message, which follows the header. The form of this optional + * data portion is defined strictly by the message type (pm_type). + */ + +struct pmmsg { + char pm_type; /* type of message */ + uchar_t pm_state; /* current state of port monitor */ + char pm_maxclass; /* max message class this PM */ + /* understands */ + char pm_tag[PMTAGSIZE + 1]; /* port monitor's tag */ + int pm_size; /* size of optional data portion */ +}; + + + +/* + * pm_type values + */ + +#define PM_STATUS 1 /* status response */ +#define PM_UNKNOWN 2 /* an unknown message was received */ + +/* + * pm_state values + */ + +/* + * Class 1 responses + */ + +#define PM_STARTING 1 /* port monitor in starting state */ +#define PM_ENABLED 2 /* port monitor in enabled state */ +#define PM_DISABLED 3 /* port monitor in disabled state */ +#define PM_STOPPING 4 /* port monitor in stopping state */ + +/* + * message to port monitor + */ + +struct sacmsg { + int sc_size; /* size of optional data portion */ + char sc_type; /* type of message */ +}; + + + +/* + * sc_type values + * These represent commands that the SAC sends to a port monitor. These + * commands are divided into "classes" for extensibility. Each subsequent + * "class" is a superset of the previous "classes" plus the new commands + * defined within that "class". The header for all commands is identical; + * however, a command may be defined such that an optional data portion may + * be sent in addition to the header. The format of this optional data piece + * is self-defining based on the command. Important note: the first message + * sent by the SAC will always be a class 1 message. The port monitor + * response will indicate the maximum class that it is able to understand. + * Another note is that port monitors should only respond to a message with + * an equivalent class response (i.e. a class 1 command causes a class 1 + * response). + */ + +/* + * Class 1 commands (currently, there are only class 1 commands) + */ + +#define SC_STATUS 1 /* status request */ +#define SC_ENABLE 2 /* enable request */ +#define SC_DISABLE 3 /* disable request */ +#define SC_READDB 4 /* read pmtab request */ + +/* + * `errno' values for Saferrno, note that Saferrno is used by + * both pmadm and sacadm and these values are shared between + * them + */ + +#define E_BADARGS 1 /* bad args or ill-formed command line */ +#define E_NOPRIV 2 /* user not privileged for operation */ +#define E_SAFERR 3 /* generic SAF error */ +#define E_SYSERR 4 /* system error */ +#define E_NOEXIST 5 /* invalid specification */ +#define E_DUP 6 /* entry already exists */ +#define E_PMRUN 7 /* port monitor is running */ +#define E_PMNOTRUN 8 /* port monitor is not running */ +#define E_RECOVER 9 /* in recovery */ +#define E_SACNOTRUN 10 /* sac daemon is not running */ + +#ifdef __STDC__ +extern int doconfig(int, char *, long); +#else +extern int doconfig(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SAC_H */ diff --git a/usr/src/head/sched.h b/usr/src/head/sched.h new file mode 100644 index 0000000000..5be792bbd3 --- /dev/null +++ b/usr/src/head/sched.h @@ -0,0 +1,86 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1993-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SCHED_H +#define _SCHED_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <time.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct sched_param { + int sched_priority; /* process execution scheduling priority */ + int sched_nicelim; /* nice value limit for SCHED_OTHER policy */ + int sched_nice; /* nice value for SCHED_OTHER policy */ + int sched_pad[6]; /* pad to the same size as pcparms_t of */ + /* sys/priocntl.h */ + /* sizeof(sched_priority) + */ + /* sizeof(pcparms_t.pc_clparms) */ +}; + +/* + * POSIX scheduling policies + */ +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 /* run to completion */ +#define SCHED_RR 2 /* round-robin */ +#define SCHED_SYS 3 /* sys scheduling class */ +#define SCHED_IA 4 /* interactive class */ +#define _SCHED_NEXT 5 /* first unassigned policy number */ + +/* + * function prototypes + */ +#if defined(__STDC__) +int sched_getparam(pid_t, struct sched_param *); +int sched_setparam(pid_t, const struct sched_param *); +int sched_getscheduler(pid_t); +int sched_setscheduler(pid_t, int, const struct sched_param *); +int sched_yield(void); +int sched_get_priority_max(int); +int sched_get_priority_min(int); +int sched_rr_get_interval(pid_t, struct timespec *); +#else +int sched_getparam(); +int sched_setparam(); +int sched_getscheduler(); +int sched_setscheduler(); +int sched_yield(); +int sched_get_priority_max(); +int sched_get_priority_min(); +int sched_rr_get_interval(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SCHED_H */ diff --git a/usr/src/head/schedctl.h b/usr/src/head/schedctl.h new file mode 100644 index 0000000000..3e6f261c7f --- /dev/null +++ b/usr/src/head/schedctl.h @@ -0,0 +1,68 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1996-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SCHEDCTL_H +#define _SCHEDCTL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/schedctl.h> + +typedef sc_public_t schedctl_t; + +extern void yield(void); + +#define schedctl_start(p) \ + (void) (((p) == NULL)? 0 : \ + ((((schedctl_t *)(p))->sc_nopreempt = 1), 0)) + +#define schedctl_stop(p) \ + (void) (((p) == NULL)? 0 : \ + ((((schedctl_t *)(p))->sc_nopreempt = 0), \ + (((schedctl_t *)(p))->sc_yield? (yield(), 0) : 0))) + +/* + * libsched API + */ +#if defined(__STDC__) +schedctl_t *schedctl_init(void); +schedctl_t *schedctl_lookup(void); +void schedctl_exit(void); +#else +schedctl_t *schedctl_init(); +schedctl_t *schedctl_lookup(); +void schedctl_exit(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SCHEDCTL_H */ diff --git a/usr/src/head/sdssc.h b/usr/src/head/sdssc.h new file mode 100644 index 0000000000..d26fb263ca --- /dev/null +++ b/usr/src/head/sdssc.h @@ -0,0 +1,256 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SDSSC_H +#define _SDSSC_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * This header supports DiskSuite cluster operations and describes the + * functions that isolate it from cluster implementation. + */ + +#include <meta.h> +#include <metacl.h> +#include <sys/types.h> +#ifdef CLUSTER_LIBRARY_SOURCE +#include <sys/mhd.h> +#include <scadmin/scconf.h> +#include <scadmin/scswitch.h> +#include <scadmin/scstat.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define SDSSC_PROXY_PRIMARY ((char *)1) +#define SDSSC_CLASS "sds" /* Service class name */ +#define SDSSC_MO_CLASS "multi-owner-svm" +#define SDSSC_SERVICE_CMD "sds_ownership" +#define SDSSC_DEFAULT_PREFERENCE 0 + + +/* + * IMPORTANT: Any change to the metaset "-C" option interface shall + * be reflected in this number. Changes which do not affect shell + * parsing such as elimination of spaces or substitution of spaces + * for \n or addition of new non-interfering features may be indicated + * by incrementing the minor number in the version. Changes in content + * require the major portion of the version be incremented. All changes + * shall be discussed with and approved by our current contract partner(s). + */ +#define METASETIFVERSION "1.0" + +/* + * XXX - This should be in some general purpose header but I can't + * find it anywhere. - JST + */ +#define SDSSC_MD_DIR "/dev/md" +#define SDSSC_SET_PATH SDSSC_MD_DIR "/shared" +#define SDSSC_SETNO_LINK "shared" + +/* This is a cluster-specific directory. */ +#define SDSSC_CL_GLOBAL "/global/.devices/node@" + +/* + * Cluster specific directory which contains libdid.so + */ +#define SDSSC_CL_LIBDIR "/usr/cluster/lib" +#define SDSSC_DID_LIB SDSSC_CL_LIBDIR "/libdid.so" + +/* + * This information can't change unless a corresponding change to SC3.0 + * upgrade process is made. When a HA1.3 or SC2.2 system is upgraded + * to SC3.0, the upgrade process will create our services with the following + * properties: + * SDSSC_PROP_INDEX: the current set number on the old HA pair + * SDSSC_PROP_STATE: SDSSC_STATE_COMMIT + */ +#define SDSSC_PROP_COUNT 4 /* Number of store props */ +#define SDSSC_PROP_INDEX "index" /* One of the properties */ +#define SDSSC_PROP_NODE "node" /* ditto */ +#define SDSSC_PROP_INCAR "incarnation" /* ditto */ +#define SDSSC_PROP_STATE "state" /* ditto */ + +#define SDSSC_STATE_COMMIT "commit" /* state values */ +#define SDSSC_STATE_CREATE "create" /* ditto */ +#define SDSSC_STATE_DEL "delete" /* ditto */ + +/* + * When creating services in the DCS the index used is either set + * by the calling routine or sdssc_create_begin will pick the next + * available one. To have the next available one picked the following + * define should be used as the forth argument. + */ +#define SDSSC_PICK_SETNO 0 + +/* + * The following number was lifted from the Cluster Project source + * code. Apparently they don't believe in using #define for constants. + * For now we'll create one. + */ +#define SDSSC_NODE_NAME_LEN 64 + +/* + * We need to malloc a small amount of space for property values. + * The two values are integer strings with a value of 1 to 64. + */ +#define SDSSC_NODE_INDEX_LEN 20 + +/* + * The maximum number of metadevices in a set is currently limited + * to 8192. + */ +#define SDSSC_METADDEV_MAX 8192 + +/* + * To avoid the need for two separate files with definitions for the libraries + * entry points the following macro is being used. CLUSTER_LIBRARY_SOURCE + * is only defined in the libsdssc source just as the name implies. The + * reference below becomes a function prototype. Otherwise a pointer to a + * function is defined which can be used elsewhere in the commands. + */ +#ifdef CLUSTER_LIBRARY_SOURCE +#define REF(method, args) _##method args +#else +#define REF(method, args) (* method) args +#endif + +struct sdssc_version { + int major; + int minor; + int library_level; +}; + +typedef struct { + char *fname; /* function name found in library */ + void **fptr; /* pointer to storage for global pointer */ +} func_table_t, *func_table_p; + +enum rval1 { + /* + * Function executed without errors. Duh + */ + SDSSC_OKAY, + + /* + * Some generic error condition occurred + */ + SDSSC_ERROR, + + /* + * sdssc_cmd_proxy was able to execute the command + * remotely. + */ + SDSSC_PROXY_DONE, + + /* + * When the libsds_sc.so is not found or the system isn't + * part of a cluster the interface routines will return this + * as indication + */ + SDSSC_NOT_BOUND, + + /* + * If the service isn't found in the CCR sdssc_get_primary + * will this enumeration. + */ + SDSSC_NO_SERVICE, + + /* + * When the libsds_sc.so is found, but this specific routine failed + * to bind, then this interface routine will return this error. + * This error indicates that an older version of the libsds_sc.so + * library which does not support this routine. + */ + SDSSC_NOT_BOUND_ERROR + +}; +enum dcs_state { SDSSC_COMMIT, SDSSC_CLEANUP }; +enum sds_boolean { SDSSC_True, SDSSC_False }; +enum sdssc_dcs_notify { Make_Primary, Release_Primary, Shutdown_Services }; + +typedef enum rval1 rval_e; +typedef enum dcs_state dcs_set_state_e; +typedef struct sdssc_version sdssc_version_t; +typedef enum sds_boolean sdssc_boolean_e; +typedef enum sdssc_dcs_notify sdssc_dcs_notify_e; + +rval_e sdssc_bind_library(void); +rval_e REF(sdssc_version, (sdssc_version_t *)); +rval_e REF(sdssc_create_begin, (char *, int, char **, int)); +rval_e REF(sdssc_mo_create_begin, (char *, int, char **, int)); +rval_e REF(sdssc_create_end, (char *, dcs_set_state_e)); +rval_e REF(sdssc_delete_begin, (char *)); +rval_e REF(sdssc_delete_end, (char *, dcs_set_state_e)); +rval_e REF(sdssc_get_index, (char *, set_t *)); +rval_e REF(sdssc_add_hosts, (char *, int, char **)); +rval_e REF(sdssc_delete_hosts, (char *, int, char **)); +rval_e REF(sdssc_get_primary_host, (char *, char *, int)); +rval_e REF(sdssc_cmd_proxy, (int, char **, char *host, int *)); +rval_e REF(sdssc_getnodelist, (int **)); +void REF(sdssc_freenodelist, (int *)); +mdc_errno_t REF(sdssc_binddevs, (void)); +rval_e REF(sdssc_gettransportbynode, (int, char **)); +rval_e REF(sdssc_bindclusterdevs, (mdc_err_t ***)); +void REF(sdssc_free_mdcerr_list, (mdc_err_t **)); +rval_e REF(sdssc_clnt_bind_devs, (char *, mdc_err_t *)); +rval_e REF(sdssc_property_get, (char *, char *, char **)); +rval_e REF(sdssc_property_set, (char *, char *, char *)); +rval_e REF(sdssc_get_services, (char ***)); +rval_e REF(sdssc_get_services_free, (char **)); +rval_e REF(sdssc_suspend, (const char *)); +rval_e REF(sdssc_convert_cluster_path, (const char *, char **)); +rval_e REF(sdssc_convert_ctd_path, (const char *, char **)); +void REF(sdssc_convert_path_free, (char *)); +rval_e REF(sdssc_notify_service, (const char *, sdssc_dcs_notify_e)); +void REF(sdssc_cm_nm2nid, (char *)); +void REF(sdssc_cm_sr_nm2nid, (md_set_record *)); +void REF(sdssc_cm_nid2nm, (char *)); +void REF(sdssc_cm_sr_nid2nm, (md_set_record *)); +rval_e REF(sdssc_get_priv_ipaddr, (char *, struct in_addr *)); +rval_e REF(sdssc_clnt_proxy_cmd, (uint_t, char **, uint_t, char **, + char *, mdc_err_t *)); + +#ifdef CLUSTER_LIBRARY_SOURCE +/* + * Support routines used with libsds_sc.so and not for public + * consumption (see mapfile-vers for scoping). + */ +rval_e l_get_property(scconf_cfg_ds_t *, char *, char **); +void *l_get_incarnation(int); +char *l_incarnation_to_prop(int); +void *l_prop_to_incarnation(char *); +sdssc_boolean_e l_compare_incarnation(void *, void *); +rval_e l_build_hostlist(scconf_nodeid_t *, char ***); +#endif +#ifdef __cplusplus +} +#endif + +#endif /* _SDSSC_H */ diff --git a/usr/src/head/search.h b/usr/src/head/search.h new file mode 100644 index 0000000000..0af11254c8 --- /dev/null +++ b/usr/src/head/search.h @@ -0,0 +1,116 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SEARCH_H +#define _SEARCH_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3.1.11 */ + +#include <sys/feature_tests.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* HSEARCH(3C) */ +typedef enum { FIND, ENTER } ACTION; + +#if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) +struct qelem { + struct qelem *q_forw; + struct qelem *q_back; +}; +#endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */ + +typedef struct entry { char *key, *data; } ENTRY; + +#if defined(__STDC__) + +int hcreate(size_t); +void hdestroy(void); +ENTRY *hsearch(ENTRY, ACTION); +#if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || defined(_XPG4_2) +void insque(void *, void *); +void remque(void *); +#endif + +#else /* defined(__STDC__) */ + +int hcreate(); +void hdestroy(); +ENTRY *hsearch(); +#if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || defined(_XPG4_2) +void insque(); +void remque(); +#endif + +#endif /* defined(__STDC__) */ + +/* TSEARCH(3C) */ +typedef enum { preorder, postorder, endorder, leaf } VISIT; + +#if defined(__STDC__) +void *tdelete(const void *_RESTRICT_KYWD, void **_RESTRICT_KYWD, + int (*)(const void *, const void *)); +void *tfind(const void *, void *const *, int (*)(const void *, const void *)); +void *tsearch(const void *, void **, int (*)(const void *, const void *)); +void twalk(const void *, void (*)(const void *, VISIT, int)); +#else +void *tdelete(); +void *tfind(); +void *tsearch(); +void twalk(); +#endif + +#if defined(__STDC__) + +#if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) +/* BSEARCH(3C) */ +void *bsearch(const void *, const void *, size_t, size_t, + int (*)(const void *, const void *)); +#endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */ + +/* LSEARCH(3C) */ +void *lfind(const void *, const void *, size_t *, size_t, + int (*)(const void *, const void *)); +void *lsearch(const void *, void *, size_t *, size_t, + int (*)(const void *, const void *)); +#else +void *bsearch(); +void *lfind(); +void *lsearch(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SEARCH_H */ diff --git a/usr/src/head/secdb.h b/usr/src/head/secdb.h new file mode 100644 index 0000000000..3954dbbd64 --- /dev/null +++ b/usr/src/head/secdb.h @@ -0,0 +1,116 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SECDB_H +#define _SECDB_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define DEFAULT_POLICY "solaris" +#define SUSER_POLICY "suser" /* fallback: old policy */ + +#define KV_ACTION "act" +#define KV_COMMAND "cmd" +#define KV_JAVA_CLASS "java_class" +#define KV_JAVA_METHOD "java_method" + +#define KV_ASSIGN "=" +#define KV_DELIMITER ";" +#define KV_EMPTY "" +#define KV_ESCAPE '\\' +#define KV_ADD_KEYS 16 /* number of key value pairs to realloc */ +#define KV_SPECIAL "=;:\\"; +#define KV_TOKEN_DELIMIT ":" +#define KV_WILDCARD "*" +#define KV_WILDCHAR '*' +#define KV_ACTION_WILDCARD "*;*;*;*;*" + +#define KV_FLAG_NONE 0x0000 +#define KV_FLAG_REQUIRED 0x0001 + +/* + * return status macros for all attribute databases + */ +#define ATTR_FOUND 0 /* Authoritative found */ +#define ATTR_NOT_FOUND -1 /* Authoritative not found */ +#define ATTR_NO_RECOVERY -2 /* Non-recoverable errors */ + + +typedef struct kv_s { + char *key; + char *value; +} kv_t; /* A key-value pair */ + +typedef struct kva_s { + int length; /* array length */ + kv_t *data; /* array of key value pairs */ +} kva_t; /* Key-value array */ + + +#ifdef __STDC__ +extern char *kva_match(kva_t *, char *); + +extern int _auth_match(const char *, const char *); +extern char *_argv_to_csl(char **strings); +extern char **_csl_to_argv(char *csl); +extern char *_do_unescape(char *src); +extern void _free_argv(char **p_argv); +extern int _get_auth_policy(char **, char **); +extern int _insert2kva(kva_t *, char *, char *); +extern int _kva2str(kva_t *, char *, int, char *, char *); +extern kva_t *_kva_dup(kva_t *); +extern void _kva_free(kva_t *); +extern kva_t *_new_kva(int size); +extern kva_t *_str2kva(char *, char *, char *); + +#else /* not __STDC__ */ + +extern char *kva_match(); + +extern int _auth_match(); +extern char *_argv_to_csl(); +extern char **_csl_to_argv(); +extern char *_do_unescape(); +extern void _free_argv(); +extern int _get_auth_policy(); +extern int _insert2kva(); +extern int _kva2str(); +extern kva_t *_kva_dup(); +extern void _kva_free(kva_t *); +extern kva_t *_new_kva(); +extern int _str2kva(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SECDB_H */ diff --git a/usr/src/head/semaphore.h b/usr/src/head/semaphore.h new file mode 100644 index 0000000000..6a77eab5da --- /dev/null +++ b/usr/src/head/semaphore.h @@ -0,0 +1,98 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SEMAPHORE_H +#define _SEMAPHORE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#include <sys/types.h> +#include <sys/fcntl.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + /* this structure must be the same as sema_t in <synch.h> */ + uint32_t sem_count; /* semaphore count */ + uint16_t sem_type; + uint16_t sem_magic; + upad64_t sem_pad1[3]; /* reserved for a mutex_t */ + upad64_t sem_pad2[2]; /* reserved for a cond_t */ +} sem_t; + +#define SEM_FAILED ((sem_t *)(-1)) + +/* + * function prototypes + */ +#if defined(__STDC__) +int sem_init(sem_t *, int, unsigned int); +int sem_destroy(sem_t *); +sem_t *sem_open(const char *, int, ...); +int sem_close(sem_t *); +int sem_unlink(const char *); +int sem_wait(sem_t *); +/* + * Inclusion of <time.h> breaks X/Open and POSIX namespace. + * The timespec structure while allowed in XPG6 and POSIX.1003d-1999, + * is not permitted in prior POSIX or X/Open specifications even + * though functions beginning with sem_* are allowed. + */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) +struct timespec; +int sem_timedwait(sem_t *_RESTRICT_KYWD, + const struct timespec *_RESTRICT_KYWD); +int sem_reltimedwait_np(sem_t *_RESTRICT_KYWD, + const struct timespec *_RESTRICT_KYWD); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ +int sem_trywait(sem_t *); +int sem_post(sem_t *); +int sem_getvalue(sem_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); +#else +int sem_init(); +int sem_destroy(); +sem_t *sem_open(); +int sem_close(); +int sem_unlink(); +int sem_wait(); +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) +int sem_timedwait(); +int sem_reltimedwait_np(); +#endif /* #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ +int sem_trywait(); +int sem_post(); +int sem_getvalue(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SEMAPHORE_H */ diff --git a/usr/src/head/setjmp.h b/usr/src/head/setjmp.h new file mode 100644 index 0000000000..0a7f65224d --- /dev/null +++ b/usr/src/head/setjmp.h @@ -0,0 +1,86 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SETJMP_H +#define _SETJMP_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9.2.9 */ + +#include <iso/setjmp_iso.h> + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/setjmp_iso.h>. + */ +#if __cplusplus >= 199711L +using std::jmp_buf; +using std::longjmp; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) + +#if !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX) || \ + defined(__EXTENSIONS__) +/* non-ANSI standard compilation */ + +#if defined(_LP64) || defined(_I32LPx) +typedef long sigjmp_buf[_SIGJBLEN]; +#else +typedef int sigjmp_buf[_SIGJBLEN]; +#endif + +extern int sigsetjmp(sigjmp_buf, int); +#pragma unknown_control_flow(sigsetjmp) +extern void siglongjmp(sigjmp_buf, int) __NORETURN; +#endif + +#else /* __STDC__ */ + +#if defined(_LP64) || defined(_I32LPx) +typedef long sigjmp_buf[_SIGJBLEN]; +#else +typedef int sigjmp_buf[_SIGJBLEN]; +#endif + +extern int sigsetjmp(); +#pragma unknown_control_flow(sigsetjmp) +extern void siglongjmp(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SETJMP_H */ diff --git a/usr/src/head/sgtty.h b/usr/src/head/sgtty.h new file mode 100644 index 0000000000..b2919fabe4 --- /dev/null +++ b/usr/src/head/sgtty.h @@ -0,0 +1,137 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _SGTTY_H +#define _SGTTY_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3.1.3 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Modes + */ +#define HUPCL 01 +#ifndef _SYS_IOCTL_H +#define XTABS 02 +#define LCASE 04 +#define ECHO 010 +#define CRMOD 020 +#define RAW 040 +#define ODDP 0100 +#define EVENP 0200 +#define ANYP 0300 +#define NLDELAY 001400 +#define TBDELAY 002000 +#define CRDELAY 030000 +#define VTDELAY 040000 +#define BSDELAY 0100000 +#define ALLDELAY 0177400 + +/* + * Delay algorithms + */ +#define CR0 0 +#define CR1 010000 +#define CR2 020000 +#define CR3 030000 +#define NL0 0 +#define NL1 000400 +#define NL2 001000 +#define NL3 001400 +#define TAB0 0 +#define TAB1 002000 +#endif /* _SYS_IOCTL_H */ +#define NOAL 004000 +#ifndef _SYS_IOCTL_H +#define FF0 0 +#define FF1 040000 +#define BS0 0 +#define BS1 0100000 +#endif /* _SYS_IOCTL_H */ + +#ifndef _SYS_TTOLD_H + +/* + * Structure for stty and gtty system calls. + */ +struct sgttyb { + char sg_ispeed; /* input speed */ + char sg_ospeed; /* output speed */ + char sg_erase; /* erase character */ + char sg_kill; /* kill character */ + int sg_flags; /* mode flags */ +}; + +/* BSD local special chars. Structure for TIOCSLTC/TIOCGLTC */ +struct ltchars { + char t_suspc; /* stop process signal */ + char t_dsuspc; /* delayed stop process signal */ + char t_rprntc; /* reprint line */ + char t_flushc; /* flush output (toggles) */ + char t_werasc; /* word erase */ + char t_lnextc; /* literal next character */ +}; + +/* + * Speeds + */ +#define B0 0 +#define B50 1 +#define B75 2 +#define B110 3 +#define B134 4 +#define B150 5 +#define B200 6 +#define B300 7 +#define B600 8 +#define B1200 9 +#define B1800 10 +#define B2400 11 +#define B4800 12 +#define B9600 13 +#define EXTA 14 +#define EXTB 15 + +/* + * ioctl arguments + */ +#define FIOCLEX (('f'<<8)|1) +#define FIONCLEX (('f'<<8)|2) +#define TIOCHPCL (('t'<<8)|2) +#define TIOCGETP (('t'<<8)|8) +#define TIOCSETP (('t'<<8)|9) +#define TIOCEXCL (('t'<<8)|13) +#define TIOCNXCL (('t'<<8)|14) + +#endif /* _SYS_TTOLD_H */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SGTTY_H */ diff --git a/usr/src/head/shadow.h b/usr/src/head/shadow.h new file mode 100644 index 0000000000..7b8688e2a4 --- /dev/null +++ b/usr/src/head/shadow.h @@ -0,0 +1,113 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _SHADOW_H +#define _SHADOW_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define PASSWD "/etc/passwd" +#define SHADOW "/etc/shadow" +#define OPASSWD "/etc/opasswd" +#define OSHADOW "/etc/oshadow" +#define PASSTEMP "/etc/ptmp" +#define SHADTEMP "/etc/stmp" + +#define DAY (24L * 60 * 60) /* 1 day in seconds */ +#define DAY_NOW (time_t)time((time_t *)0) / DAY + /* The above timezone variable is set by a call to */ + /* any ctime(3c) routine. Programs using the DAY_NOW */ + /* macro must call one of the ctime routines, */ + /* e.g. tzset(), BEFORE referencing DAY_NOW */ + +#define LOCKSTRING "*LK*" /* prefix to/string in sp_pwdp to lock acct */ +#define NOLOGINSTRING "NP" /* sp_pwdp for no-login accounts */ + +/* + * The spwd structure is used in the retreval of information from + * /etc/shadow. It is used by routines in the libos library. + */ +struct spwd { + char *sp_namp; /* user name */ + char *sp_pwdp; /* user password */ + int sp_lstchg; /* password lastchanged date */ + int sp_min; /* minimum number of days between password changes */ + int sp_max; /* number of days password is valid */ + int sp_warn; /* number of days to warn user to change passwd */ + int sp_inact; /* number of days the login may be inactive */ + int sp_expire; /* date when the login is no longer valid */ + unsigned int sp_flag; /* currently low 4 bits are used */ + + /* low 4 bits of sp_flag for counting failed login attempts */ +#define FAILCOUNT_MASK 0xF +}; + +#if defined(__STDC__) + +#ifndef _STDIO_H +#include <stdio.h> +#endif + +/* Declare all shadow password functions */ + +extern struct spwd *getspnam_r(const char *, struct spwd *, char *, int); +extern struct spwd *getspent_r(struct spwd *, char *, int); +extern struct spwd *fgetspent_r(FILE *, struct spwd *, char *, int); + +extern void setspent(void); +extern void endspent(void); +extern struct spwd *getspent(void); /* MT-unsafe */ +extern struct spwd *fgetspent(FILE *); /* MT-unsafe */ +extern struct spwd *getspnam(const char *); /* MT-unsafe */ + +extern int putspent(const struct spwd *, FILE *); +extern int lckpwdf(void); +extern int ulckpwdf(void); + +#else + +/* Declare all shadow password functions */ + +struct spwd *getspent_r(), *fgetspent_r(), *getspnam_r(); +void setspent(), endspent(); +struct spwd *getspent(), *fgetspent(), *getspnam(); /* MT-unsafe */ +int putspent(), lckpwdf(), ulckpwdf(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SHADOW_H */ diff --git a/usr/src/head/siginfo.h b/usr/src/head/siginfo.h new file mode 100644 index 0000000000..01d3793931 --- /dev/null +++ b/usr/src/head/siginfo.h @@ -0,0 +1,79 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _SIGINFO_H +#define _SIGINFO_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +#include <sys/types.h> +#include <sys/siginfo.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct siginfolist { + int nsiginfo; + char **vsiginfo; +}; + +#ifdef __STDC__ +extern const char * _sys_illlist[]; +extern const char * _sys_fpelist[]; +extern const char * _sys_segvlist[]; +extern const char * _sys_buslist[]; +extern const char * _sys_traplist[]; +extern const char * _sys_cldlist[]; +extern const struct siginfolist *_sys_siginfolistp; +#define _sys_siginfolist _sys_siginfolistp +#else +extern char * _sys_illlist[]; +extern char * _sys_fpelist[]; +extern char * _sys_segvlist[]; +extern char * _sys_buslist[]; +extern char * _sys_traplist[]; +extern char * _sys_cldlist[]; +extern struct siginfolist *_sys_siginfolistp; +#define _sys_siginfolist _sys_siginfolistp +#endif + +#if defined(__STDC__) + +extern void psignal(int, const char *); +extern void psiginfo(siginfo_t *, char *); + +#else + +extern void psignal(); +extern void psiginfo(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SIGINFO_H */ diff --git a/usr/src/head/signal.h b/usr/src/head/signal.h new file mode 100644 index 0000000000..127cc6ad0c --- /dev/null +++ b/usr/src/head/signal.h @@ -0,0 +1,286 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SIGNAL_H +#define _SIGNAL_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5.3.4 */ + +#include <sys/feature_tests.h> + +#if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ + defined(__XOPEN_OR_POSIX) +#include <sys/types.h> /* need pid_t/uid_t/size_t/clock_t/caddr_t/pthread_t */ +#endif + +#include <iso/signal_iso.h> +#include <sys/signal.h> + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/signal_iso.h>. + */ +#if __cplusplus >= 199711L +using std::sig_atomic_t; +using std::signal; +using std::raise; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined(__STDC__) + +extern const char **_sys_siglistp; /* signal descriptions */ +extern const int _sys_siglistn; /* # of signal descriptions */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +#define _sys_siglist _sys_siglistp +#define _sys_nsig _sys_siglistn +#endif + +#if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ + defined(__XOPEN_OR_POSIX) +extern int kill(pid_t, int); +extern int sigaction(int, const struct sigaction *_RESTRICT_KYWD, + struct sigaction *_RESTRICT_KYWD); +#ifndef _KERNEL +extern int sigaddset(sigset_t *, int); +extern int sigdelset(sigset_t *, int); +extern int sigemptyset(sigset_t *); +extern int sigfillset(sigset_t *); +extern int sigismember(const sigset_t *, int); +#endif +extern int sigpending(sigset_t *); +extern int sigprocmask(int, const sigset_t *_RESTRICT_KYWD, + sigset_t *_RESTRICT_KYWD); +extern int sigsuspend(const sigset_t *); +#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC)... */ + +#if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \ + !defined(__XOPEN_OR_POSIX)) +#include <sys/procset.h> +extern int gsignal(int); +extern int (*ssignal(int, int (*)(int)))(int); +extern int sigsend(idtype_t, id_t, int); +extern int sigsendset(const procset_t *, int); +extern int sig2str(int, char *); +extern int str2sig(const char *, int *); +#define SIG2STR_MAX 32 +#endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC)... */ + +#if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \ + !defined(__XOPEN_OR_POSIX)) || defined(_XPG4_2) +extern void (*bsd_signal(int, void (*)(int)))(int); +extern int killpg(pid_t, int); +extern int siginterrupt(int, int); +extern int sigaltstack(const stack_t *_RESTRICT_KYWD, stack_t *_RESTRICT_KYWD); +extern int sighold(int); +extern int sigignore(int); +extern int sigpause(int); +extern int sigrelse(int); +extern void (*sigset(int, void (*)(int)))(int); +#endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && ... */ + +/* Marked as LEGACY in SUSv2 and removed in SUSv3 */ +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + (defined(_XPG4_2) && !defined(_XPG6)) +extern int sigstack(struct sigstack *, struct sigstack *); +#endif + +#if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \ + !defined(__XOPEN_OR_POSIX)) || (_POSIX_C_SOURCE > 2) +#include <sys/siginfo.h> +#include <time.h> +extern int pthread_kill(pthread_t, int); +extern int pthread_sigmask(int, const sigset_t *_RESTRICT_KYWD, + sigset_t *_RESTRICT_KYWD); +extern int sigwaitinfo(const sigset_t *_RESTRICT_KYWD, + siginfo_t *_RESTRICT_KYWD); +extern int sigtimedwait(const sigset_t *_RESTRICT_KYWD, + siginfo_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD); +extern int sigqueue(pid_t, int, const union sigval); +#endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && */ + +#else /* __STDC__ */ + +extern char **_sys_siglistp; /* signal descriptions */ +extern int _sys_siglistn; /* # of signal descriptions */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +#define _sys_siglist _sys_siglistp +#define _sys_nsig _sys_siglistn +#endif + +#if defined(__EXTENSIONS__) || defined(__XOPEN_OR_POSIX) +extern int kill(); +extern int sigaction(); +#ifndef _KERNEL +extern int sigaddset(); +extern int sigdelset(); +extern int sigemptyset(); +extern int sigfillset(); +extern int sigismember(); +#endif +extern int sigpending(); +extern int sigprocmask(); +extern int sigsuspend(); +#endif /* defined(__EXTENSIONS__)... */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_XPG4_2) +extern void (*bsd_signal())(); +extern int killpg(); +extern int siginterrupt(); +#endif /* defined(__EXTENSIONS__) ... */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + (defined(_XPG4_2) && !defined(_XPG6)) +extern int sigstack(); +#endif + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +extern int gsignal(); +extern int (*ssignal)(); +extern int sigsend(); +extern int sigsendset(); +extern int sig2str(); +extern int str2sig(); +#define SIG2STR_MAX 32 +#endif + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_XPG4_2) +extern int sigaltstack(); +extern int sighold(); +extern int sigignore(); +extern int sigpause(); +extern int sigrelse(); +extern void (*sigset())(); +#endif + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + (_POSIX_C_SOURCE > 2) +#include <sys/siginfo.h> +#include <sys/time.h> +extern int pthread_kill(); +extern int pthread_sigmask(); +extern int sigwaitinfo(); +extern int sigtimedwait(); +extern int sigqueue(); +#endif + +#endif /* __STDC__ */ + +/* + * sigwait() prototype is defined here. + */ + +#if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \ + !defined(__XOPEN_OR_POSIX)) || (_POSIX_C_SOURCE - 0 >= 199506L) || \ + defined(_POSIX_PTHREAD_SEMANTICS) + +#if defined(__STDC__) + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname sigwait __posix_sigwait +extern int sigwait(const sigset_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern int __posix_sigwait(const sigset_t *_RESTRICT_KYWD, + int *_RESTRICT_KYWD); + +#ifdef __lint +#define sigwait __posix_sigwait +#else /* !__lint */ + +static int +sigwait(const sigset_t *_RESTRICT_KYWD __setp, int *_RESTRICT_KYWD __signo) +{ + return (__posix_sigwait(__setp, __signo)); +} + +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern int sigwait(sigset_t *); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + + +#else /* __STDC__ */ + + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname sigwait __posix_sigwait +extern int sigwait(); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern int __posix_sigwait(); + +#ifdef __lint +#define sigwait __posix_sigwait +#else /* !__lint */ + +static int +sigwait(__setp, __signo) + sigset_t *__setp; + int *__signo; +{ + return (__posix_sigwait(__setp, __signo)); +} + +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern int sigwait(); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +#endif /* __STDC__ */ + +#endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SIGNAL_H */ diff --git a/usr/src/head/spawn.h b/usr/src/head/spawn.h new file mode 100644 index 0000000000..a33b3adb34 --- /dev/null +++ b/usr/src/head/spawn.h @@ -0,0 +1,180 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SPAWN_H +#define _SPAWN_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/types.h> +#include <signal.h> +#include <sched.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define POSIX_SPAWN_RESETIDS 0x01 +#define POSIX_SPAWN_SETPGROUP 0x02 +#define POSIX_SPAWN_SETSIGDEF 0x04 +#define POSIX_SPAWN_SETSIGMASK 0x08 +#define POSIX_SPAWN_SETSCHEDPARAM 0x10 +#define POSIX_SPAWN_SETSCHEDULER 0x20 + +typedef struct { + void *__spawn_attrp; /* implementation-private */ +} posix_spawnattr_t; + +typedef struct { + void *__file_attrp; /* implementation-private */ +} posix_spawn_file_actions_t; + +#if defined(__STDC__) + +extern int posix_spawn( + pid_t *_RESTRICT_KYWD pid, + const char *_RESTRICT_KYWD path, + const posix_spawn_file_actions_t *file_actions, + const posix_spawnattr_t *_RESTRICT_KYWD attrp, + char *const argv[_RESTRICT_KYWD], + char *const envp[_RESTRICT_KYWD]); + +extern int posix_spawnp( + pid_t *_RESTRICT_KYWD pid, + const char *_RESTRICT_KYWD file, + const posix_spawn_file_actions_t *file_actions, + const posix_spawnattr_t *_RESTRICT_KYWD attrp, + char *const argv[_RESTRICT_KYWD], + char *const envp[_RESTRICT_KYWD]); + +extern int posix_spawn_file_actions_init( + posix_spawn_file_actions_t *file_actions); + +extern int posix_spawn_file_actions_destroy( + posix_spawn_file_actions_t *file_actions); + +extern int posix_spawn_file_actions_addopen( + posix_spawn_file_actions_t *_RESTRICT_KYWD file_actions, + int filedes, + const char *_RESTRICT_KYWD path, + int oflag, + mode_t mode); + +extern int posix_spawn_file_actions_addclose( + posix_spawn_file_actions_t *file_actions, + int filedes); + +extern int posix_spawn_file_actions_adddup2( + posix_spawn_file_actions_t *file_actions, + int filedes, + int newfiledes); + +extern int posix_spawnattr_init( + posix_spawnattr_t *attr); + +extern int posix_spawnattr_destroy( + posix_spawnattr_t *attr); + +extern int posix_spawnattr_setflags( + posix_spawnattr_t *attr, + short flags); + +extern int posix_spawnattr_getflags( + const posix_spawnattr_t *_RESTRICT_KYWD attr, + short *_RESTRICT_KYWD flags); + +extern int posix_spawnattr_setpgroup( + posix_spawnattr_t *attr, + pid_t pgroup); + +extern int posix_spawnattr_getpgroup( + const posix_spawnattr_t *_RESTRICT_KYWD attr, + pid_t *_RESTRICT_KYWD pgroup); + +extern int posix_spawnattr_setschedparam( + posix_spawnattr_t *_RESTRICT_KYWD attr, + const struct sched_param *_RESTRICT_KYWD schedparam); + +extern int posix_spawnattr_getschedparam( + const posix_spawnattr_t *_RESTRICT_KYWD attr, + struct sched_param *_RESTRICT_KYWD schedparam); + +extern int posix_spawnattr_setschedpolicy( + posix_spawnattr_t *attr, + int schedpolicy); + +extern int posix_spawnattr_getschedpolicy( + const posix_spawnattr_t *_RESTRICT_KYWD attr, + int *_RESTRICT_KYWD schedpolicy); + +extern int posix_spawnattr_setsigdefault( + posix_spawnattr_t *_RESTRICT_KYWD attr, + const sigset_t *_RESTRICT_KYWD sigdefault); + +extern int posix_spawnattr_getsigdefault( + const posix_spawnattr_t *_RESTRICT_KYWD attr, + sigset_t *_RESTRICT_KYWD sigdefault); + +extern int posix_spawnattr_setsigmask( + posix_spawnattr_t *_RESTRICT_KYWD attr, + const sigset_t *_RESTRICT_KYWD sigmask); + +extern int posix_spawnattr_getsigmask( + const posix_spawnattr_t *_RESTRICT_KYWD attr, + sigset_t *_RESTRICT_KYWD sigmask); + +#else /* __STDC__ */ + +extern int posix_spawn(); +extern int posix_spawnp(); +extern int posix_spawn_file_actions_init(); +extern int posix_spawn_file_actions_destroy(); +extern int posix_spawn_file_actions_addopen(); +extern int posix_spawn_file_actions_addclose(); +extern int posix_spawn_file_actions_adddup2(); +extern int posix_spawnattr_init(); +extern int posix_spawnattr_destroy(); +extern int posix_spawnattr_setflags(); +extern int posix_spawnattr_getflags(); +extern int posix_spawnattr_setpgroup(); +extern int posix_spawnattr_getpgroup(); +extern int posix_spawnattr_setschedparam(); +extern int posix_spawnattr_getschedparam(); +extern int posix_spawnattr_setschedpolicy(); +extern int posix_spawnattr_getschedpolicy(); +extern int posix_spawnattr_setsigdefault(); +extern int posix_spawnattr_getsigdefault(); +extern int posix_spawnattr_setsigmask(); +extern int posix_spawnattr_getsigmask(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SPAWN_H */ diff --git a/usr/src/head/stack_unwind.h b/usr/src/head/stack_unwind.h new file mode 100644 index 0000000000..5f6fd71eb1 --- /dev/null +++ b/usr/src/head/stack_unwind.h @@ -0,0 +1,298 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Public interfaces for AMD64 Unwind routines + */ + +#ifndef _STACK_UNWIND_H +#define _STACK_UNWIND_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__amd64) /* none of this is valid except for AMD64 */ + +typedef enum { + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 +} _Unwind_Reason_Code; + +typedef int _Unwind_Action; +extern const _Unwind_Action _UA_SEARCH_PHASE; +extern const _Unwind_Action _UA_CLEANUP_PHASE; +extern const _Unwind_Action _UA_HANDLER_FRAME; +extern const _Unwind_Action _UA_FORCE_UNWIND; + +struct _Unwind_Exception; +struct _Unwind_Context; + + +/* + * Signature of language specific call back for deleting exception object + */ +typedef void (*_Unwind_Exception_Cleanup_Fn)( + _Unwind_Reason_Code reason, + struct _Unwind_Exception *exc); + +/* + * Header preceding language specific exception object + * For Sun C++ these fields are the beginning of the + * language specific structure. + */ +struct _Unwind_Exception { + uint64_t exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; + uint64_t private_1; + uint64_t private_2; +}; + +/* + * Signature for language specific routine - address is in eh_frame CIE. + * During phase one it predicts whether exception would be caught at this + * frame and during phase two selects a handler as predicted. An action + * of _UA_FORCE_UNWIND will prevent any catch block from being selected. + * + * The personality function is the only call back used when + * _Unwind_RaiseException() is called. + */ +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)( + int version, + _Unwind_Action actions, + uint64_t exceptionClass, + struct _Unwind_Exception *exceptionObject, + struct _Unwind_Context *context); + +/* + * Signature of callback function that is used when _Unwind_ForcedUnwind() + * is called. It is called at every step of walkback and that can control + * the execution of the personality routine at each frame. + */ +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)( + int version, + _Unwind_Action actions, + uint64_t exceptionClass, + struct _Unwind_Exception *exceptionObject, + struct _Unwind_Context *context, + void *stop_parameter); + +/* + * Here begins the external functional interface + */ + +/* + * Used to implement C++ throw - starts walkback with caller's caller. + * The routine in the middle must use %rbp as a frame pointer + */ +_Unwind_Reason_Code _Unwind_RaiseException( + struct _Unwind_Exception *exception_object); + +/* + * Used (with different stop functions) for POSIX thread cancellation + * and stack walking - starts walkback with caller's caller. + * + * Note: must be called by a routine which has a real FP and doesn't use + * callee saves registers. + */ +_Unwind_Reason_Code _Unwind_ForcedUnwind( + struct _Unwind_Exception *exception_object, + _Unwind_Stop_Fn stop, + void *stop_parameter); + +/* + * Used to resume unwinding at end of cleanup (not catch) code + * Assumes that caller is language specific cleanup code and + * pops the stack one level before resuming walk. + */ +void _Unwind_Resume(struct _Unwind_Exception *exception_object); + +/* + * Calls destructor function for exception object + */ +void _Unwind_DeleteException(struct _Unwind_Exception *exception_object); +/* + * { + * (*(exception_object->exception_cleanup))(_URC_NO_REASON, + * exception_object); + * } + */ + + +#if 0 + +extern "C" _Unwind_Reason_Code +__example_stop_fn(int version, int actions, uint64_t exclass, + struct _Unwind_Exception *exception_object, + struct _Unwind_Context *ctx, void *_Sa) +{ + _Unwind_Reason_Code res; + + uint64_t fp = _Unwind_GetCFA(ctx); + + if (fp == 0 || _Unwind_GetGR(ctx, RET_ADD) == 0) { + if (no_return) + die; + res = _URC_END_OF_STACK; + } else { + /* + * Your logic here: + * res = ........ + */ + } + switch (res) { + case _URC_NO_REASON: + /* + * framework will call personality routine for current context + * then then move one frame back the stack and call here with + * updated context. POSIX thread cancellation uses this pattern. + * + * If this path is taken the exception object passed must have + * been constructed by the same language system supplying the + * personality routines. i.e. foreign exceptions are not + * implemented. + * + * The Sun Microsystems C++ runtime contains the routine + * + * _ex_unwind(_Unwind_Stop_fn sfunc, void *sfunc_arg) + * + * which is a wrapper around _Unwind_ForcedUnwind that + * sets up a C++ exception object. + * + * Once this path is taken, the stack frame from which + * _Unwind_ForcedUnwind was called is not guaranteed to + * still exist. Thus the return codes listed below which + * result in that call returning are rendered bogus. + * + * A thread reaching the end of the stack during cancellation + * must die instead of returning _URC_END_OF_STACK. + */ + break; + case _URC_CONTINUE_UNWIND: + /* + * framework will move one frame back the stack and + * call here with updated context + * + * The exception record supplied to _Unwind_ForcedUnwind + * need only contain the header and may be stack allocated + * if this function will never allow the personality + * function to run (as in a trace generator). + */ + break; + case _URC_INSTALL_CONTEXT: + /* + * framework will resume execution of user code at location + * specified by (altered) context + */ + _Unwind_Delete_Exception(res, exception_object); + break; + case _URC_NORMAL_STOP: + /* + * call to _Unwind_ForcedUnwind will return _URC_NORMAL_STOP + */ + _Unwind_Delete_Exception(res, exception_object); + break; + case _URC_END_OF_STACK: + /* + * call to _Unwind_ForcedUnwind will return _URC_END_OF_STACK + */ + _Unwind_Delete_Exception(res, exception_object); + break; + case _URC_FOREIGN_EXCEPTION_CAUGHT: + case _URC_FATAL_PHASE2_ERROR: + case _URC_FATAL_PHASE1_ERROR: + case _URC_HANDLER_FOUND: + /* + * call to _Unwind_ForcedUnwind will return + * _URC_FATAL_PHASE2_ERROR + */ + _Unwind_Delete_Exception(res, exception_object); + break; + } + return (res); +} + +#endif + +/* + * Stack frame context accessors defined in ABI + * (despite all the dire text in the ABI these are reliable Get/Set routines) + * Note: RA is handled as a GR value + */ + +/* + * Valid Index values for _Unwind_GetGR + */ +#define GPR_RBX 3 /* callee saves */ +#define FP_RBP 6 /* callee saves (optional frame pointer) */ +#define SP_RSP 7 /* callee saves */ +#define EIR_R12 12 /* callee saves */ +#define EIR_R13 13 /* callee saves */ +#define EIR_R14 14 /* callee saves */ +#define EIR_R15 15 /* callee saves */ +#define RET_ADD 16 /* virtual register - really caller's PC */ + +/* + * Valid Index values for _Unwind_SetGR + */ +#define GPR_RDX 1 /* landing pad parameter */ +#define GPR_RCX 2 /* landing pad parameter */ +#define GPR_RSI 4 /* landing pad parameter */ +#define GPR_RDI 5 /* landing pad parameter */ + +uint64_t _Unwind_GetGR(struct _Unwind_Context *context, int index); + +void _Unwind_SetGR(struct _Unwind_Context *context, int index, + uint64_t new_value); + +uint64_t _Unwind_GetCFA(struct _Unwind_Context *context); + +uint64_t _Unwind_GetIP(struct _Unwind_Context *context); + +void _Unwind_SetIP(struct _Unwind_Context *context, uint64_t new_value); + +void *_Unwind_GetLanguageSpecificData(struct _Unwind_Context *context); + +uint64_t _Unwind_GetRegionStart(struct _Unwind_Context *context); + +#endif /* __amd64 */ + +#ifdef __cplusplus +} +#endif + +#endif /* _STACK_UNWIND_H */ diff --git a/usr/src/head/stdarg.h b/usr/src/head/stdarg.h new file mode 100644 index 0000000000..73684dfa9e --- /dev/null +++ b/usr/src/head/stdarg.h @@ -0,0 +1,67 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _STDARG_H +#define _STDARG_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */ + +/* + * This header defines the ISO C 1989, ISO C++ 1998, and ISO C 1999 + * variable argument definitions. For legacy support, it also defines + * the pre-standard variable argument definitions. + * + * The varargs definitions within this header are defined in terms of + * implementation definitions. These implementation definitions reside + * in <sys/va_list.h>. This organization enables protected use of + * the implementation by other standard headers without introducing + * names into the users' namespace. + */ + +#if defined(__STDC__) + +#include <iso/stdarg_iso.h> +#include <iso/stdarg_c99.h> + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/stdarg_iso.h>. + */ +#if __cplusplus >= 199711L +using std::va_list; +#endif + +#else /* __STDC__ */ + +#include <varargs.h> + +#endif /* __STDC__ */ + +#endif /* _STDARG_H */ diff --git a/usr/src/head/stdbool.h b/usr/src/head/stdbool.h new file mode 100644 index 0000000000..a55ea90f14 --- /dev/null +++ b/usr/src/head/stdbool.h @@ -0,0 +1,71 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _STDBOOL_H +#define _STDBOOL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Included for alignment with the ISO/IEC 9899:1999 standard. The + * contents of this header are only visible when using a c99 + * compiler, otherwise inclusion of this header will result in a + * forced compilation failure. + * + * Note that the ability to undefine and redefine the macros bool, + * true, and false is an obsolescent feature which may be withdrawn + * in a future version of the standards specifications. + */ + +#include <sys/feature_tests.h> + +#if defined(_STDC_C99) + +#undef bool +#undef true +#undef false + +#define bool _Bool +#define true 1 +#define false 0 + +#define __bool_true_false_are_defined 1 + +#else /* _STDC_C99 */ + +#error "Use of <stdbool.h> is valid only in a c99 compilation environment." + +#endif /* _STDC_C99 */ + +#ifdef __cplusplus +} +#endif + +#endif /* _STDBOOL_H */ diff --git a/usr/src/head/stddef.h b/usr/src/head/stddef.h new file mode 100644 index 0000000000..15a4ba0f6b --- /dev/null +++ b/usr/src/head/stddef.h @@ -0,0 +1,80 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _STDDEF_H +#define _STDDEF_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/isa_defs.h> +#include <iso/stddef_iso.h> + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/stddef_iso.h>. + */ +#if __cplusplus >= 199711L +using std::ptrdiff_t; +using std::size_t; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * wchar_t is a built-in type in standard C++ and as such is not + * defined here when using standard C++. However, the GNU compiler + * fixincludes utility nonetheless creates it's own version of this + * header for use by gcc and g++. In that version it adds a redundant + * guard for __cplusplus. To avoid the creation of a gcc/g++ specific + * header we need to include the following magic comment: + * + * we must use the C++ compiler's type + * + * The above comment should not be removed or changed until GNU + * gcc/fixinc/inclhack.def is updated to bypass this header. + */ +#if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__)) +#ifndef _WCHAR_T +#define _WCHAR_T +#if defined(_LP64) +typedef int wchar_t; +#else +typedef long wchar_t; +#endif +#endif /* !_WCHAR_T */ +#endif /* !defined(__cplusplus) ... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _STDDEF_H */ diff --git a/usr/src/head/stdint.h b/usr/src/head/stdint.h new file mode 100644 index 0000000000..bd87d1ad15 --- /dev/null +++ b/usr/src/head/stdint.h @@ -0,0 +1,40 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _STDINT_H +#define _STDINT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * This header was introduced by the ISO C Standard, ISO/IEC + * 9899:1999 Programming language - C. It is a subset of the + * <inttypes.h> header. + */ + +#include <sys/stdint.h> + +#endif /* _STDINT_H */ diff --git a/usr/src/head/stdio.h b/usr/src/head/stdio.h new file mode 100644 index 0000000000..0c1ac2d77a --- /dev/null +++ b/usr/src/head/stdio.h @@ -0,0 +1,461 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * User-visible pieces of the ANSI C standard I/O package. + */ + +#ifndef _STDIO_H +#define _STDIO_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2.34.1.2 */ + +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Do all of our 'redefine_extname' processing before + * declarations of the associated functions are seen. + * This is necessary to keep gcc happy. + */ +#if defined(__PRAGMA_REDEFINE_EXTNAME) + +/* large file compilation environment setup */ +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#pragma redefine_extname fopen fopen64 +#pragma redefine_extname freopen freopen64 +#pragma redefine_extname tmpfile tmpfile64 +#pragma redefine_extname fgetpos fgetpos64 +#pragma redefine_extname fsetpos fsetpos64 +#if defined(_LARGEFILE_SOURCE) +#pragma redefine_extname fseeko fseeko64 +#pragma redefine_extname ftello ftello64 +#endif /* _LARGEFILE_SOURCE */ +#endif /* !defined(_LP64) && _FILE_OFFSET_BITS == 64 */ + +/* In the LP64 compilation environment, all APIs are already large file */ +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +#pragma redefine_extname fopen64 fopen +#pragma redefine_extname freopen64 freopen +#pragma redefine_extname tmpfile64 tmpfile +#pragma redefine_extname fgetpos64 fgetpos +#pragma redefine_extname fsetpos64 fsetpos +#if defined(_LARGEFILE_SOURCE) +#pragma redefine_extname fseeko64 fseeko +#pragma redefine_extname ftello64 ftello +#endif /* _LARGEFILE_SOURCE */ +#endif /* defined(_LP64) && defined(_LARGEFILE64_SOURCE) */ + +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#ifdef __cplusplus +} +#endif + +#include <iso/stdio_iso.h> + +/* + * If feature test macros are set that enable interfaces that use types + * defined in <sys/types.h>, get those types by doing the include. + * + * Note that in asking for the interfaces associated with this feature test + * macro one also asks for definitions of the POSIX types. + */ + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/stdio_iso.h>. + */ +#if __cplusplus >= 199711L +using std::FILE; +using std::size_t; +using std::fpos_t; +using std::remove; +using std::rename; +using std::tmpfile; +using std::tmpnam; +using std::fclose; +using std::fflush; +using std::fopen; +using std::freopen; +using std::setbuf; +using std::setvbuf; +using std::fprintf; +using std::fscanf; +using std::printf; +using std::scanf; +using std::sprintf; +using std::sscanf; +using std::vfprintf; +using std::vprintf; +using std::vsprintf; +using std::fgetc; +using std::fgets; +using std::fputc; +using std::fputs; +using std::getc; +using std::getchar; +using std::gets; +using std::putc; +using std::putchar; +using std::puts; +using std::ungetc; +using std::fread; +using std::fwrite; +using std::fgetpos; +using std::fseek; +using std::fsetpos; +using std::ftell; +using std::rewind; +using std::clearerr; +using std::feof; +using std::ferror; +using std::perror; +#ifndef _LP64 +using std::__filbuf; +using std::__flsbuf; +#endif /* _LP64 */ +#endif /* __cplusplus >= 199711L */ + +/* + * This header needs to be included here because it relies on the global + * visibility of FILE and size_t in the C++ environment. + */ +#include <iso/stdio_c99.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_LARGEFILE_SOURCE) || defined(_XPG5) +#ifndef _OFF_T +#define _OFF_T +#if defined(_LP64) || _FILE_OFFSET_BITS == 32 +typedef long off_t; +#else +typedef __longlong_t off_t; +#endif +#ifdef _LARGEFILE64_SOURCE +#ifdef _LP64 +typedef off_t off64_t; +#else +typedef __longlong_t off64_t; +#endif +#endif /* _LARGEFILE64_SOURCE */ +#endif /* _OFF_T */ +#endif /* _LARGEFILE_SOURCE */ + +#ifdef _LARGEFILE64_SOURCE +#ifdef _LP64 +typedef fpos_t fpos64_t; +#else +typedef __longlong_t fpos64_t; +#endif +#endif /* _LARGEFILE64_SOURCE */ + +/* + * XPG4 requires that va_list be defined in <stdio.h> "as described in + * <stdarg.h>". ANSI-C and POSIX require that the namespace of <stdio.h> + * not be polluted with this name. + */ +#if defined(_XPG4) && !defined(_VA_LIST) +#define _VA_LIST +typedef __va_list va_list; +#endif /* defined(_XPG4 && !defined(_VA_LIST) */ + +#if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ + defined(__XOPEN_OR_POSIX) + +#define L_ctermid 9 + +/* Marked LEGACY in SUSv2 and removed in SUSv3 */ +#if !defined(_XPG6) || defined(__EXTENSIONS__) +#define L_cuserid 9 +#endif + +#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \ + defined(_XOPEN_SOURCE) + +#define P_tmpdir "/var/tmp/" +#endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */ + +#ifndef _STDIO_ALLOCATE +extern unsigned char _sibuf[], _sobuf[]; +#endif + +/* large file compilation environment setup */ +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#if !defined(__PRAGMA_REDEFINE_EXTNAME) +#if defined(__STDC__) +extern FILE *fopen64(const char *, const char *); +extern FILE *freopen64(const char *, const char *, FILE *); +extern FILE *tmpfile64(void); +extern int fgetpos64(FILE *, fpos_t *); +extern int fsetpos64(FILE *, const fpos_t *); +#else /* defined(__STDC__) */ +extern FILE *fopen64(); +extern FILE *freopen64(); +extern FILE *tmpfile64(); +extern int fgetpos64(); +extern int fsetpos64(); +#endif /* defined(__STDC__) */ +#define fopen fopen64 +#define freopen freopen64 +#define tmpfile tmpfile64 +#define fgetpos fgetpos64 +#define fsetpos fsetpos64 +#ifdef _LARGEFILE_SOURCE +#define fseeko fseeko64 +#define ftello ftello64 +#endif +#endif /* !__PRAGMA_REDEFINE_EXTNAME */ +#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ + +#ifndef _LP64 +extern unsigned char *_bufendtab[]; +extern FILE *_lastbuf; +#endif + +/* In the LP64 compilation environment, all APIs are already large file */ +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +#if !defined(__PRAGMA_REDEFINE_EXTNAME) +#define fopen64 fopen +#define freopen64 freopen +#define tmpfile64 tmpfile +#define fgetpos64 fgetpos +#define fsetpos64 fsetpos +#ifdef _LARGEFILE_SOURCE +#define fseeko64 fseeko +#define ftello64 ftello +#endif +#endif /* !__PRAGMA_REDEFINE_EXTNAME */ +#endif /* _LP64 && _LARGEFILE64_SOURCE */ + +#if defined(__STDC__) + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_REENTRANT) +extern char *tmpnam_r(char *); +#endif + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) +extern void setbuffer(FILE *, char *, size_t); +extern int setlinebuf(FILE *); +#endif + +/* + * The following are known to POSIX and XOPEN, but not to ANSI-C. + */ +#if defined(__EXTENSIONS__) || \ + !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX) + +extern FILE *fdopen(int, const char *); +extern char *ctermid(char *); +extern int fileno(FILE *); + +#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ + +/* + * The following are known to POSIX.1c, but not to ANSI-C or XOPEN. + */ +#if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ + (_POSIX_C_SOURCE - 0 >= 199506L) +extern void flockfile(FILE *); +extern int ftrylockfile(FILE *); +extern void funlockfile(FILE *); +extern int getc_unlocked(FILE *); +extern int getchar_unlocked(void); +extern int putc_unlocked(int, FILE *); +extern int putchar_unlocked(int); + +#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ + +/* + * The following are known to XOPEN, but not to ANSI-C or POSIX. + */ +#if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ + defined(_XOPEN_SOURCE) +extern FILE *popen(const char *, const char *); +extern char *tempnam(const char *, const char *); +extern int pclose(FILE *); +#if !defined(_XOPEN_SOURCE) +extern int getsubopt(char **, char *const *, char **); +#endif /* !defined(_XOPEN_SOURCE) */ + +/* Marked LEGACY in SUSv2 and removed in SUSv3 */ +#if !defined(_XPG6) || defined(__EXTENSIONS__) +extern char *cuserid(char *); +extern int getopt(int, char *const *, const char *); +extern char *optarg; +extern int optind, opterr, optopt; +extern int getw(FILE *); +extern int putw(int, FILE *); +#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ + +#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ + +/* + * The following are defined as part of the Large File Summit interfaces. + */ +#if defined(_LARGEFILE_SOURCE) || defined(_XPG5) +extern int fseeko(FILE *, off_t, int); +extern off_t ftello(FILE *); +#endif + +/* + * The following are defined as part of the transitional Large File Summit + * interfaces. + */ +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern FILE *fopen64(const char *, const char *); +extern FILE *freopen64(const char *, const char *, FILE *); +extern FILE *tmpfile64(void); +extern int fgetpos64(FILE *, fpos64_t *); +extern int fsetpos64(FILE *, const fpos64_t *); +extern int fseeko64(FILE *, off64_t, int); +extern off64_t ftello64(FILE *); +#endif + +#else /* !defined __STDC__ */ + +#ifndef _LP64 +#define _bufend(p) ((fileno(p) < _NFILE) ? _bufendtab[fileno(p)] : \ + (unsigned char *)_realbufend(p)) +#define _bufsiz(p) (_bufend(p) - (p)->_base) +#endif /* _LP64 */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_REENTRANT) +extern char *tmpnam_r(); +#endif + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +extern void setbuffer(); +extern int setlinebuf(); +#endif + +#if defined(__EXTENSIONS__) || defined(__XOPEN_OR_POSIX) +extern FILE *fdopen(); +extern char *ctermid(); +extern int fileno(); +#endif /* defined(__EXTENSIONS__) || defined(__XOPEN_OR_POSIX) */ + +#if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ + (_POSIX_C_SOURCE - 0 >= 199506L) +extern void flockfile(); +extern int ftrylockfile(); +extern void funlockfile(); +extern int getc_unlocked(); +extern int getchar_unlocked(); +extern int putc_unlocked(); +extern int putchar_unlocked(); +#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ + +#if defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) +extern FILE *popen(); +extern char *tempnam(); +extern int pclose(); + +#if !defined(_XOPEN_SOURCE) +extern int getsubopt(); +#endif /* !defined(_XOPEN_SOURCE) */ + +#if !defined(_XPG6) || defined(__EXTENSIONS__) +extern char *cuserid(); +extern int getopt(); +extern char *optarg; +extern int optind, opterr, optopt; +extern int getw(); +extern int putw(); +#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ + +#endif /* defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) */ + +#if defined(_LARGEFILE_SOURCE) || defined(_XPG5) +extern int fseeko(); +extern off_t ftello(); +#endif + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern FILE *fopen64(); +extern FILE *freopen64(); +extern FILE *tmpfile64(); +extern int fgetpos64(); +extern int fsetpos64(); +extern int fseeko64(); +extern off64_t ftello64(); +#endif + +#endif /* __STDC__ */ + +#if !defined(__lint) + +#if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ + (_POSIX_C_SOURCE - 0 >= 199506L) +#ifndef _LP64 +#ifdef __STDC__ +#define getc_unlocked(p) (--(p)->_cnt < 0 \ + ? __filbuf(p) \ + : (int)*(p)->_ptr++) +#define putc_unlocked(x, p) (--(p)->_cnt < 0 \ + ? __flsbuf((x), (p)) \ + : (int)(*(p)->_ptr++ = \ + (unsigned char) (x))) +#else +#define getc_unlocked(p) (--(p)->_cnt < 0 \ + ? _filbuf(p) \ + : (int)*(p)->_ptr++) +#define putc_unlocked(x, p) (--(p)->_cnt < 0 \ + ? _flsbuf((x), (p)) \ + : (int)(*(p)->_ptr++ = \ + (unsigned char) (x))) +#endif /* __STDC__ */ +#endif /* _LP64 */ +#define getchar_unlocked() getc_unlocked(stdin) +#define putchar_unlocked(x) putc_unlocked((x), stdout) +#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ + +#endif /* !defined(__lint) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _STDIO_H */ diff --git a/usr/src/head/stdio_ext.h b/usr/src/head/stdio_ext.h new file mode 100644 index 0000000000..f3e52daeb1 --- /dev/null +++ b/usr/src/head/stdio_ext.h @@ -0,0 +1,79 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1998, by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * Extensions to the stdio package + */ + +#ifndef _STDIO_EXT_H +#define _STDIO_EXT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <stdio.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Even though the contents of the stdio FILE structure have always been + * private to the stdio implementation, over the years some programs have + * needed to get information about a stdio stream that was not accessible + * through a supported interface. These programs have resorted to accessing + * fields of the FILE structure directly, rendering them possibly non-portable + * to new implementations of stdio, or more likely, preventing enhancements + * to stdio because those programs will break. + * + * In the 64-bit world, the FILE structure is opaque. The routines here + * are provided as a way to get the information that used to be retrieved + * directly from the FILE structure. They are based on the needs of + * existing programs (such as 'mh' and 'emacs'), so they may be extended + * as other programs are ported. Though they may still be non-portable to + * other operating systems, they will work from each Solaris release to + * the next. More portable interfaces are being developed. + */ + +#define FSETLOCKING_QUERY 0 +#define FSETLOCKING_INTERNAL 1 +#define FSETLOCKING_BYCALLER 2 + +extern size_t __fbufsize(FILE *stream); +extern int __freading(FILE *stream); +extern int __fwriting(FILE *stream); +extern int __freadable(FILE *stream); +extern int __fwritable(FILE *stream); +extern int __flbf(FILE *stream); +extern void __fpurge(FILE *stream); +extern size_t __fpending(FILE *stream); +extern void _flushlbf(void); +extern int __fsetlocking(FILE *stream, int type); + +#ifdef __cplusplus +} +#endif + +#endif /* _STDIO_EXT_H */ diff --git a/usr/src/head/stdio_impl.h b/usr/src/head/stdio_impl.h new file mode 100644 index 0000000000..145af56b4c --- /dev/null +++ b/usr/src/head/stdio_impl.h @@ -0,0 +1,74 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _STDIO_IMPL_H +#define _STDIO_IMPL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/isa_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _LP64 + +#ifndef _FILE64_H + +struct __FILE_TAG { + long __pad[16]; +}; + +#endif /* _FILE64_H */ + +#else + +struct __FILE_TAG /* needs to be binary-compatible with old versions */ +{ +#ifdef _STDIO_REVERSE + unsigned char *_ptr; /* next character from/to here in buffer */ + int _cnt; /* number of available characters in buffer */ +#else + int _cnt; /* number of available characters in buffer */ + unsigned char *_ptr; /* next character from/to here in buffer */ +#endif + unsigned char *_base; /* the buffer */ + unsigned char _flag; /* the state of the stream */ + unsigned char _file; /* UNIX System file descriptor */ + unsigned __orientation:2; /* the orientation of the stream */ + unsigned __ionolock:1; /* turn off implicit locking */ + unsigned __seekable:1; /* is file seekable? */ + unsigned __filler:4; +}; + +#endif /* _LP64 */ + +#ifdef __cplusplus +} +#endif + +#endif /* _STDIO_IMPL_H */ diff --git a/usr/src/head/stdio_tag.h b/usr/src/head/stdio_tag.h new file mode 100644 index 0000000000..818845a016 --- /dev/null +++ b/usr/src/head/stdio_tag.h @@ -0,0 +1,49 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _STDIO_TAG_H +#define _STDIO_TAG_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __FILE_TAG +#if defined(__cplusplus) && !defined(__GNUC__) && (__cplusplus < 54321L) +#define __FILE_TAG FILE +#else +#define __FILE_TAG __FILE +#endif +typedef struct __FILE_TAG __FILE; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _STDIO_TAG_H */ diff --git a/usr/src/head/stdlib.h b/usr/src/head/stdlib.h new file mode 100644 index 0000000000..d652900fc2 --- /dev/null +++ b/usr/src/head/stdlib.h @@ -0,0 +1,336 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _STDLIB_H +#define _STDLIB_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.22 */ + +#include <iso/stdlib_iso.h> +#include <iso/stdlib_c99.h> + +#if defined(__EXTENSIONS__) || defined(_XPG4) +#include <sys/wait.h> +#endif + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/stdlib_iso.h>. + */ +#if __cplusplus >= 199711L +using std::div_t; +using std::ldiv_t; +using std::size_t; +using std::abort; +using std::abs; +using std::atexit; +using std::atof; +using std::atoi; +using std::atol; +using std::bsearch; +using std::calloc; +using std::div; +using std::exit; +using std::free; +using std::getenv; +using std::labs; +using std::ldiv; +using std::malloc; +using std::mblen; +using std::mbstowcs; +using std::mbtowc; +using std::qsort; +using std::rand; +using std::realloc; +using std::srand; +using std::strtod; +using std::strtol; +using std::strtoul; +using std::system; +using std::wcstombs; +using std::wctomb; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _UID_T +#define _UID_T +#if defined(_LP64) || defined(_I32LPx) +typedef int uid_t; /* UID type */ +#else +typedef long uid_t; /* (historical version) */ +#endif +#endif /* !_UID_T */ + +#if defined(__STDC__) + +/* large file compilation environment setup */ +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname mkstemp mkstemp64 +#else /* __PRAGMA_REDEFINE_EXTNAME */ +#define mkstemp mkstemp64 +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#endif /* _FILE_OFFSET_BITS == 64 */ + +/* In the LP64 compilation environment, all APIs are already large file */ +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname mkstemp64 mkstemp +#else /* __PRAGMA_REDEFINE_EXTNAME */ +#define mkstemp64 mkstemp +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#endif /* _LP64 && _LARGEFILE64_SOURCE */ + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT) +extern int rand_r(unsigned int *); +#endif + +extern void _exithandle(void); + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \ + defined(_XPG4) +extern double drand48(void); +extern double erand48(unsigned short *); +extern long jrand48(unsigned short *); +extern void lcong48(unsigned short *); +extern long lrand48(void); +extern long mrand48(void); +extern long nrand48(unsigned short *); +extern unsigned short *seed48(unsigned short *); +extern void srand48(long); +extern int putenv(char *); +extern void setkey(const char *); +#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ + +/* + * swab() has historically been in <stdlib.h> as delivered from AT&T + * and continues to be visible in the default compilation environment. + * As of Issue 4 of the X/Open Portability Guides, swab() was declared + * in <unistd.h>. As a result, with respect to X/Open namespace the + * swab() declaration in this header is only visible for the XPG3 + * environment. + */ +#if (defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC__) && !defined(_POSIX_C_SOURCE))) && \ + (!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !defined(_XPG4))) +#ifndef _SSIZE_T +#define _SSIZE_T +#if defined(_LP64) || defined(_I32LPx) +typedef long ssize_t; /* size of something in bytes or -1 */ +#else +typedef int ssize_t; /* (historical version) */ +#endif +#endif /* !_SSIZE_T */ + +extern void swab(const char *, char *, ssize_t); +#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ + +#if defined(__EXTENSIONS__) || \ + !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) +extern int mkstemp(char *); +#endif /* defined(__EXTENSIONS__) ... */ + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern int mkstemp64(char *); +#endif /* _LARGEFILE64_SOURCE... */ + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_XPG4_2) +extern long a64l(const char *); +extern char *ecvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD); +extern char *fcvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD); +extern char *gcvt(double, int, char *); +extern int getsubopt(char **, char *const *, char **); +extern int grantpt(int); +extern char *initstate(unsigned, char *, size_t); +extern char *l64a(long); +extern char *mktemp(char *); +extern char *ptsname(int); +extern long random(void); +extern char *realpath(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD); +extern char *setstate(const char *); +extern void srandom(unsigned); +extern int unlockpt(int); +/* Marked LEGACY in SUSv2 and removed in SUSv3 */ +#if !defined(_XPG6) || defined(__EXTENSIONS__) +extern int ttyslot(void); +extern void *valloc(size_t); +#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ +#endif /* defined(__EXTENSIONS__) || ... || defined(_XPG4_2) */ + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_XPG6) +extern int posix_openpt(int); +extern int setenv(const char *, const char *, int); +extern int unsetenv(const char *); +#endif + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) +extern void closefrom(int); +extern int dup2(int, int); +extern int fdwalk(int (*)(void *, int), void *); +extern char *qecvt(long double, int, int *, int *); +extern char *qfcvt(long double, int, int *, int *); +extern char *qgcvt(long double, int, char *); +extern char *getcwd(char *, size_t); +extern const char *getexecname(void); +extern char *getlogin(void); +extern int getopt(int, char *const *, const char *); +extern char *optarg; +extern int optind, opterr, optopt; +extern char *getpass(const char *); +extern char *getpassphrase(const char *); +extern int getpw(uid_t, char *); +extern int isatty(int); +extern void *memalign(size_t, size_t); +extern char *ttyname(int); + +#if !defined(_STRICT_STDC) && defined(_LONGLONG_TYPE) +extern char *lltostr(long long, char *); +extern char *ulltostr(unsigned long long, char *); +#endif /* !defined(_STRICT_STDC) && defined(_LONGLONG_TYPE) */ + +#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ + +#else /* not __STDC__ */ + +#if defined(__EXTENSIONS__) || !defined(_XOPEN_OR_POSIX) || \ + (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT) +extern int rand_r(); +#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT) ... */ + +extern void _exithandle(); + +#if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || defined(_XPG4) +extern double drand48(); +extern double erand48(); +extern long jrand48(); +extern void lcong48(); +extern long lrand48(); +extern long mrand48(); +extern long nrand48(); +extern unsigned short *seed48(); +extern void srand48(); +extern int putenv(); +extern void setkey(); +#endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) ... */ + +#if (defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE)) && \ + (!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !defined(_XPG4))) +extern void swab(); +#endif + +#if defined(__EXTENSIONS__) || \ + !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) +extern int mkstemp(); +#endif /* defined(__EXTENSIONS__) ... */ + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern int mkstemp64(); +#endif /* _LARGEFILE64_SOURCE... */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) +extern long a64l(); +extern char *ecvt(); +extern char *fcvt(); +extern char *gcvt(); +extern int getsubopt(); +extern int grantpt(); +extern char *initstate(); +extern char *l64a(); +extern char *mktemp(); +extern char *ptsname(); +extern long random(); +extern char *realpath(); +extern char *setstate(); +extern void srandom(); +/* Marked LEGACY in SUSv2 and removed in SUSv3 */ +#if !defined(_XPG6) || defined(__EXTENSIONS__) +extern int ttyslot(); +extern void *valloc(); +#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ +#endif /* defined(__EXTENSIONS__) || ... || defined(_XPG4_2) */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG6) +extern int posix_openpt(); +extern int setenv(); +extern int unsetenv(); +#endif + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +extern void closefrom(); +extern int dup2(); +extern int fdwalk(); +extern char *qecvt(); +extern char *qfcvt(); +extern char *qgcvt(); +extern char *getcwd(); +extern char *getexecname(); +extern char *getlogin(); +extern int getopt(); +extern char *optarg; +extern int optind, opterr, optopt; +extern char *getpass(); +extern char *getpassphrase(); +extern int getpw(); +extern int isatty(); +extern void *memalign(); +extern char *ttyname(); + +#if defined(_LONGLONG_TYPE) +extern char *lltostr(); +extern char *ulltostr(); +#endif /* defined(_LONGLONG_TYPE) */ +#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _STDLIB_H */ diff --git a/usr/src/head/storclass.h b/usr/src/head/storclass.h new file mode 100644 index 0000000000..3cbfb8e48f --- /dev/null +++ b/usr/src/head/storclass.h @@ -0,0 +1,79 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _STORCLASS_H +#define _STORCLASS_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * STORAGE CLASSES + */ + +#define C_EFCN -1 /* physical end of function */ +#define C_NULL 0 +#define C_AUTO 1 /* automatic variable */ +#define C_EXT 2 /* external symbol */ +#define C_STAT 3 /* static */ +#define C_REG 4 /* register variable */ +#define C_EXTDEF 5 /* external definition */ +#define C_LABEL 6 /* label */ +#define C_ULABEL 7 /* undefined label */ +#define C_MOS 8 /* member of structure */ +#define C_ARG 9 /* function argument */ +#define C_STRTAG 10 /* structure tag */ +#define C_MOU 11 /* member of union */ +#define C_UNTAG 12 /* union tag */ +#define C_TPDEF 13 /* type definition */ +#define C_USTATIC 14 /* undefined static */ +#define C_ENTAG 15 /* enumeration tag */ +#define C_MOE 16 /* member of enumeration */ +#define C_REGPARM 17 /* register parameter */ +#define C_FIELD 18 /* bit field */ +#define C_BLOCK 100 /* ".bb" or ".eb" */ +#define C_FCN 101 /* ".bf" or ".ef" */ +#define C_EOS 102 /* end of structure */ +#define C_FILE 103 /* file name */ + +/* + * The following storage class is a "dummy" used only by STS + * for line number entries reformatted as symbol table entries + */ + +#define C_LINE 104 +#define C_ALIAS 105 /* duplicate tag */ +#define C_HIDDEN 106 /* special storage class for external */ + /* symbols in dmert public libraries */ +#define C_SHADOW 107 /* shadow symbol */ + +#ifdef __cplusplus +} +#endif + +#endif /* _STORCLASS_H */ diff --git a/usr/src/head/string.h b/usr/src/head/string.h new file mode 100644 index 0000000000..7111355608 --- /dev/null +++ b/usr/src/head/string.h @@ -0,0 +1,145 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _STRING_H +#define _STRING_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7.1.12 */ + +#include <iso/string_iso.h> + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/string_iso.h>. + */ +#if __cplusplus >= 199711L +using std::size_t; +using std::memchr; +using std::memcmp; +using std::memcpy; +using std::memmove; +using std::memset; +using std::strcat; +using std::strchr; +using std::strcmp; +using std::strcoll; +using std::strcpy; +using std::strcspn; +using std::strerror; +using std::strlen; +using std::strncat; +using std::strncmp; +using std::strncpy; +using std::strpbrk; +using std::strrchr; +using std::strspn; +using std::strstr; +using std::strtok; +using std::strxfrm; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_XPG6) || defined(_REENTRANT) +extern int strerror_r(int, char *, size_t); +#endif + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT) +extern char *strtok_r(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, + char **_RESTRICT_KYWD); +#endif + +#if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ + defined(__XOPEN_OR_POSIX) +extern void *memccpy(void *_RESTRICT_KYWD, const void *_RESTRICT_KYWD, + int, size_t); +#endif + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) +extern char *strsignal(int); +extern int ffs(int); +extern int strcasecmp(const char *, const char *); +extern int strncasecmp(const char *, const char *, size_t); +extern size_t strlcpy(char *, const char *, size_t); +extern size_t strlcat(char *, const char *, size_t); +#endif /* defined(__EXTENSIONS__)... */ + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_XPG4_2) +extern char *strdup(const char *); +#endif + +#else /* __STDC__ */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + defined(_XPG6) || defined(_REENTRANT) +extern int strerror_r(); +#endif + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ + (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT) +extern char *strtok_r(); +#endif + +#if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ + defined(__XOPEN_OR_POSIX) +extern void *memccpy(); +#endif + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) +extern char *strsignal(); +extern int ffs(); +extern int strcasecmp(); +extern int strncasecmp(); +extern size_t strlcpy(); +extern size_t strlcat(); +#endif /* defined(__EXTENSIONS__) ... */ + +#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) +extern char *strdup(); +#endif + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _STRING_H */ diff --git a/usr/src/head/strings.h b/usr/src/head/strings.h new file mode 100644 index 0000000000..d4487dae1f --- /dev/null +++ b/usr/src/head/strings.h @@ -0,0 +1,89 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1995, 1996, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _STRINGS_H +#define _STRINGS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <sys/feature_tests.h> + +#if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) +#include <string.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) + +extern int bcmp(const void *, const void *, size_t); +extern void bcopy(const void *, void *, size_t); +extern void bzero(void *, size_t); + +extern char *index(const char *, int); +extern char *rindex(const char *, int); + +/* + * X/Open System Interfaces and Headers, Issue 4, Version 2, defines + * both <string.h> and <strings.h>. The namespace requirements + * do not permit the visibility of anything other than what is + * specifically defined for each of these headers. As a result, + * inclusion of <string.h> would result in declarations not allowed + * in <strings.h>, and making the following prototypes visible for + * anything other than X/Open UNIX Extension would result in + * conflicts with what is now in <string.h>. + */ +#if defined(_XPG4_2) && !defined(__EXTENSIONS__) +extern int ffs(int); +extern int strcasecmp(const char *, const char *); +extern int strncasecmp(const char *, const char *, size_t); +#endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */ + +#else + +extern int bcmp(); +extern void bcopy(); +extern void bzero(); + +extern char *index(); +extern char *rindex(); + +#if defined(_XPG4_2) && !defined(__EXTENSIONS__) +extern int ffs(); +extern int strcasecmp(); +extern int strncasecmp(); +#endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _STRINGS_H */ diff --git a/usr/src/head/stropts.h b/usr/src/head/stropts.h new file mode 100644 index 0000000000..f0ceea2a71 --- /dev/null +++ b/usr/src/head/stropts.h @@ -0,0 +1,74 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _STROPTS_H +#define _STROPTS_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */ + +/* + * Streams user options definitions. + */ + +#include <sys/feature_tests.h> +#include <sys/stropts.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) + +extern int isastream(int); + +extern int getmsg(int, struct strbuf *_RESTRICT_KYWD, + struct strbuf *_RESTRICT_KYWD, int *_RESTRICT_KYWD); +extern int putmsg(int, const struct strbuf *, const struct strbuf *, int); + +extern int getpmsg(int, struct strbuf *_RESTRICT_KYWD, + struct strbuf *_RESTRICT_KYWD, int *_RESTRICT_KYWD, + int *_RESTRICT_KYWD); +extern int putpmsg(int, const struct strbuf *, const struct strbuf *, int, int); + +/* + * These three routines are duplicated in unistd.h; duplication necessitated + * by XPG4.2 compliance/namespace issues. + */ +extern int ioctl(int, int, ...); +extern int fattach(int, const char *); +extern int fdetach(const char *); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _STROPTS_H */ diff --git a/usr/src/head/syms.h b/usr/src/head/syms.h new file mode 100644 index 0000000000..d18dda2ff4 --- /dev/null +++ b/usr/src/head/syms.h @@ -0,0 +1,230 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _SYMS_H +#define _SYMS_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2.8 */ + +/* Storage Classes are defined in storclass.h */ +#include <storclass.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Number of characters in a symbol name */ +#define SYMNMLEN 8 +/* Number of characters in a file name */ +#define FILNMLEN 14 +/* Number of array dimensions in auxiliary entry */ +#define DIMNUM 4 + +struct syment +{ + union + { + char _n_name[SYMNMLEN]; /* old COFF version */ + struct + { + long _n_zeroes; /* new == 0 */ + long _n_offset; /* offset into string table */ + } _n_n; + char *_n_nptr[2]; /* allows for overlaying */ + } _n; + unsigned long n_value; /* value of symbol */ + short n_scnum; /* section number */ + unsigned short n_type; /* type and derived type */ + char n_sclass; /* storage class */ + char n_numaux; /* number of aux. entries */ +}; + +#define n_name _n._n_name +#define n_nptr _n._n_nptr[1] +#define n_zeroes _n._n_n._n_zeroes +#define n_offset _n._n_n._n_offset + +/* + * Relocatable symbols have a section number of the + * section in which they are defined. Otherwise, section + * numbers have the following meanings: + */ + /* undefined symbol */ +#define N_UNDEF 0 + /* value of symbol is absolute */ +#define N_ABS -1 + /* special debugging symbol -- value of symbol is meaningless */ +#define N_DEBUG -2 + /* indicates symbol needs transfer vector (preload) */ +#define N_TV (unsigned short)-3 + + /* indicates symbol needs transfer vector (postload) */ + +#define P_TV (unsigned short)-4 + +/* + * The fundamental type of a symbol packed into the low + * 4 bits of the word. + */ + +#define _EF ".ef" + +#define T_NULL 0 +#define T_ARG 1 /* function argument (only used by compiler) */ +#define T_CHAR 2 /* character */ +#define T_SHORT 3 /* short integer */ +#define T_INT 4 /* integer */ +#define T_LONG 5 /* long integer */ +#define T_FLOAT 6 /* floating point */ +#define T_DOUBLE 7 /* double word */ +#define T_STRUCT 8 /* structure */ +#define T_UNION 9 /* union */ +#define T_ENUM 10 /* enumeration */ +#define T_MOE 11 /* member of enumeration */ +#define T_UCHAR 12 /* unsigned character */ +#define T_USHORT 13 /* unsigned short */ +#define T_UINT 14 /* unsigned integer */ +#define T_ULONG 15 /* unsigned long */ + +/* + * derived types are: + */ + +#define DT_NON 0 /* no derived type */ +#define DT_PTR 1 /* pointer */ +#define DT_FCN 2 /* function */ +#define DT_ARY 3 /* array */ + +/* + * type packing constants + */ + +#define N_BTMASK 017 +#define N_TMASK 060 +#define N_TMASK1 0300 +#define N_TMASK2 0360 +#define N_BTSHFT 4 +#define N_TSHIFT 2 + +/* + * MACROS + */ + + /* Basic Type of x */ + +#define BTYPE(x) ((x) & N_BTMASK) + + /* Is x a pointer ? */ + +#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) + + /* Is x a function ? */ + +#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) + + /* Is x an array ? */ + +#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) + + /* Is x a structure, union, or enumeration TAG? */ + +#define ISTAG(x) ((x) == C_STRTAG || (x) == C_UNTAG || (x) == C_ENTAG) + +#define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(DT_PTR<<N_BTSHFT)|(x&N_BTMASK)) + +#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) + +/* + * AUXILIARY ENTRY FORMAT + */ + +union auxent +{ + struct + { + long x_tagndx; /* str, un, or enum tag indx */ + union + { + struct + { + unsigned short x_lnno; /* declaration line */ + /* number */ + unsigned short x_size; /* str, union, array */ + /* size */ + } x_lnsz; + long x_fsize; /* size of function */ + } x_misc; + union + { + struct /* if ISFCN, tag, or .bb */ + { + long x_lnnoptr; /* ptr to fcn line # */ + long x_endndx; /* entry ndx past */ + /* block end */ + } x_fcn; + struct /* if ISARY, up to 4 dimen. */ + { + unsigned short x_dimen[DIMNUM]; + } x_ary; + } x_fcnary; + unsigned short x_tvndx; /* tv index */ + } x_sym; + struct + { + char x_fname[FILNMLEN]; + } x_file; + struct + { + long x_scnlen; /* section length */ + unsigned short x_nreloc; /* number of reloc entries */ + unsigned short x_nlinno; /* number of line numbers */ + } x_scn; + + struct + { + long x_tvfill; /* tv fill value */ + unsigned short x_tvlen; /* length of .tv */ + unsigned short x_tvran[2]; /* tv range */ + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ +}; + +#define SYMENT struct syment +#define SYMESZ 18 /* sizeof(SYMENT) */ + +#define AUXENT union auxent +#define AUXESZ 18 /* sizeof(AUXENT) */ + +/* Defines for "special" symbols */ + +#define _ETEXT "etext" +#define _EDATA "edata" +#define _END "end" +#define _START "_start" + +#ifdef __cplusplus +} +#endif + +#endif /* _SYMS_H */ diff --git a/usr/src/head/synch.h b/usr/src/head/synch.h new file mode 100644 index 0000000000..8d825d55a8 --- /dev/null +++ b/usr/src/head/synch.h @@ -0,0 +1,264 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYNCH_H +#define _SYNCH_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * synch.h: + * definitions needed to use the thread synchronization interface + */ + +#ifndef _ASM +#include <sys/machlock.h> +#include <sys/time_impl.h> +#include <sys/synch.h> +#endif /* _ASM */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASM + +/* + * Semaphores + */ +typedef struct _sema { + /* this structure must be the same as sem_t in <semaphore.h> */ + uint32_t count; /* semaphore count */ + uint16_t type; + uint16_t magic; + upad64_t pad1[3]; /* reserved for a mutex_t */ + upad64_t pad2[2]; /* reserved for a cond_t */ +} sema_t; + +/* + * POSIX.1c Note: + * POSIX.1c requires that <pthread.h> define the structures pthread_mutex_t + * and pthread_cond_t. These structures are identical to mutex_t (lwp_mutex_t) + * and cond_t (lwp_cond_t) which are defined in <synch.h>. A nested included + * of <synch.h> (to allow a "#typedef mutex_t pthread_mutex_t") would pull in + * non-posix symbols/constants violating the namespace restrictions. Hence, + * pthread_mutex_t/pthread_cond_t have been redefined in <pthread.h> (actually + * in <sys/types.h>). Any modifications done to mutex_t/lwp_mutex_t or + * cond_t/lwp_cond_t should also be done to pthread_mutex_t/pthread_cond_t. + */ +typedef lwp_mutex_t mutex_t; +typedef lwp_cond_t cond_t; + +/* + * Readers/writer locks + * + * NOTE: The layout of this structure should be kept in sync with the layout + * of the correponding structure of pthread_rwlock_t in sys/types.h. + * Also, there is an identical structure for lwp_rwlock_t in <sys/synch.h>. + * Because we have to deal with C++, we cannot redefine this one as that one. + */ +typedef struct _rwlock { + int32_t readers; /* -1 == writer else # of readers */ + uint16_t type; + uint16_t magic; + mutex_t mutex; /* used to indicate ownership */ + cond_t readercv; /* unused */ + cond_t writercv; /* unused */ +} rwlock_t; + +#ifdef __STDC__ +int _lwp_mutex_lock(lwp_mutex_t *); +int _lwp_mutex_unlock(lwp_mutex_t *); +int _lwp_mutex_trylock(lwp_mutex_t *); +int _lwp_cond_wait(lwp_cond_t *, lwp_mutex_t *); +int _lwp_cond_timedwait(lwp_cond_t *, lwp_mutex_t *, timespec_t *); +int _lwp_cond_reltimedwait(lwp_cond_t *, lwp_mutex_t *, timespec_t *); +int _lwp_cond_signal(lwp_cond_t *); +int _lwp_cond_broadcast(lwp_cond_t *); +int _lwp_sema_init(lwp_sema_t *, int); +int _lwp_sema_wait(lwp_sema_t *); +int _lwp_sema_trywait(lwp_sema_t *); +int _lwp_sema_post(lwp_sema_t *); +int cond_init(cond_t *, int, void *); +int cond_destroy(cond_t *); +int cond_wait(cond_t *, mutex_t *); +int cond_timedwait(cond_t *, mutex_t *, const timespec_t *); +int cond_reltimedwait(cond_t *, mutex_t *, const timespec_t *); +int cond_signal(cond_t *); +int cond_broadcast(cond_t *); +int mutex_init(mutex_t *, int, void *); +int mutex_destroy(mutex_t *); +int mutex_lock(mutex_t *); +int mutex_trylock(mutex_t *); +int mutex_unlock(mutex_t *); +int rwlock_init(rwlock_t *, int, void *); +int rwlock_destroy(rwlock_t *); +int rw_rdlock(rwlock_t *); +int rw_wrlock(rwlock_t *); +int rw_unlock(rwlock_t *); +int rw_tryrdlock(rwlock_t *); +int rw_trywrlock(rwlock_t *); +int sema_init(sema_t *, unsigned int, int, void *); +int sema_destroy(sema_t *); +int sema_wait(sema_t *); +int sema_timedwait(sema_t *, const timespec_t *); +int sema_reltimedwait(sema_t *, const timespec_t *); +int sema_post(sema_t *); +int sema_trywait(sema_t *); + +#else /* __STDC__ */ + +int _lwp_mutex_lock(); +int _lwp_mutex_unlock(); +int _lwp_mutex_trylock(); +int _lwp_cond_wait(); +int _lwp_cond_timedwait(); +int _lwp_cond_reltimedwait(); +int _lwp_cond_signal(); +int _lwp_cond_broadcast(); +int _lwp_sema_init(); +int _lwp_sema_wait(); +int _lwp_sema_trywait(); +int _lwp_sema_post(); +int cond_init(); +int cond_destroy(); +int cond_wait(); +int cond_timedwait(); +int cond_reltimedwait(); +int cond_signal(); +int cond_broadcast(); +int mutex_init(); +int mutex_destroy(); +int mutex_lock(); +int mutex_trylock(); +int mutex_unlock(); +int rwlock_init(); +int rwlock_destroy(); +int rw_rdlock(); +int rw_wrlock(); +int rw_unlock(); +int rw_tryrdlock(); +int rw_trywrlock(); +int sema_init(); +int sema_destroy(); +int sema_wait(); +int sema_timedwait(); +int sema_reltimedwait(); +int sema_post(); +int sema_trywait(); + +#endif /* __STDC__ */ + +#endif /* _ASM */ + +/* "Magic numbers" tagging synchronization object types */ +#define MUTEX_MAGIC _MUTEX_MAGIC +#define SEMA_MAGIC _SEMA_MAGIC +#define COND_MAGIC _COND_MAGIC +#define RWL_MAGIC _RWL_MAGIC + +/* + * POSIX.1c Note: + * DEFAULTMUTEX is defined same as PTHREAD_MUTEX_INITIALIZER in <pthread.h>. + * DEFAULTCV is defined same as PTHREAD_COND_INITIALIZER in <pthread.h>. + * DEFAULTRWLOCK is defined same as PTHREAD_RWLOCK_INITIALIZER in <pthread.h>. + * Any changes to these macros should be reflected in <pthread.h> + */ +#define DEFAULTMUTEX \ + {{0, 0, 0, {USYNC_THREAD}, MUTEX_MAGIC}, \ + {{{0, 0, 0, 0, 0, 0, 0, 0}}}, 0} +#define SHAREDMUTEX \ + {{0, 0, 0, {USYNC_PROCESS}, MUTEX_MAGIC}, \ + {{{0, 0, 0, 0, 0, 0, 0, 0}}}, 0} +#define RECURSIVEMUTEX \ + {{0, 0, 0, {USYNC_THREAD|LOCK_RECURSIVE}, MUTEX_MAGIC}, \ + {{{0, 0, 0, 0, 0, 0, 0, 0}}}, 0} +#define ERRORCHECKMUTEX \ + {{0, 0, 0, {USYNC_THREAD|LOCK_ERRORCHECK}, MUTEX_MAGIC}, \ + {{{0, 0, 0, 0, 0, 0, 0, 0}}}, 0} +#define RECURSIVE_ERRORCHECKMUTEX \ + {{0, 0, 0, {USYNC_THREAD|LOCK_RECURSIVE|LOCK_ERRORCHECK}, \ + MUTEX_MAGIC}, {{{0, 0, 0, 0, 0, 0, 0, 0}}}, 0} +#define DEFAULTCV \ + {{{0, 0, 0, 0}, USYNC_THREAD, COND_MAGIC}, 0} +#define SHAREDCV \ + {{{0, 0, 0, 0}, USYNC_PROCESS, COND_MAGIC}, 0} +#define DEFAULTSEMA \ + {0, USYNC_THREAD, SEMA_MAGIC, {0, 0, 0}, {0, 0}} +#define SHAREDSEMA \ + {0, USYNC_PROCESS, SEMA_MAGIC, {0, 0, 0}, {0, 0}} +#define DEFAULTRWLOCK \ + {0, USYNC_THREAD, RWL_MAGIC, DEFAULTMUTEX, DEFAULTCV, DEFAULTCV} +#define SHAREDRWLOCK \ + {0, USYNC_PROCESS, RWL_MAGIC, SHAREDMUTEX, SHAREDCV, SHAREDCV} + +/* + * Tests on lock states. + */ +#define SEMA_HELD(x) _sema_held(x) +#define RW_READ_HELD(x) _rw_read_held(x) +#define RW_WRITE_HELD(x) _rw_write_held(x) +#define RW_LOCK_HELD(x) (RW_READ_HELD(x) || RW_WRITE_HELD(x)) +#define MUTEX_HELD(x) _mutex_held(x) + +/* + * The following definitions are for assertions which can be checked + * statically by tools like lock_lint. You can also define your own + * run-time test for each. If you don't, we define them to 1 so that + * such assertions simply pass. + */ +#ifndef NO_LOCKS_HELD +#define NO_LOCKS_HELD 1 +#endif +#ifndef NO_COMPETING_THREADS +#define NO_COMPETING_THREADS 1 +#endif + +#ifndef _ASM + +#ifdef __STDC__ + +int _sema_held(sema_t *); +int _rw_read_held(rwlock_t *); +int _rw_write_held(rwlock_t *); +int _mutex_held(mutex_t *); + +#else /* __STDC__ */ + +int _sema_held(); +int _rw_read_held(); +int _rw_write_held(); +int _mutex_held(); + +#endif /* __STDC__ */ + +#endif /* _ASM */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYNCH_H */ diff --git a/usr/src/head/sysexits.h b/usr/src/head/sysexits.h new file mode 100644 index 0000000000..51876bbc9a --- /dev/null +++ b/usr/src/head/sysexits.h @@ -0,0 +1,130 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1989 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _SYSEXITS_H +#define _SYSEXITS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * SYSEXITS.H -- Exit status codes employed by the mail subsystem. + * + * This include file attempts to categorize possible error + * exit statuses for mail subsystem. + * + * Error numbers begin at EX__BASE to reduce the possibility of + * clashing with other exit statuses that random programs may + * already return. The meaning of the codes is approximately + * as follows: + * + * EX_USAGE -- The command was used incorrectly, e.g., with + * the wrong number of arguments, a bad flag, a bad + * syntax in a parameter, or whatever. + * EX_DATAERR -- The input data was incorrect in some way. + * This should only be used for user's data & not + * system files. + * EX_NOINPUT -- An input file (not a system file) did not + * exist or was not readable. This could also include + * errors like "No message" to a mailer (if it cared + * to catch it). + * EX_NOUSER -- The user specified did not exist. This might + * be used for mail addresses or remote logins. + * EX_NOHOST -- The host specified did not exist. This is used + * in mail addresses or network requests. + * EX_UNAVAILABLE -- A service is unavailable. This can occur + * if a support program or file does not exist. This + * can also be used as a catchall message when something + * you wanted to do doesn't work, but you don't know + * why. + * EX_SOFTWARE -- An internal software error has been detected. + * This should be limited to non-operating system related + * errors as possible. + * EX_OSERR -- An operating system error has been detected. + * This is intended to be used for such things as "cannot + * fork", "cannot create pipe", or the like. It includes + * things like getuid returning a user that does not + * exist in the passwd file. + * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp, + * etc.) does not exist, cannot be opened, or has some + * sort of error (e.g., syntax error). + * EX_CANTCREAT -- A (user specified) output file cannot be + * created. + * EX_IOERR -- An error occurred while doing I/O on some file. + * EX_TEMPFAIL -- temporary failure, indicating something that + * is not really an error. In sendmail, this means + * that a mailer (e.g.) could not create a connection, + * and the request should be reattempted later. + * EX_PROTOCOL -- the remote system returned something that + * was "not possible" during a protocol exchange. + * EX_NOPERM -- You did not have sufficient permission to + * perform the operation. This is not intended for + * file system problems, which should use NOINPUT or + * CANTCREAT, but rather for higher level permissions. + * For example, kre uses this to restrict who students + * can send mail to. + */ + +#define EX_OK 0 /* successful termination */ + +#define EX__BASE 64 /* base value for error messages */ + +#define EX_USAGE 64 /* command line usage error */ +#define EX_DATAERR 65 /* data format error */ +#define EX_NOINPUT 66 /* cannot open input */ +#define EX_NOUSER 67 /* addressee unknown */ +#define EX_NOHOST 68 /* host name unknown */ +#define EX_UNAVAILABLE 69 /* service unavailable */ +#define EX_SOFTWARE 70 /* internal software error */ +#define EX_OSERR 71 /* system error (e.g., can't fork) */ +#define EX_OSFILE 72 /* critical OS file missing */ +#define EX_CANTCREAT 73 /* can't create (user) output file */ +#define EX_IOERR 74 /* input/output error */ +#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ +#define EX_PROTOCOL 76 /* remote error in protocol */ +#define EX_NOPERM 77 /* permission denied */ +#define EX_CONFIG 78 /* configuration error */ + +#define EX_NOTFOUND 79 /* entry not found */ +#define EX__MAX 79 /* maximum listed value */ + + +#ifdef __cplusplus +} +#endif + +#endif /* _SYSEXITS_H */ diff --git a/usr/src/head/syslog.h b/usr/src/head/syslog.h new file mode 100644 index 0000000000..52ddee0695 --- /dev/null +++ b/usr/src/head/syslog.h @@ -0,0 +1,65 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _SYSLOG_H +#define _SYSLOG_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +#include <sys/feature_tests.h> +#include <sys/syslog.h> +#include <sys/va_list.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __STDC__ + +void openlog(const char *, int, int); +void syslog(int, const char *, ...); +void closelog(void); +int setlogmask(int); +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +void vsyslog(int, const char *, __va_list); +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#else /* __STDC__ */ + +void openlog(); +void syslog(); +void closelog(); +int setlogmask(); +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +void vsyslog(); +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYSLOG_H */ diff --git a/usr/src/head/tar.h b/usr/src/head/tar.h new file mode 100644 index 0000000000..d3dcd35ab6 --- /dev/null +++ b/usr/src/head/tar.h @@ -0,0 +1,75 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _TAR_H +#define _TAR_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define TMAGIC "ustar" +#define TMAGLEN 6 +#define TVERSION "00" +#define TVERSLEN 2 + +/* + * Typeflag field definitions. + */ + +#define REGTYPE '0' +#define AREGTYPE '\0' +#define LNKTYPE '1' +#define SYMTYPE '2' +#define CHRTYPE '3' +#define BLKTYPE '4' +#define DIRTYPE '5' +#define FIFOTYPE '6' +#define CONTTYPE '7' + +/* + * Mode fild bit definitions. + */ + +#define TSUID 04000 +#define TSGID 02000 +#define TSVTX 01000 +#define TUREAD 00400 +#define TUWRITE 00200 +#define TUEXEC 00100 +#define TGREAD 00040 +#define TGWRITE 00020 +#define TGEXEC 00010 +#define TOREAD 00004 +#define TOWRITE 00002 +#define TOEXEC 00001 + +#ifdef __cplusplus +} +#endif + +#endif /* _TAR_H */ diff --git a/usr/src/head/termio.h b/usr/src/head/termio.h new file mode 100644 index 0000000000..81d1ab0204 --- /dev/null +++ b/usr/src/head/termio.h @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _TERMIO_H +#define _TERMIO_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3.1.4 */ + +#include <sys/termio.h> + +#endif /* _TERMIO_H */ diff --git a/usr/src/head/termios.h b/usr/src/head/termios.h new file mode 100644 index 0000000000..dfa6ca05eb --- /dev/null +++ b/usr/src/head/termios.h @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _TERMIOS_H +#define _TERMIOS_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ + +#include <sys/termios.h> + +#endif /* _TERMIOS_H */ diff --git a/usr/src/head/thread.h b/usr/src/head/thread.h new file mode 100644 index 0000000000..be8e272e21 --- /dev/null +++ b/usr/src/head/thread.h @@ -0,0 +1,147 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _THREAD_H +#define _THREAD_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * thread.h: + * definitions needed to use the thread interface except synchronization. + * use <synch.h> for thread synchronization. + */ + +#ifndef _ASM +#include <sys/signal.h> +#include <sys/time.h> +#include <synch.h> +#endif /* _ASM */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASM +typedef unsigned int thread_t; +typedef unsigned int thread_key_t; +#endif /* _ASM */ + +#ifndef _ASM +#ifdef __STDC__ + +extern int thr_create(void *, size_t, void *(*)(void *), void *, long, + thread_t *); +extern int thr_join(thread_t, thread_t *, void **); +extern int thr_setconcurrency(int); +extern int thr_getconcurrency(void); +extern void thr_exit(void *) __NORETURN; +extern thread_t thr_self(void); + +/* + * the definition of thr_sigsetmask() is not strict ansi-c since sigset_t is + * not in the strict ansi-c name space. Hence, include the prototype for + * thr_sigsetmask() only if strict ansi-c conformance is not turned on. + */ +#if !defined(_STRICT_STDC) || defined(__EXTENSIONS__) +extern int thr_sigsetmask(int, const sigset_t *, sigset_t *); +#endif + +/* + * the definition of thr_stksegment() is not strict ansi-c since stack_t is + * not in the strict ansi-c name space. Hence, include the prototype for + * thr_stksegment() only if strict ansi-c conformance is not turned on. + */ +#if !defined(_STRICT_STDC) || defined(__EXTENSIONS__) +extern int thr_stksegment(stack_t *); +#endif + +extern int thr_main(void); +extern int thr_kill(thread_t, int); +extern int thr_suspend(thread_t); +extern int thr_continue(thread_t); +extern void thr_yield(void); +extern int thr_setprio(thread_t, int); +extern int thr_getprio(thread_t, int *); +extern int thr_keycreate(thread_key_t *, void(*)(void *)); +extern int thr_setspecific(thread_key_t, void *); +extern int thr_getspecific(thread_key_t, void **); +extern size_t thr_min_stack(void); + +#else /* __STDC */ + +extern int thr_create(); +extern int thr_join(); +extern int thr_setconcurrency(); +extern int thr_getconcurrency(); +extern void thr_exit(); +extern thread_t thr_self(); +extern int thr_sigsetmask(); +extern int thr_stksegment(); +extern int thr_main(); +extern int thr_kill(); +extern int thr_suspend(); +extern int thr_continue(); +extern void thr_yield(); +extern int thr_setprio(); +extern int thr_getprio(); +extern int thr_keycreate(); +extern int thr_setspecific(); +extern int thr_getspecific(); +extern size_t thr_min_stack(); + +#endif /* __STDC */ +#endif /* _ASM */ + +#define THR_MIN_STACK thr_min_stack() +/* + * thread flags (one word bit mask) + */ +/* + * POSIX.1c Note: + * THR_BOUND is defined same as PTHREAD_SCOPE_SYSTEM in <pthread.h> + * THR_DETACHED is defined same as PTHREAD_CREATE_DETACHED in <pthread.h> + * Any changes in these definitions should be reflected in <pthread.h> + */ +#define THR_BOUND 0x00000001 /* = PTHREAD_SCOPE_SYSTEM */ +#define THR_NEW_LWP 0x00000002 +#define THR_DETACHED 0x00000040 /* = PTHREAD_CREATE_DETACHED */ +#define THR_SUSPENDED 0x00000080 +#define THR_DAEMON 0x00000100 + +/* + * The available register states returned by thr_getstate(). + */ +#define TRS_VALID 0 +#define TRS_NONVOLATILE 1 +#define TRS_LWPID 2 +#define TRS_INVALID 3 + +#ifdef __cplusplus +} +#endif + +#endif /* _THREAD_H */ diff --git a/usr/src/head/thread_db.h b/usr/src/head/thread_db.h new file mode 100644 index 0000000000..3259593dc9 --- /dev/null +++ b/usr/src/head/thread_db.h @@ -0,0 +1,692 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _THREAD_DB_H +#define _THREAD_DB_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * + * Description: + * Types, global variables, and function definitions for users + * of libc_db (formerly libthread_db). + * + */ + + +#include <sys/lwp.h> +#include <sys/procfs_isa.h> +#include <thread.h> +#include <proc_service.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define TD_THR_ANY_USER_FLAGS 0xffffffff +#define TD_THR_LOWEST_PRIORITY 0 +#define TD_SIGNO_MASK 0 +#define TD_EVENTSIZE 2 + +/* + * Opaque handle types. + */ + +/* Client's handle for a process */ +struct ps_prochandle; + +/* libthread's handle for a process */ +typedef struct td_thragent td_thragent_t; + +/* The thread handle. */ +typedef struct td_thrhandle { + td_thragent_t *th_ta_p; + psaddr_t th_unique; +} td_thrhandle_t; + +/* The handle for a synchronization object. */ +typedef struct td_synchandle { + td_thragent_t *sh_ta_p; + psaddr_t sh_unique; +} td_synchandle_t; + +/* ------------------------------------------------------------------ */ + +/* + * The libc_db event facility. + */ +#define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */ +#define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */ +#define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */ + +/* Bitmask of enabled events. */ +typedef struct td_thr_events { + uint_t event_bits[TD_EVENTSIZE]; +} td_thr_events_t; + +/* Event set manipulation macros. */ +#define __td_eventmask(n) ((unsigned int)1 << (((n) - 1) \ + & (BT_NBIPUI - 1))) +#define __td_eventword(n) (((unsigned int)((n) - 1))>>5) + +#define td_event_emptyset(setp) \ + { \ + int _i_; \ + _i_ = TD_EVENTSIZE; \ + while (_i_) (setp)->event_bits[--_i_] = 0; \ + } + +#define td_event_fillset(setp) \ + { \ + int _i_; \ + _i_ = TD_EVENTSIZE; \ + while (_i_) (setp)->event_bits[--_i_] = \ + 0xffffffff; \ + } + +#define td_event_addset(setp, n) \ + (((setp)->event_bits[__td_eventword(n)]) |= __td_eventmask(n)) +#define td_event_delset(setp, n) \ + (((setp)->event_bits[__td_eventword(n)]) &= ~__td_eventmask(n)) +#define td_eventismember(setp, n) \ + (__td_eventmask(n) & ((setp)->event_bits[__td_eventword(n)])) +#define td_eventisempty(setp) \ + (!((setp)->event_bits[0]) && !((setp)->event_bits[1])) + +typedef enum { + TD_ALL_EVENTS, /* pseudo-event number */ + TD_EVENT_NONE = TD_ALL_EVENTS, /* depends on context */ + TD_READY, + TD_SLEEP, + TD_SWITCHTO, + TD_SWITCHFROM, + TD_LOCK_TRY, + TD_CATCHSIG, + TD_IDLE, + TD_CREATE, + TD_DEATH, + TD_PREEMPT, + TD_PRI_INHERIT, + TD_REAP, + TD_CONCURRENCY, + TD_TIMEOUT, + TD_MIN_EVENT_NUM = TD_READY, + TD_MAX_EVENT_NUM = TD_TIMEOUT, + TD_EVENTS_ENABLE = 31 /* Event reporting enabled */ +} td_event_e; + +/* + * Ways that an event type can be reported. + */ +typedef enum { + NOTIFY_BPT, + /* + * bpt to be inserted at u.bptaddr by + * debugger + */ + NOTIFY_AUTOBPT, /* bpt inserted at u.bptaddr by application */ + NOTIFY_SYSCALL /* syscall u.syscallno will be invoked */ +} td_notify_e; + +/* + * How an event type is reported. + */ +typedef struct td_notify { + td_notify_e type; + union { + psaddr_t bptaddr; + int syscallno; + } u; +} td_notify_t; + +/* + * An event message. + */ +typedef struct td_event_msg { + td_event_e event; /* Event type being reported */ + const td_thrhandle_t *th_p; /* Thread reporting the event */ + union { /* Type-dependent event data */ + td_synchandle_t *sh; /* historical rubbish; ignore */ + uintptr_t data; /* valid, depending on event type */ + } msg; +} td_event_msg_t; + +/* --------------------------------------------------------------------- */ + +/* + * Thread information structure as returned by td_thr_get_info(), and + * related types. + */ + +/* + * Possible thread states. TD_THR_ANY_STATE is a pseudo-state used + * to select threads regardless of state in td_ta_thr_iter(). + */ +typedef enum { + TD_THR_ANY_STATE, + TD_THR_UNKNOWN, + TD_THR_STOPPED, + TD_THR_RUN, + TD_THR_ACTIVE, + TD_THR_ZOMBIE, + TD_THR_SLEEP, + TD_THR_STOPPED_ASLEEP +} td_thr_state_e; + +/* + * Thread type: user or system. + * As of Solaris 9, all threads are type TD_THR_USER. + */ +typedef enum { + TD_THR_ANY_TYPE, /* not used */ + TD_THR_USER, + TD_THR_SYSTEM +} td_thr_type_e; + +typedef struct td_thrinfo { + td_thragent_t *ti_ta_p; /* process handle */ + unsigned ti_user_flags; /* flags passed to thr_create() */ + thread_t ti_tid; /* tid returned by thr_create() */ + void *ti_exitval; /* thread exit value (TD_THR_ZOMBIE) */ + psaddr_t ti_startfunc; /* startfunc passed to thr_create() */ + psaddr_t ti_stkbase; /* base of thread's stack */ + long ti_stksize; /* size of thread's stack */ + psaddr_t ti_ro_area; /* address of uthread_t struct */ + int ti_ro_size; /* size of uthread_t struct */ + td_thr_state_e ti_state; /* thread state */ + uchar_t ti_db_suspended; /* boolean: suspended by debugger? */ + td_thr_type_e ti_type; /* thread type */ + intptr_t ti_pc; /* resume PC when sleeping */ + intptr_t ti_sp; /* resume SP when sleeping */ + short ti_flags; /* flags used by libthread */ + int ti_pri; /* thread priority */ + lwpid_t ti_lid; /* last LWP assigned to this thread */ + sigset_t ti_sigmask; /* signal mask */ + uchar_t ti_traceme; /* event reporting enabled? */ + uchar_t ti_preemptflag; /* was thread preemppted? */ + uchar_t ti_pirecflag; /* priority inheritance happened */ + sigset_t ti_pending; /* set of pending signals */ + td_thr_events_t ti_events; /* set of enabled events */ +} td_thrinfo_t; + +#define ti_tls ti_exitval /* for source compatibility */ + +typedef struct td_ta_stats { + int nthreads; /* total number of threads in use */ + int r_concurrency; /* requested concurrency level */ + int nrunnable_num; /* numerator, avg. runnable threads */ + int nrunnable_den; /* denominator, avg. runnable threads */ + int a_concurrency_num; /* numerator, achieved concurrency level */ + int a_concurrency_den; /* denominator, concurrency level */ + int nlwps_num; /* numerator, average number of LWP's in use */ + int nlwps_den; /* denom., average number of LWP's in use */ + int nidle_num; /* numerator, avg. number of idling LWP's */ + int nidle_den; /* denom., avg. number of idling LWP's */ +} td_ta_stats_t; + +/* + * Iterator callback function declarations. + */ + +/* Callback function for td_ta_tsd_iter(). */ +typedef int td_key_iter_f(thread_key_t, void (*destructor)(), void *); + +/* Callback function for td_ta_thr_iter(). */ +typedef int td_thr_iter_f(const td_thrhandle_t *, void *); + +/* Callback function for td_ta_sync_iter(). */ +typedef int td_sync_iter_f(const td_synchandle_t *, void *); + +/* -------------------------------------------------------------------- */ + +/* + * Synchronization Objects + */ + +/* Enumeration of synchronization object types. */ +typedef enum td_sync_type_e { + TD_SYNC_UNKNOWN, /* Sync. variable of unknown type */ + TD_SYNC_COND, /* Condition variable */ + TD_SYNC_MUTEX, /* Mutex lock */ + TD_SYNC_SEMA, /* Semaphore */ + TD_SYNC_RWLOCK /* Reader/Writer lock */ +} td_sync_type_e; + +#define TD_SV_MAX_FLAGS 4 +typedef uint8_t td_sync_flags_t; + +/* + * Synchronization object information structure filled in by td_sync_get_info() + */ +typedef struct td_syncinfo { + td_thragent_t *si_ta_p; /* process handle */ + psaddr_t si_sv_addr; /* address of sync. object */ + td_sync_type_e si_type; /* object type */ + uint32_t si_shared_type; /* process-shared or process-private */ + td_sync_flags_t si_flags[TD_SV_MAX_FLAGS]; /* flags (?) */ + pid_t si_ownerpid; /* owner's process-id (USYNC_PROCESS) */ + union _si_un_state { + int sem_count; /* semaphore count */ + int nreaders; /* number of readers, -1 if writer */ + int mutex_locked; /* non-zero iff locked */ + } si_state; + int si_size; /* size in bytes of synch variable */ + uint8_t si_has_waiters; /* non-zero iff at least one waiter */ + uint8_t si_is_wlock; /* non-zero iff rwlock write-locked */ + uint8_t si_rcount; /* count for locked recursive mutex */ + uint8_t si_prioceiling; /* ceiling pri (PTHREAD_PRIO_PROTECT) */ + td_thrhandle_t si_owner; /* mutex holder or write-lock holder */ + psaddr_t si_data; /* optional data */ +} td_syncinfo_t; + +/* + * Statistics structures for the various synchronization objects, contained + * within the td_syncstats structure returned by td_sync_get_stats(). + */ +typedef struct { + uint_t mutex_lock; + uint_t mutex_sleep; + hrtime_t mutex_sleep_time; + hrtime_t mutex_hold_time; + uint_t mutex_try; + uint_t mutex_try_fail; + uint_t mutex_internal; /* internal to libthread */ +} td_mutex_stats_t; + +typedef struct { + uint_t cond_wait; + uint_t cond_timedwait; + hrtime_t cond_wait_sleep_time; + hrtime_t cond_timedwait_sleep_time; + uint_t cond_timedwait_timeout; + uint_t cond_signal; + uint_t cond_broadcast; + uint_t cond_internal; /* internal to libthread */ +} td_cond_stats_t; + +typedef struct { + uint_t rw_rdlock; + uint_t rw_rdlock_sleep; + hrtime_t rw_rdlock_sleep_time; + uint_t rw_rdlock_try; + uint_t rw_rdlock_try_fail; + uint_t rw_wrlock; + uint_t rw_wrlock_sleep; + hrtime_t rw_wrlock_sleep_time; + hrtime_t rw_wrlock_hold_time; + uint_t rw_wrlock_try; + uint_t rw_wrlock_try_fail; +} td_rwlock_stats_t; + +typedef struct { + uint_t sema_wait; + uint_t sema_wait_sleep; + hrtime_t sema_wait_sleep_time; + uint_t sema_trywait; + uint_t sema_trywait_fail; + uint_t sema_post; + uint_t sema_max_count; + uint_t sema_min_count; +} td_sema_stats_t; + +/* + * Synchronization object statistics structure filled in by td_sync_get_stats() + */ +typedef struct td_syncstats { + td_syncinfo_t ss_info; /* as returned by td_sync_get_info() */ + union { + td_mutex_stats_t mutex; + td_cond_stats_t cond; + td_rwlock_stats_t rwlock; + td_sema_stats_t sema; + uint_t pad[32]; /* for future growth */ + } ss_un; +} td_syncstats_t; + +/* The set of error codes. */ +typedef enum { + TD_OK, /* generic "call succeeded" */ + TD_ERR, /* generic error. */ + TD_NOTHR, /* no thread can be found to satisfy query */ + TD_NOSV, /* no synch. handle can be found to satisfy query */ + TD_NOLWP, /* no lwp can be found to satisfy query */ + TD_BADPH, /* invalid process handle */ + TD_BADTH, /* invalid thread handle */ + TD_BADSH, /* invalid synchronization handle */ + TD_BADTA, /* invalid thread agent */ + TD_BADKEY, /* invalid key */ + TD_NOMSG, /* no event message for td_thr_event_getmsg() */ + TD_NOFPREGS, /* FPU register set not available */ + TD_NOLIBTHREAD, /* application not linked with libthread */ + TD_NOEVENT, /* requested event is not supported */ + TD_NOCAPAB, /* capability not available */ + TD_DBERR, /* Debugger service failed */ + TD_NOAPLIC, /* Operation not applicable to */ + TD_NOTSD, /* No thread-specific data for this thread */ + TD_MALLOC, /* Malloc failed */ + TD_PARTIALREG, /* Only part of register set was writen/read */ + TD_NOXREGS, /* X register set not available for given thread */ + TD_NOTLS, /* There is no TLS in the specified module */ + TD_TLSDEFER /* module's TLS not yet allocated by the thread */ +} td_err_e; + + +/* ----------------------------------------------------------------------- */ + +/* + * Exported functions. + */ + +/* + * Initialize the threads debug interface. + */ +td_err_e +td_init(void); + +/* + * A no-op, left for historical reasons. + */ +void +td_log(void); + +/* + * Allocate a new process handle ("thread agent"). + */ +td_err_e +td_ta_new(struct ps_prochandle *, td_thragent_t **); + +/* + * De-allocate a process handle, releasing all related resources. + */ +td_err_e +td_ta_delete(td_thragent_t *); + +/* + * Map a process handle to a client process handle. + */ +td_err_e +td_ta_get_ph(const td_thragent_t *, struct ps_prochandle **); + +/* + * Set the process's suggested concurrency level. + */ +td_err_e +td_ta_setconcurrency(const td_thragent_t *, int); + +/* + * Get the number of threads in the process, including zombie threads. + */ +td_err_e +td_ta_get_nthreads(const td_thragent_t *, int *); + +/* + * Map a tid, as returned by thr_create(), to a thread handle. + */ +td_err_e +td_ta_map_id2thr(const td_thragent_t *, thread_t, td_thrhandle_t *); + +/* + * Map the address of a synchronization object to a sync. object handle. + */ +td_err_e +td_ta_map_addr2sync(const td_thragent_t *, psaddr_t, td_synchandle_t *); + +/* + * Iterate over a process's thread-specific data (TSD) keys. + */ +td_err_e +td_ta_tsd_iter(const td_thragent_t *, td_key_iter_f *, void *); + +/* + * Iterate over a process's threads, including zombie threads. + */ +td_err_e +td_ta_thr_iter(const td_thragent_t *, td_thr_iter_f *, void *, + td_thr_state_e, int, sigset_t *, unsigned); + +/* + * Iterate over a process's known synchronization objects. + */ +td_err_e +td_ta_sync_iter(const td_thragent_t *, td_sync_iter_f *, void *); + +/* + * Enable/disable process statistics collection. + */ +td_err_e +td_ta_enable_stats(const td_thragent_t *, int); + +/* + * Reset process statistics. + */ +td_err_e +td_ta_reset_stats(const td_thragent_t *); + +/* + * Read process statistics. + */ +td_err_e +td_ta_get_stats(const td_thragent_t *, td_ta_stats_t *); + +/* + * Get thread information. + */ +td_err_e +td_thr_get_info(const td_thrhandle_t *, td_thrinfo_t *); + +/* + * Get the "event address" for an event type. + */ +td_err_e +td_ta_event_addr(const td_thragent_t *, td_event_e, td_notify_t *); + +/* + * Enable/disable event reporting for a thread. + */ +td_err_e +td_thr_event_enable(const td_thrhandle_t *, int); + +/* + * Enable a set of events for a thread. + */ +td_err_e +td_thr_set_event(const td_thrhandle_t *, td_thr_events_t *); + +/* + * Disable a set of events for a thread. + */ +td_err_e +td_thr_clear_event(const td_thrhandle_t *, td_thr_events_t *); + +/* + * Retrieve (and consume) an event message for a thread. + */ +td_err_e +td_thr_event_getmsg(const td_thrhandle_t *, td_event_msg_t *); + +/* + * Enable a set of events in the process. + */ +td_err_e +td_ta_set_event(const td_thragent_t *, td_thr_events_t *); + +/* + * Disable a set of events in the process. + */ +td_err_e +td_ta_clear_event(const td_thragent_t *, td_thr_events_t *); + +/* + * Retrieve (and consume) an event message for some thread in the process. + */ +td_err_e +td_ta_event_getmsg(const td_thragent_t *, td_event_msg_t *); + +/* + * Suspend a thread. + */ +td_err_e +td_thr_dbsuspend(const td_thrhandle_t *); + +/* + * Resume a suspended thread. + */ +td_err_e +td_thr_dbresume(const td_thrhandle_t *); + +/* + * Set a thread's signal mask. + */ +td_err_e +td_thr_sigsetmask(const td_thrhandle_t *, const sigset_t); + +/* + * Set a thread's "signals-pending" set. + */ +td_err_e +td_thr_setsigpending(const td_thrhandle_t *, uchar_t, const sigset_t); + +/* + * Get a thread's general register set. + */ +td_err_e +td_thr_getgregs(const td_thrhandle_t *, prgregset_t); + +/* + * Set a thread's general register set. + */ +td_err_e +td_thr_setgregs(const td_thrhandle_t *, const prgregset_t); + +/* + * Get a thread's floating-point register set. + */ +td_err_e +td_thr_getfpregs(const td_thrhandle_t *, prfpregset_t *); + +/* + * Set a thread's floating-point register set. + */ +td_err_e +td_thr_setfpregs(const td_thrhandle_t *, const prfpregset_t *); + +/* + * Get the size of the extra state register set for this architecture. + */ +td_err_e +td_thr_getxregsize(const td_thrhandle_t *th_p, int *xregsize); + +/* + * Get a thread's extra state register set. + */ +td_err_e +td_thr_getxregs(const td_thrhandle_t *th_p, void *xregs); + +/* + * Set a thread's extra state register set. + */ +td_err_e +td_thr_setxregs(const td_thrhandle_t *th_p, const void *xregs); + +/* + * Validate a thread handle. + */ +td_err_e +td_thr_validate(const td_thrhandle_t *); + +/* + * Get a thread-specific data pointer for a thread. + */ +td_err_e +td_thr_tsd(const td_thrhandle_t *, thread_key_t, void **); + +/* + * Get the base address of a thread's thread local storage (TLS) block + * for the module (executable or shared object) identified by 'moduleid'. + */ +td_err_e +td_thr_tlsbase(const td_thrhandle_t *, ulong_t moduleid, psaddr_t *base); + +/* + * Set a thread's priority. + */ +td_err_e +td_thr_setprio(const td_thrhandle_t *, int); + +/* + * Iterate over the set of locks owned by a thread. + */ +td_err_e +td_thr_lockowner(const td_thrhandle_t *, td_sync_iter_f *, void *); + +/* + * Return the sync. handle of the object this thread is sleeping on. + */ +td_err_e +td_thr_sleepinfo(const td_thrhandle_t *, td_synchandle_t *); + +/* + * Map an lwpid, as returned by _lwp_create(), to a thread handle. + */ +td_err_e +td_ta_map_lwp2thr(const td_thragent_t *, lwpid_t, td_thrhandle_t *th_p); + +/* + * Enable/disable a process's synchronization object tracking. + */ +td_err_e +td_ta_sync_tracking_enable(const td_thragent_t *, int); + +/* + * Get information about a synchronization object. + */ +td_err_e +td_sync_get_info(const td_synchandle_t *, td_syncinfo_t *); + +/* + * Get statistics for a synchronization object. + */ +td_err_e +td_sync_get_stats(const td_synchandle_t *, td_syncstats_t *); + +/* + * Set the state of a synchronization object. + */ +td_err_e +td_sync_setstate(const td_synchandle_t *, int value); + +/* + * Iterate over all threads blocked on a synchronization object. + */ +td_err_e +td_sync_waiters(const td_synchandle_t *, td_thr_iter_f *, void *); + +#ifdef __cplusplus +} +#endif + +#endif /* _THREAD_DB_H */ diff --git a/usr/src/head/time.h b/usr/src/head/time.h new file mode 100644 index 0000000000..a47298e3e7 --- /dev/null +++ b/usr/src/head/time.h @@ -0,0 +1,375 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _TIME_H +#define _TIME_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.18 */ + +#include <sys/feature_tests.h> +#include <iso/time_iso.h> +#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + (_POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__) +#include <sys/types.h> +#include <sys/time_impl.h> +#endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) ... */ + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/time_iso.h>. + */ +#if __cplusplus >= 199711L +using std::size_t; +using std::clock_t; +using std::time_t; +using std::tm; +using std::asctime; +using std::clock; +using std::ctime; +using std::difftime; +using std::gmtime; +using std::localtime; +using std::mktime; +using std::time; +using std::strftime; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CLOCKID_T +#define _CLOCKID_T +typedef int clockid_t; +#endif + +#ifndef _TIMER_T +#define _TIMER_T +typedef int timer_t; +#endif + +#if defined(__STDC__) + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT) +extern struct tm *gmtime_r(const time_t *_RESTRICT_KYWD, + struct tm *_RESTRICT_KYWD); +extern struct tm *localtime_r(const time_t *_RESTRICT_KYWD, + struct tm *_RESTRICT_KYWD); +#endif + +#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_XPG4) || defined(__EXTENSIONS__) + +#ifdef _STRPTIME_DONTZERO +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname strptime __strptime_dontzero +#else /* __PRAGMA_REDEFINE_EXTNAME */ +extern char *__strptime_dontzero(const char *, const char *, struct tm *); +#define strptime __strptime_dontzero +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* _STRPTIME_DONTZERO */ + +extern char *strptime(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, + struct tm *_RESTRICT_KYWD); + +#endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */ + +#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + (_POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__) +/* + * Neither X/Open nor POSIX allow the inclusion of <signal.h> for the + * definition of the sigevent structure. Both require the inclusion + * of <signal.h> and <time.h> when using the timer_create() function. + * However, X/Open also specifies that the sigevent structure be defined + * in <time.h> as described in the header <signal.h>. This prevents + * compiler warnings for applications that only include <time.h> and not + * also <signal.h>. The sigval union and the sigevent structure is + * therefore defined both here and in <sys/siginfo.h> which gets included + * via inclusion of <signal.h>. + */ +#ifndef _SIGVAL +#define _SIGVAL +union sigval { + int sival_int; /* integer value */ + void *sival_ptr; /* pointer value */ +}; +#endif /* _SIGVAL */ + +#ifndef _SIGEVENT +#define _SIGEVENT +struct sigevent { + int sigev_notify; /* notification mode */ + int sigev_signo; /* signal number */ + union sigval sigev_value; /* signal value */ + void (*sigev_notify_function)(union sigval); + pthread_attr_t *sigev_notify_attributes; + int __sigev_pad2; +}; +#endif /* _SIGEVENT */ + +extern int clock_getres(clockid_t, struct timespec *); +extern int clock_gettime(clockid_t, struct timespec *); +extern int clock_settime(clockid_t, const struct timespec *); +extern int timer_create(clockid_t, struct sigevent *_RESTRICT_KYWD, + timer_t *_RESTRICT_KYWD); +extern int timer_delete(timer_t); +extern int timer_getoverrun(timer_t); +extern int timer_gettime(timer_t, struct itimerspec *); +extern int timer_settime(timer_t, int, const struct itimerspec *_RESTRICT_KYWD, + struct itimerspec *_RESTRICT_KYWD); + +extern int nanosleep(const struct timespec *, struct timespec *); +extern int clock_nanosleep(clockid_t, int, + const struct timespec *, struct timespec *); + +#endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */ + +#if !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX) || \ + defined(__EXTENSIONS__) + +extern void tzset(void); +extern char *tzname[2]; + +/* CLK_TCK marked as LEGACY in SUSv2 and removed in SUSv3 */ +#if !defined(_XPG6) || defined(__EXTENSIONS__) +#ifndef CLK_TCK +extern long _sysconf(int); /* System Private interface to sysconf() */ +#define CLK_TCK ((clock_t)_sysconf(3)) /* clock ticks per second */ + /* 3 is _SC_CLK_TCK */ +#endif +#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ + +#if (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \ + defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) +extern long timezone; +extern int daylight; +#endif + +#endif /* !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX)... */ + +#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) +extern int cftime(char *, char *, const time_t *); +extern int ascftime(char *, const char *, const struct tm *); +extern long altzone; +#endif + +#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + defined(_XPG4_2) || defined(__EXTENSIONS__) +extern struct tm *getdate(const char *); +#ifdef _REENTRANT +#undef getdate_err +#define getdate_err *(int *)_getdate_err_addr() +extern int *_getdate_err_addr(void); +#else +extern int getdate_err; +#endif /* _REENTRANT */ +#endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */ + +#else /* __STDC__ */ + +extern int cftime(), ascftime(); +extern void tzset(); + +#ifdef _STRPTIME_DONTZERO +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname strptime __strptime_dontzero +#else /* __PRAGMA_REDEFINE_EXTNAME */ +extern char *__strptime_dontzero(); +#define strptime __strptime_dontzero +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* _STRPTIME_DONTZERO */ + +extern char *strptime(); + +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT) +extern struct tm *gmtime_r(); +extern struct tm *localtime_r(); +#endif + +extern long timezone, altzone; +extern int daylight; +extern char *tzname[2]; + +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern struct tm *getdate(); +#ifdef _REENTRANT +#undef getdate_err +#define getdate_err *(int *)_getdate_err_addr() +extern int *_getdate_err_addr(); +#else +extern int getdate_err; +#endif /* _REENTRANT */ +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ + +#endif /* __STDC__ */ + +/* + * ctime_r() & asctime_r() prototypes are defined here. + */ + +/* + * Previous releases of Solaris, starting at 2.3, provided definitions of + * various functions as specified in POSIX.1c, Draft 6. For some of these + * functions, the final POSIX 1003.1c standard had a different number of + * arguments and return values. + * + * The following segment of this header provides support for the standard + * interfaces while supporting applications written under earlier + * releases. The application defines appropriate values of the feature + * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate + * whether it was written to expect the Draft 6 or standard versions of + * these interfaces, before including this header. This header then + * provides a mapping from the source version of the interface to an + * appropriate binary interface. Such mappings permit an application + * to be built from libraries and objects which have mixed expectations + * of the definitions of these functions. + * + * For applications using the Draft 6 definitions, the binary symbol is the + * same as the source symbol, and no explicit mapping is needed. For the + * standard interface, the function func() is mapped to the binary symbol + * _posix_func(). The preferred mechanism for the remapping is a compiler + * #pragma. If the compiler does not provide such a #pragma, the header file + * defines a static function func() which calls the _posix_func() version; + * this has to be done instead of #define since POSIX specifies that an + * application can #undef the symbol and still be bound to the correct + * implementation. Unfortunately, the statics confuse lint so we fallback to + * #define in that case. + * + * NOTE: Support for the Draft 6 definitions is provided for compatibility + * only. New applications/libraries should use the standard definitions. + */ + +#if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ + (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#if defined(__STDC__) + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname ctime_r __posix_ctime_r +#pragma redefine_extname asctime_r __posix_asctime_r +extern char *asctime_r(const struct tm *_RESTRICT_KYWD, char *_RESTRICT_KYWD); +extern char *ctime_r(const time_t *, char *); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern char *__posix_asctime_r(const struct tm *_RESTRICT_KYWD, + char *_RESTRICT_KYWD); +extern char *__posix_ctime_r(const time_t *, char *); + +#ifdef __lint + +#define ctime_r __posix_ctime_r +#define asctime_r __posix_asctime_r + +#else /* !__lint */ + +static char * +asctime_r(const struct tm *_RESTRICT_KYWD __tm, char *_RESTRICT_KYWD __buf) +{ + return (__posix_asctime_r(__tm, __buf)); +} + +static char * +ctime_r(const time_t *__time, char *__buf) +{ + return (__posix_ctime_r(__time, __buf)); +} + +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern char *asctime_r(const struct tm *, char *, int); +extern char *ctime_r(const time_t *, char *, int); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +#else /* __STDC__ */ + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname asctime_r __posix_asctime_r +#pragma redefine_extname ctime_r __posix_ctime_r +extern char *asctime_r(); +extern char *ctime_r(); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern char *__posix_asctime_r(); +extern char *__posix_ctime_r(); + +#ifdef __lint + +#define asctime_r __posix_asctime_r +#define ctime_r __posix_ctime_r + +#else /* !__lint */ + +static char * +asctime_r(__tm, __buf) + struct tm *__tm; + char *__buf; +{ + return (__posix_asctime_r(__tm, __buf)); +} +static char * +ctime_r(__time, __buf) + time_t *__time; + char *__buf; +{ + return (__posix_ctime_r(__time, __buf)); +} + +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern char *asctime_r(); +extern char *ctime_r(); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +#endif /* __STDC__ */ + +#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TIME_H */ diff --git a/usr/src/head/tiuser.h b/usr/src/head/tiuser.h new file mode 100644 index 0000000000..12fc9c24d6 --- /dev/null +++ b/usr/src/head/tiuser.h @@ -0,0 +1,57 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _TIUSER_H +#define _TIUSER_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/* + * TLI user interface definitions. + */ + +#include <sys/tiuser.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_REENTRANT) || defined(_TS_ERRNO) || \ + _POSIX_C_SOURCE - 0 >= 199506L +#if defined(__STDC__) +extern int *__t_errno(void); +#else +extern int *__t_errno(); +#endif +#define t_errno (*(__t_errno())) +#else +extern int t_errno; +#endif /* defined(_REENTRANT) || defined(_TS_ERRNO) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TIUSER_H */ diff --git a/usr/src/head/tzfile.h b/usr/src/head/tzfile.h new file mode 100644 index 0000000000..6138826a41 --- /dev/null +++ b/usr/src/head/tzfile.h @@ -0,0 +1,240 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1988-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +#ifndef _TZFILE_H +#define _TZFILE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * A part of this file comes from public domain source, so + * clarified as of June 5, 1996 by Arthur David Olson + * (arthur_david_olson@nih.gov). + */ + +#include <sys/types.h> + +/* + * WARNING: + * The interfaces defined in this header file are for Sun private use only. + * The contents of this file are subject to change without notice for the + * future releases. + */ + +/* For further information, see ctime(3C) and zic(1M) man pages. */ + +/* + * This file is in the public domain, so clarified as of + * June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov). + */ + +/* + * This header is for use ONLY with the time conversion code. + * There is no guarantee that it will remain unchanged, + * or that it will remain at all. + * Do NOT copy it to any system include directory. + * Thank you! + */ + +/* + * Note: Despite warnings from the authors of this code, Solaris has + * placed this header file in the system include directory. This was + * probably done in order to build both zic and zdump which are in + * separate source directories, but both use this file. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Information about time zone files. + */ + +#ifndef TZDIR +#define TZDIR "/usr/share/lib/zoneinfo" /* Time zone object file directory */ +#endif /* !defined TZDIR */ + +#ifndef TZDEFAULT +#define TZDEFAULT "localtime" +#endif /* !defined TZDEFAULT */ + +#ifndef TZDEFRULES +#define TZDEFRULES "posixrules" +#endif /* !defined TZDEFRULES */ + +/* + * Each file begins with. . . + */ + +#define TZ_MAGIC "TZif" + +struct tzhead { + char tzh_magic[4]; /* TZ_MAGIC */ + char tzh_reserved[16]; /* reserved for future use */ + char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ + char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ + char tzh_leapcnt[4]; /* coded number of leap seconds */ + char tzh_timecnt[4]; /* coded number of transition times */ + char tzh_typecnt[4]; /* coded number of local time types */ + char tzh_charcnt[4]; /* coded number of abbr. chars */ +}; + +/* + * . . .followed by. . . + * + * tzh_timecnt (char [4])s coded transition times a la time(2) + * tzh_timecnt (unsigned char)s types of local time starting at above + * tzh_typecnt repetitions of + * one (char [4]) coded UTC offset in seconds + * one (unsigned char) used to set tm_isdst + * one (unsigned char) that's an abbreviation list index + * tzh_charcnt (char)s '\0'-terminated zone abbreviations + * tzh_leapcnt repetitions of + * one (char [4]) coded leap second transition times + * one (char [4]) total correction after above + * tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition + * time is standard time, if FALSE, + * transition time is wall clock time + * if absent, transition times are + * assumed to be wall clock time + * tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition + * time is UTC, if FALSE, + * transition time is local time + * if absent, transition times are + * assumed to be local time + */ + +/* + * In the current implementation, "tzset()" refuses to deal with files that + * exceed any of the limits below. + */ + +#ifndef TZ_MAX_TIMES +/* + * The TZ_MAX_TIMES value below is enough to handle a bit more than a + * year's worth of solar time (corrected daily to the nearest second) or + * 138 years of Pacific Presidential Election time + * (where there are three time zone transitions every fourth year). + */ +#define TZ_MAX_TIMES 370 +#endif /* !defined TZ_MAX_TIMES */ + +#ifndef TZ_MAX_TYPES +#ifndef NOSOLAR +#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ +#endif /* !defined NOSOLAR */ +#ifdef NOSOLAR +/* + * Must be at least 14 for Europe/Riga as of Jan 12 1995, + * as noted by Earl Chew <earl@hpato.aus.hp.com>. + */ +#define TZ_MAX_TYPES 20 /* Maximum number of local time types */ +#endif /* !defined NOSOLAR */ +#endif /* !defined TZ_MAX_TYPES */ + +#ifndef TZ_MAX_CHARS +#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ + /* (limited by what unsigned chars can hold) */ +#endif /* !defined TZ_MAX_CHARS */ + +#ifndef TZ_MAX_LEAPS +#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ +#endif /* !defined TZ_MAX_LEAPS */ + +#define SECSPERMIN 60 +#define MINSPERHOUR 60 +#define HOURSPERDAY 24 +#define DAYSPERWEEK 7 +#define DAYSPERNYEAR 365 +#define DAYSPERLYEAR 366 +#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) +#define SECSPERDAY ((time_t)SECSPERHOUR * HOURSPERDAY) +#define MONSPERYEAR 12 + +#define TM_SUNDAY 0 +#define TM_MONDAY 1 +#define TM_TUESDAY 2 +#define TM_WEDNESDAY 3 +#define TM_THURSDAY 4 +#define TM_FRIDAY 5 +#define TM_SATURDAY 6 + +#define TM_JANUARY 0 +#define TM_FEBRUARY 1 +#define TM_MARCH 2 +#define TM_APRIL 3 +#define TM_MAY 4 +#define TM_JUNE 5 +#define TM_JULY 6 +#define TM_AUGUST 7 +#define TM_SEPTEMBER 8 +#define TM_OCTOBER 9 +#define TM_NOVEMBER 10 +#define TM_DECEMBER 11 + +#define TM_YEAR_BASE 1900 + +#define EPOCH_YEAR 1970 +#define EPOCH_WDAY TM_THURSDAY + +/* + * Accurate only for the past couple of centuries; + * that will probably do. + */ + +#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) + +#ifndef USG + +/* + * Use of the underscored variants may cause problems if you move your code to + * certain System-V-based systems; for maximum portability, use the + * underscore-free variants. The underscored variants are provided for + * backward compatibility only; they may disappear from future versions of + * this file. + */ + +#define SECS_PER_MIN SECSPERMIN +#define MINS_PER_HOUR MINSPERHOUR +#define HOURS_PER_DAY HOURSPERDAY +#define DAYS_PER_WEEK DAYSPERWEEK +#define DAYS_PER_NYEAR DAYSPERNYEAR +#define DAYS_PER_LYEAR DAYSPERLYEAR +#define SECS_PER_HOUR SECSPERHOUR +#define SECS_PER_DAY SECSPERDAY +#define MONS_PER_YEAR MONSPERYEAR + +#endif /* !defined USG */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TZFILE_H */ diff --git a/usr/src/head/ucontext.h b/usr/src/head/ucontext.h new file mode 100644 index 0000000000..8fc6fd52bd --- /dev/null +++ b/usr/src/head/ucontext.h @@ -0,0 +1,104 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _UCONTEXT_H +#define _UCONTEXT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/ucontext.h> + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +#include <sys/siginfo.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __sparc +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname makecontext __makecontext_v2 +#else +#define makecontext __makecontext_v2 +#endif +#endif + +#if defined(__STDC__) + +extern int getcontext(ucontext_t *); +#pragma unknown_control_flow(getcontext) +extern int setcontext(const ucontext_t *) __NORETURN; +extern int swapcontext(ucontext_t *_RESTRICT_KYWD, + const ucontext_t *_RESTRICT_KYWD); +extern void makecontext(ucontext_t *, void(*)(), int, ...); +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int walkcontext(const ucontext_t *, int (*)(uintptr_t, int, void *), + void *); +extern int printstack(int); + +extern int getustack(stack_t **); +extern int setustack(stack_t *); + +extern int stack_getbounds(stack_t *); +extern int stack_setbounds(const stack_t *); +extern int stack_inbounds(void *); +extern int stack_violation(int, const siginfo_t *, const ucontext_t *); + +extern void *_stack_grow(void *); +#endif +#else + +extern int getcontext(); +#pragma unknown_control_flow(getcontext) +extern int setcontext(); +extern int swapcontext(); +extern void makecontext(); +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int walkcontext(); +extern int printstack(); + +extern int getustack(); +extern int setustack(); + +extern int stack_getbounds(); +extern int stack_setbounds(); +extern int stack_inbounds(); +extern int stack_violation(); + +extern void *_stack_grow(); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _UCONTEXT_H */ diff --git a/usr/src/head/ucred.h b/usr/src/head/ucred.h new file mode 100644 index 0000000000..a0d4af444a --- /dev/null +++ b/usr/src/head/ucred.h @@ -0,0 +1,104 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _UCRED_H_ +#define _UCRED_H_ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <sys/priv.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ucred_s ucred_t; + +/* + * library functions prototype. + */ +#if defined(__STDC__) + +extern ucred_t *ucred_get(pid_t pid); + +extern void ucred_free(ucred_t *); + +extern uid_t ucred_geteuid(const ucred_t *); +extern uid_t ucred_getruid(const ucred_t *); +extern uid_t ucred_getsuid(const ucred_t *); +extern gid_t ucred_getegid(const ucred_t *); +extern gid_t ucred_getrgid(const ucred_t *); +extern gid_t ucred_getsgid(const ucred_t *); +extern int ucred_getgroups(const ucred_t *, const gid_t **); + +extern const priv_set_t *ucred_getprivset(const ucred_t *, priv_ptype_t); +extern uint_t ucred_getpflags(const ucred_t *, uint_t); + +extern pid_t ucred_getpid(const ucred_t *); /* for door_cred compatibility */ + +extern size_t ucred_size(void); + +extern int getpeerucred(int, ucred_t **); + +extern zoneid_t ucred_getzoneid(const ucred_t *); + +extern projid_t ucred_getprojid(const ucred_t *); + +#else /* Non ANSI */ + +extern ucred_t *ucred_get(/* pid_t pid */); + +extern void ucred_free(/* ucred_t * */); + +extern uid_t ucred_geteuid(/* ucred_t * */); +extern uid_t ucred_getruid(/* ucred_t * */); +extern uid_t ucred_getsuid(/* ucred_t * */); +extern gid_t ucred_getegid(/* ucred_t * */); +extern gid_t ucred_getrgid(/* ucred_t * */); +extern gid_t ucred_getsgid(/* ucred_t * */); +extern int ucred_getgroups(/* ucred_t *, gid_t ** */); + +extern priv_set_t *ucred_getprivset(/* ucred_t *, priv_ptype_t */); +extern uint_t ucred_getpflags(/* ucred_t *, uint_t */); + +extern pid_t ucred_getpid(/* ucred_t * */); + +extern size_t ucred_size(/* void */); + +extern int getpeerucred(/* int, ucred_t ** */); + +extern zoneid_t ucred_getzoneid(/* ucred_t * */); + +extern projid_t ucred_getprojid(/* ucred_t * */); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _UCRED_H_ */ diff --git a/usr/src/head/ulimit.h b/usr/src/head/ulimit.h new file mode 100644 index 0000000000..7ceb93f072 --- /dev/null +++ b/usr/src/head/ulimit.h @@ -0,0 +1,47 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _ULIMIT_H +#define _ULIMIT_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */ + +#include <sys/ulimit.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __STDC__ +extern long ulimit(int, ...); +#else +extern long ulimit(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _ULIMIT_H */ diff --git a/usr/src/head/unistd.h b/usr/src/head/unistd.h new file mode 100644 index 0000000000..333f333287 --- /dev/null +++ b/usr/src/head/unistd.h @@ -0,0 +1,1020 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _UNISTD_H +#define _UNISTD_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#include <sys/types.h> +#include <sys/unistd.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Symbolic constants for the "access" routine: */ +#define R_OK 4 /* Test for Read permission */ +#define W_OK 2 /* Test for Write permission */ +#define X_OK 1 /* Test for eXecute permission */ +#define F_OK 0 /* Test for existence of File */ + +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +#define F_ULOCK 0 /* Unlock a previously locked region */ +#define F_LOCK 1 /* Lock a region for exclusive use */ +#define F_TLOCK 2 /* Test and lock a region for exclusive use */ +#define F_TEST 3 /* Test a region for other processes locks */ +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ + +/* Symbolic constants for the "lseek" routine: */ + +#ifndef SEEK_SET +#define SEEK_SET 0 /* Set file pointer to "offset" */ +#endif + +#ifndef SEEK_CUR +#define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ +#endif + +#ifndef SEEK_END +#define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +#ifndef SEEK_DATA +#define SEEK_DATA 3 /* Set file pointer to next data past offset */ +#endif + +#ifndef SEEK_HOLE +#define SEEK_HOLE 4 /* Set file pointer to next hole past offset */ +#endif +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ + +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +/* Path names: */ +#define GF_PATH "/etc/group" /* Path name of the "group" file */ +#define PF_PATH "/etc/passwd" /* Path name of the "passwd" file */ +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ + +/* + * compile-time symbolic constants, + * Support does not mean the feature is enabled. + * Use pathconf/sysconf to obtain actual configuration value. + */ + +/* Values unchanged in UNIX 03 */ +#define _POSIX_ASYNC_IO 1 +#define _POSIX_JOB_CONTROL 1 +#define _POSIX_SAVED_IDS 1 +#define _POSIX_SYNC_IO 1 + +/* + * POSIX.1b compile-time symbolic constants. + */ +#if defined(_XPG6) +#define _POSIX_ASYNCHRONOUS_IO 200112L +#define _POSIX_FSYNC 200112L +#define _POSIX_MAPPED_FILES 200112L +#define _POSIX_MEMLOCK 200112L +#define _POSIX_MEMLOCK_RANGE 200112L +#define _POSIX_MEMORY_PROTECTION 200112L +#define _POSIX_MESSAGE_PASSING 200112L +#define _POSIX_PRIORITY_SCHEDULING 200112L +#define _POSIX_REALTIME_SIGNALS 200112L +#define _POSIX_SEMAPHORES 200112L +#define _POSIX_SHARED_MEMORY_OBJECTS 200112L +#define _POSIX_SYNCHRONIZED_IO 200112L +#else +#define _POSIX_ASYNCHRONOUS_IO 1 +#define _POSIX_FSYNC 1 +#define _POSIX_MAPPED_FILES 1 +#define _POSIX_MEMLOCK 1 +#define _POSIX_MEMLOCK_RANGE 1 +#define _POSIX_MEMORY_PROTECTION 1 +#define _POSIX_MESSAGE_PASSING 1 +#define _POSIX_PRIORITY_SCHEDULING 1 +#define _POSIX_REALTIME_SIGNALS 1 +#define _POSIX_SEMAPHORES 1 +#define _POSIX_SHARED_MEMORY_OBJECTS 1 +#define _POSIX_SYNCHRONIZED_IO 1 +#endif + +/* + * POSIX.1c compile-time symbolic constants. + */ +#if defined(_XPG6) +#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L +#define _POSIX_THREADS 200112L +#define _POSIX_THREAD_ATTR_STACKADDR 200112L +#define _POSIX_THREAD_ATTR_STACKSIZE 200112L +#define _POSIX_THREAD_PROCESS_SHARED 200112L +#define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L +#define _POSIX_TIMERS 200112L +#else +#define _POSIX_THREAD_SAFE_FUNCTIONS 1 +#define _POSIX_THREADS 1 +#define _POSIX_THREAD_ATTR_STACKADDR 1 +#define _POSIX_THREAD_ATTR_STACKSIZE 1 +#define _POSIX_THREAD_PROCESS_SHARED 1 +#define _POSIX_THREAD_PRIORITY_SCHEDULING 1 +#define _POSIX_TIMERS 1 +#endif + +/* New in UNIX 03 */ +#define _POSIX_BARRIERS 200112L +#define _POSIX_CLOCK_SELECTION 200112L +#define _POSIX_IPV6 200112L +#define _POSIX_MONOTONIC_CLOCK 200112L +#define _POSIX_RAW_SOCKETS 200112L +#define _POSIX_READER_WRITER_LOCKS 200112L +#define _POSIX_SPAWN 200112L +#define _POSIX_SPIN_LOCKS 200112L +#define _POSIX_TIMEOUTS 200112L + +/* + * Support for the POSIX.1 mutex protocol attribute. For realtime applications + * which need mutexes to support priority inheritance/ceiling. + */ +#if defined(_XPG6) +#define _POSIX_THREAD_PRIO_INHERIT 200112L +#define _POSIX_THREAD_PRIO_PROTECT 200112L +#else +#define _POSIX_THREAD_PRIO_INHERIT 1 +#define _POSIX_THREAD_PRIO_PROTECT 1 +#endif + +#ifndef _POSIX_VDISABLE +#define _POSIX_VDISABLE 0 +#endif + +#ifndef NULL +#if defined(_LP64) +#define NULL 0L +#else +#define NULL 0 +#endif +#endif + +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +/* + * Large File Summit-related announcement macros. The system supports both + * the additional and transitional Large File Summit interfaces. (The final + * two macros provide a finer granularity breakdown of _LFS64_LARGEFILE.) + */ +#define _LFS_LARGEFILE 1 +#define _LFS64_LARGEFILE 1 +#define _LFS64_STDIO 1 +#define _LFS64_ASYNCHRONOUS_IO 1 + +/* large file compilation environment setup */ +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname ftruncate ftruncate64 +#pragma redefine_extname lseek lseek64 +#pragma redefine_extname pread pread64 +#pragma redefine_extname pwrite pwrite64 +#pragma redefine_extname truncate truncate64 +#pragma redefine_extname lockf lockf64 +#pragma redefine_extname tell tell64 +#else /* __PRAGMA_REDEFINE_EXTNAME */ +#define ftruncate ftruncate64 +#define lseek lseek64 +#define pread pread64 +#define pwrite pwrite64 +#define truncate truncate64 +#define lockf lockf64 +#define tell tell64 +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ + +/* In the LP64 compilation environment, the APIs are already large file */ +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname ftruncate64 ftruncate +#pragma redefine_extname lseek64 lseek +#pragma redefine_extname pread64 pread +#pragma redefine_extname pwrite64 pwrite +#pragma redefine_extname truncate64 truncate +#pragma redefine_extname lockf64 lockf +#pragma redefine_extname tell64 tell +#else /* __PRAGMA_REDEFINE_EXTNAME */ +#define ftruncate64 ftruncate +#define lseek64 lseek +#define pread64 pread +#define pwrite64 pwrite +#define truncate64 truncate +#define lockf64 lockf +#define tell64 tell +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* _LP64 && _LARGEFILE64_SOURCE */ + +#if defined(__STDC__) + +extern int access(const char *, int); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int acct(const char *); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +extern unsigned alarm(unsigned); +/* Marked as LEGACY in SUSv2 and removed in SUSv3 */ +#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ + defined(__EXTENSIONS__) +extern int brk(void *); +#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ +extern int chdir(const char *); +extern int chown(const char *, uid_t, gid_t); +/* Marked as LEGACY in SUSv2 and removed in SUSv3 */ +#if !defined(_POSIX_C_SOURCE) || (defined(_XOPEN_SOURCE) && \ + !defined(_XPG6)) || defined(__EXTENSIONS__) +extern int chroot(const char *); +#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))... */ +extern int close(int); +#if defined(_XPG4) || defined(__EXTENSIONS__) +extern size_t confstr(int, char *, size_t); +extern char *crypt(const char *, const char *); +#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ +#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(__EXTENSIONS__) +extern char *ctermid(char *); +#endif /* (!defined(_POSIX_C_SOURCE) ... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS_) +extern char *ctermid_r(char *); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */ +/* Marked as LEGACY in SUSv2 and removed in SUSv3 */ +#if !defined(_XPG6) || defined(__EXTENSIONS__) +extern char *cuserid(char *); +#endif +extern int dup(int); +extern int dup2(int, int); +#if defined(_XPG4) || defined(__EXTENSIONS__) +extern void encrypt(char *, int); +#endif /* defined(XPG4) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern void endusershell(void); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +extern int execl(const char *, const char *, ...); +extern int execle(const char *, const char *, ...); +extern int execlp(const char *, const char *, ...); +extern int execv(const char *, char *const *); +extern int execve(const char *, char *const *, char *const *); +extern int execvp(const char *, char *const *); +extern void _exit(int) + __NORETURN; +/* + * The following fattach prototype is duplicated in <stropts.h>. The + * duplication is necessitated by XPG4.2 which requires the prototype + * be defined in <stropts.h>. + */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int fattach(int, const char *); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int fchdir(int); +extern int fchown(int, uid_t, gid_t); +#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ + defined(__EXTENSIONS__) +extern int fchownat(int, const char *, uid_t, gid_t, int); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int fchroot(int); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ + defined(__EXTENSIONS__) +extern int fdatasync(int); +#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ +/* + * The following fdetach prototype is duplicated in <stropts.h>. The + * duplication is necessitated by XPG4.2 which requires the prototype + * be defined in <stropts.h>. + */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int fdetach(const char *); +#endif /* !defined(__XOPEN_OR_POSIX)... */ +extern pid_t fork(void); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern pid_t fork1(void); +extern pid_t forkall(void); +#endif /* !defined(__XOPEN_OR_POSIX)... */ +extern long fpathconf(int, int); +#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \ + defined(__EXTENSIONS__) +extern int fsync(int); +#endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */ +#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern int ftruncate(int, off_t); +#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ +extern char *getcwd(char *, size_t); +#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ + defined(__EXTENSIONS__) +extern int getdtablesize(void); +#endif +extern gid_t getegid(void); +extern uid_t geteuid(void); +extern gid_t getgid(void); +extern int getgroups(int, gid_t *); +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern long gethostid(void); +#endif +#if defined(_XPG4_2) +extern int gethostname(char *, size_t); +#elif !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int gethostname(char *, int); +#endif +extern char *getlogin(void); +#if defined(_XPG4) || defined(__EXTENSIONS__) +extern int getopt(int, char *const *, const char *); +extern char *optarg; +extern int opterr, optind, optopt; +/* Marked as LEGACY in SUSv2 and removed in SUSv3 */ +#if !defined(_XPG6) || defined(__EXTENSIONS__) +extern char *getpass(const char *); +#endif +#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +/* Marked as LEGACY in SUSv2 and removed in SUSv3 */ +#if !defined(_XPG6) || defined(__EXTENSIONS__) +extern int getpagesize(void); +#endif +extern pid_t getpgid(pid_t); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +extern pid_t getpid(void); +extern pid_t getppid(void); +extern pid_t getpgrp(void); + +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +char *gettxt(const char *, const char *); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern pid_t getsid(pid_t); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +extern uid_t getuid(void); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern char *getusershell(void); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern char *getwd(char *); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +/* + * The following ioctl prototype is duplicated in <stropts.h>. The + * duplication is necessitated by XPG4.2 which requires the prototype + * be defined in <stropts.h>. + */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int ioctl(int, int, ...); +extern int isaexec(const char *, char *const *, char *const *); +extern int issetugid(void); +#endif +extern int isatty(int); +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int lchown(const char *, uid_t, gid_t); +#endif +extern int link(const char *, const char *); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern offset_t llseek(int, offset_t, int); +#endif +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern int lockf(int, int, off_t); +#endif +extern off_t lseek(int, off_t, int); +#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(__EXTENSIONS__) +extern int nice(int); +#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int mincore(caddr_t, size_t, char *); +#endif +extern long pathconf(const char *, int); +extern int pause(void); +extern int pipe(int *); +#if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern ssize_t pread(int, void *, size_t, off_t); +#endif +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern void profil(unsigned short *, size_t, unsigned long, unsigned int); +#endif +/* + * pthread_atfork() is also declared in <pthread.h> as per SUSv3. The + * declarations are identical. A change to either one may also require + * appropriate namespace updates in order to avoid redeclaration + * warnings in the case where both prototypes are exposed via inclusion + * of both <pthread.h> and <unistd.h>. + */ +#if !defined(__XOPEN_OR_POSIX) || \ + ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \ + defined(__EXTENSIONS__) +extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void)); +#endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */ +#if !defined(_LP64) && \ + (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)) +extern int ptrace(int, pid_t, int, int); +#endif +#if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern ssize_t pwrite(int, const void *, size_t, off_t); +#endif +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +/* per RFC 3542; This is also defined in netdb.h */ +extern int rcmd_af(char **, unsigned short, const char *, const char *, + const char *, int *, int); +#endif +extern ssize_t read(int, void *, size_t); +#if !defined(__XOPEN_OR_POSIX) || \ + defined(_XPG4_2) || defined(__EXTENSIONS__) +extern ssize_t readlink(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD, + size_t); +#endif +#if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \ + defined(__EXTENSIONS__) +extern int rename(const char *, const char *); +#endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ + defined(__EXTENSIONS__) +extern int renameat(int, const char *, int, const char *); +#endif /* !defined(__XOPEN_OR_POSIX || defined(_ATFILE_SOURCE)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int resolvepath(const char *, char *, size_t); +/* per RFC 3542; This is also defined in netdb.h */ +extern int rexec_af(char **, unsigned short, const char *, const char *, + const char *, int *, int); +#endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ +extern int rmdir(const char *); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +/* per RFC 3542; This is also defined in netdb.h */ +extern int rresvport_af(int *, int); +#endif + +#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ + defined(__EXTENSIONS__) +extern void *sbrk(intptr_t); +#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) +extern int setegid(gid_t); +extern int seteuid(uid_t); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ +extern int setgid(gid_t); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int setgroups(int, const gid_t *); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +extern int setpgid(pid_t, pid_t); +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern pid_t setpgrp(void); +extern int setregid(gid_t, gid_t); +extern int setreuid(uid_t, uid_t); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +extern pid_t setsid(void); +extern int setuid(uid_t); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern void setusershell(void); +#endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ +extern unsigned sleep(unsigned); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int stime(const time_t *); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if defined(_XPG4) +/* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */ +extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, ssize_t); +#endif /* defined(_XPG4) */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int symlink(const char *, const char *); +extern void sync(void); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ +#if defined(_XPG5) && !defined(_XPG6) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname sysconf __sysconf_xpg5 +#else /* __PRAGMA_REDEFINE_EXTNAME */ +#define sysconf __sysconf_xpg5 +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* defined(_XPG5) && !defined(_XPG6) */ +extern long sysconf(int); +extern pid_t tcgetpgrp(int); +extern int tcsetpgrp(int, pid_t); +#if !defined(__XOPEN_OR_POSIX) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern off_t tell(int); +#endif /* !defined(__XOPEN_OR_POSIX)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern int truncate(const char *, off_t); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +extern char *ttyname(int); +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern useconds_t ualarm(useconds_t, useconds_t); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +extern int unlink(const char *); +#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ + defined(__EXTENSIONS__) +extern int unlinkat(int, const char *, int); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int usleep(useconds_t); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern pid_t vfork(void); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern void vhangup(void); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +extern ssize_t write(int, const void *, size_t); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern void yield(void); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ + +/* transitional large file interface versions */ +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern int ftruncate64(int, off64_t); +extern off64_t lseek64(int, off64_t, int); +extern ssize_t pread64(int, void *, size_t, off64_t); +extern ssize_t pwrite64(int, const void *, size_t, off64_t); +extern off64_t tell64(int); +extern int truncate64(const char *, off64_t); +extern int lockf64(int, int, off64_t); +#endif /* _LARGEFILE64_SOURCE */ + +#else /* __STDC__ */ + +extern int access(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int acct(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +extern unsigned alarm(); +#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ + defined(__EXTENSIONS__) +extern int brk(); +#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ +extern int chdir(); +extern int chown(); +#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(__EXTENSIONS__) +extern int chroot(); +#endif /* (!defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ +extern int close(); +#if defined(_XPG4) || defined(__EXTENSIONS__) +extern size_t confstr(); +extern char *crypt(); +#endif /* defined(XPG4) || defined(__EXTENSIONS__) */ +#if !defined(_POSIX_C_SOURCE) || defined(_XPG3) || defined(__EXTENSIONS__) +extern char *ctermid(); +#endif /* (!defined(_POSIX_C_SOURCE) || defined(_XPG3)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS_) +extern char *ctermid_r(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */ +#if !defined(_XPG6) || defined(__EXTENSIONS__) +extern char *cuserid(); +#endif +extern int dup(); +extern int dup2(); +#if defined(_XPG4) || defined(__EXTENSIONS__) +extern void encrypt(); +#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern void endusershell(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +extern int execl(); +extern int execle(); +extern int execlp(); +extern int execv(); +extern int execve(); +extern int execvp(); +extern void _exit(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int fattach(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int fchdir(); +extern int fchown(); +#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ + defined(__EXTENSIONS__) +extern int fchownat(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int fchroot(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ + defined(__EXTENSIONS__) +extern int fdatasync(); +#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ +#if !defined(__XOPEN_OR_POSIX) +extern int fdetach(); +#endif /* !defined(__XOPEN_OR_POSIX) */ +extern pid_t fork(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern pid_t fork1(); +extern pid_t forkall(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +extern long fpathconf(); +#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \ + defined(__EXTENSIONS__) +extern int fsync(); +#endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */ +#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern int ftruncate(); +#endif /* !defined(__XOPEN_OR_POSIX) (_POSIX_C_SOURCE > 2)... */ +extern char *getcwd(); +#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ + defined(__EXTENSIONS__) +extern int getdtablesize(); +#endif +extern gid_t getegid(); +extern uid_t geteuid(); +extern gid_t getgid(); +extern int getgroups(); +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern long gethostid(); +#endif +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int gethostname(); +#endif +extern char *getlogin(); +#if defined(_XPG4) || defined(__EXTENSIONS__) +extern int getopt(); +extern char *optarg; +extern int opterr, optind, optopt; +#if !defined(_XPG6) || defined(__EXTENSIONS__) +extern char *getpass(); +#endif +#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +#if !defined(_XPG6) || defined(__EXTENSIONS__) +extern int getpagesize(); +#endif +extern pid_t getpgid(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +extern pid_t getpid(); +extern pid_t getppid(); +extern pid_t getpgrp(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +char *gettxt(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern pid_t getsid(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ +extern uid_t getuid(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern char *getusershell(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern char *getwd(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int ioctl(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int isaexec(); +extern int issetugid(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +extern int isatty(); +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int lchown(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ +extern int link(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern offset_t llseek(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern int lockf(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +extern off_t lseek(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int mincore(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ + defined(__EXTENSIONS__) +extern int nice(); +#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ +extern long pathconf(); +extern int pause(); +extern int pipe(); +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern ssize_t pread(); +#endif +#if !defined(_LP64) && \ + (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)) +extern void profil(); +extern int ptrace(); +#endif +#if !defined(__XOPEN_OR_POSIX) || \ + ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \ + defined(__EXTENSIONS__) +extern int pthread_atfork(); +#endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern ssize_t pwrite(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG5) */ +extern ssize_t read(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +/* per RFC 3542; This is also defined in netdb.h */ +extern int rcmd_af(); +#endif +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern ssize_t readlink(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +#if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \ + defined(__EXTENSIONS__) +extern int rename(); +#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ + defined(__EXTENSIONS__) +extern int renameat(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ +#endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int resolvepath(); +/* per RFC 3542; This is also defined in netdb.h */ +extern int rexec_af(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +extern int rmdir(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +/* per RFC 3542; This is also defined in netdb.h */ +extern int rresvport_af(); +#endif +#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ + defined(__EXTENSIONS__) +extern void *sbrk(); +#endif /* !defined(__XOPEN_OR_POSIX)|| (defined(_XPG4_2)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) +extern int setegid(); +extern int seteuid(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ +extern int setgid(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int setgroups(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +extern int setpgid(); +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern pid_t setpgrp(); +extern int setregid(); +extern int setreuid(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +extern pid_t setsid(); +extern int setuid(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern void setusershell(); +#endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ +extern unsigned sleep(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int stime(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#if defined(_XPG4) +/* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */ +extern void swab(); +#endif /* defined(_XPG4) */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int symlink(); +extern void sync(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +#if defined(_XPG5) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname sysconf __sysconf_xpg5 +extern long sysconf(); +#else /* __PRAGMA_REDEFINE_EXTNAME */ +extern long __sysconf_xpg5(); +#define sysconf __sysconf_xpg5 +#endif /* __PRAGMA_REDEFINE_EXTNAME */ +#endif /* defined(_XPG5) */ +extern pid_t tcgetpgrp(); +extern int tcsetpgrp(); +#if !defined(__XOPEN_OR_POSIX) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern off_t tell(); +#endif /* !defined(__XOPEN_OR_POSIX)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ + (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ + defined(__EXTENSIONS__) +extern int truncate(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +extern char *ttyname(); +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern useconds_t ualarm(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +extern int unlink(); +#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ + defined(__EXTENSIONS__) +extern int unlinkat(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int usleep(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) +extern pid_t vfork(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern void vhangup(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +extern ssize_t write(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern void yield(); +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ + +/* transitional large file interface versions */ +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern int ftruncate64(); +extern off64_t lseek64(); +extern ssize_t pread64(); +extern ssize_t pwrite64(); +extern off64_t tell64(); +extern int truncate64(); +extern int lockf64(); +#endif /* _LARGEFILE64_SOURCE */ + +#endif /* __STDC__ */ + +/* + * This atrocity is necessary on sparc because registers modified + * by the child get propagated back to the parent via the window + * save/restore mechanism. + */ +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +#if defined(__sparc) +#pragma unknown_control_flow(vfork) +#endif +#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ + +/* + * getlogin_r() & ttyname_r() prototypes are defined here. + */ + +/* + * Previous releases of Solaris, starting at 2.3, provided definitions of + * various functions as specified in POSIX.1c, Draft 6. For some of these + * functions, the final POSIX 1003.1c standard had a different number of + * arguments and return values. + * + * The following segment of this header provides support for the standard + * interfaces while supporting applications written under earlier + * releases. The application defines appropriate values of the feature + * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate + * whether it was written to expect the Draft 6 or standard versions of + * these interfaces, before including this header. This header then + * provides a mapping from the source version of the interface to an + * appropriate binary interface. Such mappings permit an application + * to be built from libraries and objects which have mixed expectations + * of the definitions of these functions. + * + * For applications using the Draft 6 definitions, the binary symbol is the + * same as the source symbol, and no explicit mapping is needed. For the + * standard interface, the function func() is mapped to the binary symbol + * _posix_func(). The preferred mechanism for the remapping is a compiler + * #pragma. If the compiler does not provide such a #pragma, the header file + * defines a static function func() which calls the _posix_func() version; + * this has to be done instead of #define since POSIX specifies that an + * application can #undef the symbol and still be bound to the correct + * implementation. Unfortunately, the statics confuse lint so we fallback to + * #define in that case. + * + * NOTE: Support for the Draft 6 definitions is provided for compatibility + * only. New applications/libraries should use the standard definitions. + */ + +#if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ + !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L) || \ + defined(_POSIX_PTHREAD_SEMANTICS) + +#if defined(__STDC__) + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname getlogin_r __posix_getlogin_r +#pragma redefine_extname ttyname_r __posix_ttyname_r +extern int getlogin_r(char *, int); +extern int ttyname_r(int, char *, size_t); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern int __posix_getlogin_r(char *, int); +extern int __posix_ttyname_r(int, char *, size_t); + +#ifdef __lint + +#define getlogin_r __posix_getlogin_r +#define ttyname_r __posix_ttyname_r + +#else /* !__lint */ + +static int +getlogin_r(char *__name, int __len) +{ + return (__posix_getlogin_r(__name, __len)); +} +static int +ttyname_r(int __fildes, char *__buf, size_t __size) +{ + return (__posix_ttyname_r(__fildes, __buf, __size)); +} + +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern char *getlogin_r(char *, int); +extern char *ttyname_r(int, char *, int); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +#else /* __STDC__ */ + +#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname getlogin_r __posix_getlogin_r +#pragma redefine_extname ttyname_r __posix_ttyname_r +extern int getlogin_r(); +extern int ttyname_r(); +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +extern int __posix_getlogin_r(); +extern int __posix_ttyname_r(); + +#ifdef __lint + +#define getlogin_r __posix_getlogin_r +#define ttyname_r __posix_ttyname_r + +#else /* !__lint */ + +static int +getlogin_r(__name, __len) + char *__name; + int __len; +{ + return (__posix_getlogin_r(__name, __len)); +} +static int +ttyname_r(__fildes, __buf, __size) + int __fildes; + char *__buf; + size_t __size; +{ + return (__posix_ttyname_r(__fildes, __buf, __size)); +} +#endif /* !__lint */ +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +extern char *getlogin_r(); +extern char *ttyname_r(); + +#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ + +#endif /* __STDC__ */ + +#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _UNISTD_H */ diff --git a/usr/src/head/user_attr.h b/usr/src/head/user_attr.h new file mode 100644 index 0000000000..2f79d937fd --- /dev/null +++ b/usr/src/head/user_attr.h @@ -0,0 +1,144 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _USER_ATTR_H +#define _USER_ATTR_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + + +#include <sys/types.h> +#include <secdb.h> + + +struct __FILE; /* structure tag for type FILE defined in stdio.h */ + +/* + * Some macros used internally by the nsswitch code + */ +#define USERATTR_FILENAME "/etc/user_attr" +#define USERATTR_DB_NAME "user_attr.org_dir" +#define USERATTR_DB_NCOL 5 /* total columns */ +#define USERATTR_DB_NKEYCOL 2 /* total searchable columns */ +#define USERATTR_DB_TBL "user_attr_tbl" +#define USERATTR_NAME_DEFAULT_KW "nobody" + +#define USERATTR_COL0_KW "name" +#define USERATTR_COL1_KW "qualifier" +#define USERATTR_COL2_KW "res1" +#define USERATTR_COL3_KW "res2" +#define USERATTR_COL4_KW "attr" + +#define DEF_LIMITPRIV "PRIV_LIMIT=" +#define DEF_DFLTPRIV "PRIV_DEFAULT=" + +/* + * indices of searchable columns + */ +#define USERATTR_KEYCOL0 0 /* name */ +#define USERATTR_KEYCOL1 1 /* qualifier */ + +/* + * Key words used in the user_attr database + */ +#define USERATTR_LOCK_KW "lock" +#define USERATTR_LOCK_LOCKED_KW "locked" +#define USERATTR_LOCK_OPEN_KW "open" +#define USERATTR_LOCK_FIXED_KW "fixed" +#define USERATTR_GEN_KW "gen" +#define USERATTR_GEN_AUTOMATIC_KW "automatic" +#define USERATTR_GEN_MANUAL_KW "manual" +#define USERATTR_GEN_SYSDEF_KW "sysdef" +#define USERATTR_PROFILES_KW "profiles" +#define USERATTR_PROFILES_NONE_KW "none" +#define USERATTR_ROLES_KW "roles" +#define USERATTR_ROLES_NONE_KW "none" +#define USERATTR_DEFAULTPROJ_KW "project" +#define USERATTR_IDLETIME_KW "idletime" +#define USERATTR_IDLECMD_KW "idlecmd" +#define USERATTR_IDLECMD_LOCK_KW "lock" +#define USERATTR_IDLECMD_LOGOUT_KW "logout" +#define USERATTR_TYPE_KW "type" +#define USERATTR_TYPE_NORMAL_KW "normal" +#define USERATTR_TYPE_ADMIN_KW "admin" +#define USERATTR_TYPE_NONADMIN_KW "role" +#define USERATTR_AUTHS_KW "auths" +#define USERATTR_LIMPRIV_KW "limitpriv" +#define USERATTR_DFLTPRIV_KW "defaultpriv" +#define USERATTR_LOCK_AFTER_RETRIES_KW "lock_after_retries" + + +/* + * Nsswitch representation of user attributes. + */ +typedef struct userstr_s { + char *name; /* user name */ + char *qualifier; /* reserved for future use */ + char *res1; /* reserved for future use */ + char *res2; /* reserved for future use */ + char *attr; /* string of key-value pair attributes */ +} userstr_t; + +/* + * API representation of user attributes. + */ +typedef struct userattr_s { + char *name; /* user name */ + char *qualifier; /* reserved for future use */ + char *res1; /* reserved for future use */ + char *res2; /* reserved for future use */ + kva_t *attr; /* array of key-value pair attributes */ +} userattr_t; + +#ifdef __STDC__ +extern userattr_t *getusernam(const char *); +extern userattr_t *getuseruid(uid_t uid); +extern userattr_t *getuserattr(void); +extern userattr_t *fgetuserattr(struct __FILE *); +extern void setuserattr(void); +extern void enduserattr(void); +extern void free_userattr(userattr_t *); + +#else /* not __STDC__ */ + +extern userattr_t *getusernam(); +extern userattr_t *getuseruid(); +extern userattr_t *getuserattr(); +extern userattr_t *fgetuserattr(); +extern void setuserattr(); +extern void enduserattr(); +extern void free_userattr(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _USER_ATTR_H */ diff --git a/usr/src/head/userdefs.h b/usr/src/head/userdefs.h new file mode 100644 index 0000000000..7c6407cd17 --- /dev/null +++ b/usr/src/head/userdefs.h @@ -0,0 +1,172 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ifndef _USERDEFS_H +#define _USERDEFS_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7.1.1 */ + +#include <project.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The definitions in this file are local to the OA&M subsystem. General + * use is not encouraged. + */ + +/* User/group default values */ +#define DEFGID 99 /* max reserved group id */ +#define DEFRID 99 +#define DEFPROJ 3 +#define DEFPROJNAME "default" +#define DEFGROUP 1 +#define DEFGNAME "other" +#define DEFPARENT "/home" +#define DEFSKL "/etc/skel" +#define DEFSHL "/bin/sh" +#define DEFROLESHL "/bin/pfsh" +#define DEFINACT 0 +#define DEFEXPIRE "" +#define DEFAUTH "" +#define DEFPROF "" +#define DEFROLEPROF "All" +#define DEFROLE "" +#define DEFLIMPRIV "" +#define DEFDFLTPRIV "" +#define DEFLOCK_AFTER_RETRIES "" + +/* Defaults file keywords */ +#define RIDSTR "defrid=" +#define GIDSTR "defgroup=" +#define GNAMSTR "defgname=" +#define PARSTR "defparent=" +#define SKLSTR "defskel=" +#define SHELLSTR "defshell=" +#define INACTSTR "definact=" +#define EXPIRESTR "defexpire=" +#define AUTHSTR "defauthorization=" +#define PROFSTR "defprofile=" +#define ROLESTR "defrole=" +#define PROJSTR "defproj=" +#define PROJNMSTR "defprojname=" +#define LIMPRSTR "deflimitpriv=" +#define DFLTPRSTR "defdefaultpriv=" +#define FHEADER "# Default values for useradd. Changed " +#define FHEADER_ROLE "# Default values for roleadd. Changed " +#define LOCK_AFTER_RETRIESSTR "deflock_after_retries=" + +/* Defaults file */ +#define DEFFILE "/usr/sadm/defadduser" +#define DEFROLEFILE "/usr/sadm/defaddrole" +#define GROUP "/etc/group" + +/* various limits */ +#define MAXGLEN 9 /* max length of group name */ +#define MAXDLEN 80 /* max length of a date string */ + +/* defaults structure */ +struct userdefs { + int defrid; /* highest reserved uid */ + int defgroup; /* default group id */ + char *defgname; /* default group name */ + char *defparent; /* default base directory for new logins */ + char *defskel; /* default skel directory */ + char *defshell; /* default shell */ + int definact; /* default inactive */ + char *defexpire; /* default expire date */ + char *defauth; /* default authorization */ + char *defprof; /* default profile */ + char *defrole; /* default role */ + projid_t defproj; /* default project id */ + char *defprojname; /* default project name */ + char *deflimpriv; /* default limitpriv */ + char *defdfltpriv; /* default defaultpriv */ + char *deflock_after_retries; /* default lock_after_retries */ + +}; + +/* exit() values for user/group commands */ + +/* Everything succeeded */ +#define EX_SUCCESS 0 + +/* No permission */ +#define EX_NO_PERM 1 + +/* Command syntax error */ +#define EX_SYNTAX 2 + +/* Invalid argument given */ +#define EX_BADARG 3 + +/* A gid or uid already exists */ +#define EX_ID_EXISTS 4 + +/* PASSWD and SHADOW are inconsistent with each other */ +#define EX_INCONSISTENT 5 + +/* A group or user name doesn't exist */ +#define EX_NAME_NOT_EXIST 6 + +/* GROUP, PASSWD, or SHADOW file missing */ +#define EX_MISSING 7 + +/* GROUP, PASSWD, or SHAWOW file is busy */ +#define EX_BUSY 8 + +/* A group or user name already exists */ +#define EX_NAME_EXISTS 9 + +/* Unable to update GROUP, PASSWD, or SHADOW file */ +#define EX_UPDATE 10 + +/* Not enough space */ +#define EX_NOSPACE 11 + +/* Unable to create/remove/move home directory */ +#define EX_HOMEDIR 12 + +/* new login already in use */ +#define EX_NL_USED 13 + +/* Unexpected failure */ +#define EX_FAILURE 14 + +/* A user name is in a non-local name service */ +#define EX_NOT_LOCAL 15 + +#ifdef __cplusplus +} +#endif + +#endif /* _USERDEFS_H */ diff --git a/usr/src/head/ustat.h b/usr/src/head/ustat.h new file mode 100644 index 0000000000..b198e8f502 --- /dev/null +++ b/usr/src/head/ustat.h @@ -0,0 +1,48 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _USTAT_H +#define _USTAT_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3.1.6 */ + +#include <sys/types.h> +#include <sys/ustat.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) +extern int ustat(dev_t, struct ustat *); +#else +extern int ustat(); +#endif /* end defined(_STDC) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _USTAT_H */ diff --git a/usr/src/head/utime.h b/usr/src/head/utime.h new file mode 100644 index 0000000000..a39c702486 --- /dev/null +++ b/usr/src/head/utime.h @@ -0,0 +1,49 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* utimbuf is used by utime(2) */ + +#ifndef _UTIME_H +#define _UTIME_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */ + +#include <sys/utime.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) +extern int utime(const char *, const struct utimbuf *); +#else +extern int utime(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _UTIME_H */ diff --git a/usr/src/head/utmp.h b/usr/src/head/utmp.h new file mode 100644 index 0000000000..5784a98bf6 --- /dev/null +++ b/usr/src/head/utmp.h @@ -0,0 +1,178 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + + +#ifndef _UTMP_H +#define _UTMP_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5.1.7 */ + +/* + * Note: The getutent(3c) family of interfaces are obsolete. + * The getutxent(3c) family provide a superset of this functionality + * and should be used in place of getutent(3c). + */ + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +#define UTMP_FILE "/var/adm/utmp" +#define WTMP_FILE "/var/adm/wtmp" +#endif + +#define ut_name ut_user + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +struct exit_status { + short e_termination; /* Process termination status */ + short e_exit; /* Process exit status */ +}; +#else +struct ut_exit_status { + short ut_e_termination; /* Process termination status */ + short ut_e_exit; /* Process exit status */ +}; +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) + +/* + * This data structure describes the utmp entries returned by + * the getutent(3c) family of APIs. It does not (necessarily) + * correspond to the contents of the utmp or wtmp files. + * + * Applications should only interact with this subsystem via + * the getutxent(3c) family of APIs, as the getutent(3c) family + * are obsolete. + */ +struct utmp { + char ut_user[8]; /* User login name */ + char ut_id[4]; /* /etc/inittab id(usually line #) */ + char ut_line[12]; /* device name (console, lnxx) */ + short ut_pid; /* short for compat. - process id */ + short ut_type; /* type of entry */ + struct exit_status ut_exit; /* The exit status of a process */ + /* marked as DEAD_PROCESS. */ + time_t ut_time; /* time entry was made */ +}; + +#include <sys/types32.h> +#include <inttypes.h> + +/* + * This data structure describes the utmp *file* contents using + * fixed-width data types. It should only be used by the implementation. + * + * Applications should use the getutxent(3c) family of routines to interact + * with this database. + */ + +struct futmp { + char ut_user[8]; /* User login name */ + char ut_id[4]; /* /etc/inittab id */ + char ut_line[12]; /* device name (console, lnxx) */ + int16_t ut_pid; /* process id */ + int16_t ut_type; /* type of entry */ + struct { + int16_t e_termination; /* Process termination status */ + int16_t e_exit; /* Process exit status */ + } ut_exit; /* The exit status of a process */ + time32_t ut_time; /* time entry was made */ +}; + +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +/* Definitions for ut_type */ + +#define EMPTY 0 +#define RUN_LVL 1 +#define BOOT_TIME 2 +#define OLD_TIME 3 +#define NEW_TIME 4 +#define INIT_PROCESS 5 /* Process spawned by "init" */ +#define LOGIN_PROCESS 6 /* A "getty" process waiting for login */ +#define USER_PROCESS 7 /* A user process */ +#define DEAD_PROCESS 8 + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) + +#define ACCOUNTING 9 +#define DOWN_TIME 10 + +#define UTMAXTYPE DOWN_TIME /* Largest legal value of ut_type */ + +/* Special strings or formats used in the "ut_line" field when */ +/* accounting for something other than a process. */ +/* No string for the ut_line field can be more than 11 chars + */ +/* a NULL in length. */ + +#define RUNLVL_MSG "run-level %c" +#define BOOT_MSG "system boot" +#define OTIME_MSG "old time" +#define NTIME_MSG "new time" +#define PSRADM_MSG "%03d %s" /* processor on or off */ +#define DOWN_MSG "system down" + +/* Define and macro for determing if a normal user wrote the entry */ +/* and marking the utmpx entry as a normal user */ +#define NONROOT_USR 2 +#define nonuser(ut) ((ut).ut_exit.e_exit == NONROOT_USR ? 1 : 0) +#define setuser(ut) ((ut).ut_exit.e_exit = NONROOT_USR) + + +#if defined(__STDC__) +extern void endutent(void); +extern struct utmp *getutent(void); +extern struct utmp *getutid(const struct utmp *); +extern struct utmp *getutline(const struct utmp *); +extern struct utmp *pututline(const struct utmp *); +extern void setutent(void); +extern int utmpname(const char *); +#else +extern void endutent(); +extern struct utmp *getutent(); +extern struct utmp *getutid(); +extern struct utmp *getutline(); +extern struct utmp *pututline(); +extern void setutent(); +extern int utmpname(); +#endif + +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _UTMP_H */ diff --git a/usr/src/head/utmpx.h b/usr/src/head/utmpx.h new file mode 100644 index 0000000000..fe2dbd83e7 --- /dev/null +++ b/usr/src/head/utmpx.h @@ -0,0 +1,174 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _UTMPX_H +#define _UTMPX_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/types.h> +#include <sys/time.h> +#include <utmp.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define _UTMPX_FILE "/var/adm/utmpx" +#define _WTMPX_FILE "/var/adm/wtmpx" +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +#define UTMPX_FILE _UTMPX_FILE +#define WTMPX_FILE _WTMPX_FILE +#endif + +#define ut_name ut_user +#define ut_xtime ut_tv.tv_sec + +/* + * This data structure describes the utmpx entries returned by + * the getutxent(3c) family of APIs. It does not (necessarily) + * correspond to the contents of the utmpx or wtmpx files. + * + * Applications should only interact with this subsystem via + * the getutxent(3c) family of APIs. + */ +struct utmpx { + char ut_user[32]; /* user login name */ + char ut_id[4]; /* inittab id */ + char ut_line[32]; /* device name (console, lnxx) */ + pid_t ut_pid; /* process id */ + short ut_type; /* type of entry */ +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) + struct exit_status ut_exit; /* process termination/exit status */ +#else + struct ut_exit_status ut_exit; /* process termination/exit status */ +#endif + struct timeval ut_tv; /* time entry was made */ + int ut_session; /* session ID, used for windowing */ +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) + int pad[5]; /* reserved for future use */ +#else + int __pad[5]; /* reserved for future use */ +#endif + short ut_syslen; /* significant length of ut_host */ + /* including terminating null */ + char ut_host[257]; /* remote host name */ +}; + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) + +#include <sys/types32.h> +#include <inttypes.h> + +/* + * This data structure describes the utmp *file* contents using + * fixed-width data types. It should only be used by the implementation. + * + * Applications should use the getutxent(3c) family of routines to interact + * with this database. + */ + +struct futmpx { + char ut_user[32]; /* user login name */ + char ut_id[4]; /* inittab id */ + char ut_line[32]; /* device name (console, lnxx) */ + pid32_t ut_pid; /* process id */ + int16_t ut_type; /* type of entry */ + struct { + int16_t e_termination; /* process termination status */ + int16_t e_exit; /* process exit status */ + } ut_exit; /* exit status of a process */ + struct timeval32 ut_tv; /* time entry was made */ + int32_t ut_session; /* session ID, user for windowing */ + int32_t pad[5]; /* reserved for future use */ + int16_t ut_syslen; /* significant length of ut_host */ + char ut_host[257]; /* remote host name */ +}; + +#define MOD_WIN 10 + +/* Define and macro for determing if a normal user wrote the entry */ +/* and marking the utmpx entry as a normal user */ +#define NONROOT_USRX 2 +#define nonuserx(utx) ((utx).ut_exit.e_exit == NONROOT_USRX ? 1 : 0) +#define setuserx(utx) ((utx).ut_exit.e_exit = NONROOT_USRX) + +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#if defined(__STDC__) + +extern void endutxent(void); +extern struct utmpx *getutxent(void); +extern struct utmpx *getutxid(const struct utmpx *); +extern struct utmpx *getutxline(const struct utmpx *); +extern struct utmpx *pututxline(const struct utmpx *); +extern void setutxent(void); + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int utmpxname(const char *); +extern struct utmpx *makeutx(const struct utmpx *); +extern struct utmpx *modutx(const struct utmpx *); +extern void getutmp(const struct utmpx *, struct utmp *); +extern void getutmpx(const struct utmp *, struct utmpx *); +extern void updwtmp(const char *, struct utmp *); +extern void updwtmpx(const char *, struct utmpx *); +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#else /* __STDC__ */ + +extern void endutxent(); +extern struct utmpx *getutxent(); +extern struct utmpx *getutxid(); +extern struct utmpx *getutxline(); +extern struct utmpx *pututxline(); +extern void setutxent(); + +#if !defined(_XPG4_2) || defined(__EXTENSIONS__) +extern int utmpxname(); +extern struct utmpx *makeutx(); +extern struct utmpx *modutx(); +extern void getutmp(); +extern void getutmpx(); +extern void updwtmp(); +extern void updwtmpx(); +#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _UTMPX_H */ diff --git a/usr/src/head/uuid/uuid.h b/usr/src/head/uuid/uuid.h new file mode 100644 index 0000000000..570a2c0912 --- /dev/null +++ b/usr/src/head/uuid/uuid.h @@ -0,0 +1,77 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _UUID_H +#define _UUID_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The copyright in this file is taken from the original Leach & Salz + * UUID specification, from which this implementation is derived. + */ + +/* + * Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. + * Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & + * Digital Equipment Corporation, Maynard, Mass. Copyright (c) 1998 + * Microsoft. To anyone who acknowledges that this file is provided + * "AS IS" without any express or implied warranty: permission to use, + * copy, modify, and distribute this file for any purpose is hereby + * granted without fee, provided that the above copyright notices and + * this notice appears in all source code copies, and that none of the + * names of Open Software Foundation, Inc., Hewlett-Packard Company, + * or Digital Equipment Corporation be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. Neither Open Software + * Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital + * Equipment Corporation makes any representations about the + * suitability of this software for any purpose. + */ + +#include <sys/types.h> +#include <sys/uuid.h> + +extern void uuid_generate(uuid_t); +extern void uuid_generate_random(uuid_t); +extern void uuid_generate_time(uuid_t); +extern void uuid_copy(uuid_t, uuid_t); +extern void uuid_clear(uuid_t); +extern void uuid_unparse(uuid_t, char *); +extern int uuid_compare(uuid_t, uuid_t); +extern int uuid_is_null(uuid_t); +extern int uuid_parse(char *, uuid_t); +extern time_t uuid_time(uuid_t, struct timeval *); + +#ifdef __cplusplus +} +#endif + +#endif /* _UUID_H */ diff --git a/usr/src/head/valtools.h b/usr/src/head/valtools.h new file mode 100644 index 0000000000..933ae91eac --- /dev/null +++ b/usr/src/head/valtools.h @@ -0,0 +1,75 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 */ + + +#ifndef _VALTOOLS_H +#define _VALTOOLS_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct _choice_ { + char *token; + char *text; + struct _choice_ *next; +}; + +struct _menu_ { + char *label; + int attr; + short longest; + short nchoices; + struct _choice_ + *choice; + char **invis; +}; + +typedef struct _menu_ CKMENU; + +#define P_ABSOLUTE 0x0001 +#define P_RELATIVE 0x0002 +#define P_EXIST 0x0004 +#define P_NEXIST 0x0008 +#define P_REG 0x0010 +#define P_DIR 0x0020 +#define P_BLK 0x0040 +#define P_CHR 0x0080 +#define P_NONZERO 0x0100 +#define P_READ 0x0200 +#define P_WRITE 0x0400 +#define P_EXEC 0x0800 +#define P_CREAT 0x1000 + +#define CKUNNUM 0x01 +#define CKALPHA 0x02 +#define CKONEFLAG 0x04 + +#ifdef __cplusplus +} +#endif + +#endif /* _VALTOOLS_H */ diff --git a/usr/src/head/values.h b/usr/src/head/values.h new file mode 100644 index 0000000000..848981ccdb --- /dev/null +++ b/usr/src/head/values.h @@ -0,0 +1,151 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _VALUES_H +#define _VALUES_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.33 */ + +#include <sys/isa_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * These values work with any binary representation of integers + * where the high-order bit contains the sign. + */ + +/* a number used normally for size of a shift */ +#define BITSPERBYTE 8 + +#define BITS(type) (BITSPERBYTE * (long)sizeof (type)) + +/* short, regular and long ints with only the high-order bit turned on */ +#define HIBITS ((short)(1 << (BITS(short) - 1))) + +#if defined(__STDC__) + +#define HIBITI (1U << (BITS(int) - 1)) +#define HIBITL (1UL << (BITS(long) - 1)) + +#else + +#define HIBITI ((unsigned)1 << (BITS(int) - 1)) +#define HIBITL (1L << (BITS(long) - 1)) + +#endif + +/* largest short, regular and long int */ +#define MAXSHORT ((short)~HIBITS) +#define MAXINT ((int)(~HIBITI)) +#define MAXLONG ((long)(~HIBITL)) + +/* + * various values that describe the binary floating-point representation + * _EXPBASE - the exponent base + * DMAXEXP - the maximum exponent of a double (as returned by frexp()) + * FMAXEXP - the maximum exponent of a float (as returned by frexp()) + * DMINEXP - the minimum exponent of a double (as returned by frexp()) + * FMINEXP - the minimum exponent of a float (as returned by frexp()) + * MAXDOUBLE - the largest double + * ((_EXPBASE ** DMAXEXP) * (1 - (_EXPBASE ** -DSIGNIF))) + * MAXFLOAT - the largest float + * ((_EXPBASE ** FMAXEXP) * (1 - (_EXPBASE ** -FSIGNIF))) + * MINDOUBLE - the smallest double (_EXPBASE ** (DMINEXP - 1)) + * MINFLOAT - the smallest float (_EXPBASE ** (FMINEXP - 1)) + * DSIGNIF - the number of significant bits in a double + * FSIGNIF - the number of significant bits in a float + * DMAXPOWTWO - the largest power of two exactly representable as a double + * FMAXPOWTWO - the largest power of two exactly representable as a float + * _IEEE - 1 if IEEE standard representation is used + * _DEXPLEN - the number of bits for the exponent of a double + * _FEXPLEN - the number of bits for the exponent of a float + * _HIDDENBIT - 1 if high-significance bit of mantissa is implicit + * LN_MAXDOUBLE - the natural log of the largest double -- log(MAXDOUBLE) + * LN_MINDOUBLE - the natural log of the smallest double -- log(MINDOUBLE) + * LN_MAXFLOAT - the natural log of the largest float -- log(MAXFLOAT) + * LN_MINFLOAT - the natural log of the smallest float -- log(MINFLOAT) + */ + +/* + * Currently, only IEEE-754 format is supported. + */ +#if defined(_IEEE_754) +#define MAXDOUBLE 1.79769313486231570e+308 +#define MAXFLOAT ((float)3.40282346638528860e+38) +#define MINDOUBLE 4.94065645841246544e-324 +#define MINFLOAT ((float)1.40129846432481707e-45) +#define _IEEE 1 +#define _DEXPLEN 11 +#define _HIDDENBIT 1 +#define _LENBASE 1 +#define DMINEXP (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3)) +#define FMINEXP (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3)) +#else +/* #error is strictly ansi-C, but works as well as anything for K&R systems. */ +#error "ISA not supported" +#endif + +#define _EXPBASE (1 << _LENBASE) +#define _FEXPLEN 8 +#define DSIGNIF (BITS(double) - _DEXPLEN + _HIDDENBIT - 1) +#define FSIGNIF (BITS(float) - _FEXPLEN + _HIDDENBIT - 1) +#define DMAXPOWTWO ((double)(1 << (BITS(int) - 2)) * \ + (1 << (DSIGNIF - BITS(int) + 1))) +#define FMAXPOWTWO ((float)(1 << (FSIGNIF - 1))) +#define DMAXEXP ((1 << (_DEXPLEN - 1)) - 1 + _IEEE) +#define FMAXEXP ((1 << (_FEXPLEN - 1)) - 1 + _IEEE) +#define LN_MAXDOUBLE (M_LN2 * DMAXEXP) +#define LN_MAXFLOAT (float)(M_LN2 * FMAXEXP) +#define LN_MINDOUBLE (M_LN2 * (DMINEXP - 1)) +#define LN_MINFLOAT (float)(M_LN2 * (FMINEXP - 1)) +#define H_PREC (DSIGNIF % 2 ? (1 << DSIGNIF/2) * M_SQRT2 : 1 << DSIGNIF/2) +#define FH_PREC \ + (float)(FSIGNIF % 2 ? (1 << FSIGNIF/2) * M_SQRT2 : 1 << FSIGNIF/2) +#define X_EPS (1.0/H_PREC) +#define FX_EPS (float)((float)1.0/FH_PREC) +#define X_PLOSS ((double)(int)(M_PI * H_PREC)) +#define FX_PLOSS ((float)(int)(M_PI * FH_PREC)) +#define X_TLOSS (M_PI * DMAXPOWTWO) +#define FX_TLOSS (float)(M_PI * FMAXPOWTWO) +#define M_LN2 0.69314718055994530942 +#define M_PI 3.14159265358979323846 +#define M_SQRT2 1.41421356237309504880 +#define MAXBEXP DMAXEXP /* for backward compatibility */ +#define MINBEXP DMINEXP /* for backward compatibility */ +#define MAXPOWTWO DMAXPOWTWO /* for backward compatibility */ + +#ifdef __cplusplus +} +#endif + +#endif /* _VALUES_H */ diff --git a/usr/src/head/varargs.h b/usr/src/head/varargs.h new file mode 100644 index 0000000000..3d908c8ac8 --- /dev/null +++ b/usr/src/head/varargs.h @@ -0,0 +1,80 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _VARARGS_H +#define _VARARGS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * This header defines the pre-standard variable argument definitions. + * Programs using this header should migrate to using <stdarg.h>. + * + * The varargs definitions within this header are defined in terms of + * implementation definitions. These implementation definitions reside + * in <sys/va_impl.h>. This organization enables protected use of + * the implementation by other standard headers without introducing + * names into the users' namespace. + */ + +#include <sys/feature_tests.h> +#include <sys/va_impl.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _VA_LIST +#define _VA_LIST +typedef __va_list va_list; +#endif + +#define va_alist __builtin_va_alist +#define va_dcl __va_alist_type va_alist; +#define va_start(list) __va_start(list, va_alist) +#define va_arg(list, type) __va_arg(list, type) +#define va_end(list) __va_end(list) + +/* + * va_copy is a Solaris extension to provide a portable way to perform + * a variable argument list ``bookmarking'' function. + */ +#if defined(__EXTENSIONS__) || \ + (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) + +#define va_copy(to, from) __va_copy(to, from) + +#endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && ... ) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _VARARGS_H */ diff --git a/usr/src/head/wait.h b/usr/src/head/wait.h new file mode 100644 index 0000000000..90d8df581c --- /dev/null +++ b/usr/src/head/wait.h @@ -0,0 +1,58 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _WAIT_H +#define _WAIT_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +#include <sys/types.h> +#include <sys/siginfo.h> +#include <sys/procset.h> +#include <sys/wait.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) + +extern pid_t wait(int *); +extern pid_t waitpid(pid_t, int *, int); +extern int waitid(idtype_t, id_t, siginfo_t *, int); + +#else + +extern pid_t wait(); +extern pid_t waitpid(); +extern int waitid(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _WAIT_H */ diff --git a/usr/src/head/wchar.h b/usr/src/head/wchar.h new file mode 100644 index 0000000000..7e1c0f0dab --- /dev/null +++ b/usr/src/head/wchar.h @@ -0,0 +1,178 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _WCHAR_H +#define _WCHAR_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#include <iso/wchar_iso.h> +#include <iso/wchar_c99.h> + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/wchar_iso.h>. + */ +#if __cplusplus >= 199711L +using std::FILE; +using std::wint_t; +using std::clock_t; +using std::size_t; +using std::time_t; +using std::tm; +using std::mbstate_t; +using std::fgetwc; +using std::fgetws; +using std::fputwc; +using std::fputws; +using std::ungetwc; +using std::getwc; +using std::getwchar; +using std::putwc; +using std::putwchar; +using std::wcstod; +using std::wcstol; +using std::wcstoul; +using std::wcscat; +using std::wcschr; +using std::wcscmp; +using std::wcscoll; +using std::wcscpy; +using std::wcscspn; +using std::wcslen; +using std::wcsncat; +using std::wcsncmp; +using std::wcsncpy; +using std::wcspbrk; +using std::wcsrchr; +using std::wcsspn; +using std::wcsxfrm; +using std::wcstok; +using std::wcsftime; +/* not XPG4 and not XPG4v2 */ +#if (!defined(_XPG4) && !defined(_XPG4_2) || defined(_XPG5)) +using std::btowc; +using std::fwprintf; +using std::fwscanf; +using std::fwide; +using std::mbsinit; +using std::mbrlen; +using std::mbrtowc; +using std::mbsrtowcs; +using std::swprintf; +using std::swscanf; +using std::vfwprintf; +using std::vwprintf; +using std::vswprintf; +using std::wcrtomb; +using std::wcsrtombs; +using std::wcsstr; +using std::wctob; +using std::wmemchr; +using std::wmemcmp; +using std::wmemcpy; +using std::wmemmove; +using std::wmemset; +using std::wprintf; +using std::wscanf; +#endif /* not XPG4 and not XPG4v2 */ +#endif /* __cplusplus >= 199711L */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) +#if !defined(_WCTYPE_T) || __cplusplus >= 199711L +#define _WCTYPE_T +typedef int wctype_t; +#endif +#endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */ + +/* + * XPG6 requires that va_list be defined as defined in <stdarg.h>, + * however, inclusion of <stdarg.h> breaks Standard C namespace. + */ +#if defined(_XPG6) && !defined(_VA_LIST) +#define _VA_LIST +typedef __va_list va_list; +#endif /* defined(_XPG6) && !defined(_VA_LIST) */ + +#ifdef __STDC__ + +#if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) +extern int iswalpha(wint_t); +extern int iswupper(wint_t); +extern int iswlower(wint_t); +extern int iswdigit(wint_t); +extern int iswxdigit(wint_t); +extern int iswalnum(wint_t); +extern int iswspace(wint_t); +extern int iswpunct(wint_t); +extern int iswprint(wint_t); +extern int iswgraph(wint_t); +extern int iswcntrl(wint_t); +extern int iswctype(wint_t, wctype_t); +extern wint_t towlower(wint_t); +extern wint_t towupper(wint_t); +extern wchar_t *wcswcs(const wchar_t *, const wchar_t *); +extern int wcswidth(const wchar_t *, size_t); +extern int wcwidth(const wchar_t); +extern wctype_t wctype(const char *); +#endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */ + +#else /* __STDC__ */ + +#if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) +extern int iswalpha(); +extern int iswupper(); +extern int iswlower(); +extern int iswdigit(); +extern int iswxdigit(); +extern int iswalnum(); +extern int iswspace(); +extern int iswpunct(); +extern int iswprint(); +extern int iswgraph(); +extern int iswcntrl(); +extern int iswctype(); +extern wint_t towlower(); +extern wint_t towupper(); +extern wchar_t *wcswcs(); +extern int wcswidth(); +extern int wcwidth(); +extern wctype_t wctype(); +#endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _WCHAR_H */ diff --git a/usr/src/head/wchar_impl.h b/usr/src/head/wchar_impl.h new file mode 100644 index 0000000000..0e704a1164 --- /dev/null +++ b/usr/src/head/wchar_impl.h @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1998 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _WCHAR_IMPL_H +#define _WCHAR_IMPL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/isa_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _MBSTATET_H +#define _MBSTATET_H +typedef struct __mbstate_t { +#if defined(_LP64) + long __filler[4]; +#else + int __filler[6]; +#endif +} __mbstate_t; +#endif /* _MBSTATET_H */ + +#ifdef __cplusplus +} +#endif + +#endif /* _WCHAR_IMPL_H */ diff --git a/usr/src/head/wctype.h b/usr/src/head/wctype.h new file mode 100644 index 0000000000..532f61aaf9 --- /dev/null +++ b/usr/src/head/wctype.h @@ -0,0 +1,137 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 + */ +/* wctype.h 1.13 89/11/02 SMI; JLE */ +/* from AT&T JAE 2.1 */ +/* definitions for international functions */ + +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _WCTYPE_H +#define _WCTYPE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <iso/wctype_iso.h> +#if !defined(__XOPEN_OR_POSIX) && !defined(_STRICT_STDC) || \ + defined(__EXTENSIONS__) +#include <ctype.h> +#include <wchar.h> +#endif + +/* + * Allow global visibility for symbols defined in + * C++ "std" namespace in <iso/wctype_iso.h>. + */ +#if __cplusplus >= 199711L +using std::wint_t; +using std::wctrans_t; +using std::iswalnum; +using std::iswalpha; +using std::iswcntrl; +using std::iswdigit; +using std::iswgraph; +using std::iswlower; +using std::iswprint; +using std::iswpunct; +using std::iswspace; +using std::iswupper; +using std::iswxdigit; +using std::towlower; +using std::towupper; +using std::wctrans; +using std::towctrans; +using std::iswctype; +using std::wctype; +#endif + +/* + * This header needs to be included here because it relies on the global + * visibility of wint_t in the C++ environment. + */ + +#include <iso/wctype_c99.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* do not allow any of the following in a strictly conforming application */ +#if !defined(__XOPEN_OR_POSIX) && !defined(_STRICT_STDC) || \ + defined(__EXTENSIONS__) + +/* + * data structure for supplementary code set + * for character class and conversion + */ +struct _wctype { + wchar_t tmin; /* minimum code for wctype */ + wchar_t tmax; /* maximum code for wctype */ + unsigned char *index; /* class index */ + unsigned int *type; /* class type */ + wchar_t cmin; /* minimum code for conversion */ + wchar_t cmax; /* maximum code for conversion */ + wchar_t *code; /* conversion code */ +}; + +/* character classification functions */ + +/* iswascii is still a macro */ +#define iswascii(c) isascii(c) + +/* isw*, except iswascii(), are not macros any more. They become functions */ +#ifdef __STDC__ + +extern unsigned _iswctype(wchar_t, int); +extern wchar_t _trwctype(wchar_t, int); +/* is* also become functions */ +extern int isphonogram(wint_t); +extern int isideogram(wint_t); +extern int isenglish(wint_t); +extern int isnumber(wint_t); +extern int isspecial(wint_t); +#else + +extern unsigned _iswctype(); +extern wchar_t _trwctype(); +/* is* also become functions */ +extern int isphonogram(); +extern int isideogram(); +extern int isenglish(); +extern int isnumber(); +extern int isspecial(); +#endif + +#define iscodeset0(c) isascii(c) +#define iscodeset1(c) (((c) & WCHAR_CSMASK) == WCHAR_CS1) +#define iscodeset2(c) (((c) & WCHAR_CSMASK) == WCHAR_CS2) +#define iscodeset3(c) (((c) & WCHAR_CSMASK) == WCHAR_CS3) + +#endif /* !defined(__XOPEN_OR_POSIX)... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _WCTYPE_H */ diff --git a/usr/src/head/widec.h b/usr/src/head/widec.h new file mode 100644 index 0000000000..b0542b969b --- /dev/null +++ b/usr/src/head/widec.h @@ -0,0 +1,180 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1986 AT&T */ +/* All Rights Reserved */ + + +/* This module is created for NLS on Jun.04.86 */ + +#ifndef _WIDEC_H +#define _WIDEC_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> + +#if defined(__STDC__) +#include <stdio.h> /* For definition of FILE */ +#endif +#include <euc.h> +#include <wchar.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) +/* Character based input and output functions */ +extern wchar_t *getws(wchar_t *); +extern int putws(const wchar_t *); + +#if !defined(__lint) +#define getwc(p) fgetwc(p) +#define putwc(x, p) fputwc((x), (p)) +#define getwchar() getwc(stdin) +#define putwchar(x) putwc((x), stdout) +#endif + +/* wchar_t string operation functions */ +extern wchar_t *strtows(wchar_t *, char *); +extern wchar_t *wscpy(wchar_t *, const wchar_t *); +extern wchar_t *wsncpy(wchar_t *, const wchar_t *, size_t); +extern wchar_t *wscat(wchar_t *, const wchar_t *); +extern wchar_t *wsncat(wchar_t *, const wchar_t *, size_t); +extern wchar_t *wschr(const wchar_t *, wchar_t); +extern wchar_t *wsrchr(const wchar_t *, wchar_t); +extern wchar_t *wspbrk(const wchar_t *, const wchar_t *); +extern wchar_t *wstok(wchar_t *, const wchar_t *); +extern char *wstostr(char *, wchar_t *); + +extern int wscmp(const wchar_t *, const wchar_t *); +extern int wsncmp(const wchar_t *, const wchar_t *, size_t); +extern size_t wslen(const wchar_t *); +extern size_t wsspn(const wchar_t *, const wchar_t *); +extern size_t wscspn(const wchar_t *, const wchar_t *); +extern int wscoll(const wchar_t *, const wchar_t *); +extern size_t wsxfrm(wchar_t *, const wchar_t *, size_t); + +#if !defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX) + +extern wchar_t *wsdup(const wchar_t *); +extern int wscol(const wchar_t *); +extern double wstod(const wchar_t *, wchar_t **); +extern long wstol(const wchar_t *, wchar_t **, int); +extern int wscasecmp(const wchar_t *, const wchar_t *); +extern int wsncasecmp(const wchar_t *, const wchar_t *, size_t); +extern int wsprintf(wchar_t *, const char *, ...); +#if defined(_LONGLONG_TYPE) +extern long long wstoll(const wchar_t *, wchar_t **, int); +#endif /* defined(_LONGLONG_TYPE) */ + +#endif /* !defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX) */ + +#else /* !defined(__STDC__) */ +/* Character based input and output functions */ +extern wchar_t *getws(); +extern int putws(); + +#ifndef getwc +#define getwc(p) fgetwc(p) +#endif +#ifndef putwc +#define putwc(x, p) fputwc((x), (p)) +#endif +#ifndef getwchar +#define getwchar() getwc(stdin) +#endif +#ifndef putwchar +#define putwchar(x) putwc((x), stdout) +#endif + +/* wchar_t string operation functions */ +extern wchar_t *strtows(); +extern wchar_t *wscpy(); +extern wchar_t *wsncpy(); +extern wchar_t *wscat(); +extern wchar_t *wsncat(); +extern wchar_t *wschr(); +extern wchar_t *wsrchr(); +extern wchar_t *wspbrk(); +extern wchar_t *wstok(); + +extern int wscmp(); +extern int wsncmp(); +extern int wslen(); +extern int wsspn(); +extern int wscspn(); +extern int wscoll(); +extern int wsxfrm(); + +extern char *wstostr(); +extern wchar_t *wsdup(); +extern int wscol(); +extern double wstod(); +extern long wstol(); +extern int wscasecmp(); +extern int wsncasecmp(); +extern int wsprintf(); +#if defined(_LONGLONG_TYPE) +extern long long wstoll(); +#endif /* defined(_LONGLONG_TYPE) */ + +#endif /* !defined(__STDC__) */ + +/* Returns the code set number for the process code c. */ +#define WCHAR_SHIFT 7 +#define WCHAR_S_MASK 0x7f +#define wcsetno(c) \ + (((c)&0x20000000)?(((c)&0x10000000)?1:3):(((c)&0x10000000)?2:0)) + +/* Aliases... */ +#define windex wschr +#define wrindex wsrchr + +#define watol(s) wstol((s), (wchar_t **)0, 10) +#if defined(_LONGLONG_TYPE) && !defined(__lint) +#define watoll(s) wstoll((s), (wchar_t **)0, 10) +#endif /* defined(_LONGLONG_TYPE) && !defined(__lint) */ +#define watoi(s) ((int)wstol((s), (wchar_t **)0, 10)) +#define watof(s) wstod((s), (wchar_t **)0) + +/* + * other macros. + */ +#define WCHAR_CSMASK 0x30000000 +#define EUCMASK 0x30000000 +#define WCHAR_CS0 0x00000000 +#define WCHAR_CS1 0x30000000 +#define WCHAR_CS2 0x10000000 +#define WCHAR_CS3 0x20000000 +#define WCHAR_BYTE_OF(wc, i) (((wc&~0x30000000)>>(7*(3-i)))&0x7f) + +#ifdef __cplusplus +} +#endif + +#endif /* _WIDEC_H */ diff --git a/usr/src/head/wordexp.h b/usr/src/head/wordexp.h new file mode 100644 index 0000000000..c805a8a983 --- /dev/null +++ b/usr/src/head/wordexp.h @@ -0,0 +1,85 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright 1985, 1992 by Mortice Kern Systems Inc. All rights reserved. + */ + +#ifndef _WORDEXP_H +#define _WORDEXP_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct wordexp_t { + size_t we_wordc; /* Count of paths matched by pattern */ + char **we_wordv; /* List of matched pathnames */ + size_t we_offs; /* # of slots reserved in we_pathv */ + /* following are internal to the implementation */ + char **we_wordp; /* we_pathv + we_offs */ + int we_wordn; /* # of elements allocated */ +} wordexp_t; + +/* + * wordexp flags. + */ +#define WRDE_APPEND 0x0001 /* append to existing wordexp_t */ +#define WRDE_DOOFFS 0x0002 /* use we_offs */ +#define WRDE_NOCMD 0x0004 /* don't allow $() */ +#define WRDE_REUSE 0x0008 +#define WRDE_SHOWERR 0x0010 /* don't 2>/dev/null */ +#define WRDE_UNDEF 0x0020 /* set -u */ + +/* + * wordexp errors. + */ +#define WRDE_ERRNO (2) /* error in "errno" */ +#define WRDE_BADCHAR (3) /* shell syntax character */ +#define WRDE_BADVAL (4) /* undefined variable expanded */ +#define WRDE_CMDSUB (5) /* prohibited $() */ +#define WRDE_NOSPACE (6) /* no memory */ +#define WRDE_SYNTAX (7) /* bad syntax */ +#define WRDE_NOSYS (8) /* function not supported (XPG4) */ + +#ifdef __STDC__ +extern int wordexp(const char *_RESTRICT_KYWD, wordexp_t *_RESTRICT_KYWD, int); +extern void wordfree(wordexp_t *); +#else +extern int wordexp(); +extern void wordfree(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _WORDEXP_H */ diff --git a/usr/src/head/xti.h b/usr/src/head/xti.h new file mode 100644 index 0000000000..a757167e2a --- /dev/null +++ b/usr/src/head/xti.h @@ -0,0 +1,543 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1996 Sun Microsystems, Inc. */ +/* All Rights Reserved */ + + +#ifndef _XTI_H +#define _XTI_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> + +/* + * The following include file has declarations needed by both the kernel + * level transport providers and the user level library. This file includes + * it to expose its namespaces to XTI user level interface. + */ +#include <sys/tpicommon.h> + +/* + * Include XTI interface level options management declarations + */ +#include <sys/xti_xtiopt.h> + +#if !defined(_XPG5) + +/* + * Include declarations related to OSI transport and management data + * structures, and the Internet Protocol Suite. + * Note: The older Unix95/XNS4 XTI spec required these to be + * exposed through the generic interface header. + */ +#include <sys/xti_osi.h> +#include <sys/xti_inet.h> + +#endif /* !defined(_XPG5) */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The following t_errno error codes are included in the namespace by + * inclusion of <sys/tpicommon.h> above. The english language error strings + * associated with the error values are reproduced here for easy reference. + * + * Error Value Error message string + * ---- ----- -------------------- + * TBADADDR 1 Incorrect address format + * TBADOPT 2 Incorrect options format + * TACCES 3 Illegal permissions + * TBADF 4 Illegal file descriptor + * TNOADDR 5 Couldn't allocate address + * TOUTSTATE 6 Routine will place interface out of state + * TBADSEQ 7 Illegal called/calling sequence number + * TSYSERR 8 System error + * TLOOK 9 An event requires attention + * TBADDATA 10 Illegal amount of data + * TBUFOVFLW 11 Buffer not large enough + * TFLOW 12 Can't send message - (blocked) + * TNODATA 13 No message currently available + * TNODIS 14 Disconnect message not found + * TNOUDERR 15 Unitdata error message not found + * TBADFLAG 16 Incorrect flags specified + * TNOREL 17 Orderly release message not found + * TNOTSUPPORT 18 Primitive not supported by provider + * TSTATECHNG 19 State is in process of changing + * TNOSTRUCTYPE 20 Unsupported structure type requested + * TBADNAME 21 Invalid transport provider name + * TBADQLEN 22 Listener queue length limit is zero + * TADDRBUSY 23 Transport address is in use + * TINDOUT 24 Outstanding connection indications + * TPROVMISMATCH 25 Listener-acceptor transport provider mismatch + * TRESQLEN 26 Connection acceptor has listen queue length + * limit greater than zero + * TRESADDR 27 Connection acceptor-listener addresses not + * same but required by transport + * TQFULL 28 Incoming connection queue is full + * TPROTO 29 Protocol error on transport primitive + * + */ + +/* + * The following are the events returned by t_look + */ +#define T_LISTEN 0x0001 /* connection indication received */ +#define T_CONNECT 0x0002 /* connect confirmation received */ +#define T_DATA 0x0004 /* normal data received */ +#define T_EXDATA 0x0008 /* expedited data received */ +#define T_DISCONNECT 0x0010 /* disconnect received */ +#define T_UDERR 0x0040 /* data gram error indication */ +#define T_ORDREL 0x0080 /* orderly release indication */ +#define T_GODATA 0x0100 /* sending normal data is again possible */ +#define T_GOEXDATA 0x0200 /* sending expedited data is again possible */ + +/* + * Flags for data primitives + */ +#define T_MORE 0x001 /* more data */ +#define T_EXPEDITED 0x002 /* expedited data */ +#define T_PUSH 0x004 /* send data immediately */ + +/* + * XTI error return + */ +#if defined(_REENTRANT) || defined(_TS_ERRNO) +extern int *__t_errno(); +#define t_errno (*(__t_errno())) +#else +extern int t_errno; +#endif /* defined(_REENTRANT) || defined(_TS_ERRNO) */ + + +/* + * The following are for t_sysconf() + */ +#ifndef T_IOV_MAX +#define T_IOV_MAX 16 /* Maximum number of scatter/gather buffers */ +#endif /* Should be <= IOV_MAX */ + +#ifndef _SC_T_IOV_MAX +#define _SC_T_IOV_MAX 79 /* Should be same in <unistd.h> for use by */ +#endif /* sysconf() */ + +struct t_iovec { + void *iov_base; + size_t iov_len; +}; + +/* + * Translate source level interface to binary entry point names. + * + * Note: This is done to maintain co-existence of TLI and XTI + * interfaces which have identical names for most functions but + * different semantics. The XTI names are moved to the different + * prefix space in the ABI. The #ifdef is required to make use of + * of the compiler feature to allow redefinition of external names + * where available. Otherwise a simple #define is used when this + * header is used with other compilers. + * The use of #define also has the effect of renaming all names (not + * just function names) to the new name. The TLI function names + * (e.g. t_bind) can have identical names for structure names + * (e.g struct t_bind). Therefore, this redefinition of names needs + * to be before all structure and function name declarations in the header. + */ + +#ifdef __PRAGMA_REDEFINE_EXTNAME + +#if defined(_XOPEN_SOURCE) && !defined(_XPG5) +#pragma redefine_extname t_accept _xti_accept +#else +#pragma redefine_extname t_accept _xti_xns5_accept +#endif +#pragma redefine_extname t_alloc _xti_alloc +#pragma redefine_extname t_bind _xti_bind +#pragma redefine_extname t_close _xti_close +#pragma redefine_extname t_connect _xti_connect +#pragma redefine_extname t_error _xti_error +#pragma redefine_extname t_free _xti_free +#pragma redefine_extname t_getinfo _xti_getinfo +#pragma redefine_extname t_getstate _xti_getstate +#pragma redefine_extname t_getprotaddr _xti_getprotaddr +#pragma redefine_extname t_listen _xti_listen +#pragma redefine_extname t_look _xti_look +#pragma redefine_extname t_open _xti_open +#pragma redefine_extname t_optmgmt _xti_optmgmt +#pragma redefine_extname t_rcv _xti_rcv +#pragma redefine_extname t_rcvconnect _xti_rcvconnect +#pragma redefine_extname t_rcvdis _xti_rcvdis +#pragma redefine_extname t_rcvrel _xti_rcvrel +#pragma redefine_extname t_rcvreldata _xti_rcvreldata +#pragma redefine_extname t_rcvudata _xti_rcvudata +#pragma redefine_extname t_rcvuderr _xti_rcvuderr +#pragma redefine_extname t_rcvv _xti_rcvv +#pragma redefine_extname t_rcvvudata _xti_rcvvudata +#if defined(_XOPEN_SOURCE) && !defined(_XPG5) +#pragma redefine_extname t_snd _xti_snd +#else +#pragma redefine_extname t_snd _xti_xns5_snd +#endif +#pragma redefine_extname t_snddis _xti_snddis +#pragma redefine_extname t_sndrel _xti_sndrel +#pragma redefine_extname t_sndreldata _xti_sndreldata +#pragma redefine_extname t_sndudata _xti_sndudata +#pragma redefine_extname t_sndv _xti_sndv +#pragma redefine_extname t_sndvudata _xti_sndvudata +#pragma redefine_extname t_strerror _xti_strerror +#pragma redefine_extname t_sync _xti_sync +#pragma redefine_extname t_sysconf _xti_sysconf +#pragma redefine_extname t_unbind _xti_unbind + +#else /* __PRAGMA_REDEFINE_EXTNAME */ + +#if defined(_XOPEN_SOURCE) && !defined(_XPG5) +#define t_accept _xti_accept +#else +#define t_accept _xti_xns5_accept +#endif +#define t_alloc _xti_alloc +#define t_bind _xti_bind +#define t_close _xti_close +#define t_connect _xti_connect +#define t_error _xti_error +#define t_free _xti_free +#define t_getinfo _xti_getinfo +#define t_getstate _xti_getstate +#define t_getprotaddr _xti_getprotaddr +#define t_listen _xti_listen +#define t_look _xti_look +#define t_open _xti_open +#define t_optmgmt _xti_optmgmt +#define t_rcv _xti_rcv +#define t_rcvconnect _xti_rcvconnect +#define t_rcvdis _xti_rcvdis +#define t_rcvrel _xti_rcvrel +#define t_rcvreldata _xti_rcvreldata +#define t_rcvudata _xti_rcvudata +#define t_rcvuderr _xti_rcvuderr +#define t_rcvv _xti_rcvv +#define t_rcvvudata _xti_rcvvudata +#if defined(_XOPEN_SOURCE) && !defined(_XPG5) +#define t_snd _xti_snd +#else +#define t_snd _xti_xns5_snd +#endif +#define t_snddis _xti_snddis +#define t_sndrel _xti_sndrel +#define t_sndreldata _xti_sndreldata +#define t_sndudata _xti_sndudata +#define t_sndv _xti_sndv +#define t_sndvudata _xti_sndvudata +#define t_strerror _xti_strerror +#define t_sync _xti_sync +#define t_sysconf _xti_sysconf +#define t_unbind _xti_unbind + +#endif /* __PRAGMA_REDEFINE_EXTNAME */ + +/* + * protocol specific service limits + */ +struct t_info { + t_scalar_t addr; /* max size of protocol address */ + t_scalar_t options; /* max size of protocol options */ + t_scalar_t tsdu; /* max size of max transport service */ + /* data unit */ + t_scalar_t etsdu; /* max size of max expedited tsdu */ + t_scalar_t connect; /* max data for connection primitives */ + t_scalar_t discon; /* max data for disconnect primitives */ + t_scalar_t servtype; /* provider service type */ + t_scalar_t flags; /* other info about transport providers */ +}; + +/* + * Flags definitions for the t_info structure + */ +#define T_SENDZERO 0x001 /* supports 0-length TSDUs */ +#define T_ORDRELDATA 0x002 /* supports orderly release data */ + +/* + * netbuf structure + */ +struct netbuf { + unsigned int maxlen; + unsigned int len; +#if defined(_XPG5) + void *buf; +#else + char *buf; +#endif +}; + +/* + * t_opthdr structure + */ +struct t_opthdr { + t_uscalar_t len; /* total length of option */ + t_uscalar_t level; /* protocol level */ + t_uscalar_t name; /* option name */ + t_uscalar_t status; /* status value */ + /* followed by option value */ +}; + +/* + * t_bind - format of the addres and options arguments of bind + */ + +struct t_bind { + struct netbuf addr; + unsigned int qlen; +}; + +/* + * options management + */ +struct t_optmgmt { + struct netbuf opt; + t_scalar_t flags; +}; + +/* + * disconnect structure + */ +struct t_discon { + struct netbuf udata; /* user data */ + int reason; /* reason code */ + int sequence; /* sequence number */ +}; + +/* + * call structure + */ +struct t_call { + struct netbuf addr; /* address */ + struct netbuf opt; /* options */ + struct netbuf udata; /* user data */ + int sequence; /* sequence number */ +}; + +/* + * data gram structure + */ +struct t_unitdata { + struct netbuf addr; /* address */ + struct netbuf opt; /* options */ + struct netbuf udata; /* user data */ +}; + +/* + * unitdata error + */ +struct t_uderr { + struct netbuf addr; /* address */ + struct netbuf opt; /* options */ + t_scalar_t error; /* error code */ +}; + +/* + * The following are structure types used when dynamically + * allocating the above structures via t_structalloc(). + */ +#define T_BIND 1 /* struct t_bind */ +#define T_OPTMGMT 2 /* struct t_optmgmt */ +#define T_CALL 3 /* struct t_call */ +#define T_DIS 4 /* struct t_discon */ +#define T_UNITDATA 5 /* struct t_unitdata */ +#define T_UDERROR 6 /* struct t_uderr */ +#define T_INFO 7 /* struct t_info */ + +/* + * The following bits specify which fields of the above + * structures should be allocated by t_alloc(). + */ +#define T_ADDR 0x01 /* address */ +#define T_OPT 0x02 /* options */ +#define T_UDATA 0x04 /* user data */ +#define T_ALL 0xffff /* all the above fields */ + + +/* + * the following are the states for the user + */ + +#define T_UNINIT 0 /* uninitialized */ +#define T_UNBND 1 /* unbound */ +#define T_IDLE 2 /* idle */ +#define T_OUTCON 3 /* outgoing connection pending */ +#define T_INCON 4 /* incoming connection pending */ +#define T_DATAXFER 5 /* data transfer */ +#define T_OUTREL 6 /* outgoing release pending */ +#define T_INREL 7 /* incoming release pending */ + + +#define T_UNUSED -1 +#define T_NULL 0 + + +/* + * Allegedly general purpose constant. Used with (and needs to be bitwise + * distinct from) T_NOPROTECT, T_PASSIVEPROTECT and T_ACTIVEPROTECT + * which are OSI specific constants but part of this header (defined + * in <xti_osi.h> which is included in this header for historical + * XTI specification reasons) + */ +#define T_ABSREQ 0x8000 + +/* + * General definitions for option management + * + * Multiple variable length options may be packed into a single option buffer. + * Each option consists of a fixed length header followed by variable length + * data. The header and data will have to be aligned at appropriate + * boundaries. The following macros are used to manipulate the options. + * + * Helper Macros: Macros beginning with a "_T" prefix are helper macros. + * They are private, not meant for public use and may + * change without notice. Users should use the standard + * XTI macros beginning with "T_" prefix + */ + +#define _T_OPT_HALIGN_SZ (sizeof (t_scalar_t)) /* Hdr Alignment size */ +#define _T_OPT_DALIGN_SZ (sizeof (int32_t)) /* Data Alignment size */ +#define _T_OPTHDR_SZ (sizeof (struct t_opthdr)) + +/* Align 'x' to the next 'asize' alignment boundary */ +#define _T_OPT_ALIGN(x, asize) \ + (((uintptr_t)(x) + ((asize) - 1L)) & ~((asize) - 1L)) + +/* Align 'x' to the next header alignment boundary */ +#define _T_OPTHDR_ALIGN(x) \ + (_T_OPT_ALIGN((x), _T_OPT_HALIGN_SZ)) + +/* Align 'x' to the next data alignment boundary */ +#define _T_OPTDATA_ALIGN(x) \ + (_T_OPT_ALIGN((x), _T_OPT_DALIGN_SZ)) + +/* + * struct t_opthdr *T_OPT_FIRSTHDR(struct netbuf *nbp): + * Get aligned start of first option header + * + * unsigned char *T_OPT_DATA(struct t_opthdr *tohp): + * Get aligned start of data part after option header + * + * struct t_opthdr *T_OPT_NEXTHDR(struct netbuf *nbp, struct t_opthdr *tohp): + * Skip to next option header + */ + +#define T_OPT_FIRSTHDR(nbp) \ + ((nbp)->len >= _T_OPTHDR_SZ ? (struct t_opthdr *)(nbp)->buf : \ + (struct t_opthdr *)0) + +#define T_OPT_DATA(tohp) \ + ((unsigned char *)_T_OPTDATA_ALIGN((char *)(tohp) + _T_OPTHDR_SZ)) + +#define _T_NEXTHDR(pbuf, buflen, popt) \ + (((char *)_T_OPTHDR_ALIGN((char *)(popt) + (popt)->len) + \ + _T_OPTHDR_SZ <= ((char *)(pbuf) + (buflen))) ? \ + (struct t_opthdr *)((char *)_T_OPTHDR_ALIGN((char *)(popt) + \ + (popt)->len)) : (struct t_opthdr *)0) + +#define T_OPT_NEXTHDR(nbp, tohp) (_T_NEXTHDR((nbp)->buf, (nbp)->len, (tohp))) + +#if !defined(_XPG5) +/* + * The macros below are meant for older applications for compatibility. + * New applications should use the T_OPT_* macros, obviating the need + * to explicitly use the T_ALIGN macro + * + * struct t_opthdr *OPT_NEXTHDR(char *pbuf, unsigned int buflen, + * struct t_opthdr *popt): + * Skip to next option header + */ +#define T_ALIGN(p) (((uintptr_t)(p) + (sizeof (t_scalar_t) - 1))\ + & ~(sizeof (t_scalar_t) - 1)) +#define OPT_NEXTHDR(pbuf, buflen, popt) (_T_NEXTHDR((pbuf), (buflen), (popt))) +#endif + +/* + * XTI LIBRARY FUNCTIONS + */ + +#if defined(__STDC__) + +#if defined(_XOPEN_SOURCE) && !defined(_XPG5) +extern int t_accept(int, int, struct t_call *); +extern char *t_alloc(int, int, int); +extern int t_bind(int, struct t_bind *, struct t_bind *); +extern int t_connect(int, struct t_call *, struct t_call *); +extern int t_error(char *); +extern int t_free(char *, int); +extern int t_open(char *, int, struct t_info *); +extern int t_optmgmt(int, struct t_optmgmt *, struct t_optmgmt *); +extern int t_rcv(int, char *, unsigned int, int *); +extern int t_snd(int, char *, unsigned int, int); +extern int t_snddis(int, struct t_call *); +extern int t_sndudata(int, struct t_unitdata *); +extern char *t_strerror(int); +#else +extern int t_accept(int, int, const struct t_call *); +extern void *t_alloc(int, int, int); +extern int t_bind(int, const struct t_bind *, struct t_bind *); +extern int t_connect(int, const struct t_call *, struct t_call *); +extern int t_error(const char *); +extern int t_free(void *, int); +extern int t_open(const char *, int, struct t_info *); +extern int t_optmgmt(int, const struct t_optmgmt *, struct t_optmgmt *); +extern int t_rcv(int, void *, unsigned int, int *); +extern int t_snd(int, void *, unsigned int, int); +extern int t_snddis(int, const struct t_call *); +extern int t_sndudata(int, const struct t_unitdata *); +extern const char *t_strerror(int); +#endif +extern int t_close(int); +extern int t_getinfo(int, struct t_info *); +extern int t_getstate(int); +extern int t_getprotaddr(int, struct t_bind *, struct t_bind *); +extern int t_listen(int, struct t_call *); +extern int t_look(int); +extern int t_rcvconnect(int, struct t_call *); +extern int t_rcvdis(int, struct t_discon *); +extern int t_rcvrel(int); +extern int t_rcvreldata(int, struct t_discon *); +extern int t_rcvudata(int, struct t_unitdata *, int *); +extern int t_rcvuderr(int, struct t_uderr *); +extern int t_rcvv(int, struct t_iovec *, unsigned int, int *); +extern int t_rcvvudata(int, struct t_unitdata *, struct t_iovec *, + unsigned int, int *); +extern int t_sndrel(int); +extern int t_sndreldata(int, struct t_discon *); +extern int t_sndv(int, const struct t_iovec *, unsigned int, int); +extern int t_sndvudata(int, struct t_unitdata *, struct t_iovec *, + unsigned int); +extern int t_sync(int); +extern int t_sysconf(int); +extern int t_unbind(int); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _XTI_H */ diff --git a/usr/src/head/xti_inet.h b/usr/src/head/xti_inet.h new file mode 100644 index 0000000000..5d06ac2132 --- /dev/null +++ b/usr/src/head/xti_inet.h @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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) 1998 Sun Microsystems, Inc. */ +/* All Rights Reserved */ + + +#ifndef _XTI_INET_H +#define _XTI_INET_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/xti_inet.h> + +#endif /* _XTI_INET_H */ diff --git a/usr/src/head/zone.h b/usr/src/head/zone.h new file mode 100644 index 0000000000..90c1a9c940 --- /dev/null +++ b/usr/src/head/zone.h @@ -0,0 +1,72 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 + * or http://www.opensolaris.org/os/licensing. + * 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 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _ZONE_H +#define _ZONE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <sys/zone.h> +#include <sys/priv.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Functions for mapping between id and name for active zones. + */ +extern zoneid_t getzoneid(void); +extern zoneid_t getzoneidbyname(const char *); +extern ssize_t getzonenamebyid(zoneid_t, char *, size_t); + +/* + * NOTE + * + * The remaining contents of this file are private to the implementation + * of Solaris and are subject to change at any time without notice, + * Applications using these interfaces may fail to run on future releases. + */ + +extern int zonept(int, zoneid_t); +extern int zone_get_id(const char *, zoneid_t *); + +/* System call API */ +extern zoneid_t zone_create(const char *, const char *, + const struct priv_set *, const char *, size_t, int *); +extern int zone_boot(zoneid_t, const char *); +extern int zone_destroy(zoneid_t); +extern ssize_t zone_getattr(zoneid_t, int, void *, size_t); +extern int zone_enter(zoneid_t); +extern int zone_list(zoneid_t *, uint_t *); +extern int zone_shutdown(zoneid_t); + +#ifdef __cplusplus +} +#endif + +#endif /* _ZONE_H */ |