added HCL_MOD_INCTX to hcl
added HCL_SERVER_MODULE_INCTX to hcl server
This commit is contained in:
parent
40aaa13e8e
commit
ae3745d5f3
@ -353,6 +353,7 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
|
runstatedir = @runstatedir@
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
@ -583,7 +584,7 @@ distdir: $(DISTFILES)
|
|||||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||||
|| chmod -R a+r "$(distdir)"
|
|| chmod -R a+r "$(distdir)"
|
||||||
dist-gzip: distdir
|
dist-gzip: distdir
|
||||||
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
|
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||||
$(am__post_remove_distdir)
|
$(am__post_remove_distdir)
|
||||||
|
|
||||||
dist-bzip2: distdir
|
dist-bzip2: distdir
|
||||||
@ -609,7 +610,7 @@ dist-shar: distdir
|
|||||||
@echo WARNING: "Support for shar distribution archives is" \
|
@echo WARNING: "Support for shar distribution archives is" \
|
||||||
"deprecated." >&2
|
"deprecated." >&2
|
||||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||||
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
|
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||||
$(am__post_remove_distdir)
|
$(am__post_remove_distdir)
|
||||||
|
|
||||||
dist-zip: distdir
|
dist-zip: distdir
|
||||||
@ -627,7 +628,7 @@ dist dist-all:
|
|||||||
distcheck: dist
|
distcheck: dist
|
||||||
case '$(DIST_ARCHIVES)' in \
|
case '$(DIST_ARCHIVES)' in \
|
||||||
*.tar.gz*) \
|
*.tar.gz*) \
|
||||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
|
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||||
*.tar.bz2*) \
|
*.tar.bz2*) \
|
||||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||||
*.tar.lz*) \
|
*.tar.lz*) \
|
||||||
@ -637,7 +638,7 @@ distcheck: dist
|
|||||||
*.tar.Z*) \
|
*.tar.Z*) \
|
||||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||||
*.shar.gz*) \
|
*.shar.gz*) \
|
||||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
|
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||||
*.zip*) \
|
*.zip*) \
|
||||||
unzip $(distdir).zip ;;\
|
unzip $(distdir).zip ;;\
|
||||||
esac
|
esac
|
||||||
|
14
configure
vendored
14
configure
vendored
@ -781,6 +781,7 @@ infodir
|
|||||||
docdir
|
docdir
|
||||||
oldincludedir
|
oldincludedir
|
||||||
includedir
|
includedir
|
||||||
|
runstatedir
|
||||||
localstatedir
|
localstatedir
|
||||||
sharedstatedir
|
sharedstatedir
|
||||||
sysconfdir
|
sysconfdir
|
||||||
@ -874,6 +875,7 @@ datadir='${datarootdir}'
|
|||||||
sysconfdir='${prefix}/etc'
|
sysconfdir='${prefix}/etc'
|
||||||
sharedstatedir='${prefix}/com'
|
sharedstatedir='${prefix}/com'
|
||||||
localstatedir='${prefix}/var'
|
localstatedir='${prefix}/var'
|
||||||
|
runstatedir='${localstatedir}/run'
|
||||||
includedir='${prefix}/include'
|
includedir='${prefix}/include'
|
||||||
oldincludedir='/usr/include'
|
oldincludedir='/usr/include'
|
||||||
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
||||||
@ -1126,6 +1128,15 @@ do
|
|||||||
| -silent | --silent | --silen | --sile | --sil)
|
| -silent | --silent | --silen | --sile | --sil)
|
||||||
silent=yes ;;
|
silent=yes ;;
|
||||||
|
|
||||||
|
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
||||||
|
| --runstate | --runstat | --runsta | --runst | --runs \
|
||||||
|
| --run | --ru | --r)
|
||||||
|
ac_prev=runstatedir ;;
|
||||||
|
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
||||||
|
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
||||||
|
| --run=* | --ru=* | --r=*)
|
||||||
|
runstatedir=$ac_optarg ;;
|
||||||
|
|
||||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||||
ac_prev=sbindir ;;
|
ac_prev=sbindir ;;
|
||||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||||
@ -1263,7 +1274,7 @@ fi
|
|||||||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||||
libdir localedir mandir
|
libdir localedir mandir runstatedir
|
||||||
do
|
do
|
||||||
eval ac_val=\$$ac_var
|
eval ac_val=\$$ac_var
|
||||||
# Remove trailing slashes.
|
# Remove trailing slashes.
|
||||||
@ -1416,6 +1427,7 @@ Fine tuning of the installation directories:
|
|||||||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||||
|
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
||||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||||
--includedir=DIR C header files [PREFIX/include]
|
--includedir=DIR C header files [PREFIX/include]
|
||||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||||
|
@ -424,6 +424,7 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
|
runstatedir = @runstatedir@
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
|
10
lib/hcl-s.c
10
lib/hcl-s.c
@ -316,6 +316,7 @@ struct hcl_server_t
|
|||||||
hcl_oow_t actor_heap_size;
|
hcl_oow_t actor_heap_size;
|
||||||
hcl_ntime_t actor_max_runtime;
|
hcl_ntime_t actor_max_runtime;
|
||||||
hcl_ooch_t script_include_path[HCL_PATH_MAX + 1];
|
hcl_ooch_t script_include_path[HCL_PATH_MAX + 1];
|
||||||
|
void* module_inctx;
|
||||||
} cfg;
|
} cfg;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
@ -1067,6 +1068,7 @@ hcl_server_proto_t* hcl_server_proto_open (hcl_oow_t xtnsize, hcl_server_worker_
|
|||||||
xtn = (worker_hcl_xtn_t*)hcl_getxtn(proto->hcl);
|
xtn = (worker_hcl_xtn_t*)hcl_getxtn(proto->hcl);
|
||||||
xtn->proto = proto;
|
xtn->proto = proto;
|
||||||
|
|
||||||
|
hcl_setoption (proto->hcl, HCL_MOD_INCTX, &proto->worker->server->cfg.module_inctx);
|
||||||
hcl_setoption (proto->hcl, HCL_LOG_MASK, &proto->worker->server->cfg.logmask);
|
hcl_setoption (proto->hcl, HCL_LOG_MASK, &proto->worker->server->cfg.logmask);
|
||||||
hcl_setcmgr (proto->hcl, proto->worker->server->cmgr);
|
hcl_setcmgr (proto->hcl, proto->worker->server->cmgr);
|
||||||
|
|
||||||
@ -2644,6 +2646,10 @@ int hcl_server_setoption (hcl_server_t* server, hcl_server_option_t id, const vo
|
|||||||
case HCL_SERVER_SCRIPT_INCLUDE_PATH:
|
case HCL_SERVER_SCRIPT_INCLUDE_PATH:
|
||||||
hcl_copy_oocstr (server->cfg.script_include_path, HCL_COUNTOF(server->cfg.script_include_path), (const hcl_ooch_t*)value);
|
hcl_copy_oocstr (server->cfg.script_include_path, HCL_COUNTOF(server->cfg.script_include_path), (const hcl_ooch_t*)value);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case HCL_SERVER_MODULE_INCTX:
|
||||||
|
server->cfg.module_inctx = *(void**)value;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
hcl_server_seterrnum (server, HCL_EINVAL);
|
hcl_server_seterrnum (server, HCL_EINVAL);
|
||||||
@ -2685,6 +2691,10 @@ int hcl_server_getoption (hcl_server_t* server, hcl_server_option_t id, void* va
|
|||||||
case HCL_SERVER_SCRIPT_INCLUDE_PATH:
|
case HCL_SERVER_SCRIPT_INCLUDE_PATH:
|
||||||
*(hcl_ooch_t**)value = server->cfg.script_include_path;
|
*(hcl_ooch_t**)value = server->cfg.script_include_path;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case HCL_SERVER_MODULE_INCTX:
|
||||||
|
*(void**)value = server->cfg.module_inctx;
|
||||||
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
hcl_server_seterrnum (server, HCL_EINVAL);
|
hcl_server_seterrnum (server, HCL_EINVAL);
|
||||||
|
@ -42,7 +42,8 @@ enum hcl_server_option_t
|
|||||||
HCL_SERVER_WORKER_IDLE_TIMEOUT,
|
HCL_SERVER_WORKER_IDLE_TIMEOUT,
|
||||||
HCL_SERVER_ACTOR_HEAP_SIZE,
|
HCL_SERVER_ACTOR_HEAP_SIZE,
|
||||||
HCL_SERVER_ACTOR_MAX_RUNTIME,
|
HCL_SERVER_ACTOR_MAX_RUNTIME,
|
||||||
HCL_SERVER_SCRIPT_INCLUDE_PATH
|
HCL_SERVER_SCRIPT_INCLUDE_PATH,
|
||||||
|
HCL_SERVER_MODULE_INCTX
|
||||||
};
|
};
|
||||||
typedef enum hcl_server_option_t hcl_server_option_t;
|
typedef enum hcl_server_option_t hcl_server_option_t;
|
||||||
|
|
||||||
|
12
lib/hcl.c
12
lib/hcl.c
@ -374,6 +374,10 @@ int hcl_setoption (hcl_t* hcl, hcl_option_t id, const void* value)
|
|||||||
hcl->option.dfl_procstk_size = *(hcl_oow_t*)value;
|
hcl->option.dfl_procstk_size = *(hcl_oow_t*)value;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case HCL_MOD_INCTX:
|
||||||
|
hcl->option.mod_inctx = *(void**)value;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
einval:
|
einval:
|
||||||
@ -408,6 +412,10 @@ int hcl_getoption (hcl_t* hcl, hcl_option_t id, void* value)
|
|||||||
case HCL_PROCSTK_SIZE:
|
case HCL_PROCSTK_SIZE:
|
||||||
*(hcl_oow_t*)value = hcl->option.dfl_procstk_size;
|
*(hcl_oow_t*)value = hcl->option.dfl_procstk_size;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case HCL_MOD_INCTX:
|
||||||
|
*(void**)value = hcl->option.mod_inctx;
|
||||||
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
hcl_seterrnum (hcl, HCL_EINVAL);
|
hcl_seterrnum (hcl, HCL_EINVAL);
|
||||||
@ -563,6 +571,7 @@ hcl_mod_data_t* hcl_openmod (hcl_t* hcl, const hcl_ooch_t* name, hcl_oow_t namel
|
|||||||
/* found the module in the staic module table */
|
/* found the module in the staic module table */
|
||||||
|
|
||||||
HCL_MEMSET (&md, 0, HCL_SIZEOF(md));
|
HCL_MEMSET (&md, 0, HCL_SIZEOF(md));
|
||||||
|
md.mod.inctx = hcl->option.mod_inctx;
|
||||||
hcl_copy_oochars ((hcl_ooch_t*)md.mod.name, name, namelen);
|
hcl_copy_oochars ((hcl_ooch_t*)md.mod.name, name, namelen);
|
||||||
/* Note md.handle is HCL_NULL for a static module */
|
/* Note md.handle is HCL_NULL for a static module */
|
||||||
|
|
||||||
@ -605,6 +614,7 @@ hcl_mod_data_t* hcl_openmod (hcl_t* hcl, const hcl_ooch_t* name, hcl_oow_t namel
|
|||||||
|
|
||||||
/* attempt to find a dynamic external module */
|
/* attempt to find a dynamic external module */
|
||||||
HCL_MEMSET (&md, 0, HCL_SIZEOF(md));
|
HCL_MEMSET (&md, 0, HCL_SIZEOF(md));
|
||||||
|
md.mod.inctx = hcl->option.mod_inctx;
|
||||||
hcl_copy_oochars((hcl_ooch_t*)md.mod.name, name, namelen);
|
hcl_copy_oochars((hcl_ooch_t*)md.mod.name, name, namelen);
|
||||||
if (hcl->vmprim.dl_open && hcl->vmprim.dl_getsym && hcl->vmprim.dl_close)
|
if (hcl->vmprim.dl_open && hcl->vmprim.dl_getsym && hcl->vmprim.dl_close)
|
||||||
{
|
{
|
||||||
@ -695,7 +705,7 @@ hcl_pfbase_t* hcl_querymod (hcl_t* hcl, const hcl_ooch_t* pfid, hcl_oow_t pfidle
|
|||||||
hcl_oow_t mod_name_len;
|
hcl_oow_t mod_name_len;
|
||||||
hcl_pfbase_t* pfbase;
|
hcl_pfbase_t* pfbase;
|
||||||
|
|
||||||
sep = hcl_rfind_oochar (pfid, pfidlen, '.');
|
sep = hcl_rfind_oochar(pfid, pfidlen, '.');
|
||||||
if (!sep)
|
if (!sep)
|
||||||
{
|
{
|
||||||
/* i'm writing a conservative code here. the compiler should
|
/* i'm writing a conservative code here. the compiler should
|
||||||
|
@ -163,7 +163,8 @@ enum hcl_option_t
|
|||||||
HCL_LOG_MAXCAPA,
|
HCL_LOG_MAXCAPA,
|
||||||
HCL_SYMTAB_SIZE, /* default system table size */
|
HCL_SYMTAB_SIZE, /* default system table size */
|
||||||
HCL_SYSDIC_SIZE, /* default system dictionary size */
|
HCL_SYSDIC_SIZE, /* default system dictionary size */
|
||||||
HCL_PROCSTK_SIZE /* default process stack size */
|
HCL_PROCSTK_SIZE, /* default process stack size */
|
||||||
|
HCL_MOD_INCTX
|
||||||
};
|
};
|
||||||
typedef enum hcl_option_t hcl_option_t;
|
typedef enum hcl_option_t hcl_option_t;
|
||||||
|
|
||||||
@ -1015,9 +1016,10 @@ typedef void (*hcl_mod_gc_t) (
|
|||||||
struct hcl_mod_t
|
struct hcl_mod_t
|
||||||
{
|
{
|
||||||
/* input */
|
/* input */
|
||||||
/*const*/ hcl_ooch_t name[HCL_MOD_NAME_LEN_MAX + 1];
|
hcl_ooch_t name[HCL_MOD_NAME_LEN_MAX + 1];
|
||||||
|
void* inctx;
|
||||||
|
|
||||||
/* user-defined data */
|
/* user-defined data - the module intializer shoudl fill in the following fields. */
|
||||||
hcl_mod_query_t query;
|
hcl_mod_query_t query;
|
||||||
hcl_mod_unload_t unload;
|
hcl_mod_unload_t unload;
|
||||||
hcl_mod_gc_t gc;
|
hcl_mod_gc_t gc;
|
||||||
@ -1076,6 +1078,7 @@ struct hcl_t
|
|||||||
hcl_oow_t dfl_symtab_size;
|
hcl_oow_t dfl_symtab_size;
|
||||||
hcl_oow_t dfl_sysdic_size;
|
hcl_oow_t dfl_sysdic_size;
|
||||||
hcl_oow_t dfl_procstk_size;
|
hcl_oow_t dfl_procstk_size;
|
||||||
|
void* mod_inctx;
|
||||||
|
|
||||||
#if defined(HCL_BUILD_DEBUG)
|
#if defined(HCL_BUILD_DEBUG)
|
||||||
/* set automatically when trait is set */
|
/* set automatically when trait is set */
|
||||||
|
@ -376,6 +376,7 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
|
runstatedir = @runstatedir@
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
|
Loading…
Reference in New Issue
Block a user