|
From: Peter K. <pk...@us...> - 2001-10-10 16:20:42
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bt_misc.c 1.20 1.21=20=20=20=20=20=20=20=20=20=20=20=20
bt_misc.h 1.10 1.11=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added restart_btd() which sends SIGUSR1 to the pid registered in
/var/run/btd.pid to make it reinitialise the stack.
The diff of the modified file(s):
--- bt_misc.c 2001/10/04 15:10:40 1.20
+++ bt_misc.c 2001/10/10 16:20:40 1.21
@@ -96,6 +96,36 @@
return pid_fd;
}
=20
+int
+restart_btd(void)
+{
+ int fd;
+ int pid =3D -1;
+ int size;
+ char buf[100];
+
+ if ((fd =3D open("/var/run/btd.pid", O_RDONLY)) < 0)
+ {
+ return -1;
+ }
+
+ if ((size =3D read(fd, buf, sizeof buf - 1)) > 0)
+ {
+ buf[size-1] =3D '\0';
+ pid =3D atoi(buf);
+ }
+
+ close(fd);
+
+ if (pid > 0)
+ {
+ kill(pid, SIGUSR1);
+ return 0;
+ }
+
+ return -1;
+}
+
/* Local UNIX socket */
int
open_socket(const char *name, int role)
--- bt_misc.h 2001/10/03 17:45:44 1.10
+++ bt_misc.h 2001/10/10 16:20:40 1.11
@@ -59,6 +59,9 @@
int open_tcpsocket(const char *addrstr, int role);
=20
int write_pidfile(const char *pidname);
+
+int restart_btd(void);
+
char *get_local_ip_address(void);
const char *bd2str(const unsigned char *bd);
#ifndef BT_USERSTACK
|