[[!meta copyright="Copyright © 2007, 2008, 2010, 2011, 2012, 2013, 2014 Free
Software Foundation, Inc."]]
[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]
[[!tag open_issue_glibc]]
Here's what's to be done for maintaining glibc.
[[!toc levels=2]]
# [[General information|/glibc]]
* [[Versioning]]
# [[Sources|source_repositories/glibc]]
# [[Debian Cheat Sheet|debian]]
# Configuration
Last reviewed up to the [[Git mirror's 64a17f1adde4715bb6607f64decd73b2df9e6852
(2013-12-19) sources|source_repositories/glibc]].
* `t/hurdsig-fixes`
hurdsig.c: In function '_hurd_internal_post_signal':
hurdsig.c:1188:26: warning: 'pending' may be used uninitialized in this function [-Wmaybe-uninitialized]
hurdsig.c:1168:12: note: 'pending' was declared here
* `t/host-independency`
[[!message-id "87bougerfb.fsf@kepler.schwinge.homeip.net"]], [[!message-id
"20120525202732.GA31088@intel.com"]], commit
918b56067a444572f1c71b02f18255ae4540b043. [[!GCC_PR 53183]], GCC commit
c05436a7e361b8040ee899266e15bea817212c37.
* `t/pie-sbrk`
[[gcc/PIE]].
* `t/sysvshm`
../sysdeps/mach/hurd/shmat.c: In function '__shmat':
../sysdeps/mach/hurd/shmat.c:57:7: warning: implicit declaration of function '__close' [-Wimplicit-function-declaration]
../sysdeps/mach/hurd/shmget.c: In function 'get_exclusive':
../sysdeps/mach/hurd/shmget.c:85:8: warning: variable 'is_private' set but not used [-Wunused-but-set-variable]
../sysdeps/mach/hurd/shmget.c:102:8: warning: 'dir' may be used uninitialized in this function [-Wmaybe-uninitialized]
../sysdeps/mach/hurd/shmget.c:102:8: warning: 'file' may be used uninitialized in this function [-Wmaybe-uninitialized]
* [[`t/tls`|t/tls]]
* [[`t/tls-threadvar`|t/tls-threadvar]]
* `t/verify.h`
People didn't like this too much.
Other examples:
* 11988f8f9656042c3dfd9002ac85dff33173b9bd -- `static_assert`
* [[toolchain/cross-gnu]], without `--disable-multi-arch`
i686-pc-gnu-gcc ../sysdeps/i386/i686/multiarch/strcmp.S -c [...]
../sysdeps/i386/i686/multiarch/../strcmp.S: Assembler messages:
../sysdeps/i386/i686/multiarch/../strcmp.S:31: Error: symbol `strcmp' is already defined
make[2]: *** [/media/boole-data/thomas/tmp/gnu-0/src/glibc.obj/string/strcmp.o] Error 1
make[2]: Leaving directory `/media/boole-data/thomas/tmp/gnu-0/src/glibc/string'
Might simply be a missing patch(es) from master.
* `--disable-multi-arch`
IRC, freenode, #hurd, 2012-11-22
tschwinge: is your glibc build w/ or w/o multiarch?
pinotree: See open_issues/glibc: --disable-multi-arch
ah, because you do cross-compilation?
No, that's natively.
There is also a not of what happened in cross-gnu when I
enabled multi-arch.
No idea whether that's still relevant, though.
EPARSE
s%not%note
Better?
yes :)
As for native builds: I guess I just didn't (want to) play
with it yet.
it is enabled in debian since quite some time, maybe other
i386/i686 patches (done for linux) help us too
I though we first needed some CPU identification
infrastructe before it can really work?
I thought [...].
as in use the i686 variant as runtime automatically? i guess
so
I thought I had some notes about that, but can't currently
find them.
Ah, I probably have been thinking about open_issues/ifunc
and open_issues/libc_variant_selection.
* --build=X
`long double` test: due to `cross_compiling = maybe` wants to execute a
file, which fails. Thus `--build=X` has to be set.
* Check what all these are:
running configure fragment for sysdeps/mach/hurd
checking Hurd header version... ok
running configure fragment for sysdeps/mach
checking for i586-pc-gnu-mig... i586-pc-gnu-mig
checking for mach/mach_types.h... yes
checking for mach/mach_types.defs... yes
checking for task_t in mach/mach_types.h... task_t
checking for thread_t in mach/mach_types.h... thread_t
checking for creation_time in task_basic_info... yes
checking for mach/mach.defs... yes
checking for mach/mach4.defs... yes
checking for mach/clock.defs... no
checking for mach/clock_priv.defs... no
checking for mach/host_priv.defs... no
checking for mach/host_security.defs... no
checking for mach/ledger.defs... no
checking for mach/lock_set.defs... no
checking for mach/processor.defs... no
checking for mach/processor_set.defs... no
checking for mach/task.defs... no
checking for mach/thread_act.defs... no
checking for mach/vm_map.defs... no
checking for mach/memory_object.defs... yes
checking for mach/memory_object_default.defs... yes
checking for mach/default_pager.defs... yes
checking for mach/i386/mach_i386.defs... yes
checking for egrep... grep -E
checking for host_page_size in mach_host.defs... no
checking for mach/machine/ndr_def.h... no
checking for machine/ndr_def.h... no
checking for i386_io_perm_modify in mach_i386.defs... yes
checking for i386_set_gdt in mach_i386.defs... yes
checking whether i586-pc-gnu-mig supports the retcode keyword... yes
* `sysdeps/i386/stackguard-macros.h`
See [[t/tls|t/tls]].
* Verify 77c84aeb81808c3109665949448dba59965c391e against
`~/shared/glibc/make_TAGS.patch`.
* `HP_SMALL_TIMING_AVAIL` not defined anywhere.
* Unify `CPUCLOCK_WHICH` stuff in `clock_*` files.
* Not all tests are re-run in a `make -k tests; make tests-clean; make -k
tests` cycle. For example, after `make tests-clean`:
$ find ./ -name \*.out
./localedata/tst-locale.out
./localedata/sort-test.out
./localedata/de_DE.out
./localedata/en_US.out
./localedata/da_DK.out
./localedata/hr_HR.out
./localedata/sv_SE.out
./localedata/tr_TR.out
./localedata/fr_FR.out
./localedata/si_LK.out
./localedata/tst-mbswcs.out
./iconvdata/iconv-test.out
./iconvdata/tst-tables.out
./stdlib/isomac.out
./posix/wordexp-tst.out
./posix/annexc.out
./posix/tst-getconf.out
./elf/check-textrel.out
./elf/check-execstack.out
./elf/check-localplt.out
./c++-types-check.out
./check-local-headers.out
./begin-end-check.out
* `CPUCLOCK_WHICH`, `t/cpuclock`
/media/boole-data/thomas/tmp/gnu-0/src/glibc.obj/rt/librt_pic.a(clock_settime.os): In function `clock_settime':
/media/boole-data/thomas/tmp/gnu-0/src/glibc/rt/../sysdeps/unix/clock_settime.c:113: undefined reference to `CPUCLOCK_WHICH'
/media/boole-data/thomas/tmp/gnu-0/src/glibc/rt/../sysdeps/unix/clock_settime.c:114: undefined reference to `CPUCLOCK_WHICH'
collect2: error: ld returned 1 exit status
make[2]: *** [/media/boole-data/thomas/tmp/gnu-0/src/glibc.obj/rt/librt.so] Error 1
make[2]: Leaving directory `/media/boole-data/thomas/tmp/gnu-0/src/glibc/rt'
make[1]: *** [rt/others] Error 2
make[1]: Leaving directory `/media/boole-data/thomas/tmp/gnu-0/src/glibc'
make: *** [all] Error 2
* Missing interfaces, amongst many more.
IRC, freenode, #hurd, 2014-02-25:
youpi et al.: Is it a useful GSoC task to have the student
implement interfaces in glibc that we are currently missing?
tschwinge: definitely
posix_timers would be great
tschwinge: probably
Many more are missing, some of which have been announced in `NEWS`, others
typically haven't (like new flags to existing functions). Typically,
porters will notice missing functionaly. But in case you're looking for
something to work on, here's a bit of a commented list, otherwise go
looking in `/usr/include/i386-gnu/gnu/stubs.h` on a Debian GNU/Hurd system,
or the respective file from a fresh glibc build.
`AT_EMPTY_PATH`, `CLOCK_BOOTTIME`, `CLOCK_BOOTTIME_ALARM`,
`CLOCK_REALTIME_ALARM`, `O_PATH`, `O_TMPFILE`
(ffdd31816a67f48697ea4d6b852e58d2886d42ca),
`PTRACE_*` (for example, cbff0d9689c4d68578b6a4f0a17807232506ea27,
b1b2aaf8eb9eed301ea8f65b96844568ca017f8b,
521c6785e1fc94d1f501743e9a40af9e02797df3),
`RLIMIT_RTTIME`, `SEEK_DATA` (`unistd.h`), `SEEK_HOLE` (`unistd.h`)
`clock_adjtime`, `fallocate`, `fallocate64`, `name_to_handle_at`,
`open_by_handle_at`,
`posix_openpt`, `process_vm_readv`, `process_vm_writev`,
`setns`, `sync_file_range`, [[`mremap`|mremap]] and [[several
`MAP_*`|glibc/mmap]]
Check also the content of `gnu/stubs.h`, which lists all the functions
marked as stub which only return `ENOSYS`.
* `chflags`
Patch sent, [[!message-id "20120427012130.GZ19431@type.famille.thibault.fr"]].
IRC, OFTC, #debian-hurd, 2012-04-27:
Does anyone have any idea why int main(void) { return
chflags(); } will compile with gcc but not with g++ ? It says
that "chflags" was not declared in this scope.
I get the same error on FreeBSD, but including sys/stat.h
makes it work
Can't find a solution on Hurd though :/
the Hurd doesn't have chflags
apparently linux neither
what does it do?
change flags :)
Are you sure the Hurd does not have chflags ? Because gcc
does not complain
there is no chflags function in /usr/include
but what flags does it change?
According to the FreeBSD manpage, it can set flags such as
UF_NODUMP, UF_IMMUTABLE etc.
Hum, there is actually a chflags() definition
but no declaration
so actually chflags is supported, but the declaration was
forgotten
probably because since linux doens't have it, it has never
been a problem up to now
so I'd say ignore the error for now, we'll add the
declaration
* [[t/tls-threadvar]]
* `futimesat`
If we have all of 'em (check Linux kernel), `#define __ASSUME_ATFCTS`.
* `futimens`
IRC, freenode, #hurd, 2014-02-09:
it seems apt 0.9.15.1 has troubles downloading packages
etc., as opposed to apt 0.9.15
ah, that version uses futimens unconditionally
and we haven't implemented that yet
did somebody file a bug for that apt-get issue?
I haven't
I'll commit the fix in eglibc
but perhaps a bug report would be good for the kfreebsd
case
* `bits/stat.h [__USE_ATFILE]`: `UTIME_NOW`, `UTIME_OMIT`
* `io/fcntl.h [__USE_ATFILE]`
Do we support `AT_FDCWD` et al.?
(80b4e5f3ef231702b24d44c33e8dceb70abb3a06.)
* `t/opendirat`: `opendirat` (`scandirat`, `scandirat64`)
Need changes equivalent to c55fbd1ea768f9fdef34a01377702c0d72cbc213 +
14d96785125abee5e9a49a1c3037f35a581750bd.
* `madvise`, `MADV_DONTNEED`, `MADV_DONTDUMP`, `MADV_DODUMP`
[[glibc_madvise_vs_static_linking]].
IRC, OFTC, #debian-hurd, 2013-09-09:
does hurd MADV_DONTNEED or MADV_FREE or none?
http://sources.debian.net/src/jemalloc/3.4.0-1/include/jemalloc/jemalloc_defs.h.in#L239
seems it builds by defining JEMALLOC_PURGE_MADVISE_DONTNEED
but i don't know what i'm talking about, so it could build with
JEMALLOC_PURGE_MADVISE_FREE as well
IRC, OFTC, #debian-hurd, 2013-09-10:
gg0: it implements none, even if it defines DONTNEED (but
not FREE)
See also:
gnash (0.8.11~git20130903-1) unstable; urgency=low
* Git snapshot.
+ Embedded jemalloc copy has been replaced by system one.
[...]
- Disable jemalloc on hurd and kfreebsd-*. No longer disabled upstream.
* `msync`
Then define `_POSIX_MAPPED_FILES`, `_POSIX_SYNCHRONIZED_IO`.
* `epoll`, `sys/epoll.h`
Used by [[wayland]], for example.
IRC, freenode, #hurd, 2013-08-08:
is there any possible to have kquque/epoll alike
things in hurd? or there is one?
nalaginrut: use select/poll
is it possible to implement epoll?
it is
we don't care enough about it to do it
(for now)
well, since I wrote a server with Guile, and it could
take advantage of epoll, never mind, if there's no, it'll use
select automatically
but if someday someone care about it, I'll be
interested on it
epoll is a scalability improvement over poll
the hurd being full of scalability issues, this one is
clearly not a priority
ok
IRC, freenode, #hurd, 2013-09-26:
if I want to have epoll/kqueue like things, where
should it dwell? kernel or some libs?
libs
userland
that would be a good project to work on, something i
intended to do (so i can help) but it requires a lot of work
you basically need to add a way to explicitely install and
remove polling requests (instead of the currently way that
implicitely remove polling requests when select/poll returns)
while keeping the existing way working for some time
glibc implements select
the hurd io interface shows the select interface
servers such as pfinet/pflocal implement it
glibc implements the client-side of the call
where's poll? since epoll just added edge-trigger in
poll
both select and poll are implemented on top of the hurd io
select call (which isn't exactly select)
http://darnassus.sceen.net/gitweb/savannah_mirror/hurd.git/blob/HEAD:/hurd/io.defs
this is the io interface
http://darnassus.sceen.net/gitweb/savannah_mirror/glibc.git/blob/refs/heads/tschwinge/Roger_Whittaker:/hurd/hurdselect.c
this is the client side implementation
IRC, freenode, #hurd, 2014-02-14:
also: do you know if hurd has a modern-day poll()
replacement? ala epoll, kqueue, iocp, port_create(), etc?
last thing I remember was that there was no epoll
equivalent, but that was a few years ago :)
braunr: ^
* desrt is about to replace gmaincontext in glib with something
more modern
* desrt really very much wants not to have to write a poll()
backend....
it seems that absolutely every system that i care about,
except for hurd, has a new approach here :/
even illumos has solaris-style ports
desrt: I suggest you bring up the question on bug-hurd
the poll() system call there to satisfy POSIX, but there
might be a better Hurd-specific thing you could use
is there*
that would be ideal
i have to assume that a system that passes to many messages
has some other facilities :)
*so many
the question is if they work with fds....
bug-hurd doesn't seem like a good place to ask open-ended
questions....
it's the main development lists, it's just old GNU naming
list*
k. thanks.
bug-hurd@gnu.org is the address
* desrt goes to bug... hurd
written. thanks.
desrt: the hurd has only select/poll
it suffers from so many scalability issues there isn't
much point providing one currently
we focus more on bug fixing and posix compliance right now
fair answer
you should want a poll-based backend
it's the most portable one, and doesn't suck as much as
select
very easy to write
although, internally, our select/poll works just like a
bare epoll
i.e. select requests are installed, the client waits for
one or more messages, then uninstalls the requests
IRC, freenode, #hurd, 2014-02-23:
brings me to another question i asked here recently that
nobody had a great answer for: any plan to do kqueue?
not for now
i remember answering you about that
ah. on IRC or the list?
that internally, our select/poll implementation works just
like epoll
on irc
well "just like" is a bit far from the truth
well... poll() doesn't really work like epoll :p
internally, it does
even on linux
since both of us have to do the linear scan on the list
which is really the entire difference
that's the user interface part
i'm talking about the implementation
ya -- but it's the interface that makes it unscalable
i know
what i mean is
since the implementation already works like a more modern
poll
we could in theory add such an interface
but epoll adds some complicated detail
you'll have to forgive me a bit -- i wasn't around from a
time that i could imagine what a non-modern poll would look like
inside of a kernel :)
what i mean with a modern poll is a scalable poll-like
interface
epoll being the reference
* desrt is not super-crazy about the epoll interface....
me neither
kevent() is amazing -- one syscall for everything you need
i don't know kqueue enough to talk about it
no need to do 100 epollctls when you have a whole batch of
updates to do
there's two main differences
first is that instead of having a bunch of separate fds for
things like inotify, timerfd, eventfd, signalfd, etc -- they're
all built in as different 'filter' types
second is that instead of a separate epoll_ctl() call to
update the list of monitored things, the kevent() call
(epoll_wait() equivalent) takes two lists: one is the list of
updates to make and the other is the list of events to
return.... so you only do one syscall
well, again, that's the interface
internally, there still are updates and waits
and on a multiserver system like the hurd, this would mean
one system call per update per fd
and then one per wait
on the implementation side, i think kqueue also has a nice
feature: the kernel somehow has some magic that lets it post
events to a userspace queue.... so if you're not making updates
and you do a kevent() that would not block, you don't even enter
the kernel
ok
hm. that's an interesting point
"unix" as such is just another server for you guys, right?
no
that's a major difference between the hurd and other
microkernel based systems
even multiserver ones like minix
we don't have a unix server
we don't have a vfs server or even an "fd server"
so mach knows about things like fds?
no
only glibc
oh. weird!
yes
that's the hurd's magic :)
being so posix compliant despite how exotic it is
this starts to feel like msvcrt :p
maybe, i wouldn't know
windows is a hybrid after all
with multiple servers for its file system
so why not
anyway
so windows doesn't have fds in the kernel either... the C
library runtime emulates them
mach has something close to file descriptors
which is fun when you get into dll hell -- sometimes you
have multiple copies of the C library runtime in the same program
-- and you have to take care not to use fds from one of them with
th o ther one
yes ..
that, i knew :)
but back to the hurd
since fds are a glibc thing here, and because "files" can
be implemented by multiple servers
(sockets actually most of the time with select/poll)
we have to make per fd requests
the implementation uses the "port set" kernel abstraction
right -- we could have different "fd" coming from different
places
do you know what a mach port is ?
not even a little bit
hm
i think it's what a plane does when it goes really fast,
right?
let's say it's a kernel message queue
no it's not a sonic boom
:)
;p
so
ports are queues
(aside: i did briefly run into mach ports recently on macos
where they modified their kqueue to support them...)
queues of RPC requests usually
(but i didn't use them or look into them at all)
they can be referenced through mach port names, which are
integers much like file descriptors
they're also used for replies but, except for weird calls
like select/poll, you don't need to know that :)
a port set is one object containing multiple ports
sounds like dbus :)
the point of a port set is to provide the ability to
perform a single operation (wait for a message) on multiple ports
sounds like an epoll fd....
is the port set itself a port?
so, when a client calls select, it translates the list of
fds into port names, creates reply ports for each of them, puts
them into a port set, send one select request for each, and does
one blocking wait on the port set
no, but you can wait for a message on a port set the same
way you do on a port
and that's all it does
does that mean that you can you put a port set inside of
another port set?
hm maybe
i guess in some way that doesn't actually make sense
i guess
because i assume that the message you sent to each port in
your example is "tell me when you have some stuff"
yes
and you'd have to send an equivalent message to the port
set.... and that just doesn't make sense
since it's not really a thing, per se
it would
insteaf of port -> port set, it would just be port -> port
set -> port set
but we don't have any interface where an fd stands for a
port set
what i'm trying to tell here is that
considering how it's done, you can easily see that there
has to be non trivial communication
each with the cost of a system call
and not just any system call, a messaging one
mach is clearly not as good as l4 when it comes to that
hrmph
and the fact that most pollable fds are either unix or
inet/inet6 sockets mean that there will be contention in the
socket servers anyway
i've seen some of the crazy things you guys can do as a
result of the way mach works and way that hurd uses it, in
particular
normal users setting up little tcp/ip universes for
themselves, and so on
yes :)
but i guess this all has a cost
the cost here comes more from the implementation than the
added abstractions
mach provides async ipc, which can partially succeed
if i spin up a subhurd, it's using the same mach, right?
yes
that's neat
we tend to call them neighbour hurds because of that
i'm not sure it is
it puts it half way between linux containers and outright
VMs
because you have a new kernel.... ish...
well, it is for the same reasons hypervisors are neat
but the kernel exists within this construct....
a new kernel ?
a new hurd
yes
but not a new mach
exactly
ya -- that's very cool
it's halfway between hypervisors and containers/jails
what matters is that we didn't need to write much code to
make it work
and that the design naturally guarantees strong isolation
right. that's what i'm getting at
unlike containers
it shows that the interaction between mach and these set of
crazy things collectively referred to as the hurd is really
proper
usually
sometimes i think it's not
but that's another story :)
don't worry -- you can fix it when you port to L4 ;)
eh, no :)
btw: is this fundamentally the same mach as darwin?
yes
so i guess there are multiple separate implementations of a
standard set of interfaces?
?
* desrt has to assume that apple wouldn't be using GNU mach, for
example...
no it's the same code base
they couldn't
but only because the forks have diverged a bit
ah
and they probably changed a lot of things in their virtual
memory implementation
so i guess original mach was under some BSDish type thing
and GNU mach forked from that and started adding GPL code?
something like that
makes sense
we have very few "non-standard" mach interfaces