From a4a7cb9fe7df044fe2477b44dcda58e775d1376c Mon Sep 17 00:00:00 2001 From: cshapiro <cshapiro> Date: Mon, 17 Dec 2007 09:54:35 +0000 Subject: [PATCH] Make all ports use an accessor function to retrieve the value of h_errno. Like errno, it is left unspecified whether h_errno is a macro or an identifier declared with external linkage. Let the C compiler sort this out for us. --- code/internet.lisp | 11 ++--------- lisp/Linux-os.c | 9 +-------- lisp/os-common.c | 9 ++++++++- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/code/internet.lisp b/code/internet.lisp index 7e5e585ca..51b9f3cac 100644 --- a/code/internet.lisp +++ b/code/internet.lisp @@ -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/internet.lisp,v 1.51 2006/03/17 02:56:45 rtoy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/internet.lisp,v 1.52 2007/12/17 09:54:35 cshapiro Exp $") ;;; ;;; ********************************************************************** ;;; @@ -199,14 +199,7 @@ struct in_addr { (len int) (type int)) -#+(and x86 linux) -(def-alien-routine get-h-errno c-call:int) - -#-(and x86 linux) -(progn - (def-alien-variable "h_errno" c-call:int) - (defun get-h-errno () - h-errno)) +(def-alien-routine ("os_get_h_errno" get-h-errno) int) (defun lookup-host-entry (host) "Return a host-entry for the given host. The host may be an address diff --git a/lisp/Linux-os.c b/lisp/Linux-os.c index 97342d959..36e645d74 100644 --- a/lisp/Linux-os.c +++ b/lisp/Linux-os.c @@ -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.35 2007/12/14 12:19:58 cshapiro Exp $ + * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.36 2007/12/17 09:54:35 cshapiro Exp $ * */ @@ -40,7 +40,6 @@ #include <unistd.h> #include <sys/resource.h> #include <sys/wait.h> -#include <netdb.h> #include <link.h> #include <dlfcn.h> #include <assert.h> @@ -382,12 +381,6 @@ os_dlsym(const char *sym_name, lispobj lib_list) } } -int -get_h_errno() -{ - return h_errno; -} - void restore_fpu(ucontext_t *context) { diff --git a/lisp/os-common.c b/lisp/os-common.c index 7023e48af..3d6c754c3 100644 --- a/lisp/os-common.c +++ b/lisp/os-common.c @@ -1,6 +1,6 @@ /* - $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os-common.c,v 1.25 2007/12/10 21:14:16 rtoy Exp $ + $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os-common.c,v 1.26 2007/12/17 09:54:35 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. @@ -8,6 +8,7 @@ */ #include <errno.h> +#include <netdb.h> #include <stdio.h> #include <string.h> @@ -126,6 +127,12 @@ os_set_errno(int value) return errno = value; } +int +os_get_h_errno(void) +{ + return h_errno; +} + #ifdef LINKAGE_TABLE /* These declarations are lies. They actually take args, but are -- GitLab