forked from mit-pdos/6.5660-lab-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean-env.sh
executable file
·28 lines (22 loc) · 895 Bytes
/
clean-env.sh
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
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: $0 BIN PORT"
echo "clean-env runs the given server binary BIN using the configuration CONFIG in"
echo "a pristine environment to ensure predictable memory layout between executions."
exit 0
fi
killall -qw zookld zookd zookfs zookd-nxstack zookfs-nxstack zookd-exstack zookfs-exstack
ulimit -s unlimited
DIR=$(pwd -P)
if [ "$DIR" != /home/student/lab ]; then
echo "========================================================"
echo "WARNING: Lab directory is $DIR"
echo "Make sure your lab is checked out at /home/student/lab or"
echo "your solutions may not work when grading."
echo "========================================================"
fi
# setarch -R disables ASLR
exec env - PWD="$DIR" SHLVL=0 setarch "$(uname -m)" -R "$@"
ERR=$?
echo Failed: exec env - PWD="$DIR" SHLVL=0 setarch "$(uname -m)" -R "$@"
exit $ERR