Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr base test #6

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3291eb3
Makefile: Shrink 'snabb' from 2MB to 0.6MB with UPX
lukego Sep 6, 2015
2e67903
Avoid ctype diversity for registers in intel10g
alexandergall Sep 9, 2015
ee0ebbe
pmu_x86: Fix bug where machine code gets GC'd
lukego Sep 13, 2015
52806ea
pmu: Minor improvements to reporting interface
lukego Sep 13, 2015
0a3e398
Merge PR #604 (snabbnfv promisc mode) into next
lukego Sep 14, 2015
f0f5f9b
lib.pmu: Fixed bug that required affinity to CPU core 0
lukego Sep 14, 2015
2af9164
Merge PR #614 (lib.pmu improvement) into next
lukego Sep 14, 2015
3139933
deps: Removed all submodules
lukego Sep 14, 2015
532f9f4
Squashed 'lib/luajit/' content from commit 55c3b29
lukego Sep 14, 2015
2d8ba7c
Merge commit '532f9f4dcb1a8fbccb3c766be96f72b995834b03' as 'lib/luajit'
lukego Sep 14, 2015
77c63c9
Squashed 'lib/pflua/' content from commit cc651ae
lukego Sep 14, 2015
618a0fe
Merge commit '77c63c9c2ae211911532b6a2923dcf79f9279533' as 'lib/pflua'
lukego Sep 14, 2015
ec17feb
Squashed 'lib/ljsyscall/' content from commit d78235c
lukego Sep 14, 2015
be03ff5
Merge commit 'ec17feb164a087e236e723943efd7744ea46e996' as 'lib/ljsys…
lukego Sep 14, 2015
401932e
Updated build scripts for subtree-based libararies
lukego Sep 14, 2015
d78d7a9
READMEs: '--recursive' no longer needed for git-clone
lukego Sep 14, 2015
3b9570a
Merge PR #610 (UPX compression) into next
lukego Sep 14, 2015
64045b2
Merge PR #612 (intel10g ctype fix) into next
lukego Sep 14, 2015
6d7602c
Merge PR #617 (submodule to subtree switch) into next
lukego Sep 14, 2015
065979c
jit.p: Add support for profiling at trace granularity
lukego Sep 14, 2015
53aedce
jit.p: Add CPU performance counters as profiler source
lukego Sep 14, 2015
a212176
jit.p: Enhance 'v' mode of profiler
lukego Sep 14, 2015
863854c
Merge PRs #619 #620 #621 (LuaJIT extensions) into next
lukego Sep 14, 2015
ef49da4
jit.util.traceinfo(): Include mcode, mcloop, szmcode
lukego Sep 23, 2015
d467236
lib.traceprof: New profiler (alternative to jit.p)
lukego Sep 23, 2015
51ddd8e
snsh: Add '-jtprof' to enable traceprof profiling
lukego Sep 23, 2015
0ba096c
lib.traceprof: Include inter-trace linkage
lukego Sep 23, 2015
ddabbd6
intel10g: Enable TX prefetch for 14.8 Mpps
lukego Sep 28, 2015
c29f053
intel10g: Fix error in tx prefetch enable for VF mode
lukego Sep 28, 2015
dd53917
snsh: Added '-q' to break program to REPL via keyboard
lukego Sep 28, 2015
8e7c32c
src/README.md: Document engine.configure() multiple calls
lukego Sep 30, 2015
63d3158
lib.pmu.writemsr(): Improve error message
lukego Sep 30, 2015
f87990e
snsh: Changed --sigquit-repl (-q) to --sigquit=repl (-qrepl)
lukego Oct 1, 2015
32957f6
Merge PR #629 (snsh -q) into next
lukego Oct 1, 2015
a076cda
Merge PR #630 (README engine.configure()) into next
lukego Oct 1, 2015
0a1bc5d
Merge PR #628 (intel10g txdesc prefetch) into next
lukego Oct 1, 2015
5934fc4
Merge PR #632 (pmu.writemsr() errormsg) into next
lukego Oct 1, 2015
fdf5b29
Merge PR #623 (traceprof) into next
lukego Oct 1, 2015
1192957
lib/ljsyscall: Remove dangling git submodules
lukego Oct 2, 2015
5451d6d
lib/pflua: Remove dangling git submodule
lukego Oct 2, 2015
b0c770b
Merge PR #639 (fix dangling submodules) into next
lukego Oct 2, 2015
20532ef
Merge pull request #618 from SnabbCo/next
eugeneia Oct 5, 2015
9b85855
Test commit.
eugeneia Nov 4, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 0 additions & 10 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +0,0 @@
[submodule "deps/luajit"]
path = deps/luajit
url = http://github.com/SnabbCo/luajit.git
ignore = dirty
[submodule "deps/ljsyscall"]
path = deps/ljsyscall
url = https://github.com/justincormack/ljsyscall.git
[submodule "deps/pflua"]
path = deps/pflua
url = https://github.com/SnabbCo/pflua.git
56 changes: 14 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,29 @@ LUAOBJ = $(LUASRC:.lua=.o)
CSRC = $(wildcard src/c/*.c)
COBJ = $(CSRC:.c=.o)

LUAJIT := deps/luajit.vsn
SYSCALL := deps/syscall.vsn
PFLUA := deps/pflua.vsn

LUAJIT_CFLAGS := -include $(CURDIR)/gcc-preinclude.h

all: $(LUAJIT) $(SYSCALL) $(PFLUA)
@echo "Building snabbswitch"
# LuaJIT
@(cd lib/luajit && \
$(MAKE) PREFIX=`pwd`/usr/local \
CFLAGS="$(LUAJIT_CFLAGS)" && \
$(MAKE) DESTDIR=`pwd` install)
(cd lib/luajit/usr/local/bin; ln -fs luajit-2.1.0-beta1 luajit)
# ljsyscall
@mkdir -p src/syscall/linux
@cp -p lib/ljsyscall/syscall.lua src/
@cp -p lib/ljsyscall/syscall/*.lua src/syscall/
@cp -p lib/ljsyscall/syscall/linux/*.lua src/syscall/linux/
@cp -pr lib/ljsyscall/syscall/linux/x64 src/syscall/linux/
@cp -pr lib/ljsyscall/syscall/shared src/syscall/
cd src && $(MAKE)

install: all
install -D src/snabb ${PREFIX}/usr/local/bin/snabb

$(LUAJIT):
@if [ ! -f deps/luajit/Makefile ]; then \
echo "Initializing LuaJIT submodule.."; \
git submodule update --init deps/luajit; \
fi
@echo 'Building LuaJIT'
@(cd deps/luajit && \
$(MAKE) PREFIX=`pwd`/usr/local \
CFLAGS="$(LUAJIT_CFLAGS)" && \
$(MAKE) DESTDIR=`pwd` install && \
git describe > ../luajit.vsn)
(cd deps/luajit/usr/local/bin; ln -fs luajit-2.1.0-alpha luajit)

$(PFLUA): $(LUAJIT)
@if [ ! -f deps/pflua/src/pf.lua ]; then \
echo "Initializing pflua submodule.."; \
git submodule update --init deps/pflua; \
fi
# pflua has no tags at time of writing, so use raw commit id
@(cd deps/pflua && git rev-parse HEAD > ../pflua.vsn)

$(SYSCALL): $(PFLUA)
@if [ ! -f deps/ljsyscall/syscall.lua ]; then \
echo "Initializing ljsyscall submodule.."; \
git submodule update --init deps/ljsyscall; \
fi
@echo 'Copying ljsyscall components'
@mkdir -p src/syscall/linux
@cp -p deps/ljsyscall/syscall.lua src/
@cp -p deps/ljsyscall/syscall/*.lua src/syscall/
@cp -p deps/ljsyscall/syscall/linux/*.lua src/syscall/linux/
@cp -pr deps/ljsyscall/syscall/linux/x64 src/syscall/linux/
@cp -pr deps/ljsyscall/syscall/shared src/syscall/
@(cd deps/ljsyscall; git describe > ../ljsyscall.vsn)

clean:
(cd deps/luajit && $(MAKE) clean)
(cd lib/luajit && $(MAKE) clean)
(cd src; $(MAKE) clean; rm -rf syscall.lua syscall)
(rm deps/*.vsn)

.SERIAL: all
1 change: 1 addition & 0 deletions TEST
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello
1 change: 0 additions & 1 deletion deps/ljsyscall
Submodule ljsyscall deleted from 7081d9
1 change: 0 additions & 1 deletion deps/luajit
Submodule luajit deleted from 5feb63
1 change: 0 additions & 1 deletion deps/pflua
Submodule pflua deleted from 5e2c56
6 changes: 6 additions & 0 deletions lib/ljsyscall/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# misc temp files
tmp/*
*~
*.core
ktrace.out
obj/*
9 changes: 9 additions & 0 deletions lib/ljsyscall/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "include/buildrump.sh"]
path = include/buildrump.sh
url = https://github.com/rumpkernel/buildrump.sh.git
[submodule "include/ffi-reflect"]
path = include/ffi-reflect
url = https://github.com/corsix/ffi-reflect
[submodule "include/linux-kernel-headers"]
path = include/linux-kernel-headers
url = https://github.com/sabotage-linux/kernel-headers.git
28 changes: 28 additions & 0 deletions lib/ljsyscall/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
language: c

before_install:
- sudo add-apt-repository ppa:mwild1/ppa -y
- sudo apt-get update -y
- sudo apt-get install luajit -y --force-yes
- sudo apt-get install luarocks -y
- sudo apt-get install strace -y
- git submodule update --init --recursive

env:
- LD_LIBRARY_PATH=./include/buildrump.sh/rump/lib

script:
- luajit test/test.lua
- mkdir -p ./obj
- luajit test/ctest.lua > ./obj/ctest.c && cc -std=c99 ./obj/ctest.c -o ./obj/ctest && ./obj/ctest
- ./test/globals.sh
- test ! -n "`./test/check-rockspec.sh`"
- cd ./include/buildrump.sh && ./buildrump.sh -qq -j16 -V NOSTATICLIB=1 && cd ../..
- luajit test/test.lua rump
- luajit test/linux-constants.lua x64 > ./obj/c.c && cc -U__i386__ -DBITS_PER_LONG=64 -I./include/linux-kernel-headers/x86_64/include -o ./obj/c ./obj/c.c && ./obj/c
- luajit test/linux-constants.lua x86 > ./obj/c.c && cc -D__i386__ -DBITS_PER_LONG=32 -I./include/linux-kernel-headers/i386/include -o ./obj/c ./obj/c.c && ./obj/c
- luajit test/linux-constants.lua arm > ./obj/c.c && cc -D__ARM_EABI__ -DBITS_PER_LONG=32 -I./include/linux-kernel-headers/arm/include -o ./obj/c ./obj/c.c && ./obj/c
- luajit test/linux-constants.lua ppc > ./obj/c.c && cc -I./include/linux-kernel-headers/powerpc/include -o ./obj/c ./obj/c.c && ./obj/c
- luajit test/linux-constants.lua mips > ./obj/c.c && cc -D__MIPSEL__ -D_MIPS_SIM=_MIPS_SIM_ABI32 -DCONFIG_32BIT -DBITS_PER_LONG=32 -D_MIPS_SZLONG=32 -D__LITTLE_ENDIAN_BITFIELD -D__LITTLE_ENDIAN -DCONFIG_CPU_LITTLE_ENDIAN -I./include/linux-kernel-headers/mips/include -o ./obj/c ./obj/c.c && ./obj/c
- luajit test/linux-structures.lua x64 > ./obj/c.c && cc -U__i386__ -DBITS_PER_LONG=64 -I./include/linux-kernel-headers/x86_64/include -o ./obj/c ./obj/c.c && ./obj/c

30 changes: 30 additions & 0 deletions lib/ljsyscall/COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
The ABI description files (ffifunctions, ffitypes, constants) do not consist of
copyrightable material and should be considered public domain.

Files under the include directory include their own copyright information.


ljsyscall: System call interface for LuaJIT

Copyright (C) 2011-2014 Justin Cormack. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

[ MIT license: http://www.opensource.org/licenses/mit-license.php ]

101 changes: 101 additions & 0 deletions lib/ljsyscall/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
unreleased
+ OSX time functions
+ OSX Mach types
+ arm64 support
+ OpenBSD 5.6 and 5.7 support
+ ppc64le support, by Gustavo Serra Scalet
+ mipsel support

0.10 release

+ Additional ioctls
+ FreeBSD 9 support
+ Linux MIPS now fully supported
+ more timer, clock and signal functions for BSDs.
+ error message fixes
+ FreeBSD, OSX extended attribute support
+ Linux PPC fixes
+ Luafilesystem compatibility module
+ New rockspecs for stable version, thanks to Hisham
+ Add remap_file_pages, thanks to Brian Downing
+ Add getpagesize
+ All syscalls now direct not via libc on Linux
+ OpenBSD support (5.4 and 5.5), thanks to tedu
+ sysctl support
+ timer_* syscall support
+ time functions for rump kernel
+ fix backtraces on error
+ improved tests for OS versions
+ add recvmmsg, sendmmsg

0.9 release

+ Bug fixes and better tests
+ Reworking of how methods are called
+ More NetBSD support
+ termios interface rework
+ improved ioctl that understands type and direction of arguments
+ More NetBSD network config
+ Rump kernel Linux ABI support
+ Full Linux ppc support, endian fixes
+ Android fixes
+ Xen support
+ kqueue, poll and epoll interface improvements
+ additional syscalls
+ luaffi supported again
+ Better kernel headers and fixes against them
+ More Linux MIPS support
+ Improved APIs with multiple return values
+ Initial NetBSD ktrace support
+ FreeBSD support
+ More OSX support
+ Sharing of common BSD code.

0.8 release

+ Rump kernel fixes
+ NetBSD 64 bit fixes
+ Initial arp/neighbour support
+ Work towards MIPS support
+ Cmsg cleanup, shm_open, iterators for directory iteration and ls
+ More OSX and NetBSD support
+ Initial cgroups support
+ Initial support of NetBSD network config.

0.7 release

+ Bug fixes, general cleanups
+ Filesystem capabilities, xattr bug fixes, signal handler functions, cpu affinity support, scheduler functions, POSIX message queues, tun/tap support, ioctl additions and improvements
+ Initial NetBSD and OSX support
+ Initial NetBSD rump kernel support
+ Some fixes to allow Android to work.

0.6 release

+ Add support for raw sockets, BPF, seccomp mode 2 (syscall filtering), capabilities
+ feature tests
+ bug fixes

0.5 release

+ Add support for ppc
+ Some bug fixes for 64 bit file handling on 32 bit architectures
+ Better organisation of files

0.4 release

+ Works well with LuaJIT 2.0.0 and has had extensive testing.
+ Somewhat modular code now, which makes it easier to use and understand.

0.3 release

+ The last release to work with luaffi.

0.2 release

+ Work in progress release.

0.1 release

+ Very early prototype.

16 changes: 16 additions & 0 deletions lib/ljsyscall/INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Installation instructions

Make sure you have LuaJIT, at least version 2.0.2, installed.

You need to put the file syscall.lua and the directory syscall and its contents in the same directory where they will be found by LuaJIT. This can vary by system, but you can find out with `luajit -e 'print(package.path)'` for your system. You do not need all the files, you can delete operating system and architecture files you do not require.

You can use the stable versions in the luarocks repository, or you can install the head version using ```luarocks install rockspec/ljsyscall-scm-1.rockspec``` or one of the other versions in that directory, which will pull the version from github and install in the right place.

None of the files in include/ are needed to use the code, just to run the tests. You need to run `git submodule update --init --recursive` to load them before running the tests with `luajit test/test.lua`.

The optional NetBSD rump kernel support requires building the libraries using the `include/buildrump.sh` submodule, for more information see http://rumpkernel.org/

There is some work in progress towards other build patterns such as building into a single binary, see in the examples directory, this will have more documentation later; this is currently used by the Xen runtime for example, or can be used to make static executables. If you want to link into a C program (or something else interfacing to C, such as another scripting language), there are some example scripts. `examples/bytecode.sh` creates an `ar` file with all the bytecode in, and `examples/cbuild.sh` makes a hello world program in C with ljsyscall and luajit linked in. These are only intended as examples to be customised as appropriate, and they link in all files not just the required ones for your architecture.



Loading