Commit Graph

18272 Commits

Author SHA1 Message Date
christos a8673dd4cc Improve wording. 2016-07-01 22:56:06 +00:00
christos a1d87d3311 new hmac function. 2016-07-01 22:41:39 +00:00
wiz c763387bbc Bump date for header file change. 2016-06-30 18:43:43 +00:00
abhinav 5fd6a784bb Document WAIT_ANY and WAIT_MYPGRP constants
(text referenced from OpenBSD wait(2) man page)

While there, remove duplicated information and add more refernces in SEE ALSO
Also, the NOTES section refers to intro(2), while siginterrupt(3) is a better
suited reference, so fix that too.

Ok by wiz
2016-06-30 17:00:55 +00:00
dholland ae3b3bcc2b PR 51287 Ralf Nolden: posix_fallocate belongs in <fcntl.h> 2016-06-30 15:29:20 +00:00
mrg 5f3362148f various ia64 updates:
- add a compat vfork because of stupid
- add a weak sbrk
- add a shmat syscall
- add an empty kvm implementation that links
- add missing fp stuff
2016-06-30 09:14:30 +00:00
joerg b16a977791 For some mind-boogling reasons, GCC 5.4 believes that a weak reference
cannot alias with an extern. While this is clearly bogus, avoid yet
another alias handling bug and use strong aliases. It's actually
slightly simpler, too.
2016-06-29 11:16:47 +00:00
abhinav 2ed9602dad Fix function prototype in the SYNOPSIS
Also, fix function name in the RETURN VALUES section.

From Henning Petersen in PR lib/51284
2016-06-27 08:18:34 +00:00
kre 0a924e39aa Remove dawn/sunup/sunset/sundown (sunrise was never there...)
If 06:00 or 18:00 are wanted, just say "06:00" (etc).  If these
are ever added back, they really should determine location, and
calculate actual sunrise/sunset times for the location and date.
That's not likely to happen...
2016-06-26 07:09:24 +00:00
kamil e3d1905862 Use generic types in the profil(2) function prototype (<unistd.h>) 2016-06-18 14:39:15 +00:00
ryoon 71d366f3be Bump date for previous 2016-06-16 12:48:09 +00:00
ryoon e9d3857230 Fix typo 2016-06-16 12:47:10 +00:00
abhinav d5c78a7d38 Don't refer getfsstat() using .Xr as we don't have man page for it anymore.
Ok from wiz@
2016-06-12 09:42:41 +00:00
christos ea2913a0a2 GSoC 2016: Charles Cui: Add timer related macros
_POSIX_CPUTIME
    _POSIX_THREAD_CPUTIME
    _POSIX_DELAYTIMER_MAX
2016-06-10 23:29:20 +00:00
wiz 0cdaab3d0b Bump date for previous. 2016-06-10 23:26:43 +00:00
christos 0196f35dd1 GSoC 2016: Charles Cui: add SEM_NSEMS_MAX 2016-06-10 23:24:33 +00:00
wiz d0ca0b92be Fix typo. From Kurt Jaeger via Brooks Davis and FreeBSD. 2016-06-08 15:00:04 +00:00
wiz 39cb8ece36 Bump date for previous. 2016-06-08 07:53:15 +00:00
kamil 9177c97b03 Sync STANDARDS of iconv(3) with current reality
GNU libiconv is no longer incompatible with POSIX since 2007.

Solaris 11 moved to POSIX.
Illumos moved to POSIX http://illumos.org/man/3c/iconv

New software is aligned to POSIX not to the old mistake in the standard.
2016-06-08 07:31:45 +00:00
joerg 6da05bfa8e Fun fact of the weak: a weak reference doesn't have visibility attached.
As such, reorganize the start/end references to use a weak reference
only, if we use it to remove size knowledge. Otherwise use weak
external declarations.
2016-06-07 12:07:35 +00:00
wiz cd42b3989a Fix typo. Sort errors. 2016-06-07 11:20:45 +00:00
christos 395941f2ce PR/51216: Instead of trying to open files in the current working
directory first for paths that don't contain "/", first try the
/dev paths to avoid confusion with files in the working directory
that happen to match disk names.
2016-06-06 17:50:19 +00:00
wiz 5d37c18716 Remove bsd_signal prototype from SYNOPSIS, we now have bsd_signal(3). 2016-06-06 08:28:18 +00:00
wiz d5c0ec00bb Remove trailing whitespace. Fix Xr. Fix Dd argument. 2016-06-06 08:27:22 +00:00
wiz c2280ba7ad Use Fn. Merge two EINVAL sections. 2016-06-06 08:27:05 +00:00
christos 78cbc4ca75 Document bsd_signal (From GSoC 2016 by Charles Cui) 2016-06-05 17:16:44 +00:00
christos 739a312465 conditionalize 2016-06-05 01:23:58 +00:00
christos 4b11f6f5bb add ubsan 2016-06-05 01:20:58 +00:00
joerg 70b825c3b6 Make older GCC and Clang happy and use weak references to the elements,
not declared as arrays.
2016-06-05 00:43:39 +00:00
christos d433114464 sanitizer for all. 2016-06-04 02:06:46 +00:00
christos bbba7d645f Asan is back 2016-06-04 00:11:01 +00:00
christos 0762ef8b4d Add bsd_signal as required by POSIX (from GSoC 2016, Charles Cui) 2016-06-03 23:57:37 +00:00
christos d764cbd394 Fix previous to better match readline behavior (Ingo Schwarze) 2016-06-02 21:40:51 +00:00
christos 956883ecd7 From Ingo Schwarze:
In libedit, the only way how H_ENTER can fail is memory exhaustion,
too, and of course it is handled gracefully, returning -1 from
history().  So of course, we will continue to handle it gracefully
in add_history() as well, but we are free to decide what to do with
the library state in this case because GNU just dies...

I think the most reasonable course of action is to simply not change
the library state in any way when add_history() fails due to memory
exhaustion, but just return.

If H_ENTER does not fail, we know that the history now contains at
least one entry, so there is no need any longer to check the H_GETSIZE
return value.  And we can of course always set current_history_valid.

While testing these changes, i noticed three problems so closely
related that i'd like to fix them in the same diff.

 1. libedit has the wrong prototype for add_history().
    GNU readline-6.3 defines it as void add_history(const char *).
    Of course, that is very stupid - no way to report problems to
    the caller!  But the whole point of a compatibility mode is
    being compatible, so we should ultimately change this.
    Of course, changing the prototype of a public symbol requires
    a libedit major bump.  I don't want to do that casually.
    Rather, i will take a note and change the prototype the next
    time we need a libedit major bump for more important reasons.
    For now, let's just always return 0.

 2. While *implicitely* pushing an old entry off the history
    increments history_base in GNU readline, testing reveals that
    *explicitly* deleting one does not.  Again, this is not
    documented, but it applies to both remove_history() and
    stifle_history().  So delete history_base manipulation
    from stifle_history(), which also allows to simplify the
    code and delete two automatic variables.

 3. GNU readline add_history(NULL) crashes with a segfault.
    There is nothing wrong with having a public interface
    behave that way.  Many standard interfaces do, including
    strlen(3).  Such crashes can even be useful to catch
    buggy application programs.
    In libedit/readline.c rev. 1.104, Christos made add_history()
    silently ignore this coding error, according to the commit
    message to hide a bug in nslookup(1).  That change was never
    merged to OpenBSD.  I strongly disagree with this change.
    If nslookup(1) is still broken, that program needs to be
    fixed instead.  In any case, delete the bogus check; hiding
    bugs is dangerous.
2016-06-02 15:11:18 +00:00
christos f32209ed0d Use NULL instead of 0. 2016-06-01 22:58:52 +00:00
joerg b940261f81 Revert -O1 hack for GCC 5.3, replaced by workaround in the code. 2016-06-01 21:24:55 +00:00
joerg ad68895fdb PR toolchain/51121:
__CTOR_LIST__ and __CTOR_LIST_END__ are logically the same object, but
due to the start marker, the former has to be declared as array of fixed
size. Newer GCC versions take the liberty of exploiting the UB of
accessing global objects past the end to unconditionally load zero
values in that case. Two fixes are possible:
(1) Pruning via inline assembler as done by GCC's own CRT copy.
(2) Pruning via weak references as done for linker sets.
Since the second part is known and required to work anyway, prefer this
approach. In theory, the labels could be replaced completely, except
that GNU as doesn't provide start/end symbols for sections containing
dots.
2016-06-01 21:21:55 +00:00
wiz a948ccc5b2 Fix manually applied patch. Mark up NULL with Dv. 2016-06-01 08:32:05 +00:00
pgoyette 39bee72c5e Document return value for realloc(3) when size is 0. From PR lib/47384 2016-06-01 05:40:26 +00:00
christos 94b4dd721e remove the right history entry (Ingo Schwarze) 2016-05-31 19:25:17 +00:00
pgoyette d2c5329790 Use calloc(1, ...) instead of malloc(...) followed immediately by memset()
Addresses PR lib/46818
2016-05-31 07:49:09 +00:00
dholland 7dae429fbd PR 51003 David Binderman: bzero struct before passing it around.
This is actually unnecessary as the call in question uses only fields
that have been set explicitly, but good practice regardless and it's
not like it's on a performance-critical path.
2016-05-31 03:47:49 +00:00
dholland 39a10a6851 PR 51002 David Binderman: fix wrong printing code not enabled by default. 2016-05-31 03:43:10 +00:00
dholland 6413fb5a5d PR 51000 David Binderman: comment out unused assignment 2016-05-31 03:34:14 +00:00
dholland 6b93d6fdd7 PR 51190 David Binderman: simplify redundant conditionals.
Also add paranoia when looping on isdigit().
2016-05-30 17:48:29 +00:00
christos d8509bf6e2 abstract read code to a single function (Ingo Schwarze) 2016-05-25 13:01:11 +00:00
christos fa7ab2f97a el_map.alt can't be NULL here (Ingo Schwarze) 2016-05-24 19:31:27 +00:00
christos 6eacc2dbd2 remove debug read (Ingo Schwarze) 2016-05-24 17:42:54 +00:00
christos 0a374fd7e5 From Ingo Schwarze:
Reduce obfuscation of errno handling. There is only one purpose
non-local errno handling is needed for:  Inside el_wgets(), several
functions call down indirectly to el_wgetc(), many of them via the
dispatch table.  When el_wgetc() fails, it does properly report
failure, but then various cleanup is done which may clobber errno.
But when returning due to failure, el_wgets() wants to have errno
set to the reason of the original read failure, not to the reason
of some subsequent failure of some cleanup operation.  So el_wgetc()
needs to save errno, and if it's non-zero, el_wgets() needs to
restore it on failure.

This core logic is currently obscured by the fact that el_errno
is set and inspected at some additional places where it isn't needed.
Besides, since el_wgetc() and and el_wgets() are both in read.c,
el_errno does not need to be in struct editline, it can and should
be local to read.c in struct el_read_t.

Let's look at what can be simplified.

 1. keymacro_get() abuses el_errno instead of having a proper
    error return code.  Adding that error return code is easy
    because node_trav() already detects the condition and an
    adequate code is already defined.  Returning it, testing
    for it in read_getcmd(), and returning with error from there
    removes the need to inspect el_errno from el_wgets() after
    calling read_getcmd().
    Note that resetting lastchar and cursor and clearing buffer[0]
    is irrelevant.  The code returns from el_wgets() right afterwards.
    Outside el_wgets(), these variables are no longer relevant.
    When el_wgets() is called the next time, it will call ch_reset()
    anyway, resetting the two pointers.  And as long as lastchar
    points to the beginning of the buffer, the contents of the
    buffer won't be used for anything.

 2. read_getcmd() doesn't need to set el_errno again after el_wgetc()
    failure since el_wgetc() already did so.  While here, remove
    the silly "if EOF or error" comments from the el_wgetc()
    return value tests.  It's a public interface documented in a
    manual, so people working on the implementation can obviously
    be expected to know how it works.  It's a case of

      count++;  /* Increment count. */

 3. In the two code paths of el_wgets() that lead up to "goto noedit",
    there is no need to save the errno because nothing that might
    change it happens before returning.

For clarity, since el_wgets() is the function restoring the errno,
also move initializing it to the same function.

Finally, note that restoring errno when the saved value is zero is
wrong.  No library code is ever allowed to clear a previously set
value of errno.  Only application programs are allowed to do that,
and even they usually don't need to do so, except when using certain
ill-designed interfaces like strtol(3).

I tested that the behaviour remains sane in the following cases,
all during execution of el_wgets(3) and with a signal handler
for USR1 installed without SA_RESTART.

 * Enter some text and maybe move around a bit.
   Then send a USR1 signal.
   The signal gets processed, then read_char() resumes reading.
   Send another USR1 signal.
   Now el_wgets() sets errno=EINTR and returns -1.

 * Press Ctrl-V to activate ed-quoted-insert.
   Then send a USR1 signal.
   The signal gets processed, then read_char() resumes reading.
   Send another USR1 signal.
   ed_quoted_insert() returns ed_end_of_file(), i.e. CC_EOF,
   and el_wgets() returns 0.

 * Press a key starting a keyboard macro.
   Then send a USR1 signal.
   The signal gets processed, then read_char() resumes reading.
   Send another USR1 signal.
   Now el_wgets() sets errno=EINTR and returns -1.

 * Press : to enter builtin command mode.
   Start typing a command.
   Then send a USR1 signal.
   The signal gets processed, then read_char() resumes reading.
   Send another USR1 signal.
   Now c_gets() returns -1, ed_command() beeps and returns CC_REFRESH,
   and el_wgets() resumes operation as it should.

I also tested with "el_set(el, EL_EDITMODE, 0)", and it returns
the right value and sets errno correctly.
2016-05-24 15:00:45 +00:00
christos 16467be6f9 documentation improvements (Ingo Schwarze) 2016-05-22 23:54:20 +00:00