Skip to content

Fix semantics of posix time function#240

Merged
han-jiang277 merged 1 commit into
vivoblueos:mainfrom
zhanghe-vivo:zhanghe_posix_time
Mar 8, 2026
Merged

Fix semantics of posix time function#240
han-jiang277 merged 1 commit into
vivoblueos:mainfrom
zhanghe-vivo:zhanghe_posix_time

Conversation

@zhanghe-vivo

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

stub posix timers, preserve clock implement

@zhanghe-vivo

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

❌ 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
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

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

@zhanghe-vivo

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

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

@zhanghe-vivo

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

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

@zhanghe-vivo

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

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

@zhanghe-vivo

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

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

@zhanghe-vivo

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

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

@zhanghe-vivo

Copy link
Copy Markdown
Contributor Author

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

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

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

@zhanghe-vivo

Copy link
Copy Markdown
Contributor Author

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

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

✅ 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
Copy Markdown
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
Copy Markdown
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);

@han-jiang277 han-jiang277 Mar 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use AtomicI64 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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.

@han-jiang277 han-jiang277 Mar 4, 2026

Copy link
Copy Markdown
Contributor

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.

@lawkai-vivo lawkai-vivo Mar 5, 2026

Copy link
Copy Markdown
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.

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
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown

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

@zhanghe-vivo

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown

❌ 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
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown

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

@zhanghe-vivo

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown

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

@han-jiang277 han-jiang277 merged commit 133eb6a into vivoblueos:main Mar 8, 2026
1 check passed
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