2004 by Marc J. Rochkind. All rights reserved. Portions marked "Open Source" may be copied under license.

 

Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

c2/x2.c File Reference


Detailed Description

Miscellaneous examples for Chap. 2 [Chap. 2].

Definition in file x2.c.

Go to the source code of this file.

Defines

#define SYNCREPS   5000
#define PATHNAME   "tmp"
#define VERSION   506
#define STR_MAX   100
#define BUFSIZE   512
#define BUFSIZE   1024
#define BUFSIZE   1100
#define LOCKDIR   "/tmp/"
#define MAXTRIES   10
#define NAPLENGTH   2

Functions

void synctest (void)
void scatter (void)
void print_C_info (void)
bool cleanup_previous_run (void)
bool temp_open (void)
void copy (char *from, char *to)
bool copy2 (char *from, char *to)
bool copy2a (char *from, char *to)
bool copy3 (char *from, char *to)
bool copy4 (char *from, char *to)
char * lockpath (char *name)
bool lock (char *name)
bool unlock (char *name)
void testlock (void)
void junk (void)
void backward0 (char *path)
void backward (char *path)
void backward2 (char *path)
void ftruncate_test (void)
void pwrite_test (void)
void backward_test (void)
int main (void)


Define Documentation

#define BUFSIZE   1100
 

Definition at line 280 of file x2.c.

#define BUFSIZE   1024
 

Definition at line 280 of file x2.c.

#define BUFSIZE   512
 

Definition at line 280 of file x2.c.

Referenced by copy(), copy2(), and copy2a().

#define LOCKDIR   "/tmp/"
 

Definition at line 368 of file x2.c.

Referenced by lockpath().

#define MAXTRIES   10
 

Definition at line 369 of file x2.c.

Referenced by lock().

#define NAPLENGTH   2
 

Definition at line 370 of file x2.c.

Referenced by lock().

#define PATHNAME   "tmp"
 

Definition at line 27 of file x2.c.

#define STR_MAX   100
 

#define SYNCREPS   5000
 

Definition at line 26 of file x2.c.

Referenced by synctest().

#define VERSION   506
 


Function Documentation

void backward char *  path  ) 
 

Definition at line 621 of file x2.c.

References close(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, EC_FLUSH, ec_neg1, errno, lseek(), open(), and read().

Referenced by backward_test().

void backward0 char *  path  ) 
 

Definition at line 580 of file x2.c.

References close(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, EC_FLUSH, ec_neg1, errno, lseek(), open(), and read().

Referenced by backward_test().

void backward2 char *  path  ) 
 

Definition at line 664 of file x2.c.

References close(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, EC_FLUSH, ec_neg1, errno, lseek(), open(), and pread().

Referenced by backward_test().

void backward_test void   ) 
 

Definition at line 752 of file x2.c.

References backward(), backward0(), backward2(), EC_CLEANUP_BGN, EC_CLEANUP_END, ec_eof, EC_FLUSH, ec_null, and unlink().

Referenced by main().

bool cleanup_previous_run void   )  [static]
 

Definition at line 178 of file x2.c.

References unlink().

Referenced by temp_open().

void copy char *  from,
char *  to
 

Definition at line 219 of file x2.c.

References BUFSIZE, close(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_neg1, open(), read(), and write().

Referenced by main().

bool copy2 char *  from,
char *  to
 

Definition at line 248 of file x2.c.

References BUFSIZE, close(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_neg1, open(), read(), and write().

Referenced by main().

bool copy2a char *  from,
char *  to
 

Definition at line 282 of file x2.c.

References BUFSIZE, close(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_neg1, open(), read(), and write().

Referenced by main().

bool copy3 char *  from,
char *  to
 

Definition at line 319 of file x2.c.

References Bclose(), Bgetc(), Bopen(), Bputc(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_false, ec_null, and errno.

Referenced by main().

bool copy4 char *  from,
char *  to
 

Definition at line 344 of file x2.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_eof, ec_false, and ec_null.

Referenced by main().

void ftruncate_test void   ) 
 

Definition at line 705 of file x2.c.

References close(), EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, EC_FLUSH, ec_neg1, errno, ftruncate(), open(), PERM_FILE, system(), and write().

Referenced by main().

void junk void   ) 
 

Definition at line 448 of file x2.c.

References close(), creat(), EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, ec_neg1, ec_null, errno, lock(), lseek(), mkstemp(), open(), PERM_FILE, read(), syserr(), system(), unlink(), unlock(), and write().

Referenced by main().

bool lock char *  name  ) 
 

Definition at line 381 of file x2.c.

References close(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_neg1, ec_null, errno, lockpath(), MAXTRIES, NAPLENGTH, open(), and sleep().

Referenced by ec_mutex(), junk(), main(), and testlock().

char* lockpath char *  name  )  [static]
 

Definition at line 372 of file x2.c.

References LOCKDIR.

Referenced by lock(), and unlock().

int main void   ) 
 

Definition at line 769 of file x2.c.

References backward_test(), copy(), copy2(), copy2a(), copy3(), copy4(), EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, ec_neg1, ftruncate_test(), getblksize(), junk(), lock(), print_C_info(), pwrite_test(), scatter(), stat::st_blksize, stat(), sysconf(), syserr(), system(), temp_open(), testlock(), timestart(), timestop(), unlink(), and unlock().

void print_C_info void   ) 
 

Definition at line 154 of file x2.c.

Referenced by main().

void pwrite_test void   ) 
 

Definition at line 727 of file x2.c.

References close(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FLUSH, ec_neg1, lseek(), open(), PERM_FILE, pwrite(), system(), and write().

Referenced by main().

void scatter void   ) 
 

Definition at line 74 of file x2.c.

References close(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, EC_FLUSH, ec_neg1, ec_null, errno, iovec::iov_base, iovec::iov_len, lseek(), open(), PERM_FILE, read(), and writev().

Referenced by main().

void synctest void   ) 
 

Definition at line 29 of file x2.c.

References close(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, EC_FLUSH, ec_neg1, open(), OPT_ERROR, OPT_NO, OPT_YES, option_sync_io(), PATHNAME, PERM_FILE, SYNCREPS, timestart(), timestop(), and write().

bool temp_open void   )  [static]
 

Definition at line 192 of file x2.c.

References cleanup_previous_run(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, errno, open(), and PERM_FILE.

Referenced by main().

void testlock void   ) 
 

Definition at line 420 of file x2.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_false, EC_FLUSH, ec_reinit(), errno, getpid(), lock(), sleep(), and unlock().

Referenced by main().

bool unlock char *  name  ) 
 

Definition at line 406 of file x2.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, ec_null, lockpath(), and unlink().

Referenced by junk(), main(), and testlock().


Generated on Fri Apr 23 10:57:07 2004 for AUP2 Example Source by doxygen 1.3.1