[libc-commits] [libc] [libc] Add SCM_TIMESTAMP constants (PR #232688)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Fri Oct 16 04:15:56 PDT 2026


labath wrote:

Tired of adding new constants, I looked at whether we could use asm/socket.h, and the header is fairly clean. The only potential hickup is the definition of SO_TIMESTAMP, which depends on the ambient definition of `time_t` like so:
```
#define SO_TIMESTAMP (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW)
```

The risks with that are:
- someone could try using the macro without a definition of time_t. Currently cannot happen, because our sys/socket.h defines time_t, but only because of sendmmsg (a gnu extension). If someone disables that, the type will go away.
- C++ code could define a conflicting definition of time_t in a namespace. This isn't that likely because glibc uses this code as well -- although only in __USE_MISC mode, and only on non-x86 arches (the kernel header has a fast path for x86)

If that doesn't sounds too scary, I can instead create a PR to replace these.

https://github.com/llvm/llvm-project/pull/232688


More information about the libc-commits mailing list