Added errno.
This commit is contained in:
parent
55974d44fa
commit
3049d3d22e
|
@ -25,7 +25,8 @@
|
|||
pointer->integer integer->pointer pointer? dlopen dlsym
|
||||
dlclose dlerror
|
||||
make-c-callout make-c-callback
|
||||
pointer-size)
|
||||
pointer-size
|
||||
errno)
|
||||
|
||||
(import (ikarus) (ikarus system $foreign))
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
(library (ikarus.pointers)
|
||||
(export pointer? integer->pointer pointer->integer
|
||||
dlopen dlerror dlclose dlsym malloc free
|
||||
errno
|
||||
pointer-ref-c-signed-char
|
||||
pointer-ref-c-signed-short
|
||||
pointer-ref-c-signed-int
|
||||
|
@ -264,6 +265,9 @@
|
|||
(or (foreign-call "ikrt_prepare_callback" data)
|
||||
(die who "cannot prepare foreign callback")))))))
|
||||
|
||||
(define (errno)
|
||||
(foreign-call "ikrt_last_errno"))
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
1691
|
||||
1692
|
||||
|
|
|
@ -1475,6 +1475,7 @@
|
|||
[dlsym $for]
|
||||
[malloc $for]
|
||||
[free $for]
|
||||
[errno $for]
|
||||
[pointer-ref-c-signed-char $for]
|
||||
[pointer-ref-c-signed-short $for]
|
||||
[pointer-ref-c-signed-int $for]
|
||||
|
|
|
@ -172,6 +172,7 @@ typedef struct ikpcb{
|
|||
struct timeval collect_utime;
|
||||
struct timeval collect_stime;
|
||||
struct timeval collect_rtime;
|
||||
int last_errno;
|
||||
} ikpcb;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "ikarus-data.h"
|
||||
#include "config.h"
|
||||
#include <sys/errno.h>
|
||||
|
||||
#if ENABLE_LIBFFI
|
||||
#include <ffi.h>
|
||||
|
@ -337,6 +338,7 @@ ikrt_ffi_call(ikptr data, ikptr argsvec, ikpcb* pcb) {
|
|||
avalues[n] = NULL;
|
||||
void* rvalue = alloc_room_for_type(cif->rtype);
|
||||
ffi_call(cif, fn, rvalue, avalues);
|
||||
pcb->last_errno = errno;
|
||||
ikptr val = ffi_to_scheme_value_cast(unfix(rtype), rvalue, pcb);
|
||||
for(i=0; i<n; i++){
|
||||
free(avalues[i]);
|
||||
|
@ -360,6 +362,10 @@ ikrt_ffi_call(ikptr data, ikptr argsvec, ikpcb* pcb) {
|
|||
return val;
|
||||
}
|
||||
|
||||
ikptr
|
||||
ikrt_last_errno(ikpcb* pcb){
|
||||
return s_to_number(pcb->last_errno, pcb);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
|
|
Loading…
Reference in New Issue