Skip to content

Instantly share code, notes, and snippets.

@ksaj
Created August 1, 2018 07:53
Show Gist options
  • Save ksaj/d86d7a2b63851fef3f3211bcf8909a9f to your computer and use it in GitHub Desktop.
Save ksaj/d86d7a2b63851fef3f3211bcf8909a9f to your computer and use it in GitHub Desktop.
Making clisp code executable from the Linux kernel
From: https://clisp.sourceforge.io/impnotes/quickstart.html#quickstart-unix (very end of page):
32.6.4. Associating extensions with CLISP via kernel
Platform Dependent: Linux platforms only.
You have to build your kernel with CONFIG_BINFMT_MISC=y and CONFIG_PROC_FS=y. Then you will have a /proc/sys/fs/binfmt_misc/ directory and you will be able to do (as root; you might want to put these lines into /etc/rc.d/rc.local):
# echo ":CLISP:E::fas::/usr/local/bin/clisp:" >> /proc/sys/fs/binfmt_misc/register
# echo ":CLISP:E::lisp::/usr/local/bin/clisp:" >> /proc/sys/fs/binfmt_misc/register
Then you can do the following:
$ cat << EOF > hello.lisp
(print "hello, world!")
EOF
$ clisp -c hello.lisp
;; Compiling file hello.lisp ...
;; Wrote file hello.fas
0 errors, 0 warnings
$ chmod +x hello.fas
$ hello.fas
"hello, world!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment