new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / headers / file_op.h
1 /* Copyright (C) 2009 Trend Micro Inc.
2  * All rights reserved.
3  *
4  * This program is a free software; you can redistribute it
5  * and/or modify it under the terms of the GNU General Public
6  * License (version 2) as published by the FSF - Free Software
7  * Foundation
8  */
9
10 /* Functions to handle operation with files */
11
12 #ifndef __FILE_H
13 #define __FILE_H
14
15 #include <time.h>
16
17 #define OS_PIDFILE  "/var/run"
18
19 /* Set the program name - must be done before *anything* else */
20 void OS_SetName(const char *name) __attribute__((nonnull));
21
22 time_t File_DateofChange(const char *file) __attribute__((nonnull));
23
24 int IsDir(const char *file) __attribute__((nonnull));
25
26 int CreatePID(const char *name, int pid) __attribute__((nonnull));
27
28 char *GetRandomNoise();
29
30 int DeletePID(const char *name) __attribute__((nonnull));
31
32 int MergeFiles(const char *finalpath, char **files) __attribute__((nonnull));
33
34 int MergeAppendFile(const char *finalpath, const char *files) __attribute__((nonnull(1)));
35
36 int UnmergeFiles(const char *finalpath, const char *optdir) __attribute__((nonnull(1)));
37
38 /* Daemonize a process */
39 void goDaemon(void);
40
41 /* Daemonize a process without closing stdin/stdout/stderr */
42 void goDaemonLight(void);
43
44 /* Not really a file operation, but returns the uname */
45 char *getuname(void);
46
47 /* Return basename of path */
48 char *basename_ex(char *path) __attribute__((nonnull));
49
50 /* Rename file or directory */
51 int rename_ex(const char *source, const char *destination) __attribute__((nonnull));
52
53 /* Create temporary file */
54 int mkstemp_ex(char *tmp_path) __attribute__((nonnull));
55
56 /* Checks for Windows Vista */
57 #ifdef WIN32
58 int checkVista();
59 int isVista;
60 #endif
61
62 int w_ref_parent_folder(const char * path);
63 #endif /* __FILE_H */