dirent.h 4.09 KB
Newer Older
unknown's avatar
unknown committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */


#if defined(_NO_PROTOTYPE)	/* Old, crufty environment */
#include <oldstyle/dirent.h>
#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS)	/* Xpg4 environment */
#include <xpg4/dirent.h>
#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */
#include <posix/dirent.h>
#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */
#include <ods_30_compat/dirent.h>
#else 	/* Normal, default environment */
/*
 *   Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc.
 *		All Rights Reserved.
 *
 *	The information in this file is provided for the exclusive use of
 *	the licensees of The Santa Cruz Operation, Inc.  Such users have the
 *	right to use, modify, and incorporate this code into other products
 *	for purposes authorized by the license agreement provided they include
 *	this notice and the associated copyright notice with any such product.
 *	The information in this file is provided "AS IS" without warranty.
 */

/*	Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */
/*	Portions Copyright (c) 1979 - 1990 AT&T   */
/*	  All Rights Reserved   */

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF          */
/*	UNIX System Laboratories, Inc.                          */
/*	The copyright notice above does not evidence any        */
/*	actual or intended publication of such source code.     */

#ifndef _DIRENT_H
#define _DIRENT_H

#pragma comment(exestr, "xpg4plus @(#) dirent.h 20.1 94/12/04 ")

#ifdef __cplusplus
extern "C" {
#endif

#pragma pack(4)

#define MAXNAMLEN	512	/* maximum filename length  */
#ifndef MAXPATHLEN
#define MAXPATHLEN	1024
#endif
#undef DIRBLKSIZ
#define DIRBLKSIZ	1048	/* buffer size for fs-indep. dirs  */

#ifndef _SYS_TYPES_H
#include <sys/types.h>
#endif

#ifndef _SYS_DIRENT_H
#define _SYS_DIRENT_H
#ifdef __STDC__
#pragma comment(exestr, "@(#) dirent.h 25.8 94/09/22 ")
#else
#ident "@(#) dirent.h 25.8 94/09/22 "
#endif
/*
 *	Copyright (C) 1988-1994 The Santa Cruz Operation, Inc.
 *		All Rights Reserved.
 *	The information in this file is provided for the exclusive use of
 *	the licensees of The Santa Cruz Operation, Inc.  Such users have the
 *	right to use, modify, and incorporate this code into other products
 *	for purposes authorized by the license agreement provided they include
 *	this notice and the associated copyright notice with any such product.
 *	The information in this file is provided "AS IS" without warranty.
 */
/*	Copyright (c) 1984, 1986, 1987, 1988 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/

/* #ident	"@)#(head.sys:dirent.h	1.3" */

/*
 * The following structure defines the file
 * system independent directory entry.
 *
 */

#include <sys/types.h>

#ifdef  _M_I386
#pragma pack(4)
#else
#pragma pack(2)
#endif

#ifdef _INKERNEL
/*
 * dirent used by the kernel
 */
struct dirent {
	ino32_t	d_ino;		/* inode number of entry */
	off_t	d_off;		/* offset of disk directory entry */
	unsigned short	d_reclen;	/* length of this record */
	char	d_name[MAXNAMLEN+1];	/* name of file */
};

#else /* !_INKERNEL */
/*
 * dirent as used by application code
 * For now leave the declaration as is. When the new development system
 * is implemented, ino_t may be ushort or ulong. If ino_t is ulong, there
 * will be no d_pad field.
 */
struct dirent				/* data from readdir() */
	{
#if defined(_IBCS2)
	long		d_ino;
#else /* !_IBCS2 */
	ino_t		d_ino;		/* inode number of entry */
#if defined(_INO_16_T)
	short		d_pad;		/* because ino_t is ushort */
#endif /* defined(_INO_16_T) */
#endif /* defined(_IBCS2) */
	off_t		d_off;		/* offset of disk directory entry */
	unsigned short	d_reclen;	/* length of this record */
	char		d_name[MAXNAMLEN+1];	/* name of file */
	};
#endif /* _INKERNEL */

typedef struct dirent	dirent_t;

#pragma pack()
#endif	/* _SYS_DIRENT_H */

#define d_fileno	d_ino
#define	d_namlen	d_reclen

#ifdef __cplusplus
}
#endif

#pragma pack()

#endif /* _DIRENT_H */
#endif