This project has been split into two libraries, both providing bindings to the most important system calls and utilities available on Unix-like operating systems.
The libraries are the result of working through the Linux Programming Interface and writing bindings for the most important system calls (usually via the corresponding C functions) in Idris. As I crawl through the chapters, the todo-list below will continuously grow.
In the examples
subproject you can find many of the example applications
and exercises from the book implemented as a single command-line application.
open
plus flags and moderead
for raw buffers and ByteString
write
for raw buffers and ByteString
close
lseek
including different whence
constantsfcntl
dup
, dup2
, and via fcntl
pread
and pwrite
truncate
and ftruncate
mkstemp
The following will probably not be implemented:
read
and write
tmpfile
as it operates on FILE *
dup3
as it is not part of POSIXgetpid
and getppid
.The following will probably not be implemented:
setjmp
and longjmp
as they belong strictly to C landrealloc
The following will probably not be implemented:
alloca
because it is mostly useful in C landmemalign
and posix_memalign
because they are non-standardNote: Calls to crypt
are available from idris2-crypt.
The following will probably not be implemented:
getpwnam
, getpwuid
, getgrnam
, getgruid
, getpwent
, setpwent
endpwent
, getspnam
, getspent
, setspent
, endspent
: All of these
can be implemented by reading or streaming the corresponding files in /etc
into proper Idris records.getuid
, geteuid
, setuid
, and seteuid
getgid
, getegid
, setgid
, and setegid
setreuid
and setregid
getgroups
setgroups
initgroups
The following will probably not be implemented:
getresuid
, getresgid
, setfsuid
, and setfsgid
(all are non-standard)gmtime_r
localtime_r
mktime
strftime_l
The following will probably not be implemented:
settimeofday
and adjtime
because these are typically handled by
a system daemonNote: Different types of clocks are implemented in System.Clock
in base.
sysconf
, pathconf
, and fpathconf
uname
fileno
fdopen
Notes: Currently, I am more interested in the raw system calls. Buffered
file I/O is available from System.File
in base.
mount
umount
and umount2
statvfs
and fstatvfs
stat
, lstat
, and fstat
utimes
, futimes
, and lutimes
chown
, lchown
, and fchown
umask
chmod
and fchmod
The following will probably not be implemented:
access
as its use is discouragedExtended attributes are non-standard and will not be supported for the time being.
Access control lists are non-standard and will not be supported for the time being.
link
and unlink
rename
symlink
and readlink
mkidr
, rmdir
, and something similar to mkdir -p
remove
opendir
and fopendir
rewinddir
and closedir
readdir
getcwd
chdir
chroot
The following will probably not be implemented:
nfwt
: We should probably write our tree-walking routines in
Idris proper instead of messing around with C callbacks.realpath
because it's even more broken than getcwd
inotify
utilities for monitoring fileskill
and raise
sigset_t
sigprocmask
sigpending
Notes: As per the Chez Scheme documentation, it is not safe to call from
C to Scheme from C interrupt handlers. We can therefore not make use
of signal
and sigaction
when on one of the Scheme backends.
~~Instead, a Scheme specific utility called onsignal
is added for registering
signal handlers~~ (this is no longer available, as it caused spurious
core dumps). An alternative would be to use epoll
with a signal
file descriptor (under Linux) or synchronous signal handling. See chapter 22.
abort
The following will probably not be implemented:
sigsetjmp
siglongjmp
, and sigaltstack
as I can't see their use on
the default backends.sigsuspend
sigwaitinfo
and sigtimedwait
setitimerval
and getitimerval
nanosleep
and clock_nanosleep
.clock_gettime
and clock_settime
fork
exit
is already available in base.
The following will probably not be implemented:
atexit
and onexit
, as these might suffer
from the same limitations as other callbacks when used from Schemes.wait
waitpid
waitid
The following will probably not be implemented:
wait3
and wait4
as they are (according to the book) not often used
and lack standardization.execve
and related functionssystem
The following will probably not be implemented:
clone
as it takes a callback function and is probably not very
useful in this generality when using Idris.pthreadSelf
pthreadJoin
The following will probably not be implemented:
pthread_create
, pthread_exit
, pthread_detach
, and thread attributes
as the lifetime of threads is controlled by the Scheme runtime.MutexT
and utilities for working with mutexesCondT
and utilities for working with condition variablesThe following will probably not be implemented:
The following will probably not be implemented:
pthread_once
as it involves callbacks and is not clear how it
interacts with Scheme's thread management.pthread_cancel
pthread_setcanceltype
and pthread_setcancelstate
pthread_testcancel
The following will probably not be implemented:
pthread_sigmask
in various formspthread_kill
pthread_sigqueue
sigwait
To be added...
pipe
pipe2
popen
and pclose
mkfifo