This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit b7001f2d9fc711df8fc130e8795c9559b5f7cc2d
Author: Claude <[email protected]>
AuthorDate: Fri Sep 25 16:35:17 2026 +0000

    include/sys/socket.h: give SOF_TIMESTAMPING_* their Linux values
    
    All SOF_TIMESTAMPING_* flags currently alias 1 << SO_TIMESTAMPING, so
    they cannot tell hardware from software or RX from TX.  Give them their
    distinct Linux values, and add SOF_TIMESTAMPING_RX_HARDWARE,
    SOF_TIMESTAMPING_RX_SOFTWARE and SOF_TIMESTAMPING_SYS_HARDWARE, so that
    they can also describe the timestamping capabilities of an interface
    (so_timestamping of ETHTOOL_GET_TS_INFO).
    
    This does not change behaviour: setsockopt(SO_TIMESTAMPING) only checks
    for a non-zero value and getsockopt() returns 0 or 1, so existing users
    and binaries built with the previous values keep working.  The
    individual flags are still not honoured.
    
    Assisted-by: Claude:claude-sonnet-5
    Signed-off-by: Daniel P. Carvalho <[email protected]>
---
 include/sys/socket.h | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/sys/socket.h b/include/sys/socket.h
index 50424bff924..6471fdc2f0a 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -230,15 +230,24 @@
 
 #define __SO_PROTOCOL   16
 
+/* SO_TIMESTAMPING flags, with the same values as Linux so that they can
+ * also describe the capabilities of an interface (ETHTOOL_GET_TS_INFO).
+ * setsockopt(SO_TIMESTAMPING) currently treats any non-zero value as
+ * "enabled" and does not honour the individual flags.
+ */
+
 /* Timestamp generation */
 
-#define SOF_TIMESTAMPING_TX_HARDWARE  (1 << SO_TIMESTAMPING)
-#define SOF_TIMESTAMPING_TX_SOFTWARE  SOF_TIMESTAMPING_TX_HARDWARE
+#define SOF_TIMESTAMPING_TX_HARDWARE  (1 << 0)
+#define SOF_TIMESTAMPING_TX_SOFTWARE  (1 << 1)
+#define SOF_TIMESTAMPING_RX_HARDWARE  (1 << 2)
+#define SOF_TIMESTAMPING_RX_SOFTWARE  (1 << 3)
 
 /* Timestamp reporting */
 
-#define SOF_TIMESTAMPING_SOFTWARE     SOF_TIMESTAMPING_TX_SOFTWARE
-#define SOF_TIMESTAMPING_RAW_HARDWARE SOF_TIMESTAMPING_TX_HARDWARE
+#define SOF_TIMESTAMPING_SOFTWARE     (1 << 4)
+#define SOF_TIMESTAMPING_SYS_HARDWARE (1 << 5)
+#define SOF_TIMESTAMPING_RAW_HARDWARE (1 << 6)
 
 /* The options are unsupported but included for compatibility
  * and portability

Reply via email to