From 4e8b4a20ab3a21c69c03b548709b60267b50af44 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 5 Oct 1998 04:58:33 +0000 Subject: got rid of all assembly code and gcc special features. I'm hoping to get smbsh working with the normal sun compiler (This used to be commit c6ee915336e1533e1f4f10f14b3d57de01f8fe96) --- source3/smbwrapper/smbw.c | 31 -------- source3/smbwrapper/smbw_dir.c | 20 ------ source3/smbwrapper/smbw_stat.c | 6 -- source3/smbwrapper/wrapped.c | 157 ++++++++++++++++++++++++++++------------- 4 files changed, 106 insertions(+), 108 deletions(-) (limited to 'source3') diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c index 76cd8e1e65..9734215305 100644 --- a/source3/smbwrapper/smbw.c +++ b/source3/smbwrapper/smbw.c @@ -503,8 +503,6 @@ int smbw_open(const char *fname, int flags, mode_t mode) int eno, fd = -1; struct smbw_file *file=NULL; - DEBUG(4,("%s\n", __FUNCTION__)); - smbw_init(); if (!fname) { @@ -612,9 +610,6 @@ ssize_t smbw_pread(int fd, void *buf, size_t count, off_t ofs) struct smbw_file *file; int ret; - DEBUG(4,("%s %d\n", - __FUNCTION__, (int)count)); - smbw_busy++; file = smbw_file(fd); @@ -644,9 +639,6 @@ ssize_t smbw_read(int fd, void *buf, size_t count) struct smbw_file *file; int ret; - DEBUG(4,("%s %d\n", - __FUNCTION__, (int)count)); - smbw_busy++; file = smbw_file(fd); @@ -681,8 +673,6 @@ ssize_t smbw_write(int fd, void *buf, size_t count) struct smbw_file *file; int ret; - DEBUG(4,("%s\n", __FUNCTION__)); - smbw_busy++; file = smbw_file(fd); @@ -715,8 +705,6 @@ ssize_t smbw_pwrite(int fd, void *buf, size_t count, off_t ofs) struct smbw_file *file; int ret; - DEBUG(4,("%s\n", __FUNCTION__)); - smbw_busy++; file = smbw_file(fd); @@ -746,8 +734,6 @@ int smbw_close(int fd) { struct smbw_file *file; - DEBUG(4,("%s\n", __FUNCTION__)); - smbw_busy++; file = smbw_file(fd); @@ -789,7 +775,6 @@ a wrapper for fcntl() *******************************************************/ int smbw_fcntl(int fd, int cmd, long arg) { - DEBUG(4,("%s\n", __FUNCTION__)); return 0; } @@ -835,8 +820,6 @@ int smbw_unlink(const char *fname) fstring server, share; pstring path; - DEBUG(4,("%s (%s)\n", __FUNCTION__, fname)); - if (!fname) { errno = EINVAL; return -1; @@ -889,8 +872,6 @@ int smbw_rename(const char *oldname, const char *newname) fstring server2, share2; pstring path2; - DEBUG(4,("%s (%s, %s)\n", __FUNCTION__, oldname, newname)); - if (!oldname || !newname) { errno = EINVAL; return -1; @@ -942,8 +923,6 @@ int smbw_utime(const char *fname, void *buf) pstring path; uint32 mode; - DEBUG(4,("%s (%s, 0x%x)\n", __FUNCTION__, fname, (unsigned)buf)); - if (!fname) { errno = EINVAL; return -1; @@ -992,8 +971,6 @@ int smbw_chown(const char *fname, uid_t owner, gid_t group) pstring path; uint32 mode; - DEBUG(4,("%s (%s)\n", __FUNCTION__, fname)); - if (!fname) { errno = EINVAL; return -1; @@ -1038,8 +1015,6 @@ int smbw_chmod(const char *fname, mode_t newmode) pstring path; uint32 mode; - DEBUG(4,("%s (%s)\n", __FUNCTION__, fname)); - if (!fname) { errno = EINVAL; return -1; @@ -1082,8 +1057,6 @@ off_t smbw_lseek(int fd, off_t offset, int whence) struct smbw_file *file; uint32 size; - DEBUG(4,("%s\n", __FUNCTION__)); - smbw_busy++; file = smbw_file(fd); @@ -1126,8 +1099,6 @@ int smbw_dup(int fd) int fd2; struct smbw_file *file, *file2; - DEBUG(4,("%s\n", __FUNCTION__)); - smbw_busy++; file = smbw_file(fd); @@ -1181,8 +1152,6 @@ int smbw_dup2(int fd, int fd2) { struct smbw_file *file, *file2; - DEBUG(4,("%s\n", __FUNCTION__)); - smbw_busy++; file = smbw_file(fd); diff --git a/source3/smbwrapper/smbw_dir.c b/source3/smbwrapper/smbw_dir.c index bd8c91682e..39fe034e7b 100644 --- a/source3/smbwrapper/smbw_dir.c +++ b/source3/smbwrapper/smbw_dir.c @@ -166,8 +166,6 @@ int smbw_dir_open(const char *fname) int fd; char *s, *p; - DEBUG(4,("%s\n", __FUNCTION__)); - if (!fname) { errno = EINVAL; return -1; @@ -266,8 +264,6 @@ int smbw_dir_fstat(int fd, struct stat *st) { struct smbw_dir *dir; - DEBUG(4,("%s\n", __FUNCTION__)); - dir = smbw_dir(fd); if (!dir) { errno = EBADF; @@ -290,11 +286,8 @@ int smbw_dir_close(int fd) { struct smbw_dir *dir; - DEBUG(4,("%s\n", __FUNCTION__)); - dir = smbw_dir(fd); if (!dir) { - DEBUG(4,("%s(%d)\n", __FUNCTION__, __LINE__)); errno = EBADF; return -1; } @@ -317,8 +310,6 @@ int smbw_getdents(unsigned int fd, struct dirent *dirp, int count) struct smbw_dir *dir; int n=0; - DEBUG(4,("%s\n", __FUNCTION__)); - smbw_busy++; dir = smbw_dir(fd); @@ -371,8 +362,6 @@ int smbw_chdir(const char *name) goto failed; } - DEBUG(4,("%s (%s)\n", __FUNCTION__, name)); - /* work out what server they are after */ cwd = smbw_parse_path(name, server, share, path); @@ -436,9 +425,6 @@ off_t smbw_dir_lseek(int fd, off_t offset, int whence) struct smbw_dir *dir; off_t ret; - DEBUG(4,("%s offset=%d whence=%d\n", __FUNCTION__, - (int)offset, whence)); - dir = smbw_dir(fd); if (!dir) { errno = EBADF; @@ -475,8 +461,6 @@ int smbw_mkdir(const char *fname, mode_t mode) fstring server, share; pstring path; - DEBUG(4,("%s (%s)\n", __FUNCTION__, fname)); - if (!fname) { errno = EINVAL; return -1; @@ -518,8 +502,6 @@ int smbw_rmdir(const char *fname) fstring server, share; pstring path; - DEBUG(4,("%s (%s)\n", __FUNCTION__, fname)); - if (!fname) { errno = EINVAL; return -1; @@ -595,8 +577,6 @@ int smbw_fchdir(unsigned int fd) { struct smbw_dir *dir; - DEBUG(4,("%s\n", __FUNCTION__)); - smbw_busy++; dir = smbw_dir(fd); diff --git a/source3/smbwrapper/smbw_stat.c b/source3/smbwrapper/smbw_stat.c index d0b0e59b4f..5362f3a6cb 100644 --- a/source3/smbwrapper/smbw_stat.c +++ b/source3/smbwrapper/smbw_stat.c @@ -120,8 +120,6 @@ int smbw_fstat(int fd, struct stat *st) uint32 size; int mode; - DEBUG(4,("%s\n", __FUNCTION__)); - smbw_busy++; file = smbw_file(fd); @@ -147,8 +145,6 @@ int smbw_fstat(int fd, struct stat *st) st->st_mtime = m_time; st->st_dev = file->srv->dev; - DEBUG(4,("%s - OK\n", __FUNCTION__)); - smbw_busy--; return 0; } @@ -166,8 +162,6 @@ int smbw_stat(const char *fname, struct stat *st) size_t size=0; uint32 mode=0; - DEBUG(4,("%s (%s)\n", __FUNCTION__, fname)); - if (!fname) { errno = EINVAL; return -1; diff --git a/source3/smbwrapper/wrapped.c b/source3/smbwrapper/wrapped.c index 025bbcc2db..d0a3842485 100644 --- a/source3/smbwrapper/wrapped.c +++ b/source3/smbwrapper/wrapped.c @@ -22,12 +22,6 @@ #include "wrapper.h" -#ifdef HAVE__OPEN -__asm__(".globl _open; _open = open"); -#elif HAVE___OPEN -__asm__(".globl __open; __open = open"); -#endif - int open(const char *name, int flags, mode_t mode) { if (smbw_path(name)) { @@ -37,6 +31,19 @@ __asm__(".globl __open; __open = open"); return real_open(name, flags, mode); } +#ifdef HAVE__OPEN + int _open(const char *name, int flags, mode_t mode) +{ + return open(name, flags, mode); +} +#elif HAVE___OPEN + int __open(const char *name, int flags, mode_t mode) +{ + return open(name, flags, mode); +} +#endif + + #ifdef HAVE_OPEN64 int open64(const char *name, int flags, mode_t mode) { @@ -93,26 +100,25 @@ __asm__(".globl __open; __open = open"); #endif -#ifdef HAVE___CHDIR -__asm__(".globl __chdir; __chdir = chdir"); -#elif HAVE__CHDIR -__asm__(".globl _chdir; _chdir = chdir"); -#endif - int chdir(const char *name) { return smbw_chdir(name); } - - -#ifdef HAVE___CLOSE -__asm__(".globl __close; __close = close"); -#elif HAVE__CLOSE -__asm__(".globl _close; _close = close"); +#ifdef HAVE___CHDIR + int __chdir(const char *name) +{ + return chdir(name); +} +#elif HAVE__CHDIR + int _chdir(const char *name) +{ + return chdir(name); +} #endif - ssize_t close(int fd) + + int close(int fd) { if (smbw_fd(fd)) { return smbw_close(fd); @@ -121,13 +127,19 @@ __asm__(".globl _close; _close = close"); return real_close(fd); } - -#ifdef HAVE___FCHDIR -__asm__(".globl __fchdir; __fchdir = fchdir"); -#elif HAVE__FCHDIR -__asm__(".globl _fchdir; _fchdir = fchdir"); +#ifdef HAVE___CLOSE + int __close(int fd) +{ + return close(fd); +} +#elif HAVE__CLOSE + int _close(int fd) +{ + return close(fd); +} #endif + int fchdir(int fd) { if (smbw_fd(fd)) { @@ -137,13 +149,19 @@ __asm__(".globl _fchdir; _fchdir = fchdir"); return real_fchdir(fd); } - -#ifdef HAVE___FCNTL -__asm__(".globl __fcntl; __fcntl = fcntl"); -#elif HAVE__FCNTL -__asm__(".globl _fcntl; _fcntl = fcntl"); +#ifdef HAVE___FCHDIR + int __fchdir(int fd) +{ + return fchdir(fd); +} +#elif HAVE__FCHDIR + int _fchdir(int fd) +{ + return fchdir(fd); +} #endif + int fcntl(int fd, int cmd, long arg) { if (smbw_fd(fd)) { @@ -154,13 +172,20 @@ __asm__(".globl _fcntl; _fcntl = fcntl"); } - -#ifdef HAVE___GETDENTS -__asm__(".globl __getdents; __getdents = getdents"); -#elif HAVE__GETDENTS -__asm__(".globl _getdents; _getdents = getdents"); +#ifdef HAVE___FCNTL + int __fcntl(int fd, int cmd, long arg) +{ + return fcntl(fd, cmd, arg); +} +#elif HAVE__FCNTL + int _fcntl(int fd, int cmd, long arg) +{ + return fcntl(fd, cmd, arg); +} #endif + + int getdents(int fd, struct dirent *dirp, unsigned int count) { if (smbw_fd(fd)) { @@ -170,14 +195,20 @@ __asm__(".globl _getdents; _getdents = getdents"); return real_getdents(fd, dirp, count); } - -#ifdef HAVE___LSEEK -__asm__(".globl __lseek; __lseek = lseek"); -#elif HAVE__LSEEK -__asm__(".globl _lseek; _lseek = lseek"); +#ifdef HAVE___GETDENTS + int __getdents(int fd, struct dirent *dirp, unsigned int count) +{ + return getdents(fd, dirp, count); +} +#elif HAVE__GETDENTS + int _getdents(int fd, struct dirent *dirp, unsigned int count) +{ + return getdents(fd, dirp, count); +} #endif - ssize_t lseek(int fd, off_t offset, int whence) + + off_t lseek(int fd, off_t offset, int whence) { if (smbw_fd(fd)) { return smbw_lseek(fd, offset, whence); @@ -186,14 +217,19 @@ __asm__(".globl _lseek; _lseek = lseek"); return real_lseek(fd, offset, whence); } - - -#ifdef HAVE___READ -__asm__(".globl __read; __read = read"); -#elif HAVE__READ -__asm__(".globl _read; _read = read"); +#ifdef HAVE___LSEEK + off_t __lseek(int fd, off_t offset, int whence) +{ + return lseek(fd, offset, whence); +} +#elif HAVE__LSEEK + off_t _lseek(int fd, off_t offset, int whence) +{ + return lseek(fd, offset, whence); +} #endif + ssize_t read(int fd, void *buf, size_t count) { if (smbw_fd(fd)) { @@ -203,13 +239,19 @@ __asm__(".globl _read; _read = read"); return real_read(fd, buf, count); } - -#ifdef HAVE___WRITE -__asm__(".globl __write; __write = write"); -#elif HAVE__WRITE -__asm__(".globl _write; _write = write"); +#ifdef HAVE___READ + ssize_t __read(int fd, void *buf, size_t count) +{ + return read(fd, buf, count); +} +#elif HAVE__READ + ssize_t _read(int fd, void *buf, size_t count) +{ + return read(fd, buf, count); +} #endif + ssize_t write(int fd, void *buf, size_t count) { if (smbw_fd(fd)) { @@ -219,6 +261,19 @@ __asm__(".globl _write; _write = write"); return real_write(fd, buf, count); } +#ifdef HAVE___WRITE + ssize_t __write(int fd, void *buf, size_t count) +{ + return write(fd, buf, count); +} +#elif HAVE__WRITE + ssize_t _write(int fd, void *buf, size_t count) +{ + return write(fd, buf, count); +} +#endif + + int access(const char *name, int mode) { -- cgit