/[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.7 by rupp, Wed Jul 16 15:22:55 2003 UTC revision 1.8 by rupp, Wed Jul 23 07:35:29 2003 UTC
# Line 111  extern "C" { Line 111  extern "C" {
111    #define TARGET_NATIVE_FILE_FILEPERMISSION_PRIVATE (S_IRUSR | S_IWUSR)    #define TARGET_NATIVE_FILE_FILEPERMISSION_PRIVATE (S_IRUSR | S_IWUSR)
112  #endif  #endif
113    
114    #ifndef TARGET_NATIVE_FILE_FILEPERMISSION_READONLY
115      #define TARGET_NATIVE_FILE_FILEPERMISSION_READONLY (~(S_IWRITE|S_IWGRP|S_IWOTH))
116    #endif
117    
118  /***************************** Datatypes *******************************/  /***************************** Datatypes *******************************/
119    
120  /***************************** Variables *******************************/  /***************************** Variables *******************************/
# Line 270  extern "C" { Line 274  extern "C" {
274  \***********************************************************************/  \***********************************************************************/
275    
276  #ifndef TARGET_NATIVE_FILE_VALID_FILE_DESCRIPTOR  #ifndef TARGET_NATIVE_FILE_VALID_FILE_DESCRIPTOR
277    #define TARGET_NATIVE_FILE_VALID_FILE_DESCRIPTOR(filedescriptor,result) \    #if   defined(HAVE_FCNTL)
278      do { \      #include <unistd.h>
279        result=(fcntl(filedescriptor,F_GETFL,0)!=-1)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \      #include <fcntl.h>
280      } while(0)      #define TARGET_NATIVE_FILE_VALID_FILE_DESCRIPTOR(filedescriptor,result) \
281          do { \
282            result=(fcntl(filedescriptor,F_GETFL,0)!=-1)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
283          } while(0)
284      #elif defined(HAVE_FSTAT)
285        #include <sys/types.h>
286        #include <sys/stat.h>
287        #include <unistd.h>
288        #define TARGET_NATIVE_FILE_VALID_FILE_DESCRIPTOR(filedescriptor,result) \
289          do { \
290            struct stat __stat; \
291            \
292            result=(fstat(filedescriptor,&__stat)==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
293          } while(0)
294      #else
295        #error fcntl() nor fstat() available for checking if file descriptor is valid
296      #endif
297  #endif  #endif
298    
299  /***********************************************************************\  /***********************************************************************\
# Line 386  extern "C" { Line 406  extern "C" {
406  \***********************************************************************/  \***********************************************************************/
407    
408  #ifndef TARGET_NATIVE_FILE_AVAILABLE  #ifndef TARGET_NATIVE_FILE_AVAILABLE
409    #if   defined(FIONREAD)    #if   defined(HAVE_FIONREAD)
410      #include <sys/ioctl.h>      #ifdef HAVE_SYS_IOCTL
     #ifdef HAVE_SYS_IOCTL_H  
411        #define BSD_COMP /* Get FIONREAD on Solaris2 */        #define BSD_COMP /* Get FIONREAD on Solaris2 */
412        #include <sys/ioctl.h>        #include <sys/ioctl.h>
413      #endif      #endif
414      #ifdef HAVE_SYS_FILIO_H /* Get FIONREAD on Solaris 2.5 */      #ifdef HAVE_SYS_FILIO /* Get FIONREAD on Solaris 2.5 */
415        #include <sys/filio.h>        #include <sys/filio.h>
416      #endif      #endif
417      #define TARGET_NATIVE_FILE_AVAILABLE(filedescriptor,length,result) \      #define TARGET_NATIVE_FILE_AVAILABLE(filedescriptor,length,result) \
# Line 507  extern "C" { Line 526  extern "C" {
526        struct stat __statBuffer; \        struct stat __statBuffer; \
527        \        \
528        if (stat(filename,&__statBuffer)==0) { \        if (stat(filename,&__statBuffer)==0) { \
529          result=(chmod(filename,__statBuffer.st_mode & (~(S_IWRITE|S_IWGRP|S_IWOTH)))==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \          result=(chmod(filename,__statBuffer.st_mode & TARGET_NATIVE_FILE_FILEPERMISSION_READONLY)==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
530        } else { \        } else { \
531          result=TARGET_NATIVE_ERROR; \          result=TARGET_NATIVE_ERROR; \
532        } \        } \
# Line 624  extern "C" { Line 643  extern "C" {
643    #include <sys/types.h>    #include <sys/types.h>
644    #include <sys/stat.h>    #include <sys/stat.h>
645    #include <unistd.h>    #include <unistd.h>
646    #ifdef HAVE_UTIME_H    #ifdef HAVE_UTIME
647      #include <utime.h>      #include <utime.h>
648    #elif HAVE_SYS_UTIME_H    #elif HAVE_SYS_UTIME
649      #include <sys/utime.h>      #include <sys/utime.h>
650    #else    #else
651      #error utime.h not found. Please check configuration.      #error utime.h not found. Please check configuration.

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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