Beispiel #1
0
int dup2(int oldfd, int newfd)
{
    if (smbw_fd(newfd)) {
        close(newfd);
    }

    if (smbw_fd(oldfd)) {
        return smbw_dup2(oldfd, newfd);
    }

    return real_dup2(oldfd, newfd);
}
Beispiel #2
0
int dup2(int oldfd, int newfd)
{
        check_init("dup2");
        
	if (smbw_fd(newfd)) {
		(* smbw_libc.close)(newfd);
	}
        
	if (smbw_fd(oldfd)) {
		return smbw_dup2(oldfd, newfd);
	}
        
        return (* smbw_libc.dup2)(oldfd, newfd);
}
Beispiel #3
0
static off64_t lseek64x(int fd,
                        off64_t offset,
                        int whence,
                        off64_t (* f)(int, off64_t, int))
{
        off64_t         ret;
        
        /*
         * We have left the definitions of the smbw_ functions undefined,
         * because types such as off_t can differ in meaning betweent his
         * function and smbw.c et al.  Functions that return other than an
         * integer value, however, MUST have their return value defined.
         */
        off64_t         smbw_lseek();
        
	if (smbw_fd(fd))
		ret = smbw_lseek(fd, offset, whence);
        else
                ret = (* f)(fd, offset, whence);
        if (smbw_debug)
        {
                printf("lseek64x(%d, 0x%llx) returned 0x%llx\n",
                       fd,
                       (unsigned long long) offset,
                       (unsigned long long) ret);
        }
        return ret;
}
Beispiel #4
0
int getdents64(int fd, struct dirent64 *external, unsigned int count)
{
        check_init("getdents64");
	if (smbw_fd(fd)) {
                int i;
                struct SMBW_dirent *internal;
                int ret;
                int n;
                
                /*
                 * LIMITATION: If they pass a count which is not a multiple of
                 * the size of struct dirent, they will not get a partial
                 * structure; we ignore the excess count.
                 */
                n = (count / sizeof(struct dirent64));
                
                internal = malloc(sizeof(struct SMBW_dirent) * n);
                if (internal == NULL) {
                        errno = ENOMEM;
                        return -1;
                }
		ret = smbw_getdents(fd, internal, count);
                if (ret <= 0)
                        return ret;
                
                ret = sizeof(struct dirent) * count;
                
                for (i = 0; count; i++, count--)
                        dirent64_convert(&internal[i], &external[i]);
                
                return ret;
	}
        
        return (* smbw_libc.getdents64)(fd, external, count);
}
Beispiel #5
0
offset_t llseek(int fd, offset_t ofs, int whence)
{
    if (smbw_fd(fd)) {
        return lseek(fd, ofs, whence);
    }
    return real_llseek(fd, ofs, whence);
}
Beispiel #6
0
static int closex(int fd, int (* f)(int fd))
{
	if (smbw_fd(fd)) {
		return smbw_close(fd);
	}
        
        return (* f)(fd);
}
Beispiel #7
0
static int fcntlx(int fd, int cmd, long arg, int (* f)(int, int, long))
{
	if (smbw_fd(fd)) {
		return smbw_fcntl(fd, cmd, arg);
	}
        
        return (* f)(fd, cmd, arg);
}
Beispiel #8
0
ssize_t pread64(int fd, void *buf, size_t size, off64_t ofs)
{
    if (smbw_fd(fd)) {
        return smbw_pread(fd, buf, size, ofs);
    }

    return real_pread64(fd, buf, size, ofs);
}
Beispiel #9
0
 ssize_t pwrite64(int fd, const void *buf, size_t size, off64_t ofs)
{
	if (smbw_fd(fd)) {
		return smbw_pwrite(fd, buf, size, ofs);
	}

	return real_pwrite64(fd, buf, size, ofs);
}
Beispiel #10
0
off_t lseek(int fd, off_t offset, int whence)
{
    if (smbw_fd(fd)) {
        return smbw_lseek(fd, offset, whence);
    }

    return real_lseek(fd, offset, whence);
}
Beispiel #11
0
ssize_t read(int fd, void *buf, size_t count)
{
    if (smbw_fd(fd)) {
        return smbw_read(fd, buf, count);
    }

    return real_read(fd, buf, count);
}
Beispiel #12
0
int fcntl(int fd, int cmd, long arg)
{
    if (smbw_fd(fd)) {
        return smbw_fcntl(fd, cmd, arg);
    }

    return real_fcntl(fd, cmd, arg);
}
Beispiel #13
0
static ssize_t writex(int fd, void *buf, size_t count, ssize_t (* f)(int, void *, size_t))
{
	if (smbw_fd(fd)) {
		return smbw_write(fd, buf, count);
	}
        
        return (* f)(fd, buf, count);
}
Beispiel #14
0
ssize_t pwrite(int fd, void *buf, size_t size, off_t ofs)
{
    if (smbw_fd(fd)) {
        return smbw_pwrite(fd, buf, size, ofs);
    }

    return real_pwrite(fd, buf, size, ofs);
}
Beispiel #15
0
int dup(int fd)
{
    if (smbw_fd(fd)) {
        return smbw_dup(fd);
    }

    return real_dup(fd);
}
Beispiel #16
0
int  facl(int fd,  int  cmd,  int  nentries, void *aclbufp)
{
    if (smbw_fd(fd)) {
        return smbw_facl(fd, cmd, nentries, aclbufp);
    }

    return real_facl(fd, cmd, nentries, aclbufp);
}
Beispiel #17
0
ssize_t write(int fd, void *buf, size_t count)
{
    if (smbw_fd(fd)) {
        return smbw_write(fd, buf, count);
    }

    return real_write(fd, buf, count);
}
Beispiel #18
0
int getdents(int fd, void *dirp, unsigned int count)
{
    if (smbw_fd(fd)) {
        return smbw_getdents(fd, dirp, count);
    }

    return real_getdents(fd, dirp, count);
}
Beispiel #19
0
int fremovexattr(int fd,
                 const char *name)
{
	if (smbw_fd(fd)) {
		return smbw_fremovexattr(fd, name);
	}
        
        return (* smbw_libc.fremovexattr)(fd, name);
}
Beispiel #20
0
int dup(int fd)
{
        check_init("dup");
        
	if (smbw_fd(fd)) {
		return smbw_dup(fd);
	}
        
        return (* smbw_libc.dup)(fd);
}
Beispiel #21
0
ssize_t pwrite64(int fd,  const void *buf, size_t size, off64_t ofs)
{
        check_init("pwrite64");
        
	if (smbw_fd(fd)) {
		return smbw_pwrite(fd, (void *) buf, size, (off_t) ofs);
	}
        
        return (* smbw_libc.pwrite64)(fd, (void *) buf, size, ofs);
}
Beispiel #22
0
ssize_t pread64(int fd, void *buf, size_t size, off64_t ofs)
{
        check_init("pread64");
        
	if (smbw_fd(fd)) {
		return smbw_pread(fd, buf, size, (off_t) ofs);
	}
        
        return (* smbw_libc.pread64)(fd, buf, size, ofs);
}
Beispiel #23
0
int flistxattr(int fd,
               char *list,
               size_t size)
{
	if (smbw_fd(fd)) {
                return smbw_flistxattr(fd, list, size);
	}
        
        return (* smbw_libc.flistxattr)(fd, list, size);
}
Beispiel #24
0
int fstat64(int fd, void *st64)
{
    if (smbw_fd(fd)) {
        double xx[32];
        int ret = fstat(fd, xx);
        stat64_convert(xx, st64);
        return ret;
    }
    return real_fstat64(fd, st64);
}
Beispiel #25
0
int fchown(int fd, uid_t owner, gid_t group)
{
        check_init("fchown");
        
	if (smbw_fd(fd)) {
                /* Not yet implemented in libsmbclient */
                return ENOTSUP;
	}
        
        return (* smbw_libc.fchown)(fd, owner, group);
}
Beispiel #26
0
int _llseek(unsigned int fd,  unsigned  long  offset_high, unsigned  long  offset_low,  loff_t  *result, unsigned int whence)
{
        check_init("_llseek");
        
	if (smbw_fd(fd)) {
		*result = lseek(fd, offset_low, whence);
                return (*result < 0 ? -1 : 0);
	}
        
        return (* smbw_libc._llseek)(fd, offset_high, offset_low, result, whence);
}
Beispiel #27
0
int fchmod(int fd, mode_t mode)
{
        check_init("fchmod");
        
	if (smbw_fd(fd)) {
                /* Not yet implemented in libsmbclient */
                return ENOTSUP;
	}
        
        return (* smbw_libc.fchmod)(fd, mode);
}
Beispiel #28
0
int fgetxattr(int fd,
              const char *name,
              const void *value,
              size_t size)
{
	if (smbw_fd(fd)) {
		return smbw_fgetxattr(fd, name, value, size);
	}
        
        return (* smbw_libc.fgetxattr)(fd, name, value, size);
}
Beispiel #29
0
int fstat(int fd, void *st)
{
#if HAVE___LXSTAT
    return __fxstat(0, fd, st);
#else
    if (smbw_fd(fd)) {
        return smbw_fstat(fd, st);
    }
    return real_fstat(fd, st);
#endif
}
Beispiel #30
0
int close(int fd)
{
    if (smbw_fd(fd)) {
        return smbw_close(fd);
    }
    if (smbw_local_fd(fd)) {
        errno = EBADF;
        return -1;
    }

    return real_close(fd);
}