Comments (3)
err = watcher.Watch(os.Getpid(), psnotify.PROC_EVENT_ALL)
Change os.Getpid() to shell pid
from gosigar.
watcher.Watch(os.Getpid(), psnotify.PROC_EVENT_ALL) watch 自己?你是谁,你不是 B 哥。。。
from gosigar.
It's impossible to monitor all events without making modifications to this library, as shown in the following:
case PROC_EVENT_FORK:
event := &forkProcEvent{}
binary.Read(buf, byteOrder, event)
ppid := int(event.ParentTgid)
pid := int(event.ChildTgid)
if w.isWatching(ppid, PROC_EVENT_EXEC) {
// follow forks
watch, _ := w.watches[ppid]
w.Watch(pid, watch.flags)
}
if w.isWatching(ppid, PROC_EVENT_FORK) {
w.Fork <- &ProcEventFork{ParentPid: ppid, ChildPid: pid}
}
Since the PID filter cannot be disabled from the caller, case closed.
from gosigar.
Related Issues (20)
- linux FileSystemList.Get fails if /etc/mtab is not present HOT 3
- Can psnotify watch on all PIDs HOT 5
- Reconsider linux memory computation HOT 1
- Crashes on Windows XP on init HOT 2
- macOS Sierra crash HOT 1
- Make Memory calculations use MemAvailable HOT 1
- Darwin: no get 'syscall.NOTE_EXEC' event, and how get pid and ppid in one event? HOT 3
- psnotify can't work on Darwin platform HOT 2
- Weird package dependency
- Issue with uintptr size HOT 2
- showing wrong uptime in windows machine HOT 2
- Memory calculation inside containerized environments HOT 2
- Resolve vulnerability CVE-2020-14040 in outdated golang.org/x/text HOT 3
- More examples HOT 1
- Error when run the code HOT 4
- Gosigar explodes when cgroup controllers are mounted in multiple FS locations HOT 2
- sigar.Mem not reporting correctly inside Docker container HOT 9
- build errors on GOARCH=arm64 (type Cpu has no field or method Get) HOT 6
- security issue from dependency on gopkg.in/yaml.v2 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gosigar.