Libraries updates and cleanup

* Updating common/lib
 * Updating lib/csu
 * Updating lib/libc
 * Updating libexec/ld.elf_so
 * Corrected test on __minix in featuretest to actually follow the
   meaning of the comment.
 * Cleaned up _REENTRANT-related defintions.
 * Disabled -D_REENTRANT for libfetch
 * Removing some unneeded __NBSD_LIBC defines and tests

Change-Id: Ic1394baef74d11b9f86b312f5ff4bbc3cbf72ce2
This commit is contained in:
2012-11-15 12:06:41 +01:00
parent f6aac1c3b5
commit f14fb60209
1285 changed files with 44244 additions and 14308 deletions

View File

@@ -36,7 +36,7 @@ INCS= ansi.h atomic.h \
statvfs.h sysctl.h stdarg.h stdint.h \
syslimits.h syslog.h \
termios.h time.h times.h \
tree.h ttycom.h \
tls.h tree.h ttycom.h \
ttydefaults.h types.h \
ucontext.h ucred.h uio.h un.h unistd.h utsname.h uuid.h \
\

View File

@@ -1,4 +1,4 @@
/* $NetBSD: ansi.h,v 1.13 2010/03/27 22:14:10 tnozaki Exp $ */
/* $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ */
/*-
* Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -35,17 +35,17 @@
#include <machine/ansi.h>
typedef char * __caddr_t; /* core address */
typedef __uint32_t __gid_t; /* group id */
typedef __uint32_t __gid_t; /* group id */
typedef __uint32_t __in_addr_t; /* IP(v4) address */
typedef __uint16_t __in_port_t; /* "Internet" port number */
typedef unsigned short __mode_t; /* file permissions */
typedef long __off_t; /* file offset */
typedef int __pid_t; /* process id */
typedef __uint16_t __mode_t; /* file permissions */
typedef __int32_t __off_t; /* file offset */
typedef __int32_t __pid_t; /* process id */
typedef __uint8_t __sa_family_t; /* socket address family */
typedef __int32_t __socklen_t; /* socket-related datum length */
typedef __uint32_t __uid_t; /* user id */
typedef unsigned long __fsblkcnt_t; /* fs block count (statvfs) */
typedef unsigned long __fsfilcnt_t; /* fs file count */
typedef __uint32_t __uid_t; /* user id */
typedef __uint32_t __fsblkcnt_t; /* fs block count (statvfs) */
typedef __uint32_t __fsfilcnt_t; /* fs file count */
struct __tag_wctrans_t;
typedef struct __tag_wctrans_t *__wctrans_t;
@@ -66,4 +66,10 @@ typedef union {
#define _BSD_WCTYPE_T_ __wctype_t /* wctype_t */
#define _BSD_MBSTATE_T_ __mbstate_t /* mbstate_t */
#ifdef __lint__
typedef char *__va_list;
#else
typedef __builtin_va_list __va_list;
#endif
#endif /* !_SYS_ANSI_H_ */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: bitops.h,v 1.7 2010/03/21 14:28:15 christos Exp $ */
/* $NetBSD: bitops.h,v 1.9 2011/07/30 16:35:58 christos Exp $ */
/*-
* Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
@@ -255,7 +255,7 @@ fls64(uint64_t _n)
_ilog2_helper(_n, 2) \
_ilog2_helper(_n, 1) \
_ilog2_helper(_n, 0) \
-1) : ((sizeof(_n) >= 4 ? fls64(_n) : fls32(_n)) - 1) \
-1) : ((sizeof(_n) > 4 ? fls64(_n) : fls32(_n)) - 1) \
)
static __inline void
@@ -266,7 +266,7 @@ fast_divide32_prepare(uint32_t _div, uint32_t * __restrict _m,
int _l;
_l = fls32(_div - 1);
_mt = 0x100000000ULL * ((1ULL << _l) - _div);
_mt = (uint64_t)(0x100000000ULL * ((1ULL << _l) - _div));
*_m = (uint32_t)(_mt / _div + 1);
*_s1 = (_l > 1) ? 1 : _l;
*_s2 = (_l == 0) ? 0 : _l - 1;
@@ -274,7 +274,7 @@ fast_divide32_prepare(uint32_t _div, uint32_t * __restrict _m,
/* ARGSUSED */
static __inline uint32_t
fast_divide32(uint32_t _v, uint32_t _div, uint32_t _m, uint8_t _s1,
fast_divide32(uint32_t _v, uint32_t _div __unused, uint32_t _m, uint8_t _s1,
uint8_t _s2)
{
uint32_t _t;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: cdefs.h,v 1.81 2010/12/25 22:30:52 joerg Exp $ */
/* $NetBSD: cdefs.h,v 1.100 2012/08/24 05:47:51 dholland Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -63,6 +63,21 @@
#include <sys/cdefs_aout.h>
#endif
#ifdef __GNUC__
#define __strict_weak_alias(alias,sym) \
__unused static __typeof__(alias) *__weak_alias_##alias = &sym; \
__weak_alias(alias,sym)
#else
#define __strict_weak_alias(alias,sym) __weak_alias(alias,sym)
#endif
/*
* Optional marker for size-optimised MD calling convention.
*/
#ifndef __compactcall
#define __compactcall
#endif
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
@@ -125,6 +140,17 @@
#define __aconst
#endif
/*
* Compile Time Assertion.
*/
#ifdef __COUNTER__
#define __CTASSERT(x) __CTASSERT0(x, __ctassert, __COUNTER__)
#else
#define __CTASSERT(x) __CTASSERT0(x, __ctassert, __LINE__)
#endif
#define __CTASSERT0(x, y, z) __CTASSERT1(x, y, z)
#define __CTASSERT1(x, y, z) typedef char y ## z[/*CONSTCOND*/(x) ? 1 : -1]
/*
* The following macro is used to remove const cast-away warnings
* from gcc -Wcast-qual; it should be used with caution because it
@@ -206,6 +232,24 @@
#define __noinline /* nothing */
#endif
#if __GNUC_PREREQ__(3, 0)
#define __always_inline __attribute__((__always_inline__))
#else
#define __always_inline /* nothing */
#endif
#if __GNUC_PREREQ__(4, 1)
#define __returns_twice __attribute__((__returns_twice__))
#else
#define __returns_twice /* nothing */
#endif
#if __GNUC_PREREQ__(4, 5)
#define __noclone __attribute__((__noclone__))
#else
#define __noclone /* nothing */
#endif
#if __GNUC_PREREQ__(2, 7)
#define __unused __attribute__((__unused__))
#else
@@ -218,6 +262,12 @@
#define __used __unused
#endif
#if __GNUC_PREREQ__(3, 1)
#define __noprofile __attribute__((__no_instrument_function__))
#else
#define __noprofile /* nothing */
#endif
#if defined(__cplusplus)
#define __BEGIN_EXTERN_C extern "C" {
#define __END_EXTERN_C }
@@ -278,6 +328,8 @@
#define __packed _Pragma("packed 1")
#define __aligned(x) _Pragma("aligned " __STRING(x))
#define __section(x) _Pragma("section " ## x)
#elif defined(_MSC_VER)
#define __packed /* ignore */
#else
#define __packed error: no __packed for this compiler
#define __aligned(x) error: no __aligned for this compiler
@@ -292,7 +344,9 @@
#define __restrict /* delete __restrict when not supported */
#elif __STDC_VERSION__ >= 199901L
#define __restrict restrict
#elif !__GNUC_PREREQ__(2, 92)
#elif __GNUC_PREREQ__(2, 92)
#define __restrict __restrict__
#else
#define __restrict /* delete __restrict when not supported */
#endif
@@ -320,12 +374,10 @@
#if !defined(_STANDALONE) && !defined(_KERNEL)
#if defined(__GNUC__) || defined(__PCC__)
#define __RENAME(x) ___RENAME(x)
#else
#ifdef __lint__
#elif defined(__lint__)
#define __RENAME(x) __symbolrename(x)
#else
#error "No function renaming possible"
#endif /* __lint__ */
#endif /* __GNUC__ */
#else /* _STANDALONE || _KERNEL */
#define __RENAME(x) no renaming in kernel or standalone environment
@@ -443,7 +495,7 @@
#define __link_set_foreach(pvar, set) \
for (pvar = __link_set_start(set); pvar < __link_set_end(set); pvar++)
#define __link_set_entry(set, idx) (__link_set_begin(set)[idx])
#define __link_set_entry(set, idx) (__link_set_start(set)[idx])
/*
* Return the number of elements in a statically-allocated array,
@@ -482,8 +534,37 @@
#define __CAST(__dt, __st) ((__dt)(__st))
#endif
#ifdef _MINIX
/* If compiling in Minix tree, Minix ANSI definitions are always useful. */
#define __type_mask(t) (/*LINTED*/sizeof(t) < sizeof(intmax_t) ? \
(~((1ULL << (sizeof(t) * NBBY)) - 1)) : 0ULL)
#ifndef __ASSEMBLER__
static __inline long long __zeroll(void) { return 0; }
static __inline int __negative_p(double x) { return x < 0; }
#else
#define __zeroll() (0LL)
#define __negative_p(x) ((x) < 0)
#endif
#define __type_min_s(t) ((t)((1ULL << (sizeof(t) * NBBY - 1))))
#define __type_max_s(t) ((t)~((1ULL << (sizeof(t) * NBBY - 1))))
#define __type_min_u(t) ((t)0ULL)
#define __type_max_u(t) ((t)~0ULL)
#define __type_is_signed(t) (/*LINTED*/__type_min_s(t) + (t)1 < (t)1)
#define __type_min(t) (__type_is_signed(t) ? __type_min_s(t) : __type_min_u(t))
#define __type_max(t) (__type_is_signed(t) ? __type_max_s(t) : __type_max_u(t))
#define __type_fit_u(t, a) (/*LINTED*/sizeof(t) < sizeof(intmax_t) ? \
(((a) & __type_mask(t)) == 0) : !__negative_p(a))
#define __type_fit_s(t, a) (/*LINTED*/__negative_p(a) ? \
((intmax_t)((a) + __zeroll()) >= (intmax_t)__type_min_s(t)) : \
((intmax_t)((a) + __zeroll()) <= (intmax_t)__type_max_s(t)))
/*
* return true if value 'a' fits in type 't'
*/
#define __type_fit(t, a) (__type_is_signed(t) ? \
__type_fit_s(t, a) : __type_fit_u(t, a))
#endif /* !_SYS_CDEFS_H_ */

View File

@@ -110,17 +110,11 @@
#define __link_set_add_data(set, sym) __link_set_make_entry(set, sym, 25)
#define __link_set_add_bss(set, sym) __link_set_make_entry(set, sym, 27)
#ifdef __minix
/* GNU binutils 2.x doesn't support a.out link sets. We need to workaround
* this by explicitely creating the N_SETV structure. */
#define __link_set_decl(set, ptype)
#else
#define __link_set_decl(set, ptype) \
extern struct { \
int __ls_length; \
ptype *__ls_items[1]; \
} __link_set_##set
#endif /* !__minix */
#define __link_set_start(set) (&(__link_set_##set).__ls_items[0])
#define __link_set_end(set) \

View File

@@ -1,4 +1,4 @@
/* $NetBSD: cdefs_elf.h,v 1.34 2010/12/08 01:18:55 joerg Exp $ */
/* $NetBSD: cdefs_elf.h,v 1.40 2012/03/04 16:14:48 tron Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -65,21 +65,21 @@
__asm(".weak " _C_LABEL_STRING(#sym));
#if __GNUC_PREREQ__(4, 0)
#define __weak_reference(sym) __attribute__((__weakref__))
#define __weak_reference(sym) __attribute__((__weakref__(#sym)))
#else
#define __weak_reference(sym) ; __asm(".weak " _C_LABEL_STRING(#sym))
#endif
#if defined(__clang__)
#define __warn_references(sym,msg) \
static __attribute__((__used__, __section__(".gnu.warning." #sym))) \
const char ___CONCAT(__warn_reference_##sym,__COUNTER__)[] = msg;
#if __GNUC_PREREQ__(4, 2)
#define __weakref_visible static
#else
#define __weakref_visible extern
#endif
#define __warn_references(sym,msg) \
__asm(".pushsection .gnu.warning." #sym "\n" \
".ascii \"" msg "\"\n" \
".popsection");
#endif
#else /* !__STDC__ */
@@ -106,11 +106,7 @@
#endif /* !__STDC__ */
#if defined(__clang__)
#define __SECTIONSTRING(_sec, _str) \
static __attribute__((__used__, __section__(#_sec))) const char \
___CONCAT(__sectstr,__COUNTER__)[] = _str
#elif __STDC__
#if __STDC__
#define __SECTIONSTRING(_sec, _str) \
__asm(".pushsection " #_sec "\n" \
".asciz \"" _str "\"\n" \
@@ -157,8 +153,8 @@
#define __link_set_add_bss2(set, sym, n) __link_set_make_entry2(set, sym, n)
#define __link_set_decl(set, ptype) \
extern ptype * const __start_link_set_##set[]; \
extern ptype * const __stop_link_set_##set[] \
extern ptype * const __start_link_set_##set[] __dso_hidden; \
extern ptype * const __stop_link_set_##set[] __dso_hidden \
#define __link_set_start(set) (__start_link_set_##set)
#define __link_set_end(set) (__stop_link_set_##set)
@@ -200,7 +196,7 @@
__attribute__((__section__(".data.read_mostly")))
#define __cacheline_aligned \
__attribute__((__aligned__(COHERENCY_UNIT) \
__attribute__((__aligned__(COHERENCY_UNIT), \
__section__(".data.cacheline_aligned")))
#endif /* _KERNEL */

View File

@@ -44,7 +44,7 @@
#include <sys/featuretest.h>
#include <sys/ctype_bits.h>
/* LSC: cast to unsigned char in order to prevent char as indice errors. */
#define isdigit(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_N))
#define islower(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_L))
#define isspace(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_S))

View File

@@ -41,6 +41,10 @@
#include <sys/types.h>
#endif
#if defined(__minix) && !defined(_STANDALONE)
#include <minix/partition.h>
#endif
/*
* Each disk has a label which includes information about the hardware
* disk geometry, filesystem partitions, and drive specific information.
@@ -180,6 +184,10 @@ struct disklabel {
uint16_t d_npartitions; /* number of partitions in following */
uint32_t d_bbsize; /* size of boot area at sn0, bytes */
uint32_t d_sbsize; /* max size of fs superblock, bytes */
#if defined(__minix) && !defined(_STANDALONE)
struct partition /* the partition table */
d_partitions[MAXPARTITIONS]; /* actually may be more */
#else
struct partition { /* the partition table */
uint32_t p_size; /* number of sectors in partition */
uint32_t p_offset; /* starting sector */
@@ -199,6 +207,7 @@ struct disklabel {
#define p_cpg __partition_u1.cpg
#define p_sgs __partition_u1.sgs
} d_partitions[MAXPARTITIONS]; /* actually may be more */
#endif /* defined(__minix) */
};
#if defined(__HAVE_OLD_DISKLABEL) && !HAVE_NBTOOL_CONFIG_H

View File

@@ -17,8 +17,8 @@
* file is included in an ordinary user program, EPERM has the value ( 1).
*/
#ifndef _ERRNO_H /* check if <errno.h> is already included */
# define _ERRNO_H /* it is not included; note that fact */
#ifndef _SYS_ERRNO_H_
#define _SYS_ERRNO_H_
/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
#ifdef _SYSTEM
@@ -173,4 +173,4 @@
#define EDEADEPT (_SIGN 302 ) /* specified endpoint is not alive */
#define EBADCPU (_SIGN 303 ) /* requested CPU does not work */
#endif /* _ERRNO_H */
#endif /* !_SYS_ERRNO_H_ */

View File

@@ -71,7 +71,7 @@
/* Never define _REENTRANT on Minix */
#ifdef __minix
#ifndef __minix
#if ((_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500) && \
!defined(_REENTRANT)

View File

@@ -450,10 +450,15 @@ int getfh(const char *, void *, size_t *)
__RENAME(__getfh30);
#endif
#if !defined(__minix)
int unmount(const char *, int);
#endif /* !defined(__minix) */
#if defined(_NETBSD_SOURCE)
#ifndef __LIBC12_SOURCE__
#if !defined(__minix)
/* LSC FIXME: we should remove our definition, and make sure all the tools uses the new one*/
int mount(const char *, const char *, int, void *, size_t) __RENAME(__mount50);
#endif /* !defined(__minix) */
int fhopen(const void *, size_t, int) __RENAME(__fhopen40);
int fhstat(const void *, size_t, struct stat *) __RENAME(__fhstat50);
#endif

View File

@@ -1,4 +1,5 @@
/* $NetBSD: ptree.h,v 1.3 2008/11/25 15:13:47 ad Exp $ */
/* $NetBSD: ptree.h,v 1.8 2012/10/06 22:15:09 matt Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -27,6 +28,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_PTREE_H_
#define _SYS_PTREE_H_
@@ -46,42 +48,42 @@ typedef unsigned int pt_bitlen_t;
typedef struct pt_node {
uintptr_t ptn_slots[2]; /* must be first */
#define PT_SLOT_LEFT 0
#define PT_SLOT_RIGHT 1
#define PT_SLOT_LEFT 0u
#define PT_SLOT_RIGHT 1u
#ifdef _PT_PRIVATE
#define PT_SLOT_ROOT 0
#define PT_SLOT_OTHER 1
#define PT_SLOT_ODDMAN 1
#define PT_TYPE_LEAF 0x00000000
#define PT_TYPE_BRANCH 0x00000001
#define PT_TYPE_MASK 0x00000001
#define PT_SLOT_ROOT 0u
#define PT_SLOT_OTHER 1u
#define PT_SLOT_ODDMAN 1u
#define PT_TYPE_LEAF ((uintptr_t)0x00000000u)
#define PT_TYPE_BRANCH ((uintptr_t)0x00000001u)
#define PT_TYPE_MASK ((uintptr_t)0x00000001u)
#endif /* _PT_PRIVATE */
uint32_t ptn_nodedata;
#ifdef _PT_PRIVATE
#define PTN_LEAF_POSITION_BITS 8
#define PTN_LEAF_POSITION_SHIFT 0
#define PTN_BRANCH_POSITION_BITS 8
#define PTN_BRANCH_POSITION_SHIFT 8
#define PTN_LEAF_POSITION_BITS 8u
#define PTN_LEAF_POSITION_SHIFT 0u
#define PTN_BRANCH_POSITION_BITS 8u
#define PTN_BRANCH_POSITION_SHIFT 8u
#ifndef PTNOMASK
#define PTN_MASK_BITLEN_BITS 15
#define PTN_MASK_BITLEN_SHIFT 16
#define PTN_MASK_FLAG 0x80000000
#define PTN_MASK_BITLEN_BITS 15u
#define PTN_MASK_BITLEN_SHIFT 16u
#define PTN_MASK_FLAG 0x80000000u
#endif
#endif /* _PT_PRIVATE */
uint32_t ptn_branchdata;
#ifdef _PT_PRIVATE
#define PTN_BRANCH_BITOFF_BITS 15
#define PTN_BRANCH_BITOFF_SHIFT 0
#define PTN_BRANCH_BITLEN_BITS 8
#define PTN_BRANCH_BITLEN_SHIFT 16
#define PTN_BRANCH_BITOFF_BITS 15u
#define PTN_BRANCH_BITOFF_SHIFT 0u
#define PTN_BRANCH_BITLEN_BITS 8u
#define PTN_BRANCH_BITLEN_SHIFT 16u
#if 0
#define PTN_ORIENTATION_BITS 1
#define PTN_ORIENTATION_SHIFT 30
#define PTN_ORIENTATION_BITS 1u
#define PTN_ORIENTATION_SHIFT 30u
#endif
#define PTN_BRANCH_UNUSED 0x3f000000
#define PTN_XBRANCH_FLAG 0x80000000
#define PTN_BRANCH_UNUSED 0x3f000000u
#define PTN_XBRANCH_FLAG 0x80000000u
#endif /* _PT_PRIVATE */
} pt_node_t;
@@ -155,12 +157,14 @@ typedef struct pt_node {
#endif /* _PT_PRIVATE */
typedef struct pt_tree_ops {
bool (*ptto_matchnode)(const void *, const void *, pt_bitoff_t,
pt_bitoff_t *, pt_slot_t *);
bool (*ptto_matchkey)(const void *, const void *, pt_bitoff_t,
pt_bitlen_t);
pt_slot_t (*ptto_testnode)(const void *, pt_bitoff_t, pt_bitlen_t);
pt_slot_t (*ptto_testkey)(const void *, pt_bitoff_t, pt_bitlen_t);
bool (*ptto_matchnode)(const void *, const void *,
pt_bitoff_t, pt_bitoff_t *, pt_slot_t *, void *);
bool (*ptto_matchkey)(const void *, const void *,
pt_bitoff_t, pt_bitlen_t, void *);
pt_slot_t (*ptto_testnode)(const void *,
pt_bitoff_t, pt_bitlen_t, void *);
pt_slot_t (*ptto_testkey)(const void *,
pt_bitoff_t, pt_bitlen_t, void *);
} pt_tree_ops_t;
typedef struct pt_tree {
@@ -170,16 +174,18 @@ typedef struct pt_tree {
const pt_tree_ops_t *pt_ops;
size_t pt_node_offset;
size_t pt_key_offset;
uintptr_t pt_spare[4];
void *pt_context;
uintptr_t pt_spare[3];
} pt_tree_t;
#define PT_FILTER_MASK 0x00000001 /* node is a mask */
typedef bool (*pt_filter_t)(void *, const void *, int);
void ptree_init(pt_tree_t *, const pt_tree_ops_t *, size_t, size_t);
void ptree_init(pt_tree_t *, const pt_tree_ops_t *, void *, size_t, size_t);
bool ptree_insert_node(pt_tree_t *, void *);
bool ptree_insert_mask_node(pt_tree_t *, void *, pt_bitlen_t);
void * ptree_find_filtered_node(pt_tree_t *, void *, pt_filter_t, void *);
bool ptree_mask_node_p(pt_tree_t *, const void *, pt_bitlen_t *);
void * ptree_find_filtered_node(pt_tree_t *, const void *, pt_filter_t, void *);
#define ptree_find_node(pt,key) \
ptree_find_filtered_node((pt), (key), NULL, NULL)
void ptree_remove_node(pt_tree_t *, void *);

View File

@@ -39,10 +39,11 @@
#define RBT_HALT 0 /* shutdown and return to monitor */
#define RBT_REBOOT 1 /* reboot the system through the monitor */
#define RBT_PANIC 2 /* a server panics */
#define RBT_MONITOR 3 /* let the monitor do this */
#define RBT_POWEROFF 3 /* power off, reset if not possible */
#define RBT_RESET 4 /* hard reset the system */
#define RBT_DEFAULT 5 /* return to monitor, reset if not possible */
#define RBT_INVALID 6 /* first invalid reboot flag */
/*
* Arguments to reboot system call. These are passed to the boot program,
* and then on to init.

View File

@@ -1,3 +1,65 @@
/* $NetBSD: socket.h,v 1.107 2012/06/22 18:26:35 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
*/
/*
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
* 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. 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.
*
* @(#)socket.h 8.6 (Berkeley) 5/3/95
*/
#ifndef _SYS_SOCKET_H_
#define _SYS_SOCKET_H_
@@ -73,7 +135,6 @@ typedef _BSD_SSIZE_T_ ssize_t;
/* SO_OSNDTIMEO 0x1005 */
/* SO_ORCVTIMEO 0x1006 */
#define SO_ERROR 0x1007 /* get error status and clear */
#define SO_TYPE 0x1008 /* get socket type */
#define SO_OVERFLOWED 0x1009 /* datagrams: return packets dropped */
@@ -238,6 +299,10 @@ struct msghdr {
int msg_flags; /* flags on received message */
};
#define MSG_OOB 0x0001 /* process out-of-band data */
#define MSG_PEEK 0x0002 /* peek at incoming message */
#define MSG_DONTROUTE 0x0004 /* send without using routing tables */
#define MSG_EOR 0x0008 /* complete record */
/*
* Header for ancillary data objects in msg_control buffer.
* Used for additional information with/about a datagram
@@ -319,9 +384,5 @@ int socket(int, int, int);
int socketpair(int, int, int, int *);
__END_DECLS
#define MSG_OOB 0x0001 /* process out-of-band data */
#define MSG_PEEK 0x0002 /* peek at incoming message */
#define MSG_DONTROUTE 0x0004 /* send without using routing tables */
#define MSG_EOR 0x0008 /* complete record */
#endif /* !_SYS_SOCKET_H_ */

View File

@@ -220,6 +220,7 @@ struct minix_prev_stat {
#define MINIX_ST_BLKSIZE PAGE_SIZE
#endif
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <sys/cdefs.h>
__BEGIN_DECLS
@@ -240,4 +241,5 @@ int mknod(const char *, mode_t, dev_t) __RENAME(__mknod50);
#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
__END_DECLS
#endif /* !_KERNEL && !_STANDALONE */
#endif /* !_SYS_STAT_H_ */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: syslog.h,v 1.32 2008/10/31 16:12:18 christos Exp $ */
/* $NetBSD: syslog.h,v 1.35 2012/10/10 22:51:55 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
@@ -170,70 +170,67 @@ CODE facilitynames[] = {
/* Used by reentrant functions */
struct syslog_data {
int log_version;
int log_file;
int connected;
int opened;
int log_connected;
int log_opened;
int log_stat;
const char *log_tag;
char log_hostname[256]; /* MAXHOSTNAMELEN */
int log_fac;
int log_mask;
};
#define SYSLOG_DATA_INIT { \
.log_version = 1, \
.log_file = -1, \
.log_connected = 0, \
.log_opened = 0, \
.log_stat = 0, \
.log_tag = 0, \
.log_hostname = { '\0' }, \
.log_fac = LOG_USER, \
.log_mask = 0xff, \
}
/*
* Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two
* places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
* of them here we may collide with the utility's includes. It's unreasonable
* for utilities to have to include one of them to include syslog.h, so we get
* _BSD_VA_LIST_ from <machine/ansi.h> and use it.
*/
#include <machine/ansi.h>
#include <sys/cdefs.h>
#include <sys/featuretest.h>
#include <sys/ansi.h>
__BEGIN_DECLS
void closelog(void);
void openlog(const char *, int, int);
int setlogmask(int);
void syslog(int, const char *, ...)
__attribute__((__format__(__printf__,2,3)));
void syslog(int, const char *, ...) __printflike(2, 3);
#if defined(_NETBSD_SOURCE)
void vsyslog(int, const char *, _BSD_VA_LIST_)
__attribute__((__format__(__printf__,2,0)));
void closelog_r(struct syslog_data *);
void openlog_r(const char *, int, int, struct syslog_data *);
int setlogmask_r(int, struct syslog_data *);
void vsyslog(int, const char *, __va_list) __printflike(2, 0);
#ifndef __LIBC12_SOURCE__
void closelog_r(struct syslog_data *) __RENAME(__closelog_r60);
void openlog_r(const char *, int, int, struct syslog_data *)
__RENAME(__openlog_r60);
int setlogmask_r(int, struct syslog_data *) __RENAME(__setlogmask_r60);
void syslog_r(int, struct syslog_data *, const char *, ...)
__attribute__((__format__(__printf__,3,4)));
void vsyslog_r(int, struct syslog_data *, const char *, _BSD_VA_LIST_)
__attribute__((__format__(__printf__,3,0)));
void syslogp(int, const char *, const char *, const char *, ...)
__attribute__((__format__(__printf__,4,5)));
void vsyslogp(int, const char *, const char *, const char *, _BSD_VA_LIST_)
__attribute__((__format__(__printf__,4,0)));
void syslogp_r(int, struct syslog_data *, const char *, const char *,
const char *, ...)
__attribute__((__format__(__printf__,5,6)));
void vsyslogp_r(int, struct syslog_data *, const char *, const char *,
const char *, _BSD_VA_LIST_)
__attribute__((__format__(__printf__,5,0)));
__RENAME(__syslog_r60) __printflike(3, 4);
void vsyslog_r(int, struct syslog_data *, const char *, __va_list)
__RENAME(__vsyslog_r60) __printflike(3, 0);
void syslogp_r(int, struct syslog_data *, const char *, const char *,
const char *, ...) __RENAME(__syslogp_r60) __printflike(5, 6);
void vsyslogp_r(int, struct syslog_data *, const char *, const char *,
const char *, __va_list) __RENAME(__vsyslogp_r60) __printflike(5, 0);
#endif
void syslogp(int, const char *, const char *, const char *, ...)
__printflike(4, 5);
void vsyslogp(int, const char *, const char *, const char *, __va_list)
__printflike(4, 0);
#endif
__END_DECLS
#else /* !_KERNEL */
void logpri(int);
void log(int, const char *, ...)
__attribute__((__format__(__printf__,2,3)));
void vlog(int, const char *, _BSD_VA_LIST_)
__attribute__((__format__(__printf__,2,0)));
void addlog(const char *, ...)
__attribute__((__format__(__printf__,1,2)));
void log(int, const char *, ...) __printflike(2, 3);
void vlog(int, const char *, __va_list) __printflike(2, 0);
void addlog(const char *, ...) __printflike(1, 2);
void logwakeup(void);
#endif /* !_KERNEL */

61
sys/sys/tls.h Normal file
View File

@@ -0,0 +1,61 @@
/* $NetBSD: tls.h,v 1.1 2011/03/09 23:10:07 joerg Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Joerg Sonnenberger.
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#ifndef _SYS_TLS_H_
#define _SYS_TLS_H_
#include <sys/cdefs.h>
#include <machine/types.h>
#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
#if defined(__HAVE_TLS_VARIANT_I) && defined(__HAVE_TLS_VARIANT_II)
#error Only one TLS variant can be supported at a time
#endif
struct tls_tcb {
#ifdef __HAVE_TLS_VARIANT_I
void **tcb_dtv;
void *tcb_pthread;
#else
void *tcb_self;
void **tcb_dtv;
void *tcb_pthread;
#endif
};
__BEGIN_PUBLIC_DECLS
struct tls_tcb *_rtld_tls_allocate(void);
void _rtld_tls_free(struct tls_tcb *);
void _rtld_tls_static_setup(void);
__END_PUBLIC_DECLS
#endif /* __HAVE_TLS_VARIANT_I || __HAVE_TLS_VARIANT_II */
#endif /* _SYS_TLS_H_ */

View File

@@ -117,11 +117,11 @@ typedef u32_t big_uid_t;
#ifdef _MINIX
/* some Minix specific types that do not conflict with posix */
typedef u32_t zone_t; /* zone number */
typedef u32_t block_t; /* block number */
typedef u32_t bit_t; /* bit number in a bit map */
typedef u16_t zone1_t; /* zone number for V1 file systems */
typedef u32_t bitchunk_t; /* collection of bits in a bitmap */
typedef uint32_t zone_t; /* zone number */
typedef uint32_t block_t; /* block number */
typedef uint32_t bit_t; /* bit number in a bit map */
typedef uint16_t zone1_t; /* zone number for V1 file systems */
typedef uint32_t bitchunk_t; /* collection of bits in a bitmap */
#endif
/* ANSI C makes writing down the promotion of unsigned types very messy. When

View File

@@ -50,6 +50,16 @@ struct ucred
gid_t gid;
};
#ifdef __minix
/* LSC FIXME: Remove this! Compatibility thing, only used in pfs/uds.c */
struct ucred_old
{
pid_t pid;
short uid;
char gid;
};
#endif /* def __minix */
/* Userland's view of credentials. This should not change */
struct uucred {
unsigned short cr_unused; /* not used, compat */