]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/common/filestuff.h
* common/filestuff.c: Check USE_WIN32API before including
[thirdparty/binutils-gdb.git] / gdb / common / filestuff.h
CommitLineData
614c279d
TT
1/* Low-level file-handling.
2 Copyright (C) 2012, 2013 Free Software Foundation, Inc.
3
4 This file is part of GDB.
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#ifndef FILESTUFF_H
20#define FILESTUFF_H
21
22/* Note all the file descriptors which are open when this is called.
23 These file descriptors will not be closed by close_most_fds. */
24
25extern void notice_open_fds (void);
26
27/* Close all open file descriptors other than those marked by
28 'notice_open_fds', and stdin, stdout, and stderr. Errors that
29 occur while closing are ignored. */
30
31extern void close_most_fds (void);
32
33/* Like 'open', but ensures that the returned file descriptor has the
34 close-on-exec flag set. */
35
5d71132c
TT
36extern int gdb_open_cloexec (const char *filename, int flags,
37 /* mode_t */ unsigned long mode);
614c279d
TT
38
39/* Like 'fopen', but ensures that the returned file descriptor has the
40 close-on-exec flag set. */
41
42extern FILE *gdb_fopen_cloexec (const char *filename, const char *opentype);
43
44/* Like 'socketpair', but ensures that the returned file descriptors
45 have the close-on-exec flag set. */
46
47extern int gdb_socketpair_cloexec (int namespace, int style, int protocol,
48 int filedes[2]);
49
50/* Like 'socket', but ensures that the returned file descriptor has
51 the close-on-exec flag set. */
52
53extern int gdb_socket_cloexec (int namespace, int style, int protocol);
54
55/* Like 'pipe', but ensures that the returned file descriptors have
56 the close-on-exec flag set. */
57
58extern int gdb_pipe_cloexec (int filedes[2]);
59
60#endif /* FILESTUFF_H */