根据许多联机帮助页,getpwnam_r() 是可重入的。然而,standard唯一状态
The getpwnam_r() function is thread-safe and returns values in a user-supplied buffer instead of possibly using a static data area that may be overwritten by each call.
我很困惑。 NSS 模块的 ...getpwnam_r() 函数必须可重入吗?或者仅仅线程安全就足够了?
最佳答案
嗯,正如您所注意到的,该标准要求该函数必须是线程安全的。这并不妨碍实现提供更严格的保证。
IOW,可移植软件不能假设 getpwnam_r 是可重入的。但是,如果您只关心某个保证其可重入的特定平台,那么您大概可以这样假设。
关于c - getpwnam_r() 是否需要可重入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7836844/