- 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:
Abdulaziz Ghuloum 2008-11-01 07:28:08 -04:00
parent 74a1d302ec
commit 069bd683cd
8 changed files with 31 additions and 10 deletions

Binary file not shown.

Binary file not shown.

View File

@ -30,11 +30,10 @@
(define fasl-extension ".ikarus-fasl")
(define (load-serialized-library filename sk)
;;; TODO: check file last-modified date
(let ([ikfasl (string-append filename fasl-extension)])
(cond
[(not (file-exists? ikfasl)) #f]
[(<= (file-ctime ikfasl) (file-ctime filename))
[(< (file-mtime ikfasl) (file-mtime filename))
(fprintf (current-error-port)
"WARNING: not using fasl file ~s because it is older \
than the source file ~s\n"

View File

@ -16,7 +16,8 @@
(library (ikarus.posix)
(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
directory-list make-directory delete-directory change-mode
kill strerror
@ -26,7 +27,8 @@
(except (ikarus)
nanosleep
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
directory-list make-directory delete-directory change-mode
kill strerror
@ -237,16 +239,22 @@
(unless (eq? r #t)
(raise/strerror who r path)))))
(define (file-ctime x)
(define who 'file-ctime)
(define ($file-time x who proc)
(unless (string? x)
(die who "not a string" x))
(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
[(0) (+ (* (car p) #e1e9) (cdr p))]
[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)
(foreign-call "ikrt_getenv" key))

View File

@ -1 +1 @@
1657
1658

View File

@ -1256,6 +1256,7 @@
[change-mode i]
[make-symbolic-link i]
[file-ctime i]
[file-mtime i]
[fork i]
[define-record-type i r rs]
[fields i r rs]

View File

@ -298,6 +298,19 @@ ikrt_file_ctime(ikptr filename, ikptr res){
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);
}

View File

@ -246,13 +246,13 @@ ik_munmap(ikptr mem, unsigned long int size){
assert(((-pagesize) & (int)mem) == (int)mem);
total_allocated_pages -= pages;
#ifndef __CYGWIN__
int err = munmap((char*)(long)mem, mapsize);
int err = munmap((char*)mem, mapsize);
if(err != 0){
fprintf(stderr, "ik_munmap failed: %s\n", strerror(errno));
exit(-1);
}
#else
win_munmap(mem, mapsize);
win_munmap((char*)mem, mapsize);
#endif
#ifndef NDEBUG
fprintf(stderr, "UNMAP 0x%08x .. 0x%08x\n", (int)mem,