emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e258e58276: process-attributes-ps-args / process-attributes-ps-fo


From: Michael Albinus
Subject: master e258e58276: process-attributes-ps-args / process-attributes-ps-format for Darwin
Date: Tue, 12 Apr 2022 03:12:55 -0400 (EDT)

branch: master
commit e258e582768a6f974ab1da198e894408d9933cd1
Author: Filipp Gunbin <fgunbin@fastmail.fm>
Commit: Michael Albinus <michael.albinus@gmx.de>

    process-attributes-ps-args / process-attributes-ps-format for Darwin
    
    * lisp/net/tramp-integration.el
    (tramp-darwin-process-attributes-ps-args)
    (tramp-darwin-process-attributes-ps-format)
    (tramp-connection-local-darwin-ps-variables): New defconsts.  Add
    them to connection-local variables.  Preset default "ps" profile
    for Darwin.
---
 lisp/net/tramp-integration.el | 94 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index 81990c6a33..901826bfc1 100644
--- a/lisp/net/tramp-integration.el
+++ b/lisp/net/tramp-integration.el
@@ -430,6 +430,100 @@ See `tramp-process-attributes-ps-format'.")
  'tramp-connection-local-busybox-ps-profile
  tramp-connection-local-busybox-ps-variables)
 
+
+;; Darwin (macOS)
+(defconst tramp-darwin-process-attributes-ps-args
+  `("-acxww"
+    "-o"
+    ,(mapconcat
+      #'identity
+      '("pid"
+        "uid"
+        "user"
+        "gid"
+        "comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
+      ",")
+    "-o" "state=abcde"
+    "-o"
+    ,(mapconcat
+      #'identity
+      '("ppid"
+        "pgid"
+        "sess"
+        "tty"
+        "tpgid"
+        "minflt"
+        "majflt"
+        "time"
+        "pri"
+        "nice"
+        "vsz"
+        "rss"
+        "etime"
+        "pcpu"
+        "pmem"
+        "args")
+      ","))
+  "List of arguments for \"ps\".
+See `tramp-process-attributes-ps-args'.")
+
+(defconst tramp-darwin-process-attributes-ps-format
+  '((pid . number)
+    (euid . number)
+    (user . string)
+    (egid . number)
+    (comm . 52)
+    (state . 5)
+    (ppid . number)
+    (pgrp . number)
+    (sess . number)
+    (ttname . string)
+    (tpgid . number)
+    (minflt . number)
+    (majflt . number)
+    (time . tramp-ps-time)
+    (pri . number)
+    (nice . number)
+    (vsize . number)
+    (rss . number)
+    (etime . tramp-ps-time)
+    (pcpu . number)
+    (pmem . number)
+    (args . nil))
+  "Alist of formats for \"ps\".
+See `tramp-process-attributes-ps-format'.")
+
+(defconst tramp-connection-local-darwin-ps-variables
+  `((tramp-process-attributes-ps-args
+     . ,tramp-darwin-process-attributes-ps-args)
+    (tramp-process-attributes-ps-format
+     . ,tramp-darwin-process-attributes-ps-format))
+  "Default connection-local ps variables for remote Darwin
+connections.")
+
+(connection-local-set-profile-variables
+ 'tramp-connection-local-darwin-ps-profile
+ tramp-connection-local-darwin-ps-variables)
+
+
+
+;; Preset default "ps" profile for the case of local sudo, based on
+;; system type.
+
+(let ((local-sudo-profile
+       (cond ((eq system-type 'darwin)
+              'tramp-connection-local-darwin-ps-profile)
+             ;; ...add other system types here
+             )))
+  (when local-sudo-profile
+    (connection-local-set-profiles
+     `(:application tramp :protocol "sudo" :user "root" :machine 
,(system-name))
+     local-sudo-profile)
+    (connection-local-set-profiles
+     '(:application tramp :protocol "sudo" :user "root" :machine "localhost")
+     local-sudo-profile)))
+
+
 (add-hook 'tramp-unload-hook
          (lambda () (unload-feature 'tramp-integration 'force)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]