Line | |
---|
1 | #+title: POSIX SYSCALLS |
---|
2 | |
---|
3 | * POSIX_SYSCALLS contrib |
---|
4 | |
---|
5 | Created to respond to <https://mailman.common-lisp.net/pipermail/armedbear-devel/2023-April/004308.html>. |
---|
6 | |
---|
7 | This ABCL contrib provides and demonstrates the scaffolding for |
---|
8 | extending the implementation by use of direct syscalls via the foreign |
---|
9 | function interface (FFI) afforded by the JNA library. |
---|
10 | |
---|
11 | On loading this system, new implementations of the EXT:GETENV and |
---|
12 | UIOP/OS:GETENV functions are provided which use FFI to directly call |
---|
13 | the setenv() and getenv() library functions. The setenv() |
---|
14 | functionality is provided by DEFSETF expander. |
---|
15 | |
---|
16 | ** Usage |
---|
17 | |
---|
18 | *** Initialization |
---|
19 | #+begin_src lisp |
---|
20 | (require :abcl-contrib) |
---|
21 | (asdf:load-system :posix-syscalls) |
---|
22 | #+end_src |
---|
23 | |
---|
24 | *** Example |
---|
25 | |
---|
26 | #+begin_src |
---|
27 | CL-USER> (uiop/os:getenv "PATH") |
---|
28 | "/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin" |
---|
29 | CL-USER> (setf (uiop/os:getenv "PATH") "/usr/sbin") |
---|
30 | "/usr/sbin" |
---|
31 | CL-USER> (uiop/os:getenv "PATH") |
---|
32 | "/usr/sbin" |
---|
33 | CL-USER> |
---|
34 | #+end_src |
---|
35 | |
---|
36 | ** Notes |
---|
37 | |
---|
38 | CFFI isn't used to minimize dependencies. |
---|
39 | |
---|
40 | Posix syscalls is perhaps a terrible name. |
---|
41 | |
---|
42 | This isn't expected work on Windows (untested). |
---|
43 | |
---|
44 | |
---|
45 | * Colophon |
---|
46 | #+begin_example |
---|
47 | Mark <evenson@not.org> |
---|
48 | Created: 24-MAY-2023 |
---|
49 | Revised: <2023-05-25 Thu 08:38> |
---|
50 | #+end_example |
---|
51 | |
---|
52 | |
---|
53 | |
---|
Note: See
TracBrowser
for help on using the repository browser.