Commit Graph

188 Commits

Author SHA1 Message Date
andvar 1cd43426d5 Fix various typos in comments, log messages and documentation. 2024-02-10 18:43:51 +00:00
thorpej fc5ee90beb In _prop_string_instantiate(), when we de-dup a non-MUTABLE string, make
sure we free the provided string buffer if NOCOPY is not set.  Fixes
a memory leak reported by M. Boerschig.

While we're at it, also change _prop_string_instantiate() to free the
provided string buffer in the not-NOCOPY case when string object allocation
fails (this was previously handled by _prop_string_instantiate()'s
callers).

PR lib/57699
2023-11-17 21:29:33 +00:00
rin 8d23affcbe Sprinkle braces around _PROP_RWLOCK_UNLOCK() in ``if'' block.
It is expanded into /* nothing */ for _STANDALONE.
2023-06-14 00:35:18 +00:00
andvar 95f94af301 fix various typos in documentation, comments and sysctl device description.
mainly aion -> ation and inlude -> include.
2023-03-26 19:10:32 +00:00
riastradh 86af3c87c3 proplib: Allocate sizeof(*ctx), not sizeof(struct ...).
No functional change intended.
2022-08-07 23:49:46 +00:00
riastradh e603605e86 proplib: Fix mistake in previous -- use strncmp for prefix matching. 2022-08-04 09:02:29 +00:00
riastradh efe5c7855e proplib: Don't run off end of buffer with memcmp.
The input is required to be NUL-terminated anyway, so just use strcmp
here.

Reported-by: syzbot+69838802c8ec55909ba3@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=927d66e8aa079ba2be43497425a6d9878025ad09
2022-08-03 21:20:21 +00:00
riastradh 3f7675e077 proplib: Nix trailing whitespace. 2022-08-03 21:13:46 +00:00
andvar 218ff21897 s/refrences/references/ 2022-07-02 16:30:13 +00:00
msaitoh 344f0d1e04 s/exisit/exist/ in comment. 2021-12-05 02:52:17 +00:00
andvar 4ddb87935b s/aquire/acquire/ in comments, also one typo fix acqure->acquire. 2021-09-07 13:24:45 +00:00
christos d3ce6b6028 Fix lint 2020-06-20 00:16:50 +00:00
christos 3df41e0b22 remove error(1) comments 2020-06-15 00:46:00 +00:00
christos ad3c244aa9 add/fix linted comments 2020-06-14 21:31:01 +00:00
christos e0cecd8234 Fix incorrect type (found by lint), and add linted comments for the
long long -> long (uintmax_t on LP64)
2020-06-14 21:28:58 +00:00
thorpej 6620d0c742 Change previous to only apply when building with clang. 2020-06-12 00:02:26 +00:00
joerg 3c4ddcbfa9 Unbreak clang builds by removing questionable linker warning sections
trggered all over the place.
2020-06-11 22:25:44 +00:00
thorpej f2709a687f Fix a paste-o that caused prop_data_create_copy() to be intolerant
of creating empty data objects.  Fixes t_ifconfig::ifconfig_description
unit test.
2020-06-08 21:31:56 +00:00
thorpej b1bbd8163d Correct a deprecation warning. 2020-06-06 22:23:31 +00:00
thorpej a792b8435e Improvements to the problib(3) API:
==> Provide a much more complete set of setters and getters for different
    value types in the prop_array_util(3) and prop_dictionary_util(3)
    functions.

==> Overhaul the prop_data(3), prop_number(3), and prop_string(3) APIs
    to be easier to use and less awkwardly named,  Deprecate the old
    awkward names, and produce link-time warnings when they are referenced.

==> Deprecate mutable prop_data(3) and prop_string(3) objects.  The old
    APIs that support them still exist, but will now produce link-time
    warnings when used.

==> When the new prop_string(3) API is used, strings are internally
    de-duplicated as a memory footprint optimization.

==> Provide a rich set of bounds-checked gettter functions in and a
    corresponding set of convenience setters in the prop_number(3) API.

==> Add a new prop_bool_value(3) function that is equivalent to
    prop_bool_true(3), but aligned with the new "value" routines in
    prop_data(3), prop_string(3), and prop_number(3).
2020-06-06 21:25:59 +00:00
thorpej 88c316691b Use posix_madvise() rather than the legacy madvise() call, and
wrapp the calls in #ifdef for the advice we're giving.  Should
address reports of host tool build issues.
2019-05-08 04:34:33 +00:00
thorpej 8319f966d5 Fix building libprop as a host tool library on platforms that don't have
the Matt Thomas rbtree:

- Include rb.c in libnbcompat, and provide a nbcompat sys/rbtree.h
  header.
- Make sure libprop's source file include prop_object_impl.h before
  anything else, and pull in nbtool_config.h from there.

Tested by simulating such a host system by renaming the host's
<sys/rbtree.h> out of the way (which reproduced the build failure)
and verifying that the host-tool installboot contained the rb_*
functions in its own .text segment.
2019-05-08 02:25:50 +00:00
jdolecek bcc384fdef remove M_CANFAIL flag for malloc(9) - it was completely ignored, so had
actually no effect
2018-10-14 17:37:40 +00:00
njoly 656b88f2b5 Fix commas in NAME section. 2017-03-07 19:10:07 +00:00
abhinav b9a7c39267 Add entry for prop_ingest in the NAME section. 2017-02-12 16:18:48 +00:00
abhinav 3ed54b8d62 Use .Fn to refer a function name instead of Nm.
Also, use Xr to refer problib(3) in the HISTORY section instead of Nm.

While parsing the man pages, any .Nm occurrence gets replaced by the
value specified in the NAME section. Referencing individual function
names with .Nm was causing makemandb(8) to replicate the complete
NAME section for every such occurrence. This was leading to an
ugly looking snippet in apropos(1)'s output when searched for
any of these man pages.
2017-02-12 16:00:53 +00:00
pgoyette accf810fc9 Add the *_size() variants to the .Nm list so it will be found by
apropos(1).

While here, reorder the function lists to improve readability.
2017-02-05 00:47:33 +00:00
wiz 4cb81f1b9d Use just the right amount of commas. 2017-02-04 23:32:43 +00:00
christos 0d0d359801 call the proper size functions 2017-01-29 02:29:06 +00:00
christos fc9eacac98 missing brace 2017-01-29 02:07:57 +00:00
pgoyette 7a4cf709e4 Update for the new *_size() functions recently added. Mention the
implicit size limit (128KB) for the functions which do not take an
explicit limit argument.
2017-01-29 01:38:02 +00:00
christos d185461508 add sized versions of the copyin ioctls 2017-01-29 00:16:42 +00:00
wiz 7d1bc67258 Sort errors. 2017-01-15 22:14:22 +00:00
pgoyette 4545115c63 Document E2BIG error when copying a large object. 2017-01-15 21:42:09 +00:00
christos 0c925f5c13 bump to 128K (because of npf large rules) and return E2BIG. 2017-01-15 18:15:45 +00:00
pgoyette fc18a7c1c6 Fix the previous fix - there's only one _node suffix here! 2016-06-28 06:47:35 +00:00
pgoyette 2e711daeb9 Missed a couple of function-call renames in previous 2016-06-28 05:21:15 +00:00
pgoyette e987c735b0 The local copy of rb_tree code has been unused for quite some time. So
we can just remove it, and adjust callers to use the "real" rbtree
function names.

Addresses PR lib/44090
2016-06-28 05:18:11 +00:00
wiz b17d0f9679 Punctuation nits.
(adding space makes sure they are not marked up)
2016-05-31 09:31:13 +00:00
pgoyette 66c6aeeb7a Add prop_array_add_cstring{,_no_copy} utility functions as suggested in
PR lib/46723 using the patch provided.  (Header file updates are mine.)
2016-05-31 09:29:25 +00:00
phx 028fd4a71a Fixed typo: propertly -> property. 2015-08-20 15:55:09 +00:00
christos 72b528eece Now that _PROP_ISSPACE does not include the EOF check, put the check for
EOF inside the loop. Also fix another unbounded loop that did not check for
EOF. From Mateusz Kocielski
XXX: pullup-7
2015-05-12 14:59:35 +00:00
christos 272b1fe359 Don't treat NUL (EOF) as SPACE. All the code that uses _PROP_ISSPACE() checks
explicitly for _PROP_EOF() anyway, and this can be abused to cause run beyond
the end of buffer DoS (Mateusz Kocielski)
XXX: pullup-7
2015-05-11 16:50:35 +00:00
christos ad3d79508d Limit size of xml buffer for userland requests (From Mateusz Kocielski)
XXX: pullup-7
2015-05-11 16:48:34 +00:00
chs 6d40f9ff57 add a new "fo_mmap" fileops method to allow use of arbitrary uvm_objects for
mappings of file objects.  move vnode-specific details of mmap()ing a vnode
from uvm_mmap() to the new vnode-specific vn_mmap().  add new uvm_mmap_dev()
and uvm_mmap_anon() convenience functions for mapping character devices
and anonymous memory, and replace all other calls to uvm_mmap() with those.
use the new fileop in drm2 so that libdrm can use mmap() to map things
like on other platforms (instead of the ioctl that we have used so far).
2014-12-14 23:48:58 +00:00
matt 6569f93208 Eliminate use of C++ keywords and don't nest struct definitions. 2014-09-05 05:19:24 +00:00
christos a6e338b0d6 kill sprintf 2014-03-26 18:12:46 +00:00
martin 5fb50cc6c4 Make this compilable with gcc 4.8.1 without options DIAGNOSTIC. 2013-10-18 18:26:20 +00:00
pooka c303bcbe4c Bit-un-rot the proplib portability layer. 2012-07-27 09:10:59 +00:00
njoly d0e00679ff Use Lk macro when dealing with URLs. While here update or remove some
dead URL links. Another part of PR/29238.
2012-03-15 22:35:02 +00:00