diff options
author | Philippe Coval <philippe.coval@eurogiciel.fr> | 2013-03-01 11:33:00 +0100 |
---|---|---|
committer | Philippe Coval <philippe.coval@eurogiciel.fr> | 2013-03-01 11:33:00 +0100 |
commit | a119991b98b043ef5a2432a7a0e2c4f2cf484674 (patch) | |
tree | 7346d42a282562a3937d82307012b5857d642ce6 /include | |
parent | 17a3b002800b60ee4863bd971c0068c324a27fd7 (diff) | |
download | cdrkit-a119991b98b043ef5a2432a7a0e2c4f2cf484674.tar.gz cdrkit-a119991b98b043ef5a2432a7a0e2c4f2cf484674.tar.bz2 cdrkit-a119991b98b043ef5a2432a7a0e2c4f2cf484674.zip |
Imported Upstream version 1.1.11upstream/1.1.11upstream
Diffstat (limited to 'include')
47 files changed, 8233 insertions, 0 deletions
diff --git a/include/AddNetworkBits.cmake b/include/AddNetworkBits.cmake new file mode 100644 index 0000000..56643b3 --- /dev/null +++ b/include/AddNetworkBits.cmake @@ -0,0 +1,60 @@ + +# various checks add additional of extra libs, most likely for SunOS +# using own checks and not CHECK_SYMBOLE because of spurios problems seen with +# it + +INCLUDE(CheckCSourceCompiles) + +SET(TESTSRC " +#include <sys/types.h> +#include <sys/socket.h> + +int main(int argc, char **argv) { +return socket(AF_INET, SOCK_STREAM, 0); +} +") + +SET(CMAKE_REQUIRED_LIBRARIES ) +CHECK_C_SOURCE_COMPILES("${TESTSRC}" USE_LIBC_SOCKET) + +IF(NOT USE_LIBC_SOCKET) + + LIST(APPEND EXTRA_LIBS socket) + + SET(CMAKE_REQUIRED_LIBRARIES socket) + CHECK_C_SOURCE_COMPILES("${TESTSRC}" USE_LIBSOCKET) + IF(NOT USE_LIBSOCKET) + MESSAGE(FATAL_ERROR "No working socket(...) found in libc or libsocket") + ENDIF(NOT USE_LIBSOCKET) + +ENDIF(NOT USE_LIBC_SOCKET) + +SET(TESTSRC " +#include <sys/types.h> +#include <sys/socket.h> +#include <netdb.h> + +int main(int argc, char **argv) { +struct hostent *h = gethostbyname(argv[0]); +return sizeof(h); +} +") + +CHECK_C_SOURCE_COMPILES("${TESTSRC}" USE_LIBC_NLS) +IF(NOT USE_LIBC_NLS) + SET(CMAKE_REQUIRED_LIBRARIES nls) + CHECK_C_SOURCE_COMPILES("${TESTSRC}" USE_LIBNLS) + IF(USE_LIBNLS) + LIST(APPEND EXTRA_LIBS nls) + ELSE(USE_LIBNLS) + SET(CMAKE_REQUIRED_LIBRARIES xnet) + CHECK_C_SOURCE_COMPILES("${TESTSRC}" USE_LIBXNET) + IF(NOT USE_LIBXNET) + MESSAGE(FATAL_ERROR "Error: Could not find a system library providing gethostbyname.") + ELSE(NOT USE_LIBXNET) + LIST(APPEND EXTRA_LIBS xnet) + ENDIF(NOT USE_LIBXNET) + ENDIF(USE_LIBNLS) +ENDIF(NOT USE_LIBC_NLS) +SET(CMAKE_REQUIRED_LIBRARIES ) + diff --git a/include/AddScgBits.cmake b/include/AddScgBits.cmake new file mode 100644 index 0000000..6aaff73 --- /dev/null +++ b/include/AddScgBits.cmake @@ -0,0 +1,65 @@ + +IF(NOT GUARD_SCGCONFIG) + SET(GUARD_SCGCONFIG 1) + + +LIST(APPEND EXTRA_LIBS "usal") + +INCLUDE(CheckIncludeFiles) +CHECK_INCLUDE_FILES("stdio.h;camlib.h" HAVE_CAMLIB_H) + +IF(HAVE_CAMLIB_H) + + # quick an dirty, should better become a variable used by libusal only, + # analogous to SCG_SELF_LIBS + ADD_DEFINITIONS(-DHAVE_CAMLIB_H) + + LIST(APPEND EXTRA_LIBS "cam") + LIST(APPEND SCG_SELF_LIBS "cam") + +ENDIF(HAVE_CAMLIB_H) + +FIND_LIBRARY(HAVE_LIBVOLMGT "volmgt") +IF(HAVE_LIBVOLMGT) + LIST(APPEND EXTRA_LIBS "volmgt") + LIST(APPEND SCG_SELF_LIBS "volmgt") +ENDIF(HAVE_LIBVOLMGT) + + INCLUDE(CheckCSourceCompiles) + + SET(TESTSRC " +#include <sys/types.h> +#include <sys/socket.h> + +int main(int argc, char **argv) { + return socket(AF_INET, SOCK_STREAM, 0); +} +") + +SET(CMAKE_REQUIRED_LIBRARIES ) + CHECK_C_SOURCE_COMPILES("${TESTSRC}" LIBC_SOCKET) + +IF(NOT LIBC_SOCKET) + LIST(APPEND EXTRA_LIBS -lsocket) + #MESSAGE("Using libsocket for socket functions") +ENDIF(NOT LIBC_SOCKET) + + + SET(TESTSRC " +#include <sched.h> +struct sched_param scp; + int main(int argc, char **argv) { + return sched_setscheduler(0, SCHED_RR, &scp); + } +") + + +SET(CMAKE_REQUIRED_LIBRARIES ) + CHECK_C_SOURCE_COMPILES("${TESTSRC}" LIBC_SCHED) + +IF(NOT LIBC_SCHED) + LIST(APPEND EXTRA_LIBS -lrt) + #MESSAGE("Using librt for realtime functions") +ENDIF(NOT LIBC_SCHED) + +ENDIF(NOT GUARD_SCGCONFIG) diff --git a/include/AddSchilyBits.cmake b/include/AddSchilyBits.cmake new file mode 100644 index 0000000..475e5cd --- /dev/null +++ b/include/AddSchilyBits.cmake @@ -0,0 +1,13 @@ +IF(NOT CHECKED_rols) + SET(CHECKED_rols 1) + + LIST(APPEND EXTRA_LIBS "rols") + +# abuse this include file to make sure the target is set + + IF(NOT MANSUBDIR) + SET(MANSUBDIR "share/man") + ENDIF(NOT MANSUBDIR) + +ENDIF(NOT CHECKED_rols) + diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 0000000..99a69fd --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,170 @@ +PROJECT (INCLUDES C) + +FILE(READ "${CMAKE_SOURCE_DIR}/VERSION" CDRKIT_VERSION) +STRING(REPLACE "\n" "" CDRKIT_VERSION "${CDRKIT_VERSION}") +MESSAGE("Configuring Cdrkit, version ${CDRKIT_VERSION}") + +# auto-generated header with sizeof magic +INCLUDE(CheckTypeSize) +CHECK_TYPE_SIZE(short SIZE_SHORT) +MATH(EXPR SHORTLESS ${SIZE_SHORT}-1) +CHECK_TYPE_SIZE(int SIZE_INT) +MATH(EXPR INTLESS ${SIZE_INT}-1) +CHECK_TYPE_SIZE(long SIZE_LONG) +MATH(EXPR LONGLESS ${SIZE_LONG}-1) +CHECK_TYPE_SIZE("long long" SIZE_LLONG) +MATH(EXPR LLONGLESS ${SIZE_LLONG}-1) +CHECK_TYPE_SIZE(float SIZE_FLOAT) +MATH(EXPR FLOATLESS ${SIZE_FLOAT}-1) +CHECK_TYPE_SIZE(double SIZE_DOUBLE) +MATH(EXPR DOUBLELESS ${SIZE_DOUBLE}-1) +CHECK_TYPE_SIZE("char*" SIZE_PTR) +MATH(EXPR PTRLESS ${SIZE_PTR}-1) +CONFIGURE_FILE( align.h.in align.h) +#SET_SOURCE_FILES_PROPERTIES(align.h PROPERTIES GENERATED 1) + +TRY_COMPILE(VA_LIST_IS_ARRAY ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/test_VA_LIST_IS_ARRAY.c) +# invert the result, has the condition IFF compiler fails. There must be a simple way to say a=!b... but how? +IF(VA_LIST_IS_ARRAY) + SET(VA_LIST_IS_ARRAY FALSE) +else(VA_LIST_IS_ARRAY) + SET(VA_LIST_IS_ARRAY TRUE) +endif(VA_LIST_IS_ARRAY) + + +INCLUDE(TestBigEndian) +TEST_BIG_ENDIAN(WORDS_BIGENDIAN) + +TRY_RUN(BITFIELDS_HTOL TEST_DUMMY ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/test_BITFIELDS_HTOL.c) + +INCLUDE(CheckIncludeFiles) + +#SET(CMAKE_REQUIRED_INCLUDES "/usr/include;/usr/local/include") +CHECK_INCLUDE_FILES("stdarg.h" HAVE_STDARG_H) +CHECK_INCLUDE_FILES("stdlib.h" HAVE_STDLIB_H) +CHECK_INCLUDE_FILES("string.h" HAVE_STRING_H) +CHECK_INCLUDE_FILES("strings.h" HAVE_STRINGS_H) +CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H) +CHECK_INCLUDE_FILES("getopt.h" HAVE_GETOPT_H) +CHECK_INCLUDE_FILES("limits.h" HAVE_LIMITS_H) +CHECK_INCLUDE_FILES("fcntl.h" HAVE_FCNTL_H) +CHECK_INCLUDE_FILES("sys/file.h" HAVE_SYS_FILE_H) +CHECK_INCLUDE_FILES("inttypes.h" HAVE_INTTYPES_H) +CHECK_INCLUDE_FILES("dirent.h" HAVE_DIRENT_H) +CHECK_INCLUDE_FILES("alloca.h" HAVE_ALLOCA_H) +CHECK_INCLUDE_FILES("termios.h" HAVE_TERMIOS_H) +CHECK_INCLUDE_FILES("termio.h" HAVE_TERMIO_H) +CHECK_INCLUDE_FILES("pwd.h" HAVE_PWD_H) +CHECK_INCLUDE_FILES("sys/time.h" HAVE_SYS_TIME_H) +CHECK_INCLUDE_FILES("utime.h" HAVE_UTIME_H) +CHECK_INCLUDE_FILES("sys/ioctl.h" HAVE_SYS_IOCTL_H) +CHECK_INCLUDE_FILES("sys/param.h" HAVE_SYS_PARAM_H) +CHECK_INCLUDE_FILES("wait.h" HAVE_WAIT_H) +CHECK_INCLUDE_FILES("sys/wait.h" HAVE_SYS_WAIT_H) +CHECK_INCLUDE_FILES("sys/resource.h" HAVE_SYS_RESOURCE_H) +CHECK_INCLUDE_FILES("sys/utsname.h" HAVE_SYS_UTSNAME_H) +CHECK_INCLUDE_FILES("poll.h" HAVE_POLL_H) +CHECK_INCLUDE_FILES("sys/poll.h" HAVE_SYS_POLL_H) +CHECK_INCLUDE_FILES("netdb.h" HAVE_NETDB_H) +CHECK_INCLUDE_FILES("sys/socket.h" HAVE_SYS_SOCKET_H) +CHECK_INCLUDE_FILES("linux/pg.h" HAVE_LINUX_PG_H) +CHECK_INCLUDE_FILES("arpa/inet.h" HAVE_ARPA_INET_H) +CHECK_INCLUDE_FILES("sys/ipc.h" HAVE_SYS_IPC_H) +CHECK_INCLUDE_FILES("sys/types.h;sys/mman.h" HAVE_SYS_MMAN_H) +CHECK_INCLUDE_FILES("sys/types.h;sys/dkio.h" HAVE_SYS_DKIO_H) +CHECK_INCLUDE_FILES("sys/types.h;sun/dkio.h" HAVE_SUN_DKIO_H) +CHECK_INCLUDE_FILES("iconv.h" HAVE_ICONV_H) + + +INCLUDE(CheckCSourceCompiles) +INCLUDE(CheckFunctionExists) + +#SET(CMAKE_REQUIRED_LIBRARIES iconv) +SET(TESTSRC " +#include <iconv.h> +int main(int a, char **b) { iconv_t foo = iconv_open(b[0], b[0]); return(0); } +") + +CHECK_C_SOURCE_COMPILES("${TESTSRC}" USE_LIBC_ICONV) +IF(NOT USE_LIBC_ICONV) +SET(CMAKE_REQUIRED_LIBRARIES iconv) +CHECK_C_SOURCE_COMPILES("${TESTSRC}" USE_LIBICONV) +IF(NOT USE_LIBICONV) + message("ERROR: no library providing iconv found") +ENDIF(NOT USE_LIBICONV) +ENDIF(NOT USE_LIBC_ICONV) +SET(CMAKE_REQUIRED_INCLUDES ) + + + +#CHECK_C_SOURCE_COMPILES("${TESTSRC}" USE_LIBICONV) +#IF(NOT USE_LIBICONV) +# FIND_FILE(ICONV_H_LOCATION "iconv.h") +# IF(NOT "${ICONV_H_LOCATION}" EQUAL "/usr/include/iconv.h") +# MESSAGE("WARNING: iconv.h found in non-standard location (${ICONV_H_LOCATION}) but") +# MESSAGE("GNU libiconv is not available. See INSTALL for details. Sleeping 10 seconds.") +# EXECUTE_PROCESS(COMMAND "sleep" "10") +# ENDIF(NOT "${ICONV_H_LOCATION}" EQUAL "/usr/include/iconv.h") +#ENDIF(NOT USE_LIBICONV) + +SET(CMAKE_REQUIRED_LIBRARIES ) +SET(TESTSRC " +#include <stdlib.h> +int main() { return ( (int) drand48() ) ; } +") +CHECK_C_SOURCE_COMPILES("${TESTSRC}" HAVE_DRAND48) +SET(TESTSRC " +#include <stdlib.h> +int main() { return ( (int) drand() ) ; } +") +CHECK_C_SOURCE_COMPILES("${TESTSRC}" HAVE_DRAND) +SET(TESTSRC " +#include <sys/socket.h> +#include <netdb.h> +int main(int argc, char **argv) { +struct sockaddr sa; +return getnameinfo(&sa, 1, argv[0], 1, argv[1], 1, 0); +} +") +CHECK_C_SOURCE_COMPILES("${TESTSRC}" HAVE_GETNAMEINFO) +SET(TESTSRC " +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +int main(int a, char **b) { +struct in_addr in; +inet_ntoa(in); +return 0; +} +") +CHECK_C_SOURCE_COMPILES("${TESTSRC}" HAVE_INET_NTOA) + +SET(TESTSRC " +#include <sys/types.h> +#include <wait.h> +int main() { +union wait w; +return 0; +} +") +# FIXME: try the same with #include <sys/wait.h>... may work, if yes, integrate properly +CHECK_C_SOURCE_COMPILES("${TESTSRC}" HAVE_UNION_WAIT) +SET(TESTSRC " +#include <sys/types.h> +#include <sys/mman.h> +int main() { +if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0) + return(0); + } +") +CHECK_C_SOURCE_COMPILES("${TESTSRC}" HAVE_MLOCKALL) +SET(TESTSRC " +int main(int argc, char **argv) { + int a[argc]; + return 0; +} +") +CHECK_C_SOURCE_COMPILES("${TESTSRC}" HAVE_DYN_ARRAYS) + +CONFIGURE_FILE( xconfig.h.in xconfig.h) + diff --git a/include/align.h.in b/include/align.h.in new file mode 100644 index 0000000..411fec1 --- /dev/null +++ b/include/align.h.in @@ -0,0 +1,84 @@ +/* + * This file has been generated automatically + * by CMake commands. Do not edit. + * + * Original contents from @(#)align_test.c 1.19 03/11/25 Copyright 1995 J. Schilling + * + */ + +#ifndef _UTYPES_H +#include <utypes.h> +#endif + +#define ALIGN_SHORT @SIZE_SHORT@ +#define ALIGN_INT @SIZE_INT@ +#define ALIGN_LONG @SIZE_LONG@ +#define ALIGN_LLONG @SIZE_LLONG@ +#define ALIGN_FLOAT @SIZE_FLOAT@ +#define ALIGN_DOUBLE @SIZE_DOUBLE@ +#define ALIGN_PTR @SIZE_PTR@ + +#define SIZE_SHORT @SIZE_SHORT@ +#define SIZE_INT @SIZE_INT@ +#define SIZE_LONG @SIZE_LONG@ +#define SIZE_LLONG @SIZE_LLONG@ +#define SIZE_FLOAT @SIZE_FLOAT@ +#define SIZE_DOUBLE @SIZE_DOUBLE@ +#define SIZE_PTR @SIZE_PTR@ + + +#define ALIGN_SMASK @SHORTLESS@ +#define ALIGN_IMASK @INTLESS@ +#define ALIGN_LMASK @LONGLESS@ +#define ALIGN_LLMASK @LLONGLESS@ +#define ALIGN_FMASK @FLOATLESS@ +#define ALIGN_DMASK @DOUBLELESS@ +#define ALIGN_PMASK @PTRLESS@ + + +/* + * There used to be a cast to an int but we get a warning from GCC. + * This warning message from GCC is wrong. + * Believe me that this macro would even be usable if I would cast to short. + * In order to avoid this warning, we are now using UIntptr_t + */ +#define xaligned(a, s) ((((UIntptr_t)(a)) & (s)) == 0 ) +#define x2aligned(a, b, s) (((((UIntptr_t)(a)) | ((UIntptr_t)(b))) & (s)) == 0 ) + +#define saligned(a) xaligned(a, ALIGN_SMASK) +#define s2aligned(a, b) x2aligned(a, b, ALIGN_SMASK) + +#define ialigned(a) xaligned(a, ALIGN_IMASK) +#define i2aligned(a, b) x2aligned(a, b, ALIGN_IMASK) + +#define laligned(a) xaligned(a, ALIGN_LMASK) +#define l2aligned(a, b) x2aligned(a, b, ALIGN_LMASK) + +#define llaligned(a) xaligned(a, ALIGN_LLMASK) +#define ll2aligned(a, b) x2aligned(a, b, ALIGN_LLMASK) + +#define faligned(a) xaligned(a, ALIGN_FMASK) +#define f2aligned(a, b) x2aligned(a, b, ALIGN_FMASK) + +#define daligned(a) xaligned(a, ALIGN_DMASK) +#define d2aligned(a, b) x2aligned(a, b, ALIGN_DMASK) + +#define paligned(a) xaligned(a, ALIGN_PMASK) +#define p2aligned(a, b) x2aligned(a, b, ALIGN_PMASK) + + +/* + * There used to be a cast to an int but we get a warning from GCC. + * This warning message from GCC is wrong. + * Believe me that this macro would even be usable if I would cast to short. + * In order to avoid this warning, we are now using UIntptr_t + */ +#define xalign(x, a, m) ( ((char *)(x)) + ( (a) - 1 - ((((UIntptr_t)(x))-1)&(m))) ) + +#define salign(x) xalign((x), ALIGN_SHORT, ALIGN_SMASK) +#define ialign(x) xalign((x), ALIGN_INT, ALIGN_IMASK) +#define lalign(x) xalign((x), ALIGN_LONG, ALIGN_LMASK) +#define llalign(x) xalign((x), ALIGN_LLONG, ALIGN_LLMASK) +#define falign(x) xalign((x), ALIGN_FLOAT, ALIGN_FMASK) +#define dalign(x) xalign((x), ALIGN_DOUBLE, ALIGN_DMASK) +#define palign(x) xalign((x), ALIGN_PTR, ALIGN_PMASK) diff --git a/include/allocax.h b/include/allocax.h new file mode 100644 index 0000000..11431de --- /dev/null +++ b/include/allocax.h @@ -0,0 +1,80 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)allocax.h 1.3 03/07/15 Copyright 2002 J. Schilling */ +/* + * Definitions for users of alloca() + * + * Important: #include this directly after <mconfig.h> + * and before any other include file. + * See comment in _AIX part below. + * + * Copyright (c) 2002 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef _ALLOCAX_H +#define _ALLOCAX_H + +#ifdef __GNUC__ +# ifndef alloca +# define alloca(s) __builtin_alloca(s) +# endif +#else +# ifdef _MSC_VER +# include <malloc.h> +# define alloca _alloca +# else +# ifdef HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + /* + * Indent so pre-ANSI compilers will ignore it + * + * Some versions of AIX may require this to be + * first in the file and only preceded by + * comments and preprocessor directives/ + */ + #pragma alloca +# else +# ifndef alloca + /* + * predefined by HP cc +Olibcalls + */ +# ifdef PROTOTYPES + extern void *alloca(); +# else + extern char *alloca(); +# endif +# endif +# endif +# endif +# endif +#endif + + +#endif /* _ALLOCAX_H */ diff --git a/include/avoffset.h b/include/avoffset.h new file mode 100644 index 0000000..aa0fdaa --- /dev/null +++ b/include/avoffset.h @@ -0,0 +1,13 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* Dummy */ diff --git a/include/btorder.h b/include/btorder.h new file mode 100644 index 0000000..a76a239 --- /dev/null +++ b/include/btorder.h @@ -0,0 +1,130 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)btorder.h 1.16 03/06/15 Copyright 1996 J. Schilling */ +/* + * Definitions for Bit and Byte ordering + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef _BTORDER_H +#define _BTORDER_H + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> /* try to load isa_defs.h on Solaris */ +#define _INCL_SYS_TYPES_H +#endif + +#ifndef _MCONFIG_H +#include <mconfig.h> /* load bit/byte-oder from xmconfig.h*/ +#endif + +/* + * Convert bit-order definitions from xconfig.h into our values + * and verify them. + */ +#if defined(HAVE_C_BITFIELDS) && \ + defined(BITFIELDS_LTOH) +#define _BIT_FIELDS_LTOH +#endif + +#if defined(HAVE_C_BITFIELDS) && \ + defined(BITFIELDS_HTOL) +#define _BIT_FIELDS_HTOL +#endif + +#if defined(HAVE_C_BITFIELDS) && \ + !defined(BITFIELDS_HTOL) +#define BITFIELDS_LTOH +#define _BIT_FIELDS_LTOH +#endif + +#if defined(_BIT_FIELDS_LTOH) && defined(_BIT_FIELDS_HTOL) +/* + * #error will not work for all compilers (e.g. sunos4) + * The following line will abort compilation on all compilers + * if none of the above is defines. And that's what we want. + */ +error Only one of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL may be defined +#endif + + +/* + * Convert byte-order definitions from xconfig.h into our values + * and verify them. + * Note that we cannot use the definitions _LITTLE_ENDIAN and _BIG_ENDIAN + * because they are used on IRIX-6.5 with different meaning. + */ +#if defined(HAVE_C_BIGENDIAN) && \ + !defined(WORDS_BIGENDIAN) +#define WORDS_LITTLEENDIAN +/*#define _LITTLE_ENDIAN*/ +#endif + +#if defined(HAVE_C_BIGENDIAN) && \ + defined(WORDS_BIGENDIAN) +#undef WORDS_LITTLEENDIAN +/*#define _BIG_ENDIAN*/ +#endif + +#if defined(_BIT_FIELDS_LTOH) || defined(_BIT_FIELDS_HTOL) +/* + * Bitorder is already known. + */ +#else +/* + * Bitorder not yet known. + */ +# if defined(sun3) || defined(mc68000) || \ + defined(sun4) || defined(__sparc) || defined(sparc) || \ + defined(__hppa) || defined(_ARCH_PPC) || defined(_IBMR2) +# define _BIT_FIELDS_HTOL +# endif + +# if defined(__sgi) && defined(__mips) +# define _BIT_FIELDS_HTOL +# endif + +# if defined(__i386__) || defined(__i386) || defined(i386) || \ + defined(__alpha__) || defined(__alpha) || defined(alpha) || \ + defined(__arm__) || defined(__arm) || defined(arm) +# define _BIT_FIELDS_LTOH +# endif + +# if defined(__ppc__) || defined(ppc) || defined(__ppc) || \ + defined(__PPC) || defined(powerpc) || defined(__powerpc__) + +# if defined(__BIG_ENDIAN__) +# define _BIT_FIELDS_HTOL +# else +# define _BIT_FIELDS_LTOH +# endif +# endif +#endif + +#endif /* _BTORDER_H */ diff --git a/include/ccomdefs.h b/include/ccomdefs.h new file mode 100644 index 0000000..6667501 --- /dev/null +++ b/include/ccomdefs.h @@ -0,0 +1,78 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)ccomdefs.h 1.3 03/06/15 Copyright 2000 J. Schilling */ +/* + * Various compiler dependant macros. + * + * Copyright (c) 2000 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _CCOMDEFS_H +#define _CCOMDEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Compiler-dependent macros to declare that functions take printf-like + * or scanf-like arguments. They are defined to nothing for versions of gcc + * that are not known to support the features properly (old versions of gcc-2 + * didn't permit keeping the keywords out of the application namespace). + */ +#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 7 + +#define __printflike__(fmtarg, firstvararg) +#define __printf0like__(fmtarg, firstvararg) +#define __scanflike__(fmtarg, firstvararg) + +#else /* We found GCC that supports __attribute__ */ + +#define __printflike__(fmtarg, firstvararg) \ + __attribute__((__format__(__printf__, fmtarg, firstvararg))) +#define __printf0like__(fmtarg, firstvararg) \ + __attribute__((__format__(__printf0__, fmtarg, firstvararg))) + +/* + * FreeBSD GCC implements printf0 that allows the format string to + * be a NULL pointer. + */ +#if __FreeBSD_cc_version < 300001 +#undef __printf0like__ +#define __printf0like__ __printflike__ +#endif + +#define __scanflike__(fmtarg, firstvararg) \ + __attribute__((__format__(__scanf__, fmtarg, firstvararg))) + +#endif /* GNUC */ + +#ifdef __cplusplus +} +#endif + +#endif /* _CCOMDEFS_H */ diff --git a/include/deflts.h b/include/deflts.h new file mode 100644 index 0000000..097047b --- /dev/null +++ b/include/deflts.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2006 Eduard Bloch + * + * Config parsing code, with interface similar to basic libdeflt interface + * from J. Schilling but with different semantics + * + * get_value uses a static buffer (warning, non-reentrant) + * cfg_open and cfg_close maintain a static FILE pointer (warning, non-reentrant) + * + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _DEFLTS_H +#define _DEFLTS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* FIXME: use inline trough an INLINE macro wrapper */ +extern int cfg_open (const char *name); +extern int cfg_close (void); + +/* reset the position in FILE */ +extern void cfg_restart (void); +/* returns the next value found after the current position */ +extern char *cfg_get_next (const char *name); +/* equivalent to cfg_restart(); cfg_get_next(...) */ +extern char *cfg_get(const char *key); +/* function wrapped by those above */ +extern char *get_value(FILE *srcfile, const char *key, int dorewind); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/device.h b/include/device.h new file mode 100644 index 0000000..a3c8c92 --- /dev/null +++ b/include/device.h @@ -0,0 +1,162 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)device.h 1.13 05/01/24 Copyright 1995 J. Schilling */ +/* + * Generic header for users of major(), minor() and makedev() + * + * Copyright (c) 1995 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _DEVICE_H +#define _DEVICE_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +/* + * On generic SVR4, major is a function (defined in sys/mkdev.h). + * On Solaris it is defined ... + * As we cannot just test if major is #define'd, we have to + * define _FOUND_MAJOR_ instead. + * + * WARNING: Do never include <sys/sysmacros.h> in SVR4, it contains + * an old definition for major()/minor() defining 8 minorbits. + * Use <sys/mkdev.h> instead. + */ +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif +/* + * Some systems define major in <sys/types.h>. + * We are ready... + */ +#ifdef major +# define _FOUND_MAJOR_ +#endif + +#ifdef MAJOR_IN_MKDEV +# ifndef _INCL_SYS_MKDEV_H +# include <sys/mkdev.h> +# define _INCL_SYS_MKDEV_H +# endif + /* + * Interix doesn't use makedev(); it uses mkdev() + */ +# if !defined(makedev) && defined(mkdev) +# define makedev(a,b) mkdev((a),(b)) +# endif +# define _FOUND_MAJOR_ +#endif + +#ifndef _FOUND_MAJOR_ +# ifdef MAJOR_IN_SYSMACROS +# ifndef _INCL_SYS_SYSMACROS_H +# include <sys/sysmacros.h> +# define _INCL_SYS_SYSMACROS_H +# endif +# define _FOUND_MAJOR_ +# endif +#endif + +/* + * If we are on HP/UX before HP/UX 8, + * major/minor are not in <sys/sysmacros.h>. + */ +#ifndef _FOUND_MAJOR_ +# if defined(hpux) || defined(__hpux__) || defined(__hpux) +# ifndef _INCL_SYS_MKOD_H +# include <sys/mknod.h> +# define _INCL_SYS_MKOD_H +# endif +# define _FOUND_MAJOR_ +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * For all other systems define major()/minor() here. + * XXX Check if this definition will be usefull for ms dos too. + */ +#ifndef _FOUND_MAJOR_ +# define major(dev) (((dev) >> 8) & 0xFF) +# define minor(dev) ((dev) & 0xFF) +# define makedev(majo, mino) (((majo) << 8) | (mino)) +#endif + +/* + * Don't pollute namespace... + */ +#undef _FOUND_MAJOR_ + +#ifdef __XDEV__ +/* + * The following defines are currently only needed for 'star'. + * We make it conditional code to avoid to pollute the namespace. + */ +#define XDEV_T unsigned long + +extern int minorbits; +extern XDEV_T minormask; +extern XDEV_T _dev_mask[]; + +#define dev_major(dev) (((XDEV_T)(dev)) >> minorbits) +#define _dev_major(mbits, dev) (((XDEV_T)(dev)) >> (mbits)) + +#define dev_minor(dev) (((XDEV_T)(dev)) & minormask) +#define _dev_minor(mbits, dev) (((XDEV_T)(dev)) & _dev_mask[(mbits)]) + + +#define dev_make(majo, mino) ((((XDEV_T)(majo)) << minorbits) | \ + ((XDEV_T)(mino))) +#define _dev_make(mbits, majo, mino) ((((XDEV_T)(majo)) << (mbits) | \ + ((XDEV_T)(mino))) + +extern void dev_init(BOOL debug); +#ifndef dev_major +extern XDEV_T dev_major(XDEV_T dev); +extern XDEV_T _dev_major(int mbits, XDEV_T dev); +extern XDEV_T dev_minor(XDEV_T dev); +extern XDEV_T _dev_minor(int mbits, XDEV_T dev); +extern XDEV_T dev_make(XDEV_T majo, XDEV_T mino); +extern XDEV_T _dev_make(int mbits, XDEV_T majo, XDEV_T mino); +#endif + +#endif /* __XDEV__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _DEVICE_H */ diff --git a/include/dirdefs.h b/include/dirdefs.h new file mode 100644 index 0000000..fa966ab --- /dev/null +++ b/include/dirdefs.h @@ -0,0 +1,188 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)dirdefs.h 1.15 04/06/16 Copyright 1987, 1998 J. Schilling */ +/* + * Copyright (c) 1987, 1998 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _DIRDEFS_H +#define _DIRDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef JOS +# ifndef _INCL_SYS_STYPES_H +# include <sys/stypes.h> +# define _INCL_SYS_STYPES_H +# endif +# ifndef _INCL_SYS_FILEDESC_H +# include <sys/filedesc.h> +# define _INCL_SYS_FILEDESC_H +# endif +# define NEED_READDIR +# define dirent _direct +# define DIR_NAMELEN(dirent) strlen((dirent)->d_name) +# define DIRSIZE 30 +# define FOUND_DIRSIZE + typedef struct _dirent { + char name[DIRSIZE]; + short ino; + } dirent; + +#else /* !JOS */ + +# ifndef _INCL_SYS_TYPES_H +# include <sys/types.h> +# define _INCL_SYS_TYPES_H +# endif +# ifndef _INCL_SYS_STAT_H +# include <sys/stat.h> +# define _INCL_SYS_STAT_H +# endif +# ifdef HAVE_LIMITS_H +# ifndef _INCL_LIMITS_H +# include <limits.h> +# define _INCL_LIMITS_H +# endif +# endif +# ifdef HAVE_SYS_PARAM_H +# ifndef _INCL_SYS_PARAM_H +# include <sys/param.h> +# define _INCL_SYS_PARAM_H +# endif +# endif + +# ifdef HAVE_DIRENT_H /* This a POSIX compliant system */ +# ifndef _INCL_DIRENT_H +# include <dirent.h> +# define _INCL_DIRENT_H +# endif +# define DIR_NAMELEN(dirent) strlen((dirent)->d_name) +# define _FOUND_DIR_ +# else /* This is a Pre POSIX system */ + +# define dirent direct +# define DIR_NAMELEN(dirent) (dirent)->d_namlen + +# if defined(HAVE_SYS_DIR_H) +# ifndef _INCL_SYS_DIR_H +# include <sys/dir.h> +# define _INCL_SYS_DIR_H +# endif +# define _FOUND_DIR_ +# endif + +# if defined(HAVE_NDIR_H) && !defined(_FOUND_DIR_) +# ifndef _INCL_NDIR_H +# include <ndir.h> +# define _INCL_NDIR_H +# endif +# define _FOUND_DIR_ +# endif + +# if defined(HAVE_SYS_NDIR_H) && !defined(_FOUND_DIR_) +# ifndef _INCL_SYS_NDIR_H +# include <sys/ndir.h> +# define _INCL_SYS_NDIR_H +# endif +# define _FOUND_DIR_ +# endif +# endif /* HAVE_DIRENT_H */ + +# if defined(_FOUND_DIR_) +/* + * Don't use defaults here to allow recognition of problems. + */ +# ifdef MAXNAMELEN +# define DIRSIZE MAXNAMELEN /* From sys/param.h */ +# define FOUND_DIRSIZE +# else +# ifdef MAXNAMLEN +# define DIRSIZE MAXNAMLEN /* From dirent.h */ +# define FOUND_DIRSIZE +# else +# ifdef DIRSIZ +# define DIRSIZE DIRSIZ /* From sys/dir.h */ +# define FOUND_DIRSIZE +# endif +# endif +# endif +# else /* !_FOUND_DIR_ */ + +# define NEED_DIRENT +# define NEED_READDIR +# define dirent _direct +# define DIR_NAMELEN(dirent) strlen((dirent)->d_name) + +# endif /* _FOUND_DIR_ */ + + +#ifdef NEED_DIRENT + +#ifndef FOUND_DIRSIZE +#define DIRSIZE 14 /* The old UNIX standard value */ +#define FOUND_DIRSIZE +#endif + +typedef struct _dirent { + short ino; + char name[DIRSIZE]; +} dirent; + +#endif /* NEED_DIRENT */ + +#endif /* !JOS */ + +#ifdef NEED_READDIR + typedef struct __dirdesc { + FILE *dd_fd; + } DIR; + + struct _direct { + unsigned long d_ino; + unsigned short d_reclen; + unsigned short d_namlen; + char d_name[DIRSIZE +1]; + }; + +extern DIR *opendir(); +extern closedir(); +extern struct dirent *readdir(); + +#endif /* NEED_READDIR */ + +#ifdef __cplusplus +} +#endif + +#endif /* _DIRDEFS_H */ diff --git a/include/fctldefs.h b/include/fctldefs.h new file mode 100644 index 0000000..d382e68 --- /dev/null +++ b/include/fctldefs.h @@ -0,0 +1,93 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)fctldefs.h 1.13 03/02/23 Copyright 1996 J. Schilling */ +/* + * Generic header for users of open(), creat() and chmod() + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _FCTLDEFS_H +#define _FCTLDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _STATDEFS_H +#include <statdefs.h> /* For 3rd arg of open() and chmod() */ +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> /* Needed for fcntl.h */ +#define _INCL_SYS_TYPES_H +#endif + +#ifdef HAVE_SYS_FILE_H +/* + * Historical systems with flock() only need sys/file.h + */ +# ifndef _INCL_SYS_FILE_H +# include <sys/file.h> +# define _INCL_SYS_FILE_H +# endif +#endif +#ifdef HAVE_FCNTL_H +# ifndef _INCL_FCNTL_H +# include <fcntl.h> +# define _INCL_FCNTL_H +#endif +#endif + +/* + * Do not define more than O_RDONLY / O_WRONLY / O_RDWR / O_BINARY + * The values may differ. + * + * O_BINARY is defined here to allow all applications to compile on a non DOS + * environment without repeating this definition. + */ +#ifndef O_RDONLY +# define O_RDONLY 0 +#endif +#ifndef O_WRONLY +# define O_WRONLY 1 +#endif +#ifndef O_RDWR +# define O_RDWR 2 +#endif +#ifndef O_BINARY /* Only present on DOS or similar */ +# define O_BINARY 0 +#endif +#ifndef O_NDELAY /* This is undefined on BeOS :-( */ +# define O_NDELAY 0 +#endif + +#ifndef O_ACCMODE +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) +#endif + +#endif /* _FCTLDEFS_H */ diff --git a/include/getargs.h b/include/getargs.h new file mode 100644 index 0000000..6aa36b0 --- /dev/null +++ b/include/getargs.h @@ -0,0 +1,67 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)getargs.h 1.10 04/09/25 Copyright 1985 J. Schilling */ +/* + * Definitions for getargs()/getallargs()/getfiles() + * + * Copyright (c) 1985 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _GETARGS_H +#define _GETARGS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define NOARGS 0 /* No more args */ +#define NOTAFLAG 1 /* Not a flag type argument */ +#define BADFLAG (-1) /* Not a valid flag argument */ +#define BADFMT (-2) /* Error in format string */ +#define NOTAFILE (-3) /* Seems to be a flag type */ + +typedef int (*getargfun)(const void *, void *); + +/* + * Keep in sync with schily.h + */ +extern int getallargs(int *, char * const**, const char *, ...); +extern int getargs(int *, char * const**, const char *, ...); +extern int getfiles(int *, char * const**, const char *); + +#ifdef __cplusplus +} +#endif + +#endif /* _GETARGS_H */ diff --git a/include/getcwd.h b/include/getcwd.h new file mode 100644 index 0000000..462a43c --- /dev/null +++ b/include/getcwd.h @@ -0,0 +1,54 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)getcwd.h 1.3 01/07/15 Copyright 1998 J. Schilling */ +/* + * Definitions for getcwd() + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _GETCWD_H +#define _GETCWD_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef JOS +# ifndef _INCL_SYS_STYPES_H +# include <sys/stypes.h> +# define _INCL_SYS_STYPES_H +# endif + extern char *gwd(); +# define getcwd(b, len) gwd(b) +#else +# ifndef HAVE_GETCWD +# define getcwd(b, len) getwd(b) +# endif +#endif + +#endif /* _GETCWD_H */ diff --git a/include/glibc_elf.h b/include/glibc_elf.h new file mode 100644 index 0000000..ae640d5 --- /dev/null +++ b/include/glibc_elf.h @@ -0,0 +1,2558 @@ +/* + * This file has been modified for inclusion into the cdrkit package. + */ + +/* This file defines standard ELF types, structures, and macros. + Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ELF_H +#define _ELF_H 1 + +/* Standard ELF types. */ + +#include <inttypes.h> +#include <sys/types.h> + +/* Type for a 16-bit quantity. */ +typedef uint16_t Elf32_Half; +typedef uint16_t Elf64_Half; + +/* Types for signed and unsigned 32-bit quantities. */ +typedef uint32_t Elf32_Word; +typedef int32_t Elf32_Sword; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; + +/* Types for signed and unsigned 64-bit quantities. */ +typedef uint64_t Elf32_Xword; +typedef int64_t Elf32_Sxword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; + +/* Type of addresses. */ +typedef uint32_t Elf32_Addr; +typedef uint64_t Elf64_Addr; + +/* Type of file offsets. */ +typedef uint32_t Elf32_Off; +typedef uint64_t Elf64_Off; + +/* Type for section indices, which are 16-bit quantities. */ +typedef uint16_t Elf32_Section; +typedef uint16_t Elf64_Section; + +/* Type for version symbol information. */ +typedef Elf32_Half Elf32_Versym; +typedef Elf64_Half Elf64_Versym; + + +/* The ELF file header. This appears at the start of every ELF file. */ + +#define EI_NIDENT (16) + +typedef struct +{ + unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ + Elf32_Half e_type; /* Object file type */ + Elf32_Half e_machine; /* Architecture */ + Elf32_Word e_version; /* Object file version */ + Elf32_Addr e_entry; /* Entry point virtual address */ + Elf32_Off e_phoff; /* Program header table file offset */ + Elf32_Off e_shoff; /* Section header table file offset */ + Elf32_Word e_flags; /* Processor-specific flags */ + Elf32_Half e_ehsize; /* ELF header size in bytes */ + Elf32_Half e_phentsize; /* Program header table entry size */ + Elf32_Half e_phnum; /* Program header table entry count */ + Elf32_Half e_shentsize; /* Section header table entry size */ + Elf32_Half e_shnum; /* Section header table entry count */ + Elf32_Half e_shstrndx; /* Section header string table index */ +} Elf32_Ehdr; + +typedef struct +{ + unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ + Elf64_Half e_type; /* Object file type */ + Elf64_Half e_machine; /* Architecture */ + Elf64_Word e_version; /* Object file version */ + Elf64_Addr e_entry; /* Entry point virtual address */ + Elf64_Off e_phoff; /* Program header table file offset */ + Elf64_Off e_shoff; /* Section header table file offset */ + Elf64_Word e_flags; /* Processor-specific flags */ + Elf64_Half e_ehsize; /* ELF header size in bytes */ + Elf64_Half e_phentsize; /* Program header table entry size */ + Elf64_Half e_phnum; /* Program header table entry count */ + Elf64_Half e_shentsize; /* Section header table entry size */ + Elf64_Half e_shnum; /* Section header table entry count */ + Elf64_Half e_shstrndx; /* Section header string table index */ +} Elf64_Ehdr; + +/* Fields in the e_ident array. The EI_* macros are indices into the + array. The macros under each EI_* macro are the values the byte + may have. */ + +#define EI_MAG0 0 /* File identification byte 0 index */ +#define ELFMAG0 0x7f /* Magic number byte 0 */ + +#define EI_MAG1 1 /* File identification byte 1 index */ +#define ELFMAG1 'E' /* Magic number byte 1 */ + +#define EI_MAG2 2 /* File identification byte 2 index */ +#define ELFMAG2 'L' /* Magic number byte 2 */ + +#define EI_MAG3 3 /* File identification byte 3 index */ +#define ELFMAG3 'F' /* Magic number byte 3 */ + +/* Conglomeration of the identification bytes, for easy testing as a word. */ +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define EI_CLASS 4 /* File class byte index */ +#define ELFCLASSNONE 0 /* Invalid class */ +#define ELFCLASS32 1 /* 32-bit objects */ +#define ELFCLASS64 2 /* 64-bit objects */ +#define ELFCLASSNUM 3 + +#define EI_DATA 5 /* Data encoding byte index */ +#define ELFDATANONE 0 /* Invalid data encoding */ +#define ELFDATA2LSB 1 /* 2's complement, little endian */ +#define ELFDATA2MSB 2 /* 2's complement, big endian */ +#define ELFDATANUM 3 + +#define EI_VERSION 6 /* File version byte index */ + /* Value must be EV_CURRENT */ + +#define EI_OSABI 7 /* OS ABI identification */ +#define ELFOSABI_NONE 0 /* UNIX System V ABI */ +#define ELFOSABI_SYSV 0 /* Alias. */ +#define ELFOSABI_HPUX 1 /* HP-UX */ +#define ELFOSABI_NETBSD 2 /* NetBSD. */ +#define ELFOSABI_LINUX 3 /* Linux. */ +#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ +#define ELFOSABI_AIX 7 /* IBM AIX. */ +#define ELFOSABI_IRIX 8 /* SGI Irix. */ +#define ELFOSABI_FREEBSD 9 /* FreeBSD. */ +#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ +#define ELFOSABI_MODESTO 11 /* Novell Modesto. */ +#define ELFOSABI_OPENBSD 12 /* OpenBSD. */ +#define ELFOSABI_ARM 97 /* ARM */ +#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ + +#define EI_ABIVERSION 8 /* ABI version */ + +#define EI_PAD 9 /* Byte index of padding bytes */ + +/* Legal values for e_type (object file type). */ + +#define ET_NONE 0 /* No file type */ +#define ET_REL 1 /* Relocatable file */ +#define ET_EXEC 2 /* Executable file */ +#define ET_DYN 3 /* Shared object file */ +#define ET_CORE 4 /* Core file */ +#define ET_NUM 5 /* Number of defined types */ +#define ET_LOOS 0xfe00 /* OS-specific range start */ +#define ET_HIOS 0xfeff /* OS-specific range end */ +#define ET_LOPROC 0xff00 /* Processor-specific range start */ +#define ET_HIPROC 0xffff /* Processor-specific range end */ + +/* Legal values for e_machine (architecture). */ + +#define EM_NONE 0 /* No machine */ +#define EM_M32 1 /* AT&T WE 32100 */ +#define EM_SPARC 2 /* SUN SPARC */ +#define EM_386 3 /* Intel 80386 */ +#define EM_68K 4 /* Motorola m68k family */ +#define EM_88K 5 /* Motorola m88k family */ +#define EM_860 7 /* Intel 80860 */ +#define EM_MIPS 8 /* MIPS R3000 big-endian */ +#define EM_S370 9 /* IBM System/370 */ +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ + +#define EM_PARISC 15 /* HPPA */ +#define EM_VPP500 17 /* Fujitsu VPP500 */ +#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ +#define EM_960 19 /* Intel 80960 */ +#define EM_PPC 20 /* PowerPC */ +#define EM_PPC64 21 /* PowerPC 64-bit */ +#define EM_S390 22 /* IBM S390 */ + +#define EM_V800 36 /* NEC V800 series */ +#define EM_FR20 37 /* Fujitsu FR20 */ +#define EM_RH32 38 /* TRW RH-32 */ +#define EM_RCE 39 /* Motorola RCE */ +#define EM_ARM 40 /* ARM */ +#define EM_FAKE_ALPHA 41 /* Digital Alpha */ +#define EM_SH 42 /* Hitachi SH */ +#define EM_SPARCV9 43 /* SPARC v9 64-bit */ +#define EM_TRICORE 44 /* Siemens Tricore */ +#define EM_ARC 45 /* Argonaut RISC Core */ +#define EM_H8_300 46 /* Hitachi H8/300 */ +#define EM_H8_300H 47 /* Hitachi H8/300H */ +#define EM_H8S 48 /* Hitachi H8S */ +#define EM_H8_500 49 /* Hitachi H8/500 */ +#define EM_IA_64 50 /* Intel Merced */ +#define EM_MIPS_X 51 /* Stanford MIPS-X */ +#define EM_COLDFIRE 52 /* Motorola Coldfire */ +#define EM_68HC12 53 /* Motorola M68HC12 */ +#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ +#define EM_PCP 55 /* Siemens PCP */ +#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ +#define EM_NDR1 57 /* Denso NDR1 microprocessor */ +#define EM_STARCORE 58 /* Motorola Start*Core processor */ +#define EM_ME16 59 /* Toyota ME16 processor */ +#define EM_ST100 60 /* STMicroelectronic ST100 processor */ +#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ +#define EM_X86_64 62 /* AMD x86-64 architecture */ +#define EM_PDSP 63 /* Sony DSP Processor */ + +#define EM_FX66 66 /* Siemens FX66 microcontroller */ +#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ +#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ +#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ +#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ +#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ +#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ +#define EM_SVX 73 /* Silicon Graphics SVx */ +#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ +#define EM_VAX 75 /* Digital VAX */ +#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ +#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */ +#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ +#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ +#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ +#define EM_HUANY 81 /* Harvard University machine-independent object files */ +#define EM_PRISM 82 /* SiTera Prism */ +#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ +#define EM_FR30 84 /* Fujitsu FR30 */ +#define EM_D10V 85 /* Mitsubishi D10V */ +#define EM_D30V 86 /* Mitsubishi D30V */ +#define EM_V850 87 /* NEC v850 */ +#define EM_M32R 88 /* Mitsubishi M32R */ +#define EM_MN10300 89 /* Matsushita MN10300 */ +#define EM_MN10200 90 /* Matsushita MN10200 */ +#define EM_PJ 91 /* picoJava */ +#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ +#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ +#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ +#define EM_NUM 95 + +/* If it is necessary to assign new unofficial EM_* values, please + pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the + chances of collision with official or non-GNU unofficial values. */ + +#define EM_ALPHA 0x9026 + +/* Legal values for e_version (version). */ + +#define EV_NONE 0 /* Invalid ELF version */ +#define EV_CURRENT 1 /* Current version */ +#define EV_NUM 2 + +/* Section header. */ + +typedef struct +{ + Elf32_Word sh_name; /* Section name (string tbl index) */ + Elf32_Word sh_type; /* Section type */ + Elf32_Word sh_flags; /* Section flags */ + Elf32_Addr sh_addr; /* Section virtual addr at execution */ + Elf32_Off sh_offset; /* Section file offset */ + Elf32_Word sh_size; /* Section size in bytes */ + Elf32_Word sh_link; /* Link to another section */ + Elf32_Word sh_info; /* Additional section information */ + Elf32_Word sh_addralign; /* Section alignment */ + Elf32_Word sh_entsize; /* Entry size if section holds table */ +} Elf32_Shdr; + +typedef struct +{ + Elf64_Word sh_name; /* Section name (string tbl index) */ + Elf64_Word sh_type; /* Section type */ + Elf64_Xword sh_flags; /* Section flags */ + Elf64_Addr sh_addr; /* Section virtual addr at execution */ + Elf64_Off sh_offset; /* Section file offset */ + Elf64_Xword sh_size; /* Section size in bytes */ + Elf64_Word sh_link; /* Link to another section */ + Elf64_Word sh_info; /* Additional section information */ + Elf64_Xword sh_addralign; /* Section alignment */ + Elf64_Xword sh_entsize; /* Entry size if section holds table */ +} Elf64_Shdr; + +/* Special section indices. */ + +#define SHN_UNDEF 0 /* Undefined section */ +#define SHN_LORESERVE 0xff00 /* Start of reserved indices */ +#define SHN_LOPROC 0xff00 /* Start of processor-specific */ +#define SHN_BEFORE 0xff00 /* Order section before all others + (Solaris). */ +#define SHN_AFTER 0xff01 /* Order section after all others + (Solaris). */ +#define SHN_HIPROC 0xff1f /* End of processor-specific */ +#define SHN_LOOS 0xff20 /* Start of OS-specific */ +#define SHN_HIOS 0xff3f /* End of OS-specific */ +#define SHN_ABS 0xfff1 /* Associated symbol is absolute */ +#define SHN_COMMON 0xfff2 /* Associated symbol is common */ +#define SHN_XINDEX 0xffff /* Index is in extra table. */ +#define SHN_HIRESERVE 0xffff /* End of reserved indices */ + +/* Legal values for sh_type (section type). */ + +#define SHT_NULL 0 /* Section header table entry unused */ +#define SHT_PROGBITS 1 /* Program data */ +#define SHT_SYMTAB 2 /* Symbol table */ +#define SHT_STRTAB 3 /* String table */ +#define SHT_RELA 4 /* Relocation entries with addends */ +#define SHT_HASH 5 /* Symbol hash table */ +#define SHT_DYNAMIC 6 /* Dynamic linking information */ +#define SHT_NOTE 7 /* Notes */ +#define SHT_NOBITS 8 /* Program space with no data (bss) */ +#define SHT_REL 9 /* Relocation entries, no addends */ +#define SHT_SHLIB 10 /* Reserved */ +#define SHT_DYNSYM 11 /* Dynamic linker symbol table */ +#define SHT_INIT_ARRAY 14 /* Array of constructors */ +#define SHT_FINI_ARRAY 15 /* Array of destructors */ +#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ +#define SHT_GROUP 17 /* Section group */ +#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ +#define SHT_NUM 19 /* Number of defined types. */ +#define SHT_LOOS 0x60000000 /* Start OS-specific */ +#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ +#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ +#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ +#define SHT_SUNW_move 0x6ffffffa +#define SHT_SUNW_COMDAT 0x6ffffffb +#define SHT_SUNW_syminfo 0x6ffffffc +#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ +#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ +#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ +#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ +#define SHT_HIOS 0x6fffffff /* End OS-specific type */ +#define SHT_LOPROC 0x70000000 /* Start of processor-specific */ +#define SHT_HIPROC 0x7fffffff /* End of processor-specific */ +#define SHT_LOUSER 0x80000000 /* Start of application-specific */ +#define SHT_HIUSER 0x8fffffff /* End of application-specific */ + +/* Legal values for sh_flags (section flags). */ + +#define SHF_WRITE (1 << 0) /* Writable */ +#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ +#define SHF_EXECINSTR (1 << 2) /* Executable */ +#define SHF_MERGE (1 << 4) /* Might be merged */ +#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ +#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ +#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ +#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling + required */ +#define SHF_GROUP (1 << 9) /* Section is member of a group. */ +#define SHF_TLS (1 << 10) /* Section hold thread-local data. */ +#define SHF_MASKOS 0x0ff00000 /* OS-specific. */ +#define SHF_MASKPROC 0xf0000000 /* Processor-specific */ +#define SHF_ORDERED (1 << 30) /* Special ordering requirement + (Solaris). */ +#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless + referenced or allocated (Solaris).*/ + +/* Section group handling. */ +#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */ + +/* Symbol table entry. */ + +typedef struct +{ + Elf32_Word st_name; /* Symbol name (string tbl index) */ + Elf32_Addr st_value; /* Symbol value */ + Elf32_Word st_size; /* Symbol size */ + unsigned char st_info; /* Symbol type and binding */ + unsigned char st_other; /* Symbol visibility */ + Elf32_Section st_shndx; /* Section index */ +} Elf32_Sym; + +typedef struct +{ + Elf64_Word st_name; /* Symbol name (string tbl index) */ + unsigned char st_info; /* Symbol type and binding */ + unsigned char st_other; /* Symbol visibility */ + Elf64_Section st_shndx; /* Section index */ + Elf64_Addr st_value; /* Symbol value */ + Elf64_Xword st_size; /* Symbol size */ +} Elf64_Sym; + +/* The syminfo section if available contains additional information about + every dynamic symbol. */ + +typedef struct +{ + Elf32_Half si_boundto; /* Direct bindings, symbol bound to */ + Elf32_Half si_flags; /* Per symbol flags */ +} Elf32_Syminfo; + +typedef struct +{ + Elf64_Half si_boundto; /* Direct bindings, symbol bound to */ + Elf64_Half si_flags; /* Per symbol flags */ +} Elf64_Syminfo; + +/* Possible values for si_boundto. */ +#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */ +#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */ +#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */ + +/* Possible bitmasks for si_flags. */ +#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ +#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ +#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ +#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy + loaded */ +/* Syminfo version values. */ +#define SYMINFO_NONE 0 +#define SYMINFO_CURRENT 1 +#define SYMINFO_NUM 2 + + +/* How to extract and insert information held in the st_info field. */ + +#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) +#define ELF32_ST_TYPE(val) ((val) & 0xf) +#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) + +/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ +#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) +#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) +#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) + +/* Legal values for ST_BIND subfield of st_info (symbol binding). */ + +#define STB_LOCAL 0 /* Local symbol */ +#define STB_GLOBAL 1 /* Global symbol */ +#define STB_WEAK 2 /* Weak symbol */ +#define STB_NUM 3 /* Number of defined types. */ +#define STB_LOOS 10 /* Start of OS-specific */ +#define STB_HIOS 12 /* End of OS-specific */ +#define STB_LOPROC 13 /* Start of processor-specific */ +#define STB_HIPROC 15 /* End of processor-specific */ + +/* Legal values for ST_TYPE subfield of st_info (symbol type). */ + +#define STT_NOTYPE 0 /* Symbol type is unspecified */ +#define STT_OBJECT 1 /* Symbol is a data object */ +#define STT_FUNC 2 /* Symbol is a code object */ +#define STT_SECTION 3 /* Symbol associated with a section */ +#define STT_FILE 4 /* Symbol's name is file name */ +#define STT_COMMON 5 /* Symbol is a common data object */ +#define STT_TLS 6 /* Symbol is thread-local data object*/ +#define STT_NUM 7 /* Number of defined types. */ +#define STT_LOOS 10 /* Start of OS-specific */ +#define STT_HIOS 12 /* End of OS-specific */ +#define STT_LOPROC 13 /* Start of processor-specific */ +#define STT_HIPROC 15 /* End of processor-specific */ + + +/* Symbol table indices are found in the hash buckets and chain table + of a symbol hash table section. This special index value indicates + the end of a chain, meaning no further symbols are found in that bucket. */ + +#define STN_UNDEF 0 /* End of a chain. */ + + +/* How to extract and insert information held in the st_other field. */ + +#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) + +/* For ELF64 the definitions are the same. */ +#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) + +/* Symbol visibility specification encoded in the st_other field. */ +#define STV_DEFAULT 0 /* Default symbol visibility rules */ +#define STV_INTERNAL 1 /* Processor specific hidden class */ +#define STV_HIDDEN 2 /* Sym unavailable in other modules */ +#define STV_PROTECTED 3 /* Not preemptible, not exported */ + + +/* Relocation table entry without addend (in section of type SHT_REL). */ + +typedef struct +{ + Elf32_Addr r_offset; /* Address */ + Elf32_Word r_info; /* Relocation type and symbol index */ +} Elf32_Rel; + +/* I have seen two different definitions of the Elf64_Rel and + Elf64_Rela structures, so we'll leave them out until Novell (or + whoever) gets their act together. */ +/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */ + +typedef struct +{ + Elf64_Addr r_offset; /* Address */ + Elf64_Xword r_info; /* Relocation type and symbol index */ +} Elf64_Rel; + +/* Relocation table entry with addend (in section of type SHT_RELA). */ + +typedef struct +{ + Elf32_Addr r_offset; /* Address */ + Elf32_Word r_info; /* Relocation type and symbol index */ + Elf32_Sword r_addend; /* Addend */ +} Elf32_Rela; + +typedef struct +{ + Elf64_Addr r_offset; /* Address */ + Elf64_Xword r_info; /* Relocation type and symbol index */ + Elf64_Sxword r_addend; /* Addend */ +} Elf64_Rela; + +/* How to extract and insert information held in the r_info field. */ + +#define ELF32_R_SYM(val) ((val) >> 8) +#define ELF32_R_TYPE(val) ((val) & 0xff) +#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) + +#define ELF64_R_SYM(i) ((i) >> 32) +#define ELF64_R_TYPE(i) ((i) & 0xffffffff) +#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) + +/* Program segment header. */ + +typedef struct +{ + Elf32_Word p_type; /* Segment type */ + Elf32_Off p_offset; /* Segment file offset */ + Elf32_Addr p_vaddr; /* Segment virtual address */ + Elf32_Addr p_paddr; /* Segment physical address */ + Elf32_Word p_filesz; /* Segment size in file */ + Elf32_Word p_memsz; /* Segment size in memory */ + Elf32_Word p_flags; /* Segment flags */ + Elf32_Word p_align; /* Segment alignment */ +} Elf32_Phdr; + +typedef struct +{ + Elf64_Word p_type; /* Segment type */ + Elf64_Word p_flags; /* Segment flags */ + Elf64_Off p_offset; /* Segment file offset */ + Elf64_Addr p_vaddr; /* Segment virtual address */ + Elf64_Addr p_paddr; /* Segment physical address */ + Elf64_Xword p_filesz; /* Segment size in file */ + Elf64_Xword p_memsz; /* Segment size in memory */ + Elf64_Xword p_align; /* Segment alignment */ +} Elf64_Phdr; + +/* Legal values for p_type (segment type). */ + +#define PT_NULL 0 /* Program header table entry unused */ +#define PT_LOAD 1 /* Loadable program segment */ +#define PT_DYNAMIC 2 /* Dynamic linking information */ +#define PT_INTERP 3 /* Program interpreter */ +#define PT_NOTE 4 /* Auxiliary information */ +#define PT_SHLIB 5 /* Reserved */ +#define PT_PHDR 6 /* Entry for header table itself */ +#define PT_TLS 7 /* Thread-local storage segment */ +#define PT_NUM 8 /* Number of defined types */ +#define PT_LOOS 0x60000000 /* Start of OS-specific */ +#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ +#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ +#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ +#define PT_LOSUNW 0x6ffffffa +#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ +#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ +#define PT_HISUNW 0x6fffffff +#define PT_HIOS 0x6fffffff /* End of OS-specific */ +#define PT_LOPROC 0x70000000 /* Start of processor-specific */ +#define PT_HIPROC 0x7fffffff /* End of processor-specific */ + +/* Legal values for p_flags (segment flags). */ + +#define PF_X (1 << 0) /* Segment is executable */ +#define PF_W (1 << 1) /* Segment is writable */ +#define PF_R (1 << 2) /* Segment is readable */ +#define PF_MASKOS 0x0ff00000 /* OS-specific */ +#define PF_MASKPROC 0xf0000000 /* Processor-specific */ + +/* Legal values for note segment descriptor types for core files. */ + +#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ +#define NT_FPREGSET 2 /* Contains copy of fpregset struct */ +#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ +#define NT_PRXREG 4 /* Contains copy of prxregset struct */ +#define NT_TASKSTRUCT 4 /* Contains copy of task structure */ +#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */ +#define NT_AUXV 6 /* Contains copy of auxv array */ +#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */ +#define NT_ASRS 8 /* Contains copy of asrset struct */ +#define NT_PSTATUS 10 /* Contains copy of pstatus struct */ +#define NT_PSINFO 13 /* Contains copy of psinfo struct */ +#define NT_PRCRED 14 /* Contains copy of prcred struct */ +#define NT_UTSNAME 15 /* Contains copy of utsname struct */ +#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ +#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ +#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct*/ + +/* Legal values for the note segment descriptor types for object files. */ + +#define NT_VERSION 1 /* Contains a version string. */ + + +/* Dynamic section entry. */ + +typedef struct +{ + Elf32_Sword d_tag; /* Dynamic entry type */ + union + { + Elf32_Word d_val; /* Integer value */ + Elf32_Addr d_ptr; /* Address value */ + } d_un; +} Elf32_Dyn; + +typedef struct +{ + Elf64_Sxword d_tag; /* Dynamic entry type */ + union + { + Elf64_Xword d_val; /* Integer value */ + Elf64_Addr d_ptr; /* Address value */ + } d_un; +} Elf64_Dyn; + +/* Legal values for d_tag (dynamic entry type). */ + +#define DT_NULL 0 /* Marks end of dynamic section */ +#define DT_NEEDED 1 /* Name of needed library */ +#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ +#define DT_PLTGOT 3 /* Processor defined value */ +#define DT_HASH 4 /* Address of symbol hash table */ +#define DT_STRTAB 5 /* Address of string table */ +#define DT_SYMTAB 6 /* Address of symbol table */ +#define DT_RELA 7 /* Address of Rela relocs */ +#define DT_RELASZ 8 /* Total size of Rela relocs */ +#define DT_RELAENT 9 /* Size of one Rela reloc */ +#define DT_STRSZ 10 /* Size of string table */ +#define DT_SYMENT 11 /* Size of one symbol table entry */ +#define DT_INIT 12 /* Address of init function */ +#define DT_FINI 13 /* Address of termination function */ +#define DT_SONAME 14 /* Name of shared object */ +#define DT_RPATH 15 /* Library search path (deprecated) */ +#define DT_SYMBOLIC 16 /* Start symbol search here */ +#define DT_REL 17 /* Address of Rel relocs */ +#define DT_RELSZ 18 /* Total size of Rel relocs */ +#define DT_RELENT 19 /* Size of one Rel reloc */ +#define DT_PLTREL 20 /* Type of reloc in PLT */ +#define DT_DEBUG 21 /* For debugging; unspecified */ +#define DT_TEXTREL 22 /* Reloc might modify .text */ +#define DT_JMPREL 23 /* Address of PLT relocs */ +#define DT_BIND_NOW 24 /* Process relocations of object */ +#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ +#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ +#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ +#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ +#define DT_RUNPATH 29 /* Library search path */ +#define DT_FLAGS 30 /* Flags for the object being loaded */ +#define DT_ENCODING 32 /* Start of encoded range */ +#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ +#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ +#define DT_NUM 34 /* Number used */ +#define DT_LOOS 0x6000000d /* Start of OS-specific */ +#define DT_HIOS 0x6ffff000 /* End of OS-specific */ +#define DT_LOPROC 0x70000000 /* Start of processor-specific */ +#define DT_HIPROC 0x7fffffff /* End of processor-specific */ +#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ + +/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the + Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's + approach. */ +#define DT_VALRNGLO 0x6ffffd00 +#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ +#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ +#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ +#define DT_CHECKSUM 0x6ffffdf8 +#define DT_PLTPADSZ 0x6ffffdf9 +#define DT_MOVEENT 0x6ffffdfa +#define DT_MOVESZ 0x6ffffdfb +#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */ +#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting + the following DT_* entry. */ +#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ +#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ +#define DT_VALRNGHI 0x6ffffdff +#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ +#define DT_VALNUM 12 + +/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the + Dyn.d_un.d_ptr field of the Elf*_Dyn structure. + + If any adjustment is made to the ELF object after it has been + built these entries will need to be adjusted. */ +#define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ +#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ +#define DT_CONFIG 0x6ffffefa /* Configuration information. */ +#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */ +#define DT_AUDIT 0x6ffffefc /* Object auditing. */ +#define DT_PLTPAD 0x6ffffefd /* PLT padding. */ +#define DT_MOVETAB 0x6ffffefe /* Move table. */ +#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ +#define DT_ADDRRNGHI 0x6ffffeff +#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ +#define DT_ADDRNUM 10 + +/* The versioning entry types. The next are defined as part of the + GNU extension. */ +#define DT_VERSYM 0x6ffffff0 + +#define DT_RELACOUNT 0x6ffffff9 +#define DT_RELCOUNT 0x6ffffffa + +/* These were chosen by Sun. */ +#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */ +#define DT_VERDEF 0x6ffffffc /* Address of version definition + table */ +#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */ +#define DT_VERNEED 0x6ffffffe /* Address of table with needed + versions */ +#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */ +#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */ +#define DT_VERSIONTAGNUM 16 + +/* Sun added these machine-independent extensions in the "processor-specific" + range. Be compatible. */ +#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */ +#define DT_FILTER 0x7fffffff /* Shared object to get values from */ +#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) +#define DT_EXTRANUM 3 + +/* Values of `d_un.d_val' in the DT_FLAGS entry. */ +#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */ +#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */ +#define DF_TEXTREL 0x00000004 /* Object contains text relocations */ +#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */ +#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */ + +/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 + entry in the dynamic section. */ +#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */ +#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */ +#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */ +#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/ +#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/ +#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/ +#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */ +#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */ +#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */ +#define DF_1_TRANS 0x00000200 +#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */ +#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */ +#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */ +#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/ +#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */ +#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */ +#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */ + +/* Flags for the feature selection in DT_FEATURE_1. */ +#define DTF_1_PARINIT 0x00000001 +#define DTF_1_CONFEXP 0x00000002 + +/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */ +#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */ +#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not + generally available. */ + +/* Version definition sections. */ + +typedef struct +{ + Elf32_Half vd_version; /* Version revision */ + Elf32_Half vd_flags; /* Version information */ + Elf32_Half vd_ndx; /* Version Index */ + Elf32_Half vd_cnt; /* Number of associated aux entries */ + Elf32_Word vd_hash; /* Version name hash value */ + Elf32_Word vd_aux; /* Offset in bytes to verdaux array */ + Elf32_Word vd_next; /* Offset in bytes to next verdef + entry */ +} Elf32_Verdef; + +typedef struct +{ + Elf64_Half vd_version; /* Version revision */ + Elf64_Half vd_flags; /* Version information */ + Elf64_Half vd_ndx; /* Version Index */ + Elf64_Half vd_cnt; /* Number of associated aux entries */ + Elf64_Word vd_hash; /* Version name hash value */ + Elf64_Word vd_aux; /* Offset in bytes to verdaux array */ + Elf64_Word vd_next; /* Offset in bytes to next verdef + entry */ +} Elf64_Verdef; + + +/* Legal values for vd_version (version revision). */ +#define VER_DEF_NONE 0 /* No version */ +#define VER_DEF_CURRENT 1 /* Current version */ +#define VER_DEF_NUM 2 /* Given version number */ + +/* Legal values for vd_flags (version information flags). */ +#define VER_FLG_BASE 0x1 /* Version definition of file itself */ +#define VER_FLG_WEAK 0x2 /* Weak version identifier */ + +/* Versym symbol index values. */ +#define VER_NDX_LOCAL 0 /* Symbol is local. */ +#define VER_NDX_GLOBAL 1 /* Symbol is global. */ +#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ +#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ + +/* Auxialiary version information. */ + +typedef struct +{ + Elf32_Word vda_name; /* Version or dependency names */ + Elf32_Word vda_next; /* Offset in bytes to next verdaux + entry */ +} Elf32_Verdaux; + +typedef struct +{ + Elf64_Word vda_name; /* Version or dependency names */ + Elf64_Word vda_next; /* Offset in bytes to next verdaux + entry */ +} Elf64_Verdaux; + + +/* Version dependency section. */ + +typedef struct +{ + Elf32_Half vn_version; /* Version of structure */ + Elf32_Half vn_cnt; /* Number of associated aux entries */ + Elf32_Word vn_file; /* Offset of filename for this + dependency */ + Elf32_Word vn_aux; /* Offset in bytes to vernaux array */ + Elf32_Word vn_next; /* Offset in bytes to next verneed + entry */ +} Elf32_Verneed; + +typedef struct +{ + Elf64_Half vn_version; /* Version of structure */ + Elf64_Half vn_cnt; /* Number of associated aux entries */ + Elf64_Word vn_file; /* Offset of filename for this + dependency */ + Elf64_Word vn_aux; /* Offset in bytes to vernaux array */ + Elf64_Word vn_next; /* Offset in bytes to next verneed + entry */ +} Elf64_Verneed; + + +/* Legal values for vn_version (version revision). */ +#define VER_NEED_NONE 0 /* No version */ +#define VER_NEED_CURRENT 1 /* Current version */ +#define VER_NEED_NUM 2 /* Given version number */ + +/* Auxiliary needed version information. */ + +typedef struct +{ + Elf32_Word vna_hash; /* Hash value of dependency name */ + Elf32_Half vna_flags; /* Dependency specific information */ + Elf32_Half vna_other; /* Unused */ + Elf32_Word vna_name; /* Dependency name string offset */ + Elf32_Word vna_next; /* Offset in bytes to next vernaux + entry */ +} Elf32_Vernaux; + +typedef struct +{ + Elf64_Word vna_hash; /* Hash value of dependency name */ + Elf64_Half vna_flags; /* Dependency specific information */ + Elf64_Half vna_other; /* Unused */ + Elf64_Word vna_name; /* Dependency name string offset */ + Elf64_Word vna_next; /* Offset in bytes to next vernaux + entry */ +} Elf64_Vernaux; + + +/* Legal values for vna_flags. */ +#define VER_FLG_WEAK 0x2 /* Weak version identifier */ + + +/* Auxiliary vector. */ + +/* This vector is normally only used by the program interpreter. The + usual definition in an ABI supplement uses the name auxv_t. The + vector is not usually defined in a standard <elf.h> file, but it + can't hurt. We rename it to avoid conflicts. The sizes of these + types are an arrangement between the exec server and the program + interpreter, so we don't fully specify them here. */ + +typedef struct +{ + int a_type; /* Entry type */ + union + { + long int a_val; /* Integer value */ + void *a_ptr; /* Pointer value */ + void (*a_fcn) (void); /* Function pointer value */ + } a_un; +} Elf32_auxv_t; + +typedef struct +{ + long int a_type; /* Entry type */ + union + { + long int a_val; /* Integer value */ + void *a_ptr; /* Pointer value */ + void (*a_fcn) (void); /* Function pointer value */ + } a_un; +} Elf64_auxv_t; + +/* Legal values for a_type (entry type). */ + +#define AT_NULL 0 /* End of vector */ +#define AT_IGNORE 1 /* Entry should be ignored */ +#define AT_EXECFD 2 /* File descriptor of program */ +#define AT_PHDR 3 /* Program headers for program */ +#define AT_PHENT 4 /* Size of program header entry */ +#define AT_PHNUM 5 /* Number of program headers */ +#define AT_PAGESZ 6 /* System page size */ +#define AT_BASE 7 /* Base address of interpreter */ +#define AT_FLAGS 8 /* Flags */ +#define AT_ENTRY 9 /* Entry point of program */ +#define AT_NOTELF 10 /* Program is not ELF */ +#define AT_UID 11 /* Real uid */ +#define AT_EUID 12 /* Effective uid */ +#define AT_GID 13 /* Real gid */ +#define AT_EGID 14 /* Effective gid */ +#define AT_CLKTCK 17 /* Frequency of times() */ + +/* Some more special a_type values describing the hardware. */ +#define AT_PLATFORM 15 /* String identifying platform. */ +#define AT_HWCAP 16 /* Machine dependent hints about + processor capabilities. */ + +/* This entry gives some information about the FPU initialization + performed by the kernel. */ +#define AT_FPUCW 18 /* Used FPU control word. */ + +/* Cache block sizes. */ +#define AT_DCACHEBSIZE 19 /* Data cache block size. */ +#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ +#define AT_UCACHEBSIZE 21 /* Unified cache block size. */ + +/* A special ignored value for PPC, used by the kernel to control the + interpretation of the AUXV. Must be > 16. */ +#define AT_IGNOREPPC 22 /* Entry should be ignored. */ + +#define AT_SECURE 23 /* Boolean, was exec setuid-like? */ + +/* Pointer to the global system page used for system calls and other + nice things. */ +#define AT_SYSINFO 32 +#define AT_SYSINFO_EHDR 33 + +/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains + log2 of line size; mask those to get cache size. */ +#define AT_L1I_CACHESHAPE 34 +#define AT_L1D_CACHESHAPE 35 +#define AT_L2_CACHESHAPE 36 +#define AT_L3_CACHESHAPE 37 + +/* Note section contents. Each entry in the note section begins with + a header of a fixed form. */ + +typedef struct +{ + Elf32_Word n_namesz; /* Length of the note's name. */ + Elf32_Word n_descsz; /* Length of the note's descriptor. */ + Elf32_Word n_type; /* Type of the note. */ +} Elf32_Nhdr; + +typedef struct +{ + Elf64_Word n_namesz; /* Length of the note's name. */ + Elf64_Word n_descsz; /* Length of the note's descriptor. */ + Elf64_Word n_type; /* Type of the note. */ +} Elf64_Nhdr; + +/* Known names of notes. */ + +/* Solaris entries in the note section have this name. */ +#define ELF_NOTE_SOLARIS "SUNW Solaris" + +/* Note entries for GNU systems have this name. */ +#define ELF_NOTE_GNU "GNU" + + +/* Defined types of notes for Solaris. */ + +/* Value of descriptor (one word) is desired pagesize for the binary. */ +#define ELF_NOTE_PAGESIZE_HINT 1 + + +/* Defined note types for GNU systems. */ + +/* ABI information. The descriptor consists of words: + word 0: OS descriptor + word 1: major version of the ABI + word 2: minor version of the ABI + word 3: subminor version of the ABI +*/ +#define ELF_NOTE_ABI 1 + +/* Known OSes. These value can appear in word 0 of an ELF_NOTE_ABI + note section entry. */ +#define ELF_NOTE_OS_LINUX 0 +#define ELF_NOTE_OS_GNU 1 +#define ELF_NOTE_OS_SOLARIS2 2 +#define ELF_NOTE_OS_FREEBSD 3 + + +/* Move records. */ +typedef struct +{ + Elf32_Xword m_value; /* Symbol value. */ + Elf32_Word m_info; /* Size and index. */ + Elf32_Word m_poffset; /* Symbol offset. */ + Elf32_Half m_repeat; /* Repeat count. */ + Elf32_Half m_stride; /* Stride info. */ +} Elf32_Move; + +typedef struct +{ + Elf64_Xword m_value; /* Symbol value. */ + Elf64_Xword m_info; /* Size and index. */ + Elf64_Xword m_poffset; /* Symbol offset. */ + Elf64_Half m_repeat; /* Repeat count. */ + Elf64_Half m_stride; /* Stride info. */ +} Elf64_Move; + +/* Macro to construct move records. */ +#define ELF32_M_SYM(info) ((info) >> 8) +#define ELF32_M_SIZE(info) ((unsigned char) (info)) +#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) + +#define ELF64_M_SYM(info) ELF32_M_SYM (info) +#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) +#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) + + +/* Motorola 68k specific definitions. */ + +/* Values for Elf32_Ehdr.e_flags. */ +#define EF_CPU32 0x00810000 + +/* m68k relocs. */ + +#define R_68K_NONE 0 /* No reloc */ +#define R_68K_32 1 /* Direct 32 bit */ +#define R_68K_16 2 /* Direct 16 bit */ +#define R_68K_8 3 /* Direct 8 bit */ +#define R_68K_PC32 4 /* PC relative 32 bit */ +#define R_68K_PC16 5 /* PC relative 16 bit */ +#define R_68K_PC8 6 /* PC relative 8 bit */ +#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ +#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ +#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ +#define R_68K_GOT32O 10 /* 32 bit GOT offset */ +#define R_68K_GOT16O 11 /* 16 bit GOT offset */ +#define R_68K_GOT8O 12 /* 8 bit GOT offset */ +#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ +#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ +#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ +#define R_68K_PLT32O 16 /* 32 bit PLT offset */ +#define R_68K_PLT16O 17 /* 16 bit PLT offset */ +#define R_68K_PLT8O 18 /* 8 bit PLT offset */ +#define R_68K_COPY 19 /* Copy symbol at runtime */ +#define R_68K_GLOB_DAT 20 /* Create GOT entry */ +#define R_68K_JMP_SLOT 21 /* Create PLT entry */ +#define R_68K_RELATIVE 22 /* Adjust by program base */ +/* Keep this the last entry. */ +#define R_68K_NUM 23 + +/* Intel 80386 specific definitions. */ + +/* i386 relocs. */ + +#define R_386_NONE 0 /* No reloc */ +#define R_386_32 1 /* Direct 32 bit */ +#define R_386_PC32 2 /* PC relative 32 bit */ +#define R_386_GOT32 3 /* 32 bit GOT entry */ +#define R_386_PLT32 4 /* 32 bit PLT address */ +#define R_386_COPY 5 /* Copy symbol at runtime */ +#define R_386_GLOB_DAT 6 /* Create GOT entry */ +#define R_386_JMP_SLOT 7 /* Create PLT entry */ +#define R_386_RELATIVE 8 /* Adjust by program base */ +#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ +#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ +#define R_386_32PLT 11 +#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */ +#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS + block offset */ +#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block + offset */ +#define R_386_TLS_LE 17 /* Offset relative to static TLS + block */ +#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of + general dynamic thread local data */ +#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of + local dynamic thread local data + in LE code */ +#define R_386_16 20 +#define R_386_PC16 21 +#define R_386_8 22 +#define R_386_PC8 23 +#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic + thread local data */ +#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */ +#define R_386_TLS_GD_CALL 26 /* Relocation for call to + __tls_get_addr() */ +#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */ +#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic + thread local data in LE code */ +#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */ +#define R_386_TLS_LDM_CALL 30 /* Relocation for call to + __tls_get_addr() in LDM code */ +#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */ +#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */ +#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS + block offset */ +#define R_386_TLS_LE_32 34 /* Negated offset relative to static + TLS block */ +#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ +#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ +#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ +/* Keep this the last entry. */ +#define R_386_NUM 38 + +/* SUN SPARC specific definitions. */ + +/* Legal values for ST_TYPE subfield of st_info (symbol type). */ + +#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */ + +/* Values for Elf64_Ehdr.e_flags. */ + +#define EF_SPARCV9_MM 3 +#define EF_SPARCV9_TSO 0 +#define EF_SPARCV9_PSO 1 +#define EF_SPARCV9_RMO 2 +#define EF_SPARC_LEDATA 0x800000 /* little endian data */ +#define EF_SPARC_EXT_MASK 0xFFFF00 +#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ +#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ +#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ +#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ + +/* SPARC relocs. */ + +#define R_SPARC_NONE 0 /* No reloc */ +#define R_SPARC_8 1 /* Direct 8 bit */ +#define R_SPARC_16 2 /* Direct 16 bit */ +#define R_SPARC_32 3 /* Direct 32 bit */ +#define R_SPARC_DISP8 4 /* PC relative 8 bit */ +#define R_SPARC_DISP16 5 /* PC relative 16 bit */ +#define R_SPARC_DISP32 6 /* PC relative 32 bit */ +#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */ +#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */ +#define R_SPARC_HI22 9 /* High 22 bit */ +#define R_SPARC_22 10 /* Direct 22 bit */ +#define R_SPARC_13 11 /* Direct 13 bit */ +#define R_SPARC_LO10 12 /* Truncated 10 bit */ +#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */ +#define R_SPARC_GOT13 14 /* 13 bit GOT entry */ +#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */ +#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */ +#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */ +#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */ +#define R_SPARC_COPY 19 /* Copy symbol at runtime */ +#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */ +#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */ +#define R_SPARC_RELATIVE 22 /* Adjust by program base */ +#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */ + +/* Additional Sparc64 relocs. */ + +#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */ +#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */ +#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */ +#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */ +#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */ +#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */ +#define R_SPARC_10 30 /* Direct 10 bit */ +#define R_SPARC_11 31 /* Direct 11 bit */ +#define R_SPARC_64 32 /* Direct 64 bit */ +#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */ +#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */ +#define R_SPARC_HM10 35 /* High middle 10 bits of ... */ +#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */ +#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */ +#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */ +#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ +#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ +#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ +#define R_SPARC_7 43 /* Direct 7 bit */ +#define R_SPARC_5 44 /* Direct 5 bit */ +#define R_SPARC_6 45 /* Direct 6 bit */ +#define R_SPARC_DISP64 46 /* PC relative 64 bit */ +#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */ +#define R_SPARC_HIX22 48 /* High 22 bit complemented */ +#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */ +#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */ +#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */ +#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */ +#define R_SPARC_REGISTER 53 /* Global register usage */ +#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */ +#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */ +#define R_SPARC_TLS_GD_HI22 56 +#define R_SPARC_TLS_GD_LO10 57 +#define R_SPARC_TLS_GD_ADD 58 +#define R_SPARC_TLS_GD_CALL 59 +#define R_SPARC_TLS_LDM_HI22 60 +#define R_SPARC_TLS_LDM_LO10 61 +#define R_SPARC_TLS_LDM_ADD 62 +#define R_SPARC_TLS_LDM_CALL 63 +#define R_SPARC_TLS_LDO_HIX22 64 +#define R_SPARC_TLS_LDO_LOX10 65 +#define R_SPARC_TLS_LDO_ADD 66 +#define R_SPARC_TLS_IE_HI22 67 +#define R_SPARC_TLS_IE_LO10 68 +#define R_SPARC_TLS_IE_LD 69 +#define R_SPARC_TLS_IE_LDX 70 +#define R_SPARC_TLS_IE_ADD 71 +#define R_SPARC_TLS_LE_HIX22 72 +#define R_SPARC_TLS_LE_LOX10 73 +#define R_SPARC_TLS_DTPMOD32 74 +#define R_SPARC_TLS_DTPMOD64 75 +#define R_SPARC_TLS_DTPOFF32 76 +#define R_SPARC_TLS_DTPOFF64 77 +#define R_SPARC_TLS_TPOFF32 78 +#define R_SPARC_TLS_TPOFF64 79 +/* Keep this the last entry. */ +#define R_SPARC_NUM 80 + +/* For Sparc64, legal values for d_tag of Elf64_Dyn. */ + +#define DT_SPARC_REGISTER 0x70000001 +#define DT_SPARC_NUM 2 + +/* Bits present in AT_HWCAP, primarily for Sparc32. */ + +#define HWCAP_SPARC_FLUSH 1 /* The cpu supports flush insn. */ +#define HWCAP_SPARC_STBAR 2 +#define HWCAP_SPARC_SWAP 4 +#define HWCAP_SPARC_MULDIV 8 +#define HWCAP_SPARC_V9 16 /* The cpu is v9, so v8plus is ok. */ +#define HWCAP_SPARC_ULTRA3 32 +#define HWCAP_SPARC_BLKINIT 64 /* Sun4v with block-init/load-twin. */ + +/* MIPS R3000 specific definitions. */ + +/* Legal values for e_flags field of Elf32_Ehdr. */ + +#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */ +#define EF_MIPS_PIC 2 /* Contains PIC code */ +#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */ +#define EF_MIPS_XGOT 8 +#define EF_MIPS_64BIT_WHIRL 16 +#define EF_MIPS_ABI2 32 +#define EF_MIPS_ABI_ON32 64 +#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ + +/* Legal values for MIPS architecture level. */ + +#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ +#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ +#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ +#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ +#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ +#define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ +#define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ + +/* The following are non-official names and should not be used. */ + +#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ +#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ +#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ +#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ +#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ +#define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ +#define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ + +/* Special section indices. */ + +#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ +#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ +#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ +#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ +#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ + +/* Legal values for sh_type field of Elf32_Shdr. */ + +#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ +#define SHT_MIPS_MSYM 0x70000001 +#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ +#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ +#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ +#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/ +#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ +#define SHT_MIPS_PACKAGE 0x70000007 +#define SHT_MIPS_PACKSYM 0x70000008 +#define SHT_MIPS_RELD 0x70000009 +#define SHT_MIPS_IFACE 0x7000000b +#define SHT_MIPS_CONTENT 0x7000000c +#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ +#define SHT_MIPS_SHDR 0x70000010 +#define SHT_MIPS_FDESC 0x70000011 +#define SHT_MIPS_EXTSYM 0x70000012 +#define SHT_MIPS_DENSE 0x70000013 +#define SHT_MIPS_PDESC 0x70000014 +#define SHT_MIPS_LOCSYM 0x70000015 +#define SHT_MIPS_AUXSYM 0x70000016 +#define SHT_MIPS_OPTSYM 0x70000017 +#define SHT_MIPS_LOCSTR 0x70000018 +#define SHT_MIPS_LINE 0x70000019 +#define SHT_MIPS_RFDESC 0x7000001a +#define SHT_MIPS_DELTASYM 0x7000001b +#define SHT_MIPS_DELTAINST 0x7000001c +#define SHT_MIPS_DELTACLASS 0x7000001d +#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ +#define SHT_MIPS_DELTADECL 0x7000001f +#define SHT_MIPS_SYMBOL_LIB 0x70000020 +#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ +#define SHT_MIPS_TRANSLATE 0x70000022 +#define SHT_MIPS_PIXIE 0x70000023 +#define SHT_MIPS_XLATE 0x70000024 +#define SHT_MIPS_XLATE_DEBUG 0x70000025 +#define SHT_MIPS_WHIRL 0x70000026 +#define SHT_MIPS_EH_REGION 0x70000027 +#define SHT_MIPS_XLATE_OLD 0x70000028 +#define SHT_MIPS_PDR_EXCEPTION 0x70000029 + +/* Legal values for sh_flags field of Elf32_Shdr. */ + +#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ +#define SHF_MIPS_MERGE 0x20000000 +#define SHF_MIPS_ADDR 0x40000000 +#define SHF_MIPS_STRINGS 0x80000000 +#define SHF_MIPS_NOSTRIP 0x08000000 +#define SHF_MIPS_LOCAL 0x04000000 +#define SHF_MIPS_NAMES 0x02000000 +#define SHF_MIPS_NODUPE 0x01000000 + + +/* Symbol tables. */ + +/* MIPS specific values for `st_other'. */ +#define STO_MIPS_DEFAULT 0x0 +#define STO_MIPS_INTERNAL 0x1 +#define STO_MIPS_HIDDEN 0x2 +#define STO_MIPS_PROTECTED 0x3 +#define STO_MIPS_SC_ALIGN_UNUSED 0xff + +/* MIPS specific values for `st_info'. */ +#define STB_MIPS_SPLIT_COMMON 13 + +/* Entries found in sections of type SHT_MIPS_GPTAB. */ + +typedef union +{ + struct + { + Elf32_Word gt_current_g_value; /* -G value used for compilation */ + Elf32_Word gt_unused; /* Not used */ + } gt_header; /* First entry in section */ + struct + { + Elf32_Word gt_g_value; /* If this value were used for -G */ + Elf32_Word gt_bytes; /* This many bytes would be used */ + } gt_entry; /* Subsequent entries in section */ +} Elf32_gptab; + +/* Entry found in sections of type SHT_MIPS_REGINFO. */ + +typedef struct +{ + Elf32_Word ri_gprmask; /* General registers used */ + Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ + Elf32_Sword ri_gp_value; /* $gp register value */ +} Elf32_RegInfo; + +/* Entries found in sections of type SHT_MIPS_OPTIONS. */ + +typedef struct +{ + unsigned char kind; /* Determines interpretation of the + variable part of descriptor. */ + unsigned char size; /* Size of descriptor, including header. */ + Elf32_Section section; /* Section header index of section affected, + 0 for global options. */ + Elf32_Word info; /* Kind-specific information. */ +} Elf_Options; + +/* Values for `kind' field in Elf_Options. */ + +#define ODK_NULL 0 /* Undefined. */ +#define ODK_REGINFO 1 /* Register usage information. */ +#define ODK_EXCEPTIONS 2 /* Exception processing options. */ +#define ODK_PAD 3 /* Section padding options. */ +#define ODK_HWPATCH 4 /* Hardware workarounds performed */ +#define ODK_FILL 5 /* record the fill value used by the linker. */ +#define ODK_TAGS 6 /* reserve space for desktop tools to write. */ +#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */ +#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */ + +/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */ + +#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */ +#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */ +#define OEX_PAGE0 0x10000 /* page zero must be mapped. */ +#define OEX_SMM 0x20000 /* Force sequential memory mode? */ +#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */ +#define OEX_PRECISEFP OEX_FPDBUG +#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */ + +#define OEX_FPU_INVAL 0x10 +#define OEX_FPU_DIV0 0x08 +#define OEX_FPU_OFLO 0x04 +#define OEX_FPU_UFLO 0x02 +#define OEX_FPU_INEX 0x01 + +/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */ + +#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */ +#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */ +#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */ +#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */ + +#define OPAD_PREFIX 0x1 +#define OPAD_POSTFIX 0x2 +#define OPAD_SYMBOL 0x4 + +/* Entry found in `.options' section. */ + +typedef struct +{ + Elf32_Word hwp_flags1; /* Extra flags. */ + Elf32_Word hwp_flags2; /* Extra flags. */ +} Elf_Options_Hw; + +/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */ + +#define OHWA0_R4KEOP_CHECKED 0x00000001 +#define OHWA1_R4KEOP_CLEAN 0x00000002 + +/* MIPS relocs. */ + +#define R_MIPS_NONE 0 /* No reloc */ +#define R_MIPS_16 1 /* Direct 16 bit */ +#define R_MIPS_32 2 /* Direct 32 bit */ +#define R_MIPS_REL32 3 /* PC relative 32 bit */ +#define R_MIPS_26 4 /* Direct 26 bit shifted */ +#define R_MIPS_HI16 5 /* High 16 bit */ +#define R_MIPS_LO16 6 /* Low 16 bit */ +#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ +#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ +#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ +#define R_MIPS_PC16 10 /* PC relative 16 bit */ +#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ +#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ + +#define R_MIPS_SHIFT5 16 +#define R_MIPS_SHIFT6 17 +#define R_MIPS_64 18 +#define R_MIPS_GOT_DISP 19 +#define R_MIPS_GOT_PAGE 20 +#define R_MIPS_GOT_OFST 21 +#define R_MIPS_GOT_HI16 22 +#define R_MIPS_GOT_LO16 23 +#define R_MIPS_SUB 24 +#define R_MIPS_INSERT_A 25 +#define R_MIPS_INSERT_B 26 +#define R_MIPS_DELETE 27 +#define R_MIPS_HIGHER 28 +#define R_MIPS_HIGHEST 29 +#define R_MIPS_CALL_HI16 30 +#define R_MIPS_CALL_LO16 31 +#define R_MIPS_SCN_DISP 32 +#define R_MIPS_REL16 33 +#define R_MIPS_ADD_IMMEDIATE 34 +#define R_MIPS_PJUMP 35 +#define R_MIPS_RELGOT 36 +#define R_MIPS_JALR 37 +/* Keep this the last entry. */ +#define R_MIPS_NUM 38 + +/* Legal values for p_type field of Elf32_Phdr. */ + +#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ +#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */ +#define PT_MIPS_OPTIONS 0x70000002 + +/* Special program header types. */ + +#define PF_MIPS_LOCAL 0x10000000 + +/* Legal values for d_tag field of Elf32_Dyn. */ + +#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */ +#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ +#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */ +#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ +#define DT_MIPS_FLAGS 0x70000005 /* Flags */ +#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */ +#define DT_MIPS_MSYM 0x70000007 +#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */ +#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */ +#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */ +#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */ +#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */ +#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */ +#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ +#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */ +#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ +#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */ +#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */ +#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in + DT_MIPS_DELTA_CLASS. */ +#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */ +#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in + DT_MIPS_DELTA_INSTANCE. */ +#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */ +#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in + DT_MIPS_DELTA_RELOC. */ +#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta + relocations refer to. */ +#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in + DT_MIPS_DELTA_SYM. */ +#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the + class declaration. */ +#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in + DT_MIPS_DELTA_CLASSSYM. */ +#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */ +#define DT_MIPS_PIXIE_INIT 0x70000023 +#define DT_MIPS_SYMBOL_LIB 0x70000024 +#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 +#define DT_MIPS_LOCAL_GOTIDX 0x70000026 +#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 +#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 +#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */ +#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */ +#define DT_MIPS_DYNSTR_ALIGN 0x7000002b +#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ +#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve + function stored in GOT. */ +#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added + by rld on dlopen() calls. */ +#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ +#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ +#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ +#define DT_MIPS_NUM 0x32 + +/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ + +#define RHF_NONE 0 /* No flags */ +#define RHF_QUICKSTART (1 << 0) /* Use quickstart */ +#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */ +#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */ +#define RHF_NO_MOVE (1 << 3) +#define RHF_SGI_ONLY (1 << 4) +#define RHF_GUARANTEE_INIT (1 << 5) +#define RHF_DELTA_C_PLUS_PLUS (1 << 6) +#define RHF_GUARANTEE_START_INIT (1 << 7) +#define RHF_PIXIE (1 << 8) +#define RHF_DEFAULT_DELAY_LOAD (1 << 9) +#define RHF_REQUICKSTART (1 << 10) +#define RHF_REQUICKSTARTED (1 << 11) +#define RHF_CORD (1 << 12) +#define RHF_NO_UNRES_UNDEF (1 << 13) +#define RHF_RLD_ORDER_SAFE (1 << 14) + +/* Entries found in sections of type SHT_MIPS_LIBLIST. */ + +typedef struct +{ + Elf32_Word l_name; /* Name (string table index) */ + Elf32_Word l_time_stamp; /* Timestamp */ + Elf32_Word l_checksum; /* Checksum */ + Elf32_Word l_version; /* Interface version */ + Elf32_Word l_flags; /* Flags */ +} Elf32_Lib; + +typedef struct +{ + Elf64_Word l_name; /* Name (string table index) */ + Elf64_Word l_time_stamp; /* Timestamp */ + Elf64_Word l_checksum; /* Checksum */ + Elf64_Word l_version; /* Interface version */ + Elf64_Word l_flags; /* Flags */ +} Elf64_Lib; + + +/* Legal values for l_flags. */ + +#define LL_NONE 0 +#define LL_EXACT_MATCH (1 << 0) /* Require exact match */ +#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */ +#define LL_REQUIRE_MINOR (1 << 2) +#define LL_EXPORTS (1 << 3) +#define LL_DELAY_LOAD (1 << 4) +#define LL_DELTA (1 << 5) + +/* Entries found in sections of type SHT_MIPS_CONFLICT. */ + +typedef Elf32_Addr Elf32_Conflict; + + +/* HPPA specific definitions. */ + +/* Legal values for e_flags field of Elf32_Ehdr. */ + +#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ +#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */ +#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ +#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ +#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch + prediction. */ +#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ +#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ + +/* Defined values for `e_flags & EF_PARISC_ARCH' are: */ + +#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */ +#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ +#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ + +/* Additional section indeces. */ + +#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared + symbols in ANSI C. */ +#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ + +/* Legal values for sh_type field of Elf32_Shdr. */ + +#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */ +#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */ +#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */ + +/* Legal values for sh_flags field of Elf32_Shdr. */ + +#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */ +#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */ +#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */ + +/* Legal values for ST_TYPE subfield of st_info (symbol type). */ + +#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */ + +#define STT_HP_OPAQUE (STT_LOOS + 0x1) +#define STT_HP_STUB (STT_LOOS + 0x2) + +/* HPPA relocs. */ + +#define R_PARISC_NONE 0 /* No reloc. */ +#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */ +#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */ +#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */ +#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */ +#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */ +#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */ +#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */ +#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */ +#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ +#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ +#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ +#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ +#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ +#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ +#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ +#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ +#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ +#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ +#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ +#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ +#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ +#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ +#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ +#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ +#define R_PARISC_FPTR64 64 /* 64 bits function address. */ +#define R_PARISC_PLABEL32 65 /* 32 bits function address. */ +#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ +#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ +#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ +#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ +#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */ +#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */ +#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */ +#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */ +#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */ +#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */ +#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */ +#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */ +#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */ +#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */ +#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */ +#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */ +#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */ +#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */ +#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */ +#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */ +#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */ +#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */ +#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */ +#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ +#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ +#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ +#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ +#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ +#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ +#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */ +#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */ +#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */ +#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */ +#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */ +#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */ +#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */ +#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */ +#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ +#define R_PARISC_LORESERVE 128 +#define R_PARISC_COPY 128 /* Copy relocation. */ +#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ +#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ +#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ +#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ +#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ +#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */ +#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/ +#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */ +#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */ +#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */ +#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */ +#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */ +#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */ +#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */ +#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */ +#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/ +#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/ +#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ +#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ +#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ +#define R_PARISC_HIRESERVE 255 + +/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ + +#define PT_HP_TLS (PT_LOOS + 0x0) +#define PT_HP_CORE_NONE (PT_LOOS + 0x1) +#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) +#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) +#define PT_HP_CORE_COMM (PT_LOOS + 0x4) +#define PT_HP_CORE_PROC (PT_LOOS + 0x5) +#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) +#define PT_HP_CORE_STACK (PT_LOOS + 0x7) +#define PT_HP_CORE_SHM (PT_LOOS + 0x8) +#define PT_HP_CORE_MMF (PT_LOOS + 0x9) +#define PT_HP_PARALLEL (PT_LOOS + 0x10) +#define PT_HP_FASTBIND (PT_LOOS + 0x11) +#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) +#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) +#define PT_HP_STACK (PT_LOOS + 0x14) + +#define PT_PARISC_ARCHEXT 0x70000000 +#define PT_PARISC_UNWIND 0x70000001 + +/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */ + +#define PF_PARISC_SBP 0x08000000 + +#define PF_HP_PAGE_SIZE 0x00100000 +#define PF_HP_FAR_SHARED 0x00200000 +#define PF_HP_NEAR_SHARED 0x00400000 +#define PF_HP_CODE 0x01000000 +#define PF_HP_MODIFY 0x02000000 +#define PF_HP_LAZYSWAP 0x04000000 +#define PF_HP_SBP 0x08000000 + + +/* Alpha specific definitions. */ + +/* Legal values for e_flags field of Elf64_Ehdr. */ + +#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */ +#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */ + +/* Legal values for sh_type field of Elf64_Shdr. */ + +/* These two are primerily concerned with ECOFF debugging info. */ +#define SHT_ALPHA_DEBUG 0x70000001 +#define SHT_ALPHA_REGINFO 0x70000002 + +/* Legal values for sh_flags field of Elf64_Shdr. */ + +#define SHF_ALPHA_GPREL 0x10000000 + +/* Legal values for st_other field of Elf64_Sym. */ +#define STO_ALPHA_NOPV 0x80 /* No PV required. */ +#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */ + +/* Alpha relocs. */ + +#define R_ALPHA_NONE 0 /* No reloc */ +#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ +#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ +#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ +#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ +#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ +#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ +#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ +#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ +#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ +#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ +#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ +#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */ +#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */ +#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */ +#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ +#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ +#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ +#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ +#define R_ALPHA_TLS_GD_HI 28 +#define R_ALPHA_TLSGD 29 +#define R_ALPHA_TLS_LDM 30 +#define R_ALPHA_DTPMOD64 31 +#define R_ALPHA_GOTDTPREL 32 +#define R_ALPHA_DTPREL64 33 +#define R_ALPHA_DTPRELHI 34 +#define R_ALPHA_DTPRELLO 35 +#define R_ALPHA_DTPREL16 36 +#define R_ALPHA_GOTTPREL 37 +#define R_ALPHA_TPREL64 38 +#define R_ALPHA_TPRELHI 39 +#define R_ALPHA_TPRELLO 40 +#define R_ALPHA_TPREL16 41 +/* Keep this the last entry. */ +#define R_ALPHA_NUM 46 + +/* Magic values of the LITUSE relocation addend. */ +#define LITUSE_ALPHA_ADDR 0 +#define LITUSE_ALPHA_BASE 1 +#define LITUSE_ALPHA_BYTOFF 2 +#define LITUSE_ALPHA_JSR 3 +#define LITUSE_ALPHA_TLS_GD 4 +#define LITUSE_ALPHA_TLS_LDM 5 + + +/* PowerPC specific declarations */ + +/* Values for Elf32/64_Ehdr.e_flags. */ +#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ + +/* Cygnus local bits below */ +#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ +#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib + flag */ + +/* PowerPC relocations defined by the ABIs */ +#define R_PPC_NONE 0 +#define R_PPC_ADDR32 1 /* 32bit absolute address */ +#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ +#define R_PPC_ADDR16 3 /* 16bit absolute address */ +#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ +#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ +#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ +#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 /* PC relative 26 bit */ +#define R_PPC_REL14 11 /* PC relative 16 bit */ +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_GLOB_DAT 20 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 +#define R_PPC_SECTOFF 33 +#define R_PPC_SECTOFF_LO 34 +#define R_PPC_SECTOFF_HI 35 +#define R_PPC_SECTOFF_HA 36 + +/* PowerPC relocations defined for the TLS access ABI. */ +#define R_PPC_TLS 67 /* none (sym+add)@tls */ +#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ +#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ +#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ +#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ +#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ +#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ +#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ +#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ +#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ +#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ +#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ +#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ +#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ +#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ +#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ +#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ +#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ +#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ +#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ +#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ +#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ +#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ +#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ +#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ +#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ +#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ +#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ + +/* Keep this the last entry. */ +#define R_PPC_NUM 95 + +/* The remaining relocs are from the Embedded ELF ABI, and are not + in the SVR4 ELF ABI. */ +#define R_PPC_EMB_NADDR32 101 +#define R_PPC_EMB_NADDR16 102 +#define R_PPC_EMB_NADDR16_LO 103 +#define R_PPC_EMB_NADDR16_HI 104 +#define R_PPC_EMB_NADDR16_HA 105 +#define R_PPC_EMB_SDAI16 106 +#define R_PPC_EMB_SDA2I16 107 +#define R_PPC_EMB_SDA2REL 108 +#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ +#define R_PPC_EMB_MRKREF 110 +#define R_PPC_EMB_RELSEC16 111 +#define R_PPC_EMB_RELST_LO 112 +#define R_PPC_EMB_RELST_HI 113 +#define R_PPC_EMB_RELST_HA 114 +#define R_PPC_EMB_BIT_FLD 115 +#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ + +/* Diab tool relocations. */ +#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ +#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ +#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ +#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ +#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ +#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ + +/* This is a phony reloc to handle any old fashioned TOC16 references + that may still be in object files. */ +#define R_PPC_TOC16 255 + + +/* PowerPC64 relocations defined by the ABIs */ +#define R_PPC64_NONE R_PPC_NONE +#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */ +#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */ +#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */ +#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */ +#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */ +#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ +#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */ +#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN +#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN +#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */ +#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */ +#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN +#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN +#define R_PPC64_GOT16 R_PPC_GOT16 +#define R_PPC64_GOT16_LO R_PPC_GOT16_LO +#define R_PPC64_GOT16_HI R_PPC_GOT16_HI +#define R_PPC64_GOT16_HA R_PPC_GOT16_HA + +#define R_PPC64_COPY R_PPC_COPY +#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT +#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT +#define R_PPC64_RELATIVE R_PPC_RELATIVE + +#define R_PPC64_UADDR32 R_PPC_UADDR32 +#define R_PPC64_UADDR16 R_PPC_UADDR16 +#define R_PPC64_REL32 R_PPC_REL32 +#define R_PPC64_PLT32 R_PPC_PLT32 +#define R_PPC64_PLTREL32 R_PPC_PLTREL32 +#define R_PPC64_PLT16_LO R_PPC_PLT16_LO +#define R_PPC64_PLT16_HI R_PPC_PLT16_HI +#define R_PPC64_PLT16_HA R_PPC_PLT16_HA + +#define R_PPC64_SECTOFF R_PPC_SECTOFF +#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO +#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI +#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA +#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */ +#define R_PPC64_ADDR64 38 /* doubleword64 S + A */ +#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */ +#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */ +#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */ +#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */ +#define R_PPC64_UADDR64 43 /* doubleword64 S + A */ +#define R_PPC64_REL64 44 /* doubleword64 S + A - P */ +#define R_PPC64_PLT64 45 /* doubleword64 L + A */ +#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */ +#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */ +#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */ +#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */ +#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */ +#define R_PPC64_TOC 51 /* doubleword64 .TOC */ +#define R_PPC64_PLTGOT16 52 /* half16* M + A */ +#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */ +#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */ +#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */ + +#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */ +#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */ +#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */ +#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */ +#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */ +#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */ +#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */ +#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */ +#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */ +#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */ +#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */ + +/* PowerPC64 relocations defined for the TLS access ABI. */ +#define R_PPC64_TLS 67 /* none (sym+add)@tls */ +#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ +#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ +#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ +#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ +#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ +#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ +#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ +#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ +#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ +#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ +#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ +#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ +#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ +#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ +#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ +#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ +#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ +#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ +#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ +#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ +#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ +#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ +#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ +#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ +#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ +#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ +#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ +#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ +#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ +#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ +#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ +#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ +#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ +#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ +#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ +#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ +#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ +#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ +#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ + +/* Keep this the last entry. */ +#define R_PPC64_NUM 107 + +/* PowerPC64 specific values for the Dyn d_tag field. */ +#define DT_PPC64_GLINK (DT_LOPROC + 0) +#define DT_PPC64_OPD (DT_LOPROC + 1) +#define DT_PPC64_OPDSZ (DT_LOPROC + 2) +#define DT_PPC64_NUM 3 + + +/* ARM specific declarations */ + +/* Processor specific flags for the ELF header e_flags field. */ +#define EF_ARM_RELEXEC 0x01 +#define EF_ARM_HASENTRY 0x02 +#define EF_ARM_INTERWORK 0x04 +#define EF_ARM_APCS_26 0x08 +#define EF_ARM_APCS_FLOAT 0x10 +#define EF_ARM_PIC 0x20 +#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ +#define EF_ARM_NEW_ABI 0x80 +#define EF_ARM_OLD_ABI 0x100 + +/* Other constants defined in the ARM ELF spec. version B-01. */ +/* NB. These conflict with values defined above. */ +#define EF_ARM_SYMSARESORTED 0x04 +#define EF_ARM_DYNSYMSUSESEGIDX 0x08 +#define EF_ARM_MAPSYMSFIRST 0x10 +#define EF_ARM_EABIMASK 0XFF000000 + +#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) +#define EF_ARM_EABI_UNKNOWN 0x00000000 +#define EF_ARM_EABI_VER1 0x01000000 +#define EF_ARM_EABI_VER2 0x02000000 + +/* Additional symbol types for Thumb */ +#define STT_ARM_TFUNC 0xd + +/* ARM-specific values for sh_flags */ +#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ +#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined + in the input to a link step */ + +/* ARM-specific program header flags */ +#define PF_ARM_SB 0x10000000 /* Segment contains the location + addressed by the static base */ + +/* ARM relocs. */ +#define R_ARM_NONE 0 /* No reloc */ +#define R_ARM_PC24 1 /* PC relative 26 bit branch */ +#define R_ARM_ABS32 2 /* Direct 32 bit */ +#define R_ARM_REL32 3 /* PC relative 32 bit */ +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 /* Direct 16 bit */ +#define R_ARM_ABS12 6 /* Direct 12 bit */ +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 /* Direct 8 bit */ +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_SWI24 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +#define R_ARM_COPY 20 /* Copy symbol at runtime */ +#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ +#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ +#define R_ARM_RELATIVE 23 /* Adjust by program base */ +#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ +#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ +#define R_ARM_GOT32 26 /* 32 bit GOT entry */ +#define R_ARM_PLT32 27 /* 32 bit PLT address */ +#define R_ARM_ALU_PCREL_7_0 32 +#define R_ARM_ALU_PCREL_15_8 33 +#define R_ARM_ALU_PCREL_23_15 34 +#define R_ARM_LDR_SBREL_11_0 35 +#define R_ARM_ALU_SBREL_19_12 36 +#define R_ARM_ALU_SBREL_27_20 37 +#define R_ARM_GNU_VTENTRY 100 +#define R_ARM_GNU_VTINHERIT 101 +#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ +#define R_ARM_THM_PC9 103 /* thumb conditional branch */ +#define R_ARM_RXPC25 249 +#define R_ARM_RSBREL32 250 +#define R_ARM_THM_RPC22 251 +#define R_ARM_RREL32 252 +#define R_ARM_RABS22 253 +#define R_ARM_RPC24 254 +#define R_ARM_RBASE 255 +/* Keep this the last entry. */ +#define R_ARM_NUM 256 + +/* IA-64 specific declarations. */ + +/* Processor specific flags for the Ehdr e_flags field. */ +#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ +#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */ +#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ + +/* Processor specific values for the Phdr p_type field. */ +#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ +#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ +#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) +#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) +#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) + +/* Processor specific flags for the Phdr p_flags field. */ +#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */ + +/* Processor specific values for the Shdr sh_type field. */ +#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ +#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ + +/* Processor specific flags for the Shdr sh_flags field. */ +#define SHF_IA_64_SHORT 0x10000000 /* section near gp */ +#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ + +/* Processor specific values for the Dyn d_tag field. */ +#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) +#define DT_IA_64_NUM 1 + +/* IA-64 relocations. */ +#define R_IA64_NONE 0x00 /* none */ +#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */ +#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */ +#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */ +#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */ +#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */ +#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */ +#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */ +#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */ +#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */ +#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */ +#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */ +#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */ +#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */ +#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */ +#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */ +#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */ +#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */ +#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */ +#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */ +#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */ +#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */ +#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */ +#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */ +#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */ +#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */ +#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */ +#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */ +#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */ +#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */ +#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */ +#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */ +#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */ +#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */ +#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */ +#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */ +#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */ +#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */ +#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */ +#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */ +#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */ +#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */ +#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */ +#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */ +#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */ +#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */ +#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */ +#define R_IA64_REL32MSB 0x6c /* data 4 + REL */ +#define R_IA64_REL32LSB 0x6d /* data 4 + REL */ +#define R_IA64_REL64MSB 0x6e /* data 8 + REL */ +#define R_IA64_REL64LSB 0x6f /* data 8 + REL */ +#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */ +#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */ +#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */ +#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */ +#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */ +#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */ +#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */ +#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */ +#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */ +#define R_IA64_COPY 0x84 /* copy relocation */ +#define R_IA64_SUB 0x85 /* Addend and symbol difference */ +#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */ +#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */ +#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */ +#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */ +#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */ +#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */ +#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */ +#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */ +#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */ +#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */ +#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */ +#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */ +#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */ +#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */ +#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */ +#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */ +#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */ +#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ +#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ + +/* SH specific declarations */ + +/* SH relocs. */ +#define R_SH_NONE 0 +#define R_SH_DIR32 1 +#define R_SH_REL32 2 +#define R_SH_DIR8WPN 3 +#define R_SH_IND12W 4 +#define R_SH_DIR8WPL 5 +#define R_SH_DIR8WPZ 6 +#define R_SH_DIR8BP 7 +#define R_SH_DIR8W 8 +#define R_SH_DIR8L 9 +#define R_SH_SWITCH16 25 +#define R_SH_SWITCH32 26 +#define R_SH_USES 27 +#define R_SH_COUNT 28 +#define R_SH_ALIGN 29 +#define R_SH_CODE 30 +#define R_SH_DATA 31 +#define R_SH_LABEL 32 +#define R_SH_SWITCH8 33 +#define R_SH_GNU_VTINHERIT 34 +#define R_SH_GNU_VTENTRY 35 +#define R_SH_TLS_GD_32 144 +#define R_SH_TLS_LD_32 145 +#define R_SH_TLS_LDO_32 146 +#define R_SH_TLS_IE_32 147 +#define R_SH_TLS_LE_32 148 +#define R_SH_TLS_DTPMOD32 149 +#define R_SH_TLS_DTPOFF32 150 +#define R_SH_TLS_TPOFF32 151 +#define R_SH_GOT32 160 +#define R_SH_PLT32 161 +#define R_SH_COPY 162 +#define R_SH_GLOB_DAT 163 +#define R_SH_JMP_SLOT 164 +#define R_SH_RELATIVE 165 +#define R_SH_GOTOFF 166 +#define R_SH_GOTPC 167 +/* Keep this the last entry. */ +#define R_SH_NUM 256 + +/* Additional s390 relocs */ + +#define R_390_NONE 0 /* No reloc. */ +#define R_390_8 1 /* Direct 8 bit. */ +#define R_390_12 2 /* Direct 12 bit. */ +#define R_390_16 3 /* Direct 16 bit. */ +#define R_390_32 4 /* Direct 32 bit. */ +#define R_390_PC32 5 /* PC relative 32 bit. */ +#define R_390_GOT12 6 /* 12 bit GOT offset. */ +#define R_390_GOT32 7 /* 32 bit GOT offset. */ +#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */ +#define R_390_COPY 9 /* Copy symbol at runtime. */ +#define R_390_GLOB_DAT 10 /* Create GOT entry. */ +#define R_390_JMP_SLOT 11 /* Create PLT entry. */ +#define R_390_RELATIVE 12 /* Adjust by program base. */ +#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */ +#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */ +#define R_390_GOT16 15 /* 16 bit GOT offset. */ +#define R_390_PC16 16 /* PC relative 16 bit. */ +#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */ +#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */ +#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */ +#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */ +#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */ +#define R_390_64 22 /* Direct 64 bit. */ +#define R_390_PC64 23 /* PC relative 64 bit. */ +#define R_390_GOT64 24 /* 64 bit GOT offset. */ +#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */ +#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */ +#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */ +#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */ +#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */ +#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */ +#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */ +#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */ +#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */ +#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */ +#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */ +#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */ +#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */ +#define R_390_TLS_GDCALL 38 /* Tag for function call in general + dynamic TLS code. */ +#define R_390_TLS_LDCALL 39 /* Tag for function call in local + dynamic TLS code. */ +#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic + thread local data. */ +#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic + thread local data. */ +#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS + block offset. */ +#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS + block offset. */ +#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS + block offset. */ +#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic + thread local data in LE code. */ +#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic + thread local data in LE code. */ +#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for + negated static TLS block offset. */ +#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for + negated static TLS block offset. */ +#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for + negated static TLS block offset. */ +#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to + static TLS block. */ +#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to + static TLS block. */ +#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS + block. */ +#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS + block. */ +#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */ +#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ +#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS + block. */ +#define R_390_20 57 /* Direct 20 bit. */ +#define R_390_GOT20 58 /* 20 bit GOT offset. */ +#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */ +#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS + block offset. */ +/* Keep this the last entry. */ +#define R_390_NUM 61 + + +/* CRIS relocations. */ +#define R_CRIS_NONE 0 +#define R_CRIS_8 1 +#define R_CRIS_16 2 +#define R_CRIS_32 3 +#define R_CRIS_8_PCREL 4 +#define R_CRIS_16_PCREL 5 +#define R_CRIS_32_PCREL 6 +#define R_CRIS_GNU_VTINHERIT 7 +#define R_CRIS_GNU_VTENTRY 8 +#define R_CRIS_COPY 9 +#define R_CRIS_GLOB_DAT 10 +#define R_CRIS_JUMP_SLOT 11 +#define R_CRIS_RELATIVE 12 +#define R_CRIS_16_GOT 13 +#define R_CRIS_32_GOT 14 +#define R_CRIS_16_GOTPLT 15 +#define R_CRIS_32_GOTPLT 16 +#define R_CRIS_32_GOTREL 17 +#define R_CRIS_32_PLT_GOTREL 18 +#define R_CRIS_32_PLT_PCREL 19 + +#define R_CRIS_NUM 20 + + +/* AMD x86-64 relocations. */ +#define R_X86_64_NONE 0 /* No reloc */ +#define R_X86_64_64 1 /* Direct 64 bit */ +#define R_X86_64_PC32 2 /* PC relative 32 bit signed */ +#define R_X86_64_GOT32 3 /* 32 bit GOT entry */ +#define R_X86_64_PLT32 4 /* 32 bit PLT address */ +#define R_X86_64_COPY 5 /* Copy symbol at runtime */ +#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ +#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ +#define R_X86_64_RELATIVE 8 /* Adjust by program base */ +#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative + offset to GOT */ +#define R_X86_64_32 10 /* Direct 32 bit zero extended */ +#define R_X86_64_32S 11 /* Direct 32 bit sign extended */ +#define R_X86_64_16 12 /* Direct 16 bit zero extended */ +#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ +#define R_X86_64_8 14 /* Direct 8 bit sign extended */ +#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ +#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ +#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */ +#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */ +#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset + to two GOT entries for GD symbol */ +#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset + to two GOT entries for LD symbol */ +#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ +#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset + to GOT entry for IE symbol */ +#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ + +#define R_X86_64_NUM 24 + + +/* AM33 relocations. */ +#define R_MN10300_NONE 0 /* No reloc. */ +#define R_MN10300_32 1 /* Direct 32 bit. */ +#define R_MN10300_16 2 /* Direct 16 bit. */ +#define R_MN10300_8 3 /* Direct 8 bit. */ +#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ +#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ +#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ +#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */ +#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */ +#define R_MN10300_24 9 /* Direct 24 bit. */ +#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */ +#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */ +#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */ +#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */ +#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */ +#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */ +#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */ +#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */ +#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */ +#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */ +#define R_MN10300_COPY 20 /* Copy symbol at runtime. */ +#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */ +#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */ +#define R_MN10300_RELATIVE 23 /* Adjust by program base. */ + +#define R_MN10300_NUM 24 + + +/* M32R relocs. */ +#define R_M32R_NONE 0 /* No reloc. */ +#define R_M32R_16 1 /* Direct 16 bit. */ +#define R_M32R_32 2 /* Direct 32 bit. */ +#define R_M32R_24 3 /* Direct 24 bit. */ +#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */ +#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */ +#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */ +#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */ +#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */ +#define R_M32R_LO16 9 /* Low 16 bit. */ +#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */ +#define R_M32R_GNU_VTINHERIT 11 +#define R_M32R_GNU_VTENTRY 12 +/* M32R relocs use SHT_RELA. */ +#define R_M32R_16_RELA 33 /* Direct 16 bit. */ +#define R_M32R_32_RELA 34 /* Direct 32 bit. */ +#define R_M32R_24_RELA 35 /* Direct 24 bit. */ +#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */ +#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */ +#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */ +#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */ +#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */ +#define R_M32R_LO16_RELA 41 /* Low 16 bit */ +#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */ +#define R_M32R_RELA_GNU_VTINHERIT 43 +#define R_M32R_RELA_GNU_VTENTRY 44 + +#define R_M32R_GOT24 48 /* 24 bit GOT entry */ +#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */ +#define R_M32R_COPY 50 /* Copy symbol at runtime */ +#define R_M32R_GLOB_DAT 51 /* Create GOT entry */ +#define R_M32R_JMP_SLOT 52 /* Create PLT entry */ +#define R_M32R_RELATIVE 53 /* Adjust by program base */ +#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */ +#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */ +#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned + low */ +#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed + low */ +#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */ +#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to + GOT with unsigned low */ +#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to + GOT with signed low */ +#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to + GOT */ +#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT + with unsigned low */ +#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT + with signed low */ +#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ +#define R_M32R_NUM 256 /* Keep this the last entry. */ + + +#endif /* elf.h */ diff --git a/include/intcvt.h b/include/intcvt.h new file mode 100644 index 0000000..12ef59a --- /dev/null +++ b/include/intcvt.h @@ -0,0 +1,124 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)intcvt.h 1.4 03/12/29 Copyright 1986-2003 J. Schilling */ +/* + * Definitions for conversion to/from integer data types of various size. + * + * Copyright (c) 1986-2003 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _INTCVT_H +#define _INTCVT_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#define i_to_2_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[1] = (i) & 0xFF) + +#define i_to_3_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[2] = (i) & 0xFF) + +#define i_to_4_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 24)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[2] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[3] = (i) & 0xFF) + + + +#define a_to_byte(a) (((Int8_t *) a)[0]) + +#define a_to_u_byte(a) ((UInt8_t) \ + (((Uchar *) a)[0] & 0xFF)) + +#define a_to_u_2_byte(a) ((UInt16_t) \ + ((((Uchar *) a)[1] & 0xFF) | \ + (((Uchar *) a)[0] << 8 & 0xFF00))) + +#define a_to_2_byte(a) (int)(Int16_t)a_to_u_2_byte(a) + +#define a_to_u_3_byte(a) ((Ulong) \ + ((((Uchar *) a)[2] & 0xFF) | \ + (((Uchar *) a)[1] << 8 & 0xFF00) | \ + (((Uchar *) a)[0] << 16 & 0xFF0000))) + +#define a_to_3_byte(a) a_to_u_3_byte(a) /* XXX Is there a signed version ? */ + +#ifdef __STDC__ +# define __TOP_4BYTE 0xFF000000UL +#else +# define __TOP_4BYTE 0xFF000000 +#endif + +#define a_to_u_4_byte(a) ((Ulong) \ + ((((Uchar*) a)[3] & 0xFF) | \ + (((Uchar*) a)[2] << 8 & 0xFF00) | \ + (((Uchar*) a)[1] << 16 & 0xFF0000) | \ + (((Uchar*) a)[0] << 24 & __TOP_4BYTE))) + +#define a_to_4_byte(a) (long)(Int32_t)a_to_u_4_byte(a) + +/* + * Little Endian versions of above macros + */ +#define li_to_2_byte(a, i) (((Uchar *)(a))[1] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[0] = (i) & 0xFF) + +#define li_to_3_byte(a, i) (((Uchar *)(a))[2] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[0] = (i) & 0xFF) + +#define li_to_4_byte(a, i) (((Uchar *)(a))[3] = ((i) >> 24)& 0xFF,\ + ((Uchar *)(a))[2] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[0] = (i) & 0xFF) + + +#define la_to_u_2_byte(a) ((UInt16_t) \ + ((((Uchar*) a)[0] & 0xFF) | \ + (((Uchar*) a)[1] << 8 & 0xFF00))) + +#define la_to_2_byte(a) (int)(Int16_t)la_to_u_2_byte(a) + +#define la_to_u_3_byte(a) ((Ulong) \ + ((((Uchar*) a)[0] & 0xFF) | \ + (((Uchar*) a)[1] << 8 & 0xFF00) | \ + (((Uchar*) a)[2] << 16 & 0xFF0000))) + +#define la_to_3_byte(a) la_to_u_3_byte(a) /* XXX Is there a signed version ? */ + +#define la_to_u_4_byte(a) ((Ulong) \ + ((((Uchar*) a)[0] & 0xFF) | \ + (((Uchar*) a)[1] << 8 & 0xFF00) | \ + (((Uchar*) a)[2] << 16 & 0xFF0000) | \ + (((Uchar*) a)[3] << 24 & __TOP_4BYTE))) + +#define la_to_4_byte(a) (long)(Int32_t)la_to_u_4_byte(a) + +#endif /* _INTCVT_H */ diff --git a/include/jmpdefs.h b/include/jmpdefs.h new file mode 100644 index 0000000..d9d2db0 --- /dev/null +++ b/include/jmpdefs.h @@ -0,0 +1,49 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)jmpdefs.h 1.2 00/11/08 Copyright 1999 J. Schilling */ +/* + * Definitions that help to handle a jmp_buf + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _JMPDEFS_H +#define _JMPDEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + jmp_buf jb; +} jmps_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _JMPDEFS_H */ diff --git a/include/libport.h b/include/libport.h new file mode 100644 index 0000000..2d5930f --- /dev/null +++ b/include/libport.h @@ -0,0 +1,124 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)libport.h 1.9 03/06/15 Copyright 1995 J. Schilling */ +/* + * Copyright (c) 1995 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef _LIBPORT_H +#define _LIBPORT_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif +#ifndef _STANDARD_H +#include <standard.h> +#endif + +/* + * Try to get HOST_NAME_MAX for gethostname() + */ +#ifndef _UNIXSTD_H +#include <unixstd.h> +#endif + +#ifndef HOST_NAME_MAX +#if defined(HAVE_NETDB_H) && !defined(HOST_NOT_FOUND) && \ + !defined(_INCL_NETDB_H) +#include <netdb.h> +#define _INCL_NETDB_H +#endif +#ifdef MAXHOSTNAMELEN +#define HOST_NAME_MAX MAXHOSTNAMELEN +#endif +#endif + +#ifndef HOST_NAME_MAX +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> /* Include various defs needed with some OS */ + /* Linux MAXHOSTNAMELEN */ +#endif +#ifdef MAXHOSTNAMELEN +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX MAXHOSTNAMELEN +#endif +#endif +#endif + +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSERVER +/* + * Don't use the usleep() from libc on SCO's OPENSERVER. + * It will kill our processes with SIGALRM. + */ +/* + * Don't #undef HAVE_USLEEP in this file, SCO has a + * usleep() prototype in unistd.h + */ +/*#undef HAVE_USLEEP*/ +#endif + +#ifndef HAVE_GETHOSTID +extern long gethostid(void); +#endif +#ifndef HAVE_GETHOSTNAME +extern int gethostname(char *name, int namelen); +#endif +#ifndef HAVE_GETDOMAINNAME +extern int getdomainname(char *name, int namelen); +#endif +#ifndef HAVE_GETPAGESIZE +int getpagesize(void); +#endif +#ifndef HAVE_USLEEP +extern int usleep(int usec); +#endif + +#if !defined(HAVE_STRDUP) || defined(__SVR4) +extern char *strdup(const char *s); +#endif + +#ifndef HAVE_RENAME +extern int rename(const char *old, const char *new); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBPORT_H */ diff --git a/include/librmt.h b/include/librmt.h new file mode 100644 index 0000000..9264216 --- /dev/null +++ b/include/librmt.h @@ -0,0 +1,75 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)librmt.h 1.16 03/06/15 Copyright 1996 J. Schilling */ +/* + * Prototypes for rmt client subroutines + * + * Copyright (c) 1995,1996,2000-2002 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _LIBRMT_H +#define _LIBRMT_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#include <rmtio.h> + +/* + * remote.c + */ +extern void rmtinit(int (*errmsgn)(int, const char *, ...), + void (*eexit)(int)); +extern int rmtdebug(int dlevel); +extern char *rmtfilename(char *name); +extern char *rmthostname(char *hostname, int hnsize, char *rmtspec); +extern int rmtgetconn(char *host, int trsize, int excode); +extern int rmtopen(int fd, char *fname, int fmode); +extern int rmtclose(int fd); +extern int rmtread(int fd, char *buf, int count); +extern int rmtwrite(int fd, char *buf, int count); +extern off_t rmtseek(int fd, off_t offset, int whence); +extern int rmtioctl(int fd, int cmd, int count); +#ifdef MTWEOF +extern int rmtstatus(int fd, struct mtget *mtp); +#endif +extern int rmtxstatus(int fd, struct rmtget *mtp); +#ifdef MTWEOF +extern void _rmtg2mtg(struct mtget *mtp, struct rmtget *rmtp); +extern int _mtg2rmtg(struct rmtget *rmtp, struct mtget *mtp); +#endif + +#endif /* _LIBRMT_H */ diff --git a/include/maxpath.h b/include/maxpath.h new file mode 100644 index 0000000..a26cfe4 --- /dev/null +++ b/include/maxpath.h @@ -0,0 +1,86 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)maxpath.h 1.6 03/08/23 Copyright 1985, 1995, 1998 J. Schilling */ +/* + * Definitions for dealing with statically limitations on pathnames + * + * Copyright (c) 1985, 1995, 1998 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _MAXPATH_H +#define _MAXPATH_H + +#ifndef _DIRDEFS_H +#include <dirdefs.h> /* Includes mconfig.h if needed */ +#endif + +#ifdef JOS +#ifndef _JOS_MAXP_H +# include <jos_maxp.h> +#endif +# define FOUND_MAXPATHNAME +# define FOUND_MAXFILENAME +#else + +# ifdef MAXPATHLEN +# define MAXPATHNAME MAXPATHLEN /* From sys/param.h */ +# define FOUND_MAXPATHNAME +# else +# ifdef PATH_MAX +# define MAXPATHNAME PATH_MAX /* From limits.h */ +# define FOUND_MAXPATHNAME +# else +# define MAXPATHNAME 256 /* Is there a limit? */ +# endif +# endif + +/* + * Don't use defaults here to allow recognition of problems. + */ +# ifdef MAXNAMELEN +# define MAXFILENAME MAXNAMELEN /* From sys/param.h */ +# define FOUND_MAXFILENAME +# else +# ifdef MAXNAMLEN +# define MAXFILENAME MAXNAMLEN /* From dirent.h */ +# define FOUND_MAXFILENAME +# else +# ifdef DIRSIZ +# define MAXFILENAME DIRSIZ /* From sys/dir.h */ +# define FOUND_MAXFILENAME +# endif +# endif +# endif + +#if !defined(FOUND_MAXFILENAME) && defined(FOUND_DIRSIZE) +# define MAXFILENAME DIRSIZE /* From dirdefs.h */ +# define FOUND_MAXFILENAME +#endif + +#endif /* JOS */ + +#endif /* _MAXPATH_H */ diff --git a/include/mconfig.h b/include/mconfig.h new file mode 100644 index 0000000..ee356ec --- /dev/null +++ b/include/mconfig.h @@ -0,0 +1,487 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)mconfig.h 1.50 04/07/11 Copyright 1995 J. Schilling */ +/* + * definitions for machine configuration + * + * Copyright (c) 1995 J. Schilling + * + * This file must be included before any other file. + * If this file is not included before stdio.h you will not be + * able to get LARGEFILE support + * + * Use only cpp instructions. + * + * NOTE: SING: (Schily Is Not Gnu) + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _MCONFIG_H +#define _MCONFIG_H + +/* whatever, just shut up */ +#define __sccsid "forked version from cdrkit" +#define _sccsid "forked version from cdrkit" + +/* + * This hack that is needed as long as VMS has no POSIX shell. + */ +#ifdef VMS +# define USE_STATIC_CONF +#endif + +#ifdef USE_STATIC_CONF +#include <xmconfig.h> /* This is the current static autoconf stuff */ +#else +#include <xconfig.h> /* This is the current dynamic autoconf stuff */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The NetBSD people want to bother us. + * They removed the definition for 'unix' and are bleating for every test + * for #if defined(unix). So we need to check for NetBSD early. + */ +#ifndef IS_UNIX +# if defined(__NetBSD__) +# define IS_UNIX +# endif +#endif + +#ifndef IS_UNIX +# if (defined(unix) || defined(__unix) || defined(__unix__)) && !defined(__DJGPP__) +# define IS_UNIX +# endif +#endif + +#ifdef __MSDOS__ +# define IS_MSDOS +#endif + +#if defined(tos) || defined(__tos) +# define IS_TOS +#endif + +#ifdef THINK_C +# define IS_MAC +#endif + +#if defined(sun) || defined(__sun) || defined(__sun__) +# define IS_SUN +#endif + +#if defined(__CYGWIN32__) || defined(__CYGWIN__) +# define IS_GCC_WIN32 +# define IS_CYGWIN + +#if defined(unix) || defined(_X86) +# define IS_CYGWIN_1 +#endif +#endif + +/*--------------------------------------------------------------------------*/ +/* + * Some magic that cannot (yet) be figured out with autoconf. + */ + +#if defined(sun3) || defined(mc68000) || defined(mc68020) +# ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +# endif +#endif +#ifdef sparc +# ifndef HAVE_LDSTUB +# define HAVE_LDSTUB +# endif +# ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +# endif +#endif +#if defined(__i386_) || defined(i386) +# ifndef HAVE_XCHG +# define HAVE_XCHG +# endif +# ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +# endif +#endif + +/* + * Use of SCANSTACK is disabled by default + */ +#ifndef USE_SCANSTACK +# undef HAVE_SCANSTACK +#else +/* + * But .... + * The tests are much better now, so always give it a chance. + */ +#ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +#endif +#endif + +/* + * Allow to overwrite the defines in the makefiles by calling + * + * make COPTX=-DFORCE_SCANSTACK + */ +#ifdef FORCE_SCANSTACK +# undef NO_SCANSTACK +#ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +#endif +#ifndef USE_SCANSTACK +# define USE_SCANSTACK +#endif +#endif + +/* + * This is the global switch to deactivate stack scanning + */ +#ifdef NO_SCANSTACK +# ifdef HAVE_SCANSTACK +# undef HAVE_SCANSTACK +# endif +#endif + +#ifdef NO_FORK +# ifdef HAVE_FORK +# undef HAVE_FORK +# endif +# ifdef HAVE_VFORK +# undef HAVE_VFORK +# endif +#endif +#ifdef NO_VFORK +# ifdef HAVE_VFORK +# undef HAVE_VFORK +# endif +#endif + +#if defined(SOL2) || defined(SOL2) || \ + defined(S5R4) || defined(__S5R4) || defined(SVR4) +# ifndef __SVR4 +# define __SVR4 +# endif +#endif + +#ifdef __SVR4 +# ifndef SVR4 +# define SVR4 +# endif +#endif + +/* + * SunOS 4.x / SunOS 5.x + */ +#if defined(IS_SUN) +# define HAVE_GETAV0 +#endif + +/* + * AIX + */ +#if defined(_IBMR2) || defined(_AIX) +# ifndef IS_UNIX +# define IS_UNIX /* ??? really ??? */ +# endif +#endif + +/* + * QNX + */ +#if defined(__QNX__) +# ifndef IS_UNIX +# define IS_UNIX +# endif +#endif + +/* + * Silicon Graphics (must be before SVR4) + */ +#if defined(sgi) || defined(__sgi) +# define __NOT_SVR4__ /* Not a real SVR4 implementation */ +#endif + +/* + * Data General + */ +#if defined(__DGUX__) +#ifdef XXXXXXX +# undef HAVE_MTGET_DSREG +# undef HAVE_MTGET_RESID +# undef HAVE_MTGET_FILENO +# undef HAVE_MTGET_BLKNO +#endif +# define mt_type mt_model +# define mt_dsreg mt_status1 +# define mt_erreg mt_status2 + /* + * DGUX hides its flock as dg_flock. + */ +# define HAVE_FLOCK +# define flock dg_flock + /* + * Use the BSD style wait on DGUX to get the resource usages of child + * processes. + */ +# define _BSD_WAIT_FLAVOR +#endif + +/* + * Apple Rhapsody (This is the name for Mac OS X beta) + */ +#if defined(__NeXT__) && defined(__TARGET_OSNAME) && __TARGET_OSNAME == rhapsody +# define HAVE_OSDEF /* prevent later definitions to overwrite current */ +# ifndef IS_UNIX +# define IS_UNIX +# endif +#endif + +/* + * NextStep + */ +#if defined(__NeXT__) && !defined(HAVE_OSDEF) +#define NO_PRINT_OVR +#undef HAVE_USG_STDIO /* + * NeXT Step 3.x uses __flsbuf(unsigned char, FILE *) + * instead of __flsbuf(int, FILE *) + */ +# ifndef IS_UNIX +# define IS_UNIX +# endif +#endif + +/* + * Mac OS X + */ +#if defined(__APPLE__) && defined(__MACH__) +# ifndef IS_UNIX +# define IS_UNIX +# endif +# define IS_MACOS_X +#endif + +/* + * NextStep 3.x has a broken linker that does not allow us to override + * these functions. + */ +#ifndef __OPRINTF__ + +#ifdef NO_PRINT_OVR +# define printf Xprintf +# define fprintf Xfprintf +# define sprintf Xsprintf +#endif + +#endif /* __OPRINTF__ */ + +/*--------------------------------------------------------------------------*/ +/* + * If there is no flock defined by the system, use emulation + * through fcntl record locking. + */ +#ifndef HAVE_FLOCK +#define LOCK_SH 1 /* shared lock */ +#define LOCK_EX 2 /* exclusive lock */ +#define LOCK_NB 4 /* don't block when locking */ +#define LOCK_UN 8 /* unlock */ +#endif + +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +/* + * gcc 2.x generally implements the long long type. + */ +#ifdef __GNUC__ +# if __GNUC__ > 1 +# ifndef HAVE_LONGLONG +# define HAVE_LONGLONG +# endif +# endif +#endif + +/* + * Convert to GNU name + */ +#ifdef HAVE_STDC_HEADERS +# ifndef STDC_HEADERS +# define STDC_HEADERS +# endif +#endif +/* + * Convert to SCHILY name + */ +#ifdef STDC_HEADERS +# ifndef HAVE_STDC_HEADERS +# define HAVE_STDC_HEADERS +# endif +#endif + +#ifdef IS_UNIX +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define far +# define near +#endif + +/* + * Win32 with Gygwin + */ +#ifdef IS_GCC_WIN32 +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define HAVE_DOS_DRIVELETTER +# define far +# define near +# define NEED_O_BINARY +#endif + +/* + * Win32 with Mingw32 + */ +#ifdef __MINGW32__ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER +# define far +# define near +# define NEED_O_BINARY +#endif + +/* + * OS/2 EMX + */ +#ifdef __EMX__ /* We don't want to call it UNIX */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER +# define far +# define near +# define NEED_O_BINARY +#endif + +#ifdef __BEOS__ /* We don't want to call it UNIX */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define far +# define near +#endif + +/* + * DOS with DJGPP + */ +#ifdef __DJGPP__ /* We don't want to call it UNIX */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER + +# define NEED_O_BINARY +#endif + +/* + * Vanilla DOS + */ +#if defined(IS_MSDOS) && !defined(__DJGPP__) +# define HAVE_PATH_DELIM +# define PATH_DELIM '\\' +# define PATH_DELIM_STR "\\" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER + +# define NEED_O_BINARY +#endif + +/* + * ATARI TOS + */ +#ifdef IS_TOS +# define HAVE_PATH_DELIM +# define PATH_DELIM '\\' +# define PATH_DELIM_STR "\\" +# define PATH_ENV_DELIM ',' +# define PATH_ENV_DELIM_STR "," +# define HAVE_DOS_DRIVELETTER +# define far +# define near +#endif + +/* + * Mac OS 9 + */ +#ifdef IS_MAC +# define HAVE_PATH_DELIM +# define PATH_DELIM ':' +# define PATH_DELIM_STR ":" +# define PATH_ENV_DELIM ';' /* ??? */ +# define PATH_ENV_DELIM_STR ";" /* ??? */ +# define far +# define near +#endif + +/* + * I hope this will make compilation on unknown OS easier. + */ +#ifndef HAVE_PATH_DELIM /* Default to POSIX rules */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define far +# define near +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _MCONFIG_H */ diff --git a/include/mmapdefs.h b/include/mmapdefs.h new file mode 100644 index 0000000..82d5256 --- /dev/null +++ b/include/mmapdefs.h @@ -0,0 +1,74 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)mmapdefs.h 1.1 01/02/25 Copyright 2001 J. Schilling */ +/* + * Definitions to be used for mmap() + * + * Copyright (c) 2001 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _MMAPDEFS_H +#define _MMAPDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#if defined(HAVE_SMMAP) + +#ifndef _INCL_SYS_MMAN_H +#include <sys/mman.h> +#define _INCL_SYS_MMAN_H +#endif + +#ifndef MAP_ANONYMOUS +# ifdef MAP_ANON +# define MAP_ANONYMOUS MAP_ANON +# endif +#endif + +#ifndef MAP_FILE +# define MAP_FILE 0 /* Needed on Apollo Domain/OS */ +#endif + +/* + * Needed for Apollo Domain/OS and may be for others? + */ +#ifdef _MMAP_WITH_SIZEP +# define mmap_sizeparm(s) (&(s)) +#else +# define mmap_sizeparm(s) (s) +#endif + +#endif /* defined(HAVE_SMMAP) */ + +#endif /* _MMAPDEFS_H */ diff --git a/include/patmatch.h b/include/patmatch.h new file mode 100644 index 0000000..20ddc77 --- /dev/null +++ b/include/patmatch.h @@ -0,0 +1,116 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)patmatch.h 1.10 03/08/24 Copyright 1985 J. Schilling */ + +#ifndef _PATMATCH_H +#define _PATMATCH_H +/* + * Definitions for the pattern matching functions. + * + * Copyright (c) 1985,1995 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/* + * The pattern matching functions are based on the algorithm + * presented by Martin Richards in: + * + * "A Compact Function for Regular Expression Pattern Matching", + * Software-Practice and Experience, Vol. 9, 527-534 (1979) + * + * Several changes have been made to the original source which has been + * written in BCPL: + * + * '/' is replaced by '!' (to allow UNIX filenames) + * '(',')' are replaced by '{', '}' + * '\'' is replaced by '\\' (UNIX compatible quote) + * + * Character classes have been added to allow "[<character list>]" + * to be used. + * Start of line '^' and end of line '$' have been added. + * + * Any number in the following comment is zero or more occurrencies + */ +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define ALT '!' /* Alternation in match i.e. this!that!the_other */ +#define REP '#' /* Any number of occurrences of the following expr */ +#define NIL '%' /* Empty string (exactly nothing) */ +#define STAR '*' /* Any number of any character (equivalent of #?) */ +#define ANY '?' /* Any one character */ +#define QUOTE '\\' /* Quotes the next character */ +#define LBRACK '{' /* Begin of precedence grouping */ +#define RBRACK '}' /* End of precedence grouping */ +#define LCLASS '[' /* Begin of character set */ +#define RCLASS ']' /* End of character set */ +#define NOT '^' /* If first in set: invert set content */ +#define RANGE '-' /* Range notation in sets */ +#define START '^' /* Begin of a line */ +#define END '$' /* End of a line */ + +/* + * A list of case statements that may be used for a issimple() or ispattern() + * funtion that checks whether a string conrtains characters that need the + * pattern matcher. + * + * Note that this list does not contain NOT or RANGE because you need + * LCLASS and RCLASS in addition. + */ +#define casePAT case ALT: case REP: case NIL: case STAR: case ANY: \ + case QUOTE: case LBRACK: case RBRACK: \ + case LCLASS: case RCLASS: case START: case END: + + +#define MAXPAT 128 /* Maximum length of pattern */ + +extern int patcompile(const unsigned char *__pat, int __patlen, int *__aux); + +extern unsigned char *opatmatch(const unsigned char *__pat, const int *__aux, + const unsigned char *__str, int __soff, + int __slen, int __alt); +extern unsigned char *opatlmatch(const unsigned char *__pat, const int *__aux, + const unsigned char *__str, int __soff, + int __slen, int __alt); +extern unsigned char *patmatch(const unsigned char *__pat, const int *__aux, + const unsigned char *__str, int __soff, + int __slen, int __alt, int __state[]); +extern unsigned char *patlmatch(const unsigned char *__pat, const int *__aux, + const unsigned char *__str, int __soff, + int __slen, int __alt, int __state[]); + +#ifdef __cplusplus +} +#endif + +#endif /* _PATMATCH_H */ diff --git a/include/prototyp.h b/include/prototyp.h new file mode 100644 index 0000000..70d06ca --- /dev/null +++ b/include/prototyp.h @@ -0,0 +1,106 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)prototyp.h 1.11 03/08/23 Copyright 1995 J. Schilling */ +/* + * Definitions for dealing with ANSI / KR C-Compilers + * + * Copyright (c) 1995 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * mconfig.h includes prototype.h so we must do this include before we test + * for _PROTOTYP_H + */ +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _PROTOTYP_H +#define _PROTOTYP_H + +#ifndef PROTOTYPES + /* + * If this has already been defined, + * someone else knows better than us... + */ +# ifdef __STDC__ +# if __STDC__ /* ANSI C */ +# define PROTOTYPES +# endif +# if defined(sun) && __STDC__ - 0 == 0 /* Sun C */ +# define PROTOTYPES +# endif +# endif +#endif /* PROTOTYPES */ + +#if !defined(PROTOTYPES) && (defined(__cplusplus) || defined(_MSC_VER)) + /* + * C++ always supports prototypes. + * Define PROTOTYPES so we are not forced to make + * a separtate autoconf run for C++ + * + * Microsoft C has prototypes but does not define __STDC__ + */ +# define PROTOTYPES +#endif + +/* + * If we have prototypes, we should have stdlib.h string.h stdarg.h + */ +#ifdef PROTOTYPES +#if !(defined(SABER) && defined(sun)) +# ifndef HAVE_STDARG_H +# define HAVE_STDARG_H +# endif +#endif +#ifndef JOS +# ifndef HAVE_STDLIB_H +# define HAVE_STDLIB_H +# endif +# ifndef HAVE_STRING_H +# define HAVE_STRING_H +# endif +# ifndef HAVE_STDC_HEADERS +# define HAVE_STDC_HEADERS +# endif +# ifndef STDC_HEADERS +# define STDC_HEADERS /* GNU name */ +# endif +#endif +#endif + +#ifdef NO_PROTOTYPES /* Force not to use prototypes */ +# undef PROTOTYPES +#endif + +#ifdef PROTOTYPES +# define __PR(a) a +#else +# define __PR(a) () +#endif + +#endif /* _PROTOTYP_H */ diff --git a/include/rmtio.h b/include/rmtio.h new file mode 100644 index 0000000..1bf46ec --- /dev/null +++ b/include/rmtio.h @@ -0,0 +1,167 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)rmtio.h 1.5 03/06/15 Copyright 1995,2000 J. Schilling */ +/* + * Definition for enhanced remote tape IO + * + * Copyright (c) 1995,2000-2002 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _RMTIO_H +#define _RMTIO_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _UTYPES_H +#include <utypes.h> +#endif + +/* + * values for mt_op + */ +#define RMTWEOF 0 /* write an end-of-file record */ +#define RMTFSF 1 /* forward space over file mark */ +#define RMTBSF 2 /* backward space over file mark (1/2" only ) */ +#define RMTFSR 3 /* forward space to inter-record gap */ +#define RMTBSR 4 /* backward space to inter-record gap */ +#define RMTREW 5 /* rewind */ +#define RMTOFFL 6 /* rewind and put the drive offline */ +#define RMTNOP 7 /* no operation, sets status only */ + +#ifdef __needed__ +#define MTRETEN 8 /* retension the tape (cartridge tape only) */ +#define MTERASE 9 /* erase the entire tape */ +#define MTEOM 10 /* position to end of media */ +#define MTNBSF 11 /* backward space file to BOF */ + +#define MTSRSZ 12 /* set record size */ +#define MTGRSZ 13 /* get record size */ +#define MTLOAD 14 /* for loading a tape (use o_delay to open */ + /* the tape device) */ +#endif + +/* + * Definitions for the new RMT Protocol version 1 + * + * The new Protocol version tries to make the use + * of rmtioctl() more portable between different platforms. + */ +#define RMTIVERSION -1 /* Opcode to request version */ +#define RMT_NOVERSION -1 /* Old version code */ +#define RMT_VERSION 1 /* New (current) version code */ + +/* + * Support for commands bejond MTWEOF..MTNOP (0..7) + */ +#define RMTICACHE 0 /* enable controller cache */ +#define RMTINOCACHE 1 /* disable controller cache */ +#define RMTIRETEN 2 /* retension the tape (cartridge tape only) */ +#define RMTIERASE 3 /* erase the entire tape */ +#define RMTIEOM 4 /* position to end of media */ +#define RMTINBSF 5 /* backward space file to BOF */ + +/* + * Old MTIOCGET copies a binary version of struct mtget back + * over the wire. This is highly non portable. + * MTS_* retrieves ascii versions (%d format) of a single + * field in the struct mtget. + * NOTE: MTS_ERREG may only be valid on the first call and + * must be retrived first. + */ +#define MTS_TYPE 'T' /* mtget.mt_type */ +#define MTS_DSREG 'D' /* mtget.mt_dsreg */ +#define MTS_ERREG 'E' /* mtget.mt_erreg */ +#define MTS_RESID 'R' /* mtget.mt_resid */ +#define MTS_FILENO 'F' /* mtget.mt_fileno */ +#define MTS_BLKNO 'B' /* mtget.mt_blkno */ +#define MTS_FLAGS 'f' /* mtget.mt_flags */ +#define MTS_BF 'b' /* mtget.mt_bf */ + +/* + * structure for remote MTIOCGET - mag tape get status command + */ +struct rmtget { + Llong mt_type; /* type of magtape device */ + /* the following two registers are grossly device dependent */ + Llong mt_dsreg; /* ``drive status'' register */ + Int32_t mt_dsreg1; /* ``drive status'' register */ + Int32_t mt_dsreg2; /* ``drive status'' register */ + Llong mt_gstat; /* ``generic status'' register */ + Llong mt_erreg; /* ``error'' register */ + /* optional error info. */ + Llong mt_resid; /* residual count */ + Llong mt_fileno; /* file number of current position */ + Llong mt_blkno; /* block number of current position */ + Llong mt_flags; + Llong mt_gflags; /* generic flags */ + long mt_bf; /* optimum blocking factor */ + int mt_xflags; /* eXistence flags for struct members */ +}; + +/* + * Values for mt_xflags + */ +#define RMT_TYPE 0x0001 /* mt_type/mt_model present */ +#define RMT_DSREG 0x0002 /* mt_dsreg present */ +#define RMT_DSREG1 0x0004 /* mt_dsreg1 present */ +#define RMT_DSREG2 0x0008 /* mt_dsreg2 present */ +#define RMT_GSTAT 0x0010 /* mt_gstat present */ +#define RMT_ERREG 0x0020 /* mt_erreg present */ +#define RMT_RESID 0x0040 /* mt_resid present */ +#define RMT_FILENO 0x0080 /* mt_fileno present */ +#define RMT_BLKNO 0x0100 /* mt_blkno present */ +#define RMT_FLAGS 0x0200 /* mt_flags present */ +#define RMT_BF 0x0400 /* mt_bf present */ +#define RMT_COMPAT 0x0800 /* Created from old compat data */ + +/* + * values for mt_flags + */ +#define RMTF_SCSI 0x01 +#define RMTF_REEL 0x02 +#define RMTF_ASF 0x04 +#define RMTF_TAPE_HEAD_DIRTY 0x08 +#define RMTF_TAPE_CLN_SUPPORTED 0x10 + +/* + * these are recommended + */ +#ifdef __needed__ +#define MT_ISQIC 0x32 /* generic QIC tape drive */ +#define MT_ISREEL 0x33 /* generic reel tape drive */ +#define MT_ISDAT 0x34 /* generic DAT tape drive */ +#define MT_IS8MM 0x35 /* generic 8mm tape drive */ +#define MT_ISOTHER 0x36 /* generic other type of tape drive */ + +/* more Sun devices */ +#define MT_ISTAND25G 0x37 /* sun: SCSI Tandberg 2.5 Gig QIC */ +#define MT_ISDLT 0x38 /* sun: SCSI DLT tape drive */ +#define MT_ISSTK9840 0x39 /* sun: STK 9840 (Ironsides) */ +#endif + +#endif /* _RMTIO_H */ diff --git a/include/schily.h b/include/schily.h new file mode 100644 index 0000000..ec7cbb4 --- /dev/null +++ b/include/schily.h @@ -0,0 +1,288 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)schily.h 1.54 06/01/12 Copyright 1985-2006 J. Schilling */ +/* + * Definitions for libschily + * + * This file should be included past: + * + * mconfig.h / config.h + * standard.h + * stdio.h + * stdlib.h (better use stdxlib.h) + * unistd.h (better use unixstd.h) needed LARGEFILE support + * string.h + * sys/types.h + * + * If you need stdio.h, you must include it before schily.h + * + * NOTE: If you need ctype.h and did not include stdio.h you need to + * include ctype.h past schily.h as OpenBSD does not follow POSIX and + * defines EOF in ctype.h + * + * Copyright (c) 1985-2006 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SCHILY_H +#define _SCHILY_H + +#ifndef _STANDARD_H +#include <standard.h> +#endif +#ifndef _CCOMDEFS_H +#include <ccomdefs.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_INCL_SYS_TYPES_H) || defined(off_t) +# ifndef FOUND_OFF_T +# define FOUND_OFF_T +# endif +#endif +#if defined(_INCL_SYS_TYPES_H) || defined(size_t) +# ifndef FOUND_SIZE_T +# define FOUND_SIZE_T +# endif +#endif + +#ifdef __never_def__ +/* + * It turns out that we cannot use the folloginw definition because there are + * some platforms that do not behave application friendly. These are mainly + * BSD-4.4 based systems (which #undef a definition when size_t is available. + * We actually removed this code because of a problem with QNX Neutrino. + * For this reason, it is important not to include <sys/types.h> directly but + * via the Schily SING include files so we know whether it has been included + * before we come here. + */ +#if defined(_SIZE_T) || defined(_T_SIZE_) || defined(_T_SIZE) || \ + defined(__SIZE_T) || defined(_SIZE_T_) || \ + defined(_GCC_SIZE_T) || defined(_SIZET_) || \ + defined(__sys_stdtypes_h) || defined(___int_size_t_h) || defined(size_t) + +#ifndef FOUND_SIZE_T +# define FOUND_SIZE_T /* We already included a size_t definition */ +#endif +#endif +#endif /* __never_def__ */ + +#if defined(HAVE_LARGEFILES) +# define _fcons _fcons64 +# define fdup fdup64 +# define fileluopen fileluopen64 +# define fileopen fileopen64 +# define filemopen filemopen64 +# define filepos filepos64 +# define filereopen filereopen64 +# define fileseek fileseek64 +# define filesize filesize64 +# define filestat filestat64 +# define _openfd _openfd64 +#endif + +#ifdef EOF /* stdio.h has been included */ +extern int _cvmod(const char *, int *, int *); +extern FILE *_fcons(FILE *, int, int); +extern FILE *fdup(FILE *); +extern int fdown(FILE *); +extern int rols_fexecl(const char *, FILE *, FILE *, FILE *, const char *, ...); +extern int rols_fexecle(const char *, FILE *, FILE *, FILE *, const char *, ...); + /* 6th arg not const, fexecv forces av[ac] = NULL */ +extern int rols_fexecv(const char *, FILE *, FILE *, FILE *, int, char **); +extern int rols_fexecve(const char *, FILE *, FILE *, FILE *, char * const *, + char * const *); +extern int fspawnv(FILE *, FILE *, FILE *, int, char * const *); +extern int fspawnl(FILE *, FILE *, FILE *, const char *, const char *, ...); +extern int fspawnv_nowait(FILE *, FILE *, FILE *, const char *, int, + char *const*); +extern int rols_fgetline(FILE *, char *, int); +extern int fgetstr(FILE *, char *, int); +extern void file_raise(FILE *, int); +extern int fileclose(FILE *); +extern FILE *fileluopen(int, const char *); +extern FILE *fileopen(const char *, const char *); +#ifdef _INCL_SYS_TYPES_H +extern FILE *filemopen(const char *, const char *, mode_t); +#endif +#ifdef FOUND_OFF_T +extern off_t filepos(FILE *); +#endif +extern int fileread(FILE *, void *, int); +extern int ffileread(FILE *, void *, int); +extern FILE *filereopen(const char *, const char *, FILE *); +#ifdef FOUND_OFF_T +extern int fileseek(FILE *, off_t); +extern off_t filesize(FILE *); +#endif +#ifdef S_IFMT +extern int filestat(FILE *, struct stat *); +#endif +extern int filewrite(FILE *, void *, int); +extern int ffilewrite(FILE *, void *, int); +extern int flush(void); +extern int fpipe(FILE **); +extern int getbroken(FILE *, char *, char, char **, int); +extern int ofindline(FILE *, char, const char *, int, char **, int); +extern int peekc(FILE *); + +#ifdef __never_def__ +/* + * We cannot define this or we may get into problems with DOS based systems. + */ +extern int spawnv(FILE *, FILE *, FILE *, int, char * const *); +extern int spawnl(FILE *, FILE *, FILE *, const char *, const char *, ...); +extern int spawnv_nowait(FILE *, FILE *, FILE *, const char *, int, + char *const*); +#endif /* __never_def__m */ +#endif /* EOF */ + +extern int _niread(int, void *, int); +extern int _niwrite(int, void *, int); +extern int _nixread(int, void *, int); +extern int _nixwrite(int, void *, int); +extern int _openfd(const char *, int); +extern int on_comerr(void (*fun)(int, void *), void *arg); +/*PRINTFLIKE1*/ +extern void comerr(const char *, ...) __printflike__(1, 2); +/*PRINTFLIKE2*/ +extern void comerrno(int, const char *, ...) __printflike__(2, 3); +/*PRINTFLIKE1*/ +extern int errmsg(const char *, ...) __printflike__(1, 2); +/*PRINTFLIKE2*/ +extern int errmsgno(int, const char *, ...) __printflike__(2, 3); +#ifdef FOUND_SIZE_T +/*PRINTFLIKE3*/ +extern int serrmsg(char *, size_t, const char *, ...) __printflike__(3, 4); +/*PRINTFLIKE4*/ +extern int serrmsgno(int, char *, size_t, const char *, ...) __printflike__(4, 5); +#endif +extern void comexit(int); +extern char *errmsgstr(int); +/*PRINTFLIKE1*/ +extern int schily_error(const char *, ...) __printflike__(1, 2); +extern char *fillbytes(void *, int, char); +extern char *findbytes(const void *, int, char); +extern int findline(const char *, char, const char *, int, char **, int); +extern int rols_getline(char *, int); +extern int getstr(char *, int); +extern int breakline(char *, char, char **, int); +extern int getallargs(int *, char * const**, const char *, ...); +extern int getargs(int *, char * const**, const char *, ...); +extern int getfiles(int *, char * const**, const char *); +extern char *astoi(const char *, int *); +extern char *astol(const char *, long *); +extern char *astolb(const char *, long *, int base); +#ifdef _UTYPES_H +extern char *astoll(const char *, Llong *); +extern char *astollb(const char *, Llong *, int); +extern char *astoull(const char *, Ullong *); +extern char *astoullb(const char *, Ullong *, int); +#endif + +/*extern void handlecond __PR((const char *, SIGBLK *, int(*)(const char *, long, long), long));*/ +/*extern void unhandlecond __PR((SIGBLK *));*/ + +extern int patcompile(const unsigned char *, int, int *); +extern unsigned char *patmatch(const unsigned char *, const int *, + const unsigned char *, int, int, int, int[]); +extern unsigned char *patlmatch(const unsigned char *, const int *, + const unsigned char *, int, int, int, int[]); + +extern char *movebytes(const void *, void *, int); + +extern void save_args(int, char **); +extern int saved_ac(void); +extern char **saved_av(void); +extern char *saved_av0(void); +#ifndef seterrno +extern int seterrno(int); +#endif +extern void set_progname(const char *); +extern char *get_progname(void); + +extern void setfp(void * const *); +extern int wait_chld(int); /* for fspawnv_nowait() */ +extern int geterrno(void); +extern void raisecond(const char *, long); +extern char *strcatl(char *, ...); +extern int streql(const char *, const char *); +#ifdef va_arg +extern int format(void (*)(char, long), long, const char *, va_list); +#else +extern int format(void (*)(char, long), long, const char *, void *); +#endif + +extern int ftoes(char *, double, int, int); +extern int ftofs(char *, double, int, int); + +extern void swabbytes(void *, int); +extern char **getmainfp(void); +extern char **getavp(void); +extern char *getav0(void); +extern void **getfp(void); +extern int flush_reg_windows(int); +extern int cmpbytes(const void *, const void *, int); +extern int cmpnullbytes(const void *, int); + +#ifdef nonono +#if defined(HAVE_LARGEFILES) +/* + * To allow this, we need to figure out how to do autoconfiguration for off64_t + */ +extern FILE *_fcons64(FILE *, int, int); +extern FILE *fdup64(FILE *); +extern FILE *fileluopen64(int, const char *); +extern FILE *fileopen64(const char *, const char *); +#ifdef FOUND_OFF_T +extern off64_t filepos64(FILE *); +#endif +extern FILE *filereopen64(const char *, const char *, FILE *); +#ifdef FOUND_OFF_T +extern int fileseek64(FILE *, off64_t); +extern off64_t filesize64(FILE *); +#endif +#ifdef S_IFMT +extern int filestat64(FILE *, struct stat *); +#endif +extern int _openfd64(const char *, int); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#if defined(_JOS) || defined(JOS) +# ifndef _JOS_IO_H +# include <jos_io.h> +# endif +#endif + +#endif /* _SCHILY_H */ diff --git a/include/sigblk.h b/include/sigblk.h new file mode 100644 index 0000000..afb125a --- /dev/null +++ b/include/sigblk.h @@ -0,0 +1,80 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)sigblk.h 1.10 03/07/10 Copyright 1985, 1995-2003 J. Schilling */ +/* + * software signal block definition + * + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SIGBLK_H +#define _SIGBLK_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _STANDARD_H +#include <standard.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct sigblk { + long **sb_savfp; /* Real saved framepointer */ + struct sigblk *sb_signext; /* Next sw signal blk for this func */ + short sb_siglen; /* Strlen for sb_signame */ + const char *sb_signame; /* Name of software signal */ + + /* sb_sigfun: function to call */ + int (*sb_sigfun)(const char *, long, long); + + long sb_sigarg; /* Second arg for sb_sigfun */ +} SIGBLK; + +/* + * The handler function is called with three arguments: + * + * 1) The name of the software signal + * 2) The argument from the handlecond() call + * 3) The argument from the raisecond() call + */ +typedef int (*handlefunc_t)(const char *, long, long); + +extern void handlecond(const char *, SIGBLK *, + int(*)(const char *, long, long), + long); +extern void raisecond(const char *, long); +extern void starthandlecond(SIGBLK *); +extern void unhandlecond(SIGBLK *); + +#ifdef __cplusplus +} +#endif + +#endif /* _SIGBLK_H */ diff --git a/include/sigdefs.h b/include/sigdefs.h new file mode 100644 index 0000000..8e8ba7e --- /dev/null +++ b/include/sigdefs.h @@ -0,0 +1,81 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)sigdefs.h 1.5 02/01/19 Copyright 1997 J. Schilling */ +/* + * Signal abstraction for BSD/SVR4 signals + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SIGDEFS_H +#define _SIGDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef HAVE_SIGSET +/* + * Try to by default use the function that sets up signal handlers in a way + * that does not reset the handler after it has been called. + */ +#define signal sigset +#endif + +#ifdef HAVE_SIGPROCMASK +#define block_sigs(a) { \ + sigset_t __new; \ + \ + sigfillset(&__new); \ + sigprocmask(SIG_BLOCK, &__new, &a);\ + } +#define unblock_sig(s) { \ + sigset_t __new; \ + \ + sigemptyset(&__new); \ + sigaddset(&__new, (s)); \ + sigprocmask(SIG_UNBLOCK, &__new, NULL);\ + } +#define restore_sigs(a) sigprocmask(SIG_SETMASK, &a, 0); + +#else /* !HAVE_SIGPROCMASK */ + +#define sigset_t int +#define block_sigs(a) a = sigblock(0xFFFFFFFF) +#define restore_sigs(a) sigsetmask(a); +#define unblock_sig(s) { \ + int __old, __new; \ + \ + block_sigs(__old); \ + __new = sigmask(s); \ + __new = __old & ~__new; \ + sigsetmask(__new); \ + } + +#endif /* HAVE_SIGPROCMASK */ + +#endif /* _SIGDEFS_H */ diff --git a/include/standard.h b/include/standard.h new file mode 100644 index 0000000..d884973 --- /dev/null +++ b/include/standard.h @@ -0,0 +1,165 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)standard.h 1.31 03/08/23 Copyright 1985 J. Schilling */ +/* + * standard definitions + * + * This file should be included past: + * + * mconfig.h / config.h + * stdio.h + * stdlib.h (better use stdxlib.h) + * unistd.h (better use unixstd.h) needed LARGEFILE support + * + * If you need stdio.h, you must include it before standard.h + * + * Copyright (c) 1985 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _STANDARD_H +#define _STANDARD_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifdef M68000 +# ifndef tos +# define JOS 1 +# endif +#endif + +/* + * fundamental constants + */ +#ifndef NULL +# define NULL 0 +#endif +#ifndef TRUE +# define TRUE 1 +# define FALSE 0 +#endif + +/* + * Program exit codes + */ +#define EX_BAD (-1) + +/* + * standard storage class definitions + */ +#define GLOBAL extern +#define IMPORT extern +#define EXPORT +#define INTERN static +#define LOCAL static +#define FAST register + +#ifndef PROTOTYPES +# ifndef const +# define const +# endif +# ifndef signed +# define signed +# endif +# ifndef volatile +# define volatile +# endif +#endif /* PROTOTYPES */ + +/* + * standard type definitions + * + * The hidden Schily BOOL definition is used in case we need to deal + * with other BOOL defines on systems we like to port to. + */ +typedef int __SBOOL; +typedef int BOOL; +#ifdef JOS +# ifndef __GNUC__ +# define NO_VOID +# endif +#endif +#ifdef NO_VOID + typedef int VOID; +# ifndef lint + typedef int void; +# endif +#else + typedef void VOID; +#endif + +#if defined(_INCL_SYS_TYPES_H) || defined(off_t) +# ifndef FOUND_OFF_T +# define FOUND_OFF_T +# endif +#endif +#if defined(_INCL_SYS_TYPES_H) || defined(size_t) +# ifndef FOUND_SIZE_T +# define FOUND_SIZE_T +# endif +#endif + +#ifdef __never_def__ +/* + * It turns out that we cannot use the folloginw definition because there are + * some platforms that do not behave application friendly. These are mainly + * BSD-4.4 based systems (which #undef a definition when size_t is available. + * We actually removed this code because of a problem with QNX Neutrino. + * For this reason, it is important not to include <sys/types.h> directly but + * via the Schily SING include files so we know whether it has been included + * before we come here. + */ +#if defined(_SIZE_T) || defined(_T_SIZE_) || defined(_T_SIZE) || \ + defined(__SIZE_T) || defined(_SIZE_T_) || \ + defined(_GCC_SIZE_T) || defined(_SIZET_) || \ + defined(__sys_stdtypes_h) || defined(___int_size_t_h) || defined(size_t) + +#ifndef FOUND_SIZE_T +# define FOUND_SIZE_T /* We already included a size_t definition */ +#endif +#endif +#endif /* __never_def__ */ + +#if defined(_JOS) || defined(JOS) +# ifndef _SCHILY_H +# include <schily.h> +# endif + +# ifndef _JOS_DEFS_H +# include <jos_defs.h> +# endif + +# ifndef _JOS_IO_H +# include <jos_io.h> +# endif +#endif + +#endif /* _STANDARD_H */ diff --git a/include/statdefs.h b/include/statdefs.h new file mode 100644 index 0000000..cfaa96d --- /dev/null +++ b/include/statdefs.h @@ -0,0 +1,350 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)statdefs.h 1.9 03/06/15 Copyright 1998 J. Schilling */ +/* + * Definitions for stat() file mode + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _STATDEFS_H +#define _STATDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> /* Needed for sys/stat.h */ +#define _INCL_SYS_TYPES_H +#endif +#ifndef _INCL_SYS_STAT_H +#include <sys/stat.h> /* For S_IS* and S_IF* */ +#define _INCL_SYS_STAT_H +#endif + +/* + * Apollo Domain/OS has a broken sys/stat.h that defines + * S_IFIFO == S_IFSOCK and creates trouble if the constants + * are used as case labels. + */ +#if S_IFIFO == S_IFSOCK +# undef S_IFSOCK +#endif + +#ifdef STAT_MACROS_BROKEN +#undef S_ISFIFO /* Named pipe */ +#undef S_ISCHR /* Character special */ +#undef S_ISMPC /* UNUSED multiplexed c */ +#undef S_ISDIR /* Directory */ +#undef S_ISNAM /* Named file (XENIX) */ +#undef S_ISBLK /* Block special */ +#undef S_ISMPB /* UNUSED multiplexed b */ +#undef S_ISREG /* Regular file */ +#undef S_ISCNT /* Contiguous file */ +#undef S_ISLNK /* Symbolic link */ +#undef S_ISSHAD /* Solaris shadow inode */ +#undef S_ISSOCK /* UNIX domain socket */ +#undef S_ISDOOR /* Solaris DOOR */ +#undef S_ISWHT /* BSD whiteout */ +#undef S_ISEVC /* UNOS eventcount */ +#endif + +#ifndef S_ISFIFO /* 1 Named pipe */ +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) (0) +# endif +#endif +#ifndef S_ISCHR /* 2 Character special */ +# ifdef S_IFCHR +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +# else +# define S_ISCHR(m) (0) +# endif +#endif +#ifndef S_ISMPC /* 3 UNUSED multiplexed char */ +# ifdef S_IFMPC +# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) +# else +# define S_ISMPC(m) (0) +# endif +#endif +#ifndef S_ISDIR /* 4 Directory */ +# ifdef S_IFDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(m) (0) +# endif +#endif +#ifndef S_ISNAM /* 5 Named file (XENIX) */ +# ifdef S_IFNAM +# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) +# else +# define S_ISNAM(m) (0) +# endif +#endif +#ifndef S_ISBLK /* 6 Block special */ +# ifdef S_IFBLK +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +# else +# define S_ISBLK(m) (0) +# endif +#endif +#ifndef S_ISMPB /* 7 UNUSED multiplexed block */ +# ifdef S_IFMPB +# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) +# else +# define S_ISMPB(m) (0) +# endif +#endif +#ifndef S_ISREG /* 8 Regular file */ +# ifdef S_IFREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# else +# define S_ISREG(m) (0) +# endif +#endif +#ifndef S_ISCNT /* 9 Contiguous file */ +# ifdef S_IFCNT +# define S_ISCNT(m) (((m) & S_IFMT) == S_IFCNT) +# else +# define S_ISCNT(m) (0) +# endif +#endif +#ifndef S_ISLNK /* 10 Symbolic link */ +# ifdef S_IFLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(m) (0) +# endif +#endif +#ifndef S_ISSHAD /* 11 Solaris shadow inode */ +# ifdef S_IFSHAD +# define S_ISSHAD(m) (((m) & S_IFMT) == S_IFSHAD) +# else +# define S_ISSHAD(m) (0) +# endif +#endif +#ifndef S_ISSOCK /* 12 UNIX domain socket */ +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) (0) +# endif +#endif +#ifndef S_ISDOOR /* 13 Solaris DOOR */ +# ifdef S_IFDOOR +# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR) +# else +# define S_ISDOOR(m) (0) +# endif +#endif +#ifndef S_ISWHT /* 14 BSD whiteout */ +# ifdef S_IFWHT +# define S_ISWHT(m) (((m) & S_IFMT) == S_ISWHT) +# else +# define S_ISWHT(m) (0) +# endif +#endif +#ifndef S_IFEVC /* 15 UNOS eventcount */ +# ifdef S_IFEVC +# define S_ISEVC(m) (((m) & S_IFMT) == S_IFEVC) +# else +# define S_ISEVC(m) (0) +# endif +#endif + +#ifndef S_TYPEISMQ +/* + * XXX ??? where is a definition of a message queue ??? + */ +# define S_TYPEISMQ(_stbuf) (0) +#endif +#ifndef S_TYPEISSEM +# ifdef S_INSEM +# define S_TYPEISSEM(_stbuf) (S_ISNAM((_stbuf)->st_mode) && (_stbuf)->st_rdev == S_INSEM) +# else +# define S_TYPEISSEM(_stbuf) (0) +# endif +#endif +#ifndef S_TYPEISSHM +# ifdef S_INSHD +# define S_TYPEISSHM(_stbuf) (S_ISNAM((_stbuf)->st_mode) && (_stbuf)->st_rdev == S_INSHD) +# else +# define S_TYPEISSHM(_stbuf) (0) +# endif +#endif + +/* + * Mode permission bits. + * UNIX V.7 has only S_ISUID/S_ISGID/S_ISVTX and S_IREAD/S_IWRITE/S_IEXEC + */ +#ifndef S_ISUID /* Set-user-ID on execution */ +#define S_ISUID 0 /* If it is not defined, it is not supported */ +#endif +#ifndef S_ISGID /* Set-group-ID on execution */ +#define S_ISGID 0 /* If it is not defined, it is not supported */ +#endif +#ifndef S_ISVTX /* On directories, restricted deletion flag */ +#define S_ISVTX 0 /* If it is not defined, it is not supported */ +#endif + +#ifndef S_IRUSR /* Read permission, owner */ +#ifdef S_IREAD +#define S_IRUSR S_IREAD /* Needed on old UNIX systems */ +#else +#define S_IRUSR 0400 +#endif +#endif +#ifndef S_IWUSR /* Write permission, owner */ +#ifdef S_IWRITE +#define S_IWUSR S_IWRITE /* Needed on old UNIX systems */ +#else +#define S_IWUSR 0200 +#endif +#endif +#ifndef S_IXUSR /* Execute/search permission, owner */ +#ifdef S_IEXEC +#define S_IXUSR S_IEXEC /* Needed on old UNIX systems */ +#else +#define S_IXUSR 0100 +#endif +#endif +#ifndef S_IRGRP /* Read permission, group */ +#ifdef S_IREAD +#define S_IRGRP (S_IREAD >> 3) /* Needed on old UNIX systems */ +#else +#define S_IRGRP 040 +#endif +#endif +#ifndef S_IWGRP /* Write permission, group */ +#ifdef S_IWRITE +#define S_IWGRP (S_IWRITE >> 3) /* Needed on old UNIX systems */ +#else +#define S_IWGRP 020 +#endif +#endif +#ifndef S_IXGRP /* Execute/search permission, group */ +#ifdef S_IEXEC +#define S_IXGRP (S_IEXEC >> 3) /* Needed on old UNIX systems */ +#else +#define S_IXGRP 010 +#endif +#endif +#ifndef S_IROTH /* Read permission, others */ +#ifdef S_IREAD +#define S_IROTH (S_IREAD >> 6) /* Needed on old UNIX systems */ +#else +#define S_IROTH 004 +#endif +#endif +#ifndef S_IWOTH /* Write permission, others */ +#ifdef S_IWRITE +#define S_IWOTH (S_IWRITE >> 6) /* Needed on old UNIX systems */ +#else +#define S_IWOTH 002 +#endif +#endif +#ifndef S_IXOTH /* Execute/search permission, others */ +#ifdef S_IEXEC +#define S_IXOTH (S_IEXEC >> 6) /* Needed on old UNIX systems */ +#else +#define S_IXOTH 001 +#endif +#endif + +#ifndef S_IRWXU /* Read, write, execute/search by owner */ +#define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR) +#endif +#ifndef S_IRWXG /* Read, write, execute/search by group */ +#define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP) +#endif +#ifndef S_IRWXO /* Read, write, execute/search by others */ +#define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH) +#endif + +/* + * SCO UnixWare has st_atim.st__tim.tv_nsec but the st_atim.tv_nsec tests also + * succeeds. If we use st_atim.tv_nsec on UnixWare, we get a warning about + * illegal structure usage. For this reason, our code needs to have + * #ifdef HAVE_ST__TIM before #ifdef HAVE_ST_NSEC. + */ +#if defined(HAVE_ST_ATIMENSEC) + +#define stat_ansecs(s) ((s)->st_atimensec) +#define stat_mnsecs(s) ((s)->st_mtimensec) +#define stat_cnsecs(s) ((s)->st_ctimensec) + +#define _FOUND_STAT_NSECS_ +#endif + +#if defined(HAVE_ST_SPARE1) && !defined(_FOUND_STAT_NSECS_) + +#define stat_ansecs(s) ((s)->st_spare1 * 1000) +#define stat_mnsecs(s) ((s)->st_spare2 * 1000) +#define stat_cnsecs(s) ((s)->st_spare3 * 1000) + +#define _FOUND_STAT_USECS_ +#define _FOUND_STAT_NSECS_ +#endif + +#if defined(HAVE_ST__TIM) && !defined(_FOUND_STAT_NSECS_) + +#define stat_ansecs(s) ((s)->st_atim.st__tim.tv_nsec) +#define stat_mnsecs(s) ((s)->st_mtim.st__tim.tv_nsec) +#define stat_cnsecs(s) ((s)->st_ctim.st__tim.tv_nsec) + +#define _FOUND_STAT_NSECS_ +#endif + +#if defined(HAVE_ST_NSEC) && !defined(_FOUND_STAT_NSECS_) + +#define stat_ansecs(s) ((s)->st_atim.tv_nsec) +#define stat_mnsecs(s) ((s)->st_mtim.tv_nsec) +#define stat_cnsecs(s) ((s)->st_ctim.tv_nsec) + +#define _FOUND_STAT_NSECS_ +#endif + +#if defined(HAVE_ST_ATIMESPEC) && !defined(_FOUND_STAT_NSECS_) + +#define stat_ansecs(s) ((s)->st_atimespec.tv_nsec) +#define stat_mnsecs(s) ((s)->st_mtimespec.tv_nsec) +#define stat_cnsecs(s) ((s)->st_ctimespec.tv_nsec) + +#define _FOUND_STAT_NSECS_ +#endif + +#if !defined(_FOUND_STAT_NSECS_) +#define stat_ansecs(s) (0) +#define stat_mnsecs(s) (0) +#define stat_cnsecs(s) (0) +#endif + +#endif /* _STATDEFS_H */ diff --git a/include/stdxlib.h b/include/stdxlib.h new file mode 100644 index 0000000..cf377af --- /dev/null +++ b/include/stdxlib.h @@ -0,0 +1,65 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)stdxlib.h 1.6 01/07/15 Copyright 1996 J. Schilling */ +/* + * Definitions for stdlib + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _STDXLIB_H +#define _STDXLIB_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef HAVE_STDLIB_H +#ifndef _INCL_STDLIB_H +#include <stdlib.h> +#define _INCL_STDLIB_H +#endif +#else + +extern char *malloc(); +extern char *realloc(); + +extern double atof(); + +#endif /* HAVE_STDLIB_H */ + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif +#ifndef RAND_MAX +#define RAND_MAX 32767 +#endif + +#endif /* _STDXLIB_H */ diff --git a/include/stkframe.h b/include/stkframe.h new file mode 100644 index 0000000..fc1ae22 --- /dev/null +++ b/include/stkframe.h @@ -0,0 +1,101 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)stkframe.h 1.10 03/06/15 Copyright 1995 J. Schilling */ +/* + * Common definitions for routines that parse the stack frame. + * + * This file has to be fixed if you want to port routines which use getfp(). + * Have a look at struct frame below and use it as a sample, + * the new struct frame must at least contain a member 'fr_savfp'. + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _STKFRAME_H +#define _STKFRAME_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#if defined(sun) && (defined(SVR4) || defined(__SVR4) || defined(__SVR4__)) + /* + * Solaris 2.x aka SunOS 5.x + */ +# ifdef i386 + /* + * On Solaris 2.1 x86 sys/frame.h is not useful at all + * On Solaris 2.4 x86 sys/frame.h is buggy (fr_savfp is int!!) + */ +# ifndef _INCL_SYS_REG_H +# include <sys/reg.h> +# define _INCL_SYS_REG_H +# endif +# endif +# ifndef _INCL_SYS_FRAME_H +# include <sys/frame.h> +# define _INCL_SYS_FRAME_H +# endif + +#else +# if defined(sun) + /* + * SunOS 4.x + */ +# ifndef _INCL_MACHINE_FRAME_H +# include <machine/frame.h> +# define _INCL_MACHINE_FRAME_H +# endif +# else + /* + * Anything that is not SunOS + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX: I hope this will be useful on other machines (no guarantee) + * XXX: It is taken from a sun Motorola system, but should also be useful + * XXX: on a i386. + * XXX: In general you have to write a sample program, set a breakpoint + * XXX: on a small function and inspect the stackframe with adb. + */ + +struct frame { + struct frame *fr_savfp; /* saved frame pointer */ + int fr_savpc; /* saved program counter */ + int fr_arg[1]; /* array of arguments */ +}; + +#ifdef __cplusplus +} +#endif + +# endif /* ! defined (sun) */ +#endif /* ! defined (sun) && (defined(SVR4) || defined(__SVR4) || defined(__SVR4__)) */ + +#endif /* _STKFRAME_H */ diff --git a/include/strdefs.h b/include/strdefs.h new file mode 100644 index 0000000..36bdcaa --- /dev/null +++ b/include/strdefs.h @@ -0,0 +1,125 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)strdefs.h 1.8 03/03/09 Copyright 1996 J. Schilling */ +/* + * Definitions for strings + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _STRDEFS_H +#define _STRDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +/* + * It may be that IBM's AIX has problems when doing + * #include <string.h> + * #include <strings.h> + * So I moved the #include <strings.h> to the top. As the file strings.h + * defines strcasecmp() we may need it... + * + * Note that the only real problem appears if we use rubbish FSF based code that + * #defines _NO_PROTO + */ +#ifdef HAVE_STRINGS_H +#ifndef _INCL_STRINGS_H +#include <strings.h> +#define _INCL_STRINGS_H +#endif +#endif /* HAVE_STRINGS_H */ + + +#ifdef HAVE_STRING_H +#ifndef _INCL_STRING_H +#include <string.h> +#define _INCL_STRING_H +#endif +#else /* HAVE_STRING_H */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#define NULL 0 +#endif + +extern void *memcpy(void *, const void *, int); +extern void *memmove(void *, const void *, int); +extern char *strcpy(char *, const char *); +extern char *strncpy(char *, const char *, int); + +extern char *strcat(char *, const char *); +extern char *strncat(char *, const char *, int); + +extern int memcmp(const void *, const void *, int); +extern int strcmp(const char *, const char *); +extern int strcoll(const char *, const char *); +extern int strncmp(const char *, const char *, int); +extern int strxfrm(char *, const char *, int); + +extern void *memchr(const void *, int, int); +extern char *strchr(const char *, int); + +extern int strcspn(const char *, const char *); +/*#pragma int_to_unsigned strcspn*/ + +extern char *strpbrk(const char *, const char *); +extern char *strrchr(const char *, int); + +extern int strspn(const char *, const char *); +/*#pragma int_to_unsigned strspn*/ + +extern char *strstr(const char *, const char *); +extern char *strtok(char *, const char *); +extern void *memset(void *, int, int); +extern char *strerror(int); + +extern int strlen(const char *); +/*#pragma int_to_unsigned strlen*/ + +extern void *memccpy(void *, const void *, int, int); + +extern int strcasecmp(const char *, const char *); +extern int strncasecmp(const char *, const char *, int); + +/*#define index strchr*/ +/*#define rindex strrchr*/ + +#ifdef __cplusplus +} +#endif + +#endif /* HAVE_STRING_H */ + +#endif /* _STRDEFS_H */ diff --git a/include/termcap.h b/include/termcap.h new file mode 100644 index 0000000..b220b2a --- /dev/null +++ b/include/termcap.h @@ -0,0 +1,73 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)termcap.h 1.6 03/06/15 Copyright 1995 J. Schilling */ +/* + * Copyright (c) 1995 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _TERMCAP_H +#define _TERMCAP_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Flags for tcsetflags() + */ +#define TCF_NO_TC 0x0001 /* Don't follow tc= entries */ +#define TCF_NO_SIZE 0x0002 /* Don't get actual ttysize (li#/co#)*/ +#define TCF_NO_STRIP 0x0004 /* Don't strip down termcap buffer */ + +extern char PC; /* Pad character */ +extern char *BC; /* Backspace if not "\b" from "bc" capability*/ +extern char *UP; /* Cursor up string from "up" capability */ +extern short ospeed; /* output speed coded as in ioctl */ + +extern int tgetent(char *bp, char *name); +extern int tcsetflags(int flags); +extern char *tcgetbuf(void); +extern int tgetnum(char *ent); +extern BOOL tgetflag(char *ent); +extern char *tgetstr(char *ent, char **array); +extern char *tdecode(char *ep, char **array); + +extern int tputs(char *cp, int affcnt, int (*outc)(int c)); +extern char *tgoto(char *cm, int destcol, int destline); + +#ifdef __cplusplus +} +#endif + +#endif /* _TERMCAP_H */ diff --git a/include/test_BITFIELDS_HTOL.c b/include/test_BITFIELDS_HTOL.c new file mode 100644 index 0000000..674c457 --- /dev/null +++ b/include/test_BITFIELDS_HTOL.c @@ -0,0 +1,23 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* test_BITFIELD_HTOL.c derived from cdrtools aclocal.m4 by Joerg Schilling */ +/* Return 1 if bitfields are high-to-low, 0 if bitfields are low-to-high */ +int main() +{ + union { + unsigned char ch; + struct { unsigned char bf1:4, bf2:4; } bf; + } u; + u.ch = 0x12; + return (u.bf.bf1 == 1); +} diff --git a/include/test_VA_LIST_IS_ARRAY.c b/include/test_VA_LIST_IS_ARRAY.c new file mode 100644 index 0000000..2cd80c7 --- /dev/null +++ b/include/test_VA_LIST_IS_ARRAY.c @@ -0,0 +1,21 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +#include <stdarg.h> + +int main() { + +va_list a, b; + +a = b; +; return 0; } + diff --git a/include/timedefs.h b/include/timedefs.h new file mode 100644 index 0000000..08a9145 --- /dev/null +++ b/include/timedefs.h @@ -0,0 +1,143 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)timedefs.h 1.13 05/08/22 Copyright 1996 J. Schilling */ +/* + * Generic header for users of time(), gettimeofday() ... + * + * It includes definitions for time_t, struct timeval, ... + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _TIMEDEFS_H +#define _TIMEDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> /* Needed for time_t */ +#define _INCL_SYS_TYPES_H +#endif + +#ifdef TIME_WITH_SYS_TIME +# ifndef _INCL_SYS_TIME_H +# include <sys/time.h> +# define _INCL_SYS_TIME_H +# endif +# ifndef _INCL_TIME_H +# include <time.h> +# define _INCL_TIME_H +# endif +#else +#ifdef HAVE_SYS_TIME_H +# ifndef _INCL_SYS_TIME_H +# include <sys/time.h> +# define _INCL_SYS_TIME_H +# endif +#else +# ifndef _INCL_TIME_H +# include <time.h> +# define _INCL_TIME_H +# endif +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__CYGWIN32__) || defined(__EMX__) || defined(__linux__) || defined(__DJGPP__) +/* + * Cygnus defines struct timeval in sys/time.h but not timerclear + * timerclear is defined in windows32/Sockets.h ??? + * + * EMX for OS/2 defines struct timeval in sys/time.h but not timerclear + * + * Linux defines struct timeval in sys/time.h but if __USE_BSD is not + * defined, timerclear is missing. + */ +#ifndef timerclear +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#endif +#endif + +#ifndef timerclear + +#ifndef VMS +struct timeval { + long tv_sec; + long tv_usec; +}; +#endif + +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 + +#endif + +#undef timerfix +#define timerfix1(tvp) while ((tvp)->tv_usec < 0) { \ + (tvp)->tv_sec--; \ + (tvp)->tv_usec += 1000000; \ + } + +#define timerfix2(tvp) while ((tvp)->tv_usec > 1000000) { \ + (tvp)->tv_sec++; \ + (tvp)->tv_usec -= 1000000; \ + } + +#define timerfix(tvp) do { timerfix1(tvp); timerfix2(tvp); } while (0) + +/* + * timersub() and timeradd() are defined on FreeBSD with a different + * interface (3 parameters). + */ +#undef timersub +#define timersub(tvp1, tvp2) do { \ + (tvp1)->tv_sec -= (tvp2)->tv_sec; \ + (tvp1)->tv_usec -= (tvp2)->tv_usec; \ + timerfix1(tvp1); timerfix2(tvp1); \ + } while (0) + +#undef timeradd +#define timeradd(tvp1, tvp2) do { \ + (tvp1)->tv_sec += (tvp2)->tv_sec; \ + (tvp1)->tv_usec += (tvp2)->tv_usec; \ + timerfix1(tvp1); timerfix2(tvp1); \ + } while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* _TIMEDEFS_H */ diff --git a/include/ttydefs.h b/include/ttydefs.h new file mode 100644 index 0000000..8eed081 --- /dev/null +++ b/include/ttydefs.h @@ -0,0 +1,131 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)ttydefs.h 1.26 03/02/28 Copyright 1984-2003 J. Schilling */ +/* + * Terminal driver tty mode handling + * + * Copyright (c) 1984-2003 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef _TTYDEFS_H +#define _TTYDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#ifdef JOS +# include <ttymodes.h> +# include <spfcode.h> +#else +#ifdef HAVE_TERMIOS_H +# include <termios.h> +# define _INCL_TERMIOS_H +# ifdef TIOCGETA /* FreeBSD */ +# define TCGETS TIOCGETA +# define TCSETSW TIOCSETAW +# endif +# ifdef TCGETATTR +# define TCGETS TCGETATTR +# define TCSETSW TCSETATTRD +# endif +#else +# ifdef HAVE_TERMIO_H +# include <termio.h> +# define _INCL_TERMIO_H +# ifndef TCGETS +# define termios termio +# define TCGETS TCGETA +# define TCSETSW TCSETAW +# endif +# else +# define USE_V7_TTY +# endif +#endif +#endif + +#if !defined(HAVE_TCGETATTR) || !defined(HAVE_TCSETATTR) +# undef TCSANOW +#endif + +#ifndef TCSANOW +# if !defined(TCGETS) || !defined(TCSETSW) +# define USE_V7_TTY +# endif +#endif + +#if !defined(_INCL_TERMIOS_H) && !defined(_INCL_TERMIO_H) +#ifdef HAVE_SYS_IOCTL_H +# ifndef _INCL_SYS_IOCTl_H +# include <sys/ioctl.h> +# define _INCL_SYS_IOCTL_H +# endif +#endif +#endif + +#ifdef HAVE_SYS_BSDTTY_H +#include <sys/bsdtty.h> +#endif + +#if !defined(TIOCGWINSZ) && ! defined(TIOCGSIZE) +# ifndef _INCL_SYS_IOCTl_H +# include <sys/ioctl.h> +# define _INCL_SYS_IOCTL_H +# endif +#endif + +#ifndef OXTABS /* OS/2 EMX */ +#define OXTABS 0 +#endif +#ifndef XTABS +# ifndef TAB3 /* FreeBSD */ +# define TABDLY OXTABS +# define XTABS OXTABS +# else +# define XTABS TAB3 +# endif +#endif +#ifndef ONLCR /* OS/2 EMX */ +#define ONLCR 0 +#endif +#ifndef OCRNL /* FreeBSD */ +# define OCRNL 0 +#endif +#ifndef ONLRET /* FreeBSD */ +# define ONLRET 0 +#endif +#ifndef _POSIX_VDISABLE +# define _POSIX_VDISABLE 0 +#endif + +#endif /* _TTYDEFS_H */ diff --git a/include/unixstd.h b/include/unixstd.h new file mode 100644 index 0000000..16c8816 --- /dev/null +++ b/include/unixstd.h @@ -0,0 +1,132 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)unixstd.h 1.12 04/06/17 Copyright 1996 J. Schilling */ +/* + * Definitions for unix system interface + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _UNIXSTD_H +#define _UNIXSTD_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef HAVE_UNISTD_H + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif +#ifndef _INCL_UNISTD_H +#include <unistd.h> +#define _INCL_UNISTD_H +#endif + +#ifndef _SC_PAGESIZE +#ifdef _SC_PAGE_SIZE /* HP/UX & OSF */ +#define _SC_PAGESIZE _SC_PAGE_SIZE +#endif +#endif + +#else /* HAVE_UNISTD_H */ + +/* + * unistd.h grants things like off_t to be typedef'd. + */ +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#endif /* HAVE_UNISTD_H */ + +#ifndef STDIN_FILENO +# ifdef JOS +# ifndef _JOS_IO_H +# include <jos_io.h> +# endif +# else +# define STDIN_FILENO 0 +# define STDOUT_FILENO 1 +# define STDERR_FILENO 2 +# endif +#endif + +#ifndef R_OK +/* 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 */ +#endif +#ifndef E_OK +#ifdef HAVE_ACCESS_E_OK +#ifdef EFF_ONLY_OK +#define E_OK EFF_ONLY_OK /* Irix */ +#else +#ifdef EUID_OK +#define E_OK EUID_OK /* UNICOS (0400) */ +#else +#define E_OK 010 /* Test effective uids */ +#endif /* EUID_OK */ +#endif /* EFF_ONLY_OK */ +#else +#define E_OK 0 +#endif /* HAVE_ACCESS_E_OK */ +#endif /* !E_OK */ + +/* 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(HAVE_UNISTD_H) || !defined(_POSIX_VERSION) +/* + * Maybe we need a lot more definitions here... + * It is not clear whether we should have prototyped definitions. + */ +extern int access(const char *, int); +extern int close(int); +extern int dup(int); +extern int dup2(int, int); +extern void _exit(int); +extern int link(const char *, const char *); +extern int read(int, void *, size_t); +extern int unlink(const char *); +extern int write(int, void *, size_t); +#endif + +#endif /* _UNIXSTD_H */ diff --git a/include/unls.h b/include/unls.h new file mode 100644 index 0000000..8a5c633 --- /dev/null +++ b/include/unls.h @@ -0,0 +1,85 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)unls.h 1.6 05/04/21 Copyright 2000-2005 J. Schilling */ +/* + * Definitions fur users of libunls + * + * Copyright (c) 2000-2005 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _UNLS_H +#define _UNLS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifdef USE_ICONV +#include <iconv.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct unls_unicode { + unsigned char unls_low; /* Low Byte */ + unsigned char unls_high; /* High Byte */ +}; + +struct unls_table { + char *unls_name; /* UNLS charset name */ + unsigned char **unls_uni2cs; /* Unicode -> Charset */ + struct unls_unicode *unls_cs2uni; /* Charset -> Unicode */ + struct unls_table *unls_next; /* Next table */ +#ifdef USE_ICONV + iconv_t iconv_d; +#endif +}; + +extern int init_unls(void); +extern int register_unls(struct unls_table *); +extern int unregister_unls(struct unls_table *); +extern struct unls_table *find_unls(char *); +extern void list_unls(void); +extern struct unls_table *load_unls(char *); +extern void unload_unls(struct unls_table *); +extern struct unls_table *load_unls_default(void); +extern int init_unls_file(char * name); + +#ifdef USE_ICONV +extern int init_nls_iconv(char * name); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _UNLS_H */ diff --git a/include/usal b/include/usal new file mode 120000 index 0000000..02d7e2f --- /dev/null +++ b/include/usal @@ -0,0 +1 @@ +../libusal/usal
\ No newline at end of file diff --git a/include/utimdefs.h b/include/utimdefs.h new file mode 100644 index 0000000..d54af42 --- /dev/null +++ b/include/utimdefs.h @@ -0,0 +1,87 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)utimdefs.h 1.5 03/06/15 Copyright 2001 J. Schilling */ +/* + * Defines for utimes() / utime() + * + * Copyright (c) 2001 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _UTIMDEFS_H +#define _UTIMDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#ifdef HAVE_UTIMES +#ifndef _TIMEDEFS_H +#include <timedefs.h> +#endif +#endif + +#ifdef HAVE_UTIME_H +#ifndef _INCL_UTIME_H +#include <utime.h> +#define _INCL_UTIME_H +#endif +#else +#ifdef HAVE_SYS_UTIME_H +#ifndef _INCL_SYS_UTIME_H +#include <sys/utime.h> +#define _INCL_SYS_UTIME_H +#endif +#else +struct utimbuf { + time_t actime; + time_t modtime; +}; +#endif +#endif + +#ifdef __comment__ +/* + * file.c contains this + * I am not sure if it is really needed. + * It may be a good idea to add a test for HAVE_STRUCT_UTIMBUF + * as in gnutar. + */ +#if (__COHERENT__ >= 0x420) +# include <sys/utime.h> +#else +# include <utime.h> +#endif + +#endif /* __comment__ */ + + +#endif /* _UTIMDEFS_H */ diff --git a/include/utypes.h b/include/utypes.h new file mode 100644 index 0000000..9a4049f --- /dev/null +++ b/include/utypes.h @@ -0,0 +1,440 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)utypes.h 1.15 05/11/06 Copyright 1997 J. Schilling */ +/* + * Definitions for some user defined types + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _UTYPES_H +#define _UTYPES_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +/* + * Include limits.h for CHAR_BIT + */ +#ifdef HAVE_LIMITS_H +#ifndef _INCL_LIMITS_H +#include <limits.h> +#define _INCL_LIMITS_H +#endif +#endif + +/* + * Include sys/param.h for NBBY + */ +#ifdef HAVE_SYS_PARAM_H +#ifndef _INCL_SYS_PARAM_H +#include <sys/param.h> +#define _INCL_SYS_PARAM_H +#endif +#endif + +#ifndef CHAR_BIT +#ifdef NBBY +#define CHAR_BIT NBBY +#endif +#endif + +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif + +/* + * These macros may not work on all platforms but as we depend + * on two's complement in many places, they do not reduce portability. + * The macros below work with 2s complement and ones complement machines. + * Verify with this table... + * + * Bits 1's c. 2's complement. + * 100 -3 -4 + * 101 -2 -3 + * 110 -1 -2 + * 111 -0 -1 + * 000 +0 0 + * 001 +1 +1 + * 010 +2 +2 + * 011 +3 +3 + * + * Computing -TYPE_MINVAL(type) will not work on 2's complement machines + * if 'type' is int or more. Use -(UIntmax_t)TYPE_MINVAL(type), it works + * for both 1's complement and 2's complement machines. + */ +#define TYPE_ISSIGNED(t) (((t)-1) < ((t)0)) +#define TYPE_ISUNSIGNED(t) (!TYPE_ISSIGNED(t)) +#define TYPE_MSBVAL(t) ((t)(~((t)0) << (sizeof (t)*CHAR_BIT - 1))) +#define TYPE_MINVAL(t) (TYPE_ISSIGNED(t) \ + ? TYPE_MSBVAL(t) \ + : ((t)0)) +#define TYPE_MAXVAL(t) ((t)(~((t)0) - TYPE_MINVAL(t))) + +/* + * Let us include system defined types too. + */ +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +/* + * Several unsigned cardinal types + */ +typedef unsigned long Ulong; +typedef unsigned int Uint; +typedef unsigned short Ushort; +typedef unsigned char Uchar; + +/* + * This is a definition for a compiler dependant 64 bit type. + * It currently is silently a long if the compiler does not + * support it. Check if this is the right way. + */ +#ifndef NO_LONGLONG +# if defined(HAVE_LONGLONG) +# define USE_LONGLONG +# endif +#endif + +#ifdef USE_LONGLONG + +typedef long long Llong; +typedef unsigned long long Ullong; /* We should avoid this */ +typedef unsigned long long ULlong; + +#define SIZEOF_LLONG SIZEOF_LONG_LONG +#define SIZEOF_ULLONG SIZEOF_UNSIGNED_LONG_LONG + +#else + +typedef long Llong; +typedef unsigned long Ullong; /* We should avoid this */ +typedef unsigned long ULlong; + +#define SIZEOF_LLONG SIZEOF_LONG +#define SIZEOF_ULLONG SIZEOF_UNSIGNED_LONG + +#endif +#ifndef LLONG_MIN +#define LLONG_MIN TYPE_MINVAL(Llong) +#endif +#ifndef LLONG_MAX +#define LLONG_MAX TYPE_MAXVAL(Llong) +#endif +#ifndef ULLONG_MAX +#define ULLONG_MAX TYPE_MAXVAL(Ullong) +#endif + +/* + * The IBM AIX C-compiler seems to be the only compiler on the world + * which does not allow to use unsigned char bit fields as a hint + * for packed bit fields. Define a pesical type to avoid warnings. + * The packed attribute is honored wit unsigned int in this case too. + */ +#if defined(_AIX) && !defined(__GNUC__) + +typedef unsigned int Ucbit; + +#else + +typedef unsigned char Ucbit; + +#endif + +/* + * Start inttypes.h emulation. + * + * Thanks to Solaris 2.4 and even recent 1999 Linux versions, we + * cannot use the official UNIX-98 names here. Old Solaris versions + * define parts of the types in some exotic include files. + * Linux even defines incompatible types in <sys/types.h>. + */ + +#ifdef HAVE_INTTYPES_H +# ifndef _INCL_INTTYPES_H +# include <inttypes.h> +# define _INCL_INTTYPES_H +# endif +# define HAVE_INT64_T +# define HAVE_UINT64_T + +#define Int8_t int8_t +#define Int16_t int16_t +#define Int32_t int32_t +#define Int64_t int64_t +#define Intmax_t intmax_t +#define UInt8_t uint8_t +#define UInt16_t uint16_t +#define UInt32_t uint32_t +#define UInt64_t uint64_t +#define UIntmax_t uintmax_t + +#define Intptr_t intptr_t +#define UIntptr_t uintptr_t + +#else /* !HAVE_INTTYPES_H */ + +#if SIZEOF_CHAR != 1 || SIZEOF_UNSIGNED_CHAR != 1 +/* + * #error will not work for all compilers (e.g. sunos4) + * The following line will abort compilation on all compilers + * if the above is true. And that's what we want. + */ +error Sizeof char is not equal 1 +#endif + +typedef signed char Int8_t; + +#if SIZEOF_SHORT_INT == 2 + typedef short Int16_t; +#else + error No int16_t found +#endif + +#if SIZEOF_INT == 4 + typedef int Int32_t; +#else + error No int32_t found +#endif + +#if SIZEOF_LONG_INT == 8 + typedef long Int64_t; +# define HAVE_INT64_T +#else +#if SIZEOF_LONG_LONG == 8 + typedef long long Int64_t; +# define HAVE_INT64_T +#else +/* error No int64_t found*/ +#endif +#endif + +#if SIZEOF_CHAR_P == SIZEOF_INT + typedef int Intptr_t; +#else +#if SIZEOF_CHAR_P == SIZEOF_LONG_INT + typedef long Intptr_t; +#else + error No intptr_t found +#endif +#endif + +typedef unsigned char UInt8_t; + +#if SIZEOF_UNSIGNED_SHORT_INT == 2 + typedef unsigned short UInt16_t; +#else + error No uint16_t found +#endif + +#if SIZEOF_UNSIGNED_INT == 4 + typedef unsigned int UInt32_t; +#else + error No int32_t found +#endif + +#if SIZEOF_UNSIGNED_LONG_INT == 8 + typedef unsigned long UInt64_t; +# define HAVE_UINT64_T +#else +#if SIZEOF_UNSIGNED_LONG_LONG == 8 + typedef unsigned long long UInt64_t; +# define HAVE_UINT64_T +#else +/* error No uint64_t found*/ +#endif +#endif + +#define Intmax_t Llong +#define UIntmax_t Ullong + +#if SIZEOF_CHAR_P == SIZEOF_UNSIGNED_INT + typedef unsigned int UIntptr_t; +#else +#if SIZEOF_CHAR_P == SIZEOF_UNSIGNED_LONG_INT + typedef unsigned long UIntptr_t; +#else + error No uintptr_t found +#endif +#endif + +#endif /* HAVE_INTTYPES_H */ + +#ifndef CHAR_MIN +#define CHAR_MIN TYPE_MINVAL(char) +#endif +#ifndef CHAR_MAX +#define CHAR_MAX TYPE_MAXVAL(char) +#endif +#ifndef UCHAR_MAX +#define UCHAR_MAX TYPE_MAXVAL(unsigned char) +#endif + +#ifndef SHRT_MIN +#define SHRT_MIN TYPE_MINVAL(short) +#endif +#ifndef SHRT_MAX +#define SHRT_MAX TYPE_MAXVAL(short) +#endif +#ifndef USHRT_MAX +#define USHRT_MAX TYPE_MAXVAL(unsigned short) +#endif + +#ifndef INT_MIN +#define INT_MIN TYPE_MINVAL(int) +#endif +#ifndef INT_MAX +#define INT_MAX TYPE_MAXVAL(int) +#endif +#ifndef UINT_MAX +#define UINT_MAX TYPE_MAXVAL(unsigned int) +#endif + +#ifndef LONG_MIN +#define LONG_MIN TYPE_MINVAL(long) +#endif +#ifndef LONG_MAX +#define LONG_MAX TYPE_MAXVAL(long) +#endif +#ifndef ULONG_MAX +#define ULONG_MAX TYPE_MAXVAL(unsigned long) +#endif + +#ifndef INT8_MIN +#define INT8_MIN TYPE_MINVAL(Int8_t) +#endif +#ifndef INT8_MAX +#define INT8_MAX TYPE_MAXVAL(Int8_t) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX TYPE_MAXVAL(UInt8_t) +#endif + +#ifndef INT16_MIN +#define INT16_MIN TYPE_MINVAL(Int16_t) +#endif +#ifndef INT16_MAX +#define INT16_MAX TYPE_MAXVAL(Int16_t) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX TYPE_MAXVAL(UInt16_t) +#endif + +#ifndef INT32_MIN +#define INT32_MIN TYPE_MINVAL(Int32_t) +#endif +#ifndef INT32_MAX +#define INT32_MAX TYPE_MAXVAL(Int32_t) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX TYPE_MAXVAL(UInt32_t) +#endif + +#ifdef HAVE_INT64_T +#ifndef INT64_MIN +#define INT64_MIN TYPE_MINVAL(Int64_t) +#endif +#ifndef INT64_MAX +#define INT64_MAX TYPE_MAXVAL(Int64_t) +#endif +#endif +#ifdef HAVE_UINT64_T +#ifndef UINT64_MAX +#define UINT64_MAX TYPE_MAXVAL(UInt64_t) +#endif +#endif + +#ifndef INTMAX_MIN +#define INTMAX_MIN TYPE_MINVAL(Intmax_t) +#endif +#ifndef INTMAX_MAX +#define INTMAX_MAX TYPE_MAXVAL(Intmax_t) +#endif +#ifndef UINTMAX_MAX +#define UINTMAX_MAX TYPE_MAXVAL(UIntmax_t) +#endif + +#define SIZE_T_MIN TYPE_MINVAL(size_t) +#ifndef SIZE_T_MAX +#define SIZE_T_MAX TYPE_MAXVAL(size_t) +#endif + +#define SSIZE_T_MIN TYPE_MINVAL(ssize_t) +#define SSIZE_T_MAX TYPE_MAXVAL(ssize_t) + +#define OFF_T_MIN TYPE_MINVAL(off_t) +#define OFF_T_MAX TYPE_MAXVAL(off_t) + +#define UID_T_MIN TYPE_MINVAL(uid_t) +#define UID_T_MAX TYPE_MAXVAL(uid_t) + +#define GID_T_MIN TYPE_MINVAL(gid_t) +#define GID_T_MAX TYPE_MAXVAL(gid_t) + +#define PID_T_MIN TYPE_MINVAL(pid_t) +#define PID_T_MAX TYPE_MAXVAL(pid_t) + +#define MODE_T_MIN TYPE_MINVAL(mode_t) +#define MODE_T_MAX TYPE_MAXVAL(mode_t) + +#define TIME_T_MIN TYPE_MINVAL(time_t) +#define TIME_T_MAX TYPE_MAXVAL(time_t) + +#define CADDR_T_MIN TYPE_MINVAL(caddr_t) +#define CADDR_T_MAX TYPE_MAXVAL(caddr_t) + +#define DADDR_T_MIN TYPE_MINVAL(daddr_t) +#define DADDR_T_MAX TYPE_MAXVAL(daddr_t) + +#define DEV_T_MIN TYPE_MINVAL(dev_t) +#define DEV_T_MAX TYPE_MAXVAL(dev_t) + +#define MAJOR_T_MIN TYPE_MINVAL(major_t) +#define MAJOR_T_MAX TYPE_MAXVAL(major_t) + +#define MINOR_T_MIN TYPE_MINVAL(minor_t) +#define MINOR_T_MAX TYPE_MAXVAL(minor_t) + +#define INO_T_MIN TYPE_MINVAL(ino_t) +#define INO_T_MAX TYPE_MAXVAL(ino_t) + +#define NLINK_T_MIN TYPE_MINVAL(nlink_t) +#define NLINK_T_MAX TYPE_MAXVAL(nlink_t) + +#define BLKCNT_T_MIN TYPE_MINVAL(blkcnt_t) +#define BLKCNT_T_MAX TYPE_MAXVAL(blkcnt_t) + +#define CLOCK_T_MIN TYPE_MINVAL(clock_t) +#define CLOCK_T_MAX TYPE_MAXVAL(clock_t) + +#define SOCKLEN_T_MIN TYPE_MINVAL(socklen_t) +#define SOCKLEN_T_MAX TYPE_MAXVAL(socklen_t) + +#endif /* _UTYPES_H */ diff --git a/include/vadefs.h b/include/vadefs.h new file mode 100644 index 0000000..a686074 --- /dev/null +++ b/include/vadefs.h @@ -0,0 +1,131 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)vadefs.h 1.5 01/07/15 Copyright 1998 J. Schilling */ +/* + * Generic header for users of var args ... + * + * Includes a default definition for va_copy() + * and some magic know how about the SVr4 Power PC var args ABI + * to create a __va_arg_list() macro. + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _VADEFS_H +#define _VADEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef PROTOTYPES +/* + * For ANSI C-compilers prefer stdarg.h + */ +# ifdef HAVE_STDARG_H +# ifndef _INCL_STDARG_H +# include <stdarg.h> +# define _INCL_STDARG_H +# endif +# else +# ifndef _INCL_VARARGS_H +# include <varargs.h> +# define _INCL_VARARGS_H +# endif +# endif +#else +/* + * For K&R C-compilers prefer varargs.h + */ +# ifdef HAVE_VARARGS_H +# ifndef _INCL_VARARGS_H +# include <varargs.h> +# define _INCL_VARARGS_H +# endif +# else +# ifndef _INCL_STDARG_H +# include <stdarg.h> +# define _INCL_STDARG_H +# endif +# endif +#endif + +#if (defined(__linux__) || defined(__linux) || defined(sun)) && \ + (defined(__ppc) || defined(__PPC) || defined(powerpc) || defined(__powerpc__)) + +# ifndef VA_LIST_IS_ARRAY +# define VA_LIST_IS_ARRAY +# endif +#endif + + +/* + * __va_copy() is used by GCC 2.8 or newer until va_copy() becomes + * a final ISO standard. + */ +#if !defined(va_copy) && !defined(HAVE_VA_COPY) +# if defined(__va_copy) +# define va_copy(to, from) __va_copy(to, from) +# endif +#endif + +/* + * va_copy() is a Solaris extension to provide a portable way to perform a + * variable argument list "bookmarking" function. + * If it is not available via stdarg.h, use a simple assignement for backward + * compatibility. + */ +#if !defined(va_copy) && !defined(HAVE_VA_COPY) +#ifdef VA_LIST_IS_ARRAY +# define va_copy(to, from) ((to)[0] = (from)[0]) +#else +# define va_copy(to, from) ((to) = (from)) +#endif +#endif + +/* + * I don't know any portable way to get an arbitrary + * C object from a var arg list so I use a + * system-specific routine __va_arg_list() that knows + * if 'va_list' is an array. You will not be able to + * assign the value of __va_arg_list() but it works + * to be used as an argument of a function. + * It is a requirement for recursive printf to be able + * to use this function argument. If your system + * defines va_list to be an array you need to know this + * via autoconf or another mechanism. + * It would be nice to have something like + * __va_arg_list() in stdarg.h + */ + +#ifdef VA_LIST_IS_ARRAY +# define __va_arg_list(list) va_arg(list, void *) +#else +# define __va_arg_list(list) va_arg(list, va_list) +#endif + +#endif /* _VADEFS_H */ diff --git a/include/waitdefs.h b/include/waitdefs.h new file mode 100644 index 0000000..d363b4f --- /dev/null +++ b/include/waitdefs.h @@ -0,0 +1,152 @@ +/* + * This file has been modified for the cdrkit suite. + * + * The behaviour and appearence of the program code below can differ to a major + * extent from the version distributed by the original author(s). + * + * For details, see Changelog file distributed with the cdrkit package. If you + * received this file from another source then ask the distributing person for + * a log of modifications. + * + */ + +/* @(#)waitdefs.h 1.10 03/02/25 Copyright 1995-2003 J. Schilling */ +/* + * Definitions to deal with various kinds of wait flavour + * + * Copyright (c) 1995-2003 J. Schilling + */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _WAITDEFS_H +#define _WAITDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +/* + * Needed for SysVr4 + */ +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#if defined(HAVE_WAIT_H) +# ifndef _INCL_WAIT_H +# include <wait.h> +# define _INCL_WAIT_H +# endif +#else +/* + * K&R Compiler doesn't like #elif + */ +# if defined(HAVE_SYS_WAIT_H) /* POSIX.1 compl. sys/wait.h */ +# undef HAVE_UNION_WAIT /* POSIX.1 doesn't use U_W */ +# ifndef _INCL_SYS_WAIT_H +# include <sys/wait.h> +# define _INCL_SYS_WAIT_H +# endif +# else +# if defined(HAVE_UNION_WAIT) /* Pure BSD U_W / sys/wait.h */ +# ifndef _INCL_SYS_WAIT_H +# include <sys/wait.h> +# define _INCL_SYS_WAIT_H +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_UNION_WAIT +# define WAIT_T union wait +# ifndef WSTOPPED +# define WSTOPPED 0x7F +# endif +# ifndef WTERMSIG +# define WTERMSIG(status) ((status).w_termsig) +# endif +# ifndef WCOREDUMP +# define WCOREDUMP(status) ((status).w_coredump) +# endif +# ifndef WEXITSTATUS +# define WEXITSTATUS(status) ((status).w_retcode) +# endif +# ifndef WSTOPSIG +# define WSTOPSIG(status) ((status).w_stopsig) +# endif +# ifndef WIFSTOPPED +# define WIFSTOPPED(status) ((status).w_stopval == \ + WSTOPPED) +# endif +# ifndef WIFSIGNALED +# define WIFSIGNALED(status) ((status).w_stopval != \ + WSTOPPED && \ + (status).w_termsig != 0) +# endif +# ifndef WIFEXITED +# define WIFEXITED(status) ((status).w_stopval != \ + WSTOPPED && \ + (status).w_termsig == 0) +# endif +#else +# define WAIT_T int +# ifndef WTERMSIG +# define WTERMSIG(status) ((status) & 0x7F) +# endif +# ifndef WCOREDUMP +# define WCOREDUMP(status) ((status) & 0x80) +# endif +# ifndef WEXITSTATUS +# define WEXITSTATUS(status) (((status) >> 8) & 0xFF) +# endif +# ifndef WSTOPSIG +# define WSTOPSIG(status) (((status) >> 8) & 0xFF) +# endif +# ifndef WIFSTOPPED +# define WIFSTOPPED(status) (((status) & 0xFF) == 0x7F) +# endif +# ifndef WIFSIGNALED +# define WIFSIGNALED(status) (((status) & 0xFF) != 0x7F && \ + WTERMSIG(status) != 0) +# endif +# ifndef WIFEXITED +# define WIFEXITED(status) (((status) & 0xFF) == 0) +# endif +#endif + + +#ifndef WCOREFLG +#define WCOREFLG 0x80 +#endif + +#ifndef WSTOPFLG +#define WSTOPFLG 0x7F +#endif + +#ifndef WCONTFLG +#define WCONTFLG 0xFFFF +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _WAITDEFS_H */ diff --git a/include/xconfig.h.in b/include/xconfig.h.in new file mode 100644 index 0000000..c130600 --- /dev/null +++ b/include/xconfig.h.in @@ -0,0 +1,286 @@ +/* xconfig.h.in Prototype for xconfig.h, generated automatically by cmake in + * cdrkit's build system. + * + * Most features are expected to be available on every modern unixoide systems, + * others are probed. + * + * NOTE: Be carefull, there are some double checks for the 1 value hidden in + * the source, just defining it may be not enough. + * */ + +/* + * Copyright Eduard Bloch, 2006 + * + * Using constants names and comments from xconfig.h.in by J. Schilling, + * Copyright (c) 1998-2003 + * + */ + +/* + * Header Files + */ +#define PROTOTYPES 1 /* if Compiler supports ANSI C prototypes */ +#cmakedefine HAVE_STDARG_H + /* to use stdarg.h, else use varargs.h NOTE: SaberC on a Sun has prototypes but no stdarg.h */ + +#cmakedefine HAVE_STDLIB_H + /* to use general utility defines (malloc(), size_t ...) and general C library prototypes */ + +#cmakedefine HAVE_STRING_H + /* to get NULL and ANSI C string function prototypes */ +#cmakedefine HAVE_STRINGS_H + /* to get BSD string function prototypes */ +#define STDC_HEADERS 1 /* if ANSI compliant stdlib.h, stdarg.h, string.h, float.h are present */ +#cmakedefine HAVE_UNISTD_H + /* to get POSIX syscall prototypes XXX sys/file.h fcntl.h (unixstd/fctl)XXX*/ +#cmakedefine HAVE_GETOPT_H + /* to get getopt() prototype from getopt.h instead of unistd.h */ +#cmakedefine HAVE_LIMITS_H + /* to get POSIX numeric limits constants */ + +#cmakedefine HAVE_FCNTL_H + /* to access, O_XXX constants for open(), otherwise use sys/file.h */ +#cmakedefine HAVE_SYS_FILE_H + /* to use O_XXX constants for open() and flock() defs */ +#cmakedefine HAVE_INTTYPES_H + /* to use UNIX-98 inttypes.h */ +#cmakedefine HAVE_DIRENT_H + /* to use POSIX dirent.h */ + +#cmakedefine HAVE_ALLOCA_H + /* if alloca.h exists */ + +#cmakedefine HAVE_TERMIOS_H + /* to use POSIX termios.h */ +#cmakedefine HAVE_TERMIO_H + /* to use SVR4 termio.h */ +#cmakedefine HAVE_PWD_H + /* if pwd.h exists */ + +#cmakedefine HAVE_SYS_TIME_H + /* may include sys/time.h for struct timeval */ +#define TIME_WITH_SYS_TIME 1 /* may include both time.h and sys/time.h */ + +#define HAVE_UTIME 1 /* to use AT&T utime() and utimbuf */ +#define HAVE_UTIMES 1 /* to use BSD utimes() and sys/time.h */ + +#cmakedefine HAVE_UTIME_H + /* to use utime.h for the utimbuf structure declaration, else declare struct utimbuf yourself */ + +#cmakedefine HAVE_SYS_IOCTL_H + /* if sys/ioctl.h is present */ + +#cmakedefine HAVE_SYS_PARAM_H + /* if sys/param.h is present */ + +/* to use wait.h for prototypes and union wait */ +#cmakedefine HAVE_WAIT_H +/* else use sys/wait.h */ +#cmakedefine define HAVE_SYS_WAIT_H +#cmakedefine HAVE_SYS_RESOURCE_H + /* to use sys/resource.h for rlimit() and wait3() */ + +#cmakedefine HAVE_SYS_UTSNAME_H + /* to use uname() */ + +#cmakedefine HAVE_SYS_MTIO_H + /* to use mtio definitions from sys/mtio.h */ + +#cmakedefine HAVE_SYS_MMAN_H + /* to use definitions for mmap()/madvise()... from sys/mman.h */ +#define MAJOR_IN_SYSMACROS 1 /* if we should include sys/sysmacros.h to get major()/minor()/makedev() */ +#cmakedefine HAVE_SYS_DKIO_H +#cmakedefine HAVE_SUN_DKIO_H +#cmakedefine HAVE_POLL_H + /* if we may include poll.h to use poll() */ +#cmakedefine HAVE_SYS_POLL_H + /* if we may include sys/poll.h to use poll() */ + + +#cmakedefine HAVE_NETDB_H + /* if we have netdb.h for get*by*() and rcmd() */ +#cmakedefine HAVE_SYS_SOCKET_H + /* if we have sys/socket.h for socket() */ + +#cmakedefine HAVE_LINUX_PG_H + /* if we may include linux/pg.h for PP ATAPI sypport */ +#define HAVE_ERRNO_DEF 1 /* if we have errno definition in <errno.h> */ + +#cmakedefine HAVE_ARPA_INET_H + /* if we have arpa/inet.h (missing on BeOS) */ + /* BeOS has inet_ntoa() in <netdb.h> */ + +#cmakedefine HAVE_ICONV_H + +/* + * Convert to SCHILY name + */ +#ifdef STDC_HEADERS +# ifndef HAVE_STDC_HEADERS +# define HAVE_STDC_HEADERS +# endif +#endif + +/* + * Library Functions + */ +#define HAVE_ACCESS 1 /* access() is present in libc */ +#define HAVE_STRERROR 1 /* strerror() is present in libc */ +#define HAVE_MEMMOVE 1 /* memmove() is present in libc */ + +#define HAVE_MLOCK 1 /* mlock() is present in libc */ +#cmakedefine HAVE_MLOCKALL + /* working mlockall() is present in libc */ +#define HAVE_FLOCK 1 /* *BSD flock() is present in libc */ +#define HAVE_SETREUID 1 /* setreuid() is present in libc */ +#define HAVE_SETEUID 1 /* seteuid() is present in libc */ +#define HAVE_SETUID 1 /* setuid() is present in libc */ +#define HAVE_SETREGID 1 /* setregid() is present in libc */ +#define HAVE_SETEGID 1 /* setegid() is present in libc */ +#define HAVE_SETGID 1 /* setgid() is present in libc */ +#define HAVE_TCGETATTR 1 /* tcgetattr() is present in libc */ +#define HAVE_TCSETATTR 1 /* tcsetattr() is present in libc */ +#define HAVE_GETHOSTID 1 /* gethostid() is present in libc */ +#define HAVE_GETHOSTNAME 1 /* gethostname() is present in libc */ +#define HAVE_GETDOMAINNAME 1 /* getdomainname() is present in libc */ +#define HAVE_GETPAGESIZE 1 /* getpagesize() is present in libc */ +#define HAVE_POLL 1 /* poll() is present in libc */ +#define HAVE_SELECT 1 /* select() is present in libc */ +#define HAVE_LCHOWN 1 /* lchown() is present in libc */ +#define HAVE_SBRK 1 /* sbrk() is present in libc */ +#define HAVE_VA_COPY 1 /* va_copy() is present in varargs.h/stdarg.h */ +#define HAVE_DUP2 1 /* dup2() is present in libc */ +#define HAVE_GETCWD 1 /* POSIX getcwd() is present in libc */ +#define HAVE_SMMAP 1 /* may map anonymous memory to get shared mem */ +#define HAVE_SHMAT 1 /* shmat() is present in libc */ +#define HAVE_SEMGET 1 /* semget() is present in libc */ +#define HAVE_LSTAT 1 /* lstat() is present in libc */ +#define HAVE_READLINK 1 /* readlink() is present in libc */ +#define HAVE_RENAME 1 /* rename() is present in libc */ + +#cmakedefine HAVE_RAND + /* rand() is present in libc */ +#cmakedefine HAVE_DRAND48 + /* drand48() is present in libc */ +#define HAVE_SETPRIORITY 1 /* setpriority() is present in libc */ +#define HAVE_NICE 1 /* nice() is present in libc */ +#define HAVE_UNAME 1 /* uname() is present in libc */ +#define HAVE_SNPRINTF 1 /* snprintf() is present in libc */ +#define HAVE_STRCASECMP 1 /* strcasecmp() is present in libc */ +#define HAVE_STRDUP 1 /* strdup() is present in libc */ +#define HAVE_SIGPROCMASK 1 /* sigprocmask() is present in libc (POSIX) */ +#define HAVE_SIGSET 1 /* sigset() is present in libc (POSIX) */ +#define HAVE_NANOSLEEP 1 /* nanosleep() is present in libc */ +#define HAVE_USLEEP 1 /* usleep() is present in libc */ +#define HAVE_FORK 1 /* fork() is present in libc */ +#define HAVE_ALLOCA 1 /* alloca() is present (else use malloc())*/ +#define HAVE_VALLOC 1 /* valloc() is present in libc (else use malloc())*/ + +/* + * Important: This must be a result from a check _before_ the Large File test + * has been run. It then tells us whether these functions are + * available even when not in Large File mode. + * + * Do not run the AC_FUNC_FSEEKO test from the GNU tar Large File test + * siute. It will use the same cache names and interfere with our test. + * Instead use the tests AC_SMALL_FSEEKO/AC_SMALL/STELLO and make sure + * they are placed before the large file tests. + */ + +#define HAVE_RCMD 1 /* rcmd() is present in libc/libsocket */ +#define HAVE_SOCKET 1 /* socket() is present in libc/libsocket */ +#define HAVE_SOCKETPAIR 1 /* socketpair() is present in libc/libsocket */ +#define HAVE_GETSERVBYNAME 1 /* getservbyname() is present in libc/libsocket */ +/* inet_ntoa() is present in libc/libsocket */ +#cmakedefine HAVE_INET_NTOA + +/* getnameinfo() is present in libc/libsocket */ +#cmakedefine define HAVE_GETNAMEINFO + +/* + * We need to test for the include files too because Apollo Domain/OS has a + * libc that includes the functions but the includes files are not visible + * from the BSD compile environment. + */ +#if defined(HAVE_SHMAT) && defined(HAVE_SYS_SHM_H) && defined(HAVE_SYS_IPC_H) +# define HAVE_USGSHM /* USG shared memory is present */ +#endif +#if defined(HAVE_SEMGET) && defined(HAVE_SYS_SHM_H) && defined(HAVE_SYS_IPC_H) +# define HAVE_USGSEM /* USG semaphores are present */ +#endif + +#if defined(HAVE_GETPGRP) && !defined(HAVE_BSD_GETPGRP) +#define HAVE_POSIX_GETPGRP 1 /* getpgrp() in libc is POSIX compliant */ +#endif +#if defined(HAVE_SETPGRP) && !defined(HAVE_BSD_SETPGRP) +#define HAVE_POSIX_SETPGRP 1 /* setpgrp() in libc is POSIX compliant */ +#endif + +/* + * Structures + */ + +/* have union wait in wait.h */ +#cmakedefine HAVE_UNION_WAIT + +#define HAVE_ST_NSEC 1 /* if struct stat contains st_atim.tv_nsec (nanosecs) */ +#define HAVE_ST_RDEV 1 /* if struct stat contains st_rdev */ +#define HAVE_SOCKADDR_STORAGE 1 /* if socket.h defines struct sockaddr_storage */ + +/* + * Byteorder/Bitorder + */ +/* If using network byte order */ +#cmakedefine WORDS_BIGENDIAN +/* If high bits come first in structures */ +#cmakedefine BITFIELDS_HTOL +#define HAVE_C_BIGENDIAN /* Flag that WORDS_BIGENDIAN test was done */ +#define HAVE_C_BITFIELDS /* Flag that BITFIELDS_HTOL test was done */ + +/* + * Types/Keywords + */ +#define SIZEOF_CHAR 1 +#define SIZEOF_SHORT_INT @SIZE_SHORT@ +#define SIZEOF_INT @SIZE_INT@ +#define SIZEOF_LONG_INT @SIZE_LONG@ +#define SIZEOF_LONG_LONG @SIZE_LLONG@ +#define SIZEOF_CHAR_P @SIZE_PTR@ +#define SIZEOF_UNSIGNED_CHAR 1 +#define SIZEOF_UNSIGNED_SHORT_INT @SIZE_SHORT@ +#define SIZEOF_UNSIGNED_INT @SIZE_INT@ +#define SIZEOF_UNSIGNED_LONG_INT @SIZE_LONG@ +#define SIZEOF_UNSIGNED_LONG_LONG @SIZE_LLONG@ +#define SIZEOF_UNSIGNED_CHAR_P @SIZE_PTR@ + +#define HAVE_LONGLONG 1 /* Compiler defines long long type */ + + +/* + * Critical on some of Debian architectures (EB) */ +/* #define VA_LIST_IS_ARRAY 1 */ + +#cmakedefine VA_LIST_IS_ARRAY + +#define GETGROUPS_T gid_t +#define GID_T GETGROUPS_T + +/* + * Define as the return type of signal handlers (int or void). + */ +#define RETSIGTYPE void + +#define HAVE_LARGEFILES 1 +#define _FILE_OFFSET_BITS 64 /* glibc style */ +#define _LARGEFILE_SOURCE 1 /* To make ftello() visible (HP-UX 10.20). */ +#define _LARGE_FILES 1 /* Large file defined on AIX-style hosts. */ + +/* + * Misc CC / LD related stuff + */ +/* If the compiler allows dynamic sized arrays */ +#cmakedefine HAVE_DYN_ARRAYS + +#define HOST_SYSTEM "@CMAKE_SYSTEM_NAME@" +#cmakedefine CDRKIT_VERSION "@CDRKIT_VERSION@" +/*[$Rev: 467 $]" */ |