got smbwrapper working on IRIX 6.4. Things got a bit tricky,
authorAndrew Tridgell <tridge@samba.org>
Mon, 5 Oct 1998 12:17:01 +0000 (12:17 +0000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 5 Oct 1998 12:17:01 +0000 (12:17 +0000)
especially as the headers get the syscall numbers wrong!

source/Makefile.in
source/configure.in
source/include/proto.h
source/libsmb/clientgen.c
source/smbwrapper/realcalls.h
source/smbwrapper/smbsh.in
source/smbwrapper/smbw.c
source/smbwrapper/smbw_stat.c

index 8f21e417e6781c37b3f0cfaa1ed6519cafd68501..3faa4331d4d2026ab33995386dd09927e105e901 100644 (file)
@@ -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
index a16ed13f789307f8361ed2f188aa99b062222c52..ddacea3215f8e9ba4f863d442b5c6aee23f56691 100644 (file)
@@ -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);;
index 0736e3f5bdc92f016db32906f8a9ff396101e52a..b7a1b31f0d26c408ad11e5f4a7f304d2aa4e32ff 100644 (file)
@@ -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);
index 46da08bb3a4598e5231e2b97af8e17d14ada32de..e395aa3b15cb8de04da19a47e30029f0a30b030e 100644 (file)
@@ -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);
index 0c9bcd69bf5a0695e0f2b1f4f802ea18c09f0418..afd69b2d0ca109a12b579cad32c5ffe0f7be2094 100644 (file)
    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 */
 
index f5a5614842840c74584922890d16409629097061..7a26933f39105bfdf543eb56bfa4ea0e56961295 100644 (file)
@@ -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+"$@"}
index e7d010603412f5b9477b3157ec3738fc38eb3620..97beca9b1979e7586805d27335672eb6c8e791a2 100644 (file)
@@ -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++;
 
index 5362f3a6cb62a0db394c87def216234fa56343cd..f4d92321bb1c161fe4d7abf49a7ae0f5b7611242 100644 (file)
@@ -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++;