/[classpath]/classpath/native/target/generic/target_generic_file.h
ViewVC logotype

Diff of /classpath/native/target/generic/target_generic_file.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by rupp, Fri Mar 28 08:33:44 2003 UTC revision 1.3 by rupp, Mon Jul 7 11:08:48 2003 UTC
# Line 72  extern "C" { Line 72  extern "C" {
72  /****************************** Macros *********************************/  /****************************** Macros *********************************/
73    
74  /***********************************************************************\  /***********************************************************************\
75    * Name       : TARGET_NATIVE_FILE_OPEN_CREATE
76    * Purpose    : create a file
77    * Input      : -
78    * Output     : -
79    * Return     : -
80    * Side-effect: unknown
81    * Notes      : file is created if it does not exist
82    \***********************************************************************/
83    
84    #ifndef TARGET_NATIVE_FILE_OPEN_CREATE
85      #include <sys/types.h>
86      #include <sys/stat.h>
87      #include <fcntl.h>
88      #define TARGET_NATIVE_FILE_OPEN_CREATE(filename,filedescriptor,result) \
89        do { \
90          filedescriptor=open(filename,O_CREAT|O_EXCL|O_RDWR,0777); \
91          result=(filedescriptor>=0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
92       } while (0)
93    #endif
94    
95    /***********************************************************************\
96  * Name       : TARGET_NATIVE_FILE_OPEN_READ  * Name       : TARGET_NATIVE_FILE_OPEN_READ
97  * Purpose    : open an existing file for reading  * Purpose    : open an existing file for reading
98  * Input      : -  * Input      : -
# Line 108  extern "C" { Line 129  extern "C" {
129    #include <fcntl.h>    #include <fcntl.h>
130    #define TARGET_NATIVE_FILE_OPEN_READWRITE(filename,filedescriptor,result) \    #define TARGET_NATIVE_FILE_OPEN_READWRITE(filename,filedescriptor,result) \
131      do { \      do { \
132        filedescriptor=open(filename,O_CREAT|O_RDWR,0666); \        filedescriptor=open(filename,O_RDWR,0666); \
133        result=(filedescriptor>=0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \        result=(filedescriptor>=0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
134     } while (0)     } while (0)
135  #endif  #endif
# Line 340  extern "C" { Line 361  extern "C" {
361      do { \      do { \
362        struct stat __statBuffer; \        struct stat __statBuffer; \
363        \        \
364        result=((lstat(filename,&__statBuffer)==0) && (S_ISREG(__statBuffer.st_mode)))?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \        result=((stat(filename,&__statBuffer)==0) && (S_ISREG(__statBuffer.st_mode)))?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
365      } while (0)      } while (0)
366  #endif  #endif
367    
# Line 362  extern "C" { Line 383  extern "C" {
383      do { \      do { \
384        struct stat __statBuffer; \        struct stat __statBuffer; \
385        \        \
386        result=((lstat(filename,&__statBuffer)==0) && (S_ISDIR(__statBuffer.st_mode)))?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \        result=((stat(filename,&__statBuffer)==0) && (S_ISDIR(__statBuffer.st_mode)))?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
387      } while (0)      } while (0)
388  #endif  #endif
389    
# Line 477  extern "C" { Line 498  extern "C" {
498    #include <sys/stat.h>    #include <sys/stat.h>
499    #define TARGET_NATIVE_FILE_MAKE_DIR(name,result) \    #define TARGET_NATIVE_FILE_MAKE_DIR(name,result) \
500      do { \      do { \
501        result=((mkdir(name,S_IRWXU)==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR); \        result=((mkdir(name,(S_IRWXO|S_IRWXG|S_IRWXU))==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR); \
502      } while (0)      } while (0)
503  #endif  #endif
504    
# Line 595  extern "C" { Line 616  extern "C" {
616  #endif /* __TARGET_GENERIC_FILE__ */  #endif /* __TARGET_GENERIC_FILE__ */
617    
618  /* end of file */  /* end of file */
619    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26