symbolic links take on user ownership of their containing directory
[unix-history] / usr / src / include / dirent.h
index 662efcd..e051321 100644 (file)
@@ -1,51 +1,31 @@
-/*
+/*-
  * Copyright (c) 1989 The Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1989 The Regents of the University of California.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * %sccs.include.redist.c%
  *
  *
- *     @(#)dirent.h    5.5 (Berkeley) %G%
+ *     @(#)dirent.h    5.19 (Berkeley) %G%
  */
 
  */
 
-#ifndef _DIRENT_
-#define _DIRENT_
+#ifndef _DIRENT_H_
+#define _DIRENT_H_
 
 /*
 
 /*
- * A directory entry has a struct direct at the front of it,
- * containing its inode number, the length of the entry, and the
- * length of the name contained in the entry.  These are followed
- * by the name padded to a 4 byte boundary with null bytes.  All
- * names are guaranteed null terminated.  The maximum length of a
- * name in a directory is MAXNAMLEN.
+ * The kernel defines the format of directory entries returned by 
+ * the getdirentries(2) system call.
  */
  */
-#define        MAXNAMLEN       255
+#include <sys/dirent.h>
 
 
-struct dirent {
-       u_long  d_fileno;               /* file number of entry */
-       u_short d_reclen;               /* length of this record */
-       u_short d_namlen;               /* length of string in d_name */
-       char    d_name[MAXNAMLEN + 1];  /* name must be no longer than this */
-};
-#define d_ino d_fileno         /* backward compatibility */
+#ifdef _POSIX_SOURCE
+typedef void * DIR;
+#else
 
 
-/*
- * Definitions for library routines operating on directories.
- */
+#define        d_ino           d_fileno        /* backward compatibility */
+
+/* definitions for library routines operating on directories. */
 #define        DIRBLKSIZ       1024
 
 #define        DIRBLKSIZ       1024
 
-/*
- * This structure describes an open directory.
- */
+/* structure describing an open directory. */
 typedef struct _dirdesc {
        int     dd_fd;          /* file descriptor associated with directory */
        long    dd_loc;         /* offset in current buffer */
 typedef struct _dirdesc {
        int     dd_fd;          /* file descriptor associated with directory */
        long    dd_loc;         /* offset in current buffer */
@@ -55,15 +35,33 @@ typedef struct _dirdesc {
        long    dd_seek;        /* magic cookie returned by getdirentries */
 } DIR;
 
        long    dd_seek;        /* magic cookie returned by getdirentries */
 } DIR;
 
-#define dirfd(dirp)    ((dirp)->dd_fd)
+#define        dirfd(dirp)     ((dirp)->dd_fd)
 
 #ifndef NULL
 
 #ifndef NULL
-#define NULL 0
+#define        NULL    0
 #endif
 #endif
-extern DIR *opendir();
-extern struct dirent *readdir();
-extern long telldir();
-extern void seekdir();
-#define rewinddir(dirp)        seekdir((dirp), (long)0)
-extern void closedir();
-#endif /* _DIRENT_ */
+
+#endif /* _POSIX_SOURCE */
+
+#ifndef KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+DIR *opendir __P((const char *));
+struct dirent *readdir __P((DIR *));
+void rewinddir __P((DIR *));
+int closedir __P((DIR *));
+#ifndef _POSIX_SOURCE
+long telldir __P((const DIR *));
+void seekdir __P((DIR *, long));
+int scandir __P((const char *, struct dirent ***,
+    int (*)(struct dirent *), int (*)(const void *, const void *)));
+int alphasort __P((const void *, const void *));
+int getdirentries __P((int, char *, int, long *));
+#endif /* not POSIX */
+__END_DECLS
+
+#endif /* !KERNEL */
+
+#endif /* !_DIRENT_H_ */