changeset: 87:721312ae775c
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Jan 26 22:27:42 2008 -0500
summary: Add <sys/types.h> where needed, thanks to a report by Muzgo, and on wmii-list. Also, add ixp_fstat, and const some parameters.
diff -r ca6f78505576 -r 721312ae775c config.mk
--- a/config.mk Sun Jan 20 12:19:58 2008 -0500
+++ b/config.mk Sat Jan 26 22:27:42 2008 -0500
@@ -18,7 +18,7 @@ LIBS = -L/usr/lib -lc
# Flags
include $(ROOT)/mk/gcc.mk
-CFLAGS += $(DEBUGCFLAGS) $(INCS)
+CFLAGS += $(DEBUGCFLAGS) -O0 $(INCS)
LDFLAGS = -g $(LDLIBS) $(LIBS)
# Compiler, Linker. Linker should usually *not* be ld.
diff -r ca6f78505576 -r 721312ae775c include/ixp.h
--- a/include/ixp.h Sun Jan 20 12:19:58 2008 -0500
+++ b/include/ixp.h Sat Jan 26 22:27:42 2008 -0500
@@ -7,16 +7,14 @@
#include <sys/types.h>
#include <sys/select.h>
-#define IXP_API 86
+#define IXP_API 87
/* Gunk */
-#ifdef IXP_NEEDAPI
-# if IXP_API < IXP_NEEDAPI
-# error A newer version of libixp is needed for this compilation.
-# elif IXP_API > IXP_NEEDAPI && \
- (defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(KENC))
-# warning This version of libixp has a newer API than this compilation suggests.
-# endif
+#if defined(IXP_NEEDAPI) && IXP_API < IXP_NEEDAPI
+# error A newer version of libixp is needed for this compilation.
+#endif
+#if defined(IXP_MAXAPI) && IXP_API > IXP_MAXAPI
+# warning This version of libixp has a newer API than this compilation requires.
#endif
#undef uchar
@@ -499,20 +497,21 @@ int ixp_pthread_init(void);
#endif
/* client.c */
+int ixp_close(IxpCFid*);
+Stat* ixp_fstat(IxpCFid*);
+long ixp_pread(IxpCFid*, void*, long, vlong);
+int ixp_print(IxpCFid*, const char*, ...);
+long ixp_pwrite(IxpCFid*, const void*, long, vlong);
+long ixp_read(IxpCFid*, void*, long);
+int ixp_remove(IxpClient*, const char*);
+void ixp_unmount(IxpClient*);
+int ixp_vprint(IxpCFid*, const char*, va_list);
+long ixp_write(IxpCFid*, const void*, long);
+IxpCFid* ixp_create(IxpClient*, const char*, uint perm, uchar mode);
IxpClient* ixp_mount(char*);
IxpClient* ixp_mountfd(int);
-void ixp_unmount(IxpClient*);
-IxpCFid* ixp_create(IxpClient*, char*, uint perm, uchar mode);
-IxpCFid* ixp_open(IxpClient*, char*, uchar);
-int ixp_remove(IxpClient*, char*);
-IxpStat* ixp_stat(IxpClient*, char*);
-long ixp_read(IxpCFid*, void*, long);
-long ixp_write(IxpCFid*, const void*, long);
-long ixp_pread(IxpCFid*, void*, long, vlong);
-long ixp_pwrite(IxpCFid*, const void*, long, vlong);
-int ixp_close(IxpCFid*);
-int ixp_print(IxpCFid*, const char*, ...);
-int ixp_vprint(IxpCFid*, const char*, va_list);
+IxpCFid* ixp_open(IxpClient*, const char*, uchar);
+IxpStat* ixp_stat(IxpClient*, const char*);
/* convert.c */
void ixp_pu8(IxpMsg*, uchar*);
@@ -525,7 +524,7 @@ void ixp_pqid(IxpMsg*, IxpQid*);
void ixp_pqid(IxpMsg*, IxpQid*);
void ixp_pqids(IxpMsg*, ushort*, IxpQid*);
void ixp_pstat(IxpMsg*, IxpStat*);
-void ixp_pfcall(IxpMsg*, Fcall*);
+void ixp_pfcall(IxpMsg*, IxpFcall*);
/* error.h */
char* ixp_errbuf(void);
@@ -554,8 +553,8 @@ void ixp_server_close(IxpServer*);
void ixp_server_close(IxpServer*);
/* socket.c */
-int ixp_dial(char*);
-int ixp_announce(char*);
+int ixp_dial(const char*);
+int ixp_announce(const char*);
/* transport.c */
uint ixp_sendmsg(int, IxpMsg*);
diff -r ca6f78505576 -r 721312ae775c include/ixp_local.h
--- a/include/ixp_local.h Sun Jan 20 12:19:58 2008 -0500
+++ b/include/ixp_local.h Sat Jan 26 22:27:42 2008 -0500
@@ -24,7 +24,8 @@ char *argv0;
#ifndef KENC
static inline void _used(long a, ...) { if(a){} }
# define USED(...) _used((long)__VA_ARGS__)
-# define SET(x) USED(&x)
+# define SET(x) (x = 0)
+/* # define SET(x) USED(&x) GCC 4 is 'too smart' for this. */
#endif
#undef nil
diff -r ca6f78505576 -r 721312ae775c libixp/client.c
--- a/libixp/client.c Sun Jan 20 12:19:58 2008 -0500
+++ b/libixp/client.c Sat Jan 26 22:27:42 2008 -0500
@@ -3,6 +3,7 @@
*/
#include <assert.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -174,13 +175,14 @@ ixp_mount(char *address) {
}
static IxpCFid*
-walk(IxpClient *c, char *path) {
- IxpCFid *f;
- Fcall fcall;
- int n;
-
- path = estrdup(path);
- n = tokenize(fcall.wname, nelem(fcall.wname), path, '/');
+walk(IxpClient *c, const char *path) {
+ IxpCFid *f;
+ char *p;
+ Fcall fcall;
+ int n;
+
+ p = estrdup(path);
+ n = tokenize(fcall.wname, nelem(fcall.wname), p, '/');
f = getfid(c);
fcall.type = TWalk;
@@ -195,7 +197,7 @@ walk(IxpClient *c, char *path) {
f->qid = fcall.wqid[n-1];
ixp_freefcall(&fcall);
- free(path);
+ free(p);
return f;
fail:
putfid(f);
@@ -203,7 +205,7 @@ fail:
}
static IxpCFid*
-walkdir(IxpClient *c, char *path, char **rest) {
+walkdir(IxpClient *c, char *path, const char **rest) {
char *p;
p = path + strlen(path) - 1;
@@ -241,7 +243,7 @@ clunk(IxpCFid *f) {
}
int
-ixp_remove(IxpClient *c, char *path) {
+ixp_remove(IxpClient *c, const char *path) {
Fcall fcall;
IxpCFid *f;
int ret;
@@ -269,7 +271,7 @@ initfid(IxpCFid *f, Fcall *fcall) {
}
IxpCFid*
-ixp_create(IxpClient *c, char *name, uint perm, uchar mode) {
+ixp_create(IxpClient *c, const char *name, uint perm, uchar mode) {
Fcall fcall;
IxpCFid *f;
char *path;;
@@ -282,7 +284,7 @@ ixp_create(IxpClient *c, char *name, uin
fcall.type = TCreate;
fcall.fid = f->fid;
- fcall.name = name;
+ fcall.name = (char*)(uintptr_t)name;
fcall.perm = perm;
fcall.mode = mode;
@@ -303,7 +305,7 @@ done:
}
IxpCFid*
-ixp_open(IxpClient *c, char *name, uchar mode) {
+ixp_open(IxpClient *c, const char *name, uchar mode) {
Fcall fcall;
IxpCFid *f;
@@ -332,36 +334,46 @@ ixp_close(IxpCFid *f) {
return clunk(f);
}
+static Stat*
+_stat(IxpClient *c, ulong fid) {
+ IxpMsg msg;
+ Fcall fcall;
+ Stat *stat;
+
+ fcall.type = TStat;
+ fcall.fid = fid;
+ if(dofcall(c, &fcall) == 0)
+ return nil;
+
+ msg = ixp_message((char*)fcall.stat, fcall.nstat, MsgUnpack);
+
+ stat = emalloc(sizeof *stat);
+ ixp_pstat(&msg, stat);
+ ixp_freefcall(&fcall);
+ if(msg.pos > msg.end) {
+ free(stat);
+ stat = nil;
+ }
+ return stat;
+}
+
Stat*
-ixp_stat(IxpClient *c, char *path) {
- IxpMsg msg;
- Fcall fcall;
+ixp_stat(IxpClient *c, const char *path) {
Stat *stat;
IxpCFid *f;
- stat = nil;
f = walk(c, path);
if(f == nil)
return nil;
- fcall.type = TStat;
- fcall.fid = f->fid;
- if(dofcall(c, &fcall) == 0)
- goto done;
-
- msg = ixp_message((char*)fcall.stat, fcall.nstat, MsgUnpack);
-
- stat = emalloc(sizeof(*stat));
- ixp_pstat(&msg, stat);
- ixp_freefcall(&fcall);
- if(msg.pos > msg.end) {
- free(stat);
- stat = 0;
- }
-
-done:
+ stat = _stat(c, f->fid);
clunk(f);
return stat;
+}
+
+Stat*
+ixp_fstat(IxpCFid *f) {
+ return _stat(f->client, f->fid);
}
static long
diff -r ca6f78505576 -r 721312ae775c libixp/server.c
--- a/libixp/server.c Sun Jan 20 12:19:58 2008 -0500
+++ b/libixp/server.c Sat Jan 26 22:27:42 2008 -0500
@@ -4,6 +4,7 @@
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
+#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include "ixp_local.h"
diff -r ca6f78505576 -r 721312ae775c libixp/socket.c
--- a/libixp/socket.c Sun Jan 20 12:19:58 2008 -0500
+++ b/libixp/socket.c Sat Jan 26 22:27:42 2008 -0500
@@ -9,6 +9,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
@@ -221,7 +222,7 @@ struct addrtab {
};
static int
-lookup(char *address, addrtab *tab) {
+lookup(const char *address, addrtab *tab) {
char *addr, *type;
int ret;
@@ -246,12 +247,12 @@ lookup(char *address, addrtab *tab) {
}
int
-ixp_dial(char *address) {
+ixp_dial(const char *address) {
return lookup(address, dtab);
}
int
-ixp_announce(char *address) {
+ixp_announce(const char *address) {
return lookup(address, atab);
}
diff -r ca6f78505576 -r 721312ae775c mk/dir.mk
--- a/mk/dir.mk Sun Jan 20 12:19:58 2008 -0500
+++ b/mk/dir.mk Sat Jan 26 22:27:42 2008 -0500
@@ -1,10 +1,10 @@ MKSUBDIR = targ=$@; \
-MKSUBDIR = targ=$@; \
+MKSUBDIR = targ=$@; targ=$${targ\#d}; \
for i in $$dirs; do \
if [ ! -d $$i ]; then \
echo Skipping nonexistent directory: $$i 1>&2; \
else \
- echo MAKE $${targ\#d} $(BASE)$$i/; \
- (cd $$i && $(MAKE) BASE="$(BASE)$$i/" $${targ\#d}) || exit $?; \
+ echo MAKE $$targ $(BASE)$$i/; \
+ (cd $$i && $(MAKE) BASE="$(BASE)$$i/" $$targ) || exit $?; \
fi; \
done
diff -r ca6f78505576 -r 721312ae775c mk/gcc.mk
--- a/mk/gcc.mk Sun Jan 20 12:19:58 2008 -0500
+++ b/mk/gcc.mk Sat Jan 26 22:27:42 2008 -0500
@@ -26,5 +26,5 @@ CFLAGS += \
-Wtrigraphs
MKDEP = cpp -M
SOCFLAGS += -fPIC
-SOLDFLAGS += -shared -soname $(SONAME)
+SOLDFLAGS += -shared -Wl,-soname=$(SONAME)
diff -r ca6f78505576 -r 721312ae775c mk/hdr.mk
--- a/mk/hdr.mk Sun Jan 20 12:19:58 2008 -0500
+++ b/mk/hdr.mk Sat Jan 26 22:27:42 2008 -0500
@@ -1,10 +1,27 @@
+FILTER = cat
+EXCFLAGS = -I$$(echo $(INCPATH)|sed 's/:/ -I/g') -D_XOPEN_SOURCE=600
+COMPILE= CC="$(CC)" CFLAGS="$(EXCFLAGS) $(CFLAGS)" $(ROOT)/util/compile
+COMPILEPIC= CC="$(CC)" CFLAGS="$(EXCFLAGS) $(CFLAGS) $(SOCFLAGS)" $(ROOT)/util/compile
+LINK= LD="$(LD)" LDFLAGS="$(LDFLAGS)" $(ROOT)/util/link
+LINKSO= LD="$(LD)" LDFLAGS="$(SOLDFLAGS) $(SHARED)" $(ROOT)/util/link
+CLEANNAME=$(ROOT)/util/cleanname
+SOEXT=so
+
+include $(ROOT)/config.mk
+
+# I hate this.
+MKCFGSH=if test -f $(ROOT)/config.local.mk; then echo $(ROOT)/config.local.mk; else echo /dev/null; fi
+MKCFG:=${shell $(MKCFGSH)}
+MKCFG!=${MKCFGSH}
+include $(MKCFG)
+
.SILENT:
-.SUFFIXES: .O .o .o_pic .c .sh .rc .so .awk .1 .depend .install .uninstall .clean
+.SUFFIXES: .O .o .o_pic .c .sh .rc .$(SOEXT) .awk .1 .depend .install .uninstall .clean
all:
.c.depend:
echo MKDEP $<
- $(MKDEP) $(CFLAGS) $< >>.depend
+ $(MKDEP) $(EXCFLAGS) $(CFLAGS) $< >>.depend
.sh.depend .rc.depend .1.depend .awk.depend:
:
@@ -40,11 +57,11 @@ all:
echo UNINSTALL $$($(CLEANNAME) $(BASE)$*)
rm -f $(BIN)/$*
-.a.install .so.install:
+.a.install .$(SOEXT).install:
echo INSTALL $$($(CLEANNAME) $(BASE)$<)
cp -f $< $(LIBDIR)/$<
chmod 0644 $(LIBDIR)/$<
-.a.uninstall .so.uninstall:
+.a.uninstall .$(SOEXT).uninstall:
echo UNINSTALL $$($(CLEANNAME) $(BASE)$<)
rm -f $(LIBDIR)/$<
@@ -65,9 +82,11 @@ all:
rm -f $(MAN)/man1/$<
.O.clean:
+ echo CLEAN $$($(CLEANNAME) $(BASE)$<)
rm -f $< || true 2>/dev/null
rm -f $*.o || true 2>/dev/null
.o.clean .o_pic.clean:
+ echo CLEAN $$($(CLEANNAME) $(BASE)$<)
rm -f $< || true 2>/dev/null
printinstall:
@@ -76,21 +95,5 @@ install: printinstall mkdirs
install: printinstall mkdirs
depend: cleandep
-FILTER = cat
-COMPILE= CC="$(CC)" CFLAGS="$(CFLAGS)" $(ROOT)/util/compile
-COMPILEPIC= CC="$(CC)" CFLAGS="$(CFLAGS) $(SOCFLAGS)" $(ROOT)/util/compile
-LINK= LD="$(LD)" LDFLAGS="$(LDFLAGS)" $(ROOT)/util/link
-LINKSO= LD="$(LD)" LDFLAGS="$(SOLDFLAGS)" $(ROOT)/util/link
-CLEANNAME=$(ROOT)/util/cleanname
-
-include $(ROOT)/config.mk
-
-# I hate this.
-MKCFGSH=if test -f $(ROOT)/config.local.mk; then echo $(ROOT)/config.local.mk; else echo /dev/null; fi
-MKCFG:=${shell $(MKCFGSH)}
-MKCFG!=${MKCFGSH}
-include $(MKCFG)
-
-CFLAGS += -I$$(echo $(INCPATH)|sed 's/:/ -I/g')
include $(ROOT)/mk/common.mk
diff -r ca6f78505576 -r 721312ae775c mk/many.mk
--- a/mk/many.mk Sun Jan 20 12:19:58 2008 -0500
+++ b/mk/many.mk Sat Jan 26 22:27:42 2008 -0500
@@ -13,6 +13,7 @@ printinstall:
manyclean:
for i in ${TARG:=.o} ${TARG:=.O} $(OFILES); do \
+ echo CLEAN $$($(CLEANNAME) $(BASE)$$i); \
rm -f $$i; \
done 2>/dev/null || true
diff -r ca6f78505576 -r 721312ae775c mk/one.mk
--- a/mk/one.mk Sun Jan 20 12:19:58 2008 -0500
+++ b/mk/one.mk Sat Jan 26 22:27:42 2008 -0500
@@ -14,6 +14,7 @@ printinstall:
oneclean:
for i in $(PROG) $(OFILES); do \
+ echo CLEAN $$($(CLEANNAME) $(BASE)$$i); \
rm -f $$i; \
done 2>/dev/null || true
diff -r ca6f78505576 -r 721312ae775c mk/so.mk
--- a/mk/so.mk Sun Jan 20 12:19:58 2008 -0500
+++ b/mk/so.mk Sat Jan 26 22:27:42 2008 -0500
@@ -1,6 +1,6 @@ SOPTARG = $(ROOT)/lib/$(TARG)
SOPTARG = $(ROOT)/lib/$(TARG)
-SO = $(SOPTARG).so
-SONAME = $(TARG).so
+SO = $(SOPTARG).$(SOEXT)
+SONAME = $(TARG).$(SOEXT)
OFILES_PIC = ${OBJ:=.o_pic}
all: $(HFILES) $(SO)
diff -r ca6f78505576 -r 721312ae775c util/link
--- a/util/link Sun Jan 20 12:19:58 2008 -0500
+++ b/util/link Sat Jan 26 22:27:42 2008 -0500
@@ -26,7 +26,7 @@ status=$?
status=$?
sed 's/.*: In function `[^:]*: *//' $xtmp | egrep . |
-egrep -v 'is almost always misused|is dangerous, better use'
+egrep -v 'is almost always misused|is dangerous, better use|in statically linked applications requires at runtime'
rm -f $xtmp
exit $status
Received on Sun Jan 27 2008 - 04:31:56 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:59:11 UTC