diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2022-04-05 17:08:03 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2022-04-05 17:08:03 +0200 |
commit | e48ac2e2040cf0dd628b7fee6991a1738ceb2349 (patch) | |
tree | 76fe1343cbb9ea73d506982d8b0158f474488cc4 /lisp/net/tramp-integration.el | |
parent | 7d504c9acc0c8d75d11c3a2b5e016f39e6156bf8 (diff) | |
download | emacs-e48ac2e2040cf0dd628b7fee6991a1738ceb2349.tar.gz |
Handle remote system processes
* doc/lispref/files.texi (Magic File Names):
Add list-system-processes and process-attributes.
* doc/lispref/processes.texi (System Processes): Document changes
in list-system-processes and process-attributes.
* doc/misc/tramp.texi (Customizing Completion): Use @ftable.
(Remote processes): Document changes in list-system-processes and
process-attributes.
* etc/NEWS: Document changes in proced, list-system-processes and
process-attributes.
* lisp/proced.el (proced-show-remote-processes): New defcustom.
(proced-remote-directory): Remove.
(proced-filter-alist): Use it.
(proced-user-name): New defun.
(proced-available): Set it to t.
(proced-mode): Adapt docstring.
(proced): Adapt docstring. Acknowledge prefix argument.
(proced-format): Change initialization of `standard-attributes'.
(proced-send-signal, proced-renice): Adapt docstring. Remove
special handling of prefix argument.
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Add 'list-system-processes' and `process-attributes'.
* lisp/net/tramp-integration.el (files-x): Require `files-x'.
(tramp-bsd-process-attributes-ps-args)
(tramp-bsd-process-attributes-ps-format)
(tramp-connection-local-bsd-ps-variables)
(tramp-busybox-process-attributes-ps-args)
(tramp-busybox-process-attributes-ps-format)
(tramp-connection-local-busybox-ps-variables):
* lisp/net/tramp-adb.el (tramp-adb-connection-local-default-ps-variables):
New defconsts. Add them to connection-local variables.
* lisp/net/tramp.el (tramp-file-name-for-operation):
Add 'list-system-processes' and `process-attributes'.
(tramp-process-attributes-ps-args)
(tramp-process-attributes-ps-format): New defconsts.
(tramp-ps-time, tramp-get-process-attributes)
(tramp-handle-list-system-processes)
(tramp-handle-process-attributes): New defuns.
* src/process.c (Flist_system_processes, Fprocess_attributes):
Support remote system processes.
(Qlist_system_processes, Qprocess_attributes): Declare symbols.
Diffstat (limited to 'lisp/net/tramp-integration.el')
-rw-r--r-- | lisp/net/tramp-integration.el | 140 |
1 files changed, 136 insertions, 4 deletions
diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el index 3b2e7c0f916..089093a4208 100644 --- a/lisp/net/tramp-integration.el +++ b/lisp/net/tramp-integration.el @@ -28,6 +28,7 @@ ;;; Code: (require 'tramp-compat) +(require 'files-x) ;; Pacify byte-compiler. (require 'cl-lib) @@ -285,9 +286,11 @@ NAME must be equal to `tramp-current-connection'." 'tramp-connection-local-default-system-profile tramp-connection-local-default-system-variables) -(connection-local-set-profiles +(apply + #'connection-local-set-profiles '(:application tramp) - 'tramp-connection-local-default-system-profile) + (cons 'tramp-connection-local-default-system-profile + (connection-local-get-profiles '(:application tramp)))) (defconst tramp-connection-local-default-shell-variables '((shell-file-name . "/bin/sh") @@ -299,9 +302,138 @@ NAME must be equal to `tramp-current-connection'." tramp-connection-local-default-shell-variables) (with-eval-after-load 'shell - (connection-local-set-profiles + (apply + #'connection-local-set-profiles '(:application tramp) - 'tramp-connection-local-default-shell-profile)) + (cons 'tramp-connection-local-default-shell-profile + (connection-local-get-profiles '(:application tramp))))) + +;; Tested with FreeBSD 12.2. +(defconst tramp-bsd-process-attributes-ps-args + `("-acxww" + "-o" + ,(mapconcat + #'identity + '("pid" + "euid" + "user" + "egid" + "egroup" + "comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + ",") + "-o" + ,(mapconcat + #'identity + '("state" + "ppid" + "pgid" + "sid" + "tty" + "tpgid" + "minflt" + "majflt" + "time" + "pri" + "nice" + "vsz" + "rss" + "etimes" + "pcpu" + "pmem" + "args") + ",")) + "List of arguments for \"ps\". +See `tramp-process-attributes-ps-args'.") + +(defconst tramp-bsd-process-attributes-ps-format + '((pid . number) + (euid . number) + (user . string) + (egid . number) + (group . string) + (comm . 52) + (state . string) + (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 . number) + (pcpu . number) + (pmem . number) + (args . nil)) + "Alist of formats for \"ps\". +See `tramp-process-attributes-ps-format'.") + +(defconst tramp-connection-local-bsd-ps-variables + `((tramp-process-attributes-ps-args + . ,tramp-bsd-process-attributes-ps-args) + (tramp-process-attributes-ps-format + . ,tramp-bsd-process-attributes-ps-format)) + "Default connection-local ps variables for remote BSD connections.") + +(connection-local-set-profile-variables + 'tramp-connection-local-bsd-ps-profile + tramp-connection-local-bsd-ps-variables) + +;; Tested with BusyBox v1.24.1. +(defconst tramp-busybox-process-attributes-ps-args + `("-o" + ,(mapconcat + #'identity + '("pid" + "user" + "group" + "comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + ",") + "-o" "stat=abcde" + "-o" + ,(mapconcat + #'identity + '("ppid" + "pgid" + "tty" + "time" + "nice" + "etime" + "args") + ",")) + "List of arguments for \"ps\". +See `tramp-process-attributes-ps-args'.") + +(defconst tramp-busybox-process-attributes-ps-format + '((pid . number) + (user . string) + (group . string) + (comm . 52) + (state . 5) + (ppid . number) + (pgrp . number) + (ttname . string) + (time . tramp-ps-time) + (nice . number) + (etime . tramp-ps-time) + (args . nil)) + "Alist of formats for \"ps\". +See `tramp-process-attributes-ps-format'.") + +(defconst tramp-connection-local-busybox-ps-variables + `((tramp-process-attributes-ps-args + . ,tramp-busybox-process-attributes-ps-args) + (tramp-process-attributes-ps-format + . ,tramp-busybox-process-attributes-ps-format)) + "Default connection-local ps variables for remote Busybox connections.") + +(connection-local-set-profile-variables + 'tramp-connection-local-busybox-ps-profile + tramp-connection-local-busybox-ps-variables) (add-hook 'tramp-unload-hook (lambda () (unload-feature 'tramp-integration 'force))) |