summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)AuthorLines
2013-07-22make pthread_key_t unsigned to match ABIRich Felker-1/+1
2013-07-22make pthread attribute types structs, even when they just have one fieldRich Felker-3/+3
this change is to get the right tags for C++ ABI matching. it should have no other effects.
2013-07-22change wint_t to unsignedRich Felker-4/+4
aside from the obvious C++ ABI purpose for this change, it also brings musl into alignment with the compiler's idea of the definition of wint_t (use in -Wformat), and makes the situation less awkward on ARM, where wchar_t is unsigned. internal code using wint_t and WEOF was checked against this change, and while a few cases of storing WEOF into wchar_t were found, they all seem to operate properly with the natural conversion from unsigned to signed.
2013-07-22refactor headers, especially alltypes.h, and improve C++ ABI compatRich Felker-87/+133
the arch-specific bits/alltypes.h.sh has been replaced with a generic alltypes.h.in and minimal arch-specific bits/alltypes.h.in. this commit is intended to have no functional changes except: - exposing additional symbols that POSIX allows but does not require - changing the C++ name mangling for some types - fixing the signedness of blksize_t on powerpc (POSIX requires signed) - fixing the limit macros for sig_atomic_t on x86_64 - making dev_t an unsigned type (ABI matching goal, and more logical) in addition, some types that were wrongly defined with long on 32-bit archs were changed to int, and vice versa; this change is non-functional except for the possibility of making pointer types mismatch, and only affects programs that were using them incorrectly, and only at build-time, not runtime. the following changes were made in the interest of moving non-arch-specific types out of the alltypes system and into the headers they're associated with, and also will tend to improve application compatibility: - netdb.h now includes netinet/in.h (for socklen_t and uint32_t) - netinet/in.h now includes sys/socket.h and inttypes.h - sys/resource.h now includes sys/time.h (for struct timeval) - sys/wait.h now includes signal.h (for siginfo_t) - langinfo.h now includes nl_types.h (for nl_item) for the types in stdint.h: - types which are of no interest to other headers were moved out of the alltypes system. - fast types for 8- and 64-bit are hard-coded (at least for now); only the 16- and 32-bit ones have reason to vary by arch. and the following types have been changed for C++ ABI purposes; - mbstate_t now has a struct tag, __mbstate_t - FILE's struct tag has been changed to _IO_FILE - DIR's struct tag has been changed to __dirstream - locale_t's struct tag has been changed to __locale_struct - pthread_t is defined as unsigned long in C++ mode only - fpos_t now has a struct tag, _G_fpos64_t - fsid_t's struct tag has been changed to __fsid_t - idtype_t has been made an enum type (also required by POSIX) - nl_catd has been changed from long to void * - siginfo_t's struct tag has been removed - sigset_t's has been given a struct tag, __sigset_t - stack_t has been given a struct tag, sigaltstack - suseconds_t has been changed to long on 32-bit archs - [u]intptr_t have been changed from long to int rank on 32-bit archs - dev_t has been made unsigned summary of tests that have been performed against these changes: - nsz's libc-test (diff -u before and after) - C++ ABI check symbol dump (diff -u before, after, glibc) - grepped for __NEED, made sure types needed are still in alltypes - built gcc 3.4.6
2013-07-19add UIO_MAXIOV macro in sys/uio.hRich Felker-0/+2
while there's no POSIX namespace provision for UIO_* in uio.h, this exact macro name is reserved in XBD 2.2.2. apparently some glibc-centric software expects it to exist, so let's provide it.
2013-07-18fix FILENAME_MAX to match PATH_MAXRich Felker-1/+1
POSIX is not clear on whether it includes the termination, but ISO C requires that it does. the whole concept of this macro is rather useless, but it's better to be correct anyway.
2013-07-06add NFDBITS in sys/select.h with appropriate feature testsRich Felker-0/+3
the main use for this macro seems to be knowing the correct allocation granularity for dynamic-sized fd_set objects. such usage is non-conforming and results in undefined behavior, but it is widespread in applications.
2013-07-03add legacy sys/ttydefaults.h headerrofl0r-0/+39
2013-07-03add legacy scsi/scsi_ioctl.h headerrofl0r-0/+11
2013-07-03paths.h: remove cruftrofl0r-9/+0
a research in debian codesearch and grepping over the pkgsrc directory tree have shown that these macros are all either unused, or defined by programs in case they need them.
2013-07-01add stubs for additional legacy ether.h functionsRich Felker-3/+3
these would not be expensive to actually implement, but reading /etc/ethers does not sound like a particularly useful feature, so for now I'm leaving them as stubs.
2013-06-29fix shifts possibly larger than type in major() macroRich Felker-1/+1
in theory this should not be an issue, since major() should only be applied to type dev_t, which is 64-bit. however, it appears some applications are not using dev_t but a smaller integer type (which works on Linux because the kernel's dev_t is really only 32-bit). to avoid the undefined behavior, do it as two shifts.
2013-06-29implement minimal dlinfo functionRich Felker-0/+3
2013-06-28work around wrong kernel type for sem_nsems member of struct semid_dsRich Felker-1/+9
rejecting invalid values for n is fine even in the case where a new sem will not be created, since the kernel does its range checks on n even in this case as well. by default, the kernel will bound the limit well below USHRT_MAX anyway, but it's presumably possible that an administrator could override this limit and break things.
2013-06-28add missing type shmatt_t in sys/shm.hRich Felker-0/+2
this type is not really intended to be used; it's just there to allow implementations to choose the type for the shm_nattch member of struct shmid_sh, presumably since historical implementations disagreed on the type. in any case, it needs to be there, so now it is.
2013-06-27minor compatibility fixes in utmp.h and fixing mismatch with paths.hRich Felker-4/+10
the pathnames prefixed with /dev/null/ are guaranteed never to be valid. the previous use of /dev/null alone was mildly dangerous in that bad software might attempt to unlink the name when it found a non-regular file there and create a new file.
2013-06-26document in sysconf and unistd.h that per-thread cpu clocks existRich Felker-0/+1
2013-06-25respect iso c namespace in stdio.h and wchar.h regarding va_listRich Felker-17/+19
despite declaring functions that take arguments of type va_list, these headers are not permitted by the c standard to expose the definition of va_list, so an alias for the type must be used. the name __isoc_va_list was chosen to convey that the purpose of this alternate name is for iso c conformance, and to avoid the multitude of names which gcc mangles with its hideous "fixincludes" monstrosity, leading to serious header breakage if these "fixes" are run.
2013-06-25implement inet_lnaof, inet_netof, and inet_makeaddrRich Felker-1/+4
also move all legacy inet_* functions into a single file to avoid wasting object file and compile time overhead on them. the added functions are legacy interfaces for working with classful ipv4 network addresses. they have no modern usefulness whatsoever, but some programs unconditionally use them anyway, and they're tiny.
2013-06-25add ether_aton[_r] and ether_ntoa[_r] functionsRich Felker-0/+14
based on patch by Strake with minor stylistic changes, and combined into a single file. this patch remained open for a long time due to some question as to whether ether_aton would be better implemented in terms of sscanf, and it's time something was committed, so here it is.
2013-06-08add clock id macros for a number of new(ish) Linux-specific clocksRich Felker-0/+6
arguably CLOCK_MONOTONIC should be redirected to CLOCK_BOOTTIME with a fallback for old kernels that don't support it, since Linux's CLOCK_BOOTTIME semantics seem to match the spirit of the POSIX requirements for CLOCK_MONOTONIC better than Linux's version of CLOCK_MONOTONIC does. however, this is a change that would require further discussion and research, so for now, I'm simply making them all available.
2013-06-08fix the type of CLOCKS_PER_SEC to match new clock_t typeRich Felker-1/+1
originally it was right on 32-bit archs and wrong on 64-bit, but after recent changes it was wrong everywhere. with this commit, it's now right everywhere.
2013-06-07improve handling of nonstandard fields in struct tmRich Felker-4/+5
defining tm_gmtoff and tm_zone as macros was breaking some application code that used these names for its own purposes.
2013-05-26fix the prototype of settimeofday to follow the original BSD declarationSzabolcs Nagy-5/+5
2013-05-17add FLT_TRUE_MIN, etc. macros from C11Rich Felker-0/+2
there was some question as to how many decimal places to use, since one decimal place is always sufficient to identify the smallest denormal uniquely. for now, I'm following the example in the C standard which is consistent with the other min/max macros we already had in place.
2013-05-17remove the __STDC_FORMAT_MACROS nonsense from inttypes.hRich Felker-4/+0
somehow I missed this when removing the corresponding __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS nonsense from stdint.h. these were all attempts by the C committee to guess what the C++ committee would want, and the guesses turned out to be wrong.
2013-05-15support full range of dev_t major/minor numbers in makedev, etc. macrosRich Felker-3/+10
2013-05-06remove compound literals from math.h to please c++Szabolcs Nagy-5/+10
__FLOAT_BITS and __DOUBLE_BITS macros used union compound literals, now they are changed into static inline functions. A good C compiler generates the same code for both and the later is C++ conformant.
2013-04-22remove __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS checks in stdint.hRich Felker-8/+0
C++11, the first C++ with stdint.h, requires the previously protected macros to be exposed unconditionally by stdint.h. apparently these checks were an early attempt by the C committee to guess what the C++ committee would want, and they guessed wrong.
2013-04-10make ifaddrs.h expose sys/socket.hRich Felker-0/+1
the getifaddrs interface seems to have been invented by glibc, and they expose socket.h, so for us not to do so is just gratuitous incompatibility with the interface we're mimicing.
2013-04-06add support for program_invocation[_short]_nameRich Felker-0/+6
this is a bit ugly, and the motivation for supporting it is questionable. however the main factors were: 1. it will be useful to have this for certain internal purposes anyway -- things like syslog. 2. applications can just save argv[0] in main, but it's hard to fix non-portable library code that's depending on being able to get the invocation name without the main application's help.
2013-04-05include/ifaddrs.h: add prototypes for get/freeifaddrsrofl0r-0/+3
2013-04-05add getifaddrsrofl0r-0/+31
supports ipv4 and ipv6, but not the "extended" usage where usage statistics and other info are assigned to ifa_data members of duplicate entries with AF_PACKET family.
2013-04-05net/if.h: add some missing IFF_ constantsrofl0r-0/+5
2013-04-04add prototype for dn_skipnameRich Felker-0/+1
2013-04-05add arpa/tftp.hrofl0r-0/+31
2013-04-04fix type issues in stdint.h so underlying types of 64-bit types match ABIRich Felker-8/+15
2013-04-04eliminate bits/wchar.hRich Felker-2/+15
the preprocessor can reliably determine the signedness of wchar_t. L'\0' is used for 0 in the expressions so that, if the underlying type of wchar_t is long rather than int, the promoted type of the expression will match the type of wchar_t.
2013-04-04eliminate gcc dependency for testing char signedness in limits.hRich Felker-1/+1
2013-04-04add put*ent functions for passwd/group files and similar for shadowRich Felker-0/+2
since shadow does not yet support enumeration (getspent), the corresponding FILE-based get and put versions are also subbed out for now. this is partly out of laziness and partly because it's not clear how they should work in the presence of TCB shadow files. the stubs should make it possible to compile some software that expects them to exist, but such software still may not work properly.
2013-04-02re-add useconds_trofl0r-0/+2
this type was removed back in 5243e5f1606a9c6fcf01414e , because it was removed from the XSI specs. however some apps use it. since it's in the POSIX reserved namespace, we can expose it unconditionally.
2013-04-02add arpa/nameser_compat.hrofl0r-0/+2
the contents of this header are already in arpa/nameser.h
2013-04-02make tm_zone etc visible under _GNU_SOURCErofl0r-1/+1
2013-04-01add new socket options to sys/socket.h following linuxSzabolcs Nagy-2/+17
2013-04-01adding ethernet protocol ids to if_ether.h following linuxSzabolcs Nagy-0/+15
2013-04-01add ADJ_SETOFFSET timex mode bit (new in linux v2.6.39)Szabolcs Nagy-0/+1
2013-04-01add new linux tcp socket option flags to netinet/tcp.hSzabolcs Nagy-0/+10
2013-03-31provide prototype for pthread_getattr_npRich Felker-0/+4
2013-03-06fix epoll structure alignment on non-x86_64 archsRich Felker-1/+5
this fix is far from ideal and breaks the rule of not using arch-specific #ifdefs, but for now we just need a solution to the existing breakage. the underlying problem is that the kernel folks made a very stupid decision to make misalignment of this struct part of the kernel API/ABI for x86_64, in order to avoid writing a few extra lines of code to handle both 32- and 64-bit userspace on 64-bit kernels. I had just added the packed attribute unconditionally thinking it was harmless on 32-bit archs, but non-x86 32-bit archs have 8-byte alignment on 64-bit types.
2013-03-06fix missing type error in grp.h from adding fgetgrentRich Felker-0/+4