summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-10-05 12:17:01 +0000
committerAndrew Tridgell <tridge@samba.org>1998-10-05 12:17:01 +0000
commitbfaff8ed1a3899c9aef7eaa2421d3d6467343ea1 (patch)
treeb8613065fc41cf94769d1950f30cd9756855048f
parentf151bf0694cd41bab2ed8a4ff260ff84f714ec5c (diff)
downloadsamba-bfaff8ed1a3899c9aef7eaa2421d3d6467343ea1.tar.gz
samba-bfaff8ed1a3899c9aef7eaa2421d3d6467343ea1.tar.bz2
samba-bfaff8ed1a3899c9aef7eaa2421d3d6467343ea1.zip
got smbwrapper working on IRIX 6.4. Things got a bit tricky,
especially as the headers get the syscall numbers wrong! (This used to be commit a5405f1ab069a3123a819311a87ca84f2c5f0fea)
-rw-r--r--source3/Makefile.in25
-rw-r--r--source3/configure.in12
-rw-r--r--source3/include/proto.h10
-rw-r--r--source3/libsmb/clientgen.c2
-rw-r--r--source3/smbwrapper/realcalls.h9
-rw-r--r--source3/smbwrapper/smbsh.in18
-rw-r--r--source3/smbwrapper/smbw.c5
-rw-r--r--source3/smbwrapper/smbw_stat.c2
8 files changed, 69 insertions, 14 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 8f21e417e6..3faa4331d4 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -222,6 +222,7 @@ PROTO_OBJ = $(SMBD_OBJ) $(NMBD_OBJ) $(SWAT_OBJ) $(CLIENT_OBJ) \
$(RPCCLIENT_OBJ) $(SMBWRAPPER_OBJ)
PICOBJS = $(SMBWRAPPER_OBJ:.o=.po)
+PICOBJS32 = $(SMBWRAPPER_OBJ:.o=.po32)
######################################################################
# now the rules...
@@ -229,10 +230,10 @@ PICOBJS = $(SMBWRAPPER_OBJ:.o=.po)
all : CHECK $(SPROGS) $(PROGS)
-smbwrapper : CHECK smbwrapper/smbsh smbwrapper/smbwrapper.so
+smbwrapper : CHECK smbwrapper/smbsh smbwrapper/smbwrapper.so @WRAP32@
.SUFFIXES:
-.SUFFIXES: .c .o .po
+.SUFFIXES: .c .o .po .po32
CHECK:
@echo "Using FLAGS = $(FLAGS)"
@@ -259,8 +260,16 @@ MAKEDIR = || exec false; \
.c.po: @MAINT@ .deps/.dummy
@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
- @echo Compiling $*.c with -fpic
- @$(CC) -I. -I$(srcdir) $(FLAGS) -fpic -c $< -o $@ \
+ @echo Compiling $*.c with @PICFLAG@
+ @$(CC) -I. -I$(srcdir) $(FLAGS) @PICFLAG@ -c $< -o $@ \
+ @MAINT@ -Wp,-MD,.deps/`echo $* | sed s,/,_,g`.P && : >.deps/.stamp
+
+# this is for IRIX
+.c.po32: @MAINT@ .deps/.dummy
+ @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
+ dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
+ @echo Compiling $*.c with @PICFLAG@
+ @$(CC) -32 -I. -I$(srcdir) $(FLAGS) @PICFLAG@ -c $< -o $@ \
@MAINT@ -Wp,-MD,.deps/`echo $* | sed s,/,_,g`.P && : >.deps/.stamp
bin/.dummy:
@@ -338,7 +347,11 @@ bin/smbtorture: $(SMBTORTURE_OBJ) bin/.dummy
smbwrapper/smbwrapper.so: $(PICOBJS)
@echo Linking shared library $@
- $(LD) @LDSHFLAGS@ -o $@ $(PICOBJS) $(LIBS)
+ @$(LD) @LDSHFLAGS@ -o $@ $(PICOBJS) $(LIBS)
+
+smbwrapper/smbwrapper.32.so: $(PICOBJS32)
+ @echo Linking shared library $@
+ @$(LD) -32 @LDSHFLAGS@ -o $@ $(PICOBJS32) $(LIBS)
smbwrapper/smbsh: smbwrapper/smbsh.in config.status
CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
@@ -402,7 +415,7 @@ ctags:
realclean: clean
-rm -f config.log $(PROGS) $(SPROGS) bin/.dummy
-rmdir bin
- -rm -f smbwrapper/smbsh smbwrapper/smbwrapper.so
+ -rm -f smbwrapper/smbsh smbwrapper/smbwrapper*.so
distclean: realclean
-rm -f include/config.h include/stamp-h Makefile
diff --git a/source3/configure.in b/source3/configure.in
index a16ed13f78..ddacea3215 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -8,8 +8,15 @@ AC_PROG_INSTALL
AC_SUBST(SHELL)
AC_SUBST(MPROGS)
AC_SUBST(LDSHFLAGS)
+AC_SUBST(HOST_OS)
+AC_SUBST(WRAP32)
+AC_SUBST(PICFLAG)
AC_PROG_AWK
+
+PICFLAG="-fpic"
+HOST_OS="$host_os"
+
AC_CANONICAL_SYSTEM
case "$host_os" in
*linux*) AC_DEFINE(LINUX)
@@ -18,7 +25,10 @@ case "$host_os" in
LDSHFLAGS="-G";;
*sunos*) AC_DEFINE(SUNOS4);;
*irix*) AC_DEFINE(IRIX)
- LDSHFLAGS="-shared";;
+ LDSHFLAGS="-shared"
+ WRAP32=smbwrapper/smbwrapper.32.so
+ PICFLAG="-KPIC"
+ ;;
*aix*) AC_DEFINE(AIX);;
*hpux*) AC_DEFINE(HPUX);;
*qnx*) AC_DEFINE(QNX);;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 0736e3f5bd..b7a1b31f0d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -387,7 +387,7 @@ BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int
size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
size_t cli_write(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
BOOL cli_getattrE(struct cli_state *cli, int fd,
- int *attr, uint32 *size,
+ uint32 *attr, size_t *size,
time_t *c_time, time_t *a_time, time_t *m_time);
BOOL cli_getatr(struct cli_state *cli, char *fname,
uint32 *attr, size_t *size, time_t *t);
@@ -2276,6 +2276,11 @@ BOOL unbecome_user(void );
void become_root(BOOL save_dir) ;
void unbecome_root(BOOL restore_dir);
+/*The following definitions come from smbwrapper/realcalls.c */
+
+int real_utime(const char *name, struct utimbuf *buf);
+int real_utimes(const char *name, struct timeval tv[2]);
+
/*The following definitions come from smbwrapper/smbw.c */
void smbw_init(void);
@@ -2288,8 +2293,10 @@ int smbw_errno(struct cli_state *c);
struct smbw_server *smbw_server(char *server, char *share);
struct smbw_file *smbw_file(int fd);
int smbw_open(const char *fname, int flags, mode_t mode);
+ssize_t smbw_pread(int fd, void *buf, size_t count, off_t ofs);
ssize_t smbw_read(int fd, void *buf, size_t count);
ssize_t smbw_write(int fd, void *buf, size_t count);
+ssize_t smbw_pwrite(int fd, void *buf, size_t count, off_t ofs);
int smbw_close(int fd);
int smbw_fcntl(int fd, int cmd, long arg);
int smbw_access(const char *name, int mode);
@@ -2297,6 +2304,7 @@ int smbw_readlink(const char *path, char *buf, size_t bufsize);
int smbw_unlink(const char *fname);
int smbw_rename(const char *oldname, const char *newname);
int smbw_utime(const char *fname, void *buf);
+int smbw_utimes(const char *fname, void *buf);
int smbw_chown(const char *fname, uid_t owner, gid_t group);
int smbw_chmod(const char *fname, mode_t newmode);
off_t smbw_lseek(int fd, off_t offset, int whence);
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 46da08bb3a..e395aa3b15 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -1343,7 +1343,7 @@ size_t cli_write(struct cli_state *cli, int fnum, char *buf, off_t offset, size_
do a SMBgetattrE call
****************************************************************************/
BOOL cli_getattrE(struct cli_state *cli, int fd,
- int *attr, uint32 *size,
+ uint32 *attr, size_t *size,
time_t *c_time, time_t *a_time, time_t *m_time)
{
bzero(cli->outbuf,smb_size);
diff --git a/source3/smbwrapper/realcalls.h b/source3/smbwrapper/realcalls.h
index 0c9bcd69bf..afd69b2d0c 100644
--- a/source3/smbwrapper/realcalls.h
+++ b/source3/smbwrapper/realcalls.h
@@ -19,6 +19,15 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifdef IRIX
+/* amazingly, IRIX gets its own syscall numbers wrong! */
+#ifdef SYSVoffset
+#if (SYSVoffset == 1)
+#undef SYSVoffset
+#define SYSVoffset 1000
+#endif
+#endif
+#endif
/* this file is partly derived from zlibc by Alain Knaff */
diff --git a/source3/smbwrapper/smbsh.in b/source3/smbwrapper/smbsh.in
index f5a5614842..7a26933f39 100644
--- a/source3/smbwrapper/smbsh.in
+++ b/source3/smbwrapper/smbsh.in
@@ -29,7 +29,21 @@ export PWD
PS1='smbsh$ '
export PS1
-LD_PRELOAD=$SMBW_LIBDIR/smbwrapper.so
-export LD_PRELOAD
+
+host_os=@HOST_OS@
+
+case "$host_os" in
+ *irix*)
+ _RLDN32_LIST=$SMBW_LIBDIR/smbwrapper.so:DEFAULT
+ _RLD_LIST=$SMBW_LIBDIR/smbwrapper.32.so:DEFAULT
+ export _RLDN32_LIST
+ export _RLD_LIST
+ ;;
+ *)
+ LD_PRELOAD=$SMBW_LIBDIR/smbwrapper.so
+ export LD_PRELOAD
+ ;;
+esac
+
exec ${SMBW_SHELL-${SHELL-/bin/sh}} ${1+"$@"}
diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c
index e7d0106034..97beca9b19 100644
--- a/source3/smbwrapper/smbw.c
+++ b/source3/smbwrapper/smbw.c
@@ -500,7 +500,7 @@ int smbw_open(const char *fname, int flags, mode_t mode)
fstring server, share;
pstring path;
struct smbw_server *srv=NULL;
- int eno, fd = -1;
+ int eno=0, fd = -1;
struct smbw_file *file=NULL;
smbw_init();
@@ -529,6 +529,7 @@ int smbw_open(const char *fname, int flags, mode_t mode)
}
if (fd == -1) {
/* it might be a directory. Maybe we should use chkpath? */
+ eno = smbw_error(&srv->cli);
fd = smbw_dir_open(fname);
smbw_busy--;
return fd;
@@ -1072,7 +1073,7 @@ a wrapper for lseek()
off_t smbw_lseek(int fd, off_t offset, int whence)
{
struct smbw_file *file;
- uint32 size;
+ size_t size;
smbw_busy++;
diff --git a/source3/smbwrapper/smbw_stat.c b/source3/smbwrapper/smbw_stat.c
index 5362f3a6cb..f4d92321bb 100644
--- a/source3/smbwrapper/smbw_stat.c
+++ b/source3/smbwrapper/smbw_stat.c
@@ -118,7 +118,7 @@ int smbw_fstat(int fd, struct stat *st)
struct smbw_file *file;
time_t c_time, a_time, m_time;
uint32 size;
- int mode;
+ uint32 mode;
smbw_busy++;