loader.go 970 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
// +build linux

package nsenter

/*
#cgo LDFLAGS: -ldl

#include <stdio.h>
#include <stdlib.h>

struct pal_attr_t {
	const char *args;
	const char *log_level;
};

struct pal_stdio_fds {
	int stdin, stdout, stderr;
};

extern int *pal_version;
extern int (*fptr_pal_init)(const struct pal_attr_t *attr);
extern int (*fptr_pal_exec)(const char *path, const char * const argv[],
			const struct pal_stdio_fds *stdio, int *exit_code);
extern int (*fptr_pal_kill)(int sig, int pid);
extern int (*fptr_pal_destroy)(void);
*/
import "C"

import (
	"unsafe"
)

func SymAddrPalVersion() unsafe.Pointer {
	return unsafe.Pointer(C.pal_version)
}

func SymAddrPalInit() unsafe.Pointer {
	return unsafe.Pointer(C.fptr_pal_init)
}

func SymAddrPalExec() unsafe.Pointer {
	return unsafe.Pointer(C.fptr_pal_exec)
}

func SymAddrPalKill() unsafe.Pointer {
	return unsafe.Pointer(C.fptr_pal_kill)
}

func SymAddrPalDestroy() unsafe.Pointer {
	return unsafe.Pointer(C.fptr_pal_destroy)
}