diff options
| author | 2022-03-07 11:08:26 +0100 | |
|---|---|---|
| committer | 2022-03-07 11:08:26 +0100 | |
| commit | 07727753b96d209406783e5e539725bcdafebdc7 (patch) | |
| tree | b32f11cbc304d633ed0acd8f84b4c11e909bb5f3 /vendor/golang.org/x/sys/windows | |
| parent | [documentation] Creates Docker documentation and docker-compose.yaml (#416) (diff) | |
| download | gotosocial-07727753b96d209406783e5e539725bcdafebdc7.tar.xz | |
[feature] Clean up/uncache remote media (#407)
* Add whereNotEmptyAndNotNull
* Add GetRemoteOlderThanDays
* Add GetRemoteOlderThanDays
* Add PruneRemote to Manager interface
* Start implementing PruneRemote
* add new attachment + status to tests
* fix up and test GetRemoteOlderThan
* fix bad import
* PruneRemote: return number pruned
* add Cached column to mediaattachment
* update + test pruneRemote
* update mediaTest
* use Cached column
* upstep bun to latest version
* embed structs in mediaAttachment
* migrate mediaAttachment to new format
* don't default cached to true
* select only remote media
* update db dependencies
* step bun back to last working version
* update pruneRemote to use Cached field
* fix storage path of test attachments
* add recache logic to manager
* fix trimmed aspect ratio
* test prune and recache
* return errwithcode
* tidy up different paths for emoji vs attachment
* fix incorrect thumbnail type being stored
* expose TransportController to media processor
* implement tee-ing recached content
* add thoughts of dog to test fedi attachments
* test get remote files
* add comment on PruneRemote
* add postData cleanup to recache
* test thumbnail fetching
* add incredible diagram
* go mod tidy
* buffer pipes for recache streaming
* test for client stops reading after 1kb
* add media-remote-cache-days to config
* add cron package
* wrap logrus so it's available to cron
* start and stop cron jobs gracefully
Diffstat (limited to 'vendor/golang.org/x/sys/windows')
| -rw-r--r-- | vendor/golang.org/x/sys/windows/exec_windows.go | 37 | ||||
| -rw-r--r-- | vendor/golang.org/x/sys/windows/syscall_windows.go | 2 | ||||
| -rw-r--r-- | vendor/golang.org/x/sys/windows/types_windows.go | 43 | ||||
| -rw-r--r-- | vendor/golang.org/x/sys/windows/zsyscall_windows.go | 14 | 
4 files changed, 67 insertions, 29 deletions
diff --git a/vendor/golang.org/x/sys/windows/exec_windows.go b/vendor/golang.org/x/sys/windows/exec_windows.go index 7a11e83b7..855698bb2 100644 --- a/vendor/golang.org/x/sys/windows/exec_windows.go +++ b/vendor/golang.org/x/sys/windows/exec_windows.go @@ -9,8 +9,6 @@ package windows  import (  	errorspkg "errors"  	"unsafe" - -	"golang.org/x/sys/internal/unsafeheader"  )  // EscapeArg rewrites command line argument s as prescribed @@ -147,8 +145,12 @@ func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeListCo  		}  		return nil, err  	} +	alloc, err := LocalAlloc(LMEM_FIXED, uint32(size)) +	if err != nil { +		return nil, err +	}  	// size is guaranteed to be ≥1 by InitializeProcThreadAttributeList. -	al := &ProcThreadAttributeListContainer{data: (*ProcThreadAttributeList)(unsafe.Pointer(&make([]byte, size)[0]))} +	al := &ProcThreadAttributeListContainer{data: (*ProcThreadAttributeList)(unsafe.Pointer(alloc))}  	err = initializeProcThreadAttributeList(al.data, maxAttrCount, 0, &size)  	if err != nil {  		return nil, err @@ -157,36 +159,17 @@ func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeListCo  }  // Update modifies the ProcThreadAttributeList using UpdateProcThreadAttribute. -// Note that the value passed to this function will be copied into memory -// allocated by LocalAlloc, the contents of which should not contain any -// Go-managed pointers, even if the passed value itself is a Go-managed -// pointer.  func (al *ProcThreadAttributeListContainer) Update(attribute uintptr, value unsafe.Pointer, size uintptr) error { -	alloc, err := LocalAlloc(LMEM_FIXED, uint32(size)) -	if err != nil { -		return err -	} -	var src, dst []byte -	hdr := (*unsafeheader.Slice)(unsafe.Pointer(&src)) -	hdr.Data = value -	hdr.Cap = int(size) -	hdr.Len = int(size) -	hdr = (*unsafeheader.Slice)(unsafe.Pointer(&dst)) -	hdr.Data = unsafe.Pointer(alloc) -	hdr.Cap = int(size) -	hdr.Len = int(size) -	copy(dst, src) -	al.heapAllocations = append(al.heapAllocations, alloc) -	return updateProcThreadAttribute(al.data, 0, attribute, unsafe.Pointer(alloc), size, nil, nil) +	al.pointers = append(al.pointers, value) +	return updateProcThreadAttribute(al.data, 0, attribute, value, size, nil, nil)  }  // Delete frees ProcThreadAttributeList's resources.  func (al *ProcThreadAttributeListContainer) Delete() {  	deleteProcThreadAttributeList(al.data) -	for i := range al.heapAllocations { -		LocalFree(Handle(al.heapAllocations[i])) -	} -	al.heapAllocations = nil +	LocalFree(Handle(unsafe.Pointer(al.data))) +	al.data = nil +	al.pointers = nil  }  // List returns the actual ProcThreadAttributeList to be passed to StartupInfoEx. diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 200b62a00..cf44e6933 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -363,6 +363,8 @@ func NewCallbackCDecl(fn interface{}) uintptr {  //sys	SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error)  //sys	GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error)  //sys	SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) +//sys	GetActiveProcessorCount(groupNumber uint16) (ret uint32) +//sys	GetMaximumProcessorCount(groupNumber uint16) (ret uint32)  // Volume Management Functions  //sys	DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 73087bf5e..e19471c6a 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -938,8 +938,8 @@ type StartupInfoEx struct {  type ProcThreadAttributeList struct{}  type ProcThreadAttributeListContainer struct { -	data            *ProcThreadAttributeList -	heapAllocations []uintptr +	data     *ProcThreadAttributeList +	pointers []unsafe.Pointer  }  type ProcessInformation struct { @@ -2749,6 +2749,43 @@ type PROCESS_BASIC_INFORMATION struct {  	InheritedFromUniqueProcessId uintptr  } +type SYSTEM_PROCESS_INFORMATION struct { +	NextEntryOffset              uint32 +	NumberOfThreads              uint32 +	WorkingSetPrivateSize        int64 +	HardFaultCount               uint32 +	NumberOfThreadsHighWatermark uint32 +	CycleTime                    uint64 +	CreateTime                   int64 +	UserTime                     int64 +	KernelTime                   int64 +	ImageName                    NTUnicodeString +	BasePriority                 int32 +	UniqueProcessID              uintptr +	InheritedFromUniqueProcessID uintptr +	HandleCount                  uint32 +	SessionID                    uint32 +	UniqueProcessKey             *uint32 +	PeakVirtualSize              uintptr +	VirtualSize                  uintptr +	PageFaultCount               uint32 +	PeakWorkingSetSize           uintptr +	WorkingSetSize               uintptr +	QuotaPeakPagedPoolUsage      uintptr +	QuotaPagedPoolUsage          uintptr +	QuotaPeakNonPagedPoolUsage   uintptr +	QuotaNonPagedPoolUsage       uintptr +	PagefileUsage                uintptr +	PeakPagefileUsage            uintptr +	PrivatePageCount             uintptr +	ReadOperationCount           int64 +	WriteOperationCount          int64 +	OtherOperationCount          int64 +	ReadTransferCount            int64 +	WriteTransferCount           int64 +	OtherTransferCount           int64 +} +  // SystemInformationClasses for NtQuerySystemInformation and NtSetSystemInformation  const (  	SystemBasicInformation = iota @@ -3135,3 +3172,5 @@ type ModuleInfo struct {  	SizeOfImage uint32  	EntryPoint  uintptr  } + +const ALL_PROCESSOR_GROUPS = 0xFFFF diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 1055d47ed..9ea1a44f0 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -226,6 +226,7 @@ var (  	procFreeLibrary                                          = modkernel32.NewProc("FreeLibrary")  	procGenerateConsoleCtrlEvent                             = modkernel32.NewProc("GenerateConsoleCtrlEvent")  	procGetACP                                               = modkernel32.NewProc("GetACP") +	procGetActiveProcessorCount                              = modkernel32.NewProc("GetActiveProcessorCount")  	procGetCommTimeouts                                      = modkernel32.NewProc("GetCommTimeouts")  	procGetCommandLineW                                      = modkernel32.NewProc("GetCommandLineW")  	procGetComputerNameExW                                   = modkernel32.NewProc("GetComputerNameExW") @@ -251,6 +252,7 @@ var (  	procGetLogicalDriveStringsW                              = modkernel32.NewProc("GetLogicalDriveStringsW")  	procGetLogicalDrives                                     = modkernel32.NewProc("GetLogicalDrives")  	procGetLongPathNameW                                     = modkernel32.NewProc("GetLongPathNameW") +	procGetMaximumProcessorCount                             = modkernel32.NewProc("GetMaximumProcessorCount")  	procGetModuleFileNameW                                   = modkernel32.NewProc("GetModuleFileNameW")  	procGetModuleHandleExW                                   = modkernel32.NewProc("GetModuleHandleExW")  	procGetNamedPipeHandleStateW                             = modkernel32.NewProc("GetNamedPipeHandleStateW") @@ -1967,6 +1969,12 @@ func GetACP() (acp uint32) {  	return  } +func GetActiveProcessorCount(groupNumber uint16) (ret uint32) { +	r0, _, _ := syscall.Syscall(procGetActiveProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0) +	ret = uint32(r0) +	return +} +  func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {  	r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0)  	if r1 == 0 { @@ -2169,6 +2177,12 @@ func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err er  	return  } +func GetMaximumProcessorCount(groupNumber uint16) (ret uint32) { +	r0, _, _ := syscall.Syscall(procGetMaximumProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0) +	ret = uint32(r0) +	return +} +  func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) {  	r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size))  	n = uint32(r0)  | 
