Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Aug 2023 15:18:13 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 273086] clock_gettime(CLOCK_MONOTONIC_COARSE, *struct timespec) fails with 32bit program on 64bit machine
Message-ID:  <bug-273086-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D273086

            Bug ID: 273086
           Summary: clock_gettime(CLOCK_MONOTONIC_COARSE, *struct
                    timespec) fails with 32bit program on 64bit machine
           Product: Base System
           Version: 13.2-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: minsoochoo0122@proton.me

$ cat main.c
#include <stdio.h>
#include <time.h>

int main() {
  struct timespec ts;

  for (int i =3D 0; i < 100; ++i) {
    clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
    printf("%d %ld\n", ts.tv_sec, ts.tv_nsec);
  }
  return 0;
}

$ cc -m32 main.c
$ ./a.out
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
-1 318747501
....


This happens when building the program as 32bit executable on 64bit FreeBSD=
 and
run the executable on 64bit FreeBSD.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-273086-227>