[libc-commits] [libc] [libc] Implement getitimer and setitimer, add proxy headers for itimerval (PR #134773)

Tsz Chan via libc-commits libc-commits at lists.llvm.org
Wed Apr 9 21:46:52 PDT 2025


================
@@ -0,0 +1,32 @@
+//===-- Unittests for getitimer -------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
+// Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "hdr/types/struct_itimerval.h"
+#include "src/sys/time/getitimer.h"
+#include "test/UnitTest/ErrnoSetterMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <sys/time.h>
+
+using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
+
+TEST(LlvmLibcSysTimeGetitimerTest, SmokeTest) {
+  struct itimerval timer;
+  timer.it_value.tv_sec = -1;
+  timer.it_value.tv_usec = -1;
+  timer.it_interval.tv_sec = -1;
+  timer.it_interval.tv_usec = -1;
+
+  ASSERT_THAT(LIBC_NAMESPACE::getitimer(0, &timer),
+              returns(EQ(0)).with_errno(EQ(0)));
----------------
tszhin-swe wrote:

Added

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


More information about the libc-commits mailing list