forked from TrueCloudLab/rclone
vendor: update minimum number of packages so compile with go1.11 works
This commit is contained in:
parent
c19d1ae9a5
commit
ff8de59d2b
7 changed files with 246 additions and 44 deletions
1
vendor/github.com/okzk/sdnotify/notify.go
generated
vendored
1
vendor/github.com/okzk/sdnotify/notify.go
generated
vendored
|
@ -2,6 +2,7 @@
|
|||
|
||||
package sdnotify
|
||||
|
||||
// SdNotify sends a specified string to the systemd notification socket.
|
||||
func SdNotify(state string) error {
|
||||
// do nothing
|
||||
return nil
|
||||
|
|
3
vendor/github.com/okzk/sdnotify/notify_linux.go
generated
vendored
3
vendor/github.com/okzk/sdnotify/notify_linux.go
generated
vendored
|
@ -5,10 +5,11 @@ import (
|
|||
"os"
|
||||
)
|
||||
|
||||
// SdNotify sends a specified string to the systemd notification socket.
|
||||
func SdNotify(state string) error {
|
||||
name := os.Getenv("NOTIFY_SOCKET")
|
||||
if name == "" {
|
||||
return SdNotifyNoSocket
|
||||
return ErrSdNotifyNoSocket
|
||||
}
|
||||
|
||||
conn, err := net.DialUnix("unixgram", nil, &net.UnixAddr{Name: name, Net: "unixgram"})
|
||||
|
|
20
vendor/github.com/okzk/sdnotify/sample/main.go
generated
vendored
20
vendor/github.com/okzk/sdnotify/sample/main.go
generated
vendored
|
@ -1,24 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/okzk/sdnotify"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/okzk/sdnotify"
|
||||
)
|
||||
|
||||
func reload() {
|
||||
// Tells the service manager that the service is reloading its configuration.
|
||||
sdnotify.SdNotifyReloading()
|
||||
sdnotify.Reloading()
|
||||
|
||||
log.Println("reloading...")
|
||||
time.Sleep(time.Second)
|
||||
log.Println("reloaded.")
|
||||
|
||||
// The service must also send a "READY" notification when it completed reloading its configuration.
|
||||
sdnotify.SdNotifyReady()
|
||||
sdnotify.Ready()
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -27,7 +28,16 @@ func main() {
|
|||
log.Println("started.")
|
||||
|
||||
// Tells the service manager that service startup is finished.
|
||||
sdnotify.SdNotifyReady()
|
||||
sdnotify.Ready()
|
||||
|
||||
go func() {
|
||||
tick := time.Tick(30 * time.Second)
|
||||
for {
|
||||
<-tick
|
||||
log.Println("watchdog reporting")
|
||||
sdnotify.Watchdog()
|
||||
}
|
||||
}()
|
||||
|
||||
sigCh := make(chan os.Signal, 1)
|
||||
signal.Notify(sigCh, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
||||
|
@ -40,7 +50,7 @@ func main() {
|
|||
}
|
||||
|
||||
// Tells the service manager that the service is beginning its shutdown.
|
||||
sdnotify.SdNotifyStopping()
|
||||
sdnotify.Stopping()
|
||||
|
||||
log.Println("existing...")
|
||||
time.Sleep(time.Second)
|
||||
|
|
2
vendor/github.com/okzk/sdnotify/sample/sample.service
generated
vendored
2
vendor/github.com/okzk/sdnotify/sample/sample.service
generated
vendored
|
@ -6,6 +6,8 @@ Type=notify
|
|||
ExecStart=/path/to/sample
|
||||
ExecStop=/bin/kill -SIGTERM $MAINPID
|
||||
ExecReload=/bin/kill -SIGHUP $MAINPID
|
||||
WatchdogSec=60s
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy = multi-user.target
|
||||
|
|
30
vendor/github.com/okzk/sdnotify/util.go
generated
vendored
30
vendor/github.com/okzk/sdnotify/util.go
generated
vendored
|
@ -1,21 +1,39 @@
|
|||
package sdnotify
|
||||
|
||||
import "errors"
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var SdNotifyNoSocket = errors.New("No socket")
|
||||
// ErrSdNotifyNoSocket is the error returned when the NOTIFY_SOCKET does not exist.
|
||||
var ErrSdNotifyNoSocket = errors.New("No socket")
|
||||
|
||||
func SdNotifyReady() error {
|
||||
// Ready sends READY=1 to the systemd notify socket.
|
||||
func Ready() error {
|
||||
return SdNotify("READY=1")
|
||||
}
|
||||
|
||||
func SdNotifyStopping() error {
|
||||
// Stopping sends STOPPING=1 to the systemd notify socket.
|
||||
func Stopping() error {
|
||||
return SdNotify("STOPPING=1")
|
||||
}
|
||||
|
||||
func SdNotifyReloading() error {
|
||||
// Reloading sends RELOADING=1 to the systemd notify socket.
|
||||
func Reloading() error {
|
||||
return SdNotify("RELOADING=1")
|
||||
}
|
||||
|
||||
func SdNotifyStatus(status string) error {
|
||||
// Errno sends ERRNO=? to the systemd notify socket.
|
||||
func Errno(errno int) error {
|
||||
return SdNotify(fmt.Sprintf("ERRNO=%d", errno))
|
||||
}
|
||||
|
||||
// Status sends STATUS=? to the systemd notify socket.
|
||||
func Status(status string) error {
|
||||
return SdNotify("STATUS=" + status)
|
||||
}
|
||||
|
||||
// Watchdog sends WATCHDOG=1 to the systemd notify socket.
|
||||
func Watchdog() error {
|
||||
return SdNotify("WATCHDOG=1")
|
||||
}
|
||||
|
|
28
vendor/github.com/xanzy/ssh-agent/pageant_windows.go
generated
vendored
28
vendor/github.com/xanzy/ssh-agent/pageant_windows.go
generated
vendored
|
@ -29,8 +29,8 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
. "syscall"
|
||||
. "unsafe"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Maximum size of message can be sent to pageant
|
||||
|
@ -53,7 +53,7 @@ const (
|
|||
type copyData struct {
|
||||
dwData uintptr
|
||||
cbData uint32
|
||||
lpData Pointer
|
||||
lpData unsafe.Pointer
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -65,7 +65,7 @@ var (
|
|||
)
|
||||
|
||||
func winAPI(dllName, funcName string) func(...uintptr) (uintptr, uintptr, error) {
|
||||
proc := MustLoadDLL(dllName).MustFindProc(funcName)
|
||||
proc := syscall.MustLoadDLL(dllName).MustFindProc(funcName)
|
||||
return func(a ...uintptr) (uintptr, uintptr, error) { return proc.Call(a...) }
|
||||
}
|
||||
|
||||
|
@ -96,21 +96,21 @@ func query(msg []byte) ([]byte, error) {
|
|||
|
||||
thID, _, _ := winGetCurrentThreadID()
|
||||
mapName := fmt.Sprintf("PageantRequest%08x", thID)
|
||||
pMapName, _ := UTF16PtrFromString(mapName)
|
||||
pMapName, _ := syscall.UTF16PtrFromString(mapName)
|
||||
|
||||
mmap, err := CreateFileMapping(InvalidHandle, nil, PAGE_READWRITE, 0, MaxMessageLen+4, pMapName)
|
||||
mmap, err := syscall.CreateFileMapping(syscall.InvalidHandle, nil, syscall.PAGE_READWRITE, 0, MaxMessageLen+4, pMapName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer CloseHandle(mmap)
|
||||
defer syscall.CloseHandle(mmap)
|
||||
|
||||
ptr, err := MapViewOfFile(mmap, FILE_MAP_WRITE, 0, 0, 0)
|
||||
ptr, err := syscall.MapViewOfFile(mmap, syscall.FILE_MAP_WRITE, 0, 0, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer UnmapViewOfFile(ptr)
|
||||
defer syscall.UnmapViewOfFile(ptr)
|
||||
|
||||
mmSlice := (*(*[MaxMessageLen]byte)(Pointer(ptr)))[:]
|
||||
mmSlice := (*(*[MaxMessageLen]byte)(unsafe.Pointer(ptr)))[:]
|
||||
|
||||
copy(mmSlice, msg)
|
||||
|
||||
|
@ -119,10 +119,10 @@ func query(msg []byte) ([]byte, error) {
|
|||
cds := copyData{
|
||||
dwData: agentCopydataID,
|
||||
cbData: uint32(len(mapNameBytesZ)),
|
||||
lpData: Pointer(&(mapNameBytesZ[0])),
|
||||
lpData: unsafe.Pointer(&(mapNameBytesZ[0])),
|
||||
}
|
||||
|
||||
resp, _, _ := winSendMessage(paWin, wmCopydata, 0, uintptr(Pointer(&cds)))
|
||||
resp, _, _ := winSendMessage(paWin, wmCopydata, 0, uintptr(unsafe.Pointer(&cds)))
|
||||
|
||||
if resp == 0 {
|
||||
return nil, ErrSendMessage
|
||||
|
@ -140,7 +140,7 @@ func query(msg []byte) ([]byte, error) {
|
|||
}
|
||||
|
||||
func pageantWindow() uintptr {
|
||||
nameP, _ := UTF16PtrFromString("Pageant")
|
||||
h, _, _ := winFindWindow(uintptr(Pointer(nameP)), uintptr(Pointer(nameP)))
|
||||
nameP, _ := syscall.UTF16PtrFromString("Pageant")
|
||||
h, _, _ := winFindWindow(uintptr(unsafe.Pointer(nameP)), uintptr(unsafe.Pointer(nameP)))
|
||||
return h
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue