Skip to content
Snippets Groups Projects
Commit c196fd8d authored by cshapiro's avatar cshapiro
Browse files

Replace operating system private errno accessors with a common set of

errno accessors shared by all ports.  Change the definition of
UNIX:UNIX-ERRNO so that it always calls down to an accessor function.
parent 25a69164
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix-glibc2.lisp,v 1.37 2007/04/07 15:05:52 rtoy Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix-glibc2.lisp,v 1.38 2007/07/31 10:08:47 cshapiro Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -324,13 +324,11 @@
;;;; System calls.
(def-alien-variable ("errno" unix-internal-errno) int)
;;; later...
(defun unix-get-errno ())
(defun unix-errno () (unix-get-errno) unix-internal-errno)
(defun (setf unix-errno) (newvalue) (setf unix-internal-errno newvalue))
(def-alien-routine ("os_get_errno" unix-get-errno) int)
(def-alien-routine ("os_set_errno" unix-set-errno) int (newvalue int))
(defun unix-errno () (unix-get-errno))
(defun (setf unix-errno) (newvalue) (unix-set-errno newvalue))
;;; GET-UNIX-ERROR-MSG -- public.
;;;
......@@ -371,9 +369,6 @@
(defmacro int-syscall ((name &rest arg-types) &rest args)
`(syscall (,name ,@arg-types) (values result 0) ,@args))
(defun unix-get-errno ()
"Get the unix errno value in errno..."
(void-syscall ("update_errno")))
;;; From stdio.h
;;; Unix-rename accepts two files names and renames the first to the second.
......
......@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix.lisp,v 1.112 2007/07/30 06:44:19 cshapiro Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix.lisp,v 1.113 2007/07/31 10:08:47 cshapiro Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -912,17 +912,10 @@
;;; And now for something completely different ...
(emit-unix-errors)
#-bsd
(progn
(def-alien-variable ("errno" unix-internal-errno) int)
(defun unix-errno () unix-internal-errno)
(defun (setf unix-errno) (newvalue) (setf unix-internal-errno newvalue)))
#+bsd
(progn
(def-alien-routine ("os_get_errno" unix-get-errno) int)
(def-alien-routine ("os_set_errno" unix-set-errno) int (newvalue int))
(defun unix-errno () (unix-get-errno))
(defun (setf unix-errno) (newvalue) (unix-set-errno newvalue)))
(defun (setf unix-errno) (newvalue) (unix-set-errno newvalue))
;;; GET-UNIX-ERROR-MSG -- public.
;;;
......
......@@ -14,7 +14,7 @@
* Frobbed for OpenBSD by Pierre R. Mai, 2001.
* Frobbed for Darwin by Pierre R. Mai, 2003.
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Darwin-os.c,v 1.10 2007/07/15 21:33:13 cshapiro Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Darwin-os.c,v 1.11 2007/07/31 10:08:47 cshapiro Exp $
*
*/
......@@ -109,19 +109,6 @@ os_init(void)
#endif
}
int
os_get_errno(void)
{
return errno;
}
int
os_set_errno(int newvalue)
{
errno = newvalue;
return errno;
}
#if defined(__ppc__)
int *
sc_reg(os_context_t * context, int offset)
......
......@@ -12,7 +12,7 @@
* Much hacked by Paul Werkowski
* GENCGC support by Douglas Crosher, 1996, 1997.
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.c,v 1.19 2007/07/30 07:24:46 cshapiro Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.c,v 1.20 2007/07/31 10:08:47 cshapiro Exp $
*
*/
......@@ -44,18 +44,6 @@ os_init(void)
os_vm_page_size = getpagesize();
}
int
os_get_errno(void)
{
return errno;
}
int
os_set_errno(int value)
{
return errno = value;
}
int *
sc_reg(ucontext_t *context, int offset)
{
......
......@@ -15,7 +15,7 @@
* GENCGC support by Douglas Crosher, 1996, 1997.
* Alpha support by Julian Dolby, 1999.
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.32 2007/07/30 07:24:46 cshapiro Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.33 2007/07/31 10:08:47 cshapiro Exp $
*
*/
......@@ -54,14 +54,6 @@ size_t os_vm_page_size;
#if defined GENCGC
#include "gencgc.h"
#endif
int PVE_stub_errno;
void
update_errno(void)
{
PVE_stub_errno = errno;
}
void
......
/*
$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os-common.c,v 1.22 2007/07/06 08:04:39 cshapiro Exp $
$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os-common.c,v 1.23 2007/07/31 10:08:47 cshapiro Exp $
This code was written as part of the CMU Common Lisp project at
Carnegie Mellon University, and has been placed in the public domain.
......@@ -113,6 +113,18 @@ os_reallocate(os_vm_address_t addr, os_vm_size_t old_len, os_vm_size_t len)
}
}
int
os_get_errno(void)
{
return errno;
}
int
os_set_errno(int value)
{
return errno = value;
}
#ifdef LINKAGE_TABLE
/* These declarations are lies. They actually take args, but are
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment