git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] DT_UNKNOWN: do not fully trust existence of DT_UNKNOWN

From
Junio C Hamano <junkio@cox.net>
Date
Jan 20, 2006, 01:13 UTC
Message-ID
<7voe277lbe.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<81b0412b0601180547q4a812c8xb632de6ab13a5e62@mail.gmail.com>

The recent Cygwin defines DT_UNKNOWN although it does not have d_type in struct dirent. Give an option to tell us not to use d_type on such platforms. Hopefully this problem will be transient.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * By sending this out, I am not claiming this is better than
   your version or anything like that.  This is just for
   completeness and convenience, because my other two patches
   touch overlapping areas in the same Makefile.  This patch
   comes after the other two.
 Makefile |    7 +++++++
 cache.h  |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)
80a4322a9bfbf0389ba8cb50f674682349f40a3a
diff --git a/Makefile b/Makefile
index 31898f7..84f5d24 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,9 @@ all:
 #
 # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
 #
+# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
+# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
+#
 # Define NO_STRCASESTR if you don't have strcasestr.
 #
 # Define NO_SETENV if you don't have setenv in the C library.
@@ -233,6 +236,7 @@ ifeq ($(uname_S),SunOS)
 	ALL_CFLAGS += -D__EXTENSIONS__
 endif
 ifeq ($(uname_O),Cygwin)
+	NO_D_TYPE_IN_DIRENT = YesPlease
 	NO_D_INO_IN_DIRENT = YesPlease
 	NO_STRCASESTR = YesPlease
 	NEEDS_LIBICONV = YesPlease
@@ -335,6 +339,9 @@ ifdef NEEDS_NSL
 	LIBS += -lnsl
 	SIMPLE_LIB += -lnsl
 endif
+ifdef NO_D_TYPE_IN_DIRENT
+	ALL_CFLAGS += -DNO_D_TYPE_IN_DIRENT
+endif
 ifdef NO_D_INO_IN_DIRENT
 	ALL_CFLAGS += -DNO_D_INO_IN_DIRENT
 endif
diff --git a/cache.h b/cache.h
index 29c9e81..3d79c55 100644
--- a/cache.h
+++ b/cache.h
@@ -10,7 +10,7 @@
 #define deflateBound(c,s)  ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
 #endif
 
-#ifdef DT_UNKNOWN
+#if defined(DT_UNKNOWN) && !NO_D_TYPE_IN_DIRENT
 #define DTYPE(de)	((de)->d_type)
 #else
 #define DT_UNKNOWN	0
-- 
1.1.3-gacdd
Previous: Alex RiesenNext: Alex Riesen
Message 22 of 27 in “cygwin-latest: compile errors related to sockaddr_storage, dirent->d_type and dirent->d_ino”
  1. Alex RiesenJan 18, 2006
  2. Christopher FaylorJan 19, 2006
  3. Junio C HamanoJan 19, 2006
  4. Christopher FaylorJan 19, 2006
  5. Christopher FaylorJan 19, 2006
  6. Linus TorvaldsJan 19, 2006
  7. Christopher FaylorJan 19, 2006
  8. Linus TorvaldsJan 19, 2006
  9. Christopher FaylorJan 19, 2006
  10. fsck-objects: support platforms without d_ino in struct dirent.Junio C Hamano, Jan 20, 2006
  11. Christopher FaylorJan 20, 2006
  12. Alex RiesenJan 19, 2006
  13. Christopher FaylorJan 19, 2006
  14. Alex RiesenJan 19, 2006
  15. Christopher FaylorJan 19, 2006
  16. Petr BaudisJan 19, 2006
  17. Alex RiesenJan 19, 2006
  18. Petr BaudisJan 19, 2006
  19. Alex RiesenJan 19, 2006
  20. Junio C HamanoJan 20, 2006
  21. Alex RiesenJan 20, 2006
  22. DT_UNKNOWN: do not fully trust existence of DT_UNKNOWNJunio C Hamano, Jan 20, 2006
  23. Alex RiesenJan 20, 2006
  24. Junio C HamanoJan 20, 2006
  25. Alex RiesenJan 20, 2006
  26. Junio C HamanoJan 21, 2006
  27. Alex RiesenJan 23, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.