Skip to content

Add missing psmisc features: regexp/namespace filters for killall, fuser utility#16

Merged
martabal merged 2 commits intomainfrom
copilot/add-missing-features
Dec 13, 2025
Merged

Add missing psmisc features: regexp/namespace filters for killall, fuser utility#16
martabal merged 2 commits intomainfrom
copilot/add-missing-features

Conversation

Copy link
Contributor

Copilot AI commented Dec 13, 2025

Implementation Plan for Missing Features in psmisc-rs

Phase 1: Missing faulx features ✅

  • Add regexp support to faulx (killall)
    • Added -r, --regexp flag to interpret process names as regular expressions
    • Regex behind feature flag - can be disabled with --no-default-features
    • Supports case-insensitive matching when combined with -I, --ignore-case
    • Added unit tests for regex matching functionality
    • Updated faulx README to reflect completed feature
  • Add namespace support to faulx (killall)
    • Added -n, --namespace option to match processes in the same namespace
    • Supports all Linux namespace types (pid, net, mnt, ipc, uts, cgroup, user, time)
    • Avoided clone - uses Option<&str> instead of Option<String> with lifetime parameter
    • Added unit tests for namespace checking
    • Updated faulx README to reflect completed feature

Phase 2: New utilities

  • Implement fuser utility (identify processes using files/sockets) ✅
    • Created new fuser crate with full implementation
    • Checks current working directory, root directory, executable, file descriptors, and memory maps
    • Supports kill functionality with custom signals
    • Verbose and quiet modes
    • Avoided clones - uses Arc<str> for shared process names
    • Updated main README to list fuser as implemented
    • All code review feedback addressed:
      • Moved signal parsing to helpers crate to eliminate duplication
      • Removed unused CLI flags
      • Optimized PID tracking with HashSet (O(1) vs O(n) lookup)
      • Fixed memory map parsing to handle all line formats and process all entries
      • Improved code readability in time checking logic
      • Fixed all redundant clone warnings

Architecture & Standards ✅

  • Follow existing code patterns and structure
  • Add tests for new features
  • Update documentation
  • Ensure clippy and formatting compliance
  • Address all code review feedback
  • Rebased to main - includes latest test coverage improvements

All requested changes complete:

  • ✅ Regex behind feature flag
  • ✅ Clones avoided (lifetimes + Arc)
  • ✅ Rebased to main
Original prompt

Identify and implement the missing features in the martabal/psmisc-rs repository based on the project specifications or roadmap. Ensure that the new features align with the current architecture and meet the repository's standards. Deliver well-documented code with necessary tests for the new features.

This pull request was created as a result of the following prompt from Copilot chat.

Identify and implement the missing features in the martabal/psmisc-rs repository based on the project specifications or roadmap. Ensure that the new features align with the current architecture and meet the repository's standards. Deliver well-documented code with necessary tests for the new features.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Implement missing features in psmisc-rs repository Add missing psmisc features: regexp/namespace filters for killall, fuser utility Dec 13, 2025
Copilot AI requested a review from martabal December 13, 2025 16:17
@martabal
Copy link
Owner

@copilot put regex behind a feature flag, avoid clone if you can

@martabal
Copy link
Owner

@copilot Retry my last comment and rebase to main

Copy link
Contributor Author

Copilot AI commented Dec 13, 2025

@copilot Retry my last comment and rebase to main

Completed both tasks:

  1. Regex behind feature flag - Regex support is now optional, enabled by default. Can be disabled with --no-default-features when building faulx. The regex import and related functions are wrapped in #[cfg(feature = "regex")].

  2. Avoided clones:

    • In faulx: Changed OptionsPids to use Option<&'a str> instead of Option<String> for namespace field, eliminating the clone in main.rs
    • In fuser: Changed ProcessFileInfo.comm from String to Arc<str>, allowing cheap reference counting instead of cloning strings for each file access type
  3. Rebased to main - Successfully rebased onto latest main (commits a7b2e88 and 2cb0682), resolving all conflicts

The branch is ready but I encountered authentication issues when trying to force-push the rebased commits. The local branch has all changes applied and passes all tests and clippy checks.

@martabal martabal force-pushed the copilot/add-missing-features branch 2 times, most recently from 44e246c to f40b08d Compare December 13, 2025 20:08
@martabal martabal force-pushed the copilot/add-missing-features branch from f40b08d to 71db79e Compare December 13, 2025 20:19
@martabal martabal marked this pull request as ready for review December 13, 2025 20:23
@martabal martabal merged commit 6110b31 into main Dec 13, 2025
8 checks passed
@martabal martabal deleted the copilot/add-missing-features branch December 13, 2025 20:23
martabal added a commit that referenced this pull request Dec 13, 2025
…ser utility (#16)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: martin <martin.labat92@gmail.com>
martabal added a commit that referenced this pull request Dec 13, 2025
…ser utility (#16)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: martin <martin.labat92@gmail.com>
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.

2 participants