I see that pid_t is typedef'd in unistd.h, and file descriptors are defined to be int in fcntl.h. But since they are used in similar ways, wouldn't it make sense to have a typedef for file descriptors?
|
|
||||
|
|
|
Before reading the other responses, my guess was that |
|||
|
|
|
I think that this is a difference in philosophy between the C standard (fcntl.h) and the POSIX standard (unistd.h). C has as few types as are necessary (including size_t and time_t), whereas POSIX has as many types as make code clearer (such as pid_t, gid_t, and size_t). |
|||||
|
|
PID can be used for more functional purposes in identifying the unique process in relation to certain parameters (i.e. time, size, duration, etc), making it easier to make calls to the specific PID because the same process can occur multiple times over x amount of time. Where file descriptors don't need a type because the file in itself can easily be called by it's unique name. |
|||
|
|