Skip to content

Commit 8f60278

Browse files
committed
fix some warnings and some compile errors.
1 parent 505d408 commit 8f60278

File tree

10 files changed

+64
-39
lines changed

10 files changed

+64
-39
lines changed

libctf/makefile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CPPFLAGS += -I../common -I../common/ctf -I../uts/common/ \
55
-I../linux -DCTF_OLD_VERSIONS $(PTR32)
66
CPPFLAGS += -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64
77
BINDIR = ../$(BUILD_DIR)
8+
ARFLAGS=Urv
89

910
COMMON_OBJS = \
1011
ctf_create.o \
@@ -36,47 +37,47 @@ $(BINDIR)/libctf.a: \
3637

3738
$(BINDIR)/libctf.a(ctf_create.o): $(COMMON)/ctf_create.c
3839
$(CC) $(CPPFLAGS) -c $<
39-
$(AR) rv $(BINDIR)/libctf.a ctf_create.o
40+
$(AR) $(ARFLAGS) $(BINDIR)/libctf.a ctf_create.o
4041
rm -f ctf_create.o
4142

4243
$(BINDIR)/libctf.a(ctf_error.o): $(COMMON)/ctf_error.c
4344
$(CC) $(CPPFLAGS) -c $<
44-
$(AR) rv $(BINDIR)/libctf.a ctf_error.o
45+
$(AR) $(ARFLAGS) $(BINDIR)/libctf.a ctf_error.o
4546
rm -f ctf_error.o
4647

4748
$(BINDIR)/libctf.a(ctf_hash.o): $(COMMON)/ctf_hash.c
4849
$(CC) $(CPPFLAGS) -c $<
49-
$(AR) rv $(BINDIR)/libctf.a ctf_hash.o
50+
$(AR) $(ARFLAGS) $(BINDIR)/libctf.a ctf_hash.o
5051
rm -f ctf_hash.o
5152

5253
$(BINDIR)/libctf.a(ctf_labels.o): $(COMMON)/ctf_labels.c
5354
$(CC) $(CPPFLAGS) -c $<
54-
$(AR) rv $(BINDIR)/libctf.a ctf_labels.o
55+
$(AR) $(ARFLAGS) $(BINDIR)/libctf.a ctf_labels.o
5556
rm -f ctf_labels.o
5657

5758
$(BINDIR)/libctf.a(ctf_lookup.o): $(COMMON)/ctf_lookup.c
5859
$(CC) $(CPPFLAGS) -c $<
59-
$(AR) rv $(BINDIR)/libctf.a ctf_lookup.o
60+
$(AR) $(ARFLAGS) $(BINDIR)/libctf.a ctf_lookup.o
6061
rm -f ctf_lookup.o
6162

6263
$(BINDIR)/libctf.a(ctf_open.o): $(COMMON)/ctf_open.c
6364
$(CC) $(CPPFLAGS) -c $<
64-
$(AR) rv $(BINDIR)/libctf.a ctf_open.o
65+
$(AR) $(ARFLAGS) $(BINDIR)/libctf.a ctf_open.o
6566
rm -f ctf_open.o
6667

6768
$(BINDIR)/libctf.a(ctf_types.o): $(COMMON)/ctf_types.c
6869
$(CC) $(CPPFLAGS) -c $<
69-
$(AR) rv $(BINDIR)/libctf.a ctf_types.o
70+
$(AR) $(ARFLAGS) $(BINDIR)/libctf.a ctf_types.o
7071
rm -f ctf_types.o
7172

7273
$(BINDIR)/libctf.a(uncompress.o): uncompress.c
7374
$(CC) $(CPPFLAGS) -c $<
74-
$(AR) rv $(BINDIR)/libctf.a uncompress.o
75+
$(AR) $(ARFLAGS) $(BINDIR)/libctf.a uncompress.o
7576
rm -f uncompress.o
7677

7778
$(BINDIR)/libctf.a(ctf_util.o): $(COMMON)/ctf_util.c
7879
$(CC) $(CPPFLAGS) -c $<
79-
$(AR) rv $(BINDIR)/libctf.a ctf_util.o
80+
$(AR) $(ARFLAGS) $(BINDIR)/libctf.a ctf_util.o
8081
rm -f ctf_util.o
8182

8283
clean:

libdtrace/makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ARFLAGS=Urv
12
CC=gcc -g $(BUILD_BITS)
23
CPPFLAGS += -I. \
34
-I../../common/ctf \
@@ -88,14 +89,14 @@ $(BINDIR)/dt_grammar.h $(LIB)(dt_grammar.o): dt_grammar.y $(H)
8889
mv y.tab.h $(BINDIR)/dt_grammar.h
8990
mv y.tab.c dt_grammar.c
9091
$(CC) -DYYDEBUG=1 -DYYERROR_VERBOSE $(CPPFLAGS) -c dt_grammar.c
91-
ar rv $(LIB) dt_grammar.o
92+
ar $(ARFLAGS) $(LIB) dt_grammar.o
9293
-rm -f dt_grammar.c dt_grammar.o
9394

9495
#dt_grammar.h: $(LIB)(dt_grammar.o)
9596

9697
$(LIB)(dt_lex.o): $(BINDIR)/dt_grammar.h $(BINDIR)/dt_lex.c $(H)
9798
$(CC) $(CPPFLAGS) -c $(BINDIR)/dt_lex.c
98-
ar rv $(LIB) dt_lex.o
99+
ar $(ARFLAGS) $(LIB) dt_lex.o
99100
-rm -f dt_lex.o
100101
$(BINDIR)/dt_lex.c: dt_lex.l
101102
lex -t -v dt_lex.l > $(BINDIR)/dt_lex.c
@@ -106,16 +107,16 @@ $(BINDIR)/drti.o: drti.c $(H)
106107

107108
$(LIB)(dis_tables.o): ../driver/dis_tables.c $(H)
108109
$(CC) $(CPPFLAGS) -Ii386 -I../driver -c ../driver/dis_tables.c
109-
ar rv $(LIB) dis_tables.o
110+
ar $(ARFLAGS) $(LIB) dis_tables.o
110111
-rm -f dis_tables.o
111112
$(LIB)(dt_names.o): dt_names.c
112113
$(CC) $(CPPFLAGS) -c dt_names.c
113-
ar rv $(LIB) dt_names.o
114+
ar $(ARFLAGS) $(LIB) dt_names.o
114115
-rm -f dt_names.o
115116

116117
$(LIB)(dt_isadep.o): i386/dt_isadep.c $(H)
117118
$(CC) $(CPPFLAGS) -Ii386 -I../driver -c i386/dt_isadep.c
118-
ar rv $(LIB) dt_isadep.o
119+
ar $(ARFLAGS) $(LIB) dt_isadep.o
119120
-rm -f dt_isadep.o
120121
clean:
121122
-rm -f dt_errtags.c dt_names.c dt_grammar.h dt_lex.c *.o *.a

liblinux/makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ARFLAGS=Urv
12
CC=gcc -g $(BUILD_BITS)
23
CPPFLAGS += -I../libproc/common \
34
-I../common/ctf \

libproc/common/Pgcore.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ typedef struct {
8383
shstrtab_t pgc_shstrtab;
8484
} pgcore_t;
8585

86+
void bzero(void *, size_t);
87+
void bcopy(const void *src, void *dest, size_t n);
88+
8689
static void
8790
shstrtab_init(shstrtab_t *s)
8891
{

libproc/common/makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ARFLAGS=Urv
12
CC=gcc -g $(BUILD_BITS)
23
CPPFLAGS += -I../common \
34
-I../../common/ctf \

libproc/common/proc_arg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ proc_walk(proc_walk_f *func, void *arg, int flag)
459459
continue;
460460
/* PR_WALK_PROC case */
461461
(void) snprintf(pidstr, sizeof (pidstr),
462-
"%s/%ld/psinfo", procfs_path, pid);
462+
"%s/%ld/psinfo", procfs_path, (long) pid);
463463
fd = open(pidstr, O_RDONLY);
464464
if (fd < 0)
465465
continue;
@@ -475,7 +475,7 @@ proc_walk(proc_walk_f *func, void *arg, int flag)
475475
}
476476
/* PR_WALK_LWP case */
477477
(void) snprintf(pidstr, sizeof (pidstr),
478-
"%s/%ld/lpsinfo", procfs_path, pid);
478+
"%s/%ld/lpsinfo", procfs_path, (long) pid);
479479
fd = open(pidstr, O_RDONLY);
480480
if (fd < 0)
481481
continue;

librtld/makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ $(LIB): \
2222
$(LIB)(rd_elf32.o): rd_elf.c
2323
$(CC) $(CPPFLAGS) -c rd_elf.c
2424
mv rd_elf.o rd_elf32.o
25-
ar rv $(LIB) rd_elf32.o
25+
ar $(ARFLAGS) $(LIB) rd_elf32.o
2626
rm -f rd_elf32.o
2727

2828
$(LIB)(rd_elf64.o): rd_elf.c
2929
$(CC) $(CPPFLAGS) -D_ELF64 -c rd_elf.c
3030
mv rd_elf.o rd_elf64.o
31-
ar rv $(LIB) rd_elf64.o
31+
ar $(ARFLAGS) $(LIB) rd_elf64.o
3232
rm -f rd_elf64.o
3333
clean:
3434
-rm -f *.o *.a

librtld/rtld_db.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828

2929
#include <string.h>
30+
#include <stdlib.h>
3031
#include <stdarg.h>
3132
#include <stdio.h>
3233
#include <errno.h>
@@ -260,7 +261,7 @@ rd_errstr(int rderr)
260261
rd_err_e
261262
rd_event_addr(rd_agent_t *rdap, rd_event_e event, rd_notify_t *notify)
262263
{
263-
printf("proc-stub:%s addr=%p\n", __func__, rdap->rda_addr);
264+
printf("proc-stub:%s addr=%p\n", __func__, (void *) rdap->rda_addr);
264265
notify->type = RD_NOTIFY_BPT;
265266
notify->u.bptaddr = rdap->rda_addr;
266267

linux/sys/signal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@
6969
#define SIGILL 4
7070
#define SIGTRAP 5
7171
#define SIGABRT 6
72+
# if !defined(SIGIOT)
7273
#define SIGIOT 6
74+
# endif
7375
#define SIGBUS 7
7476
#define SIGFPE 8
7577
#define SIGKILL 9
@@ -95,7 +97,9 @@
9597
#define SIGVTALRM 26
9698
#define SIGPROF 27
9799
#define SIGWINCH 28
100+
# if !defined(SIGIO)
98101
#define SIGIO 29
102+
# endif
99103
#define SIGPOLL SIGIO
100104
#define SIGCANCEL 36 /* reserved signal for thread cancellation */
101105

tests/syscalls.c

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,25 @@
55
/* problems. */
66
/**********************************************************************/
77
# include <stdio.h>
8+
# include <unistd.h>
89
# include <fcntl.h>
910
# include <stdlib.h>
1011
# include <string.h>
1112
# include <signal.h>
1213
# include <errno.h>
14+
# include <unistd.h>
15+
# include <sys/types.h>
16+
# include <sys/stat.h>
17+
# include <sys/time.h>
18+
# include <sys/mman.h>
19+
# include <sys/ipc.h>
20+
# include <sys/sem.h>
21+
# include <sys/shm.h>
22+
# include <poll.h>
23+
# include <sys/uio.h>
24+
# include <sys/fsuid.h>
25+
# include <sched.h>
26+
# include <sys/file.h>
1327
/*# include <sys/vm86.h>*/
1428

1529
static int cnt;
@@ -108,8 +122,8 @@ int main(int argc, char **argv)
108122
x += getuid();
109123
x += getgid();
110124
x += setsid();
111-
x += seteuid();
112-
x += setegid();
125+
x += seteuid(0);
126+
x += setegid(0);
113127
lseek(0, 0, -1);
114128
kill(0, 0);
115129
signal(99, 0);
@@ -118,36 +132,36 @@ int main(int argc, char **argv)
118132
// *(int *) 0 = 0;
119133
pipe(0);
120134
munmap(0, 0);
121-
mincore(0, 0);
122-
shmget(0);
123-
shmat(0);
135+
mincore(0, 0, 0);
136+
shmget(0, 0, 0);
137+
shmat(0, 0, 0);
124138

125139
line = __LINE__;
126-
poll(-1, 0, 0);
140+
poll((void *) -1, 0, 0);
127141
signal(SIGSEGV, SIG_IGN);
128142
// ppoll(-1, -1, -1, 0);
129143
signal(SIGSEGV, SIG_DFL);
130144
sched_yield();
131-
readv(-1, 0, 0, 0);
132-
writev(-1, 0, 0, 0);
145+
readv(-1, 0, 0);
146+
writev(-1, 0, 0);
133147
msync(0, 0, 0);
134148
fsync(-1);
135149
fdatasync(-1);
136150
semget(0, 0, 0);
137151
semctl(0, 0, 0);
138-
uselib(NULL);
152+
// uselib(NULL);
139153
pivot_root(0, 0);
140154
personality(-1);
141155
setfsuid(-1);
142156
flock(-1, 0);
143-
shmdt(0, 0, 0);
157+
shmdt(0);
144158
times(0);
145159
mremap(0, 0, 0, 0, 0);
146160
madvise(0, 0, 0);
147161
fchown(-1, 0, 0);
148-
lchown(0, 0, 0);
149-
setreuid();
150-
setregid();
162+
lchown("", 0, 0);
163+
setreuid(0, 0);
164+
setregid(0, 0);
151165
link("/nonexistant", "/also-nonexistant");
152166

153167
do_slow();
@@ -156,11 +170,10 @@ int main(int argc, char **argv)
156170
rename("/", "/");
157171
mkdir("/junk/stuff////0", 0777);
158172
geteuid();
159-
getsid();
160-
getpgid();
173+
getsid(0);
174+
getpgid(0);
161175
getresuid();
162176
getresgid();
163-
getpgid();
164177
ptrace(-1, 0, 0, 0);
165178
semop(0, 0, 0);
166179
capget(0, 0);
@@ -170,7 +183,7 @@ int main(int argc, char **argv)
170183
settimeofday(0, 0);
171184
dup(-1);
172185
dup2(-1, -1);
173-
shmctl(0, 0, 0, 0);
186+
shmctl(0, 0, 0);
174187
execve("/bin/nothing", "/bin/nothing", 0);
175188
alarm(9999);
176189
bind(0, 0, 0);
@@ -199,7 +212,7 @@ int main(int argc, char **argv)
199212
sigprocmask(0, 0, 0);
200213
x += open("/nothing", 0);
201214
x += chdir("/nothing");
202-
x += mknod("/nothing/nothing", 0);
215+
x += mknod("/nothing/nothing", 0, 0);
203216
x += ioctl();
204217
execve("/nothing", NULL, NULL);
205218
line = __LINE__;
@@ -213,7 +226,7 @@ int main(int argc, char **argv)
213226
brk(0);
214227
sbrk(0);
215228
line = __LINE__;
216-
mmap(0, 0, 0, 0, 0);
229+
mmap(0, 0, 0, 0, 0, 0);
217230
line = __LINE__;
218231
uname(0);
219232
line = __LINE__;
@@ -226,7 +239,7 @@ int main(int argc, char **argv)
226239
umount(0, 0, 0);
227240
swapon(0, 0);
228241
swapoff(0);
229-
sethostname(0);
242+
sethostname(0, 0);
230243
line = __LINE__;
231244
time(NULL);
232245
unlink("/nothing");

0 commit comments

Comments
 (0)