chiark / gitweb /
codec/{base32,hex}.h: Include `codec.h'.
[mLib] / sys / fwatch.h
CommitLineData
32e1147e 1/* -*-c-*-
32e1147e 2 *
3 * Watch a file for changes
4 *
5 * (c) 2001 Straylight/Edgeware
6 */
7
d4efbcd9 8/*----- Licensing notice --------------------------------------------------*
32e1147e 9 *
10 * This file is part of the mLib utilities library.
11 *
12 * mLib is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Library General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
d4efbcd9 16 *
32e1147e 17 * mLib is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Library General Public License for more details.
d4efbcd9 21 *
32e1147e 22 * You should have received a copy of the GNU Library General Public
23 * License along with mLib; if not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25 * MA 02111-1307, USA.
26 */
27
32e1147e 28#ifndef MLIB_FWATCH_H
29#define MLIB_FWATCH_H
30
31#ifdef __cplusplus
32 extern "C" {
33#endif
34
35/*----- Header files ------------------------------------------------------*/
36
37#include <sys/types.h>
38#include <sys/stat.h>
39
40/*----- Data structures ---------------------------------------------------*/
41
42typedef struct fwatch {
43 int err;
44 dev_t dev;
45 ino_t ino;
46 time_t mtime;
47 off_t size;
48 mode_t mode;
49 uid_t uid;
50 gid_t gid;
51} fwatch;
52
53/*----- Functions provided ------------------------------------------------*/
54
55/* --- @fwatch_init@, @fwatch_update@, etc --- *
56 *
57 * Arguments: @fwatch *f@ = pointer to an @fwatch@ structure
58 * @const char *name@ = name of the file to watch
59 * @int fd@ = a file descriptor to watch
60 *
61 * Returns: The @update@ functions return nonzero if the file has
62 * changed.
63 *
64 * Use: Stores information about a file which can be used to watch
65 * for changes. The structures may be freed without telling
66 * anyone.
67 */
68
69extern void fwatch_init(fwatch */*f*/, const char */*name*/);
70extern void fwatch_initfd(fwatch */*f*/, int /*fd*/);
71extern int fwatch_update(fwatch */*f*/, const char */*name*/);
72extern int fwatch_updatefd(fwatch */*f*/, int /*fd*/);
73
74/*----- That's all, folks -------------------------------------------------*/
75
76#ifdef __cplusplus
77 }
78#endif
79
80#endif