1 | /*
|
---|
2 | Create and remove pidfile
|
---|
3 |
|
---|
4 | Copyright (C) Amitay Isaacs 2016
|
---|
5 |
|
---|
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.
|
---|
10 |
|
---|
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.
|
---|
15 |
|
---|
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/>.
|
---|
18 | */
|
---|
19 |
|
---|
20 | #ifndef __CTDB_PIDFILE_H__
|
---|
21 | #define __CTDB_PIDFILE_H__
|
---|
22 |
|
---|
23 | #include <talloc.h>
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * @file pidfile.h
|
---|
27 | *
|
---|
28 | * @brief Routines to manage PID file
|
---|
29 | */
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * @brief Abstract struct to store pidfile details
|
---|
33 | */
|
---|
34 | struct pidfile_context;
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * @brief Create a PID file
|
---|
38 | *
|
---|
39 | * This creates a PID file, locks it, and writes PID.
|
---|
40 | *
|
---|
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
|
---|
45 | *
|
---|
46 | * Freeing the pidfile_context, will delete the pidfile.
|
---|
47 | */
|
---|
48 | int pidfile_create(TALLOC_CTX *mem_ctx, const char *pidfile,
|
---|
49 | struct pidfile_context **result);
|
---|
50 |
|
---|
51 | #endif /* __CTDB_PIDFILE_H__ */
|
---|