> TL;DR: POSIX.1-2008 says gettimeofday(2) can't return anything but 0, > but we return -1 on invalid input.
It must return -1 to indicate the tp pointer is to invalid memory. All system calls indicate invalid pointer arguments in that way, and this one is not special. [EFAULT] An argument address referenced invalid memory. > We claim that our gettimeofday(2) conforms to POSIX.1-2008. Is > something off here? POSIX appears to be wrong. Yes there are people doing VDSO things, which may not be able to indicate a fault, and the process will crash instead when it fondles it's own missing memory. But I don't see any way that gives the commitee latitude to remove historic behaviour. > Also, gettimeofday(2) is an XSI extension, so I think at a > minimum the STANDARDS section needs to be tweaked (attached). As a general rule we don't speak of XSI unless it exposes programmers to problems. Mentioning XSI in the way you propose doesn't actually help anyone write better code since noone knows what XSI is. So in this case, I don't think XSI should be mentioned, the words perform no educational function. > Long version: > > POSIX.1-2008 [1] says: > > > The gettimeofday() function shall return 0 and no value shall > > be reserved to indicate an error. Wouldn't be the first error in POSIX. The documents have gotten sloppier. I think this is due to their commitee not acquiring any sensible young blood. > Does this make our implementation non-conforming and does something > in the manpage need to change? I don't think anything should change.