summaryrefslogtreecommitdiff
path: root/internal/eventloop.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-03-24 21:58:05 +0200
committerPaul Buetow <paul@buetow.org>2025-03-24 21:58:05 +0200
commit91bdec412bf5701c8dfe4b5e1a8ec841a18c004a (patch)
tree18ca76a712c25de5147ec3072054a9699ef1c5cd /internal/eventloop.go
parent26be49ea3cc2516ab7d26b629e7edc93a296596d (diff)
ignore ior process itself
Diffstat (limited to 'internal/eventloop.go')
-rw-r--r--internal/eventloop.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/eventloop.go b/internal/eventloop.go
index f7bfa9a..18f02c4 100644
--- a/internal/eventloop.go
+++ b/internal/eventloop.go
@@ -266,13 +266,15 @@ func (e *eventLoop) syscallExit(exitEv event.Event, ch chan<- *event.Pair) {
if !ok {
panic("expected a file.FdFile")
}
+ if fdFile.Flags == -1 {
+ fmt.Println("DEBUG flags is -1", fdFile)
+ }
// See fcntl(2) for implementation details
switch v.Cmd {
case syscall.F_SETFL:
- fmt.Println("DEBUG", fdFile)
canChange := syscall.O_APPEND | syscall.O_ASYNC | syscall.O_DIRECT | syscall.O_NOATIME | syscall.O_NONBLOCK
- *fdFile.Flags |= (int32(v.Arg) & int32(canChange))
+ fdFile.Flags |= (int32(v.Arg) & int32(canChange))
ev.File = fdFile
e.files[fd] = fdFile
case syscall.F_DUPFD:
@@ -281,7 +283,7 @@ func (e *eventLoop) syscallExit(exitEv event.Event, ch chan<- *event.Pair) {
case syscall.F_DUPFD_CLOEXEC:
newFd := int32(retEvent.Ret)
duppedFd := fdFile.Dup(newFd)
- *duppedFd.Flags |= syscall.O_CLOEXEC
+ duppedFd.Flags |= syscall.O_CLOEXEC
e.files[newFd] = duppedFd
}
@@ -292,7 +294,6 @@ func (e *eventLoop) syscallExit(exitEv event.Event, ch chan<- *event.Pair) {
// TODO: implement dup syscall
// TODO: implement dup2 syscall
// TODO: implement dup3 syscall
- // TODO: Yes, on Linux, when you use the `fork` syscall to create a subprocess, the child process shares the same file descriptors as the parent process. If the child process changes the file modes of these open file descriptors (e.g., by using `fcntl` or similar system calls), those changes will be reflected in the parent process as well, since they reference the same underlying file table entries.
ev.PrevPair, _ = e.prevPairs[ev.EnterEv.GetTid()]
ev.CalculateDurations()