DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Li, Changqing" <Changqing.Li@windriver.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: "Li, Changqing" <Changqing.Li@windriver.com>
Subject: A compile failure related to "Y2038 Problem"
Date: Thu, 17 Apr 2025 05:46:36 +0000	[thread overview]
Message-ID: <DS0PR11MB731286BF187EB3647769285982BC2@DS0PR11MB7312.namprd11.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1651 bytes --]

Hi, Dear Maintainers

I  met  the following compile failure  when I pass "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" to build  32bit  dpdk.  The key command like:
gcc -m32  ...   -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64  ...  -o lib/librte_ethdev.a.p/ethdev_ethdev_trace_points.c.o -c ../git/lib/ethdev/ethdev_trace_points.c.

../git/lib/ethdev/ethdev_trace.h: In function 'rte_eth_trace_timesync_write_time':
../git/lib/eal/include/rte_common.h:498:55: error: size of unnamed array is negative
  498 | #define RTE_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))

[snip]
RTE_TRACE_POINT(
    rte_eth_trace_timesync_write_time,
    RTE_TRACE_POINT_ARGS(uint16_t port_id, const struct timespec *time,
        int ret),
    rte_trace_point_emit_u16(port_id);
    rte_trace_point_emit_size_t(time->tv_sec);
    rte_trace_point_emit_long(time->tv_nsec);
    rte_trace_point_emit_int(ret);
)
[snip]

In order to support Y2038,  "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"  is passed,  the time->tv_sec is 64bit,  but size_t is 32bits,  so the error happend.
if I understand right,  maybe it is possible that  some  codes  will  assign  time->tv_sec to a size_t variable, so this check is meanningful.  Maybe what need to do
is make sure the whole project supports Y2038, avoid code similar like  assign  time->tv_sec to a size_t variable, and then change  rte_trace_point_emit_size_t(time->tv_sec);
to  like  rte_trace_point_emit_uint64_t(time->tv_sec);

Could you please help to check if my understanding is correct , and could you share if there is any plan to support Y2038?   Great Thanks!

Regards
Changqing



[-- Attachment #2: Type: text/html, Size: 11090 bytes --]

                 reply	other threads:[~2025-04-17  5:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DS0PR11MB731286BF187EB3647769285982BC2@DS0PR11MB7312.namprd11.prod.outlook.com \
    --to=changqing.li@windriver.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).