aboutsummaryrefslogtreecommitdiff
path: root/src/progman.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-11-26 21:49:15 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-11-26 21:49:15 +0200
commit9de9182e3517c677e2309b0dd58ab4e3af1b3176 (patch)
treea8d2f33ee720591be9212b9cc6a33a5b018f60bd /src/progman.c
parentc0802ebe4ebd7e7bb173c6efa2c6e59dd5440cc3 (diff)
downloadpies-9de9182e3517c677e2309b0dd58ab4e3af1b3176.tar.gz
pies-9de9182e3517c677e2309b0dd58ab4e3af1b3176.tar.bz2
Implement internal inetd services in the pies config.
* src/pies.h (CF_INTERNAL): New flag. (ISCF_TCPMUX): New macro. (struct component): Reorder fields. New field: tcpmux. (progman_lookup_service): Remove proto. (progman_lookup_tcpmux): New proto. (struct inetd_builtin.foo): Change signature. All uses updated. * src/progman.c (progman_lookup_service): Remove. (progman_lookup_tcpmux): New function. (progman_create_sockets): Skip tcpmux subservices. (progman_start): Skip disabled inetd components. * src/inetd-bi.c (tcpmux): Use progman_lookup_tcpmux. * src/inetd.c (tcpmux_service, mktag): New functions. (inetd_conf_file): Minor changes. * src/pies.c (_cb_bitmask, _cb_precious) (_cb_disabled, _cb_wait): Remove. (str_to_cf, _cb_flags): New functions. (component_keywords): Remove keywords: disable, precious, wait. Add keywords: flags, service, tcpmux-master. (component_verify): Improve. * src/url.c (pies_url_destroy): Fix coredump on NULL argument.
Diffstat (limited to 'src/progman.c')
-rw-r--r--src/progman.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/progman.c b/src/progman.c
index 89be1f5..4743507 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -146,12 +146,19 @@ progman_lookup_component (const char *tag)
}
struct component *
-progman_lookup_service (const char *service)
+progman_lookup_tcpmux (const char *service, const char *master)
{
- struct prog *prog = prog_lookup_by_service (service);
- if (!prog)
- return NULL;
- return prog->v.p.comp;
+ struct prog *prog;
+ for (prog = proghead; prog; prog = prog->next)
+ if (IS_COMPONENT (prog)
+ && ISCF_TCPMUX (prog->v.p.comp->flags)
+ && !(prog->v.p.comp->flags & CF_DISABLED)
+ && prog->v.p.comp->service
+ && strcmp (prog->v.p.comp->service, service) == 0
+ && prog->v.p.comp->tcpmux
+ && strcmp (prog->v.p.comp->tcpmux, master) == 0)
+ return prog->v.p.comp;
+ return NULL;
}
struct prog *
@@ -775,7 +782,7 @@ prog_execute (struct prog *prog)
{
mf_proctitle_format ("inetd %s",
prog->v.p.comp->builtin->service);
- prog->v.p.comp->builtin->fun (0);
+ prog->v.p.comp->builtin->fun (0, prog->v.p.comp);
_exit (0);
}
@@ -862,7 +869,7 @@ prog_start (struct prog *prog)
if (prog->v.p.comp->builtin && prog->v.p.comp->builtin->single_process)
{
- prog->v.p.comp->builtin->fun (prog->v.p.socket);
+ prog->v.p.comp->builtin->fun (prog->v.p.socket, prog->v.p.comp);
return;
}
@@ -1254,8 +1261,7 @@ progman_create_sockets ()
if (IS_COMPONENT (prog))
{
struct component *comp = prog->v.p.comp;
- if (comp->mode == pies_comp_inetd
- && !(comp->flags & (CF_TCPMUXPLUS | CF_TCPMUX)))
+ if (comp->mode == pies_comp_inetd && !ISCF_TCPMUX (comp->flags))
{
int fd = create_socket (comp->socket_url,
comp->socket_type,
@@ -1324,8 +1330,13 @@ progman_start ()
{
if (prog->v.p.comp->mode == pies_comp_inetd)
{
- prog->v.p.status = status_listener;
- enable_socket (prog->v.p.socket);
+ if (prog->v.p.comp->flags & CF_DISABLED)
+ disable_socket (prog->v.p.socket);
+ else
+ {
+ prog->v.p.status = status_listener;
+ enable_socket (prog->v.p.socket);
+ }
}
else if ((prog->v.p.status == status_enabled && prog->pid == 0)
|| prog->v.p.status == status_sleeping)

Return to:

Send suggestions and report system problems to the System administrator.