Commit Graph

998 Commits

Author SHA1 Message Date
Lucas De Marchi d2c2b8b500 build-sys: autotoolify build of check libraries
Many thanks to Iván Briano (sachieru@gmail.com) for pointing out this
thread in libtool mailing list:
	http://www.mail-archive.com/libtool@gnu.org/msg09627.html

Passing '-rpath /nowhere' in LDFLAGS we are able to create shared libs
that are not installed.
2012-01-26 16:05:05 -02:00
Lucas De Marchi 53646fc56f testsuite: add trap to init_module() including simple test 2012-01-26 16:05:05 -02:00
Lucas De Marchi ea17e2b043 elf: privately export kmod_elf_get_section()
This function is used to find a certain section in ELF file. It will be
used to get the modname from an ELF file.
2012-01-26 16:05:05 -02:00
Lucas De Marchi 95daea07f4 testsuite: add test for modinfo
These ext4 modules were sent by Jon Master so we can test the result of
modinfo with modules generated for different architectures.

They are now added to testsuite and their output tested automatically.
2012-01-26 16:05:05 -02:00
Lucas De Marchi 9e3b9d2e8c testsuite: remind users to build tools 2012-01-26 16:05:05 -02:00
Lucas De Marchi 51b1d1ab28 testsuite: add colors to test output 2012-01-26 16:05:05 -02:00
Lucas De Marchi 61e9433f7c testsuite: add simple test for list of loaded modules 2012-01-26 16:05:05 -02:00
Lucas De Marchi 3dbb8dea5f testsuite: match outputs of test with a known correct one
Tests may put the correct output in a file and tell testsuite to check
if it matches the output from the test running.

Testsuite compares the outputs while running the test: it creates a pipe
between parent and child; parent reads both stdout and stderr from child
and compares with the correct output.
2012-01-26 16:05:05 -02:00
Lucas De Marchi 45481ee28c testsuite: separate child from parent 2012-01-26 16:05:04 -02:00
Lucas De Marchi 6b88ef3e97 testsuite: allow to run tests outside of top_buildir
In order to locate where the shared libs to be preloaded are we need to
reference them using abs_top_buildir. Otherwise we are limited to
running tests from there.
2012-01-26 16:05:04 -02:00
Lucas De Marchi 4e36cb18e1 testsuite: add trap to opendir() including tests 2012-01-26 16:05:04 -02:00
Lucas De Marchi 1426a613fa testsuite: add trap to stat() and friends including tests
Add trap to stat(): we need to trap other functions too, depending on
stat.h, the function from glibc that is actually called may be stat64 or
__xstat() too.
2012-01-26 16:05:04 -02:00
Lucas De Marchi 7fa8c2d2df testsuite: add trap to open() including tests 2012-01-26 16:05:04 -02:00
Lucas De Marchi 6afc9cd616 testsuite: add trap to fopen() including tests 2012-01-26 16:05:04 -02:00
Lucas De Marchi ab25311072 testsuite: fake kernel 4.0.20-kmod is out
Go get it while it's fresh :-). Test fake results of "uname -r" by
LD_PRELOAD'ing uname.so.
2012-01-26 16:05:04 -02:00
Lucas De Marchi 395478cbbb testsuite: export environment with flags and LD_PRELOAD
A certain config can add flags and each flag may be associated with a
lib to LD_PRELOAD. It's now done for uname(2), which requires uname.so
in order to trap the calls.

Other trap will be added in later commits.
2012-01-26 16:05:04 -02:00
Lucas De Marchi ed2df4e984 testsuite: move oneshot to inside the test struct 2012-01-26 16:05:04 -02:00
Lucas De Marchi 68cc449376 testsuite: trap calls to uname 2012-01-26 16:05:04 -02:00
Lucas De Marchi eebca81e94 testsuite: test libkmod initialization 2012-01-26 16:05:04 -02:00
Lucas De Marchi 80f9e02382 testsuite: add skeleton 2012-01-26 16:05:04 -02:00
Lucas De Marchi 3ef848b28b modprobe: fix build 'cause of excessive number of arguments 2012-01-26 16:03:47 -02:00
Dave Reisner cc98830ca4 modprobe: remove code referring to -t, --type
This was only useful with the --list function, which isn't implemented.
2012-01-26 15:07:09 -02:00
Lucas De Marchi 1b3cd9d09f README: add link to packages place
A lot of people trying to get latest package from cgit is not good.
They should get the package from the released versions instead.
2012-01-23 12:29:38 -02:00
Lucas De Marchi fe8b0671a0 build-sys: do not create symlinks by default
Distro packagers should create them instead. It's too much trouble to
create them in the build system and every distro wants a different path
for them.
2012-01-21 18:01:00 -02:00
Lucas De Marchi 569f1609bd modprobe: kill operations depending on path
It was not on module-init-tools and it doesn't make much sense. It will
deal with dependencies, but looking at modules in the index. This might
not be the module we want if we are loading another from outside of the
tree.

Dealing with paths causes this bug (supposing there's a module names
squashfs):

	# cd /
	# touch squashfs
	# modprobe squashfs

That is because it detects that squashfs exists as a file and it will
try to load it instead of the alias "squashfs".

If you need to load a module from a path, use insmod.

Thanks to Silvan Calarco <silvan.calarco@mambasoft.it> who reported the
bug and helped debugging it.
2012-01-21 02:47:08 -02:00
Lucas De Marchi a41b39fb69 TODO: system() should not be used inside a library 2012-01-20 13:04:43 -02:00
Lucas De Marchi 12fd9cd55c build-sys: forcefully create links
If link already existed we would fail. Really not important for
packagers (the link should not exist), but for those who manually install it.
2012-01-18 19:48:16 -02:00
Lucas De Marchi 1592b0efdf build-sys: move modprobe to sbindir 2012-01-18 19:48:16 -02:00
Lucas De Marchi 411d83c41e Add program to calculate the shortest relative path for symlinks 2012-01-18 19:48:16 -02:00
Lucas De Marchi 434f32ca8d libkmod-list: allow to append an empty list 2012-01-17 21:16:23 -02:00
Lucas De Marchi 7bbf52341f build-sys: create symlinks if we are installing tools 2012-01-17 19:33:32 -02:00
Thierry Vignaud eff917c0d2 WEXITSTATUS is defined in sys/wait.h
Fix compiling with dietlibc:

../libkmod/libkmod-module.c:858:2: warning: implicit declaration of function 'WEXITSTATUS' [-Wimplicit-function-declaration]
../libkmod/libkmod-module.c:858:2: warning: nested extern declaration of 'WEXITSTATUS' [-Wnested-externs]
(...)
kmod-modprobe.c:(.text.command_do+0x157): undefined reference to `WEXITSTATUS'
2012-01-17 17:33:07 -02:00
Lucas De Marchi 6068aaaea8 Check if struct stat has mtim member
Not all libc's have a mtim member in struct stat (dietlibc doesn't).
Change ts_usec() to receive a struct stat as parameter and implement it
accordingly for both cases.
2012-01-17 12:22:55 -02:00
Lucas De Marchi 09e9ae58b6 modprobe: flush stdout before dumping indexes
Index dump doesn't use stdio.h function and instead call write()
directly on STDOUT_FILENO file descriptor. Therefore we need to flush
stdio buffers before calling it, to be sure the configuration dump will
appear before index's.
2012-01-17 10:11:03 -02:00
Lucas De Marchi b8542a82b7 Fix common misspelling with codespell
-------8<-------
SUMMARY:
ommitted      1
2012-01-16 23:03:33 -02:00
Miklos Vajna 9be0162f9b man: spelling fixes 2012-01-16 23:01:36 -02:00
Lucas De Marchi b53b7e3282 kmod 4 2012-01-16 16:53:04 -02:00
Lucas De Marchi f4647b6329 build-sys: add release helpers 2012-01-16 16:52:25 -02:00
Lucas De Marchi 0224482e62 Add doc to kmod_dump_index 2012-01-16 16:44:25 -02:00
Lucas De Marchi 49a163759d modprobe: dump indexes as well 2012-01-16 16:05:47 -02:00
Lucas De Marchi 758428a75f libkmod: dump index files
Provide a function to dump the index files to a certain fd. It could be
more optimized (particularly the functions to dump the index that were
copied and pasted from m-i-t), but it seems like the only user of it is
'modprobe -c', used for debugging purposes. So, keep it as is.
2012-01-16 16:05:46 -02:00
Lucas De Marchi f1cbf3cfe2 libkmod-util: add helper function to write to fd 2012-01-16 16:05:46 -02:00
Lucas De Marchi 7a973b0cb0 libkmod-util: adhere to coding style 2012-01-16 16:05:46 -02:00
Lucas De Marchi b08314f7b7 libkmod: export enum kmod_index and rename members 2012-01-16 16:05:36 -02:00
Lucas De Marchi 63be91cbd5 libkmod: store prefix of each index
Prefix is useful when dumping the index (to be added later).
2012-01-16 16:04:32 -02:00
Lucas De Marchi 2f47c7fae9 Update documentation with recent changes 2012-01-14 12:16:48 -02:00
Lucas De Marchi e15a56af85 depmod: deal with relative root dir
module paths coming from libkmod are absolute. Make sure we store the
absolute dirname to compare later.
2012-01-14 02:46:58 -02:00
Lucas De Marchi 2e092e19a7 kmod_new(): deal with relative paths for dirname 2012-01-14 02:32:25 -02:00
Lucas De Marchi 33557e8d69 depmod: fix idx calculation after postponed array creation
We need to set up each module's idx when the array is created. So,
postpone its initialization as well.
2012-01-14 02:07:14 -02:00
Lucas De Marchi 31f1d0d306 Reduce scope of counter variable 2012-01-14 02:04:31 -02:00