I think I would disagree on this one. While it would make some operations neater, I steer clear of any and all external file metadata for the simple reason that it is not portable (and never will be, because that would mean giving up the stream/pipe abstraction).
It's not portable because nobody else adopted it. Had DOS and Unix also embraced the concept this would be a solved problem. Microsoft does actually have something on NTFS that works similarly, which is how Windows knows when something has been downloaded from the internet and warns you that it might be dangerous.
Having a standard to separate your data from your metadata isn't necessarily incompatible with streams. It would be something you would IOCTL on an open stream if you cared.
int fd;
fd = open("the_file", O_RDONLY);
if ( fd < 0 )
{
perror("the_file");
return -1;
}
char* filetype = NULL;
ioctl(fd, FDRESGET, "FILETYPE", &filetype);
if ( filetype != NULL )
{
printf("%s has a filetype of %s\n", "the_file", filetype);
}
You could also have a version FNRESGET that operates on file names instead of file descriptors. Also a setter. There's still obviously a lot of details to work out, but nothing about this should be all that difficult. It even simplifies some other parts of the system, for example if you have a network socket the socket metadata like the remote IP address and port numbers could be in the resource fork of the socket itself.