Sponsored Content
Full Discussion: od -cb .
Top Forums UNIX for Advanced & Expert Users od -cb . Post 302174047 by Perderabo on Sunday 9th of March 2008 08:17:38 PM
Old 03-09-2008
I don't think that we are being fair to Linux here. Linux is designed to be very flexible in handling filesystems. No one, even root, can open a directory and read it. Instead a semi-secret system call is used to enable readdir to function. This means that the structure of a directory is known only to the kernel and it is using the FileSystem Switch to handle each filesystem type. As a result, filesystems that do not employ the unix directory structure can be supported. Consider FAT32, it has a very alien directory structure but it works well under Linux. Also file system developers are free to try new directory concepts. Linux actually gained quite a bit by prohibiting user-level directory reads.
 
READDIR(3)						     Linux Programmer's Manual							READDIR(3)

NAME
readdir - read a directory SYNOPSIS
#include <sys/types.h> #include <dirent.h> struct dirent *readdir(DIR *dir); DESCRIPTION
The readdir() function returns a pointer to a dirent structure representing the next directory entry in the directory stream pointed to by dir. It returns NULL on reaching the end-of-file or if an error occurred. According to POSIX, the dirent structure contains a field char d_name[] of unspecified size, with at most NAME_MAX characters preceding the terminating null character. Use of other fields will harm the portability of your programs. POSIX-2001 also documents the field ino_t d_ino as an XSI extension. The data returned by readdir() may be overwritten by subsequent calls to readdir() for the same directory stream. RETURN VALUE
The readdir() function returns a pointer to a dirent structure, or NULL if an error occurs or end-of-file is reached. ERRORS
EBADF Invalid directory stream descriptor dir. CONFORMING TO
SVID 3, POSIX, BSD 4.3 SEE ALSO
read(2), closedir(3), dirfd(3), opendir(3), rewinddir(3), scandir(3), seekdir(3), telldir(3) 1996-04-22 READDIR(3)
All times are GMT -4. The time now is 09:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy