Skip to content

Commit

Permalink
support compiling on darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
winglq committed Nov 1, 2024
1 parent 6a2a137 commit 781a093
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
9 changes: 4 additions & 5 deletions splice/pair_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@

package splice

import ()

func (p *Pair) LoadFromAt(fd uintptr, sz int, off int64) (int, error) {
panic("not implemented")
return 0, nil
}

func (p *Pair) LoadFrom(fd uintptr, sz int) (int, error) {
panic("not implemented")
return 0, nil
}

func (p *Pair) WriteTo(fd uintptr, n int) (int, error) {
panic("not implemented")
return 0, nil
}

func (p *Pair) discard() {
panic("not implemented")
}
6 changes: 0 additions & 6 deletions splice/splice.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ func fcntl(fd uintptr, cmd int, arg int) (val int, errno syscall.Errno) {
const F_SETPIPE_SZ = 1031
const F_GETPIPE_SZ = 1032

func osPipe() (int, int, error) {
var fds [2]int
err := syscall.Pipe2(fds[:], syscall.O_NONBLOCK)
return fds[0], fds[1], err
}

func newSplicePair() (p *Pair, err error) {
p = &Pair{}
p.r, p.w, err = osPipe()
Expand Down
7 changes: 7 additions & 0 deletions splice/splice_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package splice

import "fmt"

func osPipe() (int, int, error) {
return 0, 0, fmt.Errorf("not implemented")
}
9 changes: 9 additions & 0 deletions splice/splice_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package splice

import "syscall"

func osPipe() (int, int, error) {
var fds [2]int
err := syscall.Pipe2(fds[:], syscall.O_NONBLOCK)
return fds[0], fds[1], err
}

0 comments on commit 781a093

Please sign in to comment.