Skip to content

Commit

Permalink
Resize fifo to 1024K
Browse files Browse the repository at this point in the history
Signed-off-by: kkkkun <[email protected]>
  • Loading branch information
kkkkun committed Mar 20, 2024
1 parent 3e17f98 commit 17373f5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fifo.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ type fifo struct {
handle *handle
}

const (
F_SETPIPE_SZ = 1031
)

const FIFO_SIZE = 1024 * 1024

var leakCheckWg *sync.WaitGroup

// OpenFifoDup2 is same as OpenFifo, but additionally creates a copy of the FIFO file descriptor with dup2 syscall.
Expand Down Expand Up @@ -173,6 +179,9 @@ func openFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (*fifo
return nil, f.err
}
}
// Set fifo size to 1024K
// https://github.com/torvalds/linux/commit/ff9da691c0498ff81fdd014e7a0731dab2337dac
unix.FcntlInt(f.file.Fd(), F_SETPIPE_SZ, FIFO_SIZE)
return f, nil
}

Expand Down

0 comments on commit 17373f5

Please sign in to comment.