Skip to content

Fix semantics of posix time function#240

Open
zhanghe-vivo wants to merge 1 commit intovivoblueos:mainfrom
zhanghe-vivo:zhanghe_posix_time
Open

Fix semantics of posix time function#240
zhanghe-vivo wants to merge 1 commit intovivoblueos:mainfrom
zhanghe-vivo:zhanghe_posix_time

Conversation

@zhanghe-vivo
Copy link
Contributor

signal process hasn't added, will rebase #238

@lawkai-vivo lawkai-vivo changed the title fix semantics of posix time function Fix semantics of posix time function Dec 22, 2025
@lawkai-vivo
Copy link
Contributor

Can you elaborate why do we need to invent a new POSIX timer in kernel rather than using soft timer?

@zhanghe-vivo
Copy link
Contributor Author

stub posix timers, preserve clock implement

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

❌ Job failed. Failed jobs: check_format (failure), build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/20710231867.

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/20710672760.

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/20710835888.

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/20711463695.

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/20711707723.

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

✅ All jobs completed successfully, see https://github.com/vivoblueos/kernel/actions/runs/20712177870.

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

✅ All jobs completed successfully, see https://github.com/vivoblueos/kernel/actions/runs/20712502352.

@github-actions
Copy link

❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/22388379202.

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

@github-actions
Copy link

❌ Job failed. Failed jobs: check_format (failure), see https://github.com/vivoblueos/kernel/actions/runs/22388526351.

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

@github-actions
Copy link

✅ All jobs completed successfully, see https://github.com/vivoblueos/kernel/actions/runs/22389341686.

if !evp.is_null() {
return -EINVAL as c_long;
}
unsafe { *timerid = 1 as timer_t };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not fully implemented, it is recommended to add a TODO marker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chang as suggestion


// Global realtime offset.
use crate::sync::spinlock::SpinLock;
static REALTIME_OFFSET_NS: SpinLock<i64> = SpinLock::new(0);
Copy link
Contributor

@han-jiang277 han-jiang277 Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use AtomicI64 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AtomicU64 is supported via libatomic on 32-bit platforms. However, it's not lock-free.

Copy link
Contributor

@han-jiang277 han-jiang277 Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also think that in most scenarios we should use an efficient implementation, and only fall back to use lock in 32-bit environments.

Copy link
Contributor

@lawkai-vivo lawkai-vivo Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AtomicU64 is supported via libatomic on 32-bit platforms. However, it's not lock-free.

According to https://doc.rust-lang.org/std/sync/atomic/, rust's Atomic only supports lock-free types, so AtomicU64 might be unavailable on 32-bit platoforms. Using spinlock here LGTM.

@lawkai-vivo lawkai-vivo requested review from lawkai-vivo and removed request for lawkai-vivo March 4, 2026 07:58
@zhanghe-vivo zhanghe-vivo force-pushed the zhanghe_posix_time branch 2 times, most recently from d034ad8 to 915f29f Compare March 4, 2026 08:24
@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

✅ All jobs completed successfully, see https://github.com/vivoblueos/kernel/actions/runs/22661144095.

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

❌ Job failed. Failed jobs: check_format (failure), build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/22701076137.

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/22701822414.

@zhanghe-vivo
Copy link
Contributor Author

build_prs #240 vivoblueos/librs#22 vivoblueos/libc#5

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

✅ All jobs completed successfully, see https://github.com/vivoblueos/kernel/actions/runs/22704702662.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants