mirror of
git://sourceware.org/git/glibc.git
synced 2026-09-08 23:58:31 +08:00
Compare commits
377
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a92f117fec | ||
|
|
5b9ac69a65 | ||
|
|
654665b7c7 | ||
|
|
f0271955ec | ||
|
|
aa01a02424 | ||
|
|
620432767f | ||
|
|
752069ed74 | ||
|
|
b75d05951a | ||
|
|
104f19466b | ||
|
|
8c557d5e3e | ||
|
|
aff7685365 | ||
|
|
27bd4a1e78 | ||
|
|
0a5d42def7 | ||
|
|
4d3a95a6b6 | ||
|
|
fdc5571f25 | ||
|
|
0e04de001a | ||
|
|
5d42a4c2cc | ||
|
|
0ad9e46784 | ||
|
|
68b192d0dd | ||
|
|
c0a119316e | ||
|
|
ae2eaff13e | ||
|
|
6a5f96bfef | ||
|
|
98bec7469c | ||
|
|
4b4a00eb13 | ||
|
|
51b2586797 | ||
|
|
4e5f9db6ba | ||
|
|
6cfad51303 | ||
|
|
88c3891b7a | ||
|
|
2c606f0f92 | ||
|
|
62bb57925d | ||
|
|
f844eec463 | ||
|
|
0f1f93279b | ||
|
|
a83b0f09cb | ||
|
|
c6c955c542 | ||
|
|
9e1cbaf632 | ||
|
|
ee96242d57 | ||
|
|
db4703c178 | ||
|
|
6b280740cc | ||
|
|
22e8d11155 | ||
|
|
3ab24a1afb | ||
|
|
396e0415e4 | ||
|
|
3ff6d686a4 | ||
|
|
7f42b77318 | ||
|
|
9279ceae42 | ||
|
|
0ed18d6c0c | ||
|
|
f860dce906 | ||
|
|
7645b65271 | ||
|
|
079f7c691f | ||
|
|
00b97dc29c | ||
|
|
08ed359420 | ||
|
|
3090a1d9d9 | ||
|
|
ea72be0702 | ||
|
|
780f64dfed | ||
|
|
4360912968 | ||
|
|
57790ddd15 | ||
|
|
ae62f3fd1a | ||
|
|
a53b62005c | ||
|
|
4f81f15b9f | ||
|
|
caf512f51a | ||
|
|
f301b57542 | ||
|
|
ba11b11f3f | ||
|
|
6750d9b090 | ||
|
|
716a8a8a1a | ||
|
|
45ca822c29 | ||
|
|
5d08e3e8ab | ||
|
|
26753f62d6 | ||
|
|
48956dfd0f | ||
|
|
b7c667f2ff | ||
|
|
54a1813de5 | ||
|
|
402a46171b | ||
|
|
ae4b002f02 | ||
|
|
83817a84c3 | ||
|
|
09390d612a | ||
|
|
311e8a4a28 | ||
|
|
0d0f83ce42 | ||
|
|
12ef0fc101 | ||
|
|
6eb3b349ee | ||
|
|
c5b46a461f | ||
|
|
430896bd6a | ||
|
|
5dd4da2d24 | ||
|
|
f688a75efb | ||
|
|
7bd83db5a4 | ||
|
|
04c524c4b0 | ||
|
|
71584f8abc | ||
|
|
26765111ad | ||
|
|
066d68b563 | ||
|
|
65c0c1fd36 | ||
|
|
ee815d3f29 | ||
|
|
4be6b7a59e | ||
|
|
e4e9c3596e | ||
|
|
a67fb77b6b | ||
|
|
8bbe90f014 | ||
|
|
e13ea31465 | ||
|
|
b2cbddd0a4 | ||
|
|
ba8c210b3e | ||
|
|
bab0a98c67 | ||
|
|
758999db4f | ||
|
|
5346455569 | ||
|
|
8e619d6a10 | ||
|
|
e9e8bfe716 | ||
|
|
e2d554858b | ||
|
|
b9b2307456 | ||
|
|
fdd1a62962 | ||
|
|
e49ad9b365 | ||
|
|
5105c5e94b | ||
|
|
392ca57fdd | ||
|
|
b0d7c39e33 | ||
|
|
bb267dc296 | ||
|
|
1769a89be6 | ||
|
|
54cd01e24f | ||
|
|
7384dd3fbe | ||
|
|
51b221ee43 | ||
|
|
bff1832b2d | ||
|
|
70d7ddbbcc | ||
|
|
b7c5a468dc | ||
|
|
f9652c80ae | ||
|
|
39dbc7be16 | ||
|
|
dd5aac0f53 | ||
|
|
1452bbc1aa | ||
|
|
4a6fbb12f2 | ||
|
|
3cf9054816 | ||
|
|
fc8c13e9e1 | ||
|
|
3cfd9c9ac9 | ||
|
|
49d05ecd64 | ||
|
|
a0e78d4ebe | ||
|
|
da3b378848 | ||
|
|
14f82daac6 | ||
|
|
0c07dfee2c | ||
|
|
cdd3026022 | ||
|
|
f21e0750a8 | ||
|
|
f854c0566e | ||
|
|
b75f2c28f9 | ||
|
|
6393f70acb | ||
|
|
3d5a869794 | ||
|
|
12fc66d651 | ||
|
|
f1ecbef29e | ||
|
|
0c1ed45457 | ||
|
|
bf5806397a | ||
|
|
bf094836d8 | ||
|
|
0b67eee38b | ||
|
|
82bf05a0ce | ||
|
|
ea09d877ca | ||
|
|
aef475bc34 | ||
|
|
a0713d8d9b | ||
|
|
5bae2227b8 | ||
|
|
5703aac7be | ||
|
|
c9b41a4451 | ||
|
|
d78af38fec | ||
|
|
f958e42835 | ||
|
|
5e0fd15720 | ||
|
|
99f1dfad31 | ||
|
|
d33c4d286a | ||
|
|
7f0ddd1987 | ||
|
|
9359e4cbf3 | ||
|
|
72de2dcd21 | ||
|
|
ab8080455c | ||
|
|
f1698e08cc | ||
|
|
b8a7384521 | ||
|
|
d97aad47e3 | ||
|
|
789a98d932 | ||
|
|
c075fbc99c | ||
|
|
eb0740ad73 | ||
|
|
9106c38136 | ||
|
|
5cb9ee6746 | ||
|
|
72b6c2b1c7 | ||
|
|
ffc30dcbea | ||
|
|
0043ae9883 | ||
|
|
477f40256e | ||
|
|
67c27119f8 | ||
|
|
f23649c50d | ||
|
|
2143456bb3 | ||
|
|
473167dcc7 | ||
|
|
9216338892 | ||
|
|
1559585ef1 | ||
|
|
dc0d0c616e | ||
|
|
16afa991d0 | ||
|
|
9ad114ad58 | ||
|
|
b0b60fc2f1 | ||
|
|
6a11e51e2c | ||
|
|
0f884de176 | ||
|
|
2c218fa5d9 | ||
|
|
3c0bfe141d | ||
|
|
58611c4757 | ||
|
|
6ad469c1c4 | ||
|
|
ca911f45cf | ||
|
|
a80f36629b | ||
|
|
133192c659 | ||
|
|
07e85a9e7e | ||
|
|
6c60c46fcd | ||
|
|
438171b5ba | ||
|
|
4a764e3d3b | ||
|
|
0b25d4905e | ||
|
|
2dd2b17df7 | ||
|
|
870eeeb6b2 | ||
|
|
582b8e86e0 | ||
|
|
bab280f93a | ||
|
|
4749ee6c81 | ||
|
|
1a1f354cd7 | ||
|
|
71e4ceb22b | ||
|
|
6f7922d89c | ||
|
|
a16d0942d7 | ||
|
|
fea444e4d2 | ||
|
|
797f8dc9d5 | ||
|
|
20ce139ac1 | ||
|
|
eb46a9a4e2 | ||
|
|
0af17c40df | ||
|
|
b9cec87760 | ||
|
|
98d289f6b6 | ||
|
|
f175ece367 | ||
|
|
a91b462b62 | ||
|
|
5e9e4d273d | ||
|
|
a7071cbe63 | ||
|
|
ceb4bfd63d | ||
|
|
1cb5fbec42 | ||
|
|
6cc0f29734 | ||
|
|
7ec30d5937 | ||
|
|
ae6f93ebf0 | ||
|
|
8fa5aed6e8 | ||
|
|
1d7d57a23c | ||
|
|
ec6bc3a6c1 | ||
|
|
c544156ecf | ||
|
|
14b1c93b79 | ||
|
|
03a5167722 | ||
|
|
d17c16a1c0 | ||
|
|
46139b3cfb | ||
|
|
ba18232742 | ||
|
|
d03cbf630d | ||
|
|
d9c42342a1 | ||
|
|
cfa805f954 | ||
|
|
c55caac80e | ||
|
|
46da0971fe | ||
|
|
c1691f4661 | ||
|
|
41e2d09648 | ||
|
|
d69e5f014e | ||
|
|
630ee40e92 | ||
|
|
637a638f30 | ||
|
|
0b4a289092 | ||
|
|
d6b95af8bb | ||
|
|
80e41ab46e | ||
|
|
f47163fad3 | ||
|
|
4bf5771c23 | ||
|
|
66284f47ac | ||
|
|
43e2ba6ef6 | ||
|
|
6227894ac9 | ||
|
|
fa8ceb1f2c | ||
|
|
2c44d7573c | ||
|
|
35d80b24e3 | ||
|
|
f6bf4da124 | ||
|
|
e22307c48b | ||
|
|
9ca318cc03 | ||
|
|
254249b29a | ||
|
|
288238a6ea | ||
|
|
5286bb7e27 | ||
|
|
94941d2212 | ||
|
|
257b878d90 | ||
|
|
0e6e45afa2 | ||
|
|
68c0fa52a2 | ||
|
|
ff48318555 | ||
|
|
daa5c348d6 | ||
|
|
b234e8652a | ||
|
|
2018d9e2ee | ||
|
|
b8d4e46167 | ||
|
|
f581e9ca08 | ||
|
|
0966931ed7 | ||
|
|
dd4831ce37 | ||
|
|
db7cdaaaa4 | ||
|
|
721869072d | ||
|
|
83bbbdd08c | ||
|
|
b44c1e14db | ||
|
|
18d41844f1 | ||
|
|
ea00844dfb | ||
|
|
59c37b6b21 | ||
|
|
f42bf1bcfa | ||
|
|
6718095b09 | ||
|
|
b41fb4250f | ||
|
|
7e165c9059 | ||
|
|
d4fff052ce | ||
|
|
22c4356832 | ||
|
|
6f69fa17e5 | ||
|
|
a23087343b | ||
|
|
ba2ccfa167 | ||
|
|
71c5289b0f | ||
|
|
1893ec6a38 | ||
|
|
e2f8a38f47 | ||
|
|
e16db41ba6 | ||
|
|
13babeb0d3 | ||
|
|
c424f2da59 | ||
|
|
cac34d519a | ||
|
|
b47d1816eb | ||
|
|
8fbe82ee26 | ||
|
|
dd23f3b0d6 | ||
|
|
3365152cb0 | ||
|
|
4b3769bc7c | ||
|
|
cf2b29bfe0 | ||
|
|
98e994340a | ||
|
|
f4a0465b69 | ||
|
|
1908c08641 | ||
|
|
31d7822815 | ||
|
|
9b5225b600 | ||
|
|
f13f1b26e4 | ||
|
|
967578d96c | ||
|
|
421dcdf3a9 | ||
|
|
87a5e8a7a4 | ||
|
|
a2a3fc55fd | ||
|
|
02f25bd59b | ||
|
|
c7b0194ac3 | ||
|
|
885ba00117 | ||
|
|
3cfcebc885 | ||
|
|
2047317f3b | ||
|
|
ac7c207f14 | ||
|
|
a18be620a1 | ||
|
|
177f9d5cd4 | ||
|
|
afc1d235b7 | ||
|
|
c293f9bc63 | ||
|
|
24ea71e942 | ||
|
|
79df061031 | ||
|
|
375676b1b6 | ||
|
|
94f1773041 | ||
|
|
77055d99e4 | ||
|
|
fb63ae13d0 | ||
|
|
44a09a3306 | ||
|
|
579749498e | ||
|
|
52cff2eeb6 | ||
|
|
94f8647f1c | ||
|
|
88f4537c77 | ||
|
|
32fff90d82 | ||
|
|
00aec83a30 | ||
|
|
ff046934fd | ||
|
|
31f43cffe0 | ||
|
|
4c2d948abe | ||
|
|
c5cb336b87 | ||
|
|
8d7899fbb6 | ||
|
|
bca9fd93a8 | ||
|
|
9f3168cf9a | ||
|
|
24a09ef771 | ||
|
|
f0427c13e4 | ||
|
|
347415b76e | ||
|
|
ff407b13b9 | ||
|
|
265ede2a16 | ||
|
|
1bdf7624dc | ||
|
|
95a5089d2f | ||
|
|
760f9f4cd0 | ||
|
|
3a1db3bf88 | ||
|
|
0b7f4318c0 | ||
|
|
3316c605ba | ||
|
|
aa8ecd3c01 | ||
|
|
d35ffac1c7 | ||
|
|
b1f911a801 | ||
|
|
5b2cfa7797 | ||
|
|
3967ae2f20 | ||
|
|
3a7c62f09a | ||
|
|
571286fe50 | ||
|
|
28b5b97f16 | ||
|
|
4db14580ca | ||
|
|
379091f89d | ||
|
|
a6a5f54f28 | ||
|
|
a06faff6c1 | ||
|
|
e3d3d6c990 | ||
|
|
00926c6660 | ||
|
|
2f54e18d8b | ||
|
|
eb3b8b2ea7 | ||
|
|
731640fc24 | ||
|
|
1f574fe0be | ||
|
|
1b4d62a18d | ||
|
|
ce328bf180 | ||
|
|
58f6951944 | ||
|
|
450867ffea | ||
|
|
992b2c400b | ||
|
|
6145c5ea69 | ||
|
|
e3f24cf1bf | ||
|
|
1217a671f4 | ||
|
|
8814d1a72e | ||
|
|
d730f1d27c | ||
|
|
2e12a92961 | ||
|
|
4f72518358 | ||
|
|
655fe31070 | ||
|
|
9652be3de8 |
@@ -0,0 +1,63 @@
|
||||
List of known bugs (certainly very incomplete)
|
||||
----------------------------------------------
|
||||
|
||||
Time-stamp: <1997-05-21T20:55:45+0200 drepper>
|
||||
|
||||
This following list contains those bugs which I'm aware of. Please
|
||||
make sure that bugs you report are not listed here. If you can fix one
|
||||
of these bugs/limitations I'll certainly be glad to receive a patch.
|
||||
|
||||
Another source of information about bugs is the problem data base of the
|
||||
GNU project. There is an easy to use WWW interface is available at
|
||||
|
||||
http://www-gnats.gnu.ai.mit.edu:8080/cgi-bin/wwwgnats.pl
|
||||
|
||||
I would appreciate it very much if you could verify the problem was not
|
||||
reported before by looking though the database. To make the information
|
||||
in this data as useful as possible please report bugs always using the
|
||||
`glibcbug' shell script which gets installed with GNU libc.
|
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Severity: [ *] to [***]
|
||||
|
||||
|
||||
[ **] For GNU libc on Linux, there is still no solution for the UTMP
|
||||
problem. Two people are working on a possible solution.
|
||||
[Among others: PR libc/39]
|
||||
|
||||
[ **] There are problems with signal handling when using LinuxThreads.
|
||||
|
||||
[ **] The `cbrtl' function for ix86 does not work in the moment.
|
||||
|
||||
[ *] The precision of the `sinhl' and/or `asinhl' function do not seem
|
||||
to be the best.
|
||||
|
||||
[ *] The syslog function should print to the console if the LOG_CONS
|
||||
flag was given.
|
||||
[PR libc/72]
|
||||
|
||||
[ *] On Linux, the <linux/posix_types.h> is not clean enough to satisfy
|
||||
the C++ namespace rules. Declaring `struct fd_set' also makes
|
||||
`fd_set' available in the global namespace which conflicts with
|
||||
the definition of `fd_set' in glibc.
|
||||
[PR libc/79]
|
||||
|
||||
[ *] On Linux, there should be a way to prevent defining the symbol
|
||||
NGROUPS_MAX in the <linux/limits.h> header file. In glibc it
|
||||
is defined in <posix1_lim.h> which must not make the other
|
||||
symbols in <linux/limits.h> available.
|
||||
[PR libc/140]
|
||||
|
||||
[ *] The localedef program should interpret only the required categories
|
||||
addressed by `copy' statements. This especially means that limited
|
||||
character sets must not lead to errors if the LC_CTYPE category in
|
||||
the locale addressed by `copy' is not really used.
|
||||
|
||||
[ *] Statically linking with libpthread leads to strange warnings
|
||||
from the linker. I don't know why this happen so far.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Ulrich Drepper
|
||||
drepper@cygnus.com
|
||||
@@ -550,7 +550,8 @@ by
|
||||
|
||||
in the above example specs file to make it work for other systems.
|
||||
|
||||
Future versions of GCC will automatically provide the correct specs.
|
||||
Version 2.7.2.2 does and future versions of GCC will automatically
|
||||
provide the correct specs.
|
||||
|
||||
|
||||
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
@@ -568,12 +569,6 @@ something like this:
|
||||
GROUP ( libc.so.6 ld.so.1 libc.a )
|
||||
|
||||
|
||||
{UD} The Linux ldconfig file probably generates a link libc.so ->
|
||||
libc.so.6 in /lib. This is not correct. There must not be such a
|
||||
link. The linker script with the above contents is placed in
|
||||
/usr/lib which is enough for the linker.
|
||||
|
||||
|
||||
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
[Q18] ``The prototypes for `connect', `accept', `getsockopt',
|
||||
`setsockopt', `getsockname', `getpeername', `send',
|
||||
@@ -603,10 +598,22 @@ invalid. I.e., an emulated FPU is for the libc as good as a real one.
|
||||
[Q20] ``How can I compile gcc 2.7.2.1 from the gcc source code using
|
||||
glibc 2.x?
|
||||
|
||||
[A20] {HJL} There is no support in gcc for glibc 2.0 before gcc 2.8. It
|
||||
is very tricky to compile gcc 2.7.2.1 using glibc 2.x. You have to
|
||||
build it manually or with one pass only. You also have to use the
|
||||
specs file in this FAQ while compiling gcc.
|
||||
[A20] {AJ} There's only support for glibc 2.0 in gcc 2.7.2.2 or later.
|
||||
For 2.7.2.2 you should use the following patch and configure for
|
||||
e.g. i486-linux.
|
||||
-----------------------------------------------------------------------
|
||||
--- configure Tue Feb 11 15:57:17 1997
|
||||
+++ configure Wed Feb 12 23:09:29 1997
|
||||
@@ -1021,7 +1021,7 @@
|
||||
gnu_ld=yes
|
||||
# GNU libc version 2 does not supply these;
|
||||
# we want them from GCC.
|
||||
- extra_parts="crtbegin.o crtend.o"
|
||||
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
|
||||
;;
|
||||
i[3456]86-go32-msdos | i[3456]86-*-go32)
|
||||
cpu_type=i386
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
|
||||
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
|
||||
@@ -157,17 +157,17 @@ build the GNU C library:
|
||||
recommend you port GNU `make' instead. *Really.* We recommend
|
||||
version GNU `make' version 3.75 or later.
|
||||
|
||||
* GCC 2.7.2.1
|
||||
* GCC 2.7.2
|
||||
|
||||
On most platforms, the GNU C library can only be compiled with the
|
||||
GNU C compiler. We recommend GCC version 2.7.2 or later; earlier
|
||||
versions may have problems.
|
||||
|
||||
* `binutils' 2.7
|
||||
* `binutils' 2.8
|
||||
|
||||
Using the GNU `binutils' (assembler, linker, and related tools) is
|
||||
preferable when possible, and they are required to build an ELF
|
||||
shared C library. We recommend `binutils' version 2.7 or later;
|
||||
shared C library. We recommend `binutils' version 2.8 or later;
|
||||
earlier versions are known to have problems or to not support all
|
||||
architectures.
|
||||
|
||||
@@ -183,8 +183,8 @@ following patterns:
|
||||
iX86-ANYTHING-linux
|
||||
m68k-ANYTHING-linux
|
||||
|
||||
Former versions of this library used to support the following
|
||||
configurations but the current status is unknown:
|
||||
Former releases of this library (version 1.09.1 and perhaps earlier
|
||||
versions) used to run on the following configurations:
|
||||
|
||||
alpha-dec-osf1
|
||||
iX86-ANYTHING-bsd4.3
|
||||
@@ -208,7 +208,13 @@ configurations but the current status is unknown:
|
||||
sparc-sun-solaris2.N
|
||||
sparc-sun-sunos4.N
|
||||
|
||||
Each case of `iX86' can be `i386', `i486', `i586', or `i686'.. All
|
||||
Since no one has volunteered to test and fix the above
|
||||
configurations, these are not supported at the moment. It's expected
|
||||
that these don't work anymore. Porting the library is not hard. If
|
||||
you are interested in doing a port, please contact the glibc
|
||||
maintainers by sending electronic mail to <bug-glibc@prep.ai.mit.edu>.
|
||||
|
||||
Each case of `iX86' can be `i386', `i486', `i586', or `i686'. All
|
||||
of those configurations produce a library that can run on any of these
|
||||
processors. The library will be optimized for the specified processor,
|
||||
but will not use instructions not available on all of them.
|
||||
@@ -258,11 +264,11 @@ and `config.make' which are created by running `configure'; they will
|
||||
be in whatever directory was current when you ran `configure'.
|
||||
|
||||
If you think you have found some way in which the GNU C library does
|
||||
not conform to the ANSI and POSIX standards (*note Standards and
|
||||
not conform to the ISO and POSIX standards (*note Standards and
|
||||
Portability::.), that is definitely a bug. Report it!
|
||||
|
||||
Send bug reports to the Internet address `bug-glibc@prep.ai.mit.edu'
|
||||
or the UUCP path `mit-eddie!prep.ai.mit.edu!bug-glibc'. If you have
|
||||
Send bug reports to the Internet address <bug-glibc@prep.ai.mit.edu>
|
||||
or the UUCP path <mit-eddie!prep.ai.mit.edu!bug-glibc>. If you have
|
||||
other problems with installation or use, please report those as well.
|
||||
|
||||
If you are not sure how a function should behave, and this manual
|
||||
@@ -270,8 +276,8 @@ doesn't tell you, that's a bug in the manual. Report that too! If the
|
||||
function's behavior disagrees with the manual, then either the library
|
||||
or the manual has a bug, so report the disagreement. If you find any
|
||||
errors or omissions in this manual, please report them to the Internet
|
||||
address `bug-glibc-manual@prep.ai.mit.edu' or the UUCP path
|
||||
`mit-eddie!prep.ai.mit.edu!bug-glibc-manual'.
|
||||
address <bug-glibc-manual@prep.ai.mit.edu> or the UUCP path
|
||||
<mit-eddie!prep.ai.mit.edu!bug-glibc-manual>.
|
||||
|
||||
Adding New Functions
|
||||
====================
|
||||
@@ -773,10 +779,9 @@ parts of the library were contributed or worked on by other people.
|
||||
platforms was written by Per Bothner and modified by Ulrich
|
||||
Drepper.
|
||||
|
||||
* Some of the Internet-related code (most of the `inet'
|
||||
subdirectory) and several other miscellaneous functions and
|
||||
header files have been included from 4.4 BSD with little or no
|
||||
modification.
|
||||
* The Internet-related code (most of the `inet' subdirectory) and
|
||||
several other miscellaneous functions and header files have been
|
||||
included from 4.4 BSD with little or no modification.
|
||||
|
||||
All code incorporated from 4.4 BSD is under the following
|
||||
copyright:
|
||||
@@ -827,7 +832,7 @@ parts of the library were contributed or worked on by other people.
|
||||
`rand' and `srand' functions, were written by Earl T. Cohen for
|
||||
the University of California at Berkeley and are copyrighted by the
|
||||
Regents of the University of California. They have undergone minor
|
||||
changes to fit into the GNU C library and to fit the ANSI C
|
||||
changes to fit into the GNU C library and to fit the ISO C
|
||||
standard, but the functional code is Berkeley's.
|
||||
|
||||
* The Internet resolver code is taken directly from BIND 4.9.5,
|
||||
@@ -914,59 +919,7 @@ parts of the library were contributed or worked on by other people.
|
||||
Carnegie Mellon University
|
||||
Pittsburgh PA 15213-3890
|
||||
|
||||
or `Software.Distribution@CS.CMU.EDU' any improvements or
|
||||
or <Software.Distribution@CS.CMU.EDU> any improvements or
|
||||
extensions that they make and grant Carnegie Mellon the
|
||||
rights to redistribute these changes.
|
||||
|
||||
* The `getaddrinfo' function is written by Craig Metz and it has the
|
||||
following copyright:
|
||||
|
||||
The Inner Net License, Version 2.00
|
||||
===================================
|
||||
|
||||
The author(s) grant permission for redistribution and use in source and
|
||||
binary forms, with or without modification, of the software
|
||||
and documentation provided that the following conditions are met:
|
||||
|
||||
0. If you receive a version of the software that is
|
||||
specifically labelled as not being for redistribution
|
||||
(check the version message and/or README), you are not
|
||||
permitted to redistribute that version of the software in
|
||||
any way or form.
|
||||
1. All terms of the all other applicable copyrights and
|
||||
licenses must be followed.
|
||||
2. Redistributions of source code must retain the authors'
|
||||
copyright notice(s), this list of conditions, and the
|
||||
following disclaimer.
|
||||
3. Redistributions in binary form must reproduce the authors'
|
||||
copyright notice(s), this list of conditions, and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
4. All advertising materials mentioning features or use of
|
||||
this software must display the following acknowledgement
|
||||
with the name(s) of the authors as specified in the
|
||||
copyright notice(s) substituted where indicated:
|
||||
|
||||
This product includes software developed by <name(s)>, The Inner
|
||||
Net, and other contributors.
|
||||
|
||||
5. Neither the name(s) of the author(s) nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
|
||||
If these license terms cause you a real problem, contact the author.
|
||||
|
||||
@@ -118,8 +118,8 @@ foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
|
||||
$(+sysdeps)
|
||||
foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2)
|
||||
foo:=$(shell echo generated='$(generated)' >&2)
|
||||
generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
|
||||
foo:=$(shell echo now generated='$(generated)' >&2)
|
||||
#generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
|
||||
#foo:=$(shell echo now generated='$(generated)' >&2)
|
||||
+tsrcs := $(sort $(filter-out $(generated),$(+tsrcs)))
|
||||
foo:=$(shell echo '+tsrcs=$(+tsrcs)'>&2)
|
||||
foo:=$(shell echo foobie, dammit! >&2)
|
||||
@@ -142,10 +142,10 @@ ifdef subdir
|
||||
|
||||
foo:=$(shell echo subdir foo >&2)
|
||||
|
||||
+tsrcs := Makefile $(+tsrcs) \
|
||||
$(addsuffix .c,$(others) $(tests)) \
|
||||
$(wildcard $(addsuffix .input,$(tests)) \
|
||||
$(addsuffix .args,$(tests)))
|
||||
+tsrcs := Makefile $(+tsrcs) \
|
||||
$(addsuffix .c,$(others) $(tests) $(test-srcs)) \
|
||||
$(wildcard $(addsuffix .input,$(tests) $(test-srcs)) \
|
||||
$(addsuffix .args,$(tests) $(test-srcs)))
|
||||
+tardeps := $(strip $(+tsrcs))
|
||||
|
||||
verbose = v
|
||||
@@ -195,9 +195,9 @@ dist.tar: README $(tardir) $(+tsrcs)
|
||||
|
||||
$(tardir).tar: dist.tar subdir_dist
|
||||
@echo Files listed here have names exceeding 14 chars.
|
||||
tar xfv $< -C /tmp | sed -n '/[^/]\{15,\}/p'
|
||||
tar covf $@ -C /tmp $(tardir)
|
||||
-rm -fr /tmp/$(tardir) dist.tar &
|
||||
tar xfv $< -C $${TMPDIR-/tmp} | sed -n '/[^/]\{15,\}/p'
|
||||
tar covf $@ -C $${TMPDIR-/tmp} $(tardir)
|
||||
-rm -fr $${TMPDIR-/tmp}/$(tardir) dist.tar &
|
||||
|
||||
%.Z: %
|
||||
compress -c $< > $@
|
||||
|
||||
@@ -88,7 +88,7 @@ sources += $(foreach lib,$(extra-libs),$($(lib)-routines:=.c))
|
||||
# sysdep directories, so don't bother searching them.
|
||||
sysdep-sources := $(filter-out $(wildcard $(sources)), $(sources))
|
||||
all-sources = $(wildcard $(sort $(sources) $(sources:.c=.S) $(sources:.c=.s) \
|
||||
$(others:=.c) $(tests:=.c))) \
|
||||
$(others:=.c) $(tests:=.c) $(test-srcs:=.c))) \
|
||||
$(foreach dir,$(all-dirs),\
|
||||
$(wildcard \
|
||||
$(addprefix $(dir)/,\
|
||||
|
||||
+8
-9
@@ -23,6 +23,8 @@ ifneq (,)
|
||||
This makefile requires GNU Make.
|
||||
endif
|
||||
|
||||
all: # Make this the default goal
|
||||
|
||||
ifneq "$(origin +included-Makeconfig)" "file"
|
||||
|
||||
+included-Makeconfig := yes
|
||||
@@ -239,7 +241,8 @@ endif
|
||||
# other than there, so the zoneinfo directory contains only universal data,
|
||||
# localizing the configuration data elsewhere.
|
||||
ifndef localtime-file
|
||||
localtime-file = $(inst_sysconfdir)/localtime
|
||||
localtime-file = $(sysconfdir)/localtime
|
||||
inst_localtime-file = $(install_root)$(localtime-file)
|
||||
endif
|
||||
|
||||
# What to use for leap second specifications in compiling the default
|
||||
@@ -319,10 +322,10 @@ endif
|
||||
ifndef +link
|
||||
+link = $(CC) -nostdlib -nostartfiles -o $@ \
|
||||
$(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) \
|
||||
$(addprefix $(csu-objpfx),start.o) $(+preinit) \
|
||||
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+prector) \
|
||||
$(filter-out $(addprefix $(csu-objpfx),start.o) $(+preinit) \
|
||||
$(link-extra-libs) $(common-objpfx)libc% $(+postinit),$^) \
|
||||
$(link-extra-libs) $(link-libc) $(+postinit)
|
||||
$(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
|
||||
endif
|
||||
ifndef config-LDFLAGS
|
||||
ifeq (yes,$(build-shared))
|
||||
@@ -366,6 +369,8 @@ endif
|
||||
ifeq ($(elf),yes)
|
||||
+preinit = $(addprefix $(csu-objpfx),crti.o)
|
||||
+postinit = $(addprefix $(csu-objpfx),crtn.o)
|
||||
+prector = `$(CC) --print-file-name=crtbegin.o`
|
||||
+postctor = `$(CC) --print-file-name=crtend.o`
|
||||
endif
|
||||
csu-objpfx = $(common-objpfx)csu/
|
||||
elf-objpfx = $(common-objpfx)elf/
|
||||
@@ -516,12 +521,6 @@ endif
|
||||
ifndef BUILD_CC
|
||||
BUILD_CC = $(CC)
|
||||
endif
|
||||
|
||||
ifneq ($(BUILD_CC),$(CC))
|
||||
cross-compiling := yes
|
||||
else
|
||||
cross-compiling := no
|
||||
endif
|
||||
|
||||
# Figure out the version numbers from version.h.
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ parent_echo-distinfo:
|
||||
|
||||
# Make the distribution tarfile.
|
||||
|
||||
distribute := README INSTALL FAQ NOTES NEWS PROJECTS \
|
||||
distribute := README INSTALL FAQ NOTES NEWS PROJECTS BUGS \
|
||||
COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \
|
||||
Makefile Makeconfig Makerules Rules Make-dist MakeTAGS \
|
||||
extra-lib.mk o-iterator.mk \
|
||||
@@ -303,6 +303,8 @@ makeinfo --no-validate --no-warn --no-headers $< -o $@
|
||||
endef
|
||||
INSTALL: manual/maint.texi; $(format-me)
|
||||
NOTES: manual/creature.texi; $(format-me)
|
||||
manual/dir-add.texi:
|
||||
$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
|
||||
|
||||
rpm/%: subdir_distinfo
|
||||
$(MAKE) $(PARALLELMFLAGS) -C $(@D) subdirs='$(subdirs)' $(@F)
|
||||
|
||||
@@ -339,6 +339,8 @@ $(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
|
||||
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
|
||||
-Wl,--whole-archive $^ $(no-whole-archive) \
|
||||
$(LDLIBS-$(@F:lib%.so=%).so)
|
||||
test -z "$($(@F)-version)" || \
|
||||
(rm -f $@$($(@F)-version); $(LN_S) $(@F) $@$($(@F)-version))
|
||||
endef
|
||||
|
||||
# Don't try to use -lc when making libc.so itself.
|
||||
@@ -354,12 +356,6 @@ $(common-objpfx)libc.so: $(elfobjdir)/soinit.so \
|
||||
$(common-objpfx)libc_pic.a \
|
||||
$(elfobjdir)/sofini.so $(elfobjdir)/ld.so
|
||||
$(build-shlib)
|
||||
|
||||
ifdef libc.so-version
|
||||
$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
|
||||
rm -f $@
|
||||
ln -s $(<F) $@ || ln $< $@
|
||||
endif
|
||||
endif
|
||||
|
||||
# Some files must not be compiled with the exception handler mechanism
|
||||
@@ -811,7 +807,7 @@ $(BUILD_CC) $(BUILD_CFLAGS) $(<:$(common-objpfx)%=$(..)%) -o $(..)$(@F)
|
||||
endef
|
||||
|
||||
# We always want to use configuration definitions.
|
||||
BUILD_CFLAGS = -include $(common-objpfx)config.h
|
||||
BUILD_CFLAGS = -include $(..)config.h
|
||||
|
||||
# Support the GNU standard name for this target.
|
||||
.PHONY: check
|
||||
@@ -839,9 +835,10 @@ mostlyclean: common-mostlyclean
|
||||
|
||||
# Remove the object files.
|
||||
common-mostlyclean:
|
||||
-rm -f $(addprefix $(objpfx),$(tests) $(others) \
|
||||
$(addsuffix .o,$(tests) $(others)) \
|
||||
$(addsuffix .out,$(tests)))
|
||||
-rm -f $(addprefix $(objpfx),$(tests) $(test-srcs) $(others) \
|
||||
$(addsuffix .o,$(tests) $(test-srcs) \
|
||||
$(others)) \
|
||||
$(addsuffix .out,$(tests) $(test-srcs)))
|
||||
-rm -f $(addprefix $(objpfx),$(extra-objs) $(install-lib))
|
||||
-rm -f core $(common-objpfx)stub-$(subdir)
|
||||
$(rmobjs)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
GNU C Library NEWS -- history of user-visible changes. 26 January 1997
|
||||
GNU C Library NEWS -- history of user-visible changes. 1997-03-18
|
||||
|
||||
Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
See the end for copying conditions.
|
||||
@@ -14,6 +14,8 @@ Version 2.0.2
|
||||
* add atoll function
|
||||
|
||||
* fix complex problems in Berkeley DB code
|
||||
|
||||
* fix math functions
|
||||
|
||||
Version 2.0.1
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
This directory contains the version 2.0.1 test release of the GNU C Library.
|
||||
This directory contains the version 2.0.4 test release of the GNU C Library.
|
||||
Many bugs have been fixed since the last release.
|
||||
Some bugs surely remain.
|
||||
|
||||
As of this release, the GNU C library is known to run on the following
|
||||
configurations:
|
||||
|
||||
*-*-gnu GNU Hurd
|
||||
i[3456]86-*-gnu GNU Hurd
|
||||
i[3456]86-*-linux-gnu Linux-2.0 on Intel
|
||||
m68k-*-linux-gnu Linux-2.0 on Motorola 680x0
|
||||
alpha-*-linux-gnu Linux-2.0 on DEC Alpha
|
||||
@@ -36,17 +36,18 @@ versions) used to run on the following configurations:
|
||||
sparc-sun-solaris2
|
||||
sparc-sun-sunos4
|
||||
|
||||
Whether this is still true for this release is unknown. Porting the
|
||||
library is not hard. If you are interested in doing a port, please
|
||||
get on the mailing list by sending electronic mail to
|
||||
<bug-glibc-request@prep.ai.mit.edu>.
|
||||
Since no one has volunteered to test and fix the above configurations,
|
||||
these are not supported at the moment. It's expected that these don't
|
||||
work anymore. Porting the library is not hard. If you are interested
|
||||
in doing a port, please contact the glibc maintainers by sending
|
||||
electronic mail to <bug-glibc@prep.ai.mit.edu>.
|
||||
|
||||
The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
|
||||
provides the Unix `crypt' function, plus some other entry points.
|
||||
Because of the United States export restriction on DES implementations,
|
||||
we are distributing this code separately from the rest of the C
|
||||
library. There is an extra distribution tar file just for crypt; it is
|
||||
called `glibc-crypt-2.0.1.tar.gz'. You can just unpack the crypt
|
||||
called `glibc-crypt-2.0.4.tar.gz'. You can just unpack the crypt
|
||||
distribution along with the rest of the C library and build; you can
|
||||
also build the library without getting crypt. Users outside the USA
|
||||
can get the crypt distribution via anonymous FTP from ftp.ifi.uio.no
|
||||
|
||||
+6
-5
@@ -5,7 +5,7 @@ Some bugs surely remain.
|
||||
As of this release, the GNU C library is known to run on the following
|
||||
configurations:
|
||||
|
||||
*-*-gnu GNU Hurd
|
||||
i[3456]86-*-gnu GNU Hurd
|
||||
i[3456]86-*-linux-gnu Linux-2.0 on Intel
|
||||
m68k-*-linux-gnu Linux-2.0 on Motorola 680x0
|
||||
alpha-*-linux-gnu Linux-2.0 on DEC Alpha
|
||||
@@ -36,10 +36,11 @@ versions) used to run on the following configurations:
|
||||
sparc-sun-solaris2
|
||||
sparc-sun-sunos4
|
||||
|
||||
Whether this is still true for this release is unknown. Porting the
|
||||
library is not hard. If you are interested in doing a port, please
|
||||
get on the mailing list by sending electronic mail to
|
||||
<bug-glibc-request@prep.ai.mit.edu>.
|
||||
Since no one has volunteered to test and fix the above configurations,
|
||||
these are not supported at the moment. It's expected that these don't
|
||||
work anymore. Porting the library is not hard. If you are interested
|
||||
in doing a port, please contact the glibc maintainers by sending
|
||||
electronic mail to <bug-glibc@prep.ai.mit.edu>.
|
||||
|
||||
The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
|
||||
provides the Unix `crypt' function, plus some other entry points.
|
||||
|
||||
@@ -83,19 +83,19 @@ common-generated := $(common-generated) dummy.o dummy.c empty.c empty.o
|
||||
.PHONY: others tests
|
||||
others: $(addprefix $(objpfx),$(others) $(extra-objs))
|
||||
ifeq ($(cross-compiling),yes)
|
||||
tests: $(addprefix $(objpfx),$(tests))
|
||||
tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
|
||||
else
|
||||
tests: $(tests:%=$(objpfx)%.out)
|
||||
tests: $(tests:%=$(objpfx)%.out) $(addprefix $(objpfx),$(test-srcs))
|
||||
endif
|
||||
|
||||
ifneq "$(strip $(others) $(tests))" ""
|
||||
$(addprefix $(objpfx),$(others) $(tests)): %: %.o \
|
||||
ifneq "$(strip $(others) $(tests) $(test-srcs))" ""
|
||||
$(addprefix $(objpfx),$(others) $(tests) $(test-srcs)): %: %.o \
|
||||
$(sort $(filter $(common-objpfx)libc%,$(link-libc))) \
|
||||
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
|
||||
$(+link)
|
||||
endif
|
||||
|
||||
ifneq "$(strip $(tests))" ""
|
||||
ifneq "$(strip $(tests) $(test-srcs))" ""
|
||||
# These are the implicit rules for making test outputs
|
||||
# from the test programs and whatever input files are present.
|
||||
$(objpfx)%.out: %.args $(objpfx)% %.input
|
||||
|
||||
Vendored
+59
@@ -31,3 +31,62 @@ changequote([,])dnl
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
|
||||
dnl
|
||||
|
||||
dnl These modifications are to allow for an empty cross compiler tree.
|
||||
dnl In the situation that cross-linking is impossible, the variable
|
||||
dnl `cross_linkable' will be substituted with "yes".
|
||||
AC_DEFUN(AC_PROG_CC_LOCAL,
|
||||
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
|
||||
AC_CHECK_PROG(CC, gcc, gcc)
|
||||
if test -z "$CC"; then
|
||||
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
|
||||
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
|
||||
fi
|
||||
|
||||
AC_PROG_CC_WORKS_LOCAL
|
||||
AC_PROG_CC_GNU
|
||||
|
||||
dnl The following differs from the AC_PROG_CC macro in autoconf. Since
|
||||
dnl we require a recent version of gcc to be used we do not need to go
|
||||
dnl into lengths and test for bugs in old versions. It must be gcc 2.7
|
||||
dnl or above.
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
|
||||
dnl Check the version
|
||||
cat > conftest.c <<EOF
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
|
||||
yes;
|
||||
#endif
|
||||
EOF
|
||||
if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
|
||||
if test -z "$CFLAGS"; then
|
||||
CFLAGS="-g -O2"
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([We require GNU CC version 2.7 or newer])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([GNU libc must be compiled using GNU CC])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_PROG_CC_WORKS_LOCAL,
|
||||
[AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross)
|
||||
AC_LANG_RESTORE
|
||||
AC_MSG_RESULT($ac_cv_prog_cc_works)
|
||||
if test $ac_cv_prog_cc_works = no; then
|
||||
cross_linkable=no
|
||||
ac_cv_prog_cc_cross=yes
|
||||
dnl AC_MSG_ERROR([installation or configuration problem: C compiler cannot create executables.])
|
||||
else
|
||||
cross_linkable=yes
|
||||
fi
|
||||
AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
|
||||
AC_MSG_RESULT($ac_cv_prog_cc_cross)
|
||||
AC_SUBST(cross_linkable)
|
||||
cross_compiling=$ac_cv_prog_cc_cross
|
||||
])
|
||||
|
||||
+12
-3
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -34,6 +34,7 @@ catopen (const char *cat_name, int flag)
|
||||
{
|
||||
__nl_catd result;
|
||||
const char *env_var;
|
||||
const char *nlspath;
|
||||
|
||||
result = (__nl_catd) malloc (sizeof (*result));
|
||||
if (result == NULL)
|
||||
@@ -82,8 +83,16 @@ catopen (const char *cat_name, int flag)
|
||||
return (nl_catd) -1;
|
||||
}
|
||||
|
||||
if (__secure_getenv ("NLSPATH") != NULL)
|
||||
result->nlspath = __strdup (getenv ("NLSPATH"));
|
||||
nlspath = __secure_getenv ("NLSPATH");
|
||||
if (nlspath != NULL && *nlspath != '\0')
|
||||
{
|
||||
/* Append the system dependent directory. */
|
||||
size_t len = strlen (nlspath + 1 + sizeof NLSPATH);
|
||||
char *tmp = alloca (len);
|
||||
|
||||
__stpcpy (__stpcpy (__stpcpy (tmp, nlspath), ":"), NLSPATH);
|
||||
nlspath = tmp;
|
||||
}
|
||||
else
|
||||
result->nlspath = __strdup (NLSPATH);
|
||||
|
||||
|
||||
Vendored
+25
-7
@@ -68,8 +68,20 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
echo m68k-cbm-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-cbm-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc:OpenBSD:*:*)
|
||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
laguna:OpenBSD:*:*)
|
||||
echo mips64-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
@@ -118,19 +130,25 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
echo m68k-atari-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:OpenBSD:*:*)
|
||||
echo m68k-atari-openbsd${UNAME_RELEASE}
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:NetBSD:*:*)
|
||||
echo m68k-sun-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:OpenBSD:*:*)
|
||||
echo m68k-sun-openbsd${UNAME_RELEASE}
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:NetBSD:*:*)
|
||||
echo m68k-apple-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-apple-openbsd${UNAME_RELEASE}
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme88k:OpenBSD:*:*)
|
||||
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
@@ -378,8 +396,8 @@ EOF
|
||||
hp3[0-9][05]:NetBSD:*:*)
|
||||
echo m68k-hp-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp3[0-9][05]:OpenBSD:*:*)
|
||||
echo m68k-hp-openbsd${UNAME_RELEASE}
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:BSD/386:*:* | *:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
|
||||
@@ -39,6 +39,7 @@ build-profile = @profile@
|
||||
build-omitfp = @omitfp@
|
||||
stdio = @stdio@
|
||||
add-ons = @subdirs@
|
||||
cross-compiling = @cross_compiling@
|
||||
|
||||
# Build tools.
|
||||
CC = @CC@
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#! /bin/sh
|
||||
|
||||
# From configure.in CVSid
|
||||
|
||||
|
||||
|
||||
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated automatically using autoconf version 2.12
|
||||
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
@@ -720,7 +724,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
|
||||
fi
|
||||
|
||||
echo $ac_n "checking host system type""... $ac_c" 1>&6
|
||||
echo "configure:724: checking host system type" >&5
|
||||
echo "configure:728: checking host system type" >&5
|
||||
|
||||
host_alias=$host
|
||||
case "$host_alias" in
|
||||
@@ -800,7 +804,7 @@ esac
|
||||
# This can take a while to compute.
|
||||
sysdep_dir=$srcdir/sysdeps
|
||||
echo $ac_n "checking sysdep dirs""... $ac_c" 1>&6
|
||||
echo "configure:804: checking sysdep dirs" >&5
|
||||
echo "configure:808: checking sysdep dirs" >&5
|
||||
# Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
|
||||
os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
|
||||
|
||||
@@ -1001,7 +1005,7 @@ echo "$ac_t""sysdeps/generic sysdeps/stub" 1>&6
|
||||
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
|
||||
# ./install, which can be erroneously created by make from ./install.sh.
|
||||
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
|
||||
echo "configure:1005: checking for a BSD compatible install" >&5
|
||||
echo "configure:1009: checking for a BSD compatible install" >&5
|
||||
if test -z "$INSTALL"; then
|
||||
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@@ -1055,7 +1059,7 @@ if test "$INSTALL" = "${srcdir}/install-sh -c"; then
|
||||
INSTALL='$(..)./install-sh -c'
|
||||
fi
|
||||
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
|
||||
echo "configure:1059: checking whether ln -s works" >&5
|
||||
echo "configure:1063: checking whether ln -s works" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1080,7 +1084,7 @@ do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1084: checking for $ac_word" >&5
|
||||
echo "configure:1088: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_MSGFMT'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1110,8 +1114,168 @@ done
|
||||
test -n "$MSGFMT" || MSGFMT=":"
|
||||
|
||||
|
||||
# Extract the first word of "gcc", so it can be a program name with args.
|
||||
set dummy gcc; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1121: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
ac_cv_prog_CC="gcc"
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
fi
|
||||
fi
|
||||
CC="$ac_cv_prog_CC"
|
||||
if test -n "$CC"; then
|
||||
echo "$ac_t""$CC" 1>&6
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
if test -z "$CC"; then
|
||||
# Extract the first word of "cc", so it can be a program name with args.
|
||||
set dummy cc; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1150: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
ac_prog_rejected=no
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
|
||||
ac_prog_rejected=yes
|
||||
continue
|
||||
fi
|
||||
ac_cv_prog_CC="cc"
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
if test $ac_prog_rejected = yes; then
|
||||
# We found a bogon in the path, so make sure we never use it.
|
||||
set dummy $ac_cv_prog_CC
|
||||
shift
|
||||
if test $# -gt 0; then
|
||||
# We chose a different compiler from the bogus one.
|
||||
# However, it has the same basename, so the bogon will be chosen
|
||||
# first if we set CC to just the basename; use the full file name.
|
||||
shift
|
||||
set dummy "$ac_dir/$ac_word" "$@"
|
||||
shift
|
||||
ac_cv_prog_CC="$@"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
CC="$ac_cv_prog_CC"
|
||||
if test -n "$CC"; then
|
||||
echo "$ac_t""$CC" 1>&6
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
|
||||
fi
|
||||
|
||||
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
|
||||
echo "configure:1198: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
|
||||
|
||||
ac_ext=c
|
||||
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
|
||||
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
|
||||
cross_compiling=$ac_cv_prog_cc_cross
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1208 "configure"
|
||||
#include "confdefs.h"
|
||||
main(){return(0);}
|
||||
EOF
|
||||
if { (eval echo configure:1212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
ac_cv_prog_cc_works=yes
|
||||
# If we can't run a trivial program, we are probably using a cross compiler.
|
||||
if (./conftest; exit) 2>/dev/null; then
|
||||
ac_cv_prog_cc_cross=no
|
||||
else
|
||||
ac_cv_prog_cc_cross=yes
|
||||
fi
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_cv_prog_cc_works=no
|
||||
fi
|
||||
rm -fr conftest*
|
||||
|
||||
echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
|
||||
if test $ac_cv_prog_cc_works = no; then
|
||||
cross_linkable=no
|
||||
ac_cv_prog_cc_cross=yes
|
||||
else
|
||||
cross_linkable=yes
|
||||
fi
|
||||
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
|
||||
echo "configure:1235: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
|
||||
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
|
||||
|
||||
cross_compiling=$ac_cv_prog_cc_cross
|
||||
|
||||
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
|
||||
echo "configure:1241: checking whether we are using GNU C" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.c <<EOF
|
||||
#ifdef __GNUC__
|
||||
yes;
|
||||
#endif
|
||||
EOF
|
||||
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1250: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
|
||||
ac_cv_prog_gcc=yes
|
||||
else
|
||||
ac_cv_prog_gcc=no
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$ac_t""$ac_cv_prog_gcc" 1>&6
|
||||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
|
||||
cat > conftest.c <<EOF
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
|
||||
yes;
|
||||
#endif
|
||||
EOF
|
||||
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1267: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
|
||||
if test -z "$CFLAGS"; then
|
||||
CFLAGS="-g -O2"
|
||||
fi
|
||||
else
|
||||
{ echo "configure: error: We require GNU CC version 2.7 or newer" 1>&2; exit 1; }
|
||||
fi
|
||||
else
|
||||
{ echo "configure: error: GNU libc must be compiled using GNU CC" 1>&2; exit 1; }
|
||||
fi
|
||||
|
||||
echo $ac_n "checking build system type""... $ac_c" 1>&6
|
||||
echo "configure:1115: checking build system type" >&5
|
||||
echo "configure:1279: checking build system type" >&5
|
||||
|
||||
build_alias=$build
|
||||
case "$build_alias" in
|
||||
@@ -1129,47 +1293,12 @@ build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
echo "$ac_t""$build" 1>&6
|
||||
|
||||
if test $host != $build; then
|
||||
ac_tool_prefix=${host_alias}-
|
||||
else
|
||||
ac_tool_prefix=
|
||||
fi
|
||||
|
||||
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}gcc; ac_word=$2
|
||||
for ac_prog in gcc cc
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1141: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
ac_cv_prog_CC="${ac_tool_prefix}gcc"
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="gcc"
|
||||
fi
|
||||
fi
|
||||
CC="$ac_cv_prog_CC"
|
||||
if test -n "$CC"; then
|
||||
echo "$ac_t""$CC" 1>&6
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test $host != $build; then
|
||||
# Extract the first word of "gcc cc", so it can be a program name with args.
|
||||
set dummy gcc cc; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1173: checking for $ac_word" >&5
|
||||
echo "configure:1302: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1180,7 +1309,7 @@ else
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
ac_cv_prog_BUILD_CC=""
|
||||
ac_cv_prog_BUILD_CC="$ac_prog"
|
||||
break
|
||||
fi
|
||||
done
|
||||
@@ -1194,9 +1323,13 @@ else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
test -n "$BUILD_CC" && break
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
|
||||
echo "configure:1200: checking how to run the C preprocessor" >&5
|
||||
echo "configure:1333: checking how to run the C preprocessor" >&5
|
||||
# On Suns, sometimes $CPP names a directory.
|
||||
if test -n "$CPP" && test -d "$CPP"; then
|
||||
CPP=
|
||||
@@ -1211,13 +1344,13 @@ else
|
||||
# On the NeXT, cc -E runs the code through the compiler's parser,
|
||||
# not just through cpp.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1215 "configure"
|
||||
#line 1348 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1221: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:1354: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out`
|
||||
if test -z "$ac_err"; then
|
||||
:
|
||||
@@ -1228,13 +1361,13 @@ else
|
||||
rm -rf conftest*
|
||||
CPP="${CC-cc} -E -traditional-cpp"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1232 "configure"
|
||||
#line 1365 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1238: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:1371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out`
|
||||
if test -z "$ac_err"; then
|
||||
:
|
||||
@@ -1256,10 +1389,16 @@ else
|
||||
fi
|
||||
echo "$ac_t""$CPP" 1>&6
|
||||
|
||||
if test $host != $build; then
|
||||
ac_tool_prefix=${host_alias}-
|
||||
else
|
||||
ac_tool_prefix=
|
||||
fi
|
||||
|
||||
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}ar; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1263: checking for $ac_word" >&5
|
||||
echo "configure:1402: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1290,7 +1429,7 @@ fi
|
||||
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1294: checking for $ac_word" >&5
|
||||
echo "configure:1433: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1321,7 +1460,7 @@ if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "ranlib", so it can be a program name with args.
|
||||
set dummy ranlib; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1325: checking for $ac_word" >&5
|
||||
echo "configure:1464: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1356,7 +1495,7 @@ fi
|
||||
# Extract the first word of "bash", so it can be a program name with args.
|
||||
set dummy bash; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1360: checking for $ac_word" >&5
|
||||
echo "configure:1499: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1397,7 +1536,7 @@ if test "$BASH" = no; then
|
||||
# Extract the first word of "ksh", so it can be a program name with args.
|
||||
set dummy ksh; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:1401: checking for $ac_word" >&5
|
||||
echo "configure:1540: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1439,7 +1578,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
|
||||
echo "configure:1443: checking for signed size_t type" >&5
|
||||
echo "configure:1582: checking for signed size_t type" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1463,12 +1602,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6
|
||||
echo "configure:1467: checking for libc-friendly stddef.h" >&5
|
||||
echo "configure:1606: checking for libc-friendly stddef.h" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1472 "configure"
|
||||
#line 1611 "configure"
|
||||
#include "confdefs.h"
|
||||
#define __need_size_t
|
||||
#define __need_wchar_t
|
||||
@@ -1483,7 +1622,7 @@ size_t size; wchar_t wchar;
|
||||
if (&size == NULL || &wchar == NULL) abort ();
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1487: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:1626: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
libc_cv_friendly_stddef=yes
|
||||
else
|
||||
@@ -1502,7 +1641,7 @@ override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
|
||||
fi
|
||||
|
||||
echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6
|
||||
echo "configure:1506: checking whether we need to use -P to assemble .S files" >&5
|
||||
echo "configure:1645: checking whether we need to use -P to assemble .S files" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1525,7 +1664,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6
|
||||
echo "configure:1529: checking for assembler global-symbol directive" >&5
|
||||
echo "configure:1668: checking for assembler global-symbol directive" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1555,7 +1694,7 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
|
||||
echo "configure:1559: checking for .set assembler directive" >&5
|
||||
echo "configure:1698: checking for .set assembler directive" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1590,7 +1729,7 @@ fi
|
||||
|
||||
if test $elf = yes; then
|
||||
echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
|
||||
echo "configure:1594: checking for .previous assembler directive" >&5
|
||||
echo "configure:1733: checking for .previous assembler directive" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1598,7 +1737,7 @@ else
|
||||
.section foo_section
|
||||
.previous
|
||||
EOF
|
||||
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1602: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
|
||||
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1741: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
|
||||
libc_cv_asm_previous_directive=yes
|
||||
else
|
||||
libc_cv_asm_previous_directive=no
|
||||
@@ -1614,7 +1753,7 @@ EOF
|
||||
|
||||
else
|
||||
echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
|
||||
echo "configure:1618: checking for .popsection assembler directive" >&5
|
||||
echo "configure:1757: checking for .popsection assembler directive" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1622,7 +1761,7 @@ else
|
||||
.pushsection foo_section
|
||||
.popsection
|
||||
EOF
|
||||
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1626: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
|
||||
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1765: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
|
||||
libc_cv_asm_popsection_directive=yes
|
||||
else
|
||||
libc_cv_asm_popsection_directive=no
|
||||
@@ -1642,12 +1781,12 @@ fi
|
||||
|
||||
if test $elf != yes; then
|
||||
echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
|
||||
echo "configure:1646: checking for .init and .fini sections" >&5
|
||||
echo "configure:1785: checking for .init and .fini sections" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1651 "configure"
|
||||
#line 1790 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int main() {
|
||||
@@ -1656,7 +1795,7 @@ asm (".section .init");
|
||||
asm (".text");
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1660: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:1799: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
libc_cv_have_initfini=yes
|
||||
else
|
||||
@@ -1681,19 +1820,19 @@ if test $elf = yes; then
|
||||
libc_cv_asm_underscores=no
|
||||
else
|
||||
echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
|
||||
echo "configure:1685: checking for _ prefix on C symbol names" >&5
|
||||
echo "configure:1824: checking for _ prefix on C symbol names" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1690 "configure"
|
||||
#line 1829 "configure"
|
||||
#include "confdefs.h"
|
||||
asm ("_glibc_foobar:");
|
||||
int main() {
|
||||
glibc_foobar ();
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:1836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
rm -rf conftest*
|
||||
libc_cv_asm_underscores=yes
|
||||
else
|
||||
@@ -1720,7 +1859,7 @@ if test $elf = yes; then
|
||||
libc_cv_asm_weakext_directive=no
|
||||
else
|
||||
echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
|
||||
echo "configure:1724: checking for assembler .weak directive" >&5
|
||||
echo "configure:1863: checking for assembler .weak directive" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1743,7 +1882,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6
|
||||
|
||||
if test $libc_cv_asm_weak_directive = no; then
|
||||
echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
|
||||
echo "configure:1747: checking for assembler .weakext directive" >&5
|
||||
echo "configure:1886: checking for assembler .weakext directive" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1780,7 +1919,7 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
|
||||
echo "configure:1784: checking for ld --no-whole-archive" >&5
|
||||
echo "configure:1923: checking for ld --no-whole-archive" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1791,7 +1930,7 @@ __throw () {}
|
||||
EOF
|
||||
if { ac_try='${CC-cc} $CFLAGS
|
||||
-nostdlib -nostartfiles -Wl,--no-whole-archive
|
||||
-o conftest conftest.c'; { (eval echo configure:1795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
|
||||
-o conftest conftest.c'; { (eval echo configure:1934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
|
||||
libc_cv_ld_no_whole_archive=yes
|
||||
else
|
||||
libc_cv_ld_no_whole_archive=no
|
||||
@@ -1802,7 +1941,7 @@ fi
|
||||
echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6
|
||||
|
||||
echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6
|
||||
echo "configure:1806: checking for gcc -fno-exceptions" >&5
|
||||
echo "configure:1945: checking for gcc -fno-exceptions" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1813,7 +1952,7 @@ __throw () {}
|
||||
EOF
|
||||
if { ac_try='${CC-cc} $CFLAGS
|
||||
-nostdlib -nostartfiles -fno-exceptions
|
||||
-o conftest conftest.c'; { (eval echo configure:1817: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
|
||||
-o conftest conftest.c'; { (eval echo configure:1956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
|
||||
libc_cv_gcc_no_exceptions=yes
|
||||
else
|
||||
libc_cv_gcc_no_exceptions=no
|
||||
@@ -1865,7 +2004,7 @@ if test "$uname" = generic; then
|
||||
fi
|
||||
|
||||
echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
|
||||
echo "configure:1869: checking OS release for uname" >&5
|
||||
echo "configure:2008: checking OS release for uname" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1887,7 +2026,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6
|
||||
uname_release="$libc_cv_uname_release"
|
||||
|
||||
echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
|
||||
echo "configure:1891: checking OS version for uname" >&5
|
||||
echo "configure:2030: checking OS version for uname" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -1909,7 +2048,7 @@ else
|
||||
fi
|
||||
|
||||
echo $ac_n "checking stdio selection""... $ac_c" 1>&6
|
||||
echo "configure:1913: checking stdio selection" >&5
|
||||
echo "configure:2052: checking stdio selection" >&5
|
||||
|
||||
case $stdio in
|
||||
libio) cat >> confdefs.h <<\EOF
|
||||
@@ -1993,7 +2132,7 @@ EOF
|
||||
# Ultrix sh set writes to stderr and can't be redirected directly,
|
||||
# and sets the high bit in the cache file unless we assign to the vars.
|
||||
(set) 2>&1 |
|
||||
case `(ac_space=' '; set | grep ac_space) 2>&1` in
|
||||
case `(ac_space=' '; set) 2>&1` in
|
||||
*ac_space=\ *)
|
||||
# `set' does not quote correctly, so add quotes (double-quote substitution
|
||||
# turns \\\\ into \\, and sed turns \\ into \).
|
||||
@@ -2113,13 +2252,15 @@ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
|
||||
s%@INSTALL_DATA@%$INSTALL_DATA%g
|
||||
s%@LN_S@%$LN_S%g
|
||||
s%@MSGFMT@%$MSGFMT%g
|
||||
s%@CC@%$CC%g
|
||||
s%@cross_linkable@%$cross_linkable%g
|
||||
s%@build@%$build%g
|
||||
s%@build_alias@%$build_alias%g
|
||||
s%@build_cpu@%$build_cpu%g
|
||||
s%@build_vendor@%$build_vendor%g
|
||||
s%@build_os@%$build_os%g
|
||||
s%@CC@%$CC%g
|
||||
s%@BUILD_CC@%$BUILD_CC%g
|
||||
s%@cross_compiling@%$cross_compiling%g
|
||||
s%@CPP@%$CPP%g
|
||||
s%@AR@%$AR%g
|
||||
s%@RANLIB@%$RANLIB%g
|
||||
|
||||
+4
-2
@@ -356,10 +356,12 @@ fi
|
||||
AC_PROG_LN_S
|
||||
AC_CHECK_PROGS(MSGFMT, msgfmt gmsgfmt, :)
|
||||
|
||||
AC_CHECK_TOOL(CC, gcc)
|
||||
AC_PROG_CC_LOCAL
|
||||
AC_CANONICAL_BUILD
|
||||
if test $host != $build; then
|
||||
AC_CHECK_PROG(BUILD_CC, gcc cc)
|
||||
AC_CHECK_PROGS(BUILD_CC, gcc cc)
|
||||
fi
|
||||
AC_SUBST(cross_compiling)
|
||||
AC_PROG_CPP
|
||||
AC_CHECK_TOOL(AR, ar)
|
||||
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
||||
|
||||
+24
-21
@@ -1,6 +1,6 @@
|
||||
# Makefile for csu code for GNU C library.
|
||||
|
||||
# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -36,7 +36,7 @@ omit-deps = $(patsubst %.o,%,$(start-installed-name) g$(start-installed-name) \
|
||||
$(csu-dummies))
|
||||
install-lib = $(start-installed-name) g$(start-installed-name) \
|
||||
$(csu-dummies)
|
||||
distribute = initfini.c gmon-start.c start.c
|
||||
distribute = initfini.c gmon-start.c start.c defs.awk
|
||||
|
||||
all: # Make this the default target; it will be defined in Rules.
|
||||
|
||||
@@ -56,7 +56,7 @@ have-initfini = yes
|
||||
|
||||
endif
|
||||
|
||||
ifeq (yes,$(have-initfini))
|
||||
ifeq ($(have-initfini),yes)
|
||||
|
||||
CPPFLAGS += -DHAVE_INITFINI
|
||||
|
||||
@@ -67,27 +67,30 @@ crtstuff = crti crtn
|
||||
|
||||
install-lib += $(crtstuff:=.o)
|
||||
extra-objs += $(crtstuff:=.o)
|
||||
generated += $(crtstuff:=.s)
|
||||
generated += $(crtstuff:=.S) initfini.s align.h end.h
|
||||
omit-deps += $(crtstuff)
|
||||
|
||||
# Compile initfini.c to assembly code, which contains embedded shell
|
||||
# commands that produce crti.s-new and crtn.s-new when run. We need to
|
||||
# disable emission of .size directives and debugging information, since
|
||||
# they will get confused by the splitting of the output we do.
|
||||
$(objpfx)cr%i.s $(objpfx)cr%n.s: initfini.c; $(initfini)
|
||||
# Special rules for the building of crti.o and crtn.o
|
||||
$(objpfx)crt%.o: $(objpfx)crt%.S $(objpfx)defs.h
|
||||
$(CC) -c -fPIC -g0 -I$(..) -I$(common-objpfx) -DASSEMBLER $< -o $@
|
||||
|
||||
define initfini
|
||||
-rm -f $(objpfx)crtcommon.tmp
|
||||
(echo 'cat > crtcommon.tmp <<\EOF_common'; \
|
||||
$(CC) $< $(CPPFLAGS) $(CFLAGS) \
|
||||
-fPIC -finhibit-size-directive $(no-exceptions) -g0 -S -o -; \
|
||||
echo 'EOF_common') | (cd $(@D); $(SHELL))
|
||||
cat $(objpfx)crtcommon.tmp >> $(objpfx)crti.s-new
|
||||
cat $(objpfx)crtcommon.tmp >> $(objpfx)crtn.s-new
|
||||
rm -f $(objpfx)crtcommon.tmp
|
||||
mv -f $(objpfx)crti.s-new $(subst crtn,crti,$@)
|
||||
mv -f $(objpfx)crtn.s-new $(subst crti,crtn,$@)
|
||||
endef
|
||||
$(objpfx)initfini.s: initfini.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -g0 -S -fPIC -finhibit-size-directive \
|
||||
$(no-exceptions) $< -o $@
|
||||
|
||||
$(objpfx)crti.S: $(objpfx)initfini.s
|
||||
sed -n -e '1,/@HEADER_ENDS/p' \
|
||||
-e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
|
||||
-e '/@TRAILER_BEGINS/,$$p' $< > $@
|
||||
|
||||
$(objpfx)crtn.S: $(objpfx)initfini.s
|
||||
sed -n -e '1,/@HEADER_ENDS/p' \
|
||||
-e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
|
||||
-e '/@TRAILER_BEGINS/,$$p' $< > $@
|
||||
|
||||
$(objpfx)defs.h: $(objpfx)initfini.s
|
||||
sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
|
||||
awk -f defs.awk > $@
|
||||
|
||||
endif
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/.end/ { need_end = 1 }
|
||||
/.align/ { if($2 > max) max = $2; }
|
||||
|
||||
END {
|
||||
if(need_end)
|
||||
{
|
||||
print "#define END_INIT .end _init";
|
||||
print "#define END_FINI .end _fini";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "#define END_INIT";
|
||||
print "#define END_FINI";
|
||||
}
|
||||
if(max)
|
||||
print "#define ALIGN .align", max;
|
||||
else
|
||||
print "#define ALIGN";
|
||||
|
||||
print "#include <libc-symbols.h>";
|
||||
print "weak_extern (__gmon_start__)";
|
||||
}
|
||||
+47
-79
@@ -1,5 +1,5 @@
|
||||
/* Special .init and .fini section support.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it
|
||||
@@ -26,68 +26,40 @@
|
||||
write to the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file is compiled into assembly code which is then surrounded by the
|
||||
lines `cat > crtcommon.tmp <<\EOF_common' and `EOF_common' and thus
|
||||
becomes a shell script which creates three files of assembly code.
|
||||
/* This file is compiled into assembly code which is then munged by a sed
|
||||
script into two files: crti.s and crtn.s.
|
||||
|
||||
* The first file is crti.s-new; this puts a function prologue at the
|
||||
beginning of the .init and .fini sections and defines global symbols for
|
||||
* crti.s puts a function prologue at the beginning of the
|
||||
.init and .fini sections and defines global symbols for
|
||||
those addresses, so they can be called as functions.
|
||||
|
||||
* The second file is crtn.s-new; this puts the corresponding function
|
||||
epilogues in the .init and .fini sections.
|
||||
|
||||
* The third file is crtcommon.tmp, which is whatever miscellaneous cruft
|
||||
the compiler generated at the end; it should be appended to both crti.s-new
|
||||
and crtn.s-new. */
|
||||
* crtn.s puts the corresponding function epilogues
|
||||
in the .init and .fini sections. */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* We use embedded asm for .section unconditionally, as this makes it
|
||||
easier to insert the necessary directives into crtn.S. */
|
||||
#define SECTION(x) asm (".section \"" x "\"");
|
||||
|
||||
#ifdef HAVE_ELF
|
||||
/* These declarations make the functions go in the right sections when
|
||||
we define them below. GCC syntax does not allow the attribute
|
||||
specifications to be in the function definitions themselves. */
|
||||
void _init (void) __attribute__ ((section (".init")));
|
||||
void _fini (void) __attribute__ ((section (".fini")));
|
||||
/* Embed an #include to pull in the alignment and .end directives. */
|
||||
asm ("\n#include \"defs.h\"");
|
||||
|
||||
#define SECTION(x) /* Put nothing extra before the defn. */
|
||||
/* The initial common code ends here. */
|
||||
asm ("\n/*@HEADER_ENDS*/");
|
||||
|
||||
#else
|
||||
/* Some non-ELF systems support .init and .fini sections,
|
||||
but the __attribute__ syntax only works for ELF. */
|
||||
#define SECTION(x) asm (".section " x);
|
||||
#endif
|
||||
|
||||
/* End the here document containing the initial common code.
|
||||
Then move the output file crtcommon.tmp to crti.s-new and crtn.s-new. */
|
||||
asm ("\nEOF_common\n\
|
||||
rm -f crti.s-new crtn.s-new\n\
|
||||
mv crtcommon.tmp crti.s-new\n\
|
||||
cp crti.s-new crtn.s-new");
|
||||
|
||||
/* Extract a `.end' if one is produced by the compiler. */
|
||||
asm ("fgrep .end >/dev/null 2>&1 <<\\EOF.end && need_end=yes");
|
||||
/* To determine whether we need .end and .align: */
|
||||
asm ("\n/*@TESTS_BEGIN*/");
|
||||
void
|
||||
useless_function (void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
asm ("\nEOF.end\n");
|
||||
|
||||
/* Find out how much alignment is produced by the compiler. */
|
||||
asm ("align=`awk '$1==\".align\" { if ($2>max) max=$2; } END { print max; }' \
|
||||
<<\\EOF.align");
|
||||
void
|
||||
useless_function2 (void (*foo) (void))
|
||||
dummy (void (*foo) (void))
|
||||
{
|
||||
if (foo)
|
||||
(*foo) ();
|
||||
}
|
||||
asm ("\nEOF.align\n`\n");
|
||||
asm ("\n/*@TESTS_END*/");
|
||||
|
||||
/* Append the .init prologue to crti.s-new. */
|
||||
asm ("cat >> crti.s-new <<\\EOF.crti.init");
|
||||
/* The beginning of _init: */
|
||||
asm ("\n/*@_init_PROLOG_BEGINS*/");
|
||||
|
||||
SECTION (".init")
|
||||
void
|
||||
@@ -99,38 +71,33 @@ _init (void)
|
||||
gcrt1.o to reference a symbol which would be defined by some library
|
||||
module which has a constructor; but then user code's constructors
|
||||
would come first, and not be profiled. */
|
||||
extern void __gmon_start__ (void); weak_extern (__gmon_start__)
|
||||
extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
|
||||
|
||||
if (__gmon_start__)
|
||||
__gmon_start__ ();
|
||||
|
||||
/* End the here document containing the .init prologue code.
|
||||
Then fetch the .section directive just written and append that
|
||||
to crtn.s-new, followed by the function epilogue. */
|
||||
asm ("\n\
|
||||
EOF.crti.init\n\
|
||||
test -n \"$align\" && echo .align $align >> crti.s-new\n\
|
||||
test -n \"$need_end\" && echo .end _init >> crti.s-new\n\
|
||||
fgrep .init crti.s-new >>crtn.s-new\n\
|
||||
fgrep -v .end >> crtn.s-new <<\\EOF.crtn.init");
|
||||
asm ("ALIGN");
|
||||
asm("END_INIT");
|
||||
/* Now the epilog. */
|
||||
asm ("\n/*@_init_PROLOG_ENDS*/");
|
||||
asm ("\n/*@_init_EPILOG_BEGINS*/");
|
||||
SECTION(".init");
|
||||
}
|
||||
asm ("END_INIT");
|
||||
|
||||
/* End the here document containing the .init epilogue code.
|
||||
Then append the .fini prologue to crti.s-new. */
|
||||
asm ("\nEOF.crtn.init\
|
||||
\n\
|
||||
cat >> crti.s-new <<\\EOF.crti.fini");
|
||||
/* End of the _init epilog, beginning of the _fini prolog. */
|
||||
asm ("\n/*@_init_EPILOG_ENDS*/");
|
||||
asm ("\n/*@_fini_PROLOG_BEGINS*/");
|
||||
|
||||
SECTION (".fini")
|
||||
void
|
||||
_fini (void)
|
||||
{
|
||||
/* End the here document containing the .fini prologue code.
|
||||
Then fetch the .section directive just written and append that
|
||||
to crtn.s-new, followed by the function epilogue. */
|
||||
asm ("\nEOF.crti.fini\n\
|
||||
test -n \"$align\" && echo .align $align >> crti.s-new\n\
|
||||
test -n \"$need_end\" && echo .end _fini >> crti.s-new\n\
|
||||
cat > /dev/null <<\\EOF.fini.skip");
|
||||
|
||||
/* End of the _fini prolog. */
|
||||
asm ("ALIGN");
|
||||
asm ("END_FINI");
|
||||
asm ("\n/*@_fini_PROLOG_ENDS*/");
|
||||
|
||||
{
|
||||
/* Let GCC know that _fini is not a leaf function by having a dummy
|
||||
@@ -140,14 +107,15 @@ cat > /dev/null <<\\EOF.fini.skip");
|
||||
i_am_not_a_leaf ();
|
||||
}
|
||||
|
||||
asm ("\nEOF.fini.skip\
|
||||
\n\
|
||||
fgrep .fini crti.s-new >>crtn.s-new\n\
|
||||
fgrep -v .end >> crtn.s-new <<\\EOF.crtn.fini");
|
||||
/* Beginning of the _fini epilog. */
|
||||
asm ("\n/*@_fini_EPILOG_BEGINS*/");
|
||||
SECTION (".fini");
|
||||
}
|
||||
asm ("END_FINI");
|
||||
|
||||
/* End the here document containing the .fini epilogue code.
|
||||
Finally, put the remainder of the generated assembly into crtcommon.tmp. */
|
||||
asm ("\nEOF.crtn.fini\
|
||||
\n\
|
||||
cat > crtcommon.tmp <<\\EOF_common");
|
||||
/* End of the _fini epilog. Any further generated assembly (e.g. .ident)
|
||||
is shared between both crt files. */
|
||||
asm ("\n/*@_fini_EPILOG_ENDS*/");
|
||||
asm ("\n/*@TRAILER_BEGINS*/");
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -45,3 +45,8 @@ $(objpfx)makedb: $(objpfx)libdb.so$(libdb.so-version)
|
||||
else
|
||||
$(objpfx)makedb: $(objpfx)libdb.a
|
||||
endif
|
||||
|
||||
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
|
||||
# This ensures they will load libc.so for needed symbols if loaded by
|
||||
# a statically-linked program that hasn't already loaded it.
|
||||
$(objpfx)libdb.so: $(common-objpfx)libc.so
|
||||
|
||||
@@ -249,7 +249,7 @@ __big_delete(hashp, bufp)
|
||||
bufp->flags |= BUF_MOD;
|
||||
if (rbufp)
|
||||
__free_ovflpage(hashp, rbufp);
|
||||
if (last_bfp != rbufp)
|
||||
if (last_bfp && last_bfp != rbufp)
|
||||
__free_ovflpage(hashp, last_bfp);
|
||||
|
||||
hashp->NKEYS--;
|
||||
|
||||
+17
-19
@@ -1,29 +1,27 @@
|
||||
/* Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
DEFUN(alphasort, (a, b),
|
||||
CONST PTR a AND CONST PTR b)
|
||||
alphasort (const void *a, const void *b)
|
||||
{
|
||||
return strcmp (((struct dirent *) a)->d_name,
|
||||
((struct dirent *) b)->d_name);
|
||||
return strcmp ((*(const struct dirent **) a)->d_name,
|
||||
(*(const struct dirent **) b)->d_name);
|
||||
}
|
||||
|
||||
+14
-2
@@ -1,5 +1,5 @@
|
||||
/* Look up a symbol in the loaded objects.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -162,7 +162,7 @@ _dl_lookup_symbol (const char *undef_name, const ElfW(Sym) **ref,
|
||||
(*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK))
|
||||
{
|
||||
/* We could find no value for a strong reference. */
|
||||
const char msg[] = "undefined symbol: ";
|
||||
static const char msg[] = "undefined symbol: ";
|
||||
const size_t len = strlen (undef_name);
|
||||
char buf[sizeof msg + len];
|
||||
memcpy (buf, msg, sizeof msg - 1);
|
||||
@@ -206,6 +206,18 @@ _dl_lookup_symbol_skip (const char *undef_name, const ElfW(Sym) **ref,
|
||||
reference_name, skip_map, flags))
|
||||
break;
|
||||
|
||||
if (current_value.s == NULL &&
|
||||
(*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK))
|
||||
{
|
||||
/* We could find no value for a strong reference. */
|
||||
static const char msg[] = "undefined symbol: ";
|
||||
const size_t len = strlen (undef_name);
|
||||
char buf[sizeof msg + len];
|
||||
memcpy (buf, msg, sizeof msg - 1);
|
||||
memcpy (&buf[sizeof msg - 1], undef_name, len + 1);
|
||||
_dl_signal_error (0, reference_name, buf);
|
||||
}
|
||||
|
||||
*ref = current_value.s;
|
||||
return current_value.a;
|
||||
}
|
||||
|
||||
+6
-7
@@ -1,5 +1,5 @@
|
||||
/* Relocate a shared object and resolve its references to other loaded objects.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -58,17 +58,16 @@ _dl_relocate_object (struct link_map *l, struct link_map *scope[], int lazy)
|
||||
|
||||
/* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */
|
||||
#define RESOLVE(ref, flags) \
|
||||
(_dl_lookup_symbol (strtab + (*ref)->st_name, ref, scope, \
|
||||
l->l_name, flags))
|
||||
(((*ref)->st_shndx != SHN_UNDEF && \
|
||||
ELFW(ST_BIND) ((*ref)->st_info) == STB_LOCAL) \
|
||||
? l->l_addr \
|
||||
: _dl_lookup_symbol (strtab + (*ref)->st_name, ref, scope, \
|
||||
l->l_name, flags))
|
||||
|
||||
#include "dynamic-link.h"
|
||||
ELF_DYNAMIC_RELOCATE (l, lazy);
|
||||
}
|
||||
|
||||
/* Set up the PLT so its unrelocated entries will jump to
|
||||
_dl_runtime_resolve (dl-runtime.c), which will relocate them. */
|
||||
elf_machine_runtime_setup (l, lazy);
|
||||
|
||||
/* Mark the object so we know ths work has been done. */
|
||||
l->l_relocated = 1;
|
||||
|
||||
|
||||
+6
-3
@@ -97,8 +97,11 @@ elf_get_dynamic_info (ElfW(Dyn) *dyn,
|
||||
|
||||
/* This can't just be an inline function because GCC is too dumb
|
||||
to inline functions containing inlines themselves. */
|
||||
#define ELF_DYNAMIC_RELOCATE(map, lazy) \
|
||||
do { ELF_DYNAMIC_DO_REL ((map), (lazy)); \
|
||||
ELF_DYNAMIC_DO_RELA ((map), (lazy)); } while (0)
|
||||
#define ELF_DYNAMIC_RELOCATE(map, lazy) \
|
||||
do { \
|
||||
int edr_lazy = elf_machine_runtime_setup((map), (lazy)); \
|
||||
ELF_DYNAMIC_DO_REL ((map), edr_lazy); \
|
||||
ELF_DYNAMIC_DO_RELA ((map), edr_lazy); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,13 +18,17 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _LINK_H
|
||||
|
||||
#define _LINK_H 1
|
||||
#include <features.h>
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
#include <elf.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* We use this macro to refer to ELF types independent of the native wordsize.
|
||||
`ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */
|
||||
#define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type)
|
||||
@@ -340,5 +344,6 @@ extern void _dl_debug_state (void);
|
||||
in the `r_ldbase' member. Returns the address of the structure. */
|
||||
extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* link.h */
|
||||
|
||||
+1
-1
@@ -232,7 +232,7 @@ sed -e "
|
||||
/^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
|
||||
" $TEMP > $TEMP.x
|
||||
|
||||
if $MAIL_AGENT $BUGGLIBC < $TEMP.x; then
|
||||
if $MAIL_AGENT < $TEMP.x; then
|
||||
echo "$COMMAND: problem report sent"
|
||||
xs=0; exit
|
||||
else
|
||||
|
||||
+86
-37
@@ -34,6 +34,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/gmon.h>
|
||||
#include <sys/gmon_out.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
@@ -165,21 +166,26 @@ static void
|
||||
write_hist (fd)
|
||||
int fd;
|
||||
{
|
||||
const u_char tag = GMON_TAG_TIME_HIST;
|
||||
struct gmon_hist_hdr thdr;
|
||||
u_char tag = GMON_TAG_TIME_HIST;
|
||||
struct gmon_hist_hdr thdr __attribute__ ((aligned (__alignof__ (char *))));
|
||||
|
||||
if (_gmonparam.kcountsize > 0)
|
||||
{
|
||||
thdr.low_pc = _gmonparam.lowpc;
|
||||
thdr.high_pc = _gmonparam.highpc;
|
||||
thdr.hist_size = _gmonparam.kcountsize / sizeof(HISTCOUNTER);
|
||||
thdr.prof_rate = __profile_frequency();
|
||||
strncpy(thdr.dimen, "seconds", sizeof(thdr.dimen));
|
||||
struct iovec iov[3] =
|
||||
{
|
||||
{ &tag, sizeof (tag) },
|
||||
{ &thdr, sizeof (struct gmon_hist_hdr) },
|
||||
{ _gmonparam.kcount, _gmonparam.kcountsize }
|
||||
};
|
||||
|
||||
*(char **) thdr.low_pc = (char *) _gmonparam.lowpc;
|
||||
*(char **) thdr.high_pc = (char *) _gmonparam.highpc;
|
||||
*(int *) thdr.hist_size = _gmonparam.kcountsize / sizeof (HISTCOUNTER);
|
||||
*(int *) thdr.prof_rate = __profile_frequency ();
|
||||
strncpy (thdr.dimen, "seconds", sizeof (thdr.dimen));
|
||||
thdr.dimen_abbrev = 's';
|
||||
|
||||
write(fd, &tag, sizeof(tag));
|
||||
write(fd, &thdr, sizeof(thdr));
|
||||
write(fd, _gmonparam.kcount, _gmonparam.kcountsize);
|
||||
__writev (fd, iov, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,12 +194,26 @@ static void
|
||||
write_call_graph (fd)
|
||||
int fd;
|
||||
{
|
||||
const u_char tag = GMON_TAG_CG_ARC;
|
||||
struct gmon_cg_arc_record raw_arc;
|
||||
u_char tag = GMON_TAG_CG_ARC;
|
||||
struct gmon_cg_arc_record raw_arc[4]
|
||||
__attribute__ ((aligned (__alignof__ (char*))));
|
||||
int from_index, to_index, from_len;
|
||||
u_long frompc;
|
||||
|
||||
from_len = _gmonparam.fromssize / sizeof(*_gmonparam.froms);
|
||||
struct iovec iov[8] =
|
||||
{
|
||||
{ &tag, sizeof (tag) },
|
||||
{ &raw_arc[0], sizeof (struct gmon_cg_arc_record) },
|
||||
{ &tag, sizeof (tag) },
|
||||
{ &raw_arc[1], sizeof (struct gmon_cg_arc_record) },
|
||||
{ &tag, sizeof (tag) },
|
||||
{ &raw_arc[2], sizeof (struct gmon_cg_arc_record) },
|
||||
{ &tag, sizeof (tag) },
|
||||
{ &raw_arc[3], sizeof (struct gmon_cg_arc_record) },
|
||||
};
|
||||
int nfilled = 0;
|
||||
|
||||
from_len = _gmonparam.fromssize / sizeof (*_gmonparam.froms);
|
||||
for (from_index = 0; from_index < from_len; ++from_index)
|
||||
{
|
||||
if (_gmonparam.froms[from_index] == 0)
|
||||
@@ -201,19 +221,24 @@ write_call_graph (fd)
|
||||
|
||||
frompc = _gmonparam.lowpc;
|
||||
frompc += (from_index * _gmonparam.hashfraction
|
||||
* sizeof(*_gmonparam.froms));
|
||||
* sizeof (*_gmonparam.froms));
|
||||
for (to_index = _gmonparam.froms[from_index];
|
||||
to_index != 0;
|
||||
to_index = _gmonparam.tos[to_index].link)
|
||||
{
|
||||
raw_arc.from_pc = frompc;
|
||||
raw_arc.self_pc = _gmonparam.tos[to_index].selfpc;
|
||||
raw_arc.count = _gmonparam.tos[to_index].count;
|
||||
|
||||
write(fd, &tag, sizeof(tag));
|
||||
write(fd, &raw_arc, sizeof(raw_arc));
|
||||
if (nfilled > 3)
|
||||
{
|
||||
__writev (fd, iov, 2 * nfilled);
|
||||
nfilled = 0;
|
||||
}
|
||||
*(char **) raw_arc[nfilled].from_pc = (char *)frompc;
|
||||
*(char **) raw_arc[nfilled].self_pc =
|
||||
(char *)_gmonparam.tos[to_index].selfpc;
|
||||
*(int *) raw_arc[nfilled].count = _gmonparam.tos[to_index].count;
|
||||
++nfilled;
|
||||
}
|
||||
}
|
||||
__writev (fd, iov, 2 * nfilled);
|
||||
}
|
||||
|
||||
|
||||
@@ -222,55 +247,79 @@ write_bb_counts (fd)
|
||||
int fd;
|
||||
{
|
||||
struct __bb *grp;
|
||||
const u_char tag = GMON_TAG_BB_COUNT;
|
||||
u_char tag = GMON_TAG_BB_COUNT;
|
||||
int ncounts;
|
||||
int i;
|
||||
|
||||
struct iovec bbhead[2] =
|
||||
{
|
||||
{ &tag, sizeof (tag) },
|
||||
{ &ncounts, sizeof (ncounts) }
|
||||
};
|
||||
struct iovec bbbody[8];
|
||||
int nfilled;
|
||||
|
||||
for (i = 0; i < (sizeof (bbbody) / sizeof (bbbody[0])); i += 2)
|
||||
{
|
||||
bbbody[i].iov_len = sizeof (grp->addresses[0]);
|
||||
bbbody[i + 1].iov_len = sizeof (grp->counts[0]);
|
||||
}
|
||||
|
||||
/* Write each group of basic-block info (all basic-blocks in a
|
||||
compilation unit form a single group). */
|
||||
|
||||
nfilled = 0;
|
||||
for (grp = __bb_head; grp; grp = grp->next)
|
||||
{
|
||||
ncounts = grp->ncounts;
|
||||
write(fd, &tag, sizeof(tag));
|
||||
write(fd, &ncounts, sizeof(ncounts));
|
||||
__writev (fd, bbhead, 2);
|
||||
for (i = 0; i < ncounts; ++i)
|
||||
{
|
||||
write(fd, &grp->addresses[i], sizeof(grp->addresses[0]));
|
||||
write(fd, &grp->counts[i], sizeof(grp->counts[0]));
|
||||
if (nfilled > (sizeof (bbbody) / sizeof (bbbody[0])) - 2)
|
||||
{
|
||||
__writev (fd, bbbody, nfilled);
|
||||
nfilled = 0;
|
||||
}
|
||||
|
||||
bbbody[nfilled++].iov_base = (char *) &grp->addresses[i];
|
||||
bbbody[nfilled++].iov_base = &grp->counts[i];
|
||||
}
|
||||
}
|
||||
__writev (fd, bbbody, nfilled);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mcleanup ()
|
||||
{
|
||||
struct gmon_hdr ghdr;
|
||||
struct gmon_hdr ghdr __attribute__ ((aligned (__alignof__ (int))));
|
||||
int fd;
|
||||
|
||||
moncontrol(0);
|
||||
fd = open("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666);
|
||||
moncontrol (0);
|
||||
fd = __open ("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666);
|
||||
if (fd < 0)
|
||||
{
|
||||
perror("_mcleanup: gmon.out");
|
||||
perror ("_mcleanup: gmon.out");
|
||||
return;
|
||||
}
|
||||
|
||||
/* write gmon.out header: */
|
||||
memset(&ghdr, 0, sizeof(ghdr));
|
||||
memcpy(&ghdr.cookie[0], GMON_MAGIC, sizeof(ghdr.cookie));
|
||||
ghdr.version = GMON_VERSION;
|
||||
write(fd, &ghdr, sizeof(ghdr));
|
||||
memset (&ghdr, 0, sizeof (struct gmon_hdr));
|
||||
memcpy (&ghdr.cookie[0], GMON_MAGIC, sizeof (ghdr.cookie));
|
||||
*(int *) ghdr.version = GMON_VERSION;
|
||||
__write (fd, &ghdr, sizeof (struct gmon_hdr));
|
||||
|
||||
/* write PC histogram: */
|
||||
write_hist(fd);
|
||||
write_hist (fd);
|
||||
|
||||
/* write call-graph: */
|
||||
write_call_graph(fd);
|
||||
write_call_graph (fd);
|
||||
|
||||
/* write basic-block execution counts: */
|
||||
write_bb_counts(fd);
|
||||
write_bb_counts (fd);
|
||||
|
||||
close(fd);
|
||||
__close (fd);
|
||||
|
||||
/* free the memory. */
|
||||
free (_gmonparam.tos);
|
||||
}
|
||||
|
||||
+27
-21
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by David Mosberger <davidm@cs.arizona.edu>.
|
||||
|
||||
@@ -40,30 +40,36 @@ __BEGIN_DECLS
|
||||
* always comes first in gmon.out and is then followed by a series
|
||||
* records defined below.
|
||||
*/
|
||||
struct gmon_hdr {
|
||||
char cookie[4];
|
||||
int version;
|
||||
int spare[3];
|
||||
};
|
||||
struct gmon_hdr
|
||||
{
|
||||
char cookie[4];
|
||||
char version[4];
|
||||
char spare[3 * 4];
|
||||
};
|
||||
|
||||
/* types of records in this file: */
|
||||
typedef enum {
|
||||
GMON_TAG_TIME_HIST = 0, GMON_TAG_CG_ARC = 1, GMON_TAG_BB_COUNT = 2
|
||||
} GMON_Record_Tag;
|
||||
typedef enum
|
||||
{
|
||||
GMON_TAG_TIME_HIST = 0,
|
||||
GMON_TAG_CG_ARC = 1,
|
||||
GMON_TAG_BB_COUNT = 2
|
||||
} GMON_Record_Tag;
|
||||
|
||||
struct gmon_hist_hdr {
|
||||
unsigned long low_pc; /* base pc address of sample buffer */
|
||||
unsigned long high_pc; /* max pc address of sampled buffer */
|
||||
int hist_size; /* size of sample buffer */
|
||||
int prof_rate; /* profiling clock rate */
|
||||
char dimen[15]; /* phys. dim., usually "seconds" */
|
||||
char dimen_abbrev; /* usually 's' for "seconds" */
|
||||
};
|
||||
struct gmon_hist_hdr
|
||||
{
|
||||
char low_pc[sizeof (char *)]; /* base pc address of sample buffer */
|
||||
char high_pc[sizeof (char *)]; /* max pc address of sampled buffer */
|
||||
char hist_size[4]; /* size of sample buffer */
|
||||
char prof_rate[4]; /* profiling clock rate */
|
||||
char dimen[15]; /* phys. dim., usually "seconds" */
|
||||
char dimen_abbrev; /* usually 's' for "seconds" */
|
||||
};
|
||||
|
||||
struct gmon_cg_arc_record {
|
||||
unsigned long from_pc; /* address within caller's body */
|
||||
unsigned long self_pc; /* address within callee's body */
|
||||
int count; /* number of arc traversals */
|
||||
struct gmon_cg_arc_record
|
||||
{
|
||||
char from_pc[sizeof (char *)]; /* address within caller's body */
|
||||
char self_pc[sizeof (char *)]; /* address within callee's body */
|
||||
char count[4]; /* number of arc traversals */
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
+58
-18
@@ -1,35 +1,75 @@
|
||||
/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <grp.h>
|
||||
#include <stdio.h>
|
||||
#include <libc-lock.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/* We need to protect the dynamic buffer handling. */
|
||||
__libc_lock_define_initialized (static, lock);
|
||||
|
||||
/* Read one entry from the given stream. */
|
||||
struct group *
|
||||
fgetgrent (FILE *stream)
|
||||
{
|
||||
static char buffer[BUFSIZ];
|
||||
static char *buffer;
|
||||
static size_t buffer_size;
|
||||
static struct group resbuf;
|
||||
struct group *result;
|
||||
int save;
|
||||
|
||||
if (__fgetgrent_r (stream, &resbuf, buffer, sizeof buffer, &result) != 0)
|
||||
return NULL;
|
||||
/* Get lock. */
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
/* Allocate buffer if not yet available. */
|
||||
if (buffer == NULL)
|
||||
{
|
||||
buffer_size = NSS_BUFLEN_GROUP;
|
||||
buffer = malloc (buffer_size);
|
||||
}
|
||||
|
||||
while (buffer != NULL
|
||||
&& __fgetgrent_r (stream, &resbuf, buffer, buffer_size, &result) != 0
|
||||
&& errno == ERANGE)
|
||||
{
|
||||
char *new_buf;
|
||||
buffer_size += NSS_BUFLEN_GROUP;
|
||||
new_buf = realloc (buffer, buffer_size);
|
||||
if (new_buf == NULL)
|
||||
{
|
||||
/* We are out of memory. Free the current buffer so that the
|
||||
process gets a chance for a normal termination. */
|
||||
save = errno;
|
||||
free (buffer);
|
||||
__set_errno (save);
|
||||
}
|
||||
buffer = new_buf;
|
||||
}
|
||||
|
||||
if (buffer == NULL)
|
||||
result = NULL;
|
||||
|
||||
/* Release lock. Preserve error value. */
|
||||
save = errno;
|
||||
__libc_lock_unlock (lock);
|
||||
__set_errno (save);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+12
-3
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -56,6 +56,7 @@ __fgetgrent_r (FILE *stream, struct group *resbuf, char *buffer, size_t buflen,
|
||||
struct group **result)
|
||||
{
|
||||
char *p;
|
||||
int parse_result;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -69,10 +70,18 @@ __fgetgrent_r (FILE *stream, struct group *resbuf, char *buffer, size_t buflen,
|
||||
/* Skip leading blanks. */
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
} while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
|
||||
} while (*p == '\0' || *p == '#' /* Ignore empty and comment lines. */
|
||||
/* Parse the line. If it is invalid, loop to
|
||||
get the next line of the file to parse. */
|
||||
! parse_line (p, resbuf, (void *) buffer, buflen));
|
||||
|| ! (parse_result = parse_line (p, resbuf,
|
||||
(void *) buffer, buflen)));
|
||||
|
||||
if (parse_result == -1)
|
||||
{
|
||||
/* The parser ran out of space. */
|
||||
*result = NULL;
|
||||
return errno;
|
||||
}
|
||||
|
||||
*result = resbuf;
|
||||
return 0;
|
||||
|
||||
@@ -32,9 +32,6 @@ __BEGIN_DECLS
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
/* The group structure. */
|
||||
struct group
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ include ../Rules
|
||||
# from $(subdirs), and this rule arranges for the headers in question
|
||||
# to get installed.
|
||||
sunrpc-headers = netdb.h pmap_prot.h xdr.h types.h auth.h \
|
||||
rpc_msg.h auth_unix.h
|
||||
rpc_msg.h auth_unix.h clnt.h
|
||||
installed-sunrpc-headers = $(addprefix $(inst_includedir)/rpc/, \
|
||||
$(sunrpc-headers))
|
||||
install-headers-nosubdir: $(installed-sunrpc-headers)
|
||||
|
||||
+22
-17
@@ -1,22 +1,21 @@
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <unistd.h>
|
||||
#include <hurd.h>
|
||||
#include <hurd/fd.h>
|
||||
@@ -24,7 +23,7 @@ Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Change the current root directory to FD. */
|
||||
int
|
||||
DEFUN(fchroot, (fd), int fd)
|
||||
fchroot (int fd)
|
||||
{
|
||||
error_t err;
|
||||
file_t dir;
|
||||
@@ -36,7 +35,13 @@ DEFUN(fchroot, (fd), int fd)
|
||||
}));
|
||||
|
||||
if (! err)
|
||||
_hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], dir);
|
||||
{
|
||||
file_t root;
|
||||
err = __file_reparent (dir, MACH_PORT_NULL, &root);
|
||||
__mach_port_deallocate (__mach_task_self (), dir);
|
||||
if (! err)
|
||||
_hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], root);
|
||||
}
|
||||
|
||||
return err ? __hurd_fail (err) : 0;
|
||||
}
|
||||
|
||||
+17
-16
@@ -1,26 +1,27 @@
|
||||
/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1991, 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <hurd.h>
|
||||
|
||||
/* This is initialized in dtable.c when that gets linked in.
|
||||
If dtable.c is not linked in, it will be zero. */
|
||||
file_t (*_hurd_getdport_fn) (int fd);
|
||||
static file_t (*_default_hurd_getdport_fn) (int fd) = 0;
|
||||
weak_alias (_default_hurd_getdport_fn, _hurd_getdport_fn)
|
||||
|
||||
file_t
|
||||
__getdport (int fd)
|
||||
@@ -43,7 +44,7 @@ __getdport (int fd)
|
||||
errno = EBADF;
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
__mach_port_mod_refs (__mach_task_self (), _hurd_init_dtable[fd],
|
||||
MACH_PORT_RIGHT_SEND, 1);
|
||||
|
||||
+23
-17
@@ -1,20 +1,20 @@
|
||||
/* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _HURD_H
|
||||
|
||||
@@ -109,11 +109,10 @@ extern pid_t _hurd_pid, _hurd_ppid, _hurd_pgrp;
|
||||
extern int _hurd_orphaned;
|
||||
|
||||
/* This variable is incremented every time the process IDs change. */
|
||||
|
||||
unsigned int _hurd_pids_changed_stamp;
|
||||
extern unsigned int _hurd_pids_changed_stamp;
|
||||
|
||||
/* This condition is broadcast every time the process IDs change. */
|
||||
struct condition _hurd_pids_changed_sync;
|
||||
extern struct condition _hurd_pids_changed_sync;
|
||||
|
||||
/* Unix `data break', for brk and sbrk.
|
||||
If brk and sbrk are not used, this info will not be initialized or used. */
|
||||
@@ -304,4 +303,11 @@ extern int hurd_check_cancel (void);
|
||||
extern io_t __getdport (int fd), getdport (int fd);
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Write formatted output to PORT, a Mach port supporting the i/o protocol,
|
||||
according to the format string FORMAT, using the argument list in ARG. */
|
||||
int vpprintf (io_t port, const char *format, va_list arg);
|
||||
|
||||
|
||||
#endif /* hurd.h */
|
||||
|
||||
+16
-15
@@ -1,21 +1,21 @@
|
||||
/* Internal per-thread variables for the Hurd.
|
||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _HURD_THREADVAR_H
|
||||
#define _HURD_THREADVAR_H
|
||||
@@ -33,7 +33,7 @@ Cambridge, MA 02139, USA. */
|
||||
stack pointer is ignored; and __hurd_threadvar_stack_offset gives the
|
||||
address of a small allocated region which contains the variables for the
|
||||
single thread. */
|
||||
|
||||
|
||||
extern unsigned long int __hurd_threadvar_stack_mask;
|
||||
extern unsigned long int __hurd_threadvar_stack_offset;
|
||||
|
||||
@@ -60,6 +60,7 @@ enum __hurd_threadvar_index
|
||||
_HURD_THREADVAR_ERRNO, /* `errno' value for this thread. */
|
||||
_HURD_THREADVAR_SIGSTATE, /* This thread's `struct hurd_sigstate'. */
|
||||
_HURD_THREADVAR_DYNAMIC_USER, /* Dynamically-assigned user variables. */
|
||||
_HURD_THREADVAR_MALLOC, /* For use of malloc. */
|
||||
_HURD_THREADVAR_MAX /* Default value for __hurd_threadvar_max. */
|
||||
};
|
||||
|
||||
|
||||
+130
-23
@@ -1,20 +1,20 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <hurd.h>
|
||||
#include <hurd/msg_server.h>
|
||||
@@ -37,17 +37,124 @@ _S_msg_add_auth (mach_port_t me,
|
||||
{
|
||||
error_t err;
|
||||
auth_t newauth;
|
||||
uid_t *genuids, *gengids, *auxuids, *auxgids;
|
||||
mach_msg_type_number_t ngenuids, ngengids, nauxuids, nauxgids;
|
||||
uid_t *newgenuids, *newgengids, *newauxuids, *newauxgids;
|
||||
mach_msg_type_number_t nnewgenuids, nnewgengids, nnewauxuids, nnewauxgids;
|
||||
|
||||
if (err = __USEPORT (AUTH,
|
||||
__auth_makeauth (port,
|
||||
&addauth, 1, MACH_MSG_TYPE_MOVE_SEND,
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
&newauth)))
|
||||
/* Create a list of ids and store it in NEWLISTP, length NEWLISTLEN.
|
||||
Keep all the ids in EXIST (len NEXIST), adding in those from NEW
|
||||
(len NNEW) which are not already there. */
|
||||
error_t make_list (uid_t **newlistp, mach_msg_type_number_t *newlistlen,
|
||||
uid_t *exist, mach_msg_type_number_t nexist,
|
||||
uid_t *new, mach_msg_type_number_t nnew)
|
||||
{
|
||||
error_t urp;
|
||||
int i, j, k;
|
||||
vm_size_t offset;
|
||||
|
||||
urp = vm_allocate (mach_task_self (), (vm_address_t *) newlistp,
|
||||
nexist + nnew * sizeof (uid_t), 1);
|
||||
if (urp)
|
||||
return urp;
|
||||
|
||||
j = 0;
|
||||
for (i = 0; i < nexist; i++)
|
||||
(*newlistp)[j++] = exist[i];
|
||||
|
||||
for (i = 0; i < nnew; i++)
|
||||
{
|
||||
for (k = 0; k < nexist; k++)
|
||||
if (exist[k] == new[i])
|
||||
break;
|
||||
if (k < nexist)
|
||||
continue;
|
||||
|
||||
(*newlistp)[j++] = new[i];
|
||||
}
|
||||
|
||||
offset = (round_page (nexist + nnew * sizeof (uid_t))
|
||||
- round_page (j * sizeof (uid_t)));
|
||||
if (offset)
|
||||
vm_deallocate (mach_task_self (),
|
||||
(vm_address_t) (*newlistp
|
||||
+ (nexist + nnew * sizeof (uid_t))),
|
||||
offset);
|
||||
*newlistlen = j;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find out what ids ADDAUTH refers to */
|
||||
|
||||
genuids = gengids = auxuids = auxgids = 0;
|
||||
ngenuids = ngengids = nauxuids = nauxgids = 0;
|
||||
err = __auth_getids (addauth,
|
||||
&genuids, &ngenuids,
|
||||
&auxuids, &nauxuids,
|
||||
&gengids, &ngengids,
|
||||
&auxgids, &nauxgids);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* OR in these ids to what we already have, creating a new list. */
|
||||
|
||||
HURD_CRITICAL_BEGIN;
|
||||
__mutex_lock (&_hurd_id.lock);
|
||||
_hurd_check_ids ();
|
||||
|
||||
#define MAKE(genaux,uidgid) \
|
||||
make_list (&new ## genaux ## uidgid ## s, \
|
||||
&nnew ## genaux ## uidgid ## s, \
|
||||
_hurd_id.genaux.uidgid ## s, \
|
||||
_hurd_id.genaux.n ## uidgid ## s, \
|
||||
genaux ## uidgid ## s, \
|
||||
n ## genaux ## uidgid ## s)
|
||||
|
||||
err = MAKE (gen, uid);
|
||||
if (!err)
|
||||
MAKE (aux, uid);
|
||||
if (!err)
|
||||
MAKE (gen, gid);
|
||||
if (!err)
|
||||
MAKE (aux, gid);
|
||||
#undef MAKE
|
||||
|
||||
__mutex_unlock (&_hurd_id.lock);
|
||||
HURD_CRITICAL_END;
|
||||
|
||||
|
||||
/* Create the new auth port */
|
||||
|
||||
if (!err)
|
||||
err = __USEPORT (AUTH,
|
||||
__auth_makeauth (port,
|
||||
&addauth, MACH_MSG_TYPE_MOVE_SEND, 1,
|
||||
newgenuids, nnewgenuids,
|
||||
newauxuids, nnewauxuids,
|
||||
newgengids, nnewgengids,
|
||||
newauxgids, nnewauxgids,
|
||||
&newauth));
|
||||
|
||||
#define freeup(array, len) \
|
||||
if (array) \
|
||||
vm_deallocate (mach_task_self (), (vm_address_t) array, \
|
||||
len * sizeof (uid_t));
|
||||
|
||||
freeup (genuids, ngenuids);
|
||||
freeup (auxuids, nauxuids);
|
||||
freeup (gengids, ngengids);
|
||||
freeup (auxgids, nauxgids);
|
||||
freeup (newgenuids, nnewgenuids);
|
||||
freeup (newauxuids, nnewauxuids);
|
||||
freeup (newgengids, nnewgengids);
|
||||
freeup (newauxgids, nnewauxgids);
|
||||
#undef freeup
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* And install it. */
|
||||
|
||||
err = __setauth (newauth);
|
||||
__mach_port_deallocate (__mach_task_self (), newauth);
|
||||
if (err)
|
||||
@@ -108,7 +215,7 @@ _S_msg_del_auth (mach_port_t me,
|
||||
|
||||
err = __USEPORT (AUTH, __auth_makeauth
|
||||
(port,
|
||||
NULL, 0, MACH_MSG_TYPE_COPY_SEND,
|
||||
NULL, MACH_MSG_TYPE_COPY_SEND, 0,
|
||||
newu, nu,
|
||||
_hurd_id.aux.uids, _hurd_id.aux.nuids,
|
||||
newg, ng,
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/* Handle faults in the signal thread.
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -29,7 +29,10 @@
|
||||
#include <assert.h>
|
||||
|
||||
jmp_buf _hurdsig_fault_env;
|
||||
struct hurd_signal_preemptor _hurdsig_fault_preemptor;
|
||||
struct hurd_signal_preemptor _hurdsig_fault_preemptor = {0};
|
||||
|
||||
/* XXX temporary to deal with spelling fix */
|
||||
weak_alias (_hurdsig_fault_preemptor, _hurdsig_fault_preempter)
|
||||
|
||||
static mach_port_t forward_sigexc;
|
||||
|
||||
|
||||
+16
-14
@@ -1,20 +1,20 @@
|
||||
/* Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
@@ -31,7 +31,9 @@ struct hurd_port *_hurd_ports;
|
||||
unsigned int _hurd_nports;
|
||||
mode_t _hurd_umask;
|
||||
sigset_t _hurdsig_traced;
|
||||
|
||||
char **__libc_argv;
|
||||
int __libc_argc;
|
||||
|
||||
|
||||
error_t
|
||||
|
||||
+11
-3
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -39,6 +39,11 @@ thread_t _hurd_msgport_thread;
|
||||
/* Thread which receives task-global signals. */
|
||||
thread_t _hurd_sigthread;
|
||||
|
||||
/* These are set up by _hurdsig_init. */
|
||||
unsigned long int __hurd_sigthread_stack_base;
|
||||
unsigned long int __hurd_sigthread_stack_end;
|
||||
unsigned long int *__hurd_sigthread_variables;
|
||||
|
||||
/* Linked-list of per-thread signal state. */
|
||||
struct hurd_sigstate *_hurd_sigstates;
|
||||
|
||||
@@ -421,9 +426,12 @@ abort_all_rpcs (int signo, struct machine_thread_all_state *state, int live)
|
||||
}
|
||||
}
|
||||
|
||||
struct hurd_signal_preemptor *_hurdsig_preemptors;
|
||||
struct hurd_signal_preemptor *_hurdsig_preemptors = 0;
|
||||
sigset_t _hurdsig_preempted_set;
|
||||
|
||||
/* XXX temporary to deal with spelling fix */
|
||||
weak_alias (_hurdsig_preemptors, _hurdsig_preempters)
|
||||
|
||||
/* Mask of stop signals. */
|
||||
#define STOPSIGS (sigmask (SIGTTIN) | sigmask (SIGTTOU) | \
|
||||
sigmask (SIGSTOP) | sigmask (SIGTSTP))
|
||||
@@ -1186,7 +1194,7 @@ _hurdsig_init (void)
|
||||
err = __thread_create (__mach_task_self (), &_hurd_msgport_thread);
|
||||
assert_perror (err);
|
||||
|
||||
stacksize = __vm_page_size * 4; /* Small stack for signal thread. */
|
||||
stacksize = __vm_page_size * 8; /* Small stack for signal thread. */
|
||||
err = __mach_setup_thread (__mach_task_self (), _hurd_msgport_thread,
|
||||
_hurd_msgport_receive,
|
||||
(vm_address_t *) &__hurd_sigthread_stack_base,
|
||||
|
||||
+14
-23
@@ -1,21 +1,21 @@
|
||||
/* Initial program startup for running under the GNU Hurd.
|
||||
Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
@@ -35,15 +35,6 @@ Cambridge, MA 02139, USA. */
|
||||
mach_port_t *_hurd_init_dtable;
|
||||
mach_msg_type_number_t _hurd_init_dtablesize;
|
||||
|
||||
unsigned int __hurd_threadvar_max;
|
||||
unsigned long int __hurd_threadvar_stack_mask;
|
||||
unsigned long int __hurd_threadvar_stack_offset;
|
||||
|
||||
/* These are set up by _hurdsig_init. */
|
||||
unsigned long int __hurd_sigthread_stack_base;
|
||||
unsigned long int __hurd_sigthread_stack_end;
|
||||
unsigned long int *__hurd_sigthread_variables;
|
||||
|
||||
extern void __mach_init (void);
|
||||
|
||||
/* Entry point. This is the first thing in the text segment.
|
||||
|
||||
+24
-17
@@ -1,21 +1,21 @@
|
||||
/* Report on what a thread in our task is waiting for.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <hurd.h>
|
||||
#include <hurd/signal.h>
|
||||
@@ -93,8 +93,15 @@ describe_port (string_t description, mach_port_t port)
|
||||
}
|
||||
|
||||
|
||||
/* Common defn so we don't link in the itimer code unnecessarily. */
|
||||
thread_t _hurd_itimer_thread; /* XXX */
|
||||
/* We want _HURD_ITIMER_THREAD, but don't want to link in the itimer code
|
||||
unnecessarily. */
|
||||
#if 0 /* libc.so.0.0 needs this defined, so make it a weak alias for now. */
|
||||
extern thread_t _hurd_itimer_thread; /* XXX */
|
||||
weak_extern (_hurd_itimer_thread)
|
||||
#else
|
||||
static thread_t default_hurd_itimer_thread;
|
||||
weak_alias (default_hurd_itimer_thread, _hurd_itimer_thread)
|
||||
#endif
|
||||
|
||||
kern_return_t
|
||||
_S_msg_report_wait (mach_port_t msgport, thread_t thread,
|
||||
@@ -105,7 +112,7 @@ _S_msg_report_wait (mach_port_t msgport, thread_t thread,
|
||||
if (thread == _hurd_msgport_thread)
|
||||
/* Cute. */
|
||||
strcpy (description, "msgport");
|
||||
else if (thread == _hurd_itimer_thread)
|
||||
else if (&_hurd_msgport_thread && thread == _hurd_itimer_thread)
|
||||
strcpy (description, "itimer");
|
||||
else
|
||||
{
|
||||
|
||||
+15
-15
@@ -1,21 +1,21 @@
|
||||
/* Set a host configuration item kept as the whole contents of a file.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <hurd.h>
|
||||
@@ -28,7 +28,7 @@ _hurd_set_host_config (const char *item, const char *value, size_t valuelen)
|
||||
mach_msg_type_number_t nwrote;
|
||||
file_t new, dir;
|
||||
|
||||
dir = __file_name_split (item, &item);
|
||||
dir = __file_name_split (item, (char **)&item);
|
||||
if (dir == MACH_PORT_NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
+23
-22
@@ -1,30 +1,30 @@
|
||||
/* Copyright (C) 1991, 1994 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <hurd.h>
|
||||
|
||||
static ssize_t
|
||||
DEFUN(pwrite, (cookie, buf, n),
|
||||
PTR cookie AND CONST char *buf AND size_t n)
|
||||
pwrite (void *cookie,
|
||||
const char *buf,
|
||||
size_t n)
|
||||
{
|
||||
error_t error = __io_write ((io_t) cookie, buf, n, -1,
|
||||
(mach_msg_type_number_t *) &n);
|
||||
@@ -37,24 +37,25 @@ DEFUN(pwrite, (cookie, buf, n),
|
||||
/* Write formatted output to PORT, a Mach port supporting the i/o protocol,
|
||||
according to the format string FORMAT, using the argument list in ARG. */
|
||||
int
|
||||
DEFUN(vpprintf, (port, format, arg),
|
||||
io_t port AND CONST char *format AND va_list arg)
|
||||
vpprintf (io_t port,
|
||||
const char *format,
|
||||
va_list arg)
|
||||
{
|
||||
int done;
|
||||
FILE f;
|
||||
|
||||
/* Create an unbuffered stream talking to PORT on the stack. */
|
||||
memset((PTR) &f, 0, sizeof(f));
|
||||
memset ((void *) &f, 0, sizeof (f));
|
||||
f.__magic = _IOMAGIC;
|
||||
f.__mode.__write = 1;
|
||||
f.__cookie = (PTR) port;
|
||||
f.__cookie = (void *) port;
|
||||
f.__room_funcs = __default_room_functions;
|
||||
f.__io_funcs.__write = pwrite;
|
||||
f.__seen = 1;
|
||||
f.__userbuf = 1;
|
||||
|
||||
/* vfprintf will use a buffer on the stack for the life of the call. */
|
||||
done = vfprintf(&f, format, arg);
|
||||
done = vfprintf (&f, format, arg);
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
+86
-53
@@ -1,62 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)inet.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
/* Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
#ifndef _INET_H_
|
||||
#define _INET_H_
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
/* External definitions for functions in inet(3) */
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _ARPA_INET_H
|
||||
|
||||
#define _ARPA_INET_H 1
|
||||
#include <features.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h> /* To define `struct in_addr'. */
|
||||
|
||||
__BEGIN_DECLS
|
||||
u_long inet_addr __P((const char *));
|
||||
int inet_aton __P((const char *, struct in_addr *));
|
||||
u_int32_t inet_lnaof __P((struct in_addr));
|
||||
struct in_addr inet_makeaddr __P((u_int32_t , u_int32_t));
|
||||
char * inet_neta __P((u_long, char *, size_t));
|
||||
u_int32_t inet_netof __P((struct in_addr));
|
||||
u_int32_t inet_network __P((const char *));
|
||||
char *inet_net_ntop __P((int, const void *, int, char *, size_t));
|
||||
int inet_net_pton __P((int, const char *, void *, size_t));
|
||||
char *inet_ntoa __P((struct in_addr));
|
||||
int inet_pton __P((int, const char *, void *));
|
||||
const char *inet_ntop __P((int, const void *, char *, size_t));
|
||||
u_int inet_nsap_addr __P((const char *, u_char *, int));
|
||||
char *inet_nsap_ntoa __P((int, const u_char *, char *));
|
||||
|
||||
/* Convert Internet host address from numbers-and-dots notation in CP
|
||||
into binary data in network byte order. */
|
||||
extern unsigned long int inet_addr __P ((__const char *__cp));
|
||||
|
||||
/* Convert Internet host address from numbers-and-dots notation in CP
|
||||
into binary data and store the result in the structure INP. */
|
||||
extern int inet_aton __P ((__const char *__cp, struct in_addr *__inp));
|
||||
|
||||
/* Return the local host address part of the Internet address in IN. */
|
||||
extern u_int32_t inet_lnaof __P ((struct in_addr __in));
|
||||
|
||||
/* Make Internet host address in network byte order by combining the
|
||||
network number NET with the local address HOST. */
|
||||
extern struct in_addr inet_makeaddr __P ((u_int32_t __net, u_int32_t __host));
|
||||
|
||||
/* Format a network number NET into presentation format and place result
|
||||
in buffer starting at BUF with length of LEN bytes. */
|
||||
extern char *inet_neta __P ((u_long __net, char *__buf, size_t __len));
|
||||
|
||||
/* Return network number part of the Internet address IN. */
|
||||
extern u_int32_t inet_netof __P ((struct in_addr __in));
|
||||
|
||||
/* Extract the network number in network byte order from the address
|
||||
in numbers-and-dots natation starting at CP. */
|
||||
extern u_int32_t inet_network __P ((__const char *__cp));
|
||||
|
||||
/* Convert network number for interface type AF in buffer starting at
|
||||
CP to presentation format. The result will specifiy BITS bits of
|
||||
the number. */
|
||||
extern char *inet_net_ntop __P((int __af, __const void *__cp, int __bits,
|
||||
char *__buf, size_t __len));
|
||||
|
||||
/* Convert network number for interface type AF from presentation in
|
||||
buffer starting at CP to network format and store result int
|
||||
buffer starting at BUF of size LEN. */
|
||||
extern int inet_net_pton __P ((int __af, __const char *__cp,
|
||||
void *__buf, size_t __len));
|
||||
|
||||
/* Convert Internet number in IN to ASCII representation. The return value
|
||||
is a pointer to an internal array containing the string. */
|
||||
extern char *inet_ntoa __P ((struct in_addr __in));
|
||||
|
||||
/* Convert from presentation format of an Internet number in buffer
|
||||
starting at CP to the binary network format and store result for
|
||||
interface type AF in buffer starting at BUF. */
|
||||
extern int inet_pton __P ((int __af, __const char *__cp, void *__buf));
|
||||
|
||||
/* Convert a Internet address in binary network format for interface
|
||||
type AF in buffer starting at CP to presentation form and place
|
||||
result in buffer of length LEN astarting at BUF. */
|
||||
extern __const char *inet_ntop __P ((int __af, __const void *__cp,
|
||||
char *__buf, size_t __len));
|
||||
|
||||
/* Convert ASCII representation in hexadecimal form of the Internet
|
||||
address to binary form and place result in buffer of length LEN
|
||||
starting at BUF. */
|
||||
extern unsigned int inet_nsap_addr __P ((__const char *__cp,
|
||||
unsigned char *__buf, int __len));
|
||||
|
||||
/* Convert internet address in binary form in LEN bytes starting at CP
|
||||
a presentation form and place result in BUF. */
|
||||
extern char *inet_nsap_ntoa __P ((int __len, __const unsigned char *__cp,
|
||||
char *__buf));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_INET_H_ */
|
||||
#endif /* arpa/inet.h */
|
||||
|
||||
+29
-23
@@ -1,21 +1,21 @@
|
||||
/* Functions for storing Ethernet addresses in ASCII and mapping to hostnames.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef __NETINET_ETHER_H
|
||||
|
||||
@@ -25,24 +25,30 @@ Boston, MA 02111-1307, USA. */
|
||||
/* Get definition of `struct ether_addr'. */
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Convert 48 bit Ethernet ADDRess to ASCII. */
|
||||
char *ether_ntoa __P ((const struct ether_addr *__addr));
|
||||
char *ether_ntoa_r __P ((const struct ether_addr *__addr, char *__buf));
|
||||
extern char *ether_ntoa __P ((__const struct ether_addr *__addr));
|
||||
extern char *ether_ntoa_r __P ((__const struct ether_addr *__addr,
|
||||
char *__buf));
|
||||
|
||||
/* Convert ASCII string S to 48 bit Ethernet address. */
|
||||
struct ether_addr *ether_aton __P ((const char *__asc));
|
||||
struct ether_addr *ether_aton_r __P ((const char *__asc,
|
||||
struct ether_addr *__addr));
|
||||
extern struct ether_addr *ether_aton __P ((__const char *__asc));
|
||||
extern struct ether_addr *ether_aton_r __P ((__const char *__asc,
|
||||
struct ether_addr *__addr));
|
||||
|
||||
/* Map 48 bit Ethernet number ADDR to HOSTNAME. */
|
||||
int ether_ntohost __P ((char *__hostname, const struct ether_addr *__addr));
|
||||
extern int ether_ntohost __P ((char *__hostname,
|
||||
__const struct ether_addr *__addr));
|
||||
|
||||
/* Map HOSTNAME to 48 bit Ethernet address. */
|
||||
int ether_hostton __P ((const char *__hostname, struct ether_addr *__addr));
|
||||
extern int ether_hostton __P ((__const char *__hostname,
|
||||
struct ether_addr *__addr));
|
||||
|
||||
/* Scan LINE and set ADDR and HOSTNAME. */
|
||||
int ether_line __P ((const char *__line, struct ether_addr *__addr,
|
||||
char *__hostname));
|
||||
extern int ether_line __P ((__const char *__line, struct ether_addr *__addr,
|
||||
char *__hostname));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* netinet/ether.h */
|
||||
|
||||
+11
-7
@@ -306,7 +306,6 @@ iruserok(raddr, superuser, ruser, luser)
|
||||
struct stat sbuf;
|
||||
struct passwd pwdbuf, *pwd;
|
||||
FILE *hostf;
|
||||
uid_t uid;
|
||||
int first;
|
||||
|
||||
first = 1;
|
||||
@@ -326,7 +325,7 @@ again:
|
||||
char *buffer = __alloca (buflen);
|
||||
|
||||
first = 0;
|
||||
if (getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0)
|
||||
if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0)
|
||||
return -1;
|
||||
|
||||
dirlen = strlen (pwd->pw_dir);
|
||||
@@ -339,10 +338,15 @@ again:
|
||||
* reading an NFS mounted file system, can't read files that
|
||||
* are protected read/write owner only.
|
||||
*/
|
||||
uid = geteuid();
|
||||
(void)seteuid(pwd->pw_uid);
|
||||
hostf = fopen(pbuf, "r");
|
||||
(void)seteuid(uid);
|
||||
if (__access (pbuf, R_OK) != 0)
|
||||
hostf = NULL;
|
||||
else
|
||||
{
|
||||
uid_t uid = geteuid ();
|
||||
seteuid (pwd->pw_uid);
|
||||
hostf = fopen (pbuf, "r");
|
||||
seteuid (uid);
|
||||
}
|
||||
|
||||
if (hostf == NULL)
|
||||
return (-1);
|
||||
@@ -390,7 +394,7 @@ __ivaliduser(hostf, raddr, luser, ruser)
|
||||
size_t bufsize = 0;
|
||||
ssize_t nread;
|
||||
|
||||
while ((nread = getline (&buf, &bufsize, hostf)) > 0) {
|
||||
while ((nread = __getline (&buf, &bufsize, hostf)) > 0) {
|
||||
buf[bufsize - 1] = '\0'; /* Make sure it's terminated. */
|
||||
p = buf;
|
||||
while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') {
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ int
|
||||
rexec(ahost, rport, name, pass, cmd, fd2p)
|
||||
char **ahost;
|
||||
int rport;
|
||||
char *name, *pass, *cmd;
|
||||
const char *name, *pass, *cmd;
|
||||
int *fd2p;
|
||||
{
|
||||
struct sockaddr_in sin, sin2, from;
|
||||
|
||||
+2
-1
@@ -206,7 +206,8 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
|
||||
? strlen (modifier) + 1 : 0)
|
||||
+ ((mask & CEN_SPECIAL) != 0
|
||||
? strlen (special) + 1 : 0)
|
||||
+ ((mask & (CEN_SPONSOR | CEN_REVISION) != 0)
|
||||
+ (((mask & CEN_SPONSOR) != 0
|
||||
|| (mask & CEN_REVISION) != 0)
|
||||
? (1 + ((mask & CEN_SPONSOR) != 0
|
||||
? strlen (sponsor) + 1 : 0)
|
||||
+ ((mask & CEN_REVISION) != 0
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#define _FTW_H 1
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <statbuf.h>
|
||||
|
||||
/* The FLAG argument to the user function passed to ftw. */
|
||||
@@ -41,4 +43,6 @@ extern int ftw __P ((__const char *__dir,
|
||||
int __flag),
|
||||
int __descriptors));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ftw.h */
|
||||
|
||||
+4
-3
@@ -138,8 +138,8 @@ DEFUN(_IO_file_close_it, (fp),
|
||||
}
|
||||
|
||||
void
|
||||
DEFUN(_IO_file_finish, (fp),
|
||||
register _IO_FILE* fp)
|
||||
DEFUN(_IO_file_finish, (fp, dummy),
|
||||
register _IO_FILE* fp AND int dummy)
|
||||
{
|
||||
if (_IO_file_is_open(fp))
|
||||
{
|
||||
@@ -147,7 +147,7 @@ DEFUN(_IO_file_finish, (fp),
|
||||
if (!(fp->_flags & _IO_DELETE_DONT_CLOSE))
|
||||
_IO_SYSCLOSE (fp);
|
||||
}
|
||||
_IO_default_finish(fp);
|
||||
_IO_default_finish(fp, 0);
|
||||
}
|
||||
|
||||
_IO_FILE *
|
||||
@@ -317,6 +317,7 @@ DEFUN(_IO_file_overflow, (f, ch),
|
||||
{
|
||||
if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
|
||||
{
|
||||
f->_flags |= _IO_ERR_SEEN;
|
||||
__set_errno (EBADF);
|
||||
return EOF;
|
||||
}
|
||||
|
||||
+3
-3
@@ -481,8 +481,8 @@ DEFUN(_IO_default_sync, (fp),
|
||||
current implementation, this function can get called twice! */
|
||||
|
||||
void
|
||||
DEFUN(_IO_default_finish, (fp),
|
||||
_IO_FILE *fp)
|
||||
DEFUN(_IO_default_finish, (fp, dummy),
|
||||
_IO_FILE *fp AND int dummy)
|
||||
{
|
||||
struct _IO_marker *mark;
|
||||
if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
|
||||
@@ -615,7 +615,7 @@ DEFUN_VOID(_IO_flush_all_linebuffered)
|
||||
{
|
||||
_IO_FILE *fp;
|
||||
for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
|
||||
if (fp->_flags & _IO_LINE_BUF)
|
||||
if ((fp->_flags & _IO_NO_WRITES) == 0 && fp->_flags & _IO_LINE_BUF)
|
||||
_IO_OVERFLOW (fp, EOF);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -101,8 +101,8 @@ extern "C" {
|
||||
/* The 'finish' function does any final cleaning up of an _IO_FILE object.
|
||||
It does not delete (free) it, but does everything else to finalize it/
|
||||
It matches the streambuf::~streambuf virtual destructor. */
|
||||
typedef void (*_IO_finish_t) __P((_IO_FILE*)); /* finalize */
|
||||
#define _IO_FINISH(FP) JUMP0(__finish, FP)
|
||||
typedef void (*_IO_finish_t) __P((_IO_FILE*, int)); /* finalize */
|
||||
#define _IO_FINISH(FP) JUMP1(__finish, FP, 0)
|
||||
|
||||
/* The 'overflow' hook flushes the buffer.
|
||||
The second argument is a character, or EOF.
|
||||
@@ -295,7 +295,7 @@ extern int _IO_seekmark __P((_IO_FILE *, struct _IO_marker *, int));
|
||||
extern int _IO_default_underflow __P((_IO_FILE*));
|
||||
extern int _IO_default_uflow __P((_IO_FILE*));
|
||||
extern int _IO_default_doallocate __P((_IO_FILE*));
|
||||
extern void _IO_default_finish __P((_IO_FILE *));
|
||||
extern void _IO_default_finish __P((_IO_FILE *, int));
|
||||
extern int _IO_default_pbackfail __P((_IO_FILE*, int));
|
||||
extern _IO_FILE* _IO_default_setbuf __P((_IO_FILE *, char*, _IO_ssize_t));
|
||||
extern _IO_size_t _IO_default_xsputn __P((_IO_FILE *, const void*, _IO_size_t));
|
||||
@@ -352,7 +352,7 @@ extern _IO_ssize_t _IO_file_read __P((_IO_FILE*, void*, _IO_ssize_t));
|
||||
extern int _IO_file_sync __P((_IO_FILE*));
|
||||
extern int _IO_file_close_it __P((_IO_FILE*));
|
||||
extern _IO_fpos_t _IO_file_seek __P((_IO_FILE *, _IO_off_t, int));
|
||||
extern void _IO_file_finish __P((_IO_FILE*));
|
||||
extern void _IO_file_finish __P((_IO_FILE*, int));
|
||||
|
||||
/* Other file functions. */
|
||||
extern _IO_FILE* _IO_file_attach __P((_IO_FILE *, int));
|
||||
@@ -366,7 +366,7 @@ extern int _IO_str_underflow __P((_IO_FILE*));
|
||||
extern int _IO_str_overflow __P((_IO_FILE *, int));
|
||||
extern int _IO_str_pbackfail __P((_IO_FILE*, int));
|
||||
extern _IO_fpos_t _IO_str_seekoff __P((_IO_FILE*,_IO_off_t,int,int));
|
||||
extern void _IO_str_finish __P ((_IO_FILE*));
|
||||
extern void _IO_str_finish __P ((_IO_FILE*, int));
|
||||
|
||||
/* Other strfile functions */
|
||||
extern void _IO_str_init_static __P((_IO_FILE *, char*, int, char*));
|
||||
|
||||
+18
-17
@@ -1,20 +1,20 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include "strfile.h"
|
||||
@@ -31,7 +31,7 @@ struct _IO_FILE_memstream
|
||||
|
||||
|
||||
static int _IO_mem_sync __P ((_IO_FILE* fp));
|
||||
static void _IO_mem_finish __P ((_IO_FILE* fp));
|
||||
static void _IO_mem_finish __P ((_IO_FILE* fp, int));
|
||||
|
||||
|
||||
static const struct _IO_jump_t _IO_mem_jumps =
|
||||
@@ -124,8 +124,9 @@ _IO_mem_sync (fp)
|
||||
|
||||
|
||||
static void
|
||||
_IO_mem_finish (fp)
|
||||
_IO_mem_finish (fp, dummy)
|
||||
_IO_FILE* fp;
|
||||
int dummy;
|
||||
{
|
||||
struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
|
||||
|
||||
@@ -139,5 +140,5 @@ _IO_mem_finish (fp)
|
||||
|
||||
fp->_IO_buf_base = NULL;
|
||||
|
||||
_IO_default_finish (fp);
|
||||
_IO_default_finish (fp, 0);
|
||||
}
|
||||
|
||||
+3
-3
@@ -258,14 +258,14 @@ DEFUN(_IO_str_pbackfail, (fp, c),
|
||||
}
|
||||
|
||||
void
|
||||
DEFUN (_IO_str_finish, (fp),
|
||||
register _IO_FILE* fp)
|
||||
DEFUN (_IO_str_finish, (fp, dummy),
|
||||
register _IO_FILE* fp AND int dummy)
|
||||
{
|
||||
if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
|
||||
(((_IO_strfile*)fp)->_s._free_buffer)(fp->_IO_buf_base);
|
||||
fp->_IO_buf_base = NULL;
|
||||
|
||||
_IO_default_finish(fp);
|
||||
_IO_default_finish(fp, 0);
|
||||
}
|
||||
|
||||
struct _IO_jump_t _IO_str_jumps = {
|
||||
|
||||
+2
-1
@@ -26,7 +26,7 @@ const struct locale_data _nl_C_LC_TIME =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, /* no file mapped */
|
||||
53,
|
||||
54,
|
||||
{
|
||||
{ string: "Sun" },
|
||||
{ string: "Mon" },
|
||||
@@ -79,6 +79,7 @@ const struct locale_data _nl_C_LC_TIME =
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ word: 0 },
|
||||
{ word: 0 },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -73,6 +73,7 @@ localepath = "$(localedir):$(i18ndir)"
|
||||
|
||||
CPPFLAGS := -DLOCALE_PATH='$(localepath)' \
|
||||
-DLOCALEDIR='"$(localedir)"' \
|
||||
-DLOCALE_ALIAS_PATH='"$(localedir):$(i18ndir)"' \
|
||||
-DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
|
||||
-DLOCSRCDIR='"$(i18ndir)/locales"' -DHAVE_CONFIG_H \
|
||||
-Iprograms $(CPPFLAGS)
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ extern const struct locale_data *_nl_current_##category;
|
||||
|
||||
extern const char *const _nl_category_names[LC_ALL + 1];
|
||||
extern const size_t _nl_category_name_sizes[LC_ALL + 1];
|
||||
extern const struct locale_data * *const _nl_current[LC_ALL];
|
||||
extern const struct locale_data * *const _nl_current[LC_ALL + 1];
|
||||
|
||||
/* Name of the standard locale. */
|
||||
extern const char _nl_C_name[];
|
||||
|
||||
@@ -72,7 +72,7 @@ charmap_read (const char *filename)
|
||||
|
||||
result = parse_charmap (pathnfile);
|
||||
|
||||
if (result == NULL)
|
||||
if (result == NULL && !be_quiet)
|
||||
error (0, errno, _("character map file `%s' not found"), filename);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ parse_charmap (const char *filename)
|
||||
result->mb_cur_max = 1;
|
||||
if (result->mb_cur_min == 0)
|
||||
result->mb_cur_min = result->mb_cur_max;
|
||||
if (result->mb_cur_min > result->mb_cur_max)
|
||||
if (result->mb_cur_min > result->mb_cur_max && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
%s: <mb_cur_max> must be greater than <mb_cur_min>\n"),
|
||||
@@ -596,7 +596,7 @@ only WIDTH definitions are allowed to follow the CHARMAP definition"));
|
||||
break;
|
||||
}
|
||||
|
||||
if (state != 91)
|
||||
if (state != 91 && !be_quiet)
|
||||
error (0, 0, _("%s: premature end of file"), cmfile->fname);
|
||||
|
||||
lr_close (cmfile);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -56,6 +56,9 @@ struct charset_t
|
||||
#define ILLEGAL_CHAR_VALUE ((wchar_t) 0xffffffffu)
|
||||
|
||||
|
||||
/* Declared in localedef.c. */
|
||||
extern int be_quiet;
|
||||
|
||||
/* Prototypes for charmap handling functions. */
|
||||
struct charset_t *charmap_read (const char *filename);
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
|
||||
else
|
||||
value = 0;
|
||||
|
||||
if (value == 0)
|
||||
if (value == 0 && !be_quiet)
|
||||
error_at_line (0, 0, patch->fname, patch->lineno,
|
||||
_("no weight defined for symbol `%s'"), patch->token);
|
||||
else
|
||||
@@ -256,7 +256,8 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
|
||||
\**************************************************************/
|
||||
u_int32_t weight;
|
||||
|
||||
error (0, 0, _("no definition of `UNDEFINED'"));
|
||||
if (!be_quiet)
|
||||
error (0, 0, _("no definition of `UNDEFINED'"));
|
||||
|
||||
collate->undefined.ordering_len = collate->nrules;
|
||||
weight = ++collate->order_cnt;
|
||||
@@ -324,9 +325,10 @@ collate_output (struct localedef_t *locale, struct charset_t *charset,
|
||||
level_best = 0xffff;
|
||||
|
||||
/* Compute table size. */
|
||||
fputs (_("\
|
||||
if (!be_quiet)
|
||||
fputs (_("\
|
||||
Computing table size for collation information might take a while..."),
|
||||
stderr);
|
||||
stderr);
|
||||
for (table_size = 256; table_size < sum_best; ++table_size)
|
||||
{
|
||||
size_t hits[table_size];
|
||||
@@ -357,7 +359,8 @@ Computing table size for collation information might take a while..."),
|
||||
}
|
||||
}
|
||||
assert (table_best != 0xffff || level_best != 0xffff);
|
||||
fputs (_(" done\n"), stderr);
|
||||
if (!be_quiet)
|
||||
fputs (_(" done\n"), stderr);
|
||||
|
||||
obstack_init (&non_simple);
|
||||
obstack_init (&string_pool);
|
||||
|
||||
+43
-36
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -262,10 +262,11 @@ ctype_finish (struct localedef_t *locale, struct charset_t *charset)
|
||||
cp += sprintf (cp, "\\%o", (value >> 8) & 0xff);
|
||||
sprintf (cp, "\\%o", value & 0xff);
|
||||
|
||||
error (0, 0, _("\
|
||||
if (!be_quiet)
|
||||
error (0, 0, _("\
|
||||
character %s'%s' in class `%s' must be in class `%s'"), value > 256 ? "L" : "",
|
||||
cp, valid_table[cls1].name,
|
||||
valid_table[cls2].name);
|
||||
cp, valid_table[cls1].name,
|
||||
valid_table[cls2].name);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -286,10 +287,12 @@ character %s'%s' in class `%s' must be in class `%s'"), value > 256 ? "L" : "",
|
||||
cp += sprintf (cp, "\\%o", (value >> 8) & 0xff);
|
||||
sprintf (cp, "\\%o", value & 0xff);
|
||||
|
||||
error (0, 0, _("\
|
||||
if (!be_quiet)
|
||||
error (0, 0, _("\
|
||||
character %s'%s' in class `%s' must not be in class `%s'"),
|
||||
value > 256 ? "L" : "", cp,
|
||||
valid_table[cls1].name, valid_table[cls2].name);
|
||||
value > 256 ? "L" : "", cp,
|
||||
valid_table[cls1].name,
|
||||
valid_table[cls2].name);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -306,23 +309,25 @@ character %s'%s' in class `%s' must not be in class `%s'"),
|
||||
|
||||
/* ... and now test <SP> as a special case. */
|
||||
space_value = charset_find_value (charset, "SP", 2);
|
||||
if ((wchar_t) space_value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) space_value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("character <SP> not defined in character map"));
|
||||
else if ((cnt = BITPOS (tok_space),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_space)) == 0)
|
||||
|| (cnt = BITPOS (tok_blank),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_blank)) == 0))
|
||||
else if (((cnt = BITPOS (tok_space),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_space)) == 0)
|
||||
|| (cnt = BITPOS (tok_blank),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_blank)) == 0))
|
||||
&& !be_quiet)
|
||||
error (0, 0, _("<SP> character not in class `%s'"),
|
||||
valid_table[cnt].name);
|
||||
else if ((cnt = BITPOS (tok_punct),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_punct)) != 0)
|
||||
|| (cnt = BITPOS (tok_graph),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_graph))
|
||||
!= 0))
|
||||
else if (((cnt = BITPOS (tok_punct),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_punct)) != 0)
|
||||
|| (cnt = BITPOS (tok_graph),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_graph))
|
||||
!= 0))
|
||||
&& !be_quiet)
|
||||
error (0, 0, _("<SP> character must not be in class `%s'"),
|
||||
valid_table[cnt].name);
|
||||
else
|
||||
@@ -934,7 +939,7 @@ set_class_defaults (struct locale_ctype_t *ctype, struct charset_t *charset)
|
||||
tmp[0] = ch;
|
||||
|
||||
value = charset_find_value (charset, tmp, 1);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
@@ -998,7 +1003,7 @@ character `%s' not defined while needed as default value"),
|
||||
unsigned int value;
|
||||
|
||||
value = charset_find_value (charset, "space", 5);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<space>");
|
||||
@@ -1006,7 +1011,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
|
||||
|
||||
value = charset_find_value (charset, "form-feed", 9);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<form-feed>");
|
||||
@@ -1014,7 +1019,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
|
||||
|
||||
value = charset_find_value (charset, "newline", 7);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<newline>");
|
||||
@@ -1022,7 +1027,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
|
||||
|
||||
value = charset_find_value (charset, "carriage-return", 15);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<carriage-return>");
|
||||
@@ -1030,7 +1035,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
|
||||
|
||||
value = charset_find_value (charset, "tab", 3);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<tab>");
|
||||
@@ -1038,7 +1043,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
|
||||
|
||||
value = charset_find_value (charset, "vertical-tab", 12);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<vertical-tab>");
|
||||
@@ -1064,7 +1069,7 @@ character `%s' not defined while needed as default value"),
|
||||
unsigned int value;
|
||||
|
||||
value = charset_find_value (charset, "space", 5);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<space>");
|
||||
@@ -1072,7 +1077,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_blank);
|
||||
|
||||
value = charset_find_value (charset, "tab", 3);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<tab>");
|
||||
@@ -1110,7 +1115,7 @@ character `%s' not defined while needed as default value"),
|
||||
ctype->class_collection[cnt] |= BIT (tok_print);
|
||||
|
||||
space = charset_find_value (charset, "space", 5);
|
||||
if (space == ILLEGAL_CHAR_VALUE)
|
||||
if (space == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<space>");
|
||||
@@ -1136,7 +1141,7 @@ character `%s' not defined while needed as default value"),
|
||||
tmp[1] = (char) ch;
|
||||
|
||||
value_from = charset_find_value (charset, &tmp[1], 1);
|
||||
if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
@@ -1147,7 +1152,7 @@ character `%s' not defined while needed as default value"),
|
||||
/* This conversion is implementation defined. */
|
||||
tmp[1] = (char) (ch + ('A' - 'a'));
|
||||
value_to = charset_find_value (charset, &tmp[1], 1);
|
||||
if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
@@ -1195,9 +1200,10 @@ allocate_arrays (struct locale_ctype_t *ctype, struct charset_t *charset)
|
||||
size_t min_total = UINT_MAX;
|
||||
size_t act_size = 256;
|
||||
|
||||
fputs (_("\
|
||||
if (!be_quiet)
|
||||
fputs (_("\
|
||||
Computing table size for character classes might take a while..."),
|
||||
stderr);
|
||||
stderr);
|
||||
|
||||
while (act_size < min_total)
|
||||
{
|
||||
@@ -1232,7 +1238,8 @@ Computing table size for character classes might take a while..."),
|
||||
++act_size;
|
||||
}
|
||||
|
||||
fprintf (stderr, _(" done\n"));
|
||||
if (!be_quiet)
|
||||
fprintf (stderr, _(" done\n"));
|
||||
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -77,7 +77,7 @@ messages_finish (struct localedef_t *locale)
|
||||
= locale->categories[LC_MESSAGES].messages;
|
||||
|
||||
/* The fields YESSTR and NOSTR are optional. */
|
||||
if (messages->yesexpr == NULL)
|
||||
if (messages->yesexpr == NULL && !be_quiet)
|
||||
error (0, 0, _("field `%s' in category `%s' undefined"),
|
||||
"yesexpr", "LC_MESSAGES");
|
||||
else
|
||||
@@ -87,7 +87,7 @@ messages_finish (struct localedef_t *locale)
|
||||
|
||||
/* Test whether it are correct regular expressions. */
|
||||
result = regcomp (&re, messages->yesexpr, REG_EXTENDED);
|
||||
if (result != 0)
|
||||
if (result != 0 && !be_quiet)
|
||||
{
|
||||
char errbuf[BUFSIZ];
|
||||
|
||||
@@ -98,7 +98,7 @@ no correct regular expression for field `%s' in category `%s': %s"),
|
||||
}
|
||||
}
|
||||
|
||||
if (messages->noexpr == NULL)
|
||||
if (messages->noexpr == NULL && !be_quiet)
|
||||
error (0, 0, _("field `%s' in category `%s' undefined"),
|
||||
"noexpr", "LC_MESSAGES");
|
||||
else
|
||||
@@ -108,7 +108,7 @@ no correct regular expression for field `%s' in category `%s': %s"),
|
||||
|
||||
/* Test whether it are correct regular expressions. */
|
||||
result = regcomp (&re, messages->noexpr, REG_EXTENDED);
|
||||
if (result != 0)
|
||||
if (result != 0 && !be_quiet)
|
||||
{
|
||||
char errbuf[BUFSIZ];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -115,7 +115,7 @@ monetary_finish (struct localedef_t *locale)
|
||||
= locale->categories[LC_MONETARY].monetary;
|
||||
|
||||
#define TEST_ELEM(cat) \
|
||||
if (monetary->cat == NULL) \
|
||||
if (monetary->cat == NULL && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"), \
|
||||
#cat, "LC_MONETARY")
|
||||
|
||||
@@ -129,12 +129,13 @@ monetary_finish (struct localedef_t *locale)
|
||||
/* The international currency symbol must come from ISO 4217. */
|
||||
if (monetary->int_curr_symbol != NULL)
|
||||
{
|
||||
if (strlen (monetary->int_curr_symbol) != 4)
|
||||
if (strlen (monetary->int_curr_symbol) != 4 && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
value of field `int_curr_symbol' in category `LC_MONETARY' has wrong length"));
|
||||
else if (bsearch (monetary->int_curr_symbol, valid_int_curr,
|
||||
NR_VALID_INT_CURR, sizeof (const char *),
|
||||
(comparison_fn_t) curr_strcmp) == NULL)
|
||||
(comparison_fn_t) curr_strcmp) == NULL
|
||||
&& !be_quiet)
|
||||
error (0, 0, _("\
|
||||
value of field `int_curr_symbol' in category `LC_MONETARY' does \
|
||||
not correspond to a valid name in ISO 4217"));
|
||||
@@ -143,23 +144,23 @@ not correspond to a valid name in ISO 4217"));
|
||||
/* The decimal point must not be empty. This is not said explicitly
|
||||
in POSIX but ANSI C (ISO/IEC 9899) says in 4.4.2.1 it has to be
|
||||
!= "". */
|
||||
if (monetary->mon_decimal_point[0] == '\0')
|
||||
if (monetary->mon_decimal_point[0] == '\0' && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
value for field `%s' in category `%s' must not be the empty string"),
|
||||
"mon_decimal_point", "LC_MONETARY");
|
||||
}
|
||||
|
||||
if (monetary->mon_grouping_act == 0)
|
||||
if (monetary->mon_grouping_act == 0 && !be_quiet)
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"),
|
||||
"mon_grouping", "LC_MONETARY");
|
||||
|
||||
#undef TEST_ELEM
|
||||
#define TEST_ELEM(cat, min, max) \
|
||||
if (monetary->cat == -2) \
|
||||
if (monetary->cat == -2 && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"), \
|
||||
#cat, "LC_MONETARY"); \
|
||||
else if (monetary->cat < min || monetary->cat > max) \
|
||||
else if ((monetary->cat < min || monetary->cat > max) && !be_quiet) \
|
||||
error (0, 0, _("\
|
||||
value for field `%s' in category `%s' must be in range %d...%d"), \
|
||||
#cat, "LC_MONETARY", min, max)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -74,7 +74,7 @@ numeric_finish (struct localedef_t *locale)
|
||||
struct locale_numeric_t *numeric = locale->categories[LC_NUMERIC].numeric;
|
||||
|
||||
#define TEST_ELEM(cat) \
|
||||
if (numeric->cat == NULL) \
|
||||
if (numeric->cat == NULL && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"), \
|
||||
#cat, "LC_NUMERIC")
|
||||
|
||||
@@ -84,14 +84,14 @@ numeric_finish (struct localedef_t *locale)
|
||||
/* The decimal point must not be empty. This is not said explicitly
|
||||
in POSIX but ANSI C (ISO/IEC 9899) says in 4.4.2.1 it has to be
|
||||
!= "". */
|
||||
if (numeric->decimal_point[0] == '\0')
|
||||
if (numeric->decimal_point[0] == '\0' && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
value for field `%s' in category `%s' must not be the empty string"),
|
||||
"decimal_point", "LC_NUMERIC");
|
||||
}
|
||||
|
||||
if (numeric->grouping_act == 0)
|
||||
if (numeric->grouping_act == 0 && !be_quiet)
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"),
|
||||
"grouping", "LC_NUMERIC");
|
||||
}
|
||||
|
||||
+31
-29
@@ -106,10 +106,10 @@ time_finish (struct localedef_t *locale)
|
||||
struct locale_time_t *time = locale->categories[LC_TIME].time;
|
||||
|
||||
#define TESTARR_ELEM(cat, max) \
|
||||
if (time->cur_num_##cat == 0) \
|
||||
if (time->cur_num_##cat == 0 && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"), \
|
||||
#cat, "LC_TIME"); \
|
||||
else if (time->cur_num_##cat != max) \
|
||||
else if (time->cur_num_##cat != max && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' has not enough values"), \
|
||||
#cat, "LC_TIME")
|
||||
|
||||
@@ -120,7 +120,7 @@ time_finish (struct localedef_t *locale)
|
||||
TESTARR_ELEM (am_pm, 2);
|
||||
|
||||
#define TEST_ELEM(cat) \
|
||||
if (time->cat == NULL) \
|
||||
if (time->cat == NULL && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"), \
|
||||
#cat, "LC_TIME")
|
||||
|
||||
@@ -149,7 +149,7 @@ time_finish (struct localedef_t *locale)
|
||||
memcpy (str, time->era[idx], era_len + 1);
|
||||
|
||||
/* First character must be + or - for the direction. */
|
||||
if (*str != '+' && *str != '-')
|
||||
if (*str != '+' && *str != '-' && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("direction flag in string %d in `era' field"
|
||||
" in category `%s' is not '+' nor '-'"),
|
||||
@@ -159,7 +159,7 @@ time_finish (struct localedef_t *locale)
|
||||
}
|
||||
else
|
||||
time->era_entries[idx].direction = *str;
|
||||
if (*++str != ':')
|
||||
if (*++str != ':' && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("direction flag in string %d in `era' field"
|
||||
" in category `%s' is not a single character"),
|
||||
@@ -171,14 +171,14 @@ time_finish (struct localedef_t *locale)
|
||||
|
||||
/* Now the offset year. */
|
||||
time->era_entries[idx].offset = strtol (str, &endp, 10);
|
||||
if (endp == str)
|
||||
if (endp == str && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("illegal number for offset in string %d in"
|
||||
" `era' field in category `%s'"),
|
||||
idx + 1, "LC_TIME");
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else if (*endp != ':')
|
||||
else if (*endp != ':' && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("garbage at end of offset value in string %d in"
|
||||
" `era' field in category `%s'"),
|
||||
@@ -224,7 +224,7 @@ time_finish (struct localedef_t *locale)
|
||||
time->era_entries[idx].start_date[1] -= 1;
|
||||
|
||||
time->era_entries[idx].start_date[2] = strtol (str, &endp, 10);
|
||||
if (endp == str)
|
||||
if (endp == str && !be_quiet)
|
||||
{
|
||||
invalid_start_date:
|
||||
error (0, 0, _("illegal starting date in string %d in"
|
||||
@@ -232,7 +232,7 @@ time_finish (struct localedef_t *locale)
|
||||
idx + 1, "LC_TIME");
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else if (*endp != ':')
|
||||
else if (*endp != ':' && !be_quiet)
|
||||
{
|
||||
garbage_start_date:
|
||||
error (0, 0, _("garbage at end of starting date in string %d"
|
||||
@@ -245,14 +245,15 @@ time_finish (struct localedef_t *locale)
|
||||
str = endp + 1;
|
||||
|
||||
/* Check for valid value. */
|
||||
if (time->era_entries[idx].start_date[1] < 0
|
||||
|| time->era_entries[idx].start_date[1] >= 12
|
||||
|| time->era_entries[idx].start_date[2] < 0
|
||||
|| (time->era_entries[idx].start_date[2]
|
||||
> days_per_month[time->era_entries[idx].start_date[1]])
|
||||
|| (time->era_entries[idx].start_date[1] == 2
|
||||
&& time->era_entries[idx].start_date[2] == 29
|
||||
&& !__isleap (time->era_entries[idx].start_date[0])))
|
||||
if ((time->era_entries[idx].start_date[1] < 0
|
||||
|| time->era_entries[idx].start_date[1] >= 12
|
||||
|| time->era_entries[idx].start_date[2] < 0
|
||||
|| (time->era_entries[idx].start_date[2]
|
||||
> days_per_month[time->era_entries[idx].start_date[1]])
|
||||
|| (time->era_entries[idx].start_date[1] == 2
|
||||
&& time->era_entries[idx].start_date[2] == 29
|
||||
&& !__isleap (time->era_entries[idx].start_date[0])))
|
||||
&& !be_quiet)
|
||||
error (0, 0, _("starting date is illegal in"
|
||||
" string %d in `era' field in"
|
||||
" category `%s'"),
|
||||
@@ -296,7 +297,7 @@ time_finish (struct localedef_t *locale)
|
||||
time->era_entries[idx].stop_date[1] -= 1;
|
||||
|
||||
time->era_entries[idx].stop_date[2] = strtol (str, &endp, 10);
|
||||
if (endp == str)
|
||||
if (endp == str && !be_quiet)
|
||||
{
|
||||
invalid_stop_date:
|
||||
error (0, 0, _("illegal stopping date in string %d in"
|
||||
@@ -304,7 +305,7 @@ time_finish (struct localedef_t *locale)
|
||||
idx + 1, "LC_TIME");
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else if (*endp != ':')
|
||||
else if (*endp != ':' && !be_quiet)
|
||||
{
|
||||
garbage_stop_date:
|
||||
error (0, 0, _("garbage at end of stopping date in string %d"
|
||||
@@ -317,14 +318,15 @@ time_finish (struct localedef_t *locale)
|
||||
str = endp + 1;
|
||||
|
||||
/* Check for valid value. */
|
||||
if (time->era_entries[idx].stop_date[1] < 0
|
||||
|| time->era_entries[idx].stop_date[1] >= 12
|
||||
|| time->era_entries[idx].stop_date[2] < 0
|
||||
|| (time->era_entries[idx].stop_date[2]
|
||||
> days_per_month[time->era_entries[idx].stop_date[1]])
|
||||
|| (time->era_entries[idx].stop_date[1] == 2
|
||||
&& time->era_entries[idx].stop_date[2] == 29
|
||||
&& !__isleap (time->era_entries[idx].stop_date[0])))
|
||||
if ((time->era_entries[idx].stop_date[1] < 0
|
||||
|| time->era_entries[idx].stop_date[1] >= 12
|
||||
|| time->era_entries[idx].stop_date[2] < 0
|
||||
|| (time->era_entries[idx].stop_date[2]
|
||||
> days_per_month[time->era_entries[idx].stop_date[1]])
|
||||
|| (time->era_entries[idx].stop_date[1] == 2
|
||||
&& time->era_entries[idx].stop_date[2] == 29
|
||||
&& !__isleap (time->era_entries[idx].stop_date[0])))
|
||||
&& !be_quiet)
|
||||
error (0, 0, _("stopping date is illegal in"
|
||||
" string %d in `era' field in"
|
||||
" category `%s'"),
|
||||
@@ -332,7 +334,7 @@ time_finish (struct localedef_t *locale)
|
||||
}
|
||||
}
|
||||
|
||||
if (str == NULL || *str == '\0')
|
||||
if ((str == NULL || *str == '\0') && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("missing era name in string %d in `era' field"
|
||||
" in category `%s'"), idx + 1, "LC_TIME");
|
||||
@@ -343,7 +345,7 @@ time_finish (struct localedef_t *locale)
|
||||
{
|
||||
time->era_entries[idx].name = strsep (&str, ":");
|
||||
|
||||
if (str == NULL || *str == '\0')
|
||||
if ((str == NULL || *str == '\0') && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("missing era format in string %d in `era'"
|
||||
" field in category `%s'"),
|
||||
|
||||
+169
-7
@@ -22,6 +22,8 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <argz.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <error.h>
|
||||
#include <getopt.h>
|
||||
@@ -29,11 +31,13 @@
|
||||
#include <libintl.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <search.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "localeinfo.h"
|
||||
|
||||
@@ -201,6 +205,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||
/* `-a' requests the names of all available locales. */
|
||||
if (do_all != 0)
|
||||
{
|
||||
setlocale (LC_ALL, "");
|
||||
write_locales ();
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
@@ -263,31 +268,165 @@ Report bugs using the `glibcbug' script to <bugs@gnu.ai.mit.edu>.\n"),
|
||||
}
|
||||
|
||||
|
||||
/* Write the names of all available locales to stdout. */
|
||||
/* Simple action function which prints arguments as strings. */
|
||||
static void
|
||||
print_names (const void *nodep, VISIT value, int level)
|
||||
{
|
||||
if (value == postorder || value == leaf)
|
||||
puts (*(char **) nodep);
|
||||
}
|
||||
|
||||
|
||||
/* Write the names of all available locales to stdout. We have some
|
||||
sources of the information: the contents of the locale directory
|
||||
and the locale.alias file. To avoid duplicates and print the
|
||||
result is a reasonable order we put all entries is a search tree
|
||||
and print them afterwards. */
|
||||
static void
|
||||
write_locales (void)
|
||||
{
|
||||
void *all_data = NULL;
|
||||
DIR *dir;
|
||||
struct dirent *dirent;
|
||||
char *alias_path;
|
||||
size_t alias_path_len;
|
||||
char *entry;
|
||||
|
||||
/* `POSIX' locale is always available (POSIX.2 4.34.3). */
|
||||
puts ("POSIX");
|
||||
#define PUT(name) tsearch ((name), &all_data, \
|
||||
(int (*) (const void *, const void *)) strcoll)
|
||||
|
||||
dir = opendir (LOCALE_PATH);
|
||||
dir = opendir (LOCALEDIR);
|
||||
if (dir == NULL)
|
||||
{
|
||||
error (1, errno, gettext ("cannot read locale directory `%s'"),
|
||||
LOCALE_PATH);
|
||||
LOCALEDIR);
|
||||
return;
|
||||
}
|
||||
|
||||
/* `POSIX' locale is always available (POSIX.2 4.34.3). */
|
||||
PUT ("POSIX");
|
||||
/* And so is the "C" locale. */
|
||||
PUT ("C");
|
||||
|
||||
/* Now we can look for all files in the directory. */
|
||||
while ((dirent = readdir (dir)) != NULL)
|
||||
if (strcmp (dirent->d_name, ".") != 0
|
||||
&& strcmp (dirent->d_name, "..") != 0)
|
||||
puts (dirent->d_name);
|
||||
{
|
||||
mode_t mode;
|
||||
#ifdef _DIRENT_HAVE_D_TYPE
|
||||
if (dirent->d_type != DT_UNKNOWN)
|
||||
mode = DTTOIF (dirent->d_type);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
struct stat st;
|
||||
char buf[sizeof (LOCALEDIR) + strlen (dirent->d_name) + 1];
|
||||
|
||||
stpcpy (stpcpy (stpcpy (buf, LOCALEDIR), "/"), dirent->d_name);
|
||||
|
||||
if (stat (buf, &st) < 0)
|
||||
continue;
|
||||
mode = st.st_mode;
|
||||
}
|
||||
|
||||
if (S_ISDIR (mode))
|
||||
PUT (strdup (dirent->d_name));
|
||||
}
|
||||
|
||||
closedir (dir);
|
||||
|
||||
/* Now read the locale.alias files. */
|
||||
if (argz_create_sep (LOCALE_ALIAS_PATH, ':', &alias_path, &alias_path_len))
|
||||
error (1, errno, gettext ("while preparing output"));
|
||||
|
||||
entry = NULL;
|
||||
while ((entry = argz_next (alias_path, alias_path_len, entry)))
|
||||
{
|
||||
static const char aliasfile[] = "/locale.alias";
|
||||
FILE *fp;
|
||||
char full_name[strlen (entry) + sizeof aliasfile];
|
||||
|
||||
stpcpy (stpcpy (full_name, entry), aliasfile);
|
||||
fp = fopen (full_name, "r");
|
||||
if (fp == NULL)
|
||||
/* Ignore non-existing files. */
|
||||
continue;
|
||||
|
||||
while (! feof (fp))
|
||||
{
|
||||
/* It is a reasonable approach to use a fix buffer here
|
||||
because
|
||||
a) we are only interested in the first two fields
|
||||
b) these fields must be usable as file names and so must
|
||||
not be that long */
|
||||
char buf[BUFSIZ];
|
||||
char *alias;
|
||||
char *value;
|
||||
char *cp;
|
||||
|
||||
if (fgets (buf, BUFSIZ, fp) == NULL)
|
||||
/* EOF reached. */
|
||||
break;
|
||||
|
||||
cp = buf;
|
||||
/* Ignore leading white space. */
|
||||
while (isspace (cp[0]))
|
||||
++cp;
|
||||
|
||||
/* A leading '#' signals a comment line. */
|
||||
if (cp[0] != '\0' && cp[0] != '#')
|
||||
{
|
||||
alias = cp++;
|
||||
while (cp[0] != '\0' && !isspace (cp[0]))
|
||||
++cp;
|
||||
/* Terminate alias name. */
|
||||
if (cp[0] != '\0')
|
||||
*cp++ = '\0';
|
||||
|
||||
/* Now look for the beginning of the value. */
|
||||
while (isspace (cp[0]))
|
||||
++cp;
|
||||
|
||||
if (cp[0] != '\0')
|
||||
{
|
||||
value = cp++;
|
||||
while (cp[0] != '\0' && !isspace (cp[0]))
|
||||
++cp;
|
||||
/* Terminate value. */
|
||||
if (cp[0] == '\n')
|
||||
{
|
||||
/* This has to be done to make the following
|
||||
test for the end of line possible. We are
|
||||
looking for the terminating '\n' which do not
|
||||
overwrite here. */
|
||||
*cp++ = '\0';
|
||||
*cp = '\n';
|
||||
}
|
||||
else if (cp[0] != '\0')
|
||||
*cp++ = '\0';
|
||||
|
||||
/* Add the alias. */
|
||||
PUT (strdup (alias));
|
||||
}
|
||||
}
|
||||
|
||||
/* Possibly not the whole line fits into the buffer.
|
||||
Ignore the rest of the line. */
|
||||
while (strchr (cp, '\n') == NULL)
|
||||
{
|
||||
cp = buf;
|
||||
if (fgets (buf, BUFSIZ, fp) == NULL)
|
||||
/* Make sure the inner loop will be left. The outer
|
||||
loop will exit at the `feof' test. */
|
||||
*cp = '\n';
|
||||
}
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
twalk (all_data, print_names);
|
||||
}
|
||||
|
||||
|
||||
@@ -295,6 +434,7 @@ write_locales (void)
|
||||
static void
|
||||
write_charmaps (void)
|
||||
{
|
||||
void *all_data = NULL;
|
||||
DIR *dir;
|
||||
struct dirent *dirent;
|
||||
|
||||
@@ -310,9 +450,31 @@ write_charmaps (void)
|
||||
while ((dirent = readdir (dir)) != NULL)
|
||||
if (strcmp (dirent->d_name, ".") != 0
|
||||
&& strcmp (dirent->d_name, "..") != 0)
|
||||
puts (dirent->d_name);
|
||||
{
|
||||
mode_t mode;
|
||||
#ifdef _DIRENT_HAVE_D_TYPE
|
||||
if (dirent->d_type != DT_UNKNOWN)
|
||||
mode = DTTOIF (dirent->d_type);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
struct stat st;
|
||||
char buf[sizeof (CHARMAP_PATH) + strlen (dirent->d_name) + 1];
|
||||
|
||||
stpcpy (stpcpy (stpcpy (buf, CHARMAP_PATH), "/"), dirent->d_name);
|
||||
|
||||
if (stat (buf, &st) < 0)
|
||||
continue;
|
||||
mode = st.st_mode;
|
||||
}
|
||||
|
||||
if (S_ISREG (mode))
|
||||
PUT (strdup (dirent->d_name));
|
||||
}
|
||||
|
||||
closedir (dir);
|
||||
|
||||
twalk (all_data, print_names);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ int posix_conformance;
|
||||
/* If not zero give a lot more messages. */
|
||||
int verbose;
|
||||
|
||||
/* If not zero don't print warnings. */
|
||||
int be_quiet;
|
||||
|
||||
|
||||
/* Long options. */
|
||||
@@ -81,6 +83,7 @@ static const struct option long_options[] =
|
||||
{ "force", no_argument, NULL, 'c' },
|
||||
{ "inputfile", required_argument, NULL, 'i' },
|
||||
{ "posix", no_argument, &posix_conformance, 1 },
|
||||
{ "quiet", no_argument, &be_quiet, 1 },
|
||||
{ "verbose", no_argument, &verbose, 1},
|
||||
{ "version", no_argument, NULL, 'V' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
@@ -258,21 +261,22 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||
|
||||
if (! avail)
|
||||
{
|
||||
const char *locale_names[] = { "LC_COLLATE", "LC_CTYPE",
|
||||
"LC_MONETARY", "LC_NUMERIC",
|
||||
"LC_TIME", "LC_MESSAGES" };
|
||||
static const char *locale_names[] =
|
||||
{ "LC_COLLATE", "LC_CTYPE", "LC_MONETARY",
|
||||
"LC_NUMERIC", "LC_TIME", "LC_MESSAGES"
|
||||
};
|
||||
char *fname;
|
||||
int fd;
|
||||
struct stat st;
|
||||
|
||||
asprintf (&fname, LOCALE_PATH "/%s/%s", act_add_locdef->name,
|
||||
asprintf (&fname, LOCALEDIR "/%s/%s", act_add_locdef->name,
|
||||
locale_names[cat]);
|
||||
fd = open (fname, O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
free (fname);
|
||||
|
||||
asprintf (&fname, LOCALE_PATH "/%s/%s/SYS_%s",
|
||||
asprintf (&fname, LOCALEDIR "/%s/%s/SYS_%s",
|
||||
act_add_locdef->name, locale_names[cat],
|
||||
locale_names[cat]);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <locale.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -76,10 +77,31 @@ locfile_read (const char *filename, struct charset_t *charset)
|
||||
{
|
||||
if (filename[0] != '/')
|
||||
{
|
||||
char path[strlen (filename) + 1 + sizeof (LOCSRCDIR)];
|
||||
char *i18npath = __secure_getenv ("I18NPATH");
|
||||
if (i18npath != NULL && *i18npath != '\0')
|
||||
{
|
||||
char path[strlen (filename) + 1 + strlen (i18npath) + 1];
|
||||
char *next;
|
||||
i18npath = strdupa (i18npath);
|
||||
|
||||
stpcpy (stpcpy (stpcpy (path, LOCSRCDIR), "/"), filename);
|
||||
ldfile = lr_open (path, locfile_hash);
|
||||
|
||||
while (ldfile == NULL
|
||||
&& (next = strsep (&i18npath, ":")) != NULL)
|
||||
{
|
||||
stpcpy (stpcpy (stpcpy (path, next), "/"), filename);
|
||||
|
||||
ldfile = lr_open (path, locfile_hash);
|
||||
}
|
||||
}
|
||||
|
||||
/* Test in the default directory. */
|
||||
if (ldfile == NULL)
|
||||
{
|
||||
char path[strlen (filename) + 1 + sizeof (LOCSRCDIR)];
|
||||
|
||||
stpcpy (stpcpy (stpcpy (path, LOCSRCDIR), "/"), filename);
|
||||
ldfile = lr_open (path, locfile_hash);
|
||||
}
|
||||
}
|
||||
|
||||
if (ldfile == NULL)
|
||||
@@ -981,7 +1003,7 @@ write_locale_data (const char *output_path, const char *category,
|
||||
save_err = errno;
|
||||
}
|
||||
|
||||
if (fd == -1)
|
||||
if (fd == -1 && !be_quiet)
|
||||
{
|
||||
error (0, save_err, _("\
|
||||
cannot open output file `%s' for category `%s'"),
|
||||
@@ -1005,7 +1027,7 @@ cannot open output file `%s' for category `%s'"),
|
||||
if (maxiov > 0)
|
||||
step = MIN (maxiov, step);
|
||||
|
||||
if (writev (fd, &vec[cnt], step) < 0)
|
||||
if (writev (fd, &vec[cnt], step) < 0 && !be_quiet)
|
||||
{
|
||||
error (0, errno, _("failure while writing data for category `%s'"),
|
||||
category);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -53,6 +53,8 @@ struct localedef_t
|
||||
size_t len[6];
|
||||
};
|
||||
|
||||
/* Declared in localedef.c. */
|
||||
extern int be_quiet;
|
||||
|
||||
/* Found in localedef.c. */
|
||||
void def_to_process (const char *name, int category);
|
||||
|
||||
+17
-14
@@ -1,20 +1,20 @@
|
||||
/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <alloca.h>
|
||||
#include <argz.h>
|
||||
@@ -49,6 +49,9 @@ static const struct locale_data * *const _nl_current[] =
|
||||
[category] = &_nl_current_##category,
|
||||
#include "categories.def"
|
||||
#undef DEFINE_CATEGORY
|
||||
/* We need this additional element to simplify the code. It must
|
||||
simply be != NULL. */
|
||||
[LC_ALL] = (const struct locale_data **) ~0ul
|
||||
};
|
||||
|
||||
/* Array indexed by category of pointers to _nl_C_CATEGORY slots.
|
||||
|
||||
+7
-9
@@ -55,8 +55,8 @@ typedef struct weight_t
|
||||
((u_int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_RULES))
|
||||
|
||||
|
||||
static __inline int get_weight (const STRING_TYPE **str, weight_t *result);
|
||||
static __inline int
|
||||
static __inline void get_weight (const STRING_TYPE **str, weight_t *result);
|
||||
static __inline void
|
||||
get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
{
|
||||
unsigned int ch = *((USTRING_TYPE *) (*str))++;
|
||||
@@ -86,7 +86,7 @@ get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
result->data[cnt].value = &__collate_extra[idx];
|
||||
idx += result->data[cnt].number;
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
slot += level_size;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
result->data[cnt].number = 1;
|
||||
result->data[cnt].value = &__collate_table[slot + 1 + cnt];
|
||||
}
|
||||
return ch == 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* We now look for any collation element which starts with CH.
|
||||
@@ -135,14 +135,12 @@ get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
result->data[cnt].value = &__collate_extra[idx];
|
||||
idx += result->data[cnt].number;
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* To next entry in list. */
|
||||
slot += __collate_extra[slot];
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return 0; /* To calm down gcc. */
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +153,7 @@ get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
do \
|
||||
{ \
|
||||
weight_t *newp; \
|
||||
do \
|
||||
while (*str != '\0') \
|
||||
{ \
|
||||
newp = (weight_t *) alloca (sizeof (weight_t) \
|
||||
+ (collate_nrules \
|
||||
@@ -168,7 +166,7 @@ get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
backw->next = newp; \
|
||||
newp->next = NULL; \
|
||||
backw = newp; \
|
||||
get_weight (&str, newp); \
|
||||
} \
|
||||
while (get_weight (&str, newp) == 0); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
+6
-2
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -35,5 +35,9 @@ extra-libs-others := $(extra-libs)
|
||||
|
||||
libutil-routines:= login login_tty logout logwtmp pty
|
||||
|
||||
|
||||
include ../Rules
|
||||
|
||||
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
|
||||
# This ensures they will load libc.so for needed symbols if loaded by
|
||||
# a statically-linked program that hasn't already loaded it.
|
||||
$(objpfx)libutil.so: $(common-objpfx)libc.so
|
||||
|
||||
+38
-31
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
@@ -25,18 +25,51 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
void
|
||||
logwtmp (const char *line, const char *name, const char *host)
|
||||
updwtmp (const char *wtmp_file, const struct utmp *ut)
|
||||
{
|
||||
struct utmp ut;
|
||||
struct stat st;
|
||||
size_t written;
|
||||
int fd;
|
||||
|
||||
/* Open WTMP file. */
|
||||
fd = __open (_PATH_WTMP, O_WRONLY | O_APPEND);
|
||||
fd = __open (wtmp_file, O_WRONLY | O_APPEND);
|
||||
if (fd < 0)
|
||||
return;
|
||||
|
||||
/* Try to lock the file. */
|
||||
if (__flock (fd, LOCK_EX | LOCK_NB) < 0 && errno != ENOSYS)
|
||||
{
|
||||
/* Oh, oh. The file is already locked. Wait a bit and try again. */
|
||||
sleep (1);
|
||||
|
||||
/* This time we ignore the error. */
|
||||
__flock (fd, LOCK_EX | LOCK_NB);
|
||||
}
|
||||
|
||||
/* Remember original size of log file: */
|
||||
if (__fstat (fd, &st) < 0)
|
||||
goto done;
|
||||
|
||||
/* Write the entry. If we can't write all the bytes, reset the file
|
||||
size back to the original size. That way, no partial entries
|
||||
will remain. */
|
||||
written = __write (fd, ut, sizeof (struct utmp));
|
||||
if (written > 0 && written != sizeof (struct utmp))
|
||||
ftruncate (fd, st.st_size);
|
||||
|
||||
done:
|
||||
/* And unlock the file. */
|
||||
__flock (fd, LOCK_UN);
|
||||
|
||||
/* Close WTMP file. */
|
||||
__close (fd);
|
||||
}
|
||||
|
||||
void
|
||||
logwtmp (const char *line, const char *name, const char *host)
|
||||
{
|
||||
struct utmp ut;
|
||||
|
||||
/* Set information in new entry. */
|
||||
memset (&ut, 0, sizeof (ut));
|
||||
#if _HAVE_UT_PID - 0
|
||||
@@ -57,31 +90,5 @@ logwtmp (const char *line, const char *name, const char *host)
|
||||
time (&ut.ut_time);
|
||||
#endif
|
||||
|
||||
/* Try to lock the file. */
|
||||
if (__flock (fd, LOCK_EX | LOCK_NB) < 0 && errno != ENOSYS)
|
||||
{
|
||||
/* Oh, oh. The file is already locked. Wait a bit and try again. */
|
||||
sleep (1);
|
||||
|
||||
/* This time we ignore the error. */
|
||||
__flock (fd, LOCK_EX | LOCK_NB);
|
||||
}
|
||||
|
||||
/* Remember original size of log file: */
|
||||
if (__fstat (fd, &st) < 0)
|
||||
goto done;
|
||||
|
||||
/* Write the entry. If we can't write all the bytes, reset the file
|
||||
size back to the original size. That way, no partial entries
|
||||
will remain. */
|
||||
written = __write (fd, &ut, sizeof (ut));
|
||||
if (written > 0 && written != sizeof (ut))
|
||||
ftruncate (fd, st.st_size);
|
||||
|
||||
done:
|
||||
/* And unlock the file. */
|
||||
__flock (fd, LOCK_UN);
|
||||
|
||||
/* Close WTMP file. */
|
||||
__close (fd);
|
||||
updwtmp(_PATH_WTMP, &ut);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Get system dependent values and data structures. */
|
||||
#include <utmpbits.h>
|
||||
@@ -47,6 +48,10 @@ extern void login __P ((__const struct utmp *__entry));
|
||||
/* Write the utmp entry to say the user on UT_LINE has logged out. */
|
||||
extern int logout __P ((__const char *__ut_line));
|
||||
|
||||
/* Append the given entry to a wtmp file. */
|
||||
extern void updwtmp __P ((__const char *__wtmp_file,
|
||||
__const struct utmp *__entry));
|
||||
|
||||
/* Append to wtmp an entry for the current time and the given info. */
|
||||
extern void logwtmp __P ((__const char *__ut_line, __const char *__ut_name,
|
||||
__const char *__ut_host));
|
||||
|
||||
+50
-22
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>
|
||||
and Paul Janzen <pcj@primenet.com>, 1996.
|
||||
@@ -87,8 +87,10 @@ setutent_file (int reset)
|
||||
}
|
||||
file_offset = 0;
|
||||
|
||||
#if _HAVE_UT_TYPE - 0
|
||||
/* Make sure the entry won't match. */
|
||||
last_entry.ut_type = -1;
|
||||
#endif
|
||||
}
|
||||
else if (reset)
|
||||
{
|
||||
@@ -97,8 +99,10 @@ setutent_file (int reset)
|
||||
/* Remember we are at beginning of file. */
|
||||
file_offset = 0;
|
||||
|
||||
#if _HAVE_UT_TYPE - 0
|
||||
/* Make sure the entry won't match. */
|
||||
last_entry.ut_type = -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -210,8 +214,36 @@ getutline_r_file (const struct utmp *line, struct utmp *buffer,
|
||||
|
||||
|
||||
static int
|
||||
internal_getutid_r (const struct utmp *id, struct utmp *buffer)
|
||||
proc_utmp_eq (const struct utmp *entry, const struct utmp *match)
|
||||
{
|
||||
return
|
||||
(
|
||||
#if _HAVE_UT_TYPE - 0
|
||||
(entry->ut_type == INIT_PROCESS
|
||||
|| entry->ut_type == LOGIN_PROCESS
|
||||
|| entry->ut_type == USER_PROCESS
|
||||
|| entry->ut_type == DEAD_PROCESS)
|
||||
&&
|
||||
(match->ut_type == INIT_PROCESS
|
||||
|| match->ut_type == LOGIN_PROCESS
|
||||
|| match->ut_type == USER_PROCESS
|
||||
|| match->ut_type == DEAD_PROCESS)
|
||||
&&
|
||||
#endif
|
||||
#if _HAVE_UT_ID - 0
|
||||
(entry->ut_id[0] && match->ut_id[0]
|
||||
? strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
|
||||
: strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0)
|
||||
#else
|
||||
strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
static int
|
||||
internal_getut_r (const struct utmp *id, struct utmp *buffer)
|
||||
{
|
||||
#if _HAVE_UT_TYPE - 0
|
||||
if (id->ut_type == RUN_LVL || id->ut_type == BOOT_TIME
|
||||
|| id->ut_type == OLD_TIME || id->ut_type == NEW_TIME)
|
||||
{
|
||||
@@ -235,6 +267,7 @@ internal_getutid_r (const struct utmp *id, struct utmp *buffer)
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* _HAVE_UT_TYPE */
|
||||
{
|
||||
/* Search for the next entry with the specified ID and with type
|
||||
INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS. */
|
||||
@@ -251,11 +284,7 @@ internal_getutid_r (const struct utmp *id, struct utmp *buffer)
|
||||
}
|
||||
file_offset += sizeof (struct utmp);
|
||||
|
||||
if (( buffer->ut_type == INIT_PROCESS
|
||||
|| buffer->ut_type == LOGIN_PROCESS
|
||||
|| buffer->ut_type == USER_PROCESS
|
||||
|| buffer->ut_type == DEAD_PROCESS)
|
||||
&& strncmp (buffer->ut_id, id->ut_id, sizeof id->ut_id) == 0)
|
||||
if (proc_utmp_eq (buffer, id))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -276,7 +305,7 @@ getutid_r_file (const struct utmp *id, struct utmp *buffer,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (internal_getutid_r (id, &last_entry) < 0)
|
||||
if (internal_getut_r (id, &last_entry) < 0)
|
||||
{
|
||||
*result = NULL;
|
||||
return -1;
|
||||
@@ -306,21 +335,20 @@ pututline_file (const struct utmp *data)
|
||||
setutent_file (0);
|
||||
|
||||
/* Find the correct place to insert the data. */
|
||||
if (file_offset > 0)
|
||||
found = 0;
|
||||
if (file_offset > 0
|
||||
&& (
|
||||
#if _HAVE_UT_TYPE - 0
|
||||
(last_entry.ut_type == data->ut_type
|
||||
&& (last_entry.ut_type == RUN_LVL
|
||||
|| last_entry.ut_type == BOOT_TIME
|
||||
|| last_entry.ut_type == OLD_TIME
|
||||
|| last_entry.ut_type == NEW_TIME))
|
||||
||
|
||||
#endif
|
||||
proc_utmp_eq (&last_entry, data)))
|
||||
found = 1;
|
||||
else
|
||||
if ( last_entry.ut_type == RUN_LVL
|
||||
|| last_entry.ut_type == BOOT_TIME
|
||||
|| last_entry.ut_type == OLD_TIME
|
||||
|| last_entry.ut_type == NEW_TIME
|
||||
|| (( last_entry.ut_type == INIT_PROCESS
|
||||
|| last_entry.ut_type == LOGIN_PROCESS
|
||||
|| last_entry.ut_type == USER_PROCESS
|
||||
|| last_entry.ut_type == DEAD_PROCESS)
|
||||
&& !strncmp (last_entry.ut_id, data->ut_id, sizeof data->ut_id)))
|
||||
found = 1;
|
||||
else
|
||||
found = internal_getutid_r (data, &buffer);
|
||||
found = internal_getut_r (data, &buffer);
|
||||
|
||||
/* Try to lock the file. */
|
||||
memset (&fl, '\0', sizeof (struct flock));
|
||||
|
||||
+21
-16
@@ -1,23 +1,22 @@
|
||||
/* stdio on a Mach device port.
|
||||
Translates \n to \r\n on output, echos and translates \r to \n on input.
|
||||
Copyright (C) 1992, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <mach.h>
|
||||
@@ -148,10 +147,16 @@ output (FILE *f, int c)
|
||||
{
|
||||
kern_return_t err;
|
||||
int wrote;
|
||||
int thiswrite;
|
||||
|
||||
while (to_write > 0)
|
||||
{
|
||||
thiswrite = to_write;
|
||||
if (thiswrite > IO_INBAND_MAX)
|
||||
thiswrite = IO_INBAND_MAX;
|
||||
|
||||
if (err = device_write_inband ((device_t) f->__cookie, 0,
|
||||
f->__target, p, to_write, &wrote))
|
||||
f->__target, p, thiswrite, &wrote))
|
||||
{
|
||||
errno = err;
|
||||
f->__error = 1;
|
||||
|
||||
+23
-2
@@ -26,6 +26,28 @@
|
||||
|
||||
/* This file was broken out from:
|
||||
$Log$
|
||||
Revision 1.1.2.1 1997/03/17 03:52:14 drepper
|
||||
(__mach_error_map_compat): Give full prototype.
|
||||
|
||||
Revision 1.2 1997/03/16 17:41:36 drepper
|
||||
(__mach_error_map_compat): Give full prototype.
|
||||
|
||||
Revision 1.2 1997/03/14 15:26:28 thomas
|
||||
Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
|
||||
|
||||
* mach/mach_error.c (mach_error_string_int): Give full prototype.
|
||||
* mach/errstring.c (mach_error_string_int): Likewise.
|
||||
* mach/error_compat.c (__mach_error_map_compat): Likewise.
|
||||
|
||||
* mach/spin-solid.c: Include <mach/mach_traps.h>.
|
||||
* mach/spin-solid.c (__spin_lock_solid): Provide arg to
|
||||
swtch_pri.
|
||||
|
||||
* mach/mach_init.c: Include <mach/mig_support.h>.
|
||||
|
||||
* mach/mach_error.h (mach_error_string, mach_error,
|
||||
mach_error_type): Always provide prototypes.
|
||||
|
||||
Revision 1.1 1993/11/30 17:35:24 roland
|
||||
entered into RCS
|
||||
|
||||
@@ -39,8 +61,7 @@
|
||||
|
||||
|
||||
void
|
||||
__mach_error_map_compat( org_err )
|
||||
mach_error_t * org_err;
|
||||
__mach_error_map_compat(mach_error_t *org_err)
|
||||
{
|
||||
mach_error_t err = *org_err;
|
||||
|
||||
|
||||
+24
-3
@@ -26,6 +26,28 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log$
|
||||
* Revision 1.1.2.1 1997/03/17 03:52:30 drepper
|
||||
* (mach_error_string_int): Give full prototype.
|
||||
*
|
||||
* Revision 1.2 1997/03/16 17:41:48 drepper
|
||||
* (mach_error_string_int): Give full prototype.
|
||||
*
|
||||
* Revision 1.2 1997/03/14 15:26:29 thomas
|
||||
* Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
|
||||
*
|
||||
* * mach/mach_error.c (mach_error_string_int): Give full prototype.
|
||||
* * mach/errstring.c (mach_error_string_int): Likewise.
|
||||
* * mach/error_compat.c (__mach_error_map_compat): Likewise.
|
||||
*
|
||||
* * mach/spin-solid.c: Include <mach/mach_traps.h>.
|
||||
* * mach/spin-solid.c (__spin_lock_solid): Provide arg to
|
||||
* swtch_pri.
|
||||
*
|
||||
* * mach/mach_init.c: Include <mach/mig_support.h>.
|
||||
*
|
||||
* * mach/mach_error.h (mach_error_string, mach_error,
|
||||
* mach_error_type): Always provide prototypes.
|
||||
*
|
||||
* Revision 1.1 1993/11/30 17:35:58 roland
|
||||
* entered into RCS
|
||||
*
|
||||
@@ -67,9 +89,8 @@ mach_error_type( err )
|
||||
boolean_t mach_error_full_diag = FALSE;
|
||||
|
||||
const char *
|
||||
mach_error_string_int( err, diag )
|
||||
mach_error_t err;
|
||||
boolean_t * diag;
|
||||
mach_error_string_int(mach_error_t err,
|
||||
boolean_t * diag)
|
||||
{
|
||||
int sub, system, code;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -26,7 +26,7 @@
|
||||
#define _MACH_MACH_TRAPS_H_ 1
|
||||
|
||||
#include <mach/port.h>
|
||||
|
||||
#include <mach/kern_return.h>
|
||||
|
||||
/* Create and return a new receive right. */
|
||||
extern mach_port_t mach_reply_port (void);
|
||||
|
||||
+23
-1
@@ -26,6 +26,28 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log$
|
||||
* Revision 1.1.2.1 1997/03/17 03:52:38 drepper
|
||||
* (mach_error_string_int): Give full prototype.
|
||||
*
|
||||
* Revision 1.2 1997/03/16 17:42:02 drepper
|
||||
* (mach_error_string_int): Give full prototype.
|
||||
*
|
||||
* Revision 1.2 1997/03/14 15:26:30 thomas
|
||||
* Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
|
||||
*
|
||||
* * mach/mach_error.c (mach_error_string_int): Give full prototype.
|
||||
* * mach/errstring.c (mach_error_string_int): Likewise.
|
||||
* * mach/error_compat.c (__mach_error_map_compat): Likewise.
|
||||
*
|
||||
* * mach/spin-solid.c: Include <mach/mach_traps.h>.
|
||||
* * mach/spin-solid.c (__spin_lock_solid): Provide arg to
|
||||
* swtch_pri.
|
||||
*
|
||||
* * mach/mach_init.c: Include <mach/mig_support.h>.
|
||||
*
|
||||
* * mach/mach_error.h (mach_error_string, mach_error,
|
||||
* mach_error_type): Always provide prototypes.
|
||||
*
|
||||
* Revision 1.1 1992/10/06 18:29:54 roland
|
||||
* entered into RCS
|
||||
*
|
||||
@@ -63,7 +85,7 @@
|
||||
#include <mach_error.h>
|
||||
#include <mach/boolean.h>
|
||||
|
||||
extern char * mach_error_string_int();
|
||||
extern char * mach_error_string_int(mach_error_t, boolean_t *);
|
||||
|
||||
void
|
||||
mach_error( str, err )
|
||||
|
||||
+26
-6
@@ -26,6 +26,32 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log$
|
||||
* Revision 1.2.2.1 1997/03/17 03:52:48 drepper
|
||||
* (mach_error_string, mach_error, mach_error_type): Always provide
|
||||
* prototypes.
|
||||
*
|
||||
* Revision 1.3 1997/03/16 17:42:25 drepper
|
||||
* (mach_error_string, mach_error, mach_error_type): Always provide
|
||||
* prototypes.
|
||||
* (mach_error_fn_t): Comment out declaration; it appears to be entirely
|
||||
* unused dead code.
|
||||
*
|
||||
* Revision 1.3 1997/03/14 15:26:31 thomas
|
||||
* Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
|
||||
*
|
||||
* * mach/mach_error.c (mach_error_string_int): Give full prototype.
|
||||
* * mach/errstring.c (mach_error_string_int): Likewise.
|
||||
* * mach/error_compat.c (__mach_error_map_compat): Likewise.
|
||||
*
|
||||
* * mach/spin-solid.c: Include <mach/mach_traps.h>.
|
||||
* * mach/spin-solid.c (__spin_lock_solid): Provide arg to
|
||||
* swtch_pri.
|
||||
*
|
||||
* * mach/mach_init.c: Include <mach/mig_support.h>.
|
||||
*
|
||||
* * mach/mach_error.h (mach_error_string, mach_error,
|
||||
* mach_error_type): Always provide prototypes.
|
||||
*
|
||||
* Revision 1.2 1993/11/23 20:39:08 mib
|
||||
* entered into RCS
|
||||
*
|
||||
@@ -53,28 +79,22 @@ const char *mach_error_string(
|
||||
/*
|
||||
* Returns a string appropriate to the error argument given
|
||||
*/
|
||||
#if c_plusplus
|
||||
mach_error_t error_value
|
||||
#endif c_plusplus
|
||||
);
|
||||
|
||||
void mach_error(
|
||||
/*
|
||||
* Prints an appropriate message on the standard error stream
|
||||
*/
|
||||
#if c_plusplus
|
||||
char *str,
|
||||
mach_error_t error_value
|
||||
#endif c_plusplus
|
||||
);
|
||||
|
||||
const char *mach_error_type(
|
||||
/*
|
||||
* Returns a string with the error system, subsystem and code
|
||||
*/
|
||||
#if c_plusplus
|
||||
mach_error_t error_value
|
||||
#endif c_plusplus
|
||||
);
|
||||
|
||||
#endif _MACH_ERROR_
|
||||
|
||||
+15
-14
@@ -1,23 +1,24 @@
|
||||
/* Copyright (C) 1992, 1993, 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <mach_init.h>
|
||||
#include <mach/mach_interface.h>
|
||||
#include <mach/mig_support.h>
|
||||
|
||||
mach_port_t __mach_task_self_;
|
||||
vm_size_t __vm_page_size = 0; /* Must be data not bss for weak alias. */
|
||||
|
||||
+16
-15
@@ -1,28 +1,29 @@
|
||||
/* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <spin-lock.h>
|
||||
#include <mach/mach_traps.h>
|
||||
|
||||
void
|
||||
__spin_lock_solid (spin_lock_t *lock)
|
||||
{
|
||||
while (__spin_lock_locked (lock) || ! __spin_try_lock (lock))
|
||||
/* Yield to another thread (system call). */
|
||||
__swtch_pri ();
|
||||
__swtch_pri (0);
|
||||
}
|
||||
weak_alias (__spin_lock_solid, spin_lock_solid);
|
||||
|
||||
+247
-33
@@ -19,7 +19,7 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* V2.6.4-pt2 Sat Dec 14 1996
|
||||
/* V2.6.4-pt3 Thu Feb 20 1997
|
||||
|
||||
This work is mainly derived from malloc-2.6.4 by Doug Lea
|
||||
<dl@cs.oswego.edu>, which is available from:
|
||||
@@ -835,6 +835,7 @@ Void_t *(*__morecore)() = __default_morecore;
|
||||
#define mmap __mmap
|
||||
#define munmap __munmap
|
||||
#define mremap __mremap
|
||||
#define mprotect __mprotect
|
||||
#undef malloc_getpagesize
|
||||
#define malloc_getpagesize __getpagesize()
|
||||
|
||||
@@ -874,6 +875,8 @@ extern Void_t* sbrk();
|
||||
#define mALLOC_STATs __malloc_stats
|
||||
#define mALLOC_USABLE_SIZe __malloc_usable_size
|
||||
#define mALLOC_TRIm __malloc_trim
|
||||
#define mALLOC_GET_STATe __malloc_get_state
|
||||
#define mALLOC_SET_STATe __malloc_set_state
|
||||
|
||||
#else
|
||||
|
||||
@@ -889,6 +892,8 @@ extern Void_t* sbrk();
|
||||
#define mALLOC_STATs malloc_stats
|
||||
#define mALLOC_USABLE_SIZe malloc_usable_size
|
||||
#define mALLOC_TRIm malloc_trim
|
||||
#define mALLOC_GET_STATe malloc_get_state
|
||||
#define mALLOC_SET_STATe malloc_set_state
|
||||
|
||||
#endif
|
||||
|
||||
@@ -912,7 +917,11 @@ size_t mALLOC_USABLE_SIZe(Void_t*);
|
||||
void mALLOC_STATs(void);
|
||||
int mALLOPt(int, int);
|
||||
struct mallinfo mALLINFo(void);
|
||||
#else
|
||||
Void_t* mALLOC_GET_STATe(void);
|
||||
int mALLOC_SET_STATe(Void_t*);
|
||||
|
||||
#else /* !__STD_C */
|
||||
|
||||
#ifndef _LIBC
|
||||
void ptmalloc_init();
|
||||
#endif
|
||||
@@ -929,7 +938,10 @@ size_t mALLOC_USABLE_SIZe();
|
||||
void mALLOC_STATs();
|
||||
int mALLOPt();
|
||||
struct mallinfo mALLINFo();
|
||||
#endif
|
||||
Void_t* mALLOC_GET_STATe();
|
||||
int mALLOC_SET_STATe();
|
||||
|
||||
#endif /* __STD_C */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -1789,11 +1801,16 @@ new_heap(size) size_t size;
|
||||
unsigned long ul;
|
||||
heap_info *h;
|
||||
|
||||
if(size < HEAP_MIN_SIZE)
|
||||
if(size+top_pad < HEAP_MIN_SIZE)
|
||||
size = HEAP_MIN_SIZE;
|
||||
size = (size + page_mask) & ~page_mask;
|
||||
if(size > HEAP_MAX_SIZE)
|
||||
else if(size+top_pad <= HEAP_MAX_SIZE)
|
||||
size += top_pad;
|
||||
else if(size > HEAP_MAX_SIZE)
|
||||
return 0;
|
||||
else
|
||||
size = HEAP_MAX_SIZE;
|
||||
size = (size + page_mask) & ~page_mask;
|
||||
|
||||
p1 = (char *)MMAP(HEAP_MAX_SIZE<<1, PROT_NONE);
|
||||
if(p1 == (char *)-1)
|
||||
return 0;
|
||||
@@ -2216,9 +2233,11 @@ static void malloc_extend_top(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb;
|
||||
(brk < old_end && old_top != initial_top(&main_arena)))
|
||||
return;
|
||||
|
||||
#if defined(_LIBC) || defined(MALLOC_HOOKS)
|
||||
/* Call the `morecore' hook if necessary. */
|
||||
if (__after_morecore_hook)
|
||||
(*__after_morecore_hook) ();
|
||||
#endif
|
||||
|
||||
sbrked_mem += sbrk_size;
|
||||
|
||||
@@ -2248,9 +2267,11 @@ static void malloc_extend_top(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb;
|
||||
new_brk = (char*)(MORECORE (correction));
|
||||
if (new_brk == (char*)(MORECORE_FAILURE)) return;
|
||||
|
||||
#if defined(_LIBC) || defined(MALLOC_HOOKS)
|
||||
/* Call the `morecore' hook if necessary. */
|
||||
if (__after_morecore_hook)
|
||||
(*__after_morecore_hook) ();
|
||||
(*__after_morecore_hook) ();
|
||||
#endif
|
||||
|
||||
sbrked_mem += correction;
|
||||
|
||||
@@ -2291,7 +2312,7 @@ static void malloc_extend_top(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb;
|
||||
}
|
||||
|
||||
/* A new heap must be created. */
|
||||
heap = new_heap(nb + top_pad + (MINSIZE + sizeof(*heap)));
|
||||
heap = new_heap(nb + (MINSIZE + sizeof(*heap)));
|
||||
if(!heap)
|
||||
return;
|
||||
heap->ar_ptr = ar_ptr;
|
||||
@@ -2413,12 +2434,21 @@ Void_t* mALLOc(bytes) size_t bytes;
|
||||
#endif
|
||||
|
||||
nb = request2size(bytes);
|
||||
arena_get(ar_ptr, nb + top_pad);
|
||||
arena_get(ar_ptr, nb);
|
||||
if(!ar_ptr)
|
||||
return 0;
|
||||
victim = chunk_alloc(ar_ptr, nb);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
return victim ? chunk2mem(victim) : 0;
|
||||
if(!victim) {
|
||||
/* Maybe the failure is due to running out of mmapped areas. */
|
||||
if(ar_ptr != &main_arena) {
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
victim = chunk_alloc(&main_arena, nb);
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
}
|
||||
if(!victim) return 0;
|
||||
}
|
||||
return chunk2mem(victim);
|
||||
}
|
||||
|
||||
static mchunkptr
|
||||
@@ -2780,8 +2810,6 @@ chunk_free(ar_ptr, p) arena *ar_ptr; mchunkptr p;
|
||||
return;
|
||||
}
|
||||
|
||||
set_head(next, nextsz); /* clear inuse bit */
|
||||
|
||||
islr = 0;
|
||||
|
||||
if (!(hd & PREV_INUSE)) /* consolidate backward */
|
||||
@@ -2808,12 +2836,29 @@ chunk_free(ar_ptr, p) arena *ar_ptr; mchunkptr p;
|
||||
}
|
||||
else
|
||||
unlink(next, bck, fwd);
|
||||
|
||||
next = chunk_at_offset(p, sz);
|
||||
}
|
||||
else
|
||||
set_head(next, nextsz); /* clear inuse bit */
|
||||
|
||||
set_head(p, sz | PREV_INUSE);
|
||||
set_foot(p, sz);
|
||||
next->prev_size = sz;
|
||||
if (!islr)
|
||||
frontlink(ar_ptr, p, sz, idx, bck, fwd);
|
||||
|
||||
#ifndef NO_THREADS
|
||||
/* Check whether the heap containing top can go away now. */
|
||||
if(next->size < MINSIZE &&
|
||||
(unsigned long)sz > trim_threshold &&
|
||||
ar_ptr != &main_arena) { /* fencepost */
|
||||
heap_info* heap = heap_for_ptr(top(ar_ptr));
|
||||
|
||||
if(top(ar_ptr) == chunk_at_offset(heap, sizeof(*heap)) &&
|
||||
heap->prev == heap_for_ptr(p))
|
||||
heap_trim(heap, top_pad);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -3051,8 +3096,16 @@ arena* ar_ptr; mchunkptr oldp; INTERNAL_SIZE_T oldsize, nb;
|
||||
|
||||
newp = chunk_alloc (ar_ptr, nb);
|
||||
|
||||
if (newp == 0) /* propagate failure */
|
||||
return 0;
|
||||
if (newp == 0) {
|
||||
/* Maybe the failure is due to running out of mmapped areas. */
|
||||
if (ar_ptr != &main_arena) {
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
newp = chunk_alloc(&main_arena, nb);
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
}
|
||||
if (newp == 0) /* propagate failure */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Avoid copy if newp is next chunk after oldp. */
|
||||
/* (This can only happen when new chunk is sbrk'ed.) */
|
||||
@@ -3147,7 +3200,16 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;
|
||||
return 0;
|
||||
p = chunk_align(ar_ptr, nb, alignment);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
return p ? chunk2mem(p) : NULL;
|
||||
if(!p) {
|
||||
/* Maybe the failure is due to running out of mmapped areas. */
|
||||
if(ar_ptr != &main_arena) {
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
p = chunk_align(&main_arena, nb, alignment);
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
}
|
||||
if(!p) return 0;
|
||||
}
|
||||
return chunk2mem(p);
|
||||
}
|
||||
|
||||
static mchunkptr
|
||||
@@ -3317,31 +3379,34 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
|
||||
/* Only clearing follows, so we can unlock early. */
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
|
||||
if (p == 0)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
mem = chunk2mem(p);
|
||||
if (p == 0) {
|
||||
/* Maybe the failure is due to running out of mmapped areas. */
|
||||
if(ar_ptr != &main_arena) {
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
p = chunk_alloc(&main_arena, sz);
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
}
|
||||
if (p == 0) return 0;
|
||||
}
|
||||
mem = chunk2mem(p);
|
||||
|
||||
/* Two optional cases in which clearing not necessary */
|
||||
/* Two optional cases in which clearing not necessary */
|
||||
|
||||
#if HAVE_MMAP
|
||||
if (chunk_is_mmapped(p)) return mem;
|
||||
if (chunk_is_mmapped(p)) return mem;
|
||||
#endif
|
||||
|
||||
csz = chunksize(p);
|
||||
csz = chunksize(p);
|
||||
|
||||
#if MORECORE_CLEARS
|
||||
if (p == oldtop && csz > oldtopsize)
|
||||
{
|
||||
/* clear only the bytes from non-freshly-sbrked memory */
|
||||
csz = oldtopsize;
|
||||
}
|
||||
if (p == oldtop && csz > oldtopsize) {
|
||||
/* clear only the bytes from non-freshly-sbrked memory */
|
||||
csz = oldtopsize;
|
||||
}
|
||||
#endif
|
||||
|
||||
MALLOC_ZERO(mem, csz - SIZE_SZ);
|
||||
return mem;
|
||||
}
|
||||
MALLOC_ZERO(mem, csz - SIZE_SZ);
|
||||
return mem;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3432,9 +3497,11 @@ main_trim(pad) size_t pad;
|
||||
|
||||
new_brk = (char*)(MORECORE (-extra));
|
||||
|
||||
#if defined(_LIBC) || defined(MALLOC_HOOKS)
|
||||
/* Call the `morecore' hook if necessary. */
|
||||
if (__after_morecore_hook)
|
||||
(*__after_morecore_hook) ();
|
||||
#endif
|
||||
|
||||
if (new_brk == (char*)(MORECORE_FAILURE)) { /* sbrk failed? */
|
||||
/* Try to figure out what we have */
|
||||
@@ -3680,8 +3747,9 @@ void mALLOC_STATs()
|
||||
#endif
|
||||
#if !defined(NO_THREADS) && MALLOC_DEBUG > 1
|
||||
if(ar_ptr != &main_arena) {
|
||||
heap_info* heap;
|
||||
(void)mutex_lock(&ar_ptr->mutex);
|
||||
heap_info *heap = heap_for_ptr(top(ar_ptr));
|
||||
heap = heap_for_ptr(top(ar_ptr));
|
||||
while(heap) { dump_heap(heap); heap = heap->prev; }
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
}
|
||||
@@ -3697,6 +3765,7 @@ void mALLOC_STATs()
|
||||
#endif
|
||||
#if HAVE_MMAP
|
||||
fprintf(stderr, "max mmap regions = %10u\n", (unsigned int)max_n_mmaps);
|
||||
fprintf(stderr, "max mmap bytes = %10lu\n", max_mmapped_mem);
|
||||
#endif
|
||||
#if THREAD_STATS
|
||||
fprintf(stderr, "heaps created = %10d\n", stat_n_heaps);
|
||||
@@ -3775,6 +3844,144 @@ int mALLOPt(param_number, value) int param_number; int value;
|
||||
|
||||
|
||||
|
||||
/* Get/set state: malloc_get_state() records the current state of all
|
||||
malloc variables (_except_ for the actual heap contents and `hook'
|
||||
function pointers) in a system dependent, opaque data structure.
|
||||
This data structure is dynamically allocated and can be free()d
|
||||
after use. malloc_set_state() restores the state of all malloc
|
||||
variables to the previously obtained state. This is especially
|
||||
useful when using this malloc as part of a shared library, and when
|
||||
the heap contents are saved/restored via some other method. The
|
||||
primary example for this is GNU Emacs with its `dumping' procedure.
|
||||
`Hook' function pointers are never saved or restored by these
|
||||
functions. */
|
||||
|
||||
#define MALLOC_STATE_MAGIC 0x444c4541l
|
||||
#define MALLOC_STATE_VERSION (0*0x100l + 0l) /* major*0x100 + minor */
|
||||
|
||||
struct malloc_state {
|
||||
long magic;
|
||||
long version;
|
||||
mbinptr av[NAV * 2 + 2];
|
||||
char* sbrk_base;
|
||||
int sbrked_mem_bytes;
|
||||
unsigned long trim_threshold;
|
||||
unsigned long top_pad;
|
||||
unsigned int n_mmaps_max;
|
||||
unsigned long mmap_threshold;
|
||||
int check_action;
|
||||
unsigned long max_sbrked_mem;
|
||||
unsigned long max_total_mem;
|
||||
unsigned int n_mmaps;
|
||||
unsigned int max_n_mmaps;
|
||||
unsigned long mmapped_mem;
|
||||
unsigned long max_mmapped_mem;
|
||||
};
|
||||
|
||||
Void_t*
|
||||
mALLOC_GET_STATe()
|
||||
{
|
||||
mchunkptr victim;
|
||||
struct malloc_state* ms;
|
||||
int i;
|
||||
mbinptr b;
|
||||
|
||||
ptmalloc_init();
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
victim = chunk_alloc(&main_arena, request2size(sizeof(*ms)));
|
||||
if(!victim) {
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
return 0;
|
||||
}
|
||||
ms = (struct malloc_state*)chunk2mem(victim);
|
||||
ms->magic = MALLOC_STATE_MAGIC;
|
||||
ms->version = MALLOC_STATE_VERSION;
|
||||
ms->av[0] = main_arena.av[0];
|
||||
ms->av[1] = main_arena.av[1];
|
||||
for(i=0; i<NAV; i++) {
|
||||
b = bin_at(&main_arena, i);
|
||||
if(first(b) == b)
|
||||
ms->av[2*i+2] = ms->av[2*i+3] = 0; /* empty bin (or initial top) */
|
||||
else {
|
||||
ms->av[2*i+2] = first(b);
|
||||
ms->av[2*i+3] = last(b);
|
||||
}
|
||||
}
|
||||
ms->sbrk_base = sbrk_base;
|
||||
ms->sbrked_mem_bytes = sbrked_mem;
|
||||
ms->trim_threshold = trim_threshold;
|
||||
ms->top_pad = top_pad;
|
||||
ms->n_mmaps_max = n_mmaps_max;
|
||||
ms->mmap_threshold = mmap_threshold;
|
||||
ms->check_action = check_action;
|
||||
ms->max_sbrked_mem = max_sbrked_mem;
|
||||
#ifdef NO_THREADS
|
||||
ms->max_total_mem = max_total_mem;
|
||||
#else
|
||||
ms->max_total_mem = 0;
|
||||
#endif
|
||||
ms->n_mmaps = n_mmaps;
|
||||
ms->max_n_mmaps = max_n_mmaps;
|
||||
ms->mmapped_mem = mmapped_mem;
|
||||
ms->max_mmapped_mem = max_mmapped_mem;
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
return (Void_t*)ms;
|
||||
}
|
||||
|
||||
int
|
||||
#if __STD_C
|
||||
mALLOC_SET_STATe(Void_t* msptr)
|
||||
#else
|
||||
mALLOC_SET_STATe(msptr) Void_t* msptr;
|
||||
#endif
|
||||
{
|
||||
struct malloc_state* ms = (struct malloc_state*)msptr;
|
||||
int i;
|
||||
mbinptr b;
|
||||
|
||||
ptmalloc_init();
|
||||
if(ms->magic != MALLOC_STATE_MAGIC) return -1;
|
||||
/* Must fail if the major version is too high. */
|
||||
if((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl)) return -2;
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
main_arena.av[0] = ms->av[0];
|
||||
main_arena.av[1] = ms->av[1];
|
||||
for(i=0; i<NAV; i++) {
|
||||
b = bin_at(&main_arena, i);
|
||||
if(ms->av[2*i+2] == 0)
|
||||
first(b) = last(b) = b;
|
||||
else {
|
||||
first(b) = ms->av[2*i+2];
|
||||
last(b) = ms->av[2*i+3];
|
||||
if(i > 0) {
|
||||
/* Make sure the links to the `av'-bins in the heap are correct. */
|
||||
first(b)->bk = b;
|
||||
last(b)->fd = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
sbrk_base = ms->sbrk_base;
|
||||
sbrked_mem = ms->sbrked_mem_bytes;
|
||||
trim_threshold = ms->trim_threshold;
|
||||
top_pad = ms->top_pad;
|
||||
n_mmaps_max = ms->n_mmaps_max;
|
||||
mmap_threshold = ms->mmap_threshold;
|
||||
check_action = ms->check_action;
|
||||
max_sbrked_mem = ms->max_sbrked_mem;
|
||||
#ifdef NO_THREADS
|
||||
max_total_mem = ms->max_total_mem;
|
||||
#endif
|
||||
n_mmaps = ms->n_mmaps;
|
||||
max_n_mmaps = ms->max_n_mmaps;
|
||||
mmapped_mem = ms->mmapped_mem;
|
||||
max_mmapped_mem = ms->max_mmapped_mem;
|
||||
/* add version-dependent code here */
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(_LIBC) || defined(MALLOC_HOOKS)
|
||||
|
||||
/* A simple, standard set of debugging hooks. Overhead is `only' one
|
||||
@@ -4048,12 +4255,19 @@ weak_alias (__libc_mallopt, __mallopt) weak_alias (__libc_mallopt, mallopt)
|
||||
weak_alias (__malloc_stats, malloc_stats)
|
||||
weak_alias (__malloc_usable_size, malloc_usable_size)
|
||||
weak_alias (__malloc_trim, malloc_trim)
|
||||
weak_alias (__malloc_get_state, malloc_get_state)
|
||||
weak_alias (__malloc_set_state, malloc_set_state)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
History:
|
||||
|
||||
V2.6.4-pt3 Thu Feb 20 1997 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de)
|
||||
* Added malloc_get/set_state() (mainly for use in GNU emacs),
|
||||
using interface from Marcus Daniels
|
||||
* All parameters are now adjustable via environment variables
|
||||
|
||||
V2.6.4-pt2 Sat Dec 14 1996 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de)
|
||||
* Added debugging hooks
|
||||
* Fixed possible deadlock in realloc() when out of memory
|
||||
|
||||
@@ -171,6 +171,13 @@ extern size_t malloc_usable_size __MALLOC_P ((__malloc_ptr_t __ptr));
|
||||
/* Prints brief summary statistics on stderr. */
|
||||
extern void malloc_stats __MALLOC_P ((void));
|
||||
|
||||
/* Record the state of all malloc variables in an opaque data structure. */
|
||||
extern __malloc_ptr_t malloc_get_state __MALLOC_P ((void));
|
||||
|
||||
/* Restore the state of all malloc variables from data obtained with
|
||||
malloc_get_state(). */
|
||||
extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr));
|
||||
|
||||
#if defined(__GLIBC__) || defined(MALLOC_HOOKS)
|
||||
|
||||
/* Hooks for debugging versions. */
|
||||
|
||||
+6
-2
@@ -1,5 +1,5 @@
|
||||
/* obstack.c - subroutines used implicitly by object stack macros
|
||||
Copyright (C) 1988,89,90,91,92,93,94,96 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
@@ -19,6 +19,10 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "obstack.h"
|
||||
|
||||
/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
|
||||
@@ -85,7 +89,7 @@ void (*obstack_alloc_failed_handler) () = print_and_abort;
|
||||
#endif
|
||||
|
||||
/* Exit value used when `print_and_abort' is used. */
|
||||
#if defined (__STDC__) && __STDC__
|
||||
#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifndef EXIT_FAILURE
|
||||
|
||||
+12
-3
@@ -106,6 +106,10 @@ Summary:
|
||||
|
||||
#ifndef __OBSTACK_H__
|
||||
#define __OBSTACK_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* We use subtraction of (char *) 0 instead of casting to int
|
||||
because on word-addressable machines a simple cast to int
|
||||
@@ -303,13 +307,14 @@ extern int obstack_exit_failure;
|
||||
|
||||
#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
|
||||
_obstack_begin_1 ((h), (size), (alignment), \
|
||||
(void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun), (arg))
|
||||
(void *(*) (void *, long)) (chunkfun), \
|
||||
(void (*) (void *, void *)) (freefun), (arg))
|
||||
|
||||
#define obstack_chunkfun(h, newchunkfun) \
|
||||
((h) -> chunkfun = (struct _obstack_chunk *(*)(long)) (newchunkfun))
|
||||
((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))
|
||||
|
||||
#define obstack_freefun(h, newfreefun) \
|
||||
((h) -> freefun = (void (*)(void *)) (newfreefun))
|
||||
((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
|
||||
|
||||
#else
|
||||
|
||||
@@ -578,4 +583,8 @@ __extension__ \
|
||||
|
||||
#endif /* not __GNUC__ or not __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* C++ */
|
||||
#endif
|
||||
|
||||
#endif /* not __OBSTACK_H__ */
|
||||
|
||||
+27
-9
@@ -1,6 +1,6 @@
|
||||
/* Basic platform-independent macro definitions for mutexes and
|
||||
thread-specific data.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>, 1996.
|
||||
|
||||
@@ -66,19 +66,37 @@ static Void_t *malloc_key_data;
|
||||
(__pthread_mutex_unlock != NULL ? __pthread_mutex_unlock (m) : 0)
|
||||
|
||||
#elif defined(MUTEX_INITIALIZER)
|
||||
/* Assume hurd, with cthreads */
|
||||
|
||||
typedef thread_t thread_id;
|
||||
/* Cthreads `mutex_t' is a pointer to a mutex, and malloc wants just the
|
||||
mutex itself. */
|
||||
#undef mutex_t
|
||||
#define mutex_t struct mutex
|
||||
|
||||
/* mutex */
|
||||
typedef mutex_t mutex_t;
|
||||
#undef mutex_lock
|
||||
#define mutex_lock(m) (__mutex_lock(m), 0)
|
||||
|
||||
#undef mutex_unlock
|
||||
#define mutex_unlock(m) (__mutex_unlock(m), 0)
|
||||
|
||||
#define mutex_trylock(m) (!__mutex_trylock(m))
|
||||
|
||||
#include <hurd/threadvar.h>
|
||||
|
||||
/* thread specific data */
|
||||
typedef pthread_key_t tsd_key_t;
|
||||
typedef int tsd_key_t;
|
||||
|
||||
#define mutex_init(m) __mutex_init (m)
|
||||
#define mutex_lock(m) __mutex_lock (m)
|
||||
#define mutex_trylock(m) __mutex_trylock (m)
|
||||
#define mutex_unlock(m) __mutex_unlock (m)
|
||||
static int tsd_keys_alloced = 0;
|
||||
|
||||
#define tsd_key_create(key, destr) \
|
||||
(assert (tsd_keys_alloced == 0), tsd_keys_alloced++)
|
||||
#define tsd_setspecific(key, data) \
|
||||
(*__hurd_threadvar_location (_HURD_THREADVAR_MALLOC) = (unsigned long)(data))
|
||||
#define tsd_getspecific(key, vptr) \
|
||||
((vptr) = (void *)*__hurd_threadvar_location (_HURD_THREADVAR_MALLOC))
|
||||
|
||||
/* No we're *not* using pthreads. */
|
||||
#define __pthread_initialize ((void (*)(void))0)
|
||||
|
||||
#else
|
||||
|
||||
|
||||
+12
-1
@@ -21,6 +21,9 @@
|
||||
subdir := manual
|
||||
export subdir := $(subdir)
|
||||
|
||||
# We need GNU awk for the xtract-typefun script.
|
||||
GAWK = gawk
|
||||
|
||||
.PHONY: all dvi info
|
||||
all: dvi info
|
||||
dvi: libc.dvi
|
||||
@@ -60,6 +63,13 @@ stamp-summary: summary.awk $(chapters) $(chapters-incl)
|
||||
# touch is broken on our machines. Sigh.
|
||||
date > $@
|
||||
|
||||
# Generate a file which can be added to the `dir' content to provide direct
|
||||
# access to the documentation of the function, variables, and other
|
||||
# definitions.
|
||||
dir-add.texi: xtract-typefun.awk $(chapters)
|
||||
$(GAWK) -f $^ | sort > $@.new;
|
||||
mv -f $@.new $@
|
||||
|
||||
# Generate Texinfo files from the C source for the example programs.
|
||||
%.c.texi: examples/%.c
|
||||
sed -e 's,[{}],@&,g' \
|
||||
@@ -78,7 +88,8 @@ distribute = $(minimal-dist) \
|
||||
$(patsubst examples/%.c,%.c.texi,$(filter examples/%.c, \
|
||||
$(minimal-dist))) \
|
||||
libc.info* libc.?? libc.??s texinfo.tex summary.texi \
|
||||
stamp-summary chapters chapters-incl
|
||||
stamp-summary chapters chapters-incl \
|
||||
xtract-typefun.awk
|
||||
export distribute := $(distribute)
|
||||
|
||||
tar-it = tar chovf $@ $^
|
||||
|
||||
@@ -1214,6 +1214,25 @@ overwritten. (But it's guaranteed that no library function ever calls
|
||||
The function @code{strerror} is declared in @file{string.h}.
|
||||
@end deftypefun
|
||||
|
||||
@comment string.h
|
||||
@comment GNU
|
||||
@deftypefun {char *} strerror_r (int @var{errnum}, char *@var{buf}, size_t @var{n})
|
||||
The @code{strerror_r} function works like @code{strerror} but instead of
|
||||
returning the error message in a statically allocated buffer shared by
|
||||
all threads in the process, it writes the message string in the user
|
||||
supplied buffer starting at @var{buf} with the length of @var{n} bytes.
|
||||
|
||||
At most @var{n} characters are written (including the NUL byte) so it is
|
||||
up to the user to select the buffer large enough.
|
||||
|
||||
This function should always be used in multi-threaded programs since
|
||||
there is no way to guarantee the string returned by @code{strerror}
|
||||
really belongs to the last call of the current thread.
|
||||
|
||||
This function @code{strerror_r} is a GNU extension and it is declared in
|
||||
@file{string.h}.
|
||||
@end deftypefun
|
||||
|
||||
@comment stdio.h
|
||||
@comment ISO
|
||||
@deftypefun void perror (const char *@var{message})
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*@group*/
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
/*@end group*/
|
||||
|
||||
static int
|
||||
one (struct dirent *unused)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
struct dirent **eps;
|
||||
int n;
|
||||
|
||||
n = scandir ("./", &eps, one, alphasort);
|
||||
if (n >= 0)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt < n; ++cnt)
|
||||
puts (eps[cnt]->d_name);
|
||||
}
|
||||
else
|
||||
perror ("Couldn't open the directory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
+68
-2
@@ -166,6 +166,9 @@ parallels here to the stream facilities for ordinary files, described in
|
||||
* Simple Directory Lister:: A very simple directory listing program.
|
||||
* Random Access Directory:: Rereading part of the directory
|
||||
already read with the same stream.
|
||||
* Scanning Directory Content:: Get entries for user selected subset of
|
||||
contents in given directory.
|
||||
* Simple Directory Lister Mark II:: Revised version of the program.
|
||||
@end menu
|
||||
|
||||
@node Directory Entries
|
||||
@@ -386,9 +389,9 @@ the current working directory:
|
||||
|
||||
The order in which files appear in a directory tends to be fairly
|
||||
random. A more useful program would sort the entries (perhaps by
|
||||
alphabetizing them) before printing them; see @ref{Array Sort Function}.
|
||||
alphabetizing them) before printing them; see
|
||||
@ref{Scanning Directory Content} and @ref{Array Sort Function}.
|
||||
|
||||
@c ??? not documented: scandir, alphasort
|
||||
|
||||
@node Random Access Directory
|
||||
@subsection Random Access in a Directory Stream
|
||||
@@ -429,6 +432,69 @@ closing and reopening the directory can invalidate values returned by
|
||||
@code{telldir}.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
@node Scanning Directory Content
|
||||
@subsection Scanning the Content of a Directory
|
||||
|
||||
A higher-level interface to the directory handling functions is the
|
||||
@code{scandir} function. With its help one can select a subset of the
|
||||
entries in a directory, possibly sort them and get as the result a list
|
||||
of names.
|
||||
|
||||
@deftypefun int scandir (const char *@var{dir}, struct dirent ***@var{namelist}, int (*@var{selector}) (struct dirent *), int (*@var{cmp}) (const void *, const void *))
|
||||
|
||||
The @code{scandir} function scans the contents of the directory selected
|
||||
by @var{dir}. The result in @var{namelist} is an array of pointers to
|
||||
structure of type @code{struct dirent} which describe all selected
|
||||
directory entries and which is allocated using @code{malloc}. Instead
|
||||
of always getting all directory entries returned, the user supplied
|
||||
function @var{selector} can be used to decide which entries are in the
|
||||
result. Only the entries for which @var{selector} returns a nonzero
|
||||
value are selected.
|
||||
|
||||
Finally the entries in the @var{namelist} are sorted using the user
|
||||
supplied function @var{cmp}. The arguments of the @var{cmp} function
|
||||
are of type @code{struct dirent **}. I.e., one cannot directly use the
|
||||
@code{strcmp} or @code{strcoll} function; see the function
|
||||
@code{alphasort} below.
|
||||
|
||||
The return value of the function gives the number of entries placed in
|
||||
@var{namelist}. If it is @code{-1} an error occurred and the global
|
||||
variable @code{errno} contains more information on the error.
|
||||
@end deftypefun
|
||||
|
||||
As said above the fourth argument to the @code{scandir} function must be
|
||||
a pointer to a sorting function. For the convenience of the programmer
|
||||
the GNU C library contains an implementation of a function which is very
|
||||
helpful for this purpose.
|
||||
|
||||
@deftypefun int alphasort (const void *@var{a}, const void *@var{b})
|
||||
The @code{alphasort} function behaves like the @code{strcmp} function
|
||||
(@pxref{String/Array Comparison}). The difference is that the arguments
|
||||
are not string pointers but instead they are of type
|
||||
@code{struct dirent **}.
|
||||
|
||||
Return value of is less than, equal to, or greater than zero depending
|
||||
on the order of the two entries @var{a} and @var{b}.
|
||||
@end deftypefun
|
||||
|
||||
@node Simple Directory Lister Mark II
|
||||
@subsection Simple Program to List a Directory, Mark II
|
||||
|
||||
Here is a revised version of the directory lister found above
|
||||
(@pxref{Simple Directory Lister}). Using the @code{scandir} function we
|
||||
can avoid using the functions which directly work with the directory
|
||||
contents. After the call the found entries are available for direct
|
||||
used.
|
||||
|
||||
@smallexample
|
||||
@include dir2.c.texi
|
||||
@end smallexample
|
||||
|
||||
Please note the simple selector function for this example. Since
|
||||
we want to see all directory entries we always return @code{1}.
|
||||
|
||||
|
||||
@node Hard Links
|
||||
@section Hard Links
|
||||
@cindex hard link
|
||||
|
||||
@@ -210,7 +210,6 @@ Memory Allocation
|
||||
calling function returns.
|
||||
* Relocating Allocator:: Waste less memory, if you can tolerate
|
||||
automatic relocation of the blocks you get.
|
||||
* Memory Warnings:: Getting warnings when memory is nearly full.
|
||||
|
||||
Unconstrained Allocation
|
||||
|
||||
|
||||
+24
-11
@@ -206,11 +206,11 @@ compiler. We recommend GCC version 2.7.2 or later; earlier versions may
|
||||
have problems.
|
||||
|
||||
@item
|
||||
@code{binutils} 2.7
|
||||
@code{binutils} 2.8
|
||||
|
||||
Using the GNU @code{binutils} (assembler, linker, and related tools) is
|
||||
preferable when possible, and they are required to build an ELF shared C
|
||||
library. We recommend @code{binutils} version 2.7 or later; earlier
|
||||
library. We recommend @code{binutils} version 2.8 or later; earlier
|
||||
versions are known to have problems or to not support all architectures.
|
||||
@end itemize
|
||||
|
||||
@@ -222,14 +222,21 @@ The GNU C Library currently supports configurations that match the
|
||||
following patterns:
|
||||
|
||||
@smallexample
|
||||
alpha-dec-osf1
|
||||
alpha-@var{anything}-linux
|
||||
alpha-@var{anything}-linuxecoff
|
||||
i@var{x}86-@var{anything}-bsd4.3
|
||||
i@var{x}86-@var{anything}-gnu
|
||||
i@var{x}86-@var{anything}-linux
|
||||
m68k-@var{anything}-linux
|
||||
@end smallexample
|
||||
|
||||
Former releases of this library (version 1.09.1 and perhaps earlier
|
||||
versions) used to run on the following configurations:
|
||||
|
||||
@smallexample
|
||||
alpha-dec-osf1
|
||||
i@var{x}86-@var{anything}-bsd4.3
|
||||
i@var{x}86-@var{anything}-isc2.2
|
||||
i@var{x}86-@var{anything}-isc3.@var{n}
|
||||
i@var{x}86-@var{anything}-linux
|
||||
i@var{x}86-@var{anything}-sco3.2
|
||||
i@var{x}86-@var{anything}-sco3.2v4
|
||||
i@var{x}86-@var{anything}-sysv
|
||||
@@ -249,8 +256,14 @@ sparc-sun-solaris2.@var{n}
|
||||
sparc-sun-sunos4.@var{n}
|
||||
@end smallexample
|
||||
|
||||
Since no one has volunteered to test and fix the above configurations,
|
||||
these are not supported at the moment. It's expected that these don't
|
||||
work anymore. Porting the library is not hard. If you are interested
|
||||
in doing a port, please contact the glibc maintainers by sending
|
||||
electronic mail to @email{bug-glibc@@prep.ai.mit.edu}.
|
||||
|
||||
Each case of @samp{i@var{x}86} can be @samp{i386}, @samp{i486},
|
||||
@samp{i586}, or @samp{i686}.. All of those configurations produce a
|
||||
@samp{i586}, or @samp{i686}. All of those configurations produce a
|
||||
library that can run on any of these processors. The library will be
|
||||
optimized for the specified processor, but will not use instructions not
|
||||
available on all of them.
|
||||
@@ -309,8 +322,8 @@ conform to the ISO and POSIX standards (@pxref{Standards and
|
||||
Portability}), that is definitely a bug. Report it!@refill
|
||||
|
||||
Send bug reports to the Internet address
|
||||
@samp{bug-glibc@@prep.ai.mit.edu} or the UUCP path
|
||||
@samp{mit-eddie!prep.ai.mit.edu!bug-glibc}. If you have other problems
|
||||
@email{bug-glibc@@prep.ai.mit.edu} or the UUCP path
|
||||
@email{mit-eddie!prep.ai.mit.edu!bug-glibc}. If you have other problems
|
||||
with installation or use, please report those as well.@refill
|
||||
|
||||
If you are not sure how a function should behave, and this manual
|
||||
@@ -318,8 +331,8 @@ doesn't tell you, that's a bug in the manual. Report that too! If the
|
||||
function's behavior disagrees with the manual, then either the library
|
||||
or the manual has a bug, so report the disagreement. If you find any
|
||||
errors or omissions in this manual, please report them to the Internet
|
||||
address @samp{bug-glibc-manual@@prep.ai.mit.edu} or the UUCP path
|
||||
@samp{mit-eddie!prep.ai.mit.edu!bug-glibc-manual}.
|
||||
address @email{bug-glibc-manual@@prep.ai.mit.edu} or the UUCP path
|
||||
@email{mit-eddie!prep.ai.mit.edu!bug-glibc-manual}.
|
||||
|
||||
@node Source Layout
|
||||
@appendixsec Adding New Functions
|
||||
@@ -1060,7 +1073,7 @@ Carnegie Mellon requests users of this software to return to
|
||||
@end display
|
||||
|
||||
@noindent
|
||||
or @samp{Software.Distribution@@CS.CMU.EDU} any improvements or
|
||||
or @email{Software.Distribution@@CS.CMU.EDU} any improvements or
|
||||
extensions that they make and grant Carnegie Mellon the rights to
|
||||
redistribute these changes.
|
||||
@end quotation
|
||||
|
||||
+133
-42
@@ -38,7 +38,6 @@ will be freed automatically. @xref{Variable Size Automatic}.
|
||||
calling function returns.
|
||||
* Relocating Allocator:: Waste less memory, if you can tolerate
|
||||
automatic relocation of the blocks you get.
|
||||
* Memory Warnings:: Getting warnings when memory is nearly full.
|
||||
@end menu
|
||||
|
||||
@node Memory Concepts
|
||||
@@ -140,6 +139,8 @@ any time (or never).
|
||||
these functions.
|
||||
* Aligned Memory Blocks:: Allocating specially aligned memory:
|
||||
@code{memalign} and @code{valloc}.
|
||||
* Malloc Tunable Parameters:: Use @code{mallopt} to adjust allocation
|
||||
parameters.
|
||||
* Heap Consistency Checking:: Automatic checking for errors.
|
||||
* Hooks for Malloc:: You can use these hooks for debugging
|
||||
programs that use @code{malloc}.
|
||||
@@ -238,10 +239,10 @@ savestring (const char *ptr, size_t len)
|
||||
|
||||
The block that @code{malloc} gives you is guaranteed to be aligned so
|
||||
that it can hold any type of data. In the GNU system, the address is
|
||||
always a multiple of eight; if the size of block is 16 or more, then the
|
||||
address is always a multiple of 16. Only rarely is any higher boundary
|
||||
(such as a page boundary) necessary; for those cases, use
|
||||
@code{memalign} or @code{valloc} (@pxref{Aligned Memory Blocks}).
|
||||
always a multiple of eight on most systems, and a multiple of 16 on
|
||||
64-bit systems. Only rarely is any higher boundary (such as a page
|
||||
boundary) necessary; for those cases, use @code{memalign} or
|
||||
@code{valloc} (@pxref{Aligned Memory Blocks}).
|
||||
|
||||
Note that the memory located after the end of the block is likely to be
|
||||
in use for something else; perhaps a block already allocated by another
|
||||
@@ -368,9 +369,11 @@ xrealloc (void *ptr, size_t size)
|
||||
@end smallexample
|
||||
|
||||
You can also use @code{realloc} to make a block smaller. The reason you
|
||||
would do this is to avoid tying up a lot of memory space when only a little
|
||||
is needed. Making a block smaller sometimes necessitates copying it, so it
|
||||
can fail if no other space is available.
|
||||
is needed.
|
||||
@comment The following is no longer true with the new malloc.
|
||||
@comment But it seems wise to keep the warning for other implementations.
|
||||
In several allocation implementations, making a block smaller sometimes
|
||||
necessitates copying it, so it can fail if no other space is available.
|
||||
|
||||
If the new size you specify is the same as the old size, @code{realloc}
|
||||
is guaranteed to change nothing and return the same address that you gave.
|
||||
@@ -404,10 +407,18 @@ calloc (size_t count, size_t eltsize)
|
||||
@}
|
||||
@end smallexample
|
||||
|
||||
But in general, it is not guaranteed that @code{calloc} calls
|
||||
@code{malloc} internally. Therefore, if an application provides its own
|
||||
@code{malloc}/@code{realloc}/@code{free} outside the C library, it
|
||||
should always define @code{calloc}, too.
|
||||
|
||||
@node Efficiency and Malloc
|
||||
@subsection Efficiency Considerations for @code{malloc}
|
||||
@cindex efficiency and @code{malloc}
|
||||
|
||||
@ignore
|
||||
|
||||
@c No longer true, see below instead.
|
||||
To make the best use of @code{malloc}, it helps to know that the GNU
|
||||
version of @code{malloc} always dispenses small amounts of memory in
|
||||
blocks whose sizes are powers of two. It keeps separate pools for each
|
||||
@@ -433,6 +444,24 @@ time using it. Also, large blocks are normally fewer in number.
|
||||
Therefore, for large blocks, it makes sense to use a method which takes
|
||||
more time to minimize the wasted space.
|
||||
|
||||
@end ignore
|
||||
|
||||
As apposed to other versions, the @code{malloc} in GNU libc does not
|
||||
round up block sizes to powers of two, neither for large nor for small
|
||||
sizes. Neighboring chunks can be coalesced on a @code{free} no matter
|
||||
what their size is. This makes the implementation suitable for all
|
||||
kinds of allocation patterns without generally incurring high memory
|
||||
waste through fragmentation.
|
||||
|
||||
Very large blocks (much larger than a page) are allocated with
|
||||
@code{mmap} (anonymous or via @code{/dev/zero}) by this implementation.
|
||||
This has the great advantage that these chunks are returned to the
|
||||
system immediately when they are freed. Therefore, it cannot happen
|
||||
that a large chunk becomes ``locked'' in between smaller ones and even
|
||||
after calling @code{free} wastes memory. The size threshold for
|
||||
@code{mmap} to be used can be adjusted with @code{mallopt}. The use of
|
||||
@code{mmap} can also be disabled completely.
|
||||
|
||||
@node Aligned Memory Blocks
|
||||
@subsection Allocating Aligned Memory Blocks
|
||||
|
||||
@@ -440,10 +469,10 @@ more time to minimize the wasted space.
|
||||
@cindex alignment (with @code{malloc})
|
||||
@pindex stdlib.h
|
||||
The address of a block returned by @code{malloc} or @code{realloc} in
|
||||
the GNU system is always a multiple of eight. If you need a block whose
|
||||
address is a multiple of a higher power of two than that, use
|
||||
@code{memalign} or @code{valloc}. These functions are declared in
|
||||
@file{stdlib.h}.
|
||||
the GNU system is always a multiple of eight (or sixteen on 64-bit
|
||||
systems). If you need a block whose address is a multiple of a higher
|
||||
power of two than that, use @code{memalign} or @code{valloc}. These
|
||||
functions are declared in @file{stdlib.h}.
|
||||
|
||||
With the GNU library, you can use @code{free} to free the blocks that
|
||||
@code{memalign} and @code{valloc} return. That does not work in BSD,
|
||||
@@ -454,9 +483,9 @@ however---BSD does not provide any way to free such blocks.
|
||||
@deftypefun {void *} memalign (size_t @var{boundary}, size_t @var{size})
|
||||
The @code{memalign} function allocates a block of @var{size} bytes whose
|
||||
address is a multiple of @var{boundary}. The @var{boundary} must be a
|
||||
power of two! The function @code{memalign} works by calling
|
||||
@code{malloc} to allocate a somewhat larger block, and then returning an
|
||||
address within the block that is on the specified boundary.
|
||||
power of two! The function @code{memalign} works by allocating a
|
||||
somewhat larger block, and then returning an address within the block
|
||||
that is on the specified boundary.
|
||||
@end deftypefun
|
||||
|
||||
@comment malloc.h stdlib.h
|
||||
@@ -475,6 +504,42 @@ valloc (size_t size)
|
||||
@c !!! xref getpagesize
|
||||
@end deftypefun
|
||||
|
||||
@node Malloc Tunable Parameters
|
||||
@subsection Malloc Tunable Parameters
|
||||
|
||||
You can adjust some parameters for dynamic memory allocation with the
|
||||
@code{mallopt} function. This function is the general SVID/XPG
|
||||
interface, defined in @file{malloc.h}.
|
||||
@pindex malloc.h
|
||||
|
||||
@deftypefun int mallopt (int @var{param}, int @var{value})
|
||||
When calling @code{mallopt}, the @var{param} argument specifies the
|
||||
parameter to be set, and @var{value} the new value to be set. Possible
|
||||
choices for @var{param}, as defined in @file{malloc.h}, are:
|
||||
|
||||
@table @code
|
||||
@item M_TRIM_THRESHOLD
|
||||
This is the minimum size (in bytes) of the top-most, releaseable chunk
|
||||
that will cause @code{sbrk} to be called with a negative argument in
|
||||
order to return memory to the system.
|
||||
@item M_TOP_PAD
|
||||
This parameter determines the amount of extra memory to obtain from the
|
||||
system when a call to @code{sbrk} is required. It also specifies the
|
||||
number of bytes to retain when shrinking the heap by calling @code{sbrk}
|
||||
with a negative argument. This provides the necessary hysteresis in
|
||||
heap size such that excessive amounts of system calls can be avoided.
|
||||
@item M_MMAP_THRESHOLD
|
||||
All chunks larger than this value are allocated outside the normal
|
||||
heap, using the @code{mmap} system call. This way it is guaranteed
|
||||
that the memory for these chunks can be returned to the system on
|
||||
@code{free}.
|
||||
@item M_MMAP_MAX
|
||||
The maximum number of chunks to allocate with @code{mmap}. Setting this
|
||||
to zero disables all use of @code{mmap}.
|
||||
@end table
|
||||
|
||||
@end deftypefun
|
||||
|
||||
@node Heap Consistency Checking
|
||||
@subsection Heap Consistency Checking
|
||||
|
||||
@@ -636,44 +701,62 @@ installing such hooks.
|
||||
|
||||
@cindex allocation statistics
|
||||
You can get information about dynamic storage allocation by calling the
|
||||
@code{mstats} function. This function and its associated data type are
|
||||
declared in @file{malloc.h}; they are a GNU extension.
|
||||
@code{mallinfo} function. This function and its associated data type
|
||||
are declared in @file{malloc.h}; they are an extension of the standard
|
||||
SVID/XPG version.
|
||||
@pindex malloc.h
|
||||
|
||||
@comment malloc.h
|
||||
@comment GNU
|
||||
@deftp {Data Type} {struct mstats}
|
||||
@deftp {Data Type} {struct mallinfo}
|
||||
This structure type is used to return information about the dynamic
|
||||
storage allocator. It contains the following members:
|
||||
|
||||
@table @code
|
||||
@item size_t bytes_total
|
||||
This is the total size of memory managed by @code{malloc}, in bytes.
|
||||
@item int arena
|
||||
This is the total size of memory allocated with @code{sbrk} by
|
||||
@code{malloc}, in bytes.
|
||||
|
||||
@item size_t chunks_used
|
||||
This is the number of chunks in use. (The storage allocator internally
|
||||
gets chunks of memory from the operating system, and then carves them up
|
||||
to satisfy individual @code{malloc} requests; see @ref{Efficiency and
|
||||
Malloc}.)
|
||||
@item int ordblks
|
||||
This is the number of chunks not in use. (The storage allocator
|
||||
internally gets chunks of memory from the operating system, and then
|
||||
carves them up to satisfy individual @code{malloc} requests; see
|
||||
@ref{Efficiency and Malloc}.)
|
||||
|
||||
@item size_t bytes_used
|
||||
This is the number of bytes in use.
|
||||
@item int smblks
|
||||
This field is unused.
|
||||
|
||||
@item size_t chunks_free
|
||||
This is the number of chunks which are free -- that is, that have been
|
||||
allocated by the operating system to your program, but which are not
|
||||
now being used.
|
||||
@item int hblks
|
||||
This is the total number of chunks allocated with @code{mmap}.
|
||||
|
||||
@item int hblkhd
|
||||
This is the total size of memory allocated with @code{mmap}, in bytes.
|
||||
|
||||
@item int usmblks
|
||||
This field is unused.
|
||||
|
||||
@item int fsmblks
|
||||
This field is unused.
|
||||
|
||||
@item int uordblks
|
||||
This is the total size of memory occupied by chunks handed out by
|
||||
@code{malloc}.
|
||||
|
||||
@item int fordblks
|
||||
This is the total size of memory occupied by free (not in use) chunks.
|
||||
|
||||
@item int keepcost
|
||||
This is the size of the top-most, releaseable chunk that normally
|
||||
borders the end of the heap (i.e. the ``brk'' of the process).
|
||||
|
||||
@item size_t bytes_free
|
||||
This is the number of bytes which are free.
|
||||
@end table
|
||||
@end deftp
|
||||
|
||||
@comment malloc.h
|
||||
@comment GNU
|
||||
@deftypefun {struct mstats} mstats (void)
|
||||
@comment SVID
|
||||
@deftypefun {struct mallinfo} mallinfo (void)
|
||||
This function returns information about the current dynamic memory usage
|
||||
in a structure of type @code{struct mstats}.
|
||||
in a structure of type @code{struct mallinfo}.
|
||||
@end deftypefun
|
||||
|
||||
@node Summary of Malloc
|
||||
@@ -706,6 +789,9 @@ Allocate a block of @var{size} bytes, starting on a page boundary.
|
||||
Allocate a block of @var{size} bytes, starting on an address that is a
|
||||
multiple of @var{boundary}. @xref{Aligned Memory Blocks}.
|
||||
|
||||
@item int mallopt (int @var{param}, int @var{value})
|
||||
Adjust a tunable parameter. @xref{Malloc Tunable Parameters}
|
||||
|
||||
@item int mcheck (void (*@var{abortfn}) (void))
|
||||
Tell @code{malloc} to perform occasional consistency checks on
|
||||
dynamically allocated memory, and to call @var{abortfn} when an
|
||||
@@ -720,7 +806,7 @@ A pointer to a function that @code{realloc} uses whenever it is called.
|
||||
@item void (*__free_hook) (void *@var{ptr})
|
||||
A pointer to a function that @code{free} uses whenever it is called.
|
||||
|
||||
@item struct mstats mstats (void)
|
||||
@item struct mallinfo mallinfo (void)
|
||||
Return information about the current dynamic memory usage.
|
||||
@xref{Statistics of Malloc}.
|
||||
@end table
|
||||
@@ -1744,10 +1830,13 @@ If enough memory is not available, this function returns a null pointer
|
||||
and does not modify @code{*@var{handleptr}}.
|
||||
@end deftypefun
|
||||
|
||||
@node Memory Warnings
|
||||
@section Memory Usage Warnings
|
||||
@cindex memory usage warnings
|
||||
@cindex warnings of memory almost full
|
||||
@ignore
|
||||
@comment No longer available...
|
||||
|
||||
@comment @node Memory Warnings
|
||||
@comment @section Memory Usage Warnings
|
||||
@comment @cindex memory usage warnings
|
||||
@comment @cindex warnings of memory almost full
|
||||
|
||||
@pindex malloc.c
|
||||
You can ask for warnings as the program approaches running out of memory
|
||||
@@ -1757,7 +1846,7 @@ system. This is a GNU extension declared in @file{malloc.h}.
|
||||
|
||||
@comment malloc.h
|
||||
@comment GNU
|
||||
@deftypefun void memory_warnings (void *@var{start}, void (*@var{warn-func}) (const char *))
|
||||
@comment @deftypefun void memory_warnings (void *@var{start}, void (*@var{warn-func}) (const char *))
|
||||
Call this function to request warnings for nearing exhaustion of virtual
|
||||
memory.
|
||||
|
||||
@@ -1775,3 +1864,5 @@ Normally it ought to display the string for the user to read.
|
||||
The warnings come when memory becomes 75% full, when it becomes 85%
|
||||
full, and when it becomes 95% full. Above 95% you get another warning
|
||||
each time memory usage increases.
|
||||
|
||||
@end ignore
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user