From a24135608d52e57fad34e25d4fcba383ffed6d7d Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 29 May 2004 20:18:47 +0000 Subject: [PATCH] Added Windows port. git-archimport-id: mj@ucw.cz--public/pciutils--main--2.2--patch-46 --- ChangeLog | 15 +++++++++++++++ lib/i386-ports.c | 6 ++++-- lib/internal.h | 8 ++++++-- lib/pci.h | 10 +++++++++- lspci.c | 4 ++++ 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b192bb..dd488de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,20 @@ 2004-05-29 Martin Mares + * lib/pci.h: Windows don't have the standard u_int* types. + + * lib/internal.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 . + + * 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 diff --git a/lib/i386-ports.c b/lib/i386-ports.c index ada1ee1..d1088c3 100644 --- a/lib/i386-ports.c +++ b/lib/i386-ports.c @@ -1,7 +1,7 @@ /* * The PCI Library -- Direct Configuration access via i386 Ports * - * Copyright (c) 1997--2003 Martin Mares + * Copyright (c) 1997--2004 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -14,8 +14,10 @@ #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 diff --git a/lib/internal.h b/lib/internal.h index 41ad612..a591f50 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -1,7 +1,7 @@ /* * The PCI Library -- Internal Include File * - * Copyright (c) 1997--2003 Martin Mares + * Copyright (c) 1997--2004 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -35,7 +35,7 @@ #include #endif -#ifdef OS_SunOS +#ifdef OS_SUNOS #include #define BIG_ENDIAN 4321 #ifdef _LITTLE_ENDIAN @@ -45,6 +45,10 @@ #endif #endif +#ifdef OS_WINDOWS +#include +#endif + #if BYTE_ORDER == BIG_ENDIAN #define cpu_to_le16 swab16 #define cpu_to_le32 swab32 diff --git a/lib/pci.h b/lib/pci.h index b031f53..188f2e5 100644 --- a/lib/pci.h +++ b/lib/pci.h @@ -1,7 +1,7 @@ /* * The PCI Library * - * Copyright (c) 1997--2003 Martin Mares + * Copyright (c) 1997--2004 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -18,11 +18,19 @@ #include +#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 diff --git a/lspci.c b/lspci.c index 8374788..b65202d 100644 --- 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 -- 2.39.5