]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
Added Windows port.
authorMartin Mares <mj@ucw.cz>
Sat, 29 May 2004 20:18:47 +0000 (20:18 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 5 May 2006 12:18:19 +0000 (14:18 +0200)
git-archimport-id: mj@ucw.cz--public/pciutils--main--2.2--patch-46

ChangeLog
lib/i386-ports.c
lib/internal.h
lib/pci.h
lspci.c

index 3b192bb6edd1eab61ea6a6881340ed44d16560bd..dd488dee0467d9fbea7053cc5a06861ffe2d9c8d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2004-05-29  Martin Mares  <mj@ucw.cz>
 
+       * lib/pci.h: Windows don't have the standard u_int* types.
+
+       * lib/internal.h: <sys/param.h> required on Windows for endianity
+       macros.
+
+       * lib/i386-ports.c: Connected i386-io-windows.h.
+
+       * lspci.c (check_root): geteuid() is not available on Windows.
+
+       * lib/i386-io-windows.h: Added Windows port contributed by Alexander
+       Stock <stock.alexander@gmx.de>.
+
+       * lib/configure: Hopefully fixed SunOS port broken by various
+       changes to the configure script.
+
        * Makefile, lib/configure: Cross-compilation support, patch by Maciej.
 
 2004-05-28  Martin Mares  <mj@ucw.cz>
index ada1ee1c5accea0a475598b05413b1415c397088..d1088c3ffa3d502478549f83bf99f3bda611d8b5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     The PCI Library -- Direct Configuration access via i386 Ports
  *
- *     Copyright (c) 1997--2003 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2004 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
 #include "i386-io-linux.h"
 #elif defined(OS_GNU)
 #include "i386-io-hurd.h"
-#elif defined(OS_SunOS)
+#elif defined(OS_SUNOS)
 #include "i386-io-sunos.h"
+#elif defined(OS_WINDOWS)
+#include "i386-io-windows.h"
 #else
 #error Do not know how to access I/O ports on this OS.
 #endif
index 41ad612b62ade899fa446e3b3403af7c9b8a3347..a591f5051b68eecea470b87daaf547fd5fffc021 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     The PCI Library -- Internal Include File
  *
- *     Copyright (c) 1997--2003 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2004 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
@@ -35,7 +35,7 @@
 #include <sys/types.h>
 #endif
 
-#ifdef OS_SunOS
+#ifdef OS_SUNOS
 #include <sys/byteorder.h>
 #define BIG_ENDIAN 4321
 #ifdef _LITTLE_ENDIAN
 #endif
 #endif
 
+#ifdef OS_WINDOWS
+#include <sys/param.h>
+#endif
+
 #if BYTE_ORDER == BIG_ENDIAN
 #define cpu_to_le16 swab16
 #define cpu_to_le32 swab32
index b031f53b705c371b57cb58780d554d7db08b3662..188f2e545c16c899c0913e565c2c6f5da8b7cce9 100644 (file)
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -1,7 +1,7 @@
 /*
  *     The PCI Library
  *
- *     Copyright (c) 1997--2003 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2004 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
 
 #include <sys/types.h>
 
+#ifdef OS_WINDOWS
+typedef unsigned char byte;
+typedef char u8;
+typedef unsigned short word;
+typedef short u16;
+typedef unsigned long u32;
+#else
 typedef u_int8_t byte;
 typedef u_int8_t u8;
 typedef u_int16_t word;
 typedef u_int16_t u16;
 typedef u_int32_t u32;
+#endif
 
 #ifdef HAVE_64BIT_ADDRESS
 #include <limits.h>
diff --git a/lspci.c b/lspci.c
index 8374788197413cb6a3943c290c9ad216ae8e8824..b65202d9c01539c8f4acfc16c72aabe35d5c4dc2 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -112,11 +112,15 @@ scan_devices(void)
 static int
 check_root(void)
 {
+#ifdef OS_WINDOWS
+  return 1;
+#else
   static int is_root = -1;
 
   if (is_root < 0)
     is_root = !geteuid();
   return is_root;
+#endif
 }
 
 static int