fix: make rust happy
This commit is contained in:
parent
2b84f94abb
commit
9fe69280f9
@ -68,6 +68,11 @@ func (s *service) Compile(meta *JudgeMeta) (*JudgeStatus, e.Status) {
|
|||||||
Destination: "/woj/problem/judge",
|
Destination: "/woj/problem/judge",
|
||||||
Readonly: true,
|
Readonly: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// Rust will write intermediate files into source directory instead of /tmp
|
||||||
|
Source: "",
|
||||||
|
Destination: "/woj/user",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Source: sourceFile,
|
Source: sourceFile,
|
||||||
Destination: fmt.Sprintf("/woj/user/%s.%s", meta.Run.User, meta.Run.Lang),
|
Destination: fmt.Sprintf("/woj/user/%s.%s", meta.Run.User, meta.Run.Lang),
|
||||||
|
@ -35,7 +35,10 @@ type MountInfo struct {
|
|||||||
|
|
||||||
func (m *MountInfo) Args() []string {
|
func (m *MountInfo) Args() []string {
|
||||||
mapping := m.Source + ":" + m.Destination
|
mapping := m.Source + ":" + m.Destination
|
||||||
if m.Readonly {
|
if m.Source == "" {
|
||||||
|
// 64MB tmpfs
|
||||||
|
return []string{"-m", "none:" + m.Destination + ":tmpfs:size=67108864"}
|
||||||
|
} else if m.Readonly {
|
||||||
return []string{"-R", mapping}
|
return []string{"-R", mapping}
|
||||||
} else {
|
} else {
|
||||||
return []string{"-B", mapping}
|
return []string{"-B", mapping}
|
||||||
@ -112,8 +115,9 @@ func (s *service) JailRun(arg *RunArgs) (RuntimeStatus, error) {
|
|||||||
args := []string{
|
args := []string{
|
||||||
"--quiet",
|
"--quiet",
|
||||||
"--use_cgroupv2",
|
"--use_cgroupv2",
|
||||||
"-T", "/tmp",
|
"--disable_rlimits", // Rust requires this
|
||||||
"-E", "PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin",
|
"-m", "none:/tmp:tmpfs:size=67108864", // 64MB tmpfs
|
||||||
|
"-E", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||||
// following envs must sync with resource/runner
|
// following envs must sync with resource/runner
|
||||||
"-E", "WOJ_LAUNCHER=/woj/framework/scripts/woj_launcher",
|
"-E", "WOJ_LAUNCHER=/woj/framework/scripts/woj_launcher",
|
||||||
"-E", "TEMPLATE=/woj/framework/template",
|
"-E", "TEMPLATE=/woj/framework/template",
|
||||||
|
@ -31,6 +31,7 @@ include ${TEMPLATE}/c.mk ${TEMPLATE}/Judger.mk
|
|||||||
# 其余通用环境变量,详见 nsjail.go
|
# 其余通用环境变量,详见 nsjail.go
|
||||||
|
|
||||||
compile:
|
compile:
|
||||||
|
# /woj/user 目录当且仅当 compile 阶段为 RW
|
||||||
$(CC) $(CFLAGS) -o $(PREFIX)/user/$(USER_PROG).out $(PREFIX)/user/$(USER_PROG).$(LANG) $(PREFIX)/problem/judge/gadget.c
|
$(CC) $(CFLAGS) -o $(PREFIX)/user/$(USER_PROG).out $(PREFIX)/user/$(USER_PROG).$(LANG) $(PREFIX)/problem/judge/gadget.c
|
||||||
|
|
||||||
judge:
|
judge:
|
||||||
|
Loading…
Reference in New Issue
Block a user