- added file-mtime
- Ikarus fasl files and source files are not compared using (< (file-mtime ikfasl) (file-mtime filename)) instead of (<= (file-ctime ikfasl) (file-ctime filename))
This commit is contained in:
parent
74a1d302ec
commit
069bd683cd
Binary file not shown.
Binary file not shown.
|
@ -30,11 +30,10 @@
|
||||||
(define fasl-extension ".ikarus-fasl")
|
(define fasl-extension ".ikarus-fasl")
|
||||||
|
|
||||||
(define (load-serialized-library filename sk)
|
(define (load-serialized-library filename sk)
|
||||||
;;; TODO: check file last-modified date
|
|
||||||
(let ([ikfasl (string-append filename fasl-extension)])
|
(let ([ikfasl (string-append filename fasl-extension)])
|
||||||
(cond
|
(cond
|
||||||
[(not (file-exists? ikfasl)) #f]
|
[(not (file-exists? ikfasl)) #f]
|
||||||
[(<= (file-ctime ikfasl) (file-ctime filename))
|
[(< (file-mtime ikfasl) (file-mtime filename))
|
||||||
(fprintf (current-error-port)
|
(fprintf (current-error-port)
|
||||||
"WARNING: not using fasl file ~s because it is older \
|
"WARNING: not using fasl file ~s because it is older \
|
||||||
than the source file ~s\n"
|
than the source file ~s\n"
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
|
|
||||||
(library (ikarus.posix)
|
(library (ikarus.posix)
|
||||||
(export posix-fork fork waitpid system file-exists? delete-file
|
(export posix-fork fork waitpid system file-exists? delete-file
|
||||||
nanosleep getenv env environ file-ctime current-directory
|
nanosleep getenv env environ file-ctime file-mtime
|
||||||
|
current-directory
|
||||||
file-regular? file-directory? file-symbolic-link? make-symbolic-link
|
file-regular? file-directory? file-symbolic-link? make-symbolic-link
|
||||||
directory-list make-directory delete-directory change-mode
|
directory-list make-directory delete-directory change-mode
|
||||||
kill strerror
|
kill strerror
|
||||||
|
@ -26,7 +27,8 @@
|
||||||
(except (ikarus)
|
(except (ikarus)
|
||||||
nanosleep
|
nanosleep
|
||||||
posix-fork fork waitpid system file-exists? delete-file
|
posix-fork fork waitpid system file-exists? delete-file
|
||||||
getenv env environ file-ctime current-directory
|
getenv env environ file-ctime file-mtime
|
||||||
|
current-directory
|
||||||
file-regular? file-directory? file-symbolic-link? make-symbolic-link
|
file-regular? file-directory? file-symbolic-link? make-symbolic-link
|
||||||
directory-list make-directory delete-directory change-mode
|
directory-list make-directory delete-directory change-mode
|
||||||
kill strerror
|
kill strerror
|
||||||
|
@ -237,16 +239,22 @@
|
||||||
(unless (eq? r #t)
|
(unless (eq? r #t)
|
||||||
(raise/strerror who r path)))))
|
(raise/strerror who r path)))))
|
||||||
|
|
||||||
(define (file-ctime x)
|
(define ($file-time x who proc)
|
||||||
(define who 'file-ctime)
|
|
||||||
(unless (string? x)
|
(unless (string? x)
|
||||||
(die who "not a string" x))
|
(die who "not a string" x))
|
||||||
(let ([p (cons #f #f)])
|
(let ([p (cons #f #f)])
|
||||||
(let ([v (foreign-call "ikrt_file_ctime" (string->utf8 x) p)])
|
(let ([v (proc (string->utf8 x) p)])
|
||||||
(case v
|
(case v
|
||||||
[(0) (+ (* (car p) #e1e9) (cdr p))]
|
[(0) (+ (* (car p) #e1e9) (cdr p))]
|
||||||
[else (raise/strerror who v x)]))))
|
[else (raise/strerror who v x)]))))
|
||||||
|
|
||||||
|
(define (file-ctime x)
|
||||||
|
($file-time x 'file-ctime
|
||||||
|
(lambda (u p) (foreign-call "ikrt_file_ctime" u p))))
|
||||||
|
|
||||||
|
(define (file-mtime x)
|
||||||
|
($file-time x 'file-mtime
|
||||||
|
(lambda (u p) (foreign-call "ikrt_file_mtime" u p))))
|
||||||
|
|
||||||
(define ($getenv-bv key)
|
(define ($getenv-bv key)
|
||||||
(foreign-call "ikrt_getenv" key))
|
(foreign-call "ikrt_getenv" key))
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1657
|
1658
|
||||||
|
|
|
@ -1256,6 +1256,7 @@
|
||||||
[change-mode i]
|
[change-mode i]
|
||||||
[make-symbolic-link i]
|
[make-symbolic-link i]
|
||||||
[file-ctime i]
|
[file-ctime i]
|
||||||
|
[file-mtime i]
|
||||||
[fork i]
|
[fork i]
|
||||||
[define-record-type i r rs]
|
[define-record-type i r rs]
|
||||||
[fields i r rs]
|
[fields i r rs]
|
||||||
|
|
|
@ -298,6 +298,19 @@ ikrt_file_ctime(ikptr filename, ikptr res){
|
||||||
return fix(0);
|
return fix(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ikptr
|
||||||
|
ikrt_file_mtime(ikptr filename, ikptr res){
|
||||||
|
struct stat s;
|
||||||
|
int err = stat((char*)(filename + off_bytevector_data), &s);
|
||||||
|
if(err) {
|
||||||
|
return ik_errno_to_code();
|
||||||
|
}
|
||||||
|
|
||||||
|
ref(res, off_car) = fix(s.st_mtime);
|
||||||
|
ref(res, off_cdr) = 0;
|
||||||
|
return fix(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -246,13 +246,13 @@ ik_munmap(ikptr mem, unsigned long int size){
|
||||||
assert(((-pagesize) & (int)mem) == (int)mem);
|
assert(((-pagesize) & (int)mem) == (int)mem);
|
||||||
total_allocated_pages -= pages;
|
total_allocated_pages -= pages;
|
||||||
#ifndef __CYGWIN__
|
#ifndef __CYGWIN__
|
||||||
int err = munmap((char*)(long)mem, mapsize);
|
int err = munmap((char*)mem, mapsize);
|
||||||
if(err != 0){
|
if(err != 0){
|
||||||
fprintf(stderr, "ik_munmap failed: %s\n", strerror(errno));
|
fprintf(stderr, "ik_munmap failed: %s\n", strerror(errno));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
win_munmap(mem, mapsize);
|
win_munmap((char*)mem, mapsize);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
fprintf(stderr, "UNMAP 0x%08x .. 0x%08x\n", (int)mem,
|
fprintf(stderr, "UNMAP 0x%08x .. 0x%08x\n", (int)mem,
|
||||||
|
|
Loading…
Reference in New Issue