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 *******************************/ |
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 |
/***********************************************************************\ |
/***********************************************************************\ |
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) \ |
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 |
} \ |
} \ |
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. |