Import Upstream version 0.4.5

This commit is contained in:
geos_one
2025-08-06 16:36:24 +02:00
parent 64807cf811
commit cfe47daa9a
122 changed files with 489 additions and 1254 deletions

69
schily/allocax.h Normal file
View File

@@ -0,0 +1,69 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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
# if 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 */

120
schily/btorder.h Normal file
View File

@@ -0,0 +1,120 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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(__ia64__) || defined(__ia64) || defined(ia64) || \
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 */

119
schily/btorder.h.endian Normal file
View File

@@ -0,0 +1,119 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

67
schily/ccomdefs.h Normal file
View File

@@ -0,0 +1,67 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

76
schily/deflts.h Normal file
View File

@@ -0,0 +1,76 @@
/* @(#)deflts.h 1.6 02/08/26 Copyright 1997 J. Schilling */
/*
* Definitions for reading program defaults.
*
* 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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _DEFLTS_H
#define _DEFLTS_H
#ifndef _MCONFIG_H
#include <mconfig.h>
#endif
#ifndef _PROTOTYP_H
#include <prototyp.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define DEFLT "/etc/default"
/*
* cmd's to defltcntl()
*/
#define DC_GETFLAGS 0 /* Get actual flags */
#define DC_SETFLAGS 1 /* Set new flags */
/*
* flags to defltcntl()
*
* Make sure that when adding features, the default behaviour
* is the same as old behaviour.
*/
#define DC_CASE 0x0001 /* Don't ignore case */
#define DC_STD DC_CASE /* Default flags */
/*
* Macros to handle flags
*/
#ifndef TURNON
#define TURNON(flags, mask) flags |= mask
#define TURNOFF(flags, mask) flags &= ~(mask)
#define ISON(flags, mask) (((flags) & (mask)) == (mask))
#define ISOFF(flags, mask) (((flags) & (mask)) != (mask))
#endif
extern int defltopen __PR((const char *name));
extern int defltclose __PR((void));
extern void defltfirst __PR((void));
extern char *defltread __PR((const char *name));
extern char *defltnext __PR((const char *name));
extern int defltcntl __PR((int cmd, int flags));
#ifdef __cplusplus
}
#endif
#endif /* _DEFLTS_H */

145
schily/device.h Normal file
View File

@@ -0,0 +1,145 @@
/* @(#)device.h 1.12 03/06/15 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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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
# 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 __PR((BOOL debug));
#ifndef dev_major
extern XDEV_T dev_major __PR((XDEV_T dev));
extern XDEV_T _dev_major __PR((int mbits, XDEV_T dev));
extern XDEV_T dev_minor __PR((XDEV_T dev));
extern XDEV_T _dev_minor __PR((int mbits, XDEV_T dev));
extern XDEV_T dev_make __PR((XDEV_T majo, XDEV_T mino));
extern XDEV_T _dev_make __PR((int mbits, XDEV_T majo, XDEV_T mino));
#endif
#endif /* __XDEV__ */
#ifdef __cplusplus
}
#endif
#endif /* _DEVICE_H */

177
schily/dirdefs.h Normal file
View File

@@ -0,0 +1,177 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

82
schily/fctldefs.h Normal file
View File

@@ -0,0 +1,82 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

49
schily/getargs.h Normal file
View File

@@ -0,0 +1,49 @@
/* @(#)getargs.h 1.9 03/06/15 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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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) __PR((const void *, void *));
#ifdef __cplusplus
}
#endif
#endif /* _GETARGS_H */

43
schily/getcwd.h Normal file
View File

@@ -0,0 +1,43 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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, 675 Mass Ave, Cambridge, MA 02139, 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 */

113
schily/intcvt.h Normal file
View File

@@ -0,0 +1,113 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

38
schily/jmpdefs.h Normal file
View File

@@ -0,0 +1,38 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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, 675 Mass Ave, Cambridge, MA 02139, 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 */

111
schily/libport.h Normal file
View File

@@ -0,0 +1,111 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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
#define HOST_NAME_MAX MAXHOSTNAMELEN
#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 __PR((void));
#endif
#ifndef HAVE_GETHOSTNAME
extern int gethostname __PR((char *name, int namelen));
#endif
#ifndef HAVE_GETDOMAINNAME
extern int getdomainname __PR((char *name, int namelen));
#endif
#ifndef HAVE_GETPAGESIZE
EXPORT int getpagesize __PR((void));
#endif
#ifndef HAVE_USLEEP
extern int usleep __PR((int usec));
#endif
#if !defined(HAVE_STRDUP) || defined(__SVR4)
extern char *strdup __PR((const char *s));
#endif
#ifndef HAVE_RENAME
extern int rename __PR((const char *old, const char *new));
#endif
#ifdef __cplusplus
}
#endif
#endif /* _LIBPORT_H */

64
schily/librmt.h Normal file
View File

@@ -0,0 +1,64 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 __PR((int (*errmsgn)(int, const char *, ...),
void (*eexit)(int)));
extern int rmtdebug __PR((int dlevel));
extern char *rmtfilename __PR((char *name));
extern char *rmthostname __PR((char *hostname, int hnsize, char *rmtspec));
extern int rmtgetconn __PR((char *host, int trsize, int excode));
extern int rmtopen __PR((int fd, char *fname, int fmode));
extern int rmtclose __PR((int fd));
extern int rmtread __PR((int fd, char *buf, int count));
extern int rmtwrite __PR((int fd, char *buf, int count));
extern off_t rmtseek __PR((int fd, off_t offset, int whence));
extern int rmtioctl __PR((int fd, int cmd, int count));
#ifdef MTWEOF
extern int rmtstatus __PR((int fd, struct mtget *mtp));
#endif
extern int rmtxstatus __PR((int fd, struct rmtget *mtp));
#ifdef MTWEOF
extern void _rmtg2mtg __PR((struct mtget *mtp, struct rmtget *rmtp));
extern int _mtg2rmtg __PR((struct rmtget *rmtp, struct mtget *mtp));
#endif
#endif /* _LIBRMT_H */

75
schily/maxpath.h Normal file
View File

@@ -0,0 +1,75 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

483
schily/mconfig.h Normal file
View File

@@ -0,0 +1,483 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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
/*
* Tell our users that this is a Schily SING compile environment.
*/
#define IS_SCHILY
/*
* 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
#ifdef __CHAR_UNSIGNED__ /* GNU GCC define (dynamic) */
#ifndef CHAR_IS_UNSIGNED
#define CHAR_IS_UNSIGNED /* Sing Schily define (static) */
#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 */

63
schily/mmapdefs.h Normal file
View File

@@ -0,0 +1,63 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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, 675 Mass Ave, Cambridge, MA 02139, 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 */

103
schily/mtiodefs.h Normal file
View File

@@ -0,0 +1,103 @@
/* @(#)mtiodefs.h 1.4 02/08/26 Copyright 1995,2000-2002 J. Schilling */
/*
* Generic header for users of magnetic tape ioctl interface.
*
* If there is no local mtio.h or equivalent, define
* simplified mtio definitions here in order
* to be able to do at least remote mtio on systems
* that have no local mtio
*
* 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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _MTIODEFS_H
#define _MTIODEFS_H
#ifndef _MCONFIG_H
#include <mconfig.h>
#endif
#ifdef HAVE_SYS_MTIO_H
#include <sys/mtio.h>
#else /* ! HAVE_SYS_MTIO_H */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Definitions for magnetic tape io control commands
*/
/*
* structure for MTIOCTOP - magnetic tape operation command
*/
struct mtop {
short mt_op; /* op code (see below) */
daddr_t mt_count; /* repeat count or param */
};
/*
* op code values for mt_op
*/
#define MTWEOF 0 /* write EOF record(s) */
#define MTFSF 1 /* fwd space over file mark(s) */
#define MTBSF 2 /* back space over file mark(s) (1/2" only ) */
#define MTFSR 3 /* fwd space record(s) (to inter-record gap) */
#define MTBSR 4 /* back space record(s) (to inter-record gap)*/
#define MTREW 5 /* rewind tape */
#define MTOFFL 6 /* rewind and put the drive offline */
#define MTNOP 7 /* no operation (sets status ?) */
/*
* structure for MTIOCGET - magnetic tape get status command
*/
struct mtget {
short mt_type; /* type of magnetic tape device */
/* the next two regs are device dependent */
short mt_dsreg; /* drive status 'register' */
short mt_erreg; /* error 'register' */
daddr_t mt_resid; /* transfer residual count */
daddr_t mt_fileno; /* file # for current position */
daddr_t mt_blkno; /* block # for current position */
};
#define HAVE_MTGET_TYPE
#define HAVE_MTGET_DSREG
#define HAVE_MTGET_ERREG
#define HAVE_MTGET_RESID
#define HAVE_MTGET_FILENO
#define HAVE_MTGET_BLKNO
/*
* Define some junk here as software may assume that these two definitions
* are always present.
*/
#define MTIOCGET 0x12340001
#define MTIOCTOP 0x12340002
#ifdef __cplusplus
}
#endif
#endif /* HAVE_SYS_MTIO_H */
#endif /* _MTIODEFS_H */

105
schily/patmatch.h Normal file
View File

@@ -0,0 +1,105 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 __PR((const unsigned char * __pat, int __patlen, int * __aux));
extern unsigned char *opatmatch __PR((const unsigned char * __pat, const int * __aux,
const unsigned char * __str, int __soff, int __slen,
int __alt));
extern unsigned char *opatlmatch __PR((const unsigned char * __pat, const int * __aux,
const unsigned char * __str, int __soff, int __slen,
int __alt));
extern unsigned char *patmatch __PR((const unsigned char * __pat, const int * __aux,
const unsigned char * __str, int __soff, int __slen,
int __alt, int __state[]));
extern unsigned char *patlmatch __PR((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 */

95
schily/prototyp.h Normal file
View File

@@ -0,0 +1,95 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

156
schily/rmtio.h Normal file
View File

@@ -0,0 +1,156 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

155
schily/scg/aspi-dos.h Normal file
View File

@@ -0,0 +1,155 @@
#ifndef __ASPI16_H_
#define __ASPI16_H_
#define PACKED __attribute__((packed))
#define FAR
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
//*****************************************************************************
// %%% SCSI MISCELLANEOUS EQUATES %%%
//*****************************************************************************
#define SENSE_LEN 14 // Default sense buffer length
#define SRB_DIR_SCSI 0x00 // Direction determined by SCSI
#define SRB_POSTING 0x01 // Enable ASPI posting
#define SRB_ENABLE_RESIDUAL_COUNT 0x04 // Enable residual byte count reporting
#define SRB_DIR_IN 0x08 // Transfer from SCSI target to host
#define SRB_DIR_OUT 0x10 // Transfer from host to SCSI target
//*****************************************************************************
// %%% ASPI Command Definitions %%%
//*****************************************************************************
#define SC_HA_INQUIRY 0x00 // Host adapter inquiry
#define SC_GET_DEV_TYPE 0x01 // Get device type
#define SC_EXEC_SCSI_CMD 0x02 // Execute SCSI command
#define SC_ABORT_SRB 0x03 // Abort an SRB
#define SC_RESET_DEV 0x04 // SCSI bus device reset
#define SC_SET_HA_PARMS 0x05 // Set HA parameters
#define SC_GET_DISK_INFO 0x06 // Get Disk information
//*****************************************************************************
// %%% SRB Status %%%
//*****************************************************************************
#define SS_PENDING 0x00 // SRB being processed
#define SS_COMP 0x01 // SRB completed without error
#define SS_ABORTED 0x02 // SRB aborted
#define SS_ABORT_FAIL 0x03 // Unable to abort SRB
#define SS_ERR 0x04 // SRB completed with error
#define SS_INVALID_CMD 0x80 // Invalid ASPI command
#define SS_INVALID_HA 0x81 // Invalid host adapter number
#define SS_NO_DEVICE 0x82 // SCSI device not installed
//*****************************************************************************
// %%% Host Adapter Status %%%
//*****************************************************************************
#define HASTAT_OK 0x00 // Host adapter did not detect an // error
#define HASTAT_SEL_TO 0x11 // Selection Timeout
#define HASTAT_DO_DU 0x12 // Data overrun data underrun
#define HASTAT_BUS_FREE 0x13 // Unexpected bus free
#define HASTAT_PHASE_ERR 0x14 // Target bus phase sequence // failure
#define HASTAT_TIMEOUT 0x09 // Timed out while SRB was waiting to beprocessed.
#define HASTAT_COMMAND_TIMEOUT 0x0B // Adapter timed out processing SRB.
#define HASTAT_MESSAGE_REJECT 0x0D // While processing SRB, the // adapter received a MESSAGE
#define HASTAT_BUS_RESET 0x0E // A bus reset was detected.
#define HASTAT_PARITY_ERROR 0x0F // A parity error was detected.
#define HASTAT_REQUEST_SENSE_FAILED 0x10 // The adapter failed in issuing
typedef struct {
BYTE Cmd; // 00/000 ASPI command code = SC_EXEC_SCSI_CMD
BYTE Status; // 01/001 ASPI command status byte
BYTE HaId; // 02/002 ASPI host adapter number
BYTE Flags; // 03/003 ASPI request flags
DWORD Hdr_Rsvd; // 04/004 Reserved, MUST = 0
union {
struct {
BYTE Count; // 08/008 Number of host adapters present
BYTE SCSI_ID; // 09/009 SCSI ID of host adapter
BYTE ManagerId[16]; // 0A/010 String describing the manager
BYTE Identifier[16]; // 1A/026 String describing the host adapter
BYTE Unique[16]; // 2A/042 Host Adapter Unique parameters
BYTE ExtBuffer[8]; // 3A/058 Extended inquiry data
} PACKED HAInquiry;
struct {
BYTE Target; // 08/008 Target's SCSI ID
BYTE Lun; // 09/009 Target's LUN number
BYTE DeviceType; // 0A/010 Target's peripheral device type
} PACKED GetDeviceType;
struct {
BYTE Target; // 08/008 Target's SCSI ID
BYTE Lun; // 09/009 Target's LUN number
DWORD BufLen; // 0A/010 Data Allocation Length
BYTE SenseLen; // 0E/014 Sense Allocation Length
BYTE FAR *BufPointer; // 0F/015 Data Buffer Pointer
DWORD Rsvd1; // 13/019 Reserved, MUST = 0
BYTE CDBLen; // 17/023 CDB Length = 6/10/12
BYTE HaStat; // 18/024 Host Adapter Status
BYTE TargStat; // 19/025 Target Status
VOID FAR *PostProc; // 1A/026 Post routine
BYTE Rsvd2[34]; // 1E/030 Reserved, MUST = 0
union {
struct {
BYTE CDBByte[6]; // 40/064 SCSI CDB
BYTE SenseArea[SENSE_LEN+2]; // 46/070 Request Sense buffer
} PACKED _6;
struct {
BYTE CDBByte[10]; // 40/064 SCSI CDB
BYTE SenseArea[SENSE_LEN+2]; // 4A/074 Request Sense buffer
} PACKED _10;
struct {
BYTE CDBByte[12]; // 40/064 SCSI CDB
BYTE SenseArea[SENSE_LEN+2]; // 4C/076 Request Sense buffer
} PACKED _12;
} PACKED CmdLen;
} PACKED ExecSCSICmd;
struct {
VOID FAR *SRBToAbort; // 08/008 Pointer to SRB to abort
} PACKED Abort;
struct {
BYTE Target; // 08/008 Target's SCSI ID
BYTE Lun; // 09/009 Target's LUN number
BYTE ResetRsvd1[14]; // 0A/010 Reserved, MUST = 0
BYTE HaStat; // 18/024 Host Adapter Status
BYTE TargStat; // 19/025 Target Status
VOID FAR *PostProc; // 1A/026 Post routine
BYTE ResetRsvd2[34]; // 1E/030 Reserved, MUST = 0
} Reset;
} PACKED Type;
} PACKED SRB;
#endif //__ASPI16_H_

196
schily/scg/aspi-win32.h Normal file
View File

@@ -0,0 +1,196 @@
#ifndef __ASPI_WIN32_H_
#define __ASPI_WIN32_H_
#include <Windows.h>
/***************************************************************************
** SCSI MISCELLANEOUS EQUATES
***************************************************************************/
#define SENSE_LEN 14 /* Default sense buffer length */
#define SRB_DIR_SCSI 0x00 /* Direction determined by SCSI */
#define SRB_POSTING 0x01 /* Enable ASPI posting */
#define SRB_ENABLE_RESIDUAL_COUNT 0x04 /* Enable residual byte count */
/* reporting */
#define SRB_DIR_IN 0x08 /* Transfer from SCSI target to */
/* host */
#define SRB_DIR_OUT 0x10 /* Transfer from host to SCSI */
/* target */
#define SRB_EVENT_NOTIFY 0x40 /* Enable ASPI event notification */
#define RESIDUAL_COUNT_SUPPORTED 0x02 /* Extended buffer flag */
#define MAX_SRB_TIMEOUT 1080001u /* 30 hour maximum timeout in sec */
#define DEFAULT_SRB_TIMEOUT 1080001u /* use max.timeout by default */
/***************************************************************************
** ASPI command definitions
***************************************************************************/
#define SC_HA_INQUIRY 0x00 /* Host adapter inquiry */
#define SC_GET_DEV_TYPE 0x01 /* Get device type */
#define SC_EXEC_SCSI_CMD 0x02 /* Execute SCSI command */
#define SC_ABORT_SRB 0x03 /* Abort an SRB */
#define SC_RESET_DEV 0x04 /* SCSI bus device reset */
#define SC_SET_HA_PARMS 0x05 /* Set HA parameters */
#define SC_GET_DISK_INFO 0x06 /* Get Disk */
#define SC_RESCAN_SCSI_BUS 0x07 /* Rebuild SCSI device map */
#define SC_GETSET_TIMEOUTS 0x08 /* Get/Set target timeouts */
/***************************************************************************
** SRB Status
***************************************************************************/
#define SS_PENDING 0x00 /* SRB being processed */
#define SS_COMP 0x01 /* SRB completed without error */
#define SS_ABORTED 0x02 /* SRB aborted */
#define SS_ABORT_FAIL 0x03 /* Unable to abort SRB */
#define SS_ERR 0x04 /* SRB completed with error */
#define SS_INVALID_CMD 0x80 /* Invalid ASPI command */
#define SS_INVALID_HA 0x81 /* Invalid host adapter number */
#define SS_NO_DEVICE 0x82 /* SCSI device not installed */
#define SS_INVALID_SRB 0xE0 /* Invalid parameter set in SRB */
#define SS_OLD_MANAGER 0xE1 /* ASPI manager doesn't support */
/* windows */
#define SS_BUFFER_ALIGN 0xE1 /* Buffer not aligned (replaces */
/* SS_OLD_MANAGER in Win32) */
#define SS_ILLEGAL_MODE 0xE2 /* Unsupported Windows mode */
#define SS_NO_ASPI 0xE3 /* No ASPI managers */
#define SS_FAILED_INIT 0xE4 /* ASPI for windows failed init */
#define SS_ASPI_IS_BUSY 0xE5 /* No resources available to */
/* execute command */
#define SS_BUFFER_TO_BIG 0xE6 /* Buffer size too big to handle */
#define SS_BUFFER_TOO_BIG 0xE6 /* Correct spelling of 'too' */
#define SS_MISMATCHED_COMPONENTS 0xE7 /* The DLLs/EXEs of ASPI don't */
/* version check */
#define SS_NO_ADAPTERS 0xE8 /* No host adapters to manager */
#define SS_INSUFFICIENT_RESOURCES 0xE9 /* Couldn't allocate resources */
/* needed to init */
#define SS_ASPI_IS_SHUTDOWN 0xEA /* Call came to ASPI after */
/* PROCESS_DETACH */
#define SS_BAD_INSTALL 0xEB /* The DLL or other components */
/* are installed wrong */
/***************************************************************************
** Host Adapter Status
***************************************************************************/
#define HASTAT_OK 0x00 /* No error detected by HA */
#define HASTAT_SEL_TO 0x11 /* Selection Timeout */
#define HASTAT_DO_DU 0x12 /* Data overrun/data underrun */
#define HASTAT_BUS_FREE 0x13 /* Unexpected bus free */
#define HASTAT_PHASE_ERR 0x14 /* Target bus phase sequence */
#define HASTAT_TIMEOUT 0x09 /* Timed out while SRB was */
/* waiting to be processed */
#define HASTAT_COMMAND_TIMEOUT 0x0B /* Adapter timed out while */
/* processing SRB */
#define HASTAT_MESSAGE_REJECT 0x0D /* While processing the SRB, the */
/* adapter received a MESSAGE */
#define HASTAT_BUS_RESET 0x0E /* A bus reset was detected */
#define HASTAT_PARITY_ERROR 0x0F /* A parity error was detected */
#define HASTAT_REQUEST_SENSE_FAILED 0x10 /* The adapter failed in issuing */
/***************************************************************************
** SRB - HOST ADAPTER INQUIRIY - SC_HA_INQUIRY (0)
***************************************************************************/
typedef struct {
BYTE SRB_Cmd; /* 00/000 ASPI command code == SC_HA_INQUIRY */
BYTE SRB_Status; /* 01/001 ASPI command status byte */
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
BYTE SRB_Flags; /* 03/003 ASPI request flags */
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
BYTE HA_Count; /* 08/008 Number of host adapters present */
BYTE HA_SCSI_ID; /* 09/009 SCSI ID of host adapter */
BYTE HA_ManagerId[16]; /* 0a/010 String describing the manager */
BYTE HA_Identifier[16]; /* 1a/026 String describing the host adapter */
BYTE HA_Unique[16]; /* 2a/042 Host Adapter Unique parameters */
WORD HA_Rsvd1; /* 3a/058 Reserved, must = 0 */
} PACKED SRB_HAInquiry, *PSRB_HAInquiry, FAR *LPSRB_HAInquiry;
/***************************************************************************
** SRB - GET DEVICE TYPE - SC_GET_DEV_TYPE (1)
***************************************************************************/
typedef struct
{
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_GET_DEV_TYPE */
BYTE SRB_Status; /* 01/001 ASPI command status byte */
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
BYTE SRB_Target; /* 08/008 Target's SCSI ID */
BYTE SRB_Lun; /* 09/009 Target's LUN number */
BYTE SRB_DeviceType; /* 0a/010 Target's peripheral device type */
BYTE SRB_Rsvd1; /* 0b/011 Reserved, must = 0 */
} PACKED SRB_GDEVBlock, *PSRB_GDEVBlock, FAR *LPSRB_GDEVBlock;
/***************************************************************************
** SRB - EXECUTE SCSI COMMAND - SC_EXEC_SCSI_CMD (2)
***************************************************************************/
typedef struct
{
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_EXEC_SCSI_CMD */
BYTE SRB_Status; /* 01/001 ASPI command status byte */
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
BYTE SRB_Target; /* 08/008 Target's SCSI ID */
BYTE SRB_Lun; /* 09/009 Target's LUN */
WORD SRB_Rsvd1; /* 0a/010 Reserved for alignment */
DWORD SRB_BufLen; /* 0c/012 Data Allocation Length */
BYTE FAR *SRB_BufPointer; /* 10/016 Data Buffer Pointer */
BYTE SRB_SenseLen; /* 14/020 Sense Allocation Length */
BYTE SRB_CDBLen; /* 15/021 CDB Length */
BYTE SRB_HaStat; /* 16/022 Host Adapter Status */
BYTE SRB_TargStat; /* 17/023 Target Status */
VOID FAR *SRB_PostProc; /* 18/024 Post routine */
BYTE SRB_Rsvd2[20]; /* 1c/028 Reserved, must = 0 */
BYTE CDBByte[16]; /* 30/048 SCSI CDB */
BYTE SenseArea[SENSE_LEN+2]; /* 40/064 Request Sense buffer */
} PACKED SRB_ExecSCSICmd, *PSRB_ExecSCSICmd, FAR *LPSRB_ExecSCSICmd;
typedef struct
{
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_ABORT_SRB */
BYTE SRB_Status; /* 01/001 ASPI command status byte */
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
void *SRB_ToAbort; /* 08/008 Pointer to SRB to abort */
} PACKED SRB_Abort, *PSRB_Abort, FAR *LPSRB_Abort;
/***************************************************************************
** SRB - BUS DEVICE RESET - SC_RESET_DEV (4)
***************************************************************************/
typedef struct
{
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_RESET_DEV */
BYTE SRB_Status; /* 01/001 ASPI command status byte */
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
DWORD SRB_Flags; /* 04/004 Reserved */
BYTE SRB_Target; /* 08/008 Target's SCSI ID */
BYTE SRB_Lun; /* 09/009 Target's LUN number */
BYTE SRB_Rsvd1[12]; /* 0A/010 Reserved for alignment */
BYTE SRB_HaStat; /* 16/022 Host Adapter Status */
BYTE SRB_TargStat; /* 17/023 Target Status */
VOID FAR *SRB_PostProc; /* 18/024 Post routine */
BYTE SRB_Rsvd2[36]; /* 1C/028 Reserved, must = 0 */
} SRB_BusDeviceReset, *PSRB_BusDeviceReset, FAR *LPSRB_BusDeviceReset;
typedef struct tag_ASPI32BUFF
{
PBYTE AB_BufPointer;
DWORD AB_BufLen;
DWORD AB_ZeroFill;
DWORD AB_Reserved;
} PACKED ASPI32BUFF, *PASPI32BUFF, FAR *LPASPI32BUFF;
typedef struct
{
BYTE SRB_Cmd;
BYTE SRB_Status;
BYTE SRB_HaId;
BYTE SRB_Flags;
DWORD SRB_Hdr_Rsvd;
} SRB, *PSRB, FAR *LPSRB;
#endif

200
schily/scg/scgcmd.h Normal file
View File

@@ -0,0 +1,200 @@
/* @(#)scgcmd.h 2.22 04/09/04 Copyright 1986 J. Schilling */
/*
* Definitions for the SCSI 'scg_cmd' structure that has been created
* for the SCSI general driver 'scg' for SunOS and Solaris but
* now is used for wrapping general libscg SCSI transport requests.
*
* Copyright (c) 1986 J. Schilling
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 _SCG_SCGCMD_H
#define _SCG_SCGCMD_H
#include <utypes.h>
#include <btorder.h>
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
#else
# if defined(_BIT_FIELDS_HTOL) /* Motorola byteorder */
# else
/*
* #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 One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
# endif
#endif
#include <scg/scsisense.h>
#include <scg/scsicdb.h>
#include <intcvt.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Leave these definitions here if possible to avoid the need to
* include scsireg.h which makes problems on some OS because these
* OS define the same types as in scsireg.h
*/
/*
* SCSI status bits.
*/
#define ST_VU_00 0x01 /* Vendor unique */
#define ST_CHK_COND 0x02 /* Check condition */
#define ST_COND_MET 0x04 /* Condition met */
#define ST_BUSY 0x08 /* Busy */
#define ST_IS_SEND 0x10 /* Intermediate status send */
#define ST_VU_05 0x20 /* Vendor unique */
#define ST_VU_06 0x40 /* Vendor unique */
#define ST_RSVD_07 0x80 /* Reserved */
/*
* Sense key values for extended sense.
*/
#define SC_NO_SENSE 0x00
#define SC_RECOVERABLE_ERROR 0x01
#define SC_NOT_READY 0x02
#define SC_MEDIUM_ERROR 0x03
#define SC_HARDWARE_ERROR 0x04
#define SC_ILLEGAL_REQUEST 0x05
#define SC_UNIT_ATTENTION 0x06
#define SC_WRITE_PROTECT 0x07
#define SC_BLANK_CHECK 0x08
#define SC_VENDOR_UNIQUE 0x09
#define SC_COPY_ABORTED 0x0A
#define SC_ABORTED_COMMAND 0x0B
#define SC_EQUAL 0x0C
#define SC_VOLUME_OVERFLOW 0x0D
#define SC_MISCOMPARE 0x0E
#define SC_RESERVED 0x0F
/*
* Messages that SCSI can send.
*/
#define SC_COMMAND_COMPLETE 0x00
#define SC_SYNCHRONOUS 0x01
#define SC_SAVE_DATA_PTR 0x02
#define SC_RESTORE_PTRS 0x03
#define SC_DISCONNECT 0x04
#define SC_ABORT 0x06
#define SC_MSG_REJECT 0x07
#define SC_NO_OP 0x08
#define SC_PARITY 0x09
#define SC_IDENTIFY 0x80
#define SC_DR_IDENTIFY 0xc0
#define SC_DEVICE_RESET 0x0c
#define SC_G0_CDBLEN 6 /* Len of Group 0 commands */
#define SC_G1_CDBLEN 10 /* Len of Group 1 commands */
#define SC_G5_CDBLEN 12 /* Len of Group 5 commands */
#define SCG_MAX_CMD 24 /* 24 bytes max. size is supported */
#define SCG_MAX_STATUS 3 /* XXX (sollte 4 allign.) Mamimum Status Len */
#define SCG_MAX_SENSE 32 /* Mamimum Sense Len for auto Req. Sense */
#define DEF_SENSE_LEN 16 /* Default Sense Len */
#define CCS_SENSE_LEN 18 /* Sense Len for CCS compatible devices */
struct scg_cmd {
caddr_t addr; /* Address of data in user space */
int size; /* DMA count for data transfer */
int flags; /* see below for definition */
int cdb_len; /* Size of SCSI command in bytes */
/* NOTE: rel 4 uses this field only */
/* with commands not in group 1 or 2*/
int sense_len; /* for intr() if -1 don't get sense */
int timeout; /* timeout in seconds */
/* NOTE: actual resolution depends */
/* on driver implementation */
int kdebug; /* driver kernel debug level */
int resid; /* Bytes not transfered */
int error; /* Error code from scgintr() */
int ux_errno; /* UNIX error code */
#ifdef comment
XXX struct scsi_status scb; ??? /* Status returnd by command */
#endif
union {
struct scsi_status Scb; /* Status returnd by command */
Uchar cmd_scb[SCG_MAX_STATUS];
} u_scb;
#define scb u_scb.Scb
#ifdef comment
XXX struct scsi_sense sense; ??? /* Sense bytes from command */
#endif
union {
struct scsi_sense Sense; /* Sense bytes from command */
Uchar cmd_sense[SCG_MAX_SENSE];
} u_sense;
#define sense u_sense.Sense
int sense_count; /* Number of bytes valid in sense */
int target; /* SCSI target id */
/* NOTE: The SCSI target id field */
/* does not need to be filled unless */
/* the low level transport is a real */
/* scg driver. In this case the low */
/* level transport routine of libscg */
/* will fill in the needed value */
union { /* SCSI command descriptor block */
struct scsi_g0cdb g0_cdb;
struct scsi_g1cdb g1_cdb;
struct scsi_g5cdb g5_cdb;
Uchar cmd_cdb[SCG_MAX_CMD];
} cdb; /* 24 bytes max. size is supported */
};
#define dma_read flags /* 1 if DMA to Sun, 0 otherwise */
/*
* definition for flags field in scg_cmd struct
*/
#define SCG_RECV_DATA 0x0001 /* DMA direction to Sun */
#define SCG_DISRE_ENA 0x0002 /* enable disconnect/reconnect */
#define SCG_SILENT 0x0004 /* be silent on errors */
#define SCG_CMD_RETRY 0x0008 /* enable retries */
#define SCG_NOPARITY 0x0010 /* disable parity for this command */
/*
* definition for error field in scg_cmd struct
*
* The codes refer to SCSI general errors, not to device
* specific errors. Device specific errors are discovered
* by checking the sense data.
* The distinction between retryable and fatal is somewhat ad hoc.
*/
#define SCG_NO_ERROR 0 /* cdb transported without error */
/* SCG_NO_ERROR incudes all commands */
/* where the SCSI status is valid */
#define SCG_RETRYABLE 1 /* any other case e.g. SCSI bus busy */
/* SCSI cdb could not be send, */
/* includes DMA errors other than */
/* DMA underrun */
#define SCG_FATAL 2 /* could not select target */
#define SCG_TIMEOUT 3 /* driver timed out */
#ifdef __cplusplus
}
#endif
#endif /* _SCG_SCGCMD_H */

68
schily/scg/scgio.h Normal file
View File

@@ -0,0 +1,68 @@
/* @(#)scgio.h 2.16 00/11/07 Copyright 1986 J. Schilling */
/*
* Definitions for the SCSI general driver 'scg'
*
* Copyright (c) 1986 J. Schilling
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _SCG_SCGIO_H
#define _SCG_SCGIO_H
#ifndef _SCG_SCGCMD_H
#include <scg/scgcmd.h>
#endif
#if defined(SVR4)
#include <sys/ioccom.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__STDC__) || defined(SVR4)
#define SCGIOCMD _IOWR('G', 1, struct scg_cmd) /* do a SCSI cmd */
#define SCGIORESET _IO('G', 2) /* reset SCSI bus */
#define SCGIOGDISRE _IOR('G', 4, int) /* get sc disre Val*/
#define SCGIOSDISRE _IOW('G', 5, int) /* set sc disre Val*/
#define SCGIOIDBG _IO('G', 100) /* Inc Debug Val */
#define SCGIODDBG _IO('G', 101) /* Dec Debug Val */
#define SCGIOGDBG _IOR('G', 102, int) /* get Debug Val */
#define SCGIOSDBG _IOW('G', 103, int) /* set Debug Val */
#define SCIOGDBG _IOR('G', 104, int) /* get sc Debug Val*/
#define SCIOSDBG _IOW('G', 105, int) /* set sc Debug Val*/
#else
#define SCGIOCMD _IOWR(G, 1, struct scg_cmd) /* do a SCSI cmd */
#define SCGIORESET _IO(G, 2) /* reset SCSI bus */
#define SCGIOGDISRE _IOR(G, 4, int) /* get sc disre Val*/
#define SCGIOSDISRE _IOW(G, 5, int) /* set sc disre Val*/
#define SCGIOIDBG _IO(G, 100) /* Inc Debug Val */
#define SCGIODDBG _IO(G, 101) /* Dec Debug Val */
#define SCGIOGDBG _IOR(G, 102, int) /* get Debug Val */
#define SCGIOSDBG _IOW(G, 103, int) /* set Debug Val */
#define SCIOGDBG _IOR(G, 104, int) /* get sc Debug Val*/
#define SCIOSDBG _IOW(G, 105, int) /* set sc Debug Val*/
#endif
#define SCGIO_CMD SCGIOCMD /* backward ccompatibility */
#ifdef __cplusplus
}
#endif
#endif /* _SCG_SCGIO_H */

69
schily/scg/scgops.h Normal file
View File

@@ -0,0 +1,69 @@
/* @(#)scgops.h 1.5 02/10/19 Copyright 2000 J. Schilling */
/*
* 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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _SCG_SCGOPS_H
#define _SCG_SCGOPS_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct scg_ops {
int (*scgo_send) __PR((SCSI *scgp));
char * (*scgo_version) __PR((SCSI *scgp, int what));
#ifdef EOF /* stdio.h has been included */
int (*scgo_help) __PR((SCSI *scgp, FILE *f));
#else
int (*scgo_help) __PR((SCSI *scgp, void *f));
#endif
int (*scgo_open) __PR((SCSI *scgp, char *device));
int (*scgo_close) __PR((SCSI *scgp));
long (*scgo_maxdma) __PR((SCSI *scgp, long amt));
void * (*scgo_getbuf) __PR((SCSI *scgp, long amt));
void (*scgo_freebuf) __PR((SCSI *scgp));
BOOL (*scgo_havebus) __PR((SCSI *scgp, int busno));
int (*scgo_fileno) __PR((SCSI *scgp, int busno, int tgt, int tlun));
int (*scgo_initiator_id) __PR((SCSI *scgp));
int (*scgo_isatapi) __PR((SCSI *scgp));
int (*scgo_reset) __PR((SCSI *scgp, int what));
} scg_ops_t;
#define SCGO_SEND(scgp) (*(scgp)->ops->scgo_send)(scgp)
#define SCGO_VERSION(scgp, what) (*(scgp)->ops->scgo_version)(scgp, what)
#define SCGO_HELP(scgp, f) (*(scgp)->ops->scgo_help)(scgp, f)
#define SCGO_OPEN(scgp, device) (*(scgp)->ops->scgo_open)(scgp, device)
#define SCGO_CLOSE(scgp) (*(scgp)->ops->scgo_close)(scgp)
#define SCGO_MAXDMA(scgp, amt) (*(scgp)->ops->scgo_maxdma)(scgp, amt)
#define SCGO_GETBUF(scgp, amt) (*(scgp)->ops->scgo_getbuf)(scgp, amt)
#define SCGO_FREEBUF(scgp) (*(scgp)->ops->scgo_freebuf)(scgp)
#define SCGO_HAVEBUS(scgp, busno) (*(scgp)->ops->scgo_havebus)(scgp, busno)
#define SCGO_FILENO(scgp, busno, tgt, tlun) (*(scgp)->ops->scgo_fileno)(scgp, busno, tgt, tlun)
#define SCGO_INITIATOR_ID(scgp) (*(scgp)->ops->scgo_initiator_id)(scgp)
#define SCGO_ISATAPI(scgp) (*(scgp)->ops->scgo_isatapi)(scgp)
#define SCGO_RESET(scgp, what) (*(scgp)->ops->scgo_reset)(scgp, what)
#ifdef __cplusplus
}
#endif
#endif /* _SCG_SCGOPS_H */

249
schily/scg/scsicdb.h Normal file
View File

@@ -0,0 +1,249 @@
/* @(#)scsicdb.h 2.19 04/09/04 Copyright 1986 J. Schilling */
/*
* Definitions for the SCSI Command Descriptor Block
*
* Copyright (c) 1986 J. Schilling
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 _SCG_SCSICDB_H
#define _SCG_SCSICDB_H
#ifndef _UTYPES_H
#include <utypes.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* SCSI Operation codes.
*/
#define SC_TEST_UNIT_READY 0x00
#define SC_REZERO_UNIT 0x01
#define SC_REQUEST_SENSE 0x03
#define SC_FORMAT 0x04
#define SC_FORMAT_TRACK 0x06
#define SC_REASSIGN_BLOCK 0x07 /* CCS only */
#define SC_SEEK 0x0b
#define SC_TRANSLATE 0x0f /* ACB4000 only */
#define SC_INQUIRY 0x12 /* CCS only */
#define SC_MODE_SELECT 0x15
#define SC_RESERVE 0x16
#define SC_RELEASE 0x17
#define SC_MODE_SENSE 0x1a
#define SC_START 0x1b
#define SC_READ_DEFECT_LIST 0x37 /* CCS only, group 1 */
#define SC_READ_BUFFER 0x3c /* CCS only, group 1 */
/*
* Note, these two commands use identical command blocks for all
* controllers except the Adaptec ACB 4000 which sets bit 1 of byte 1.
*/
#define SC_READ 0x08
#define SC_WRITE 0x0a
#define SC_EREAD 0x28 /* 10 byte read */
#define SC_EWRITE 0x2a /* 10 byte write */
#define SC_WRITE_VERIFY 0x2e /* 10 byte write+verify */
#define SC_WRITE_FILE_MARK 0x10
#define SC_UNKNOWN 0xff /* cmd list terminator */
/*
* Standard SCSI control blocks.
* These go in or out over the SCSI bus.
*/
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
struct scsi_g0cdb { /* scsi group 0 command description block */
Uchar cmd; /* command code */
Ucbit high_addr : 5; /* high part of block address */
Ucbit lun : 3; /* logical unit number */
Uchar mid_addr; /* middle part of block address */
Uchar low_addr; /* low part of block address */
Uchar count; /* transfer length */
Ucbit link : 1; /* link (another command follows) */
Ucbit fr : 1; /* flag request (interrupt at completion) */
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
Ucbit rsvd : 3; /* reserved */
Ucbit vu_56 : 1; /* vendor unique (byte 5 bit 6) */
Ucbit vu_57 : 1; /* vendor unique (byte 5 bit 7) */
};
#else /* Motorola byteorder */
struct scsi_g0cdb { /* scsi group 0 command description block */
Uchar cmd; /* command code */
Ucbit lun : 3; /* logical unit number */
Ucbit high_addr : 5; /* high part of block address */
Uchar mid_addr; /* middle part of block address */
Uchar low_addr; /* low part of block address */
Uchar count; /* transfer length */
Ucbit vu_57 : 1; /* vendor unique (byte 5 bit 7) */
Ucbit vu_56 : 1; /* vendor unique (byte 5 bit 6) */
Ucbit rsvd : 3; /* reserved */
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
Ucbit fr : 1; /* flag request (interrupt at completion) */
Ucbit link : 1; /* link (another command follows) */
};
#endif
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
struct scsi_g1cdb { /* scsi group 1 command description block */
Uchar cmd; /* command code */
Ucbit reladr : 1; /* address is relative */
Ucbit res : 4; /* reserved bits 1-4 of byte 1 */
Ucbit lun : 3; /* logical unit number */
Uchar addr[4]; /* logical block address */
Uchar res6; /* reserved byte 6 */
Uchar count[2]; /* transfer length */
Ucbit link : 1; /* link (another command follows) */
Ucbit fr : 1; /* flag request (interrupt at completion) */
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
Ucbit rsvd : 3; /* reserved */
Ucbit vu_96 : 1; /* vendor unique (byte 5 bit 6) */
Ucbit vu_97 : 1; /* vendor unique (byte 5 bit 7) */
};
#else /* Motorola byteorder */
struct scsi_g1cdb { /* scsi group 1 command description block */
Uchar cmd; /* command code */
Ucbit lun : 3; /* logical unit number */
Ucbit res : 4; /* reserved bits 1-4 of byte 1 */
Ucbit reladr : 1; /* address is relative */
Uchar addr[4]; /* logical block address */
Uchar res6; /* reserved byte 6 */
Uchar count[2]; /* transfer length */
Ucbit vu_97 : 1; /* vendor unique (byte 5 bit 7) */
Ucbit vu_96 : 1; /* vendor unique (byte 5 bit 6) */
Ucbit rsvd : 3; /* reserved */
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
Ucbit fr : 1; /* flag request (interrupt at completion) */
Ucbit link : 1; /* link (another command follows) */
};
#endif
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
struct scsi_g5cdb { /* scsi group 5 command description block */
Uchar cmd; /* command code */
Ucbit reladr : 1; /* address is relative */
Ucbit res : 4; /* reserved bits 1-4 of byte 1 */
Ucbit lun : 3; /* logical unit number */
Uchar addr[4]; /* logical block address */
Uchar count[4]; /* transfer length */
Uchar res10; /* reserved byte 10 */
Ucbit link : 1; /* link (another command follows) */
Ucbit fr : 1; /* flag request (interrupt at completion) */
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
Ucbit rsvd : 3; /* reserved */
Ucbit vu_B6 : 1; /* vendor unique (byte B bit 6) */
Ucbit vu_B7 : 1; /* vendor unique (byte B bit 7) */
};
#else /* Motorola byteorder */
struct scsi_g5cdb { /* scsi group 5 command description block */
Uchar cmd; /* command code */
Ucbit lun : 3; /* logical unit number */
Ucbit res : 4; /* reserved bits 1-4 of byte 1 */
Ucbit reladr : 1; /* address is relative */
Uchar addr[4]; /* logical block address */
Uchar count[4]; /* transfer length */
Uchar res10; /* reserved byte 10 */
Ucbit vu_B7 : 1; /* vendor unique (byte B bit 7) */
Ucbit vu_B6 : 1; /* vendor unique (byte B bit 6) */
Ucbit rsvd : 3; /* reserved */
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
Ucbit fr : 1; /* flag request (interrupt at completion) */
Ucbit link : 1; /* link (another command follows) */
};
#endif
#define g0_cdbaddr(cdb, a) ((cdb)->high_addr = (a) >> 16,\
(cdb)->mid_addr = ((a) >> 8) & 0xFF,\
(cdb)->low_addr = (a) & 0xFF)
#define g1_cdbaddr(cdb, a) ((cdb)->addr[0] = (a) >> 24,\
(cdb)->addr[1] = ((a) >> 16)& 0xFF,\
(cdb)->addr[2] = ((a) >> 8) & 0xFF,\
(cdb)->addr[3] = (a) & 0xFF)
#define g5_cdbaddr(cdb, a) g1_cdbaddr(cdb, a)
#define g0_cdblen(cdb, len) ((cdb)->count = (len))
#define g1_cdblen(cdb, len) ((cdb)->count[0] = ((len) >> 8) & 0xFF,\
(cdb)->count[1] = (len) & 0xFF)
#define g5_cdblen(cdb, len) ((cdb)->count[0] = (len) >> 24L,\
(cdb)->count[1] = ((len) >> 16L)& 0xFF,\
(cdb)->count[2] = ((len) >> 8L) & 0xFF,\
(cdb)->count[3] = (len) & 0xFF)
/*#define XXXXX*/
#ifdef XXXXX
#define i_to_long(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 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 i_to_short(a, i) (((Uchar *)(a))[0] = ((i) >> 8) & 0xFF,\
((Uchar *)(a))[1] = (i) & 0xFF)
#define a_to_u_short(a) ((unsigned short) \
((((Uchar*) a)[1] & 0xFF) | \
(((Uchar*) a)[0] << 8 & 0xFF00)))
#define a_to_3_byte(a) ((Ulong) \
((((Uchar*) a)[2] & 0xFF) | \
(((Uchar*) a)[1] << 8 & 0xFF00) | \
(((Uchar*) a)[0] << 16 & 0xFF0000)))
#ifdef __STDC__
#define a_to_u_long(a) ((Ulong) \
((((Uchar*) a)[3] & 0xFF) | \
(((Uchar*) a)[2] << 8 & 0xFF00) | \
(((Uchar*) a)[1] << 16 & 0xFF0000) | \
(((Uchar*) a)[0] << 24 & 0xFF000000UL)))
#else
#define a_to_u_long(a) ((Ulong) \
((((Uchar*) a)[3] & 0xFF) | \
(((Uchar*) a)[2] << 8 & 0xFF00) | \
(((Uchar*) a)[1] << 16 & 0xFF0000) | \
(((Uchar*) a)[0] << 24 & 0xFF000000)))
#endif
#endif /* XXXX */
#ifdef __cplusplus
}
#endif
#endif /* _SCG_SCSICDB_H */

111
schily/scg/scsidefs.h Normal file
View File

@@ -0,0 +1,111 @@
/* @(#)scsidefs.h 1.28 04/09/04 Copyright 1988 J. Schilling */
/*
* Definitions for SCSI devices i.e. for error strings in scsierrs.c
*
* Copyright (c) 1988 J. Schilling
*/
/*@@C@@*/
#ifndef _SCG_SCSIDEFS_H
#define _SCG_SCSIDEFS_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Disks
*/
#ifdef DEV_UNKNOWN
/*
* True64 defines DEV_UNKNOWN in /usr/include/sys/devio.h as "UNKNOWN"
*/
#undef DEV_UNKNOWN
#endif
#define DEV_UNKNOWN 0
#define DEV_ACB40X0 1
#define DEV_ACB4000 2
#define DEV_ACB4010 3
#define DEV_ACB4070 4
#define DEV_ACB5500 5
#define DEV_ACB4520A 6
#define DEV_ACB4525 7
#define DEV_MD21 8
#define DEV_MD23 9
#define DEV_NON_CCS_DSK 10
#define DEV_CCS_GENDISK 11
/*
* Tapes
*/
#define DEV_MT02 100
#define DEV_SC4000 101
/*
* Printer
*/
#define DEV_PRT 200
/*
* Processors
*/
#define DEV_PROC 300
/*
* Worm
*/
#define DEV_WORM 400
#define DEV_RXT800S 401
/*
* CD-ROM
*/
#define DEV_CDROM 500
#define DEV_MMC_CDROM 501
#define DEV_MMC_CDR 502
#define DEV_MMC_CDRW 503
#define DEV_MMC_DVD 504
#define DEV_MMC_DVD_WR 505
#define DEV_CDD_521_OLD 510
#define DEV_CDD_521 511
#define DEV_CDD_522 512
#define DEV_PCD_600 513
#define DEV_CDD_2000 514
#define DEV_CDD_2600 515
#define DEV_TYUDEN_EW50 516
#define DEV_YAMAHA_CDR_100 520
#define DEV_YAMAHA_CDR_400 521
#define DEV_PLASMON_RF_4100 530
#define DEV_SONY_CDU_924 540
#define DEV_RICOH_RO_1420C 550
#define DEV_RICOH_RO_1060C 551
#define DEV_TEAC_CD_R50S 560
#define DEV_MATSUSHITA_7501 570
#define DEV_MATSUSHITA_7502 571
#define DEV_PIONEER_DW_S114X 580
#define DEV_PIONEER_DVDR_S101 581
/*
* Scanners
*/
#define DEV_HRSCAN 600
#define DEV_MS300A 601
/*
* Optical memory
*/
#define DEV_SONY_SMO 700
#define old_acb(d) (((d) == DEV_ACB40X0) || \
((d) == DEV_ACB4000) || ((d) == DEV_ACB4010) || \
((d) == DEV_ACB4070) || ((d) == DEV_ACB5500))
#define is_ccs(d) (!old_acb(d))
#ifdef __cplusplus
}
#endif
#endif /* _SCG_SCSIDEFS_H */

1229
schily/scg/scsireg.h Normal file

File diff suppressed because it is too large Load Diff

191
schily/scg/scsisense.h Normal file
View File

@@ -0,0 +1,191 @@
/* @(#)scsisense.h 2.18 04/09/04 Copyright 1986 J. Schilling */
/*
* Definitions for the SCSI status code and sense structure
*
* Copyright (c) 1986 J. Schilling
*/
/*@@C@@*/
#ifndef _SCG_SCSISENSE_H
#define _SCG_SCSISENSE_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* SCSI status completion block.
*/
#define SCSI_EXTENDED_STATUS
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
struct scsi_status {
Ucbit vu_00 : 1; /* vendor unique */
Ucbit chk : 1; /* check condition: sense data available */
Ucbit cm : 1; /* condition met */
Ucbit busy : 1; /* device busy or reserved */
Ucbit is : 1; /* intermediate status sent */
Ucbit vu_05 : 1; /* vendor unique */
#define st_scsi2 vu_05 /* SCSI-2 modifier bit */
Ucbit vu_06 : 1; /* vendor unique */
Ucbit st_rsvd : 1; /* reserved */
#ifdef SCSI_EXTENDED_STATUS
#define ext_st1 st_rsvd /* extended status (next byte valid) */
/* byte 1 */
Ucbit ha_er : 1; /* host adapter detected error */
Ucbit reserved: 6; /* reserved */
Ucbit ext_st2 : 1; /* extended status (next byte valid) */
/* byte 2 */
Uchar byte2; /* third byte */
#endif /* SCSI_EXTENDED_STATUS */
};
#else /* Motorola byteorder */
struct scsi_status {
Ucbit st_rsvd : 1; /* reserved */
Ucbit vu_06 : 1; /* vendor unique */
Ucbit vu_05 : 1; /* vendor unique */
#define st_scsi2 vu_05 /* SCSI-2 modifier bit */
Ucbit is : 1; /* intermediate status sent */
Ucbit busy : 1; /* device busy or reserved */
Ucbit cm : 1; /* condition met */
Ucbit chk : 1; /* check condition: sense data available */
Ucbit vu_00 : 1; /* vendor unique */
#ifdef SCSI_EXTENDED_STATUS
#define ext_st1 st_rsvd /* extended status (next byte valid) */
/* byte 1 */
Ucbit ext_st2 : 1; /* extended status (next byte valid) */
Ucbit reserved: 6; /* reserved */
Ucbit ha_er : 1; /* host adapter detected error */
/* byte 2 */
Uchar byte2; /* third byte */
#endif /* SCSI_EXTENDED_STATUS */
};
#endif
/*
* OLD Standard (Non Extended) SCSI Sense. Used mainly by the
* Adaptec ACB 4000 which is the only controller that
* does not support the Extended sense format.
*/
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
struct scsi_sense { /* scsi sense for error classes 0-6 */
Ucbit code : 7; /* error class/code */
Ucbit adr_val : 1; /* sense data is valid */
#ifdef comment
Ucbit high_addr:5; /* high byte of block addr */
Ucbit rsvd : 3;
#else
Uchar high_addr; /* high byte of block addr */
#endif
Uchar mid_addr; /* middle byte of block addr */
Uchar low_addr; /* low byte of block addr */
};
#else /* Motorola byteorder */
struct scsi_sense { /* scsi sense for error classes 0-6 */
Ucbit adr_val : 1; /* sense data is valid */
Ucbit code : 7; /* error class/code */
#ifdef comment
Ucbit rsvd : 3;
Ucbit high_addr:5; /* high byte of block addr */
#else
Uchar high_addr; /* high byte of block addr */
#endif
Uchar mid_addr; /* middle byte of block addr */
Uchar low_addr; /* low byte of block addr */
};
#endif
/*
* SCSI extended sense parameter block.
*/
#ifdef comment
#define SC_CLASS_EXTENDED_SENSE 0x7 /* indicates extended sense */
#endif
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
struct scsi_ext_sense { /* scsi extended sense for error class 7 */
/* byte 0 */
Ucbit type : 7; /* fixed at 0x70 */
Ucbit adr_val : 1; /* sense data is valid */
/* byte 1 */
Uchar seg_num; /* segment number, applies to copy cmd only */
/* byte 2 */
Ucbit key : 4; /* sense key, see below */
Ucbit : 1; /* reserved */
Ucbit ili : 1; /* incorrect length indicator */
Ucbit eom : 1; /* end of media */
Ucbit fil_mk : 1; /* file mark on device */
/* bytes 3 through 7 */
Uchar info_1; /* information byte 1 */
Uchar info_2; /* information byte 2 */
Uchar info_3; /* information byte 3 */
Uchar info_4; /* information byte 4 */
Uchar add_len; /* number of additional bytes */
/* bytes 8 through 13, CCS additions */
Uchar optional_8; /* CCS search and copy only */
Uchar optional_9; /* CCS search and copy only */
Uchar optional_10; /* CCS search and copy only */
Uchar optional_11; /* CCS search and copy only */
Uchar sense_code; /* sense code */
Uchar qual_code; /* sense code qualifier */
Uchar fru_code; /* Field replacable unit code */
Ucbit bptr : 3; /* bit pointer for failure (if bpv) */
Ucbit bpv : 1; /* bit pointer is valid */
Ucbit : 2;
Ucbit cd : 1; /* pointers refer to command not data */
Ucbit sksv : 1; /* sense key specific valid */
Uchar field_ptr[2]; /* field pointer for failure */
Uchar add_info[2]; /* round up to 20 bytes */
};
#else /* Motorola byteorder */
struct scsi_ext_sense { /* scsi extended sense for error class 7 */
/* byte 0 */
Ucbit adr_val : 1; /* sense data is valid */
Ucbit type : 7; /* fixed at 0x70 */
/* byte 1 */
Uchar seg_num; /* segment number, applies to copy cmd only */
/* byte 2 */
Ucbit fil_mk : 1; /* file mark on device */
Ucbit eom : 1; /* end of media */
Ucbit ili : 1; /* incorrect length indicator */
Ucbit : 1; /* reserved */
Ucbit key : 4; /* sense key, see below */
/* bytes 3 through 7 */
Uchar info_1; /* information byte 1 */
Uchar info_2; /* information byte 2 */
Uchar info_3; /* information byte 3 */
Uchar info_4; /* information byte 4 */
Uchar add_len; /* number of additional bytes */
/* bytes 8 through 13, CCS additions */
Uchar optional_8; /* CCS search and copy only */
Uchar optional_9; /* CCS search and copy only */
Uchar optional_10; /* CCS search and copy only */
Uchar optional_11; /* CCS search and copy only */
Uchar sense_code; /* sense code */
Uchar qual_code; /* sense code qualifier */
Uchar fru_code; /* Field replacable unit code */
Ucbit sksv : 1; /* sense key specific valid */
Ucbit cd : 1; /* pointers refer to command not data */
Ucbit : 2;
Ucbit bpv : 1; /* bit pointer is valid */
Ucbit bptr : 3; /* bit pointer for failure (if bpv) */
Uchar field_ptr[2]; /* field pointer for failure */
Uchar add_info[2]; /* round up to 20 bytes */
};
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SCG_SCSISENSE_H */

257
schily/scg/scsitransp.h Normal file
View File

@@ -0,0 +1,257 @@
/* @(#)scsitransp.h 1.54 03/05/03 Copyright 1995 J. Schilling */
/*
* Definitions for commands that use functions from scsitransp.c
*
* 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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 _SCG_SCSITRANSP_H
#define _SCG_SCSITRANSP_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct scg_scsi SCSI;
typedef struct {
int scsibus; /* SCSI bus # for next I/O */
int target; /* SCSI target # for next I/O */
int lun; /* SCSI lun # for next I/O */
} scg_addr_t;
#ifndef _SCG_SCGOPS_H
#include <scg/scgops.h>
#endif
typedef int (*scg_cb_t) __PR((void *));
struct scg_scsi {
scg_ops_t *ops; /* Ptr to low level SCSI transport ops */
int fd; /* File descriptor for next I/O */
scg_addr_t addr; /* SCSI address for next I/O */
int flags; /* Libscg flags (see below) */
int dflags; /* Drive specific flags (see below) */
int kdebug; /* Kernel debug value for next I/O */
int debug; /* Debug value for SCSI library */
int silent; /* Be silent if value > 0 */
int verbose; /* Be verbose if value > 0 */
int overbose; /* Be verbose in open() if value > 0 */
int disre_disable;
int deftimeout;
int noparity; /* Do not use SCSI parity fo next I/O */
int dev; /* from scsi_cdr.c */
struct scg_cmd *scmd;
char *cmdname;
char *curcmdname;
BOOL running;
int error; /* libscg error number */
long maxdma; /* Max DMA limit for this open instance */
long maxbuf; /* Cur DMA buffer limit for this inst. */
/* This is the size behind bufptr */
struct timeval *cmdstart;
struct timeval *cmdstop;
const char **nonstderrs;
void *local; /* Local data from the low level code */
void *bufbase; /* needed for scsi_freebuf() */
void *bufptr; /* DMA buffer pointer for appl. use */
char *errstr; /* Error string for scsi_open/sendmcd */
char *errbeg; /* Pointer to begin of not flushed data */
char *errptr; /* Actual write pointer into errstr */
void *errfile; /* FILE to write errors to. NULL for not*/
/* writing and leaving errs in errstr */
scg_cb_t cb_fun;
void *cb_arg;
struct scsi_inquiry *inq;
struct scsi_capacity *cap;
};
/*
* Macros for accessing members of the scg address structure.
* scg_settarget() is the only function that is allowed to modify
* the values of the SCSI address.
*/
#define scg_scsibus(scgp) (scgp)->addr.scsibus
#define scg_target(scgp) (scgp)->addr.target
#define scg_lun(scgp) (scgp)->addr.lun
/*
* Flags for struct SCSI:
*/
/* NONE yet */
/*
* Drive specific flags for struct SCSI:
*/
#define DRF_MODE_DMA_OVR 0x0001 /* Drive gives DMA overrun */
/* on mode sense */
#define SCSI_ERRSTR_SIZE 4096
/*
* Libscg error codes:
*/
#define SCG_ERRBASE 1000000
#define SCG_NOMEM 1000001
/*
* Function codes for scg_version():
*/
#define SCG_VERSION 0 /* libscg or transport version */
#define SCG_AUTHOR 1 /* Author of above */
#define SCG_SCCS_ID 2 /* SCCS id of above */
#define SCG_RVERSION 10 /* Remote transport version */
#define SCG_RAUTHOR 11 /* Remote transport author */
#define SCG_RSCCS_ID 12 /* Remote transport SCCS ID */
#define SCG_KVERSION 20 /* Kernel transport version */
/*
* Function codes for scg_reset():
*/
#define SCG_RESET_NOP 0 /* Test if reset is supported */
#define SCG_RESET_TGT 1 /* Reset Target only */
#define SCG_RESET_BUS 2 /* Reset complete SCSI Bus */
/*
* Helpers for the error buffer in SCSI*
*/
#define scg_errsize(scgp) ((scgp)->errptr - (scgp)->errstr)
#define scg_errrsize(scgp) (SCSI_ERRSTR_SIZE - scg_errsize(scgp))
/*
* From scsitransp.c:
*/
extern char *scg_version __PR((SCSI *scgp, int what));
extern int scg__open __PR((SCSI *scgp, char *device));
extern int scg__close __PR((SCSI *scgp));
extern BOOL scg_havebus __PR((SCSI *scgp, int));
extern int scg_initiator_id __PR((SCSI *scgp));
extern int scg_isatapi __PR((SCSI *scgp));
extern int scg_reset __PR((SCSI *scgp, int what));
extern void *scg_getbuf __PR((SCSI *scgp, long));
extern void scg_freebuf __PR((SCSI *scgp));
extern long scg_bufsize __PR((SCSI *scgp, long));
extern void scg_setnonstderrs __PR((SCSI *scgp, const char **));
extern BOOL scg_yes __PR((char *));
extern int scg_cmd __PR((SCSI *scgp));
extern void scg_vhead __PR((SCSI *scgp));
extern int scg_svhead __PR((SCSI *scgp, char *buf, int maxcnt));
extern int scg_vtail __PR((SCSI *scgp));
extern int scg_svtail __PR((SCSI *scgp, int *retp, char *buf, int maxcnt));
extern void scg_vsetup __PR((SCSI *scgp));
extern int scg_getresid __PR((SCSI *scgp));
extern int scg_getdmacnt __PR((SCSI *scgp));
extern BOOL scg_cmd_err __PR((SCSI *scgp));
extern void scg_printerr __PR((SCSI *scgp));
#ifdef EOF /* stdio.h has been included */
extern void scg_fprinterr __PR((SCSI *scgp, FILE *f));
#endif
extern int scg_sprinterr __PR((SCSI *scgp, char *buf, int maxcnt));
extern int scg__sprinterr __PR((SCSI *scgp, char *buf, int maxcnt));
extern void scg_printcdb __PR((SCSI *scgp));
extern int scg_sprintcdb __PR((SCSI *scgp, char *buf, int maxcnt));
extern void scg_printwdata __PR((SCSI *scgp));
extern int scg_sprintwdata __PR((SCSI *scgp, char *buf, int maxcnt));
extern void scg_printrdata __PR((SCSI *scgp));
extern int scg_sprintrdata __PR((SCSI *scgp, char *buf, int maxcnt));
extern void scg_printresult __PR((SCSI *scgp));
extern int scg_sprintresult __PR((SCSI *scgp, char *buf, int maxcnt));
extern void scg_printstatus __PR((SCSI *scgp));
extern int scg_sprintstatus __PR((SCSI *scgp, char *buf, int maxcnt));
#ifdef EOF /* stdio.h has been included */
extern void scg_fprbytes __PR((FILE *, char *, unsigned char *, int));
extern void scg_fprascii __PR((FILE *, char *, unsigned char *, int));
#endif
extern void scg_prbytes __PR((char *, unsigned char *, int));
extern void scg_prascii __PR((char *, unsigned char *, int));
extern int scg_sprbytes __PR((char *buf, int maxcnt, char *, unsigned char *, int));
extern int scg_sprascii __PR((char *buf, int maxcnt, char *, unsigned char *, int));
#ifdef EOF /* stdio.h has been included */
extern void scg_fprsense __PR((FILE *f, unsigned char *, int));
#endif
extern void scg_prsense __PR((unsigned char *, int));
extern int scg_sprsense __PR((char *buf, int maxcnt, unsigned char *, int));
extern int scg_cmd_status __PR((SCSI *scgp));
extern int scg_sense_key __PR((SCSI *scgp));
extern int scg_sense_code __PR((SCSI *scgp));
extern int scg_sense_qual __PR((SCSI *scgp));
#ifdef _SCG_SCSIREG_H
#ifdef EOF /* stdio.h has been included */
extern void scg_fprintdev __PR((FILE *, struct scsi_inquiry *));
#endif
extern void scg_printdev __PR((struct scsi_inquiry *));
#endif
extern int scg_printf __PR((SCSI *scgp, const char *form, ...));
extern int scg_errflush __PR((SCSI *scgp));
#ifdef EOF /* stdio.h has been included */
extern int scg_errfflush __PR((SCSI *scgp, FILE *f));
#endif
/*
* From scsierrmsg.c:
*/
extern const char *scg_sensemsg __PR((int, int, int,
const char **, char *, int maxcnt));
#ifdef _SCG_SCSISENSE_H
extern int scg__errmsg __PR((SCSI *scgp, char *obuf, int maxcnt,
struct scsi_sense *,
struct scsi_status *,
int));
#endif
/*
* From scsiopen.c:
*/
#ifdef EOF /* stdio.h has been included */
extern int scg_help __PR((FILE *f));
#endif
extern SCSI *scg_open __PR((char *scsidev, char *errs, int slen, int odebug, int be_verbose));
extern int scg_close __PR((SCSI * scgp));
extern void scg_settimeout __PR((SCSI * scgp, int timeout));
extern SCSI *scg_smalloc __PR((void));
extern void scg_sfree __PR((SCSI *scgp));
/*
* From scgsettarget.c:
*/
extern int scg_settarget __PR((SCSI *scgp, int scsibus, int target, int lun));
/*
* From scsi-remote.c:
*/
extern scg_ops_t *scg_remote __PR((void));
/*
* From scsihelp.c:
*/
#ifdef EOF /* stdio.h has been included */
extern void __scg_help __PR((FILE *f, char *name, char *tcomment,
char *tind,
char *tspec,
char *texample,
BOOL mayscan,
BOOL bydev));
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SCG_SCSITRANSP_H */

131
schily/scg/spti-wnt.h Normal file
View File

@@ -0,0 +1,131 @@
/*
* distilled information from various header files from Microsoft's
* DDK for Windows NT 4.0
*/
#ifndef _SCSIPT_H_INC
#define _SCSIPT_H_INC
#include <windows.h>
typedef struct {
USHORT Length;
UCHAR ScsiStatus;
UCHAR PathId;
UCHAR TargetId;
UCHAR Lun;
UCHAR CdbLength;
UCHAR SenseInfoLength;
UCHAR DataIn;
ULONG DataTransferLength;
ULONG TimeOutValue;
ULONG DataBufferOffset;
ULONG SenseInfoOffset;
UCHAR Cdb[16];
} SCSI_PASS_THROUGH, *PSCSI_PASS_THROUGH;
typedef struct {
USHORT Length;
UCHAR ScsiStatus;
UCHAR PathId;
UCHAR TargetId;
UCHAR Lun;
UCHAR CdbLength;
UCHAR SenseInfoLength;
UCHAR DataIn;
ULONG DataTransferLength;
ULONG TimeOutValue;
PVOID DataBuffer;
ULONG SenseInfoOffset;
UCHAR Cdb[16];
} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
typedef struct {
SCSI_PASS_THROUGH spt;
ULONG Filler;
UCHAR ucSenseBuf[32];
UCHAR ucDataBuf[512];
} SCSI_PASS_THROUGH_WITH_BUFFERS, *PSCSI_PASS_THROUGH_WITH_BUFFERS;
typedef struct {
SCSI_PASS_THROUGH_DIRECT spt;
ULONG Filler;
UCHAR ucSenseBuf[32];
} SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, *PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER;
typedef struct {
UCHAR NumberOfLogicalUnits;
UCHAR InitiatorBusId;
ULONG InquiryDataOffset;
} SCSI_BUS_DATA, *PSCSI_BUS_DATA;
typedef struct {
UCHAR NumberOfBusses;
SCSI_BUS_DATA BusData[1];
} SCSI_ADAPTER_BUS_INFO, *PSCSI_ADAPTER_BUS_INFO;
typedef struct {
UCHAR PathId;
UCHAR TargetId;
UCHAR Lun;
BOOLEAN DeviceClaimed;
ULONG InquiryDataLength;
ULONG NextInquiryDataOffset;
UCHAR InquiryData[1];
} SCSI_INQUIRY_DATA, *PSCSI_INQUIRY_DATA;
typedef struct {
ULONG Length;
UCHAR PortNumber;
UCHAR PathId;
UCHAR TargetId;
UCHAR Lun;
} SCSI_ADDRESS, *PSCSI_ADDRESS;
/*
* method codes
*/
#define METHOD_BUFFERED 0
#define METHOD_IN_DIRECT 1
#define METHOD_OUT_DIRECT 2
#define METHOD_NEITHER 3
/*
* file access values
*/
#define FILE_ANY_ACCESS 0
#define FILE_READ_ACCESS 0x0001
#define FILE_WRITE_ACCESS 0x0002
#define IOCTL_SCSI_BASE 0x00000004
/*
* constants for DataIn member of SCSI_PASS_THROUGH* structures
*/
#define SCSI_IOCTL_DATA_OUT 0
#define SCSI_IOCTL_DATA_IN 1
#define SCSI_IOCTL_DATA_UNSPECIFIED 2
/*
* Standard IOCTL define
*/
#define CTL_CODE(DevType, Function, Method, Access) \
(((DevType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
#define IOCTL_SCSI_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_SCSI_MINIPORT CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_SCSI_GET_INQUIRY_DATA CTL_CODE(IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_SCSI_GET_ADDRESS CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS)
#endif

169
schily/scg/srb_os2.h Normal file
View File

@@ -0,0 +1,169 @@
/* @(#)srb_os2.h 1.0 98/10/28 Copyright 1998 D. Dorau, C. Wohlgemuth */
/*
* Definitions for ASPI-Router (ASPIROUT.SYS).
*
* Copyright (c) 1998 D. Dorau, C. Wohlgemuth
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#pragma pack(1)
/* SRB command */
#define SRB_Inquiry 0x00
#define SRB_Device 0x01
#define SRB_Command 0x02
#define SRB_Abort 0x03
#define SRB_Reset 0x04
#define SRB_Param 0x05
/* SRB status */
#define SRB_Busy 0x00 /* SCSI request in progress */
#define SRB_Done 0x01 /* SCSI request completed without error */
#define SRB_Aborted 0x02 /* SCSI aborted by host */
#define SRB_BadAbort 0x03 /* Unable to abort SCSI request */
#define SRB_Error 0x04 /* SCSI request completed with error */
#define SRB_BusyPost 0x10 /* SCSI request in progress with POST - Nokia */
#define SRB_InvalidCmd 0x80 /* Invalid SCSI request */
#define SRB_InvalidHA 0x81 /* Invalid Hhost adapter number */
#define SRB_BadDevice 0x82 /* SCSI device not installed */
/* SRB flags */
#define SRB_Post 0x01 /* Post vector valid */
#define SRB_Link 0x02 /* Link vector valid */
#define SRB_SG 0x04 /* Nokia: scatter/gather */
/* S/G: n * (4 bytes length, 4 bytes addr) */
/* No of s/g items not limited by HA spec. */
#define SRB_NoCheck 0x00 /* determined by command, not checked */
#define SRB_Read 0x08 /* target to host, length checked */
#define SRB_Write 0x10 /* host to target, length checked */
#define SRB_NoTransfer 0x18 /* no data transfer */
#define SRB_DirMask 0x18 /* bit mask */
/* SRB host adapter status */
#define SRB_NoError 0x00 /* No host adapter detected error */
#define SRB_Timeout 0x11 /* Selection timeout */
#define SRB_DataLength 0x12 /* Data over/underrun */
#define SRB_BusFree 0x13 /* Unexpected bus free */
#define SRB_BusSequence 0x14 /* Target bus sequence failure */
/* SRB target status field */
#define SRB_NoStatus 0x00 /* No target status */
#define SRB_CheckStatus 0x02 /* Check status (sense data valid) */
#define SRB_LUN_Busy 0x08 /* Specified LUN is busy */
#define SRB_Reserved 0x18 /* Reservation conflict */
#define MaxCDBStatus 64 /* max size of CDB + status */
typedef struct SRb {
unsigned char cmd, /* 00 */
status, /* 01 */
ha_num, /* 02 */
flags; /* 03 */
unsigned long res_04_07; /* 04..07 */
union { /* 08 */
/* SRB_Inquiry */
struct {
unsigned char num_ha, /* 08 */
ha_target, /* 09 */
aspimgr_id[16], /* 0A..19 */
host_id[16], /* 1A..29 */
unique_id[16]; /* 2A..39 */
} inq;
/* SRB_Device */
struct {
unsigned char target, /* 08 */
lun, /* 09 */
devtype; /* 0A */
} dev;
/* SRB_Command */
struct {
unsigned char target, /* 08 */
lun; /* 09 */
unsigned long data_len; /* 0A..0D */
unsigned char sense_len; /* 0E */
unsigned long data_ptr; /* 0F..12 */
unsigned long link_ptr; /* 13..16 */
// void * _Seg16 data_ptr; /* 0F..12 */
// void * _Seg16 link_ptr; /* 13..16 */
unsigned char cdb_len, /* 17 */
ha_status, /* 18 */
target_status; /* 19 */
unsigned char _Seg16postSRB[4];
// void (* _Seg16 post) (SRB *); /* 1A..1D */
unsigned char res_1E_29[12]; /* 1E..29 */
unsigned char res_2A_3F[22]; /* 2A..3F */
unsigned char cdb_st[64]; /* 40..7F CDB+status */
unsigned char res_80_BF[64]; /* 80..BF */
} cmd;
/* SRB_Abort */
struct {
unsigned char _Seg16srb[4];
// void * _Seg16 srb; /* 08..0B */
} abt;
/* SRB_Reset */
struct {
unsigned char target, /* 08 */
lun, /* 09 */
res_0A_17[14], /* 0A..17 */
ha_status, /* 18 */
target_status; /* 19 */
} res;
/* SRB_Param - unused by ASPI4OS2 */
struct {
unsigned char unique[16]; /* 08..17 */
} par;
} u;
} SRB;
// SCSI sense codes
// Note! This list may not be complete. I did this compilation for use with tape drives.
#define Sense_Current 0x70; // Current Error
#define Sense_Deferred 0x71; // Deferred Error
#define Sense_Filemark 0x80; // Filemark detected
#define Sense_EOM 0x40; // End of medium detected
#define Sense_ILI 0x20; // Incorrect length indicator
// Sense Keys
#define SK_NoSense 0x00; // No Sense
#define SK_RcvrdErr 0x01; // Recovered Error
#define SK_NotReady 0x02; // Not ready
#define SK_MedErr 0x03; // Medium Error
#define SK_HWErr 0x04; // Hardware Error
#define SK_IllReq 0x05; // Illegal Request
#define SK_UnitAtt 0x06; // Unit attention
#define SK_DataProt 0x07: // Data Protect
#define SK_BlankChk 0x08: // Blank Check
#define SK_VndSpec 0x09; // Vendor Specific
#define SK_CopyAbort 0x0A; // Copy Aborted
#define SK_AbtdCmd 0x0B; // Aborted Command
#define SK_Equal 0x0C; // Equal
#define SK_VolOvfl 0x0D; // Volume Overflow
#define SK_MisComp 0x0E; // Miscompare
#define SK_Reserved 0x0F; // Reserved

308
schily/schily.h Normal file
View File

@@ -0,0 +1,308 @@
/* @(#)schily.h 1.52 04/03/05 Copyright 1985-2002 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-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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 __PR((const char *, int *, int *));
extern FILE *_fcons __PR((FILE *, int, int));
extern FILE *fdup __PR((FILE *));
extern int fdown __PR((FILE *));
extern int fexecl __PR((const char *, FILE *, FILE *, FILE *,
const char *, ...));
extern int fexecle __PR((const char *, FILE *, FILE *, FILE *,
const char *, ...));
/* 6th arg not const, fexecv forces av[ac] = NULL */
extern int fexecv __PR((const char *, FILE *, FILE *, FILE *, int,
char **));
extern int fexecve __PR((const char *, FILE *, FILE *, FILE *,
char * const *, char * const *));
extern int fspawnv __PR((FILE *, FILE *, FILE *, int, char * const *));
extern int fspawnl __PR((FILE *, FILE *, FILE *,
const char *, const char *, ...));
extern int fspawnv_nowait __PR((FILE *, FILE *, FILE *,
const char *, int, char *const*));
extern int fgetline __PR((FILE *, char *, int));
extern int fgetstr __PR((FILE *, char *, int));
extern void file_raise __PR((FILE *, int));
extern int fileclose __PR((FILE *));
extern FILE *fileluopen __PR((int, const char *));
extern FILE *fileopen __PR((const char *, const char *));
#ifdef _INCL_SYS_TYPES_H
extern FILE *filemopen __PR((const char *, const char *, mode_t));
#endif
#ifdef FOUND_OFF_T
extern off_t filepos __PR((FILE *));
#endif
extern int fileread __PR((FILE *, void *, int));
extern int ffileread __PR((FILE *, void *, int));
extern FILE *filereopen __PR((const char *, const char *, FILE *));
#ifdef FOUND_OFF_T
extern int fileseek __PR((FILE *, off_t));
extern off_t filesize __PR((FILE *));
#endif
#ifdef S_IFMT
extern int filestat __PR((FILE *, struct stat *));
#endif
extern int filewrite __PR((FILE *, void *, int));
extern int ffilewrite __PR((FILE *, void *, int));
extern int flush __PR((void));
extern int fpipe __PR((FILE **));
/*extern int fprintf __PR((FILE *, const char *, ...)) __printflike__(2, 3);*/
extern int getbroken __PR((FILE *, char *, char, char **, int));
extern int ofindline __PR((FILE *, char, const char *, int,
char **, int));
extern int peekc __PR((FILE *));
#ifdef __never_def__
/*
* We cannot define this or we may get into problems with DOS based systems.
*/
extern int spawnv __PR((FILE *, FILE *, FILE *, int, char * const *));
extern int spawnl __PR((FILE *, FILE *, FILE *,
const char *, const char *, ...));
extern int spawnv_nowait __PR((FILE *, FILE *, FILE *,
const char *, int, char *const*));
#endif /* __never_def__m */
#endif /* EOF */
extern int _niread __PR((int, void *, int));
extern int _niwrite __PR((int, void *, int));
extern int _nixread __PR((int, void *, int));
extern int _nixwrite __PR((int, void *, int));
extern int _openfd __PR((const char *, int));
extern int on_comerr __PR((void (*fun)(int, void *), void *arg));
/*PRINTFLIKE1*/
extern void comerr __PR((const char *, ...)) __printflike__(1, 2);
/*PRINTFLIKE2*/
extern void comerrno __PR((int, const char *, ...)) __printflike__(2, 3);
/*PRINTFLIKE1*/
extern int errmsg __PR((const char *, ...)) __printflike__(1, 2);
/*PRINTFLIKE2*/
extern int errmsgno __PR((int, const char *, ...)) __printflike__(2, 3);
#ifdef FOUND_SIZE_T
/*PRINTFLIKE3*/
extern int serrmsg __PR((char *, size_t, const char *, ...)) __printflike__(3, 4);
/*PRINTFLIKE4*/
extern int serrmsgno __PR((int, char *, size_t, const char *, ...)) __printflike__(4, 5);
#endif
extern void comexit __PR((int));
extern char *errmsgstr __PR((int));
/*PRINTFLIKE1*/
extern int error __PR((const char *, ...)) __printflike__(1, 2);
extern char *fillbytes __PR((void *, int, char));
extern char *findbytes __PR((const void *, int, char));
extern int findline __PR((const char *, char, const char *,
int, char **, int));
extern int getline __PR((char *, int));
extern int getstr __PR((char *, int));
extern int breakline __PR((char *, char, char **, int));
extern int getallargs __PR((int *, char * const**, const char *, ...));
extern int getargs __PR((int *, char * const**, const char *, ...));
extern int getfiles __PR((int *, char * const**, const char *));
extern char *astoi __PR((const char *, int *));
extern char *astol __PR((const char *, long *));
extern char *astolb __PR((const char *, long *, int base));
#ifdef _UTYPES_H
extern char *astoll __PR((const char *, Llong *));
extern char *astollb __PR((const char *, Llong *, int base));
#endif
/*extern void handlecond __PR((const char *, SIGBLK *, int(*)(const char *, long, long), long));*/
/*extern void unhandlecond __PR((SIGBLK *));*/
extern int patcompile __PR((const unsigned char *, int, int *));
extern unsigned char *patmatch __PR((const unsigned char *, const int *,
const unsigned char *, int, int, int, int[]));
extern unsigned char *patlmatch __PR((const unsigned char *, const int *,
const unsigned char *, int, int, int, int[]));
/*extern int printf __PR((const char *, ...)) __printflike__(1, 2);*/
extern char *movebytes __PR((const void *, void *, int));
extern void save_args __PR((int, char **));
extern int saved_ac __PR((void));
extern char **saved_av __PR((void));
extern char *saved_av0 __PR((void));
#ifndef seterrno
extern int seterrno __PR((int));
#endif
extern void set_progname __PR((const char *));
extern char *get_progname __PR((void));
extern void setfp __PR((void * const *));
extern int wait_chld __PR((int)); /* for fspawnv_nowait() */
extern int geterrno __PR((void));
extern void raisecond __PR((const char *, long));
#ifdef FOUND_SIZE_T
/*
* We currently cannot define this here because there IXIX has a definition
* than violates the standard.
*/
#ifndef HAVE_SNPRINTF
/*PRINTFLIKE3*/
extern int snprintf __PR((char *, size_t, const char *, ...)) __printflike__(3, 4);
#endif
#endif
/*extern int sprintf __PR((char *, const char *, ...)); ist woanders falsch deklariert !!!*/
extern char *strcatl __PR((char *, ...));
extern int streql __PR((const char *, const char *));
#ifdef va_arg
extern int format __PR((void (*)(char, long), long, const char *, va_list));
#else
extern int format __PR((void (*)(char, long), long, const char *, void *));
#endif
extern int ftoes __PR((char *, double, int, int));
extern int ftofs __PR((char *, double, int, int));
#ifdef EOF /* stdio.h has been included */
/*PRINTFLIKE2*/
extern int js_fprintf __PR((FILE *, const char *, ...)) __printflike__(2, 3);
/*PRINTFLIKE1*/
extern int js_printf __PR((const char *, ...)) __printflike__(1, 2);
#ifdef FOUND_SIZE_T
/*PRINTFLIKE3*/
extern int js_snprintf __PR((char *, size_t, const char *, ...)) __printflike__(3, 4);
#endif
/*PRINTFLIKE2*/
extern int js_sprintf __PR((char *, const char *, ...)) __printflike__(2, 3);
#endif /* EOF */
extern void swabbytes __PR((void *, int));
extern char **getmainfp __PR((void));
extern char **getavp __PR((void));
extern char *getav0 __PR((void));
extern void **getfp __PR((void));
extern int flush_reg_windows __PR((int));
extern int cmpbytes __PR((const void *, const void *, int));
extern int cmpnullbytes __PR((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 __PR((FILE *, int, int));
extern FILE *fdup64 __PR((FILE *));
extern FILE *fileluopen64 __PR((int, const char *));
extern FILE *fileopen64 __PR((const char *, const char *));
#ifdef FOUND_OFF_T
extern off64_t filepos64 __PR((FILE *));
#endif
extern FILE *filereopen64 __PR((const char *, const char *, FILE *));
#ifdef FOUND_OFF_T
extern int fileseek64 __PR((FILE *, off64_t));
extern off64_t filesize64 __PR((FILE *));
#endif
#ifdef S_IFMT
extern int filestat64 __PR((FILE *, struct stat *));
#endif
extern int _openfd64 __PR((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 */

69
schily/sigblk.h Normal file
View File

@@ -0,0 +1,69 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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) __PR((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) __PR((const char *, long, long));
extern void handlecond __PR((const char *, SIGBLK *,
int(*)(const char *, long, long),
long));
extern void raisecond __PR((const char *, long));
extern void starthandlecond __PR((SIGBLK *));
extern void unhandlecond __PR((SIGBLK *));
#ifdef __cplusplus
}
#endif
#endif /* _SIGBLK_H */

70
schily/sigdefs.h Normal file
View File

@@ -0,0 +1,70 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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, 675 Mass Ave, Cambridge, MA 02139, 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 */

154
schily/standard.h Normal file
View File

@@ -0,0 +1,154 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

339
schily/statdefs.h Normal file
View File

@@ -0,0 +1,339 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

54
schily/stdxlib.h Normal file
View File

@@ -0,0 +1,54 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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, 675 Mass Ave, Cambridge, MA 02139, 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 */

90
schily/stkframe.h Normal file
View File

@@ -0,0 +1,90 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

114
schily/strdefs.h Normal file
View File

@@ -0,0 +1,114 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 __PR((void *, const void *, int));
extern void *memmove __PR((void *, const void *, int));
extern char *strcpy __PR((char *, const char *));
extern char *strncpy __PR((char *, const char *, int));
extern char *strcat __PR((char *, const char *));
extern char *strncat __PR((char *, const char *, int));
extern int memcmp __PR((const void *, const void *, int));
extern int strcmp __PR((const char *, const char *));
extern int strcoll __PR((const char *, const char *));
extern int strncmp __PR((const char *, const char *, int));
extern int strxfrm __PR((char *, const char *, int));
extern void *memchr __PR((const void *, int, int));
extern char *strchr __PR((const char *, int));
extern int strcspn __PR((const char *, const char *));
/*#pragma int_to_unsigned strcspn*/
extern char *strpbrk __PR((const char *, const char *));
extern char *strrchr __PR((const char *, int));
extern int strspn __PR((const char *, const char *));
/*#pragma int_to_unsigned strspn*/
extern char *strstr __PR((const char *, const char *));
extern char *strtok __PR((char *, const char *));
extern void *memset __PR((void *, int, int));
extern char *strerror __PR((int));
extern int strlen __PR((const char *));
/*#pragma int_to_unsigned strlen*/
extern void *memccpy __PR((void *, const void *, int, int));
extern int strcasecmp __PR((const char *, const char *));
extern int strncasecmp __PR((const char *, const char *, int));
/*#define index strchr*/
/*#define rindex strrchr*/
#ifdef __cplusplus
}
#endif
#endif /* HAVE_STRING_H */
#endif /* _STRDEFS_H */

62
schily/termcap.h Normal file
View File

@@ -0,0 +1,62 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 __PR((char *bp, char *name));
extern int tcsetflags __PR((int flags));
extern char *tcgetbuf __PR((void));
extern int tgetnum __PR((char *ent));
extern BOOL tgetflag __PR((char *ent));
extern char *tgetstr __PR((char *ent, char **array));
extern char *tdecode __PR((char *ep, char **array));
extern int tputs __PR((char *cp, int affcnt, int (*outc)(int c)));
extern char *tgoto __PR((char *cm, int destcol, int destline));
#ifdef __cplusplus
}
#endif
#endif /* _TERMCAP_H */

101
schily/timedefs.h Normal file
View File

@@ -0,0 +1,101 @@
/* @(#)timedefs.h 1.11 03/11/24 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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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
#ifdef __cplusplus
}
#endif
#endif /* _TIMEDEFS_H */

120
schily/ttydefs.h Normal file
View File

@@ -0,0 +1,120 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

121
schily/unixstd.h Normal file
View File

@@ -0,0 +1,121 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 __PR((const char *, int));
extern int close __PR((int));
extern int dup __PR((int));
extern int dup2 __PR((int, int));
extern void _exit __PR((int));
extern int link __PR((const char *, const char *));
extern int read __PR((int, void *, size_t));
extern int unlink __PR((const char *));
extern int write __PR((int, void *, size_t));
#endif
#endif /* _UNIXSTD_H */

76
schily/unls.h Normal file
View File

@@ -0,0 +1,76 @@
/* @(#)unls.h 1.5 03/06/15 2000 J. Schilling */
/*
* Modifications to make the code portable Copyright (c) 2000 J. Schilling
*
* Code taken from the Linux kernel.
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 nls_unicode {
unsigned char uni1;
unsigned char uni2;
};
struct nls_table {
char *charset;
unsigned char **page_uni2charset;
struct nls_unicode *charset2uni;
#ifdef USE_ICONV
iconv_t iconv_d;
#endif
void (*inc_use_count) __PR((void));
void (*dec_use_count) __PR((void));
struct nls_table *next;
};
extern int init_nls __PR((void));
extern int register_nls __PR((struct nls_table *));
extern int unregister_nls __PR((struct nls_table *));
extern struct nls_table *find_nls __PR((char *));
extern void list_nls __PR((void));
extern struct nls_table *load_nls __PR((char *));
extern void unload_nls __PR((struct nls_table *));
extern struct nls_table *load_nls_default __PR((void));
extern int init_nls_file __PR((char * name));
#ifdef USE_ICONV
extern int init_nls_iconv __PR((char * name));
#endif
#ifdef __cplusplus
}
#endif
#endif /* _UNLS_H */

66
schily/unls.h.utf8 Normal file
View File

@@ -0,0 +1,66 @@
/* @(#)unls.h 1.5 03/06/15 2000 J. Schilling */
/*
* Modifications to make the code portable Copyright (c) 2000 J. Schilling
*
* Code taken from the Linux kernel.
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 __cplusplus
extern "C" {
#endif
struct nls_unicode {
unsigned char uni1;
unsigned char uni2;
};
struct nls_table {
char *charset;
unsigned char **page_uni2charset;
struct nls_unicode *charset2uni;
void (*inc_use_count) __PR((void));
void (*dec_use_count) __PR((void));
struct nls_table *next;
};
extern int init_nls __PR((void));
extern int register_nls __PR((struct nls_table *));
extern int unregister_nls __PR((struct nls_table *));
extern struct nls_table *find_nls __PR((char *));
extern void list_nls __PR((void));
extern struct nls_table *load_nls __PR((char *));
extern void unload_nls __PR((struct nls_table *));
extern struct nls_table *load_nls_default __PR((void));
extern int init_nls_file __PR((char * name));
#ifdef __cplusplus
}
#endif
#endif /* _UNLS_H */

76
schily/utimdefs.h Normal file
View File

@@ -0,0 +1,76 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

339
schily/utypes.h Normal file
View File

@@ -0,0 +1,339 @@
/* @(#)utypes.h 1.11 03/06/15 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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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
#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.
*/
#define TYPE_ISSIGNED(t) (((t)-1) < ((t)0))
#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
#ifdef __CHAR_UNSIGNED__ /* GNU GCC define (dynamic) */
#ifndef CHAR_IS_UNSIGNED
#define CHAR_IS_UNSIGNED /* Sing Schily define (static) */
#endif
#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;
#define SIZEOF_LLONG SIZEOF_LONG_LONG
#define SIZEOF_ULLONG SIZEOF_UNSIGNED_LONG_LONG
#else
typedef long Llong;
typedef unsigned long Ullong;
#define SIZEOF_LLONG SIZEOF_LONG
#define SIZEOF_ULLONG SIZEOF_UNSIGNED_LONG
#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
#if defined(__STDC__) || defined(CHAR_IS_UNSIGNED)
typedef signed char Int8_t;
#else
typedef char Int8_t;
#endif
#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
#endif /* _UTYPES_H */

120
schily/vadefs.h Normal file
View File

@@ -0,0 +1,120 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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, 675 Mass Ave, Cambridge, MA 02139, 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 */

141
schily/waitdefs.h Normal file
View File

@@ -0,0 +1,141 @@
/* @(#)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 as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 */

550
schily/xconfig.h Normal file
View File

@@ -0,0 +1,550 @@
/* xconfig.h. Generated automatically by configure. */
/* @(#)xconfig.h.in 1.76 04/07/26 Copyright 1998-2003 J. Schilling */
/*
* Dynamic autoconf C-include code.
*
* Copyright (c) 1998-2003 J. Schilling
*/
/*
* Header Files
*/
#define PROTOTYPES 1 /* if Compiler supports ANSI C prototypes */
#define HAVE_STDARG_H 1 /* to use stdarg.h, else use varargs.h NOTE: SaberC on a Sun has prototypes but no stdarg.h */
/* #undef HAVE_VARARGS_H */ /* to use use varargs.h NOTE: The free HP-UX C-compiler has stdarg.h but no PROTOTYPES */
#define HAVE_STDLIB_H 1 /* to use general utility defines (malloc(), size_t ...) and general C library prototypes */
#define HAVE_STDDEF_H 1 /* to use offsetof(), ptrdiff_t, wchar>t, size_t */
#define HAVE_STRING_H 1 /* to get NULL and ANSI C string function prototypes */
#define HAVE_STRINGS_H 1 /* to get BSD string function prototypes */
#define STDC_HEADERS 1 /* if ANSI compliant stdlib.h, stdarg.h, string.h, float.h are present */
#define HAVE_UNISTD_H 1 /* to get POSIX syscall prototypes XXX sys/file.h fcntl.h (unixstd/fctl)XXX*/
#define HAVE_GETOPT_H 1 /* to get getopt() prototype from getopt.h instead of unistd.h */
#define HAVE_LIMITS_H 1 /* to get POSIX numeric limits constants */
#define HAVE_A_OUT_H 1 /* if a.out.h is present (may be a system using a.out format) */
/* #undef HAVE_AOUTHDR_H */ /* if aouthdr.h is present. This is a COFF system */
#define HAVE_ELF_H 1 /* if elf.h is present. This is an ELF system */
#define HAVE_FCNTL_H 1 /* to access, O_XXX constants for open(), otherwise use sys/file.h */
#define HAVE_SYS_FILE_H 1 /* to use O_XXX constants for open() and flock() defs */
#define HAVE_INTTYPES_H 1 /* to use UNIX-98 inttypes.h */
#define HAVE_DIRENT_H 1 /* to use POSIX dirent.h */
/* #undef HAVE_SYS_DIR_H */ /* to use BSD sys/dir.h */
/* #undef HAVE_NDIR_H */ /* to use ndir.h */
/* #undef HAVE_SYS_NDIR_H */ /* to use sys/ndir.h */
#define HAVE_ALLOCA_H 1 /* if alloca.h exists */
#define HAVE_MALLOC_H 1 /* if malloc.h exists */
#define HAVE_TERMIOS_H 1 /* to use POSIX termios.h */
#define HAVE_TERMIO_H 1 /* to use SVR4 termio.h */
#define HAVE_PWD_H 1 /* if pwd.h exists */
#define HAVE_GRP_H 1 /* if grp.h exists */
#define HAVE_SYS_ACL_H 1 /* to use <sys/acl.h> for ACL definitions */
/* #undef HAVE_ACLLIB_H */ /* if HP-UX <acllib.h> is present */
#define HAVE_SHADOW_H 1 /* if shadow.h exists */
#define HAVE_SYSLOG_H 1 /* if syslog.h exists */
#define HAVE_SYS_TIME_H 1 /* 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_TIMES 1 /* to use times() and sys/times.h */
#define HAVE_SYS_TIMES_H 1 /* may include sys/times.h for struct tms */
#define HAVE_UTIME 1 /* to use AT&T utime() and utimbuf */
#define HAVE_UTIMES 1 /* to use BSD utimes() and sys/time.h */
#define HAVE_UTIME_H 1 /* to use utime.h for the utimbuf structure declaration, else declare struct utimbuf yourself */
/* #undef HAVE_SYS_UTIME_H */ /* to use sys/utime.h if utime.h does not exist */
#define HAVE_SYS_IOCTL_H 1 /* if sys/ioctl.h is present */
/* #undef HAVE_SYS_FILIO_H */ /* if sys/ioctl.h is present */
#define HAVE_SYS_PARAM_H 1 /* if sys/param.h is present */
#define HAVE_MNTENT_H 1 /* if mntent.h is present */
/* #undef HAVE_SYS_MNTENT_H */ /* if sys/mntent.h is present */
/* #undef HAVE_SYS_MNTTAB_H */ /* if sys/mnttab.h is present */
#define HAVE_SYS_MOUNT_H 1 /* if sys/mount.h is present */
#define HAVE_WAIT_H 1 /* to use wait.h for prototypes and union wait */
#define HAVE_SYS_WAIT_H 1 /* else use sys/wait.h */
#define HAVE_SYS_RESOURCE_H 1 /* to use sys/resource.h for rlimit() and wait3() */
#define HAVE_SYS_PROCFS_H 1 /* to use sys/procfs.h for wait3() emulation */
/* #undef HAVE_SYS_SYSTEMINFO_H */ /* to use SVr4 sysinfo() */
#define HAVE_SYS_UTSNAME_H 1 /* to use uname() */
/* #undef HAVE_SYS_PRIOCNTL_H */ /* to use SVr4 priocntl() instead of nice()/setpriority() */
/* #undef HAVE_SYS_RTPRIOCNTL_H */ /* if the system supports SVr4 real time classes */
#define HAVE_SYS_SYSCALL_H 1 /* to use syscall() */
#define HAVE_SYS_MTIO_H 1 /* to use mtio definitions from sys/mtio.h */
/* #undef HAVE_SYS_TAPE_H */ /* to use mtio definitions from AIX sys/tape.h */
#define HAVE_SYS_MMAN_H 1 /* to use definitions for mmap()/madvise()... from sys/mman.h */
#define HAVE_SYS_SHM_H 1 /* to use definitions for shmget() ... from sys/shm.h */
#define HAVE_SYS_IPC_H 1 /* to use definitions for shmget() ... from sys/ipc.h */
/* #undef MAJOR_IN_MKDEV */ /* if we should include sys/mkdev.h to get major()/minor()/makedev() */
#define MAJOR_IN_SYSMACROS 1 /* if we should include sys/sysmacros.h to get major()/minor()/makedev() */
/* #undef HAVE_SYS_DKIO_H */ /* if we may include sys/dkio.h for disk ioctls */
/* #undef HAVE_SYS_DKLABEL_H */ /* if we may include sys/dklabel.h for disk label */
/* #undef HAVE_SUN_DKIO_H */ /* if we may include sun/dkio.h for disk ioctls */
/* #undef HAVE_SUN_DKLABEL_H */ /* if we may include sun/dklabel.h for disk label */
#define HAVE_SYS_TYPES_H 1 /* if we may include sys/types.h (the standard) */
#define HAVE_SYS_STAT_H 1 /* if we may include sys/stat.h (the standard) */
/* #undef HAVE_TYPES_H */ /* if we may include types.h (rare cases e.g. ATARI TOS) */
/* #undef HAVE_STAT_H */ /* if we may include stat.h (rare cases e.g. ATARI TOS) */
#define HAVE_POLL_H 1 /* if we may include poll.h to use poll() */
#define HAVE_SYS_POLL_H 1 /* if we may include sys/poll.h to use poll() */
#define HAVE_SYS_SELECT_H 1 /* if we may have sys/select.h nonstandard use for select() on some systems*/
/* #undef NEED_SYS_SELECT_H */ /* if we need sys/select.h to use select() (this is nonstandard) */
#define HAVE_NETDB_H 1 /* if we have netdb.h for get*by*() and rcmd() */
#define HAVE_SYS_SOCKET_H 1 /* if we have sys/socket.h for socket() */
/* #undef NEED_SYS_SOCKET_H */ /* if we need sys/socket.h to use select() (this is nonstandard) */
#define HAVE_LINUX_PG_H 1 /* if we may include linux/pg.h for PP ATAPI sypport */
/* #undef HAVE_CAMLIB_H */ /* if we may include camlib.h for CAM SCSI transport definitions */
/* #undef HAVE_IEEEFP_H */ /* if we may include ieeefp.h for finite()/isnand() */
/* #undef HAVE_FP_H */ /* if we may include fp.h for FINITE()/IS_INF()/IS_NAN() */
#define HAVE_VALUES_H 1 /* if we may include values.h for MAXFLOAT */
#define HAVE_FLOAT_H 1 /* if we may include float.h for FLT_MAX */
/* #undef HAVE__FILBUF */ /* if we have _filbuf() for USG derived STDIO */
/* #undef HAVE___FILBUF */ /* if we have __filbuf() for USG derived STDIO */
/* #undef HAVE_USG_STDIO */ /* if we have USG derived STDIO */
#define HAVE_ERRNO_DEF 1 /* if we have errno definition in <errno.h> */
/* #undef HAVE_VFORK_H */ /* if we should include vfork.h for vfork() definitions */
#define HAVE_ARPA_INET_H 1 /* if we have arpa/inet.h (missing on BeOS) */
/* BeOS has inet_ntoa() in <netdb.h> */
/* #undef HAVE_BSD_DEV_SCSIREG_H */ /* if we have a NeXT Step compatible sg driver */
/* #undef HAVE_SYS_BSDTTY_H */ /* if we have sys/bsdtty.h on HP-UX for TIOCGPGRP */
/* #undef HAVE_OS_H */ /* if we have the BeOS kernel definitions in OS.h */
#define HAVE_ATTR_XATTR_H 1 /* if we have the Linux Extended File Attr definitions in attr/xattr.h */
#define HAVE_FNMATCH_H 1 /* if we may include fnmatch.h */
/*
* Convert to SCHILY name
*/
#ifdef STDC_HEADERS
# ifndef HAVE_STDC_HEADERS
# define HAVE_STDC_HEADERS
# endif
#endif
#ifdef HAVE_ELF_H
#define HAVE_ELF /* This system uses ELF */
#else
# ifdef HAVE_AOUTHDR_H
# define HAVE_COFF /* This system uses COFF */
# else
# ifdef HAVE_A_OUT_H
# define HAVE_AOUT /* This system uses AOUT */
# endif
# endif
#endif
/*
* Library Functions
*/
#define HAVE_ACCESS 1 /* access() is present in libc */
/* #undef HAVE_EACCESS */ /* eaccess() is present in libc */
#define HAVE_EUIDACCESS 1 /* euidaccess() is present in libc */
/* #undef HAVE_ACCESS_E_OK */ /* access() implements E_OK (010) for effective UIDs */
#define HAVE_CRYPT 1 /* crypt() is present in libc or libcrypt */
#define HAVE_STRERROR 1 /* strerror() is present in libc */
#define HAVE_MEMMOVE 1 /* memmove() is present in libc */
#define HAVE_MADVISE 1 /* madvise() is present in libc */
#define HAVE_MLOCK 1 /* mlock() is present in libc */
#define HAVE_MLOCKALL 1 /* working mlockall() is present in libc */
#define HAVE_MMAP 1 /* working mmap() is present in libc */
/* #undef _MMAP_WITH_SIZEP */ /* mmap() needs address of size parameter */
#define HAVE_FLOCK 1 /* *BSD flock() is present in libc */
#define HAVE_LOCKF 1 /* lockf() is present in libc (XOPEN) */
#define HAVE_FCNTL_LOCKF 1 /* file locking via fcntl() is present in libc */
#define HAVE_FCHDIR 1 /* fchdir() is present in libc */
#define HAVE_STATVFS 1 /* statvfs() is present in libc */
#define HAVE_QUOTACTL 1 /* quotactl() is present in libc */
/* #undef HAVE_QUOTAIOCTL */ /* use ioctl(f, Q_QUOTACTL, &q) instead of quotactl() */
#define HAVE_SETREUID 1 /* setreuid() is present in libc */
#define HAVE_SETRESUID 1 /* setresuid() 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_SETRESGID 1 /* setresgid() is present in libc */
#define HAVE_SETEGID 1 /* setegid() is present in libc */
#define HAVE_SETGID 1 /* setgid() is present in libc */
#define HAVE_GETPGID 1 /* getpgid() is present in libc (POSIX) */
#define HAVE_SETPGID 1 /* setpgid() is present in libc (POSIX) */
#define HAVE_GETPGRP 1 /* getpgrp() is present in libc (ANY) */
#define HAVE_SETPGRP 1 /* setpgrp() is present in libc (ANY) */
/* #undef HAVE_BSD_GETPGRP */ /* getpgrp() in libc is BSD-4.2 compliant */
/* #undef HAVE_BSD_SETPGRP */ /* setpgrp() in libc is BSD-4.2 compliant */
#define HAVE_GETSPNAM 1 /* getspnam() in libc (SVR4 compliant) */
/* #undef HAVE_GETSPWNAM */ /* getspwnam() in libsec.a (HP-UX) */
#define HAVE_SYNC 1 /* sync() is present in libc */
#define HAVE_FSYNC 1 /* fsync() is present in libc */
#define HAVE_TCGETATTR 1 /* tcgetattr() is present in libc */
#define HAVE_TCSETATTR 1 /* tcsetattr() is present in libc */
#define HAVE_WAIT3 1 /* working wait3() is present in libc */
#define HAVE_WAIT4 1 /* wait4() is present in libc */
#define HAVE_WAITID 1 /* waitid() is present in libc */
#define HAVE_WAITPID 1 /* waitpid() 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_GETDTABLESIZE 1 /* getdtablesize() is present in libc */
#define HAVE_GETRUSAGE 1 /* getrusage() is present in libc */
#define HAVE_GETRLIMIT 1 /* getrlimit() is present in libc */
#define HAVE_SETRLIMIT 1 /* setrlimit() is present in libc */
#define HAVE_ULIMIT 1 /* ulimit() is present in libc */
#define HAVE_GETTIMEOFDAY 1 /* gettimeofday() is present in libc */
#define HAVE_SETTIMEOFDAY 1 /* settimeofday() is present in libc */
#define HAVE_TIME 1 /* time() is present in libc */
#define HAVE_STIME 1 /* stime() is present in libc */
#define HAVE_POLL 1 /* poll() is present in libc */
#define HAVE_SELECT 1 /* select() is present in libc */
#define HAVE_CHOWN 1 /* chown() is present in libc */
#define HAVE_LCHOWN 1 /* lchown() is present in libc */
#define HAVE_BRK 1 /* brk() 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__VA_COPY 1 /* __va_copy() is present in varargs.h/stdarg.h */
/* #undef HAVE_DTOA */ /* BSD-4.4 __dtoa() is present in libc */
/* #undef HAVE_DTOA_R */ /* BSD-4.4 __dtoa() with result ptr (reentrant) */
#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_SYMLINK 1 /* symlink() is present in libc */
#define HAVE_LINK 1 /* link() is present in libc */
#define HAVE_HARD_SYMLINKS 1 /* link() allows hard links on symlinks */
#define HAVE_LINK_NOFOLLOW 1 /* link() does not follow symlinks when hard linking symlinks */
#define HAVE_RENAME 1 /* rename() is present in libc */
#define HAVE_MKFIFO 1 /* mkfifo() is present in libc */
#define HAVE_MKNOD 1 /* mknod() is present in libc */
#define HAVE_ECVT 1 /* ecvt() is present in libc */
#define HAVE_FCVT 1 /* fcvt() is present in libc */
#define HAVE_GCVT 1 /* gcvt() is present in libc */
#define HAVE_ECVT_R 1 /* ecvt_r() is present in libc */
#define HAVE_FCVT_R 1 /* fcvt_r() is present in libc */
/* #undef HAVE_GCVT_R */ /* gcvt_r() is present in libc */
/* #undef HAVE_ECONVERT */ /* econvert() is present in libc */
/* #undef HAVE_FCONVERT */ /* fconvert() is present in libc */
/* #undef HAVE_GCONVERT */ /* gconvert() is present in libc */
#define HAVE_ISINF 1 /* isinf() is present in libc */
#define HAVE_ISNAN 1 /* isnan() is present in libc */
#define HAVE_RAND 1 /* rand() is present in libc */
#define HAVE_DRAND48 1 /* drand48() is present in libc */
#define HAVE_SETPRIORITY 1 /* setpriority() is present in libc */
#define HAVE_NICE 1 /* nice() is present in libc */
/* #undef HAVE_DOSSETPRIORITY */ /* DosSetPriority() is present in libc */
/* #undef HAVE_DOSALLOCSHAREDMEM */ /* DosAllocSharedMem() is present in libc */
#define HAVE_SEEKDIR 1 /* seekdir() is present in libc */
#define HAVE_PUTENV 1 /* putenv() is present in libc (preferred function) */
#define HAVE_SETENV 1 /* setenv() is present in libc (use instead of putenv()) */
#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_STRSIGNAL 1 /* strsignal() is present in libc */
/* #undef HAVE_STR2SIG */ /* str2sig() is present in libc */
/* #undef HAVE_SIG2STR */ /* sig2str() is present in libc */
#define HAVE_KILLPG 1 /* killpg() is present in libc */
#define HAVE_SIGRELSE 1 /* sigrelse() is present in libc */
#define HAVE_SIGPROCMASK 1 /* sigprocmask() is present in libc (POSIX) */
#define HAVE_SIGSETMASK 1 /* sigsetmask() is present in libc (BSD) */
#define HAVE_SIGSET 1 /* sigset() is present in libc (POSIX) */
#define HAVE_SYS_SIGLIST 1 /* char *sys_siglist[] is present in libc */
#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_EXECL 1 /* execl() is present in libc */
#define HAVE_EXECLE 1 /* execle() is present in libc */
#define HAVE_EXECLP 1 /* execlp() is present in libc */
#define HAVE_EXECV 1 /* execv() is present in libc */
#define HAVE_EXECVE 1 /* execve() is present in libc */
#define HAVE_EXECVP 1 /* execvp() 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())*/
/* #undef vfork */
/* #undef HAVE_CHFLAGS */ /* chflags() is present in libc */
/* #undef HAVE_FCHFLAGS */ /* fchflags() is present in libc */
/* #undef HAVE_FFLAGSTOSTR */ /* fflagstostr() is present in libc */
/* #undef HAVE_STRTOFFLAGS */ /* strtofflags() is present in libc */
#define HAVE_FNMATCH 1 /* fnmatch() is present in libc */
/*
* Linux Extended File Attributes
*/
#define HAVE_GETXATTR 1 /* getxattr() */
#define HAVE_SETXATTR 1 /* setxattr() */
#define HAVE_LISTXATTR 1 /* listxattr() */
/*
* 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.
*/
/* #undef HAVE_FSEEKO */ /* fseeko() is present in default compile mode */
/* #undef HAVE_FTELLO */ /* ftello() is present in default compile mode */
#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 */
#define HAVE_INET_NTOA 1 /* inet_ntoa() is present in libc/libsocket */
#define HAVE_GETADDRINFO 1 /* getaddrinfo() is present in libc/libsocket */
#define HAVE_GETNAMEINFO 1 /* getnameinfo() is present in libc/libsocket */
#if defined(HAVE_QUOTACTL) || defined(HAVE_QUOTAIOCTL)
# define HAVE_QUOTA /* The system inludes quota */
#endif
/*
* 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
*/
#define HAVE_MTGET_TYPE 1 /* if struct mtget contains mt_type (drive type) */
/* #undef HAVE_MTGET_MODEL */ /* if struct mtget contains mt_model (drive type) */
#define HAVE_MTGET_DSREG 1 /* if struct mtget contains mt_dsreg (drive status) */
/* #undef HAVE_MTGET_DSREG1 */ /* if struct mtget contains mt_dsreg1 (drive status msb) */
/* #undef HAVE_MTGET_DSREG2 */ /* if struct mtget contains mt_dsreg2 (drive status lsb) */
#define HAVE_MTGET_GSTAT 1 /* if struct mtget contains mt_gstat (generic status) */
#define HAVE_MTGET_ERREG 1 /* if struct mtget contains mt_erreg (error register) */
#define HAVE_MTGET_RESID 1 /* if struct mtget contains mt_resid (residual count) */
#define HAVE_MTGET_FILENO 1 /* if struct mtget contains mt_fileno (file #) */
#define HAVE_MTGET_BLKNO 1 /* if struct mtget contains mt_blkno (block #) */
/* #undef HAVE_MTGET_FLAGS */ /* if struct mtget contains mt_flags (flags) */
/* #undef HAVE_MTGET_BF */ /* if struct mtget contains mt_bf (optimum blocking factor) */
#define HAVE_STRUCT_RUSAGE 1 /* have struct rusage in sys/resource.h */
/* #undef HAVE_SI_UTIME */ /* if struct siginfo contains si_utime */
/* #undef HAVE_UNION_SEMUN */ /* have an illegal definition for union semun in sys/sem.h */
#define HAVE_UNION_WAIT 1 /* have union wait in wait.h */
/*
* SCO UnixWare has st_atim.st__tim.tv_nsec but the st_atim.tv_nsec tests also
* succeeds. If you use st_atim.tv_nsec on UnixWare, you get a warning about
* illegal structure usage. For this reason, your code needs to have
* #ifdef HAVE_ST__TIM before #ifdef HAVE_ST_NSEC.
*/
/* #undef HAVE_ST_SPARE1 */ /* if struct stat contains st_spare1 (usecs) */
/* #undef HAVE_ST_ATIMENSEC */ /* if struct stat contains st_atimensec (nanosecs) */
#define HAVE_ST_NSEC 1 /* if struct stat contains st_atim.tv_nsec (nanosecs) */
/* #undef HAVE_ST__TIM */ /* if struct stat contains st_atim.st__tim.tv_nsec (nanosecs) */
/* #undef HAVE_ST_ATIMESPEC */ /* if struct stat contains st_atimespec.tv_nsec (nanosecs) */
#define HAVE_ST_BLKSIZE 1 /* if struct stat contains st_blksize */
#define HAVE_ST_BLOCKS 1 /* if struct stat contains st_blocks */
/* #undef HAVE_ST_FSTYPE */ /* if struct stat contains st_fstype */
#define HAVE_ST_RDEV 1 /* if struct stat contains st_rdev */
/* #undef HAVE_ST_FLAGS */ /* if struct stat contains st_flags */
/* #undef STAT_MACROS_BROKEN */ /* if the macros S_ISDIR, S_ISREG .. don't work */
#define DEV_MINOR_BITS 32 /* # if bits needed to hold minor device number */
#define DEV_MINOR_NONCONTIG 1 /* if bits in minor device number are noncontiguous */
#define HAVE_SOCKADDR_STORAGE 1 /* if socket.h defines struct sockaddr_storage */
/*
* Byteorder/Bitorder
*/
#define HAVE_C_BIGENDIAN /* Flag that WORDS_BIGENDIAN test was done */
/* #undef WORDS_BIGENDIAN */ /* If using network byte order */
#define HAVE_C_BITFIELDS /* Flag that BITFIELDS_HTOL test was done */
/* #undef BITFIELDS_HTOL */ /* If high bits come first in structures */
/*
* Types/Keywords
*/
#define SIZEOF_CHAR 1
#define SIZEOF_SHORT_INT 2
#define SIZEOF_INT 4
#define SIZEOF_LONG_INT 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_CHAR_P 4
#define SIZEOF_UNSIGNED_CHAR 1
#define SIZEOF_UNSIGNED_SHORT_INT 2
#define SIZEOF_UNSIGNED_INT 4
#define SIZEOF_UNSIGNED_LONG_INT 4
#define SIZEOF_UNSIGNED_LONG_LONG 8
#define SIZEOF_UNSIGNED_CHAR_P 4
#define HAVE_LONGLONG 1 /* Compiler defines long long type */
/* #undef CHAR_IS_UNSIGNED */ /* Compiler defines char to be unsigned */
/* #undef const */ /* Define to empty if const doesn't work */
/* #undef uid_t */ /* To be used if uid_t is not present */
/* #undef gid_t */ /* To be used if gid_t is not present */
/* #undef size_t */ /* To be used if size_t is not present */
/* #undef ssize_t */ /* To be used if ssize_t is not present */
/* #undef pid_t */ /* To be used if pid_t is not present */
/* #undef off_t */ /* To be used if off_t is not present */
/* #undef mode_t */ /* To be used if mode_t is not present */
/* #undef time_t */ /* To be used if time_t is not present */
/* #undef caddr_t */ /* To be used if caddr_t is not present */
/* #undef daddr_t */ /* To be used if daddr_t is not present */
/* #undef dev_t */ /* To be used if dev_t is not present */
/* #undef ino_t */ /* To be used if ino_t is not present */
/* #undef nlink_t */ /* To be used if nlink_t is not present */
#define blksize_t long /* To be used if blksize_t is not present */
/* #undef blkcnt_t */ /* To be used if blkcnt_t is not present */
/*
* Important: Next Step needs time.h for clock_t (because of a bug)
*/
/* #undef clock_t */ /* To be used if clock_t is not present */
/* #undef socklen_t */ /* To be used if socklen_t is not present */
/*
* These types are present on all UNIX systems but should be avoided
* for portability.
* On Apollo/Domain OS we don't have them....
*
* Better include <utypes.h> and use Uchar, Uint & Ulong
*/
/* #undef u_char */ /* To be used if u_char is not present */
/* #undef u_short */ /* To be used if u_short is not present */
/* #undef u_int */ /* To be used if u_int is not present */
/* #undef u_long */ /* To be used if u_long is not present */
/*#undef HAVE_SIZE_T*/
/*#undef NO_SIZE_T*/
/* #undef VA_LIST_IS_ARRAY */ /* va_list is an 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
/*
* Defines needed to get large file support.
*/
#ifdef USE_LARGEFILES
#define HAVE_LARGEFILES 1
#ifdef HAVE_LARGEFILES /* If we have working largefiles at all */
/* This is not defined with glibc-2.1.3 */
#define _FILE_OFFSET_BITS 64 /* # of bits in off_t if settable */
#define _LARGEFILE_SOURCE 1 /* To make ftello() visible (HP-UX 10.20). */
/* #undef _LARGE_FILES */ /* Large file defined on AIX-style hosts. */
/* #undef _XOPEN_SOURCE */ /* To make ftello() visible (glibc 2.1.3). */
/* XXX We don't use this because glibc2.1.3*/
/* XXX is bad anyway. If we define */
/* XXX _XOPEN_SOURCE we will loose caddr_t */
/* #undef HAVE_FSEEKO */ /* Do we need this? If HAVE_LARGEFILES is */
/* defined, we have fseeko() */
#endif /* HAVE_LARGEFILES */
#endif /* USE_LARGEFILES */
#ifdef USE_ACL /* Enable/disable ACL support */
/*
* POSIX ACL support
*/
#define HAVE_ACL_GET_FILE 1 /* acl_get_file() function */
#define HAVE_ACL_SET_FILE 1 /* acl_set_file() function */
#define HAVE_ACL_FROM_TEXT 1 /* acl_from_text() function */
#define HAVE_ACL_TO_TEXT 1 /* acl_to_text() function */
#define HAVE_ACL_FREE 1 /* acl_free() function */
#define HAVE_ACL_DELETE_DEF_FILE 1 /* acl_delete_def_file() function */
#if defined(HAVE_ACL_GET_FILE) && defined(HAVE_ACL_SET_FILE) && \
defined(HAVE_ACL_FROM_TEXT) && defined(HAVE_ACL_TO_TEXT) && \
defined(HAVE_ACL_FREE)
# define HAVE_POSIX_ACL 1 /* POSIX ACL's present */
#endif
/*
* Sun ACL support.
* Note: unfortunately, HP-UX has an (undocumented) acl() function in libc.
*/
/* #undef HAVE_ACL */ /* acl() function */
/* #undef HAVE_FACL */ /* facl() function */
/* #undef HAVE_ACLFROMTEXT */ /* aclfromtext() function */
/* #undef HAVE_ACLTOTEXT */ /* acltotext() function */
#if defined(HAVE_ACL) && defined(HAVE_FACL) && \
defined(HAVE_ACLFROMTEXT) && defined(HAVE_ACLTOTEXT)
# define HAVE_SUN_ACL 1 /* Sun ACL's present */
#endif
/*
* HP-UX ACL support.
* Note: unfortunately, HP-UX has an (undocumented) acl() function in libc.
*/
/* #undef HAVE_GETACL */ /* getacl() function */
/* #undef HAVE_FGETACL */ /* fgetacl() function */
/* #undef HAVE_SETACL */ /* setacl() function */
/* #undef HAVE_FSETACL */ /* fsetacl() function */
/* #undef HAVE_STRTOACL */ /* strtoacl() function */
/* #undef HAVE_ACLTOSTR */ /* acltostr() function */
/* #undef HAVE_CPACL */ /* cpacl() function */
/* #undef HAVE_FCPACL */ /* fcpacl() function */
/* #undef HAVE_CHOWNACL */ /* chownacl() function */
/* #undef HAVE_SETACLENTRY */ /* setaclentry() function */
/* #undef HAVE_FSETACLENTRY */ /* fsetaclentry() function */
#if defined(HAVE_GETACL) && defined(HAVE_FGETACL) && \
defined(HAVE_SETACL) && defined(HAVE_FSETACL) && \
defined(HAVE_STRTOACL) && defined(HAVE_ACLTOTEXT)
# define HAVE_HP_ACL 1 /* HP-UX ACL's present */
#endif
/*
* Global definition whether ACL support is present.
* As HP-UX differs too much from other implementations, HAVE_HP_ACL is not
* included in HAVE_ANY_ACL.
*/
#if defined(HAVE_POSIX_ACL) || defined(HAVE_SUN_ACL)
# define HAVE_ANY_ACL 1 /* Any ACL implementation present */
#endif
#endif /* USE_ACL */
/*
* Misc CC / LD related stuff
*/
/* #undef NO_USER_MALLOC */ /* If we cannot define our own malloc() */
#define HAVE_DYN_ARRAYS 1 /* If the compiler allows dynamic sized arrays */
/*
* Strings that help to maintain OS/platform id's in C-programs
*/
#define HOST_ALIAS "i686-pc-linux-gnu" /* Output from config.guess (orig) */
#define HOST_SUB "i686-pc-linux-gnu" /* Output from config.sub (modified) */
#define HOST_CPU "i686" /* CPU part from HOST_SUB */
#define HOST_VENDOR "pc" /* VENDOR part from HOST_SUB */
#define HOST_OS "linux-gnu" /* CPU part from HOST_SUB */
/*
* Begin restricted code for quality assurance.
*
* Warning: you are not allowed to include the #define below if you are not
* using the Schily makefile system or if you modified the autoconfiguration
* tests.
*
* If you only added other tests you are allowed to keep this #define.
*
* This restiction is introduced because this way, I hope that people
* contribute to the project instead of creating branches.
*/
#define IS_SCHILY_XCONFIG
/*
* End restricted code for quality assurance.
*/

1356
schily/xmconfig.h Normal file

File diff suppressed because it is too large Load Diff