<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/stdlib/system.c, branch release/11.1.0</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>Switch libc from using _sig{procmask,action,suspend} symbols, which</title>
<updated>2015-08-29T14:25:01+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2015-08-29T14:25:01+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=bd6060a1c661b37b3f39a8b92ddea8725ae34fb1'/>
<id>bd6060a1c661b37b3f39a8b92ddea8725ae34fb1</id>
<content type='text'>
are aliases for the syscall stubs and are plt-interposed, to the
libc-private aliases of internally interposed sigprocmask() etc.

Since e.g. _sigaction is not interposed by libthr, calling signal()
removes thr_sighandler() from the handler slot etc.  The result was
breaking signal semantic and rtld locking.

The added __libc_sigprocmask and other symbols are hidden, they are
not exported and cannot be called through PLT.  The setjmp/longjmp
functions for x86 were changed to use direct calls, and since
PIC_PROLOGUE only needed for functional PLT indirection on i386, it is
removed as well.

The PowerPC bug of calling the syscall directly in the setjmp/longjmp
implementation is kept as is.

Reported by:	Pete French &lt;petefrench@ingresso.co.uk&gt;
Tested by:	Michiel Boland &lt;boland37@xs4all.nl&gt;
Reviewed by:	jilles (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
are aliases for the syscall stubs and are plt-interposed, to the
libc-private aliases of internally interposed sigprocmask() etc.

Since e.g. _sigaction is not interposed by libthr, calling signal()
removes thr_sighandler() from the handler slot etc.  The result was
breaking signal semantic and rtld locking.

The added __libc_sigprocmask and other symbols are hidden, they are
not exported and cannot be called through PLT.  The setjmp/longjmp
functions for x86 were changed to use direct calls, and since
PIC_PROLOGUE only needed for functional PLT indirection on i386, it is
removed as well.

The PowerPC bug of calling the syscall directly in the setjmp/longjmp
implementation is kept as is.

Reported by:	Pete French &lt;petefrench@ingresso.co.uk&gt;
Tested by:	Michiel Boland &lt;boland37@xs4all.nl&gt;
Reviewed by:	jilles (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix known issues which blow up the process after dlopen("libthr.so")</title>
<updated>2015-01-03T18:38:46+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2015-01-03T18:38:46+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=8495e8b1e9e13fb707296a486acf7538dbfa12b2'/>
<id>8495e8b1e9e13fb707296a486acf7538dbfa12b2</id>
<content type='text'>
(or loading a dso linked to libthr.so into process which was not
linked against threading library).

- Remove libthr interposers of the libc functions, including
  __error(). Instead, functions calls are indirected through the
  interposing table, similar to how pthread stubs in libc are already
  done.  Libc by default points either to syscall trampolines or to
  existing libc implementations.  On libthr load, libthr rewrites the
  pointers to the cancellable implementations already in libthr.  The
  interposition table is separate from pthreads stubs indirection
  table to not pull pthreads stubs into static binaries.

- Postpone the malloc(3) internal mutexes initialization until libthr
  is loaded.  This avoids recursion between calloc(3) and static
  pthread_mutex_t initialization.

- Reinstall signal handlers with wrapper on libthr load.  The
  _rtld_is_dlopened(3) is used to avoid useless calls to sigaction(2)
  when libthr is statically referenced from the main binary.

In the process, fix openat(2), swapcontext(2) and setcontext(2)
interposing.  The libc symbols were exported at different versions
than libthr interposers.  Export both libc and libthr versions from
libc now, with default set to the higher version from libthr.

Remove unused and disconnected swapcontext(3) userspace implementation
from libc/gen.

No objections from:	deischen
Tested by:	pho, antoine (exp-run) (previous versions)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(or loading a dso linked to libthr.so into process which was not
linked against threading library).

- Remove libthr interposers of the libc functions, including
  __error(). Instead, functions calls are indirected through the
  interposing table, similar to how pthread stubs in libc are already
  done.  Libc by default points either to syscall trampolines or to
  existing libc implementations.  On libthr load, libthr rewrites the
  pointers to the cancellable implementations already in libthr.  The
  interposition table is separate from pthreads stubs indirection
  table to not pull pthreads stubs into static binaries.

- Postpone the malloc(3) internal mutexes initialization until libthr
  is loaded.  This avoids recursion between calloc(3) and static
  pthread_mutex_t initialization.

- Reinstall signal handlers with wrapper on libthr load.  The
  _rtld_is_dlopened(3) is used to avoid useless calls to sigaction(2)
  when libthr is statically referenced from the main binary.

In the process, fix openat(2), swapcontext(2) and setcontext(2)
interposing.  The libc symbols were exported at different versions
than libthr interposers.  Export both libc and libthr versions from
libc now, with default set to the higher version from libthr.

Remove unused and disconnected swapcontext(3) userspace implementation
from libc/gen.

No objections from:	deischen
Tested by:	pho, antoine (exp-run) (previous versions)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</pre>
</div>
</content>
</entry>
<entry>
<title>system(): Restore behaviour for SIGINT and SIGQUIT.</title>
<updated>2013-09-01T19:59:54+00:00</updated>
<author>
<name>Jilles Tjoelker</name>
<email>jilles@FreeBSD.org</email>
</author>
<published>2013-09-01T19:59:54+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=865ca149dcac626ebca40ae3ea5c8009af91e671'/>
<id>865ca149dcac626ebca40ae3ea5c8009af91e671</id>
<content type='text'>
As mentioned in r16117 and the book "Advanced Programming in the Unix
Environment" by W. Richard Stevens, we should ignore SIGINT and SIGQUIT
before forking, since it is not guaranteed that the parent process starts
running soon enough.

To avoid calling sigaction() in the vforked child, instead block SIGINT and
SIGQUIT before vfork() and keep the sigaction() to ignore after vfork(). The
FreeBSD kernel discards ignored signals, even if they are blocked;
therefore, it is not necessary to unblock SIGINT and SIGQUIT earlier.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As mentioned in r16117 and the book "Advanced Programming in the Unix
Environment" by W. Richard Stevens, we should ignore SIGINT and SIGQUIT
before forking, since it is not guaranteed that the parent process starts
running soon enough.

To avoid calling sigaction() in the vforked child, instead block SIGINT and
SIGQUIT before vfork() and keep the sigaction() to ignore after vfork(). The
FreeBSD kernel discards ignored signals, even if they are blocked;
therefore, it is not necessary to unblock SIGINT and SIGQUIT earlier.
</pre>
</div>
</content>
</entry>
<entry>
<title>vfork(2) was listed as deprecated in 1994 (r1573) and was the false</title>
<updated>2013-08-13T20:38:55+00:00</updated>
<author>
<name>Peter Wemm</name>
<email>peter@FreeBSD.org</email>
</author>
<published>2013-08-13T20:38:55+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7d1ffcb72ac881b52c8b79bedbb120e92ee7141b'/>
<id>7d1ffcb72ac881b52c8b79bedbb120e92ee7141b</id>
<content type='text'>
reports of its impending demise were removed in 2009 (r199257).

However, in 1996 (r16117) system(3) was switched from vfork(2) to
fork(2) based partly on this.  Switch back to vfork(2).  This has a
dramatic effect in cases of extreme mmap use - such as excessive
abuse (500+) of shared libraries.

popen(3) has used vfork(2) for a while.  vfork(2) isn't going anywhere.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
reports of its impending demise were removed in 2009 (r199257).

However, in 1996 (r16117) system(3) was switched from vfork(2) to
fork(2) based partly on this.  Switch back to vfork(2).  This has a
dramatic effect in cases of extreme mmap use - such as excessive
abuse (500+) of shared libraries.

popen(3) has used vfork(2) for a while.  vfork(2) isn't going anywhere.
</pre>
</div>
</content>
</entry>
<entry>
<title>Renumber clauses to reduce diffs to other versions</title>
<updated>2013-06-13T00:19:30+00:00</updated>
<author>
<name>Ed Maste</name>
<email>emaste@FreeBSD.org</email>
</author>
<published>2013-06-13T00:19:30+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=580b4d185bc1d20da91429229920ce590309cbf6'/>
<id>580b4d185bc1d20da91429229920ce590309cbf6</id>
<content type='text'>
NetBSD, OpenBSD, and Android's Bionic number the clauses 1 through 3,
so follow suit to make comparison easier.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
NetBSD, OpenBSD, and Android's Bionic number the clauses 1 through 3,
so follow suit to make comparison easier.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix many "function declaration isn't a prototype" warnings in libc.</title>
<updated>2009-12-05T19:31:38+00:00</updated>
<author>
<name>Ed Schouten</name>
<email>ed@FreeBSD.org</email>
</author>
<published>2009-12-05T19:31:38+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=2c201a9afe37d2cec72faa4f00dc640c7b4130b3'/>
<id>2c201a9afe37d2cec72faa4f00dc640c7b4130b3</id>
<content type='text'>
I've only fixed code that seems to be written by `us'. There are still
many warnings like this present in resolv/, rpc/, stdtime/ and yp/.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I've only fixed code that seems to be written by `us'. There are still
many warnings like this present in resolv/, rpc/, stdtime/ and yp/.
</pre>
</div>
</content>
</entry>
<entry>
<title>Per Regents of the University of Calfornia letter, remove advertising</title>
<updated>2007-01-09T00:28:16+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2007-01-09T00:28:16+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c879ae3536e6d92b8d96c8965c5b05fcb9541520'/>
<id>c879ae3536e6d92b8d96c8965c5b05fcb9541520</id>
<content type='text'>
clause.

# If I've done so improperly on a file, please let me know.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
clause.

# If I've done so improperly on a file, please let me know.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix the style of the SCM ID's.</title>
<updated>2002-03-22T21:53:29+00:00</updated>
<author>
<name>David E. O'Brien</name>
<email>obrien@FreeBSD.org</email>
</author>
<published>2002-03-22T21:53:29+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=333fc21e3cd79bca0c94d7722c5a56cb5ad078d1'/>
<id>333fc21e3cd79bca0c94d7722c5a56cb5ad078d1</id>
<content type='text'>
I believe have made all of libc .c's as consistent as possible.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I believe have made all of libc .c's as consistent as possible.
</pre>
</div>
</content>
</entry>
<entry>
<title>Avoid getting stuck in system(3) when the internal call to wait4()</title>
<updated>2001-10-03T11:01:39+00:00</updated>
<author>
<name>Alfred Perlstein</name>
<email>alfred@FreeBSD.org</email>
</author>
<published>2001-10-03T11:01:39+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=9c2ccf274162e95596786f88f4d07ec34c7768fd'/>
<id>9c2ccf274162e95596786f88f4d07ec34c7768fd</id>
<content type='text'>
is interrupted by saving the pid.

The old code would assign the return value to pid which would trash
it, to fix the problem save a copy of the pid to be used as the
paramter to wait4().

Submitted by: Toshihiko ARAI &lt;toshi@jp.FreeBSD.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
is interrupted by saving the pid.

The old code would assign the return value to pid which would trash
it, to fix the problem save a copy of the pid to be used as the
paramter to wait4().

Submitted by: Toshihiko ARAI &lt;toshi@jp.FreeBSD.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove _THREAD_SAFE and make libc thread-safe by default by</title>
<updated>2001-01-24T13:01:12+00:00</updated>
<author>
<name>Daniel Eischen</name>
<email>deischen@FreeBSD.org</email>
</author>
<published>2001-01-24T13:01:12+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d201fe46e355212750b727061e6a7ac005267852'/>
<id>d201fe46e355212750b727061e6a7ac005267852</id>
<content type='text'>
adding (weak definitions to) stubs for some of the pthread
functions.  If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
	__sys_foo - actual system call
	_foo - weak definition to __sys_foo
	foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo.  In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde).  All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes.  &lt;db.h&gt; is an exception
and shouldn't be included in between namespace.h and
un-namespace.h  namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE.  We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of &lt;errno.h&gt; from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by:	-arch
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
adding (weak definitions to) stubs for some of the pthread
functions.  If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
	__sys_foo - actual system call
	_foo - weak definition to __sys_foo
	foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo.  In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde).  All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes.  &lt;db.h&gt; is an exception
and shouldn't be included in between namespace.h and
un-namespace.h  namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE.  We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of &lt;errno.h&gt; from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by:	-arch
</pre>
</div>
</content>
</entry>
</feed>
