global tagging
svn: r17535
This commit is contained in:
parent
e9165339b8
commit
dc9f3227c5
|
@ -223,7 +223,20 @@ typedef struct Thread_Local_Variables {
|
|||
int builtin_ref_counter_;
|
||||
int env_uid_counter_;
|
||||
int scheme_overflow_count_;
|
||||
Scheme_Object *original_pwd_;
|
||||
long scheme_hash_request_count_;
|
||||
long scheme_hash_iteration_count_;
|
||||
Scheme_Env *initial_modules_env_;
|
||||
int num_initial_modules_;
|
||||
Scheme_Object **initial_modules_;
|
||||
Scheme_Object *initial_renames_;
|
||||
Scheme_Bucket_Table *initial_toplevel_;
|
||||
int generate_lifts_count_;
|
||||
int special_is_ok_;
|
||||
int scheme_force_port_closed_;
|
||||
int fd_reserved_;
|
||||
int the_fd_;
|
||||
/*KPLAKE1*/
|
||||
} Thread_Local_Variables;
|
||||
|
||||
#if defined(IMPLEMENT_THREAD_LOCAL_VIA_PTHREADS)
|
||||
|
@ -430,7 +443,20 @@ XFORM_GC_VARIABLE_STACK_THROUGH_THREAD_LOCAL;
|
|||
#define builtin_ref_counter XOA (scheme_get_thread_local_variables()->builtin_ref_counter_)
|
||||
#define env_uid_counter XOA (scheme_get_thread_local_variables()->env_uid_counter_)
|
||||
#define scheme_overflow_count XOA (scheme_get_thread_local_variables()->scheme_overflow_count_)
|
||||
#define original_pwd XOA (scheme_get_thread_local_variables()->original_pwd_)
|
||||
#define scheme_hash_request_count XOA (scheme_get_thread_local_variables()->scheme_hash_request_count_)
|
||||
#define scheme_hash_iteration_count XOA (scheme_get_thread_local_variables()->scheme_hash_iteration_count_)
|
||||
#define initial_modules_env XOA (scheme_get_thread_local_variables()->initial_modules_env_)
|
||||
#define num_initial_modules XOA (scheme_get_thread_local_variables()->num_initial_modules_)
|
||||
#define initial_modules XOA (scheme_get_thread_local_variables()->initial_modules_)
|
||||
#define initial_renames XOA (scheme_get_thread_local_variables()->initial_renames_)
|
||||
#define initial_toplevel XOA (scheme_get_thread_local_variables()->initial_toplevel_)
|
||||
#define generate_lifts_count XOA (scheme_get_thread_local_variables()->generate_lifts_count_)
|
||||
#define special_is_ok XOA (scheme_get_thread_local_variables()->special_is_ok_)
|
||||
#define scheme_force_port_closed XOA (scheme_get_thread_local_variables()->scheme_force_port_closed_)
|
||||
#define fd_reserved XOA (scheme_get_thread_local_variables()->fd_reserved_)
|
||||
#define the_fd XOA (scheme_get_thread_local_variables()->the_fd_)
|
||||
/*KPLAKE2*/
|
||||
|
||||
/* **************************************** */
|
||||
|
||||
|
|
|
@ -487,6 +487,7 @@ static Scheme_Env *place_instance_init_post_kernel(int initial_main_os_thread) {
|
|||
scheme_init_sema_places();
|
||||
scheme_init_gmp_places();
|
||||
scheme_alloc_global_fdset();
|
||||
scheme_init_file_places();
|
||||
|
||||
env = scheme_make_empty_env();
|
||||
scheme_set_param(scheme_current_config(), MZCONFIG_ENV, (Scheme_Object *)env);
|
||||
|
|
|
@ -228,11 +228,31 @@ READ_ONLY static Scheme_Object *init_dir_symbol, *init_file_symbol, *sys_dir_sym
|
|||
READ_ONLY static Scheme_Object *exec_file_symbol, *run_file_symbol, *collects_dir_symbol;
|
||||
READ_ONLY static Scheme_Object *pref_file_symbol, *orig_dir_symbol, *addon_dir_symbol;
|
||||
|
||||
SHARED_OK static Scheme_Object *exec_cmd, *run_cmd;
|
||||
SHARED_OK static Scheme_Object *collects_path, *original_pwd = NULL, *addon_dir = NULL;
|
||||
SHARED_OK static Scheme_Object *exec_cmd;
|
||||
SHARED_OK static Scheme_Object *run_cmd;
|
||||
SHARED_OK static Scheme_Object *collects_path;
|
||||
THREAD_LOCAL_DECL(static Scheme_Object *original_pwd);
|
||||
SHARED_OK static Scheme_Object *addon_dir;
|
||||
|
||||
#endif
|
||||
READ_ONLY static Scheme_Object *windows_symbol, *unix_symbol;
|
||||
|
||||
#if defined(UNIX_FILE_SYSTEM) && !defined(NO_UNIX_USERS)
|
||||
typedef struct {
|
||||
gid_t gid;
|
||||
char set, in;
|
||||
} Group_Mem_Cache;
|
||||
|
||||
# define GROUP_CACHE_SIZE 10
|
||||
FIXME_LATER static Group_Mem_Cache group_mem_cache[GROUP_CACHE_SIZE];
|
||||
|
||||
SHARED_OK static int have_user_ids = 0;
|
||||
SHARED_OK static uid_t uid;
|
||||
SHARED_OK static uid_t euid;
|
||||
SHARED_OK static gid_t gid;
|
||||
SHARED_OK static gid_t egid;
|
||||
#endif
|
||||
|
||||
void scheme_init_file(Scheme_Env *env)
|
||||
{
|
||||
REGISTER_SO(up_symbol);
|
||||
|
@ -529,6 +549,13 @@ void scheme_init_file(Scheme_Env *env)
|
|||
env);
|
||||
}
|
||||
|
||||
void scheme_init_file_places()
|
||||
{
|
||||
#ifndef NO_FILE_SYSTEM_UTILS
|
||||
REGISTER_SO(original_pwd);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
/* paths */
|
||||
/**********************************************************************/
|
||||
|
@ -5281,12 +5308,6 @@ static Scheme_Object *file_modify_seconds(int argc, Scheme_Object **argv)
|
|||
}
|
||||
|
||||
#if defined(UNIX_FILE_SYSTEM) && !defined(NO_UNIX_USERS)
|
||||
# define GROUP_CACHE_SIZE 10
|
||||
typedef struct {
|
||||
gid_t gid;
|
||||
char set, in;
|
||||
} Group_Mem_Cache;
|
||||
static Group_Mem_Cache group_mem_cache[GROUP_CACHE_SIZE];
|
||||
static int user_in_group(uid_t uid, gid_t gid)
|
||||
{
|
||||
struct group *g;
|
||||
|
@ -5323,10 +5344,6 @@ static int user_in_group(uid_t uid, gid_t gid)
|
|||
|
||||
return in;
|
||||
}
|
||||
|
||||
static int have_user_ids = 0;
|
||||
static uid_t uid, euid;
|
||||
static gid_t gid, egid;
|
||||
#endif
|
||||
|
||||
static Scheme_Object *file_or_dir_permissions(int argc, Scheme_Object *argv[])
|
||||
|
@ -5690,8 +5707,7 @@ enum {
|
|||
Scheme_Object *scheme_get_run_cmd(void)
|
||||
{
|
||||
if (!run_cmd) {
|
||||
REGISTER_SO(run_cmd);
|
||||
run_cmd = scheme_make_path("mzscheme");
|
||||
return scheme_make_path("mzscheme");
|
||||
}
|
||||
return run_cmd;
|
||||
}
|
||||
|
@ -5721,16 +5737,14 @@ find_system_path(int argc, Scheme_Object **argv)
|
|||
which = id_sys_dir;
|
||||
else if (argv[0] == exec_file_symbol) {
|
||||
if (!exec_cmd) {
|
||||
REGISTER_SO(exec_cmd);
|
||||
exec_cmd = scheme_make_path("mzscheme");
|
||||
return scheme_make_path("mzscheme");
|
||||
}
|
||||
return exec_cmd;
|
||||
} else if (argv[0] == run_file_symbol) {
|
||||
return scheme_get_run_cmd();
|
||||
} else if (argv[0] == collects_dir_symbol) {
|
||||
if (!collects_path) {
|
||||
REGISTER_SO(collects_path);
|
||||
collects_path = scheme_make_path("collects");
|
||||
return scheme_make_path("collects");
|
||||
}
|
||||
return collects_path;
|
||||
} else if (argv[0] == orig_dir_symbol) {
|
||||
|
@ -5980,6 +5994,7 @@ find_system_path(int argc, Scheme_Object **argv)
|
|||
|
||||
#endif
|
||||
|
||||
/* should only called from main */
|
||||
Scheme_Object *scheme_set_exec_cmd(char *s)
|
||||
{
|
||||
#ifndef NO_FILE_SYSTEM_UTILS
|
||||
|
@ -5992,6 +6007,7 @@ Scheme_Object *scheme_set_exec_cmd(char *s)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* should only called from main */
|
||||
Scheme_Object *scheme_set_run_cmd(char *s)
|
||||
{
|
||||
#ifndef NO_FILE_SYSTEM_UTILS
|
||||
|
@ -6012,20 +6028,22 @@ char *scheme_get_exec_path(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* should only called from main */
|
||||
void scheme_set_collects_path(Scheme_Object *p)
|
||||
{
|
||||
REGISTER_SO(collects_path);
|
||||
if (!collects_path) {
|
||||
REGISTER_SO(collects_path);
|
||||
}
|
||||
collects_path = p;
|
||||
}
|
||||
|
||||
|
||||
void scheme_set_original_dir(Scheme_Object *d)
|
||||
{
|
||||
if (!original_pwd) {
|
||||
REGISTER_SO(original_pwd);
|
||||
}
|
||||
original_pwd = d;
|
||||
}
|
||||
|
||||
/* should only called from main */
|
||||
void scheme_set_addon_dir(Scheme_Object *p)
|
||||
{
|
||||
if (!addon_dir) {
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
#include <math.h>
|
||||
#include "../gc2/gc2_obj.h"
|
||||
|
||||
long scheme_hash_request_count;
|
||||
long scheme_hash_iteration_count;
|
||||
THREAD_LOCAL_DECL(long scheme_hash_request_count);
|
||||
THREAD_LOCAL_DECL(long scheme_hash_iteration_count);
|
||||
|
||||
READ_ONLY static Scheme_Object GONE[1];
|
||||
|
||||
|
@ -40,7 +40,11 @@ static void register_traversers(void);
|
|||
#endif
|
||||
|
||||
#ifdef MZ_PRECISE_GC
|
||||
static long keygen;
|
||||
/* keygen race conditions below are ok, because keygen is randomness used
|
||||
to create a hashkey. Setting a hashkey on a Scheme_Object however, may
|
||||
lead to race conditions */
|
||||
|
||||
FIXME_LATER static long keygen;
|
||||
XFORM_NONGCING static MZ_INLINE
|
||||
long PTR_TO_LONG(Scheme_Object *o)
|
||||
{
|
||||
|
@ -53,7 +57,8 @@ long PTR_TO_LONG(Scheme_Object *o)
|
|||
v = o->keyex;
|
||||
|
||||
if (!(v & 0xFFFC)) {
|
||||
v |= (short)keygen;
|
||||
long local_keygen = keygen;
|
||||
v |= (short)local_keygen;
|
||||
#ifdef OBJHEAD_HAS_HASH_BITS
|
||||
/* In 3m mode, we only have 14 bits of hash code in the
|
||||
Scheme_Object header. But the GC-level object header has some
|
||||
|
@ -62,7 +67,7 @@ long PTR_TO_LONG(Scheme_Object *o)
|
|||
objects, so we use 1 of our 14 bits to indicate whether the
|
||||
other bit are present. */
|
||||
if (GC_is_allocated(o)) {
|
||||
OBJHEAD_HASH_BITS(o) = (keygen >> 16);
|
||||
OBJHEAD_HASH_BITS(o) = (local_keygen >> 16);
|
||||
v |= 0x4000;
|
||||
} else
|
||||
v &= ~0x4000;
|
||||
|
|
|
@ -193,17 +193,18 @@ READ_ONLY static Scheme_Object *letrec_syntaxes_stx;
|
|||
READ_ONLY static Scheme_Object *var_ref_stx;
|
||||
READ_ONLY static Scheme_Object *expression_stx;
|
||||
|
||||
READ_ONLY static Scheme_Env *initial_modules_env;
|
||||
READ_ONLY static int num_initial_modules;
|
||||
READ_ONLY static Scheme_Object **initial_modules;
|
||||
READ_ONLY static Scheme_Object *initial_renames;
|
||||
READ_ONLY static Scheme_Bucket_Table *initial_toplevel;
|
||||
|
||||
READ_ONLY static Scheme_Object *empty_self_modidx;
|
||||
READ_ONLY static Scheme_Object *empty_self_modname;
|
||||
|
||||
THREAD_LOCAL_DECL(static Scheme_Bucket_Table *starts_table);
|
||||
|
||||
/* FIXME eventually theses initial objects should be shared, but work required */
|
||||
THREAD_LOCAL_DECL(static Scheme_Env *initial_modules_env);
|
||||
THREAD_LOCAL_DECL(static int num_initial_modules);
|
||||
THREAD_LOCAL_DECL(static Scheme_Object **initial_modules);
|
||||
THREAD_LOCAL_DECL(static Scheme_Object *initial_renames);
|
||||
THREAD_LOCAL_DECL(static Scheme_Bucket_Table *initial_toplevel);
|
||||
|
||||
/* caches */
|
||||
THREAD_LOCAL_DECL(static Scheme_Modidx *modidx_caching_chain);
|
||||
THREAD_LOCAL_DECL(static Scheme_Object *global_shift_cache);
|
||||
|
@ -322,6 +323,17 @@ void scheme_init_module(Scheme_Env *env)
|
|||
mzrt_mutex_create(&modpath_table_mutex);
|
||||
#endif
|
||||
|
||||
if (!empty_self_modidx) {
|
||||
REGISTER_SO(empty_self_modidx);
|
||||
REGISTER_SO(empty_self_modname);
|
||||
empty_self_modidx = scheme_make_modidx(scheme_false, scheme_false, scheme_false);
|
||||
(void)scheme_hash_key(empty_self_modidx);
|
||||
empty_self_modname = scheme_make_symbol("expanded module"); /* uninterned */
|
||||
empty_self_modname = scheme_intern_resolved_module_path(empty_self_modname);
|
||||
}
|
||||
|
||||
|
||||
|
||||
REGISTER_SO(quote_symbol);
|
||||
REGISTER_SO(file_symbol);
|
||||
REGISTER_SO(lib_symbol);
|
||||
|
@ -672,7 +684,7 @@ void scheme_save_initial_module_set(Scheme_Env *env)
|
|||
{
|
||||
int i, c, count;
|
||||
Scheme_Hash_Table *ht;
|
||||
|
||||
|
||||
if (!initial_modules_env) {
|
||||
REGISTER_SO(initial_modules_env);
|
||||
}
|
||||
|
@ -5671,15 +5683,6 @@ static Scheme_Object *do_module(Scheme_Object *form, Scheme_Comp_Env *env,
|
|||
|
||||
fm = scheme_stx_property(fm, module_name_symbol, SCHEME_PTR_VAL(m->modname));
|
||||
|
||||
if (!empty_self_modidx) {
|
||||
REGISTER_SO(empty_self_modidx);
|
||||
REGISTER_SO(empty_self_modname);
|
||||
empty_self_modidx = scheme_make_modidx(scheme_false, scheme_false, scheme_false);
|
||||
(void)scheme_hash_key(empty_self_modidx);
|
||||
empty_self_modname = scheme_make_symbol("expanded module"); /* uninterned */
|
||||
empty_self_modname = scheme_intern_resolved_module_path(empty_self_modname);
|
||||
}
|
||||
|
||||
/* phase shift to replace self_modidx of previous expansion (if any): */
|
||||
fm = scheme_stx_phase_shift(fm, 0, empty_self_modidx, self_modidx, NULL);
|
||||
|
||||
|
|
|
@ -1216,7 +1216,6 @@ static void tcp_close_input(Scheme_Input_Port *port)
|
|||
closesocket(data->tcp);
|
||||
#endif
|
||||
|
||||
--scheme_file_open_count;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1415,7 +1414,6 @@ static void tcp_close_output(Scheme_Output_Port *port)
|
|||
closesocket(data->tcp);
|
||||
#endif
|
||||
|
||||
--scheme_file_open_count;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1504,7 +1502,6 @@ static void closesocket_w_decrement(Close_Socket_Data *csd)
|
|||
if (csd->src_addr)
|
||||
mz_freeaddrinfo(csd->src_addr);
|
||||
mz_freeaddrinfo(csd->dest_addr);
|
||||
--scheme_file_open_count;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1621,7 +1618,6 @@ static Scheme_Object *tcp_connect(int argc, Scheme_Object *argv[])
|
|||
errno = status;
|
||||
#endif
|
||||
|
||||
scheme_file_open_count++;
|
||||
|
||||
if (inprogress) {
|
||||
tcp_t *sptr;
|
||||
|
@ -1681,7 +1677,6 @@ static Scheme_Object *tcp_connect(int argc, Scheme_Object *argv[])
|
|||
} else {
|
||||
errid = errno;
|
||||
closesocket(s);
|
||||
--scheme_file_open_count;
|
||||
errpart = 6;
|
||||
}
|
||||
} else {
|
||||
|
@ -1923,7 +1918,6 @@ tcp_listen(int argc, Scheme_Object *argv[])
|
|||
}
|
||||
l->s[pos++] = s;
|
||||
|
||||
scheme_file_open_count++;
|
||||
REGISTER_SOCKET(s);
|
||||
|
||||
if (pos == count) {
|
||||
|
@ -1961,7 +1955,6 @@ tcp_listen(int argc, Scheme_Object *argv[])
|
|||
s = l->s[i];
|
||||
UNREGISTER_SOCKET(s);
|
||||
closesocket(s);
|
||||
--scheme_file_open_count;
|
||||
}
|
||||
|
||||
mz_freeaddrinfo(tcp_listen_addr);
|
||||
|
@ -2004,7 +1997,6 @@ static int stop_listener(Scheme_Object *o)
|
|||
UNREGISTER_SOCKET(s);
|
||||
closesocket(s);
|
||||
listener->s[i] = INVALID_SOCKET;
|
||||
--scheme_file_open_count;
|
||||
}
|
||||
scheme_remove_managed(((listener_t *)o)->mref, o);
|
||||
}
|
||||
|
@ -2142,7 +2134,6 @@ do_tcp_accept(int argc, Scheme_Object *argv[], Scheme_Object *cust, char **_fail
|
|||
v[0] = make_tcp_input_port(tcp, "tcp-accepted", cust);
|
||||
v[1] = make_tcp_output_port(tcp, "tcp-accepted", cust);
|
||||
|
||||
scheme_file_open_count++;
|
||||
REGISTER_SOCKET(s);
|
||||
|
||||
return scheme_values(2, v);
|
||||
|
@ -2498,7 +2489,6 @@ void scheme_socket_to_ports(long s, const char *name, int takeover,
|
|||
*_outp = v;
|
||||
|
||||
if (takeover) {
|
||||
scheme_file_open_count++;
|
||||
REGISTER_SOCKET(s);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -310,14 +310,16 @@ HOOK_SHARED_OK Scheme_Object *(*scheme_make_stdin)(void) = NULL;
|
|||
HOOK_SHARED_OK Scheme_Object *(*scheme_make_stdout)(void) = NULL;
|
||||
HOOK_SHARED_OK Scheme_Object *(*scheme_make_stderr)(void) = NULL;
|
||||
|
||||
int scheme_file_open_count;
|
||||
|
||||
MZ_DLLSPEC int scheme_binary_mode_stdio;
|
||||
void scheme_set_binary_mode_stdio(int v) { scheme_binary_mode_stdio = v; }
|
||||
|
||||
static int special_is_ok;
|
||||
THREAD_LOCAL_DECL(static int special_is_ok);
|
||||
|
||||
/* locals */
|
||||
#ifdef USE_FD_PORTS
|
||||
THREAD_LOCAL_DECL(static int fd_reserved);
|
||||
THREAD_LOCAL_DECL(static int the_fd);
|
||||
#endif
|
||||
#ifdef MZ_FDS
|
||||
READ_ONLY static Scheme_Object *fd_input_port_type;
|
||||
#endif
|
||||
|
@ -342,10 +344,10 @@ READ_ONLY Scheme_Object *scheme_pipe_write_port_type;
|
|||
READ_ONLY Scheme_Object *scheme_null_output_port_type;
|
||||
READ_ONLY Scheme_Object *scheme_redirect_output_port_type;
|
||||
|
||||
int scheme_force_port_closed;
|
||||
THREAD_LOCAL_DECL(int scheme_force_port_closed);
|
||||
|
||||
static int flush_out;
|
||||
static int flush_err;
|
||||
SHARED_OK static int flush_out;
|
||||
SHARED_OK static int flush_err;
|
||||
|
||||
THREAD_LOCAL_DECL(static Scheme_Custodian *new_port_cust); /* back-door argument */
|
||||
|
||||
|
@ -685,7 +687,8 @@ void scheme_alloc_global_fdset() {
|
|||
}
|
||||
|
||||
#ifdef USE_DYNAMIC_FDSET_SIZE
|
||||
static int dynamic_fd_size;
|
||||
/* initialized early via scheme_alloc_global_fdset */
|
||||
SHARED_OK static int dynamic_fd_size;
|
||||
|
||||
# define STORED_ACTUAL_FDSET_LIMIT
|
||||
# define FDSET_LIMIT(fd) (*(int *)((char *)fd XFORM_OK_PLUS dynamic_fd_size))
|
||||
|
@ -698,11 +701,11 @@ void *scheme_alloc_fdset_array(int count, int permanent)
|
|||
ok with OS X use from default_sleep() */
|
||||
|
||||
if (!dynamic_fd_size) {
|
||||
#ifdef USE_ULIMIT
|
||||
# ifdef USE_ULIMIT
|
||||
dynamic_fd_size = ulimit(4, 0);
|
||||
#else
|
||||
# else
|
||||
dynamic_fd_size = getdtablesize();
|
||||
#endif
|
||||
# endif
|
||||
/* divide by bits-per-byte: */
|
||||
dynamic_fd_size = (dynamic_fd_size + 7) >> 3;
|
||||
/* word-align: */
|
||||
|
@ -733,17 +736,17 @@ void scheme_fdzero(void *fd)
|
|||
|
||||
#else
|
||||
|
||||
#if defined(WIN32_FD_HANDLES)
|
||||
# define fdset_type win_extended_fd_set
|
||||
#else
|
||||
# define fdset_type fd_set
|
||||
#endif
|
||||
# if defined(WIN32_FD_HANDLES)
|
||||
# define fdset_type win_extended_fd_set
|
||||
# else
|
||||
# define fdset_type fd_set
|
||||
# endif
|
||||
|
||||
void *scheme_alloc_fdset_array(int count, int permanent)
|
||||
{
|
||||
#if defined(FILES_HAVE_FDS) || defined(USE_SOCKETS_TCP) || defined(WIN32_FD_HANDLES)
|
||||
# if defined(FILES_HAVE_FDS) || defined(USE_SOCKETS_TCP) || defined(WIN32_FD_HANDLES)
|
||||
void *fdarray;
|
||||
# if defined(WIN32_FD_HANDLES)
|
||||
# if defined(WIN32_FD_HANDLES)
|
||||
if (count) {
|
||||
fdarray = scheme_malloc_allow_interior(count * sizeof(fdset_type));
|
||||
if (permanent)
|
||||
|
@ -752,19 +755,19 @@ void *scheme_alloc_fdset_array(int count, int permanent)
|
|||
scheme_init_fdset_array(fdarray, count);
|
||||
} else
|
||||
fdarray = NULL;
|
||||
# else
|
||||
# else
|
||||
if (permanent)
|
||||
fdarray = scheme_malloc_eternal(count * sizeof(fdset_type));
|
||||
else
|
||||
fdarray = scheme_malloc_atomic(count * sizeof(fdset_type));
|
||||
# endif
|
||||
# endif
|
||||
return fdarray;
|
||||
#else
|
||||
# else
|
||||
return NULL;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
#if defined(WIN32_FD_HANDLES)
|
||||
# if defined(WIN32_FD_HANDLES)
|
||||
static void reset_wait_array(win_extended_fd_set *efd)
|
||||
{
|
||||
/* Allocate an array that may be big enough to hold all events
|
||||
|
@ -775,11 +778,11 @@ static void reset_wait_array(win_extended_fd_set *efd)
|
|||
wa = MALLOC_N_ATOMIC(HANDLE, sz);
|
||||
efd->wait_array = wa;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
void *scheme_init_fdset_array(void *fdarray, int count)
|
||||
{
|
||||
#if defined(WIN32_FD_HANDLES)
|
||||
# if defined(WIN32_FD_HANDLES)
|
||||
if (count) {
|
||||
int i;
|
||||
win_extended_fd_set *fd;
|
||||
|
@ -796,28 +799,28 @@ void *scheme_init_fdset_array(void *fdarray, int count)
|
|||
reset_wait_array(fdarray);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
return fdarray;
|
||||
}
|
||||
|
||||
void *scheme_get_fdset(void *fdarray, int pos)
|
||||
{
|
||||
#if defined(FILES_HAVE_FDS) || defined(USE_SOCKETS_TCP) || defined(WIN32_FD_HANDLES)
|
||||
# if defined(FILES_HAVE_FDS) || defined(USE_SOCKETS_TCP) || defined(WIN32_FD_HANDLES)
|
||||
return ((fdset_type *)fdarray) + pos;
|
||||
#else
|
||||
# else
|
||||
return NULL;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
void scheme_fdzero(void *fd)
|
||||
{
|
||||
#if defined(WIN32_FD_HANDLES)
|
||||
# if defined(WIN32_FD_HANDLES)
|
||||
scheme_init_fdset_array(fd, 1);
|
||||
#else
|
||||
# if defined(FILES_HAVE_FDS) || defined(USE_SOCKETS_TCP)
|
||||
# else
|
||||
# if defined(FILES_HAVE_FDS) || defined(USE_SOCKETS_TCP)
|
||||
FD_ZERO((fd_set *)fd);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -3887,7 +3890,6 @@ scheme_do_open_input_file(char *name, int offset, int argc, Scheme_Object *argv[
|
|||
return NULL;
|
||||
} else {
|
||||
regfile = S_ISREG(buf.st_mode);
|
||||
scheme_file_open_count++;
|
||||
result = make_fd_input_port(fd, scheme_make_path(filename), regfile, 0, NULL, internal);
|
||||
}
|
||||
}
|
||||
|
@ -3927,7 +3929,6 @@ scheme_do_open_input_file(char *name, int offset, int argc, Scheme_Object *argv[
|
|||
filename_exn(name, "cannot open input file", filename, errno);
|
||||
return NULL;
|
||||
}
|
||||
scheme_file_open_count++;
|
||||
|
||||
result = scheme_make_named_file_input_port(fp, scheme_make_path(filename));
|
||||
# endif
|
||||
|
@ -4118,7 +4119,6 @@ scheme_do_open_output_file(char *name, int offset, int argc, Scheme_Object *argv
|
|||
} while ((ok == -1) && (errno == EINTR));
|
||||
|
||||
regfile = S_ISREG(buf.st_mode);
|
||||
scheme_file_open_count++;
|
||||
return make_fd_output_port(fd, scheme_make_path(filename), regfile, 0, and_read, -1);
|
||||
#else
|
||||
# ifdef WINDOWS_FILE_HANDLES
|
||||
|
@ -4204,7 +4204,6 @@ scheme_do_open_output_file(char *name, int offset, int argc, Scheme_Object *argv
|
|||
SetEndOfFile(fd);
|
||||
}
|
||||
|
||||
scheme_file_open_count++;
|
||||
return make_fd_output_port((int)fd, scheme_make_path(filename), regfile, mode[1] == 't', and_read, -1);
|
||||
# else
|
||||
if (scheme_directory_exists(filename)) {
|
||||
|
@ -4264,7 +4263,6 @@ scheme_do_open_output_file(char *name, int offset, int argc, Scheme_Object *argv
|
|||
if (!fp)
|
||||
filename_exn(name, "cannot open output file", filename, errno);
|
||||
}
|
||||
scheme_file_open_count++;
|
||||
|
||||
return scheme_make_file_output_port(fp);
|
||||
# endif
|
||||
|
@ -4726,7 +4724,6 @@ file_close_input(Scheme_Input_Port *port)
|
|||
fip = (Scheme_Input_File *)port->port_data;
|
||||
|
||||
fclose(fip->f);
|
||||
--scheme_file_open_count;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -5257,7 +5254,6 @@ fd_close_input(Scheme_Input_Port *port)
|
|||
rc = dec_refcount(fip->refcount);
|
||||
if (!rc) {
|
||||
CloseHandle((HANDLE)fip->fd);
|
||||
--scheme_file_open_count;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -5269,7 +5265,6 @@ fd_close_input(Scheme_Input_Port *port)
|
|||
do {
|
||||
cr = close(fip->fd);
|
||||
} while ((cr == -1) && (errno == EINTR));
|
||||
--scheme_file_open_count;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -5776,7 +5771,6 @@ file_close_output(Scheme_Output_Port *port)
|
|||
FILE *fp = fop->f;
|
||||
|
||||
fclose(fp);
|
||||
--scheme_file_open_count;
|
||||
}
|
||||
|
||||
Scheme_Object *
|
||||
|
@ -6513,7 +6507,6 @@ fd_close_output(Scheme_Output_Port *port)
|
|||
rc = dec_refcount(fop->refcount);
|
||||
if (!rc) {
|
||||
CloseHandle((HANDLE)fop->fd);
|
||||
--scheme_file_open_count;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -6526,7 +6519,6 @@ fd_close_output(Scheme_Output_Port *port)
|
|||
do {
|
||||
cr = close(fop->fd);
|
||||
} while ((cr == -1) && (errno == EINTR));
|
||||
--scheme_file_open_count;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -7855,19 +7847,16 @@ static Scheme_Object *subprocess(int c, Scheme_Object *args[])
|
|||
if (!inport) {
|
||||
mzCLOSE_PIPE_END(to_subprocess[0]);
|
||||
out = NULL;
|
||||
scheme_file_open_count += 1;
|
||||
} else
|
||||
out = scheme_false;
|
||||
if (!outport) {
|
||||
mzCLOSE_PIPE_END(from_subprocess[1]);
|
||||
in = NULL;
|
||||
scheme_file_open_count += 1;
|
||||
} else
|
||||
in = scheme_false;
|
||||
if (!errport) {
|
||||
mzCLOSE_PIPE_END(err_subprocess[1]);
|
||||
err = NULL;
|
||||
scheme_file_open_count += 1;
|
||||
} else
|
||||
err = scheme_false;
|
||||
|
||||
|
@ -8089,10 +8078,6 @@ static Scheme_Object *sch_shell_execute(int c, Scheme_Object *argv[])
|
|||
/* We don't want on-demand loading of code to fail because we run out of
|
||||
file descriptors. So, keep one in reserve. */
|
||||
|
||||
#ifdef USE_FD_PORTS
|
||||
static int fd_reserved, the_fd;
|
||||
#endif
|
||||
|
||||
void scheme_reserve_file_descriptor(void)
|
||||
{
|
||||
#ifdef USE_FD_PORTS
|
||||
|
|
|
@ -254,6 +254,7 @@ void scheme_init_sema_places(void);
|
|||
void scheme_init_gmp_places(void);
|
||||
void scheme_init_print_global_constants(void);
|
||||
void scheme_init_logger(void);
|
||||
void scheme_init_file_places(void);
|
||||
Scheme_Logger *scheme_get_main_logger(void);
|
||||
void scheme_init_logger_config(void);
|
||||
|
||||
|
@ -3139,7 +3140,6 @@ extern char *scheme_convert_from_wchar(const wchar_t *ws);
|
|||
#endif
|
||||
|
||||
THREAD_LOCAL_DECL(extern int scheme_active_but_sleeping);
|
||||
extern int scheme_file_open_count;
|
||||
|
||||
typedef struct Scheme_Indexed_String {
|
||||
MZTAG_IF_REQUIRED
|
||||
|
@ -3175,7 +3175,7 @@ extern Scheme_Object *scheme_tcp_input_port_type;
|
|||
extern Scheme_Object *scheme_tcp_output_port_type;
|
||||
#endif
|
||||
|
||||
extern int scheme_force_port_closed;
|
||||
THREAD_LOCAL_DECL(extern int scheme_force_port_closed);
|
||||
|
||||
void scheme_flush_orig_outputs(void);
|
||||
Scheme_Object *scheme_file_stream_port_p(int, Scheme_Object *[]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user