mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: Second draft of musl documentation/manual
Date: Thu, 5 Sep 2013 22:57:55 -0400	[thread overview]
Message-ID: <20130906025755.GE20515@brightrain.aerifal.cx> (raw)
In-Reply-To: <20130906024120.GP5116@port70.net>

On Fri, Sep 06, 2013 at 04:41:21AM +0200, Szabolcs Nagy wrote:
> * Rich Felker <dalias@aerifal.cx> [2013-09-05 21:12:52 -0400]:
> > #### Prerequisites
> > 
> > The only build-time prerequisites for musl are the standard POSIX
> > shell and utilities, GNU Make (version 3.81 or later) and a
> > freestanding C99 compiler toolchain targeting the desired instruction
> > set architecture and ABI, with support for gcc-style inline assembly,
> > weak aliases, and stand-alone assembly source files.
> > 
> 
> there are some optional extensions and compiler defined macros
> or builtins which may worth listing somewhere
> (noreturn, noalias, typeof, 1.0i,...)

Is 1.0i needed for compiling musl? I thought CMPLX() would be used,
but I haven't checked. The others are not needed for compiling musl
(used optionally, dependent on __GNUC__), but may be needed for
compiling applications using certain headers. I'm documenting this in
Part II. So far tgmath.h and complex.h are the only examples I have
where a header _needs_ an extension to work. Do you know others I
should document?

> > #### Dynamic linking runtime
> > 
> > `$(syslibdir)/ld-musl-$(ARCH).so.1` provides the dynamic linker, or
> > "program interpreter", for dynamically linked ELF programs using musl.
> > The absolute pathname to this file must be stored in all such
> > programs. The build and installation system provided with musl sets it
> > up as a symbolic link to `$(libdir)/libc.so`, but system integrators
> > may choose to make it available in whichever ways they find suitable.
> > 
> 
> in the usage section:
> ../libc.so pathname args
> ../ldd pathname

Good idea.

> > #### Development environment
> > 
> > Header files for use by the C compiler are installed in
> > `$(includedir)`. The standard headers are fully self-contained, and do
> > not make use of kernel-provided or compiler-provided headers or
> > otherwise require such headers to be present.
> 
> it is also worth noting that header files are not c99 (they are
> intended to be c89 except for long long and possibly wchar_t literals
> and should be usable with c++ as well)

Yes, I've already written that text in Part II (in progress right
now).

> > #### Compiler wrapper
> > 
> > To be written.
> > 
> > 
> > ### Filesystem Layout Dependencies
> > 
> > musl aims to avoid imposing filesystem policy; however, the following
> > minimal set of filesystems dependencies must be met in order for
> > programs using musl to function correctly:
> > 
> > * `/dev/null` - required by POSIX
> > 
> > * `/dev/tty` - required by POSIX
> > 
> > * `/tmp` - required by POSIX to exist as a directory, and used by
> > various temporary file creation functions.
> > 
> > * `/dev/shm` - must be a directory, and should have permissions 01777.
> > If absent, POSIX shared memory and named semaphore interfaces will
> > fail; programs not using these features will be unaffected.
> > 
> > * `/dev/ptmx` - must exist and be accessible for read/write in order
> > for pseudo-terminal opening to work.
> > 
> > * `/dev/pts` - must be a mounted devpts filesystem in order for
> > pseudo-terminal opening to work.
> > 
> > * `/proc` - must be a mount point for Linux procfs or a symlink to
> > such. Several functions such as realpath, fexecve, and a number of the
> > "at" functions added in POSIX 2008 need access to /proc to function
> > correctly.
> > 
> > * `/etc/resolv.conf` - needed to provide addresses of nameservers to
> > be used for DNS lookups, unless a working nameserver is available on
> > the loopback address.
> > 
> > * `../etc/ld-musl-$(ARCH).path`, taken relative to the location of the
> > "program interpreter" specified in the program's headers - if present,
> > this will be processed as a text file containing the shared library
> > search path, with components delimited by newlines or colons. If
> > absent, a default path of `"/lib:/usr/local/lib:/usr/lib"` will be
> > used. Not used by static-linked programs.
> > 
> 
> i'd probably repeat the program interpreter here again

OK.

> and i'd list all paths that may be used
> 
> /bin/sh
> 
> /etc/shadow or /etc/tcb/...
> /etc/passwd
> /etc/group
> 
> default zoneinfo search paths
> 
> /dev/log
> 
> /etc/services
> /etc/hosts

Indeed. Thanks for finding these.

> LD_PRELOAD and environment variable dependencies should be documented
> around here as well

Perhaps these (and the above filesystem dependencies) should be in
Part II. Also, we might want to add separate parts for run-time and
development usage.

> and the security policy for setuid binaries

Good idea.

> > Part II - Usage
> > ---------------
> > 
> > To be written. This part of the manual will deal with documenting
> > implementation-defined behavior and further behaviors that are not
> > required to be documented but for which musl makes additional
> > guarantees.
> > 
> > 
> > 
> > Part III - Implementation
> > -------------------------
> > 
> > To be written. This part of the manual will document the
> > implementation of musl, including matters such as source tree layout,
> > built system, algorithms used, musl-internal APIs, coding style, and
> > information on porting.
> 
> the documentation looks good so far

Thanks!

Rich


  reply	other threads:[~2013-09-06  2:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-01  4:41 Initial " Rich Felker
2013-09-01  9:43 ` Luca Barbato
2013-09-01 16:57   ` Rich Felker
2013-09-02  0:08     ` Luca Barbato
2013-09-02  7:12       ` Ivan Kanakarakis
2013-09-01 13:45 ` Vasily Kulikov
2013-09-01 16:54   ` Rich Felker
2013-09-02  7:11 ` Christian Wiese
2013-09-06  1:12 ` Second " Rich Felker
2013-09-06  2:41   ` Szabolcs Nagy
2013-09-06  2:57     ` Rich Felker [this message]
2013-09-06  4:20 ` Third " Rich Felker
2013-09-06 15:14   ` Szabolcs Nagy
2013-09-06 15:47     ` Rich Felker
2013-09-07 14:50       ` Szabolcs Nagy
2013-09-08 19:22   ` Ivan Kanakarakis
2013-09-09 11:42   ` AW: " Bortis Kevin
2013-09-09 12:09   ` Bortis Kevin
2013-09-09 15:49     ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130906025755.GE20515@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).