<html><body><p>Hi,<br><br>I run the Austin Swift meetup group, and a question came up about the /proc filesystem on Linux:<br><br>The question involved the inability to get any useful information from Data(contentsOf: URL(fileURLWithPath: "/proc/sys/fs/file-max")).<br><br>It turns out that Data(contentsOf:) does a stat() on the inode of the file you give it, and then runs alloc()/read() for the specified number of bytes. This works fine on normal files on normal file systems. But all the files in /proc have a 0 length specified by their inodes, and you have to actually read them until EOF to find out how much is there.<br><br>So the question is: Is that something the *Programmer* should be responsible for knowing, or should *Foundation* be responsible for handling that correctly?<br><br>I can see a case that we'd want to avoid embedding things this OS-specific in Foundation, but on the other hand, I know that this is very confusing for Darwin developers moving to Linux and expecting Data(contentsOf:) to "Just work."<br><br>So I thought I'd ask the community and see if there was a consensus.<br><br>Thanks,<br><br>-Carl<br><br>-- <br>Carl Brown<br>Swift@IBM<br>Carl.Brown1@IBM.com<br><BR>
</body></html>