github.com/noisysockets/netstack@v0.6.0/patches/00-binary_native_endian.diff (about)

     1  --- a/pkg/eventfd/eventfd.go	2024-04-17 19:36:29.488005835 +0200
     2  +++ b/pkg/eventfd/eventfd.go	2024-04-17 19:38:46.972006809 +0200
     3  @@ -16,12 +16,12 @@
     4   package eventfd
     5   
     6   import (
     7  +	"encoding/binary"
     8   	"fmt"
     9   	"io"
    10   
    11  -	"golang.org/x/sys/unix"
    12  -	"github.com/noisysockets/netstack/pkg/hostarch"
    13   	"github.com/noisysockets/netstack/pkg/tcpip/link/rawfile"
    14  +	"golang.org/x/sys/unix"
    15   )
    16   
    17   const sizeofUint64 = 8
    18  @@ -72,7 +72,7 @@
    19   // Write writes a specific value to the eventfd.
    20   func (ev Eventfd) Write(val uint64) error {
    21   	var buf [sizeofUint64]byte
    22  -	hostarch.ByteOrder.PutUint64(buf[:], val)
    23  +	binary.NativeEndian.PutUint64(buf[:], val)
    24   	for {
    25   		n, err := nonBlockingWrite(ev.fd, buf[:])
    26   		if err == unix.EINTR {
    27  @@ -105,7 +105,7 @@
    28   	if n != sizeofUint64 {
    29   		panic(fmt.Sprintf("short read from eventfd: got %d bytes, wanted %d", n, sizeofUint64))
    30   	}
    31  -	return hostarch.ByteOrder.Uint64(tmp[:]), nil
    32  +	return binary.NativeEndian.Uint64(tmp[:]), nil
    33   }
    34   
    35   // FD returns the underlying file descriptor. Use with care, as this breaks the