~ chicken-core (master) 6ab47e2038364e14f9ddcc51dc36731ae5d63348


commit 6ab47e2038364e14f9ddcc51dc36731ae5d63348
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Thu Sep 24 14:38:15 2026 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Thu Sep 24 14:38:15 2026 +0200

    move ##sys#posix-error into library.scm

diff --git a/library.scm b/library.scm
index db4e4d39..f3361a91 100644
--- a/library.scm
+++ b/library.scm
@@ -6417,6 +6417,13 @@ EOF
       (apply ##sys#signal-hook/errno mode #f msg args)
       (##sys#signal-hook/errno mode #f msg)))
 
+(define ##sys#posix-error
+  (let ((string-append string-append))
+    (lambda (type loc msg . args)
+      (apply ##sys#signal-hook/errno
+             type (##sys#update-errno) loc 
+             (string-append msg " - " strerror) args))))
+
 (define (abort x)
   (##sys#current-exception-handler x)
   (abort
@@ -6432,7 +6439,7 @@ EOF
 
 (define ##sys#error-handler
   (make-parameter
-   (let ([string-append string-append])
+   (let ((string-append string-append))
      (lambda (msg . args)
        (##sys#error-handler (lambda args (##core#inline "C_halt" "error in error")))
        (cond ((not (foreign-value "C_gui_mode" bool))
diff --git a/port.scm b/port.scm
index 0fdf4e88..52641dbb 100644
--- a/port.scm
+++ b/port.scm
@@ -592,15 +592,6 @@ char *ttyname(int fd) {
     (##sys#set-port-data! port (vector #f))
     port))
 
-;; Duplication from posix-common.scm
-(define posix-error
-  (let ((strerror (foreign-lambda c-string "strerror" int))
-	(string-append string-append))
-    (lambda (type loc msg . args)
-      (let ((rn (##sys#update-errno)))
-        (apply ##sys#signal-hook/errno
-               type rn loc (string-append msg " - " (strerror rn)) args)))))
-
 ;; Terminal ports
 (define (terminal-port? port)
   (##sys#check-open-port port 'terminal-port?)
@@ -618,7 +609,7 @@ char *ttyname(int fd) {
     (lambda (port)
       (check-terminal! 'terminal-name port)
       (or (ttyname (##core#inline "C_port_fileno" port))
-	  (posix-error #:error 'terminal-name
+	  (##sys#posix-error #:error 'terminal-name
 		       "cannot determine terminal name" port)))))
 
 (define terminal-size
@@ -633,7 +624,7 @@ char *ttyname(int fd) {
 			    (location rows)
 			    (location columns)))
 	    (values rows columns)
-	    (posix-error #:error 'terminal-size
+	    (##sys#posix-error #:error 'terminal-size
 			 "cannot determine terminal size" port))))))
 
 )
diff --git a/posix-common.scm b/posix-common.scm
index 5b334072..dd68eb01 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -192,16 +192,6 @@ EOF
 (define-foreign-variable _eilseq int "EILSEQ")
 (define-foreign-variable _ewouldblock int "EWOULDBLOCK")
 
-(define posix-error
-  (let ([strerror (foreign-lambda c-string "strerror" int)]
-	[string-append string-append] )
-    (lambda (type loc msg . args)
-      (let ([rn (##sys#update-errno)])
-        (apply ##sys#signal-hook/errno
-               type rn loc (string-append msg " - " (strerror rn)) args)))))
-
-(define ##sys#posix-error posix-error)
-
 
 ;;; File properties
 
@@ -252,7 +242,7 @@ EOF
 		   #:type-error loc "bad argument type - not a fixnum, port or string" file)) ) ) )
     (if (fx< r 0)
 	(if err
-	    (posix-error #:file-error loc "cannot access file" file)
+	    (##sys#posix-error #:file-error loc "cannot access file" file)
 	    #f)
 	#t)))
 
@@ -278,7 +268,7 @@ EOF
 		     #:type-error 'file-permissions
 		     "bad argument type - not a fixnum, port or string" f)) ) ) )
       (when (fx< r 0)
-	(posix-error #:file-error 'set-file-permissions! "cannot change file permissions" f p) ) )))
+	(##sys#posix-error #:file-error 'set-file-permissions! "cannot change file permissions" f p) ) )))
 
 (set! chicken.file.posix#file-modification-time
   (lambda (f)
@@ -302,7 +292,7 @@ EOF
 		  scheme-object scheme-object scheme-object)
 		f atime mtime)))
 	(when (fx< r 0)
-	  (apply posix-error
+	  (apply ##sys#posix-error
 		 #:file-error
 		 'set-file-times! "cannot set file times" f rest))))))
 
@@ -404,7 +394,7 @@ EOF
 		     (##core#inline "C_lseek" port pos whence))
 		    (else
 		     (##sys#signal-hook #:type-error 'set-file-position! "invalid file" port)) )
-	(posix-error #:file-error 'set-file-position! "cannot set file position" port pos) ) ) ) )
+	(##sys#posix-error #:file-error 'set-file-position! "cannot set file position" port pos) ) ) ) )
 
 (set! chicken.file.posix#file-position
   (getter-with-setter
@@ -418,7 +408,7 @@ EOF
 		      (else
 		       (##sys#signal-hook #:type-error 'file-position "invalid file" port)) ) ) )
        (when (< pos 0)
-	 (posix-error #:file-error 'file-position "cannot retrieve file position of port" port) )
+	 (##sys#posix-error #:file-error 'file-position "cannot retrieve file position of port" port) )
        pos) )
    chicken.file.posix#set-file-position! ; doesn't accept WHENCE
    "(chicken.file.posix#file-position port)"))
@@ -497,7 +487,7 @@ EOF
      loc) )
   (define (check loc fd inp r enc)
     (if (##sys#null-pointer? r)
-        (posix-error #:file-error loc "cannot open file" fd)
+        (##sys#posix-error #:file-error loc "cannot open file" fd)
         (let ((port (##sys#make-port (if inp 1 2) ##sys#stream-port-class "(fdport)" 'stream)))
           (##core#inline "C_set_file_ptr" port r)
           (##sys#setslot port 15 enc)
@@ -523,9 +513,9 @@ EOF
           ((not (zero? (##sys#peek-unsigned-integer port 0)))
            (let ([fd (##core#inline "C_port_fileno" port)])
              (when (fx< fd 0)
-               (posix-error #:file-error 'port->fileno "cannot access file-descriptor of port" port) )
+               (##sys#posix-error #:file-error 'port->fileno "cannot access file-descriptor of port" port) )
              fd) )
-          (else (posix-error #:type-error 'port->fileno "port has no attached file" port)) ) ) )
+          (else (##sys#posix-error #:type-error 'port->fileno "port has no attached file" port)) ) ) )
 
 (set! chicken.file.posix#duplicate-fileno
   (lambda (old . new)
@@ -536,7 +526,7 @@ EOF
                     (##sys#check-fixnum n 'duplicate-fileno)
                     (##core#inline "C_dup2" old n) ) ) ] )
       (when (fx< fd 0)
-        (posix-error #:file-error 'duplicate-fileno "cannot duplicate file-descriptor" old) )
+        (##sys#posix-error #:file-error 'duplicate-fileno "cannot duplicate file-descriptor" old) )
       fd) ) )
 
 
@@ -552,7 +542,7 @@ EOF
   (lambda (fd)
     (##sys#check-fixnum fd 'change-directory*)
     (unless (fx= 0 (##core#inline "C_fchdir" fd))
-      (posix-error #:file-error 'change-directory* "cannot change current directory" fd))
+      (##sys#posix-error #:file-error 'change-directory* "cannot change current directory" fd))
     fd))
 
 (set! ##sys#change-directory-hook
@@ -724,7 +714,7 @@ EOF
             (receive (epid enorm ecode) (process-wait-impl pid nohang)
               (cond
                ((fx= epid -1)
-                (posix-error #:process-error 'process-wait
+                (##sys#posix-error #:process-error 'process-wait
                              "waiting for child process failed" pid))
                ((fx= epid 0)
                 (values 0 #f #f))
@@ -816,7 +806,7 @@ EOF
   (define (badmode m) (##sys#error "illegal input/output mode specifier" m))
   (define (check loc cmd inp r)
     (if (##sys#null-pointer? r)
-	(posix-error #:file-error loc "cannot open pipe" cmd)
+	(##sys#posix-error #:file-error loc "cannot open pipe" cmd)
 	(let ((port (##sys#make-port (if inp 1 2) ##sys#stream-port-class "(pipe)" 'stream)))
 	  (##core#inline "C_set_file_ptr" port r)
 	  port) ) )
@@ -847,14 +837,14 @@ EOF
       (##sys#check-input-port port #t 'close-input-pipe)
       (let ((r (##core#inline "close_pipe" port)))
 	(when (eq? -1 r)
-	  (posix-error #:file-error 'close-input-pipe "error while closing pipe" port))
+	  (##sys#posix-error #:file-error 'close-input-pipe "error while closing pipe" port))
 	r) ) )
   (set! chicken.process#close-output-pipe
     (lambda (port)
       (##sys#check-output-port port #t 'close-output-pipe)
       (let ((r (##core#inline "close_pipe" port)))
 	(when (eq? -1 r)
-	  (posix-error #:file-error 'close-output-pipe "error while closing pipe" port))
+	  (##sys#posix-error #:file-error 'close-output-pipe "error while closing pipe" port))
 	r) ) ))
 
 (set! chicken.process#with-input-from-pipe
diff --git a/posixunix.scm b/posixunix.scm
index e11520f5..8e2c5f08 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -341,7 +341,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
       (##sys#check-fixnum cmd 'file-control)
       (let ([res (fcntl fd cmd arg)])
         (if (eq? res -1)
-            (posix-error #:file-error 'file-control "cannot control file" fd cmd)
+            (##sys#posix-error #:file-error 'file-control "cannot control file" fd cmd)
             res ) ) ) ) )
 
 (set! chicken.file.posix#file-open
@@ -353,7 +353,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
         (##sys#check-fixnum mode 'file-open)
         (let ([fd (##core#inline "C_open" (##sys#make-c-string filename 'file-open) flags mode)])
           (when (eq? -1 fd)
-            (posix-error #:file-error 'file-open "cannot open file" filename flags mode) )
+            (##sys#posix-error #:file-error 'file-open "cannot open file" filename flags mode) )
           fd) ) ) ) )
 
 (set! chicken.file.posix#file-close
@@ -364,7 +364,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 	(cond
 	  ((eq? _errno _eintr) (##sys#dispatch-interrupt loop))
 	  (else
-	   (posix-error #:file-error 'file-close "cannot close file" fd)))))))
+	   (##sys#posix-error #:file-error 'file-close "cannot close file" fd)))))))
 
 (set! chicken.file.posix#file-read
   (lambda (fd size . buffer)
@@ -375,7 +375,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 	(##sys#signal-hook #:type-error 'file-read "bad argument type - not a bytevector" buf) )
       (let ([n (##core#inline "C_read" fd buf size)])
 	(when (eq? -1 n)
-	  (posix-error #:file-error 'file-read "cannot read from file" fd size) )
+	  (##sys#posix-error #:file-error 'file-read "cannot read from file" fd size) )
 	(list buf n) ) ) ) )
 
 (set! chicken.file.posix#file-write
@@ -387,7 +387,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
       (##sys#check-fixnum size 'file-write)
       (let ([n (##core#inline "C_write" fd buffer 0 size)])
         (when (eq? -1 n)
-          (posix-error #:file-error 'file-write "cannot write to file" fd size) )
+          (##sys#posix-error #:file-error 'file-write "cannot write to file" fd size) )
         n) ) ) )
 
 (set! chicken.file.posix#file-mkstemp
@@ -399,7 +399,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
       (##core#inline "C_copy_memory" bv2 bv1 len)
       (let ((fd (##core#inline "C_mkstemp" bv2)))
         (when (eq? -1 fd)
-	  (posix-error #:file-error 'file-mkstemp 
+	  (##sys#posix-error #:file-error 'file-mkstemp 
                        "cannot create temporary file" template) )
         (values 
           fd 
@@ -415,7 +415,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
       (##core#inline "C_copy_memory" bv2 bv1 len)
       (let ((fd (##core#inline "C_mkstemps" bv2 suffixlen)))
         (when (eq? -1 fd)
-	  (posix-error #:file-error 'file-mkstemps
+	  (##sys#posix-error #:file-error 'file-mkstemps
                        "cannot create temporary file" template) )
         (values
           fd
@@ -429,7 +429,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
            (bv2 (##sys#make-bytevector len)) )
       (##core#inline "C_copy_memory" bv2 bv1 len)
       (when (eq? -1 (##core#inline "C_mkdtemp" bv2))
-        (posix-error #:file-error 'file-mkdtemp
+        (##sys#posix-error #:file-error 'file-mkdtemp
                      "cannot create temporary directory" template) )
       (##sys#buffer->string! bv2 (fx- len 1)))))
 
@@ -467,7 +467,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
       (let ((n ((foreign-lambda int "poll" scheme-pointer int int)
 		fds-blob nfds (if tm (inexact->exact (truncate (* (max 0 tm) 1000))) -1))))
 	(cond ((fx< n 0)
-	       (posix-error #:file-error 'file-select "failed" fdsr fdsw) )
+	       (##sys#posix-error #:file-error 'file-select "failed" fdsr fdsw) )
 	      ((eq? n 0) (values (if (pair? fdsr) '() #f) (if (pair? fdsw) '() #f)))
 	      (else
 	       (let ((rl (let lp ((i 0) (res '()) (fds fdsrl))
@@ -499,7 +499,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 (set! chicken.process#create-pipe
   (lambda (#!optional mode)
    (when (fx< (##core#inline "C_pipe" #f) 0)
-     (posix-error #:file-error 'create-pipe "cannot create pipe") )
+     (##sys#posix-error #:file-error 'create-pipe "cannot create pipe") )
    (values _pipefd0 _pipefd1))  )
 
 
@@ -600,7 +600,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
         (##core#inline "C_sigaddset" s) )
       sigs)
     (when (fx< (##core#inline "C_sigprocmask_set" 0) 0)
-      (posix-error #:process-error 'set-signal-mask! "cannot set signal mask") )))
+      (##sys#posix-error #:process-error 'set-signal-mask! "cannot set signal mask") )))
 
 (define chicken.process.signal#signal-mask
   (getter-with-setter
@@ -627,7 +627,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
     (##core#inline "C_sigemptyset" 0)
     (##core#inline "C_sigaddset" sig)
     (when (fx< (##core#inline "C_sigprocmask_block" 0) 0)
-      (posix-error #:process-error 'signal-mask! "cannot block signal") )))
+      (##sys#posix-error #:process-error 'signal-mask! "cannot block signal") )))
 
 (set! chicken.process.signal#signal-unmask!
   (lambda (sig)
@@ -635,7 +635,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
     (##core#inline "C_sigemptyset" 0)
     (##core#inline "C_sigaddset" sig)
     (when (fx< (##core#inline "C_sigprocmask_unblock" 0) 0)
-      (posix-error #:process-error 'signal-unmask! "cannot unblock signal") )) )
+      (##sys#posix-error #:process-error 'signal-unmask! "cannot unblock signal") )) )
 
 
 ;;; Getting group- and user-information:
@@ -733,7 +733,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 		     #:type-error loc
 		     "bad argument type - not a fixnum, port or string" f)))))
       (when (fx< r 0)
-	(posix-error #:file-error loc "cannot change file owner" f uid gid) )) ) )
+	(##sys#posix-error #:file-error loc "cannot change file owner" f uid gid) )) ) )
 
 (set! chicken.process-context.posix#create-session
   (lambda ()
@@ -773,7 +773,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
               (##sys#make-c-string old 'create-symbolic-link)
               (##sys#make-c-string new 'create-symbolic-link) )
              0)
-      (posix-error #:file-error 'create-symbolic-link "cannot create symbolic link" old new) ) ) )
+      (##sys#posix-error #:file-error 'create-symbolic-link "cannot create symbolic link" old new) ) ) )
 
 (define-foreign-variable _filename_max int "FILENAME_MAX")
 
@@ -785,7 +785,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
                   (##sys#make-c-string fname location)
                   buf)))
         (if (fx< len 0)
-            (posix-error #:file-error location "cannot read symbolic link" fname)
+            (##sys#posix-error #:file-error location "cannot read symbolic link" fname)
             (##sys#buffer->string buf 0 len))))))
 
 (set! chicken.file.posix#read-symbolic-link
@@ -815,7 +815,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
       (##sys#check-string old 'file-link)
       (##sys#check-string new 'file-link)
       (when (fx< (link old new) 0)
-        (posix-error #:file-error 'file-link "could not create hard link" old new) ) ) ) )
+        (##sys#posix-error #:file-error 'file-link "could not create hard link" old new) ) ) ) )
 
 (define-inline (eagain/ewouldblock? e)
   (or (eq? e _ewouldblock)
@@ -835,7 +835,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 		 (if (eq? -1 res)
 		     (if (eagain/ewouldblock? _errno)
 			 #f
-			 (posix-error #:file-error loc "cannot select" fd nam))
+			 (##sys#posix-error #:file-error loc "cannot select" fd nam))
 		     (eq? 1 res))))]
             [peek
              (lambda ()
@@ -861,7 +861,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
                              (loop) )
                             ((eq? _errno _eintr)
                              (##sys#dispatch-interrupt loop))
-                            (else (posix-error #:file-error loc "cannot read" fd nam) )))
+                            (else (##sys#posix-error #:file-error loc "cannot read" fd nam) )))
                          ((and more? (eq? cnt 0))
                           ;; When "more" keep trying, otherwise read once more
                           ;; to guard against race conditions
@@ -873,7 +873,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
                                 (when (eq? cnt -1)
                                   (if (eagain/ewouldblock? _errno)
                                       (set! cnt 0)
-                                      (posix-error #:file-error loc "cannot read" fd nam) ) )
+                                      (##sys#posix-error #:file-error loc "cannot read" fd nam) ) )
                                 (set! buflen cnt)
                                 (set! bufpos 0) ) ))
                          (else
@@ -897,7 +897,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 			 (ready?)) )
 		   (lambda ()		; close
 		     (when (fx< (##core#inline "C_close" fd) 0)
-		       (posix-error #:file-error loc "cannot close" fd nam))
+		       (##sys#posix-error #:file-error loc "cannot close" fd nam))
 		     (on-close))
 		   peek-char:
                    (lambda ()		; peek-char
@@ -984,7 +984,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 			    ((eq? _errno _eintr)
 			     (##sys#dispatch-interrupt loop))
 			    (else
-			     (posix-error loc #:file-error "cannot write" fd nam) ) ) )
+			     (##sys#posix-error loc #:file-error "cannot write" fd nam) ) ) )
 			  ((fx< cnt len)
 			   (poke bv (fx+ start cnt) (fx- len cnt)) ) ) ) )))
 	     (store
@@ -1019,7 +1019,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 		 (lambda (str) (store str))
 		 (lambda ()		; close
 		   (when (fx< (##core#inline "C_close" fd) 0)
-		     (posix-error #:file-error loc "cannot close" fd nam))
+		     (##sys#posix-error #:file-error loc "cannot close" fd nam))
 		   (on-close))
                  force-output:
 		 (lambda ()		; flush
@@ -1040,7 +1040,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 		     ((fixnum? fname) (##core#inline "C_ftruncate" fname off))
 		     (else (##sys#error 'file-truncate "invalid file" fname)))
 	       0)
-      (posix-error #:file-error 'file-truncate "cannot truncate file" fname off) ) ) )
+      (##sys#posix-error #:file-error 'file-truncate "cannot truncate file" fname off) ) ) )
 
 
 ;;; File locking:
@@ -1052,7 +1052,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 
 (let ()
   (define (err msg port loc)
-    (posix-error #:file-error loc msg port) )
+    (##sys#posix-error #:file-error loc msg port) )
   (define (fileno x loc)
     (if (port? x)
         (chicken.file.posix#port->fileno x)
@@ -1093,7 +1093,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
     (let ([mode (if (pair? mode) (car mode) (fxior _s_irwxu (fxior _s_irwxg _s_irwxo)))])
       (##sys#check-fixnum mode 'create-fifo)
       (when (fx< (##core#inline "C_mkfifo" (##sys#make-c-string fname 'create-fifo) mode) 0)
-      (posix-error #:file-error 'create-fifo "cannot create FIFO" fname mode) ) ) ) )
+      (##sys#posix-error #:file-error 'create-fifo "cannot create FIFO" fname mode) ) ) ) )
 
 
 ;;; Time related things:
@@ -1150,7 +1150,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
       ((foreign-lambda int "C_fflush" c-pointer) #f)
       (let ((pid (fork)))
         (cond ((eq? -1 pid)             ; error
-               (posix-error #:process-error 'process-fork "cannot create child process"))
+               (##sys#posix-error #:process-error 'process-fork "cannot create child process"))
               ((eq? 0 pid)              ; child process
                (set! children '())
                (when killothers
@@ -1177,7 +1177,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
                     (##core#inline "C_u_i_execve" prg argbuf envbuf)
                     (##core#inline "C_u_i_execvp" prg argbuf))))
          (when (eq? r -1)
-           (posix-error #:process-error 'process-execute "cannot execute process" filename)))))))
+           (##sys#posix-error #:process-error 'process-execute "cannot execute process" filename)))))))
 
 (define-foreign-variable _wnohang int "WNOHANG")
 (define-foreign-variable _wait-status int "C_wait_status")
@@ -1206,7 +1206,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
       (##sys#check-fixnum sig 'process-signal)
       (let ((r (##core#inline "C_kill" pid sig)))
       (when (eq? r -1)
-        (posix-error #:process-error 'process-signal
+        (##sys#posix-error #:process-error 'process-signal
           "could not send signal to process" id sig) ) ) ) ) )
 
 (define (shell-command loc)
@@ -1361,7 +1361,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
     (lambda (dir)
       (##sys#check-string dir 'set-root-directory!)
       (when (fx< (chroot dir) 0)
-        (posix-error #:file-error 'set-root-directory! "unable to change root directory" dir) ) ) ) )
+        (##sys#posix-error #:file-error 'set-root-directory! "unable to change root directory" dir) ) ) ) )
 
 ;;; unimplemented stuff:
 
diff --git a/posixwin.scm b/posixwin.scm
index ff989dfe..f04d0c92 100644
--- a/posixwin.scm
+++ b/posixwin.scm
@@ -555,7 +555,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 	(cond
 	  ((fx= _errno _eintr) (##sys#dispatch-interrupt loop))
 	  (else
-	   (posix-error #:file-error 'file-close "cannot close file" fd)))))))
+	   (##sys#posix-error #:file-error 'file-close "cannot close file" fd)))))))
 
 (set! chicken.file.posix#file-read
   (lambda (fd size . buffer)
@@ -621,7 +621,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 	  (if (eq? -1 fd)
 	      (if (fx< count max-attempts)
 		  (loop (fx+ count 1))
-		  (posix-error #:file-error 'file-mkstemp "cannot create temporary file" template))
+		  (##sys#posix-error #:file-error 'file-mkstemp "cannot create temporary file" template))
 	      (values fd tmpl)))))))
 
 ;;; Pipe primitive:
@@ -764,7 +764,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
                       (##core#inline "C_u_i_execve" prg argbuf envbuf)
                       (##core#inline "C_u_i_execvp" prg argbuf))))
            (when (fx= r -1)
-             (posix-error #:process-error 'process-execute "cannot execute process" filename))))))))
+             (##sys#posix-error #:process-error 'process-execute "cannot execute process" filename))))))))
 
 (set! chicken.process#process-spawn
   (lambda (mode filename #!optional (arglist '()) envlist exactf)
@@ -778,7 +778,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
                       (##core#inline "C_u_i_spawnvpe" mode prg argbuf envbuf)
                       (##core#inline "C_u_i_spawnvp" mode prg argbuf))))
            (if (fx= r -1)
-               (posix-error #:process-error 'process-spawn
+               (##sys#posix-error #:process-error 'process-spawn
                             "cannot spawn process" filename)
                (register-pid r))))))))
 
Trap