summaryrefslogtreecommitdiff
path: root/lib/utils.c
Commit message (Collapse)AuthorAgeFilesLines
* Update local copies of include/linuxThomas Graf2011-06-091-0/+1
|
* Add nl_rate2str()Thomas Graf2011-06-091-0/+21
|
* Add support for ARPHRD_NONEThomas Graf2011-04-191-0/+3
|
* Initialize dump buffer in case caller missed itThomas Graf2011-04-101-0/+3
| | | | | (Set an end to all the bug reports of applications failing to do so.)
* constify struct trans_tblThomas Graf2010-11-171-8/+8
|
* New function nl_size2str()Thomas Graf2010-11-171-0/+50
|
* Rename nl_get_hz() to nl_get_user_hz() to indicate it's not the in-kernel HZ ↵Thomas Graf2010-11-171-4/+8
| | | | value
* Updated arp and ethernet codesThomas Graf2010-10-291-0/+20
|
* Fix compile warning in utils.cThomas Graf2010-07-031-1/+1
|
* Fix a bug when calculating ticks_per_usecJose Ignacio Naranjo Hernández2010-03-101-19/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've noticed a wrong behavior when setting up some delays in a netem qdisc. I will try to make the things easier for the reader describing the calls path. To set up a delay (or jitter...) I use 'rtnl_netem_set_delay' which requires an int parameter that tells the delay in micro seconds. Inside this func, the delay is set up with the help of 'nl_us2ticks', which is just an arithmetic operation (us * ticks_per_usec), where us is the input parameter and ticks_per_usec is a global variable initialized in 'get_psched_settings'. And here is the problem: If this variable is going to be calculated using '/proc/net/psched', I think the file scan is not done properly. I don't understand what the meaning of the asterisk is here: int r = fscanf(fd, "%08x%08x%08x%*08x", &tick, &us, &nom); if (4 == r && nom == 1000000 && !got_tick) ticks_per_usec = (double)tick/(double)us; The execution path never gets in the if statement, because r is always 3, and if the fourth parameter is read (avoiding the asterisk), there is no variable to store it in, so it comes a segv. In my opinion we can get rid of the if statement, because I think the proc psched file has always a fixed format of 4 parameters, and 'nom' is always 1000000 (http://lxr.linux.no/#linux+v2.6.32/net/sched/sch_api.c#L1678). Find attached a patch I did, if I am correct.
* restructure module documentation orderThomas Graf2008-12-101-0/+42
| | | | split hiearchy into one top level module per library
* Extend nl_time2int() and rename it to nl_str2msec()Thomas Graf2008-06-161-14/+29
| | | | Support parsing of more complex time duration input.
* Remove old line counting while dumpingThomas Graf2008-05-231-3/+2
|
* Return libnl error codes in translation routinesThomas Graf2008-05-201-12/+12
|
* Uninline various functions to save 7K codeThomas Graf2008-05-151-2/+194
|
* Thread-safe error handlingThomas Graf2008-05-141-91/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for the interface to become more thread safe, the error handling was revised to no longer depend on a static errno and error string buffer. This patch converts all error paths to return a libnl specific error code which can be translated to a error message using nl_geterror(int error). The functions nl_error() and nl_get_errno() are therefore obsolete. This change required various sets of function prototypes to be changed in order to return an error code, the most prominent are: struct nl_cache *foo_alloc_cache(...); changed to: int foo_alloc_cache(..., struct nl_cache **); struct nl_msg *foo_build_request(...); changed to: int foo_build_request(..., struct nl_msg **); struct foo *foo_parse(...); changed to: int foo_parse(..., struct foo **); This pretty much only leaves trivial allocation functions to still return a pointer object which can still return NULL to signal out of memory. This change is a serious API and ABI breaker, sorry!
* Export nl_dump_line() and automatically count lines while dumpingThomas Graf2008-04-291-4/+17
|
* Read debugging environment variable when initializing the libraryThomas Graf2007-12-181-1/+9
|
* Export interface to define objectsThomas Graf2007-09-151-0/+54
| | | | | | | | | | | This interface was internal so far which required all code defining objects to be compiled with the sources available. This change exposes struct nl_object_ops which seems safe as it is not supposed to be embedded in other structures. Patch contains extensive documentation to help with the creation of own object implementations.
* Initial importThomas Graf2007-09-151-0/+701