99# -i, --image IMAGE Docker image (overrides $OR_IMAGE and default)
1010# --user Map host UID/GID into the container via entrypoint.sh
1111# -p, --port SPEC Forward a port, e.g. --port 8265:8265 (repeatable)
12+ # --pids-limit N Container PID limit: -1 = unlimited (default: -1)
1213# --dry-run Print the commands (xauth setup + docker run) without executing them
1314# -h|--help Show this help and exit
1415
@@ -31,6 +32,7 @@ get_container_engine () {
3132}
3233
3334DEFAULT_IMAGE=" openroad/orfs:latest"
35+ PIDS_LIMIT=-1
3436FLOW_DIR=" /OpenROAD-flow-scripts/flow"
3537USE_USER=false
3638DRY_RUN=false
@@ -45,20 +47,26 @@ usage() {
4547
4648while [[ $# -gt 0 ]]; do
4749 case " $1 " in
48- -i|--image) IMAGE=" $2 " ; shift 2 ;;
49- --user) USE_USER=true; shift ;;
50- -p|--port) PORTS+=(" $2 " ); shift 2 ;;
51- --dry-run) DRY_RUN=true; shift ;;
52- -h|--help) usage ;;
53- --) shift ; CMD_ARGS=(" $@ " ); break ;;
54- -* ) echo " Unknown option: $1 " >&2 ; exit 1 ;;
55- * ) CMD_ARGS=(" $@ " ); break ;;
50+ -i|--image) IMAGE=" $2 " ; shift 2 ;;
51+ --user) USE_USER=true; shift ;;
52+ -p|--port) PORTS+=(" $2 " ); shift 2 ;;
53+ --pids-limit) PIDS_LIMIT=" $2 " ; shift 2 ;;
54+ --dry-run) DRY_RUN=true; shift ;;
55+ -h|--help) usage ;;
56+ --) shift ; CMD_ARGS=(" $@ " ); break ;;
57+ -* ) echo " Unknown option: $1 " >&2 ; exit 1 ;;
58+ * ) CMD_ARGS=(" $@ " ); break ;;
5659 esac
5760done
5861
5962# Image resolution: --image > $OR_IMAGE > default
6063IMAGE=" ${IMAGE:- ${OR_IMAGE:- $DEFAULT_IMAGE } } "
6164
65+ if ! [[ " $PIDS_LIMIT " =~ ^-? [0-9]+$ ]] || [ " $PIDS_LIMIT " -lt -1 ] || [ " $PIDS_LIMIT " -eq 0 ]; then
66+ echo " Invalid PID limit: $PIDS_LIMIT (expected -1 for unlimited, or a positive integer)" >&2
67+ exit 1
68+ fi
69+
6270get_container_engine
6371
6472WORKSPACE=$( pwd)
@@ -113,6 +121,7 @@ ENV_SH_CMD='if [ -f ../env.sh ]; then . ../env.sh; fi;'
113121DOCKER_CMD=(
114122 " $container_engine " run --rm -i
115123 $DOCKER_INTERACTIVE
124+ --pids-limit " $PIDS_LIMIT "
116125 $user_env $user_args
117126 -e LIBGL_ALWAYS_SOFTWARE=1
118127 -e QT_X11_NO_MITSHM=1
0 commit comments