🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #390

4.3BSD-Reno /usr/include/{sys/dir.h,dirent.h} break namei.h, DIRBLKSIZ

#390
From: Jonathan Stone
Date: Mon, 17 Jun 1991 02:57
44 lines
2163 bytes
Subject: 4.3BSD-Reno /usr/include/{sys/dir.h,dirent.h} break namei.h, DIRBLKSIZ
Index:  /usr/include/dirent.h /usr/include/sys/dir.h  /usr/include/sys/namei.h
      /usr/include/ufs/dir.h

Description:
	The 4.3BSD-Reno release includes a placebo /usr/include/sys/dir.h
	for "backward compatibility".   The sys/dir.h file simply includes
	/usr/include/dirent.h, and defines a backward-compatible
	DIRSIZ macro.  Unfortunately, it also  ``direct'' to
	be ``dirent'', which breaks the definition of a ``struct direct''
	in ufs/dir.h,  which is in turn included by sys/namei.h.
	
	The macro DIRBLKSIZ is defined to be 1024 within
	/usr/include/dirent.h, and also (inconsistently) defined to
	be DEV_BSIZE in ufs/dir.h.   While DEV_BSIZE is fortuitously
	1024 on a CCI tahoe, on a vax or hp300, DEV_BSIZE is 512,
	not 1024.

	Both these problems break programs that include both
	<sys/dir.h> and <sys/user.h> (for example, gdb,	the GNU	debugger).
	

Repeat-By:
	Try and compile the following six-line program on a vax:

		#include <sys/types.h>
		#include <sys/dir.h>
		#include <sys/user.h.h>
		main ()
		{
		}

	I get the following output:

		nikau> cc -c dir-include-foulup.c
		/usr/include/ufs/dir.h: 51: DIRBLKSIZ redefined
		"/usr/include/ufs/dir.h", line 54: redeclaration of dirent


Workaround:
	One obvious workaround is to include <dirent.h> instead of
	<sys/dir.h>,  which fixes the problem with the ``struct direct''
	in ufs/dir.h.  But that does not fix the DIRBLKSIZ inconsistency.
Technical Details
Message-ID: <1991Jun17.025737.7681@comp.vuw.ac.nz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!waikato.ac.nz!comp.vuw.ac.nz!toru.isor.vuw.ac.nz!jonathan

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!waikato.ac.nz!comp.vuw.ac.nz!toru.isor.vuw.ac.nz!jonathan
Newsgroups: comp.bugs.4bsd
Subject: 4.3BSD-Reno /usr/include/{sys/dir.h,dirent.h} break namei.h, DIRBLKSIZ
Message-ID: <1991Jun17.025737.7681@comp.vuw.ac.nz>
From: jonathan@toru.isor.vuw.ac.nz (Jonathan Stone)
Date: Mon, 17 Jun 1991 02:57:37 GMT
Sender: news@comp.vuw.ac.nz (News Admin)
Organization: Dept. of Comp. Sci., Victoria Uni. of Wellington, New Zealand.
Keywords: DIRBLKSIZ, struct dirent, struct direct, gdb
Nntp-Posting-Host: toru.isor.vuw.ac.nz
Lines: 44