2 (error "SB-CPU-AFFINITY is SBCL/Linux only.")
4 (defpackage :sb-cpu-affinity-system
7 (in-package :sb-cpu-affinity-system)
9 (defclass c-so-source-file (c-source-file) ())
11 (defvar *gcc* "/usr/bin/gcc")
12 (defvar *gcc-options* '("-shared" "-fPIC"))
14 (defmethod output-files ((o compile-op) (c c-so-source-file))
15 (list (make-pathname :type "so"
16 :defaults (component-pathname c))))
18 (defmethod perform ((o load-op) (c c-so-source-file))
19 (destructuring-bind (so) (input-files o c)
20 (sb-alien:load-shared-object so)))
22 (defmethod perform ((o compile-op) (c c-so-source-file))
23 (destructuring-bind (so) (output-files o c)
24 (unless (zerop (run-shell-command
27 (sb-ext:native-namestring (component-pathname c) :as-file t)
29 (sb-ext:native-namestring so :as-file t)))
30 (error 'operation-error :operation o :component c))))
32 (defsystem :sb-cpu-affinity
34 ((c-so-source-file "cpu-affinity-wrapper")
36 (:file "cpu-affinity" :depends-on ("package" "cpu-affinity-wrapper"))))