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  

c7/f2.c File Reference


Detailed Description

File locking (semaphore) [Sec. 7.11.2].

Definition in file f2.c.

Go to the source code of this file.

Compounds

struct  rec

Defines

#define DBNAME   "termdb"

Functions

bool readrec (int dbfd, struct rec *r, off_t off)
bool writerec (int dbfd, struct rec *r, off_t off)
bool store (int dbfd, int data)
void process1 (void)
void process2 (void)
int main (void)

Variables

SimpleSem * sem


Define Documentation

#define DBNAME   "termdb"
 

Definition at line 97 of file f2.c.


Function Documentation

int main void   ) 
 

Definition at line 158 of file f2.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, ec_neg1, exit(), fork(), process1(), process2(), SimpleSemRemove(), and waitpid().

void process1 void   )  [static]
 

Definition at line 99 of file f2.c.

References close(), DBNAME, EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, ec_neg1, ec_null, exit(), open(), PERM_FILE, sem, SimpleSemClose(), SimpleSemOpen(), SimpleSemPost(), store(), and writerec().

void process2 void   )  [static]
 

Definition at line 119 of file f2.c.

References close(), DBNAME, EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_false, ec_neg1, ec_null, errno, exit(), open(), rec::r_data, rec::r_next, readrec(), sem, SimpleSemClose(), SimpleSemOpen(), SimpleSemPost(), and SimpleSemWait().

bool readrec int  dbfd,
struct rec r,
off_t  off
 

Definition at line 31 of file f2.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, errno, and pread().

bool store int  dbfd,
int  data
 

Definition at line 65 of file f2.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, ec_neg1, lseek(), rec::r_data, rec::r_next, readrec(), sem, SimpleSemPost(), SimpleSemWait(), usleep(), and writerec().

bool writerec int  dbfd,
struct rec r,
off_t  off
 

Definition at line 48 of file f2.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, errno, and pwrite().


Variable Documentation

struct SimpleSem* sem [static]
 

Definition at line 24 of file f2.c.

Referenced by process1(), process2(), and store().


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