linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 5/6] core: Remove old code related to sd_notify
Date: Mon, 26 Nov 2018 18:24:37 +0200	[thread overview]
Message-ID: <20181126162438.27872-5-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20181126162438.27872-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This is no longer needed since mainloop instances can handle it now.
---
 Makefile.am    |   1 -
 Makefile.tools |   2 +-
 src/systemd.c  | 107 -------------------------------------------------
 src/systemd.h  |  28 -------------
 4 files changed, 1 insertion(+), 137 deletions(-)
 delete mode 100644 src/systemd.c
 delete mode 100644 src/systemd.h

diff --git a/Makefile.am b/Makefile.am
index 124c32482..a69baea10 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -185,7 +185,6 @@ src_bluetoothd_SOURCES = $(builtin_sources) \
 			src/bluetooth.ver \
 			src/main.c src/log.h src/log.c \
 			src/backtrace.h src/backtrace.c \
-			src/systemd.h src/systemd.c \
 			src/rfkill.c src/hcid.h src/sdpd.h \
 			src/sdpd-server.c src/sdpd-request.c \
 			src/sdpd-service.c src/sdpd-database.c \
diff --git a/Makefile.tools b/Makefile.tools
index 35412ca61..d3d901bc9 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -46,7 +46,7 @@ endif
 if LOGGER
 libexec_PROGRAMS += tools/btmon-logger
 
-tools_btmon_logger_SOURCES = tools/btmon-logger.c src/systemd.c src/systemd.h
+tools_btmon_logger_SOURCES = tools/btmon-logger.c
 tools_btmon_logger_LDADD = src/libshared-mainloop.la
 tools_btmon_logger_DEPENDENCIES = src/libshared-mainloop.la \
 					tools/bluetooth-logger.service
diff --git a/src/systemd.c b/src/systemd.c
deleted file mode 100644
index 0a4b35d06..000000000
--- a/src/systemd.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2012  Intel Corporation. All rights reserved.
- *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#include "systemd.h"
-
-int sd_listen_fds(int unset_environment)
-{
-	return 0;
-}
-
-int sd_notify(int unset_environment, const char *state)
-{
-	const char *sock;
-	struct sockaddr_un addr;
-	struct msghdr msghdr;
-	struct iovec iovec;
-	int fd, err;
-
-	if (!state) {
-		err = -EINVAL;
-		goto done;
-	}
-
-	sock = getenv("NOTIFY_SOCKET");
-	if (!sock)
-		return 0;
-
-	/* check for abstract socket or absolute path */
-	if (sock[0] != '@' && sock[0] != '/') {
-		err = -EINVAL;
-		goto done;
-	}
-
-	fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0);
-	if (fd < 0) {
-		err = -errno;
-		goto done;
-	}
-
-	memset(&addr, 0, sizeof(addr));
-	addr.sun_family = AF_UNIX;
-	strncpy(addr.sun_path, sock, sizeof(addr.sun_path) - 1);
-
-	if (addr.sun_path[0] == '@')
-		addr.sun_path[0] = '\0';
-
-	memset(&iovec, 0, sizeof(iovec));
-	iovec.iov_base = (char *) state;
-	iovec.iov_len = strlen(state);
-
-	memset(&msghdr, 0, sizeof(msghdr));
-	msghdr.msg_name = &addr;
-	msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) +
-								strlen(sock);
-
-	if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
-		msghdr.msg_namelen = sizeof(struct sockaddr_un);
-
-	msghdr.msg_iov = &iovec;
-	msghdr.msg_iovlen = 1;
-
-	if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0)
-		err = -errno;
-	else
-		err = 1;
-
-	close(fd);
-
-done:
-	if (unset_environment)
-		unsetenv("NOTIFY_SOCKET");
-
-	return err;
-}
diff --git a/src/systemd.h b/src/systemd.h
deleted file mode 100644
index 0ef7c82a9..000000000
--- a/src/systemd.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2012  Intel Corporation. All rights reserved.
- *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#define SD_LISTEN_FDS_START 3
-
-int sd_listen_fds(int unset_environment);
-
-int sd_notify(int unset_environment, const char *state);
-- 
2.17.2


  parent reply	other threads:[~2018-11-26 16:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-26 16:24 [PATCH BlueZ 1/6] share/mainloop: Add handling of NOTIFY_SOCKET Luiz Augusto von Dentz
2018-11-26 16:24 ` [PATCH BlueZ 2/6] share/mainloop: Add watchdog support Luiz Augusto von Dentz
2018-11-26 16:24 ` [PATCH BlueZ 3/6] tool/btmon-logger: Use mainloop_notify instead of sd_notify Luiz Augusto von Dentz
2018-11-26 16:24 ` [PATCH BlueZ 4/6] core: " Luiz Augusto von Dentz
2018-11-26 16:24 ` Luiz Augusto von Dentz [this message]
2018-11-26 16:24 ` [PATCH BlueZ 6/6] shared/timeout-glib: Check 0 id when removing timeout Luiz Augusto von Dentz
2018-11-26 17:54 ` [PATCH BlueZ 1/6] share/mainloop: Add handling of NOTIFY_SOCKET Marcel Holtmann
2018-11-27  9:51   ` Luiz Augusto von Dentz
2018-11-27 13:30     ` Marcel Holtmann
2018-11-27 15:19       ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181126162438.27872-5-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).