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.
- implement
open
plus flags and mode - implement
read
for raw buffers andByteString
- implement
write
for raw buffers andByteString
- implement
close
- implement
lseek
including differentwhence
constants - solve exercises in Idris
- get and set file flags using
fcntl
- implement file duplication:
dup
,dup2
, and viafcntl
- implement
pread
andpwrite
- implement
truncate
andftruncate
- implement
mkstemp
- solve (most) exercises in Idris
The following will probably not be implemented:
- scatter and gather versions of
read
andwrite
tmpfile
as it operates onFILE *
dup3
as it is not part of POSIX
- implement
getpid
andgetppid
.
The following will probably not be implemented:
setjmp
andlongjmp
as they belong strictly to C land- exercises, as they deal either with non-implementable stuff or with the environment, and we already have that from base
- implement
realloc
The following will probably not be implemented:
alloca
because it is mostly useful in C landmemalign
andposix_memalign
because they are non-standard
Note: 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.
- implement
getuid
,geteuid
,setuid
, andseteuid
- implement
getgid
,getegid
,setgid
, andsetegid
- implement
setreuid
andsetregid
- implement
getgroups
- implement
setgroups
- implement
initgroups
The following will probably not be implemented:
getresuid
,getresgid
,setfsuid
, andsetfsgid
(all are non-standard)
- implement
gmtime_r
- implement
localtime_r
- implement
mktime
- implement
strftime_l
The following will probably not be implemented:
settimeofday
andadjtime
because these are typically handled by a system daemon
Note: Different types of clocks are implemented in System.Clock
in base.
- implement
sysconf
,pathconf
, andfpathconf
- implement
uname
- solve process tree exercise
- implement
fileno
- implement
fdopen
- do the exercises
Notes: Currently, I am more interested in the raw system calls. Buffered
file I/O is available from System.File
in base.
- implement
mount
- implement
umount
andumount2
- implement
statvfs
andfstatvfs
- do the exercise
- implement
stat
,lstat
, andfstat
- implement
utimes
,futimes
, andlutimes
- implement
chown
,lchown
, andfchown
- implement
umask
- implement
chmod
andfchmod
- do the exercises
The following will probably not be implemented:
access
as its use is discouraged- setting of i-node flags as these are non-standard
Extended 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.
- implement
link
andunlink
- implement
rename
- implement
symlink
andreadlink
- implement
mkidr
,rmdir
, and something similar tomkdir -p
- implement
remove
- implement
opendir
andfopendir
- implement
rewinddir
andclosedir
- implement
readdir
- implement
getcwd
- implement
chdir
- implement
chroot
- do the exercises
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 thangetcwd
- implement
inotify
utilities for monitoring files - do the exercise
- implement
kill
andraise
- implement utilities for working with
sigset_t
- implement different versions of
sigprocmask
- implement
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 (this is no longer available, as it caused spurious
core dumps). An alternative would be to use onsignal
is added for registering
signal handlersepoll
with a signal
file descriptor (under Linux) or synchronous signal handling. See chapter 22.
- implement
abort
The following will probably not be implemented:
sigsetjmp
siglongjmp
, andsigaltstack
as I can't see their use on the default backends.
- implement
sigsuspend
- implement
sigwaitinfo
andsigtimedwait
- implement raising and handling of realtime signals
- implement signal fetching via a file descriptor
- implement
setitimerval
andgetitimerval
- implement
nanosleep
andclock_nanosleep
. - implement
clock_gettime
andclock_settime
- add support for process and thread clock IDs
- implement POSIX clocks timers
- implement timer handling via file descriptors
- implement
fork
- add example applications with some IPC via signals
exit
is already available in base.
The following will probably not be implemented:
- Installing exit handlers via
atexit
andonexit
, as these might suffer from the same limitations as other callbacks when used from Schemes.
- implement
wait
- implement
waitpid
- implement
waitid
- do the exercises
The following will probably not be implemented:
wait3
andwait4
as they are (according to the book) not often used and lack standardization.
- implement
execve
and related functions - implement
system
- do the exercises
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.
- implement
pthreadSelf
- implement
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.
- implement
MutexT
and utilities for working with mutexes - implement
CondT
and utilities for working with condition variables
The following will probably not be implemented:
- Fine grained details about mutex and condition attributes.
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.- thread specific data, because we have other mechanisms in Idris to achieve this
- thread-local storage, because this makes use of a C language keyword.
- implement
pthread_cancel
- implement
pthread_setcanceltype
andpthread_setcancelstate
- implement
pthread_testcancel
The following will probably not be implemented:
- registering and handling of thread cleanup handlers. I might come back to this and check interop with the Scheme backends
- implement
pthread_sigmask
in various forms - implement
pthread_kill
- implement
pthread_sigqueue
- implement
sigwait
- do the exercises
To be added...
- implement
pipe
- implement
pipe2
- implement
popen
andpclose
- implement
mkfifo
- do the exercises
- do the exercises