Conversation
Merging this PR will improve performance by 14.68%
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
|
GNU testsuite comparison: |
| reason = "signature shared across platforms" | ||
| )] | ||
| pub(crate) fn exec(&mut self) -> UResult<()> { | ||
| println!("{}", translate!("who-unsupported-openbsd")); |
There was a problem hiding this comment.
If it is actually not supported, this code should be removed. We don't suppprt building stubs.
30b8f55 to
786338f
Compare
|
sorry, could you please rebase it |
786338f to
02d93f9
Compare
02d93f9 to
786d107
Compare
e274d29 to
837fb02
Compare
837fb02 to
29bb23f
Compare
|
it bloated with 10 unsafes can we reduce it, safe rust can do some of these things? |
29bb23f to
6a6e3e5
Compare
|
This PR adds platform specific unsafe, but not for all. |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 1
Open (5)
On Windows, onlyselect.sessionsis honored; other selection modes (e.g.,--boot,--runlevel,… · Newnow_local().unwrap()can panic if the local offset/timezone cannot be determined (which may be… · NewWtsBuffer::dropunconditionally callsWTSFreeMemoryeven if the pointer is null. While some… · New Thepidcolumn is populated withsession.id(a WTS session ID), which is not a process ID and… · New Withwhonow enabled for Windows, the existingwhotests appear to be moving toward Unix-only… · New
| for session in sessions(!self.all) { | ||
| if self.own_terminal_only && current_session != Some(session.id) { | ||
| continue; | ||
| } | ||
| if self.select.sessions && !session.user.is_empty() { | ||
| self.emit_session(&session)?; | ||
| } | ||
| } |
| /// minute, and the localized `old` past a day or before the given boot time. | ||
| pub(crate) fn format_idle<'a>(when: i64, since_boot: i64) -> Cow<'a, str> { | ||
| thread_local! { | ||
| static NOW: time::OffsetDateTime = time::OffsetDateTime::now_local().unwrap(); |
| // SAFETY: the pointer was returned by WTS and is freed exactly once. | ||
| unsafe { WTSFreeMemory(self.0.cast()) }; |
| line: &session.line, | ||
| time: &time, | ||
| idle: &idle, | ||
| pid: &format!("{}", session.id), |
| use uutests::new_ucmd; | ||
| #[cfg(unix)] | ||
| use uutests::unwrap_or_return; | ||
| #[cfg(unix)] | ||
| use uutests::util::{TestScenario, expected_result, gnu_cmd_result}; | ||
| #[cfg(unix)] | ||
| use uutests::util_name; | ||
| #[test] | ||
| fn test_invalid_arg() { |


who was previously unavailable on Windows.
This adds a backend backed by WTS session information and enables it in the Windows feature set. Option parsing and output formatting remain shared with the Unix implementation.