Unix Permission Setting Speed Unix Permission Setting Speed unix unix

Unix Permission Setting Speed


Yes, there is a difference. The absolute setting requires a single system call (chmod()). The incremental setting requires two calls — one to get the current permissions (stat()) and then chmod() to set them. The chmod() system call only deals in absolute settings.

Having said "there is a difference", I would be surprised if it was often a measurable difference. The work done by the stat() call to load the path would prime the kernel to handle the chmod() call on the same file name rather fast. However, if you are working with network files, especially over a WAN, then it is conceivable that the network file system might make a measurable difference.