Changeset 3866:5ca375b5e98c in roaraudio for libroaross


Ignore:
Timestamp:
05/19/10 16:12:26 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added open64()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroaross/libroaross.c

    r3864 r3866  
    151151 int     (*fcntl)(int fd, int cmd, ...); 
    152152 int     (*access)(const char *pathname, int mode); 
     153 int     (*open64)(const char *__file, int __oflag, ...); 
    153154} _os; 
    154155 
     
    256257 _os.fcntl  = dlsym(REAL_LIBC, "fcntl"); 
    257258 _os.access = dlsym(REAL_LIBC, "access"); 
     259 _os.open64 = dlsym(REAL_LIBC, "open64"); 
    258260} 
    259261 
     
    10191021 
    10201022 return _os.open(pathname, flags, mode); 
     1023} 
     1024 
     1025int    open64(const char *__file, int __oflag, ...) { 
     1026 int     ret; 
     1027 mode_t  mode = 0; 
     1028 va_list args; 
     1029 
     1030 _init(); 
     1031 
     1032 if ( __file == NULL ) { 
     1033  errno = EFAULT; 
     1034  return -1; 
     1035 } 
     1036 
     1037 ROAR_DBG("open64(__file='%s', __oflags=%x, ...) = ?\n", __file, __oflag); 
     1038 ret = _open_file(__file, __oflag); 
     1039 
     1040 switch (ret) { 
     1041  case -2:       // continue as normal, use _op.open() 
     1042   break; 
     1043  case -1:       // pass error to caller 
     1044    return -1; 
     1045   break; 
     1046  default:       // return successfully opened pointer to caller 
     1047    return ret; 
     1048   break; 
     1049 } 
     1050 
     1051 if (__oflag & O_CREAT) { 
     1052  va_start(args, __oflag); 
     1053  mode = va_arg(args, mode_t); 
     1054  va_end(args); 
     1055 } 
     1056 
     1057 if ( _os.open64 != NULL ) { 
     1058  return _os.open64(__file, __oflag, mode); 
     1059 } else { 
     1060#ifdef O_LARGEFILE 
     1061  return _os.open(__file, __oflag | O_LARGEFILE, mode); 
     1062#else 
     1063  return _os.open(__file, __oflag, mode); 
     1064#endif 
     1065 } 
    10211066} 
    10221067 
Note: See TracChangeset for help on using the changeset viewer.