acg / psmisc Goto Github PK
View Code? Open in Web Editor NEWA set of tools that use the proc filesystem.
Home Page: http://psmisc.sourceforge.net/
License: GNU General Public License v2.0
A set of tools that use the proc filesystem.
Home Page: http://psmisc.sourceforge.net/
License: GNU General Public License v2.0
psmisc ====== This package contains five little utilities that use the proc FS: fuser identifies processes using files or sockets (similar to Sun's or SGI's fuser) killall kills processes by name, e.g. killall -HUP named pidof like killall, buts lists PIDs instead of killing processes pstree shows the currently running processes as a tree peekfd shows the data travelling over a file descriptor They should work with most recent kernels. Man pages are included. - Werner Almesberger <[email protected]> src/loop.h was stolen from util-linux package which in turn stole it from the Linux kernel. fuser on network fs ------------------- On network filesystems, fuser can hang because its trying to stat files that may go away. If you use the --with-timeout-stat option during the configure step then fuser will fork a process to run stat. This means fuser doesn't hang, but it is much slower. Translations ------------ My thanks for the various translators who have cheerfully given me the po files to make psmisc speak different languages. If your language is not supported then let me know, all it takes is translating one file in a certain manner. Icons ----- The pstree icons were drawn by Tatlin at Coresis who has given permission for them to be used for psmisc. Copyright Change ---------------- The license has changed to GPL for version 20 onwards with permission of the original authors. People who want to use these programs under the previous license will have to look at psmisc 19 or below.
Hello!
Valgrind seems to rename itself and do a few tricks which confuses killall:
alext@dark:~/installs/psmisc$ which valgrind
/usr/bin/valgrind
alext@dark:~/installs/psmisc$ file /usr/bin/valgrind
/usr/bin/valgrind: POSIX shell script, ASCII text executable
alext@dark:~/installs/psmisc$ tail /usr/bin/valgrind
# Force C++ STL to use malloc and to free memory by disabling
# memory caching.
# For gcc < 3.4 versions
export GLIBCPP_FORCE_NEW=1
# For gcc >= 3.4 versions
export GLIBCXX_FORCE_NEW=1
# Use 'exec' to avoid having another shell process hanging around.
exec $0.bin "$@"
alext@dark:~/installs/psmisc$ which valgrind.bin
/usr/bin/valgrind.bin
alext@dark:~/installs/psmisc$ file /usr/bin/valgrind.bin
/usr/bin/valgrind.bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=83d519cb14acf074c670818c6cb48e8430620ea3, stripped
alext@dark:~/installs/psmisc$ valgrind sleep 100000 &
[1] 29264
alext@dark:~/installs/psmisc$ ==29264== Memcheck, a memory error detector
==29264== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==29264== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==29264== Command: sleep 100000
==29264==
alext@dark:~/installs/psmisc$
alext@dark:~/installs/psmisc$ ls -l /proc/29264/exe
lrwxrwxrwx 1 alext alext 0 Aug 13 10:48 /proc/29264/exe -> /usr/lib/valgrind/memcheck-amd64-linux
alext@dark:~/installs/psmisc$ cat /proc/29264/comm
memcheck-amd64-
alext@dark:~/installs/psmisc$ xxd /proc/29264/cmdline
0000000: 2f75 7372 2f62 696e 2f76 616c 6772 696e /usr/bin/valgrin
0000010: 642e 6269 6e00 736c 6565 7000 3130 3030 d.bin.sleep.1000
0000020: 3030 00 00.
alext@dark:~/installs/psmisc$ ls -l /usr/lib/valgrind/memcheck-amd64-linux
-rwxr-xr-x 1 root root 4087408 Mar 26 22:42 /usr/lib/valgrind/memcheck-amd64-linux
alext@dark:~/installs/psmisc$ file /usr/lib/valgrind/memcheck-amd64-linux
/usr/lib/valgrind/memcheck-amd64-linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=f8a43a1f62e68f711332b3f5cd8206650938c8a3, stripped
alext@dark:~/installs/psmisc$ ps aux | grep valgrind
alext 29264 0.2 0.4 105540 36708 pts/22 S 10:48 0:00 /usr/bin/valgrind.bin sleep 100000
alext 29316 0.0 0.0 10944 936 pts/22 S+ 10:51 0:00 grep --color=auto valgrind
alext@dark:~/installs/psmisc$ pidof valgrind
alext@dark:~/installs/psmisc$ pidof valgrind.bin
29264
alext@dark:~/installs/psmisc$ pidof memcheck-amd64-linux
alext@dark:~/installs/psmisc$ killall valgrind
valgrind: no process found
alext@dark:~/installs/psmisc$ killall valgrind.bin
valgrind.bin: no process found
alext@dark:~/installs/psmisc$ killall memcheck-amd64-linux
alext@dark:~/installs/psmisc$ ==29264==
==29264== HEAP SUMMARY:
==29264== in use at exit: 0 bytes in 0 blocks
==29264== total heap usage: 29 allocs, 29 frees, 3,928 bytes allocated
==29264==
==29264== All heap blocks were freed -- no leaks are possible
==29264==
==29264== For counts of detected and suppressed errors, rerun with: -v
==29264== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
[1]+ Terminated valgrind sleep 100000
alext@dark:~/installs/psmisc$
I'm not exactly sure what valgrind is doing, but it sure has many names :) The thing which I would like to work though, is if you try "killall X", where X is what ps prints. Since ps prints "/usr/bin/valgrind.bin", I would like to be able to do "killall /usr/bin/valgrind.bin" or "killall valgrind.bin". This doesn't work in this case tough.
A quick look at the source code seems to indicate that the reason is that killall loads the name from /proc/N/comm (using "load_process_name_and_age"), and only falls back to /proc/N/cmdline (using "load_proc_cmdline") if the command name is longer than COMM_LEN.
My feature request is to consider matching both names, as they may differ. In this case I don't even see the need for looking at comm.
If I execute pstree
with a pid, that does not exist, it returns a complete tree. This happens only with the --show-parents
option and for me it is an unexpected behavior.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.