mirror of
https://github.com/golang/sys.git
synced 2026-02-09 12:16:04 +03:00
Expose Strioctl and Lifreq structs Add helpers for working with them Add additional wrapper functions This work is in support of wireGuard/wireguard-go#39 Change-Id: I7a4d919f986ec977e2cd393eaf237d8c43bbc1cb Reviewed-on: https://go-review.googlesource.com/c/sys/+/302831 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Trust: Ian Lance Taylor <iant@golang.org>
27 lines
573 B
Go
27 lines
573 B
Go
// Copyright 2021 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
//go:build illumos
|
|
// +build illumos
|
|
|
|
package unix_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func TestLifreqSetName(t *testing.T) {
|
|
var l unix.Lifreq
|
|
err := l.SetName("12345678901234356789012345678901234567890")
|
|
if err == nil {
|
|
t.Fatal(`Lifreq.SetName should reject names that are too long`)
|
|
}
|
|
err = l.SetName("tun0")
|
|
if err != nil {
|
|
t.Errorf(`Lifreq.SetName("tun0") failed: %v`, err)
|
|
}
|
|
}
|