dir.c File Reference

#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#include <isc/dir.h>
#include <isc/magic.h>
#include <isc/string.h>
#include <isc/util.h>
#include "errno2result.h"

Go to the source code of this file.

Defines

#define ISC_DIR_MAGIC   ISC_MAGIC('D', 'I', 'R', '*')
#define VALID_DIR(dir)   ISC_MAGIC_VALID(dir, ISC_DIR_MAGIC)

Functions

void isc_dir_init (isc_dir_t *dir)
isc_result_t isc_dir_open (isc_dir_t *dir, const char *dirname)
 Allocate workspace and open directory stream. If either one fails, NULL will be returned.
isc_result_t isc_dir_read (isc_dir_t *dir)
 Return previously retrieved file or get next one.
void isc_dir_close (isc_dir_t *dir)
 Close directory stream.
isc_result_t isc_dir_reset (isc_dir_t *dir)
 Reposition directory stream at start.
isc_result_t isc_dir_chdir (const char *dirname)
isc_result_t isc_dir_chroot (const char *dirname)
isc_result_t isc_dir_createunique (char *templet)


Detailed Description

Author:
Principal Authors: DCL

Definition in file dir.c.


Define Documentation

#define ISC_DIR_MAGIC   ISC_MAGIC('D', 'I', 'R', '*')

Definition at line 39 of file dir.c.

Referenced by isc_dir_init().

#define VALID_DIR ( dir   )     ISC_MAGIC_VALID(dir, ISC_DIR_MAGIC)

Definition at line 40 of file dir.c.

Referenced by isc_dir_close(), isc_dir_open(), isc_dir_read(), and isc_dir_reset().


Function Documentation

void isc_dir_init ( isc_dir_t dir  ) 

Definition at line 43 of file dir.c.

References isc_dir::entry, isc_dir::handle, ISC_DIR_MAGIC, isc_direntry::length, isc_dir::magic, isc_direntry::name, and REQUIRE.

Referenced by dns_dnssec_findmatchingkeys(), greatest_version(), and try_dir().

isc_result_t isc_dir_open ( isc_dir_t dir,
const char *  dirname 
)

Allocate workspace and open directory stream. If either one fails, NULL will be returned.

Definition at line 59 of file dir.c.

References isc_dir::dirname, isc_dir::handle, isc__errno2result, ISC_R_NOSPACE, ISC_R_SUCCESS, REQUIRE, and VALID_DIR.

Referenced by dns_dnssec_findmatchingkeys(), greatest_version(), and try_dir().

isc_result_t isc_dir_read ( isc_dir_t dir  ) 

Return previously retrieved file or get next one.

Unix's dirent has separate open and read functions, but the Win32 and DOS interfaces open the dir stream and reads the first file in one operation.

Definition at line 103 of file dir.c.

References isc_dir::entry, isc_dir::handle, ISC_R_NOMORE, ISC_R_SUCCESS, ISC_R_UNEXPECTED, isc_direntry::length, isc_direntry::name, REQUIRE, and VALID_DIR.

Referenced by dns_dnssec_findmatchingkeys(), and greatest_version().

void isc_dir_close ( isc_dir_t dir  ) 

Close directory stream.

Definition at line 136 of file dir.c.

References isc_dir::handle, REQUIRE, and VALID_DIR.

Referenced by dns_dnssec_findmatchingkeys(), greatest_version(), and try_dir().

isc_result_t isc_dir_reset ( isc_dir_t dir  ) 

Reposition directory stream at start.

Definition at line 147 of file dir.c.

References isc_dir::handle, ISC_R_SUCCESS, REQUIRE, and VALID_DIR.

isc_result_t isc_dir_chdir ( const char *  dirname  ) 

Change the current directory to 'dirname'.

Definition at line 156 of file dir.c.

References isc__errno2result, ISC_R_SUCCESS, and REQUIRE.

Referenced by directory_callback(), and main().

isc_result_t isc_dir_chroot ( const char *  dirname  ) 

Definition at line 170 of file dir.c.

References isc__errno2result, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, and REQUIRE.

Referenced by main().

isc_result_t isc_dir_createunique ( char *  templet  ) 

Use a templet (such as from isc_file_mktemplate()) to create a uniquely named, empty directory. The templet string is modified in place. If result == ISC_R_SUCCESS, it is the name of the directory that was created.

mkdtemp is not portable, so this emulates it.

Definition at line 185 of file dir.c.

References isc__errno2result, ISC_R_SUCCESS, and REQUIRE.


Generated on Tue Apr 28 17:41:18 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha