Date: Mon, 25 Sep 2023 09:42:36 +0200 From: rockyho...@firemail.cc Message-ID: <1354f06f549eb36716bca02777cb7...@firemail.cc>
| The /dev/pts/ files seem to have each their own size, as if they were | regular files. Everything which has an inode (or equivalent) has a size (everything that stat() can be applied to must have one, as a size field is in the resulting structure). | First curious fact: `ls -l' doesn't show the size in | bytes of such files (for some reason). Because it is meaningless nothing. POSIX says (in the definition of the <sys/stat.h> header: off_t st_size For regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link. For a shared memory object, the length in bytes. For a typed memory object, the length in bytes. For other file types, the use of this field is unspecified. The final sentence is the relevant one. | Instead, `exa' shows their sizes: RVP already indicated how you misinterpreted that. | So, second curious fact: the sizes of these pts files are not | related to the number of characters received by them as output of some | command. Not curious, what you're looking at isn't the size field. | Any clue about what these sizes actually represent? RVP answered that for what you're looking at, the actual size, which is in the stat() results (which applications should always simply ignore for anything which isn't a regular file, symlink, or one of the memory types, as it is unspecified - and which both ls and exa (whatever that is) are doing, correctly, is irrelevant (and as RVP indicated, should always be 0, as nothing ever sets it to anything different). Terminal type devices don't get bigger (which is what the size represents) as you write data to them, they just pass the data through to someplace else, and forget it. They do tend to count how much they processed, but that's not a size, and is terminal dependant data, so not available via stat() (so ls will certainly never tell you that number). kre