Merge branch 'master' of ssh://git.samba.org/data/git/samba
[sfrench/samba-autobuild/.git] / lib / tevent / tevent_fd.c
1 /*
2    Unix SMB/CIFS implementation.
3
4    common events code for fd events
5
6    Copyright (C) Stefan Metzmacher      2009
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #include "replace.h"
23 #include "tevent.h"
24 #include "tevent_internal.h"
25 #include "tevent_util.h"
26
27 uint16_t tevent_common_fd_get_flags(struct tevent_fd *fde)
28 {
29         return fde->flags;
30 }
31
32 void tevent_common_fd_set_flags(struct tevent_fd *fde, uint16_t flags)
33 {
34         if (fde->flags == flags) return;
35         fde->flags = flags;
36 }
37
38 void tevent_common_fd_set_close_fn(struct tevent_fd *fde,
39                                    tevent_fd_close_fn_t close_fn)
40 {
41         fde->close_fn = close_fn;
42 }