Redefine constants from errqueue.h. Some header files lag behind the kernel version

pull/16456/head
Yash Tibrewal 6 years ago
parent aab47cbdf2
commit ffdcad5e06
  1. 21
      src/core/lib/iomgr/internal_errqueue.h
  2. 3
      src/core/lib/iomgr/tcp_posix.cc
  3. 2
      test/core/iomgr/buffer_list_test.cc

@ -43,6 +43,27 @@
namespace grpc_core {
#ifdef GRPC_LINUX_ERRQUEUE
/* Redefining scm_timestamping in the same way that <linux/errqueue.h> defines
* it, so that code compiles on systems that don't have it. */
struct scm_timestamping {
struct timespec ts[3];
};
/* Also redefine timestamp types */
/* The timestamp type for when the driver passed skb to NIC, or HW. */
constexpr int SCM_TSTAMP_SND = 0;
/* The timestamp type for when data entered the packet scheduler. */
constexpr int SCM_TSTAMP_SCHED = 1;
/* The timestamp type for when data acknowledged by peer. */
constexpr int SCM_TSTAMP_ACK = 2;
/* Redefine required constants from <linux/net_tstamp.h> */
constexpr uint32_t SOF_TIMESTAMPING_TX_SOFTWARE = 1u << 1;
constexpr uint32_t SOF_TIMESTAMPING_SOFTWARE = 1u << 4;
constexpr uint32_t SOF_TIMESTAMPING_OPT_ID = 1u << 7;
constexpr uint32_t SOF_TIMESTAMPING_TX_SCHED = 1u << 8;
constexpr uint32_t SOF_TIMESTAMPING_TX_ACK = 1u << 9;
constexpr uint32_t SOF_TIMESTAMPING_OPT_TSONLY = 1u << 11;
constexpr uint32_t kTimestampingSocketOptions = SOF_TIMESTAMPING_SOFTWARE |
SOF_TIMESTAMPING_OPT_ID |
SOF_TIMESTAMPING_OPT_TSONLY;

@ -646,7 +646,8 @@ struct cmsghdr* process_timestamp(grpc_tcp* tcp, msghdr* msg,
return cmsg;
}
auto tss = reinterpret_cast<struct scm_timestamping*>(CMSG_DATA(cmsg));
auto tss =
reinterpret_cast<struct grpc_core::scm_timestamping*>(CMSG_DATA(cmsg));
auto serr = reinterpret_cast<struct sock_extended_err*>(CMSG_DATA(next_cmsg));
if (serr->ee_errno != ENOMSG ||
serr->ee_origin != SO_EE_ORIGIN_TIMESTAMPING) {

@ -76,7 +76,7 @@ static void TestVerifierCalledOnAck() {
struct sock_extended_err serr;
serr.ee_data = 213;
serr.ee_info = SCM_TSTAMP_ACK;
struct scm_timestamping tss;
struct grpc_core::scm_timestamping tss;
tss.ts[0].tv_sec = 123;
tss.ts[0].tv_nsec = 456;
grpc_core::grpc_tcp_set_write_timestamps_callback(

Loading…
Cancel
Save