/* Unix SMB/CIFS implementation. Send messages to other Samba daemons Copyright (C) Tim Potter 2003 Copyright (C) Andrew Tridgell 1994-1998 Copyright (C) Martin Pool 2001-2002 Copyright (C) Simo Sorce 2002 Copyright (C) James Peach 2006 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 3 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, see . */ #include "includes.h" #include "system/filesys.h" #include "lib/util/server_id.h" #include "lib/cmdline/cmdline.h" #include "librpc/gen_ndr/spoolss.h" #include "nt_printing.h" #include "printing/notify.h" #include "libsmb/nmblib.h" #include "messages.h" #include "util_tdb.h" #include "../lib/util/pidfile.h" #include "serverid.h" #include "cmdline_contexts.h" #include "lib/util/string_wrappers.h" #include "lib/global_contexts.h" #ifdef HAVE_LIBUNWIND_H #include #endif #ifdef HAVE_LIBUNWIND_PTRACE_H #include #endif #ifdef HAVE_SYS_PTRACE_H #include #endif /* Default timeout value when waiting for replies (in seconds) */ #define DEFAULT_TIMEOUT 10 static int timeout = DEFAULT_TIMEOUT; static int num_replies; /* Used by message callback fns */ /* Send a message to a destination pid. Zero means broadcast smbd. */ /* Main program */ int main(int argc, const char **argv) { TALLOC_CTX *frame = talloc_stackframe(); int ret = 0; int fd; pid_t existing_pid; fd = open(argv[1], O_CREAT|O_NONBLOCK, 0644); SMB_ASSERT(ret == 0); ret = fcntl_lock(fd,F_OFD_SETLK,0,4,F_RDLCK); SMB_ASSERT(ret); TALLOC_FREE(frame); return ret; }