Skip to content

Commit e4983a3

Browse files
committed
Arrange tool directory
1 parent 6a4ba90 commit e4983a3

File tree

5 files changed

+25
-26
lines changed

5 files changed

+25
-26
lines changed

.gitignore

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,3 @@ lib/machine_include/
2020
lib/vnode_if.h
2121
lib/vnode_if_newproto.h
2222
lib/vnode_if_typedef.h
23-
app/nginx-1.11.10/Makefile
24-
app/nginx-1.11.10/objs/
25-
tools/arp/arp
26-
tools/ifconfig/ifconfig
27-
tools/ipfw/ipfw
28-
tools/netstat/netstat
29-
tools/netstat/nl_defs.h
30-
tools/netstat/nl_symbols.c
31-
tools/ngctl/ngctl
32-
tools/route/keywords.h
33-
tools/route/route
34-
tools/sysctl/sysctl
35-
tools/top/top

tools/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
netstat/nl_defs.h
2+
netstat/nl_symbols.c
3+
route/keywords.h
4+
netstat/nl_defs.h
5+
netstat/nl_symbols.c
6+
route/keywords.h

tools/README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Directory `compat` implements an ipc library using dpdk `rte_ring` and ports some source files compatible with FreeBSD and Linux.
44

5+
Directory `sbin` contains all the tools binary that compiled.
6+
57
All other directories are useful tools ported from FreeBSD.
68
Since F-Stack is multi-process architecture and every process has an independent stack, so we must communicate with every F-Stack process.
79
Each tool add an option `-p`(Which F-Stack process to communicate with, default 0), except that, it is same with the original FreeBSD.
@@ -48,38 +50,38 @@ Examples:
4850
```
4951
Add a default route:
5052
51-
./route -p 0 add -net 0.0.0.0/0 192.168.1.1
53+
./sbin/route -p 0 add -net 0.0.0.0/0 192.168.1.1
5254
5355
A shorter version of adding a default route can also be written as:
5456
55-
./route -p 0 add default 192.168.1.1
57+
./sbin/route -p 0 add default 192.168.1.1
5658
5759
Add a static route to the 172.16.10.0/24 network via the 172.16.1.1 gate-
5860
way:
5961
60-
./route -p 0 add -net 172.16.10.0/24 172.16.1.1
62+
./sbin/route -p 0 add -net 172.16.10.0/24 172.16.1.1
6163
6264
Change the gateway of an already established static route in the routing
6365
table:
6466
65-
./route -p 0 change -net 172.16.10.0/24 172.16.1.2
67+
./sbin/route -p 0 change -net 172.16.10.0/24 172.16.1.2
6668
6769
Display the route for a destination network:
6870
69-
./route -p 0 show 172.16.10.0
71+
./sbin/route -p 0 show 172.16.10.0
7072
7173
Delete a static route from the routing table:
7274
73-
./route -p 0 delete -net 172.16.10.0/24 172.16.1.2
75+
./sbin/route -p 0 delete -net 172.16.10.0/24 172.16.1.2
7476
7577
Remove all routes from the routing table:
7678
77-
./route -p 0 flush
79+
./sbin/route -p 0 flush
7880
7981
FreeBSD uses `netstat -rn ` to list the route table which we havn't ported,
8082
you can execute the following command instead, `-d` means debug mode, `-v`
8183
means verbose.
82-
./route -p 0 -d -v flush
84+
./sbin/route -p 0 -d -v flush
8385
```
8486
Note that, if you want to modify the route table, you must use `-p` to execute the same command for each f-stack process.
8587

@@ -92,7 +94,7 @@ top [-p <f-stack proc_id>] [-d <secs>] [-n num]
9294
```
9395
Examples:
9496
```
95-
./tools/top/top
97+
./sbin/top
9698
9799
|---------|---------|---------|---------------|
98100
| idle| sys| usr| loop|
@@ -219,7 +221,7 @@ traffic [-p <f-stack proc_id>] [-d <secs>] [-n num]
219221
```
220222
Examples:
221223
```
222-
./tools/traffic/traffic
224+
./sbin/traffic
223225
224226
|--------------------|--------------------|--------------------|--------------------|
225227
| rx packets| rx bytes| tx packets| tx bytes|

tools/prog.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ SRCS= ${PROG}.c
3535
endif
3636
endif
3737

38+
PROGDIR= ${TOPDIR}/tools/sbin
39+
3840
HEADERS+= $(filter %.h,${SRCS})
3941
OBJS+= $(patsubst %.c,%.o, $(filter %.c,${SRCS}))
4042
OBJS+= $(patsubst %.cc,%.o, $(filter %.cc,${SRCS}))
@@ -63,13 +65,13 @@ LIBS+= ${FF_PROG_LIBS}
6365
CFLAGS+= $(foreach n,${LIBADD},-I${TOPDIR}/tools/lib${n})
6466
LIBS+= $(foreach n,${LIBADD},-L${TOPDIR}/tools/lib${n} -l${n})
6567

66-
CLEANFILES+= ${PROG} ${OBJS}
68+
CLEANFILES+= ${PROGDIR}/${PROG} ${OBJS}
6769

6870
${PROG}: ${HEADERS} ${OBJS}
6971
ifdef PROG_CXX
70-
${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}
72+
${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${PROGDIR}/${PROG} ${OBJS} ${LIBS}
7173
else
72-
${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}
74+
${CC} ${CFLAGS} ${LDFLAGS} -o ${PROGDIR}/${PROG} ${OBJS} ${LIBS}
7375
endif
7476

7577
clean:

tools/sbin/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

0 commit comments

Comments
 (0)