mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-30 21:30:16 +00:00 
			
		
		
		
	dependencies: update go-systemd to v22.5.0
Signed-off-by: Akhil Mohan <akhilerm@gmail.com>
This commit is contained in:
		
							
								
								
									
										57
									
								
								vendor/github.com/coreos/go-systemd/v22/internal/dlopen/dlopen_example.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								vendor/github.com/coreos/go-systemd/v22/internal/dlopen/dlopen_example.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| // Copyright 2015 CoreOS, Inc. | ||||
| // | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| //     http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
| // | ||||
| //go:build linux | ||||
| // +build linux | ||||
|  | ||||
| package dlopen | ||||
|  | ||||
| // #include <string.h> | ||||
| // #include <stdlib.h> | ||||
| // | ||||
| // int | ||||
| // my_strlen(void *f, const char *s) | ||||
| // { | ||||
| //   size_t (*strlen)(const char *); | ||||
| // | ||||
| //   strlen = (size_t (*)(const char *))f; | ||||
| //   return strlen(s); | ||||
| // } | ||||
| import "C" | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"unsafe" | ||||
| ) | ||||
|  | ||||
| func strlen(libs []string, s string) (int, error) { | ||||
| 	h, err := GetHandle(libs) | ||||
| 	if err != nil { | ||||
| 		return -1, fmt.Errorf(`couldn't get a handle to the library: %v`, err) | ||||
| 	} | ||||
| 	defer h.Close() | ||||
|  | ||||
| 	f := "strlen" | ||||
| 	cs := C.CString(s) | ||||
| 	defer C.free(unsafe.Pointer(cs)) | ||||
|  | ||||
| 	strlen, err := h.GetSymbolPointer(f) | ||||
| 	if err != nil { | ||||
| 		return -1, fmt.Errorf(`couldn't get symbol %q: %v`, f, err) | ||||
| 	} | ||||
|  | ||||
| 	len := C.my_strlen(strlen, cs) | ||||
|  | ||||
| 	return int(len), nil | ||||
| } | ||||
							
								
								
									
										52
									
								
								vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										52
									
								
								vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -69,6 +69,58 @@ func Enabled() bool { | ||||
| 	return true | ||||
| } | ||||
|  | ||||
| // StderrIsJournalStream returns whether the process stderr is connected | ||||
| // to the Journal's stream transport. | ||||
| // | ||||
| // This can be used for automatic protocol upgrading described in [Journal Native Protocol]. | ||||
| // | ||||
| // Returns true if JOURNAL_STREAM environment variable is present, | ||||
| // and stderr's device and inode numbers match it. | ||||
| // | ||||
| // Error is returned if unexpected error occurs: e.g. if JOURNAL_STREAM environment variable | ||||
| // is present, but malformed, fstat syscall fails, etc. | ||||
| // | ||||
| // [Journal Native Protocol]: https://systemd.io/JOURNAL_NATIVE_PROTOCOL/#automatic-protocol-upgrading | ||||
| func StderrIsJournalStream() (bool, error) { | ||||
| 	return fdIsJournalStream(syscall.Stderr) | ||||
| } | ||||
|  | ||||
| // StdoutIsJournalStream returns whether the process stdout is connected | ||||
| // to the Journal's stream transport. | ||||
| // | ||||
| // Returns true if JOURNAL_STREAM environment variable is present, | ||||
| // and stdout's device and inode numbers match it. | ||||
| // | ||||
| // Error is returned if unexpected error occurs: e.g. if JOURNAL_STREAM environment variable | ||||
| // is present, but malformed, fstat syscall fails, etc. | ||||
| // | ||||
| // Most users should probably use [StderrIsJournalStream]. | ||||
| func StdoutIsJournalStream() (bool, error) { | ||||
| 	return fdIsJournalStream(syscall.Stdout) | ||||
| } | ||||
|  | ||||
| func fdIsJournalStream(fd int) (bool, error) { | ||||
| 	journalStream := os.Getenv("JOURNAL_STREAM") | ||||
| 	if journalStream == "" { | ||||
| 		return false, nil | ||||
| 	} | ||||
|  | ||||
| 	var expectedStat syscall.Stat_t | ||||
| 	_, err := fmt.Sscanf(journalStream, "%d:%d", &expectedStat.Dev, &expectedStat.Ino) | ||||
| 	if err != nil { | ||||
| 		return false, fmt.Errorf("failed to parse JOURNAL_STREAM=%q: %v", journalStream, err) | ||||
| 	} | ||||
|  | ||||
| 	var stat syscall.Stat_t | ||||
| 	err = syscall.Fstat(fd, &stat) | ||||
| 	if err != nil { | ||||
| 		return false, err | ||||
| 	} | ||||
|  | ||||
| 	match := stat.Dev == expectedStat.Dev && stat.Ino == expectedStat.Ino | ||||
| 	return match, nil | ||||
| } | ||||
|  | ||||
| // Send a message to the local systemd journal. vars is a map of journald | ||||
| // fields to values.  Fields must be composed of uppercase letters, numbers, | ||||
| // and underscores, but must not start with an underscore. Within these | ||||
|   | ||||
							
								
								
									
										8
									
								
								vendor/github.com/coreos/go-systemd/v22/journal/journal_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/coreos/go-systemd/v22/journal/journal_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -33,3 +33,11 @@ func Enabled() bool { | ||||
| func Send(message string, priority Priority, vars map[string]string) error { | ||||
| 	return errors.New("could not initialize socket to journald") | ||||
| } | ||||
|  | ||||
| func StderrIsJournalStream() (bool, error) { | ||||
| 	return false, nil | ||||
| } | ||||
|  | ||||
| func StdoutIsJournalStream() (bool, error) { | ||||
| 	return false, nil | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user