selftest: Add helper scripts for accessing the testenv namespace
[Samba.git] / ctdb / common / pidfile.h
blobbc4e3a7339f49d6d8d4d03af253ccc73c939cf8e
1 /*
2 Create and remove pidfile
4 Copyright (C) Amitay Isaacs 2016
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef __CTDB_PIDFILE_H__
21 #define __CTDB_PIDFILE_H__
23 #include <talloc.h>
25 /**
26 * @file pidfile.h
28 * @brief Routines to manage PID file
31 /**
32 * @brief Abstract struct to store pidfile details
34 struct pidfile_context;
36 /**
37 * @brief Create a PID file
39 * This creates a PID file, locks it, and writes PID.
41 * @param[in] mem_ctx Talloc memory context
42 * @param[in] pidfile Path of PID file
43 * @param[out] result Pidfile context
44 * @return 0 on success, errno on failure
46 * Freeing the pidfile_context, will delete the pidfile.
48 int pidfile_context_create(TALLOC_CTX *mem_ctx, const char *pidfile,
49 struct pidfile_context **result);
51 #endif /* __CTDB_PIDFILE_H__ */