GDBserver
Macros | Functions | Variables
filestuff.c File Reference
#include "common-defs.h"
#include "filestuff.h"
#include "gdb_vecs.h"
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>

Go to the source code of this file.

Macros

#define O_CLOEXEC   0
 
#define SOCK_CLOEXEC   0
 

Functions

static int fdwalk (int(*func)(void *, int), void *arg)
 
static VEC (int)
 
void notice_open_fds (void)
 
void mark_fd_no_cloexec (int fd)
 
void unmark_fd_no_cloexec (int fd)
 
static int do_close (void *ignore, int fd)
 
void close_most_fds (void)
 
static void mark_cloexec (int fd)
 
static void maybe_mark_cloexec (int fd)
 
int gdb_open_cloexec (const char *filename, int flags, unsigned long mode)
 
FILE * gdb_fopen_cloexec (const char *filename, const char *opentype)
 
int gdb_pipe_cloexec (int filedes[2])
 
static void do_close_cleanup (void *arg)
 
struct cleanupmake_cleanup_close (int fd)
 

Variables

static int trust_o_cloexec
 

Macro Definition Documentation

#define O_CLOEXEC   0

Definition at line 43 of file filestuff.c.

Referenced by gdb_fopen_cloexec(), gdb_open_cloexec(), and gdb_pipe_cloexec().

#define SOCK_CLOEXEC   0

Definition at line 47 of file filestuff.c.

Function Documentation

void close_most_fds ( void  )

Definition at line 224 of file filestuff.c.

References do_close(), and fdwalk().

Referenced by linux_create_inferior(), lynx_create_inferior(), and spu_create_inferior().

static int do_close ( void *  ignore,
int  fd 
)
static

Definition at line 204 of file filestuff.c.

References open_fds, and VEC_iterate.

Referenced by close_most_fds().

static void do_close_cleanup ( void *  arg)
static

Definition at line 411 of file filestuff.c.

Referenced by make_cleanup_close().

static int fdwalk ( int(*)(void *, int)  func,
void *  arg 
)
static

Definition at line 64 of file filestuff.c.

References errno.

Referenced by close_most_fds(), and notice_open_fds().

FILE* gdb_fopen_cloexec ( const char *  filename,
const char *  opentype 
)
int gdb_open_cloexec ( const char *  filename,
int  flags,
unsigned long  mode 
)

Definition at line 291 of file filestuff.c.

References maybe_mark_cloexec(), and O_CLOEXEC.

Referenced by linux_mntns_access_fs(), linux_mntns_open_cloexec(), and mnsh_handle_open().

int gdb_pipe_cloexec ( int  filedes[2])

Definition at line 381 of file filestuff.c.

References _, gdb_assert_not_reached, mark_cloexec(), maybe_mark_cloexec(), and O_CLOEXEC.

struct cleanup* make_cleanup_close ( int  fd)

Definition at line 421 of file filestuff.c.

References do_close_cleanup(), make_cleanup_dtor(), xfree(), and xmalloc().

Referenced by linux_mntns_access_fs().

static void mark_cloexec ( int  fd)
static

Definition at line 244 of file filestuff.c.

Referenced by gdb_pipe_cloexec(), and maybe_mark_cloexec().

void mark_fd_no_cloexec ( int  fd)

Definition at line 176 of file filestuff.c.

static void maybe_mark_cloexec ( int  fd)
static

Definition at line 267 of file filestuff.c.

References mark_cloexec().

Referenced by gdb_fopen_cloexec(), gdb_open_cloexec(), and gdb_pipe_cloexec().

void notice_open_fds ( void  )

Definition at line 168 of file filestuff.c.

References fdwalk().

Referenced by captured_main().

void unmark_fd_no_cloexec ( int  fd)

Definition at line 184 of file filestuff.c.

References _, gdb_assert_not_reached, open_fds, VEC_iterate, and VEC_unordered_remove.

static VEC ( int  )
static

Definition at line 153 of file filestuff.c.

References open_fds, and VEC_safe_push.

Variable Documentation

int trust_o_cloexec
static

Definition at line 238 of file filestuff.c.