[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/86: Move syscall-related private defines to their own
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/86: Move syscall-related private defines to their own header |
Date: |
Wed, 20 Jun 2018 14:09:27 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit 5176db70ca9489f9390371cd12bce3ce077d422e
Author: Andy Wingo <address@hidden>
Date: Sun Jun 17 18:18:26 2018 +0200
Move syscall-related private defines to their own header
* libguile/syscalls.h: New private header.
* libguile/Makefile.am
(address@hidden@_la_SOURCES): Add syscalls.h.
* libguile/_scm.h: Remove SCM_SYSCALL and all the bits relating to
e.g. stat versus stat64.
* libguile/filesys.c:
* libguile/fports.c:
* libguile/i18n.c:
* libguile/ioext.c:
* libguile/poll.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/rw.c:
* libguile/scmsigs.c:
* libguile/script.c:
* libguile/socket.c:
* libguile/strports.c: Include syscalls.h.
---
libguile/Makefile.am | 4 +-
libguile/_scm.h | 66 ---------------------------------
libguile/filesys.c | 1 +
libguile/fports.c | 1 +
libguile/i18n.c | 3 +-
libguile/ioext.c | 1 +
libguile/poll.c | 1 +
libguile/ports.c | 1 +
libguile/posix.c | 1 +
libguile/rw.c | 1 +
libguile/scmsigs.c | 1 +
libguile/script.c | 30 ---------------
libguile/socket.c | 1 +
libguile/strports.c | 1 +
libguile/{_scm.h => syscalls.h} | 82 ++---------------------------------------
15 files changed, 18 insertions(+), 177 deletions(-)
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index b27e183..3d2eef9 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -456,7 +456,9 @@ BUILT_SOURCES = cpp-E.c cpp-SIG.c libpath.h
$(BUILT_INCLUDES) \
# Makefile expects it to be built.
all-local: guile-procedures.texi
address@hidden@_la_SOURCES = _scm.h \
address@hidden@_la_SOURCES = \
+ _scm.h \
+ syscalls.h \
memmove.c strerror.c \
dynl.c regex-posix.c \
posix.c net_db.c socket.c \
diff --git a/libguile/_scm.h b/libguile/_scm.h
index d68e9c7..cf89f2b 100644
--- a/libguile/_scm.h
+++ b/libguile/_scm.h
@@ -88,84 +88,18 @@
#include "libguile/inline.h"
#include "libguile/strings.h"
-/* ASYNC_TICK after finding EINTR in order to handle pending signals, if
- any. See comment in scm_syserror. */
-#define SCM_SYSCALL(line) \
- do \
- { \
- errno = 0; \
- line; \
- if (errno == EINTR) \
- { \
- scm_async_tick (); \
- errno = EINTR; \
- } \
- } \
- while (errno == EINTR)
-
-
-
/* Return the first integer greater than or equal to LEN such that
LEN % ALIGN == 0. Return LEN if ALIGN is zero. */
#define ROUND_UP(len, align) \
((align) ? (((len) - 1UL) | ((align) - 1UL)) + 1UL : (len))
-
-#if defined GUILE_USE_64_CALLS && GUILE_USE_64_CALLS && defined(HAVE_STAT64)
-#define CHOOSE_LARGEFILE(foo,foo64) foo64
-#else
-#define CHOOSE_LARGEFILE(foo,foo64) foo
-#endif
-
-/* These names are a bit long, but they make it clear what they represent. */
-#if SCM_HAVE_STRUCT_DIRENT64 == 1
-# define dirent_or_dirent64 CHOOSE_LARGEFILE(dirent,dirent64)
-#else
-# define dirent_or_dirent64 dirent
-#endif
-#define fstat_or_fstat64 CHOOSE_LARGEFILE(fstat,fstat64)
-#define ftruncate_or_ftruncate64 CHOOSE_LARGEFILE(ftruncate,ftruncate64)
-#define lseek_or_lseek64 CHOOSE_LARGEFILE(lseek,lseek64)
-#define lstat_or_lstat64 CHOOSE_LARGEFILE(lstat,lstat64)
-#define off_t_or_off64_t CHOOSE_LARGEFILE(off_t,off64_t)
-#define open_or_open64 CHOOSE_LARGEFILE(open,open64)
-#define readdir_or_readdir64 CHOOSE_LARGEFILE(readdir,readdir64)
-#if SCM_HAVE_READDIR64_R == 1
-# define readdir_r_or_readdir64_r CHOOSE_LARGEFILE(readdir_r,readdir64_r)
-#else
-# define readdir_r_or_readdir64_r readdir_r
-#endif
-#define stat_or_stat64 CHOOSE_LARGEFILE(stat,stat64)
-#define truncate_or_truncate64 CHOOSE_LARGEFILE(truncate,truncate64)
-#define scm_from_off_t_or_off64_t
CHOOSE_LARGEFILE(scm_from_off_t,scm_from_int64)
-#define scm_from_ino_t_or_ino64_t
CHOOSE_LARGEFILE(scm_from_ulong,scm_from_uint64)
-#define scm_from_blkcnt_t_or_blkcnt64_t
CHOOSE_LARGEFILE(scm_from_ulong,scm_from_uint64)
-#define scm_to_off_t_or_off64_t
CHOOSE_LARGEFILE(scm_to_off_t,scm_to_int64)
-
-#if SIZEOF_OFF_T == 4
-# define scm_to_off_t scm_to_int32
-# define scm_from_off_t scm_from_int32
-#elif SIZEOF_OFF_T == 8
-# define scm_to_off_t scm_to_int64
-# define scm_from_off_t scm_from_int64
-#else
-# error sizeof(off_t) is not 4 or 8.
-#endif
-#define scm_to_off64_t scm_to_int64
-#define scm_from_off64_t scm_from_int64
-
-
-
-
#if (defined __GNUC__)
# define SCM_NOINLINE __attribute__ ((__noinline__))
#else
# define SCM_NOINLINE /* noinline */
#endif
-
-
#endif /* SCM__SCM_H */
diff --git a/libguile/filesys.c b/libguile/filesys.c
index f235ebb..5778f65 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -94,6 +94,7 @@
#include "libguile/smob.h"
#include "libguile/srfi-13.h"
#include "libguile/strings.h"
+#include "libguile/syscalls.h"
#include "libguile/validate.h"
#include "libguile/vectors.h"
diff --git a/libguile/fports.c b/libguile/fports.c
index 3f976d4..ad040a3 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -61,6 +61,7 @@
#include "libguile/posix.h"
#include "libguile/read.h"
#include "libguile/strings.h"
+#include "libguile/syscalls.h"
#include "libguile/validate.h"
#if SIZEOF_OFF_T == SIZEOF_INT
diff --git a/libguile/i18n.c b/libguile/i18n.c
index 47179d1..0f8b0ea 100644
--- a/libguile/i18n.c
+++ b/libguile/i18n.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006-2014, 2017 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2014,2017-2018 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -29,6 +29,7 @@
#include "libguile/strings.h"
#include "libguile/chars.h"
#include "libguile/dynwind.h"
+#include "libguile/syscalls.h"
#include "libguile/validate.h"
#include "libguile/values.h"
#include "libguile/threads.h"
diff --git a/libguile/ioext.c b/libguile/ioext.c
index 1528eee..7ef08eb 100644
--- a/libguile/ioext.c
+++ b/libguile/ioext.c
@@ -39,6 +39,7 @@
#include "libguile/ports-internal.h"
#include "libguile/ports.h"
#include "libguile/strings.h"
+#include "libguile/syscalls.h"
#include "libguile/validate.h"
#include "libguile/weak-set.h"
diff --git a/libguile/poll.c b/libguile/poll.c
index 5dae64a..df02ab0 100644
--- a/libguile/poll.c
+++ b/libguile/poll.c
@@ -34,6 +34,7 @@
#include "libguile/extensions.h"
#include "libguile/numbers.h"
#include "libguile/ports-internal.h"
+#include "libguile/syscalls.h"
#include "libguile/validate.h"
#include "libguile/poll.h"
diff --git a/libguile/ports.c b/libguile/ports.c
index 92aea3f..555e48a 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -58,6 +58,7 @@
#include "libguile/ports.h"
#include "libguile/ports-internal.h"
#include "libguile/private-options.h"
+#include "libguile/syscalls.h"
#include "libguile/vectors.h"
#include "libguile/weak-set.h"
#include "libguile/fluids.h"
diff --git a/libguile/posix.c b/libguile/posix.c
index 3e6d50a..e83cfc8 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -74,6 +74,7 @@
#include "libguile/strings.h"
#include "libguile/srfi-13.h"
#include "libguile/srfi-14.h"
+#include "libguile/syscalls.h"
#include "libguile/vectors.h"
#include "libguile/values.h"
diff --git a/libguile/rw.c b/libguile/rw.c
index 3b0c4bd..8387d94 100644
--- a/libguile/rw.c
+++ b/libguile/rw.c
@@ -36,6 +36,7 @@
#include "libguile/validate.h"
#include "libguile/modules.h"
#include "libguile/strports.h"
+#include "libguile/syscalls.h"
#include "libguile/ports-internal.h"
#include <unistd.h>
diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c
index ece81e6..b7773d4 100644
--- a/libguile/scmsigs.c
+++ b/libguile/scmsigs.c
@@ -48,6 +48,7 @@
#include "libguile/feature.h"
#include "libguile/eval.h"
#include "libguile/vectors.h"
+#include "libguile/syscalls.h"
#include "libguile/threads.h"
#include "libguile/validate.h"
diff --git a/libguile/script.c b/libguile/script.c
index f59ad1e..b24d10a 100644
--- a/libguile/script.c
+++ b/libguile/script.c
@@ -78,36 +78,6 @@ scm_cat_path (char *str1, const char *str2, long n)
return str1;
}
-#if 0
-static char *
-scm_try_path (char *path)
-{
- FILE *f;
- /* fprintf(stderr, "Trying %s\n", path);fflush(stderr); */
- if (!path)
- return 0L;
- SCM_SYSCALL (f = fopen (path, "r");
- );
- if (f)
- {
- fclose (f);
- return path;
- }
- free (path);
- return 0L;
-}
-
-static char *
-scm_sep_init_try (char *path, const char *sep, const char *initname)
-{
- if (path)
- path = scm_cat_path (path, sep, 0L);
- if (path)
- path = scm_cat_path (path, initname, 0L);
- return scm_try_path (path);
-}
-#endif
-
#ifndef LINE_INCREMENTORS
#define LINE_INCREMENTORS '\n'
#ifdef MSDOS
diff --git a/libguile/socket.c b/libguile/socket.c
index 13ce514..7f21a59 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -55,6 +55,7 @@
#include "libguile/vectors.h"
#include "libguile/dynwind.h"
#include "libguile/srfi-13.h"
+#include "libguile/syscalls.h"
#include "libguile/validate.h"
#include "libguile/socket.h"
diff --git a/libguile/strports.c b/libguile/strports.c
index 84ca0b2..edd1669 100644
--- a/libguile/strports.c
+++ b/libguile/strports.c
@@ -35,6 +35,7 @@
#include "libguile/ports.h"
#include "libguile/read.h"
#include "libguile/strings.h"
+#include "libguile/syscalls.h"
#include "libguile/modules.h"
#include "libguile/validate.h"
#include "libguile/deprecation.h"
diff --git a/libguile/_scm.h b/libguile/syscalls.h
similarity index 54%
copy from libguile/_scm.h
copy to libguile/syscalls.h
index d68e9c7..13f47d4 100644
--- a/libguile/_scm.h
+++ b/libguile/syscalls.h
@@ -1,7 +1,7 @@
/* classes: h_files */
-#ifndef SCM__SCM_H
-#define SCM__SCM_H
+#ifndef SCM_SYSCALLS_H
+#define SCM_SYSCALLS_H
/* Copyright (C) 1995-1996,2000-2002,2006,2008-2011,2013-2014,2018
* Free Software Foundation, Inc.
@@ -24,69 +24,10 @@
-/**********************************************************************
- This file is Guile's central private header.
-
- When included by other files, this file should preceed any include
- other than __scm.h. See __scm.h for details regarding the purpose of
- and differences between _scm.h and __scm.h.
- **********************************************************************/
-
-#if defined(__ia64) && !defined(__ia64__)
-# define __ia64__
-#endif
-
#if HAVE_CONFIG_H
# include <config.h>
#endif
-/* The size of `scm_t_bits'. */
-#define SIZEOF_SCM_T_BITS SIZEOF_VOID_P
-
-/* Undefine HAVE_STRUCT_TIMESPEC, because the libguile C code doesn't
- need it anymore, and because on MinGW:
-
- - the definition of struct timespec is provided (if at all) by
- pthread.h
-
- - pthread.h will _not_ define struct timespec if
- HAVE_STRUCT_TIMESPEC is 1, because then it thinks that it doesn't
- need to.
-
- The libguile C code doesn't need HAVE_STRUCT_TIMESPEC anymore,
- because the value of HAVE_STRUCT_TIMESPEC has already been
- incorporated in how scm_t_timespec is defined (in scmconfig.h), and
- the rest of the libguile C code now just uses scm_t_timespec.
- */
-#ifdef HAVE_STRUCT_TIMESPEC
-#undef HAVE_STRUCT_TIMESPEC
-#endif
-
-#include <errno.h>
-#include <verify.h>
-#include <alignof.h>
-#include "libguile/__scm.h"
-
-/* Include headers for those files central to the implementation. The
- rest should be explicitly #included in the C files themselves. */
-#include "libguile/error.h" /* Everyone signals errors. */
-#include "libguile/print.h" /* Everyone needs to print. */
-#include "libguile/pairs.h" /* Everyone conses. */
-#include "libguile/list.h" /* Everyone makes lists. */
-#include "libguile/gc.h" /* Everyone allocates. */
-#include "libguile/gsubr.h" /* Everyone defines global functions. */
-#include "libguile/procs.h" /* Same. */
-#include "libguile/numbers.h" /* Everyone deals with fixnums. */
-#include "libguile/symbols.h" /* For length, chars, values, miscellany. */
-#include "libguile/boolean.h" /* Everyone wonders about the truth. */
-#include "libguile/threads.h" /* You are not alone. */
-#include "libguile/snarf.h" /* Everyone snarfs. */
-#include "libguile/foreign.h" /* Snarfing needs the foreign data structures.
*/
-#include "libguile/programs.h" /* ... and program.h. */
-#include "libguile/variable.h"
-#include "libguile/modules.h"
-#include "libguile/inline.h"
-#include "libguile/strings.h"
/* ASYNC_TICK after finding EINTR in order to handle pending signals, if
any. See comment in scm_syserror. */
@@ -106,12 +47,6 @@
-/* Return the first integer greater than or equal to LEN such that
- LEN % ALIGN == 0. Return LEN if ALIGN is zero. */
-#define ROUND_UP(len, align) \
- ((align) ? (((len) - 1UL) | ((align) - 1UL)) + 1UL : (len))
-
-
#if defined GUILE_USE_64_CALLS && GUILE_USE_64_CALLS && defined(HAVE_STAT64)
#define CHOOSE_LARGEFILE(foo,foo64) foo64
#else
@@ -156,18 +91,7 @@
#define scm_from_off64_t scm_from_int64
-
-
-#if (defined __GNUC__)
-# define SCM_NOINLINE __attribute__ ((__noinline__))
-#else
-# define SCM_NOINLINE /* noinline */
-#endif
-
-
-
-
-#endif /* SCM__SCM_H */
+#endif /* SCM_SYSCALLS_H */
/*
Local Variables:
- [Guile-commits] branch master updated (f84ce54 -> 1234bb1), Andy Wingo, 2018/06/20
- [Guile-commits] 02/86: More _scm.h refactoring, Andy Wingo, 2018/06/20
- [Guile-commits] 06/86: Remove _scm.h inclusion of config.h, Andy Wingo, 2018/06/20
- [Guile-commits] 09/86: Remove alignof.h inclusion from _scm.h, Andy Wingo, 2018/06/20
- [Guile-commits] 03/86: Remove _scm hack to undefine HAVE_STRUCT_TIMESPEC, Andy Wingo, 2018/06/20
- [Guile-commits] 04/86: Refactor regarding internal detection of ia64, Andy Wingo, 2018/06/20
- [Guile-commits] 08/86: Remove _scm.h verify.h inclusion, Andy Wingo, 2018/06/20
- [Guile-commits] 07/86: Remove errno.h include from _scm.h., Andy Wingo, 2018/06/20
- [Guile-commits] 11/86: Require C99 to build Guile, Andy Wingo, 2018/06/20
- [Guile-commits] 01/86: Move syscall-related private defines to their own header,
Andy Wingo <=
- [Guile-commits] 19/86: Remove public SCM_VALIDATE_NIM, Andy Wingo, 2018/06/20
- [Guile-commits] 17/86: Remove unused macros, Andy Wingo, 2018/06/20
- [Guile-commits] 10/86: Assume that if we have GCC, we have GCC >= 3.0., Andy Wingo, 2018/06/20
- [Guile-commits] 05/86: Inline definition of SIZEOF_SCM_T_BITS, Andy Wingo, 2018/06/20
- [Guile-commits] 13/86: Remove _scm.h print.h include, Andy Wingo, 2018/06/20
- [Guile-commits] 15/86: Move number validators to numbers.h., Andy Wingo, 2018/06/20
- [Guile-commits] 16/86: Move more number validators to numbers.h., Andy Wingo, 2018/06/20
- [Guile-commits] 24/86: Deprecate libguile/validate.h, Andy Wingo, 2018/06/20
- [Guile-commits] 14/86: Move core validate macros to error.h, Andy Wingo, 2018/06/20
- [Guile-commits] 18/86: Move list validators to list.h, Andy Wingo, 2018/06/20