Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rice!uw-beaver!Teknowledge.COM!unix!hplabs!hpfcso!hpfcmgw!hpfcse!hpupnja!markf From: markf@hpupnja.HP.COM (Mark Fresolone) Newsgroups: comp.sys.hp Subject: Re: DIRECTORY (3C) strangeness Message-ID: <1520002@hpupnja.HP.COM> Date: 26 Nov 89 02:47:54 GMT References: <616@mmlai.UUCP> Organization: HP Piscataway, NJ Lines: 18 The 'ls' command has us all spoiled! It turns out that directory entries are not actually stored in any order. The directory(3) routines simply report 'em as they see 'em. Entries are kept rather primitively in a static array. At the beginning of a directory's life, files appear in creation order. However, when a file or directory is "removed", its entry is simply marked unused (traditionally, inode == 0). The next file created fills the first available unused slot, allocating a new block of entries when necessary. To visualize the behavior, create a directory, and then create and delete files, using "strings ." or "od -c ." between operations. Good coding! #include Mark Fresolone hplabs!hpfcse!hpupnja!markf