$(RPCCLIENT_OBJ) $(SMBWRAPPER_OBJ)
PICOBJS = $(SMBWRAPPER_OBJ:.o=.po)
+PICOBJS32 = $(SMBWRAPPER_OBJ:.o=.po32)
######################################################################
# now the rules...
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)"
.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:
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
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
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)
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);;
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);
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);
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);
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);
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);
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 */
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+"$@"}
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();
}
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;
off_t smbw_lseek(int fd, off_t offset, int whence)
{
struct smbw_file *file;
- uint32 size;
+ size_t size;
smbw_busy++;
struct smbw_file *file;
time_t c_time, a_time, m_time;
uint32 size;
- int mode;
+ uint32 mode;
smbw_busy++;