# # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Copyright 2025 Oxide Computer Company # # rpcgen-generated headers now committed as permanent source (2026-04-09) # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # 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 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # Copyright 2013 Garrett D'Amore # Copyright 2015 Igor Kozhukhov # Copyright 2017 Nexenta Systems, Inc. # # include global definitions include ../Makefile.master sparc_HDRS= i386_HDRS= stack_unwind.h KRB5HDRS= \ mit_copyright.h \ mit-sipb-copyright.h ATTRDB_HDRS= \ auth_attr.h \ auth_list.h \ exec_attr.h \ prof_attr.h \ secdb.h \ user_attr.h HDRS= $($(MACH)_HDRS) \ $(ATTRDB_HDRS) \ aio.h \ alloca.h \ apptrace.h \ apptrace_impl.h \ ar.h \ archives.h \ assert.h \ atomic.h \ attr.h \ complex.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 \ endian.h \ err.h \ errno.h \ euc.h \ exacct.h \ exacct_impl.h \ execinfo.h \ fatal.h \ fcntl.h \ fenv.h \ float.h \ floatingpoint.h \ fmtmsg.h \ fnmatch.h \ fts.h \ ftw.h \ gelf.h \ getopt.h \ getwidth.h \ glob.h \ grp.h \ iconv.h \ ieeefp.h \ ifaddrs.h \ inttypes.h \ iso646.h \ klpd.h \ langinfo.h \ lastlog.h \ lber.h \ ldap.h \ libelf.h \ libgen.h \ libintl.h \ libw.h \ libzonecfg.h \ limits.h \ link.h \ listen.h \ locale.h \ macros.h \ malloc.h \ math.h \ memory.h \ mon.h \ monetary.h \ mp.h \ mqueue.h \ nan.h \ ndbm.h \ ndpd.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 \ paths.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 \ project.h \ pthread.h \ pw.h \ pwd.h \ rctl.h \ re_comp.h \ regex.h \ regexp.h \ resolv.h \ rtld_db.h \ sac.h \ sched.h \ schedctl.h \ search.h \ semaphore.h \ setjmp.h \ sgtty.h \ shadow.h \ siginfo.h \ signal.h \ spawn.h \ stdalign.h \ stdarg.h \ stdbit.h \ stdbool.h \ stddef.h \ stdint.h \ stdio.h \ stdio_ext.h \ stdio_tag.h \ stdio_impl.h \ stdlib.h \ stdnoreturn.h \ string.h \ strings.h \ stropts.h \ synch.h \ sysexits.h \ syslog.h \ tar.h \ termio.h \ termios.h \ tgmath.h \ thread.h \ thread_db.h \ threads.h \ time.h \ tiuser.h \ tzfile.h \ uchar.h \ ucontext.h \ ucred.h \ ulimit.h \ unistd.h \ upanic.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 \ xlocale.h \ xti.h \ xti_inet.h \ zone.h ISOHDRS = \ assert_iso.h \ ctype_iso.h \ limits_iso.h \ locale_iso.h \ math_c99.h \ math_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_c11.h \ stdlib_iso.h \ string_iso.h \ time_iso.h \ wchar_c99.h \ wchar_iso.h \ wctype_iso.h ARPAHDRS = \ 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 \ nislib.h \ svc_dg_priv.h \ yp_prot.h \ ypclnt.h \ yppasswd.h \ nis.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 \ rquota.h \ rstat.h \ rusers.h \ rwall.h \ spray.h \ nfs_acl.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 # Hammerhead: pre-generated (rpcgen + GNU cpp truncation bug) # RPCGENFLAGS = -C -h # rpcsvc/rwall.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 RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS) # Hammerhead: Explicit paths for generated headers to ensure they're built # before installation (GNU Make implicit rule chaining doesn't always work) RPCSVC_GEN_HDR_PATHS = $(RPCSVC_GEN_HDRS:%=rpcsvc/%) # Hammerhead: removed rwhod.h (in.rwhod gone), timed.h (timed gone). # routed.h kept for snoop_rip.c; ripngd.h kept for snoop_rip6.c + in.ripngd. PROTOHDRS= dumprestore.h routed.h ripngd.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/%) \ $(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%) DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5 ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%) # 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 = 2>&1 | grep -v "header guard" | 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) # Hammerhead: Explicitly build generated rpcsvc headers before installing # This ensures they exist before the implicit install rules need them rpcsvc_gen_hdrs: $(RPCSVC_GEN_HDR_PATHS) install_h: $(ROOTDIRS) .WAIT rpcsvc_gen_hdrs .WAIT $(ROOTHDRS) $(SYMHDRERRNO) \ $(SYMHDRFLOAT) $(SYMHDRISO646) check: $(CHECKHDRS) clean clobber: @# Hammerhead: rpcsvc headers are pre-generated source, do not delete $(ROOTDIRS): $(INS.dir) $(SYMHDRERRNO): -$(RM) $@; $(SYMLINK) ../errno.h $@ $(SYMHDRFLOAT): -$(RM) $@; $(SYMLINK) ../float.h $@ $(SYMHDRISO646): -$(RM) $@; $(SYMLINK) ../iso646.h $@ # Hammerhead: pre-generated (rpcgen + GNU cpp truncation bug) # rpcsvc/%.h: rpcsvc/%.x # $(RPCGEN) $(RPCGENFLAGS) $< | $(SED) -e 's/^#ifdef 1$$/#if 1/' -e 's/defined(1)/1/g' > $@ # # rpcsvc/nis.h: rpcsvc/nis.x # @echo "Using pre-generated rpcsvc/nis.h" /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _AIO_H #define _AIO_H #include #include #include #include #include #include #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 */ 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 */ #ifdef __cplusplus } #endif #endif /* _AIO_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _ALLOCA_H #define _ALLOCA_H #include #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) extern void *__builtin_alloca(size_t); #else extern void *alloca(size_t); #endif /* defined(__BUILTIN_VA_ARG_INCR) || defined(__sparc) ... */ #ifdef __cplusplus } #endif #endif /* _ALLOCA_H */ /* * 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 #include #include #include #include #include #include #include #include #include #include #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _APPTRACE_IMPL_H #define _APPTRACE_IMPL_H #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; extern void abilock(sigset_t *); extern void abiunlock(sigset_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 *); #ifdef __cplusplus } #endif #endif /* _APPTRACE_IMPL_H */ /* * 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 #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 "!\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 */ /* * 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 #include #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ /* 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 #include #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) #include #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */ #include #if defined(_XPG4_2) && !defined(__EXTENSIONS__) #include #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */ #ifdef __cplusplus extern "C" { #endif /* * External definitions for * functions in inet(3C) */ #if !defined(_XPG4_2) || defined(__EXTENSIONS__) extern int inet_net_pton(int, const char *, void *, size_t); extern int inet_matchaddr(const void *, const char *); #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 *); /* * With the introduction of CIDR the * following 4 routines are now considered to be Obsolete */ 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_neta(ulong_t, char *, size_t); extern char *inet_net_ntop(int, const void *, int, char *, size_t); extern char *inet_cidr_ntop(int, const void *, int, char *, size_t); extern int inet_cidr_pton(int, const char *, void *, int *); extern char *inet_ntoa(struct in_addr); extern int inet_aton(const char *, struct in_addr *); extern uint_t inet_nsap_addr(const char *, uchar_t *, int); extern char *inet_nsap_ntoa(int, const uchar_t *, char *); #ifdef __cplusplus } #endif #endif /* _ARPA_INET_H */ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright (c) 2016, Chris Fraire . */ /* * 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. */ /* * Portions Copyright (C) 2004, 2005, 2008, 2009 * Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 1996-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS. IN NO EVENT SHALL ISC 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 #include #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 20090302 /* 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_MAXLABELS 128 /* theoretical max #/labels per domain name */ #define NS_MAXNNAME 256 /* maximum uncompressed (binary) domain name */ #define NS_MAXPADDR (sizeof ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")) #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; /* * Network name (compressed or not) type. Equivalent to a pointer when used * in a function prototype. Can be const'd. */ typedef uchar_t ns_nname[NS_MAXNNAME]; typedef const uchar_t *ns_nname_ct; typedef uchar_t *ns_nname_t; struct ns_namemap { ns_nname_ct base; int len; }; typedef struct ns_namemap *ns_namemap_t; typedef const struct ns_namemap *ns_namemap_ct; /* * 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; /* * This is a newmsg handle, used when constructing new messages with * ns_newmsg_init, et al. */ struct ns_newmsg { ns_msg msg; const uchar_t *dnptrs[25]; const uchar_t **lastdnptr; }; typedef struct ns_newmsg ns_newmsg; /* 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; /* * Same thing, but using uncompressed network binary names, and real C types. */ typedef struct __ns_rr2 { ns_nname nname; size_t nnamel; int type; int rr_class; uint_t ttl; int rdlength; const uchar_t *rdata; } ns_rr2; /* Accessor macros - this is part of the public interface. */ #define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") #define ns_rr_nname(rr) ((const ns_nname_t)(rr).nname) #define ns_rr_nnamel(rr) ((rr).nnamel + 0) #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_ds = 43, /* Delegation Signer */ ns_t_sshfp = 44, /* SSH Fingerprint */ ns_t_ipseckey = 45, /* IPSEC Key */ ns_t_rrsig = 46, /* RRset Signature */ ns_t_nsec = 47, /* Negative security */ ns_t_dnskey = 48, /* DNS Key */ ns_t_dhcid = 49, /* Dynamic host configuratin identifier */ ns_t_nsec3 = 50, /* Negative security type 3 */ ns_t_nsec3param = 51, /* Negative security type 3 parameters */ ns_t_tlsa = 52, /* TLSA (RFC 6698) */ ns_t_smimea = 53, /* S/MIME cert association (RFC 8162) */ ns_t_hip = 55, /* Host Identity Protocol */ ns_t_cds = 59, /* Child DS (RFC 7344) */ ns_t_cdnskey = 60, /* DNSKEY(s) the Child wants reflected in DS */ ns_t_openpgpkey = 61, /* OpenPGP Key (RFC 7929) */ ns_t_csync = 62, /* Child-To-Parent Synchronization (RFC 7477) */ ns_t_spf = 99, /* Sender Policy Framework */ 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_caa = 257, /* Certification Authority Restriction */ ns_t_dlv = 32769, /* DNSSEC look-aside validatation. */ 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 #define NS_OPT_NSID 3 /* * 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_parserr2 __ns_parserr2 #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_pton2 __ns_name_pton2 #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_name_length __ns_name_length #define ns_name_eq __ns_name_eq #define ns_name_owned __ns_name_owned #define ns_name_map __ns_name_map #define ns_name_labels __ns_name_labels #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 #define ns_newmsg_init __ns_newmsg_init #define ns_newmsg_copy __ns_newmsg_copy #define ns_newmsg_id __ns_newmsg_id #define ns_newmsg_flag __ns_newmsg_flag #define ns_newmsg_q __ns_newmsg_q #define ns_newmsg_rr __ns_newmsg_rr #define ns_newmsg_done __ns_newmsg_done #define ns_rdata_unpack __ns_rdata_unpack #define ns_rdata_equal __ns_rdata_equal #define ns_rdata_refers __ns_rdata_refers 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_parserr2(ns_msg *, ns_sect, int, ns_rr2 *); 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_pton2(const char *, uchar_t *, size_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 **); ssize_t ns_name_length(ns_nname_ct, size_t); int ns_name_eq(ns_nname_ct, size_t, ns_nname_ct, size_t); int ns_name_owned(ns_namemap_ct, int, ns_namemap_ct, int); int ns_name_map(ns_nname_ct, size_t, ns_namemap_t, int); int ns_name_labels(ns_nname_ct, size_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 *); int ns_newmsg_init(uchar_t *buffer, size_t bufsiz, ns_newmsg *); int ns_newmsg_copy(ns_newmsg *, ns_msg *); void ns_newmsg_id(ns_newmsg *handle, uint16_t id); void ns_newmsg_flag(ns_newmsg *handle, ns_flag flag, uint_t value); int ns_newmsg_q(ns_newmsg *handle, ns_nname_ct qname, ns_type qtype, ns_class qclass); int ns_newmsg_rr(ns_newmsg *handle, ns_sect sect, ns_nname_ct name, ns_type type, ns_class rr_class, uint32_t ttl, uint16_t rdlen, const uchar_t *rdata); size_t ns_newmsg_done(ns_newmsg *handle); ssize_t ns_rdata_unpack(const uchar_t *, const uchar_t *, ns_type, const uchar_t *, size_t, uchar_t *, size_t); int ns_rdata_equal(ns_type, const uchar_t *, size_t, const uchar_t *, size_t); int ns_rdata_refers(ns_type, const uchar_t *, size_t, const uchar_t *); #ifdef BIND_4_COMPAT #include #endif #ifdef __cplusplus } #endif #endif /* !_ARPA_NAMESER_H */ /* * 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 #ifdef __cplusplus extern "C" { #endif #define __BIND 19950621 /* (DEAD) interface version stamp. */ #ifndef BYTE_ORDER #if (BSD >= 199103) #include #else #ifdef linux #include #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(__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 */ /* * 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) 2016 by Delphix. All rights reserved. */ /* 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 #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 it is, but it's okay */ #define AUTH_OTHER 2 /* We know it, but not its name */ #define AUTH_USER 3 /* We know its name */ #define AUTH_VALID 4 /* We know it, and it 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 */ /* * 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 #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 */ /* * 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 2014 Garrett D'Amore * Copyright 2016 Joyent, Inc. * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. * Copyright 2023 Oxide Computer Company * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Note that the ANSI C Standard requires all headers to be idempotent except * which is explicitly required not to be idempotent (section 4.1.2). * We split up the idempotent sections into and leave the * rest of this that should be impacted by NDEBUG here. There is no header * guard. This is intentional. For more information on the split, see * . */ #include #undef assert #ifdef NDEBUG #define assert(EX) ((void)0) #else #if (__cplusplus - 0 >= 201103L) || (__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 /* __cplusplus - 0 >= 201103L || __STDC_VERSION__ - 0 >= 199901L */ #endif /* NDEBUG */ /* * 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 #include #endif /* _ATOMIC_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _ATTR_H #define _ATTR_H #include #include #include #ifdef __cplusplus extern "C" { #endif extern int getattrat(int, xattr_view_t, const char *, nvlist_t **); extern int fgetattr(int, xattr_view_t, nvlist_t **); extern int setattrat(int, xattr_view_t, const char *, nvlist_t *); extern int fsetattr(int, xattr_view_t, nvlist_t *); #ifdef __cplusplus } #endif #endif /* _ATTR_H */ /* * 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 #include #include #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 */ /* * 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 2014 Garrett D'Amore * Copyright (c) 1999 by Sun Microsystems, Inc. All rights reserved. */ #ifndef _AUTH_ATTR_H #define _AUTH_ATTR_H #ifdef __cplusplus extern "C" { #endif #include #include /* * 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; 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 *); #ifdef __cplusplus } #endif #endif /* _AUTH_ATTR_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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, 2010, Oracle and/or its affiliates. All rights reserved. * * This is an internal header file. Not to be shipped. */ #ifndef _AUTH_LIST_H #define _AUTH_LIST_H #ifdef __cplusplus extern "C" { #endif /* * Names of authorizations currently in use in the system */ #define AUTOCONF_READ_AUTH "solaris.network.autoconf.read" #define AUTOCONF_SELECT_AUTH "solaris.network.autoconf.select" #define AUTOCONF_WLAN_AUTH "solaris.network.autoconf.wlan" #define AUTOCONF_WRITE_AUTH "solaris.network.autoconf.write" #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 LINK_SEC_AUTH "solaris.network.link.security" #define MAILQ_AUTH "solaris.mail.mailq" #define NET_ILB_CONFIG_AUTH "solaris.network.ilb.config" #define NET_ILB_ENABLE_AUTH "solaris.network.ilb.enable" #define SET_DATE_AUTH "solaris.system.date" #define WIFI_CONFIG_AUTH "solaris.network.wifi.config" #define WIFI_WEP_AUTH "solaris.network.wifi.wep" #define HP_MODIFY_AUTH "solaris.hotplug.modify" /* * The following authorizations can be qualified by appending */ #define ZONE_CLONEFROM_AUTH "solaris.zone.clonefrom" #define ZONE_LOGIN_AUTH "solaris.zone.login" #define ZONE_MANAGE_AUTH "solaris.zone.manage" #define ZONE_AUTH_PREFIX "solaris.zone." /* * Authorizations used by Trusted Extensions. */ #define DEVICE_CONFIG_AUTH "solaris.device.config" #define FILE_CHOWN_AUTH "solaris.file.chown" #define FILE_DOWNGRADE_SL_AUTH "solaris.label.file.downgrade" #define FILE_OWNER_AUTH "solaris.file.owner" #define FILE_UPGRADE_SL_AUTH "solaris.label.file.upgrade" #define MAINTENANCE_AUTH "solaris.system.maintenance" #define PRINT_ADMIN_AUTH "solaris.print.admin" #define PRINT_CANCEL_AUTH "solaris.print.cancel" #define PRINT_LIST_AUTH "solaris.print.list" #define PRINT_MAC_AUTH "solaris.label.print" #define PRINT_NOBANNER_AUTH "solaris.print.nobanner" #define PRINT_POSTSCRIPT_AUTH "solaris.print.ps" #define PRINT_UNLABELED_AUTH "solaris.print.unlabeled" #define SHUTDOWN_AUTH "solaris.system.shutdown" #define SYS_ACCRED_SET_AUTH "solaris.label.range" #define SYSEVENT_READ_AUTH "solaris.system.sysevent.read" #define SYSEVENT_WRITE_AUTH "solaris.system.sysevent.write" #ifdef __cplusplus } #endif #endif /* _AUTH_LIST_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2011 Nexenta Systems, Inc. All rights reserved. */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _COMPLEX_H #define _COMPLEX_H #ifdef __cplusplus extern "C" { #endif /* * Compilation environments for Solaris must provide the _Imaginary datatype * and the compiler intrinsics _Complex_I and _Imaginary_I */ #if defined(__SUNPRO_C) #define _Complex_I _Complex_I #define _Imaginary_I _Imaginary_I #else #define _Complex_I 1.0fi #define _Imaginary_I 1.0fi #endif #define complex _Complex #define imaginary _Imaginary #undef I #define I _Imaginary_I extern float cabsf(float complex); extern float cargf(float complex); extern float cimagf(float complex); extern float crealf(float complex); extern float complex cacosf(float complex); extern float complex cacoshf(float complex); extern float complex casinf(float complex); extern float complex casinhf(float complex); extern float complex catanf(float complex); extern float complex catanhf(float complex); extern float complex ccosf(float complex); extern float complex ccoshf(float complex); extern float complex cexpf(float complex); extern float complex clogf(float complex); extern float complex conjf(float complex); extern float complex cpowf(float complex, float complex); extern float complex cprojf(float complex); extern float complex csinf(float complex); extern float complex csinhf(float complex); extern float complex csqrtf(float complex); extern float complex ctanf(float complex); extern float complex ctanhf(float complex); extern double cabs(double complex); extern double carg(double complex); extern double cimag(double complex); extern double creal(double complex); extern double complex cacos(double complex); extern double complex cacosh(double complex); extern double complex casin(double complex); extern double complex casinh(double complex); extern double complex catan(double complex); extern double complex catanh(double complex); extern double complex ccos(double complex); extern double complex ccosh(double complex); extern double complex cexp(double complex); #if defined(__PRAGMA_REDEFINE_EXTNAME) #pragma redefine_extname clog __clog #else #undef clog #define clog __clog #endif extern double complex clog(double complex); extern double complex conj(double complex); extern double complex cpow(double complex, double complex); extern double complex cproj(double complex); extern double complex csin(double complex); extern double complex csinh(double complex); extern double complex csqrt(double complex); extern double complex ctan(double complex); extern double complex ctanh(double complex); extern long double cabsl(long double complex); extern long double cargl(long double complex); extern long double cimagl(long double complex); extern long double creall(long double complex); extern long double complex cacoshl(long double complex); extern long double complex cacosl(long double complex); extern long double complex casinhl(long double complex); extern long double complex casinl(long double complex); extern long double complex catanhl(long double complex); extern long double complex catanl(long double complex); extern long double complex ccoshl(long double complex); extern long double complex ccosl(long double complex); extern long double complex cexpl(long double complex); extern long double complex clogl(long double complex); extern long double complex conjl(long double complex); extern long double complex cpowl(long double complex, long double complex); extern long double complex cprojl(long double complex); extern long double complex csinhl(long double complex); extern long double complex csinl(long double complex); extern long double complex csqrtl(long double complex); extern long double complex ctanhl(long double complex); extern long double complex ctanl(long double complex); #ifdef __cplusplus } #endif #endif /* _COMPLEX_H */ /* * 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 2014 Garrett D'Amore * * 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 /* * 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 #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; /* * 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 */ #ifdef __cplusplus } #endif #endif /* _SYS_CONFIG_ADMIN_H */ /* * 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 #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2008 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 #include #ifdef __cplusplus extern "C" { #endif /* Password and file encryption functions */ #define CRYPT_MAXCIPHERTEXTLEN 512 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 *); #ifdef __cplusplus } #endif #endif /* _CRYPT_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _CTYPE_H #define _CTYPE_H #include /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #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; #if (__cplusplus >= 201103L) || defined(_STDC_C99) || defined(_XPG6) || \ !defined(_STRICT_SYMBOLS) using std::isblank; #endif #endif #ifdef __cplusplus extern "C" { #endif #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) #define _toupper(c) (toupper(c)) #define _tolower(c) (tolower(c)) #endif /* defined(__EXTENSIONS__) || ((!defined(_STRICT_STDC) ... */ #endif /* !defined(__lint) */ #if defined(_XPG7) || !defined(_STRICT_SYMBOLS) #ifndef _LOCALE_T #define _LOCALE_T typedef struct _locale *locale_t; #endif extern int isalnum_l(int, locale_t); extern int isalpha_l(int, locale_t); extern int isblank_l(int, locale_t); extern int iscntrl_l(int, locale_t); extern int isdigit_l(int, locale_t); extern int isgraph_l(int, locale_t); extern int islower_l(int, locale_t); extern int isprint_l(int, locale_t); extern int ispunct_l(int, locale_t); extern int isspace_l(int, locale_t); extern int isupper_l(int, locale_t); extern int isxdigit_l(int, locale_t); extern int tolower_l(int, locale_t); extern int toupper_l(int, locale_t); #endif /* defined(_XPG7) || !defined(_STRICT_SYMBOLS) */ #ifdef __cplusplus } #endif #endif /* _CTYPE_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ /* Copyright (c) 1987, 1988 Microsoft Corporation */ /* All Rights Reserved */ #ifndef _DEFLT_H #define _DEFLT_H #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)) extern int defcntl(int, int); extern int defopen(char *); extern char *defread(char *); extern int defcntl_r(int, int, void *); extern void *defopen_r(const char *); extern char *defread_r(const char *, void *); extern void defclose_r(void *); #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright 2017 Nexenta Systems, Inc. */ #ifndef _DEVID_H #define _DEVID_H #ifndef _KERNEL #include #endif /* _KERNEL */ #include #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 char *devid_str_from_path(const char *path); #ifdef __cplusplus } #endif #endif /* _DEVID_H */ /* * 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 #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 */ /* * 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 #include #endif /* _DEVPOLL_H */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ #ifndef _DIAL_H #define _DIAL_H #ifndef IUCLC #include #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; extern int dial(CALL); extern void undial(int); #ifdef __cplusplus } #endif #endif /* _DIAL_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2007 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 #include #include #include #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) */ /* 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); extern int dirfd(DIR *); #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 #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(_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 #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */ #ifdef __cplusplus } #endif #endif /* _DIRENT_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. * * Copyright (c) 1989 AT&T * All Rights Reserved * */ #ifndef _DLFCN_H #define _DLFCN_H #include #include #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) #include #include #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */ #ifdef __cplusplus extern "C" { #endif /* * Information structures for various dlinfo() requests. */ #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) 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; typedef Dl_info Dl_info_t; typedef struct dl_serpath { char *dls_name; /* library search path name */ uint_t dls_flags; /* path information */ } Dl_serpath; typedef Dl_serpath Dl_serpath_t; 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 Dl_serinfo Dl_serinfo_t; typedef struct dl_argsinfo { long dla_argc; /* process argument count */ char **dla_argv; /* process arguments */ char **dla_envp; /* process environment variables */ auxv_t *dla_auxv; /* process auxv vectors */ } Dl_argsinfo; typedef Dl_argsinfo Dl_argsinfo_t; typedef struct { mmapobj_result_t *dlm_maps; /* mapping information */ uint_t dlm_acnt; /* number of dlm_maps mappings */ uint_t dlm_rcnt; /* number of returned mappings */ } Dl_mapinfo_t; 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; typedef Dl_amd64_unwindinfo Dl_amd64_unwindinfo_t; typedef struct { const char *dld_refname; /* reference name */ const char *dld_depname; /* new dependency name */ } Dl_definfo_t; #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */ typedef ulong_t Lmid_t; /* * Declarations used for dynamic linking support routines. */ 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__) */ /* * Valid values for handle argument to dlsym(3C). */ #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_ARGSINFO 11 /* get process arguments */ /* environment and auxv */ #define RTLD_DI_MMAPS 12 /* obtain objects mappings or */ #define RTLD_DI_MMAPCNT 13 /* mapping count */ #define RTLD_DI_DEFERRED 14 /* assign new dependency to a */ /* deferred dependency */ #define RTLD_DI_DEFERRED_SYM 15 /* assign new dependency to a */ /* deferred dependency */ /* using a symbol name */ #define RTLD_DI_MAX 15 #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _DOOR_H #define _DOOR_H #include #include #include #ifdef __cplusplus extern "C" { #endif #ifndef _ASM /* * Doors API */ typedef void door_server_procedure_t(void *, char *, size_t, door_desc_t *, uint_t); int door_create(door_server_procedure_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 *); typedef int door_xcreate_server_func_t(door_info_t *, void *(*)(void *), void *, void *); typedef void door_xcreate_thrsetup_func_t(void *); int door_xcreate(door_server_procedure_t *, void *, uint_t, door_xcreate_server_func_t *, door_xcreate_thrsetup_func_t *, void *, int); #endif /* _ASM */ #ifdef __cplusplus } #endif #endif /* _DOOR_H */ /* * 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 #include #endif /* _ELF_H */ /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2016 Joyent, Inc. */ #ifndef _ENDIAN_H #define _ENDIAN_H /* * Endian conversion routines, see endian(3C) */ #ifdef __cplusplus extern "C" { #endif #include #include #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 #define __PDP_ENDIAN 3412 #if defined(_LITTLE_ENDIAN) #define __BYTE_ORDER LITTLE_ENDIAN #elif defined(_BIG_ENDIAN) #define __BYTE_ORDER BIG_ENDIAN #else #error "Unknown byte order" #endif /* _LITTLE_ENDIAN */ #define LITTLE_ENDIAN __LITTLE_ENDIAN #define BIG_ENDIAN __BIG_ENDIAN #define BYTE_ORDER __BYTE_ORDER extern uint16_t htobe16(uint16_t); extern uint32_t htobe32(uint32_t); extern uint64_t htobe64(uint64_t); extern uint16_t htole16(uint16_t); extern uint32_t htole32(uint32_t); extern uint64_t htole64(uint64_t); /* Supply both the old and new BSD names */ extern uint16_t betoh16(uint16_t); extern uint16_t letoh16(uint16_t); extern uint16_t be16toh(uint16_t); extern uint16_t le16toh(uint16_t); extern uint32_t betoh32(uint32_t); extern uint32_t letoh32(uint32_t); extern uint32_t be32toh(uint32_t); extern uint32_t le32toh(uint32_t); extern uint64_t betoh64(uint64_t); extern uint64_t letoh64(uint64_t); extern uint64_t be64toh(uint64_t); extern uint64_t le64toh(uint64_t); #ifdef __cplusplus } #endif #endif /* _ENDIAN_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Copyright 2022 OmniOS Community Edition (OmniOSce) Association. */ #ifndef _ERR_H #define _ERR_H #ifdef __cplusplus extern "C" { #endif #include #include #include /* Program exit and warning calls */ void err(int, const char *, ...) __PRINTFLIKE(2) __NORETURN; void verr(int, const char *, va_list) __VPRINTFLIKE(2) __NORETURN; void errc(int, int, const char *, ...) __PRINTFLIKE(3) __NORETURN; void verrc(int, int, const char *, va_list) __VPRINTFLIKE(3) __NORETURN; void errx(int, const char *, ...) __PRINTFLIKE(2) __NORETURN; void verrx(int, const char *, va_list) __VPRINTFLIKE(2) __NORETURN; void warn(const char *, ...) __PRINTFLIKE(1); void vwarn(const char *, va_list) __VPRINTFLIKE(1); void warnc(int, const char *, ...) __PRINTFLIKE(2); void vwarnc(int, const char *, va_list) __VPRINTFLIKE(2); void warnx(const char *, ...) __PRINTFLIKE(1); void vwarnx(const char *, va_list) __VPRINTFLIKE(1); #ifdef __cplusplus } #endif #endif /* _ERR_H */ /* * 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 /* * Error codes */ #include #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) */ #if __EXT1_VISIBLE /* ISO/IEC 9899:2011 K.3.2.2 */ #ifndef _ERRNO_T_DEFINED #define _ERRNO_T_DEFINED typedef int errno_t; #endif #endif /* __EXT1_VISIBLE */ #ifdef __cplusplus } #endif #endif /* _ERRNO_H */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _EUC_H #define _EUC_H #include #ifdef __cplusplus extern "C" { #endif 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); /* 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 */ #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] #ifdef __cplusplus } #endif #endif /* _EUC_H */ /* * 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 /* * exacct item, group, and object definitions as well as structure manipulation * and conversion routines are given in sys/exacct.h. */ #include #include #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 */ /* * 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 #include #include #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _EXEC_ATTR_H #define _EXEC_ATTR_H #ifdef __cplusplus extern "C" { #endif #include #include #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 */ /* * These macros are bitmasks. GET_ONE and GET_ALL are bitfield 0 * and thus mutually exclusive. __SEARCH_ALL_POLLS is bitfield * 1 and can be logically ORed with GET_ALL if one wants to get * all matching profiles from all policies, not just the ones from * the currently active policy * * Testing for these values should be done using the IS_* macros * defined below. */ #define GET_ONE 0 #define GET_ALL 1 #define __SEARCH_ALL_POLS 2 /* get only one exec_attr from list */ #define IS_GET_ONE(f) (((f) & GET_ALL) == 0) /* get all matching exec_attrs in list */ #define IS_GET_ALL(f) (((f) & GET_ALL) == 1) /* search all existing policies */ #define IS_SEARCH_ALL(f) (((f) & __SEARCH_ALL_POLS) == __SEARCH_ALL_POLS) /* * 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 */ 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); #ifdef __cplusplus } #endif #endif /* _EXEC_ATTR_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _EXECINFO_H #define _EXECINFO_H /* * These functions provide glibc-compatible backtrace functionality. * Improved functionality is available using Solaris-specific APIs; * see man page for walkcontext(), printstack() and addtosymstr(). */ #ifdef __cplusplus extern "C" { #endif extern int backtrace(void **, int); extern char **backtrace_symbols(void *const *, int); extern void backtrace_symbols_fd(void *const *, int, int); #ifdef __cplusplus } #endif #endif /* _EXECINFO_H */ /* * 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 #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2008 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 #include #if defined(__EXTENSIONS__) || defined(_XPG4) #include #endif #include #include #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(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) #pragma redefine_extname posix_fadvise posix_fadvise64 #pragma redefine_extname posix_fallocate posix_fallocate64 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ #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(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) #define posix_fadvise posix_fadvise64 #define posix_fallocate posix_fallocate64 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ #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(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) #pragma redefine_extname posix_fadvise64 posix_fadvise #pragma redefine_extname posix_fallocate64 posix_fallocate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ #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(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) #define posix_fadvise64 posix_fadvise #define posix_fallocate64 posix_fallocate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ #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 */ extern int fcntl(int, int, ...); extern int open(const char *, int, ...); extern int creat(const char *, mode_t); #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) extern int posix_fadvise(int, off_t, off_t, int); extern int posix_fallocate(int, off_t, off_t); #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ #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(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) extern int posix_fadvise64(int, off64_t, off64_t, int); extern int posix_fallocate64(int, off64_t, off64_t); #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ #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 #ifdef __cplusplus } #endif #endif /* _FCNTL_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2011 Nexenta Systems, Inc. All rights reserved. */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _FENV_H #define _FENV_H #include #ifdef __cplusplus extern "C" { #endif /* * Rounding modes */ #if defined(__sparc) #define FE_TONEAREST 0 #define FE_TOWARDZERO 1 #define FE_UPWARD 2 #define FE_DOWNWARD 3 #elif defined(__i386) || defined(__amd64) #define FE_TONEAREST 0 #define FE_DOWNWARD 1 #define FE_UPWARD 2 #define FE_TOWARDZERO 3 #endif extern int fegetround(void); extern int fesetround(int); #if (defined(__i386) || defined(__amd64)) && \ (!defined(_STRICT_STDC) || defined(__EXTENSIONS__)) #define FE_FLTPREC 0 #define FE_DBLPREC 2 #define FE_LDBLPREC 3 extern int fegetprec(void); extern int fesetprec(int); #endif /* * Exception flags */ #if defined(__sparc) #define FE_INEXACT 0x01 #define FE_DIVBYZERO 0x02 #define FE_UNDERFLOW 0x04 #define FE_OVERFLOW 0x08 #define FE_INVALID 0x10 #define FE_ALL_EXCEPT 0x1f #elif defined(__i386) || defined(__amd64) #define FE_INVALID 0x01 #define FE_DIVBYZERO 0x04 #define FE_OVERFLOW 0x08 #define FE_UNDERFLOW 0x10 #define FE_INEXACT 0x20 #define FE_ALL_EXCEPT 0x3d #endif typedef int fexcept_t; extern int feclearexcept(int); extern int feraiseexcept(int); extern int fetestexcept(int); extern int fegetexceptflag(fexcept_t *, int); extern int fesetexceptflag(const fexcept_t *, int); #if !defined(_STRICT_STDC) || defined(__EXTENSIONS__) /* * Exception handling extensions */ #define FEX_NOHANDLER -1 #define FEX_NONSTOP 0 #define FEX_ABORT 1 #define FEX_SIGNAL 2 #define FEX_CUSTOM 3 #define FEX_INEXACT 0x001 #define FEX_DIVBYZERO 0x002 #define FEX_UNDERFLOW 0x004 #define FEX_OVERFLOW 0x008 #define FEX_INV_ZDZ 0x010 #define FEX_INV_IDI 0x020 #define FEX_INV_ISI 0x040 #define FEX_INV_ZMI 0x080 #define FEX_INV_SQRT 0x100 #define FEX_INV_SNAN 0x200 #define FEX_INV_INT 0x400 #define FEX_INV_CMP 0x800 #define FEX_INVALID 0xff0 #define FEX_COMMON (FEX_INVALID | FEX_DIVBYZERO | FEX_OVERFLOW) #define FEX_ALL (FEX_COMMON | FEX_UNDERFLOW | FEX_INEXACT) #define FEX_NONE 0 #define FEX_NUM_EXC 12 /* structure to hold a numeric value in any format used by the FPU */ typedef struct { enum fex_nt { fex_nodata = 0, fex_int = 1, fex_llong = 2, fex_float = 3, fex_double = 4, fex_ldouble = 5 } type; union { int i; #if !defined(_STRICT_STDC) && !defined(_NO_LONGLONG) || defined(_STDC_C99) || \ defined(__C99FEATURES__) long long l; #else struct { int l[2]; } l; #endif float f; double d; long double q; } val; } fex_numeric_t; /* structure to supply information about an exception to a custom handler */ typedef struct { enum fex_op { fex_add = 0, fex_sub = 1, fex_mul = 2, fex_div = 3, fex_sqrt = 4, fex_cnvt = 5, fex_cmp = 6, fex_other = 7 } op; /* operation that caused the exception */ int flags; /* flags to be set */ fex_numeric_t op1, op2, res; /* operands and result */ } fex_info_t; typedef struct fex_handler_data { int __mode; void (*__handler)(); } fex_handler_t[FEX_NUM_EXC]; extern int fex_get_handling(int); extern int fex_set_handling(int, int, void (*)()); extern void fex_getexcepthandler(fex_handler_t *, int); extern void fex_setexcepthandler(const fex_handler_t *, int); #ifdef __STDC__ #include #ifndef _FILEDEFED #define _FILEDEFED typedef __FILE FILE; #endif #endif extern FILE *fex_get_log(void); extern int fex_set_log(FILE *); extern int fex_get_log_depth(void); extern int fex_set_log_depth(int); extern void fex_log_entry(const char *); #define __fex_handler_t fex_handler_t #else typedef struct { int __mode; void (*__handler)(); } __fex_handler_t[12]; #endif /* !defined(_STRICT_STDC) || defined(__EXTENSIONS__) */ /* * Environment as a whole */ typedef struct { __fex_handler_t __handlers; unsigned long __fsr; } fenv_t; #ifdef __STDC__ extern const fenv_t __fenv_dfl_env; #else extern fenv_t __fenv_dfl_env; #endif #define FE_DFL_ENV (&__fenv_dfl_env) extern int fegetenv(fenv_t *); extern int fesetenv(const fenv_t *); extern int feholdexcept(fenv_t *); extern int feupdateenv(const fenv_t *); #if !defined(_STRICT_STDC) || defined(__EXTENSIONS__) extern void fex_merge_flags(const fenv_t *); #endif #ifdef __cplusplus } #endif #endif /* _FENV_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _FLOAT_H #define _FLOAT_H #include #ifdef __cplusplus extern "C" { #endif #if defined(__sparc) extern int __flt_rounds(void); #define FLT_ROUNDS __flt_rounds() #else /* defined(__sparc) */ extern int __fltrounds(void); #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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) 1989 AT&T */ /* All Rights Reserved */ /* * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _FLOATINGPOINT_H #define _FLOATINGPOINT_H #ifdef __STDC__ #include #endif #include #ifdef __cplusplus extern "C" { #endif /* * contains definitions for constants, types, variables, * and functions for: * IEEE floating-point arithmetic base conversion; * IEEE floating-point arithmetic modes; * IEEE floating-point arithmetic exception handling. */ #if defined(__STDC__) && !defined(_FILEDEFED) #define _FILEDEFED typedef __FILE FILE; #endif typedef int sigfpe_code_type; /* Type of SIGFPE code. */ typedef void (*sigfpe_handler_type)(); /* Pointer to exception handler */ #define SIGFPE_DEFAULT (void (*)())0 /* default exception handling */ #define SIGFPE_IGNORE (void (*)())1 /* ignore this exception or code */ #define SIGFPE_ABORT (void (*)())2 /* force abort on exception */ extern sigfpe_handler_type sigfpe(sigfpe_code_type, sigfpe_handler_type); /* * Types for IEEE floating point. */ typedef float single; #ifndef _EXTENDED #define _EXTENDED typedef unsigned extended[3]; #endif typedef long double quadruple; /* Quadruple-precision type. */ typedef unsigned fp_exception_field_type; /* * A field containing fp_exceptions OR'ed * together. */ /* * Definitions for base conversion. */ #define DECIMAL_STRING_LENGTH 512 /* Size of buffer in decimal_record. */ typedef char decimal_string[DECIMAL_STRING_LENGTH]; /* Decimal significand. */ typedef struct { enum fp_class_type fpclass; int sign; int exponent; decimal_string ds; /* Significand - each char contains an ascii */ /* digit, except the string-terminating */ /* ascii null. */ int more; /* On conversion from decimal to binary, != 0 */ /* indicates more non-zero digits following */ /* ds. */ int ndigits; /* On fixed_form conversion from binary to */ /* decimal, contains number of digits */ /* required for ds. */ } decimal_record; enum decimal_form { fixed_form, /* Fortran F format: ndigits specifies number */ /* of digits after point; if negative, */ /* specifies rounding to occur to left of */ /* point. */ floating_form /* Fortran E format: ndigits specifies number */ /* of significant digits. */ }; typedef struct { enum fp_direction_type rd; /* Rounding direction. */ enum decimal_form df; /* Format for conversion from binary to */ /* decimal. */ int ndigits; /* Number of digits for conversion. */ } decimal_mode; enum decimal_string_form { /* Valid decimal number string formats. */ invalid_form, /* Not a valid decimal string format. */ whitespace_form, /* All white space - valid in Fortran! */ fixed_int_form, /* */ fixed_intdot_form, /* . */ fixed_dotfrac_form, /* . */ fixed_intdotfrac_form, /* . */ floating_int_form, /* */ floating_intdot_form, /* . */ floating_dotfrac_form, /* . */ floating_intdotfrac_form, /* . */ inf_form, /* inf */ infinity_form, /* infinity */ nan_form, /* nan */ nanstring_form /* nan(string) */ }; extern void single_to_decimal(single *, decimal_mode *, decimal_record *, fp_exception_field_type *); extern void double_to_decimal(double *, decimal_mode *, decimal_record *, fp_exception_field_type *); extern void extended_to_decimal(extended *, decimal_mode *, decimal_record *, fp_exception_field_type *); extern void quadruple_to_decimal(quadruple *, decimal_mode *, decimal_record *, fp_exception_field_type *); extern void decimal_to_single(single *, decimal_mode *, decimal_record *, fp_exception_field_type *); extern void decimal_to_double(double *, decimal_mode *, decimal_record *, fp_exception_field_type *); extern void decimal_to_extended(extended *, decimal_mode *, decimal_record *, fp_exception_field_type *); extern void decimal_to_quadruple(quadruple *, decimal_mode *, decimal_record *, fp_exception_field_type *); extern void string_to_decimal(char **, int, int, decimal_record *, enum decimal_string_form *, char **); extern void func_to_decimal(char **, int, int, decimal_record *, enum decimal_string_form *, char **, int (*)(void), int *, int (*)(int)); extern void file_to_decimal(char **, int, int, decimal_record *, enum decimal_string_form *, char **, FILE *, int *); extern char *seconvert(single *, int, int *, int *, char *); extern char *sfconvert(single *, int, int *, int *, char *); extern char *sgconvert(single *, int, int, char *); extern char *econvert(double, int, int *, int *, char *); extern char *fconvert(double, int, int *, int *, char *); extern char *gconvert(double, int, int, char *); extern char *qeconvert(quadruple *, int, int *, int *, char *); extern char *qfconvert(quadruple *, int, int *, int *, char *); extern char *qgconvert(quadruple *, int, int, char *); extern char *ecvt(double, int, int *, int *); extern char *fcvt(double, int, int *, int *); extern char *gcvt(double, int, char *); #if __cplusplus >= 199711L namespace std { #endif /* * ANSI C Standard says the following entry points should be * prototyped in . They are now, but weren't before. */ extern double atof(const char *); extern double strtod(const char *, char **); #if __cplusplus >= 199711L } using std::atof; using std::strtod; #endif /* end of namespace std */ #ifdef __cplusplus } #endif #endif /* _FLOATINGPOINT_H */ /* * 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 2014 Garrett D'Amore * Copyright 2014-2015 PALO, Richard. * * Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _FMTMSG_H #define _FMTMSG_H #include #ifdef __cplusplus extern "C" { #endif /* * fmtmsg.h * * The 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. */ /* * 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 *)0) #define MM_NULLSEV MM_NOSEV #define MM_NULLMC MM_NULL #define MM_NULLTXT ((char *)0) #define MM_NULLACT ((char *)0) #define MM_NULLTAG ((char *)0) /* * 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__) int addseverity(int, const char *); #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ int fmtmsg(long, const char *, int, const char *, const char *, const char *); #ifdef __cplusplus } #endif #endif /* _FMTMSG_H */ /* * 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 2014 Garrett D'Amore * Copyright (c) 1994 by Sun Microsystems, Inc. * Copyright 1985, 1994 by Mortice Kern Systems Inc. All rights reserved. */ #ifndef _FNMATCH_H #define _FNMATCH_H #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_CASEFOLD 0x08 /* Ignore case when making comparisons */ /* (for FreeBSD/Linux compatibility) */ #define FNM_LEADING_DIR 0x10 /* Match if pattern matches initial segment */ /* of str which is followed by a slash */ #define FNM_NOMATCH 1 /* string doesnt match the specified pattern */ #define FNM_ERROR 2 /* error occured */ #define FNM_NOSYS 3 /* Function (XPG4) not supported */ extern int fnmatch(const char *, const char *, int); #ifdef __cplusplus } #endif #endif /* _FNMATCH_H */ /* * Copyright (c) 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. 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. */ #ifndef _FTS_H #define _FTS_H #ifdef __cplusplus extern "C" { #endif typedef struct { struct _ftsent *fts_cur; /* current node */ struct _ftsent *fts_child; /* linked list of children */ struct _ftsent **fts_array; /* sort array */ dev_t fts_dev; /* starting device # */ char *fts_path; /* path for this descent */ int fts_rfd; /* fd for root */ size_t fts_pathlen; /* sizeof(path) */ int fts_nitems; /* elements in the sort array */ int (*fts_compar)(); /* compare function */ #define FTS_COMFOLLOW 0x0001 /* follow command line symlinks */ #define FTS_LOGICAL 0x0002 /* logical walk */ #define FTS_NOCHDIR 0x0004 /* don't change directories */ #define FTS_NOSTAT 0x0008 /* don't get stat info */ #define FTS_PHYSICAL 0x0010 /* physical walk */ #define FTS_SEEDOT 0x0020 /* return dot and dot-dot */ #define FTS_XDEV 0x0040 /* don't cross devices */ #define FTS_OPTIONMASK 0x00ff /* valid user option mask */ #define FTS_NAMEONLY 0x1000 /* (private) child names only */ #define FTS_STOP 0x2000 /* (private) unrecoverable error */ int fts_options; /* fts_open options, global flags */ } FTS; typedef struct _ftsent { struct _ftsent *fts_cycle; /* cycle node */ struct _ftsent *fts_parent; /* parent directory */ struct _ftsent *fts_link; /* next file in directory */ long fts_number; /* local numeric value */ void *fts_pointer; /* local address value */ char *fts_accpath; /* access path */ char *fts_path; /* root path */ int fts_errno; /* errno for this node */ int fts_symfd; /* fd for symlink */ size_t fts_pathlen; /* strlen(fts_path) */ size_t fts_namelen; /* strlen(fts_name) */ ino_t fts_ino; /* inode */ dev_t fts_dev; /* device */ nlink_t fts_nlink; /* link count */ #define FTS_ROOTPARENTLEVEL -1 #define FTS_ROOTLEVEL 0 #define FTS_MAXLEVEL 0x7fffffff int fts_level; /* depth (-1 to N) */ #define FTS_D 1 /* preorder directory */ #define FTS_DC 2 /* directory that causes cycles */ #define FTS_DEFAULT 3 /* none of the above */ #define FTS_DNR 4 /* unreadable directory */ #define FTS_DOT 5 /* dot or dot-dot */ #define FTS_DP 6 /* postorder directory */ #define FTS_ERR 7 /* error; errno is set */ #define FTS_F 8 /* regular file */ #define FTS_INIT 9 /* initialized only */ #define FTS_NS 10 /* stat(2) failed */ #define FTS_NSOK 11 /* no stat(2) requested */ #define FTS_SL 12 /* symbolic link */ #define FTS_SLNONE 13 /* symbolic link without target */ unsigned short fts_info; /* user flags for FTSENT structure */ #define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */ #define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */ unsigned short fts_flags; /* private flags for FTSENT structure */ #define FTS_AGAIN 1 /* read node again */ #define FTS_FOLLOW 2 /* follow symbolic link */ #define FTS_NOINSTR 3 /* no instructions */ #define FTS_SKIP 4 /* discard node */ unsigned short fts_instr; /* fts_set() instructions */ unsigned short fts_spare; /* unused */ struct stat *fts_statp; /* stat(2) information */ char fts_name[1]; /* file name */ } FTSENT; #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 #ifdef __PRAGMA_REDEFINE_EXTNAME #pragma redefine_extname fts_children fts_children64 #pragma redefine_extname fts_close fts_close64 #pragma redefine_extname fts_open fts_open64 #pragma redefine_extname fts_read fts_read64 #pragma redefine_extname fts_set fts_set64 #else #define fts_children fts_children64 #define fts_close fts_close64 #define fts_open fts_open64 #define fts_read fts_read64 #define fts_set fts_set64 #endif /* __PRAGMA_REDEFINE_EXTNAME */ #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ FTSENT *fts_children(FTS *, int); int fts_close(FTS *); FTS *fts_open(char * const *, int, int (*)(const FTSENT **, const FTSENT **)); FTSENT *fts_read(FTS *); int fts_set(FTS *, FTSENT *, int); #ifdef __cplusplus } #endif #endif /* !_FTS_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2007 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 #include #include #include #ifdef __cplusplus extern "C" { #endif /* * Codes for the third argument to the user-supplied function. */ #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 */ #define FTW_DL 8 /* private interface for find utility */ /* * Codes for the fourth argument to nftw. 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 */ #define FTW_NOLOOP 0100 /* 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 */ 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 .. */ #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 */ /* * 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 #include #include #include #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 */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Copyright 2020 Joyent Inc. */ /* * GNU-like getopt_long(), getopt_long_only(). * Solaris-specific getopt_clip(). */ #ifndef _GETOPT_H #define _GETOPT_H #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 { const 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. */ 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 *); #ifdef __cplusplus } #endif #endif /* _GETOPT_H */ /* * 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 2014 Garrett D'Amore * * Copyright 1989 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ #ifndef _GETWIDTH_H #define _GETWIDTH_H #include #ifdef __cplusplus extern "C" { #endif extern void getwidth(eucwidth_t *); #ifdef __cplusplus } #endif #endif /* _GETWIDTH_H */ /* * 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 2014 Garrett D'Amore * Copyright 1985, 1992 by Mortice Kern Systems Inc. All rights reserved. */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Guido van Rossum. * * 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. 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. * * @(#)glob.h 8.1 (Berkeley) 6/2/93 */ /* * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright (c) 2013 Gary Mills */ #ifndef _GLOB_H #define _GLOB_H #include #include #include #include #ifdef __cplusplus extern "C" { #endif typedef struct glob_t { /* * Members specified by POSIX */ size_t gl_pathc; /* Total count of paths matched by pattern */ char **gl_pathv; /* List of matched pathnames */ size_t gl_offs; /* # of slots reserved in gl_pathv */ /* * Internal-use members: * * NB: The next two members are carried in both the * libc backward compatibility wrapper functions and * the extended functions. */ char **gl_pathp; /* gl_pathv + gl_offs */ int gl_pathn; /* # of elements allocated */ /* * Non-POSIX extensions * * NB: The following members are not carried in * the libc backward compatibility wrapper functions. */ int gl_matchc; /* Count of paths matching pattern. */ int gl_flags; /* Copy of flags parameter to glob. */ struct stat **gl_statv; /* Stat entries corresponding to gl_pathv */ /* * Alternate filesystem access methods for glob; replacement * versions of closedir(3), readdir(3), opendir(3), stat(2) * and lstat(2). */ void (*gl_closedir)(void *); struct dirent *(*gl_readdir)(void *); void *(*gl_opendir)(const char *); int (*gl_lstat)(const char *, struct stat *); int (*gl_stat)(const char *, struct stat *); } glob_t; /* * POSIX "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 */ /* * Non-POSIX "flags" argument to glob function, from OpenBSD. */ #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) #define GLOB_POSIX 0x007F /* All POSIX flags */ #define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ #define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ #define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ #define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ #define GLOB_LIMIT 0x2000 /* Limit pattern match output to ARG_MAX */ #define GLOB_KEEPSTAT 0x4000 /* Retain stat data for paths in gl_statv. */ #define GLOB_ALTDIRFUNC 0x8000 /* Use alternately specified directory funcs. */ #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ /* * 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 */ #define GLOB_ABEND GLOB_ABORTED /* backward compatibility */ #ifdef __PRAGMA_REDEFINE_EXTNAME #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 #pragma redefine_extname glob _glob_ext64 #pragma redefine_extname globfree _globfree_ext64 #else #pragma redefine_extname glob _glob_ext #pragma redefine_extname globfree _globfree_ext #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ #else /* __PRAGMA_REDEFINE_EXTNAME */ #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 #define glob _glob_ext64 #define globfree _globfree_ext64 #else #define glob _glob_ext #define globfree _globfree_ext #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ #endif /* __PRAGMA_REDEFINE_EXTNAME */ extern int glob(const char *_RESTRICT_KYWD, int, int(*)(const char *, int), glob_t *_RESTRICT_KYWD); extern void globfree(glob_t *); #ifdef __cplusplus } #endif #endif /* _GLOB_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Copyright 2020 Joyent, Inc. */ #ifndef _GRP_H #define _GRP_H #include #include #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) #include #endif #ifdef __cplusplus extern "C" { #endif struct group { /* see getgrent(3C) */ char *gr_name; char *gr_passwd; gid_t gr_gid; char **gr_mem; }; 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); extern int getgrouplist(const char *, gid_t, gid_t *, int *); #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)... */ /* * 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 (_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 *, size_t, struct group **); extern int getgrnam_r(const char *, struct group *, char *, size_t, 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 **); static int getgrgid_r(gid_t __gid, struct group *__grp, char *__buf, size_t __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, size_t __len, struct group **__res) { return (__posix_getgrnam_r(__cb, __grp, __buf, __len, __res)); } #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) || ... */ #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)... */ #ifdef __cplusplus } #endif #endif /* _GRP_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _ICONV_H #define _ICONV_H #include #include #ifdef __cplusplus extern "C" { #endif typedef struct _iconv_info *iconv_t; 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); #ifdef __cplusplus } #endif #endif /* _ICONV_H */ /* * 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 2014 Garrett D'Amore * * 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 #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; extern fpclass_t fpclass(double); /* get class of double value */ extern int finite(double); extern int unordered(double, double); /* * 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 extern fp_rnd fpsetround(fp_rnd); /* set rounding mode, return previous */ extern fp_rnd fpgetround(void); /* return current rounding mode */ /* * 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 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 */ /* * UTILITY MACROS ******************************************** */ extern int isnanf(float); extern int isnand(double); #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2022 Sebastian Wiedenroth */ #ifndef _IFADDRS_H #define _IFADDRS_H #ifdef __cplusplus extern "C" { #endif #include /* * The `getifaddrs' function generates a linked list of these structures. * Each element of the list describes one network interface. */ #if defined(_INT64_TYPE) struct ifaddrs { struct ifaddrs *ifa_next; /* Pointer to the next structure. */ char *ifa_name; /* Name of this network interface. */ uint64_t ifa_flags; /* Flags as from SIOCGLIFFLAGS ioctl. */ struct sockaddr *ifa_addr; /* Network address of this interface. */ struct sockaddr *ifa_netmask; /* Netmask of this interface. */ union { /* * At most one of the following two is valid. If the * IFF_BROADCAST bit is set in `ifa_flags', then * `ifa_broadaddr' is valid. If the IFF_POINTOPOINT bit is * set, then `ifa_dstaddr' is valid. It is never the case that * both these bits are set at once. */ struct sockaddr *ifu_broadaddr; struct sockaddr *ifu_dstaddr; } ifa_ifu; void *ifa_data; /* Address-specific data (may be unused). */ /* * This may have been defined in . */ #ifndef ifa_broadaddr #define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ #endif #ifndef ifa_dstaddr #define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of p-to-p link */ #endif }; #endif #ifdef __PRAGMA_REDEFINE_EXTNAME #pragma redefine_extname getifaddrs __getifaddrs #else extern int __getifaddrs(struct ifaddrs **); #define getifaddrs __getifaddrs #endif /* * Create a linked list of `struct ifaddrs' structures, one for each * network interface on the host machine. If successful, store the * list in *ifap and return 0. On errors, return -1 and set `errno'. * * The storage returned in *ifap is allocated dynamically and can * only be properly freed by passing it to `freeifaddrs'. */ extern int getifaddrs(struct ifaddrs **); /* Reclaim the storage allocated by a previous `getifaddrs' call. */ extern void freeifaddrs(struct ifaddrs *); #ifdef __cplusplus } #endif #endif /* _IFADDRS_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _INTTYPES_H #define _INTTYPES_H /* * This file, , 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 #include #if (!defined(_XOPEN_SOURCE) || defined(_XPG6)) || defined(_STDC_C99) || \ defined(__EXTENSIONS__) #include #endif #ifdef __cplusplus extern "C" { #endif /* Inclusion of 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 its 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__) 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); #endif /* (!defined(_XOPEN_SOURCE) || defined(_XPG6)) ... */ #ifdef __cplusplus } #endif #endif /* _INTTYPES_H */ /* * 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 2016 Joyent, Inc. * Copyright 2025 Oxide Computer Company * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _ISO_ASSERT_ISO_H #define _ISO_ASSERT_ISO_H /* * This file contains all of the portions of the assert.h implementation that we * wish to be re-entrant safe. This is not in as a number of * third-party applications have tried to use their own wrappers that use a * header guard, which lead to us losing the definitions that we need to have. * While those applications are potentially using the implementation namespace * incorrectly, separating out the two logical uses is helpful nonetheless and * hopefully makes it clearer what is what. * * This header should not be included directly by applications! */ #include #ifdef __cplusplus extern "C" { #endif /* * This does not use _STDC_C99 as it must match the definition of assert in * . Many C++ compilers on illumos have defined either a * __STDC_VERSION__ or the internal definitions such as _STDC_C99 so mixing * these can result in either missing the macro or the function prototype. */ #if (__cplusplus - 0 >= 201103L) || (__STDC_VERSION__ - 0 >= 199901L) extern _NORETURN_KYWD void __assert_c99(const char *, const char *, int, const char *) __NORETURN; #else extern _NORETURN_KYWD void __assert(const char *, const char *, int) __NORETURN; #endif /* __cplusplus - 0 >= 201103L || (__STDC_VERSION__ - 0 >= 199901L) */ /* * In C11 the static_assert macro is always defined, unlike the assert macro. * Starting in C23, static_assert is a keyword, so this is no longer required. */ #if defined(_STDC_C11) && !defined(__cplusplus) && !defined(_STDC_C23) #define static_assert _Static_assert #endif /* _STDC_C11 && !defined(__cplusplus) && !_STDC_C23 */ #ifdef __cplusplus } #endif #endif /* _ISO_ASSERT_ISO_H */ /* * 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 2014 Garrett D'Amore * * 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 . */ #ifndef _ISO_CTYPE_ISO_H #define _ISO_CTYPE_ISO_H #include #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) extern unsigned char __ctype[]; extern unsigned int *__ctype_mask; extern int *__trans_upper; extern int *__trans_lower; #if __cplusplus >= 199711L namespace std { #endif /* * These used to be macros, which while more efficient, precludes operation * with thread specific locales. The old macros will still work, but new * code compiles to use functions. This is specifically permitted by the * various standards. Only _tolower and _toupper were required to be * delivered in macro form. */ 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); #if defined(_XPG6) || defined(_STDC_C99) || !defined(_STRICT_SYMBOLS) extern int isblank(int); #endif extern int tolower(int); extern int toupper(int); #if __cplusplus >= 199711L } /* end of namespace std */ #endif #ifdef __cplusplus } #endif #endif /* _ISO_CTYPE_ISO_H */ /* * 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 . */ #ifndef _ISO_LIMITS_ISO_H #define _ISO_LIMITS_ISO_H #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 */ /* * 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 2014 Garrett D'Amore * Copyright 2014 PALO, Richard. * * 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 . */ #ifndef _ISO_LOCALE_ISO_H #define _ISO_LOCALE_ISO_H #include #include #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, but all instances of this structure created * by libc include space for the new fields. The new fields are excluded in a * strictly-conforming pre-C99 environment if _LCONV_C99 is not also defined. */ #if !defined(_STRICT_SYMBOLS) || 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 extern char *setlocale(int, const char *); extern struct lconv *localeconv(void); #if __cplusplus >= 199711L } #endif /* end of namespace std */ #ifdef __cplusplus } #endif #endif /* _ISO_LOCALE_ISO_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2011 Nexenta Systems, Inc. All rights reserved. */ /* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _ISO_MATH_C99_H #define _ISO_MATH_C99_H #include #include #ifdef __cplusplus extern "C" { #endif #undef FP_ZERO #define FP_ZERO 0 #undef FP_SUBNORMAL #define FP_SUBNORMAL 1 #undef FP_NORMAL #define FP_NORMAL 2 #undef FP_INFINITE #define FP_INFINITE 3 #undef FP_NAN #define FP_NAN 4 #if defined(_STDC_C99) || _XOPEN_SOURCE - 0 >= 600 || defined(__C99FEATURES__) #if defined(__GNUC__) #undef HUGE_VAL #define HUGE_VAL (__builtin_huge_val()) #undef HUGE_VALF #define HUGE_VALF (__builtin_huge_valf()) #undef HUGE_VALL #define HUGE_VALL (__builtin_huge_vall()) #undef INFINITY #define INFINITY (__builtin_inff()) #undef NAN #define NAN (__builtin_nanf("")) /* * C99 7.12.3 classification macros */ #undef isnan #undef isinf #if __GNUC__ >= 4 #define fpclassify(x) __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, \ FP_SUBNORMAL, FP_ZERO, x) #define isnan(x) __builtin_isnan(x) #define isinf(x) __builtin_isinf(x) #define isfinite(x) (__builtin_isfinite(x) != 0) #define isnormal(x) (__builtin_isnormal(x) != 0) #define signbit(x) (__builtin_signbit(x) != 0) #else /* __GNUC__ >= 4 */ #define isnan(x) __extension__( \ { __typeof(x) __x_n = (x); \ __builtin_isunordered(__x_n, __x_n); }) #define isinf(x) __extension__( \ { __typeof(x) __x_i = (x); \ __x_i == (__typeof(__x_i)) INFINITY || \ __x_i == (__typeof(__x_i)) (-INFINITY); }) #undef isfinite #define isfinite(x) __extension__( \ { __typeof(x) __x_f = (x); \ !isnan(__x_f) && !isinf(__x_f); }) #undef isnormal #define isnormal(x) __extension__( \ { __typeof(x) __x_r = (x); isfinite(__x_r) && \ (sizeof (__x_r) == sizeof (float) ? \ __builtin_fabsf(__x_r) >= __FLT_MIN__ : \ sizeof (__x_r) == sizeof (double) ? \ __builtin_fabs(__x_r) >= __DBL_MIN__ : \ __builtin_fabsl(__x_r) >= __LDBL_MIN__); }) #undef fpclassify #define fpclassify(x) __extension__( \ { __typeof(x) __x_c = (x); \ isnan(__x_c) ? FP_NAN : \ isinf(__x_c) ? FP_INFINITE : \ isnormal(__x_c) ? FP_NORMAL : \ __x_c == (__typeof(__x_c)) 0 ? FP_ZERO : \ FP_SUBNORMAL; }) #undef signbit #if defined(_BIG_ENDIAN) #define signbit(x) __extension__( \ { __typeof(x) __x_s = (x); \ (int)(*(unsigned *)&__x_s >> 31); }) #elif defined(_LITTLE_ENDIAN) #define signbit(x) __extension__( \ { __typeof(x) __x_s = (x); \ (sizeof (__x_s) == sizeof (float) ? \ (int)(*(unsigned *)&__x_s >> 31) : \ sizeof (__x_s) == sizeof (double) ? \ (int)(((unsigned *)&__x_s)[1] >> 31) : \ (int)(((unsigned short *)&__x_s)[4] >> 15)); }) #endif /* defined(_BIG_ENDIAN) */ #endif /* __GNUC__ >= 4 */ /* * C99 7.12.14 comparison macros */ #undef isgreater #define isgreater(x, y) __builtin_isgreater(x, y) #undef isgreaterequal #define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) #undef isless #define isless(x, y) __builtin_isless(x, y) #undef islessequal #define islessequal(x, y) __builtin_islessequal(x, y) #undef islessgreater #define islessgreater(x, y) __builtin_islessgreater(x, y) #undef isunordered #define isunordered(x, y) __builtin_isunordered(x, y) #else /* defined(__GNUC__) */ #undef HUGE_VAL #define HUGE_VAL __builtin_huge_val #undef HUGE_VALF #define HUGE_VALF __builtin_huge_valf #undef HUGE_VALL #define HUGE_VALL __builtin_huge_vall #undef INFINITY #define INFINITY __builtin_infinity #undef NAN #define NAN __builtin_nan /* * C99 7.12.3 classification macros */ #undef fpclassify #define fpclassify(x) __builtin_fpclassify(x) #undef isfinite #define isfinite(x) __builtin_isfinite(x) #undef isinf #define isinf(x) __builtin_isinf(x) #undef isnan #define isnan(x) __builtin_isnan(x) #undef isnormal #define isnormal(x) __builtin_isnormal(x) #undef signbit #define signbit(x) __builtin_signbit(x) /* * C99 7.12.14 comparison macros */ #undef isgreater #define isgreater(x, y) ((x) __builtin_isgreater(y)) #undef isgreaterequal #define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y)) #undef isless #define isless(x, y) ((x) __builtin_isless(y)) #undef islessequal #define islessequal(x, y) ((x) __builtin_islessequal(y)) #undef islessgreater #define islessgreater(x, y) ((x) __builtin_islessgreater(y)) #undef isunordered #define isunordered(x, y) ((x) __builtin_isunordered(y)) #endif /* defined(__GNUC__) */ #endif /* defined(_STDC_C99) || _XOPEN_SOURCE - 0 >= 600 || ... */ #if defined(__EXTENSIONS__) || defined(_STDC_C99) || \ (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ defined(__C99FEATURES__) #if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ - 0 == 0 typedef float float_t; typedef double double_t; #elif __FLT_EVAL_METHOD__ - 0 == 1 typedef double float_t; typedef double double_t; #elif __FLT_EVAL_METHOD__ - 0 == 2 typedef long double float_t; typedef long double double_t; #elif defined(__sparc) || defined(__amd64) typedef float float_t; typedef double double_t; #elif defined(__i386) typedef long double float_t; typedef long double double_t; #endif #undef FP_ILOGB0 #define FP_ILOGB0 (-2147483647) #undef FP_ILOGBNAN #define FP_ILOGBNAN 2147483647 #undef MATH_ERRNO #define MATH_ERRNO 1 #undef MATH_ERREXCEPT #define MATH_ERREXCEPT 2 #undef math_errhandling #define math_errhandling MATH_ERREXCEPT extern double acosh(double); extern double asinh(double); extern double atanh(double); extern double exp2(double); extern double expm1(double); extern int ilogb(double); extern double log1p(double); extern double log2(double); extern double logb(double); extern double scalbn(double, int); extern double scalbln(double, long int); extern double cbrt(double); extern double hypot(double, double); extern double erf(double); extern double erfc(double); extern double lgamma(double); extern double tgamma(double); extern double nearbyint(double); extern double rint(double); extern long int lrint(double); extern double round(double); extern long int lround(double); extern double trunc(double); extern double remainder(double, double); extern double remquo(double, double, int *); extern double copysign(double, double); extern double nan(const char *); extern double nextafter(double, double); extern double nexttoward(double, long double); extern double fdim(double, double); extern double fmax(double, double); extern double fmin(double, double); extern double fma(double, double, double); extern float acosf(float); extern float asinf(float); extern float atanf(float); extern float atan2f(float, float); extern float cosf(float); extern float sinf(float); extern float tanf(float); extern float acoshf(float); extern float asinhf(float); extern float atanhf(float); extern float coshf(float); extern float sinhf(float); extern float tanhf(float); extern float expf(float); extern float exp2f(float); extern float expm1f(float); extern float frexpf(float, int *); extern int ilogbf(float); extern float ldexpf(float, int); extern float logf(float); extern float log10f(float); extern float log1pf(float); extern float log2f(float); extern float logbf(float); extern float modff(float, float *); extern float scalbnf(float, int); extern float scalblnf(float, long int); extern float cbrtf(float); extern float fabsf(float); extern float hypotf(float, float); extern float powf(float, float); extern float sqrtf(float); extern float erff(float); extern float erfcf(float); extern float lgammaf(float); extern float tgammaf(float); extern float ceilf(float); extern float floorf(float); extern float nearbyintf(float); extern float rintf(float); extern long int lrintf(float); extern float roundf(float); extern long int lroundf(float); extern float truncf(float); extern float fmodf(float, float); extern float remainderf(float, float); extern float remquof(float, float, int *); extern float copysignf(float, float); extern float nanf(const char *); extern float nextafterf(float, float); extern float nexttowardf(float, long double); extern float fdimf(float, float); extern float fmaxf(float, float); extern float fminf(float, float); extern float fmaf(float, float, float); extern long double acosl(long double); extern long double asinl(long double); extern long double atanl(long double); extern long double atan2l(long double, long double); extern long double cosl(long double); extern long double sinl(long double); extern long double tanl(long double); extern long double acoshl(long double); extern long double asinhl(long double); extern long double atanhl(long double); extern long double coshl(long double); extern long double sinhl(long double); extern long double tanhl(long double); extern long double expl(long double); extern long double exp2l(long double); extern long double expm1l(long double); extern long double frexpl(long double, int *); extern int ilogbl(long double); extern long double ldexpl(long double, int); extern long double logl(long double); extern long double log10l(long double); extern long double log1pl(long double); extern long double log2l(long double); extern long double logbl(long double); extern long double modfl(long double, long double *); extern long double scalbnl(long double, int); extern long double scalblnl(long double, long int); extern long double cbrtl(long double); extern long double fabsl(long double); extern long double hypotl(long double, long double); extern long double powl(long double, long double); extern long double sqrtl(long double); extern long double erfl(long double); extern long double erfcl(long double); extern long double lgammal(long double); extern long double tgammal(long double); extern long double ceill(long double); extern long double floorl(long double); extern long double nearbyintl(long double); extern long double rintl(long double); extern long int lrintl(long double); extern long double roundl(long double); extern long int lroundl(long double); extern long double truncl(long double); extern long double fmodl(long double, long double); extern long double remainderl(long double, long double); extern long double remquol(long double, long double, int *); extern long double copysignl(long double, long double); extern long double nanl(const char *); extern long double nextafterl(long double, long double); extern long double nexttowardl(long double, long double); extern long double fdiml(long double, long double); extern long double fmaxl(long double, long double); extern long double fminl(long double, long double); extern long double fmal(long double, long double, long double); #if !defined(_STRICT_STDC) && !defined(_NO_LONGLONG) || defined(_STDC_C99) || \ defined(__C99FEATURES__) extern long long int llrint(double); extern long long int llround(double); extern long long int llrintf(float); extern long long int llroundf(float); extern long long int llrintl(long double); extern long long int llroundl(long double); #endif #endif /* defined(__EXTENSIONS__) || defined(_STDC_C99) || ... */ #ifdef __cplusplus } #endif #endif /* _ISO_MATH_C99_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2011 Nexenta Systems, Inc. All rights reserved. */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _ISO_MATH_ISO_H #define _ISO_MATH_ISO_H #include #ifdef __cplusplus extern "C" { #endif #if !defined(_STDC_C99) && _XOPEN_SOURCE - 0 < 600 && !defined(__C99FEATURES__) typedef union _h_val { unsigned long _i[sizeof (double) / sizeof (unsigned long)]; double _d; } _h_val; #ifdef __STDC__ extern const _h_val __huge_val; #else extern _h_val __huge_val; #endif #undef HUGE_VAL #define HUGE_VAL __huge_val._d #endif /* !defined(_STDC_C99) && _XOPEN_SOURCE - 0 < 600 && ... */ #if __cplusplus >= 199711L namespace std { #endif extern double acos(double); extern double asin(double); extern double atan(double); extern double atan2(double, double); extern double cos(double); extern double sin(double); extern double tan(double); extern double cosh(double); extern double sinh(double); extern double tanh(double); extern double exp(double); extern double frexp(double, int *); extern double ldexp(double, int); extern double log(double); extern double log10(double); extern double modf(double, double *); extern double pow(double, double); extern double sqrt(double); extern double ceil(double); extern double fabs(double); extern double floor(double); extern double fmod(double, double); #if defined(__MATHERR_ERRNO_DONTCARE) #pragma does_not_read_global_data(acos, asin, atan, atan2) #pragma does_not_read_global_data(cos, sin, tan, cosh, sinh, tanh) #pragma does_not_read_global_data(exp, log, log10, pow, sqrt) #pragma does_not_read_global_data(frexp, ldexp, modf) #pragma does_not_read_global_data(ceil, fabs, floor, fmod) #pragma does_not_write_global_data(acos, asin, atan, atan2) #pragma does_not_write_global_data(cos, sin, tan, cosh, sinh, tanh) #pragma does_not_write_global_data(exp, log, log10, pow, sqrt) #pragma does_not_write_global_data(ldexp) #pragma does_not_write_global_data(ceil, fabs, floor, fmod) #pragma no_side_effect(acos, asin, atan, atan2) #pragma no_side_effect(cos, sin, tan, cosh, sinh, tanh) #pragma no_side_effect(exp, log, log10, pow, sqrt) #pragma no_side_effect(ldexp) #pragma no_side_effect(ceil, fabs, floor, fmod) #endif #if __cplusplus >= 199711L extern float __acosf(float); extern float __asinf(float); extern float __atanf(float); extern float __atan2f(float, float); extern float __ceilf(float); extern float __cosf(float); extern float __coshf(float); extern float __expf(float); extern float __fabsf(float); extern float __floorf(float); extern float __fmodf(float, float); extern float __frexpf(float, int *); extern float __ldexpf(float, int); extern float __logf(float); extern float __log10f(float); extern float __modff(float, float *); extern float __powf(float, float); extern float __sinf(float); extern float __sinhf(float); extern float __sqrtf(float); extern float __tanf(float); extern float __tanhf(float); extern long double __acosl(long double); extern long double __asinl(long double); extern long double __atanl(long double); extern long double __atan2l(long double, long double); extern long double __ceill(long double); extern long double __cosl(long double); extern long double __coshl(long double); extern long double __expl(long double); extern long double __fabsl(long double); extern long double __floorl(long double); extern long double __fmodl(long double, long double); extern long double __frexpl(long double, int *); extern long double __ldexpl(long double, int); extern long double __logl(long double); extern long double __log10l(long double); extern long double __modfl(long double, long double *); extern long double __powl(long double, long double); extern long double __sinl(long double); extern long double __sinhl(long double); extern long double __sqrtl(long double); extern long double __tanl(long double); extern long double __tanhl(long double); extern "C++" { #undef __X #undef __Y inline double abs(double __X) { return fabs(__X); } inline double pow(double __X, int __Y) { return (pow(__X, (double)(__Y))); } inline float abs(float __X) { return __fabsf(__X); } inline float acos(float __X) { return __acosf(__X); } inline float asin(float __X) { return __asinf(__X); } inline float atan(float __X) { return __atanf(__X); } inline float atan2(float __X, float __Y) { return __atan2f(__X, __Y); } inline float ceil(float __X) { return __ceilf(__X); } inline float cos(float __X) { return __cosf(__X); } inline float cosh(float __X) { return __coshf(__X); } inline float exp(float __X) { return __expf(__X); } inline float fabs(float __X) { return __fabsf(__X); } inline float floor(float __X) { return __floorf(__X); } inline float fmod(float __X, float __Y) { return __fmodf(__X, __Y); } inline float frexp(float __X, int *__Y) { return __frexpf(__X, __Y); } inline float ldexp(float __X, int __Y) { return __ldexpf(__X, __Y); } inline float log(float __X) { return __logf(__X); } inline float log10(float __X) { return __log10f(__X); } inline float modf(float __X, float *__Y) { return __modff(__X, __Y); } inline float pow(float __X, float __Y) { return __powf(__X, __Y); } inline float pow(float __X, int __Y) { return (pow((double)(__X), (double)(__Y))); } inline float sin(float __X) { return __sinf(__X); } inline float sinh(float __X) { return __sinhf(__X); } inline float sqrt(float __X) { return __sqrtf(__X); } inline float tan(float __X) { return __tanf(__X); } inline float tanh(float __X) { return __tanhf(__X); } inline long double abs(long double __X) { return __fabsl(__X); } inline long double acos(long double __X) { return __acosl(__X); } inline long double asin(long double __X) { return __asinl(__X); } inline long double atan(long double __X) { return __atanl(__X); } inline long double atan2(long double __X, long double __Y) { return (__atan2l(__X, __Y)); } inline long double ceil(long double __X) { return __ceill(__X); } inline long double cos(long double __X) { return __cosl(__X); } inline long double cosh(long double __X) { return __coshl(__X); } inline long double exp(long double __X) { return __expl(__X); } inline long double fabs(long double __X) { return __fabsl(__X); } inline long double floor(long double __X) { return __floorl(__X); } inline long double fmod(long double __X, long double __Y) { return (__fmodl(__X, __Y)); } inline long double frexp(long double __X, int *__Y) { return (__frexpl(__X, __Y)); } inline long double ldexp(long double __X, int __Y) { return (__ldexpl(__X, __Y)); } inline long double log(long double __X) { return __logl(__X); } inline long double log10(long double __X) { return __log10l(__X); } inline long double modf(long double __X, long double *__Y) { return (__modfl(__X, __Y)); } inline long double pow(long double __X, long double __Y) { return (__powl(__X, __Y)); } inline long double pow(long double __X, int __Y) { return (__powl(__X, (long double) (__Y))); } inline long double sin(long double __X) { return __sinl(__X); } inline long double sinh(long double __X) { return __sinhl(__X); } inline long double sqrt(long double __X) { return __sqrtl(__X); } inline long double tan(long double __X) { return __tanl(__X); } inline long double tanh(long double __X) { return __tanhl(__X); } } /* end of extern "C++" */ #endif /* __cplusplus >= 199711L */ #if __cplusplus >= 199711L } /* end of namespace std */ #endif #ifdef __cplusplus } #endif #endif /* _ISO_MATH_ISO_H */ /* * 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 2014 Garrett D'Amore * * 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 . */ #ifndef _ISO_SETJMP_ISO_H #define _ISO_SETJMP_ISO_H #include #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) typedef long jmp_buf[_JBLEN]; #else typedef int jmp_buf[_JBLEN]; #endif #else #error "ISA not supported" #endif extern int setjmp(jmp_buf) __RETURNS_TWICE; extern int _setjmp(jmp_buf) __RETURNS_TWICE; extern void longjmp(jmp_buf, int) __NORETURN; extern void _longjmp(jmp_buf, int) __NORETURN; #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 */ /* * 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 2014 Garrett D'Amore * * 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 . */ #ifndef _ISO_SIGNAL_ISO_H #define _ISO_SIGNAL_ISO_H #include #ifdef __cplusplus extern "C" { #endif #if __cplusplus >= 199711L namespace std { #endif typedef int sig_atomic_t; #ifdef __cplusplus extern "C" SIG_PF signal(int, SIG_PF); #else extern void (*signal(int, void (*)(int)))(int); #endif extern int raise(int); #if __cplusplus >= 199711L } #endif /* end of namespace std */ #ifdef __cplusplus } #endif #endif /* _ISO_SIGNAL_ISO_H */ /* * 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 /* * 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 . This organization enables protected use of * the implementation by other standard headers without introducing * names into the users' namespace. */ #include #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 */ /* * 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 . */ #ifndef _ISO_STDARG_ISO_H #define _ISO_STDARG_ISO_H /* * 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 . This organization enables protected use of * the implementation by other standard headers without introducing * names into the users' namespace. */ #include #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 */ /* * 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. */ /* * Copyright 2014 PALO, Richard. * Copyright 2016 Joyent, Inc. */ /* * 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 . */ #ifndef _ISO_STDDEF_ISO_H #define _ISO_STDDEF_ISO_H #include #include #include #ifdef __cplusplus extern "C" { #endif #if __cplusplus >= 199711L namespace std { #endif #if !defined(_PTRDIFF_T) || __cplusplus >= 199711L #define _PTRDIFF_T #if defined(_LP64) 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) 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 !defined(_MAX_ALIGN_T) #if !defined(_STRICT_SYMBOLS) || defined(_STDC_C11) #define _MAX_ALIGN_T typedef _MAX_ALIGNMENT_TYPE max_align_t; #endif /* !_STRICT_SYMBOLS || _STDC_C11 */ #endif /* _MAX_ALIGN_T */ #if __EXT1_VISIBLE /* ISO/IEC 9899:2011 K.3.3.2 */ #ifndef _RSIZE_T_DEFINED #define _RSIZE_T_DEFINED typedef size_t rsize_t; #endif #endif /* __EXT1_VISIBLE */ #ifdef __cplusplus } #endif #endif /* _ISO_STDDEF_ISO_H */ /* * 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 2014 Garrett D'Amore * * 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 #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) */ 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); #endif /* defined(__EXTENSIONS__) ... */ #if defined(__EXTENSIONS__) || defined(_STDC_C99) || \ (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ defined(_XPG5) 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); #endif /* defined(__EXTENSIONS__) || defined(_STDC_C99) ... */ #ifdef __cplusplus } #endif #endif /* _ISO_STDIO_C99_H */ /* * 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 2014 Garrett D'Amore * Copyright 2014 PALO, Richard. * * 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 . */ /* * User-visible pieces of the ANSI C standard I/O package. */ #ifndef _ISO_STDIO_ISO_H #define _ISO_STDIO_ISO_H #include #include #include #include #include /* * If feature test macros are set that enable interfaces that use types * defined in , 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 (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) 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 */ #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) */ extern __FILE __iob[_NFILE]; #define stdin (&__iob[0]) #define stdout (&__iob[1]) #define stderr (&__iob[2]) #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) */ 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 /* * ISO/IEC C11 removed gets from the standard library. Therefore if a strict C11 * environment has been requested, we remove it. */ #if !defined(_STDC_C11) || defined(__EXTENSIONS__) extern char *gets(char *); #endif 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 */ #if __cplusplus >= 199711L } #endif /* end of namespace std */ #if !defined(__lint) #if !defined(_REENTRANT) && !defined(_LP64) #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 */ #endif /* !defined(_REENTRANT) && !defined(_LP64) */ #ifndef _REENTRANT #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 */ /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2016 Joyent, Inc. */ /* * An application should not include this header directly. Instead it * should be included only through the inclusion of other illumos headers. * * The contents of this header is limited to identifiers specified in * the C11 standard and in conflict with the C++ implementation of the * standard header. The C++ standard may adopt the C11 standard at * which point it is expected that the symbols included here will * become part of the C++ std namespace. */ #ifndef _ISO_STDLIB_C11_H #define _ISO_STDLIB_C11_H #include #ifdef __cplusplus extern "C" { #endif #if __cplusplus >= 199711L namespace std { #endif /* * The following have been added as a result of the ISO/IEC 9899:2011 * 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. */ /* * Work around fix-includes and other bad actors with using multiple headers. */ #if !defined(_NORETURN_KYWD) #if __STDC_VERSION__ - 0 >= 201112L #define _NORETURN_KYWD _Noreturn #else #define _NORETURN_KYWD #endif /* __STDC_VERSION__ - 0 >= 201112L */ #endif /* !defined(_NORETURN_KYWD) */ #if !defined(_STRICT_SYMBOLS) || defined(_STDC_C11) extern void *aligned_alloc(size_t, size_t); #endif /* !_STRICT_SYMBOLS || _STDC_C11 */ #if !defined(_STRICT_SYMBOLS) || defined(_STDC_C11) || __cplusplus >= 201103L extern int at_quick_exit(void (*)(void)); extern _NORETURN_KYWD void quick_exit(int); #endif /* !_STRICT_SYMBOLS || _STDC_C11 || __cplusplus >= 201103L */ #if __cplusplus >= 199711L } #endif /* * ISO C11 Annex K functions are not allowed to be in the standard * namespace; however, it is implementation-defined as to whether or * not they are in the global namespace and we opt to make them * available to software. */ #if __EXT1_VISIBLE #ifndef _ERRNO_T_DEFINED #define _ERRNO_T_DEFINED typedef int errno_t; #endif /* K.3.6 */ typedef void (*constraint_handler_t)(const char *_RESTRICT_KYWD, void *_RESTRICT_KYWD, errno_t); /* K.3.6.1.1 */ extern constraint_handler_t set_constraint_handler_s(constraint_handler_t); /* K.3.6.1.2 */ extern _NORETURN_KYWD void abort_handler_s(const char *_RESTRICT_KYWD, void *_RESTRICT_KYWD, errno_t); /* K3.6.1.3 */ extern void ignore_handler_s(const char *_RESTRICT_KYWD, void *_RESTRICT_KYWD, errno_t); #endif /* __EXT1_VISIBLE */ #ifdef __cplusplus } #endif #endif /* _ISO_STDLIB_C11_H */ /* * 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 2014 Garrett D'Amore * * 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 #include #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) */ #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ defined(_STDC_C99) || defined(__EXTENSIONS__) #if !defined(_NORETURN_KYWD) #if __STDC_VERSION__ - 0 >= 201112L #define _NORETURN_KYWD _Noreturn #else #define _NORETURN_KYWD #endif /* __STDC_VERSION__ - 0 >= 201112L */ #endif /* !defined(_NORETURN_KYWD) */ extern _NORETURN_KYWD 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)) ... */ #ifdef __cplusplus } #endif #endif /* _ISO_STDLIB_C99_H */ /* * 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 2014 Garrett D'Amore * Copyright 2014 PALO, Richard. * * 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 . */ #ifndef _ISO_STDLIB_ISO_H #define _ISO_STDLIB_ISO_H #include #include #ifdef __cplusplus extern "C" { #endif unsigned char __mb_cur_max(void); #ifndef MB_CUR_MAX #define MB_CUR_MAX (__mb_cur_max()) #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) typedef unsigned long size_t; /* size of something in bytes */ #else typedef unsigned int size_t; /* (historical version) */ #endif #endif /* !_SIZE_T */ #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 its 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(_NORETURN_KYWD) #if __STDC_VERSION__ - 0 >= 201112L #define _NORETURN_KYWD _Noreturn #else #define _NORETURN_KYWD #endif /* __STDC_VERSION__ - 0 >= 201112L */ #endif /* !defined(_NORETURN_KYWD) */ extern _NORETURN_KYWD 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 && defined(__SUNPRO_CC) extern "C++" { void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); } #endif /* __cplusplus >= 199711L && defined(__SUNPRO_CC) */ extern void *calloc(size_t, size_t); extern div_t div(int, int); extern _NORETURN_KYWD 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 && defined(__SUNPRO_CC) extern "C++" { void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); } #endif /* __cplusplus >= 199711L && defined(__SUNPRO_CC) */ 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 */ #if __cplusplus >= 199711L } #endif /* end of namespace std */ #ifdef __cplusplus } #endif #endif /* _ISO_STDLIB_ISO_H */ /* * 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 2014 Garrett D'Amore * Copyright 2014 PALO, Richard. * * 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 . */ #ifndef _ISO_STRING_ISO_H #define _ISO_STRING_ISO_H #include #include #ifdef __cplusplus extern "C" { #endif #if __cplusplus >= 199711L namespace std { #endif #if !defined(_SIZE_T) || __cplusplus >= 199711L #define _SIZE_T #if defined(_LP64) typedef unsigned long size_t; /* size of something in bytes */ #else typedef unsigned int size_t; /* (historical version) */ #endif #endif /* !_SIZE_T */ 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 */ #if __cplusplus >= 199711L } #endif /* end of namespace std */ /* * ISO C11 Annex K functions are not allowed to be in the standard * namespace; however, it is implementation-defined as to whether or * not they are in the global namespace and we opt to make them * available to software. */ #if __EXT1_VISIBLE #ifndef _RSIZE_T_DEFINED #define _RSIZE_T_DEFINED #if __cplusplus >= 199711L typedef std::size_t rsize_t; #else typedef size_t rsize_t; #endif #endif #ifndef _ERRNO_T_DEFINED #define _ERRNO_T_DEFINED typedef int errno_t; #endif /* ISO/IEC 9899:2011 K.3.7.4.1.1 */ extern errno_t memset_s(void *, rsize_t, int, rsize_t); #endif /* __EXT1_VISIBLE */ #ifdef __cplusplus } #endif #endif /* _ISO_STRING_ISO_H */ /* * 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 2014 Garrett D'Amore * Copyright 2014 PALO, Richard. * * 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 . */ #ifndef _ISO_TIME_ISO_H #define _ISO_TIME_ISO_H #include #include #ifdef __cplusplus extern "C" { #endif #if __cplusplus >= 199711L namespace std { #endif #if !defined(_SIZE_T) || __cplusplus >= 199711L #define _SIZE_T #if defined(_LP64) 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; }; 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); #if __cplusplus >= 199711L } #endif /* end of namespace std */ #ifdef __cplusplus } #endif #endif /* _ISO_TIME_ISO_H */ /* * 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 2014 Garrett D'Amore * * 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 #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) */ #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)... */ #ifdef __cplusplus } #endif #endif /* _ISO_WCHAR_C99_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright 2014 PALO, Richard. * * Copyright 2006 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 . */ #ifndef _ISO_WCHAR_ISO_H #define _ISO_WCHAR_ISO_H #include #include #include #include #include #if (defined(__cplusplus) && (__cplusplus - 0 < 54321L)) || \ (!defined(__cplusplus) && !defined(_STRICT_STDC)) || \ defined(__EXTENSIONS__) #include #endif /* (defined(__cplusplus) && (__cplusplus - 0 < 54321L)) ... */ #if !defined(_STRICT_STDC) || defined(__EXTENSIONS__) #include #include #endif /* !defined(_STRICT_STDC) || defined(__EXTENSIONS__) */ #include #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 its 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) 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 WEOF #if __cplusplus >= 199711L #define WEOF ((std::wint_t)(-1)) #else #define WEOF ((wint_t)(-1)) #endif #endif /* WEOF */ /* 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 */ 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 *); #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) */ 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); #if defined(_XPG7) || !defined(_STRICT_SYMBOLS) extern size_t wcsnrtombs(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD, size_t, size_t, mbstate_t *_RESTRICT_KYWD); #endif 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 */ #if __cplusplus >= 199711L } #endif /* end of namespace std */ #ifdef __cplusplus } #endif #endif /* _ISO_WCHAR_ISO_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2006 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 . */ #ifndef _ISO_WCTYPE_ISO_H #define _ISO_WCTYPE_ISO_H #include #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 #if __cplusplus >= 199711L #define WEOF ((std::wint_t)(-1)) #else #define WEOF ((wint_t)(-1)) #endif #endif /* WEOF */ #endif /* not XPG4 and not XPG4v2 */ 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); #if (__cplusplus >= 201103L) || defined(_STDC_C99) || defined(_XPG6) || \ !defined(_STRICT_SYMBOLS) extern int iswblank(wint_t); #endif /* 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 *); /* 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 */ /* * 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 #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 */ /* * 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 #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 */ /* * 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 #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _KLPD_H #define _KLPD_H #include #include #include #ifdef __cplusplus extern "C" { #endif extern void *klpd_create(boolean_t (*)(void *, const priv_set_t *, void *), void *); extern int klpd_register_id(const priv_set_t *, void *, idtype_t, id_t); extern int klpd_register(const priv_set_t *, void *); extern int klpd_unregister_id(void *, idtype_t, id_t); extern int klpd_unregister(void *); extern const char *klpd_getpath(void *); extern int klpd_getport(void *, int *); extern int klpd_getucred(ucred_t **, void *); #ifdef __cplusplus } #endif #endif /* _KLPD_H */ /* * 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 2014 Garrett D'Amore * * 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 #include #include #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 nl_langinfo(3C) */ char *nl_langinfo(nl_item); /* get a string from the database */ #if defined(_XPG7) || !defined(_STRICT_SYMBOLS) #ifndef _LOCALE_T #define _LOCALE_T typedef struct _locale *locale_t; #endif char *nl_langinfo_l(nl_item, locale_t); #endif #ifdef __cplusplus } #endif #endif /* _LANGINFO_H */ /* * 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 #ifdef __cplusplus extern "C" { #endif #ifdef _LP64 #include #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 */ /* * 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 #ifdef __cplusplus extern "C" { #endif #ifndef _SOLARIS_SDK #define _SOLARIS_SDK #endif #include /* 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 /* 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 */ /* * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * 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 #ifdef __cplusplus extern "C" { #endif #ifndef _SOLARIS_SDK #define _SOLARIS_SDK #endif #ifndef LDAP_TYPE_TIMEVAL_DEFINED #include #endif #ifndef LDAP_TYPE_SOCKET_DEFINED /* API extension */ #include #include #endif #include #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 LDAP_API(void) LDAP_CALL ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e); LDAP_API(LDAPMessage *) LDAP_CALL ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e); /* 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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright 2014 PALO, Richard. All rights reserved. */ #ifndef _LIBELF_H #define _LIBELF_H #include #include #ifdef __cplusplus extern "C" { #endif #if defined(_ILP32) && (_FILE_OFFSET_BITS != 32) #error "large files are not supported by libelf" #endif typedef void Elf_Void; /* * 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_getphnum(Elf *, size_t *); int elf_getphdrnum(Elf *, size_t *); int elf_getshnum(Elf *, size_t *); int elf_getshdrnum(Elf *, size_t *); int elf_getshstrndx(Elf *, size_t *); int elf_getshdrstrndx(Elf *, size_t *); unsigned long elf_hash(const char *); uint_t elf_sys_encoding(void); 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) */ #ifdef __cplusplus } #endif #endif /* _LIBELF_H */ /* * 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 2014 Garrett D'Amore * * 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 #include #include #if !defined(_XPG4_2) || defined(__EXTENSIONS__) #include #include #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ #ifdef __cplusplus extern "C" { #endif extern char *basename(char *); extern char *dirname(char *); #if !defined(_XPG6) || defined(__EXTENSIONS__) extern char *regcmp(const char *, ...); extern char *regex(const char *, const char *, ...); #endif #ifdef _REENTRANT extern char **____loc1(void); #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__) extern char *bgets(char *, size_t, FILE *, char *); extern size_t bufsplit(char *, size_t, char **); #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 */ 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... */ extern int eaccess(const char *, int); extern int gmatch(const char *, const char *); extern int isencrypt(const char *, size_t); extern int mkdirp(const char *, mode_t); extern int p2open(const char *, FILE *[2]); extern int p2close(FILE *[2]); extern char *pathfind(const char *, const char *, const char *); #ifdef _REENTRANT #define __i_size (*(___i_size())) #else extern int __i_size; #endif extern int rmdirp(char *, char *); extern char *strcadd(char *, const char *); extern char *strccpy(char *, const char *); extern char *streadd(char *, const char *, const char *); extern char *strecpy(char *, const char *, const char *); extern int strfind(const char *, const char *); extern char *strrspn(const char *, const char *); extern char *strtrns(const char *, const char *, const char *, char *); #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ #ifdef __cplusplus } #endif #endif /* _LIBGEN_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _LIBINTL_H #define _LIBINTL_H #include #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 its 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 #define __GNU_GETTEXT_SUPPORTED_REVISION(m) \ ((((m) == 0) || ((m) == 1)) ? 1 : -1) 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); #ifdef __cplusplus } #endif #endif /* _LIBINTL_H */ /* * Copyright 2026 Zygaena Project Contributors * * 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 THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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. */ /* * BSD-compatible utility library. * Link with -lutil. */ #ifndef _LIBUTIL_H #define _LIBUTIL_H #include #include #include struct termios; struct winsize; #ifdef __cplusplus extern "C" { #endif /* PTY functions (also available via ) */ int openpty(int *, int *, char *, struct termios *, struct winsize *); pid_t forkpty(int *, char *, struct termios *, struct winsize *); int login_tty(int); /* Atomic open + flock */ int flopen(const char *, int, ...); int flopenat(int, const char *, int, ...); /* PID file management */ struct pidfh; struct pidfh *pidfile_open(const char *, mode_t, pid_t *); int pidfile_write(struct pidfh *); int pidfile_close(struct pidfh *); int pidfile_remove(struct pidfh *); int pidfile_fileno(const struct pidfh *); /* Human-readable number formatting */ #define HN_DECIMAL 0x01 #define HN_NOSPACE 0x02 #define HN_B 0x04 #define HN_DIVISOR_1000 0x08 #define HN_IEC_PREFIXES 0x10 #define HN_GETSCALE 0x10 #define HN_AUTOSCALE 0x20 int humanize_number(char *, size_t, int64_t, const char *, int, int); int expand_number(const char *, uint64_t *); /* Config file line parsing */ #define FPARSELN_UNESCESC 0x01 #define FPARSELN_UNESCCONT 0x02 #define FPARSELN_UNESCCOMM 0x04 #define FPARSELN_UNESCREST 0x08 #define FPARSELN_UNESCALL 0x0f char *fparseln(FILE *, size_t *, size_t *, const char[3], int); #ifdef __cplusplus } #endif #endif /* _LIBUTIL_H */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ #ifndef _LIBW_H #define _LIBW_H #include #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 void getwidth(eucwidth_t *); #ifdef __cplusplus } #endif #endif /* _LIBW_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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) 2003, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _LIBZONECFG_H #define _LIBZONECFG_H /* * 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #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_BAD_ZONE_STATE 21 /* zone state invalid for given task */ #define Z_INVALID_DOCUMENT 22 /* libxml can't validate against DTD */ #define Z_NAME_IN_USE 23 /* zone name already in use (rename) */ #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 Z_PRIV_PROHIBITED 37 /* specified privilege is prohibited */ #define Z_PRIV_REQUIRED 38 /* required privilege is missing */ #define Z_PRIV_UNKNOWN 39 /* specified privilege is unknown */ #define Z_BRAND_ERROR 40 /* brand-specific error */ #define Z_INCOMPATIBLE 41 /* incompatible settings */ #define Z_ALIAS_DISALLOW 42 /* rctl alias disallowed */ #define Z_CLEAR_DISALLOW 43 /* clear property disallowed */ #define Z_POOL 44 /* generic libpool error */ #define Z_POOLS_NOT_ACTIVE 45 /* pool service not enabled */ #define Z_POOL_ENABLE 46 /* pools enable failed */ #define Z_NO_POOL 47 /* no such pool configured */ #define Z_POOL_CREATE 48 /* pool create failed */ #define Z_POOL_BIND 49 /* pool bind failed */ #define Z_INVALID_PROPERTY 50 /* invalid property value */ /* * Warning: these are shared with the admin/install consolidation. * Do not insert states between any of the currently defined states, * and any new states must be evaluated for impact on range comparisons. */ #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_MOUNTED 7 #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" #define MAXUSERNAME (sizeof (((struct utmpx *)0)->ut_name)) #define MAXAUTHS 4096 #define ZONE_MGMT_PROF "Zone Management" /* Owner, group, and mode (defined by packaging) for the config directory */ #define ZONE_CONFIG_UID 0 /* root */ #define ZONE_CONFIG_GID 3 /* sys */ #define ZONE_CONFIG_MODE 0755 /* Owner, group, and mode (defined by packaging) for the index file */ #define ZONE_INDEX_UID 0 /* root */ #define ZONE_INDEX_GID 3 /* sys */ #define ZONE_INDEX_MODE 0644 /* The maximum length of the VERSION string in the pkginfo(5) file. */ #define ZONE_PKG_VERSMAX 256 /* * Shortened alias names for the zones rctls. */ #define ALIAS_MAXLWPS "max-lwps" #define ALIAS_MAXSHMMEM "max-shm-memory" #define ALIAS_MAXSHMIDS "max-shm-ids" #define ALIAS_MAXMSGIDS "max-msg-ids" #define ALIAS_MAXSEMIDS "max-sem-ids" #define ALIAS_MAXLOCKEDMEM "locked" #define ALIAS_MAXSWAP "swap" #define ALIAS_SHARES "cpu-shares" #define ALIAS_CPUCAP "cpu-cap" #define ALIAS_MAXPROCS "max-processes" /* Default name for zone detached manifest */ #define ZONE_DETACHED "SUNWdetached.xml" /* * Bit flag definitions for passing into libzonecfg functions. */ #define ZONE_DRY_RUN 0x01 /* * 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]; /* path to zone storage */ uuid_t zone_uuid; /* unique ID for zone */ char zone_newname[ZONENAME_MAX]; /* for doing renames */ }; 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]; /* shared-ip only */ char zone_nwif_allowed_address[INET6_ADDRSTRLEN]; /* excl-ip only */ char zone_nwif_physical[LIFNAMSIZ]; char zone_nwif_defrouter[INET6_ADDRSTRLEN]; }; 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]; }; struct zone_dstab { char zone_dataset_name[MAXNAMELEN]; }; struct zone_psettab { char zone_ncpu_min[MAXNAMELEN]; char zone_ncpu_max[MAXNAMELEN]; char zone_importance[MAXNAMELEN]; }; struct zone_mcaptab { char zone_physmem_cap[MAXNAMELEN]; }; struct zone_pkgtab { char zone_pkg_name[MAXNAMELEN]; char zone_pkg_version[ZONE_PKG_VERSMAX]; }; struct zone_devpermtab { char zone_devperm_name[MAXPATHLEN]; uid_t zone_devperm_uid; gid_t zone_devperm_gid; mode_t zone_devperm_mode; char *zone_devperm_acl; }; struct zone_admintab { char zone_admin_user[MAXUSERNAME]; char zone_admin_auths[MAXAUTHS]; }; #define ZONECFG_SECFLAGS_MAX 1024 struct zone_secflagstab { char zone_secflags_lower[ZONECFG_SECFLAGS_MAX]; char zone_secflags_upper[ZONECFG_SECFLAGS_MAX]; char zone_secflags_default[ZONECFG_SECFLAGS_MAX]; }; typedef struct zone_userauths { char user[MAXUSERNAME]; char zonename[ZONENAME_MAX]; struct zone_userauths *next; } zone_userauths_t; typedef struct { uu_avl_node_t zpe_entry; char *zpe_name; char *zpe_vers; } zone_pkg_entry_t; typedef enum zone_iptype { ZS_SHARED, ZS_EXCLUSIVE } zone_iptype_t; /* * Basic configuration management routines. */ extern zone_dochandle_t zonecfg_init_handle(void); extern int zonecfg_get_handle(const char *, zone_dochandle_t); extern int zonecfg_get_snapshot_handle(const char *, zone_dochandle_t); extern int zonecfg_get_template_handle(const char *, const char *, zone_dochandle_t); extern int zonecfg_get_xml_handle(const 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 *, boolean_t); extern int zonecfg_destroy_snapshot(const char *); extern int zonecfg_save(zone_dochandle_t); extern int zonecfg_create_snapshot(const char *); extern char *zonecfg_strerror(int); extern int zonecfg_access(const char *, int); extern void zonecfg_set_root(const char *); extern const char *zonecfg_get_root(void); extern boolean_t zonecfg_in_alt_root(void); extern int zonecfg_num_resources(zone_dochandle_t, char *); extern int zonecfg_del_all_resources(zone_dochandle_t, char *); extern boolean_t zonecfg_valid_ncpus(char *, char *); extern boolean_t zonecfg_valid_importance(char *); extern int zonecfg_str_to_bytes(char *, uint64_t *); extern boolean_t zonecfg_valid_memlimit(char *, uint64_t *); extern boolean_t zonecfg_valid_alias_limit(char *, char *, uint64_t *); /* * Zone name, path to zone directory, autoboot setting, pool, boot * arguments, and scheduling-class. */ extern int zonecfg_validate_zonename(const char *); 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_iptype(zone_dochandle_t, zone_iptype_t *); extern int zonecfg_set_iptype(zone_dochandle_t, zone_iptype_t); extern int zonecfg_get_pool(zone_dochandle_t, char *, size_t); extern int zonecfg_set_pool(zone_dochandle_t, char *); extern int zonecfg_get_bootargs(zone_dochandle_t, char *, size_t); extern int zonecfg_set_bootargs(zone_dochandle_t, char *); extern int zonecfg_get_sched_class(zone_dochandle_t, char *, size_t); extern int zonecfg_set_sched(zone_dochandle_t, char *); extern int zonecfg_get_dflt_sched_class(zone_dochandle_t, char *, int); /* * Set/retrieve the brand for the zone */ extern int zonecfg_get_brand(zone_dochandle_t, char *, size_t); extern int zonecfg_set_brand(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_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 struct mnttab *, 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 *); /* * Hostid emulation configuration. */ extern int zonecfg_get_hostid(zone_dochandle_t, char *, size_t); extern int zonecfg_set_hostid(zone_dochandle_t, const char *); /* * Allowed FS mounts configuration. */ extern int zonecfg_get_fs_allowed(zone_dochandle_t, char *, size_t); extern int zonecfg_set_fs_allowed(zone_dochandle_t, const char *); /* * 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 *); /* * 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 *); extern boolean_t zonecfg_aliased_rctl_ok(zone_dochandle_t, char *); extern int zonecfg_set_aliased_rctl(zone_dochandle_t, char *, uint64_t); extern int zonecfg_get_aliased_rctl(zone_dochandle_t, char *, uint64_t *); extern int zonecfg_rm_aliased_rctl(zone_dochandle_t, char *); extern int zonecfg_apply_rctls(char *, zone_dochandle_t); /* * 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 *); /* * ZFS configuration. */ extern int zonecfg_add_ds(zone_dochandle_t, struct zone_dstab *); extern int zonecfg_delete_ds(zone_dochandle_t, struct zone_dstab *); extern int zonecfg_modify_ds(zone_dochandle_t, struct zone_dstab *, struct zone_dstab *); extern int zonecfg_lookup_ds(zone_dochandle_t, struct zone_dstab *); /* * cpu-set configuration. */ extern int zonecfg_add_pset(zone_dochandle_t, struct zone_psettab *); extern int zonecfg_delete_pset(zone_dochandle_t); extern int zonecfg_modify_pset(zone_dochandle_t, struct zone_psettab *); extern int zonecfg_lookup_pset(zone_dochandle_t, struct zone_psettab *); /* * mem-cap configuration. */ extern int zonecfg_delete_mcap(zone_dochandle_t); extern int zonecfg_modify_mcap(zone_dochandle_t, struct zone_mcaptab *); extern int zonecfg_lookup_mcap(zone_dochandle_t, struct zone_mcaptab *); /* security-flags configuration */ extern int zonecfg_add_secflags(zone_dochandle_t, struct zone_secflagstab *); extern int zonecfg_delete_secflags(zone_dochandle_t, struct zone_secflagstab *); extern int zonecfg_modify_secflags(zone_dochandle_t, struct zone_secflagstab *, struct zone_secflagstab *); extern int zonecfg_lookup_secflags(zone_dochandle_t, struct zone_secflagstab *); /* * Temporary pool support functions. */ extern int zonecfg_destroy_tmp_pool(char *, char *, int); extern int zonecfg_bind_tmp_pool(zone_dochandle_t, zoneid_t, char *, int); extern int zonecfg_bind_pool(zone_dochandle_t, zoneid_t, char *, int); extern boolean_t zonecfg_warn_poold(zone_dochandle_t); extern int zonecfg_get_poolname(zone_dochandle_t, char *, char *, size_t); /* * Miscellaneous utility functions. */ extern int zonecfg_enable_rcapd(char *, int); /* * attach/detach support. */ extern int zonecfg_get_attach_handle(const char *, const char *, const char *, boolean_t, zone_dochandle_t); extern int zonecfg_attach_manifest(int, zone_dochandle_t, zone_dochandle_t); extern int zonecfg_detach_save(zone_dochandle_t, uint_t); extern boolean_t zonecfg_detached(const char *); extern void zonecfg_rm_detached(zone_dochandle_t, boolean_t forced); extern int zonecfg_dev_manifest(zone_dochandle_t); extern int zonecfg_devperms_apply(zone_dochandle_t, const char *, uid_t, gid_t, mode_t, const char *); extern void zonecfg_set_swinv(zone_dochandle_t); extern int zonecfg_add_pkg(zone_dochandle_t, char *, char *); /* * External zone verification support. */ extern int zonecfg_verify_save(zone_dochandle_t, char *); /* * '*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_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); extern int zonecfg_setdsent(zone_dochandle_t); extern int zonecfg_getdsent(zone_dochandle_t, struct zone_dstab *); extern int zonecfg_enddsent(zone_dochandle_t); extern int zonecfg_getpsetent(zone_dochandle_t, struct zone_psettab *); extern int zonecfg_getmcapent(zone_dochandle_t, struct zone_mcaptab *); extern int zonecfg_getpkgdata(zone_dochandle_t, uu_avl_pool_t *, uu_avl_t *); extern int zonecfg_setdevperment(zone_dochandle_t); extern int zonecfg_getdevperment(zone_dochandle_t, struct zone_devpermtab *); extern int zonecfg_enddevperment(zone_dochandle_t); extern int zonecfg_setadminent(zone_dochandle_t); extern int zonecfg_getadminent(zone_dochandle_t, struct zone_admintab *); extern int zonecfg_endadminent(zone_dochandle_t); extern int zonecfg_getsecflagsent(zone_dochandle_t, struct zone_secflagstab *); /* * Privilege-related functions. */ extern int zonecfg_default_privset(priv_set_t *, const char *); extern int zonecfg_get_privset(zone_dochandle_t, priv_set_t *, char **); extern int zonecfg_get_limitpriv(zone_dochandle_t, char **); extern int zonecfg_set_limitpriv(zone_dochandle_t, char *); /* * Higher-level routines. */ extern int zone_get_brand(char *, char *, size_t); extern int zone_get_rootpath(char *, char *, size_t); extern int zone_get_devroot(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); extern int zonecfg_get_name_by_uuid(const uuid_t, char *, size_t); extern int zonecfg_get_uuid(const char *, uuid_t); extern int zonecfg_default_brand(char *, size_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 *); extern boolean_t zonecfg_ifname_exists(sa_family_t, char *); /* * 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 *); /* * Live Upgrade support functions. Shared between ON and install gate. */ extern FILE *zonecfg_open_scratch(const char *, boolean_t); extern int zonecfg_lock_scratch(FILE *); extern void zonecfg_close_scratch(FILE *); extern int zonecfg_get_scratch(FILE *, char *, size_t, char *, size_t, char *, size_t); extern int zonecfg_find_scratch(FILE *, const char *, const char *, char *, size_t); extern int zonecfg_reverse_scratch(FILE *, const char *, char *, size_t, char *, size_t); extern int zonecfg_add_scratch(FILE *, const char *, const char *, const char *); extern int zonecfg_delete_scratch(FILE *, const char *); extern boolean_t zonecfg_is_scratch(const char *); /* * zoneadmd support functions. Shared between zoneadm and brand hook code. */ extern void zonecfg_init_lock_file(const char *, char **); extern void zonecfg_release_lock_file(const char *, int); extern int zonecfg_grab_lock_file(const char *, int *); extern boolean_t zonecfg_lock_file_held(int *); extern int zonecfg_ping_zoneadmd(const char *); extern int zonecfg_call_zoneadmd(const char *, zone_cmd_arg_t *, char *, boolean_t); extern int zonecfg_insert_userauths(zone_dochandle_t, char *, char *); extern int zonecfg_remove_userauths(zone_dochandle_t, char *, char *, boolean_t); extern int zonecfg_add_admin(zone_dochandle_t, struct zone_admintab *, char *); extern int zonecfg_delete_admin(zone_dochandle_t, struct zone_admintab *, char *); extern int zonecfg_modify_admin(zone_dochandle_t, struct zone_admintab *, struct zone_admintab *, char *); extern int zonecfg_delete_admins(zone_dochandle_t, char *); extern int zonecfg_lookup_admin(zone_dochandle_t, struct zone_admintab *); extern int zonecfg_authorize_users(zone_dochandle_t, char *); extern int zonecfg_update_userauths(zone_dochandle_t, char *); extern int zonecfg_deauthorize_user(zone_dochandle_t, char *, char *); extern int zonecfg_deauthorize_users(zone_dochandle_t, char *); extern boolean_t zonecfg_valid_auths(const char *, const char *); #ifdef __cplusplus } #endif #endif /* _LIBZONECFG_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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) 2013 Gary Mills * Copyright 2017 RackTop Systems. * * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright 2015 Joyent, Inc. All rights reserved. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _LIMITS_H #define _LIMITS_H #include #include #include #include /* * 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 #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 */ /* * These two symbols have their historical values, the actual buffer is * larger. */ #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 */ #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 * 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 should not include this define, regardless of protection * by the _POSIX_SOURCE and _POSIX_C_SOURCE flags. We chose to ignore that * and provide it anyway for compatibility with other platforms that don't * follow the spec as precisely as they should. Its usage is discouraged. */ #define NAME_MAX 255 #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 */ #ifdef __USE_LEGACY_LOGNAME__ #define LOGNAME_MAX 8 /* max # of characters in a login name */ #else /* __USE_LEGACY_LOGNAME__ */ #define LOGNAME_MAX 32 /* max # of characters in a login name */ /* Increased for illumos */ #endif /* __USE_LEGACY_LOGNAME__ */ #define LOGIN_NAME_MAX (LOGNAME_MAX + 1) /* max buffer size */ #define LOGNAME_MAX_TRAD 8 /* traditional length */ #define LOGIN_NAME_MAX_TRAD (LOGNAME_MAX_TRAD + 1) /* and size */ #define TTYNAME_MAX 128 /* max # of characters in a tty name */ #endif /* if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */ #if defined(__EXTENSIONS__) || (_POSIX_C_SOURCE >= 199506L) #include #if !defined(_SIZE_T) || __cplusplus >= 199711L #define _SIZE_T #if defined(_LP64) 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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _LINK_H #define _LINK_H #include #ifndef _ASM #include #include #include #endif #ifdef __cplusplus extern "C" { #endif #ifndef _ASM /* * ld support library calls. * * These cannot be used in a 32bit large file capable environment because * libelf is not large-file safe. Only define these interfaces if we are not * 32bit, or not in the large file environment. */ #if !defined(_ILP32) || _FILE_OFFSET_BITS != 64 #include extern uint_t ld_version(uint_t); extern void ld_input_done(uint_t *); extern void ld_start(const char *, const Elf32_Half, const char *); extern void ld_atexit(int); extern void ld_open(const char **, const char **, int *, int, Elf **, Elf *, size_t, const Elf_Kind); 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_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_open64(const char **, const char **, int *, int, Elf **, Elf *, size_t, const Elf_Kind); 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) */ #endif /* !defined(_ILP32) || _FILE_OFFSET_BITS != 64 */ /* * ld_version() version values. */ #define LD_SUP_VNONE 0 #define LD_SUP_VERSION1 1 #define LD_SUP_VERSION2 2 #define LD_SUP_VERSION3 3 #define LD_SUP_VCURRENT LD_SUP_VERSION3 /* * 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 /* * Runtime link-map identifiers. */ #define LM_ID_BASE 0x00 #define LM_ID_LDSO 0x01 #define LM_ID_NUM 2 #define LM_ID_BRAND 0xfd /* brand emulation linkmap objs */ #define LM_ID_NONE 0xfe /* no link map specified */ #define LM_ID_NEWLM 0xff /* create a new link-map */ /* * Runtime Link-Edit Auditing. */ #define LAV_NONE 0 #define LAV_VERSION1 1 #define LAV_VERSION2 2 #define LAV_VERSION3 3 #define LAV_VERSION4 4 #define LAV_VERSION5 5 #define LAV_CURRENT LAV_VERSION5 #define LAV_NUM 6 /* * 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 */ #define LA_ACT_MAX 3 #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) typedef unsigned long uintptr_t; #else typedef unsigned int uintptr_t; #endif #endif 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 */ /* * The ElfW() macro is a GNU/Linux feature, provided as support for * the dl_phdr_info structure used by dl_phdr_iterate(), which also * originated under Linux. Given an ELF data type, without the ElfXX_ * prefix, it supplies the appropriate prefix (Elf32_ or Elf64_) for * the ELFCLASS of the code being compiled. * * Note that ElfW() is not suitable in situations in which the ELFCLASS * of the code being compiled does not match that of the objects that * code is intended to operate on (e.g. a 32-bit link-editor building * a 64-bit object). The macros defined in are * recommended in such cases. */ #ifdef _LP64 #define ElfW(type) Elf64_ ## type #else #define ElfW(type) Elf32_ ## type #endif /* * The callback function to dl_interate_phdr() receives a pointer * to a structure of this type. * * dlpi_addr is defined such that the address of any segment in * the program header array can be calculated as: * * addr == info->dlpi_addr + info->dlpi_phdr[x].p_vaddr; * * It is therefore 0 for ET_EXEC objects, and the base address at * which the object is mapped otherwise. */ struct dl_phdr_info { ElfW(Addr) dlpi_addr; /* Base address of object */ const char *dlpi_name; /* Null-terminated obj name */ const ElfW(Phdr) *dlpi_phdr; /* Ptr to ELF program hdr arr */ ElfW(Half) dlpi_phnum; /* # of items in dlpi_phdr[] */ /* * Note: Following members were introduced after the first version * of this structure was available. The dl_iterate_phdr() callback * function is passed a 'size' argument giving the size of the info * structure, and must compare that size to the offset of these fields * before accessing them to ensure that they are present. */ /* Incremented when a new object is mapped into the process */ u_longlong_t dlpi_adds; /* Incremented when an object is unmapped from the process */ u_longlong_t dlpi_subs; }; extern int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), void *); #endif /* _ASM */ #endif /* _KERNEL */ #ifdef __cplusplus } #endif #endif /* _LINK_H */ /* * 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 #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(3NSL) and nlsprovider(3NSL). */ #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 */ /* * 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 2014 Garrett D'Amore * * Portions of this file developed by Garrett D'Amore are licensed * under the terms of the Common Development and Distribution License (CDDL) * version 1.0 only. The use of subsequent versions of the License are * is specifically prohibited unless those terms are not in conflict with * version 1.0 of the License. You can find this license on-line at * http://www.illumos.org/license/CDDL */ #ifndef _LOCALE_H #define _LOCALE_H #include #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ defined(__EXTENSIONS__) #include #endif /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #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)) #if defined(_XPG7) || !defined(_STRICT_SYMBOLS) /* * These were added in POSIX 2008 as part of the newlocale() specification. */ #define LC_CTYPE_MASK (1 << LC_CTYPE) #define LC_NUMERIC_MASK (1 << LC_NUMERIC) #define LC_TIME_MASK (1 << LC_TIME) #define LC_COLLATE_MASK (1 << LC_COLLATE) #define LC_MONETARY_MASK (1 << LC_MONETARY) #define LC_MESSAGES_MASK (1 << LC_MESSAGES) #define LC_ALL_MASK (0x3f) #ifndef _LOCALE_T #define _LOCALE_T typedef struct _locale *locale_t; #endif extern locale_t duplocale(locale_t); extern void freelocale(locale_t); extern locale_t newlocale(int, const char *, locale_t); extern locale_t uselocale(locale_t); #define LC_GLOBAL_LOCALE (__global_locale()) extern locale_t __global_locale(void); #endif /* defined(_XPG7) || !defined(_STRICT_SYMBOLS) */ #if defined(_XPG8) || !defined(_STRICT_SYMBOLS) extern const char *getlocalename_l(int, locale_t); #endif /* _XPG8 || !_STRICT_SYMBOLS */ #ifdef __cplusplus } #endif #endif /* _LOCALE_H */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _MACROS_H #define _MACROS_H #include #include #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) */ #define DEBUG(var, type) fprintf(stderr, #var "= %" #type "\n", var) /* * 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 */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _MALLOC_H #define _MALLOC_H #include #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(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ defined(_XPG3) #if __cplusplus >= 199711L namespace std { #endif void *malloc(size_t); void free(void *); void *realloc(void *, size_t); void *calloc(size_t, size_t); #if __cplusplus >= 199711L } /* end of namespace std */ using std::malloc; using std::free; using std::realloc; using std::calloc; #endif /* __cplusplus >= 199711L */ #endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || ... */ int mallopt(int, int); struct mallinfo mallinfo(void); #ifdef __cplusplus } #endif #endif /* _MALLOC_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2011 Nexenta Systems, Inc. All rights reserved. */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Copyright 2014 Garrett D'Amore */ #ifndef _MATH_H #define _MATH_H #include #include #if __cplusplus >= 199711L using std::abs; using std::acos; using std::asin; using std::atan2; using std::atan; using std::ceil; using std::cos; using std::cosh; using std::exp; using std::fabs; using std::floor; using std::fmod; using std::frexp; using std::ldexp; using std::log10; using std::log; using std::modf; using std::pow; using std::sin; using std::sinh; using std::sqrt; using std::tan; using std::tanh; #endif #ifdef __cplusplus extern "C" { #endif #if defined(__cplusplus) #define exception __math_exception #endif #if defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) || \ !defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE) /* * SVID & X/Open */ #define M_E 2.7182818284590452354 #define M_LOG2E 1.4426950408889634074 #define M_LOG10E 0.43429448190325182765 #define M_LN2 0.69314718055994530942 #define M_LN10 2.30258509299404568402 #define M_PI 3.14159265358979323846 #define M_PI_2 1.57079632679489661923 #define M_PI_4 0.78539816339744830962 #define M_1_PI 0.31830988618379067154 #define M_2_PI 0.63661977236758134308 #define M_2_SQRTPI 1.12837916709551257390 #define M_SQRT2 1.41421356237309504880 #define M_SQRT1_2 0.70710678118654752440 extern int signgam; #define MAXFLOAT ((float)3.40282346638528860e+38) #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) /* * SVID */ enum version {libm_ieee = -1, c_issue_4, ansi_1, strict_ansi}; #ifdef __STDC__ extern const enum version _lib_version; #else extern enum version _lib_version; #endif struct exception { int type; char *name; double arg1; double arg2; double retval; }; #define HUGE MAXFLOAT #define _ABS(x) ((x) < 0 ? -(x) : (x)) #define _REDUCE(TYPE, X, XN, C1, C2) { \ double x1 = (double)(TYPE)X, x2 = X - x1; \ X = x1 - (XN) * (C1); X += x2; X -= (XN) * (C2); } #define DOMAIN 1 #define SING 2 #define OVERFLOW 3 #define UNDERFLOW 4 #define TLOSS 5 #define PLOSS 6 #define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) #define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) #define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) #define _POLY4(x, c) (_POLY3((x), (c)) * (x) + (c)[4]) #define _POLY5(x, c) (_POLY4((x), (c)) * (x) + (c)[5]) #define _POLY6(x, c) (_POLY5((x), (c)) * (x) + (c)[6]) #define _POLY7(x, c) (_POLY6((x), (c)) * (x) + (c)[7]) #define _POLY8(x, c) (_POLY7((x), (c)) * (x) + (c)[8]) #define _POLY9(x, c) (_POLY8((x), (c)) * (x) + (c)[9]) #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */ /* * SVID & X/Open */ /* BEGIN adopted by C99 */ extern double erf(double); extern double erfc(double); extern double hypot(double, double); extern double lgamma(double); #if !defined(_STDC_C99) && _XOPEN_SOURCE - 0 < 600 && !defined(__C99FEATURES__) extern int isnan(double); #endif /* END adopted by C99 */ #if defined(__EXTENSIONS__) || _XOPEN_SOURCE - 0 < 600 extern double gamma(double); /* deprecated; use lgamma */ #endif extern double j0(double); extern double j1(double); extern double jn(int, double); extern double y0(double); extern double y1(double); extern double yn(int, double); #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || \ _XOPEN_SOURCE - 0 >= 500 || \ defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1 /* * SVID & XPG 4.2/5 - removed from XPG7. */ #if !defined(_STRICT_SYMBOLS) || !defined(_XPG7) extern double scalb(double, double); #endif /* BEGIN adopted by C99 */ extern double acosh(double); extern double asinh(double); extern double atanh(double); extern double cbrt(double); extern double logb(double); extern double nextafter(double, double); extern double remainder(double, double); /* * XPG 4.2/5 */ extern double expm1(double); extern int ilogb(double); extern double log1p(double); extern double rint(double); /* END adopted by C99 */ #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || ... */ #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) /* * SVID */ extern int matherr(struct exception *); /* * IEEE Test Vector */ extern double significand(double); extern int signgamf; /* deprecated; use signgam */ extern int signgaml; /* deprecated; use signgam */ extern int isnanf(float); extern int isnanl(long double); extern float gammaf(float); /* deprecated; use lgammaf */ extern float gammaf_r(float, int *); /* deprecated; use lgammaf_r */ extern float j0f(float); extern float j1f(float); extern float jnf(int, float); extern float lgammaf_r(float, int *); extern float scalbf(float, float); extern float significandf(float); extern float y0f(float); extern float y1f(float); extern float ynf(int, float); extern long double gammal(long double); /* deprecated; use lgammal */ extern long double gammal_r(long double, int *); /* deprecated */ extern long double j0l(long double); extern long double j1l(long double); extern long double jnl(int, long double); extern long double lgammal_r(long double, int *); extern long double scalbl(long double, long double); extern long double significandl(long double); extern long double y0l(long double); extern long double y1l(long double); extern long double ynl(int, long double); /* * for sin+cos->sincos transformation */ extern void sincos(double, double *, double *); extern void sincosf(float, float *, float *); extern void sincosl(long double, long double *, long double *); /* BEGIN adopted by C99 */ /* * Functions callable from C, intended to support IEEE arithmetic. */ extern double copysign(double, double); extern double scalbn(double, int); /* END adopted by C99 */ /* * Reentrant version of gamma & lgamma; passes signgam back by reference * as the second argument; user must allocate space for signgam. */ extern double gamma_r(double, int *); /* deprecated; use lgamma_r */ extern double lgamma_r(double, int *); /* BEGIN adopted by C99 */ extern float modff(float, float *); /* END adopted by C99 */ #if defined(__EXTENSIONS__) || !defined(__cplusplus) #include #endif #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */ #endif /* defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) || ... */ #if defined(__cplusplus) && defined(__GNUC__) #undef exception #endif #ifdef __cplusplus } #endif #endif /* _MATH_H */ /* * 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 2026 Gordon Ross * Copyright 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _MEMORY_H #define _MEMORY_H #include #ifdef __cplusplus extern "C" { #endif extern void *memccpy(void *, const void *, int, size_t); #if __cplusplus >= 199711L namespace std { #endif extern int memcmp(const void *, const void *, size_t); extern void *memcpy(void *_RESTRICT_KYWD, const void *_RESTRICT_KYWD, size_t); extern void *memset(void *, int, size_t); /* See similar in string_iso.h */ #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 */ #else /* __cplusplus >= 199711L */ extern void *memchr(const void *, int, size_t); #endif /* __cplusplus >= 199711L */ #if __cplusplus >= 199711L } /* end of namespace std */ #endif /* __cplusplus >= 199711L */ #ifdef __cplusplus } #endif #if __cplusplus >= 199711L using std::memcmp; using std::memcpy; using std::memset; using std::memchr; #endif /* __cplusplus >= 199711L */ #endif /* _MEMORY_H */ /* * 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 2014 Garrett D'Amore * Copyright 2014 PALO, Richard. * * Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _MON_H #define _MON_H #include #ifdef __cplusplus extern "C" { #endif /* * Inclusion of 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) 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 extern void monitor(int (*)(void), int (*)(void), WORD *, size_t, size_t); #ifdef __cplusplus } #endif #endif /* _MON_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _MONETARY_H #define _MONETARY_H #include #include #ifdef __cplusplus extern "C" { #endif extern ssize_t strfmon(char *_RESTRICT_KYWD, size_t, const char *_RESTRICT_KYWD, ...); #if defined(_XPG7) || (!defined(_STRICT_STRICT_SYMBOLS)) #ifndef _LOCALE_T #define _LOCALE_T typedef struct _locale *locale_t; #endif extern ssize_t strfmon_l(char *_RESTRICT_KYWD, size_t, locale_t, const char *_RESTRICT_KYWD, ...); #endif #ifdef __cplusplus } #endif #endif /* _MONETARY_H */ /* * 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 2014 Garrett D'Amore * * 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 #ifdef __cplusplus extern "C" { #endif struct mint { int len; short *val; }; typedef struct mint MINT; 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 *); #define FREE(x) _mp_xfree(&(x)) /* Compatibility */ #ifdef __cplusplus } #endif #endif /* _MP_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _MQUEUE_H #define _MQUEUE_H #include #include #include #include #include #include #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 (_POSIX_C_SOURCE - 0 > 0) && (_POSIX_C_SOURCE - 0 <= 2) #error "POSIX Message Passing is not supported in POSIX.1-1990" #endif #include 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); #ifdef __cplusplus } #endif #endif /* _MQUEUE_H */ /* * 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 2014 Garrett D'Amore * * Copyright (c) 1996, by Sun Microsystems, Inc. * All Rights Reserved */ #ifndef _NAN_H #define _NAN_H /* * Handling of Not_a_Number's (only in IEEE floating-point standard) */ #include #include #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) #define KILLFPE() (void) _kill(_getpid(), 8) #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 */ /* * 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 2014 Garrett D'Amore * * 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 #include #include #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 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 *); #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _NDPD_H #define _NDPD_H #ifdef __cplusplus extern "C" { #endif #define NDPD_SNMP_SOCKET "/var/run/in.ndpd_mib" #define NDPD_SNMP_INFO_REQ 1 #define NDPD_SNMP_INFO_RESPONSE 2 #define NDPD_PHYINT_INFO 3 #define NDPD_PREFIX_INFO 4 #define NDPD_ROUTER_INFO 5 #define NDPD_SNMP_INFO_VER 1 #define NDPD_PHYINT_INFO_VER 1 #define NDPD_PREFIX_INFO_VER 1 #define NDPD_ROUTER_INFO_VER 1 /* * Data structures used to handle configuration variables set in ndpd.conf. * cf_notdefault is set for variables explicitly set in ndpd.conf. */ struct confvar { uint_t cf_value; boolean_t cf_notdefault; }; extern struct confvar ifdefaults[]; /* * Interfaces configuration variable indicies */ #define I_DupAddrDetectTransmits 0 /* From RFC 2462 */ #define I_AdvSendAdvertisements 1 #define I_MaxRtrAdvInterval 2 /* In seconds */ #define I_MinRtrAdvInterval 3 /* In seconds */ #define I_AdvManagedFlag 4 #define I_AdvOtherConfigFlag 5 #define I_AdvLinkMTU 6 #define I_AdvReachableTime 7 /* In milliseconds */ #define I_AdvRetransTimer 8 /* In milliseconds */ #define I_AdvCurHopLimit 9 #define I_AdvDefaultLifetime 10 /* In seconds */ #define I_StatelessAddrConf 11 #define I_TmpAddrsEnabled 12 /* From RFC 3041 */ #define I_TmpValidLifetime 13 /* In seconds */ #define I_TmpPreferredLifetime 14 /* In seconds */ #define I_TmpRegenAdvance 15 /* In seconds */ #define I_TmpMaxDesyncFactor 16 /* In seconds */ #define I_StatefulAddrConf 17 #define I_IFSIZE 18 /* # of variables */ typedef struct ndpd_info_s { uint_t info_type; uint_t info_version; uint_t info_num_of_phyints; } ndpd_info_t; typedef struct ndpd_prefix_info_s { uint_t prefix_info_type; uint_t prefix_info_version; struct in6_addr prefix_prefix; /* Used to indentify prefix */ uint_t prefix_len; /* Num bits valid */ uint_t prefix_flags; /* IFF_ flags */ uint_t prefix_phyint_index; uint_t prefix_ValidLifetime; /* In ms w/ 2 hour rule */ uint_t prefix_PreferredLifetime; /* In millseconds */ uint_t prefix_OnLinkLifetime; /* ms valid w/o 2 hour rule */ boolean_t prefix_OnLinkFlag; boolean_t prefix_AutonomousFlag; } ndpd_prefix_info_t; typedef struct ndpd_router_info_s { uint_t router_info_type; uint_t router_info_version; struct in6_addr router_address; /* Used to identify router */ uint_t router_lifetime; /* In milliseconds */ uint_t router_phyint_index; } ndpd_router_info_t; typedef struct ndpd_phyint_info_s { uint_t phyint_info_type; uint_t phyint_info_version; int phyint_index; struct confvar phyint_config[I_IFSIZE]; #define phyint_DupAddrDetectTransmits \ phyint_config[I_DupAddrDetectTransmits].cf_value #define phyint_AdvSendAdvertisements \ phyint_config[I_AdvSendAdvertisements].cf_value #define phyint_MaxRtrAdvInterval \ phyint_config[I_MaxRtrAdvInterval].cf_value #define phyint_MinRtrAdvInterval \ phyint_config[I_MinRtrAdvInterval].cf_value #define phyint_AdvManagedFlag phyint_config[I_AdvManagedFlag].cf_value #define phyint_AdvOtherConfigFlag \ phyint_config[I_AdvOtherConfigFlag].cf_value #define phyint_AdvLinkMTU phyint_config[I_AdvLinkMTU].cf_value #define phyint_AdvReachableTime phyint_config[I_AdvReachableTime].cf_value #define phyint_AdvRetransTimer phyint_config[I_AdvRetransTimer].cf_value #define phyint_AdvCurHopLimit phyint_config[I_AdvCurHopLimit].cf_value #define phyint_AdvDefaultLifetime \ phyint_config[I_AdvDefaultLifetime].cf_value #define phyint_StatelessAddrConf \ phyint_config[I_StatelessAddrConf].cf_value #define phyint_TmpAddrsEnabled phyint_config[I_TmpAddrsEnabled].cf_value #define phyint_TmpValidLifetime phyint_config[I_TmpValidLifetime].cf_value #define phyint_TmpPreferredLifetime \ phyint_config[I_TmpPreferredLifetime].cf_value #define phyint_TmpRegenAdvance phyint_config[I_TmpRegenAdvance].cf_value #define phyint_TmpMaxDesyncFactor \ phyint_config[I_TmpMaxDesyncFactor].cf_value #define phyint_StatefulAddrConf \ phyint_config[I_StatefulAddrConf].cf_value uint_t phyint_num_of_prefixes; uint_t phyint_num_of_routers; } ndpd_phyint_info_t; #ifdef __cplusplus } #endif #endif /* _NDPD_H */ /* * 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 #include #endif /* _NETCONFIG_H */ /* * Copyright 2014 Garrett D'Amore * * Copyright 2009 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 #include #include #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) #include #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */ #include #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 */ }; /* * The flag 0x8000 is currently reserved for private use between libnsl and * libsocket. See lib/libsocket/inet/getaddrinfo.c for more information. */ /* 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 */ #define EAI_PROTOCOL 13 #define EAI_MAX 14 /* 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__) */ /* * Scope delimit character */ #define SCOPE_DELIMITER '%' /* * 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 */ int *a_mech_params; /* mechanism specific parameters */ int a_alg_flags; /* algorithm flags */ } 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 */ }; #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__) */ /* * Error return codes from gethostbyname() and gethostbyaddr() * (when using the resolver) */ extern int h_errno; #ifdef _REENTRANT extern int *__h_errno(void); /* 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 */ /* * Error return codes from gethostbyname() and gethostbyaddr() * (left in extern int h_errno). */ #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 */ /* * 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 2014 Garrett D'Amore * Copyright (c) 2016 by Delphix. All rights reserved. */ /* 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 /* * This files uses struct netconfig, and netconfig.h must be included * before this to avoid warnings. */ #include #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 */ 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); /* * 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 its transport. It is up to the trasport provider * to support the netdir_options it 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 */ /* * 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 2014 Garrett D'Amore * * 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 #include #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; int catclose(nl_catd); char *catgets(nl_catd, int, int, const char *); nl_catd catopen(const char *, int); #ifdef __cplusplus } #endif #endif /* _NL_TYPES_H */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _NLIST_H #define _NLIST_H #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 */ }; extern int nlist(const char *, struct nlist *); #ifdef __cplusplus } #endif #endif /* _NLIST_H */ /* * 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 #include #ifdef __cplusplus extern "C" { #endif #define NOTE _NOTE #ifdef __cplusplus } #endif #endif /* _NOTE_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * * 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 #include #ifdef __cplusplus extern "C" { #endif /* * The name-service switch * ----------------------- * * From nsswitch.conf(5): * * 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 (called the "switch" or "policy" engine); * that determines what sources to use and when to invoke them. This * component works in conjunction with the name service switch (nscd). * Usually nscd is the policy engine for an application lookup. * * - Old style backend interfaces follow this pointer to function interface: * * A "backend" exists for useful pairs. 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 . * Most of these definitions are in the form of pointer to function * indicies used to call specific backend APIs. * * * 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 queries the name service cache for an existing * result via a call to _nsc_search(). if the cache * (nscd) has a definitive answer skip to step 7 * (3) nss_search looks up configuration info, gets "passwd: files nis", * (4) 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, * through a function pointer interface, * (d) backend searches /etc/passwd, doesn't find the name, * returns "not found" status to nss_search, * (5) 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, * through a function pointer interface, * (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, * (6) nss_search examines status and config info, decides to return * to caller, * (7) 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 the following 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(5)) * * The remaining conditions/errors are internally generated and if * necessary are translated, as to one of the above external errors, * usually NOTFOUND or UNAVAIL. * * NSS_NISSERVDNS_TRYAGAIN (should only be used by the NIS backend for * NIS server in DNS forwarding mode to indicate DNS server non-response). * * The policy component may return NSS_TRYLOCAL which signifies that nscd * is not going to process the request, and it should be performed locally. * * NSS_ERROR is a catchall for internal error conditions, errno will be set * to a system error that can help track down the problem if * it is persistent. This error is the result of some internal error * condition and should not be seen during or exposed to aan application. * The error may be from the application side switch component or from the * nscd side switch component. * * NSS_ALTRETRY and NSS_ALTRESET are internal codes used by the application * side policy component and nscd to direct the policy component to * communicate to a per-user nscd if/when per-user authentication is enabled. * * NSS_NSCD_PRIV is a catchall for internal nscd errors or status * conditions. This return code is not visible to applications. nscd * may use this as a status flag and maintain additional error or status * information elsewhere in other private nscd data. This status value * is for nscd private/internal use only. */ typedef enum { NSS_SUCCESS = 0, NSS_NOTFOUND = 1, NSS_UNAVAIL = 2, NSS_TRYAGAIN = 3, NSS_NISSERVDNS_TRYAGAIN = 4, NSS_TRYLOCAL = 5, NSS_ERROR = 6, NSS_ALTRETRY = 7, NSS_ALTRESET = 8, NSS_NSCD_PRIV = 9 } nss_status_t; struct nss_backend; typedef nss_status_t (*nss_backend_op_t)(struct nss_backend *, void *args); 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 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). */ 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); struct nss_backend_finder { nss_backend_constr_t (*lookup) (void *lkp_priv, const char *, const char *, void **del_privp); void (*delete) (void *del_priv, nss_backend_constr_t); 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; typedef void (*nss_db_initf_t)(nss_db_params_t *); /* * DBD param offsets in NSS2 nscd header. * Offsets are relative to beginning of dbd section. * 32 bit offsets should be sufficient, forever. * 0 offset == NULL * flags == nss_dbp_flags */ typedef struct nss_dbd { uint32_t o_name; uint32_t o_config_name; uint32_t o_default_config; uint32_t flags; } nss_dbd_t; /* * 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 /* * Policy Engine Configuration * --------------------------- * * When nscd is running it can reconfigure it's internal policy engine * as well as advise an application's front-end and policy engine on how * respond optimally to results being returned from nscd. This is done * through the policy engine configuration interface. */ typedef enum { NSS_CONFIG_GET, NSS_CONFIG_PUT, NSS_CONFIG_ADD, NSS_CONFIG_DELETE, NSS_CONFIG_LIST } nss_config_op_t; struct nss_config { char *name; nss_config_op_t cop; mutex_t *lock; void *buffer; size_t length; }; typedef struct nss_config nss_config_t; extern nss_status_t nss_config(nss_config_t **, int); 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 *); extern void nss_delete(nss_db_root_t *); extern nss_status_t nss_pack(void *, size_t, nss_db_root_t *, nss_db_initf_t, int, void *); extern nss_status_t nss_pack_ent(void *, size_t, nss_db_root_t *, nss_db_initf_t, nss_getent_t *); extern nss_status_t nss_unpack(void *, size_t, nss_db_root_t *, nss_db_initf_t, int, void *); extern nss_status_t nss_unpack_ent(void *, size_t, nss_db_root_t *, nss_db_initf_t, nss_getent_t *, void *); extern nss_status_t _nsc_search(nss_db_root_t *, nss_db_initf_t, int search_fnum, void *search_args); extern nss_status_t _nsc_getent_u(nss_db_root_t *, nss_db_initf_t, nss_getent_t *, void *getent_args); extern nss_status_t _nsc_setent_u(nss_db_root_t *, nss_db_initf_t, nss_getent_t *); extern nss_status_t _nsc_endent_u(nss_db_root_t *, nss_db_initf_t, nss_getent_t *); #ifdef __cplusplus } #endif #endif /* _NSS_COMMON_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Database-specific definitions for the getXXXbyYYY routines * (e.g getpwuid_r(), ether_ntohost()) that use the name-service switch. * Database-independent definitions are in * * 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 #include #include #include #include /* MAXALIASES, MAXADDRS */ #include /* LOGNAME_MAX */ #include #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" #define NSS_DBNAM_TSOL_TP "tnrhtp" #define NSS_DBNAM_TSOL_RH "tnrhdb" #define NSS_DBNAM_TSOL_ZC "tnzonecfg" /* 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_TSOL_FALLBACK "files ldap" #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" #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 #define NSS_DEFCONF_TSOL_TP NSS_TSOL_FALLBACK #define NSS_DEFCONF_TSOL_RH NSS_TSOL_FALLBACK #define NSS_DEFCONF_TSOL_ZC NSS_TSOL_FALLBACK /* * 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) * 8) #define NSS_LINELEN_HOSTS ((NSS_BUFSIZ) * 8) #define NSS_LINELEN_IPNODES ((NSS_BUFSIZ) * 8) #define NSS_LINELEN_NETGROUP ((NSS_BUFSIZ) * 32) #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 #define NSS_LINELEN_TSOL NSS_BUFSIZ #define NSS_LINELEN_TSOL_TP NSS_LINELEN_TSOL #define NSS_LINELEN_TSOL_RH NSS_LINELEN_TSOL #define NSS_LINELEN_TSOL_ZC NSS_LINELEN_TSOL /* * 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 , et al */ #define NSS_BUFLEN_GROUP NSS_LINELEN_GROUP #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) * 8) #define NSS_BUFLEN_TSOL NSS_LINELEN_TSOL #define NSS_BUFLEN_TSOL_TP NSS_BUFLEN_TSOL #define NSS_BUFLEN_TSOL_RH NSS_BUFLEN_TSOL #define NSS_BUFLEN_TSOL_ZC NSS_BUFLEN_TSOL /* * Default cache door buffer size (2x largest buffer) */ #define NSS_BUFLEN_DOOR ((NSS_BUFSIZ) * 16) /* * 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 nss_str2ent_t routine is the data marshaller for the nsswitch. * it converts 'native files' format into 'entry' format as part of the * return processing for a getXbyY interface. * * The nss_groupstr_t routine does the real work for any backend * that can supply a netgroup entry as a string in /etc/group format */ typedef int (*nss_str2ent_t)(const char *in, int inlen, void *ent, char *buf, int buflen); struct nss_groupsbymem; /* forward definition */ typedef nss_status_t (*nss_groupstr_t)(const char *instr, int inlen, struct nss_groupsbymem *); /* * 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; nss_str2ent_t str2ent; nss_groupstr_t process_cstr; /* 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 = 0, NSS_NETGR_USER = 1, NSS_NETGR_DOMAIN = 2, NSS_NETGR_N = 3 }; enum nss_netgr_status { /* Status from setnetgrent, multi_innetgr */ NSS_NETGR_FOUND = 0, NSS_NETGR_NO = 1, NSS_NETGR_NOMEM = 2 }; 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; }; /* For NSS_DBOP_NETGROUP_BYNAME */ struct nss_netgrent { char *netgr_name; char *netgr_members; }; /* * 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; 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 *); #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 * 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. */ typedef 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 */ } nss_XbyY_key_t; typedef int (*nss_key2str_t)(void *buffer, size_t buflen, nss_XbyY_key_t *key, size_t *len); 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. */ nss_str2ent_t str2ent; 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 */ /* NSS2 */ nss_key2str_t key2str; /* IN */ size_t returnlen; /* OUT */ /* NSCD/DOOR data */ /* ... buffer arena follows... */ } nss_XbyY_args_t; /* * nss/nscd v2 interface, packed buffer format * * A key component of the v2 name service switch is the redirection * of all activity to nscd for actual processing. In the original * switch most activity took place in each application, and the nscd * cache component was an add-on optional interface. * * The nscd v1 format was a completely private interface that * implemented specific bufferiing formats on a per getXbyY API basis. * * The nss/nscd v2 interface uses a common header and commonalizes * the buffering format as consistently as possible. The general rule * of thumb is that backends are required to assemble their results in * "files based" format [IE the format used on a per result basis as * returned by the files backend] and then call the standard str2ent * interface. This is the original intended design as used in the files * and nis backends. * * The benefit of this is that the application side library can assemble * a request and provide a header and a variable length result buffer via * a doors API, and then the nscd side switch can assemble a a getXbyY * request providing the result buffer and a str2ent function that copies * but does not unpack the result. * * This results is returned back via the door, and unpacked using the * native library side str2ent interface. * * Additionally, the common header allows extensibility to add new * getXbyYs, putXbyYs or other maintenance APIs to/from nscd without * changing the existing "old style" backend interfaces. * * Finally new style getXbyY, putXbyY and backend interfaces can be * by adding new operation requests to the header, while old style * backwards compatability. */ /* * nss/nscd v2 callnumber definitions */ /* * callnumbers are separated by categories, such as: * application to nscd requests, nscd to nscd requests, * smf to nscd requests, etc. */ #define NSCDV2CATMASK (0xFF000000) #define NSCDV2CALLMASK (0x00FFFFFF) /* * nss/nscd v2 categories */ #define NSCD_CALLCAT_APP ('a'<<24) #define NSCD_CALLCAT_N2N ('n'<<24) /* nscd v2 app-> nscd callnumbers */ #define NSCD_SEARCH (NSCD_CALLCAT_APP|0x01) #define NSCD_SETENT (NSCD_CALLCAT_APP|0x02) #define NSCD_GETENT (NSCD_CALLCAT_APP|0x03) #define NSCD_ENDENT (NSCD_CALLCAT_APP|0x04) #define NSCD_PUT (NSCD_CALLCAT_APP|0x05) #define NSCD_GETHINTS (NSCD_CALLCAT_APP|0x06) /* nscd v2 SETENT cookie markers */ #define NSCD_NEW_COOKIE 0 #define NSCD_LOCAL_COOKIE 1 /* nscd v2 header revision */ /* treated as 0xMMMMmmmm MMMM - Major Rev, mmmm - Minor Rev */ #define NSCD_HEADER_REV 0x00020000 /* * ptr/uint data type used to calculate shared nscd buffer struct sizes * sizes/offsets are arbitrarily limited to 32 bits for 32/64 compatibility * datatype is 64 bits for possible pointer storage and future use */ typedef uint64_t nssuint_t; /* * nscd v2 buffer layout overview * * The key interface to nscd moving forward is the doors interface * between applications and nscd (NSCD_CALLCAT_APP), and nscd and * it's children (NSCD_CALLCAT_N2N). * * Regardless of the interface used, the buffer layout is consistent. * The General Layout is: * [nss_pheader_t][IN key][OUT data results]{extend results} * * The header (nss_pheader_t) remains constant. * Keys and key layouts vary between call numbers/requests * NSCD_CALLCAT_APP use key layouts mimics/defines in nss_dbdefs.h * NSCD_CALLCAT_NSN use layouts defined by nscd headers * Data and data results vary between results * NSCD_CALLCAT_APP return "file standard format" output buffers * NSCD_CALLCAT_NSN return data defined by nscd headers * extended results are optional and vary * */ /* * nss_pheader_t -- buffer header structure that contains switch data * "packed" by the client into a buffer suitable for transport over * nscd's door, and that can be unpacked into a native form within * nscd's switch. Capable of packing and unpacking data ans results. * * NSCD_HEADER_REV: 0x00020000 16 x uint64 = (128 byte header) */ typedef struct { uint32_t nsc_callnumber; /* packed buffer request */ uint32_t nss_dbop; /* old nss dbop */ uint32_t p_ruid; /* real uid */ uint32_t p_euid; /* effective uid */ uint32_t p_version; /* 0xMMMMmmmm Major/minor */ uint32_t p_status; /* nss_status_t */ uint32_t p_errno; /* errno */ uint32_t p_herrno; /* h_errno */ nssuint_t libpriv; /* reserved (for lib/client) */ nssuint_t pbufsiz; /* buffer size */ nssuint_t dbd_off; /* IN: db desc off */ nssuint_t dbd_len; /* IN: db desc len */ nssuint_t key_off; /* IN: key off */ nssuint_t key_len; /* IN: key len */ nssuint_t data_off; /* OUT: data off */ nssuint_t data_len; /* OUT: data len */ nssuint_t ext_off; /* OUT: extended results off */ nssuint_t ext_len; /* OUT: extended results len */ nssuint_t nscdpriv; /* reserved (for nscd) */ nssuint_t reserved1; /* reserved (TBD) */ } nss_pheader_t; /* * nss_pnetgr_t -- packed offset structure for holding keys used * by innetgr (__multi_innetgr) key * Key format is: * nss_pnetgr_t * (nssuint_t)[machine_argc] offsets to strings * (nssuint_t)[user_argc] offsets to strings * (nssuint_t)[domain_argc] offsets to strings * (nssuint_t)[groups_argc] offsets to strings * machine,user,domain,groups strings */ typedef struct { uint32_t machine_argc; uint32_t user_argc; uint32_t domain_argc; uint32_t groups_argc; nssuint_t machine_offv; nssuint_t user_offv; nssuint_t domain_offv; nssuint_t groups_offv; } nss_pnetgr_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)->key2str = NULL, \ (str)->returnval = 0, \ (str)->returnlen = 0, \ (str)->h_errno = 0, \ (str)->erange = 0) #define NSS_XbyY_INIT_EXT(str, res, bufp, len, func, kfunc) (\ (str)->buf.result = (res), \ (str)->buf.buffer = (bufp), \ (str)->buf.buflen = (len), \ (str)->stayopen = 0, \ (str)->str2ent = (func), \ (str)->key2str = (kfunc), \ (str)->returnval = 0, \ (str)->returnlen = 0, \ (str)->h_errno = 0, \ (str)->erange = 0) #define NSS_XbyY_FINI(str) _nss_XbyY_fini(str) #define NSS_PACKED_CRED_CHECK(buf, ruid, euid) (\ ((nss_pheader_t *)(buf))->p_ruid == (ruid) && \ ((nss_pheader_t *)(buf))->p_euid == (euid)) extern void *_nss_XbyY_fini(nss_XbyY_args_t *); extern char **_nss_netdb_aliases(const char *, int, char *, int); extern nss_status_t nss_default_key2str(void *, size_t, nss_XbyY_args_t *, const char *, int, size_t *); extern nss_status_t nss_packed_arg_init(void *, size_t, nss_db_root_t *, nss_db_initf_t *, int *, nss_XbyY_args_t *); extern nss_status_t nss_packed_context_init(void *, size_t, nss_db_root_t *, nss_db_initf_t *, nss_getent_t **, nss_XbyY_args_t *); extern void nss_packed_set_status(void *, size_t, nss_status_t, nss_XbyY_args_t *); extern nss_status_t nss_packed_getkey(void *, size_t, char **, int *, nss_XbyY_args_t *); /* * nss_dbop_t values for searches with various keys; values for * destructor/endent/setent/getent are defined in */ /* * These are part of the "Over the wire" IE app->nscd getXbyY * op for well known getXbyY's. Cannot use NSS_DBOP_X_Y directly * because NSS_DBOP_next_iter is NOT an incrementing counter value * it's a starting offset into an array value. */ #define NSS_DBOP_X(x) ((x)<<16) #define NSS_DBOP_XY(x, y) ((x)|(y)) #define NSS_DBOP_ALIASES NSS_DBOP_X(1) #define NSS_DBOP_AUTOMOUNT NSS_DBOP_X(2) #define NSS_DBOP_BOOTPARAMS NSS_DBOP_X(3) #define NSS_DBOP_ETHERS NSS_DBOP_X(4) #define NSS_DBOP_GROUP NSS_DBOP_X(5) #define NSS_DBOP_HOSTS NSS_DBOP_X(6) #define NSS_DBOP_IPNODES NSS_DBOP_X(7) #define NSS_DBOP_NETGROUP NSS_DBOP_X(8) #define NSS_DBOP_NETMASKS NSS_DBOP_X(9) #define NSS_DBOP_NETWORKS NSS_DBOP_X(10) #define NSS_DBOP_PASSWD NSS_DBOP_X(11) #define NSS_DBOP_PRINTERS NSS_DBOP_X(12) #define NSS_DBOP_PROJECT NSS_DBOP_X(13) #define NSS_DBOP_PROTOCOLS NSS_DBOP_X(14) #define NSS_DBOP_PUBLICKEY NSS_DBOP_X(15) #define NSS_DBOP_RPC NSS_DBOP_X(16) #define NSS_DBOP_SERVICES NSS_DBOP_X(17) #define NSS_DBOP_AUDITUSER NSS_DBOP_X(18) #define NSS_DBOP_AUTHATTR NSS_DBOP_X(19) #define NSS_DBOP_EXECATTR NSS_DBOP_X(20) #define NSS_DBOP_PROFATTR NSS_DBOP_X(21) #define NSS_DBOP_USERATTR NSS_DBOP_X(22) #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) * Note: _BYNAME is implemented only in "files" (for now). */ #define NSS_DBOP_NETGROUP_IN (NSS_DBOP_next_iter) #define NSS_DBOP_NETGROUP_SET (NSS_DBOP_NETGROUP_IN + 1) #define NSS_DBOP_NETGROUP_BYNAME (NSS_DBOP_NETGROUP_SET + 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 #define NSS_DBOP_TSOL_TP_BYNAME (NSS_DBOP_next_iter) #define NSS_DBOP_TSOL_RH_BYADDR (NSS_DBOP_next_iter) #define NSS_DBOP_TSOL_ZC_BYNAME (NSS_DBOP_next_iter) /* * 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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2006 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 #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; }; 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 *); #ifdef __cplusplus } #endif #endif /* _NSS_NETDIR_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * nsswitch.h * * Low-level interface to the name-service switch. The interface defined * in 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 #ifdef __cplusplus extern "C" { #endif #ifndef __NSW_CONFIG_FILE #define __NSW_CONFIG_FILE "/etc/nsswitch.conf" #endif #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))) 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); #ifdef __cplusplus } #endif #endif /* _NSSWITCH_H */ /* $NetBSD: paths.h,v 1.39 2010/12/29 15:53:57 pooka Exp $ */ /* * Copyright (c) 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. 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. * * @(#)paths.h 8.1 (Berkeley) 6/2/93 */ #ifndef _PATHS_H #define _PATHS_H #ifdef __cplusplus extern "C" { #endif #define _PATH_DEFPATH "/usr/ccs/bin:/usr/bin:/bin" #define _PATH_STDPATH _PATH_DEFPATH ":/usr/sbin:/sbin" #define _PATH_BPF "/dev/bpf" #define _PATH_BSHELL "/usr/bin/sh" #define _PATH_CONSOLE "/dev/console" #define _PATH_CSHELL "/usr/bin/csh" #define _PATH_DEVNULL "/dev/null" #define _PATH_FTPUSERS "/etc/ftpusers" #define _PATH_KMEM "/dev/kmem" #define _PATH_LOCALE "/usr/share/locale" #define _PATH_MAILDIR "/var/mail" #define _PATH_MAN "/usr/share/man" #define _PATH_MEM "/dev/mem" #define _PATH_NOLOGIN "/etc/nologin" #define _PATH_RANDOM "/dev/random" #define _PATH_SENDMAIL "/usr/sbin/sendmail" #define _PATH_SHELLS "/etc/shells" #define _PATH_TTY "/dev/tty" #define _PATH_URANDOM "/dev/urandom" #define _PATH_VI "/usr/bin/vi" /* * Provide trailing slash, since mostly used for building pathnames. */ #define _PATH_DEV "/dev/" #define _PATH_DEV_PTS "/dev/pts/" #define _PATH_TMP "/tmp/" #define _PATH_VARDB "/var/db/" #define _PATH_VARRUN "/var/run/" #define _PATH_VARTMP "/var/tmp/" #ifdef __cplusplus } #endif #endif /* !_PATHS_H */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _PFMT_H #define _PFMT_H #include #ifndef va_args #include #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 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 *); #define DB_NAME_LEN 15 #define MAXLABEL 25 #ifdef __cplusplus } #endif #endif /* _PFMT_H */ /* * 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 #ifdef __cplusplus extern "C" { #endif #include 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 */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ #ifndef _PKGINFO_H #define _PKGINFO_H #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; extern char *pkgparam(char *, char *); extern int pkginfo(struct pkginfo *, char *, ...), pkgnmchk(char *, char *, int); #ifdef __cplusplus } #endif #endif /* _PKGINFO_H */ /* * 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 #ifdef __cplusplus extern "C" { #endif #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _PKGSTRCT_H #define _PKGSTRCT_H #include #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; fsblkcnt_t 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 */ /* * 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 #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _POLL_H #define _POLL_H /* * Poll system call interface definitions. */ #include #include #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) #include #include #endif /* defined(__EXTENSIONS__) ... */ #ifdef __cplusplus extern "C" { #endif #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) extern int ppoll(struct pollfd *_RESTRICT_KYWD, nfds_t, const struct timespec *_RESTRICT_KYWD, const sigset_t *_RESTRICT_KYWD); #endif /* defined(__EXTENSIONS__) ... */ #ifdef __cplusplus } #endif #endif /* _POLL_H */ /* * 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 #include #include #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _PRIV_H_ #define _PRIV_H_ #include #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. */ 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_basicset(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 *); #ifdef __cplusplus } #endif #endif /* _PRIV_H_ */ /* * 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 #include #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _PROC_SERVICE_H #define _PROC_SERVICE_H /* * 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 #include #include #include #include #if defined(__i386) || defined(__amd64) /* for struct ssd */ #include #include #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_NOXREGS /* extended register set not available for given lwp */ } ps_err_e; struct ps_prochandle; /* * See 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 *); 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); #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_pbrandname(struct ps_prochandle *, char *, size_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 */ /* * 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 #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 /* * libproc API */ #ifdef __cplusplus } #endif #endif /* _PROCFS_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _PROF_ATTR_H #define _PROF_ATTR_H #ifdef __cplusplus extern "C" { #endif #include #include #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 PROFILE_STOP "Stop" #define DEF_PROF "PROFS_GRANTED=" #define DEF_CONSUSER "CONSOLE_USER=" #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; 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); #ifdef __cplusplus } #endif #endif /* _PROF_ATTR_H */ /* * 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 #include #include #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 */ /* * 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 #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 */ extern 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 */ /* * 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 #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 */ /* * Copyright 2006 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 #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_emetric { uint16_t rip_metric; uint16_t rip_mask; uint32_t rip_token[1]; }; struct rip_sec_entry { uint32_t rip_dst; uint32_t rip_count; struct rip_emetric rip_emetric[1]; }; 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]; struct { uint32_t rip_generation; struct rip_sec_entry rip_sec_entry[1]; } ru_tsol; } ripun; #define rip_nets ripun.ru_nets #define rip_tracefile ripun.ru_tracefile #define rip_auths ripun.ru_auth #define rip_tsol ripun.ru_tsol }; 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]; }; typedef struct rdisc_info_s { uint_t info_type; uint_t info_version; uint_t info_num_of_routers; } rdisc_info_t; /* * Structure that is returned with the default router info. */ typedef struct defr_s { uint32_t defr_info_type; uint32_t defr_version; struct in_addr defr_addr; uint32_t defr_index; uint32_t defr_life; uint32_t defr_pref; } defr_t; /* * 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_SEC_RESPONSE 51 /* response includes E-metrics */ #define RIPCMD_SEC_T_RESPONSE 52 /* tunneling */ #define RIPCMD_MAX 7 #define RDISC_SNMP_SOCKET "/var/run/in.rdisc_mib" #define RDISC_SNMP_INFO_REQ 1 #define RDISC_SNMP_INFO_RESPONSE 2 #define RDISC_DEF_ROUTER_INFO 3 #define RDISC_SNMP_INFO_VER 1 #define RDISC_DEF_ROUTER_VER 1 #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright 2018 Joyent, Inc. * Copyright 2022 OmniOS Community Edition (OmniOSce) Association. * * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _PTHREAD_H #define _PTHREAD_H #include #ifndef _ASM #include #include #include #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 */ /* * mutex types * * _ERRORCHECK and _RERCURSIVE are kept in line with their corresponding values * in sys/synch.h; however, in general these types have their own semantics. */ #define PTHREAD_MUTEX_NORMAL 0x0 #define PTHREAD_MUTEX_ERRORCHECK 0x2 #define PTHREAD_MUTEX_RECURSIVE 0x4 #define PTHREAD_MUTEX_DEFAULT 0x8 /* * 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 robust attribute values. * Keep these in synch with sys/synch.h lock types. */ #define PTHREAD_MUTEX_STALLED 0x0 #define PTHREAD_MUTEX_ROBUST 0x40 /* * Historical solaris-specific names, * from before pthread_mutexattr_getrobust() became standardized */ #define PTHREAD_MUTEX_STALL_NP PTHREAD_MUTEX_STALLED #define PTHREAD_MUTEX_ROBUST_NP PTHREAD_MUTEX_ROBUST /* * 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, PTHREAD_PROCESS_PRIVATE, _MUTEX_MAGIC}, {{{0}}}, 0} #define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP /* = ERRORCHECKMUTEX */ \ {{0, 0, 0, PTHREAD_PROCESS_PRIVATE | PTHREAD_MUTEX_ERRORCHECK, \ _MUTEX_MAGIC}, {{{0}}}, 0} #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP /* = RECURSIVEMUTEX */ \ {{0, 0, 0, PTHREAD_PROCESS_PRIVATE | PTHREAD_MUTEX_RECURSIVE | \ PTHREAD_MUTEX_ERRORCHECK, _MUTEX_MAGIC}, {{{0}}}, 0} #define PTHREAD_COND_INITIALIZER /* = DEFAULTCV */ \ {{{0, 0, 0, 0}, PTHREAD_PROCESS_PRIVATE, _COND_MAGIC}, 0} #define PTHREAD_RWLOCK_INITIALIZER /* = DEFAULTRWLOCK */ \ {0, PTHREAD_PROCESS_PRIVATE, _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} } /* * The key to be created by pthread_key_create_once_np() * must be statically initialized with PTHREAD_ONCE_KEY_NP. * This must be the same as THR_ONCE_KEY in */ #define PTHREAD_ONCE_KEY_NP (pthread_key_t)(-1) /* barriers */ #define PTHREAD_BARRIER_SERIAL_THREAD -2 /* For pthread_{get,set}name_np(). */ #define PTHREAD_MAX_NAMELEN_NP (32) #ifndef _ASM /* * cancellation cleanup structure */ typedef struct _cleanup { uintptr_t pthread_cleanup_pad[4]; } _cleanup_t; void __pthread_cleanup_push(void (*)(void *), void *, caddr_t, _cleanup_t *); void __pthread_cleanup_pop(int, _cleanup_t *); caddr_t _getfp(void); #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); \ } /* * function prototypes - thread related calls */ /* * pthread_atfork() is also declared in 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 and . */ 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_attr_setname_np(pthread_attr_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD); extern int pthread_attr_getname_np(pthread_attr_t *_RESTRICT_KYWD, char *_RESTRICT_KYWD, size_t); 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_create_once_np(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); extern int pthread_setname_np(pthread_t, const char *); extern int pthread_getname_np(pthread_t, char *, size_t); /* * 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(pthread_mutexattr_t *, int); extern int pthread_mutexattr_getrobust( 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(pthread_mutex_t *); extern int pthread_mutex_destroy(pthread_mutex_t *); extern int pthread_mutex_lock(pthread_mutex_t *); extern int pthread_mutex_clocklock(pthread_mutex_t *_RESTRICT_KYWD, clockid_t, const struct timespec *_RESTRICT_KYWD); extern int pthread_mutex_timedlock(pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD); extern int pthread_mutex_relclocklock_np(pthread_mutex_t *_RESTRICT_KYWD, clockid_t, 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_clockwait(pthread_cond_t *_RESTRICT_KYWD, pthread_mutex_t *_RESTRICT_KYWD, clockid_t, const struct timespec *_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_relclockwait_np(pthread_cond_t *_RESTRICT_KYWD, pthread_mutex_t *_RESTRICT_KYWD, clockid_t, 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_clockrdlock(pthread_rwlock_t *_RESTRICT_KYWD, clockid_t, const struct timespec *_RESTRICT_KYWD); extern int pthread_rwlock_timedrdlock(pthread_rwlock_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD); extern int pthread_rwlock_relclockrdlock_np(pthread_rwlock_t *_RESTRICT_KYWD, clockid_t, 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_clockwrlock(pthread_rwlock_t *_RESTRICT_KYWD, clockid_t, const struct timespec *_RESTRICT_KYWD); extern int pthread_rwlock_timedwrlock(pthread_rwlock_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD); extern int pthread_rwlock_relclockwrlock_np(pthread_rwlock_t *_RESTRICT_KYWD, clockid_t, 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 *); /* Historical names -- present only for binary compatibility */ extern int pthread_mutex_consistent_np(pthread_mutex_t *); 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); /* * These are non-standardized extensions that we provide. Their origins are * documented in their manual pages. */ #if !defined(_STRICT_SYMBOLS) extern int pthread_attr_get_np(pthread_t, pthread_attr_t *); extern void pthread_mutex_enter_np(pthread_mutex_t *); extern void pthread_mutex_exit_np(pthread_mutex_t *); #endif /* !_STRICT_SYMBOLS */ #endif /* _ASM */ #ifdef __cplusplus } #endif #endif /* _PTHREAD_H */ /* * Copyright 2026 Zygaena Project Contributors * * 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 THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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. */ /* * BSD-compatible PTY utility functions. * Link with -lutil. */ #ifndef _PTY_H #define _PTY_H #include #include struct winsize; #ifdef __cplusplus extern "C" { #endif int openpty(int *, int *, char *, struct termios *, struct winsize *); pid_t forkpty(int *, char *, struct termios *, struct winsize *); int login_tty(int); #ifdef __cplusplus } #endif #endif /* _PTY_H */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _PW_H #define _PW_H #ifdef __cplusplus extern "C" { #endif extern char *logname(void); extern char *regcmp(const char *, ...); extern char *regex(const char *, const char *, ...); #ifdef __cplusplus } #endif #endif /* _PW_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _PWD_H #define _PWD_H #include #include #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) #include #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__) */ 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) ... */ /* * 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 (_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 *, size_t, struct passwd **); extern int getpwnam_r(const char *, struct passwd *, char *, size_t, 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, size_t __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, size_t __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) || ... */ #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L)... */ #ifdef __cplusplus } #endif #endif /* _PWD_H */ /* * 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 #include #include #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 */ /* * 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 2014 Garrett D'Amore * * Copyright (c) 1995, 2000 by Sun Microsystems, Inc. * All rights reserved. */ #ifndef _RE_COMP_H #define _RE_COMP_H #include #ifdef __cplusplus extern "C" { #endif extern char *re_comp(const char *); extern int re_exec(const char *); #ifdef __cplusplus } #endif #endif /* _RE_COMP_H */ /* * 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 2014 Garrett D'Amore * * 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. */ /* * Copyright 2017 Nexenta Systems, Inc. */ #ifndef _REGEX_H #define _REGEX_H #include #include #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 its 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_BASIC 0x00000 #define REG_EXTENDED 0x00001 /* Use Extended Regular Expressions */ #define REG_NOSUB 0x00002 /* Don't set subexpression */ #define REG_ICASE 0x00004 /* Ignore case in match */ #define REG_NEWLINE 0x00008 /* Treat \n as regular character */ #define REG_DELIM 0x00010 /* legacy, no effect */ #define REG_DEBUG 0x00020 /* legacy, no effect */ #define REG_ANCHOR 0x00040 /* legacy, no effect */ #define REG_WORDS 0x00080 /* legacy, no effect */ #define REG_EGREP 0x01000 /* legacy, no effect */ #define REG_DUMP 0x02000 /* internal */ #define REG_PEND 0x04000 /* NULs are ordinary characters */ #define REG_NOSPEC 0x08000 /* no special characters */ /* internal flags */ #define REG_MUST 0x00100 /* legacy, no effect */ /* regexec flags */ #define REG_NOTBOL 0x00200 /* string is not BOL */ #define REG_NOTEOL 0x00400 /* string has no EOL */ #define REG_NOOPT 0x00800 /* legacy, no effect */ #define REG_STARTEND 0x10000 /* match whole pattern */ #define REG_TRACE 0x20000 /* tracing of execution */ #define REG_LARGE 0x40000 /* force large representation */ #define REG_BACKR 0x80000 /* force use of backref code */ /* 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 multibyte 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_ATOI 255 /* convert name to number (!) */ #define REG_ITOA 256 /* convert number to name (!) */ #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. Note that any changes to this structure * have to preserve sizing, as it is baked into applications. */ struct re_guts *re_g; int re_magic; const char *re_endp; /* here for compat */ 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 { const char *rm_sp, *rm_ep; /* Start pointer, end pointer */ regoff_t rm_so, rm_eo; /* Start offset, end offset */ int rm_ss, rm_es; /* Used internally */ } regmatch_t; /* * IEEE Std 1003.2 ("POSIX.2") regular expressions API. */ 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 *); #ifdef __cplusplus } #endif #endif /* _REGEX_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _REGEXP_H #define _REGEXP_H #include #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 }; int advance(const char *lp, const char *ep); static void getrnge(const char *str); char * compile(char *instring, char *ep, const char *endbuf, int seof) { 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 */ #ifdef __lint /* make lint happy */ c = nodelim; #endif 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); for (;;) { 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; } /* FALLTHROUGH */ } /* FALLTHROUGH */ /* Drop through to default to use \ to turn off special chars */ defchar: default: lastep = ep; *ep++ = CCHR; *ep++ = (char)c; } } /*NOTREACHED*/ } int step(const char *p1, const char *p2) { 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 advance(const char *lp, const char *ep) { const char *curlp; int c; char *bbeg; register char neg; size_t ct; for (;;) { 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); } } /*NOTREACHED*/ } static void getrnge(const char *str) { low = *str++ & 0377; size = ((*str & 0377) == 255)? 20000: (*str &0377) - low; } #ifdef __cplusplus } #endif #endif /* _REGEXP_H */ /* * Copyright 2014 Garrett D'Amore * * Copyright 2009 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_ #include #include #include #include #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 20090302 #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 #ifndef __P #define __P(x) x #endif 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 */ uchar_t _rnd[16]; /* PRIVATE: random state */ } _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)); void res_rndinit __P((res_state)); uint_t res_randomid __P((void)); uint_t res_nrandomid __P((res_state)); 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)); int res_nopt_rdata __P((res_state, int, uchar_t *, int, uchar_t *, ushort_t, ushort_t, uchar_t *)); 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_ */ * Copyright (c) 2015 IETF Trust and the persons identified * as authors of the code. All rights reserved. * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the * following conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * - 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. * * - Neither the name of Internet Society, IETF or IETF * Trust, nor the names of specific contributors, may be * used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS * 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 COPYRIGHT OWNER 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. NFS VERSION 4 XDR DESCRIPTION /* * 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 #include #endif /* _RPCSVC_BOOTPARAM_H */ /* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _BOOTPARAM_PROT_H_RPCGEN #define _BOOTPARAM_PROT_H_RPCGEN #include #ifdef __cplusplus extern "C" { #endif /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* from bootparam_prot.x */ #define MAX_MACHINE_NAME 255 #define MAX_PATH_LEN 1024 #define MAX_FILEID 32 #define IP_ADDR_TYPE 1 typedef char *bp_machine_name_t; typedef char *bp_path_t; typedef char *bp_fileid_t; struct ip_addr_t { char net; char host; char lh; char impno; }; typedef struct ip_addr_t ip_addr_t; struct bp_address { int address_type; union { ip_addr_t ip_addr; } bp_address_u; }; typedef struct bp_address bp_address; struct bp_whoami_arg { bp_address client_address; }; typedef struct bp_whoami_arg bp_whoami_arg; struct bp_whoami_res { bp_machine_name_t client_name; bp_machine_name_t domain_name; bp_address router_address; }; typedef struct bp_whoami_res bp_whoami_res; struct bp_getfile_arg { bp_machine_name_t client_name; bp_fileid_t file_id; }; typedef struct bp_getfile_arg bp_getfile_arg; struct bp_getfile_res { bp_machine_name_t server_name; bp_address server_address; bp_path_t server_path; }; typedef struct bp_getfile_res bp_getfile_res; #define BOOTPARAMPROG 100026 #define BOOTPARAMVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define BOOTPARAMPROC_WHOAMI 1 extern bp_whoami_res * bootparamproc_whoami_1(bp_whoami_arg *, CLIENT *); extern bp_whoami_res * bootparamproc_whoami_1_svc(bp_whoami_arg *, struct svc_req *); #define BOOTPARAMPROC_GETFILE 2 extern bp_getfile_res * bootparamproc_getfile_1(bp_getfile_arg *, CLIENT *); extern bp_getfile_res * bootparamproc_getfile_1_svc(bp_getfile_arg *, struct svc_req *); extern int bootparamprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define BOOTPARAMPROC_WHOAMI 1 extern bp_whoami_res * bootparamproc_whoami_1(); extern bp_whoami_res * bootparamproc_whoami_1_svc(); #define BOOTPARAMPROC_GETFILE 2 extern bp_getfile_res * bootparamproc_getfile_1(); extern bp_getfile_res * bootparamproc_getfile_1_svc(); extern int bootparamprog_1_freeresult(); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_bp_machine_name_t(XDR *, bp_machine_name_t*); extern bool_t xdr_bp_path_t(XDR *, bp_path_t*); extern bool_t xdr_bp_fileid_t(XDR *, bp_fileid_t*); extern bool_t xdr_ip_addr_t(XDR *, ip_addr_t*); extern bool_t xdr_bp_address(XDR *, bp_address*); extern bool_t xdr_bp_whoami_arg(XDR *, bp_whoami_arg*); extern bool_t xdr_bp_whoami_res(XDR *, bp_whoami_res*); extern bool_t xdr_bp_getfile_arg(XDR *, bp_getfile_arg*); extern bool_t xdr_bp_getfile_res(XDR *, bp_getfile_res*); #else /* K&R C */ extern bool_t xdr_bp_machine_name_t(); extern bool_t xdr_bp_path_t(); extern bool_t xdr_bp_fileid_t(); extern bool_t xdr_ip_addr_t(); extern bool_t xdr_bp_address(); extern bool_t xdr_bp_whoami_arg(); extern bool_t xdr_bp_whoami_res(); extern bool_t xdr_bp_getfile_arg(); extern bool_t xdr_bp_getfile_res(); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_BOOTPARAM_PROT_H_RPCGEN */ /* * 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 */ /* * 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; typedef string bp_path_t; typedef string bp_fileid_t; 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; /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _DAEMON_UTILS_H #define _DAEMON_UTILS_H #include #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 REPARSED "svc:/system/filesystem/reparse: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 */ /* * 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 2014, 2016 PALO, Richard. * * 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 #include #include #ifdef __cplusplus extern "C" { #endif #define PBLKSIZ 1024 #define DBLKSIZ 4096 #define BYTESIZ 8 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; datum fetch(datum); datum makdatum(char *, int); datum firstkey(void); datum nextkey(datum); datum firsthash(long); long calchash(datum); long hashinc(long); #ifdef __cplusplus } #endif #endif /* _RPCSVC_DBM_H */ /* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _MOUNT_H_RPCGEN #define _MOUNT_H_RPCGEN #include #ifdef __cplusplus extern "C" { #endif #define MNTPATHLEN 1024 #define MNTNAMLEN 255 #define FHSIZE 32 #define FHSIZE3 64 typedef char fhandle[FHSIZE]; typedef struct { u_int fhandle3_len; char *fhandle3_val; } fhandle3; struct fhstatus { u_int fhs_status; union { fhandle fhs_fhandle; } fhstatus_u; }; typedef struct fhstatus fhstatus; #define fhs_fh fhstatus_u.fhs_fhandle enum mountstat3 { MNT_OK = 0, MNT3ERR_PERM = 1, MNT3ERR_NOENT = 2, MNT3ERR_IO = 5, MNT3ERR_ACCES = 13, MNT3ERR_NOTDIR = 20, MNT3ERR_INVAL = 22, MNT3ERR_NAMETOOLONG = 63, MNT3ERR_NOTSUPP = 10004, MNT3ERR_SERVERFAULT = 10006 }; typedef enum mountstat3 mountstat3; struct mountres3_ok { fhandle3 fhandle; struct { u_int auth_flavors_len; int *auth_flavors_val; } auth_flavors; }; typedef struct mountres3_ok mountres3_ok; struct mountres3 { mountstat3 fhs_status; union { mountres3_ok mountinfo; } mountres3_u; }; typedef struct mountres3 mountres3; typedef char *dirpath; typedef char *name; typedef struct mountbody *mountlist; struct mountbody { name ml_hostname; dirpath ml_directory; mountlist ml_next; }; typedef struct mountbody mountbody; typedef struct groupnode *groups; struct groupnode { name gr_name; groups gr_next; }; typedef struct groupnode groupnode; typedef struct exportnode *exports; struct exportnode { dirpath ex_dir; groups ex_groups; exports ex_next; }; typedef struct exportnode exportnode; struct ppathcnf { int pc_link_max; short pc_max_canon; short pc_max_input; short pc_name_max; short pc_path_max; short pc_pipe_buf; u_char pc_vdisable; char pc_xxx; short pc_mask[2]; }; typedef struct ppathcnf ppathcnf; #define MOUNTPROG 100005 #define MOUNTVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define MOUNTPROC_NULL 0 extern void * mountproc_null_1(void *, CLIENT *); extern void * mountproc_null_1_svc(void *, struct svc_req *); #define MOUNTPROC_MNT 1 extern fhstatus * mountproc_mnt_1(dirpath *, CLIENT *); extern fhstatus * mountproc_mnt_1_svc(dirpath *, struct svc_req *); #define MOUNTPROC_DUMP 2 extern mountlist * mountproc_dump_1(void *, CLIENT *); extern mountlist * mountproc_dump_1_svc(void *, struct svc_req *); #define MOUNTPROC_UMNT 3 extern void * mountproc_umnt_1(dirpath *, CLIENT *); extern void * mountproc_umnt_1_svc(dirpath *, struct svc_req *); #define MOUNTPROC_UMNTALL 4 extern void * mountproc_umntall_1(void *, CLIENT *); extern void * mountproc_umntall_1_svc(void *, struct svc_req *); #define MOUNTPROC_EXPORT 5 extern exports * mountproc_export_1(void *, CLIENT *); extern exports * mountproc_export_1_svc(void *, struct svc_req *); #define MOUNTPROC_EXPORTALL 6 extern exports * mountproc_exportall_1(void *, CLIENT *); extern exports * mountproc_exportall_1_svc(void *, struct svc_req *); extern int mountprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define MOUNTPROC_NULL 0 extern void * mountproc_null_1(); extern void * mountproc_null_1_svc(); #define MOUNTPROC_MNT 1 extern fhstatus * mountproc_mnt_1(); extern fhstatus * mountproc_mnt_1_svc(); #define MOUNTPROC_DUMP 2 extern mountlist * mountproc_dump_1(); extern mountlist * mountproc_dump_1_svc(); #define MOUNTPROC_UMNT 3 extern void * mountproc_umnt_1(); extern void * mountproc_umnt_1_svc(); #define MOUNTPROC_UMNTALL 4 extern void * mountproc_umntall_1(); extern void * mountproc_umntall_1_svc(); #define MOUNTPROC_EXPORT 5 extern exports * mountproc_export_1(); extern exports * mountproc_export_1_svc(); #define MOUNTPROC_EXPORTALL 6 extern exports * mountproc_exportall_1(); extern exports * mountproc_exportall_1_svc(); extern int mountprog_1_freeresult(); #endif /* K&R C */ #define MOUNTVERS_POSIX 2 #if defined(__STDC__) || defined(__cplusplus) extern void * mountproc_null_2(void *, CLIENT *); extern void * mountproc_null_2_svc(void *, struct svc_req *); extern fhstatus * mountproc_mnt_2(dirpath *, CLIENT *); extern fhstatus * mountproc_mnt_2_svc(dirpath *, struct svc_req *); extern mountlist * mountproc_dump_2(void *, CLIENT *); extern mountlist * mountproc_dump_2_svc(void *, struct svc_req *); extern void * mountproc_umnt_2(dirpath *, CLIENT *); extern void * mountproc_umnt_2_svc(dirpath *, struct svc_req *); extern void * mountproc_umntall_2(void *, CLIENT *); extern void * mountproc_umntall_2_svc(void *, struct svc_req *); extern exports * mountproc_export_2(void *, CLIENT *); extern exports * mountproc_export_2_svc(void *, struct svc_req *); extern exports * mountproc_exportall_2(void *, CLIENT *); extern exports * mountproc_exportall_2_svc(void *, struct svc_req *); #define MOUNTPROC_PATHCONF 7 extern ppathcnf * mountproc_pathconf_2(dirpath *, CLIENT *); extern ppathcnf * mountproc_pathconf_2_svc(dirpath *, struct svc_req *); extern int mountprog_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ extern void * mountproc_null_2(); extern void * mountproc_null_2_svc(); extern fhstatus * mountproc_mnt_2(); extern fhstatus * mountproc_mnt_2_svc(); extern mountlist * mountproc_dump_2(); extern mountlist * mountproc_dump_2_svc(); extern void * mountproc_umnt_2(); extern void * mountproc_umnt_2_svc(); extern void * mountproc_umntall_2(); extern void * mountproc_umntall_2_svc(); extern exports * mountproc_export_2(); extern exports * mountproc_export_2_svc(); extern exports * mountproc_exportall_2(); extern exports * mountproc_exportall_2_svc(); #define MOUNTPROC_PATHCONF 7 extern ppathcnf * mountproc_pathconf_2(); extern ppathcnf * mountproc_pathconf_2_svc(); extern int mountprog_2_freeresult(); #endif /* K&R C */ #define MOUNTVERS3 3 #if defined(__STDC__) || defined(__cplusplus) extern void * mountproc_null_3(void *, CLIENT *); extern void * mountproc_null_3_svc(void *, struct svc_req *); extern mountres3 * mountproc_mnt_3(dirpath *, CLIENT *); extern mountres3 * mountproc_mnt_3_svc(dirpath *, struct svc_req *); extern mountlist * mountproc_dump_3(void *, CLIENT *); extern mountlist * mountproc_dump_3_svc(void *, struct svc_req *); extern void * mountproc_umnt_3(dirpath *, CLIENT *); extern void * mountproc_umnt_3_svc(dirpath *, struct svc_req *); extern void * mountproc_umntall_3(void *, CLIENT *); extern void * mountproc_umntall_3_svc(void *, struct svc_req *); extern exports * mountproc_export_3(void *, CLIENT *); extern exports * mountproc_export_3_svc(void *, struct svc_req *); extern int mountprog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ extern void * mountproc_null_3(); extern void * mountproc_null_3_svc(); extern mountres3 * mountproc_mnt_3(); extern mountres3 * mountproc_mnt_3_svc(); extern mountlist * mountproc_dump_3(); extern mountlist * mountproc_dump_3_svc(); extern void * mountproc_umnt_3(); extern void * mountproc_umnt_3_svc(); extern void * mountproc_umntall_3(); extern void * mountproc_umntall_3_svc(); extern exports * mountproc_export_3(); extern exports * mountproc_export_3_svc(); extern int mountprog_3_freeresult(); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_fhandle(XDR *, fhandle); extern bool_t xdr_fhandle3(XDR *, fhandle3*); extern bool_t xdr_fhstatus(XDR *, fhstatus*); extern bool_t xdr_mountstat3(XDR *, mountstat3*); extern bool_t xdr_mountres3_ok(XDR *, mountres3_ok*); extern bool_t xdr_mountres3(XDR *, mountres3*); extern bool_t xdr_dirpath(XDR *, dirpath*); extern bool_t xdr_name(XDR *, name*); extern bool_t xdr_mountlist(XDR *, mountlist*); extern bool_t xdr_mountbody(XDR *, mountbody*); extern bool_t xdr_groups(XDR *, groups*); extern bool_t xdr_groupnode(XDR *, groupnode*); extern bool_t xdr_exports(XDR *, exports*); extern bool_t xdr_exportnode(XDR *, exportnode*); extern bool_t xdr_ppathcnf(XDR *, ppathcnf*); #else /* K&R C */ extern bool_t xdr_fhandle(); extern bool_t xdr_fhandle3(); extern bool_t xdr_fhstatus(); extern bool_t xdr_mountstat3(); extern bool_t xdr_mountres3_ok(); extern bool_t xdr_mountres3(); extern bool_t xdr_dirpath(); extern bool_t xdr_name(); extern bool_t xdr_mountlist(); extern bool_t xdr_mountbody(); extern bool_t xdr_groups(); extern bool_t xdr_groupnode(); extern bool_t xdr_exports(); extern bool_t xdr_exportnode(); extern bool_t xdr_ppathcnf(); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_MOUNT_H_RPCGEN */ /* * 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,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; /* * 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; /* * The type name is used for arbitrary names (hostnames, groupnames) */ typedef string name; /* * 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; /* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _NFS4_PROT_H_RPCGEN #define _NFS4_PROT_H_RPCGEN #include #ifdef __cplusplus extern "C" { #endif #ifndef _AUTH_SYS_DEFINE_FOR_NFSv42 #define _AUTH_SYS_DEFINE_FOR_NFSv42 #include typedef struct authsys_parms authsys_parms; #endif /* _AUTH_SYS_DEFINE_FOR_NFSv42 */ #define NFS4_FHSIZE 128 #define NFS4_VERIFIER_SIZE 8 #define NFS4_OTHER_SIZE 12 #define NFS4_OPAQUE_LIMIT 1024 #define NFS4_SESSIONID_SIZE 16 #define NFS4_INT64_MAX 0x7fffffffffffffff #define NFS4_UINT64_MAX 0xffffffffffffffff #define NFS4_INT32_MAX 0x7fffffff #define NFS4_UINT32_MAX 0xffffffff #define NFS4_MAXFILELEN 0xffffffffffffffff #define NFS4_MAXFILEOFF 0xfffffffffffffffe enum nfs_ftype4 { NF4REG = 1, NF4DIR = 2, NF4BLK = 3, NF4CHR = 4, NF4LNK = 5, NF4SOCK = 6, NF4FIFO = 7, NF4ATTRDIR = 8, NF4NAMEDATTR = 9 }; typedef enum nfs_ftype4 nfs_ftype4; enum nfsstat4 { NFS4_OK = 0, NFS4ERR_PERM = 1, NFS4ERR_NOENT = 2, NFS4ERR_IO = 5, NFS4ERR_NXIO = 6, NFS4ERR_ACCESS = 13, NFS4ERR_EXIST = 17, NFS4ERR_XDEV = 18, NFS4ERR_NOTDIR = 20, NFS4ERR_ISDIR = 21, NFS4ERR_INVAL = 22, NFS4ERR_FBIG = 27, NFS4ERR_NOSPC = 28, NFS4ERR_ROFS = 30, NFS4ERR_MLINK = 31, NFS4ERR_NAMETOOLONG = 63, NFS4ERR_NOTEMPTY = 66, NFS4ERR_DQUOT = 69, NFS4ERR_STALE = 70, NFS4ERR_BADHANDLE = 10001, NFS4ERR_BAD_COOKIE = 10003, NFS4ERR_NOTSUPP = 10004, NFS4ERR_TOOSMALL = 10005, NFS4ERR_SERVERFAULT = 10006, NFS4ERR_BADTYPE = 10007, NFS4ERR_DELAY = 10008, NFS4ERR_SAME = 10009, NFS4ERR_DENIED = 10010, NFS4ERR_EXPIRED = 10011, NFS4ERR_LOCKED = 10012, NFS4ERR_GRACE = 10013, NFS4ERR_FHEXPIRED = 10014, NFS4ERR_SHARE_DENIED = 10015, NFS4ERR_WRONGSEC = 10016, NFS4ERR_CLID_INUSE = 10017, NFS4ERR_RESOURCE = 10018, NFS4ERR_MOVED = 10019, NFS4ERR_NOFILEHANDLE = 10020, NFS4ERR_MINOR_VERS_MISMATCH = 10021, NFS4ERR_STALE_CLIENTID = 10022, NFS4ERR_STALE_STATEID = 10023, NFS4ERR_OLD_STATEID = 10024, NFS4ERR_BAD_STATEID = 10025, NFS4ERR_BAD_SEQID = 10026, NFS4ERR_NOT_SAME = 10027, NFS4ERR_LOCK_RANGE = 10028, NFS4ERR_SYMLINK = 10029, NFS4ERR_RESTOREFH = 10030, NFS4ERR_LEASE_MOVED = 10031, NFS4ERR_ATTRNOTSUPP = 10032, NFS4ERR_NO_GRACE = 10033, NFS4ERR_RECLAIM_BAD = 10034, NFS4ERR_RECLAIM_CONFLICT = 10035, NFS4ERR_BADXDR = 10036, NFS4ERR_LOCKS_HELD = 10037, NFS4ERR_OPENMODE = 10038, NFS4ERR_BADOWNER = 10039, NFS4ERR_BADCHAR = 10040, NFS4ERR_BADNAME = 10041, NFS4ERR_BAD_RANGE = 10042, NFS4ERR_LOCK_NOTSUPP = 10043, NFS4ERR_OP_ILLEGAL = 10044, NFS4ERR_DEADLOCK = 10045, NFS4ERR_FILE_OPEN = 10046, NFS4ERR_ADMIN_REVOKED = 10047, NFS4ERR_CB_PATH_DOWN = 10048, NFS4ERR_BADIOMODE = 10049, NFS4ERR_BADLAYOUT = 10050, NFS4ERR_BAD_SESSION_DIGEST = 10051, NFS4ERR_BADSESSION = 10052, NFS4ERR_BADSLOT = 10053, NFS4ERR_COMPLETE_ALREADY = 10054, NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055, NFS4ERR_DELEG_ALREADY_WANTED = 10056, NFS4ERR_BACK_CHAN_BUSY = 10057, NFS4ERR_LAYOUTTRYLATER = 10058, NFS4ERR_LAYOUTUNAVAILABLE = 10059, NFS4ERR_NOMATCHING_LAYOUT = 10060, NFS4ERR_RECALLCONFLICT = 10061, NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062, NFS4ERR_SEQ_MISORDERED = 10063, NFS4ERR_SEQUENCE_POS = 10064, NFS4ERR_REQ_TOO_BIG = 10065, NFS4ERR_REP_TOO_BIG = 10066, NFS4ERR_REP_TOO_BIG_TO_CACHE = 10067, NFS4ERR_RETRY_UNCACHED_REP = 10068, NFS4ERR_UNSAFE_COMPOUND = 10069, NFS4ERR_TOO_MANY_OPS = 10070, NFS4ERR_OP_NOT_IN_SESSION = 10071, NFS4ERR_HASH_ALG_UNSUPP = 10072, NFS4ERR_CLIENTID_BUSY = 10074, NFS4ERR_PNFS_IO_HOLE = 10075, NFS4ERR_SEQ_FALSE_RETRY = 10076, NFS4ERR_BAD_HIGH_SLOT = 10077, NFS4ERR_DEADSESSION = 10078, NFS4ERR_ENCR_ALG_UNSUPP = 10079, NFS4ERR_PNFS_NO_LAYOUT = 10080, NFS4ERR_NOT_ONLY_OP = 10081, NFS4ERR_WRONG_CRED = 10082, NFS4ERR_WRONG_TYPE = 10083, NFS4ERR_DIRDELEG_UNAVAIL = 10084, NFS4ERR_REJECT_DELEG = 10085, NFS4ERR_RETURNCONFLICT = 10086, NFS4ERR_DELEG_REVOKED = 10087, NFS4ERR_PARTNER_NOTSUPP = 10088, NFS4ERR_PARTNER_NO_AUTH = 10089, NFS4ERR_UNION_NOTSUPP = 10090, NFS4ERR_OFFLOAD_DENIED = 10091, NFS4ERR_WRONG_LFS = 10092, NFS4ERR_BADLABEL = 10093, NFS4ERR_OFFLOAD_NO_REQS = 10094 }; typedef enum nfsstat4 nfsstat4; typedef struct { u_int attrlist4_len; char *attrlist4_val; } attrlist4; typedef struct { u_int bitmap4_len; uint32_t *bitmap4_val; } bitmap4; typedef uint64_t changeid4; typedef uint64_t clientid4; typedef uint32_t count4; typedef uint64_t length4; typedef uint32_t mode4; typedef uint64_t nfs_cookie4; typedef struct { u_int nfs_fh4_len; char *nfs_fh4_val; } nfs_fh4; typedef uint64_t offset4; typedef uint32_t qop4; typedef struct { u_int sec_oid4_len; char *sec_oid4_val; } sec_oid4; typedef uint32_t sequenceid4; typedef uint32_t seqid4; typedef char sessionid4[NFS4_SESSIONID_SIZE]; typedef uint32_t slotid4; typedef struct { u_int utf8string_len; char *utf8string_val; } utf8string; typedef utf8string utf8str_cis; typedef utf8string utf8str_cs; typedef utf8string utf8str_mixed; typedef utf8str_cs component4; typedef struct { u_int linktext4_len; char *linktext4_val; } linktext4; typedef utf8string ascii_REQUIRED4; typedef struct { u_int pathname4_len; component4 *pathname4_val; } pathname4; typedef char verifier4[NFS4_VERIFIER_SIZE]; typedef char *secret4; typedef uint32_t policy4; struct nfstime4 { int64_t seconds; uint32_t nseconds; }; typedef struct nfstime4 nfstime4; enum time_how4 { SET_TO_SERVER_TIME4 = 0, SET_TO_CLIENT_TIME4 = 1 }; typedef enum time_how4 time_how4; struct settime4 { time_how4 set_it; union { nfstime4 time; } settime4_u; }; typedef struct settime4 settime4; typedef uint32_t nfs_lease4; struct fsid4 { uint64_t major; uint64_t minor; }; typedef struct fsid4 fsid4; struct change_policy4 { uint64_t cp_major; uint64_t cp_minor; }; typedef struct change_policy4 change_policy4; struct fs_location4 { struct { u_int server_len; utf8str_cis *server_val; } server; pathname4 rootpath; }; typedef struct fs_location4 fs_location4; struct fs_locations4 { pathname4 fs_root; struct { u_int locations_len; fs_location4 *locations_val; } locations; }; typedef struct fs_locations4 fs_locations4; #define ACL4_SUPPORT_ALLOW_ACL 0x00000001 #define ACL4_SUPPORT_DENY_ACL 0x00000002 #define ACL4_SUPPORT_AUDIT_ACL 0x00000004 #define ACL4_SUPPORT_ALARM_ACL 0x00000008 typedef uint32_t acetype4; #define ACE4_ACCESS_ALLOWED_ACE_TYPE 0x00000000 #define ACE4_ACCESS_DENIED_ACE_TYPE 0x00000001 #define ACE4_SYSTEM_AUDIT_ACE_TYPE 0x00000002 #define ACE4_SYSTEM_ALARM_ACE_TYPE 0x00000003 typedef uint32_t aceflag4; #define ACE4_FILE_INHERIT_ACE 0x00000001 #define ACE4_DIRECTORY_INHERIT_ACE 0x00000002 #define ACE4_NO_PROPAGATE_INHERIT_ACE 0x00000004 #define ACE4_INHERIT_ONLY_ACE 0x00000008 #define ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010 #define ACE4_FAILED_ACCESS_ACE_FLAG 0x00000020 #define ACE4_IDENTIFIER_GROUP 0x00000040 #define ACE4_INHERITED_ACE 0x00000080 typedef uint32_t acemask4; #define ACE4_READ_DATA 0x00000001 #define ACE4_LIST_DIRECTORY 0x00000001 #define ACE4_WRITE_DATA 0x00000002 #define ACE4_ADD_FILE 0x00000002 #define ACE4_APPEND_DATA 0x00000004 #define ACE4_ADD_SUBDIRECTORY 0x00000004 #define ACE4_READ_NAMED_ATTRS 0x00000008 #define ACE4_WRITE_NAMED_ATTRS 0x00000010 #define ACE4_EXECUTE 0x00000020 #define ACE4_DELETE_CHILD 0x00000040 #define ACE4_READ_ATTRIBUTES 0x00000080 #define ACE4_WRITE_ATTRIBUTES 0x00000100 #define ACE4_WRITE_RETENTION 0x00000200 #define ACE4_WRITE_RETENTION_HOLD 0x00000400 #define ACE4_DELETE 0x00010000 #define ACE4_READ_ACL 0x00020000 #define ACE4_WRITE_ACL 0x00040000 #define ACE4_WRITE_OWNER 0x00080000 #define ACE4_SYNCHRONIZE 0x00100000 #define ACE4_GENERIC_READ 0x00120081 #define ACE4_GENERIC_WRITE 0x00160106 #define ACE4_GENERIC_EXECUTE 0x001200A0 struct nfsace4 { acetype4 type; aceflag4 flag; acemask4 access_mask; utf8str_mixed who; }; typedef struct nfsace4 nfsace4; typedef uint32_t aclflag4; #define ACL4_AUTO_INHERIT 0x00000001 #define ACL4_PROTECTED 0x00000002 #define ACL4_DEFAULTED 0x00000004 struct nfsacl41 { aclflag4 na41_flag; struct { u_int na41_aces_len; nfsace4 *na41_aces_val; } na41_aces; }; typedef struct nfsacl41 nfsacl41; #define MODE4_SUID 0x800 #define MODE4_SGID 0x400 #define MODE4_SVTX 0x200 #define MODE4_RUSR 0x100 #define MODE4_WUSR 0x080 #define MODE4_XUSR 0x040 #define MODE4_RGRP 0x020 #define MODE4_WGRP 0x010 #define MODE4_XGRP 0x008 #define MODE4_ROTH 0x004 #define MODE4_WOTH 0x002 #define MODE4_XOTH 0x001 struct mode_masked4 { mode4 mm_value_to_set; mode4 mm_mask_bits; }; typedef struct mode_masked4 mode_masked4; struct specdata4 { uint32_t specdata1; uint32_t specdata2; }; typedef struct specdata4 specdata4; #define FH4_PERSISTENT 0x00000000 #define FH4_NOEXPIRE_WITH_OPEN 0x00000001 #define FH4_VOLATILE_ANY 0x00000002 #define FH4_VOL_MIGRATION 0x00000004 #define FH4_VOL_RENAME 0x00000008 struct netaddr4 { char *na_r_netid; char *na_r_addr; }; typedef struct netaddr4 netaddr4; struct nfs_impl_id4 { utf8str_cis nii_domain; utf8str_cs nii_name; nfstime4 nii_date; }; typedef struct nfs_impl_id4 nfs_impl_id4; struct stateid4 { uint32_t seqid; char other[NFS4_OTHER_SIZE]; }; typedef struct stateid4 stateid4; enum layouttype4 { LAYOUT4_NFSV4_1_FILES = 0x1, LAYOUT4_OSD2_OBJECTS = 0x2, LAYOUT4_BLOCK_VOLUME = 0x3 }; typedef enum layouttype4 layouttype4; struct layout_content4 { layouttype4 loc_type; struct { u_int loc_body_len; char *loc_body_val; } loc_body; }; typedef struct layout_content4 layout_content4; /* * LAYOUT4_OSD2_OBJECTS loc_body description * is in a separate .x file. */ /* * LAYOUT4_BLOCK_VOLUME loc_body description * is in a separate .x file. */ struct layouthint4 { layouttype4 loh_type; struct { u_int loh_body_len; char *loh_body_val; } loh_body; }; typedef struct layouthint4 layouthint4; enum layoutiomode4 { LAYOUTIOMODE4_READ = 1, LAYOUTIOMODE4_RW = 2, LAYOUTIOMODE4_ANY = 3 }; typedef enum layoutiomode4 layoutiomode4; struct layout4 { offset4 lo_offset; length4 lo_length; layoutiomode4 lo_iomode; layout_content4 lo_content; }; typedef struct layout4 layout4; #define NFS4_DEVICEID4_SIZE 16 typedef char deviceid4[NFS4_DEVICEID4_SIZE]; struct device_addr4 { layouttype4 da_layout_type; struct { u_int da_addr_body_len; char *da_addr_body_val; } da_addr_body; }; typedef struct device_addr4 device_addr4; struct layoutupdate4 { layouttype4 lou_type; struct { u_int lou_body_len; char *lou_body_val; } lou_body; }; typedef struct layoutupdate4 layoutupdate4; #define LAYOUT4_RET_REC_FILE 1 #define LAYOUT4_RET_REC_FSID 2 #define LAYOUT4_RET_REC_ALL 3 enum layoutreturn_type4 { LAYOUTRETURN4_FILE = LAYOUT4_RET_REC_FILE, LAYOUTRETURN4_FSID = LAYOUT4_RET_REC_FSID, LAYOUTRETURN4_ALL = LAYOUT4_RET_REC_ALL }; typedef enum layoutreturn_type4 layoutreturn_type4; /* layouttype4 specific data */ struct layoutreturn_file4 { offset4 lrf_offset; length4 lrf_length; stateid4 lrf_stateid; struct { u_int lrf_body_len; char *lrf_body_val; } lrf_body; }; typedef struct layoutreturn_file4 layoutreturn_file4; struct layoutreturn4 { layoutreturn_type4 lr_returntype; union { layoutreturn_file4 lr_layout; } layoutreturn4_u; }; typedef struct layoutreturn4 layoutreturn4; enum fs4_status_type { STATUS4_FIXED = 1, STATUS4_UPDATED = 2, STATUS4_VERSIONED = 3, STATUS4_WRITABLE = 4, STATUS4_REFERRAL = 5 }; typedef enum fs4_status_type fs4_status_type; struct fs4_status { bool_t fss_absent; fs4_status_type fss_type; utf8str_cs fss_source; utf8str_cs fss_current; int32_t fss_age; nfstime4 fss_version; }; typedef struct fs4_status fs4_status; #define TH4_READ_SIZE 0 #define TH4_WRITE_SIZE 1 #define TH4_READ_IOSIZE 2 #define TH4_WRITE_IOSIZE 3 typedef length4 threshold4_read_size; typedef length4 threshold4_write_size; typedef length4 threshold4_read_iosize; typedef length4 threshold4_write_iosize; struct threshold_item4 { layouttype4 thi_layout_type; bitmap4 thi_hintset; struct { u_int thi_hintlist_len; char *thi_hintlist_val; } thi_hintlist; }; typedef struct threshold_item4 threshold_item4; struct mdsthreshold4 { struct { u_int mth_hints_len; threshold_item4 *mth_hints_val; } mth_hints; }; typedef struct mdsthreshold4 mdsthreshold4; #define RET4_DURATION_INFINITE 0xffffffffffffffff struct retention_get4 { uint64_t rg_duration; struct { u_int rg_begin_time_len; nfstime4 *rg_begin_time_val; } rg_begin_time; }; typedef struct retention_get4 retention_get4; struct retention_set4 { bool_t rs_enable; struct { u_int rs_duration_len; uint64_t *rs_duration_val; } rs_duration; }; typedef struct retention_set4 retention_set4; #define FSCHARSET_CAP4_CONTAINS_NON_UTF8 0x1 #define FSCHARSET_CAP4_ALLOWS_ONLY_UTF8 0x2 typedef uint32_t fs_charset_cap4; enum netloc_type4 { NL4_NAME = 1, NL4_URL = 2, NL4_NETADDR = 3 }; typedef enum netloc_type4 netloc_type4; struct netloc4 { netloc_type4 nl_type; union { utf8str_cis nl_name; utf8str_cis nl_url; netaddr4 nl_addr; } netloc4_u; }; typedef struct netloc4 netloc4; enum change_attr_type4 { NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR = 0, NFS4_CHANGE_TYPE_IS_VERSION_COUNTER = 1, NFS4_CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS = 2, NFS4_CHANGE_TYPE_IS_TIME_METADATA = 3, NFS4_CHANGE_TYPE_IS_UNDEFINED = 4 }; typedef enum change_attr_type4 change_attr_type4; struct labelformat_spec4 { policy4 lfs_lfs; policy4 lfs_pi; }; typedef struct labelformat_spec4 labelformat_spec4; struct sec_label4 { labelformat_spec4 slai_lfs; struct { u_int slai_data_len; char *slai_data_val; } slai_data; }; typedef struct sec_label4 sec_label4; struct copy_from_auth_priv { secret4 cfap_shared_secret; netloc4 cfap_destination; utf8str_mixed cfap_username; }; typedef struct copy_from_auth_priv copy_from_auth_priv; struct copy_to_auth_priv { secret4 ctap_shared_secret; struct { u_int ctap_source_len; netloc4 *ctap_source_val; } ctap_source; utf8str_mixed ctap_username; }; typedef struct copy_to_auth_priv copy_to_auth_priv; struct copy_confirm_auth_priv { struct { u_int ccap_shared_secret_mic_len; char *ccap_shared_secret_mic_val; } ccap_shared_secret_mic; utf8str_mixed ccap_username; }; typedef struct copy_confirm_auth_priv copy_confirm_auth_priv; struct app_data_block4 { offset4 adb_offset; length4 adb_block_size; length4 adb_block_count; length4 adb_reloff_blocknum; count4 adb_block_num; length4 adb_reloff_pattern; struct { u_int adb_pattern_len; char *adb_pattern_val; } adb_pattern; }; typedef struct app_data_block4 app_data_block4; struct data4 { offset4 d_offset; struct { u_int d_data_len; char *d_data_val; } d_data; }; typedef struct data4 data4; struct data_info4 { offset4 di_offset; length4 di_length; }; typedef struct data_info4 data_info4; enum data_content4 { NFS4_CONTENT_DATA = 0, NFS4_CONTENT_HOLE = 1 }; typedef enum data_content4 data_content4; enum stable_how4 { UNSTABLE4 = 0, DATA_SYNC4 = 1, FILE_SYNC4 = 2 }; typedef enum stable_how4 stable_how4; struct write_response4 { struct { u_int wr_callback_id_len; stateid4 *wr_callback_id_val; } wr_callback_id; length4 wr_count; stable_how4 wr_committed; verifier4 wr_writeverf; }; typedef struct write_response4 write_response4; 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_t fattr4_link_support; typedef bool_t fattr4_symlink_support; typedef bool_t fattr4_named_attr; typedef fsid4 fattr4_fsid; typedef bool_t fattr4_unique_handles; typedef nfs_lease4 fattr4_lease_time; typedef nfsstat4 fattr4_rdattr_error; typedef struct { u_int fattr4_acl_len; nfsace4 *fattr4_acl_val; } fattr4_acl; typedef uint32_t fattr4_aclsupport; typedef bool_t fattr4_archive; typedef bool_t fattr4_cansettime; typedef bool_t fattr4_case_insensitive; typedef bool_t fattr4_case_preserving; typedef bool_t 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_t fattr4_hidden; typedef bool_t 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 ascii_REQUIRED4 fattr4_mimetype; typedef mode4 fattr4_mode; typedef mode_masked4 fattr4_mode_set_masked; typedef uint64_t fattr4_mounted_on_fileid; typedef bool_t 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 length4 fattr4_space_free; typedef uint64_t fattr4_space_total; typedef uint64_t fattr4_space_used; typedef bool_t 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; typedef bitmap4 fattr4_suppattr_exclcreat; typedef nfstime4 fattr4_dir_notif_delay; typedef nfstime4 fattr4_dirent_notif_delay; typedef struct { u_int fattr4_fs_layout_types_len; layouttype4 *fattr4_fs_layout_types_val; } fattr4_fs_layout_types; typedef fs4_status fattr4_fs_status; typedef fs_charset_cap4 fattr4_fs_charset_cap; typedef uint32_t fattr4_layout_alignment; typedef uint32_t fattr4_layout_blksize; typedef layouthint4 fattr4_layout_hint; typedef struct { u_int fattr4_layout_types_len; layouttype4 *fattr4_layout_types_val; } fattr4_layout_types; typedef mdsthreshold4 fattr4_mdsthreshold; typedef retention_get4 fattr4_retention_get; typedef retention_set4 fattr4_retention_set; typedef retention_get4 fattr4_retentevt_get; typedef retention_set4 fattr4_retentevt_set; typedef uint64_t fattr4_retention_hold; typedef nfsacl41 fattr4_dacl; typedef nfsacl41 fattr4_sacl; typedef change_policy4 fattr4_change_policy; typedef uint64_t fattr4_space_freed; typedef change_attr_type4 fattr4_change_attr_type; typedef sec_label4 fattr4_sec_label; typedef uint32_t fattr4_clone_blksize; /* * REQUIRED attributes */ #define FATTR4_SUPPORTED_ATTRS 0 #define FATTR4_TYPE 1 #define FATTR4_FH_EXPIRE_TYPE 2 #define FATTR4_CHANGE 3 #define FATTR4_SIZE 4 #define FATTR4_LINK_SUPPORT 5 #define FATTR4_SYMLINK_SUPPORT 6 #define FATTR4_NAMED_ATTR 7 #define FATTR4_FSID 8 #define FATTR4_UNIQUE_HANDLES 9 #define FATTR4_LEASE_TIME 10 #define FATTR4_RDATTR_ERROR 11 #define FATTR4_FILEHANDLE 19 /* * New to NFSv4.1 */ #define FATTR4_SUPPATTR_EXCLCREAT 75 /* * RECOMMENDED attributes */ #define FATTR4_ACL 12 #define FATTR4_ACLSUPPORT 13 #define FATTR4_ARCHIVE 14 #define FATTR4_CANSETTIME 15 #define FATTR4_CASE_INSENSITIVE 16 #define FATTR4_CASE_PRESERVING 17 #define FATTR4_CHOWN_RESTRICTED 18 #define FATTR4_FILEID 20 #define FATTR4_FILES_AVAIL 21 #define FATTR4_FILES_FREE 22 #define FATTR4_FILES_TOTAL 23 #define FATTR4_FS_LOCATIONS 24 #define FATTR4_HIDDEN 25 #define FATTR4_HOMOGENEOUS 26 #define FATTR4_MAXFILESIZE 27 #define FATTR4_MAXLINK 28 #define FATTR4_MAXNAME 29 #define FATTR4_MAXREAD 30 #define FATTR4_MAXWRITE 31 #define FATTR4_MIMETYPE 32 #define FATTR4_MODE 33 #define FATTR4_NO_TRUNC 34 #define FATTR4_NUMLINKS 35 #define FATTR4_OWNER 36 #define FATTR4_OWNER_GROUP 37 #define FATTR4_QUOTA_AVAIL_HARD 38 #define FATTR4_QUOTA_AVAIL_SOFT 39 #define FATTR4_QUOTA_USED 40 #define FATTR4_RAWDEV 41 #define FATTR4_SPACE_AVAIL 42 #define FATTR4_SPACE_FREE 43 #define FATTR4_SPACE_TOTAL 44 #define FATTR4_SPACE_USED 45 #define FATTR4_SYSTEM 46 #define FATTR4_TIME_ACCESS 47 #define FATTR4_TIME_ACCESS_SET 48 #define FATTR4_TIME_BACKUP 49 #define FATTR4_TIME_CREATE 50 #define FATTR4_TIME_DELTA 51 #define FATTR4_TIME_METADATA 52 #define FATTR4_TIME_MODIFY 53 #define FATTR4_TIME_MODIFY_SET 54 #define FATTR4_MOUNTED_ON_FILEID 55 /* * New to NFSv4.1 */ #define FATTR4_DIR_NOTIF_DELAY 56 #define FATTR4_DIRENT_NOTIF_DELAY 57 #define FATTR4_DACL 58 #define FATTR4_SACL 59 #define FATTR4_CHANGE_POLICY 60 #define FATTR4_FS_STATUS 61 #define FATTR4_FS_LAYOUT_TYPES 62 #define FATTR4_LAYOUT_HINT 63 #define FATTR4_LAYOUT_TYPES 64 #define FATTR4_LAYOUT_BLKSIZE 65 #define FATTR4_LAYOUT_ALIGNMENT 66 #define FATTR4_FS_LOCATIONS_INFO 67 #define FATTR4_MDSTHRESHOLD 68 #define FATTR4_RETENTION_GET 69 #define FATTR4_RETENTION_SET 70 #define FATTR4_RETENTEVT_GET 71 #define FATTR4_RETENTEVT_SET 72 #define FATTR4_RETENTION_HOLD 73 #define FATTR4_MODE_SET_MASKED 74 #define FATTR4_FS_CHARSET_CAP 76 /* * New to NFSv4.2 */ #define FATTR4_CLONE_BLKSIZE 77 #define FATTR4_SPACE_FREED 78 #define FATTR4_CHANGE_ATTR_TYPE 79 #define FATTR4_SEC_LABEL 80 struct fattr4 { bitmap4 attrmask; attrlist4 attr_vals; }; typedef struct fattr4 fattr4; struct change_info4 { bool_t atomic; changeid4 before; changeid4 after; }; typedef struct change_info4 change_info4; typedef netaddr4 clientaddr4; struct cb_client4 { uint32_t cb_program; netaddr4 cb_location; }; typedef struct cb_client4 cb_client4; struct nfs_client_id4 { verifier4 verifier; struct { u_int id_len; char *id_val; } id; }; typedef struct nfs_client_id4 nfs_client_id4; struct client_owner4 { verifier4 co_verifier; struct { u_int co_ownerid_len; char *co_ownerid_val; } co_ownerid; }; typedef struct client_owner4 client_owner4; struct server_owner4 { uint64_t so_minor_id; struct { u_int so_major_id_len; char *so_major_id_val; } so_major_id; }; typedef struct server_owner4 server_owner4; struct state_owner4 { clientid4 clientid; struct { u_int owner_len; char *owner_val; } owner; }; typedef struct state_owner4 state_owner4; typedef state_owner4 open_owner4; typedef state_owner4 lock_owner4; enum nfs_lock_type4 { READ_LT = 1, WRITE_LT = 2, READW_LT = 3, WRITEW_LT = 4 }; typedef enum nfs_lock_type4 nfs_lock_type4; /* Input for computing subkeys */ enum ssv_subkey4 { SSV4_SUBKEY_MIC_I2T = 1, SSV4_SUBKEY_MIC_T2I = 2, SSV4_SUBKEY_SEAL_I2T = 3, SSV4_SUBKEY_SEAL_T2I = 4 }; typedef enum ssv_subkey4 ssv_subkey4; /* Input for computing smt_hmac */ struct ssv_mic_plain_tkn4 { uint32_t smpt_ssv_seq; struct { u_int smpt_orig_plain_len; char *smpt_orig_plain_val; } smpt_orig_plain; }; typedef struct ssv_mic_plain_tkn4 ssv_mic_plain_tkn4; /* * Secret State Verifier Generic Security Service (SSV GSS) * PerMsgToken token */ struct ssv_mic_tkn4 { uint32_t smt_ssv_seq; struct { u_int smt_hmac_len; char *smt_hmac_val; } smt_hmac; }; typedef struct ssv_mic_tkn4 ssv_mic_tkn4; /* Input for computing ssct_encr_data and ssct_hmac */ struct ssv_seal_plain_tkn4 { struct { u_int sspt_confounder_len; char *sspt_confounder_val; } sspt_confounder; uint32_t sspt_ssv_seq; struct { u_int sspt_orig_plain_len; char *sspt_orig_plain_val; } sspt_orig_plain; struct { u_int sspt_pad_len; char *sspt_pad_val; } sspt_pad; }; typedef struct ssv_seal_plain_tkn4 ssv_seal_plain_tkn4; /* SSV GSS SealedMessage token */ struct ssv_seal_cipher_tkn4 { uint32_t ssct_ssv_seq; struct { u_int ssct_iv_len; char *ssct_iv_val; } ssct_iv; struct { u_int ssct_encr_data_len; char *ssct_encr_data_val; } ssct_encr_data; struct { u_int ssct_hmac_len; char *ssct_hmac_val; } ssct_hmac; }; typedef struct ssv_seal_cipher_tkn4 ssv_seal_cipher_tkn4; struct fs_locations_server4 { int32_t fls_currency; struct { u_int fls_info_len; char *fls_info_val; } fls_info; utf8str_cis fls_server; }; typedef struct fs_locations_server4 fs_locations_server4; #define FSLI4BX_GFLAGS 0 #define FSLI4BX_TFLAGS 1 #define FSLI4BX_CLSIMUL 2 #define FSLI4BX_CLHANDLE 3 #define FSLI4BX_CLFILEID 4 #define FSLI4BX_CLWRITEVER 5 #define FSLI4BX_CLCHANGE 6 #define FSLI4BX_CLREADDIR 7 #define FSLI4BX_READRANK 8 #define FSLI4BX_WRITERANK 9 #define FSLI4BX_READORDER 10 #define FSLI4BX_WRITEORDER 11 #define FSLI4GF_WRITABLE 0x01 #define FSLI4GF_CUR_REQ 0x02 #define FSLI4GF_ABSENT 0x04 #define FSLI4GF_GOING 0x08 #define FSLI4GF_SPLIT 0x10 #define FSLI4TF_RDMA 0x01 struct fs_locations_item4 { struct { u_int fli_entries_len; fs_locations_server4 *fli_entries_val; } fli_entries; pathname4 fli_rootpath; }; typedef struct fs_locations_item4 fs_locations_item4; struct fs_locations_info4 { uint32_t fli_flags; int32_t fli_valid_for; pathname4 fli_fs_root; struct { u_int fli_items_len; fs_locations_item4 *fli_items_val; } fli_items; }; typedef struct fs_locations_info4 fs_locations_info4; #define FSLI4IF_VAR_SUB 0x00000001 typedef fs_locations_info4 fattr4_fs_locations_info; #define NFL4_UFLG_MASK 0x0000003F #define NFL4_UFLG_DENSE 0x00000001 #define NFL4_UFLG_COMMIT_THRU_MDS 0x00000002 #define NFL42_UFLG_IO_ADVISE_THRU_MDS 0x00000004 #define NFL4_UFLG_STRIPE_UNIT_SIZE_MASK 0xFFFFFFC0 typedef uint32_t nfl_util4; enum filelayout_hint_care4 { NFLH4_CARE_DENSE = NFL4_UFLG_DENSE, NFLH4_CARE_COMMIT_THRU_MDS = NFL4_UFLG_COMMIT_THRU_MDS, NFL42_CARE_IO_ADVISE_THRU_MDS = NFL42_UFLG_IO_ADVISE_THRU_MDS, NFLH4_CARE_STRIPE_UNIT_SIZE = 0x00000040, NFLH4_CARE_STRIPE_COUNT = 0x00000080 }; typedef enum filelayout_hint_care4 filelayout_hint_care4; /* * Encoded in the loh_body field of data type layouthint4: */ struct nfsv4_1_file_layouthint4 { uint32_t nflh_care; nfl_util4 nflh_util; count4 nflh_stripe_count; }; typedef struct nfsv4_1_file_layouthint4 nfsv4_1_file_layouthint4; typedef struct { u_int multipath_list4_len; netaddr4 *multipath_list4_val; } multipath_list4; /* * Encoded in the da_addr_body field of data type device_addr4: */ struct nfsv4_1_file_layout_ds_addr4 { struct { u_int nflda_stripe_indices_len; uint32_t *nflda_stripe_indices_val; } nflda_stripe_indices; struct { u_int nflda_multipath_ds_list_len; multipath_list4 *nflda_multipath_ds_list_val; } nflda_multipath_ds_list; }; typedef struct nfsv4_1_file_layout_ds_addr4 nfsv4_1_file_layout_ds_addr4; /* * Encoded in the loc_body field of data type layout_content4: */ struct nfsv4_1_file_layout4 { deviceid4 nfl_deviceid; nfl_util4 nfl_util; uint32_t nfl_first_stripe_index; offset4 nfl_pattern_offset; struct { u_int nfl_fh_list_len; nfs_fh4 *nfl_fh_list_val; } nfl_fh_list; }; typedef struct nfsv4_1_file_layout4 nfsv4_1_file_layout4; /* New operations for NFSv4.1 */ /* New operations for NFSv4.2 */ 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_BACKCHANNEL_CTL = 40, OP_BIND_CONN_TO_SESSION = 41, OP_EXCHANGE_ID = 42, OP_CREATE_SESSION = 43, OP_DESTROY_SESSION = 44, OP_FREE_STATEID = 45, OP_GET_DIR_DELEGATION = 46, OP_GETDEVICEINFO = 47, OP_GETDEVICELIST = 48, OP_LAYOUTCOMMIT = 49, OP_LAYOUTGET = 50, OP_LAYOUTRETURN = 51, OP_SECINFO_NO_NAME = 52, OP_SEQUENCE = 53, OP_SET_SSV = 54, OP_TEST_STATEID = 55, OP_WANT_DELEGATION = 56, OP_DESTROY_CLIENTID = 57, OP_RECLAIM_COMPLETE = 58, OP_ALLOCATE = 59, OP_COPY = 60, OP_COPY_NOTIFY = 61, OP_DEALLOCATE = 62, OP_IO_ADVISE = 63, OP_LAYOUTERROR = 64, OP_LAYOUTSTATS = 65, OP_OFFLOAD_CANCEL = 66, OP_OFFLOAD_STATUS = 67, OP_READ_PLUS = 68, OP_SEEK = 69, OP_WRITE_SAME = 70, OP_CLONE = 71, OP_ILLEGAL = 10044 }; typedef enum nfs_opnum4 nfs_opnum4; #define ACCESS4_READ 0x00000001 #define ACCESS4_LOOKUP 0x00000002 #define ACCESS4_MODIFY 0x00000004 #define ACCESS4_EXTEND 0x00000008 #define ACCESS4_DELETE 0x00000010 #define ACCESS4_EXECUTE 0x00000020 struct ACCESS4args { uint32_t access; }; typedef struct ACCESS4args ACCESS4args; struct ACCESS4resok { uint32_t supported; uint32_t access; }; typedef struct ACCESS4resok ACCESS4resok; struct ACCESS4res { nfsstat4 status; union { ACCESS4resok resok4; } ACCESS4res_u; }; typedef struct ACCESS4res ACCESS4res; struct CLONE4args { stateid4 cl_src_stateid; stateid4 cl_dst_stateid; offset4 cl_src_offset; offset4 cl_dst_offset; length4 cl_count; }; typedef struct CLONE4args CLONE4args; struct CLONE4res { nfsstat4 cl_status; }; typedef struct CLONE4res CLONE4res; struct CLOSE4args { seqid4 seqid; stateid4 open_stateid; }; typedef struct CLOSE4args CLOSE4args; struct CLOSE4res { nfsstat4 status; union { stateid4 open_stateid; } CLOSE4res_u; }; typedef struct CLOSE4res CLOSE4res; struct COMMIT4args { offset4 offset; count4 count; }; typedef struct COMMIT4args COMMIT4args; struct COMMIT4resok { verifier4 writeverf; }; typedef struct COMMIT4resok COMMIT4resok; struct COMMIT4res { nfsstat4 status; union { COMMIT4resok resok4; } COMMIT4res_u; }; typedef struct COMMIT4res COMMIT4res; struct createtype4 { nfs_ftype4 type; union { linktext4 linkdata; specdata4 devdata; } createtype4_u; }; typedef struct createtype4 createtype4; struct CREATE4args { createtype4 objtype; component4 objname; fattr4 createattrs; }; typedef struct CREATE4args CREATE4args; struct CREATE4resok { change_info4 cinfo; bitmap4 attrset; }; typedef struct CREATE4resok CREATE4resok; struct CREATE4res { nfsstat4 status; union { CREATE4resok resok4; } CREATE4res_u; }; typedef struct CREATE4res CREATE4res; struct DELEGPURGE4args { clientid4 clientid; }; typedef struct DELEGPURGE4args DELEGPURGE4args; struct DELEGPURGE4res { nfsstat4 status; }; typedef struct DELEGPURGE4res DELEGPURGE4res; struct DELEGRETURN4args { stateid4 deleg_stateid; }; typedef struct DELEGRETURN4args DELEGRETURN4args; struct DELEGRETURN4res { nfsstat4 status; }; typedef struct DELEGRETURN4res DELEGRETURN4res; struct GETATTR4args { bitmap4 attr_request; }; typedef struct GETATTR4args GETATTR4args; struct GETATTR4resok { fattr4 obj_attributes; }; typedef struct GETATTR4resok GETATTR4resok; struct GETATTR4res { nfsstat4 status; union { GETATTR4resok resok4; } GETATTR4res_u; }; typedef struct GETATTR4res GETATTR4res; struct GETFH4resok { nfs_fh4 object; }; typedef struct GETFH4resok GETFH4resok; struct GETFH4res { nfsstat4 status; union { GETFH4resok resok4; } GETFH4res_u; }; typedef struct GETFH4res GETFH4res; struct LINK4args { component4 newname; }; typedef struct LINK4args LINK4args; struct LINK4resok { change_info4 cinfo; }; typedef struct LINK4resok LINK4resok; struct LINK4res { nfsstat4 status; union { LINK4resok resok4; } LINK4res_u; }; typedef struct LINK4res LINK4res; struct open_to_lock_owner4 { seqid4 open_seqid; stateid4 open_stateid; seqid4 lock_seqid; lock_owner4 lock_owner; }; typedef struct open_to_lock_owner4 open_to_lock_owner4; struct exist_lock_owner4 { stateid4 lock_stateid; seqid4 lock_seqid; }; typedef struct exist_lock_owner4 exist_lock_owner4; struct locker4 { bool_t new_lock_owner; union { open_to_lock_owner4 open_owner; exist_lock_owner4 lock_owner; } locker4_u; }; typedef struct locker4 locker4; struct LOCK4args { nfs_lock_type4 locktype; bool_t reclaim; offset4 offset; length4 length; locker4 locker; }; typedef struct LOCK4args LOCK4args; struct LOCK4denied { offset4 offset; length4 length; nfs_lock_type4 locktype; lock_owner4 owner; }; typedef struct LOCK4denied LOCK4denied; struct LOCK4resok { stateid4 lock_stateid; }; typedef struct LOCK4resok LOCK4resok; struct LOCK4res { nfsstat4 status; union { LOCK4resok resok4; LOCK4denied denied; } LOCK4res_u; }; typedef struct LOCK4res LOCK4res; struct LOCKT4args { nfs_lock_type4 locktype; offset4 offset; length4 length; lock_owner4 owner; }; typedef struct LOCKT4args LOCKT4args; struct LOCKT4res { nfsstat4 status; union { LOCK4denied denied; } LOCKT4res_u; }; typedef struct LOCKT4res LOCKT4res; struct LOCKU4args { nfs_lock_type4 locktype; seqid4 seqid; stateid4 lock_stateid; offset4 offset; length4 length; }; typedef struct LOCKU4args LOCKU4args; struct LOCKU4res { nfsstat4 status; union { stateid4 lock_stateid; } LOCKU4res_u; }; typedef struct LOCKU4res LOCKU4res; struct LOOKUP4args { component4 objname; }; typedef struct LOOKUP4args LOOKUP4args; struct LOOKUP4res { nfsstat4 status; }; typedef struct LOOKUP4res LOOKUP4res; struct LOOKUPP4res { nfsstat4 status; }; typedef struct LOOKUPP4res LOOKUPP4res; struct NVERIFY4args { fattr4 obj_attributes; }; typedef struct NVERIFY4args NVERIFY4args; struct NVERIFY4res { nfsstat4 status; }; typedef struct NVERIFY4res NVERIFY4res; enum createmode4 { UNCHECKED4 = 0, GUARDED4 = 1, EXCLUSIVE4 = 2, EXCLUSIVE4_1 = 3 }; typedef enum createmode4 createmode4; struct creatverfattr { verifier4 cva_verf; fattr4 cva_attrs; }; typedef struct creatverfattr creatverfattr; struct createhow4 { createmode4 mode; union { fattr4 createattrs; verifier4 createverf; creatverfattr ch_createboth; } createhow4_u; }; typedef struct createhow4 createhow4; enum opentype4 { OPEN4_NOCREATE = 0, OPEN4_CREATE = 1 }; typedef enum opentype4 opentype4; struct openflag4 { opentype4 opentype; union { createhow4 how; } openflag4_u; }; typedef struct openflag4 openflag4; enum limit_by4 { NFS_LIMIT_SIZE = 1, NFS_LIMIT_BLOCKS = 2 }; typedef enum limit_by4 limit_by4; struct nfs_modified_limit4 { uint32_t num_blocks; uint32_t bytes_per_block; }; typedef struct nfs_modified_limit4 nfs_modified_limit4; struct nfs_space_limit4 { limit_by4 limitby; union { uint64_t filesize; nfs_modified_limit4 mod_blocks; } nfs_space_limit4_u; }; typedef struct nfs_space_limit4 nfs_space_limit4; #define OPEN4_SHARE_ACCESS_READ 0x00000001 #define OPEN4_SHARE_ACCESS_WRITE 0x00000002 #define OPEN4_SHARE_ACCESS_BOTH 0x00000003 #define OPEN4_SHARE_DENY_NONE 0x00000000 #define OPEN4_SHARE_DENY_READ 0x00000001 #define OPEN4_SHARE_DENY_WRITE 0x00000002 #define OPEN4_SHARE_DENY_BOTH 0x00000003 #define OPEN4_SHARE_ACCESS_WANT_DELEG_MASK 0xFF00 #define OPEN4_SHARE_ACCESS_WANT_NO_PREFERENCE 0x0000 #define OPEN4_SHARE_ACCESS_WANT_READ_DELEG 0x0100 #define OPEN4_SHARE_ACCESS_WANT_WRITE_DELEG 0x0200 #define OPEN4_SHARE_ACCESS_WANT_ANY_DELEG 0x0300 #define OPEN4_SHARE_ACCESS_WANT_NO_DELEG 0x0400 #define OPEN4_SHARE_ACCESS_WANT_CANCEL 0x0500 #define OPEN4_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000 #define OPEN4_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED 0x20000 enum open_delegation_type4 { OPEN_DELEGATE_NONE = 0, OPEN_DELEGATE_READ = 1, OPEN_DELEGATE_WRITE = 2, OPEN_DELEGATE_NONE_EXT = 3 }; typedef enum open_delegation_type4 open_delegation_type4; enum open_claim_type4 { CLAIM_NULL = 0, CLAIM_PREVIOUS = 1, CLAIM_DELEGATE_CUR = 2, CLAIM_DELEGATE_PREV = 3, CLAIM_FH = 4, CLAIM_DELEG_CUR_FH = 5, CLAIM_DELEG_PREV_FH = 6 }; typedef enum open_claim_type4 open_claim_type4; struct open_claim_delegate_cur4 { stateid4 delegate_stateid; component4 file; }; typedef struct open_claim_delegate_cur4 open_claim_delegate_cur4; struct open_claim4 { open_claim_type4 claim; union { component4 file; open_delegation_type4 delegate_type; open_claim_delegate_cur4 delegate_cur_info; component4 file_delegate_prev; stateid4 oc_delegate_stateid; } open_claim4_u; }; typedef struct open_claim4 open_claim4; struct OPEN4args { seqid4 seqid; uint32_t share_access; uint32_t share_deny; open_owner4 owner; openflag4 openhow; open_claim4 claim; }; typedef struct OPEN4args OPEN4args; struct open_read_delegation4 { stateid4 stateid; bool_t recall; nfsace4 permissions; }; typedef struct open_read_delegation4 open_read_delegation4; struct open_write_delegation4 { stateid4 stateid; bool_t recall; nfs_space_limit4 space_limit; nfsace4 permissions; }; typedef struct open_write_delegation4 open_write_delegation4; enum why_no_delegation4 { WND4_NOT_WANTED = 0, WND4_CONTENTION = 1, WND4_RESOURCE = 2, WND4_NOT_SUPP_FTYPE = 3, WND4_WRITE_DELEG_NOT_SUPP_FTYPE = 4, WND4_NOT_SUPP_UPGRADE = 5, WND4_NOT_SUPP_DOWNGRADE = 6, WND4_CANCELLED = 7, WND4_IS_DIR = 8 }; typedef enum why_no_delegation4 why_no_delegation4; struct open_none_delegation4 { why_no_delegation4 ond_why; union { bool_t ond_server_will_push_deleg; bool_t ond_server_will_signal_avail; } open_none_delegation4_u; }; typedef struct open_none_delegation4 open_none_delegation4; struct open_delegation4 { open_delegation_type4 delegation_type; union { open_read_delegation4 read; open_write_delegation4 write; open_none_delegation4 od_whynone; } open_delegation4_u; }; typedef struct open_delegation4 open_delegation4; #define OPEN4_RESULT_CONFIRM 0x00000002 #define OPEN4_RESULT_LOCKTYPE_POSIX 0x00000004 #define OPEN4_RESULT_PRESERVE_UNLINKED 0x00000008 #define OPEN4_RESULT_MAY_NOTIFY_LOCK 0x00000020 struct OPEN4resok { stateid4 stateid; change_info4 cinfo; uint32_t rflags; bitmap4 attrset; open_delegation4 delegation; }; typedef struct OPEN4resok OPEN4resok; struct OPEN4res { nfsstat4 status; union { OPEN4resok resok4; } OPEN4res_u; }; typedef struct OPEN4res OPEN4res; struct OPENATTR4args { bool_t createdir; }; typedef struct OPENATTR4args OPENATTR4args; struct OPENATTR4res { nfsstat4 status; }; typedef struct OPENATTR4res OPENATTR4res; struct OPEN_CONFIRM4args { stateid4 open_stateid; seqid4 seqid; }; typedef struct OPEN_CONFIRM4args OPEN_CONFIRM4args; struct OPEN_CONFIRM4resok { stateid4 open_stateid; }; typedef struct OPEN_CONFIRM4resok OPEN_CONFIRM4resok; struct OPEN_CONFIRM4res { nfsstat4 status; union { OPEN_CONFIRM4resok resok4; } OPEN_CONFIRM4res_u; }; typedef struct OPEN_CONFIRM4res OPEN_CONFIRM4res; struct OPEN_DOWNGRADE4args { stateid4 open_stateid; seqid4 seqid; uint32_t share_access; uint32_t share_deny; }; typedef struct OPEN_DOWNGRADE4args OPEN_DOWNGRADE4args; struct OPEN_DOWNGRADE4resok { stateid4 open_stateid; }; typedef struct OPEN_DOWNGRADE4resok OPEN_DOWNGRADE4resok; struct OPEN_DOWNGRADE4res { nfsstat4 status; union { OPEN_DOWNGRADE4resok resok4; } OPEN_DOWNGRADE4res_u; }; typedef struct OPEN_DOWNGRADE4res OPEN_DOWNGRADE4res; struct PUTFH4args { nfs_fh4 object; }; typedef struct PUTFH4args PUTFH4args; struct PUTFH4res { nfsstat4 status; }; typedef struct PUTFH4res PUTFH4res; struct PUTPUBFH4res { nfsstat4 status; }; typedef struct PUTPUBFH4res PUTPUBFH4res; struct PUTROOTFH4res { nfsstat4 status; }; typedef struct PUTROOTFH4res PUTROOTFH4res; struct READ4args { stateid4 stateid; offset4 offset; count4 count; }; typedef struct READ4args READ4args; struct READ4resok { bool_t eof; struct { u_int data_len; char *data_val; } data; }; typedef struct READ4resok READ4resok; struct READ4res { nfsstat4 status; union { READ4resok resok4; } READ4res_u; }; typedef struct READ4res READ4res; struct READDIR4args { nfs_cookie4 cookie; verifier4 cookieverf; count4 dircount; count4 maxcount; bitmap4 attr_request; }; typedef struct READDIR4args READDIR4args; struct entry4 { nfs_cookie4 cookie; component4 name; fattr4 attrs; struct entry4 *nextentry; }; typedef struct entry4 entry4; struct dirlist4 { entry4 *entries; bool_t eof; }; typedef struct dirlist4 dirlist4; struct READDIR4resok { verifier4 cookieverf; dirlist4 reply; }; typedef struct READDIR4resok READDIR4resok; struct READDIR4res { nfsstat4 status; union { READDIR4resok resok4; } READDIR4res_u; }; typedef struct READDIR4res READDIR4res; struct READLINK4resok { linktext4 link; }; typedef struct READLINK4resok READLINK4resok; struct READLINK4res { nfsstat4 status; union { READLINK4resok resok4; } READLINK4res_u; }; typedef struct READLINK4res READLINK4res; struct REMOVE4args { component4 target; }; typedef struct REMOVE4args REMOVE4args; struct REMOVE4resok { change_info4 cinfo; }; typedef struct REMOVE4resok REMOVE4resok; struct REMOVE4res { nfsstat4 status; union { REMOVE4resok resok4; } REMOVE4res_u; }; typedef struct REMOVE4res REMOVE4res; struct RENAME4args { component4 oldname; component4 newname; }; typedef struct RENAME4args RENAME4args; struct RENAME4resok { change_info4 source_cinfo; change_info4 target_cinfo; }; typedef struct RENAME4resok RENAME4resok; struct RENAME4res { nfsstat4 status; union { RENAME4resok resok4; } RENAME4res_u; }; typedef struct RENAME4res RENAME4res; struct RENEW4args { clientid4 clientid; }; typedef struct RENEW4args RENEW4args; struct RENEW4res { nfsstat4 status; }; typedef struct RENEW4res RENEW4res; struct RESTOREFH4res { nfsstat4 status; }; typedef struct RESTOREFH4res RESTOREFH4res; struct SAVEFH4res { nfsstat4 status; }; typedef struct SAVEFH4res SAVEFH4res; struct SECINFO4args { component4 name; }; typedef struct SECINFO4args SECINFO4args; enum rpc_gss_svc_t { RPC_GSS_SVC_NONE = 1, RPC_GSS_SVC_INTEGRITY = 2, RPC_GSS_SVC_PRIVACY = 3 }; typedef enum rpc_gss_svc_t rpc_gss_svc_t; struct rpcsec_gss_info { sec_oid4 oid; qop4 qop; rpc_gss_svc_t service; }; typedef struct rpcsec_gss_info rpcsec_gss_info; struct secinfo4 { uint32_t flavor; union { rpcsec_gss_info flavor_info; } secinfo4_u; }; typedef struct secinfo4 secinfo4; typedef struct { u_int SECINFO4resok_len; secinfo4 *SECINFO4resok_val; } SECINFO4resok; struct SECINFO4res { nfsstat4 status; union { SECINFO4resok resok4; } SECINFO4res_u; }; typedef struct SECINFO4res SECINFO4res; struct SETATTR4args { stateid4 stateid; fattr4 obj_attributes; }; typedef struct SETATTR4args SETATTR4args; struct SETATTR4res { nfsstat4 status; bitmap4 attrsset; }; typedef struct SETATTR4res SETATTR4res; struct SETCLIENTID4args { nfs_client_id4 client; cb_client4 callback; uint32_t callback_ident; }; typedef struct SETCLIENTID4args SETCLIENTID4args; struct SETCLIENTID4resok { clientid4 clientid; verifier4 setclientid_confirm; }; typedef struct SETCLIENTID4resok SETCLIENTID4resok; struct SETCLIENTID4res { nfsstat4 status; union { SETCLIENTID4resok resok4; clientaddr4 client_using; } SETCLIENTID4res_u; }; typedef struct SETCLIENTID4res SETCLIENTID4res; struct SETCLIENTID_CONFIRM4args { clientid4 clientid; verifier4 setclientid_confirm; }; typedef struct SETCLIENTID_CONFIRM4args SETCLIENTID_CONFIRM4args; struct SETCLIENTID_CONFIRM4res { nfsstat4 status; }; typedef struct SETCLIENTID_CONFIRM4res SETCLIENTID_CONFIRM4res; struct VERIFY4args { fattr4 obj_attributes; }; typedef struct VERIFY4args VERIFY4args; struct VERIFY4res { nfsstat4 status; }; typedef struct VERIFY4res VERIFY4res; struct WRITE4args { stateid4 stateid; offset4 offset; stable_how4 stable; struct { u_int data_len; char *data_val; } data; }; typedef struct WRITE4args WRITE4args; struct WRITE4resok { count4 count; stable_how4 committed; verifier4 writeverf; }; typedef struct WRITE4resok WRITE4resok; struct WRITE4res { nfsstat4 status; union { WRITE4resok resok4; } WRITE4res_u; }; typedef struct WRITE4res WRITE4res; struct RELEASE_LOCKOWNER4args { lock_owner4 lock_owner; }; typedef struct RELEASE_LOCKOWNER4args RELEASE_LOCKOWNER4args; struct RELEASE_LOCKOWNER4res { nfsstat4 status; }; typedef struct RELEASE_LOCKOWNER4res RELEASE_LOCKOWNER4res; struct ILLEGAL4res { nfsstat4 status; }; typedef struct ILLEGAL4res ILLEGAL4res; typedef struct { u_int gsshandle4_t_len; char *gsshandle4_t_val; } gsshandle4_t; struct gss_cb_handles4 { rpc_gss_svc_t gcbp_service; gsshandle4_t gcbp_handle_from_server; gsshandle4_t gcbp_handle_from_client; }; typedef struct gss_cb_handles4 gss_cb_handles4; struct callback_sec_parms4 { uint32_t cb_secflavor; union { authsys_parms cbsp_sys_cred; gss_cb_handles4 cbsp_gss_handles; } callback_sec_parms4_u; }; typedef struct callback_sec_parms4 callback_sec_parms4; struct BACKCHANNEL_CTL4args { uint32_t bca_cb_program; struct { u_int bca_sec_parms_len; callback_sec_parms4 *bca_sec_parms_val; } bca_sec_parms; }; typedef struct BACKCHANNEL_CTL4args BACKCHANNEL_CTL4args; struct BACKCHANNEL_CTL4res { nfsstat4 bcr_status; }; typedef struct BACKCHANNEL_CTL4res BACKCHANNEL_CTL4res; enum channel_dir_from_client4 { CDFC4_FORE = 0x1, CDFC4_BACK = 0x2, CDFC4_FORE_OR_BOTH = 0x3, CDFC4_BACK_OR_BOTH = 0x7 }; typedef enum channel_dir_from_client4 channel_dir_from_client4; struct BIND_CONN_TO_SESSION4args { sessionid4 bctsa_sessid; channel_dir_from_client4 bctsa_dir; bool_t bctsa_use_conn_in_rdma_mode; }; typedef struct BIND_CONN_TO_SESSION4args BIND_CONN_TO_SESSION4args; enum channel_dir_from_server4 { CDFS4_FORE = 0x1, CDFS4_BACK = 0x2, CDFS4_BOTH = 0x3 }; typedef enum channel_dir_from_server4 channel_dir_from_server4; struct BIND_CONN_TO_SESSION4resok { sessionid4 bctsr_sessid; channel_dir_from_server4 bctsr_dir; bool_t bctsr_use_conn_in_rdma_mode; }; typedef struct BIND_CONN_TO_SESSION4resok BIND_CONN_TO_SESSION4resok; struct BIND_CONN_TO_SESSION4res { nfsstat4 bctsr_status; union { BIND_CONN_TO_SESSION4resok bctsr_resok4; } BIND_CONN_TO_SESSION4res_u; }; typedef struct BIND_CONN_TO_SESSION4res BIND_CONN_TO_SESSION4res; #define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001 #define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002 #define EXCHGID4_FLAG_SUPP_FENCE_OPS 0x00000004 #define EXCHGID4_FLAG_BIND_PRINC_STATEID 0x00000100 #define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000 #define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000 #define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000 #define EXCHGID4_FLAG_MASK_PNFS 0x00070000 #define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000 #define EXCHGID4_FLAG_CONFIRMED_R 0x80000000 struct state_protect_ops4 { bitmap4 spo_must_enforce; bitmap4 spo_must_allow; }; typedef struct state_protect_ops4 state_protect_ops4; struct ssv_sp_parms4 { state_protect_ops4 ssp_ops; struct { u_int ssp_hash_algs_len; sec_oid4 *ssp_hash_algs_val; } ssp_hash_algs; struct { u_int ssp_encr_algs_len; sec_oid4 *ssp_encr_algs_val; } ssp_encr_algs; uint32_t ssp_window; uint32_t ssp_num_gss_handles; }; typedef struct ssv_sp_parms4 ssv_sp_parms4; enum state_protect_how4 { SP4_NONE = 0, SP4_MACH_CRED = 1, SP4_SSV = 2 }; typedef enum state_protect_how4 state_protect_how4; struct state_protect4_a { state_protect_how4 spa_how; union { state_protect_ops4 spa_mach_ops; ssv_sp_parms4 spa_ssv_parms; } state_protect4_a_u; }; typedef struct state_protect4_a state_protect4_a; struct EXCHANGE_ID4args { client_owner4 eia_clientowner; uint32_t eia_flags; state_protect4_a eia_state_protect; struct { u_int eia_client_impl_id_len; nfs_impl_id4 *eia_client_impl_id_val; } eia_client_impl_id; }; typedef struct EXCHANGE_ID4args EXCHANGE_ID4args; struct ssv_prot_info4 { state_protect_ops4 spi_ops; uint32_t spi_hash_alg; uint32_t spi_encr_alg; uint32_t spi_ssv_len; uint32_t spi_window; struct { u_int spi_handles_len; gsshandle4_t *spi_handles_val; } spi_handles; }; typedef struct ssv_prot_info4 ssv_prot_info4; struct state_protect4_r { state_protect_how4 spr_how; union { state_protect_ops4 spr_mach_ops; ssv_prot_info4 spr_ssv_info; } state_protect4_r_u; }; typedef struct state_protect4_r state_protect4_r; struct EXCHANGE_ID4resok { clientid4 eir_clientid; sequenceid4 eir_sequenceid; uint32_t eir_flags; state_protect4_r eir_state_protect; server_owner4 eir_server_owner; struct { u_int eir_server_scope_len; char *eir_server_scope_val; } eir_server_scope; struct { u_int eir_server_impl_id_len; nfs_impl_id4 *eir_server_impl_id_val; } eir_server_impl_id; }; typedef struct EXCHANGE_ID4resok EXCHANGE_ID4resok; struct EXCHANGE_ID4res { nfsstat4 eir_status; union { EXCHANGE_ID4resok eir_resok4; } EXCHANGE_ID4res_u; }; typedef struct EXCHANGE_ID4res EXCHANGE_ID4res; struct channel_attrs4 { count4 ca_headerpadsize; count4 ca_maxrequestsize; count4 ca_maxresponsesize; count4 ca_maxresponsesize_cached; count4 ca_maxoperations; count4 ca_maxrequests; struct { u_int ca_rdma_ird_len; uint32_t *ca_rdma_ird_val; } ca_rdma_ird; }; typedef struct channel_attrs4 channel_attrs4; #define CREATE_SESSION4_FLAG_PERSIST 0x00000001 #define CREATE_SESSION4_FLAG_CONN_BACK_CHAN 0x00000002 #define CREATE_SESSION4_FLAG_CONN_RDMA 0x00000004 struct CREATE_SESSION4args { clientid4 csa_clientid; sequenceid4 csa_sequence; uint32_t csa_flags; channel_attrs4 csa_fore_chan_attrs; channel_attrs4 csa_back_chan_attrs; uint32_t csa_cb_program; struct { u_int csa_sec_parms_len; callback_sec_parms4 *csa_sec_parms_val; } csa_sec_parms; }; typedef struct CREATE_SESSION4args CREATE_SESSION4args; struct CREATE_SESSION4resok { sessionid4 csr_sessionid; sequenceid4 csr_sequence; uint32_t csr_flags; channel_attrs4 csr_fore_chan_attrs; channel_attrs4 csr_back_chan_attrs; }; typedef struct CREATE_SESSION4resok CREATE_SESSION4resok; struct CREATE_SESSION4res { nfsstat4 csr_status; union { CREATE_SESSION4resok csr_resok4; } CREATE_SESSION4res_u; }; typedef struct CREATE_SESSION4res CREATE_SESSION4res; struct DESTROY_SESSION4args { sessionid4 dsa_sessionid; }; typedef struct DESTROY_SESSION4args DESTROY_SESSION4args; struct DESTROY_SESSION4res { nfsstat4 dsr_status; }; typedef struct DESTROY_SESSION4res DESTROY_SESSION4res; struct FREE_STATEID4args { stateid4 fsa_stateid; }; typedef struct FREE_STATEID4args FREE_STATEID4args; struct FREE_STATEID4res { nfsstat4 fsr_status; }; typedef struct FREE_STATEID4res FREE_STATEID4res; typedef nfstime4 attr_notice4; struct GET_DIR_DELEGATION4args { bool_t gdda_signal_deleg_avail; bitmap4 gdda_notification_types; attr_notice4 gdda_child_attr_delay; attr_notice4 gdda_dir_attr_delay; bitmap4 gdda_child_attributes; bitmap4 gdda_dir_attributes; }; typedef struct GET_DIR_DELEGATION4args GET_DIR_DELEGATION4args; struct GET_DIR_DELEGATION4resok { verifier4 gddr_cookieverf; stateid4 gddr_stateid; bitmap4 gddr_notification; bitmap4 gddr_child_attributes; bitmap4 gddr_dir_attributes; }; typedef struct GET_DIR_DELEGATION4resok GET_DIR_DELEGATION4resok; enum gddrnf4_status { GDD4_OK = 0, GDD4_UNAVAIL = 1 }; typedef enum gddrnf4_status gddrnf4_status; struct GET_DIR_DELEGATION4res_non_fatal { gddrnf4_status gddrnf_status; union { GET_DIR_DELEGATION4resok gddrnf_resok4; bool_t gddrnf_will_signal_deleg_avail; } GET_DIR_DELEGATION4res_non_fatal_u; }; typedef struct GET_DIR_DELEGATION4res_non_fatal GET_DIR_DELEGATION4res_non_fatal; struct GET_DIR_DELEGATION4res { nfsstat4 gddr_status; union { GET_DIR_DELEGATION4res_non_fatal gddr_res_non_fatal4; } GET_DIR_DELEGATION4res_u; }; typedef struct GET_DIR_DELEGATION4res GET_DIR_DELEGATION4res; struct GETDEVICEINFO4args { deviceid4 gdia_device_id; layouttype4 gdia_layout_type; count4 gdia_maxcount; bitmap4 gdia_notify_types; }; typedef struct GETDEVICEINFO4args GETDEVICEINFO4args; struct GETDEVICEINFO4resok { device_addr4 gdir_device_addr; bitmap4 gdir_notification; }; typedef struct GETDEVICEINFO4resok GETDEVICEINFO4resok; struct GETDEVICEINFO4res { nfsstat4 gdir_status; union { GETDEVICEINFO4resok gdir_resok4; count4 gdir_mincount; } GETDEVICEINFO4res_u; }; typedef struct GETDEVICEINFO4res GETDEVICEINFO4res; struct GETDEVICELIST4args { layouttype4 gdla_layout_type; count4 gdla_maxdevices; nfs_cookie4 gdla_cookie; verifier4 gdla_cookieverf; }; typedef struct GETDEVICELIST4args GETDEVICELIST4args; struct GETDEVICELIST4resok { nfs_cookie4 gdlr_cookie; verifier4 gdlr_cookieverf; struct { u_int gdlr_deviceid_list_len; deviceid4 *gdlr_deviceid_list_val; } gdlr_deviceid_list; bool_t gdlr_eof; }; typedef struct GETDEVICELIST4resok GETDEVICELIST4resok; struct GETDEVICELIST4res { nfsstat4 gdlr_status; union { GETDEVICELIST4resok gdlr_resok4; } GETDEVICELIST4res_u; }; typedef struct GETDEVICELIST4res GETDEVICELIST4res; struct newtime4 { bool_t nt_timechanged; union { nfstime4 nt_time; } newtime4_u; }; typedef struct newtime4 newtime4; struct newoffset4 { bool_t no_newoffset; union { offset4 no_offset; } newoffset4_u; }; typedef struct newoffset4 newoffset4; struct LAYOUTCOMMIT4args { offset4 loca_offset; length4 loca_length; bool_t loca_reclaim; stateid4 loca_stateid; newoffset4 loca_last_write_offset; newtime4 loca_time_modify; layoutupdate4 loca_layoutupdate; }; typedef struct LAYOUTCOMMIT4args LAYOUTCOMMIT4args; struct newsize4 { bool_t ns_sizechanged; union { length4 ns_size; } newsize4_u; }; typedef struct newsize4 newsize4; struct LAYOUTCOMMIT4resok { newsize4 locr_newsize; }; typedef struct LAYOUTCOMMIT4resok LAYOUTCOMMIT4resok; struct LAYOUTCOMMIT4res { nfsstat4 locr_status; union { LAYOUTCOMMIT4resok locr_resok4; } LAYOUTCOMMIT4res_u; }; typedef struct LAYOUTCOMMIT4res LAYOUTCOMMIT4res; struct LAYOUTGET4args { bool_t loga_signal_layout_avail; layouttype4 loga_layout_type; layoutiomode4 loga_iomode; offset4 loga_offset; length4 loga_length; length4 loga_minlength; stateid4 loga_stateid; count4 loga_maxcount; }; typedef struct LAYOUTGET4args LAYOUTGET4args; struct LAYOUTGET4resok { bool_t logr_return_on_close; stateid4 logr_stateid; struct { u_int logr_layout_len; layout4 *logr_layout_val; } logr_layout; }; typedef struct LAYOUTGET4resok LAYOUTGET4resok; struct LAYOUTGET4res { nfsstat4 logr_status; union { LAYOUTGET4resok logr_resok4; bool_t logr_will_signal_layout_avail; } LAYOUTGET4res_u; }; typedef struct LAYOUTGET4res LAYOUTGET4res; struct LAYOUTRETURN4args { bool_t lora_reclaim; layouttype4 lora_layout_type; layoutiomode4 lora_iomode; layoutreturn4 lora_layoutreturn; }; typedef struct LAYOUTRETURN4args LAYOUTRETURN4args; struct layoutreturn_stateid { bool_t lrs_present; union { stateid4 lrs_stateid; } layoutreturn_stateid_u; }; typedef struct layoutreturn_stateid layoutreturn_stateid; struct LAYOUTRETURN4res { nfsstat4 lorr_status; union { layoutreturn_stateid lorr_stateid; } LAYOUTRETURN4res_u; }; typedef struct LAYOUTRETURN4res LAYOUTRETURN4res; enum secinfo_style4 { SECINFO_STYLE4_CURRENT_FH = 0, SECINFO_STYLE4_PARENT = 1 }; typedef enum secinfo_style4 secinfo_style4; typedef secinfo_style4 SECINFO_NO_NAME4args; typedef SECINFO4res SECINFO_NO_NAME4res; struct SEQUENCE4args { sessionid4 sa_sessionid; sequenceid4 sa_sequenceid; slotid4 sa_slotid; slotid4 sa_highest_slotid; bool_t sa_cachethis; }; typedef struct SEQUENCE4args SEQUENCE4args; #define SEQ4_STATUS_CB_PATH_DOWN 0x00000001 #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002 #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004 #define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008 #define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010 #define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020 #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040 #define SEQ4_STATUS_LEASE_MOVED 0x00000080 #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 #define SEQ4_STATUS_CB_PATH_DOWN_SESSION 0x00000200 #define SEQ4_STATUS_BACKCHANNEL_FAULT 0x00000400 #define SEQ4_STATUS_DEVID_CHANGED 0x00000800 #define SEQ4_STATUS_DEVID_DELETED 0x00001000 struct SEQUENCE4resok { sessionid4 sr_sessionid; sequenceid4 sr_sequenceid; slotid4 sr_slotid; slotid4 sr_highest_slotid; slotid4 sr_target_highest_slotid; uint32_t sr_status_flags; }; typedef struct SEQUENCE4resok SEQUENCE4resok; struct SEQUENCE4res { nfsstat4 sr_status; union { SEQUENCE4resok sr_resok4; } SEQUENCE4res_u; }; typedef struct SEQUENCE4res SEQUENCE4res; struct ssa_digest_input4 { SEQUENCE4args sdi_seqargs; }; typedef struct ssa_digest_input4 ssa_digest_input4; struct SET_SSV4args { struct { u_int ssa_ssv_len; char *ssa_ssv_val; } ssa_ssv; struct { u_int ssa_digest_len; char *ssa_digest_val; } ssa_digest; }; typedef struct SET_SSV4args SET_SSV4args; struct ssr_digest_input4 { SEQUENCE4res sdi_seqres; }; typedef struct ssr_digest_input4 ssr_digest_input4; struct SET_SSV4resok { struct { u_int ssr_digest_len; char *ssr_digest_val; } ssr_digest; }; typedef struct SET_SSV4resok SET_SSV4resok; struct SET_SSV4res { nfsstat4 ssr_status; union { SET_SSV4resok ssr_resok4; } SET_SSV4res_u; }; typedef struct SET_SSV4res SET_SSV4res; struct TEST_STATEID4args { struct { u_int ts_stateids_len; stateid4 *ts_stateids_val; } ts_stateids; }; typedef struct TEST_STATEID4args TEST_STATEID4args; struct TEST_STATEID4resok { struct { u_int tsr_status_codes_len; nfsstat4 *tsr_status_codes_val; } tsr_status_codes; }; typedef struct TEST_STATEID4resok TEST_STATEID4resok; struct TEST_STATEID4res { nfsstat4 tsr_status; union { TEST_STATEID4resok tsr_resok4; } TEST_STATEID4res_u; }; typedef struct TEST_STATEID4res TEST_STATEID4res; struct deleg_claim4 { open_claim_type4 dc_claim; union { open_delegation_type4 dc_delegate_type; } deleg_claim4_u; }; typedef struct deleg_claim4 deleg_claim4; struct WANT_DELEGATION4args { uint32_t wda_want; deleg_claim4 wda_claim; }; typedef struct WANT_DELEGATION4args WANT_DELEGATION4args; struct WANT_DELEGATION4res { nfsstat4 wdr_status; union { open_delegation4 wdr_resok4; } WANT_DELEGATION4res_u; }; typedef struct WANT_DELEGATION4res WANT_DELEGATION4res; struct DESTROY_CLIENTID4args { clientid4 dca_clientid; }; typedef struct DESTROY_CLIENTID4args DESTROY_CLIENTID4args; struct DESTROY_CLIENTID4res { nfsstat4 dcr_status; }; typedef struct DESTROY_CLIENTID4res DESTROY_CLIENTID4res; struct RECLAIM_COMPLETE4args { bool_t rca_one_fs; }; typedef struct RECLAIM_COMPLETE4args RECLAIM_COMPLETE4args; struct RECLAIM_COMPLETE4res { nfsstat4 rcr_status; }; typedef struct RECLAIM_COMPLETE4res RECLAIM_COMPLETE4res; struct COPY4args { stateid4 ca_src_stateid; stateid4 ca_dst_stateid; offset4 ca_src_offset; offset4 ca_dst_offset; length4 ca_count; bool_t ca_consecutive; bool_t ca_synchronous; struct { u_int ca_source_server_len; netloc4 *ca_source_server_val; } ca_source_server; }; typedef struct COPY4args COPY4args; struct copy_requirements4 { bool_t cr_consecutive; bool_t cr_synchronous; }; typedef struct copy_requirements4 copy_requirements4; struct COPY4resok { write_response4 cr_response; copy_requirements4 cr_requirements; }; typedef struct COPY4resok COPY4resok; struct COPY4res { nfsstat4 cr_status; union { COPY4resok cr_resok4; copy_requirements4 cr_requirements; } COPY4res_u; }; typedef struct COPY4res COPY4res; struct COPY_NOTIFY4args { stateid4 cna_src_stateid; netloc4 cna_destination_server; }; typedef struct COPY_NOTIFY4args COPY_NOTIFY4args; struct COPY_NOTIFY4resok { nfstime4 cnr_lease_time; stateid4 cnr_stateid; struct { u_int cnr_source_server_len; netloc4 *cnr_source_server_val; } cnr_source_server; }; typedef struct COPY_NOTIFY4resok COPY_NOTIFY4resok; struct COPY_NOTIFY4res { nfsstat4 cnr_status; union { COPY_NOTIFY4resok resok4; } COPY_NOTIFY4res_u; }; typedef struct COPY_NOTIFY4res COPY_NOTIFY4res; struct OFFLOAD_CANCEL4args { stateid4 oca_stateid; }; typedef struct OFFLOAD_CANCEL4args OFFLOAD_CANCEL4args; struct OFFLOAD_CANCEL4res { nfsstat4 ocr_status; }; typedef struct OFFLOAD_CANCEL4res OFFLOAD_CANCEL4res; struct OFFLOAD_STATUS4args { stateid4 osa_stateid; }; typedef struct OFFLOAD_STATUS4args OFFLOAD_STATUS4args; struct OFFLOAD_STATUS4resok { length4 osr_count; struct { u_int osr_complete_len; nfsstat4 *osr_complete_val; } osr_complete; }; typedef struct OFFLOAD_STATUS4resok OFFLOAD_STATUS4resok; struct OFFLOAD_STATUS4res { nfsstat4 osr_status; union { OFFLOAD_STATUS4resok osr_resok4; } OFFLOAD_STATUS4res_u; }; typedef struct OFFLOAD_STATUS4res OFFLOAD_STATUS4res; struct ALLOCATE4args { stateid4 aa_stateid; offset4 aa_offset; length4 aa_length; }; typedef struct ALLOCATE4args ALLOCATE4args; struct ALLOCATE4res { nfsstat4 ar_status; }; typedef struct ALLOCATE4res ALLOCATE4res; struct DEALLOCATE4args { stateid4 da_stateid; offset4 da_offset; length4 da_length; }; typedef struct DEALLOCATE4args DEALLOCATE4args; struct DEALLOCATE4res { nfsstat4 dr_status; }; typedef struct DEALLOCATE4res DEALLOCATE4res; enum IO_ADVISE_type4 { IO_ADVISE4_NORMAL = 0, IO_ADVISE4_SEQUENTIAL = 1, IO_ADVISE4_SEQUENTIAL_BACKWARDS = 2, IO_ADVISE4_RANDOM = 3, IO_ADVISE4_WILLNEED = 4, IO_ADVISE4_WILLNEED_OPPORTUNISTIC = 5, IO_ADVISE4_DONTNEED = 6, IO_ADVISE4_NOREUSE = 7, IO_ADVISE4_READ = 8, IO_ADVISE4_WRITE = 9, IO_ADVISE4_INIT_PROXIMITY = 10 }; typedef enum IO_ADVISE_type4 IO_ADVISE_type4; struct IO_ADVISE4args { stateid4 iaa_stateid; offset4 iaa_offset; length4 iaa_count; bitmap4 iaa_hints; }; typedef struct IO_ADVISE4args IO_ADVISE4args; struct IO_ADVISE4resok { bitmap4 ior_hints; }; typedef struct IO_ADVISE4resok IO_ADVISE4resok; struct IO_ADVISE4res { nfsstat4 ior_status; union { IO_ADVISE4resok resok4; } IO_ADVISE4res_u; }; typedef struct IO_ADVISE4res IO_ADVISE4res; struct device_error4 { deviceid4 de_deviceid; nfsstat4 de_status; nfs_opnum4 de_opnum; }; typedef struct device_error4 device_error4; struct LAYOUTERROR4args { offset4 lea_offset; length4 lea_length; stateid4 lea_stateid; struct { u_int lea_errors_len; device_error4 *lea_errors_val; } lea_errors; }; typedef struct LAYOUTERROR4args LAYOUTERROR4args; struct LAYOUTERROR4res { nfsstat4 ler_status; }; typedef struct LAYOUTERROR4res LAYOUTERROR4res; struct io_info4 { uint64_t ii_count; uint64_t ii_bytes; }; typedef struct io_info4 io_info4; struct LAYOUTSTATS4args { offset4 lsa_offset; length4 lsa_length; stateid4 lsa_stateid; io_info4 lsa_read; io_info4 lsa_write; deviceid4 lsa_deviceid; layoutupdate4 lsa_layoutupdate; }; typedef struct LAYOUTSTATS4args LAYOUTSTATS4args; struct LAYOUTSTATS4res { nfsstat4 lsr_status; }; typedef struct LAYOUTSTATS4res LAYOUTSTATS4res; struct READ_PLUS4args { stateid4 rpa_stateid; offset4 rpa_offset; count4 rpa_count; }; typedef struct READ_PLUS4args READ_PLUS4args; struct read_plus_content { data_content4 rpc_content; union { data4 rpc_data; data_info4 rpc_hole; } read_plus_content_u; }; typedef struct read_plus_content read_plus_content; struct read_plus_res4 { bool_t rpr_eof; struct { u_int rpr_contents_len; read_plus_content *rpr_contents_val; } rpr_contents; }; typedef struct read_plus_res4 read_plus_res4; struct READ_PLUS4res { nfsstat4 rp_status; union { read_plus_res4 rp_resok4; } READ_PLUS4res_u; }; typedef struct READ_PLUS4res READ_PLUS4res; struct SEEK4args { stateid4 sa_stateid; offset4 sa_offset; data_content4 sa_what; }; typedef struct SEEK4args SEEK4args; struct seek_res4 { bool_t sr_eof; offset4 sr_offset; }; typedef struct seek_res4 seek_res4; struct SEEK4res { nfsstat4 sa_status; union { seek_res4 resok4; } SEEK4res_u; }; typedef struct SEEK4res SEEK4res; struct WRITE_SAME4args { stateid4 wsa_stateid; stable_how4 wsa_stable; app_data_block4 wsa_adb; }; typedef struct WRITE_SAME4args WRITE_SAME4args; struct WRITE_SAME4res { nfsstat4 wsr_status; union { write_response4 resok4; } WRITE_SAME4res_u; }; typedef struct WRITE_SAME4res WRITE_SAME4res; struct nfs_argop4 { nfs_opnum4 argop; union { ACCESS4args opaccess; CLOSE4args opclose; COMMIT4args opcommit; CREATE4args opcreate; DELEGPURGE4args opdelegpurge; DELEGRETURN4args opdelegreturn; GETATTR4args opgetattr; LINK4args oplink; LOCK4args oplock; LOCKT4args oplockt; LOCKU4args oplocku; LOOKUP4args oplookup; NVERIFY4args opnverify; OPEN4args opopen; OPENATTR4args opopenattr; OPEN_CONFIRM4args opopen_confirm; OPEN_DOWNGRADE4args opopen_downgrade; PUTFH4args opputfh; READ4args opread; READDIR4args opreaddir; REMOVE4args opremove; RENAME4args oprename; RENEW4args oprenew; SECINFO4args opsecinfo; SETATTR4args opsetattr; SETCLIENTID4args opsetclientid; SETCLIENTID_CONFIRM4args opsetclientid_confirm; VERIFY4args opverify; WRITE4args opwrite; RELEASE_LOCKOWNER4args oprelease_lockowner; BACKCHANNEL_CTL4args opbackchannel_ctl; BIND_CONN_TO_SESSION4args opbind_conn_to_session; EXCHANGE_ID4args opexchange_id; CREATE_SESSION4args opcreate_session; DESTROY_SESSION4args opdestroy_session; FREE_STATEID4args opfree_stateid; GET_DIR_DELEGATION4args opget_dir_delegation; GETDEVICEINFO4args opgetdeviceinfo; GETDEVICELIST4args opgetdevicelist; LAYOUTCOMMIT4args oplayoutcommit; LAYOUTGET4args oplayoutget; LAYOUTRETURN4args oplayoutreturn; SECINFO_NO_NAME4args opsecinfo_no_name; SEQUENCE4args opsequence; SET_SSV4args opset_ssv; TEST_STATEID4args optest_stateid; WANT_DELEGATION4args opwant_delegation; DESTROY_CLIENTID4args opdestroy_clientid; RECLAIM_COMPLETE4args opreclaim_complete; ALLOCATE4args opallocate; COPY4args opcopy; COPY_NOTIFY4args opoffload_notify; DEALLOCATE4args opdeallocate; IO_ADVISE4args opio_advise; LAYOUTERROR4args oplayouterror; LAYOUTSTATS4args oplayoutstats; OFFLOAD_CANCEL4args opoffload_cancel; OFFLOAD_STATUS4args opoffload_status; READ_PLUS4args opread_plus; SEEK4args opseek; WRITE_SAME4args opwrite_same; CLONE4args opclone; } nfs_argop4_u; }; typedef struct nfs_argop4 nfs_argop4; struct nfs_resop4 { nfs_opnum4 resop; union { ACCESS4res opaccess; CLOSE4res opclose; COMMIT4res opcommit; CREATE4res opcreate; DELEGPURGE4res opdelegpurge; DELEGRETURN4res opdelegreturn; GETATTR4res opgetattr; GETFH4res opgetfh; LINK4res oplink; LOCK4res oplock; LOCKT4res oplockt; LOCKU4res oplocku; LOOKUP4res oplookup; LOOKUPP4res oplookupp; NVERIFY4res opnverify; OPEN4res opopen; OPENATTR4res opopenattr; OPEN_CONFIRM4res opopen_confirm; OPEN_DOWNGRADE4res opopen_downgrade; PUTFH4res opputfh; PUTPUBFH4res opputpubfh; PUTROOTFH4res opputrootfh; READ4res opread; READDIR4res opreaddir; READLINK4res opreadlink; REMOVE4res opremove; RENAME4res oprename; RENEW4res oprenew; RESTOREFH4res oprestorefh; SAVEFH4res opsavefh; SECINFO4res opsecinfo; SETATTR4res opsetattr; SETCLIENTID4res opsetclientid; SETCLIENTID_CONFIRM4res opsetclientid_confirm; VERIFY4res opverify; WRITE4res opwrite; RELEASE_LOCKOWNER4res oprelease_lockowner; BACKCHANNEL_CTL4res opbackchannel_ctl; BIND_CONN_TO_SESSION4res opbind_conn_to_session; EXCHANGE_ID4res opexchange_id; CREATE_SESSION4res opcreate_session; DESTROY_SESSION4res opdestroy_session; FREE_STATEID4res opfree_stateid; GET_DIR_DELEGATION4res opget_dir_delegation; GETDEVICEINFO4res opgetdeviceinfo; GETDEVICELIST4res opgetdevicelist; LAYOUTCOMMIT4res oplayoutcommit; LAYOUTGET4res oplayoutget; LAYOUTRETURN4res oplayoutreturn; SECINFO_NO_NAME4res opsecinfo_no_name; SEQUENCE4res opsequence; SET_SSV4res opset_ssv; TEST_STATEID4res optest_stateid; WANT_DELEGATION4res opwant_delegation; DESTROY_CLIENTID4res opdestroy_clientid; RECLAIM_COMPLETE4res opreclaim_complete; ALLOCATE4res opallocate; COPY4res opcopy; COPY_NOTIFY4res opcopy_notify; DEALLOCATE4res opdeallocate; IO_ADVISE4res opio_advise; LAYOUTERROR4res oplayouterror; LAYOUTSTATS4res oplayoutstats; OFFLOAD_CANCEL4res opoffload_cancel; OFFLOAD_STATUS4res opoffload_status; READ_PLUS4res opread_plus; SEEK4res opseek; WRITE_SAME4res opwrite_same; CLONE4res opclone; ILLEGAL4res opillegal; } nfs_resop4_u; }; typedef struct nfs_resop4 nfs_resop4; struct COMPOUND4args { utf8str_cs tag; uint32_t minorversion; struct { u_int argarray_len; nfs_argop4 *argarray_val; } argarray; }; typedef struct COMPOUND4args COMPOUND4args; struct COMPOUND4res { nfsstat4 status; utf8str_cs tag; struct { u_int resarray_len; nfs_resop4 *resarray_val; } resarray; }; typedef struct COMPOUND4res COMPOUND4res; struct CB_GETATTR4args { nfs_fh4 fh; bitmap4 attr_request; }; typedef struct CB_GETATTR4args CB_GETATTR4args; struct CB_GETATTR4resok { fattr4 obj_attributes; }; typedef struct CB_GETATTR4resok CB_GETATTR4resok; struct CB_GETATTR4res { nfsstat4 status; union { CB_GETATTR4resok resok4; } CB_GETATTR4res_u; }; typedef struct CB_GETATTR4res CB_GETATTR4res; struct CB_RECALL4args { stateid4 stateid; bool_t truncate; nfs_fh4 fh; }; typedef struct CB_RECALL4args CB_RECALL4args; struct CB_RECALL4res { nfsstat4 status; }; typedef struct CB_RECALL4res CB_RECALL4res; struct CB_ILLEGAL4res { nfsstat4 status; }; typedef struct CB_ILLEGAL4res CB_ILLEGAL4res; enum layoutrecall_type4 { LAYOUTRECALL4_FILE = LAYOUT4_RET_REC_FILE, LAYOUTRECALL4_FSID = LAYOUT4_RET_REC_FSID, LAYOUTRECALL4_ALL = LAYOUT4_RET_REC_ALL }; typedef enum layoutrecall_type4 layoutrecall_type4; struct layoutrecall_file4 { nfs_fh4 lor_fh; offset4 lor_offset; length4 lor_length; stateid4 lor_stateid; }; typedef struct layoutrecall_file4 layoutrecall_file4; struct layoutrecall4 { layoutrecall_type4 lor_recalltype; union { layoutrecall_file4 lor_layout; fsid4 lor_fsid; } layoutrecall4_u; }; typedef struct layoutrecall4 layoutrecall4; struct CB_LAYOUTRECALL4args { layouttype4 clora_type; layoutiomode4 clora_iomode; bool_t clora_changed; layoutrecall4 clora_recall; }; typedef struct CB_LAYOUTRECALL4args CB_LAYOUTRECALL4args; struct CB_LAYOUTRECALL4res { nfsstat4 clorr_status; }; typedef struct CB_LAYOUTRECALL4res CB_LAYOUTRECALL4res; enum notify_type4 { NOTIFY4_CHANGE_CHILD_ATTRS = 0, NOTIFY4_CHANGE_DIR_ATTRS = 1, NOTIFY4_REMOVE_ENTRY = 2, NOTIFY4_ADD_ENTRY = 3, NOTIFY4_RENAME_ENTRY = 4, NOTIFY4_CHANGE_COOKIE_VERIFIER = 5 }; typedef enum notify_type4 notify_type4; struct notify_entry4 { component4 ne_file; fattr4 ne_attrs; }; typedef struct notify_entry4 notify_entry4; struct prev_entry4 { notify_entry4 pe_prev_entry; nfs_cookie4 pe_prev_entry_cookie; }; typedef struct prev_entry4 prev_entry4; struct notify_remove4 { notify_entry4 nrm_old_entry; nfs_cookie4 nrm_old_entry_cookie; }; typedef struct notify_remove4 notify_remove4; struct notify_add4 { struct { u_int nad_old_entry_len; notify_remove4 *nad_old_entry_val; } nad_old_entry; notify_entry4 nad_new_entry; struct { u_int nad_new_entry_cookie_len; nfs_cookie4 *nad_new_entry_cookie_val; } nad_new_entry_cookie; struct { u_int nad_prev_entry_len; prev_entry4 *nad_prev_entry_val; } nad_prev_entry; bool_t nad_last_entry; }; typedef struct notify_add4 notify_add4; struct notify_attr4 { notify_entry4 na_changed_entry; }; typedef struct notify_attr4 notify_attr4; struct notify_rename4 { notify_remove4 nrn_old_entry; notify_add4 nrn_new_entry; }; typedef struct notify_rename4 notify_rename4; struct notify_verifier4 { verifier4 nv_old_cookieverf; verifier4 nv_new_cookieverf; }; typedef struct notify_verifier4 notify_verifier4; typedef struct { u_int notifylist4_len; char *notifylist4_val; } notifylist4; struct notify4 { bitmap4 notify_mask; notifylist4 notify_vals; }; typedef struct notify4 notify4; struct CB_NOTIFY4args { stateid4 cna_stateid; nfs_fh4 cna_fh; struct { u_int cna_changes_len; notify4 *cna_changes_val; } cna_changes; }; typedef struct CB_NOTIFY4args CB_NOTIFY4args; struct CB_NOTIFY4res { nfsstat4 cnr_status; }; typedef struct CB_NOTIFY4res CB_NOTIFY4res; struct CB_PUSH_DELEG4args { nfs_fh4 cpda_fh; open_delegation4 cpda_delegation; }; typedef struct CB_PUSH_DELEG4args CB_PUSH_DELEG4args; struct CB_PUSH_DELEG4res { nfsstat4 cpdr_status; }; typedef struct CB_PUSH_DELEG4res CB_PUSH_DELEG4res; #define RCA4_TYPE_MASK_RDATA_DLG 0 #define RCA4_TYPE_MASK_WDATA_DLG 1 #define RCA4_TYPE_MASK_DIR_DLG 2 #define RCA4_TYPE_MASK_FILE_LAYOUT 3 #define RCA4_TYPE_MASK_BLK_LAYOUT 4 #define RCA4_TYPE_MASK_OBJ_LAYOUT_MIN 8 #define RCA4_TYPE_MASK_OBJ_LAYOUT_MAX 9 #define RCA4_TYPE_MASK_OTHER_LAYOUT_MIN 12 #define RCA4_TYPE_MASK_OTHER_LAYOUT_MAX 15 struct CB_RECALL_ANY4args { uint32_t craa_objects_to_keep; bitmap4 craa_type_mask; }; typedef struct CB_RECALL_ANY4args CB_RECALL_ANY4args; struct CB_RECALL_ANY4res { nfsstat4 crar_status; }; typedef struct CB_RECALL_ANY4res CB_RECALL_ANY4res; typedef CB_RECALL_ANY4args CB_RECALLABLE_OBJ_AVAIL4args; struct CB_RECALLABLE_OBJ_AVAIL4res { nfsstat4 croa_status; }; typedef struct CB_RECALLABLE_OBJ_AVAIL4res CB_RECALLABLE_OBJ_AVAIL4res; struct CB_RECALL_SLOT4args { slotid4 rsa_target_highest_slotid; }; typedef struct CB_RECALL_SLOT4args CB_RECALL_SLOT4args; struct CB_RECALL_SLOT4res { nfsstat4 rsr_status; }; typedef struct CB_RECALL_SLOT4res CB_RECALL_SLOT4res; struct referring_call4 { sequenceid4 rc_sequenceid; slotid4 rc_slotid; }; typedef struct referring_call4 referring_call4; struct referring_call_list4 { sessionid4 rcl_sessionid; struct { u_int rcl_referring_calls_len; referring_call4 *rcl_referring_calls_val; } rcl_referring_calls; }; typedef struct referring_call_list4 referring_call_list4; struct CB_SEQUENCE4args { sessionid4 csa_sessionid; sequenceid4 csa_sequenceid; slotid4 csa_slotid; slotid4 csa_highest_slotid; bool_t csa_cachethis; struct { u_int csa_referring_call_lists_len; referring_call_list4 *csa_referring_call_lists_val; } csa_referring_call_lists; }; typedef struct CB_SEQUENCE4args CB_SEQUENCE4args; struct CB_SEQUENCE4resok { sessionid4 csr_sessionid; sequenceid4 csr_sequenceid; slotid4 csr_slotid; slotid4 csr_highest_slotid; slotid4 csr_target_highest_slotid; }; typedef struct CB_SEQUENCE4resok CB_SEQUENCE4resok; struct CB_SEQUENCE4res { nfsstat4 csr_status; union { CB_SEQUENCE4resok csr_resok4; } CB_SEQUENCE4res_u; }; typedef struct CB_SEQUENCE4res CB_SEQUENCE4res; struct CB_WANTS_CANCELLED4args { bool_t cwca_contended_wants_cancelled; bool_t cwca_resourced_wants_cancelled; }; typedef struct CB_WANTS_CANCELLED4args CB_WANTS_CANCELLED4args; struct CB_WANTS_CANCELLED4res { nfsstat4 cwcr_status; }; typedef struct CB_WANTS_CANCELLED4res CB_WANTS_CANCELLED4res; struct CB_NOTIFY_LOCK4args { nfs_fh4 cnla_fh; lock_owner4 cnla_lock_owner; }; typedef struct CB_NOTIFY_LOCK4args CB_NOTIFY_LOCK4args; struct CB_NOTIFY_LOCK4res { nfsstat4 cnlr_status; }; typedef struct CB_NOTIFY_LOCK4res CB_NOTIFY_LOCK4res; enum notify_deviceid_type4 { NOTIFY_DEVICEID4_CHANGE = 1, NOTIFY_DEVICEID4_DELETE = 2 }; typedef enum notify_deviceid_type4 notify_deviceid_type4; struct notify_deviceid_delete4 { layouttype4 ndd_layouttype; deviceid4 ndd_deviceid; }; typedef struct notify_deviceid_delete4 notify_deviceid_delete4; struct notify_deviceid_change4 { layouttype4 ndc_layouttype; deviceid4 ndc_deviceid; bool_t ndc_immediate; }; typedef struct notify_deviceid_change4 notify_deviceid_change4; struct CB_NOTIFY_DEVICEID4args { struct { u_int cnda_changes_len; notify4 *cnda_changes_val; } cnda_changes; }; typedef struct CB_NOTIFY_DEVICEID4args CB_NOTIFY_DEVICEID4args; struct CB_NOTIFY_DEVICEID4res { nfsstat4 cndr_status; }; typedef struct CB_NOTIFY_DEVICEID4res CB_NOTIFY_DEVICEID4res; struct offload_info4 { nfsstat4 coa_status; union { write_response4 coa_resok4; length4 coa_bytes_copied; } offload_info4_u; }; typedef struct offload_info4 offload_info4; struct CB_OFFLOAD4args { nfs_fh4 coa_fh; stateid4 coa_stateid; offload_info4 coa_offload_info; }; typedef struct CB_OFFLOAD4args CB_OFFLOAD4args; struct CB_OFFLOAD4res { nfsstat4 cor_status; }; typedef struct CB_OFFLOAD4res CB_OFFLOAD4res; /* Callback operations new to NFSv4.1 */ /* Callback operations new to NFSv4.2 */ enum nfs_cb_opnum4 { OP_CB_GETATTR = 3, OP_CB_RECALL = 4, OP_CB_LAYOUTRECALL = 5, OP_CB_NOTIFY = 6, OP_CB_PUSH_DELEG = 7, OP_CB_RECALL_ANY = 8, OP_CB_RECALLABLE_OBJ_AVAIL = 9, OP_CB_RECALL_SLOT = 10, OP_CB_SEQUENCE = 11, OP_CB_WANTS_CANCELLED = 12, OP_CB_NOTIFY_LOCK = 13, OP_CB_NOTIFY_DEVICEID = 14, OP_CB_OFFLOAD = 15, OP_CB_ILLEGAL = 10044 }; typedef enum nfs_cb_opnum4 nfs_cb_opnum4; struct nfs_cb_argop4 { nfs_cb_opnum4 argop; union { CB_GETATTR4args opcbgetattr; CB_RECALL4args opcbrecall; CB_LAYOUTRECALL4args opcblayoutrecall; CB_NOTIFY4args opcbnotify; CB_PUSH_DELEG4args opcbpush_deleg; CB_RECALL_ANY4args opcbrecall_any; CB_RECALLABLE_OBJ_AVAIL4args opcbrecallable_obj_avail; CB_RECALL_SLOT4args opcbrecall_slot; CB_SEQUENCE4args opcbsequence; CB_WANTS_CANCELLED4args opcbwants_cancelled; CB_NOTIFY_LOCK4args opcbnotify_lock; CB_NOTIFY_DEVICEID4args opcbnotify_deviceid; CB_OFFLOAD4args opcboffload; } nfs_cb_argop4_u; }; typedef struct nfs_cb_argop4 nfs_cb_argop4; struct nfs_cb_resop4 { nfs_cb_opnum4 resop; union { CB_GETATTR4res opcbgetattr; CB_RECALL4res opcbrecall; CB_LAYOUTRECALL4res opcblayoutrecall; CB_NOTIFY4res opcbnotify; CB_PUSH_DELEG4res opcbpush_deleg; CB_RECALL_ANY4res opcbrecall_any; CB_RECALLABLE_OBJ_AVAIL4res opcbrecallable_obj_avail; CB_RECALL_SLOT4res opcbrecall_slot; CB_SEQUENCE4res opcbsequence; CB_WANTS_CANCELLED4res opcbwants_cancelled; CB_NOTIFY_LOCK4res opcbnotify_lock; CB_NOTIFY_DEVICEID4res opcbnotify_deviceid; CB_OFFLOAD4res opcboffload; CB_ILLEGAL4res opcbillegal; } nfs_cb_resop4_u; }; typedef struct nfs_cb_resop4 nfs_cb_resop4; struct CB_COMPOUND4args { utf8str_cs tag; uint32_t minorversion; uint32_t callback_ident; struct { u_int argarray_len; nfs_cb_argop4 *argarray_val; } argarray; }; typedef struct CB_COMPOUND4args CB_COMPOUND4args; struct CB_COMPOUND4res { nfsstat4 status; utf8str_cs tag; struct { u_int resarray_len; nfs_cb_resop4 *resarray_val; } resarray; }; typedef struct CB_COMPOUND4res CB_COMPOUND4res; #define NFS4_PROGRAM 100003 #define NFS_V4 4 #if defined(__STDC__) || defined(__cplusplus) #define NFSPROC4_NULL 0 extern void * nfsproc4_null_4(void *, CLIENT *); extern void * nfsproc4_null_4_svc(void *, struct svc_req *); #define NFSPROC4_COMPOUND 1 extern COMPOUND4res * nfsproc4_compound_4(COMPOUND4args *, CLIENT *); extern COMPOUND4res * nfsproc4_compound_4_svc(COMPOUND4args *, struct svc_req *); extern int nfs4_program_4_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define NFSPROC4_NULL 0 extern void * nfsproc4_null_4(); extern void * nfsproc4_null_4_svc(); #define NFSPROC4_COMPOUND 1 extern COMPOUND4res * nfsproc4_compound_4(); extern COMPOUND4res * nfsproc4_compound_4_svc(); extern int nfs4_program_4_freeresult(); #endif /* K&R C */ #define NFS4_CALLBACK 0x40000000 #define NFS_CB 1 #if defined(__STDC__) || defined(__cplusplus) #define CB_NULL 0 extern void * cb_null_1(void *, CLIENT *); extern void * cb_null_1_svc(void *, struct svc_req *); #define CB_COMPOUND 1 extern CB_COMPOUND4res * cb_compound_1(CB_COMPOUND4args *, CLIENT *); extern CB_COMPOUND4res * cb_compound_1_svc(CB_COMPOUND4args *, struct svc_req *); extern int nfs4_callback_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define CB_NULL 0 extern void * cb_null_1(); extern void * cb_null_1_svc(); #define CB_COMPOUND 1 extern CB_COMPOUND4res * cb_compound_1(); extern CB_COMPOUND4res * cb_compound_1_svc(); extern int nfs4_callback_1_freeresult(); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_nfs_ftype4(XDR *, nfs_ftype4*); extern bool_t xdr_nfsstat4(XDR *, nfsstat4*); extern bool_t xdr_attrlist4(XDR *, attrlist4*); extern bool_t xdr_bitmap4(XDR *, bitmap4*); extern bool_t xdr_changeid4(XDR *, changeid4*); extern bool_t xdr_clientid4(XDR *, clientid4*); extern bool_t xdr_count4(XDR *, count4*); extern bool_t xdr_length4(XDR *, length4*); extern bool_t xdr_mode4(XDR *, mode4*); extern bool_t xdr_nfs_cookie4(XDR *, nfs_cookie4*); extern bool_t xdr_nfs_fh4(XDR *, nfs_fh4*); extern bool_t xdr_offset4(XDR *, offset4*); extern bool_t xdr_qop4(XDR *, qop4*); extern bool_t xdr_sec_oid4(XDR *, sec_oid4*); extern bool_t xdr_sequenceid4(XDR *, sequenceid4*); extern bool_t xdr_seqid4(XDR *, seqid4*); extern bool_t xdr_sessionid4(XDR *, sessionid4); extern bool_t xdr_slotid4(XDR *, slotid4*); extern bool_t xdr_utf8string(XDR *, utf8string*); extern bool_t xdr_utf8str_cis(XDR *, utf8str_cis*); extern bool_t xdr_utf8str_cs(XDR *, utf8str_cs*); extern bool_t xdr_utf8str_mixed(XDR *, utf8str_mixed*); extern bool_t xdr_component4(XDR *, component4*); extern bool_t xdr_linktext4(XDR *, linktext4*); extern bool_t xdr_ascii_REQUIRED4(XDR *, ascii_REQUIRED4*); extern bool_t xdr_pathname4(XDR *, pathname4*); extern bool_t xdr_verifier4(XDR *, verifier4); extern bool_t xdr_secret4(XDR *, secret4*); extern bool_t xdr_policy4(XDR *, policy4*); extern bool_t xdr_nfstime4(XDR *, nfstime4*); extern bool_t xdr_time_how4(XDR *, time_how4*); extern bool_t xdr_settime4(XDR *, settime4*); extern bool_t xdr_nfs_lease4(XDR *, nfs_lease4*); extern bool_t xdr_fsid4(XDR *, fsid4*); extern bool_t xdr_change_policy4(XDR *, change_policy4*); extern bool_t xdr_fs_location4(XDR *, fs_location4*); extern bool_t xdr_fs_locations4(XDR *, fs_locations4*); extern bool_t xdr_acetype4(XDR *, acetype4*); extern bool_t xdr_aceflag4(XDR *, aceflag4*); extern bool_t xdr_acemask4(XDR *, acemask4*); extern bool_t xdr_nfsace4(XDR *, nfsace4*); extern bool_t xdr_aclflag4(XDR *, aclflag4*); extern bool_t xdr_nfsacl41(XDR *, nfsacl41*); extern bool_t xdr_mode_masked4(XDR *, mode_masked4*); extern bool_t xdr_specdata4(XDR *, specdata4*); extern bool_t xdr_netaddr4(XDR *, netaddr4*); extern bool_t xdr_nfs_impl_id4(XDR *, nfs_impl_id4*); extern bool_t xdr_stateid4(XDR *, stateid4*); extern bool_t xdr_layouttype4(XDR *, layouttype4*); extern bool_t xdr_layout_content4(XDR *, layout_content4*); extern bool_t xdr_layouthint4(XDR *, layouthint4*); extern bool_t xdr_layoutiomode4(XDR *, layoutiomode4*); extern bool_t xdr_layout4(XDR *, layout4*); extern bool_t xdr_deviceid4(XDR *, deviceid4); extern bool_t xdr_device_addr4(XDR *, device_addr4*); extern bool_t xdr_layoutupdate4(XDR *, layoutupdate4*); extern bool_t xdr_layoutreturn_type4(XDR *, layoutreturn_type4*); extern bool_t xdr_layoutreturn_file4(XDR *, layoutreturn_file4*); extern bool_t xdr_layoutreturn4(XDR *, layoutreturn4*); extern bool_t xdr_fs4_status_type(XDR *, fs4_status_type*); extern bool_t xdr_fs4_status(XDR *, fs4_status*); extern bool_t xdr_threshold4_read_size(XDR *, threshold4_read_size*); extern bool_t xdr_threshold4_write_size(XDR *, threshold4_write_size*); extern bool_t xdr_threshold4_read_iosize(XDR *, threshold4_read_iosize*); extern bool_t xdr_threshold4_write_iosize(XDR *, threshold4_write_iosize*); extern bool_t xdr_threshold_item4(XDR *, threshold_item4*); extern bool_t xdr_mdsthreshold4(XDR *, mdsthreshold4*); extern bool_t xdr_retention_get4(XDR *, retention_get4*); extern bool_t xdr_retention_set4(XDR *, retention_set4*); extern bool_t xdr_fs_charset_cap4(XDR *, fs_charset_cap4*); extern bool_t xdr_netloc_type4(XDR *, netloc_type4*); extern bool_t xdr_netloc4(XDR *, netloc4*); extern bool_t xdr_change_attr_type4(XDR *, change_attr_type4*); extern bool_t xdr_labelformat_spec4(XDR *, labelformat_spec4*); extern bool_t xdr_sec_label4(XDR *, sec_label4*); extern bool_t xdr_copy_from_auth_priv(XDR *, copy_from_auth_priv*); extern bool_t xdr_copy_to_auth_priv(XDR *, copy_to_auth_priv*); extern bool_t xdr_copy_confirm_auth_priv(XDR *, copy_confirm_auth_priv*); extern bool_t xdr_app_data_block4(XDR *, app_data_block4*); extern bool_t xdr_data4(XDR *, data4*); extern bool_t xdr_data_info4(XDR *, data_info4*); extern bool_t xdr_data_content4(XDR *, data_content4*); extern bool_t xdr_stable_how4(XDR *, stable_how4*); extern bool_t xdr_write_response4(XDR *, write_response4*); extern bool_t xdr_fattr4_supported_attrs(XDR *, fattr4_supported_attrs*); extern bool_t xdr_fattr4_type(XDR *, fattr4_type*); extern bool_t xdr_fattr4_fh_expire_type(XDR *, fattr4_fh_expire_type*); extern bool_t xdr_fattr4_change(XDR *, fattr4_change*); extern bool_t xdr_fattr4_size(XDR *, fattr4_size*); extern bool_t xdr_fattr4_link_support(XDR *, fattr4_link_support*); extern bool_t xdr_fattr4_symlink_support(XDR *, fattr4_symlink_support*); extern bool_t xdr_fattr4_named_attr(XDR *, fattr4_named_attr*); extern bool_t xdr_fattr4_fsid(XDR *, fattr4_fsid*); extern bool_t xdr_fattr4_unique_handles(XDR *, fattr4_unique_handles*); extern bool_t xdr_fattr4_lease_time(XDR *, fattr4_lease_time*); extern bool_t xdr_fattr4_rdattr_error(XDR *, fattr4_rdattr_error*); extern bool_t xdr_fattr4_acl(XDR *, fattr4_acl*); extern bool_t xdr_fattr4_aclsupport(XDR *, fattr4_aclsupport*); extern bool_t xdr_fattr4_archive(XDR *, fattr4_archive*); extern bool_t xdr_fattr4_cansettime(XDR *, fattr4_cansettime*); extern bool_t xdr_fattr4_case_insensitive(XDR *, fattr4_case_insensitive*); extern bool_t xdr_fattr4_case_preserving(XDR *, fattr4_case_preserving*); extern bool_t xdr_fattr4_chown_restricted(XDR *, fattr4_chown_restricted*); extern bool_t xdr_fattr4_fileid(XDR *, fattr4_fileid*); extern bool_t xdr_fattr4_files_avail(XDR *, fattr4_files_avail*); extern bool_t xdr_fattr4_filehandle(XDR *, fattr4_filehandle*); extern bool_t xdr_fattr4_files_free(XDR *, fattr4_files_free*); extern bool_t xdr_fattr4_files_total(XDR *, fattr4_files_total*); extern bool_t xdr_fattr4_fs_locations(XDR *, fattr4_fs_locations*); extern bool_t xdr_fattr4_hidden(XDR *, fattr4_hidden*); extern bool_t xdr_fattr4_homogeneous(XDR *, fattr4_homogeneous*); extern bool_t xdr_fattr4_maxfilesize(XDR *, fattr4_maxfilesize*); extern bool_t xdr_fattr4_maxlink(XDR *, fattr4_maxlink*); extern bool_t xdr_fattr4_maxname(XDR *, fattr4_maxname*); extern bool_t xdr_fattr4_maxread(XDR *, fattr4_maxread*); extern bool_t xdr_fattr4_maxwrite(XDR *, fattr4_maxwrite*); extern bool_t xdr_fattr4_mimetype(XDR *, fattr4_mimetype*); extern bool_t xdr_fattr4_mode(XDR *, fattr4_mode*); extern bool_t xdr_fattr4_mode_set_masked(XDR *, fattr4_mode_set_masked*); extern bool_t xdr_fattr4_mounted_on_fileid(XDR *, fattr4_mounted_on_fileid*); extern bool_t xdr_fattr4_no_trunc(XDR *, fattr4_no_trunc*); extern bool_t xdr_fattr4_numlinks(XDR *, fattr4_numlinks*); extern bool_t xdr_fattr4_owner(XDR *, fattr4_owner*); extern bool_t xdr_fattr4_owner_group(XDR *, fattr4_owner_group*); extern bool_t xdr_fattr4_quota_avail_hard(XDR *, fattr4_quota_avail_hard*); extern bool_t xdr_fattr4_quota_avail_soft(XDR *, fattr4_quota_avail_soft*); extern bool_t xdr_fattr4_quota_used(XDR *, fattr4_quota_used*); extern bool_t xdr_fattr4_rawdev(XDR *, fattr4_rawdev*); extern bool_t xdr_fattr4_space_avail(XDR *, fattr4_space_avail*); extern bool_t xdr_fattr4_space_free(XDR *, fattr4_space_free*); extern bool_t xdr_fattr4_space_total(XDR *, fattr4_space_total*); extern bool_t xdr_fattr4_space_used(XDR *, fattr4_space_used*); extern bool_t xdr_fattr4_system(XDR *, fattr4_system*); extern bool_t xdr_fattr4_time_access(XDR *, fattr4_time_access*); extern bool_t xdr_fattr4_time_access_set(XDR *, fattr4_time_access_set*); extern bool_t xdr_fattr4_time_backup(XDR *, fattr4_time_backup*); extern bool_t xdr_fattr4_time_create(XDR *, fattr4_time_create*); extern bool_t xdr_fattr4_time_delta(XDR *, fattr4_time_delta*); extern bool_t xdr_fattr4_time_metadata(XDR *, fattr4_time_metadata*); extern bool_t xdr_fattr4_time_modify(XDR *, fattr4_time_modify*); extern bool_t xdr_fattr4_time_modify_set(XDR *, fattr4_time_modify_set*); extern bool_t xdr_fattr4_suppattr_exclcreat(XDR *, fattr4_suppattr_exclcreat*); extern bool_t xdr_fattr4_dir_notif_delay(XDR *, fattr4_dir_notif_delay*); extern bool_t xdr_fattr4_dirent_notif_delay(XDR *, fattr4_dirent_notif_delay*); extern bool_t xdr_fattr4_fs_layout_types(XDR *, fattr4_fs_layout_types*); extern bool_t xdr_fattr4_fs_status(XDR *, fattr4_fs_status*); extern bool_t xdr_fattr4_fs_charset_cap(XDR *, fattr4_fs_charset_cap*); extern bool_t xdr_fattr4_layout_alignment(XDR *, fattr4_layout_alignment*); extern bool_t xdr_fattr4_layout_blksize(XDR *, fattr4_layout_blksize*); extern bool_t xdr_fattr4_layout_hint(XDR *, fattr4_layout_hint*); extern bool_t xdr_fattr4_layout_types(XDR *, fattr4_layout_types*); extern bool_t xdr_fattr4_mdsthreshold(XDR *, fattr4_mdsthreshold*); extern bool_t xdr_fattr4_retention_get(XDR *, fattr4_retention_get*); extern bool_t xdr_fattr4_retention_set(XDR *, fattr4_retention_set*); extern bool_t xdr_fattr4_retentevt_get(XDR *, fattr4_retentevt_get*); extern bool_t xdr_fattr4_retentevt_set(XDR *, fattr4_retentevt_set*); extern bool_t xdr_fattr4_retention_hold(XDR *, fattr4_retention_hold*); extern bool_t xdr_fattr4_dacl(XDR *, fattr4_dacl*); extern bool_t xdr_fattr4_sacl(XDR *, fattr4_sacl*); extern bool_t xdr_fattr4_change_policy(XDR *, fattr4_change_policy*); extern bool_t xdr_fattr4_space_freed(XDR *, fattr4_space_freed*); extern bool_t xdr_fattr4_change_attr_type(XDR *, fattr4_change_attr_type*); extern bool_t xdr_fattr4_sec_label(XDR *, fattr4_sec_label*); extern bool_t xdr_fattr4_clone_blksize(XDR *, fattr4_clone_blksize*); extern bool_t xdr_fattr4(XDR *, fattr4*); extern bool_t xdr_change_info4(XDR *, change_info4*); extern bool_t xdr_clientaddr4(XDR *, clientaddr4*); extern bool_t xdr_cb_client4(XDR *, cb_client4*); extern bool_t xdr_nfs_client_id4(XDR *, nfs_client_id4*); extern bool_t xdr_client_owner4(XDR *, client_owner4*); extern bool_t xdr_server_owner4(XDR *, server_owner4*); extern bool_t xdr_state_owner4(XDR *, state_owner4*); extern bool_t xdr_open_owner4(XDR *, open_owner4*); extern bool_t xdr_lock_owner4(XDR *, lock_owner4*); extern bool_t xdr_nfs_lock_type4(XDR *, nfs_lock_type4*); extern bool_t xdr_ssv_subkey4(XDR *, ssv_subkey4*); extern bool_t xdr_ssv_mic_plain_tkn4(XDR *, ssv_mic_plain_tkn4*); extern bool_t xdr_ssv_mic_tkn4(XDR *, ssv_mic_tkn4*); extern bool_t xdr_ssv_seal_plain_tkn4(XDR *, ssv_seal_plain_tkn4*); extern bool_t xdr_ssv_seal_cipher_tkn4(XDR *, ssv_seal_cipher_tkn4*); extern bool_t xdr_fs_locations_server4(XDR *, fs_locations_server4*); extern bool_t xdr_fs_locations_item4(XDR *, fs_locations_item4*); extern bool_t xdr_fs_locations_info4(XDR *, fs_locations_info4*); extern bool_t xdr_fattr4_fs_locations_info(XDR *, fattr4_fs_locations_info*); extern bool_t xdr_nfl_util4(XDR *, nfl_util4*); extern bool_t xdr_filelayout_hint_care4(XDR *, filelayout_hint_care4*); extern bool_t xdr_nfsv4_1_file_layouthint4(XDR *, nfsv4_1_file_layouthint4*); extern bool_t xdr_multipath_list4(XDR *, multipath_list4*); extern bool_t xdr_nfsv4_1_file_layout_ds_addr4(XDR *, nfsv4_1_file_layout_ds_addr4*); extern bool_t xdr_nfsv4_1_file_layout4(XDR *, nfsv4_1_file_layout4*); extern bool_t xdr_nfs_opnum4(XDR *, nfs_opnum4*); extern bool_t xdr_ACCESS4args(XDR *, ACCESS4args*); extern bool_t xdr_ACCESS4resok(XDR *, ACCESS4resok*); extern bool_t xdr_ACCESS4res(XDR *, ACCESS4res*); extern bool_t xdr_CLONE4args(XDR *, CLONE4args*); extern bool_t xdr_CLONE4res(XDR *, CLONE4res*); extern bool_t xdr_CLOSE4args(XDR *, CLOSE4args*); extern bool_t xdr_CLOSE4res(XDR *, CLOSE4res*); extern bool_t xdr_COMMIT4args(XDR *, COMMIT4args*); extern bool_t xdr_COMMIT4resok(XDR *, COMMIT4resok*); extern bool_t xdr_COMMIT4res(XDR *, COMMIT4res*); extern bool_t xdr_createtype4(XDR *, createtype4*); extern bool_t xdr_CREATE4args(XDR *, CREATE4args*); extern bool_t xdr_CREATE4resok(XDR *, CREATE4resok*); extern bool_t xdr_CREATE4res(XDR *, CREATE4res*); extern bool_t xdr_DELEGPURGE4args(XDR *, DELEGPURGE4args*); extern bool_t xdr_DELEGPURGE4res(XDR *, DELEGPURGE4res*); extern bool_t xdr_DELEGRETURN4args(XDR *, DELEGRETURN4args*); extern bool_t xdr_DELEGRETURN4res(XDR *, DELEGRETURN4res*); extern bool_t xdr_GETATTR4args(XDR *, GETATTR4args*); extern bool_t xdr_GETATTR4resok(XDR *, GETATTR4resok*); extern bool_t xdr_GETATTR4res(XDR *, GETATTR4res*); extern bool_t xdr_GETFH4resok(XDR *, GETFH4resok*); extern bool_t xdr_GETFH4res(XDR *, GETFH4res*); extern bool_t xdr_LINK4args(XDR *, LINK4args*); extern bool_t xdr_LINK4resok(XDR *, LINK4resok*); extern bool_t xdr_LINK4res(XDR *, LINK4res*); extern bool_t xdr_open_to_lock_owner4(XDR *, open_to_lock_owner4*); extern bool_t xdr_exist_lock_owner4(XDR *, exist_lock_owner4*); extern bool_t xdr_locker4(XDR *, locker4*); extern bool_t xdr_LOCK4args(XDR *, LOCK4args*); extern bool_t xdr_LOCK4denied(XDR *, LOCK4denied*); extern bool_t xdr_LOCK4resok(XDR *, LOCK4resok*); extern bool_t xdr_LOCK4res(XDR *, LOCK4res*); extern bool_t xdr_LOCKT4args(XDR *, LOCKT4args*); extern bool_t xdr_LOCKT4res(XDR *, LOCKT4res*); extern bool_t xdr_LOCKU4args(XDR *, LOCKU4args*); extern bool_t xdr_LOCKU4res(XDR *, LOCKU4res*); extern bool_t xdr_LOOKUP4args(XDR *, LOOKUP4args*); extern bool_t xdr_LOOKUP4res(XDR *, LOOKUP4res*); extern bool_t xdr_LOOKUPP4res(XDR *, LOOKUPP4res*); extern bool_t xdr_NVERIFY4args(XDR *, NVERIFY4args*); extern bool_t xdr_NVERIFY4res(XDR *, NVERIFY4res*); extern bool_t xdr_createmode4(XDR *, createmode4*); extern bool_t xdr_creatverfattr(XDR *, creatverfattr*); extern bool_t xdr_createhow4(XDR *, createhow4*); extern bool_t xdr_opentype4(XDR *, opentype4*); extern bool_t xdr_openflag4(XDR *, openflag4*); extern bool_t xdr_limit_by4(XDR *, limit_by4*); extern bool_t xdr_nfs_modified_limit4(XDR *, nfs_modified_limit4*); extern bool_t xdr_nfs_space_limit4(XDR *, nfs_space_limit4*); extern bool_t xdr_open_delegation_type4(XDR *, open_delegation_type4*); extern bool_t xdr_open_claim_type4(XDR *, open_claim_type4*); extern bool_t xdr_open_claim_delegate_cur4(XDR *, open_claim_delegate_cur4*); extern bool_t xdr_open_claim4(XDR *, open_claim4*); extern bool_t xdr_OPEN4args(XDR *, OPEN4args*); extern bool_t xdr_open_read_delegation4(XDR *, open_read_delegation4*); extern bool_t xdr_open_write_delegation4(XDR *, open_write_delegation4*); extern bool_t xdr_why_no_delegation4(XDR *, why_no_delegation4*); extern bool_t xdr_open_none_delegation4(XDR *, open_none_delegation4*); extern bool_t xdr_open_delegation4(XDR *, open_delegation4*); extern bool_t xdr_OPEN4resok(XDR *, OPEN4resok*); extern bool_t xdr_OPEN4res(XDR *, OPEN4res*); extern bool_t xdr_OPENATTR4args(XDR *, OPENATTR4args*); extern bool_t xdr_OPENATTR4res(XDR *, OPENATTR4res*); extern bool_t xdr_OPEN_CONFIRM4args(XDR *, OPEN_CONFIRM4args*); extern bool_t xdr_OPEN_CONFIRM4resok(XDR *, OPEN_CONFIRM4resok*); extern bool_t xdr_OPEN_CONFIRM4res(XDR *, OPEN_CONFIRM4res*); extern bool_t xdr_OPEN_DOWNGRADE4args(XDR *, OPEN_DOWNGRADE4args*); extern bool_t xdr_OPEN_DOWNGRADE4resok(XDR *, OPEN_DOWNGRADE4resok*); extern bool_t xdr_OPEN_DOWNGRADE4res(XDR *, OPEN_DOWNGRADE4res*); extern bool_t xdr_PUTFH4args(XDR *, PUTFH4args*); extern bool_t xdr_PUTFH4res(XDR *, PUTFH4res*); extern bool_t xdr_PUTPUBFH4res(XDR *, PUTPUBFH4res*); extern bool_t xdr_PUTROOTFH4res(XDR *, PUTROOTFH4res*); extern bool_t xdr_READ4args(XDR *, READ4args*); extern bool_t xdr_READ4resok(XDR *, READ4resok*); extern bool_t xdr_READ4res(XDR *, READ4res*); extern bool_t xdr_READDIR4args(XDR *, READDIR4args*); extern bool_t xdr_entry4(XDR *, entry4*); extern bool_t xdr_dirlist4(XDR *, dirlist4*); extern bool_t xdr_READDIR4resok(XDR *, READDIR4resok*); extern bool_t xdr_READDIR4res(XDR *, READDIR4res*); extern bool_t xdr_READLINK4resok(XDR *, READLINK4resok*); extern bool_t xdr_READLINK4res(XDR *, READLINK4res*); extern bool_t xdr_REMOVE4args(XDR *, REMOVE4args*); extern bool_t xdr_REMOVE4resok(XDR *, REMOVE4resok*); extern bool_t xdr_REMOVE4res(XDR *, REMOVE4res*); extern bool_t xdr_RENAME4args(XDR *, RENAME4args*); extern bool_t xdr_RENAME4resok(XDR *, RENAME4resok*); extern bool_t xdr_RENAME4res(XDR *, RENAME4res*); extern bool_t xdr_RENEW4args(XDR *, RENEW4args*); extern bool_t xdr_RENEW4res(XDR *, RENEW4res*); extern bool_t xdr_RESTOREFH4res(XDR *, RESTOREFH4res*); extern bool_t xdr_SAVEFH4res(XDR *, SAVEFH4res*); extern bool_t xdr_SECINFO4args(XDR *, SECINFO4args*); extern bool_t xdr_rpc_gss_svc_t(XDR *, rpc_gss_svc_t*); extern bool_t xdr_rpcsec_gss_info(XDR *, rpcsec_gss_info*); extern bool_t xdr_secinfo4(XDR *, secinfo4*); extern bool_t xdr_SECINFO4resok(XDR *, SECINFO4resok*); extern bool_t xdr_SECINFO4res(XDR *, SECINFO4res*); extern bool_t xdr_SETATTR4args(XDR *, SETATTR4args*); extern bool_t xdr_SETATTR4res(XDR *, SETATTR4res*); extern bool_t xdr_SETCLIENTID4args(XDR *, SETCLIENTID4args*); extern bool_t xdr_SETCLIENTID4resok(XDR *, SETCLIENTID4resok*); extern bool_t xdr_SETCLIENTID4res(XDR *, SETCLIENTID4res*); extern bool_t xdr_SETCLIENTID_CONFIRM4args(XDR *, SETCLIENTID_CONFIRM4args*); extern bool_t xdr_SETCLIENTID_CONFIRM4res(XDR *, SETCLIENTID_CONFIRM4res*); extern bool_t xdr_VERIFY4args(XDR *, VERIFY4args*); extern bool_t xdr_VERIFY4res(XDR *, VERIFY4res*); extern bool_t xdr_WRITE4args(XDR *, WRITE4args*); extern bool_t xdr_WRITE4resok(XDR *, WRITE4resok*); extern bool_t xdr_WRITE4res(XDR *, WRITE4res*); extern bool_t xdr_RELEASE_LOCKOWNER4args(XDR *, RELEASE_LOCKOWNER4args*); extern bool_t xdr_RELEASE_LOCKOWNER4res(XDR *, RELEASE_LOCKOWNER4res*); extern bool_t xdr_ILLEGAL4res(XDR *, ILLEGAL4res*); extern bool_t xdr_gsshandle4_t(XDR *, gsshandle4_t*); extern bool_t xdr_gss_cb_handles4(XDR *, gss_cb_handles4*); extern bool_t xdr_callback_sec_parms4(XDR *, callback_sec_parms4*); extern bool_t xdr_BACKCHANNEL_CTL4args(XDR *, BACKCHANNEL_CTL4args*); extern bool_t xdr_BACKCHANNEL_CTL4res(XDR *, BACKCHANNEL_CTL4res*); extern bool_t xdr_channel_dir_from_client4(XDR *, channel_dir_from_client4*); extern bool_t xdr_BIND_CONN_TO_SESSION4args(XDR *, BIND_CONN_TO_SESSION4args*); extern bool_t xdr_channel_dir_from_server4(XDR *, channel_dir_from_server4*); extern bool_t xdr_BIND_CONN_TO_SESSION4resok(XDR *, BIND_CONN_TO_SESSION4resok*); extern bool_t xdr_BIND_CONN_TO_SESSION4res(XDR *, BIND_CONN_TO_SESSION4res*); extern bool_t xdr_state_protect_ops4(XDR *, state_protect_ops4*); extern bool_t xdr_ssv_sp_parms4(XDR *, ssv_sp_parms4*); extern bool_t xdr_state_protect_how4(XDR *, state_protect_how4*); extern bool_t xdr_state_protect4_a(XDR *, state_protect4_a*); extern bool_t xdr_EXCHANGE_ID4args(XDR *, EXCHANGE_ID4args*); extern bool_t xdr_ssv_prot_info4(XDR *, ssv_prot_info4*); extern bool_t xdr_state_protect4_r(XDR *, state_protect4_r*); extern bool_t xdr_EXCHANGE_ID4resok(XDR *, EXCHANGE_ID4resok*); extern bool_t xdr_EXCHANGE_ID4res(XDR *, EXCHANGE_ID4res*); extern bool_t xdr_channel_attrs4(XDR *, channel_attrs4*); extern bool_t xdr_CREATE_SESSION4args(XDR *, CREATE_SESSION4args*); extern bool_t xdr_CREATE_SESSION4resok(XDR *, CREATE_SESSION4resok*); extern bool_t xdr_CREATE_SESSION4res(XDR *, CREATE_SESSION4res*); extern bool_t xdr_DESTROY_SESSION4args(XDR *, DESTROY_SESSION4args*); extern bool_t xdr_DESTROY_SESSION4res(XDR *, DESTROY_SESSION4res*); extern bool_t xdr_FREE_STATEID4args(XDR *, FREE_STATEID4args*); extern bool_t xdr_FREE_STATEID4res(XDR *, FREE_STATEID4res*); extern bool_t xdr_attr_notice4(XDR *, attr_notice4*); extern bool_t xdr_GET_DIR_DELEGATION4args(XDR *, GET_DIR_DELEGATION4args*); extern bool_t xdr_GET_DIR_DELEGATION4resok(XDR *, GET_DIR_DELEGATION4resok*); extern bool_t xdr_gddrnf4_status(XDR *, gddrnf4_status*); extern bool_t xdr_GET_DIR_DELEGATION4res_non_fatal(XDR *, GET_DIR_DELEGATION4res_non_fatal*); extern bool_t xdr_GET_DIR_DELEGATION4res(XDR *, GET_DIR_DELEGATION4res*); extern bool_t xdr_GETDEVICEINFO4args(XDR *, GETDEVICEINFO4args*); extern bool_t xdr_GETDEVICEINFO4resok(XDR *, GETDEVICEINFO4resok*); extern bool_t xdr_GETDEVICEINFO4res(XDR *, GETDEVICEINFO4res*); extern bool_t xdr_GETDEVICELIST4args(XDR *, GETDEVICELIST4args*); extern bool_t xdr_GETDEVICELIST4resok(XDR *, GETDEVICELIST4resok*); extern bool_t xdr_GETDEVICELIST4res(XDR *, GETDEVICELIST4res*); extern bool_t xdr_newtime4(XDR *, newtime4*); extern bool_t xdr_newoffset4(XDR *, newoffset4*); extern bool_t xdr_LAYOUTCOMMIT4args(XDR *, LAYOUTCOMMIT4args*); extern bool_t xdr_newsize4(XDR *, newsize4*); extern bool_t xdr_LAYOUTCOMMIT4resok(XDR *, LAYOUTCOMMIT4resok*); extern bool_t xdr_LAYOUTCOMMIT4res(XDR *, LAYOUTCOMMIT4res*); extern bool_t xdr_LAYOUTGET4args(XDR *, LAYOUTGET4args*); extern bool_t xdr_LAYOUTGET4resok(XDR *, LAYOUTGET4resok*); extern bool_t xdr_LAYOUTGET4res(XDR *, LAYOUTGET4res*); extern bool_t xdr_LAYOUTRETURN4args(XDR *, LAYOUTRETURN4args*); extern bool_t xdr_layoutreturn_stateid(XDR *, layoutreturn_stateid*); extern bool_t xdr_LAYOUTRETURN4res(XDR *, LAYOUTRETURN4res*); extern bool_t xdr_secinfo_style4(XDR *, secinfo_style4*); extern bool_t xdr_SECINFO_NO_NAME4args(XDR *, SECINFO_NO_NAME4args*); extern bool_t xdr_SECINFO_NO_NAME4res(XDR *, SECINFO_NO_NAME4res*); extern bool_t xdr_SEQUENCE4args(XDR *, SEQUENCE4args*); extern bool_t xdr_SEQUENCE4resok(XDR *, SEQUENCE4resok*); extern bool_t xdr_SEQUENCE4res(XDR *, SEQUENCE4res*); extern bool_t xdr_ssa_digest_input4(XDR *, ssa_digest_input4*); extern bool_t xdr_SET_SSV4args(XDR *, SET_SSV4args*); extern bool_t xdr_ssr_digest_input4(XDR *, ssr_digest_input4*); extern bool_t xdr_SET_SSV4resok(XDR *, SET_SSV4resok*); extern bool_t xdr_SET_SSV4res(XDR *, SET_SSV4res*); extern bool_t xdr_TEST_STATEID4args(XDR *, TEST_STATEID4args*); extern bool_t xdr_TEST_STATEID4resok(XDR *, TEST_STATEID4resok*); extern bool_t xdr_TEST_STATEID4res(XDR *, TEST_STATEID4res*); extern bool_t xdr_deleg_claim4(XDR *, deleg_claim4*); extern bool_t xdr_WANT_DELEGATION4args(XDR *, WANT_DELEGATION4args*); extern bool_t xdr_WANT_DELEGATION4res(XDR *, WANT_DELEGATION4res*); extern bool_t xdr_DESTROY_CLIENTID4args(XDR *, DESTROY_CLIENTID4args*); extern bool_t xdr_DESTROY_CLIENTID4res(XDR *, DESTROY_CLIENTID4res*); extern bool_t xdr_RECLAIM_COMPLETE4args(XDR *, RECLAIM_COMPLETE4args*); extern bool_t xdr_RECLAIM_COMPLETE4res(XDR *, RECLAIM_COMPLETE4res*); extern bool_t xdr_COPY4args(XDR *, COPY4args*); extern bool_t xdr_copy_requirements4(XDR *, copy_requirements4*); extern bool_t xdr_COPY4resok(XDR *, COPY4resok*); extern bool_t xdr_COPY4res(XDR *, COPY4res*); extern bool_t xdr_COPY_NOTIFY4args(XDR *, COPY_NOTIFY4args*); extern bool_t xdr_COPY_NOTIFY4resok(XDR *, COPY_NOTIFY4resok*); extern bool_t xdr_COPY_NOTIFY4res(XDR *, COPY_NOTIFY4res*); extern bool_t xdr_OFFLOAD_CANCEL4args(XDR *, OFFLOAD_CANCEL4args*); extern bool_t xdr_OFFLOAD_CANCEL4res(XDR *, OFFLOAD_CANCEL4res*); extern bool_t xdr_OFFLOAD_STATUS4args(XDR *, OFFLOAD_STATUS4args*); extern bool_t xdr_OFFLOAD_STATUS4resok(XDR *, OFFLOAD_STATUS4resok*); extern bool_t xdr_OFFLOAD_STATUS4res(XDR *, OFFLOAD_STATUS4res*); extern bool_t xdr_ALLOCATE4args(XDR *, ALLOCATE4args*); extern bool_t xdr_ALLOCATE4res(XDR *, ALLOCATE4res*); extern bool_t xdr_DEALLOCATE4args(XDR *, DEALLOCATE4args*); extern bool_t xdr_DEALLOCATE4res(XDR *, DEALLOCATE4res*); extern bool_t xdr_IO_ADVISE_type4(XDR *, IO_ADVISE_type4*); extern bool_t xdr_IO_ADVISE4args(XDR *, IO_ADVISE4args*); extern bool_t xdr_IO_ADVISE4resok(XDR *, IO_ADVISE4resok*); extern bool_t xdr_IO_ADVISE4res(XDR *, IO_ADVISE4res*); extern bool_t xdr_device_error4(XDR *, device_error4*); extern bool_t xdr_LAYOUTERROR4args(XDR *, LAYOUTERROR4args*); extern bool_t xdr_LAYOUTERROR4res(XDR *, LAYOUTERROR4res*); extern bool_t xdr_io_info4(XDR *, io_info4*); extern bool_t xdr_LAYOUTSTATS4args(XDR *, LAYOUTSTATS4args*); extern bool_t xdr_LAYOUTSTATS4res(XDR *, LAYOUTSTATS4res*); extern bool_t xdr_READ_PLUS4args(XDR *, READ_PLUS4args*); extern bool_t xdr_read_plus_content(XDR *, read_plus_content*); extern bool_t xdr_read_plus_res4(XDR *, read_plus_res4*); extern bool_t xdr_READ_PLUS4res(XDR *, READ_PLUS4res*); extern bool_t xdr_SEEK4args(XDR *, SEEK4args*); extern bool_t xdr_seek_res4(XDR *, seek_res4*); extern bool_t xdr_SEEK4res(XDR *, SEEK4res*); extern bool_t xdr_WRITE_SAME4args(XDR *, WRITE_SAME4args*); extern bool_t xdr_WRITE_SAME4res(XDR *, WRITE_SAME4res*); extern bool_t xdr_nfs_argop4(XDR *, nfs_argop4*); extern bool_t xdr_nfs_resop4(XDR *, nfs_resop4*); extern bool_t xdr_COMPOUND4args(XDR *, COMPOUND4args*); extern bool_t xdr_COMPOUND4res(XDR *, COMPOUND4res*); extern bool_t xdr_CB_GETATTR4args(XDR *, CB_GETATTR4args*); extern bool_t xdr_CB_GETATTR4resok(XDR *, CB_GETATTR4resok*); extern bool_t xdr_CB_GETATTR4res(XDR *, CB_GETATTR4res*); extern bool_t xdr_CB_RECALL4args(XDR *, CB_RECALL4args*); extern bool_t xdr_CB_RECALL4res(XDR *, CB_RECALL4res*); extern bool_t xdr_CB_ILLEGAL4res(XDR *, CB_ILLEGAL4res*); extern bool_t xdr_layoutrecall_type4(XDR *, layoutrecall_type4*); extern bool_t xdr_layoutrecall_file4(XDR *, layoutrecall_file4*); extern bool_t xdr_layoutrecall4(XDR *, layoutrecall4*); extern bool_t xdr_CB_LAYOUTRECALL4args(XDR *, CB_LAYOUTRECALL4args*); extern bool_t xdr_CB_LAYOUTRECALL4res(XDR *, CB_LAYOUTRECALL4res*); extern bool_t xdr_notify_type4(XDR *, notify_type4*); extern bool_t xdr_notify_entry4(XDR *, notify_entry4*); extern bool_t xdr_prev_entry4(XDR *, prev_entry4*); extern bool_t xdr_notify_remove4(XDR *, notify_remove4*); extern bool_t xdr_notify_add4(XDR *, notify_add4*); extern bool_t xdr_notify_attr4(XDR *, notify_attr4*); extern bool_t xdr_notify_rename4(XDR *, notify_rename4*); extern bool_t xdr_notify_verifier4(XDR *, notify_verifier4*); extern bool_t xdr_notifylist4(XDR *, notifylist4*); extern bool_t xdr_notify4(XDR *, notify4*); extern bool_t xdr_CB_NOTIFY4args(XDR *, CB_NOTIFY4args*); extern bool_t xdr_CB_NOTIFY4res(XDR *, CB_NOTIFY4res*); extern bool_t xdr_CB_PUSH_DELEG4args(XDR *, CB_PUSH_DELEG4args*); extern bool_t xdr_CB_PUSH_DELEG4res(XDR *, CB_PUSH_DELEG4res*); extern bool_t xdr_CB_RECALL_ANY4args(XDR *, CB_RECALL_ANY4args*); extern bool_t xdr_CB_RECALL_ANY4res(XDR *, CB_RECALL_ANY4res*); extern bool_t xdr_CB_RECALLABLE_OBJ_AVAIL4args(XDR *, CB_RECALLABLE_OBJ_AVAIL4args*); extern bool_t xdr_CB_RECALLABLE_OBJ_AVAIL4res(XDR *, CB_RECALLABLE_OBJ_AVAIL4res*); extern bool_t xdr_CB_RECALL_SLOT4args(XDR *, CB_RECALL_SLOT4args*); extern bool_t xdr_CB_RECALL_SLOT4res(XDR *, CB_RECALL_SLOT4res*); extern bool_t xdr_referring_call4(XDR *, referring_call4*); extern bool_t xdr_referring_call_list4(XDR *, referring_call_list4*); extern bool_t xdr_CB_SEQUENCE4args(XDR *, CB_SEQUENCE4args*); extern bool_t xdr_CB_SEQUENCE4resok(XDR *, CB_SEQUENCE4resok*); extern bool_t xdr_CB_SEQUENCE4res(XDR *, CB_SEQUENCE4res*); extern bool_t xdr_CB_WANTS_CANCELLED4args(XDR *, CB_WANTS_CANCELLED4args*); extern bool_t xdr_CB_WANTS_CANCELLED4res(XDR *, CB_WANTS_CANCELLED4res*); extern bool_t xdr_CB_NOTIFY_LOCK4args(XDR *, CB_NOTIFY_LOCK4args*); extern bool_t xdr_CB_NOTIFY_LOCK4res(XDR *, CB_NOTIFY_LOCK4res*); extern bool_t xdr_notify_deviceid_type4(XDR *, notify_deviceid_type4*); extern bool_t xdr_notify_deviceid_delete4(XDR *, notify_deviceid_delete4*); extern bool_t xdr_notify_deviceid_change4(XDR *, notify_deviceid_change4*); extern bool_t xdr_CB_NOTIFY_DEVICEID4args(XDR *, CB_NOTIFY_DEVICEID4args*); extern bool_t xdr_CB_NOTIFY_DEVICEID4res(XDR *, CB_NOTIFY_DEVICEID4res*); extern bool_t xdr_offload_info4(XDR *, offload_info4*); extern bool_t xdr_CB_OFFLOAD4args(XDR *, CB_OFFLOAD4args*); extern bool_t xdr_CB_OFFLOAD4res(XDR *, CB_OFFLOAD4res*); extern bool_t xdr_nfs_cb_opnum4(XDR *, nfs_cb_opnum4*); extern bool_t xdr_nfs_cb_argop4(XDR *, nfs_cb_argop4*); extern bool_t xdr_nfs_cb_resop4(XDR *, nfs_cb_resop4*); extern bool_t xdr_CB_COMPOUND4args(XDR *, CB_COMPOUND4args*); extern bool_t xdr_CB_COMPOUND4res(XDR *, CB_COMPOUND4res*); #else /* K&R C */ extern bool_t xdr_nfs_ftype4(); extern bool_t xdr_nfsstat4(); extern bool_t xdr_attrlist4(); extern bool_t xdr_bitmap4(); extern bool_t xdr_changeid4(); extern bool_t xdr_clientid4(); extern bool_t xdr_count4(); extern bool_t xdr_length4(); extern bool_t xdr_mode4(); extern bool_t xdr_nfs_cookie4(); extern bool_t xdr_nfs_fh4(); extern bool_t xdr_offset4(); extern bool_t xdr_qop4(); extern bool_t xdr_sec_oid4(); extern bool_t xdr_sequenceid4(); extern bool_t xdr_seqid4(); extern bool_t xdr_sessionid4(); extern bool_t xdr_slotid4(); extern bool_t xdr_utf8string(); extern bool_t xdr_utf8str_cis(); extern bool_t xdr_utf8str_cs(); extern bool_t xdr_utf8str_mixed(); extern bool_t xdr_component4(); extern bool_t xdr_linktext4(); extern bool_t xdr_ascii_REQUIRED4(); extern bool_t xdr_pathname4(); extern bool_t xdr_verifier4(); extern bool_t xdr_secret4(); extern bool_t xdr_policy4(); extern bool_t xdr_nfstime4(); extern bool_t xdr_time_how4(); extern bool_t xdr_settime4(); extern bool_t xdr_nfs_lease4(); extern bool_t xdr_fsid4(); extern bool_t xdr_change_policy4(); extern bool_t xdr_fs_location4(); extern bool_t xdr_fs_locations4(); extern bool_t xdr_acetype4(); extern bool_t xdr_aceflag4(); extern bool_t xdr_acemask4(); extern bool_t xdr_nfsace4(); extern bool_t xdr_aclflag4(); extern bool_t xdr_nfsacl41(); extern bool_t xdr_mode_masked4(); extern bool_t xdr_specdata4(); extern bool_t xdr_netaddr4(); extern bool_t xdr_nfs_impl_id4(); extern bool_t xdr_stateid4(); extern bool_t xdr_layouttype4(); extern bool_t xdr_layout_content4(); extern bool_t xdr_layouthint4(); extern bool_t xdr_layoutiomode4(); extern bool_t xdr_layout4(); extern bool_t xdr_deviceid4(); extern bool_t xdr_device_addr4(); extern bool_t xdr_layoutupdate4(); extern bool_t xdr_layoutreturn_type4(); extern bool_t xdr_layoutreturn_file4(); extern bool_t xdr_layoutreturn4(); extern bool_t xdr_fs4_status_type(); extern bool_t xdr_fs4_status(); extern bool_t xdr_threshold4_read_size(); extern bool_t xdr_threshold4_write_size(); extern bool_t xdr_threshold4_read_iosize(); extern bool_t xdr_threshold4_write_iosize(); extern bool_t xdr_threshold_item4(); extern bool_t xdr_mdsthreshold4(); extern bool_t xdr_retention_get4(); extern bool_t xdr_retention_set4(); extern bool_t xdr_fs_charset_cap4(); extern bool_t xdr_netloc_type4(); extern bool_t xdr_netloc4(); extern bool_t xdr_change_attr_type4(); extern bool_t xdr_labelformat_spec4(); extern bool_t xdr_sec_label4(); extern bool_t xdr_copy_from_auth_priv(); extern bool_t xdr_copy_to_auth_priv(); extern bool_t xdr_copy_confirm_auth_priv(); extern bool_t xdr_app_data_block4(); extern bool_t xdr_data4(); extern bool_t xdr_data_info4(); extern bool_t xdr_data_content4(); extern bool_t xdr_stable_how4(); extern bool_t xdr_write_response4(); extern bool_t xdr_fattr4_supported_attrs(); extern bool_t xdr_fattr4_type(); extern bool_t xdr_fattr4_fh_expire_type(); extern bool_t xdr_fattr4_change(); extern bool_t xdr_fattr4_size(); extern bool_t xdr_fattr4_link_support(); extern bool_t xdr_fattr4_symlink_support(); extern bool_t xdr_fattr4_named_attr(); extern bool_t xdr_fattr4_fsid(); extern bool_t xdr_fattr4_unique_handles(); extern bool_t xdr_fattr4_lease_time(); extern bool_t xdr_fattr4_rdattr_error(); extern bool_t xdr_fattr4_acl(); extern bool_t xdr_fattr4_aclsupport(); extern bool_t xdr_fattr4_archive(); extern bool_t xdr_fattr4_cansettime(); extern bool_t xdr_fattr4_case_insensitive(); extern bool_t xdr_fattr4_case_preserving(); extern bool_t xdr_fattr4_chown_restricted(); extern bool_t xdr_fattr4_fileid(); extern bool_t xdr_fattr4_files_avail(); extern bool_t xdr_fattr4_filehandle(); extern bool_t xdr_fattr4_files_free(); extern bool_t xdr_fattr4_files_total(); extern bool_t xdr_fattr4_fs_locations(); extern bool_t xdr_fattr4_hidden(); extern bool_t xdr_fattr4_homogeneous(); extern bool_t xdr_fattr4_maxfilesize(); extern bool_t xdr_fattr4_maxlink(); extern bool_t xdr_fattr4_maxname(); extern bool_t xdr_fattr4_maxread(); extern bool_t xdr_fattr4_maxwrite(); extern bool_t xdr_fattr4_mimetype(); extern bool_t xdr_fattr4_mode(); extern bool_t xdr_fattr4_mode_set_masked(); extern bool_t xdr_fattr4_mounted_on_fileid(); extern bool_t xdr_fattr4_no_trunc(); extern bool_t xdr_fattr4_numlinks(); extern bool_t xdr_fattr4_owner(); extern bool_t xdr_fattr4_owner_group(); extern bool_t xdr_fattr4_quota_avail_hard(); extern bool_t xdr_fattr4_quota_avail_soft(); extern bool_t xdr_fattr4_quota_used(); extern bool_t xdr_fattr4_rawdev(); extern bool_t xdr_fattr4_space_avail(); extern bool_t xdr_fattr4_space_free(); extern bool_t xdr_fattr4_space_total(); extern bool_t xdr_fattr4_space_used(); extern bool_t xdr_fattr4_system(); extern bool_t xdr_fattr4_time_access(); extern bool_t xdr_fattr4_time_access_set(); extern bool_t xdr_fattr4_time_backup(); extern bool_t xdr_fattr4_time_create(); extern bool_t xdr_fattr4_time_delta(); extern bool_t xdr_fattr4_time_metadata(); extern bool_t xdr_fattr4_time_modify(); extern bool_t xdr_fattr4_time_modify_set(); extern bool_t xdr_fattr4_suppattr_exclcreat(); extern bool_t xdr_fattr4_dir_notif_delay(); extern bool_t xdr_fattr4_dirent_notif_delay(); extern bool_t xdr_fattr4_fs_layout_types(); extern bool_t xdr_fattr4_fs_status(); extern bool_t xdr_fattr4_fs_charset_cap(); extern bool_t xdr_fattr4_layout_alignment(); extern bool_t xdr_fattr4_layout_blksize(); extern bool_t xdr_fattr4_layout_hint(); extern bool_t xdr_fattr4_layout_types(); extern bool_t xdr_fattr4_mdsthreshold(); extern bool_t xdr_fattr4_retention_get(); extern bool_t xdr_fattr4_retention_set(); extern bool_t xdr_fattr4_retentevt_get(); extern bool_t xdr_fattr4_retentevt_set(); extern bool_t xdr_fattr4_retention_hold(); extern bool_t xdr_fattr4_dacl(); extern bool_t xdr_fattr4_sacl(); extern bool_t xdr_fattr4_change_policy(); extern bool_t xdr_fattr4_space_freed(); extern bool_t xdr_fattr4_change_attr_type(); extern bool_t xdr_fattr4_sec_label(); extern bool_t xdr_fattr4_clone_blksize(); extern bool_t xdr_fattr4(); extern bool_t xdr_change_info4(); extern bool_t xdr_clientaddr4(); extern bool_t xdr_cb_client4(); extern bool_t xdr_nfs_client_id4(); extern bool_t xdr_client_owner4(); extern bool_t xdr_server_owner4(); extern bool_t xdr_state_owner4(); extern bool_t xdr_open_owner4(); extern bool_t xdr_lock_owner4(); extern bool_t xdr_nfs_lock_type4(); extern bool_t xdr_ssv_subkey4(); extern bool_t xdr_ssv_mic_plain_tkn4(); extern bool_t xdr_ssv_mic_tkn4(); extern bool_t xdr_ssv_seal_plain_tkn4(); extern bool_t xdr_ssv_seal_cipher_tkn4(); extern bool_t xdr_fs_locations_server4(); extern bool_t xdr_fs_locations_item4(); extern bool_t xdr_fs_locations_info4(); extern bool_t xdr_fattr4_fs_locations_info(); extern bool_t xdr_nfl_util4(); extern bool_t xdr_filelayout_hint_care4(); extern bool_t xdr_nfsv4_1_file_layouthint4(); extern bool_t xdr_multipath_list4(); extern bool_t xdr_nfsv4_1_file_layout_ds_addr4(); extern bool_t xdr_nfsv4_1_file_layout4(); extern bool_t xdr_nfs_opnum4(); extern bool_t xdr_ACCESS4args(); extern bool_t xdr_ACCESS4resok(); extern bool_t xdr_ACCESS4res(); extern bool_t xdr_CLONE4args(); extern bool_t xdr_CLONE4res(); extern bool_t xdr_CLOSE4args(); extern bool_t xdr_CLOSE4res(); extern bool_t xdr_COMMIT4args(); extern bool_t xdr_COMMIT4resok(); extern bool_t xdr_COMMIT4res(); extern bool_t xdr_createtype4(); extern bool_t xdr_CREATE4args(); extern bool_t xdr_CREATE4resok(); extern bool_t xdr_CREATE4res(); extern bool_t xdr_DELEGPURGE4args(); extern bool_t xdr_DELEGPURGE4res(); extern bool_t xdr_DELEGRETURN4args(); extern bool_t xdr_DELEGRETURN4res(); extern bool_t xdr_GETATTR4args(); extern bool_t xdr_GETATTR4resok(); extern bool_t xdr_GETATTR4res(); extern bool_t xdr_GETFH4resok(); extern bool_t xdr_GETFH4res(); extern bool_t xdr_LINK4args(); extern bool_t xdr_LINK4resok(); extern bool_t xdr_LINK4res(); extern bool_t xdr_open_to_lock_owner4(); extern bool_t xdr_exist_lock_owner4(); extern bool_t xdr_locker4(); extern bool_t xdr_LOCK4args(); extern bool_t xdr_LOCK4denied(); extern bool_t xdr_LOCK4resok(); extern bool_t xdr_LOCK4res(); extern bool_t xdr_LOCKT4args(); extern bool_t xdr_LOCKT4res(); extern bool_t xdr_LOCKU4args(); extern bool_t xdr_LOCKU4res(); extern bool_t xdr_LOOKUP4args(); extern bool_t xdr_LOOKUP4res(); extern bool_t xdr_LOOKUPP4res(); extern bool_t xdr_NVERIFY4args(); extern bool_t xdr_NVERIFY4res(); extern bool_t xdr_createmode4(); extern bool_t xdr_creatverfattr(); extern bool_t xdr_createhow4(); extern bool_t xdr_opentype4(); extern bool_t xdr_openflag4(); extern bool_t xdr_limit_by4(); extern bool_t xdr_nfs_modified_limit4(); extern bool_t xdr_nfs_space_limit4(); extern bool_t xdr_open_delegation_type4(); extern bool_t xdr_open_claim_type4(); extern bool_t xdr_open_claim_delegate_cur4(); extern bool_t xdr_open_claim4(); extern bool_t xdr_OPEN4args(); extern bool_t xdr_open_read_delegation4(); extern bool_t xdr_open_write_delegation4(); extern bool_t xdr_why_no_delegation4(); extern bool_t xdr_open_none_delegation4(); extern bool_t xdr_open_delegation4(); extern bool_t xdr_OPEN4resok(); extern bool_t xdr_OPEN4res(); extern bool_t xdr_OPENATTR4args(); extern bool_t xdr_OPENATTR4res(); extern bool_t xdr_OPEN_CONFIRM4args(); extern bool_t xdr_OPEN_CONFIRM4resok(); extern bool_t xdr_OPEN_CONFIRM4res(); extern bool_t xdr_OPEN_DOWNGRADE4args(); extern bool_t xdr_OPEN_DOWNGRADE4resok(); extern bool_t xdr_OPEN_DOWNGRADE4res(); extern bool_t xdr_PUTFH4args(); extern bool_t xdr_PUTFH4res(); extern bool_t xdr_PUTPUBFH4res(); extern bool_t xdr_PUTROOTFH4res(); extern bool_t xdr_READ4args(); extern bool_t xdr_READ4resok(); extern bool_t xdr_READ4res(); extern bool_t xdr_READDIR4args(); extern bool_t xdr_entry4(); extern bool_t xdr_dirlist4(); extern bool_t xdr_READDIR4resok(); extern bool_t xdr_READDIR4res(); extern bool_t xdr_READLINK4resok(); extern bool_t xdr_READLINK4res(); extern bool_t xdr_REMOVE4args(); extern bool_t xdr_REMOVE4resok(); extern bool_t xdr_REMOVE4res(); extern bool_t xdr_RENAME4args(); extern bool_t xdr_RENAME4resok(); extern bool_t xdr_RENAME4res(); extern bool_t xdr_RENEW4args(); extern bool_t xdr_RENEW4res(); extern bool_t xdr_RESTOREFH4res(); extern bool_t xdr_SAVEFH4res(); extern bool_t xdr_SECINFO4args(); extern bool_t xdr_rpc_gss_svc_t(); extern bool_t xdr_rpcsec_gss_info(); extern bool_t xdr_secinfo4(); extern bool_t xdr_SECINFO4resok(); extern bool_t xdr_SECINFO4res(); extern bool_t xdr_SETATTR4args(); extern bool_t xdr_SETATTR4res(); extern bool_t xdr_SETCLIENTID4args(); extern bool_t xdr_SETCLIENTID4resok(); extern bool_t xdr_SETCLIENTID4res(); extern bool_t xdr_SETCLIENTID_CONFIRM4args(); extern bool_t xdr_SETCLIENTID_CONFIRM4res(); extern bool_t xdr_VERIFY4args(); extern bool_t xdr_VERIFY4res(); extern bool_t xdr_WRITE4args(); extern bool_t xdr_WRITE4resok(); extern bool_t xdr_WRITE4res(); extern bool_t xdr_RELEASE_LOCKOWNER4args(); extern bool_t xdr_RELEASE_LOCKOWNER4res(); extern bool_t xdr_ILLEGAL4res(); extern bool_t xdr_gsshandle4_t(); extern bool_t xdr_gss_cb_handles4(); extern bool_t xdr_callback_sec_parms4(); extern bool_t xdr_BACKCHANNEL_CTL4args(); extern bool_t xdr_BACKCHANNEL_CTL4res(); extern bool_t xdr_channel_dir_from_client4(); extern bool_t xdr_BIND_CONN_TO_SESSION4args(); extern bool_t xdr_channel_dir_from_server4(); extern bool_t xdr_BIND_CONN_TO_SESSION4resok(); extern bool_t xdr_BIND_CONN_TO_SESSION4res(); extern bool_t xdr_state_protect_ops4(); extern bool_t xdr_ssv_sp_parms4(); extern bool_t xdr_state_protect_how4(); extern bool_t xdr_state_protect4_a(); extern bool_t xdr_EXCHANGE_ID4args(); extern bool_t xdr_ssv_prot_info4(); extern bool_t xdr_state_protect4_r(); extern bool_t xdr_EXCHANGE_ID4resok(); extern bool_t xdr_EXCHANGE_ID4res(); extern bool_t xdr_channel_attrs4(); extern bool_t xdr_CREATE_SESSION4args(); extern bool_t xdr_CREATE_SESSION4resok(); extern bool_t xdr_CREATE_SESSION4res(); extern bool_t xdr_DESTROY_SESSION4args(); extern bool_t xdr_DESTROY_SESSION4res(); extern bool_t xdr_FREE_STATEID4args(); extern bool_t xdr_FREE_STATEID4res(); extern bool_t xdr_attr_notice4(); extern bool_t xdr_GET_DIR_DELEGATION4args(); extern bool_t xdr_GET_DIR_DELEGATION4resok(); extern bool_t xdr_gddrnf4_status(); extern bool_t xdr_GET_DIR_DELEGATION4res_non_fatal(); extern bool_t xdr_GET_DIR_DELEGATION4res(); extern bool_t xdr_GETDEVICEINFO4args(); extern bool_t xdr_GETDEVICEINFO4resok(); extern bool_t xdr_GETDEVICEINFO4res(); extern bool_t xdr_GETDEVICELIST4args(); extern bool_t xdr_GETDEVICELIST4resok(); extern bool_t xdr_GETDEVICELIST4res(); extern bool_t xdr_newtime4(); extern bool_t xdr_newoffset4(); extern bool_t xdr_LAYOUTCOMMIT4args(); extern bool_t xdr_newsize4(); extern bool_t xdr_LAYOUTCOMMIT4resok(); extern bool_t xdr_LAYOUTCOMMIT4res(); extern bool_t xdr_LAYOUTGET4args(); extern bool_t xdr_LAYOUTGET4resok(); extern bool_t xdr_LAYOUTGET4res(); extern bool_t xdr_LAYOUTRETURN4args(); extern bool_t xdr_layoutreturn_stateid(); extern bool_t xdr_LAYOUTRETURN4res(); extern bool_t xdr_secinfo_style4(); extern bool_t xdr_SECINFO_NO_NAME4args(); extern bool_t xdr_SECINFO_NO_NAME4res(); extern bool_t xdr_SEQUENCE4args(); extern bool_t xdr_SEQUENCE4resok(); extern bool_t xdr_SEQUENCE4res(); extern bool_t xdr_ssa_digest_input4(); extern bool_t xdr_SET_SSV4args(); extern bool_t xdr_ssr_digest_input4(); extern bool_t xdr_SET_SSV4resok(); extern bool_t xdr_SET_SSV4res(); extern bool_t xdr_TEST_STATEID4args(); extern bool_t xdr_TEST_STATEID4resok(); extern bool_t xdr_TEST_STATEID4res(); extern bool_t xdr_deleg_claim4(); extern bool_t xdr_WANT_DELEGATION4args(); extern bool_t xdr_WANT_DELEGATION4res(); extern bool_t xdr_DESTROY_CLIENTID4args(); extern bool_t xdr_DESTROY_CLIENTID4res(); extern bool_t xdr_RECLAIM_COMPLETE4args(); extern bool_t xdr_RECLAIM_COMPLETE4res(); extern bool_t xdr_COPY4args(); extern bool_t xdr_copy_requirements4(); extern bool_t xdr_COPY4resok(); extern bool_t xdr_COPY4res(); extern bool_t xdr_COPY_NOTIFY4args(); extern bool_t xdr_COPY_NOTIFY4resok(); extern bool_t xdr_COPY_NOTIFY4res(); extern bool_t xdr_OFFLOAD_CANCEL4args(); extern bool_t xdr_OFFLOAD_CANCEL4res(); extern bool_t xdr_OFFLOAD_STATUS4args(); extern bool_t xdr_OFFLOAD_STATUS4resok(); extern bool_t xdr_OFFLOAD_STATUS4res(); extern bool_t xdr_ALLOCATE4args(); extern bool_t xdr_ALLOCATE4res(); extern bool_t xdr_DEALLOCATE4args(); extern bool_t xdr_DEALLOCATE4res(); extern bool_t xdr_IO_ADVISE_type4(); extern bool_t xdr_IO_ADVISE4args(); extern bool_t xdr_IO_ADVISE4resok(); extern bool_t xdr_IO_ADVISE4res(); extern bool_t xdr_device_error4(); extern bool_t xdr_LAYOUTERROR4args(); extern bool_t xdr_LAYOUTERROR4res(); extern bool_t xdr_io_info4(); extern bool_t xdr_LAYOUTSTATS4args(); extern bool_t xdr_LAYOUTSTATS4res(); extern bool_t xdr_READ_PLUS4args(); extern bool_t xdr_read_plus_content(); extern bool_t xdr_read_plus_res4(); extern bool_t xdr_READ_PLUS4res(); extern bool_t xdr_SEEK4args(); extern bool_t xdr_seek_res4(); extern bool_t xdr_SEEK4res(); extern bool_t xdr_WRITE_SAME4args(); extern bool_t xdr_WRITE_SAME4res(); extern bool_t xdr_nfs_argop4(); extern bool_t xdr_nfs_resop4(); extern bool_t xdr_COMPOUND4args(); extern bool_t xdr_COMPOUND4res(); extern bool_t xdr_CB_GETATTR4args(); extern bool_t xdr_CB_GETATTR4resok(); extern bool_t xdr_CB_GETATTR4res(); extern bool_t xdr_CB_RECALL4args(); extern bool_t xdr_CB_RECALL4res(); extern bool_t xdr_CB_ILLEGAL4res(); extern bool_t xdr_layoutrecall_type4(); extern bool_t xdr_layoutrecall_file4(); extern bool_t xdr_layoutrecall4(); extern bool_t xdr_CB_LAYOUTRECALL4args(); extern bool_t xdr_CB_LAYOUTRECALL4res(); extern bool_t xdr_notify_type4(); extern bool_t xdr_notify_entry4(); extern bool_t xdr_prev_entry4(); extern bool_t xdr_notify_remove4(); extern bool_t xdr_notify_add4(); extern bool_t xdr_notify_attr4(); extern bool_t xdr_notify_rename4(); extern bool_t xdr_notify_verifier4(); extern bool_t xdr_notifylist4(); extern bool_t xdr_notify4(); extern bool_t xdr_CB_NOTIFY4args(); extern bool_t xdr_CB_NOTIFY4res(); extern bool_t xdr_CB_PUSH_DELEG4args(); extern bool_t xdr_CB_PUSH_DELEG4res(); extern bool_t xdr_CB_RECALL_ANY4args(); extern bool_t xdr_CB_RECALL_ANY4res(); extern bool_t xdr_CB_RECALLABLE_OBJ_AVAIL4args(); extern bool_t xdr_CB_RECALLABLE_OBJ_AVAIL4res(); extern bool_t xdr_CB_RECALL_SLOT4args(); extern bool_t xdr_CB_RECALL_SLOT4res(); extern bool_t xdr_referring_call4(); extern bool_t xdr_referring_call_list4(); extern bool_t xdr_CB_SEQUENCE4args(); extern bool_t xdr_CB_SEQUENCE4resok(); extern bool_t xdr_CB_SEQUENCE4res(); extern bool_t xdr_CB_WANTS_CANCELLED4args(); extern bool_t xdr_CB_WANTS_CANCELLED4res(); extern bool_t xdr_CB_NOTIFY_LOCK4args(); extern bool_t xdr_CB_NOTIFY_LOCK4res(); extern bool_t xdr_notify_deviceid_type4(); extern bool_t xdr_notify_deviceid_delete4(); extern bool_t xdr_notify_deviceid_change4(); extern bool_t xdr_CB_NOTIFY_DEVICEID4args(); extern bool_t xdr_CB_NOTIFY_DEVICEID4res(); extern bool_t xdr_offload_info4(); extern bool_t xdr_CB_OFFLOAD4args(); extern bool_t xdr_CB_OFFLOAD4res(); extern bool_t xdr_nfs_cb_opnum4(); extern bool_t xdr_nfs_cb_argop4(); extern bool_t xdr_nfs_cb_resop4(); extern bool_t xdr_CB_COMPOUND4args(); extern bool_t xdr_CB_COMPOUND4res(); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_NFS4_PROT_H_RPCGEN */ /* * This file was machine generated for [RFC7862]. * * Last updated Sun Mar 13 10:58:40 PDT 2016 */ /* * Copyright (c) 2016 IETF Trust and the persons identified * as the authors. All rights reserved. * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the * following conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * - 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. * * - Neither the name of Internet Society, IETF or IETF * Trust, nor the names of specific contributors, may be * used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS * 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 COPYRIGHT OWNER 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. */ /* * This code was derived from RFC 7863. */ /* * nfsv42.x */ %#ifndef _AUTH_SYS_DEFINE_FOR_NFSv42 %#define _AUTH_SYS_DEFINE_FOR_NFSv42 %#include %typedef struct authsys_parms authsys_parms; %#endif /* _AUTH_SYS_DEFINE_FOR_NFSv42 */ /* * 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_OTHER_SIZE = 12; const NFS4_OPAQUE_LIMIT = 1024; const NFS4_SESSIONID_SIZE = 16; const NFS4_INT64_MAX = 0x7fffffffffffffff; const NFS4_UINT64_MAX = 0xffffffffffffffff; const NFS4_INT32_MAX = 0x7fffffff; const NFS4_UINT32_MAX = 0xffffffff; const NFS4_MAXFILELEN = 0xffffffffffffffff; const NFS4_MAXFILEOFF = 0xfffffffffffffffe; /* * 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 file systems */ /* * Please do not allocate value 19; it was used in NFSv3, * and we do not want a value in NFSv3 to have a different * meaning in NFSv4.x. */ NFS4ERR_NOTDIR = 20, /* should be a directory */ NFS4ERR_ISDIR = 21, /* should not be a directory */ NFS4ERR_INVAL = 22, /* invalid argument */ NFS4ERR_FBIG = 27, /* file exceeds server max */ NFS4ERR_NOSPC = 28, /* no space on file system */ NFS4ERR_ROFS = 30, /* read-only file system */ 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, /* client ID in use */ /* NFS4ERR_RESOURCE is not a valid error in NFSv4.1. */ NFS4ERR_RESOURCE = 10018, /* resource exhaustion */ NFS4ERR_MOVED = 10019, /* file system 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, /* overlapping lock range */ NFS4ERR_SYMLINK = 10029, /* should be file/directory */ NFS4ERR_RESTOREFH = 10030, /* no saved filehandle */ NFS4ERR_LEASE_MOVED = 10031, /* some file system moved */ NFS4ERR_ATTRNOTSUPP = 10032, /* recommended attr not supp */ 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, /* lock-owner state revoked */ NFS4ERR_CB_PATH_DOWN = 10048, /* callback path down */ /* NFSv4.1 errors start here. */ NFS4ERR_BADIOMODE = 10049, NFS4ERR_BADLAYOUT = 10050, NFS4ERR_BAD_SESSION_DIGEST = 10051, NFS4ERR_BADSESSION = 10052, NFS4ERR_BADSLOT = 10053, NFS4ERR_COMPLETE_ALREADY = 10054, NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055, NFS4ERR_DELEG_ALREADY_WANTED = 10056, NFS4ERR_BACK_CHAN_BUSY = 10057, /* backchan reqs outstanding */ NFS4ERR_LAYOUTTRYLATER = 10058, NFS4ERR_LAYOUTUNAVAILABLE = 10059, NFS4ERR_NOMATCHING_LAYOUT = 10060, NFS4ERR_RECALLCONFLICT = 10061, NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062, NFS4ERR_SEQ_MISORDERED = 10063, /* unexpected seq. ID in req */ NFS4ERR_SEQUENCE_POS = 10064, /* [CB_]SEQ. op not 1st op */ NFS4ERR_REQ_TOO_BIG = 10065, /* request too big */ NFS4ERR_REP_TOO_BIG = 10066, /* reply too big */ NFS4ERR_REP_TOO_BIG_TO_CACHE =10067, /* rep. not all cached */ NFS4ERR_RETRY_UNCACHED_REP =10068, /* retry + rep. uncached */ NFS4ERR_UNSAFE_COMPOUND =10069, /* retry/recovery too hard */ NFS4ERR_TOO_MANY_OPS = 10070, /* too many ops in [CB_]COMP */ NFS4ERR_OP_NOT_IN_SESSION =10071, /* op needs [CB_]SEQ. op */ NFS4ERR_HASH_ALG_UNSUPP = 10072, /* hash alg. not supp */ /* Error 10073 is unused. */ NFS4ERR_CLIENTID_BUSY = 10074, /* client ID has state */ NFS4ERR_PNFS_IO_HOLE = 10075, /* IO to _SPARSE file hole */ NFS4ERR_SEQ_FALSE_RETRY= 10076, /* retry != original req */ NFS4ERR_BAD_HIGH_SLOT = 10077, /* req has bad highest_slot */ NFS4ERR_DEADSESSION = 10078, /* new req sent to dead sess */ NFS4ERR_ENCR_ALG_UNSUPP= 10079, /* encr alg. not supp */ NFS4ERR_PNFS_NO_LAYOUT = 10080, /* I/O without a layout */ NFS4ERR_NOT_ONLY_OP = 10081, /* addl ops not allowed */ NFS4ERR_WRONG_CRED = 10082, /* op done by wrong cred */ NFS4ERR_WRONG_TYPE = 10083, /* op on wrong type object */ NFS4ERR_DIRDELEG_UNAVAIL=10084, /* delegation not avail. */ NFS4ERR_REJECT_DELEG = 10085, /* cb rejected delegation */ NFS4ERR_RETURNCONFLICT = 10086, /* layout get before return */ NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ /* NFSv4.2 errors start here. */ NFS4ERR_PARTNER_NOTSUPP= 10088, /* s2s not supported */ NFS4ERR_PARTNER_NO_AUTH= 10089, /* s2s not authorized */ NFS4ERR_UNION_NOTSUPP = 10090, /* arm of union not supp */ NFS4ERR_OFFLOAD_DENIED = 10091, /* dest not allowing copy */ NFS4ERR_WRONG_LFS = 10092, /* LFS not supported */ NFS4ERR_BADLABEL = 10093, /* incorrect label */ NFS4ERR_OFFLOAD_NO_REQS= 10094 /* dest not meeting reqs */ }; /* * Basic data types */ typedef opaque attrlist4<>; typedef uint32_t bitmap4<>; typedef uint64_t changeid4; typedef uint64_t clientid4; typedef uint32_t count4; typedef uint64_t length4; typedef uint32_t mode4; typedef uint64_t nfs_cookie4; typedef opaque nfs_fh4; typedef uint64_t offset4; typedef uint32_t qop4; typedef opaque sec_oid4<>; typedef uint32_t sequenceid4; typedef uint32_t seqid4; typedef opaque sessionid4[NFS4_SESSIONID_SIZE]; typedef uint32_t slotid4; typedef opaque utf8string<>; typedef utf8string utf8str_cis; typedef utf8string utf8str_cs; typedef utf8string utf8str_mixed; typedef utf8str_cs component4; typedef opaque linktext4<>; typedef utf8string ascii_REQUIRED4; typedef component4 pathname4<>; typedef opaque verifier4[NFS4_VERIFIER_SIZE]; typedef string secret4<>; typedef uint32_t policy4; /* * 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; }; typedef uint32_t nfs_lease4; /* * File attribute definitions */ /* * File System ID (FSID) structure for major/minor */ struct fsid4 { uint64_t major; uint64_t minor; }; /* * File system locations attribute * for relocation/migration and * related attributes */ struct change_policy4 { uint64_t cp_major; uint64_t cp_minor; }; struct fs_location4 { utf8str_cis server<>; pathname4 rootpath; }; struct fs_locations4 { pathname4 fs_root; fs_location4 locations<>; }; /* * Various Access Control Entry (ACE) definitions */ /* * Mask that indicates which ACEs 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; const ACE4_INHERITED_ACE = 0x00000080; /* * 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_WRITE_RETENTION = 0x00000200; const ACE4_WRITE_RETENTION_HOLD = 0x00000400; 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 a combination of * ACE4_READ_ACL | * ACE4_READ_DATA | * ACE4_READ_ATTRIBUTES | * ACE4_SYNCHRONIZE */ const ACE4_GENERIC_READ = 0x00120081; /* * ACE4_GENERIC_WRITE -- defined as a 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 a combination of * ACE4_READ_ACL | * ACE4_READ_ATTRIBUTES | * ACE4_EXECUTE | * ACE4_SYNCHRONIZE */ const ACE4_GENERIC_EXECUTE = 0x001200A0; /* * ACE definition */ struct nfsace4 { acetype4 type; aceflag4 flag; acemask4 access_mask; utf8str_mixed who; }; /* * Access Control List (ACL) flag */ typedef uint32_t aclflag4; /* * ACL flag values */ const ACL4_AUTO_INHERIT = 0x00000001; const ACL4_PROTECTED = 0x00000002; const ACL4_DEFAULTED = 0x00000004; /* * Version 4.1 ACL definition */ struct nfsacl41 { aclflag4 na41_flag; nfsace4 na41_aces<>; }; /* * Field definitions for the fattr4_mode * and fattr4_mode_set_masked attributes */ 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 */ /* * Masked mode for the mode_set_masked attribute */ struct mode_masked4 { mode4 mm_value_to_set; /* Values of bits to set or reset in mode */ mode4 mm_mask_bits; /* Mask of bits to set or reset in mode */ }; /* * 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; struct netaddr4 { /* See struct rpcb in RFC 1833. */ string na_r_netid<>; /* Network id */ string na_r_addr<>; /* Universal address */ }; /* * Data structures new to NFSv4.1 */ struct nfs_impl_id4 { utf8str_cis nii_domain; utf8str_cs nii_name; nfstime4 nii_date; }; /* * Stateid */ struct stateid4 { uint32_t seqid; opaque other[NFS4_OTHER_SIZE]; }; enum layouttype4 { LAYOUT4_NFSV4_1_FILES = 0x1, LAYOUT4_OSD2_OBJECTS = 0x2, LAYOUT4_BLOCK_VOLUME = 0x3 }; struct layout_content4 { layouttype4 loc_type; opaque loc_body<>; }; %/* % * LAYOUT4_OSD2_OBJECTS loc_body description % * is in a separate .x file. % */ % %/* % * LAYOUT4_BLOCK_VOLUME loc_body description % * is in a separate .x file. % */ struct layouthint4 { layouttype4 loh_type; opaque loh_body<>; }; enum layoutiomode4 { LAYOUTIOMODE4_READ = 1, LAYOUTIOMODE4_RW = 2, LAYOUTIOMODE4_ANY = 3 }; struct layout4 { offset4 lo_offset; length4 lo_length; layoutiomode4 lo_iomode; layout_content4 lo_content; }; const NFS4_DEVICEID4_SIZE = 16; typedef opaque deviceid4[NFS4_DEVICEID4_SIZE]; struct device_addr4 { layouttype4 da_layout_type; opaque da_addr_body<>; }; struct layoutupdate4 { layouttype4 lou_type; opaque lou_body<>; }; % /* Constants used for LAYOUTRETURN and CB_LAYOUTRECALL */ const LAYOUT4_RET_REC_FILE = 1; const LAYOUT4_RET_REC_FSID = 2; const LAYOUT4_RET_REC_ALL = 3; % enum layoutreturn_type4 { LAYOUTRETURN4_FILE = LAYOUT4_RET_REC_FILE, LAYOUTRETURN4_FSID = LAYOUT4_RET_REC_FSID, LAYOUTRETURN4_ALL = LAYOUT4_RET_REC_ALL }; struct layoutreturn_file4 { offset4 lrf_offset; length4 lrf_length; stateid4 lrf_stateid; % /* layouttype4 specific data */ opaque lrf_body<>; }; union layoutreturn4 switch (layoutreturn_type4 lr_returntype) { case LAYOUTRETURN4_FILE: layoutreturn_file4 lr_layout; default: void; }; % enum fs4_status_type { STATUS4_FIXED = 1, STATUS4_UPDATED = 2, STATUS4_VERSIONED = 3, STATUS4_WRITABLE = 4, STATUS4_REFERRAL = 5 }; struct fs4_status { bool fss_absent; fs4_status_type fss_type; utf8str_cs fss_source; utf8str_cs fss_current; int32_t fss_age; nfstime4 fss_version; }; const TH4_READ_SIZE = 0; const TH4_WRITE_SIZE = 1; const TH4_READ_IOSIZE = 2; const TH4_WRITE_IOSIZE = 3; typedef length4 threshold4_read_size; typedef length4 threshold4_write_size; typedef length4 threshold4_read_iosize; typedef length4 threshold4_write_iosize; struct threshold_item4 { layouttype4 thi_layout_type; bitmap4 thi_hintset; opaque thi_hintlist<>; }; struct mdsthreshold4 { threshold_item4 mth_hints<>; }; const RET4_DURATION_INFINITE = 0xffffffffffffffff; struct retention_get4 { uint64_t rg_duration; nfstime4 rg_begin_time<1>; }; struct retention_set4 { bool rs_enable; uint64_t rs_duration<1>; }; const FSCHARSET_CAP4_CONTAINS_NON_UTF8 = 0x1; const FSCHARSET_CAP4_ALLOWS_ONLY_UTF8 = 0x2; typedef uint32_t fs_charset_cap4; /* * Data structures new to NFSv4.2 */ enum netloc_type4 { NL4_NAME = 1, NL4_URL = 2, NL4_NETADDR = 3 }; union netloc4 switch (netloc_type4 nl_type) { case NL4_NAME: utf8str_cis nl_name; case NL4_URL: utf8str_cis nl_url; case NL4_NETADDR: netaddr4 nl_addr; }; enum change_attr_type4 { NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR = 0, NFS4_CHANGE_TYPE_IS_VERSION_COUNTER = 1, NFS4_CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS = 2, NFS4_CHANGE_TYPE_IS_TIME_METADATA = 3, NFS4_CHANGE_TYPE_IS_UNDEFINED = 4 }; struct labelformat_spec4 { policy4 lfs_lfs; policy4 lfs_pi; }; struct sec_label4 { labelformat_spec4 slai_lfs; opaque slai_data<>; }; struct copy_from_auth_priv { secret4 cfap_shared_secret; netloc4 cfap_destination; /* The NFSv4 user name that the user principal maps to */ utf8str_mixed cfap_username; }; struct copy_to_auth_priv { /* Equal to cfap_shared_secret */ secret4 ctap_shared_secret; netloc4 ctap_source<>; /* The NFSv4 user name that the user principal maps to */ utf8str_mixed ctap_username; }; struct copy_confirm_auth_priv { /* Equal to GSS_GetMIC() of cfap_shared_secret */ opaque ccap_shared_secret_mic<>; /* The NFSv4 user name that the user principal maps to */ utf8str_mixed ccap_username; }; struct app_data_block4 { offset4 adb_offset; length4 adb_block_size; length4 adb_block_count; length4 adb_reloff_blocknum; count4 adb_block_num; length4 adb_reloff_pattern; opaque adb_pattern<>; }; struct data4 { offset4 d_offset; opaque d_data<>; }; struct data_info4 { offset4 di_offset; length4 di_length; }; enum data_content4 { NFS4_CONTENT_DATA = 0, NFS4_CONTENT_HOLE = 1 }; enum stable_how4 { UNSTABLE4 = 0, DATA_SYNC4 = 1, FILE_SYNC4 = 2 }; struct write_response4 { stateid4 wr_callback_id<1>; length4 wr_count; stable_how4 wr_committed; verifier4 wr_writeverf; }; /* * NFSv4.1 attributes */ 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 nfs_lease4 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 ascii_REQUIRED4 fattr4_mimetype; typedef mode4 fattr4_mode; typedef mode_masked4 fattr4_mode_set_masked; 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 length4 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; /* * Attributes new to NFSv4.1 */ typedef bitmap4 fattr4_suppattr_exclcreat; typedef nfstime4 fattr4_dir_notif_delay; typedef nfstime4 fattr4_dirent_notif_delay; typedef layouttype4 fattr4_fs_layout_types<>; typedef fs4_status fattr4_fs_status; typedef fs_charset_cap4 fattr4_fs_charset_cap; typedef uint32_t fattr4_layout_alignment; typedef uint32_t fattr4_layout_blksize; typedef layouthint4 fattr4_layout_hint; typedef layouttype4 fattr4_layout_types<>; typedef mdsthreshold4 fattr4_mdsthreshold; typedef retention_get4 fattr4_retention_get; typedef retention_set4 fattr4_retention_set; typedef retention_get4 fattr4_retentevt_get; typedef retention_set4 fattr4_retentevt_set; typedef uint64_t fattr4_retention_hold; typedef nfsacl41 fattr4_dacl; typedef nfsacl41 fattr4_sacl; typedef change_policy4 fattr4_change_policy; /* * Attributes new to NFSv4.2 */ typedef uint64_t fattr4_space_freed; typedef change_attr_type4 fattr4_change_attr_type; typedef sec_label4 fattr4_sec_label; typedef uint32_t fattr4_clone_blksize; %/* % * REQUIRED 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; %/* % * New to NFSv4.1 % */ const FATTR4_SUPPATTR_EXCLCREAT = 75; %/* % * 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; %/* % * New to NFSv4.1 % */ const FATTR4_DIR_NOTIF_DELAY = 56; const FATTR4_DIRENT_NOTIF_DELAY = 57; const FATTR4_DACL = 58; const FATTR4_SACL = 59; const FATTR4_CHANGE_POLICY = 60; const FATTR4_FS_STATUS = 61; const FATTR4_FS_LAYOUT_TYPES = 62; const FATTR4_LAYOUT_HINT = 63; const FATTR4_LAYOUT_TYPES = 64; const FATTR4_LAYOUT_BLKSIZE = 65; const FATTR4_LAYOUT_ALIGNMENT = 66; const FATTR4_FS_LOCATIONS_INFO = 67; const FATTR4_MDSTHRESHOLD = 68; const FATTR4_RETENTION_GET = 69; const FATTR4_RETENTION_SET = 70; const FATTR4_RETENTEVT_GET = 71; const FATTR4_RETENTEVT_SET = 72; const FATTR4_RETENTION_HOLD = 73; const FATTR4_MODE_SET_MASKED = 74; const FATTR4_FS_CHARSET_CAP = 76; %/* % * New to NFSv4.2 % */ const FATTR4_CLONE_BLKSIZE = 77; const FATTR4_SPACE_FREED = 78; const FATTR4_CHANGE_ATTR_TYPE = 79; const FATTR4_SEC_LABEL = 80; /* * File attribute container */ struct fattr4 { bitmap4 attrmask; attrlist4 attr_vals; }; /* * Change info for the client */ struct change_info4 { bool atomic; changeid4 before; changeid4 after; }; typedef netaddr4 clientaddr4; /* * Callback program info as provided by the client */ struct cb_client4 { uint32_t cb_program; netaddr4 cb_location; }; /* * NFSv4.0 long-hand client ID */ struct nfs_client_id4 { verifier4 verifier; opaque id; }; /* * NFSv4.1 client owner (aka long-hand client ID) */ struct client_owner4 { verifier4 co_verifier; opaque co_ownerid; }; /* * NFSv4.1 server owner */ struct server_owner4 { uint64_t so_minor_id; opaque so_major_id; }; struct state_owner4 { clientid4 clientid; opaque owner; }; typedef state_owner4 open_owner4; typedef state_owner4 lock_owner4; enum nfs_lock_type4 { READ_LT = 1, WRITE_LT = 2, READW_LT = 3, /* Blocking read */ WRITEW_LT = 4 /* Blocking write */ }; % %/* Input for computing subkeys */ enum ssv_subkey4 { SSV4_SUBKEY_MIC_I2T = 1, SSV4_SUBKEY_MIC_T2I = 2, SSV4_SUBKEY_SEAL_I2T = 3, SSV4_SUBKEY_SEAL_T2I = 4 }; % % %/* Input for computing smt_hmac */ struct ssv_mic_plain_tkn4 { uint32_t smpt_ssv_seq; opaque smpt_orig_plain<>; }; % % %/* % * Secret State Verifier Generic Security Service (SSV GSS) % * PerMsgToken token % */ struct ssv_mic_tkn4 { uint32_t smt_ssv_seq; opaque smt_hmac<>; }; % % %/* Input for computing ssct_encr_data and ssct_hmac */ struct ssv_seal_plain_tkn4 { opaque sspt_confounder<>; uint32_t sspt_ssv_seq; opaque sspt_orig_plain<>; opaque sspt_pad<>; }; % % %/* SSV GSS SealedMessage token */ struct ssv_seal_cipher_tkn4 { uint32_t ssct_ssv_seq; opaque ssct_iv<>; opaque ssct_encr_data<>; opaque ssct_hmac<>; }; % /* * Defines an individual server replica */ struct fs_locations_server4 { int32_t fls_currency; opaque fls_info<>; utf8str_cis fls_server; }; /* * Byte indices of items within * fls_info: flag fields, class numbers, * bytes indicating ranks and orders */ const FSLI4BX_GFLAGS = 0; const FSLI4BX_TFLAGS = 1; const FSLI4BX_CLSIMUL = 2; const FSLI4BX_CLHANDLE = 3; const FSLI4BX_CLFILEID = 4; const FSLI4BX_CLWRITEVER = 5; const FSLI4BX_CLCHANGE = 6; const FSLI4BX_CLREADDIR = 7; const FSLI4BX_READRANK = 8; const FSLI4BX_WRITERANK = 9; const FSLI4BX_READORDER = 10; const FSLI4BX_WRITEORDER = 11; /* * Bits defined within the general flag byte */ const FSLI4GF_WRITABLE = 0x01; const FSLI4GF_CUR_REQ = 0x02; const FSLI4GF_ABSENT = 0x04; const FSLI4GF_GOING = 0x08; const FSLI4GF_SPLIT = 0x10; /* * Bits defined within the transport flag byte */ const FSLI4TF_RDMA = 0x01; /* * Defines a set of replicas sharing * a common value of the root path * within the corresponding * single-server namespaces */ struct fs_locations_item4 { fs_locations_server4 fli_entries<>; pathname4 fli_rootpath; }; /* * Defines the overall structure of * the fs_locations_info attribute */ struct fs_locations_info4 { uint32_t fli_flags; int32_t fli_valid_for; pathname4 fli_fs_root; fs_locations_item4 fli_items<>; }; /* * Flag bits in fli_flags */ const FSLI4IF_VAR_SUB = 0x00000001; typedef fs_locations_info4 fattr4_fs_locations_info; const NFL4_UFLG_MASK = 0x0000003F; const NFL4_UFLG_DENSE = 0x00000001; const NFL4_UFLG_COMMIT_THRU_MDS = 0x00000002; const NFL42_UFLG_IO_ADVISE_THRU_MDS = 0x00000004; const NFL4_UFLG_STRIPE_UNIT_SIZE_MASK = 0xFFFFFFC0; typedef uint32_t nfl_util4; % enum filelayout_hint_care4 { NFLH4_CARE_DENSE = NFL4_UFLG_DENSE, NFLH4_CARE_COMMIT_THRU_MDS = NFL4_UFLG_COMMIT_THRU_MDS, NFL42_CARE_IO_ADVISE_THRU_MDS = NFL42_UFLG_IO_ADVISE_THRU_MDS, NFLH4_CARE_STRIPE_UNIT_SIZE = 0x00000040, NFLH4_CARE_STRIPE_COUNT = 0x00000080 }; % %/* % * Encoded in the loh_body field of data type layouthint4: % */ % struct nfsv4_1_file_layouthint4 { uint32_t nflh_care; nfl_util4 nflh_util; count4 nflh_stripe_count; }; % % typedef netaddr4 multipath_list4<>; % %/* % * Encoded in the da_addr_body field of data type device_addr4: % */ struct nfsv4_1_file_layout_ds_addr4 { uint32_t nflda_stripe_indices<>; multipath_list4 nflda_multipath_ds_list<>; }; % % %/* % * Encoded in the loc_body field of data type layout_content4: % */ struct nfsv4_1_file_layout4 { deviceid4 nfl_deviceid; nfl_util4 nfl_util; uint32_t nfl_first_stripe_index; offset4 nfl_pattern_offset; nfs_fh4 nfl_fh_list<>; }; % /* * Operation arrays (the opnum first) */ 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, /* Mandatory not-to-implement */ 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, /* Mandatory not-to-implement */ OP_RESTOREFH = 31, OP_SAVEFH = 32, OP_SECINFO = 33, OP_SETATTR = 34, OP_SETCLIENTID = 35, /* Mandatory not-to-implement */ OP_SETCLIENTID_CONFIRM = 36, /* Mandatory not-to-implement */ OP_VERIFY = 37, OP_WRITE = 38, OP_RELEASE_LOCKOWNER = 39, /* Mandatory not-to-implement */ % %/* New operations for NFSv4.1 */ % OP_BACKCHANNEL_CTL = 40, OP_BIND_CONN_TO_SESSION = 41, OP_EXCHANGE_ID = 42, OP_CREATE_SESSION = 43, OP_DESTROY_SESSION = 44, OP_FREE_STATEID = 45, OP_GET_DIR_DELEGATION = 46, OP_GETDEVICEINFO = 47, OP_GETDEVICELIST = 48, OP_LAYOUTCOMMIT = 49, OP_LAYOUTGET = 50, OP_LAYOUTRETURN = 51, OP_SECINFO_NO_NAME = 52, OP_SEQUENCE = 53, OP_SET_SSV = 54, OP_TEST_STATEID = 55, OP_WANT_DELEGATION = 56, OP_DESTROY_CLIENTID = 57, OP_RECLAIM_COMPLETE = 58, % %/* New operations for NFSv4.2 */ % OP_ALLOCATE = 59, OP_COPY = 60, OP_COPY_NOTIFY = 61, OP_DEALLOCATE = 62, OP_IO_ADVISE = 63, OP_LAYOUTERROR = 64, OP_LAYOUTSTATS = 65, OP_OFFLOAD_CANCEL = 66, OP_OFFLOAD_STATUS = 67, OP_READ_PLUS = 68, OP_SEEK = 69, OP_WRITE_SAME = 70, OP_CLONE = 71, OP_ILLEGAL = 10044 }; 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; }; struct CLONE4args { /* SAVED_FH: source file */ /* CURRENT_FH: destination file */ stateid4 cl_src_stateid; stateid4 cl_dst_stateid; offset4 cl_src_offset; offset4 cl_dst_offset; length4 cl_count; }; struct CLONE4res { nfsstat4 cl_status; }; struct CLOSE4args { /* CURRENT_FH: object */ seqid4 seqid; stateid4 open_stateid; }; union CLOSE4res switch (nfsstat4 status) { case NFS4_OK: stateid4 open_stateid; default: void; }; 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; }; 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: /* New CURRENTFH: created object */ CREATE4resok resok4; default: void; }; struct DELEGPURGE4args { clientid4 clientid; }; struct DELEGPURGE4res { nfsstat4 status; }; struct DELEGRETURN4args { /* CURRENT_FH: delegated object */ stateid4 deleg_stateid; }; struct DELEGRETURN4res { nfsstat4 status; }; struct GETATTR4args { /* CURRENT_FH: object */ bitmap4 attr_request; }; struct GETATTR4resok { fattr4 obj_attributes; }; union GETATTR4res switch (nfsstat4 status) { case NFS4_OK: GETATTR4resok resok4; default: void; }; struct GETFH4resok { nfs_fh4 object; }; union GETFH4res switch (nfsstat4 status) { case NFS4_OK: GETFH4resok resok4; default: void; }; 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_stateid and lock_owner * to a lock stateid. */ struct open_to_lock_owner4 { seqid4 open_seqid; stateid4 open_stateid; seqid4 lock_seqid; lock_owner4 lock_owner; }; /* * For LOCK, existing lock stateid continues to request new * file lock for the same lock_owner and open_stateid. */ 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; }; struct LOOKUP4args { /* CURRENT_FH: directory */ component4 objname; }; struct LOOKUP4res { /* New CURRENT_FH: object */ nfsstat4 status; }; struct LOOKUPP4res { /* New CURRENT_FH: parent directory */ nfsstat4 status; }; struct NVERIFY4args { /* CURRENT_FH: object */ fattr4 obj_attributes; }; struct NVERIFY4res { nfsstat4 status; }; /* * Various definitions for OPEN */ enum createmode4 { UNCHECKED4 = 0, GUARDED4 = 1, /* Deprecated in NFSv4.1 */ EXCLUSIVE4 = 2, /* * New to NFSv4.1. If session is persistent, * GUARDED4 MUST be used. Otherwise, use * EXCLUSIVE4_1 instead of EXCLUSIVE4. */ EXCLUSIVE4_1 = 3 }; struct creatverfattr { verifier4 cva_verf; fattr4 cva_attrs; }; union createhow4 switch (createmode4 mode) { case UNCHECKED4: case GUARDED4: fattr4 createattrs; case EXCLUSIVE4: verifier4 createverf; case EXCLUSIVE4_1: creatverfattr ch_createboth; }; 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; /* New flags for share_access field of OPEN4args */ const OPEN4_SHARE_ACCESS_WANT_DELEG_MASK = 0xFF00; const OPEN4_SHARE_ACCESS_WANT_NO_PREFERENCE = 0x0000; const OPEN4_SHARE_ACCESS_WANT_READ_DELEG = 0x0100; const OPEN4_SHARE_ACCESS_WANT_WRITE_DELEG = 0x0200; const OPEN4_SHARE_ACCESS_WANT_ANY_DELEG = 0x0300; const OPEN4_SHARE_ACCESS_WANT_NO_DELEG = 0x0400; const OPEN4_SHARE_ACCESS_WANT_CANCEL = 0x0500; const OPEN4_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL = 0x10000; const OPEN4_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED = 0x20000; enum open_delegation_type4 { OPEN_DELEGATE_NONE = 0, OPEN_DELEGATE_READ = 1, OPEN_DELEGATE_WRITE = 2, OPEN_DELEGATE_NONE_EXT = 3 /* New to NFSv4.1 */ }; enum open_claim_type4 { /* * Not a reclaim */ CLAIM_NULL = 0, CLAIM_PREVIOUS = 1, CLAIM_DELEGATE_CUR = 2, CLAIM_DELEGATE_PREV = 3, /* * Not a reclaim * * Like CLAIM_NULL, but object identified * by the current filehandle */ CLAIM_FH = 4, /* New to NFSv4.1 */ /* * Like CLAIM_DELEGATE_CUR, but object identified * by current filehandle */ CLAIM_DELEG_CUR_FH = 5, /* New to NFSv4.1 */ /* * Like CLAIM_DELEGATE_PREV, but object identified * by current filehandle */ CLAIM_DELEG_PREV_FH = 6 /* New to NFSv4.1 */ }; 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; /* * Like CLAIM_NULL. No special rights * to file. Ordinary OPEN of the * specified file by current filehandle. */ case CLAIM_FH: /* New to NFSv4.1 */ /* CURRENT_FH: regular file to open */ void; /* * Like CLAIM_DELEGATE_PREV. Right to file based on a * delegation granted to a previous boot * instance of the client. File is identified * by filehandle. */ case CLAIM_DELEG_PREV_FH: /* New to NFSv4.1 */ /* CURRENT_FH: file being opened */ void; /* * Like CLAIM_DELEGATE_CUR. Right to file based on * a delegation granted by the server. * File is identified by filehandle. */ case CLAIM_DELEG_CUR_FH: /* New to NFSv4.1 */ /* CURRENT_FH: file being opened */ stateid4 oc_delegate_stateid; }; /* * 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 */ }; enum why_no_delegation4 { /* New to NFSv4.1 */ WND4_NOT_WANTED = 0, WND4_CONTENTION = 1, WND4_RESOURCE = 2, WND4_NOT_SUPP_FTYPE = 3, WND4_WRITE_DELEG_NOT_SUPP_FTYPE = 4, WND4_NOT_SUPP_UPGRADE = 5, WND4_NOT_SUPP_DOWNGRADE = 6, WND4_CANCELLED = 7, WND4_IS_DIR = 8 }; union open_none_delegation4 /* New to NFSv4.1 */ switch (why_no_delegation4 ond_why) { case WND4_CONTENTION: bool ond_server_will_push_deleg; case WND4_RESOURCE: bool ond_server_will_signal_avail; default: void; }; 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; case OPEN_DELEGATE_NONE_EXT: /* New to NFSv4.1 */ open_none_delegation4 od_whynone; }; /* * 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; /* Server will preserve file if removed while open. */ const OPEN4_RESULT_PRESERVE_UNLINKED = 0x00000008; /* * Server may use CB_NOTIFY_LOCK on locks * derived from this open. */ const OPEN4_RESULT_MAY_NOTIFY_LOCK = 0x00000020; 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: /* New CURRENT_FH: opened file */ OPEN4resok resok4; default: void; }; struct OPENATTR4args { /* CURRENT_FH: object */ bool createdir; }; struct OPENATTR4res { /* * If status is NFS4_OK, * New CURRENT_FH: named attribute * directory */ nfsstat4 status; }; /* Obsolete in NFSv4.1 */ 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; }; 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; }; struct PUTFH4args { nfs_fh4 object; }; struct PUTFH4res { /* * If status is NFS4_OK, * New CURRENT_FH: argument to PUTFH */ nfsstat4 status; }; struct PUTPUBFH4res { /* * If status is NFS4_OK, * New CURRENT_FH: public fh */ nfsstat4 status; }; struct PUTROOTFH4res { /* * If status is NFS4_OK, * New CURRENT_FH: root fh */ nfsstat4 status; }; 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; }; 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; }; struct READLINK4resok { linktext4 link; }; union READLINK4res switch (nfsstat4 status) { case NFS4_OK: READLINK4resok resok4; default: void; }; struct REMOVE4args { /* CURRENT_FH: directory */ component4 target; }; struct REMOVE4resok { change_info4 cinfo; }; union REMOVE4res switch (nfsstat4 status) { case NFS4_OK: REMOVE4resok resok4; default: void; }; 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; }; /* Obsolete in NFSv4.1 */ struct RENEW4args { clientid4 clientid; }; struct RENEW4res { nfsstat4 status; }; struct RESTOREFH4res { /* * If status is NFS4_OK, * New CURRENT_FH: value of saved fh */ nfsstat4 status; }; struct SAVEFH4res { /* * If status is NFS4_OK, * New SAVED_FH: value of current fh */ nfsstat4 status; }; 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: /* CURRENTFH: consumed */ SECINFO4resok resok4; default: void; }; struct SETATTR4args { /* CURRENT_FH: target object */ stateid4 stateid; fattr4 obj_attributes; }; struct SETATTR4res { nfsstat4 status; bitmap4 attrsset; }; /* Obsolete in NFSv4.1 */ 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; }; /* Obsolete in NFSv4.1 */ struct SETCLIENTID_CONFIRM4args { clientid4 clientid; verifier4 setclientid_confirm; }; struct SETCLIENTID_CONFIRM4res { nfsstat4 status; }; struct VERIFY4args { /* CURRENT_FH: object */ fattr4 obj_attributes; }; struct VERIFY4res { nfsstat4 status; }; 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; }; /* Obsolete in NFSv4.1 */ struct RELEASE_LOCKOWNER4args { lock_owner4 lock_owner; }; struct RELEASE_LOCKOWNER4res { nfsstat4 status; }; struct ILLEGAL4res { nfsstat4 status; }; typedef opaque gsshandle4_t<>; struct gss_cb_handles4 { rpc_gss_svc_t gcbp_service; /* RFC 2203 */ gsshandle4_t gcbp_handle_from_server; gsshandle4_t gcbp_handle_from_client; }; union callback_sec_parms4 switch (uint32_t cb_secflavor) { case AUTH_NONE: void; case AUTH_SYS: authsys_parms cbsp_sys_cred; /* RFC 5531 */ case RPCSEC_GSS: gss_cb_handles4 cbsp_gss_handles; }; struct BACKCHANNEL_CTL4args { uint32_t bca_cb_program; callback_sec_parms4 bca_sec_parms<>; }; struct BACKCHANNEL_CTL4res { nfsstat4 bcr_status; }; enum channel_dir_from_client4 { CDFC4_FORE = 0x1, CDFC4_BACK = 0x2, CDFC4_FORE_OR_BOTH = 0x3, CDFC4_BACK_OR_BOTH = 0x7 }; struct BIND_CONN_TO_SESSION4args { sessionid4 bctsa_sessid; channel_dir_from_client4 bctsa_dir; bool bctsa_use_conn_in_rdma_mode; }; enum channel_dir_from_server4 { CDFS4_FORE = 0x1, CDFS4_BACK = 0x2, CDFS4_BOTH = 0x3 }; struct BIND_CONN_TO_SESSION4resok { sessionid4 bctsr_sessid; channel_dir_from_server4 bctsr_dir; bool bctsr_use_conn_in_rdma_mode; }; union BIND_CONN_TO_SESSION4res switch (nfsstat4 bctsr_status) { case NFS4_OK: BIND_CONN_TO_SESSION4resok bctsr_resok4; default: void; }; const EXCHGID4_FLAG_SUPP_MOVED_REFER = 0x00000001; const EXCHGID4_FLAG_SUPP_MOVED_MIGR = 0x00000002; const EXCHGID4_FLAG_SUPP_FENCE_OPS = 0x00000004; const EXCHGID4_FLAG_BIND_PRINC_STATEID = 0x00000100; const EXCHGID4_FLAG_USE_NON_PNFS = 0x00010000; const EXCHGID4_FLAG_USE_PNFS_MDS = 0x00020000; const EXCHGID4_FLAG_USE_PNFS_DS = 0x00040000; const EXCHGID4_FLAG_MASK_PNFS = 0x00070000; const EXCHGID4_FLAG_UPD_CONFIRMED_REC_A = 0x40000000; const EXCHGID4_FLAG_CONFIRMED_R = 0x80000000; struct state_protect_ops4 { bitmap4 spo_must_enforce; bitmap4 spo_must_allow; }; struct ssv_sp_parms4 { state_protect_ops4 ssp_ops; sec_oid4 ssp_hash_algs<>; sec_oid4 ssp_encr_algs<>; uint32_t ssp_window; uint32_t ssp_num_gss_handles; }; enum state_protect_how4 { SP4_NONE = 0, SP4_MACH_CRED = 1, SP4_SSV = 2 }; union state_protect4_a switch (state_protect_how4 spa_how) { case SP4_NONE: void; case SP4_MACH_CRED: state_protect_ops4 spa_mach_ops; case SP4_SSV: ssv_sp_parms4 spa_ssv_parms; }; struct EXCHANGE_ID4args { client_owner4 eia_clientowner; uint32_t eia_flags; state_protect4_a eia_state_protect; nfs_impl_id4 eia_client_impl_id<1>; }; struct ssv_prot_info4 { state_protect_ops4 spi_ops; uint32_t spi_hash_alg; uint32_t spi_encr_alg; uint32_t spi_ssv_len; uint32_t spi_window; gsshandle4_t spi_handles<>; }; union state_protect4_r switch (state_protect_how4 spr_how) { case SP4_NONE: void; case SP4_MACH_CRED: state_protect_ops4 spr_mach_ops; case SP4_SSV: ssv_prot_info4 spr_ssv_info; }; struct EXCHANGE_ID4resok { clientid4 eir_clientid; sequenceid4 eir_sequenceid; uint32_t eir_flags; state_protect4_r eir_state_protect; server_owner4 eir_server_owner; opaque eir_server_scope; nfs_impl_id4 eir_server_impl_id<1>; }; union EXCHANGE_ID4res switch (nfsstat4 eir_status) { case NFS4_OK: EXCHANGE_ID4resok eir_resok4; default: void; }; struct channel_attrs4 { count4 ca_headerpadsize; count4 ca_maxrequestsize; count4 ca_maxresponsesize; count4 ca_maxresponsesize_cached; count4 ca_maxoperations; count4 ca_maxrequests; uint32_t ca_rdma_ird<1>; }; const CREATE_SESSION4_FLAG_PERSIST = 0x00000001; const CREATE_SESSION4_FLAG_CONN_BACK_CHAN = 0x00000002; const CREATE_SESSION4_FLAG_CONN_RDMA = 0x00000004; struct CREATE_SESSION4args { clientid4 csa_clientid; sequenceid4 csa_sequence; uint32_t csa_flags; channel_attrs4 csa_fore_chan_attrs; channel_attrs4 csa_back_chan_attrs; uint32_t csa_cb_program; callback_sec_parms4 csa_sec_parms<>; }; struct CREATE_SESSION4resok { sessionid4 csr_sessionid; sequenceid4 csr_sequence; uint32_t csr_flags; channel_attrs4 csr_fore_chan_attrs; channel_attrs4 csr_back_chan_attrs; }; union CREATE_SESSION4res switch (nfsstat4 csr_status) { case NFS4_OK: CREATE_SESSION4resok csr_resok4; default: void; }; struct DESTROY_SESSION4args { sessionid4 dsa_sessionid; }; struct DESTROY_SESSION4res { nfsstat4 dsr_status; }; struct FREE_STATEID4args { stateid4 fsa_stateid; }; struct FREE_STATEID4res { nfsstat4 fsr_status; }; typedef nfstime4 attr_notice4; struct GET_DIR_DELEGATION4args { /* CURRENT_FH: delegated directory */ bool gdda_signal_deleg_avail; bitmap4 gdda_notification_types; attr_notice4 gdda_child_attr_delay; attr_notice4 gdda_dir_attr_delay; bitmap4 gdda_child_attributes; bitmap4 gdda_dir_attributes; }; struct GET_DIR_DELEGATION4resok { verifier4 gddr_cookieverf; /* Stateid for get_dir_delegation */ stateid4 gddr_stateid; /* Which notifications can the server support? */ bitmap4 gddr_notification; bitmap4 gddr_child_attributes; bitmap4 gddr_dir_attributes; }; enum gddrnf4_status { GDD4_OK = 0, GDD4_UNAVAIL = 1 }; union GET_DIR_DELEGATION4res_non_fatal switch (gddrnf4_status gddrnf_status) { case GDD4_OK: GET_DIR_DELEGATION4resok gddrnf_resok4; case GDD4_UNAVAIL: bool gddrnf_will_signal_deleg_avail; }; union GET_DIR_DELEGATION4res switch (nfsstat4 gddr_status) { case NFS4_OK: GET_DIR_DELEGATION4res_non_fatal gddr_res_non_fatal4; default: void; }; struct GETDEVICEINFO4args { deviceid4 gdia_device_id; layouttype4 gdia_layout_type; count4 gdia_maxcount; bitmap4 gdia_notify_types; }; struct GETDEVICEINFO4resok { device_addr4 gdir_device_addr; bitmap4 gdir_notification; }; union GETDEVICEINFO4res switch (nfsstat4 gdir_status) { case NFS4_OK: GETDEVICEINFO4resok gdir_resok4; case NFS4ERR_TOOSMALL: count4 gdir_mincount; default: void; }; struct GETDEVICELIST4args { /* CURRENT_FH: object belonging to the file system */ layouttype4 gdla_layout_type; /* Number of device IDs to return */ count4 gdla_maxdevices; nfs_cookie4 gdla_cookie; verifier4 gdla_cookieverf; }; struct GETDEVICELIST4resok { nfs_cookie4 gdlr_cookie; verifier4 gdlr_cookieverf; deviceid4 gdlr_deviceid_list<>; bool gdlr_eof; }; union GETDEVICELIST4res switch (nfsstat4 gdlr_status) { case NFS4_OK: GETDEVICELIST4resok gdlr_resok4; default: void; }; union newtime4 switch (bool nt_timechanged) { case TRUE: nfstime4 nt_time; case FALSE: void; }; union newoffset4 switch (bool no_newoffset) { case TRUE: offset4 no_offset; case FALSE: void; }; struct LAYOUTCOMMIT4args { /* CURRENT_FH: file */ offset4 loca_offset; length4 loca_length; bool loca_reclaim; stateid4 loca_stateid; newoffset4 loca_last_write_offset; newtime4 loca_time_modify; layoutupdate4 loca_layoutupdate; }; union newsize4 switch (bool ns_sizechanged) { case TRUE: length4 ns_size; case FALSE: void; }; struct LAYOUTCOMMIT4resok { newsize4 locr_newsize; }; union LAYOUTCOMMIT4res switch (nfsstat4 locr_status) { case NFS4_OK: LAYOUTCOMMIT4resok locr_resok4; default: void; }; struct LAYOUTGET4args { /* CURRENT_FH: file */ bool loga_signal_layout_avail; layouttype4 loga_layout_type; layoutiomode4 loga_iomode; offset4 loga_offset; length4 loga_length; length4 loga_minlength; stateid4 loga_stateid; count4 loga_maxcount; }; struct LAYOUTGET4resok { bool logr_return_on_close; stateid4 logr_stateid; layout4 logr_layout<>; }; union LAYOUTGET4res switch (nfsstat4 logr_status) { case NFS4_OK: LAYOUTGET4resok logr_resok4; case NFS4ERR_LAYOUTTRYLATER: bool logr_will_signal_layout_avail; default: void; }; struct LAYOUTRETURN4args { /* CURRENT_FH: file */ bool lora_reclaim; layouttype4 lora_layout_type; layoutiomode4 lora_iomode; layoutreturn4 lora_layoutreturn; }; union layoutreturn_stateid switch (bool lrs_present) { case TRUE: stateid4 lrs_stateid; case FALSE: void; }; union LAYOUTRETURN4res switch (nfsstat4 lorr_status) { case NFS4_OK: layoutreturn_stateid lorr_stateid; default: void; }; enum secinfo_style4 { SECINFO_STYLE4_CURRENT_FH = 0, SECINFO_STYLE4_PARENT = 1 }; /* CURRENT_FH: object or child directory */ typedef secinfo_style4 SECINFO_NO_NAME4args; /* CURRENTFH: consumed if status is NFS4_OK */ typedef SECINFO4res SECINFO_NO_NAME4res; struct SEQUENCE4args { sessionid4 sa_sessionid; sequenceid4 sa_sequenceid; slotid4 sa_slotid; slotid4 sa_highest_slotid; bool sa_cachethis; }; const SEQ4_STATUS_CB_PATH_DOWN = 0x00000001; const SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING = 0x00000002; const SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED = 0x00000004; const SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED = 0x00000008; const SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED = 0x00000010; const SEQ4_STATUS_ADMIN_STATE_REVOKED = 0x00000020; const SEQ4_STATUS_RECALLABLE_STATE_REVOKED = 0x00000040; const SEQ4_STATUS_LEASE_MOVED = 0x00000080; const SEQ4_STATUS_RESTART_RECLAIM_NEEDED = 0x00000100; const SEQ4_STATUS_CB_PATH_DOWN_SESSION = 0x00000200; const SEQ4_STATUS_BACKCHANNEL_FAULT = 0x00000400; const SEQ4_STATUS_DEVID_CHANGED = 0x00000800; const SEQ4_STATUS_DEVID_DELETED = 0x00001000; struct SEQUENCE4resok { sessionid4 sr_sessionid; sequenceid4 sr_sequenceid; slotid4 sr_slotid; slotid4 sr_highest_slotid; slotid4 sr_target_highest_slotid; uint32_t sr_status_flags; }; union SEQUENCE4res switch (nfsstat4 sr_status) { case NFS4_OK: SEQUENCE4resok sr_resok4; default: void; }; struct ssa_digest_input4 { SEQUENCE4args sdi_seqargs; }; struct SET_SSV4args { opaque ssa_ssv<>; opaque ssa_digest<>; }; struct ssr_digest_input4 { SEQUENCE4res sdi_seqres; }; struct SET_SSV4resok { opaque ssr_digest<>; }; union SET_SSV4res switch (nfsstat4 ssr_status) { case NFS4_OK: SET_SSV4resok ssr_resok4; default: void; }; struct TEST_STATEID4args { stateid4 ts_stateids<>; }; struct TEST_STATEID4resok { nfsstat4 tsr_status_codes<>; }; union TEST_STATEID4res switch (nfsstat4 tsr_status) { case NFS4_OK: TEST_STATEID4resok tsr_resok4; default: void; }; union deleg_claim4 switch (open_claim_type4 dc_claim) { /* * No special rights to object. Ordinary delegation * request of the specified object. Object identified * by filehandle. */ case CLAIM_FH: /* New to NFSv4.1 */ /* CURRENT_FH: object being delegated */ void; /* * Right to file based on a delegation granted * to a previous boot instance of the client. * File is specified by filehandle. */ case CLAIM_DELEG_PREV_FH: /* New to NFSv4.1 */ /* CURRENT_FH: object being delegated */ void; /* * Right to the file established by an open previous * to server reboot. File identified by filehandle. * Used during server reclaim grace period. */ case CLAIM_PREVIOUS: /* CURRENT_FH: object being reclaimed */ open_delegation_type4 dc_delegate_type; }; struct WANT_DELEGATION4args { uint32_t wda_want; deleg_claim4 wda_claim; }; union WANT_DELEGATION4res switch (nfsstat4 wdr_status) { case NFS4_OK: open_delegation4 wdr_resok4; default: void; }; struct DESTROY_CLIENTID4args { clientid4 dca_clientid; }; struct DESTROY_CLIENTID4res { nfsstat4 dcr_status; }; struct RECLAIM_COMPLETE4args { /* * If rca_one_fs TRUE, * * CURRENT_FH: object in * file system for which the * reclaim is complete. */ bool rca_one_fs; }; struct RECLAIM_COMPLETE4res { nfsstat4 rcr_status; }; struct COPY4args { /* SAVED_FH: source file */ /* CURRENT_FH: destination file */ stateid4 ca_src_stateid; stateid4 ca_dst_stateid; offset4 ca_src_offset; offset4 ca_dst_offset; length4 ca_count; bool ca_consecutive; bool ca_synchronous; netloc4 ca_source_server<>; }; struct copy_requirements4 { bool cr_consecutive; bool cr_synchronous; }; struct COPY4resok { write_response4 cr_response; copy_requirements4 cr_requirements; }; union COPY4res switch (nfsstat4 cr_status) { case NFS4_OK: COPY4resok cr_resok4; case NFS4ERR_OFFLOAD_NO_REQS: copy_requirements4 cr_requirements; default: void; }; struct COPY_NOTIFY4args { /* CURRENT_FH: source file */ stateid4 cna_src_stateid; netloc4 cna_destination_server; }; struct COPY_NOTIFY4resok { nfstime4 cnr_lease_time; stateid4 cnr_stateid; netloc4 cnr_source_server<>; }; union COPY_NOTIFY4res switch (nfsstat4 cnr_status) { case NFS4_OK: COPY_NOTIFY4resok resok4; default: void; }; struct OFFLOAD_CANCEL4args { /* CURRENT_FH: file to cancel */ stateid4 oca_stateid; }; struct OFFLOAD_CANCEL4res { nfsstat4 ocr_status; }; struct OFFLOAD_STATUS4args { /* CURRENT_FH: destination file */ stateid4 osa_stateid; }; struct OFFLOAD_STATUS4resok { length4 osr_count; nfsstat4 osr_complete<1>; }; union OFFLOAD_STATUS4res switch (nfsstat4 osr_status) { case NFS4_OK: OFFLOAD_STATUS4resok osr_resok4; default: void; }; struct ALLOCATE4args { /* CURRENT_FH: file */ stateid4 aa_stateid; offset4 aa_offset; length4 aa_length; }; struct ALLOCATE4res { nfsstat4 ar_status; }; struct DEALLOCATE4args { /* CURRENT_FH: file */ stateid4 da_stateid; offset4 da_offset; length4 da_length; }; struct DEALLOCATE4res { nfsstat4 dr_status; }; enum IO_ADVISE_type4 { IO_ADVISE4_NORMAL = 0, IO_ADVISE4_SEQUENTIAL = 1, IO_ADVISE4_SEQUENTIAL_BACKWARDS = 2, IO_ADVISE4_RANDOM = 3, IO_ADVISE4_WILLNEED = 4, IO_ADVISE4_WILLNEED_OPPORTUNISTIC = 5, IO_ADVISE4_DONTNEED = 6, IO_ADVISE4_NOREUSE = 7, IO_ADVISE4_READ = 8, IO_ADVISE4_WRITE = 9, IO_ADVISE4_INIT_PROXIMITY = 10 }; struct IO_ADVISE4args { /* CURRENT_FH: file */ stateid4 iaa_stateid; offset4 iaa_offset; length4 iaa_count; bitmap4 iaa_hints; }; struct IO_ADVISE4resok { bitmap4 ior_hints; }; union IO_ADVISE4res switch (nfsstat4 ior_status) { case NFS4_OK: IO_ADVISE4resok resok4; default: void; }; struct device_error4 { deviceid4 de_deviceid; nfsstat4 de_status; nfs_opnum4 de_opnum; }; struct LAYOUTERROR4args { /* CURRENT_FH: file */ offset4 lea_offset; length4 lea_length; stateid4 lea_stateid; device_error4 lea_errors<>; }; struct LAYOUTERROR4res { nfsstat4 ler_status; }; struct io_info4 { uint64_t ii_count; uint64_t ii_bytes; }; struct LAYOUTSTATS4args { /* CURRENT_FH: file */ offset4 lsa_offset; length4 lsa_length; stateid4 lsa_stateid; io_info4 lsa_read; io_info4 lsa_write; deviceid4 lsa_deviceid; layoutupdate4 lsa_layoutupdate; }; struct LAYOUTSTATS4res { nfsstat4 lsr_status; }; struct READ_PLUS4args { /* CURRENT_FH: file */ stateid4 rpa_stateid; offset4 rpa_offset; count4 rpa_count; }; union read_plus_content switch (data_content4 rpc_content) { case NFS4_CONTENT_DATA: data4 rpc_data; case NFS4_CONTENT_HOLE: data_info4 rpc_hole; default: void; }; /* * Allow a return of an array of contents. */ struct read_plus_res4 { bool rpr_eof; read_plus_content rpr_contents<>; }; union READ_PLUS4res switch (nfsstat4 rp_status) { case NFS4_OK: read_plus_res4 rp_resok4; default: void; }; struct SEEK4args { /* CURRENT_FH: file */ stateid4 sa_stateid; offset4 sa_offset; data_content4 sa_what; }; struct seek_res4 { bool sr_eof; offset4 sr_offset; }; union SEEK4res switch (nfsstat4 sa_status) { case NFS4_OK: seek_res4 resok4; default: void; }; struct WRITE_SAME4args { /* CURRENT_FH: file */ stateid4 wsa_stateid; stable_how4 wsa_stable; app_data_block4 wsa_adb; }; union WRITE_SAME4res switch (nfsstat4 wsr_status) { case NFS4_OK: write_response4 resok4; default: void; }; /* * Operation arrays (the rest) */ 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; /* Not for NFSv4.1 */ 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; /* Not for NFSv4.1 */ case OP_RENEW: RENEW4args oprenew; case OP_RESTOREFH: void; case OP_SAVEFH: void; case OP_SECINFO: SECINFO4args opsecinfo; case OP_SETATTR: SETATTR4args opsetattr; /* Not for NFSv4.1 */ case OP_SETCLIENTID: SETCLIENTID4args opsetclientid; /* Not for NFSv4.1 */ case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4args opsetclientid_confirm; case OP_VERIFY: VERIFY4args opverify; case OP_WRITE: WRITE4args opwrite; /* Not for NFSv4.1 */ case OP_RELEASE_LOCKOWNER: RELEASE_LOCKOWNER4args oprelease_lockowner; /* Operations new to NFSv4.1 */ case OP_BACKCHANNEL_CTL: BACKCHANNEL_CTL4args opbackchannel_ctl; case OP_BIND_CONN_TO_SESSION: BIND_CONN_TO_SESSION4args opbind_conn_to_session; case OP_EXCHANGE_ID: EXCHANGE_ID4args opexchange_id; case OP_CREATE_SESSION: CREATE_SESSION4args opcreate_session; case OP_DESTROY_SESSION: DESTROY_SESSION4args opdestroy_session; case OP_FREE_STATEID: FREE_STATEID4args opfree_stateid; case OP_GET_DIR_DELEGATION: GET_DIR_DELEGATION4args opget_dir_delegation; case OP_GETDEVICEINFO: GETDEVICEINFO4args opgetdeviceinfo; case OP_GETDEVICELIST: GETDEVICELIST4args opgetdevicelist; case OP_LAYOUTCOMMIT: LAYOUTCOMMIT4args oplayoutcommit; case OP_LAYOUTGET: LAYOUTGET4args oplayoutget; case OP_LAYOUTRETURN: LAYOUTRETURN4args oplayoutreturn; case OP_SECINFO_NO_NAME: SECINFO_NO_NAME4args opsecinfo_no_name; case OP_SEQUENCE: SEQUENCE4args opsequence; case OP_SET_SSV: SET_SSV4args opset_ssv; case OP_TEST_STATEID: TEST_STATEID4args optest_stateid; case OP_WANT_DELEGATION: WANT_DELEGATION4args opwant_delegation; case OP_DESTROY_CLIENTID: DESTROY_CLIENTID4args opdestroy_clientid; case OP_RECLAIM_COMPLETE: RECLAIM_COMPLETE4args opreclaim_complete; /* Operations new to NFSv4.2 */ case OP_ALLOCATE: ALLOCATE4args opallocate; case OP_COPY: COPY4args opcopy; case OP_COPY_NOTIFY: COPY_NOTIFY4args opoffload_notify; case OP_DEALLOCATE: DEALLOCATE4args opdeallocate; case OP_IO_ADVISE: IO_ADVISE4args opio_advise; case OP_LAYOUTERROR: LAYOUTERROR4args oplayouterror; case OP_LAYOUTSTATS: LAYOUTSTATS4args oplayoutstats; case OP_OFFLOAD_CANCEL: OFFLOAD_CANCEL4args opoffload_cancel; case OP_OFFLOAD_STATUS: OFFLOAD_STATUS4args opoffload_status; case OP_READ_PLUS: READ_PLUS4args opread_plus; case OP_SEEK: SEEK4args opseek; case OP_WRITE_SAME: WRITE_SAME4args opwrite_same; case OP_CLONE: CLONE4args opclone; /* Operations not new to NFSv4.1 */ 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; /* Not for NFSv4.1 */ 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; /* Not for NFSv4.1 */ 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; /* Not for NFSv4.1 */ case OP_SETCLIENTID: SETCLIENTID4res opsetclientid; /* Not for NFSv4.1 */ case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4res opsetclientid_confirm; case OP_VERIFY: VERIFY4res opverify; case OP_WRITE: WRITE4res opwrite; /* Not for NFSv4.1 */ case OP_RELEASE_LOCKOWNER: RELEASE_LOCKOWNER4res oprelease_lockowner; /* Operations new to NFSv4.1 */ case OP_BACKCHANNEL_CTL: BACKCHANNEL_CTL4res opbackchannel_ctl; case OP_BIND_CONN_TO_SESSION: BIND_CONN_TO_SESSION4res opbind_conn_to_session; case OP_EXCHANGE_ID: EXCHANGE_ID4res opexchange_id; case OP_CREATE_SESSION: CREATE_SESSION4res opcreate_session; case OP_DESTROY_SESSION: DESTROY_SESSION4res opdestroy_session; case OP_FREE_STATEID: FREE_STATEID4res opfree_stateid; case OP_GET_DIR_DELEGATION: GET_DIR_DELEGATION4res opget_dir_delegation; case OP_GETDEVICEINFO: GETDEVICEINFO4res opgetdeviceinfo; case OP_GETDEVICELIST: GETDEVICELIST4res opgetdevicelist; case OP_LAYOUTCOMMIT: LAYOUTCOMMIT4res oplayoutcommit; case OP_LAYOUTGET: LAYOUTGET4res oplayoutget; case OP_LAYOUTRETURN: LAYOUTRETURN4res oplayoutreturn; case OP_SECINFO_NO_NAME: SECINFO_NO_NAME4res opsecinfo_no_name; case OP_SEQUENCE: SEQUENCE4res opsequence; case OP_SET_SSV: SET_SSV4res opset_ssv; case OP_TEST_STATEID: TEST_STATEID4res optest_stateid; case OP_WANT_DELEGATION: WANT_DELEGATION4res opwant_delegation; case OP_DESTROY_CLIENTID: DESTROY_CLIENTID4res opdestroy_clientid; case OP_RECLAIM_COMPLETE: RECLAIM_COMPLETE4res opreclaim_complete; /* Operations new to NFSv4.2 */ case OP_ALLOCATE: ALLOCATE4res opallocate; case OP_COPY: COPY4res opcopy; case OP_COPY_NOTIFY: COPY_NOTIFY4res opcopy_notify; case OP_DEALLOCATE: DEALLOCATE4res opdeallocate; case OP_IO_ADVISE: IO_ADVISE4res opio_advise; case OP_LAYOUTERROR: LAYOUTERROR4res oplayouterror; case OP_LAYOUTSTATS: LAYOUTSTATS4res oplayoutstats; case OP_OFFLOAD_CANCEL: OFFLOAD_CANCEL4res opoffload_cancel; case OP_OFFLOAD_STATUS: OFFLOAD_STATUS4res opoffload_status; case OP_READ_PLUS: READ_PLUS4res opread_plus; case OP_SEEK: SEEK4res opseek; case OP_WRITE_SAME: WRITE_SAME4res opwrite_same; case OP_CLONE: CLONE4res opclone; /* Operations not new to NFSv4.1 */ 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 */ 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; }; 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; }; /* * NFSv4.1 callback arguments and results */ enum layoutrecall_type4 { LAYOUTRECALL4_FILE = LAYOUT4_RET_REC_FILE, LAYOUTRECALL4_FSID = LAYOUT4_RET_REC_FSID, LAYOUTRECALL4_ALL = LAYOUT4_RET_REC_ALL }; struct layoutrecall_file4 { nfs_fh4 lor_fh; offset4 lor_offset; length4 lor_length; stateid4 lor_stateid; }; union layoutrecall4 switch (layoutrecall_type4 lor_recalltype) { case LAYOUTRECALL4_FILE: layoutrecall_file4 lor_layout; case LAYOUTRECALL4_FSID: fsid4 lor_fsid; case LAYOUTRECALL4_ALL: void; }; struct CB_LAYOUTRECALL4args { layouttype4 clora_type; layoutiomode4 clora_iomode; bool clora_changed; layoutrecall4 clora_recall; }; struct CB_LAYOUTRECALL4res { nfsstat4 clorr_status; }; /* * Directory notification types */ enum notify_type4 { NOTIFY4_CHANGE_CHILD_ATTRS = 0, NOTIFY4_CHANGE_DIR_ATTRS = 1, NOTIFY4_REMOVE_ENTRY = 2, NOTIFY4_ADD_ENTRY = 3, NOTIFY4_RENAME_ENTRY = 4, NOTIFY4_CHANGE_COOKIE_VERIFIER = 5 }; /* Changed entry information */ struct notify_entry4 { component4 ne_file; fattr4 ne_attrs; }; /* Previous entry information */ struct prev_entry4 { notify_entry4 pe_prev_entry; /* What READDIR returned for this entry */ nfs_cookie4 pe_prev_entry_cookie; }; struct notify_remove4 { notify_entry4 nrm_old_entry; nfs_cookie4 nrm_old_entry_cookie; }; struct notify_add4 { /* * During a rename, contains * the object that was deleted. */ notify_remove4 nad_old_entry<1>; notify_entry4 nad_new_entry; /* What READDIR would have returned for this entry */ nfs_cookie4 nad_new_entry_cookie<1>; prev_entry4 nad_prev_entry<1>; bool nad_last_entry; }; struct notify_attr4 { notify_entry4 na_changed_entry; }; struct notify_rename4 { notify_remove4 nrn_old_entry; notify_add4 nrn_new_entry; }; struct notify_verifier4 { verifier4 nv_old_cookieverf; verifier4 nv_new_cookieverf; }; /* * Objects of type notify_<>4 and * notify_device_<>4 are encoded in this. */ typedef opaque notifylist4<>; struct notify4 { /* Composed from notify_type4 or notify_deviceid_type4 */ bitmap4 notify_mask; notifylist4 notify_vals; }; struct CB_NOTIFY4args { stateid4 cna_stateid; nfs_fh4 cna_fh; notify4 cna_changes<>; }; struct CB_NOTIFY4res { nfsstat4 cnr_status; }; struct CB_PUSH_DELEG4args { nfs_fh4 cpda_fh; open_delegation4 cpda_delegation; }; struct CB_PUSH_DELEG4res { nfsstat4 cpdr_status; }; const RCA4_TYPE_MASK_RDATA_DLG = 0; const RCA4_TYPE_MASK_WDATA_DLG = 1; const RCA4_TYPE_MASK_DIR_DLG = 2; const RCA4_TYPE_MASK_FILE_LAYOUT = 3; const RCA4_TYPE_MASK_BLK_LAYOUT = 4; const RCA4_TYPE_MASK_OBJ_LAYOUT_MIN = 8; const RCA4_TYPE_MASK_OBJ_LAYOUT_MAX = 9; const RCA4_TYPE_MASK_OTHER_LAYOUT_MIN = 12; const RCA4_TYPE_MASK_OTHER_LAYOUT_MAX = 15; struct CB_RECALL_ANY4args { uint32_t craa_objects_to_keep; bitmap4 craa_type_mask; }; struct CB_RECALL_ANY4res { nfsstat4 crar_status; }; typedef CB_RECALL_ANY4args CB_RECALLABLE_OBJ_AVAIL4args; struct CB_RECALLABLE_OBJ_AVAIL4res { nfsstat4 croa_status; }; struct CB_RECALL_SLOT4args { slotid4 rsa_target_highest_slotid; }; struct CB_RECALL_SLOT4res { nfsstat4 rsr_status; }; struct referring_call4 { sequenceid4 rc_sequenceid; slotid4 rc_slotid; }; struct referring_call_list4 { sessionid4 rcl_sessionid; referring_call4 rcl_referring_calls<>; }; struct CB_SEQUENCE4args { sessionid4 csa_sessionid; sequenceid4 csa_sequenceid; slotid4 csa_slotid; slotid4 csa_highest_slotid; bool csa_cachethis; referring_call_list4 csa_referring_call_lists<>; }; struct CB_SEQUENCE4resok { sessionid4 csr_sessionid; sequenceid4 csr_sequenceid; slotid4 csr_slotid; slotid4 csr_highest_slotid; slotid4 csr_target_highest_slotid; }; union CB_SEQUENCE4res switch (nfsstat4 csr_status) { case NFS4_OK: CB_SEQUENCE4resok csr_resok4; default: void; }; struct CB_WANTS_CANCELLED4args { bool cwca_contended_wants_cancelled; bool cwca_resourced_wants_cancelled; }; struct CB_WANTS_CANCELLED4res { nfsstat4 cwcr_status; }; struct CB_NOTIFY_LOCK4args { nfs_fh4 cnla_fh; lock_owner4 cnla_lock_owner; }; struct CB_NOTIFY_LOCK4res { nfsstat4 cnlr_status; }; /* * Device notification types */ enum notify_deviceid_type4 { NOTIFY_DEVICEID4_CHANGE = 1, NOTIFY_DEVICEID4_DELETE = 2 }; /* For NOTIFY4_DEVICEID4_DELETE */ struct notify_deviceid_delete4 { layouttype4 ndd_layouttype; deviceid4 ndd_deviceid; }; /* For NOTIFY4_DEVICEID4_CHANGE */ struct notify_deviceid_change4 { layouttype4 ndc_layouttype; deviceid4 ndc_deviceid; bool ndc_immediate; }; struct CB_NOTIFY_DEVICEID4args { notify4 cnda_changes<>; }; struct CB_NOTIFY_DEVICEID4res { nfsstat4 cndr_status; }; union offload_info4 switch (nfsstat4 coa_status) { case NFS4_OK: write_response4 coa_resok4; default: length4 coa_bytes_copied; }; struct CB_OFFLOAD4args { nfs_fh4 coa_fh; stateid4 coa_stateid; offload_info4 coa_offload_info; }; struct CB_OFFLOAD4res { nfsstat4 cor_status; }; /* * Various definitions for CB_COMPOUND */ % enum nfs_cb_opnum4 { OP_CB_GETATTR = 3, OP_CB_RECALL = 4, %/* Callback operations new to NFSv4.1 */ OP_CB_LAYOUTRECALL = 5, OP_CB_NOTIFY = 6, OP_CB_PUSH_DELEG = 7, OP_CB_RECALL_ANY = 8, OP_CB_RECALLABLE_OBJ_AVAIL = 9, OP_CB_RECALL_SLOT = 10, OP_CB_SEQUENCE = 11, OP_CB_WANTS_CANCELLED = 12, OP_CB_NOTIFY_LOCK = 13, OP_CB_NOTIFY_DEVICEID = 14, %/* Callback operations new to NFSv4.2 */ OP_CB_OFFLOAD = 15, OP_CB_ILLEGAL = 10044 }; union nfs_cb_argop4 switch (nfs_cb_opnum4 argop) { case OP_CB_GETATTR: CB_GETATTR4args opcbgetattr; /* New NFSv4.1 operations */ case OP_CB_RECALL: CB_RECALL4args opcbrecall; case OP_CB_LAYOUTRECALL: CB_LAYOUTRECALL4args opcblayoutrecall; case OP_CB_NOTIFY: CB_NOTIFY4args opcbnotify; case OP_CB_PUSH_DELEG: CB_PUSH_DELEG4args opcbpush_deleg; case OP_CB_RECALL_ANY: CB_RECALL_ANY4args opcbrecall_any; case OP_CB_RECALLABLE_OBJ_AVAIL: CB_RECALLABLE_OBJ_AVAIL4args opcbrecallable_obj_avail; case OP_CB_RECALL_SLOT: CB_RECALL_SLOT4args opcbrecall_slot; case OP_CB_SEQUENCE: CB_SEQUENCE4args opcbsequence; case OP_CB_WANTS_CANCELLED: CB_WANTS_CANCELLED4args opcbwants_cancelled; case OP_CB_NOTIFY_LOCK: CB_NOTIFY_LOCK4args opcbnotify_lock; case OP_CB_NOTIFY_DEVICEID: CB_NOTIFY_DEVICEID4args opcbnotify_deviceid; /* New NFSv4.2 operations */ case OP_CB_OFFLOAD: CB_OFFLOAD4args opcboffload; case OP_CB_ILLEGAL: void; }; union nfs_cb_resop4 switch (nfs_cb_opnum4 resop) { case OP_CB_GETATTR: CB_GETATTR4res opcbgetattr; case OP_CB_RECALL: CB_RECALL4res opcbrecall; /* New NFSv4.1 operations */ case OP_CB_LAYOUTRECALL: CB_LAYOUTRECALL4res opcblayoutrecall; case OP_CB_NOTIFY: CB_NOTIFY4res opcbnotify; case OP_CB_PUSH_DELEG: CB_PUSH_DELEG4res opcbpush_deleg; case OP_CB_RECALL_ANY: CB_RECALL_ANY4res opcbrecall_any; case OP_CB_RECALLABLE_OBJ_AVAIL: CB_RECALLABLE_OBJ_AVAIL4res opcbrecallable_obj_avail; case OP_CB_RECALL_SLOT: CB_RECALL_SLOT4res opcbrecall_slot; case OP_CB_SEQUENCE: CB_SEQUENCE4res opcbsequence; case OP_CB_WANTS_CANCELLED: CB_WANTS_CANCELLED4res opcbwants_cancelled; case OP_CB_NOTIFY_LOCK: CB_NOTIFY_LOCK4res opcbnotify_lock; case OP_CB_NOTIFY_DEVICEID: CB_NOTIFY_DEVICEID4res opcbnotify_deviceid; /* New NFSv4.2 operations */ case OP_CB_OFFLOAD: CB_OFFLOAD4res opcboffload; /* Not new operation */ 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 CREATE_SESSION or * BACKCHANNEL_CTL operations. */ program NFS4_CALLBACK { version NFS_CB { void CB_NULL(void) = 0; CB_COMPOUND4res CB_COMPOUND(CB_COMPOUND4args) = 1; } = 1; } = 0x40000000; /* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _NFS_ACL_H_RPCGEN #define _NFS_ACL_H_RPCGEN #include #ifdef __cplusplus extern "C" { #endif #define NFS_ACL_MAX_ENTRIES 1024 typedef int uid; typedef u_short o_mode; struct aclent { int type; uid id; o_mode perm; }; typedef struct aclent aclent; #define NA_USER_OBJ 0x1 #define NA_USER 0x2 #define NA_GROUP_OBJ 0x4 #define NA_GROUP 0x8 #define NA_CLASS_OBJ 0x10 #define NA_OTHER_OBJ 0x20 #define NA_ACL_DEFAULT 0x1000 #define NA_READ 0x4 #define NA_WRITE 0x2 #define NA_EXEC 0x1 struct secattr { u_int mask; int aclcnt; struct { u_int aclent_len; aclent *aclent_val; } aclent; int dfaclcnt; struct { u_int dfaclent_len; aclent *dfaclent_val; } dfaclent; }; typedef struct secattr secattr; #define NA_ACL 0x1 #define NA_ACLCNT 0x2 #define NA_DFACL 0x4 #define NA_DFACLCNT 0x8 struct GETACL2args { fhandle_t fh; u_int mask; }; typedef struct GETACL2args GETACL2args; struct GETACL2resok { struct nfsfattr attr; secattr acl; }; typedef struct GETACL2resok GETACL2resok; struct GETACL2res { nfsstat status; union { GETACL2resok resok; } GETACL2res_u; }; typedef struct GETACL2res GETACL2res; struct SETACL2args { fhandle_t fh; secattr acl; }; typedef struct SETACL2args SETACL2args; struct SETACL2resok { struct nfsfattr attr; }; typedef struct SETACL2resok SETACL2resok; struct SETACL2res { nfsstat status; union { SETACL2resok resok; } SETACL2res_u; }; typedef struct SETACL2res SETACL2res; struct GETATTR2args { fhandle_t fh; }; typedef struct GETATTR2args GETATTR2args; struct GETATTR2resok { struct nfsfattr attr; }; typedef struct GETATTR2resok GETATTR2resok; struct GETATTR2res { nfsstat status; union { GETATTR2resok resok; } GETATTR2res_u; }; typedef struct GETATTR2res GETATTR2res; struct ACCESS2args { fhandle_t fh; uint32 access; }; typedef struct ACCESS2args ACCESS2args; #define ACCESS2_READ 0x1 #define ACCESS2_LOOKUP 0x2 #define ACCESS2_MODIFY 0x4 #define ACCESS2_EXTEND 0x8 #define ACCESS2_DELETE 0x10 #define ACCESS2_EXECUTE 0x20 struct ACCESS2resok { struct nfsfattr attr; uint32 access; }; typedef struct ACCESS2resok ACCESS2resok; struct ACCESS2res { nfsstat status; union { ACCESS2resok resok; } ACCESS2res_u; }; typedef struct ACCESS2res ACCESS2res; struct GETXATTRDIR2args { fhandle_t fh; bool_t create; }; typedef struct GETXATTRDIR2args GETXATTRDIR2args; struct GETXATTRDIR2resok { fhandle_t fh; struct nfsfattr attr; }; typedef struct GETXATTRDIR2resok GETXATTRDIR2resok; struct GETXATTRDIR2res { nfsstat status; union { GETXATTRDIR2resok resok; } GETXATTRDIR2res_u; }; typedef struct GETXATTRDIR2res GETXATTRDIR2res; struct GETACL3args { nfs_fh3 fh; u_int mask; }; typedef struct GETACL3args GETACL3args; struct GETACL3resok { post_op_attr attr; secattr acl; }; typedef struct GETACL3resok GETACL3resok; struct GETACL3resfail { post_op_attr attr; }; typedef struct GETACL3resfail GETACL3resfail; struct GETACL3res { nfsstat3 status; union { GETACL3resok resok; GETACL3resfail resfail; } GETACL3res_u; }; typedef struct GETACL3res GETACL3res; struct SETACL3args { nfs_fh3 fh; secattr acl; }; typedef struct SETACL3args SETACL3args; struct SETACL3resok { post_op_attr attr; }; typedef struct SETACL3resok SETACL3resok; struct SETACL3resfail { post_op_attr attr; }; typedef struct SETACL3resfail SETACL3resfail; struct SETACL3res { nfsstat3 status; union { SETACL3resok resok; SETACL3resfail resfail; } SETACL3res_u; }; typedef struct SETACL3res SETACL3res; struct GETXATTRDIR3args { nfs_fh3 fh; bool_t create; }; typedef struct GETXATTRDIR3args GETXATTRDIR3args; struct GETXATTRDIR3resok { nfs_fh3 fh; post_op_attr attr; }; typedef struct GETXATTRDIR3resok GETXATTRDIR3resok; struct GETXATTRDIR3res { nfsstat3 status; union { GETXATTRDIR3resok resok; } GETXATTRDIR3res_u; }; typedef struct GETXATTRDIR3res GETXATTRDIR3res; struct GETACL4args { nfs_fh4 fh; u_int mask; }; typedef struct GETACL4args GETACL4args; struct GETACL4resok { post_op_attr attr; secattr acl; }; typedef struct GETACL4resok GETACL4resok; struct GETACL4resfail { post_op_attr attr; }; typedef struct GETACL4resfail GETACL4resfail; struct GETACL4res { nfsstat3 status; union { GETACL4resok resok; GETACL4resfail resfail; } GETACL4res_u; }; typedef struct GETACL4res GETACL4res; struct SETACL4args { nfs_fh4 fh; secattr acl; }; typedef struct SETACL4args SETACL4args; struct SETACL4resok { post_op_attr attr; }; typedef struct SETACL4resok SETACL4resok; struct SETACL4resfail { post_op_attr attr; }; typedef struct SETACL4resfail SETACL4resfail; struct SETACL4res { nfsstat3 status; union { SETACL4resok resok; SETACL4resfail resfail; } SETACL4res_u; }; typedef struct SETACL4res SETACL4res; #define NFS_ACL_PORT 2049 #define NFS_ACL_PROGRAM 100227 #define NFS_ACL_V2 2 #if defined(__STDC__) || defined(__cplusplus) #define ACLPROC2_NULL 0 extern void * aclproc2_null_2(void *, CLIENT *); extern void * aclproc2_null_2_svc(void *, struct svc_req *); #define ACLPROC2_GETACL 1 extern GETACL2res * aclproc2_getacl_2(GETACL2args *, CLIENT *); extern GETACL2res * aclproc2_getacl_2_svc(GETACL2args *, struct svc_req *); #define ACLPROC2_SETACL 2 extern SETACL2res * aclproc2_setacl_2(SETACL2args *, CLIENT *); extern SETACL2res * aclproc2_setacl_2_svc(SETACL2args *, struct svc_req *); #define ACLPROC2_GETATTR 3 extern GETATTR2res * aclproc2_getattr_2(GETATTR2args *, CLIENT *); extern GETATTR2res * aclproc2_getattr_2_svc(GETATTR2args *, struct svc_req *); #define ACLPROC2_ACCESS 4 extern ACCESS2res * aclproc2_access_2(ACCESS2args *, CLIENT *); extern ACCESS2res * aclproc2_access_2_svc(ACCESS2args *, struct svc_req *); #define ACLPROC2_GETXATTRDIR 5 extern GETXATTRDIR2res * aclproc2_getxattrdir_2(GETXATTRDIR2args *, CLIENT *); extern GETXATTRDIR2res * aclproc2_getxattrdir_2_svc(GETXATTRDIR2args *, struct svc_req *); extern int nfs_acl_program_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define ACLPROC2_NULL 0 extern void * aclproc2_null_2(); extern void * aclproc2_null_2_svc(); #define ACLPROC2_GETACL 1 extern GETACL2res * aclproc2_getacl_2(); extern GETACL2res * aclproc2_getacl_2_svc(); #define ACLPROC2_SETACL 2 extern SETACL2res * aclproc2_setacl_2(); extern SETACL2res * aclproc2_setacl_2_svc(); #define ACLPROC2_GETATTR 3 extern GETATTR2res * aclproc2_getattr_2(); extern GETATTR2res * aclproc2_getattr_2_svc(); #define ACLPROC2_ACCESS 4 extern ACCESS2res * aclproc2_access_2(); extern ACCESS2res * aclproc2_access_2_svc(); #define ACLPROC2_GETXATTRDIR 5 extern GETXATTRDIR2res * aclproc2_getxattrdir_2(); extern GETXATTRDIR2res * aclproc2_getxattrdir_2_svc(); extern int nfs_acl_program_2_freeresult(); #endif /* K&R C */ #define NFS_ACL_V3 3 #if defined(__STDC__) || defined(__cplusplus) #define ACLPROC3_NULL 0 extern void * aclproc3_null_3(void *, CLIENT *); extern void * aclproc3_null_3_svc(void *, struct svc_req *); #define ACLPROC3_GETACL 1 extern GETACL3res * aclproc3_getacl_3(GETACL3args *, CLIENT *); extern GETACL3res * aclproc3_getacl_3_svc(GETACL3args *, struct svc_req *); #define ACLPROC3_SETACL 2 extern SETACL3res * aclproc3_setacl_3(SETACL3args *, CLIENT *); extern SETACL3res * aclproc3_setacl_3_svc(SETACL3args *, struct svc_req *); #define ACLPROC3_GETXATTRDIR 3 extern GETXATTRDIR3res * aclproc3_getxattrdir_3(GETXATTRDIR3args *, CLIENT *); extern GETXATTRDIR3res * aclproc3_getxattrdir_3_svc(GETXATTRDIR3args *, struct svc_req *); extern int nfs_acl_program_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define ACLPROC3_NULL 0 extern void * aclproc3_null_3(); extern void * aclproc3_null_3_svc(); #define ACLPROC3_GETACL 1 extern GETACL3res * aclproc3_getacl_3(); extern GETACL3res * aclproc3_getacl_3_svc(); #define ACLPROC3_SETACL 2 extern SETACL3res * aclproc3_setacl_3(); extern SETACL3res * aclproc3_setacl_3_svc(); #define ACLPROC3_GETXATTRDIR 3 extern GETXATTRDIR3res * aclproc3_getxattrdir_3(); extern GETXATTRDIR3res * aclproc3_getxattrdir_3_svc(); extern int nfs_acl_program_3_freeresult(); #endif /* K&R C */ #define NFS_ACL_V4 4 #if defined(__STDC__) || defined(__cplusplus) #define ACLPROC4_NULL 0 extern void * aclproc4_null_4(void *, CLIENT *); extern void * aclproc4_null_4_svc(void *, struct svc_req *); #define ACLPROC4_GETACL 1 extern GETACL4res * aclproc4_getacl_4(GETACL4args *, CLIENT *); extern GETACL4res * aclproc4_getacl_4_svc(GETACL4args *, struct svc_req *); #define ACLPROC4_SETACL 2 extern SETACL4res * aclproc4_setacl_4(SETACL4args *, CLIENT *); extern SETACL4res * aclproc4_setacl_4_svc(SETACL4args *, struct svc_req *); extern int nfs_acl_program_4_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define ACLPROC4_NULL 0 extern void * aclproc4_null_4(); extern void * aclproc4_null_4_svc(); #define ACLPROC4_GETACL 1 extern GETACL4res * aclproc4_getacl_4(); extern GETACL4res * aclproc4_getacl_4_svc(); #define ACLPROC4_SETACL 2 extern SETACL4res * aclproc4_setacl_4(); extern SETACL4res * aclproc4_setacl_4_svc(); extern int nfs_acl_program_4_freeresult(); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_uid(XDR *, uid*); extern bool_t xdr_o_mode(XDR *, o_mode*); extern bool_t xdr_aclent(XDR *, aclent*); extern bool_t xdr_secattr(XDR *, secattr*); extern bool_t xdr_GETACL2args(XDR *, GETACL2args*); extern bool_t xdr_GETACL2resok(XDR *, GETACL2resok*); extern bool_t xdr_GETACL2res(XDR *, GETACL2res*); extern bool_t xdr_SETACL2args(XDR *, SETACL2args*); extern bool_t xdr_SETACL2resok(XDR *, SETACL2resok*); extern bool_t xdr_SETACL2res(XDR *, SETACL2res*); extern bool_t xdr_GETATTR2args(XDR *, GETATTR2args*); extern bool_t xdr_GETATTR2resok(XDR *, GETATTR2resok*); extern bool_t xdr_GETATTR2res(XDR *, GETATTR2res*); extern bool_t xdr_ACCESS2args(XDR *, ACCESS2args*); extern bool_t xdr_ACCESS2resok(XDR *, ACCESS2resok*); extern bool_t xdr_ACCESS2res(XDR *, ACCESS2res*); extern bool_t xdr_GETXATTRDIR2args(XDR *, GETXATTRDIR2args*); extern bool_t xdr_GETXATTRDIR2resok(XDR *, GETXATTRDIR2resok*); extern bool_t xdr_GETXATTRDIR2res(XDR *, GETXATTRDIR2res*); extern bool_t xdr_GETACL3args(XDR *, GETACL3args*); extern bool_t xdr_GETACL3resok(XDR *, GETACL3resok*); extern bool_t xdr_GETACL3resfail(XDR *, GETACL3resfail*); extern bool_t xdr_GETACL3res(XDR *, GETACL3res*); extern bool_t xdr_SETACL3args(XDR *, SETACL3args*); extern bool_t xdr_SETACL3resok(XDR *, SETACL3resok*); extern bool_t xdr_SETACL3resfail(XDR *, SETACL3resfail*); extern bool_t xdr_SETACL3res(XDR *, SETACL3res*); extern bool_t xdr_GETXATTRDIR3args(XDR *, GETXATTRDIR3args*); extern bool_t xdr_GETXATTRDIR3resok(XDR *, GETXATTRDIR3resok*); extern bool_t xdr_GETXATTRDIR3res(XDR *, GETXATTRDIR3res*); extern bool_t xdr_GETACL4args(XDR *, GETACL4args*); extern bool_t xdr_GETACL4resok(XDR *, GETACL4resok*); extern bool_t xdr_GETACL4resfail(XDR *, GETACL4resfail*); extern bool_t xdr_GETACL4res(XDR *, GETACL4res*); extern bool_t xdr_SETACL4args(XDR *, SETACL4args*); extern bool_t xdr_SETACL4resok(XDR *, SETACL4resok*); extern bool_t xdr_SETACL4resfail(XDR *, SETACL4resfail*); extern bool_t xdr_SETACL4res(XDR *, SETACL4res*); #else /* K&R C */ extern bool_t xdr_uid(); extern bool_t xdr_o_mode(); extern bool_t xdr_aclent(); extern bool_t xdr_secattr(); extern bool_t xdr_GETACL2args(); extern bool_t xdr_GETACL2resok(); extern bool_t xdr_GETACL2res(); extern bool_t xdr_SETACL2args(); extern bool_t xdr_SETACL2resok(); extern bool_t xdr_SETACL2res(); extern bool_t xdr_GETATTR2args(); extern bool_t xdr_GETATTR2resok(); extern bool_t xdr_GETATTR2res(); extern bool_t xdr_ACCESS2args(); extern bool_t xdr_ACCESS2resok(); extern bool_t xdr_ACCESS2res(); extern bool_t xdr_GETXATTRDIR2args(); extern bool_t xdr_GETXATTRDIR2resok(); extern bool_t xdr_GETXATTRDIR2res(); extern bool_t xdr_GETACL3args(); extern bool_t xdr_GETACL3resok(); extern bool_t xdr_GETACL3resfail(); extern bool_t xdr_GETACL3res(); extern bool_t xdr_SETACL3args(); extern bool_t xdr_SETACL3resok(); extern bool_t xdr_SETACL3resfail(); extern bool_t xdr_SETACL3res(); extern bool_t xdr_GETXATTRDIR3args(); extern bool_t xdr_GETXATTRDIR3resok(); extern bool_t xdr_GETXATTRDIR3res(); extern bool_t xdr_GETACL4args(); extern bool_t xdr_GETACL4resok(); extern bool_t xdr_GETACL4resfail(); extern bool_t xdr_GETACL4res(); extern bool_t xdr_SETACL4args(); extern bool_t xdr_SETACL4resok(); extern bool_t xdr_SETACL4resfail(); extern bool_t xdr_SETACL4res(); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_NFS_ACL_H_RPCGEN */ /* * 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. */ 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; int dfaclcnt; aclent dfaclent; }; /* * 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; /* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _NFS_PROT_H_RPCGEN #define _NFS_PROT_H_RPCGEN #include #ifdef __cplusplus extern "C" { #endif /* * Definitions for uint64, int64, uint32, and int32 */ #include #define NFS_PORT 2049 #define NFS_MAXDATA 8192 #define NFS_MAXPATHLEN 1024 #define NFS_MAXNAMLEN 255 #define NFS_FHSIZE 32 #define NFS_COOKIESIZE 4 #define NFS_FIFO_DEV -1 #define NFSMODE_FMT 0170000 #define NFSMODE_DIR 0040000 #define NFSMODE_CHR 0020000 #define NFSMODE_BLK 0060000 #define NFSMODE_REG 0100000 #define NFSMODE_LNK 0120000 #define NFSMODE_SOCK 0140000 #define NFSMODE_FIFO 0010000 enum nfsstat { NFS_OK = 0, NFSERR_PERM = 1, NFSERR_NOENT = 2, NFSERR_IO = 5, NFSERR_NXIO = 6, NFSERR_ACCES = 13, NFSERR_EXIST = 17, NFSERR_XDEV = 18, NFSERR_NODEV = 19, NFSERR_NOTDIR = 20, NFSERR_ISDIR = 21, NFSERR_INVAL = 22, NFSERR_FBIG = 27, NFSERR_NOSPC = 28, NFSERR_ROFS = 30, NFSERR_OPNOTSUPP = 45, NFSERR_NAMETOOLONG = 63, NFSERR_NOTEMPTY = 66, NFSERR_DQUOT = 69, NFSERR_STALE = 70, NFSERR_REMOTE = 71, NFSERR_WFLUSH = 72 }; typedef enum nfsstat nfsstat; enum ftype { NFNON = 0, NFREG = 1, NFDIR = 2, NFBLK = 3, NFCHR = 4, NFLNK = 5, NFSOCK = 6, NFBAD = 7, NFFIFO = 8 }; typedef enum ftype ftype; struct nfs_fh { char data[NFS_FHSIZE]; }; typedef struct nfs_fh nfs_fh; struct nfstime { u_int seconds; u_int useconds; }; typedef struct nfstime nfstime; struct fattr { ftype type; u_int mode; u_int nlink; u_int uid; u_int gid; u_int size; u_int blocksize; u_int rdev; u_int blocks; u_int fsid; u_int fileid; nfstime atime; nfstime mtime; nfstime ctime; }; typedef struct fattr fattr; struct sattr { u_int mode; u_int uid; u_int gid; u_int size; nfstime atime; nfstime mtime; }; typedef struct sattr sattr; typedef char *filename; typedef char *nfspath; struct attrstat { nfsstat status; union { fattr attributes; } attrstat_u; }; typedef struct attrstat attrstat; struct sattrargs { nfs_fh file; sattr attributes; }; typedef struct sattrargs sattrargs; struct diropargs { nfs_fh dir; filename name; }; typedef struct diropargs diropargs; struct diropokres { nfs_fh file; fattr attributes; }; typedef struct diropokres diropokres; struct diropres { nfsstat status; union { diropokres diropres; } diropres_u; }; typedef struct diropres diropres; struct readlinkres { nfsstat status; union { nfspath data; } readlinkres_u; }; typedef struct readlinkres readlinkres; struct readargs { nfs_fh file; u_int offset; u_int count; u_int totalcount; }; typedef struct readargs readargs; struct readokres { fattr attributes; struct { u_int data_len; char *data_val; } data; }; typedef struct readokres readokres; struct readres { nfsstat status; union { readokres reply; } readres_u; }; typedef struct readres readres; struct writeargs { nfs_fh file; u_int beginoffset; u_int offset; u_int totalcount; struct { u_int data_len; char *data_val; } data; }; typedef struct writeargs writeargs; struct createargs { diropargs where; sattr attributes; }; typedef struct createargs createargs; struct renameargs { diropargs from; diropargs to; }; typedef struct renameargs renameargs; struct linkargs { nfs_fh from; diropargs to; }; typedef struct linkargs linkargs; struct symlinkargs { diropargs from; nfspath to; sattr attributes; }; typedef struct symlinkargs symlinkargs; typedef char nfscookie[NFS_COOKIESIZE]; struct readdirargs { nfs_fh dir; nfscookie cookie; u_int count; }; typedef struct readdirargs readdirargs; struct entry { u_int fileid; filename name; nfscookie cookie; struct entry *nextentry; }; typedef struct entry entry; struct dirlist { entry *entries; bool_t eof; }; typedef struct dirlist dirlist; struct readdirres { nfsstat status; union { dirlist reply; } readdirres_u; }; typedef struct readdirres readdirres; struct statfsokres { u_int tsize; u_int bsize; u_int blocks; u_int bfree; u_int bavail; }; typedef struct statfsokres statfsokres; struct statfsres { nfsstat status; union { statfsokres reply; } statfsres_u; }; typedef struct statfsres statfsres; #define NFS3_FHSIZE 64 #define NFS3_COOKIEVERFSIZE 8 #define NFS3_CREATEVERFSIZE 8 #define NFS3_WRITEVERFSIZE 8 typedef char *filename3; typedef char *nfspath3; typedef uint64 fileid3; typedef uint64 cookie3; typedef char cookieverf3[NFS3_COOKIEVERFSIZE]; typedef char createverf3[NFS3_CREATEVERFSIZE]; typedef char writeverf3[NFS3_WRITEVERFSIZE]; typedef uint32 uid3; typedef uint32 gid3; typedef uint64 size3; typedef uint64 offset3; typedef uint32 mode3; typedef uint32 count3; 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 }; typedef enum nfsstat3 nfsstat3; enum ftype3 { NF3REG = 1, NF3DIR = 2, NF3BLK = 3, NF3CHR = 4, NF3LNK = 5, NF3SOCK = 6, NF3FIFO = 7 }; typedef enum ftype3 ftype3; struct specdata3 { uint32 specdata1; uint32 specdata2; }; typedef struct specdata3 specdata3; struct nfs_fh3 { struct { u_int data_len; char *data_val; } data; }; typedef struct nfs_fh3 nfs_fh3; struct nfstime3 { uint32 seconds; uint32 nseconds; }; typedef struct nfstime3 nfstime3; 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; }; typedef struct fattr3 fattr3; struct post_op_attr { bool_t attributes_follow; union { fattr3 attributes; } post_op_attr_u; }; typedef struct post_op_attr post_op_attr; struct wcc_attr { size3 size; nfstime3 mtime; nfstime3 ctime; }; typedef struct wcc_attr wcc_attr; struct pre_op_attr { bool_t attributes_follow; union { wcc_attr attributes; } pre_op_attr_u; }; typedef struct pre_op_attr pre_op_attr; struct wcc_data { pre_op_attr before; post_op_attr after; }; typedef struct wcc_data wcc_data; struct post_op_fh3 { bool_t handle_follows; union { nfs_fh3 handle; } post_op_fh3_u; }; typedef struct post_op_fh3 post_op_fh3; enum time_how { DONT_CHANGE = 0, SET_TO_SERVER_TIME = 1, SET_TO_CLIENT_TIME = 2 }; typedef enum time_how time_how; struct set_mode3 { bool_t set_it; union { mode3 mode; } set_mode3_u; }; typedef struct set_mode3 set_mode3; struct set_uid3 { bool_t set_it; union { uid3 uid; } set_uid3_u; }; typedef struct set_uid3 set_uid3; struct set_gid3 { bool_t set_it; union { gid3 gid; } set_gid3_u; }; typedef struct set_gid3 set_gid3; struct set_size3 { bool_t set_it; union { size3 size; } set_size3_u; }; typedef struct set_size3 set_size3; struct set_atime { time_how set_it; union { nfstime3 atime; } set_atime_u; }; typedef struct set_atime set_atime; struct set_mtime { time_how set_it; union { nfstime3 mtime; } set_mtime_u; }; typedef struct set_mtime set_mtime; struct sattr3 { set_mode3 mode; set_uid3 uid; set_gid3 gid; set_size3 size; set_atime atime; set_mtime mtime; }; typedef struct sattr3 sattr3; struct diropargs3 { nfs_fh3 dir; filename3 name; }; typedef struct diropargs3 diropargs3; struct GETATTR3args { nfs_fh3 object; }; typedef struct GETATTR3args GETATTR3args; struct GETATTR3resok { fattr3 obj_attributes; }; typedef struct GETATTR3resok GETATTR3resok; struct GETATTR3res { nfsstat3 status; union { GETATTR3resok resok; } GETATTR3res_u; }; typedef struct GETATTR3res GETATTR3res; struct sattrguard3 { bool_t check; union { nfstime3 obj_ctime; } sattrguard3_u; }; typedef struct sattrguard3 sattrguard3; struct SETATTR3args { nfs_fh3 object; sattr3 new_attributes; sattrguard3 guard; }; typedef struct SETATTR3args SETATTR3args; struct SETATTR3resok { wcc_data obj_wcc; }; typedef struct SETATTR3resok SETATTR3resok; struct SETATTR3resfail { wcc_data obj_wcc; }; typedef struct SETATTR3resfail SETATTR3resfail; struct SETATTR3res { nfsstat3 status; union { SETATTR3resok resok; SETATTR3resfail resfail; } SETATTR3res_u; }; typedef struct SETATTR3res SETATTR3res; struct LOOKUP3args { diropargs3 what; }; typedef struct LOOKUP3args LOOKUP3args; struct LOOKUP3resok { nfs_fh3 object; post_op_attr obj_attributes; post_op_attr dir_attributes; }; typedef struct LOOKUP3resok LOOKUP3resok; struct LOOKUP3resfail { post_op_attr dir_attributes; }; typedef struct LOOKUP3resfail LOOKUP3resfail; struct LOOKUP3res { nfsstat3 status; union { LOOKUP3resok resok; LOOKUP3resfail resfail; } LOOKUP3res_u; }; typedef struct LOOKUP3res LOOKUP3res; #define ACCESS3_READ 0x0001 #define ACCESS3_LOOKUP 0x0002 #define ACCESS3_MODIFY 0x0004 #define ACCESS3_EXTEND 0x0008 #define ACCESS3_DELETE 0x0010 #define ACCESS3_EXECUTE 0x0020 struct ACCESS3args { nfs_fh3 object; uint32 access; }; typedef struct ACCESS3args ACCESS3args; struct ACCESS3resok { post_op_attr obj_attributes; uint32 access; }; typedef struct ACCESS3resok ACCESS3resok; struct ACCESS3resfail { post_op_attr obj_attributes; }; typedef struct ACCESS3resfail ACCESS3resfail; struct ACCESS3res { nfsstat3 status; union { ACCESS3resok resok; ACCESS3resfail resfail; } ACCESS3res_u; }; typedef struct ACCESS3res ACCESS3res; struct READLINK3args { nfs_fh3 symlink; }; typedef struct READLINK3args READLINK3args; struct READLINK3resok { post_op_attr symlink_attributes; nfspath3 data; }; typedef struct READLINK3resok READLINK3resok; struct READLINK3resfail { post_op_attr symlink_attributes; }; typedef struct READLINK3resfail READLINK3resfail; struct READLINK3res { nfsstat3 status; union { READLINK3resok resok; READLINK3resfail resfail; } READLINK3res_u; }; typedef struct READLINK3res READLINK3res; struct READ3args { nfs_fh3 file; offset3 offset; count3 count; }; typedef struct READ3args READ3args; struct READ3resok { post_op_attr file_attributes; count3 count; bool_t eof; struct { u_int data_len; char *data_val; } data; }; typedef struct READ3resok READ3resok; struct READ3resfail { post_op_attr file_attributes; }; typedef struct READ3resfail READ3resfail; struct READ3res { nfsstat3 status; union { READ3resok resok; READ3resfail resfail; } READ3res_u; }; typedef struct READ3res READ3res; enum stable_how { UNSTABLE = 0, DATA_SYNC = 1, FILE_SYNC = 2 }; typedef enum stable_how stable_how; struct WRITE3args { nfs_fh3 file; offset3 offset; count3 count; stable_how stable; struct { u_int data_len; char *data_val; } data; }; typedef struct WRITE3args WRITE3args; struct WRITE3resok { wcc_data file_wcc; count3 count; stable_how committed; writeverf3 verf; }; typedef struct WRITE3resok WRITE3resok; struct WRITE3resfail { wcc_data file_wcc; }; typedef struct WRITE3resfail WRITE3resfail; struct WRITE3res { nfsstat3 status; union { WRITE3resok resok; WRITE3resfail resfail; } WRITE3res_u; }; typedef struct WRITE3res WRITE3res; enum createmode3 { UNCHECKED = 0, GUARDED = 1, EXCLUSIVE = 2 }; typedef enum createmode3 createmode3; struct createhow3 { createmode3 mode; union { sattr3 obj_attributes; createverf3 verf; } createhow3_u; }; typedef struct createhow3 createhow3; struct CREATE3args { diropargs3 where; createhow3 how; }; typedef struct CREATE3args CREATE3args; struct CREATE3resok { post_op_fh3 obj; post_op_attr obj_attributes; wcc_data dir_wcc; }; typedef struct CREATE3resok CREATE3resok; struct CREATE3resfail { wcc_data dir_wcc; }; typedef struct CREATE3resfail CREATE3resfail; struct CREATE3res { nfsstat3 status; union { CREATE3resok resok; CREATE3resfail resfail; } CREATE3res_u; }; typedef struct CREATE3res CREATE3res; struct MKDIR3args { diropargs3 where; sattr3 attributes; }; typedef struct MKDIR3args MKDIR3args; struct MKDIR3resok { post_op_fh3 obj; post_op_attr obj_attributes; wcc_data dir_wcc; }; typedef struct MKDIR3resok MKDIR3resok; struct MKDIR3resfail { wcc_data dir_wcc; }; typedef struct MKDIR3resfail MKDIR3resfail; struct MKDIR3res { nfsstat3 status; union { MKDIR3resok resok; MKDIR3resfail resfail; } MKDIR3res_u; }; typedef struct MKDIR3res MKDIR3res; struct symlinkdata3 { sattr3 symlink_attributes; nfspath3 symlink_data; }; typedef struct symlinkdata3 symlinkdata3; struct SYMLINK3args { diropargs3 where; symlinkdata3 symlink; }; typedef struct SYMLINK3args SYMLINK3args; struct SYMLINK3resok { post_op_fh3 obj; post_op_attr obj_attributes; wcc_data dir_wcc; }; typedef struct SYMLINK3resok SYMLINK3resok; struct SYMLINK3resfail { wcc_data dir_wcc; }; typedef struct SYMLINK3resfail SYMLINK3resfail; struct SYMLINK3res { nfsstat3 status; union { SYMLINK3resok resok; SYMLINK3resfail resfail; } SYMLINK3res_u; }; typedef struct SYMLINK3res SYMLINK3res; struct devicedata3 { sattr3 dev_attributes; specdata3 spec; }; typedef struct devicedata3 devicedata3; struct mknoddata3 { ftype3 type; union { devicedata3 device; sattr3 pipe_attributes; } mknoddata3_u; }; typedef struct mknoddata3 mknoddata3; struct MKNOD3args { diropargs3 where; mknoddata3 what; }; typedef struct MKNOD3args MKNOD3args; struct MKNOD3resok { post_op_fh3 obj; post_op_attr obj_attributes; wcc_data dir_wcc; }; typedef struct MKNOD3resok MKNOD3resok; struct MKNOD3resfail { wcc_data dir_wcc; }; typedef struct MKNOD3resfail MKNOD3resfail; struct MKNOD3res { nfsstat3 status; union { MKNOD3resok resok; MKNOD3resfail resfail; } MKNOD3res_u; }; typedef struct MKNOD3res MKNOD3res; struct REMOVE3args { diropargs3 object; }; typedef struct REMOVE3args REMOVE3args; struct REMOVE3resok { wcc_data dir_wcc; }; typedef struct REMOVE3resok REMOVE3resok; struct REMOVE3resfail { wcc_data dir_wcc; }; typedef struct REMOVE3resfail REMOVE3resfail; struct REMOVE3res { nfsstat3 status; union { REMOVE3resok resok; REMOVE3resfail resfail; } REMOVE3res_u; }; typedef struct REMOVE3res REMOVE3res; struct RMDIR3args { diropargs3 object; }; typedef struct RMDIR3args RMDIR3args; struct RMDIR3resok { wcc_data dir_wcc; }; typedef struct RMDIR3resok RMDIR3resok; struct RMDIR3resfail { wcc_data dir_wcc; }; typedef struct RMDIR3resfail RMDIR3resfail; struct RMDIR3res { nfsstat3 status; union { RMDIR3resok resok; RMDIR3resfail resfail; } RMDIR3res_u; }; typedef struct RMDIR3res RMDIR3res; struct RENAME3args { diropargs3 from; diropargs3 to; }; typedef struct RENAME3args RENAME3args; struct RENAME3resok { wcc_data fromdir_wcc; wcc_data todir_wcc; }; typedef struct RENAME3resok RENAME3resok; struct RENAME3resfail { wcc_data fromdir_wcc; wcc_data todir_wcc; }; typedef struct RENAME3resfail RENAME3resfail; struct RENAME3res { nfsstat3 status; union { RENAME3resok resok; RENAME3resfail resfail; } RENAME3res_u; }; typedef struct RENAME3res RENAME3res; struct LINK3args { nfs_fh3 file; diropargs3 link; }; typedef struct LINK3args LINK3args; struct LINK3resok { post_op_attr file_attributes; wcc_data linkdir_wcc; }; typedef struct LINK3resok LINK3resok; struct LINK3resfail { post_op_attr file_attributes; wcc_data linkdir_wcc; }; typedef struct LINK3resfail LINK3resfail; struct LINK3res { nfsstat3 status; union { LINK3resok resok; LINK3resfail resfail; } LINK3res_u; }; typedef struct LINK3res LINK3res; struct READDIR3args { nfs_fh3 dir; cookie3 cookie; cookieverf3 cookieverf; count3 count; }; typedef struct READDIR3args READDIR3args; struct entry3 { fileid3 fileid; filename3 name; cookie3 cookie; struct entry3 *nextentry; }; typedef struct entry3 entry3; struct dirlist3 { entry3 *entries; bool_t eof; }; typedef struct dirlist3 dirlist3; struct READDIR3resok { post_op_attr dir_attributes; cookieverf3 cookieverf; dirlist3 reply; }; typedef struct READDIR3resok READDIR3resok; struct READDIR3resfail { post_op_attr dir_attributes; }; typedef struct READDIR3resfail READDIR3resfail; struct READDIR3res { nfsstat3 status; union { READDIR3resok resok; READDIR3resfail resfail; } READDIR3res_u; }; typedef struct READDIR3res READDIR3res; struct READDIRPLUS3args { nfs_fh3 dir; cookie3 cookie; cookieverf3 cookieverf; count3 dircount; count3 maxcount; }; typedef struct READDIRPLUS3args READDIRPLUS3args; struct entryplus3 { fileid3 fileid; filename3 name; cookie3 cookie; post_op_attr name_attributes; post_op_fh3 name_handle; struct entryplus3 *nextentry; }; typedef struct entryplus3 entryplus3; struct dirlistplus3 { entryplus3 *entries; bool_t eof; }; typedef struct dirlistplus3 dirlistplus3; struct READDIRPLUS3resok { post_op_attr dir_attributes; cookieverf3 cookieverf; dirlistplus3 reply; }; typedef struct READDIRPLUS3resok READDIRPLUS3resok; struct READDIRPLUS3resfail { post_op_attr dir_attributes; }; typedef struct READDIRPLUS3resfail READDIRPLUS3resfail; struct READDIRPLUS3res { nfsstat3 status; union { READDIRPLUS3resok resok; READDIRPLUS3resfail resfail; } READDIRPLUS3res_u; }; typedef struct READDIRPLUS3res READDIRPLUS3res; struct FSSTAT3args { nfs_fh3 fsroot; }; typedef struct FSSTAT3args FSSTAT3args; struct FSSTAT3resok { post_op_attr obj_attributes; size3 tbytes; size3 fbytes; size3 abytes; size3 tfiles; size3 ffiles; size3 afiles; uint32 invarsec; }; typedef struct FSSTAT3resok FSSTAT3resok; struct FSSTAT3resfail { post_op_attr obj_attributes; }; typedef struct FSSTAT3resfail FSSTAT3resfail; struct FSSTAT3res { nfsstat3 status; union { FSSTAT3resok resok; FSSTAT3resfail resfail; } FSSTAT3res_u; }; typedef struct FSSTAT3res FSSTAT3res; #define FSF3_LINK 0x0001 #define FSF3_SYMLINK 0x0002 #define FSF3_HOMOGENEOUS 0x0008 #define FSF3_CANSETTIME 0x0010 struct FSINFO3args { nfs_fh3 fsroot; }; typedef struct FSINFO3args FSINFO3args; 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; }; typedef struct FSINFO3resok FSINFO3resok; struct FSINFO3resfail { post_op_attr obj_attributes; }; typedef struct FSINFO3resfail FSINFO3resfail; struct FSINFO3res { nfsstat3 status; union { FSINFO3resok resok; FSINFO3resfail resfail; } FSINFO3res_u; }; typedef struct FSINFO3res FSINFO3res; struct PATHCONF3args { nfs_fh3 object; }; typedef struct PATHCONF3args PATHCONF3args; struct PATHCONF3resok { post_op_attr obj_attributes; uint32 linkmax; uint32 name_max; bool_t no_trunc; bool_t chown_restricted; bool_t case_insensitive; bool_t case_preserving; }; typedef struct PATHCONF3resok PATHCONF3resok; struct PATHCONF3resfail { post_op_attr obj_attributes; }; typedef struct PATHCONF3resfail PATHCONF3resfail; struct PATHCONF3res { nfsstat3 status; union { PATHCONF3resok resok; PATHCONF3resfail resfail; } PATHCONF3res_u; }; typedef struct PATHCONF3res PATHCONF3res; struct COMMIT3args { nfs_fh3 file; offset3 offset; count3 count; }; typedef struct COMMIT3args COMMIT3args; struct COMMIT3resok { wcc_data file_wcc; writeverf3 verf; }; typedef struct COMMIT3resok COMMIT3resok; struct COMMIT3resfail { wcc_data file_wcc; }; typedef struct COMMIT3resfail COMMIT3resfail; struct COMMIT3res { nfsstat3 status; union { COMMIT3resok resok; COMMIT3resfail resfail; } COMMIT3res_u; }; typedef struct COMMIT3res COMMIT3res; #define NFS_PROGRAM 100003 #define NFS_VERSION 2 #if defined(__STDC__) || defined(__cplusplus) #define NFSPROC_NULL 0 extern void * nfsproc_null_2(void *, CLIENT *); extern void * nfsproc_null_2_svc(void *, struct svc_req *); #define NFSPROC_GETATTR 1 extern attrstat * nfsproc_getattr_2(nfs_fh *, CLIENT *); extern attrstat * nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); #define NFSPROC_SETATTR 2 extern attrstat * nfsproc_setattr_2(sattrargs *, CLIENT *); extern attrstat * nfsproc_setattr_2_svc(sattrargs *, struct svc_req *); #define NFSPROC_ROOT 3 extern void * nfsproc_root_2(void *, CLIENT *); extern void * nfsproc_root_2_svc(void *, struct svc_req *); #define NFSPROC_LOOKUP 4 extern diropres * nfsproc_lookup_2(diropargs *, CLIENT *); extern diropres * nfsproc_lookup_2_svc(diropargs *, struct svc_req *); #define NFSPROC_READLINK 5 extern readlinkres * nfsproc_readlink_2(nfs_fh *, CLIENT *); extern readlinkres * nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); #define NFSPROC_READ 6 extern readres * nfsproc_read_2(readargs *, CLIENT *); extern readres * nfsproc_read_2_svc(readargs *, struct svc_req *); #define NFSPROC_WRITECACHE 7 extern void * nfsproc_writecache_2(void *, CLIENT *); extern void * nfsproc_writecache_2_svc(void *, struct svc_req *); #define NFSPROC_WRITE 8 extern attrstat * nfsproc_write_2(writeargs *, CLIENT *); extern attrstat * nfsproc_write_2_svc(writeargs *, struct svc_req *); #define NFSPROC_CREATE 9 extern diropres * nfsproc_create_2(createargs *, CLIENT *); extern diropres * nfsproc_create_2_svc(createargs *, struct svc_req *); #define NFSPROC_REMOVE 10 extern nfsstat * nfsproc_remove_2(diropargs *, CLIENT *); extern nfsstat * nfsproc_remove_2_svc(diropargs *, struct svc_req *); #define NFSPROC_RENAME 11 extern nfsstat * nfsproc_rename_2(renameargs *, CLIENT *); extern nfsstat * nfsproc_rename_2_svc(renameargs *, struct svc_req *); #define NFSPROC_LINK 12 extern nfsstat * nfsproc_link_2(linkargs *, CLIENT *); extern nfsstat * nfsproc_link_2_svc(linkargs *, struct svc_req *); #define NFSPROC_SYMLINK 13 extern nfsstat * nfsproc_symlink_2(symlinkargs *, CLIENT *); extern nfsstat * nfsproc_symlink_2_svc(symlinkargs *, struct svc_req *); #define NFSPROC_MKDIR 14 extern diropres * nfsproc_mkdir_2(createargs *, CLIENT *); extern diropres * nfsproc_mkdir_2_svc(createargs *, struct svc_req *); #define NFSPROC_RMDIR 15 extern nfsstat * nfsproc_rmdir_2(diropargs *, CLIENT *); extern nfsstat * nfsproc_rmdir_2_svc(diropargs *, struct svc_req *); #define NFSPROC_READDIR 16 extern readdirres * nfsproc_readdir_2(readdirargs *, CLIENT *); extern readdirres * nfsproc_readdir_2_svc(readdirargs *, struct svc_req *); #define NFSPROC_STATFS 17 extern statfsres * nfsproc_statfs_2(nfs_fh *, CLIENT *); extern statfsres * nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); extern int nfs_program_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define NFSPROC_NULL 0 extern void * nfsproc_null_2(); extern void * nfsproc_null_2_svc(); #define NFSPROC_GETATTR 1 extern attrstat * nfsproc_getattr_2(); extern attrstat * nfsproc_getattr_2_svc(); #define NFSPROC_SETATTR 2 extern attrstat * nfsproc_setattr_2(); extern attrstat * nfsproc_setattr_2_svc(); #define NFSPROC_ROOT 3 extern void * nfsproc_root_2(); extern void * nfsproc_root_2_svc(); #define NFSPROC_LOOKUP 4 extern diropres * nfsproc_lookup_2(); extern diropres * nfsproc_lookup_2_svc(); #define NFSPROC_READLINK 5 extern readlinkres * nfsproc_readlink_2(); extern readlinkres * nfsproc_readlink_2_svc(); #define NFSPROC_READ 6 extern readres * nfsproc_read_2(); extern readres * nfsproc_read_2_svc(); #define NFSPROC_WRITECACHE 7 extern void * nfsproc_writecache_2(); extern void * nfsproc_writecache_2_svc(); #define NFSPROC_WRITE 8 extern attrstat * nfsproc_write_2(); extern attrstat * nfsproc_write_2_svc(); #define NFSPROC_CREATE 9 extern diropres * nfsproc_create_2(); extern diropres * nfsproc_create_2_svc(); #define NFSPROC_REMOVE 10 extern nfsstat * nfsproc_remove_2(); extern nfsstat * nfsproc_remove_2_svc(); #define NFSPROC_RENAME 11 extern nfsstat * nfsproc_rename_2(); extern nfsstat * nfsproc_rename_2_svc(); #define NFSPROC_LINK 12 extern nfsstat * nfsproc_link_2(); extern nfsstat * nfsproc_link_2_svc(); #define NFSPROC_SYMLINK 13 extern nfsstat * nfsproc_symlink_2(); extern nfsstat * nfsproc_symlink_2_svc(); #define NFSPROC_MKDIR 14 extern diropres * nfsproc_mkdir_2(); extern diropres * nfsproc_mkdir_2_svc(); #define NFSPROC_RMDIR 15 extern nfsstat * nfsproc_rmdir_2(); extern nfsstat * nfsproc_rmdir_2_svc(); #define NFSPROC_READDIR 16 extern readdirres * nfsproc_readdir_2(); extern readdirres * nfsproc_readdir_2_svc(); #define NFSPROC_STATFS 17 extern statfsres * nfsproc_statfs_2(); extern statfsres * nfsproc_statfs_2_svc(); extern int nfs_program_2_freeresult(); #endif /* K&R C */ #define NFS3_PROGRAM 100003 #define NFS_V3 3 #if defined(__STDC__) || defined(__cplusplus) #define NFSPROC3_NULL 0 extern void * nfsproc3_null_3(void *, CLIENT *); extern void * nfsproc3_null_3_svc(void *, struct svc_req *); #define NFSPROC3_GETATTR 1 extern GETATTR3res * nfsproc3_getattr_3(GETATTR3args *, CLIENT *); extern GETATTR3res * nfsproc3_getattr_3_svc(GETATTR3args *, struct svc_req *); #define NFSPROC3_SETATTR 2 extern SETATTR3res * nfsproc3_setattr_3(SETATTR3args *, CLIENT *); extern SETATTR3res * nfsproc3_setattr_3_svc(SETATTR3args *, struct svc_req *); #define NFSPROC3_LOOKUP 3 extern LOOKUP3res * nfsproc3_lookup_3(LOOKUP3args *, CLIENT *); extern LOOKUP3res * nfsproc3_lookup_3_svc(LOOKUP3args *, struct svc_req *); #define NFSPROC3_ACCESS 4 extern ACCESS3res * nfsproc3_access_3(ACCESS3args *, CLIENT *); extern ACCESS3res * nfsproc3_access_3_svc(ACCESS3args *, struct svc_req *); #define NFSPROC3_READLINK 5 extern READLINK3res * nfsproc3_readlink_3(READLINK3args *, CLIENT *); extern READLINK3res * nfsproc3_readlink_3_svc(READLINK3args *, struct svc_req *); #define NFSPROC3_READ 6 extern READ3res * nfsproc3_read_3(READ3args *, CLIENT *); extern READ3res * nfsproc3_read_3_svc(READ3args *, struct svc_req *); #define NFSPROC3_WRITE 7 extern WRITE3res * nfsproc3_write_3(WRITE3args *, CLIENT *); extern WRITE3res * nfsproc3_write_3_svc(WRITE3args *, struct svc_req *); #define NFSPROC3_CREATE 8 extern CREATE3res * nfsproc3_create_3(CREATE3args *, CLIENT *); extern CREATE3res * nfsproc3_create_3_svc(CREATE3args *, struct svc_req *); #define NFSPROC3_MKDIR 9 extern MKDIR3res * nfsproc3_mkdir_3(MKDIR3args *, CLIENT *); extern MKDIR3res * nfsproc3_mkdir_3_svc(MKDIR3args *, struct svc_req *); #define NFSPROC3_SYMLINK 10 extern SYMLINK3res * nfsproc3_symlink_3(SYMLINK3args *, CLIENT *); extern SYMLINK3res * nfsproc3_symlink_3_svc(SYMLINK3args *, struct svc_req *); #define NFSPROC3_MKNOD 11 extern MKNOD3res * nfsproc3_mknod_3(MKNOD3args *, CLIENT *); extern MKNOD3res * nfsproc3_mknod_3_svc(MKNOD3args *, struct svc_req *); #define NFSPROC3_REMOVE 12 extern REMOVE3res * nfsproc3_remove_3(REMOVE3args *, CLIENT *); extern REMOVE3res * nfsproc3_remove_3_svc(REMOVE3args *, struct svc_req *); #define NFSPROC3_RMDIR 13 extern RMDIR3res * nfsproc3_rmdir_3(RMDIR3args *, CLIENT *); extern RMDIR3res * nfsproc3_rmdir_3_svc(RMDIR3args *, struct svc_req *); #define NFSPROC3_RENAME 14 extern RENAME3res * nfsproc3_rename_3(RENAME3args *, CLIENT *); extern RENAME3res * nfsproc3_rename_3_svc(RENAME3args *, struct svc_req *); #define NFSPROC3_LINK 15 extern LINK3res * nfsproc3_link_3(LINK3args *, CLIENT *); extern LINK3res * nfsproc3_link_3_svc(LINK3args *, struct svc_req *); #define NFSPROC3_READDIR 16 extern READDIR3res * nfsproc3_readdir_3(READDIR3args *, CLIENT *); extern READDIR3res * nfsproc3_readdir_3_svc(READDIR3args *, struct svc_req *); #define NFSPROC3_READDIRPLUS 17 extern READDIRPLUS3res * nfsproc3_readdirplus_3(READDIRPLUS3args *, CLIENT *); extern READDIRPLUS3res * nfsproc3_readdirplus_3_svc(READDIRPLUS3args *, struct svc_req *); #define NFSPROC3_FSSTAT 18 extern FSSTAT3res * nfsproc3_fsstat_3(FSSTAT3args *, CLIENT *); extern FSSTAT3res * nfsproc3_fsstat_3_svc(FSSTAT3args *, struct svc_req *); #define NFSPROC3_FSINFO 19 extern FSINFO3res * nfsproc3_fsinfo_3(FSINFO3args *, CLIENT *); extern FSINFO3res * nfsproc3_fsinfo_3_svc(FSINFO3args *, struct svc_req *); #define NFSPROC3_PATHCONF 20 extern PATHCONF3res * nfsproc3_pathconf_3(PATHCONF3args *, CLIENT *); extern PATHCONF3res * nfsproc3_pathconf_3_svc(PATHCONF3args *, struct svc_req *); #define NFSPROC3_COMMIT 21 extern COMMIT3res * nfsproc3_commit_3(COMMIT3args *, CLIENT *); extern COMMIT3res * nfsproc3_commit_3_svc(COMMIT3args *, struct svc_req *); extern int nfs3_program_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define NFSPROC3_NULL 0 extern void * nfsproc3_null_3(); extern void * nfsproc3_null_3_svc(); #define NFSPROC3_GETATTR 1 extern GETATTR3res * nfsproc3_getattr_3(); extern GETATTR3res * nfsproc3_getattr_3_svc(); #define NFSPROC3_SETATTR 2 extern SETATTR3res * nfsproc3_setattr_3(); extern SETATTR3res * nfsproc3_setattr_3_svc(); #define NFSPROC3_LOOKUP 3 extern LOOKUP3res * nfsproc3_lookup_3(); extern LOOKUP3res * nfsproc3_lookup_3_svc(); #define NFSPROC3_ACCESS 4 extern ACCESS3res * nfsproc3_access_3(); extern ACCESS3res * nfsproc3_access_3_svc(); #define NFSPROC3_READLINK 5 extern READLINK3res * nfsproc3_readlink_3(); extern READLINK3res * nfsproc3_readlink_3_svc(); #define NFSPROC3_READ 6 extern READ3res * nfsproc3_read_3(); extern READ3res * nfsproc3_read_3_svc(); #define NFSPROC3_WRITE 7 extern WRITE3res * nfsproc3_write_3(); extern WRITE3res * nfsproc3_write_3_svc(); #define NFSPROC3_CREATE 8 extern CREATE3res * nfsproc3_create_3(); extern CREATE3res * nfsproc3_create_3_svc(); #define NFSPROC3_MKDIR 9 extern MKDIR3res * nfsproc3_mkdir_3(); extern MKDIR3res * nfsproc3_mkdir_3_svc(); #define NFSPROC3_SYMLINK 10 extern SYMLINK3res * nfsproc3_symlink_3(); extern SYMLINK3res * nfsproc3_symlink_3_svc(); #define NFSPROC3_MKNOD 11 extern MKNOD3res * nfsproc3_mknod_3(); extern MKNOD3res * nfsproc3_mknod_3_svc(); #define NFSPROC3_REMOVE 12 extern REMOVE3res * nfsproc3_remove_3(); extern REMOVE3res * nfsproc3_remove_3_svc(); #define NFSPROC3_RMDIR 13 extern RMDIR3res * nfsproc3_rmdir_3(); extern RMDIR3res * nfsproc3_rmdir_3_svc(); #define NFSPROC3_RENAME 14 extern RENAME3res * nfsproc3_rename_3(); extern RENAME3res * nfsproc3_rename_3_svc(); #define NFSPROC3_LINK 15 extern LINK3res * nfsproc3_link_3(); extern LINK3res * nfsproc3_link_3_svc(); #define NFSPROC3_READDIR 16 extern READDIR3res * nfsproc3_readdir_3(); extern READDIR3res * nfsproc3_readdir_3_svc(); #define NFSPROC3_READDIRPLUS 17 extern READDIRPLUS3res * nfsproc3_readdirplus_3(); extern READDIRPLUS3res * nfsproc3_readdirplus_3_svc(); #define NFSPROC3_FSSTAT 18 extern FSSTAT3res * nfsproc3_fsstat_3(); extern FSSTAT3res * nfsproc3_fsstat_3_svc(); #define NFSPROC3_FSINFO 19 extern FSINFO3res * nfsproc3_fsinfo_3(); extern FSINFO3res * nfsproc3_fsinfo_3_svc(); #define NFSPROC3_PATHCONF 20 extern PATHCONF3res * nfsproc3_pathconf_3(); extern PATHCONF3res * nfsproc3_pathconf_3_svc(); #define NFSPROC3_COMMIT 21 extern COMMIT3res * nfsproc3_commit_3(); extern COMMIT3res * nfsproc3_commit_3_svc(); extern int nfs3_program_3_freeresult(); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_nfsstat(XDR *, nfsstat*); extern bool_t xdr_ftype(XDR *, ftype*); extern bool_t xdr_nfs_fh(XDR *, nfs_fh*); extern bool_t xdr_nfstime(XDR *, nfstime*); extern bool_t xdr_fattr(XDR *, fattr*); extern bool_t xdr_sattr(XDR *, sattr*); extern bool_t xdr_filename(XDR *, filename*); extern bool_t xdr_nfspath(XDR *, nfspath*); extern bool_t xdr_attrstat(XDR *, attrstat*); extern bool_t xdr_sattrargs(XDR *, sattrargs*); extern bool_t xdr_diropargs(XDR *, diropargs*); extern bool_t xdr_diropokres(XDR *, diropokres*); extern bool_t xdr_diropres(XDR *, diropres*); extern bool_t xdr_readlinkres(XDR *, readlinkres*); extern bool_t xdr_readargs(XDR *, readargs*); extern bool_t xdr_readokres(XDR *, readokres*); extern bool_t xdr_readres(XDR *, readres*); extern bool_t xdr_writeargs(XDR *, writeargs*); extern bool_t xdr_createargs(XDR *, createargs*); extern bool_t xdr_renameargs(XDR *, renameargs*); extern bool_t xdr_linkargs(XDR *, linkargs*); extern bool_t xdr_symlinkargs(XDR *, symlinkargs*); extern bool_t xdr_nfscookie(XDR *, nfscookie); extern bool_t xdr_readdirargs(XDR *, readdirargs*); extern bool_t xdr_entry(XDR *, entry*); extern bool_t xdr_dirlist(XDR *, dirlist*); extern bool_t xdr_readdirres(XDR *, readdirres*); extern bool_t xdr_statfsokres(XDR *, statfsokres*); extern bool_t xdr_statfsres(XDR *, statfsres*); extern bool_t xdr_filename3(XDR *, filename3*); extern bool_t xdr_nfspath3(XDR *, nfspath3*); extern bool_t xdr_fileid3(XDR *, fileid3*); extern bool_t xdr_cookie3(XDR *, cookie3*); extern bool_t xdr_cookieverf3(XDR *, cookieverf3); extern bool_t xdr_createverf3(XDR *, createverf3); extern bool_t xdr_writeverf3(XDR *, writeverf3); extern bool_t xdr_uid3(XDR *, uid3*); extern bool_t xdr_gid3(XDR *, gid3*); extern bool_t xdr_size3(XDR *, size3*); extern bool_t xdr_offset3(XDR *, offset3*); extern bool_t xdr_mode3(XDR *, mode3*); extern bool_t xdr_count3(XDR *, count3*); extern bool_t xdr_nfsstat3(XDR *, nfsstat3*); extern bool_t xdr_ftype3(XDR *, ftype3*); extern bool_t xdr_specdata3(XDR *, specdata3*); extern bool_t xdr_nfs_fh3(XDR *, nfs_fh3*); extern bool_t xdr_nfstime3(XDR *, nfstime3*); extern bool_t xdr_fattr3(XDR *, fattr3*); extern bool_t xdr_post_op_attr(XDR *, post_op_attr*); extern bool_t xdr_wcc_attr(XDR *, wcc_attr*); extern bool_t xdr_pre_op_attr(XDR *, pre_op_attr*); extern bool_t xdr_wcc_data(XDR *, wcc_data*); extern bool_t xdr_post_op_fh3(XDR *, post_op_fh3*); extern bool_t xdr_time_how(XDR *, time_how*); extern bool_t xdr_set_mode3(XDR *, set_mode3*); extern bool_t xdr_set_uid3(XDR *, set_uid3*); extern bool_t xdr_set_gid3(XDR *, set_gid3*); extern bool_t xdr_set_size3(XDR *, set_size3*); extern bool_t xdr_set_atime(XDR *, set_atime*); extern bool_t xdr_set_mtime(XDR *, set_mtime*); extern bool_t xdr_sattr3(XDR *, sattr3*); extern bool_t xdr_diropargs3(XDR *, diropargs3*); extern bool_t xdr_GETATTR3args(XDR *, GETATTR3args*); extern bool_t xdr_GETATTR3resok(XDR *, GETATTR3resok*); extern bool_t xdr_GETATTR3res(XDR *, GETATTR3res*); extern bool_t xdr_sattrguard3(XDR *, sattrguard3*); extern bool_t xdr_SETATTR3args(XDR *, SETATTR3args*); extern bool_t xdr_SETATTR3resok(XDR *, SETATTR3resok*); extern bool_t xdr_SETATTR3resfail(XDR *, SETATTR3resfail*); extern bool_t xdr_SETATTR3res(XDR *, SETATTR3res*); extern bool_t xdr_LOOKUP3args(XDR *, LOOKUP3args*); extern bool_t xdr_LOOKUP3resok(XDR *, LOOKUP3resok*); extern bool_t xdr_LOOKUP3resfail(XDR *, LOOKUP3resfail*); extern bool_t xdr_LOOKUP3res(XDR *, LOOKUP3res*); extern bool_t xdr_ACCESS3args(XDR *, ACCESS3args*); extern bool_t xdr_ACCESS3resok(XDR *, ACCESS3resok*); extern bool_t xdr_ACCESS3resfail(XDR *, ACCESS3resfail*); extern bool_t xdr_ACCESS3res(XDR *, ACCESS3res*); extern bool_t xdr_READLINK3args(XDR *, READLINK3args*); extern bool_t xdr_READLINK3resok(XDR *, READLINK3resok*); extern bool_t xdr_READLINK3resfail(XDR *, READLINK3resfail*); extern bool_t xdr_READLINK3res(XDR *, READLINK3res*); extern bool_t xdr_READ3args(XDR *, READ3args*); extern bool_t xdr_READ3resok(XDR *, READ3resok*); extern bool_t xdr_READ3resfail(XDR *, READ3resfail*); extern bool_t xdr_READ3res(XDR *, READ3res*); extern bool_t xdr_stable_how(XDR *, stable_how*); extern bool_t xdr_WRITE3args(XDR *, WRITE3args*); extern bool_t xdr_WRITE3resok(XDR *, WRITE3resok*); extern bool_t xdr_WRITE3resfail(XDR *, WRITE3resfail*); extern bool_t xdr_WRITE3res(XDR *, WRITE3res*); extern bool_t xdr_createmode3(XDR *, createmode3*); extern bool_t xdr_createhow3(XDR *, createhow3*); extern bool_t xdr_CREATE3args(XDR *, CREATE3args*); extern bool_t xdr_CREATE3resok(XDR *, CREATE3resok*); extern bool_t xdr_CREATE3resfail(XDR *, CREATE3resfail*); extern bool_t xdr_CREATE3res(XDR *, CREATE3res*); extern bool_t xdr_MKDIR3args(XDR *, MKDIR3args*); extern bool_t xdr_MKDIR3resok(XDR *, MKDIR3resok*); extern bool_t xdr_MKDIR3resfail(XDR *, MKDIR3resfail*); extern bool_t xdr_MKDIR3res(XDR *, MKDIR3res*); extern bool_t xdr_symlinkdata3(XDR *, symlinkdata3*); extern bool_t xdr_SYMLINK3args(XDR *, SYMLINK3args*); extern bool_t xdr_SYMLINK3resok(XDR *, SYMLINK3resok*); extern bool_t xdr_SYMLINK3resfail(XDR *, SYMLINK3resfail*); extern bool_t xdr_SYMLINK3res(XDR *, SYMLINK3res*); extern bool_t xdr_devicedata3(XDR *, devicedata3*); extern bool_t xdr_mknoddata3(XDR *, mknoddata3*); extern bool_t xdr_MKNOD3args(XDR *, MKNOD3args*); extern bool_t xdr_MKNOD3resok(XDR *, MKNOD3resok*); extern bool_t xdr_MKNOD3resfail(XDR *, MKNOD3resfail*); extern bool_t xdr_MKNOD3res(XDR *, MKNOD3res*); extern bool_t xdr_REMOVE3args(XDR *, REMOVE3args*); extern bool_t xdr_REMOVE3resok(XDR *, REMOVE3resok*); extern bool_t xdr_REMOVE3resfail(XDR *, REMOVE3resfail*); extern bool_t xdr_REMOVE3res(XDR *, REMOVE3res*); extern bool_t xdr_RMDIR3args(XDR *, RMDIR3args*); extern bool_t xdr_RMDIR3resok(XDR *, RMDIR3resok*); extern bool_t xdr_RMDIR3resfail(XDR *, RMDIR3resfail*); extern bool_t xdr_RMDIR3res(XDR *, RMDIR3res*); extern bool_t xdr_RENAME3args(XDR *, RENAME3args*); extern bool_t xdr_RENAME3resok(XDR *, RENAME3resok*); extern bool_t xdr_RENAME3resfail(XDR *, RENAME3resfail*); extern bool_t xdr_RENAME3res(XDR *, RENAME3res*); extern bool_t xdr_LINK3args(XDR *, LINK3args*); extern bool_t xdr_LINK3resok(XDR *, LINK3resok*); extern bool_t xdr_LINK3resfail(XDR *, LINK3resfail*); extern bool_t xdr_LINK3res(XDR *, LINK3res*); extern bool_t xdr_READDIR3args(XDR *, READDIR3args*); extern bool_t xdr_entry3(XDR *, entry3*); extern bool_t xdr_dirlist3(XDR *, dirlist3*); extern bool_t xdr_READDIR3resok(XDR *, READDIR3resok*); extern bool_t xdr_READDIR3resfail(XDR *, READDIR3resfail*); extern bool_t xdr_READDIR3res(XDR *, READDIR3res*); extern bool_t xdr_READDIRPLUS3args(XDR *, READDIRPLUS3args*); extern bool_t xdr_entryplus3(XDR *, entryplus3*); extern bool_t xdr_dirlistplus3(XDR *, dirlistplus3*); extern bool_t xdr_READDIRPLUS3resok(XDR *, READDIRPLUS3resok*); extern bool_t xdr_READDIRPLUS3resfail(XDR *, READDIRPLUS3resfail*); extern bool_t xdr_READDIRPLUS3res(XDR *, READDIRPLUS3res*); extern bool_t xdr_FSSTAT3args(XDR *, FSSTAT3args*); extern bool_t xdr_FSSTAT3resok(XDR *, FSSTAT3resok*); extern bool_t xdr_FSSTAT3resfail(XDR *, FSSTAT3resfail*); extern bool_t xdr_FSSTAT3res(XDR *, FSSTAT3res*); extern bool_t xdr_FSINFO3args(XDR *, FSINFO3args*); extern bool_t xdr_FSINFO3resok(XDR *, FSINFO3resok*); extern bool_t xdr_FSINFO3resfail(XDR *, FSINFO3resfail*); extern bool_t xdr_FSINFO3res(XDR *, FSINFO3res*); extern bool_t xdr_PATHCONF3args(XDR *, PATHCONF3args*); extern bool_t xdr_PATHCONF3resok(XDR *, PATHCONF3resok*); extern bool_t xdr_PATHCONF3resfail(XDR *, PATHCONF3resfail*); extern bool_t xdr_PATHCONF3res(XDR *, PATHCONF3res*); extern bool_t xdr_COMMIT3args(XDR *, COMMIT3args*); extern bool_t xdr_COMMIT3resok(XDR *, COMMIT3resok*); extern bool_t xdr_COMMIT3resfail(XDR *, COMMIT3resfail*); extern bool_t xdr_COMMIT3res(XDR *, COMMIT3res*); #else /* K&R C */ extern bool_t xdr_nfsstat(); extern bool_t xdr_ftype(); extern bool_t xdr_nfs_fh(); extern bool_t xdr_nfstime(); extern bool_t xdr_fattr(); extern bool_t xdr_sattr(); extern bool_t xdr_filename(); extern bool_t xdr_nfspath(); extern bool_t xdr_attrstat(); extern bool_t xdr_sattrargs(); extern bool_t xdr_diropargs(); extern bool_t xdr_diropokres(); extern bool_t xdr_diropres(); extern bool_t xdr_readlinkres(); extern bool_t xdr_readargs(); extern bool_t xdr_readokres(); extern bool_t xdr_readres(); extern bool_t xdr_writeargs(); extern bool_t xdr_createargs(); extern bool_t xdr_renameargs(); extern bool_t xdr_linkargs(); extern bool_t xdr_symlinkargs(); extern bool_t xdr_nfscookie(); extern bool_t xdr_readdirargs(); extern bool_t xdr_entry(); extern bool_t xdr_dirlist(); extern bool_t xdr_readdirres(); extern bool_t xdr_statfsokres(); extern bool_t xdr_statfsres(); extern bool_t xdr_filename3(); extern bool_t xdr_nfspath3(); extern bool_t xdr_fileid3(); extern bool_t xdr_cookie3(); extern bool_t xdr_cookieverf3(); extern bool_t xdr_createverf3(); extern bool_t xdr_writeverf3(); extern bool_t xdr_uid3(); extern bool_t xdr_gid3(); extern bool_t xdr_size3(); extern bool_t xdr_offset3(); extern bool_t xdr_mode3(); extern bool_t xdr_count3(); extern bool_t xdr_nfsstat3(); extern bool_t xdr_ftype3(); extern bool_t xdr_specdata3(); extern bool_t xdr_nfs_fh3(); extern bool_t xdr_nfstime3(); extern bool_t xdr_fattr3(); extern bool_t xdr_post_op_attr(); extern bool_t xdr_wcc_attr(); extern bool_t xdr_pre_op_attr(); extern bool_t xdr_wcc_data(); extern bool_t xdr_post_op_fh3(); extern bool_t xdr_time_how(); extern bool_t xdr_set_mode3(); extern bool_t xdr_set_uid3(); extern bool_t xdr_set_gid3(); extern bool_t xdr_set_size3(); extern bool_t xdr_set_atime(); extern bool_t xdr_set_mtime(); extern bool_t xdr_sattr3(); extern bool_t xdr_diropargs3(); extern bool_t xdr_GETATTR3args(); extern bool_t xdr_GETATTR3resok(); extern bool_t xdr_GETATTR3res(); extern bool_t xdr_sattrguard3(); extern bool_t xdr_SETATTR3args(); extern bool_t xdr_SETATTR3resok(); extern bool_t xdr_SETATTR3resfail(); extern bool_t xdr_SETATTR3res(); extern bool_t xdr_LOOKUP3args(); extern bool_t xdr_LOOKUP3resok(); extern bool_t xdr_LOOKUP3resfail(); extern bool_t xdr_LOOKUP3res(); extern bool_t xdr_ACCESS3args(); extern bool_t xdr_ACCESS3resok(); extern bool_t xdr_ACCESS3resfail(); extern bool_t xdr_ACCESS3res(); extern bool_t xdr_READLINK3args(); extern bool_t xdr_READLINK3resok(); extern bool_t xdr_READLINK3resfail(); extern bool_t xdr_READLINK3res(); extern bool_t xdr_READ3args(); extern bool_t xdr_READ3resok(); extern bool_t xdr_READ3resfail(); extern bool_t xdr_READ3res(); extern bool_t xdr_stable_how(); extern bool_t xdr_WRITE3args(); extern bool_t xdr_WRITE3resok(); extern bool_t xdr_WRITE3resfail(); extern bool_t xdr_WRITE3res(); extern bool_t xdr_createmode3(); extern bool_t xdr_createhow3(); extern bool_t xdr_CREATE3args(); extern bool_t xdr_CREATE3resok(); extern bool_t xdr_CREATE3resfail(); extern bool_t xdr_CREATE3res(); extern bool_t xdr_MKDIR3args(); extern bool_t xdr_MKDIR3resok(); extern bool_t xdr_MKDIR3resfail(); extern bool_t xdr_MKDIR3res(); extern bool_t xdr_symlinkdata3(); extern bool_t xdr_SYMLINK3args(); extern bool_t xdr_SYMLINK3resok(); extern bool_t xdr_SYMLINK3resfail(); extern bool_t xdr_SYMLINK3res(); extern bool_t xdr_devicedata3(); extern bool_t xdr_mknoddata3(); extern bool_t xdr_MKNOD3args(); extern bool_t xdr_MKNOD3resok(); extern bool_t xdr_MKNOD3resfail(); extern bool_t xdr_MKNOD3res(); extern bool_t xdr_REMOVE3args(); extern bool_t xdr_REMOVE3resok(); extern bool_t xdr_REMOVE3resfail(); extern bool_t xdr_REMOVE3res(); extern bool_t xdr_RMDIR3args(); extern bool_t xdr_RMDIR3resok(); extern bool_t xdr_RMDIR3resfail(); extern bool_t xdr_RMDIR3res(); extern bool_t xdr_RENAME3args(); extern bool_t xdr_RENAME3resok(); extern bool_t xdr_RENAME3resfail(); extern bool_t xdr_RENAME3res(); extern bool_t xdr_LINK3args(); extern bool_t xdr_LINK3resok(); extern bool_t xdr_LINK3resfail(); extern bool_t xdr_LINK3res(); extern bool_t xdr_READDIR3args(); extern bool_t xdr_entry3(); extern bool_t xdr_dirlist3(); extern bool_t xdr_READDIR3resok(); extern bool_t xdr_READDIR3resfail(); extern bool_t xdr_READDIR3res(); extern bool_t xdr_READDIRPLUS3args(); extern bool_t xdr_entryplus3(); extern bool_t xdr_dirlistplus3(); extern bool_t xdr_READDIRPLUS3resok(); extern bool_t xdr_READDIRPLUS3resfail(); extern bool_t xdr_READDIRPLUS3res(); extern bool_t xdr_FSSTAT3args(); extern bool_t xdr_FSSTAT3resok(); extern bool_t xdr_FSSTAT3resfail(); extern bool_t xdr_FSSTAT3res(); extern bool_t xdr_FSINFO3args(); extern bool_t xdr_FSINFO3resok(); extern bool_t xdr_FSINFO3resfail(); extern bool_t xdr_FSINFO3res(); extern bool_t xdr_PATHCONF3args(); extern bool_t xdr_PATHCONF3resok(); extern bool_t xdr_PATHCONF3resfail(); extern bool_t xdr_PATHCONF3res(); extern bool_t xdr_COMMIT3args(); extern bool_t xdr_COMMIT3resok(); extern bool_t xdr_COMMIT3resfail(); extern bool_t xdr_COMMIT3res(); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_NFS_PROT_H_RPCGEN */ /* * 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. */ #ifdef RPC_HDR %/* % * Definitions for uint64, int64, uint32, and int32 % */ %#include % #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; typedef string nfspath; /* * 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; }; 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; }; 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; }; /* * 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; /* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _NIS_H_RPCGEN #define _NIS_H_RPCGEN #include #ifdef __cplusplus extern "C" { #endif #include #ifndef __nis_object_h #define __nis_object_h #define NIS_MAXSTRINGLEN 255 #define NIS_MAXNAMELEN 1024 #define NIS_MAXATTRNAME 32 #define NIS_MAXATTRVAL 2048 #define NIS_MAXCOLUMNS 64 #define NIS_MAXATTR 16 #define NIS_MAXPATH 1024 #define NIS_MAXREPLICAS 128 #define NIS_MAXLINKS 16 #define NIS_PK_NONE 0 #define NIS_PK_DH 1 #define NIS_PK_RSA 2 #define NIS_PK_KERB 3 #define NIS_PK_DHEXT 4 struct nis_attr { char *zattr_ndx; struct { u_int zattr_val_len; char *zattr_val_val; } zattr_val; }; typedef struct nis_attr nis_attr; typedef char *nis_name; enum zotypes { BOGUS_OBJ = 0, NO_OBJ = 1, DIRECTORY_OBJ = 2, GROUP_OBJ = 3, TABLE_OBJ = 4, ENTRY_OBJ = 5, LINK_OBJ = 6, PRIVATE_OBJ = 7, NIS_BOGUS_OBJ = 0, NIS_NO_OBJ = 1, NIS_DIRECTORY_OBJ = 2, NIS_GROUP_OBJ = 3, NIS_TABLE_OBJ = 4, NIS_ENTRY_OBJ = 5, NIS_LINK_OBJ = 6, NIS_PRIVATE_OBJ = 7 }; typedef enum zotypes zotypes; enum nstype { UNKNOWN = 0, NIS = 1, SUNYP = 2, IVY = 3, DNS = 4, X500 = 5, DNANS = 6, XCHS = 7, CDS = 8 }; typedef enum nstype nstype; struct oar_mask { uint_t oa_rights; zotypes oa_otype; }; typedef struct oar_mask oar_mask; struct endpoint { char *uaddr; char *family; char *proto; }; typedef struct endpoint endpoint; struct nis_server { nis_name name; struct { u_int ep_len; endpoint *ep_val; } ep; uint_t key_type; netobj pkey; }; typedef struct nis_server nis_server; struct directory_obj { nis_name do_name; nstype do_type; struct { u_int do_servers_len; nis_server *do_servers_val; } do_servers; uint32_t do_ttl; struct { u_int do_armask_len; oar_mask *do_armask_val; } do_armask; }; typedef struct directory_obj directory_obj; #define EN_BINARY 1 #define EN_CRYPT 2 #define EN_XDR 4 #define EN_MODIFIED 8 #define EN_ASN1 64 struct entry_col { uint_t ec_flags; struct { u_int ec_value_len; char *ec_value_val; } ec_value; }; typedef struct entry_col entry_col; struct entry_obj { char *en_type; struct { u_int en_cols_len; entry_col *en_cols_val; } en_cols; }; typedef struct entry_obj entry_obj; struct group_obj { uint_t gr_flags; struct { u_int gr_members_len; nis_name *gr_members_val; } gr_members; }; typedef struct group_obj group_obj; struct link_obj { zotypes li_rtype; struct { u_int li_attrs_len; nis_attr *li_attrs_val; } li_attrs; nis_name li_name; }; typedef struct link_obj link_obj; #define TA_BINARY 1 #define TA_CRYPT 2 #define TA_XDR 4 #define TA_SEARCHABLE 8 #define TA_CASE 16 #define TA_MODIFIED 32 #define TA_ASN1 64 struct table_col { char *tc_name; uint_t tc_flags; uint_t tc_rights; }; typedef struct table_col table_col; struct table_obj { char *ta_type; int ta_maxcol; u_char ta_sep; struct { u_int ta_cols_len; table_col *ta_cols_val; } ta_cols; char *ta_path; }; typedef struct table_obj table_obj; struct objdata { zotypes zo_type; union { struct directory_obj di_data; struct group_obj gr_data; struct table_obj ta_data; struct entry_obj en_data; struct link_obj li_data; struct { u_int po_data_len; char *po_data_val; } po_data; } objdata_u; }; typedef struct objdata objdata; struct nis_oid { uint32_t ctime; uint32_t mtime; }; typedef struct nis_oid nis_oid; struct nis_object { nis_oid zo_oid; nis_name zo_name; nis_name zo_owner; nis_name zo_group; nis_name zo_domain; uint_t zo_access; uint32_t zo_ttl; objdata zo_data; }; typedef struct nis_object nis_object; #endif /* if __nis_object_h */ enum log_entry_t { LOG_NOP = 0, ADD_NAME = 1, REM_NAME = 2, MOD_NAME_OLD = 3, MOD_NAME_NEW = 4, ADD_IBASE = 5, REM_IBASE = 6, MOD_IBASE = 7, UPD_STAMP = 8 }; typedef enum log_entry_t log_entry_t; struct log_entry { uint32_t le_time; log_entry_t le_type; nis_name le_princp; nis_name le_name; struct { u_int le_attrs_len; nis_attr *le_attrs_val; } le_attrs; nis_object le_object; }; typedef struct log_entry log_entry; struct nis_tag { u_int tag_type; char *tag_val; }; typedef struct nis_tag nis_tag; /* * 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; int optimal_rank; directory_obj dobj; struct { u_int BEP_len; nis_bound_endpoint *BEP_val; } 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 /* * 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 /* XDR function declarations (normally rpcgen-generated, pre-generated here * because rpcgen cannot handle %#define line continuations in nis.x) */ extern bool_t xdr_nis_attr(XDR *, nis_attr*); extern bool_t xdr_nis_name(XDR *, nis_name*); extern bool_t xdr_zotypes(XDR *, zotypes*); extern bool_t xdr_nstype(XDR *, nstype*); extern bool_t xdr_oar_mask(XDR *, oar_mask*); extern bool_t xdr_endpoint(XDR *, endpoint*); extern bool_t xdr_nis_server(XDR *, nis_server*); extern bool_t xdr_directory_obj(XDR *, directory_obj*); extern bool_t xdr_entry_col(XDR *, entry_col*); extern bool_t xdr_entry_obj(XDR *, entry_obj*); extern bool_t xdr_group_obj(XDR *, group_obj*); extern bool_t xdr_link_obj(XDR *, link_obj*); extern bool_t xdr_table_col(XDR *, table_col*); extern bool_t xdr_table_obj(XDR *, table_obj*); extern bool_t xdr_objdata(XDR *, objdata*); extern bool_t xdr_nis_oid(XDR *, nis_oid*); extern bool_t xdr_nis_object(XDR *, nis_object*); extern bool_t xdr_log_entry_t(XDR *, log_entry_t*); extern bool_t xdr_log_entry(XDR *, log_entry*); extern bool_t xdr_nis_tag(XDR *, nis_tag*); extern bool_t xdr_nis_bound_endpoint(XDR *, nis_bound_endpoint*); extern bool_t xdr_nis_bound_directory(XDR *, nis_bound_directory*); extern bool_t xdr_nis_active_endpoint(XDR *, nis_active_endpoint*); #ifdef __cplusplus } #endif /* Prototypes, and extern declarations for the NIS library functions. */ #include #endif /* __NIS_RPCGEN_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * * From 4.1 : @(#)nis.x 1.61 Copyright 1989 Sun Microsystems */ /* This gets stuffed into the source files. */ #if RPC_HDR %#include #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" /* * 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 */ }; /* * 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 */ }; %/* % * 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 /* * 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 %#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 /* * 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 2014 Garrett D'Amore * * 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 #include #include #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. */ 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 *); #ifdef __cplusplus } #endif #endif /* _RPCSVC_NIS_DB_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #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 /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2009 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. */ #ifndef _RPCSVC_NISLIB_H #define _RPCSVC_NISLIB_H #ifdef __cplusplus extern "C" { #endif extern name_pos nis_dir_cmp(nis_name, 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_host(void); extern void nis_destroy_object(nis_object *); extern nis_object *nis_clone_object(nis_object *, nis_object *); extern nis_object *nis_read_obj(char *); extern int nis_write_obj(char *, nis_object *); extern void *nis_get_static_storage(struct nis_sdata *, uint_t, uint_t); extern nis_name __nis_rpc_domain(void); CLIENT *__nis_clnt_create(int, struct netconfig *, char *, struct netbuf *, int, int, int, int, int); #ifdef __cplusplus } #endif #endif /* _RPCSVC_NISLIB_H */ /* * 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 #include #endif /* _RPCSVC_RPC_SZTYPES_H */ /* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _RQUOTA_H_RPCGEN #define _RQUOTA_H_RPCGEN #include #ifdef __cplusplus extern "C" { #endif #define RQ_PATHLEN 1024 struct getquota_args { char *gqa_pathp; int32_t gqa_uid; }; typedef struct getquota_args getquota_args; struct rquota { int32_t rq_bsize; bool_t rq_active; uint32_t rq_bhardlimit; uint32_t rq_bsoftlimit; uint32_t rq_curblocks; uint32_t rq_fhardlimit; uint32_t rq_fsoftlimit; uint32_t rq_curfiles; uint32_t rq_btimeleft; uint32_t rq_ftimeleft; }; typedef struct rquota rquota; enum gqr_status { Q_OK = 1, Q_NOQUOTA = 2, Q_EPERM = 3 }; typedef enum gqr_status gqr_status; struct getquota_rslt { gqr_status status; union { rquota gqr_rquota; } getquota_rslt_u; }; typedef struct getquota_rslt getquota_rslt; #define RQUOTAPROG 100011 #define RQUOTAVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define RQUOTAPROC_GETQUOTA 1 extern getquota_rslt * rquotaproc_getquota_1(getquota_args *, CLIENT *); extern getquota_rslt * rquotaproc_getquota_1_svc(getquota_args *, struct svc_req *); #define RQUOTAPROC_GETACTIVEQUOTA 2 extern getquota_rslt * rquotaproc_getactivequota_1(getquota_args *, CLIENT *); extern getquota_rslt * rquotaproc_getactivequota_1_svc(getquota_args *, struct svc_req *); extern int rquotaprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define RQUOTAPROC_GETQUOTA 1 extern getquota_rslt * rquotaproc_getquota_1(); extern getquota_rslt * rquotaproc_getquota_1_svc(); #define RQUOTAPROC_GETACTIVEQUOTA 2 extern getquota_rslt * rquotaproc_getactivequota_1(); extern getquota_rslt * rquotaproc_getactivequota_1_svc(); extern int rquotaprog_1_freeresult(); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_getquota_args(XDR *, getquota_args*); extern bool_t xdr_rquota(XDR *, rquota*); extern bool_t xdr_gqr_status(XDR *, gqr_status*); extern bool_t xdr_getquota_rslt(XDR *, getquota_rslt*); #else /* K&R C */ extern bool_t xdr_getquota_args(); extern bool_t xdr_rquota(); extern bool_t xdr_gqr_status(); extern bool_t xdr_getquota_rslt(); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_RQUOTA_H_RPCGEN */ /* * 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. */ /* * Remote quota protocol * Requires unix authentication */ const RQ_PATHLEN = 1024; struct getquota_args { string gqa_pathp; /* 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; /* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _RSTAT_H_RPCGEN #define _RSTAT_H_RPCGEN #include #ifdef __cplusplus extern "C" { #endif /* * Copyright (c) 1985, 1990, 1991 by Sun Microsystems, Inc. */ /* from rstat.x */ /* * 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< /* The time struct defined below is */ #endif /* meant to match struct timeval. */ #define RSTAT_CPUSTATES 4 #define RSTAT_DK_NDRIVE 4 #define RSTAT_CPU_USER 0 #define RSTAT_CPU_NICE 1 #define RSTAT_CPU_SYS 2 #define RSTAT_CPU_IDLE 3 struct rstat_timeval { int tv_sec; int tv_usec; }; typedef struct rstat_timeval rstat_timeval; struct statsvar { struct { u_int cp_time_len; int *cp_time_val; } cp_time; struct { u_int dk_xfer_len; int *dk_xfer_val; } dk_xfer; u_int v_pgpgin; u_int v_pgpgout; u_int v_pswpin; u_int v_pswpout; u_int v_intr; int if_ipackets; int if_ierrors; int if_opackets; int if_oerrors; int if_collisions; u_int v_swtch; int avenrun[3]; rstat_timeval boottime; rstat_timeval curtime; }; typedef struct statsvar statsvar; struct statstime { int cp_time[RSTAT_CPUSTATES]; int dk_xfer[RSTAT_DK_NDRIVE]; u_int v_pgpgin; u_int v_pgpgout; u_int v_pswpin; u_int v_pswpout; u_int v_intr; int if_ipackets; int if_ierrors; int if_oerrors; int if_collisions; u_int v_swtch; int avenrun[3]; rstat_timeval boottime; rstat_timeval curtime; int if_opackets; }; typedef struct statstime statstime; #if 1 || defined(__cplusplus) enum clnt_stat rstat(char *, struct statstime *); int havedisk(char *); #else enum clnt_stat rstat(); int havedisk(); #endif #define RSTATPROG 100001 #define RSTATVERS_VAR 4 #if defined(__STDC__) || defined(__cplusplus) #define RSTATPROC_STATS 1 extern statsvar * rstatproc_stats_4(void *, CLIENT *); extern statsvar * rstatproc_stats_4_svc(void *, struct svc_req *); #define RSTATPROC_HAVEDISK 2 extern u_int * rstatproc_havedisk_4(void *, CLIENT *); extern u_int * rstatproc_havedisk_4_svc(void *, struct svc_req *); extern int rstatprog_4_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define RSTATPROC_STATS 1 extern statsvar * rstatproc_stats_4(); extern statsvar * rstatproc_stats_4_svc(); #define RSTATPROC_HAVEDISK 2 extern u_int * rstatproc_havedisk_4(); extern u_int * rstatproc_havedisk_4_svc(); extern int rstatprog_4_freeresult(); #endif /* K&R C */ #define RSTATVERS_TIME 3 #if defined(__STDC__) || defined(__cplusplus) extern statstime * rstatproc_stats_3(void *, CLIENT *); extern statstime * rstatproc_stats_3_svc(void *, struct svc_req *); extern u_int * rstatproc_havedisk_3(void *, CLIENT *); extern u_int * rstatproc_havedisk_3_svc(void *, struct svc_req *); extern int rstatprog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ extern statstime * rstatproc_stats_3(); extern statstime * rstatproc_stats_3_svc(); extern u_int * rstatproc_havedisk_3(); extern u_int * rstatproc_havedisk_3_svc(); extern int rstatprog_3_freeresult(); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_rstat_timeval(XDR *, rstat_timeval*); extern bool_t xdr_statsvar(XDR *, statsvar*); extern bool_t xdr_statstime(XDR *, statstime*); #else /* K&R C */ extern bool_t xdr_rstat_timeval(); extern bool_t xdr_statsvar(); extern bool_t xdr_statstime(); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_RSTAT_H_RPCGEN */ /* * 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 % %/* % * 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< /* 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 /* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _RUSERS_H_RPCGEN #define _RUSERS_H_RPCGEN #include #ifdef __cplusplus extern "C" { #endif /* * Find out about remote users */ #define RUSERS_MAXUSERLEN 32 #define RUSERS_MAXLINELEN 32 #define RUSERS_MAXHOSTLEN 257 struct rusers_utmp { char *ut_user; char *ut_line; char *ut_host; int ut_type; int ut_time; u_int ut_idle; }; typedef struct rusers_utmp rusers_utmp; typedef struct { u_int utmp_array_len; rusers_utmp *utmp_array_val; } utmp_array; /* * Values for ut_type field above. */ #define RUSERS_EMPTY 0 #define RUSERS_RUN_LVL 1 #define RUSERS_BOOT_TIME 2 #define RUSERS_OLD_TIME 3 #define RUSERS_NEW_TIME 4 #define RUSERS_INIT_PROCESS 5 #define RUSERS_LOGIN_PROCESS 6 #define RUSERS_USER_PROCESS 7 #define RUSERS_DEAD_PROCESS 8 #define RUSERS_ACCOUNTING 9 /* * 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 systems. */ 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 1 || defined(__cplusplus) enum clnt_stat rusers(char *host, struct utmpidlearr *up); int rnusers(char *host); #else enum clnt_stat rusers(); int rnusers(); #endif #define RUSERSPROG 100002 #define RUSERSVERS_3 3 #if defined(__STDC__) || defined(__cplusplus) #define RUSERSPROC_NUM 1 extern int * rusersproc_num_3(void *, CLIENT *); extern int * rusersproc_num_3_svc(void *, struct svc_req *); #define RUSERSPROC_NAMES 2 extern utmp_array * rusersproc_names_3(void *, CLIENT *); extern utmp_array * rusersproc_names_3_svc(void *, struct svc_req *); #define RUSERSPROC_ALLNAMES 3 extern utmp_array * rusersproc_allnames_3(void *, CLIENT *); extern utmp_array * rusersproc_allnames_3_svc(void *, struct svc_req *); extern int rusersprog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define RUSERSPROC_NUM 1 extern int * rusersproc_num_3(); extern int * rusersproc_num_3_svc(); #define RUSERSPROC_NAMES 2 extern utmp_array * rusersproc_names_3(); extern utmp_array * rusersproc_names_3_svc(); #define RUSERSPROC_ALLNAMES 3 extern utmp_array * rusersproc_allnames_3(); extern utmp_array * rusersproc_allnames_3_svc(); extern int rusersprog_3_freeresult(); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_rusers_utmp(XDR *, rusers_utmp*); extern bool_t xdr_utmp_array(XDR *, utmp_array*); #else /* K&R C */ extern bool_t xdr_rusers_utmp(); extern bool_t xdr_utmp_array(); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_RUSERS_H_RPCGEN */ /* * 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. */ %/* % * Find out about remote users % */ const RUSERS_MAXUSERLEN = 32; const RUSERS_MAXLINELEN = 32; const RUSERS_MAXHOSTLEN = 257; struct rusers_utmp { string ut_user; /* aka ut_name */ string ut_line; /* device */ string ut_host; /* 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 systems. % */ %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 /* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _RWALL_H_RPCGEN #define _RWALL_H_RPCGEN #include #ifndef _KERNEL #include #include #endif /* !_KERNEL */ #ifdef __cplusplus extern "C" { #endif /* * 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 */ typedef char *wrapstring; #if 1 || defined(__cplusplus) enum clnt_stat rwall(char *, char *); #else enum clnt_stat rwall(); #endif #define WALLPROG 100008 #define WALLVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define WALLPROC_WALL 2 extern enum clnt_stat wallproc_wall_1(wrapstring *, void *, CLIENT *); extern bool_t wallproc_wall_1_svc(wrapstring *, void *, struct svc_req *); extern int wallprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define WALLPROC_WALL 2 extern enum clnt_stat wallproc_wall_1(); extern bool_t wallproc_wall_1_svc(); extern int wallprog_1_freeresult(); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_wrapstring(XDR *, wrapstring*); #else /* K&R C */ extern bool_t xdr_wrapstring(); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_RWALL_H_RPCGEN */ %/* % * 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 /* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _SPRAY_H_RPCGEN #define _SPRAY_H_RPCGEN #include #ifdef __cplusplus extern "C" { #endif /* * Copyright (c) 1987, 1991 by Sun Microsystems, Inc. */ /* from spray.x */ #define SPRAYMAX 8845 struct spraytimeval { u_int sec; u_int usec; }; typedef struct spraytimeval spraytimeval; struct spraycumul { u_int counter; spraytimeval clock; }; typedef struct spraycumul spraycumul; typedef struct { u_int sprayarr_len; char *sprayarr_val; } sprayarr; #define SPRAYPROG 100012 #define SPRAYVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define SPRAYPROC_SPRAY 1 extern void * sprayproc_spray_1(sprayarr *, CLIENT *); extern void * sprayproc_spray_1_svc(sprayarr *, struct svc_req *); #define SPRAYPROC_GET 2 extern spraycumul * sprayproc_get_1(void *, CLIENT *); extern spraycumul * sprayproc_get_1_svc(void *, struct svc_req *); #define SPRAYPROC_CLEAR 3 extern void * sprayproc_clear_1(void *, CLIENT *); extern void * sprayproc_clear_1_svc(void *, struct svc_req *); extern int sprayprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define SPRAYPROC_SPRAY 1 extern void * sprayproc_spray_1(); extern void * sprayproc_spray_1_svc(); #define SPRAYPROC_GET 2 extern spraycumul * sprayproc_get_1(); extern spraycumul * sprayproc_get_1_svc(); #define SPRAYPROC_CLEAR 3 extern void * sprayproc_clear_1(); extern void * sprayproc_clear_1_svc(); extern int sprayprog_1_freeresult(); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_spraytimeval(XDR *, spraytimeval*); extern bool_t xdr_spraycumul(XDR *, spraycumul*); extern bool_t xdr_sprayarr(XDR *, sprayarr*); #else /* K&R C */ extern bool_t xdr_spraytimeval(); extern bool_t xdr_spraycumul(); extern bool_t xdr_sprayarr(); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_SPRAY_H_RPCGEN */ /* * 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 */ /* * 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; 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; /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SVC_DG_PRIV_H #define _SVC_DG_PRIV_H /* * The svc_dg_data private datastructure shared by some services * for nefarious reasons. THIS IS NOT AN INTERFACE. DO NOT USE. */ #ifdef __cplusplus extern "C" { #endif /* * The size of the option header should include sufficient space for * a ucred; we reserve 32 words as before we had ucreds and we allocate * sizeof (svc_dg_data) + ucred_size(). Of course, opts must be declared * last so it can use the additional memory. */ #define MAX_OPT_WORDS 32 /* * kept in xprt->xp_p2 */ struct svc_dg_data { /* Note: optbuf must be the first field, used by ti_opts.c code */ struct netbuf optbuf; /* netbuf for options */ uint_t su_iosz; /* size of send.recv buffer */ uint32_t su_xid; /* transaction id */ XDR su_xdrs; /* XDR handle */ char su_verfbody[MAX_AUTH_BYTES]; /* verifier body */ char *su_cache; /* cached data, NULL if none */ struct t_unitdata su_tudata; /* tu_data for recv */ int opts[MAX_OPT_WORDS]; /* options: MUST BE LAST */ }; #define get_svc_dg_data(xprt) ((struct svc_dg_data *)((xprt)->xp_p2)) #ifdef __cplusplus } #endif #endif /* _SVC_DG_PRIV_H */ /* * 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. */ /* * 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; typedef string mapname; typedef string peername; typedef opaque keydat; typedef opaque valdat; 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; /* * 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 2014 Garrett D'Amore * * 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 #include #include #include #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 */ 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 *); #ifdef __cplusplus } #endif #endif /* _RPCSVC_YP_PROT_H */ /* * 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 2014 Garrett D'Amore * * 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 #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(3NSL). */ /* * 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. */ 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); /* * Global yp data structures */ #ifdef __cplusplus } #endif #endif /* _RPCSVC_YPCLNT_H */ /* * 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 #ifndef _PWD_H #include #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 */ /* * 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 /* * Please do not edit this file. * It was generated using rpcgen. */ #include #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _RTLD_DB_H #define _RTLD_DB_H #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include /* * 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 */ /* * Commands for rd_ctl() */ #define RD_CTL_SET_HELPPATH 0x01 /* Set the path used to find helpers */ typedef struct rd_agent rd_agent_t; typedef int rl_iter_f(const rd_loadobj_t *, void *); /* * 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 its */ /* destination address */ struct ps_prochandle; /* * librtld_db.so entry points */ 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_ctl(int, void *); 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_get_dyns(rd_agent_t *, psaddr_t, void **, size_t *); extern rd_err_e rd_reset(struct rd_agent *); #ifdef __cplusplus } #endif #endif /* _RTLD_DB_H */ /* * 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 2014 Garrett D'Amore * * 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 #include #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 */ extern int doconfig(int, char *, long); #ifdef __cplusplus } #endif #endif /* _SAC_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SCHED_H #define _SCHED_H #include #include #ifdef __cplusplus extern "C" { #endif struct sched_param { int sched_priority; /* scheduling priority */ int sched_pad[8]; }; /* * POSIX scheduling policies */ #define SCHED_OTHER 0 /* traditional time-sharing scheduling class */ #define SCHED_FIFO 1 /* real-time class: run to completion */ #define SCHED_RR 2 /* real-time class: round-robin */ #define SCHED_SYS 3 /* system scheduling class */ #define SCHED_IA 4 /* interactive time-sharing class */ #define SCHED_FSS 5 /* fair-share scheduling class */ #define SCHED_FX 6 /* fixed-priority scheduling class */ #define _SCHED_NEXT 7 /* first unassigned policy number */ /* * function prototypes */ 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 *); #ifdef __cplusplus } #endif #endif /* _SCHED_H */ /* * 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 2014 Garrett D'Amore * * Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SCHEDCTL_H #define _SCHEDCTL_H #ifdef __cplusplus extern "C" { #endif #include 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 */ schedctl_t *schedctl_init(void); schedctl_t *schedctl_lookup(void); void schedctl_exit(void); #ifdef __cplusplus } #endif #endif /* _SCHEDCTL_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SEARCH_H #define _SEARCH_H #include #include #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; 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 /* TSEARCH(3C) */ typedef enum { preorder, postorder, endorder, leaf } VISIT; 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)); #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 *)); #ifdef __cplusplus } #endif #endif /* _SEARCH_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _SECDB_H #define _SECDB_H #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_SEPCHAR ',' #define KV_SEPSTR "," #define KV_OBJECTCHAR '/' #define KV_OBJECT "/" #define KV_AUDIT_DELIMIT ":" #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 */ 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 _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 void _kva_free_value(kva_t *, char *); extern kva_t *_new_kva(int size); extern kva_t *_str2kva(char *, char *, char *); extern int _enum_auths(const char *, int (*)(const char *, void *, void *), void *ctxt, void *pres); extern int _enum_profs(const char *, int (*)(const char *, kva_t *, void *, void *), void *ctxt, void *pres); extern int _enum_attrs(const char *, int (*)(const char *, kva_t *, void *, void *), void *ctxt, void *pres); #ifdef __cplusplus } #endif #endif /* _SECDB_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SEMAPHORE_H #define _SEMAPHORE_H #include #include #include #ifdef __cplusplus extern "C" { #endif /* * Including has an unfortunate XPG/POSIX history. In XPG6 and POSIX * 1999, sem_timedwait() was added which required making the struct timespec * declared in some form. In XPG7, this is permitted to make all of time.h * visible. In XPG8, the use of the clockid_t is required from time.h. For * better and worse, that is how the ifdef soup is here. We prefer including * time.h so that folks can get a full definition for the time struct timespec * rather than the forward declaration that most other OSes do here. */ #if !defined(_STRICT_POSIX) || defined(_XPG7) #include #elif defined(_XPG6) struct timespec; #endif typedef struct { /* this structure must be the same as sema_t in */ 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 */ 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 *); #if !defined(_STRICT_POSIX) || defined(_XPG6) 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 /* !_STRICT_POSIX || _XPG6 */ #if !defined(_STRICT_POSIX) || defined(_XPG8) int sem_clockwait(sem_t *_RESTRICT_KYWD, clockid_t, const struct timespec *_RESTRICT_KYWD); int sem_relclockwait_np(sem_t *_RESTRICT_KYWD, clockid_t, const struct timespec *_RESTRICT_KYWD); #endif /* !_STRICT_POSIX || _XPG8 */ int sem_trywait(sem_t *); int sem_post(sem_t *); int sem_getvalue(sem_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); #ifdef __cplusplus } #endif #endif /* _SEMAPHORE_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SETJMP_H #define _SETJMP_H #include /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #if __cplusplus >= 199711L using std::jmp_buf; using std::longjmp; #endif #ifdef __cplusplus extern "C" { #endif #if !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX) || \ defined(__EXTENSIONS__) /* non-ANSI standard compilation */ #if defined(_LP64) typedef long sigjmp_buf[_SIGJBLEN]; #else typedef int sigjmp_buf[_SIGJBLEN]; #endif extern int sigsetjmp(sigjmp_buf, int) __RETURNS_TWICE; extern void siglongjmp(sigjmp_buf, int) __NORETURN; #endif #ifdef __cplusplus } #endif #endif /* _SETJMP_H */ /* * 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 #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2008 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 #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 */ #define NOPWDRTR "*NP*" /* password is not retrievable */ /* * 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 }; #ifndef _STDIO_H #include #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); #ifdef __cplusplus } #endif #endif /* _SHADOW_H */ /* * 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 2015 Circonus, Inc. All rights reserved. */ /* * Copyright 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _SIGINFO_H #define _SIGINFO_H #include #include #ifdef __cplusplus extern "C" { #endif struct siginfolist { int nsiginfo; char **vsiginfo; }; 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 extern void psignal(int, const char *); extern void psiginfo(const siginfo_t *, const char *); #ifdef __cplusplus } #endif #endif /* _SIGINFO_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SIGNAL_H #define _SIGNAL_H #include #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ defined(__XOPEN_OR_POSIX) #include /* need pid_t/uid_t/size_t/clock_t/caddr_t/pthread_t */ #endif #include #include /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #if __cplusplus >= 199711L using std::sig_atomic_t; using std::signal; using std::raise; #endif #ifdef __cplusplus extern "C" { #endif 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); #if !defined(_KERNEL) && !defined(_FAKE_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 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 #include 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) && */ /* * 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 (_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) || ... */ #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */ #ifdef __cplusplus } #endif #endif /* _SIGNAL_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Copyright (c) 2011 by Delphix. All rights reserved. */ #ifndef _SPAWN_H #define _SPAWN_H #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* * flags for posix_spawnattr_setflags() */ #define POSIX_SPAWN_RESETIDS 0x0001 #define POSIX_SPAWN_SETPGROUP 0x0002 #define POSIX_SPAWN_SETSIGDEF 0x0004 #define POSIX_SPAWN_SETSIGMASK 0x0008 #define POSIX_SPAWN_SETSCHEDPARAM 0x0010 #define POSIX_SPAWN_SETSCHEDULER 0x0020 #define POSIX_SPAWN_SETSID 0x0040 /* * non-portable extensions */ #if !defined(_STRICT_POSIX) #define POSIX_SPAWN_SETSIGIGN_NP 0x0800 #define POSIX_SPAWN_NOSIGCHLD_NP 0x1000 #define POSIX_SPAWN_WAITPID_NP 0x2000 #define POSIX_SPAWN_NOEXECERR_NP 0x4000 #endif /* !_STRICT_POSIX */ typedef struct { void *__spawn_attrp; /* implementation-private */ } posix_spawnattr_t; typedef struct { void *__file_attrp; /* implementation-private */ } posix_spawn_file_actions_t; 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 *_RESTRICT_KYWD argv, char *const *_RESTRICT_KYWD envp); 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 *_RESTRICT_KYWD argv, char *const *_RESTRICT_KYWD envp); 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_addchdir( posix_spawn_file_actions_t *_RESTRICT_KYWD file_actions, const char *_RESTRICT_KYWD path); 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_spawn_file_actions_addfchdir( posix_spawn_file_actions_t *_RESTRICT_KYWD file_actions, int fd); 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); /* * non-portable extensions */ #if !defined(_STRICT_POSIX) extern int posix_spawn_pipe_np( pid_t *_RESTRICT_KYWD pidp, int *_RESTRICT_KYWD fdp, const char *_RESTRICT_KYWD cmd, boolean_t write, posix_spawn_file_actions_t *_RESTRICT_KYWD fact, posix_spawnattr_t *_RESTRICT_KYWD attr); extern int posix_spawn_file_actions_addclosefrom_np( posix_spawn_file_actions_t *file_actions, int lowfiledes); extern int posix_spawnattr_setsigignore_np( posix_spawnattr_t *_RESTRICT_KYWD attr, const sigset_t *_RESTRICT_KYWD sigignore); extern int posix_spawnattr_getsigignore_np( const posix_spawnattr_t *_RESTRICT_KYWD attr, sigset_t *_RESTRICT_KYWD sigignore); /* * These _np variants are not documented in the manual, but are provided for * compatibility purposes with folks who have implemented this prior to * standardization in POSIX 2024. */ extern int posix_spawn_file_actions_addchdir_np( posix_spawn_file_actions_t *_RESTRICT_KYWD file_actions, const char *_RESTRICT_KYWD path); extern int posix_spawn_file_actions_addfchdir_np( posix_spawn_file_actions_t *_RESTRICT_KYWD file_actions, int fd); #endif /* !_STRICT_POSIX */ 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); #ifdef __cplusplus } #endif #endif /* _SPAWN_H */ /* * 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 #include #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 */ /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2023 Oxide Computer Company */ #ifndef _STDALIGN_H #define _STDALIGN_H #include #endif /* _STDALIGN_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _STDARG_H #define _STDARG_H /* * 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 . This organization enables protected use of * the implementation by other standard headers without introducing * names into the users' namespace. */ #include #include /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #if __cplusplus >= 199711L using std::va_list; #endif #endif /* _STDARG_H */ /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2024 Oxide Computer Company */ #ifndef _STDBIT_H #define _STDBIT_H /* * This header was introduced in C23 and is the standard's expected interface * for this functionality. We provide these routines to both userland and the * kernel and all of the related declarations are in . */ #include #endif /* _STDBIT_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _STDBOOL_H #define _STDBOOL_H #include #endif /* _STDBOOL_H */ /* * 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 #include #include #include /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #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 its 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 */ /* * 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 /* * This header was introduced by the ISO C Standard, ISO/IEC * 9899:1999 Programming language - C. It is a subset of the * header. */ #include #if __EXT1_VISIBLE /* ISO/IEC 9899:2011 K.3.4.4 */ #ifndef RSIZE_MAX #define RSIZE_MAX (SIZE_MAX >> 1) #endif #endif /* __EXT1_VISIBLE */ #endif /* _STDINT_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2025 Hans Rosenfeld * Copyright 2014 Garrett D'Amore * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ /* * User-visible pieces of the ANSI C standard I/O package. */ #ifndef _STDIO_H #define _STDIO_H #include #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 /* * If feature test macros are set that enable interfaces that use types * defined in , 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 . */ #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 #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 "as described in * ". ANSI-C and POSIX require that the namespace of * 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) 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 *); #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 */ #ifndef _SSIZE_T #define _SSIZE_T #if defined(_LP64) typedef long ssize_t; /* size of something in bytes or -1 */ #else typedef int ssize_t; /* (historical version) */ #endif #endif /* !_SSIZE_T */ #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 int fdclose(FILE *, int *); extern int fcloseall(void); extern void setbuffer(FILE *, char *, size_t); extern int setlinebuf(FILE *); /* PRINTFLIKE2 */ extern int asprintf(char **, const char *, ...); /* PRINTFLIKE2 */ extern int vasprintf(char **, const char *, __va_list); #endif #if defined(__EXTENSIONS__) || \ (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) /* || defined(_XPG7) */ extern ssize_t getdelim(char **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD, int, FILE *_RESTRICT_KYWD); extern ssize_t getline(char **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD); #endif /* __EXTENSIONS__ ... */ /* * 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 /* * XPG7 symbols */ #if !defined(_STRICT_SYMBOLS) || defined(_XPG7) extern FILE *fmemopen(void *_RESTRICT_KYWD, size_t, const char *_RESTRICT_KYWD); extern FILE *open_memstream(char **, size_t *); extern int dprintf(int, const char *_RESTRICT_KYWD, ...) __PRINTFLIKE(2); extern int vdprintf(int, const char *_RESTRICT_KYWD, __va_list) __VPRINTFLIKE(2); #endif /* !_STRICT_SYMBOLS || _XPG7 */ #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ (_POSIX_C_SOURCE - 0 >= 199506L) #define getchar_unlocked() getc_unlocked(stdin) #define putchar_unlocked(x) putc_unlocked((x), stdout) #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ #ifdef __cplusplus } #endif #endif /* _STDIO_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Extensions to the stdio package */ #ifndef _STDIO_EXT_H #define _STDIO_EXT_H #include #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); /* * Extended FILE enabling function. */ #if defined(_LP64) && !defined(__lint) #define enable_extended_FILE_stdio(fd, act) (0) #else extern int enable_extended_FILE_stdio(int, int); #endif #ifdef __cplusplus } #endif #endif /* _STDIO_EXT_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _STDIO_IMPL_H #define _STDIO_IMPL_H #include #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 _magic; /* Old home of the file descriptor */ /* Only fileno(3C) can retrieve the value now */ unsigned __orientation:2; /* the orientation of the stream */ unsigned __ionolock:1; /* turn off implicit locking */ unsigned __seekable:1; /* is file seekable? */ unsigned __extendedfd:1; /* enable extended FILE */ unsigned __xf_nocheck:1; /* no extended FILE runtime check */ unsigned __filler:10; }; #endif /* _LP64 */ #ifdef __cplusplus } #endif #endif /* _STDIO_IMPL_H */ /* * 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 #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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright (c) 2013 Gary Mills * * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. * Copyright 2025 Oxide Computer Company */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _STDLIB_H #define _STDLIB_H #include #include #include #if defined(__EXTENSIONS__) || defined(_XPG4) #include #endif /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #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 /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #if __cplusplus >= 201103L using std::at_quick_exit; using std::quick_exit; #endif #if __cplusplus >= 201703L using std::aligned_alloc; #endif #ifdef __cplusplus extern "C" { #endif #ifndef _UID_T #define _UID_T typedef unsigned int uid_t; /* UID type */ #endif /* !_UID_T */ /* large file compilation environment setup */ #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 #ifdef __PRAGMA_REDEFINE_EXTNAME #pragma redefine_extname mkstemp mkstemp64 #pragma redefine_extname mkstemps mkstemps64 #pragma redefine_extname mkostemp mkostemp64 #pragma redefine_extname mkostemps mkostemps64 #else /* __PRAGMA_REDEFINE_EXTNAME */ #define mkstemp mkstemp64 #define mkstemps mkstemps64 #define mkostemp mkostemp64 #define mkostemps mkostemps64 #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 #pragma redefine_extname mkstemps64 mkstemps #pragma redefine_extname mkostemp64 mkostemp #pragma redefine_extname mkostemps64 mkostemps #else /* __PRAGMA_REDEFINE_EXTNAME */ #define mkstemp64 mkstemp #define mkstemps64 mkstemps #define mkostemp64 mkostemp #define mkostemps64 mkostemps #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 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 . 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) 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 *); #if !defined(_XPG4_2) || defined(__EXTENSIONS__) extern int mkstemps(char *, int); #endif #endif /* defined(__EXTENSIONS__) ... */ #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ !defined(__PRAGMA_REDEFINE_EXTNAME)) extern int mkstemp64(char *); #if !defined(_XPG4_2) || defined(__EXTENSIONS__) extern int mkstemps64(char *, int); #endif #endif /* _LARGEFILE64_SOURCE... */ #if !defined(_STRICT_SYMBOLS) || defined(_XPG7) extern char *mkdtemp(char *); #endif /* !_STRICT_SYMBOLS || _XPG7 */ #if !defined(_STRICT_SYMBOLS) || defined(_XPG8) extern int mkostemp(char *, int); #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ !defined(__PRAGMA_REDEFINE_EXTNAME)) extern int mkostemp64(char *, int); #endif /* _LARGEFILE64_SOURCE || !((_FILE_OFFSET_BITS == 64) ... */ #endif /* !_STRICT_SYMBOLS || _XPG8 */ #if !defined(_STRICT_SYMBOLS) extern int mkostemps(char *, int, int); #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ !defined(__PRAGMA_REDEFINE_EXTNAME)) extern int mkostemps64(char *, int, int); #endif /* _LARGEFILE64_SOURCE || !((_FILE_OFFSET_BITS == 64) ... */ #endif /* !_STRICT_SYMBOLS */ #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_memalign(void **, size_t, size_t); extern int posix_openpt(int); extern int setenv(const char *, const char *, int); extern int unsetenv(const char *); #endif /* * In strict XPG4v2 mode, slave pseudo terminal devices behave differently. * See the block comment in usr/src/lib/libc/port/gen/pt.c */ #if defined(_STRICT_SYMBOLS) && defined(_XPG4_2) #ifdef __PRAGMA_REDEFINE_EXTNAME #pragma redefine_extname unlockpt __unlockpt_xpg4 #else extern int __unlockpt_xpg4(int); #define unlockpt __unlockpt_xpg4 #endif #endif /* defined(_STRICT_SYMBOLS) && defined(_XPG4_2) */ #if defined(__EXTENSIONS__) || \ (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) extern char *canonicalize_file_name(const char *); extern int clearenv(void); extern void closefrom(int); extern int daemon(int, int); extern int dup2(int, int); extern int dup3(int, 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); #ifndef __GETLOGIN_DEFINED /* Avoid duplicate in unistd.h */ #define __GETLOGIN_DEFINED #ifndef __USE_LEGACY_LOGNAME__ #ifdef __PRAGMA_REDEFINE_EXTNAME #pragma redefine_extname getlogin getloginx #else /* __PRAGMA_REDEFINE_EXTNAME */ extern char *getloginx(void); #define getlogin getloginx #endif /* __PRAGMA_REDEFINE_EXTNAME */ #endif /* __USE_LEGACY_LOGNAME__ */ extern char *getlogin(void); #endif /* __GETLOGIN_DEFINED */ 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); extern char *mkdtemp(char *); extern const char *getprogname(void); extern void setprogname(const char *); #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) ... */ /* OpenBSD and misc. compatibility functions */ #if !defined(_STRICT_SYMBOLS) #include extern uint32_t arc4random(void); extern void arc4random_buf(void *, size_t); extern uint32_t arc4random_uniform(uint32_t); extern void freezero(void *, size_t); extern void *recallocarray(void *, size_t, size_t, size_t); extern long long strtonum(const char *, long long, long long, const char **); extern long long strtonumx(const char *, long long, long long, const char **, int); extern void *reallocf(void *, size_t); /* these three are also in xlocale.h */ #ifndef _LOCALE_T #define _LOCALE_T typedef struct _locale *locale_t; #endif extern float strtof_l(const char *, char **, locale_t); extern double strtod_l(const char *, char **, locale_t); extern long double strtold_l(const char *, char **, locale_t); #endif /* !_STRICT_SYBMOLS */ /* * POSIX 2024 functions. */ #if !defined(_STRICT_SYMBOLS) || defined(_XPG8) extern int ptsname_r(int, char *, size_t); extern void qsort_r(void *, size_t, size_t, int (*)(const void *, const void *, void *), void *); extern void *reallocarray(void *, size_t, size_t); extern char *secure_getenv(const char *); #endif /* !_STRICT_SYMBOLS || _XPG8 */ #ifdef __cplusplus } #endif #endif /* _STDLIB_H */ /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2016 Joyent, Inc. */ #ifndef _STDNORETURN_H #define _STDNORETURN_H /* * ISO/IEC C11 stdnoreturn.h */ #include #ifdef __cplusplus extern "C" { #endif #if !defined(_STRICT_SYMBOLS) || defined(_STDC_C11) #define noreturn _Noreturn #endif /* !_STRICT_SYMBOLS || _STDC_C11 */ #ifdef __cplusplus } #endif #endif /* _STDNORETURN_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2020 Joyent, Inc. * Copyright 2024 Oxide Computer company */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _STRING_H #define _STRING_H #include /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #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(__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(_STRICT_SYMBOLS) || defined(_XPG7) extern char *stpcpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD); extern char *stpncpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t); extern char *strndup(const char *, size_t); extern size_t strnlen(const char *, size_t); extern char *strsignal(int); #ifndef _LOCALE_T #define _LOCALE_T typedef struct _locale *locale_t; #endif extern int strcoll_l(const char *, const char *, locale_t); extern size_t strxfrm_l(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, locale_t); extern int strcasecmp_l(const char *, const char *, locale_t); extern int strncasecmp_l(const char *, const char *, size_t, locale_t); extern char *strerror_l(int, locale_t); #endif /* defined(_STRICT_SYMBOLS) || defined(_XPG7) */ #if !defined(_STRICT_SYMBOLS) /* Note that some of these are also declared in strings.h for XPG4_2+ */ extern void explicit_bzero(void *, size_t); extern int uucopy(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, size_t); extern int uucopystr(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, size_t); extern int ffs(int); extern int ffsl(long); extern int ffsll(long long); extern int fls(int); extern int flsl(long); extern int flsll(long long); extern void *memmem(const void *, size_t, const void *, size_t); extern void *memrchr(const void *, int, size_t); extern char *strcasestr(const char *, const char *); extern char *strnstr(const char *, const char *, size_t); extern size_t strlcpy(char *, const char *, size_t); extern size_t strlcat(char *, const char *, size_t); extern char *strsep(char **stringp, const char *delim); extern char *strchrnul(const char *, int); extern char *strcasestr_l(const char *, const char *, locale_t); extern int strcasecmp(const char *, const char *); extern int strncasecmp(const char *, const char *, size_t); extern const char *strerrorname_np(int); extern const char *strerrordesc_np(int); #endif /* !defined(__STRICT_SYMBOLS) */ #if defined(__EXTENSIONS__) || \ (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ defined(_XPG4_2) extern char *strdup(const char *); #endif #if defined(__EXTENSIONS__) || \ (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) #if defined(__GNUC__) #define strdupa(s) \ (__extension__( \ { \ char *__str = (char *)(s); \ (__str = strcpy((char *)__builtin_alloca(strlen(__str) + 1), \ __str), __str); \ })) #define strndupa(s, n) \ (__extension__( \ { \ char *__str = (char *)(s); \ size_t __len = strnlen(__str, (n)); \ (__str = strncpy((char *)__builtin_alloca(__len + 1), \ __str, __len), \ __str[__len] = '\0', __str); \ })) #else /* __GNUC__ */ #if defined(unix) /* excludes c99 */ /* * Studio C currently can't do the gcc-style inlining, * so we use thread-local storage instead. */ extern void *__builtin_alloca(size_t); extern __thread char *__strdupa_str; extern __thread size_t __strdupa_len; #define strdupa(s) \ (__strdupa_str = (char *)(s), \ strcpy((char *)__builtin_alloca(strlen(__strdupa_str) + 1), \ __strdupa_str)) #define strndupa(s, n) \ (__strdupa_str = (char *)(s), \ __strdupa_len = strnlen(__strdupa_str, (n)), \ __strdupa_str = strncpy((char *)__builtin_alloca(__strdupa_len + 1), \ __strdupa_str, __strdupa_len), \ __strdupa_str[__strdupa_len] = '\0', __strdupa_str) #endif /* unix */ #endif /* __GNUC__ */ #endif /* __EXTENSIONS__ ... */ #ifdef __cplusplus } #endif #endif /* _STRING_H */ /* * 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 2014 Garrett D'Amore * * Copyright (c) 1995, 1996, by Sun Microsystems, Inc. * All rights reserved. */ #ifndef _STRINGS_H #define _STRINGS_H #include #include #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) #include #endif #ifdef __cplusplus extern "C" { #endif 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 and . 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 would result in declarations not allowed * in , and making the following prototypes visible for * anything other than X/Open UNIX Extension would result in * conflicts with what is now in . */ #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); #if defined(_XPG7) #ifndef _LOCALE_T #define _LOCALE_T typedef struct _locale *locale_t; #endif extern int strcasecmp_l(const char *, const char *, locale_t); extern int strncasecmp_l(const char *, const char *, size_t, locale_t); #endif /* defined(_XPG7) */ #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */ #ifdef __cplusplus } #endif #endif /* _STRINGS_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _STROPTS_H #define _STROPTS_H /* * Streams user options definitions. */ #include #include #ifdef __cplusplus extern "C" { #endif 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. ioctl() is also duplicated in * for broader portability aid. */ extern int ioctl(int, int, ...); extern int fattach(int, const char *); extern int fdetach(const char *); #ifdef __cplusplus } #endif #endif /* _STROPTS_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _SYNCH_H #define _SYNCH_H /* * synch.h: * definitions needed to use the thread synchronization interface */ #ifndef _ASM #include #include #include #endif /* _ASM */ #ifdef __cplusplus extern "C" { #endif #ifndef _ASM /* * Semaphores */ typedef struct _sema { /* this structure must be the same as sem_t in */ 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 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 . A nested included * of (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 (actually * in ). 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 . * Because we have to deal with C++, we cannot redefine this one as that one. */ typedef struct _rwlock { int32_t readers; /* rwstate word */ uint16_t type; uint16_t magic; mutex_t mutex; /* used with process-shared rwlocks */ cond_t readercv; /* used only to indicate ownership */ cond_t writercv; /* used only to indicate ownership */ } rwlock_t; 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_consistent(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 *); #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 . * DEFAULTCV is defined same as PTHREAD_COND_INITIALIZER in . * DEFAULTRWLOCK is defined same as PTHREAD_RWLOCK_INITIALIZER in . * Any changes to these macros should be reflected in */ #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 /* * The *_held() functions apply equally well to Solaris threads * and to Posix threads synchronization objects, but the formal * type declarations are different, so we just declare the argument * to each *_held() function to be a void *, expecting that they will * be called with the proper type of argument in each case. */ int _sema_held(void *); /* sema_t or sem_t */ int _rw_read_held(void *); /* rwlock_t or pthread_rwlock_t */ int _rw_write_held(void *); /* rwlock_t or pthread_rwlock_t */ int _mutex_held(void *); /* mutex_t or pthread_mutex_t */ /* Pause API */ void smt_pause(void); #endif /* _ASM */ /* * Panicking versions of our favorite friends. */ void mutex_enter(mutex_t *); void mutex_exit(mutex_t *); #ifdef __cplusplus } #endif #endif /* _SYNCH_H */ /* * 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 #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 */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ #ifndef _SYSLOG_H #define _SYSLOG_H #include #include #include #ifdef __cplusplus extern "C" { #endif 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__) */ #ifdef __cplusplus } #endif #endif /* _SYSLOG_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _TAR_H #define _TAR_H #ifdef __cplusplus extern "C" { #endif #include #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 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) /* * Types used in ancillary files */ #define ACL_HDR 'A' /* Access Control List */ #define LBL_TYPE 'L' /* Trusted Extensions file label */ #define DIR_TYPE 'D' /* Trusted Extensions directory label */ /* * Attribute types used in Trusted Solaris ancillary files * that are interpreted for backward compatibility */ #define SLD_TYPE 'S' /* single-level directory component */ #define PATH_TYPE 'P' /* Path component */ #define MLD_TYPE 'M' /* multi-level directory component */ #define FILE_TYPE 'F' /* Have to handle files differently */ #define APRIV_TYPE 'P' /* allowed privileges data type in file */ #define FPRIV_TYPE 'p' /* forced privileges data type in file */ #define COMP_TYPE 'C' /* path components, use for MLD */ #define ATTR_FLAG_TYPE 'F' /* file attribute flag bytes data type */ #define LK_COMP_TYPE 'K' /* link data path component */ #endif #ifdef __cplusplus } #endif #endif /* _TAR_H */ /* * 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 #include #endif /* _TERMIO_H */ /* * 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 #include #endif /* _TERMIOS_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2011 Nexenta Systems, Inc. All rights reserved. */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _TGMATH_H #define _TGMATH_H #if !defined(__cplusplus) #include #include /* * real-floating and complex */ #undef acos #define acos(x) __tgmath_acos(x) #undef asin #define asin(x) __tgmath_asin(x) #undef atan #define atan(x) __tgmath_atan(x) #undef acosh #define acosh(x) __tgmath_acosh(x) #undef asinh #define asinh(x) __tgmath_asinh(x) #undef atanh #define atanh(x) __tgmath_atanh(x) #undef cos #define cos(x) __tgmath_cos(x) #undef sin #define sin(x) __tgmath_sin(x) #undef tan #define tan(x) __tgmath_tan(x) #undef cosh #define cosh(x) __tgmath_cosh(x) #undef sinh #define sinh(x) __tgmath_sinh(x) #undef tanh #define tanh(x) __tgmath_tanh(x) #undef exp #define exp(x) __tgmath_exp(x) #undef log #define log(x) __tgmath_log(x) #undef pow #define pow(x, y) __tgmath_pow(x, y) #undef sqrt #define sqrt(x) __tgmath_sqrt(x) #undef fabs #define fabs(x) __tgmath_fabs(x) /* * real-floating only */ #undef atan2 #define atan2(y, x) __tgmath_atan2(y, x) #undef cbrt #define cbrt(x) __tgmath_cbrt(x) #undef ceil #define ceil(x) __tgmath_ceil(x) #undef copysign #define copysign(x, y) __tgmath_copysign(x, y) #undef erf #define erf(x) __tgmath_erf(x) #undef erfc #define erfc(x) __tgmath_erfc(x) #undef exp2 #define exp2(x) __tgmath_exp2(x) #undef expm1 #define expm1(x) __tgmath_expm1(x) #undef fdim #define fdim(x, y) __tgmath_fdim(x, y) #undef floor #define floor(x) __tgmath_floor(x) #undef fma #define fma(x, y, z) __tgmath_fma(x, y, z) #undef fmax #define fmax(x, y) __tgmath_fmax(x, y) #undef fmin #define fmin(x, y) __tgmath_fmin(x, y) #undef fmod #define fmod(x, y) __tgmath_fmod(x, y) #undef frexp #define frexp(x, ip) __tgmath_frexp(x, ip) #undef hypot #define hypot(x, y) __tgmath_hypot(x, y) #undef ilogb #define ilogb(x) __tgmath_ilogb(x) #undef ldexp #define ldexp(x, i) __tgmath_ldexp(x, i) #undef lgamma #define lgamma(x) __tgmath_lgamma(x) #undef llrint #define llrint(x) __tgmath_llrint(x) #undef llround #define llround(x) __tgmath_llround(x) #undef log10 #define log10(x) __tgmath_log10(x) #undef log1p #define log1p(x) __tgmath_log1p(x) #undef log2 #define log2(x) __tgmath_log2(x) #undef logb #define logb(x) __tgmath_logb(x) #undef lrint #define lrint(x) __tgmath_lrint(x) #undef lround #define lround(x) __tgmath_lround(x) #undef nearbyint #define nearbyint(x) __tgmath_nearbyint(x) #undef nextafter #define nextafter(x, y) __tgmath_nextafter(x, y) #undef nexttoward #define nexttoward(x, y) __tgmath_nexttoward(x, y) #undef remainder #define remainder(x, y) __tgmath_remainder(x, y) #undef remquo #define remquo(x, y, ip) __tgmath_remquo(x, y, ip) #undef rint #define rint(x) __tgmath_rint(x) #undef round #define round(x) __tgmath_round(x) #undef scalbln #define scalbln(x, l) __tgmath_scalbln(x, l) #undef scalbn #define scalbn(x, i) __tgmath_scalbn(x, i) #undef tgamma #define tgamma(x) __tgmath_tgamma(x) #undef trunc #define trunc(x) __tgmath_trunc(x) /* * complex only */ #undef carg #define carg(x) __tgmath_carg(x) #undef cimag #define cimag(x) __tgmath_cimag(x) #undef conj #define conj(x) __tgmath_conj(x) #undef cproj #define cproj(x) __tgmath_cproj(x) #undef creal #define creal(x) __tgmath_creal(x) #endif /* !defined(__cplusplus) */ #endif /* _TGMATH_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Copyright 2018 Joyent, Inc. */ #ifndef _THREAD_H #define _THREAD_H /* * thread.h: * definitions needed to use the thread interface except synchronization. * use for thread synchronization. */ #ifndef _ASM #include #include #include #endif /* _ASM */ #ifdef __cplusplus extern "C" { #endif #ifndef _ASM typedef unsigned int thread_t; typedef unsigned int thread_key_t; 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_keycreate_once(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); extern int thr_getname(thread_t, char *, size_t); extern int thr_setname(thread_t, const char *); #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 * THR_DETACHED is defined same as PTHREAD_CREATE_DETACHED in * Any changes in these definitions should be reflected in */ #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 key to be created by thr_keycreate_once() * must be statically initialized with THR_ONCE_KEY. * This must be the same as PTHREAD_ONCE_KEY_NP in */ #define THR_ONCE_KEY (thread_key_t)(-1) /* * 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 */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _THREAD_DB_H #define _THREAD_DB_H /* * * Description: * Types, global variables, and function definitions for users * of libc_db (formerly libthread_db). * */ #include #include #include #include #ifdef __cplusplus extern "C" { #endif #define TD_THR_ANY_USER_FLAGS 0xffffffff #define TD_THR_LOWEST_PRIORITY -128 #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 */ /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2016 Joyent, Inc. */ #ifndef _THREADS_H #define _THREADS_H /* * ISO/IEC C11 threads.h support */ #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif #if !defined(_STRICT_SYMBOLS) || defined(_STDC_C11) #if !defined(_NORETURN_KYWD) #if __STDC_VERSION__ - 0 >= 201112L #define _NORETURN_KYWD _Noreturn #else #define _NORETURN_KYWD #endif /* __STDC_VERSION__ - 0 >= 201112L */ #endif /* !defined(_NORETURN_KYWD) */ #define thread_local _Thread_local #define ONCE_FLAG_INIT PTHREAD_ONCE_INIT #define TSS_DTOR_ITERATIONS PTHREAD_DESTRUCTOR_ITERATIONS typedef pthread_cond_t cnd_t; typedef pthread_t thrd_t; typedef pthread_key_t tss_t; typedef pthread_mutex_t mtx_t; typedef void (*tss_dtor_t)(void *); typedef int (*thrd_start_t)(void *); typedef pthread_once_t once_flag; enum { mtx_plain = 0x1, mtx_recursive = 0x2, mtx_timed = 0x4 }; enum { thrd_success = 0, thrd_error = 1, thrd_busy = 2, thrd_timedout = 3, thrd_nomem = 4 }; extern void call_once(once_flag *, void (*)(void)); extern int cnd_broadcast(cnd_t *); extern void cnd_destroy(cnd_t *); extern int cnd_init(cnd_t *); extern int cnd_signal(cnd_t *); extern int cnd_timedwait(cnd_t *_RESTRICT_KYWD, mtx_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD); extern int cnd_wait(cnd_t *, mtx_t *); extern void mtx_destroy(mtx_t *); extern int mtx_init(mtx_t *, int); extern int mtx_lock(mtx_t *); extern int mtx_timedlock(mtx_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD); extern int mtx_trylock(mtx_t *); extern int mtx_unlock(mtx_t *); extern int thrd_create(thrd_t *, thrd_start_t, void *); extern thrd_t thrd_current(void); extern int thrd_detach(thrd_t); extern int thrd_equal(thrd_t, thrd_t); extern _NORETURN_KYWD void thrd_exit(int) __NORETURN; extern int thrd_join(thrd_t, int *); extern int thrd_sleep(const struct timespec *, struct timespec *); extern void thrd_yield(void); extern int tss_create(tss_t *, tss_dtor_t); extern void tss_delete(tss_t); extern void *tss_get(tss_t); extern int tss_set(tss_t, void *); #endif /* !_STRICT_SYMBOLS | _STDC_C11 */ #ifdef __cplusplus } #endif #endif /* _THREADS_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Copyright 2010 Nexenta Systems, Inc. Al rights reserved. * Copyright 2016 Joyent, Inc. */ #ifndef _TIME_H #define _TIME_H #include #include /* * C11 requires sys/time_impl.h for the definition of the struct timespec. */ #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ (_POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__) || defined(_STDC_C11) #include #include #endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) ... */ /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #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(__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 for the * definition of the sigevent structure. Both require the inclusion * of and when using the timer_create() function. * However, X/Open also specifies that the sigevent structure be defined * in as described in the header . This prevents * compiler warnings for applications that only include and not * also . The sigval union and the sigevent structure is * therefore defined both here and in which gets included * via inclusion of . */ #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)) || \ defined(__EXTENSIONS__) extern time_t timegm(struct tm *); 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))... */ /* * 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 (_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) || ... */ #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */ #if defined(_XPG7) || !defined(_STRICT_SYMBOLS) #ifndef _LOCALE_T #define _LOCALE_T typedef struct _locale *locale_t; #endif extern size_t strftime_l(char *_RESTRICT_KYWD, size_t, const char *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD, locale_t); #endif /* defined(_XPG7) || !defined(_STRICT_SYMBOLS) */ #if !defined(_STRICT_SYMBOLS) || defined(_STDC_C11) /* * Note, the C11 standard requires that all the various base values that are * passed into timespec_get() be non-zero. Hence why TIME_UTC starts at one. */ #define TIME_UTC 0x1 /* CLOCK_REALTIME */ #define TIME_MONOTONIC 0x2 /* CLOCK_HIGHRES */ #define TIME_ACTIVE 0x3 /* CLOCK_PROCESS_CPUTIME_ID */ #define TIME_THREAD_ACTIVE 0x4 /* CLOCK_THREAD_CPUTIME_ID */ #define TIME_THREAD_ACTIVE_USR 0x5 /* CLOCK_VIRTUAL */ extern int timespec_get(struct timespec *, int); #endif #if !defined(_STRICT_SYMBOLS) || defined(_STDC_C23) extern int timespec_getres(struct timespec *, int); #endif #ifdef __cplusplus } #endif #endif /* _TIME_H */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ #ifndef _TIUSER_H #define _TIUSER_H /* * TLI user interface definitions. */ #include #ifdef __cplusplus extern "C" { #endif #if defined(_REENTRANT) || defined(_TS_ERRNO) || \ _POSIX_C_SOURCE - 0 >= 199506L extern int *__t_errno(void); #define t_errno (*(__t_errno())) #else extern int t_errno; #endif /* defined(_REENTRANT) || defined(_TS_ERRNO) */ #ifdef __cplusplus } #endif #endif /* _TIUSER_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2006 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 /* * A part of this file comes from public domain source, so * clarified as of June 5, 1996 by Arthur David Olson */ #include /* * 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(8) man pages. */ /* * This file is in the public domain, so clarified as of * 1996-06-05 by Arthur David Olson. */ /* * 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 */ /* See Internet RFC 9636 for more details about the following format. */ /* * Each file begins with. . . */ #define TZ_MAGIC "TZif" struct tzhead { char tzh_magic[4]; /* TZ_MAGIC */ char tzh_version[1]; /* '\0' or '2'-'4' as of 2021 */ char tzh_reserved[15]; /* reserved; must be zero */ char tzh_ttisutcnt[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 UT 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 1, transition * time is standard time, if 0, * transition time is local (wall clock) * time; if absent, transition times are * assumed to be local time * tzh_ttisutcnt (char)s indexed by type; if 1, transition * time is UT, if 0, transition time is * local time; if absent, transition * times are assumed to be local time. * When this is 1, the corresponding * std/wall indicator must also be 1. */ /* * If tzh_version is '2' or greater, the above is followed by a second instance * of tzhead and a second instance of the data in which each coded transition * time uses 8 rather than 4 chars, * then a POSIX.1-2017 proleptic TZ string for use in handling * instants after the last transition time stored in the file * (with nothing between the newlines if there is no POSIX.1-2017 * representation for such instants). * * If tz_version is '3' or greater, the TZ string can be any POSIX.1-2024 * proleptic TZ string, which means the above is extended as follows. * First, the TZ string's hour offset may range from -167 * through 167 as compared to the range 0 through 24 required * by POSIX.1-2017 and earlier. * Second, its DST start time may be January 1 at 00:00 and its stop * time December 31 at 24:00 plus the difference between DST and * standard time, indicating DST all year. */ /* * 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 /* This must be at least 18 for Europe/Vilnius with 'zic -b fat'. */ #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ #endif /* !defined TZ_MAX_TYPES */ #ifndef TZ_MAX_CHARS /* This must be at least 40 for America/Anchorage. */ #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 /* This must be at least 27 for leap seconds from 1972 through mid-2023. */ /* There's a plan to discontinue leap seconds by 2035. */ #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ #endif /* !defined TZ_MAX_LEAPS */ /* Handy macros that are independent of tzfile implementation. */ enum { SECSPERMIN = 60, MINSPERHOUR = 60, SECSPERHOUR = SECSPERMIN * MINSPERHOUR, HOURSPERDAY = 24, DAYSPERWEEK = 7, DAYSPERNYEAR = 365, DAYSPERLYEAR = DAYSPERNYEAR + 1, MONSPERYEAR = 12, YEARSPERREPEAT = 400 /* years before a Gregorian repeat */ }; #define SECSPERDAY ((int_fast32_t)SECSPERHOUR * HOURSPERDAY) #define DAYSPERREPEAT ((int_fast32_t)400 * 365 + 100 - 4 + 1) #define SECSPERREPEAT ((int_fast64_t)DAYSPERREPEAT * SECSPERDAY) #define AVGSECSPERYEAR (SECSPERREPEAT / YEARSPERREPEAT) /* * How many years to generate (in zic.c) or search through (in localtime.c). * This is two years larger than the obvious 400, to avoid edge cases. * E.g., suppose a rule applies from 2012 on with transitions * in March and September, plus one-off transitions in November 2013, * and suppose the rule cannot be expressed as a proleptic TZ string. * If zic looked only at the last 400 years, it would set max_year=2413, * with the intent that the 400 years 2014 through 2413 will be repeated. * The last transition listed in the tzfile would be in 2413-09, * less than 400 years after the last one-off transition in 2013-11. * Two years is not overkill for localtime.c, as a one-year bump * would mishandle 2023d's America/Ciudad_Juarez for November 2422. */ enum { years_of_observations = YEARSPERREPEAT + 2 }; enum { TM_SUNDAY, TM_MONDAY, TM_TUESDAY, TM_WEDNESDAY, TM_THURSDAY, TM_FRIDAY, TM_SATURDAY }; enum { TM_JANUARY, TM_FEBRUARY, TM_MARCH, TM_APRIL, TM_MAY, TM_JUNE, TM_JULY, TM_AUGUST, TM_SEPTEMBER, TM_OCTOBER, TM_NOVEMBER, TM_DECEMBER }; enum { TM_YEAR_BASE = 1900, TM_WDAY_BASE = TM_MONDAY, EPOCH_YEAR = 1970, EPOCH_WDAY = TM_THURSDAY }; #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) /* * Since everything in isleap is modulo 400 (or a factor of 400), we know that * isleap(y) == isleap(y % 400) * and so * isleap(a + b) == isleap((a + b) % 400) * or * isleap(a + b) == isleap(a % 400 + b % 400) * This is true even if % means modulo rather than Fortran remainder * (which is allowed by C89 but not by C99 or later). * We use this to avoid addition overflow problems. */ #define isleap_sum(a, b) isleap((a) % 400 + (b) % 400) #ifdef __cplusplus } #endif #endif /* _TZFILE_H */ /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2020 Robert Mustacchi */ #ifndef _UCHAR_H #define _UCHAR_H /* * C11 Unicode utilities support. * * Note, we do not define either __STDC_UTF_16__ or __STDC_UTF_32__. While the * functions that are implemented work in that fashion, the ability to represent * any UTF-16 or UTF-32 code point depends on the current locale. Though in * practice they function that way. */ #include #include #include #ifdef __cplusplus extern "C" { #endif #if !defined(_SIZE_T) || __cplusplus >= 199711L #define _SIZE_T #if defined(_LP64) typedef unsigned long size_t; /* size of something in bytes */ #else typedef unsigned int size_t; /* (historical version) */ #endif #endif /* _SIZE_T */ #if !defined(_MBSTATE_T) || __cplusplus >= 199711L #define _MBSTATE_T typedef __mbstate_t mbstate_t; #endif /* _MBSTATE_T */ /* * These types must match the uint_least16_t and uint_least32_t. They are * defined in terms of the same type so as to minimize the needed includes. * C++11 also defines these types and they are considered built in, so we should * not define them in that context. */ #if __cplusplus < 201103L typedef unsigned short char16_t; typedef unsigned int char32_t; #endif extern size_t mbrtoc16(char16_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD); extern size_t mbrtoc32(char32_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD); extern size_t c16rtomb(char *_RESTRICT_KYWD, char16_t, mbstate_t *_RESTRICT_KYWD); extern size_t c32rtomb(char *_RESTRICT_KYWD, char32_t, mbstate_t *_RESTRICT_KYWD); #ifdef __cplusplus } #endif #endif /* _UCHAR_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright 2023 Oxide Computer Company * * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _UCONTEXT_H #define _UCONTEXT_H #include /* * The file sys/regset.h defines indices in the gregset_t array, * such as EIP on i386. Those defines were historically exposed * via sys/ucontext.h, sys/signal.h, etc. which caused surprises * due to those defines unexpectedly polluting the namespace. * On the other hand, several existing applications assume that * the regset names are defined after an include . * To solve both problems at once: (this file) * DOES include sys/regset.h for you but * does NOT include sys/regset.h anymore. */ #if !defined(_XPG4_2) || defined(__EXTENSIONS__) #include #include #include #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 extern int getcontext(ucontext_t *) __RETURNS_TWICE; extern int setcontext(const ucontext_t *); 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 ucontext_t *ucontext_alloc(uint32_t); extern void ucontext_free(ucontext_t *); extern int getcontext_extd(ucontext_t *, uint32_t) __RETURNS_TWICE; extern int swapcontext_extd(ucontext_t *_RESTRICT_KYWD, uint32_t, const ucontext_t *_RESTRICT_KYWD); extern int walkcontext(const ucontext_t *, int (*)(uintptr_t, int, void *), void *); extern int printstack(int); extern int addrtosymstr(void *, char *, 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 /* !_XPG4_2 || __EXTENSIONS__ */ #ifdef __cplusplus } #endif #endif /* _UCONTEXT_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _UCRED_H_ #define _UCRED_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif typedef struct ucred_s ucred_t; /* * library functions prototype. */ 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 bslabel_t *ucred_getlabel(const ucred_t *); extern projid_t ucred_getprojid(const ucred_t *); #ifdef __cplusplus } #endif #endif /* _UCRED_H_ */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _ULIMIT_H #define _ULIMIT_H #include #ifdef __cplusplus extern "C" { #endif extern long ulimit(int, ...); #ifdef __cplusplus } #endif #endif /* _ULIMIT_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 PALO, Richard. * Copyright 2014 Garrett D'Amore * Copyright (c) 2013 Gary Mills * * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */ #ifndef _UNISTD_H #define _UNISTD_H #include #include #include #include #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_ADVISORY_INFO 200112L #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 #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 */ 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); extern int dup3(int, 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 *); #if defined(_XPG7) || !defined(_STRICT_SYMBOLS) extern int fexecve(int, char *const[], char *const[]); #endif #if !defined(_STRICT_SYMBOLS) extern int execvpe(const char *, char *const [], char *const []); extern int syncfs(int); #endif /* !_STRICT_SYMBOLS */ extern void _exit(int) __NORETURN; /* * The following fattach prototype is duplicated in . The * duplication is necessitated by XPG4.2 which requires the prototype * be defined in . */ #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); #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 . The * duplication is necessitated by XPG4.2 which requires the prototype * be defined in . */ #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 #ifndef __GETLOGIN_DEFINED /* Avoid duplicate in stdlib.h */ #define __GETLOGIN_DEFINED #ifndef __USE_LEGACY_LOGNAME__ #ifdef __PRAGMA_REDEFINE_EXTNAME #pragma redefine_extname getlogin getloginx #else /* __PRAGMA_REDEFINE_EXTNAME */ extern char *getloginx(void); #define getlogin getloginx #endif /* __PRAGMA_REDEFINE_EXTNAME */ #endif /* __USE_LEGACY_LOGNAME__ */ extern char *getlogin(void); #endif /* __GETLOGIN_DEFINED */ #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__) */ /* * The following ioctl prototype is duplicated in . The * duplication is necessitated by XPG4.2 which requires the prototype * be defined in . ioctl() is also duplicated in * for broader portability aid. */ #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 *); extern int pipe2(int *, 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 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 and . */ #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__) #if __cplusplus >= 199711L namespace std { #endif extern int rename(const char *, const char *); #if __cplusplus >= 199711L } /* end of namespace std */ using std::rename; #endif /* __cplusplus >= 199711L */ #endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */ #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 *); extern int sethostname(char *, int); #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(_XPG4_2) && !defined(_XPG7)) || !defined(_STRICT_SYMBOLS) extern useconds_t ualarm(useconds_t, useconds_t); #endif extern int unlink(const char *); #if (defined(_XPG4_2) && !defined(_XPG7)) || !defined(_STRICT_SYMBOLS) extern char *getwd(char *); extern int usleep(useconds_t); extern pid_t vfork(void) __RETURNS_TWICE; #endif #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__) */ #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ defined(__EXTENSIONS__) /* || defined(_XPG7) */ extern int faccessat(int, const char *, int, int); extern int fchownat(int, const char *, uid_t, gid_t, int); extern int linkat(int, const char *, int, const char *, int); extern ssize_t readlinkat(int, const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD, size_t); extern int renameat(int, const char *, int, const char *); extern int symlinkat(const char *, int, const char *); extern int unlinkat(int, const char *, int); #endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) extern int get_nprocs(void); extern int get_nprocs_conf(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 */ /* * 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 (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) #ifndef __USE_LEGACY_LOGNAME__ #ifdef __PRAGMA_REDEFINE_EXTNAME #pragma redefine_extname getlogin_r __posix_getloginx_r extern int getlogin_r(char *, int); #else /* __PRAGMA_REDEFINE_EXTNAME */ extern int __posix_getloginx_r(char *, int); #define getlogin_r __posix_getloginx_r #endif /* __PRAGMA_REDEFINE_EXTNAME */ #else /* __USE_LEGACY_LOGNAME__ */ #ifdef __PRAGMA_REDEFINE_EXTNAME #pragma redefine_extname getlogin_r __posix_getlogin_r extern int getlogin_r(char *, int); #else /* __PRAGMA_REDEFINE_EXTNAME */ extern int __posix_getlogin_r(char *, int); #ifdef __lint #define getlogin_r __posix_getlogin_r #else /* !__lint */ static int getlogin_r(char *__name, int __len) { return (__posix_getlogin_r(__name, __len)); } #endif /* !__lint */ #endif /* __PRAGMA_REDEFINE_EXTNAME */ #endif /* __USE_LEGACY_LOGNAME__ */ #ifdef __PRAGMA_REDEFINE_EXTNAME #pragma redefine_extname ttyname_r __posix_ttyname_r extern int ttyname_r(int, char *, size_t); #else /* __PRAGMA_REDEFINE_EXTNAME */ extern int __posix_ttyname_r(int, char *, size_t); #ifdef __lint #define ttyname_r __posix_ttyname_r #else /* !__lint */ 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) || ... */ #ifndef __USE_LEGACY_LOGNAME__ #ifdef __PRAGMA_REDEFINE_EXTNAME #pragma redefine_extname getlogin_r getloginx_r #else /* __PRAGMA_REDEFINE_EXTNAME */ extern char *getloginx_r(char *, int); #define getlogin_r getloginx_r #endif /* __PRAGMA_REDEFINE_EXTNAME */ #endif /* __USE_LEGACY_LOGNAME__ */ extern char *getlogin_r(char *, int); extern char *ttyname_r(int, char *, int); #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */ #if !defined(_STRICT_SYMBOLS) extern int getentropy(void *, size_t); #endif /* !_STRICT_SYMBOLS */ #ifdef __cplusplus } #endif #endif /* _UNISTD_H */ /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2020 Oxide Computer Company */ #ifndef _UPANIC_H #define _UPANIC_H /* * Support for guaranteed user process abort-like termination. */ #include #include #ifdef __cplusplus extern "C" { #endif extern _NORETURN_KYWD void upanic(const char *, size_t) __NORETURN; #ifdef __cplusplus } #endif #endif /* _UPANIC_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ #ifndef _USER_ATTR_H #define _USER_ATTR_H #ifdef __cplusplus extern "C" { #endif #include #include 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_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" #define USERATTR_CLEARANCE "clearance" #define USERATTR_LABELVIEW "labelview" #define USERATTR_LABELVIEW_EXTERNAL "external" #define USERATTR_LABELVIEW_HIDESL "hidesl" #define USERATTR_HIDESL USERATTR_LABELVIEW_HIDESL #define USERATTR_LABELVIEW_INTERNAL "internal" #define USERATTR_LABELVIEW_SHOWSL "showsl" #define USERATTR_LABELTRANS "labeltrans" #define USERATTR_LOCK_NO "no" #define USERATTR_LOCK_YES "yes" #define USERATTR_MINLABEL "min_label" #define USERATTR_PASSWD "password" #define USERATTR_PASSWD_AUTOMATIC "automatic" #define USERATTR_PASSWD_MANUAL "manual" #define USERATTR_TYPE_ROLE USERATTR_TYPE_NONADMIN_KW #define USERATTR_AUDIT_FLAGS_KW "audit_flags" #define USERATTR_ROLEAUTH_KW "roleauth" #define USERATTR_ROLEAUTH_USER "user" #define USERATTR_ROLEAUTH_ROLE "role" /* * 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; 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 *); #ifdef __cplusplus } #endif #endif /* _USER_ATTR_H */ /* * 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 */ /* * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ #ifndef _USERDEFS_H #define _USERDEFS_H #include #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 "" #define DEFROLEAUTH "" #define DEFROLEROLEAUTH "role" /* 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=" #define ROLEAUTHSTR "defroleauth=" /* 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 */ char *defroleauth; /* default roleauth */ }; /* 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 */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _USTAT_H #define _USTAT_H #include #include #ifdef __cplusplus extern "C" { #endif extern int ustat(dev_t, struct ustat *); #ifdef __cplusplus } #endif #endif /* _USTAT_H */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ /* utimbuf is used by utime(2) */ #ifndef _UTIME_H #define _UTIME_H #include #ifdef __cplusplus extern "C" { #endif extern int utime(const char *, const struct utimbuf *); #ifdef __cplusplus } #endif #endif /* _UTIME_H */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _UTMP_H #define _UTMP_H /* * 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 #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 #include /* * 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) 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 *); #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ #ifdef __cplusplus } #endif #endif /* _UTMP_H */ /* * 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 2014 Garrett D'Amore * * 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 #include #include #include #include #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 #include /* * 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__) */ 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__) */ #ifdef __cplusplus } #endif #endif /* _UTMPX_H */ /* * 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 2014 Andrew Stormont. */ #ifndef _UUID_H #define _UUID_H #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 #include 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 void uuid_unparse_lower(uuid_t, char *); extern void uuid_unparse_upper(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 */ /* * 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 #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 */ /* * 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 2014 Garrett D'Amore * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _VALUES_H #define _VALUES_H #include #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))) #define HIBITI (1U << (BITS(int) - 1)) #define HIBITL (1UL << (BITS(long) - 1)) /* 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 */ /* * 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 /* * This header defines the pre-standard variable argument definitions. * Programs using this header should migrate to using . * * The varargs definitions within this header are defined in terms of * implementation definitions. These implementation definitions reside * in . This organization enables protected use of * the implementation by other standard headers without introducing * names into the users' namespace. */ #include #include #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 */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ #ifndef _WAIT_H #define _WAIT_H #include #include #include #include #ifdef __cplusplus extern "C" { #endif extern pid_t wait(int *); extern pid_t waitpid(pid_t, int *, int); extern int waitid(idtype_t, id_t, siginfo_t *, int); #ifdef __cplusplus } #endif #endif /* _WAIT_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2014 Garrett D'Amore * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _WCHAR_H #define _WCHAR_H #include #include #include /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #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 , * however, inclusion of breaks Standard C namespace. */ #if defined(_XPG6) && !defined(_VA_LIST) #define _VA_LIST typedef __va_list va_list; #endif /* defined(_XPG6) && !defined(_VA_LIST) */ #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) #if __cplusplus >= 199711L namespace std { #endif 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(wchar_t); extern wctype_t wctype(const char *); #if __cplusplus >= 199711L } /* namespace std */ using std::iswalpha; using std::iswupper; using std::iswlower; using std::iswdigit; using std::iswxdigit; using std::iswalnum; using std::iswspace; using std::iswpunct; using std::iswprint; using std::iswgraph; using std::iswcntrl; using std::iswctype; using std::towlower; using std::towupper; using std::wcswcs; using std::wcswidth; using std::wcwidth; using std::wctype; #endif #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */ #if defined(_XPG7) || !defined(_STRICT_SYMBOLS) #ifndef _LOCALE_T #define _LOCALE_T typedef struct _locale *locale_t; #endif extern size_t wcsnlen(const wchar_t *, size_t); extern wchar_t *wcpcpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD); extern wchar_t *wcpncpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, size_t); extern size_t wcsxfrm_l(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, size_t, locale_t); extern int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); extern wchar_t *wcsdup(const wchar_t *); extern int wcscasecmp(const wchar_t *, const wchar_t *); extern int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t); extern int wcsncasecmp(const wchar_t *, const wchar_t *, size_t); extern int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t); extern size_t mbsnrtowcs(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD, size_t, size_t, mbstate_t *_RESTRICT_KYWD); extern FILE *open_wmemstream(wchar_t **, size_t *); #endif /* defined(_XPG7) || !defined(_STRICT_SYMBOLS) */ #if defined(_XPG8) || !defined(_STRICT_SYMBOLS) extern size_t wcslcat(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, size_t); extern size_t wcslcpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, size_t); #endif /* defined(_XPG8) || !defined(_STRICT_SYMBOLS) */ #ifdef __cplusplus } #endif #endif /* _WCHAR_H */ /* * 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 #include #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 */ /* * 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 2015 Garrett D'Amore * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _WCTYPE_H #define _WCTYPE_H #include #include #ifndef _STRICT_SYMBOLS #include #include #endif /* * Allow global visibility for symbols defined in * C++ "std" namespace in . */ #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; #if (__cplusplus >= 201103L) || defined(_STDC_C99) || defined(_XPG6) || \ !defined(_STRICT_SYMBOLS) using std::iswblank; #endif #endif #ifdef __cplusplus extern "C" { #endif /* do not allow any of the following in a strictly conforming application */ #ifndef _STRICT_SYMBOLS /* * 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 */ }; #ifdef _ILLUMOS_PRIVATE extern int __iswrune(wint_t); extern wint_t __nextwctype(wint_t, wctype_t); #define iswrune(c) __iswrune(c) #define nextwctype(c, t) __nextwctype(c, t) #endif /* character classification functions */ /* iswascii is still a macro */ #define iswascii(c) isascii(c) /* isw*, except iswascii(), are not macros any more. They become functions */ /* 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); /* From BSD/MacOS */ extern int iswideogram(wint_t); extern int iswphonogram(wint_t); extern int iswnumber(wint_t); extern int iswhexnumber(wint_t); extern int iswspecial(wint_t); #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(_STRICT_SYMBOLS)... */ /* XPG7 extended locale support */ #if defined(_XPG7) || !defined(_STRICT_SYMBOLS) #ifndef _LOCALE_T #define _LOCALE_T typedef struct _locale *locale_t; #endif extern wint_t towlower_l(wint_t, locale_t); extern wint_t towupper_l(wint_t, locale_t); extern wint_t towctrans_l(wint_t, wctrans_t, locale_t); extern int iswctype_l(wint_t, wctype_t, locale_t); extern int iswalnum_l(wint_t, locale_t); extern int iswalpha_l(wint_t, locale_t); extern int iswblank_l(wint_t, locale_t); extern int iswcntrl_l(wint_t, locale_t); extern int iswdigit_l(wint_t, locale_t); extern int iswgraph_l(wint_t, locale_t); extern int iswlower_l(wint_t, locale_t); extern int iswprint_l(wint_t, locale_t); extern int iswpunct_l(wint_t, locale_t); extern int iswspace_l(wint_t, locale_t); extern int iswupper_l(wint_t, locale_t); extern int iswxdigit_l(wint_t, locale_t); extern wctrans_t wctrans_l(const char *, locale_t); extern wctype_t wctype_l(const char *, locale_t); #endif /* defined(_XPG7) || !defined(_STRICT_SYMBOLS) */ #ifdef __cplusplus } #endif #endif /* _WCTYPE_H */ /* * 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 2014 Garrett D'Amore * * 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 #include #include /* For definition of FILE */ #include #include #ifdef __cplusplus extern "C" { #endif /* 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_SYMBOLS) 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_SYMBOLS) */ /* 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 */ /* * 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 2014 Garrett D'Amore * * 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 #include #include #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) */ extern int wordexp(const char *_RESTRICT_KYWD, wordexp_t *_RESTRICT_KYWD, int); extern void wordfree(wordexp_t *); #ifdef __cplusplus } #endif #endif /* _WORDEXP_H */ /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2014 Garrett D'Amore * Copyright 2025 Bill Sommerfeld */ #ifndef _XLOCALE_H #define _XLOCALE_H /* * This file supplies declarations for extended locale routines, as * originally delivered by MacOS X. Many of these things are now * officially part of XPG7. (Note that while the interfaces are the * same as MacOS X, there is no shared implementation.) * * Those declarations that are part of XPG7 are provided for the in the * XPG7-specified location. This file lists just the declarations that * were not part of the standard. These will be useful in their own right, * and will aid porting programs that don't strictly follow the standard. * * Note that it is an error to include this file in a program with strict * symbol visibilty rules (under strict ANSI or POSIX_C_SOURCE rules.) * If this is done, the symbols defined here will indeed be exposed to your * program, but those symbols that are part of the related standards might * not be. */ #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif #ifndef _LOCALE_T #define _LOCALE_T typedef struct _locale *locale_t; #endif extern int mbsinit_l(const mbstate_t *, locale_t); extern size_t mbsrtowcs_l(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD, locale_t); extern size_t mbsnrtowcs_l(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD, size_t, size_t, mbstate_t *_RESTRICT_KYWD, locale_t); extern char *strptime_l(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, struct tm *_RESTRICT_KYWD, locale_t); extern int wcwidth_l(wchar_t, locale_t); extern int wcswidth_l(const wchar_t *, size_t, locale_t); extern int iswspecial_l(wint_t, locale_t); extern int iswnumber_l(wint_t, locale_t); extern int iswhexnumber_l(wint_t, locale_t); extern int iswideogram_l(wint_t, locale_t); extern int iswphonogram_l(wint_t, locale_t); extern wint_t btowc_l(int, locale_t); extern int wctob_l(wint_t, locale_t); extern size_t mbrtowc_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD, locale_t); extern size_t mbstowcs_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, locale_t); extern int mblen_l(const char *, size_t, locale_t); extern size_t mbrlen_l(const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD, locale_t); extern int mbtowc_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, locale_t); extern size_t wcsrtombs_l(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD, locale_t); extern size_t wcsnrtombs_l(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD, size_t, size_t, mbstate_t *_RESTRICT_KYWD, locale_t); extern size_t wcrtomb_l(char *_RESTRICT_KYWD, wchar_t, mbstate_t *_RESTRICT_KYWD, locale_t); extern size_t wcstombs_l(char *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, size_t, locale_t); extern int wctomb_l(char *, wchar_t, locale_t); extern unsigned char __mb_cur_max_l(locale_t); #ifndef MB_CUR_MAX_L #define MB_CUR_MAX_L(l) (__mb_cur_max_l(l)) #endif extern struct lconv *localeconv_l(locale_t); extern size_t wcsftime_l(wchar_t *_RESTRICT_KYWD, size_t, const wchar_t *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD, locale_t); /* these three are also in stdlib.h */ extern float strtof_l(const char *, char **, locale_t); extern double strtod_l(const char *, char **, locale_t); extern long double strtold_l(const char *, char **, locale_t); extern void string_to_decimal_l(char **, int, int, decimal_record *, enum decimal_string_form *, char **, locale_t); #if defined(_XPG4) && !defined(_FILEDEFED) || __cplusplus >= 199711L #define _FILEDEFED typedef __FILE FILE; #endif extern wint_t fgetwc_l(FILE *, locale_t); extern wint_t getwc_l(FILE *, locale_t); #ifndef getwchar_l #define getwchar_l(l) fgetwc_l(stdin, (l)) #endif #ifdef __cplusplus } #endif #endif /* _XLOCALE_H */ /* * 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 2014 Garrett D'Amore */ /* Copyright (c) 1996 Sun Microsystems, Inc. */ /* All Rights Reserved */ #ifndef _XTI_H #define _XTI_H #include /* * 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 /* * Include XTI interface level options management declarations */ #include #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 #include #endif /* !defined(_XPG5) */ #ifdef __cplusplus extern "C" { #endif /* * The following t_errno error codes are included in the namespace by * inclusion of 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 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 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(_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); #ifdef __cplusplus } #endif #endif /* _XTI_H */ /* * 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 #include #endif /* _XTI_INET_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _ZONE_H #define _ZONE_H #include #include #include #include #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, const char *, size_t, int *, int, int, const bslabel_t *, int); extern int zone_boot(zoneid_t); extern int zone_destroy(zoneid_t); extern ssize_t zone_getattr(zoneid_t, int, void *, size_t); extern int zone_setattr(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); extern int zone_version(int *); extern int zone_add_datalink(zoneid_t, datalink_id_t); extern int zone_remove_datalink(zoneid_t, datalink_id_t); extern int zone_check_datalink(zoneid_t *, datalink_id_t); extern int zone_list_datalink(zoneid_t, int *, datalink_id_t *); #ifdef __cplusplus } #endif #endif /* _ZONE_H */