Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision ee7f78a5c14921259ade650857bc3495b642f4f1)
+++ uspace/Makefile	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
@@ -38,4 +38,5 @@
 	app/blkdump \
 	app/bnchmark \
+	app/corecfg \
 	app/devctl \
 	app/dnscfg \
Index: uspace/app/corecfg/Makefile
===================================================================
--- uspace/app/corecfg/Makefile	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
+++ uspace/app/corecfg/Makefile	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2013 Jiri Svoboda
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+USPACE_PREFIX = ../..
+BINARY = corecfg
+
+SOURCES = \
+	corecfg.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/corecfg/corecfg.c
===================================================================
--- uspace/app/corecfg/corecfg.c	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
+++ uspace/app/corecfg/corecfg.c	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup corecfg
+ * @{
+ */
+/** @file Core file configuration utility.
+ */
+
+#include <corecfg.h>
+#include <errno.h>
+#include <stdio.h>
+
+#define NAME "dnscfg"
+
+static void print_syntax(void)
+{
+	printf("Syntax:\n");
+	printf("\t%s [get]\n", NAME);
+	printf("\t%s enable\n", NAME);
+	printf("\t%s disable\n", NAME);
+}
+
+static int corecfg_print(void)
+{
+	bool enable;
+	int rc;
+
+	rc = corecfg_get_enable(&enable);
+	if (rc != EOK) {
+		printf("Failed getting core file setting.\n");
+		return 1;
+	}
+
+	printf("Core files: %s.\n", enable ? "enabled" : "disabled");
+
+	return 0;
+}
+
+int main(int argc, char *argv[])
+{
+	int rc;
+
+	rc = corecfg_init();
+	if (rc != EOK) {
+		printf("Failed contacting corecfg service.\n");
+		return 1;
+	}
+
+	if ((argc < 2) || (str_cmp(argv[1], "get") == 0))
+		return corecfg_print();
+	else if (str_cmp(argv[1], "enable") == 0)
+		return corecfg_set_enable(true);
+	else if (str_cmp(argv[1], "disable") == 0)
+		return corecfg_set_enable(false);
+	else {
+		printf("%s: Unknown command '%s'.\n", NAME, argv[1]);
+		print_syntax();
+		return 1;
+	}
+
+	return 0;
+}
+
+/** @}
+ */
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision ee7f78a5c14921259ade650857bc3495b642f4f1)
+++ uspace/lib/c/Makefile	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
@@ -65,4 +65,5 @@
 	generic/cfg.c \
 	generic/clipboard.c \
+	generic/corecfg.c \
 	generic/devman.c \
 	generic/device/hw_res.c \
Index: uspace/lib/c/generic/corecfg.c
===================================================================
--- uspace/lib/c/generic/corecfg.c	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
+++ uspace/lib/c/generic/corecfg.c	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2013 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <async.h>
+#include <assert.h>
+#include <corecfg.h>
+#include <errno.h>
+#include <ipc/corecfg.h>
+#include <ipc/services.h>
+#include <loc.h>
+#include <stdlib.h>
+
+static async_sess_t *corecfg_sess = NULL;
+
+int corecfg_init(void)
+{
+	service_id_t corecfg_svc;
+	int rc;
+
+	assert(corecfg_sess == NULL);
+
+	rc = loc_service_get_id(SERVICE_NAME_CORECFG, &corecfg_svc,
+	    IPC_FLAG_BLOCKING);
+	if (rc != EOK)
+		return ENOENT;
+
+	corecfg_sess = loc_service_connect(EXCHANGE_SERIALIZE, corecfg_svc,
+	    IPC_FLAG_BLOCKING);
+	if (corecfg_sess == NULL)
+		return ENOENT;
+
+	return EOK;
+}
+
+/** Get core dump enable status. */
+int corecfg_get_enable(bool *renable)
+{
+	async_exch_t *exch = async_exchange_begin(corecfg_sess);
+	sysarg_t enable;
+
+	int rc = async_req_0_1(exch, CORECFG_GET_ENABLE, &enable);
+
+	async_exchange_end(exch);
+
+	if (rc != EOK)
+		return rc;
+
+	*renable = enable;
+	return EOK;
+}
+
+/** Enable or disable core dumps. */
+int corecfg_set_enable(bool enable)
+{
+	async_exch_t *exch = async_exchange_begin(corecfg_sess);
+	int rc = async_req_1_0(exch, CORECFG_SET_ENABLE, (sysarg_t) enable);
+
+	async_exchange_end(exch);
+
+	if (rc != EOK)
+		return rc;
+
+	return EOK;
+}
+
+/** @}
+ */
Index: uspace/lib/c/include/corecfg.h
===================================================================
--- uspace/lib/c/include/corecfg.h	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
+++ uspace/lib/c/include/corecfg.h	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2013 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_INET_INETCFG_H_
+#define LIBC_INET_INETCFG_H_
+
+#include <stdbool.h>
+
+extern int corecfg_init(void);
+extern int corecfg_set_enable(bool);
+extern int corecfg_get_enable(bool *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/ipc/corecfg.h
===================================================================
--- uspace/lib/c/include/ipc/corecfg.h	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
+++ uspace/lib/c/include/ipc/corecfg.h	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2013 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libcipc
+ * @{
+ */
+
+#ifndef LIBC_IPC_CORECFG_H_
+#define LIBC_IPC_CORECFG_H_
+
+#include <ipc/common.h>
+
+typedef enum {
+	CORECFG_GET_ENABLE = IPC_FIRST_USER_METHOD,
+	CORECFG_SET_ENABLE
+} corecfg_request_t;
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/ipc/services.h
===================================================================
--- uspace/lib/c/include/ipc/services.h	(revision ee7f78a5c14921259ade650857bc3495b642f4f1)
+++ uspace/lib/c/include/ipc/services.h	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
@@ -53,4 +53,5 @@
 } services_t;
 
+#define SERVICE_NAME_CORECFG	"corecfg"
 #define SERVICE_NAME_DNSR       "net/dnsr"
 #define SERVICE_NAME_INET       "net/inet"
Index: uspace/srv/taskmon/taskmon.c
===================================================================
--- uspace/srv/taskmon/taskmon.c	(revision ee7f78a5c14921259ade650857bc3495b642f4f1)
+++ uspace/srv/taskmon/taskmon.c	(revision 92c168040f5d9bf9ee5fb484770545a4555d29e0)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2010 Jiri Svoboda
+ * Copyright (c) 2013 Jiri Svoboda
  * All rights reserved.
  *
@@ -41,4 +41,6 @@
 #include <task.h>
 #include <event.h>
+#include <ipc/corecfg.h>
+#include <loc.h>
 #include <macros.h>
 #include <errno.h>
@@ -47,8 +49,13 @@
 #define NAME  "taskmon"
 
+static bool write_core_files;
+
+static void corecfg_client_conn(ipc_callid_t , ipc_call_t *, void *);
+
 static void fault_event(ipc_callid_t callid, ipc_call_t *call)
 {
 	const char *fname;
 	char *s_taskid;
+	char *dump_fname;
 	int rc;
 
@@ -69,22 +76,59 @@
 	fname = "/app/taskdump";
 
-#ifdef CONFIG_WRITE_CORE_FILES
-	char *dump_fname;
+	if (write_core_files) {
+		if (asprintf(&dump_fname, "/data/core%" PRIu64, taskid) < 0) {
+			printf("Memory allocation failed.\n");
+			return;
+		}
 
-	if (asprintf(&dump_fname, "/data/core%" PRIu64, taskid) < 0) {
-		printf("Memory allocation failed.\n");
-		return;
+		printf(NAME ": Executing %s -c %s -t %s\n", fname, dump_fname, s_taskid);
+		rc = task_spawnl(NULL, fname, fname, "-c", dump_fname, "-t", s_taskid,
+		    NULL);
+	} else {
+		printf(NAME ": Executing %s -t %s\n", fname, s_taskid);
+		rc = task_spawnl(NULL, fname, fname, "-t", s_taskid, NULL);
 	}
 
-	printf(NAME ": Executing %s -c %s -t %s\n", fname, dump_fname, s_taskid);
-	rc = task_spawnl(NULL, fname, fname, "-c", dump_fname, "-t", s_taskid,
-	    NULL);
-#else
-	printf(NAME ": Executing %s -t %s\n", fname, s_taskid);
-	rc = task_spawnl(NULL, fname, fname, "-t", s_taskid, NULL);
-#endif
 	if (rc != EOK) {
 		printf("%s: Error spawning %s (%s).\n", NAME, fname,
 		    str_error(rc));
+	}
+}
+
+static void corecfg_get_enable_srv(ipc_callid_t iid, ipc_call_t *icall)
+{
+	async_answer_1(iid, EOK, write_core_files);
+}
+
+static void corecfg_set_enable_srv(ipc_callid_t iid, ipc_call_t *icall)
+{
+	write_core_files = IPC_GET_ARG1(*icall);
+	async_answer_0(iid, EOK);
+}
+
+static void corecfg_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
+{
+	/* Accept the connection */
+	async_answer_0(iid, EOK);
+
+	while (true) {
+		ipc_call_t call;
+		ipc_callid_t callid = async_get_call(&call);
+		sysarg_t method = IPC_GET_IMETHOD(call);
+
+		if (!method) {
+			/* The other side has hung up */
+			async_answer_0(callid, EOK);
+			return;
+		}
+
+		switch (method) {
+		case CORECFG_GET_ENABLE:
+			corecfg_get_enable_srv(callid, &call);
+			break;
+		case CORECFG_SET_ENABLE:
+			corecfg_set_enable_srv(callid, &call);
+			break;
+		}
 	}
 }
@@ -94,6 +138,28 @@
 	printf("%s: Task Monitoring Service\n", NAME);
 	
+#ifdef CONFIG_WRITE_CORE_FILES
+	write_core_files = true;
+#else
+	write_core_files = false;
+#endif
 	if (event_subscribe(EVENT_FAULT, 0) != EOK) {
 		printf("%s: Error registering fault notifications.\n", NAME);
+		return -1;
+	}
+	
+	async_set_client_connection(corecfg_client_conn);
+	
+	int rc = loc_server_register(NAME);
+	if (rc != EOK) {
+		printf("%s: Failed registering server (%d).\n",
+		    NAME, rc);
+		return -1;
+	}
+	
+	service_id_t sid;
+	rc = loc_service_register(SERVICE_NAME_CORECFG, &sid);
+	if (rc != EOK) {
+		printf("%s: Failed registering service (%d).\n",
+		    NAME, rc);
 		return -1;
 	}
