Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add helper programs for console support
recvtty is needed to trick runc into thinking it has a console and doesn't err out and serial_fd_handler passes off the tty fd to containerd. Both support being cross compiled. Signed-off-by: Brian Woods <brian.woods@xilinx.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
- Loading branch information
1 parent
4531c06
commit d287a87
Showing
3 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
GOPATH=$(shell pwd)/go | ||
GOSRC=${GOPATH}/src | ||
GODEPS=github.com/opencontainers/runc | ||
GODEPPATHS=$(addprefix ${GOSRC}/,${GODEPS}) | ||
MAIN=src/serial_fd_handler.go go/src/github.com/opencontainers/runc/contrib/cmd/recvtty/recvtty.go | ||
BIN=$(basename $(notdir ${MAIN})) | ||
|
||
ifdef GOARCH | ||
ARCH=GOARCH=${GOARCH} | ||
else | ||
ARCH= | ||
endif | ||
|
||
.PHONY: clean all dep | ||
|
||
all: ${BIN} | ||
|
||
dep: ${GODEPPATHS} | ||
|
||
${GODEPPATHS}: | ||
mkdir -p ${GOSRC} | ||
GOPATH=${GOPATH} go get $(subst ${GOSRC}/,,$@) | ||
|
||
${BIN}: ${GODEPPATHS} $(filter %/$@.go, ${MAIN}) | ||
GOPATH=${GOPATH} ${ARCH} go build $(filter %/$@.go, ${MAIN}) | ||
|
||
clean: | ||
rm -f ${BIN} | ||
|
||
distclean: | ||
rm -rf ${BIN} ${GOPATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
"net" | ||
"os" | ||
"github.com/opencontainers/runc/libcontainer/utils" | ||
) | ||
|
||
func main() { | ||
|
||
//socket_file, err := os.Open(os.Args[1]) | ||
socket_conn, err := net.Dial("unix", os.Args[1]) | ||
if err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
|
||
socket_fd, ok := socket_conn.(*net.UnixConn) | ||
if !ok { | ||
fmt.Errorf("failed to cast to fd") | ||
os.Exit(1) | ||
} | ||
|
||
socket_file, err := socket_fd.File() | ||
if err != nil { | ||
fmt.Errorf("failed to cast to file") | ||
os.Exit(1) | ||
} | ||
|
||
xen_file, err := os.OpenFile(os.Args[2], os.O_RDWR, 0755) | ||
if err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
xen_fd := xen_file.Fd() | ||
|
||
//need FD? Name? | ||
|
||
err = utils.SendFd(socket_file, os.Args[2], xen_fd); | ||
if err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
|
||
//give containerd enough to get the info and then exit | ||
time.Sleep(20 * time.Second) | ||
|
||
return | ||
} |