Initial commit.
[hondza-y36pr2.git] / README
blob25e56451da3733e745b63bd20936c3eda1b34ba9
2 This is a set of tools I originally made for myself. Some of them may be of use
3 for somebody, though.
5 Things with no "foreign" code, written entirely by me (cache, createsparse,
6 fadvise, mark, newns, nodevrandom, setrlimit, sparse, tos, xtma) are hereby
7 placed in public domain (where appllicable). Read: do whatever you want with
8 it, but don't blame me.
10 Some other things (sha256sum) use portions of GPL code, so due to the GPL virus
11 it's GPL. Non-win32 sha256sum doesn't need GPL'd getline.[ch] though...
14 A brief summary of the tools:
17 cache
18 -----
20 posix_fadvise() frontend. May be used to "cache" or "uncache" given files.
24 createsparse
25 ------------
27 Creates a set of sparse files (as specified on the command line) of given size.
28 (Inside it is just fopen() folowed by fseek(), putc() and fclose(), nothing
29 more.)
31 Usage: createsparse <size[kKmMgG]> <filename> [filenames ...]
35 fadvise
36 -------
38 write(), fwrite{,_unlocked}(), read(), fread{,_unlocked}(), close(), fclose()
39 wrapper using posix_fadvise().
41 When a dynamically linked program is run via this, it will have changed the
42 caching behavior. It is rather crude (calling posix_fadvise() for every call of
43 the functions), yet useful. Especially the default "don't cache" mode. Imagine
44 you need to copy a huge directory from one disk to another, knowing that after
45 the copy is done, you won't use it anymore. This tool advises the kernel that
46 this file won't be needed anytime soon.
48 Usage: fadvise program [that program options]
52 mark
53 ----
55 Very simple socket() wrapper. Calls setsockopt(... SO_MARK ...) for every
56 AF_INET socket() call. Mark is specified as an env. variable (or defaults to
57 1).
59 Useful when you need some means to classify packets from usermode to later
60 apply policy routing (via fwmark).
62 Usage: MARK=some_number mark program [that program options]
66 newns
67 -----
69 clone() frontend which sets the "unshare" flags (CLONE_NEWNS, CLONE_NEWPID,
70 CLONE_NEWUTS, CLONE_NEWUSER, CLONE_NEWIPC). Useful for playing with
71 *-namespaces (notably PID namespaces).
73 Usage: newns [options] -- program [that program options]
77 nodevrandom
78 -----------
80 {,f}open{,64}() wrapper that intercepts opening of /dev/random and changes the
81 opened file to /dev/urandom, therefore preventing the program to block
82 "forever". Some bad program are written in a way that they open /dev/random
83 (which may block very very long for new entropy to arrive).
85 Usage: nodevrandom program [that program options]
89 setrlimit
90 ---------
92 setrlimit() frontend. It does pretty much the same as shell's "ulimit" builtin
93 does, except that it is NOT shell builtin. Imagine you are in a VERY memory
94 restricted environment. Then even running a shell just to set some limit is way
95 too much overhead. This tool is handy for example for chroot environments ...
97 Usage: setrlimit [options] -- /path/to/executable [arguments]
101 sha256sum
102 ---------
104 Chesumming tool. Does pretty much the same job as "vanilla"
105 {md5,sha1,sha256}sum, except that it supports crc32 as well (not much win
106 there, actually) and by default generates an auxiliary record that contains the
107 file size as well.
111 sparse
112 ------
114 Reads standard input and ouputs a file with "holes" (a sparse file) when the
115 filesystem supports it. Useful for disk image files kept on filesystem (e.g.
116 virtual machines, ...)
118 Usage: sparse new_file < old_file
125 socket() wrapper similar to mark. Classifies packets by ToS (type of service).
126 Don't use unless necessary. Use mark instead where possible.
130 xtma
131 ----
133 Simple X program that draws a fullscreen black window (with no decoration
134 whatsoever). Useful when you play windows games in wine in pseudo-fullscreen
135 (vitual desktop). Just run xtma in some desktop, run the wine game, make it
136 fullscreen, switch to xtma and back and ... the pseudo-fullscreen doesn't
137 contain the window manager crap anymore. YMMV.