从命令提示符杀死在 wine 中运行的进程

发布于 2024-10-09 07:40:22 字数 406 浏览 8 评论 0原文

(我不是 Linux 或 Wine 专业人士……它们是由 IT 人员设置的……我只是一个 Java 人员) 我正在开发一个在 Linux 上运行的 java 应用程序。它产生几个做同样事情的线程,即产生进程(java.lang.Process),一些Linux,一些Windows通过wine。我的一些线程将在 wine 调用期间无限期地挂起。

因为我有几个线程调用相同的 linux/windows 应用程序,所以我不能只 grep wine 的 ps 输出并杀死它,因为我可以杀死没问题的 wine 进程。

做了一些谷歌搜索,通过反射,我能够从进程中获取 pid,但它与使用 ps 的 Linux pid 不对应,所以我认为它是在 wine 中运行的 pid。

(终于有问题了……) 有没有办法杀死在 wine 中运行并引用其 pid 的进程?

(I'm not a Linux or Wine pro... they were set up by an IT guy... I'm just a java guy)
I'm working on a java application which runs on Linux. It spawns several threads that do the same thing, namely spawning processes (java.lang.Process), some Linux, some Windows through wine. Some of my threads will hang indefinitely during the wine calls.

Because I have several threads going that call the same linux/windows apps, I can't just grep the ps output for wine and kill that because I could kill wine processes that are fine.

Did some googling, and through reflection I'm able to get the pid from the process but it doesn't correspond to a Linux pid using ps, so I'm thinking it's a pid running in wine.

(Finally the question...)
Is there a way to kill a process running in wine referencing it's pid?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

羁客 2024-10-16 07:40:22

要终止所有 Wine 进程,请使用 wineserver -k (所有进程都在同一 WINEPREFIX 环境中)。

要杀死特定进程(通过 winedbg --command "info proc" 列出),您可以按以下方式运行 winedbg

然后运行 ​​winedbg由于

$ winedbg
Wine-dbg>info proc
 pid      threads  executable (all id:s are in hex)
 0000000d 4        'taskmgr.exe'
 0000000e 4        'services.exe'
 0000001a 3        \_ 'plugplay.exe'
Wine-dbg>attach 13
0x9f68ad05 read$UNIX2003+0x5 in libsystem_kernel.dylib: call    0x9f68b40c _sysenter_trap in libsystem_kernel.dylib
Wine-dbg>kill
Wine-dbg>quit

attach 接受十进制值,因此您需要将其 pid 从十六进制转换,以下是 Bash shell 中的示例:

echo $(( 0x0000000d ))

To kill all Wine processes, use wineserver -k (all within same WINEPREFIX environment).

For killing specific process (list by winedbg --command "info proc"), you can run winedbg in the following way:

Then run winedbg in the following way:

$ winedbg
Wine-dbg>info proc
 pid      threads  executable (all id:s are in hex)
 0000000d 4        'taskmgr.exe'
 0000000e 4        'services.exe'
 0000001a 3        \_ 'plugplay.exe'
Wine-dbg>attach 13
0x9f68ad05 read$UNIX2003+0x5 in libsystem_kernel.dylib: call    0x9f68b40c _sysenter_trap in libsystem_kernel.dylib
Wine-dbg>kill
Wine-dbg>quit

Since attach accepts a decimal value, you need to convert its pid from hexadecimal, here is example in Bash shell:

echo $(( 0x0000000d ))
洋洋洒洒 2024-10-16 07:40:22

Wine,至少在最近的版本中,确实有自己的 taskmgrtaskkill,类似于 Windows 上的同名程序。

Wine, at least in recent versions, does come with its own taskmgr and taskkill, analogous to the programs by the same name on Windows.

神妖 2024-10-16 07:40:22

当您执行kill -3 PID(其中PID是您感兴趣的Wine进程的ID)时,您将在启动该进程的控制台上获得JVM线程转储。此转储将包含线程及其当前状态的列表,并将包含 nid 字段,该字段等于 ps -ef -T 输出中的 SPID 字段。

When you do kill -3 PID where PID is id of Wine process you interested in, you'll get JVM thread dump on the console where you've launched that process. This dump will contain list of threads with theirs current state, and will contain nid field which is equal to SPID field in output of ps -ef -T.

_畞蕅 2024-10-16 07:40:22

如果您感到太沮丧,请尝试使用 Windows 任务管理器。它应该能够将葡萄酒流程视为本地流程。 (当然它根本看不到其他的,所以总数加起来不会达到 100%)。

If you get too frustrated, try a Windows task manager. It should be able to see the wine processes as native. (Of course it won't see the others at all so the total won't add up to 100%).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文