+++ /dev/null
-# -*- makefile -*-
-
-$(LIBAMM): $(OBJ_LIBAMM)
- $(AR_MESSAGE)
- $(VERBOSE)$(RM) $@
- $(VERBOSE)$(AR) $(ARFLAGS) $@ $^
-
+++ /dev/null
-INTERFACE:
-
-#include "spin_lock.h"
-
-template< typename Value_t >
-class Mp_fifo
-{
- friend class Jdb_mp_request_module;
-
-public:
- typedef Value_t Value;
- class Item
- {
- friend class Mp_fifo<Value>;
- friend class Jdb_mp_request_module;
-
- public:
- Value value;
- private:
- Item *next;
- };
-
-private:
- Item *_tail;
- Item *_head;
- Spin_lock _lock;
-};
-
-
-IMPLEMENTATION:
-
-#include "lock_guard.h"
-
-PUBLIC template< typename Value_t >
-Mp_fifo<Value_t>::Mp_fifo() : _tail(0), _head(0)
-{
- _lock.init();
-}
-
-PUBLIC inline NEEDS["spin_lock.h","lock_guard.h"]
-template< typename Value_t >
-void
-Mp_fifo<Value_t>::enq(Item *e)
-{
- Lock_guard<Spin_lock> guard(&_lock);
-
- e->next = 0;
-
- if (_head)
- _tail->next = e;
- else
- _head = e;
-
- _tail = e;
-}
-
-
-PUBLIC inline NEEDS["spin_lock.h","lock_guard.h"]
-template< typename Value_t >
-typename Mp_fifo<Value_t>::Item *
-Mp_fifo<Value_t>::deq()
-{
- Lock_guard<Spin_lock> guard(&_lock);
-
- Item *h = _head;
-
- if (_head)
- _head = _head->next;
-
- return h;
-}
+++ /dev/null
-IMPLEMENTATION [ppc32]:
-
-#include "mapped_alloc.h"
-#include "util.h"
-
-#include <cassert>
-
-PUBLIC
-Kmem_slab::Kmem_slab(unsigned long slab_size, unsigned elem_size,
- unsigned alignment, char const *name)
- : Kmem_slab_simple (slab_size, elem_size, alignment, name)
-{
-}
-
-PUBLIC
-Kmem_slab::Kmem_slab(unsigned elem_size,
- unsigned alignment, char const *name,
- unsigned long min_size = Config::PAGE_SIZE,
- unsigned long max_size = Config::PAGE_SIZE * 32)
- : Kmem_slab_simple (elem_size, alignment, name, min_size, max_size)
-{
-}
-//XXX cbass: possibly need special allocator for block allocations
-virtual
-void *
-Kmem_slab::block_alloc(unsigned long size, unsigned long alignment)
-{
-
- //size must be a power of two of PAGE_SIZE
- assert(size >= Config::PAGE_SIZE
- && (size & (size - 1)) == 0); // only one bit set -> power of two
-
- // just use the buddy allocator for now, calculate maximum of size and
- // alignment
- size = size > alignment ? Util::log2(size) : Util::log2(alignment);
- return Mapped_allocator::allocator()->alloc(size);
-}
-
-virtual
-void
-Kmem_slab::block_free(void *block, unsigned long size)
-{
- Mapped_allocator::allocator()->free(Util::log2(size), block);
-}
+++ /dev/null
-INTERFACE:
-
-#include "types.h"
-
-/** Region manager.
- The region manager is a module that keeps track of virtual-memory
- allocations in a predefined virtual-address region. It only
- allocates virtual addresses -- not physical memory. In other
- words, virtual-memory regions allocated using this module are not
- backed by physical memory; mapping in physical memory is the
- client's responsibility.
- */
-class Region
-{
-};
-
-
-IMPLEMENTATION:
-
-#include "amm.h"
-#include "globals.h"
-#include "helping_lock.h"
-#include "kmem_slab_simple.h"
-#include "panic.h"
-
-//
-// helpers for the address map library
-//
-
-static Kmem_slab_simple *amm_entry_cache;
-
-static
-Amm_entry *
-amm_alloc_func(Amm *, Address, vm_size_t, int)
-{
- return reinterpret_cast<Amm_entry *>(amm_entry_cache->alloc());
-}
-
-static
-void
-amm_free_func(Amm *, Amm_entry *entry)
-{
- amm_entry_cache->free(entry);
-}
-
-//
-// region
-//
-
-static Address mem_alloc_region;
-static Address mem_alloc_region_end;
-static Amm region_amm;
-static Address end_of_last_region;
-static Helping_lock region_lock;
-
-/** Initialize the region manager. This function is called once at
- initialization.
- @param begin begin of the virtual-memory region
- @param end end of the virtual-memory region
- */
-PUBLIC static
-void
-Region::init (Address begin, Address end)
-{
- mem_alloc_region = begin;
- mem_alloc_region_end = end;
-
- // Make sure our slab cache only uses single-page slabs (slab_size =
- // PAGE_SIZE). See note above declaration of amm_entry_cache for
- // more information.
- amm_entry_cache = new Kmem_slab_simple(sizeof(Amm_entry), 4, "Amm_entry");
-
- amm_init_gen(®ion_amm, AMM_FREE, 0, amm_alloc_func, amm_free_func, 0, 0);
- check (amm_modify(®ion_amm, 0, mem_alloc_region, AMM_RESERVED, 0) == 0);
- check (amm_modify(®ion_amm, mem_alloc_region_end,
- AMM_MAXADDR - mem_alloc_region_end,
- AMM_RESERVED, 0) == 0 );
-
- end_of_last_region = mem_alloc_region;
-}
-
-
-/** Reserve an address region. This function only reserves the region --
- it does not back it with physical memory.
- @param size size of the requested region, in bytes.
- @param alignment size-alignment of the requested region, in bytes.
- @return virtual address of the allocated virtual-memory region,
- or 0 if an error occurred.
- */
-PUBLIC static
-Address
-Region::reserve_pages(size_t size, unsigned long alignment)
-{
- Helping_lock_guard guard(®ion_lock);
-
- Address address = end_of_last_region;
- int align_bits = 0;
-
- while ((alignment >>= 1) != 0)
- align_bits++;
-
- if (! amm_find_gen(®ion_amm, &address, size, AMM_FREE, -1, align_bits,
- 0, 0))
- return 0; // nothing found
-
- end_of_last_region = address + size;
-
- if (amm_modify(®ion_amm, address, size, AMM_ALLOCATED, 0) != 0)
- return 0; // error
-
- return address;
-}
-
-/** Free an address region. This function only frees a reservation ---
- it does not flush the region itself.
- @param address virtual address of the allocated virtual memory region.
- @param size size of the allocated region, in bytes.
- */
-PUBLIC static
-void
-Region::return_pages(Address address, size_t size)
-{
- Helping_lock_guard guard(®ion_lock);
-
- assert( amm_find_gen(®ion_amm, &address, size, AMM_ALLOCATED, -1,
- 0, 0, AMM_EXACT_ADDR) );
-
- check ( amm_modify(®ion_amm, address, size, AMM_FREE, 0) == 0);
-}
-
-
-IMPLEMENTATION[debug]:
-
-/** Dump an overview of current allocations to the screen.
- */
-PUBLIC static
-void
-Region::debug_dump()
-{
- amm_dump(& region_amm);
-}
+++ /dev/null
-INTERFACE:
-
-#include "irq.h"
-
-class Virq : public Irq
-{
-private:
- Virq();
- Virq(Virq&);
-};
-
-
-IMPLEMENTATION:
-
-#include "config.h"
-#include "kdb_ke.h"
-#include "atomic.h"
-#include "thread_state.h"
-#include "static_init.h"
-
-PUBLIC inline
-explicit
-Virq::Virq(unsigned /*irqnum*/) : Irq(0)
-{
-}
-
-PUBLIC inline
-void
-Virq::notify()
-{
- hit();
-}
-
-PUBLIC
-bool
-Virq::put()
-{ return false; }
-
-
-
-PUBLIC
-bool
-Virq::check_debug_irq()
-{ return true; }
-
-PUBLIC
-void
-Virq::mask()
-{}
-
-PUBLIC
-void
-Virq::ack()
-{}
-
-PUBLIC
-void
-Virq::mask_and_ack()
-{}
-
-PUBLIC
-void
-Virq::unmask()
-{}
-
+++ /dev/null
-
-Directories: oskit/amm
-Target: liboskit_amm.a
-Documentation: doc/amm.tex
-Original Code Source: Flux Research Group, University of Utah
-Description:
- Address Map Manager (AMM) library manages collections of
- resources where each element of a collection has a name
- and some set of attributes.
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Address Map Management library.
- */
-#ifndef _OSKIT_AMM_H_
-#define _OSKIT_AMM_H_
-
-#include <assert.h>
-#include "types.h"
-
-typedef Address vm_offset_t;
-typedef size_t vm_size_t;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* #define STATS */
-
-#ifdef STATS
-struct amm_stats {
- unsigned lookups;
- unsigned hits;
- unsigned entriesscanned;
-};
-#endif
-
-typedef struct amm_entry {
- struct amm_entry *next; /* must be first */
- vm_offset_t start;
- vm_offset_t end;
- int flags;
-} amm_entry_t;
-
-typedef amm_entry_t Amm_entry;
-
-#define AMM_MINADDR ((vm_offset_t)0) /* min valid address */
-#define AMM_MAXADDR ((vm_offset_t)~0) /* max valid address + 1 */
-
-/* values used for simple versions of the interface */
-#define AMM_FREE (0)
-#define AMM_RESERVED ~((unsigned)(~0) >> 1)
-#define AMM_ALLOCATED (AMM_RESERVED >> 1)
-
-typedef struct amm {
- struct amm_entry *nodes;
- struct amm_entry **hint;
- struct amm_entry *(*alloc)(struct amm *amm,
- vm_offset_t addr,
- vm_size_t size,
- int flags);
- void (*free)(struct amm *amm,
- struct amm_entry *entry);
- int (*split)(struct amm *amm,
- struct amm_entry *entry,
- vm_offset_t addr,
- struct amm_entry **headp,
- struct amm_entry **tailp);
- int (*join)(struct amm *amm,
- struct amm_entry *head,
- struct amm_entry *tail,
- struct amm_entry **new_entry);
-#ifdef STATS
- struct amm_stats stats;
-#endif
-} Amm;
-
-/* amm_find attributes */
-#define AMM_FORWARD 0 /* search forward for entry */
-//#define AMM_BACKWARD 1 /* search backward for entry */
-#define AMM_FIRSTFIT 0 /* use first fit (default) */
-//#define AMM_BESTFIT 2 /* use best fit */
-#define AMM_EXACT_ADDR 4 /* match address exactly */
-
-#define amm_entry_start(e) (e)->start
-#define amm_entry_end(e) (e)->end
-#define amm_entry_size(e) ((e)->end - (e)->start)
-#define amm_entry_flags(e) (e)->flags
-
-/* Generic interfaces */
-
-void amm_init_gen(struct amm *amm, int flags, struct amm_entry *entry,
- struct amm_entry *(*af)(struct amm *, vm_offset_t,
- vm_size_t, int),
- void (*ff)(struct amm *, struct amm_entry *),
- int (*sf)(struct amm *, struct amm_entry *, vm_offset_t,
- struct amm_entry **, struct amm_entry **),
- int (*jf)(struct amm *, struct amm_entry *,
- struct amm_entry *, struct amm_entry **));
-
-void amm_destroy(struct amm *amm);
-
-struct amm_entry *amm_find_addr(struct amm *amm, vm_offset_t addr);
-
-struct amm_entry *amm_find_gen(struct amm *amm, vm_offset_t *addrp,
- vm_size_t size, int flags, int flagmask,
- unsigned int align_bits, vm_offset_t align_off,
- int find_flags);
-
-int amm_modify(struct amm *amm, vm_offset_t addr, vm_size_t size,
- int nflags, struct amm_entry *nentry);
-
-amm_entry_t *amm_select(struct amm *amm, vm_offset_t addr, vm_size_t size);
-
-int
-amm_iterate_gen(struct amm *amm,
- int (*ifunc)(struct amm *, struct amm_entry *, void *),
- void *arg, vm_offset_t addr, vm_size_t size,
- int flags, int flagmask);
-
-void amm_dump(struct amm *amm);
-
-/* Simple interfaces */
-
-void amm_init(struct amm *amm, vm_offset_t low, vm_offset_t high);
-
-int amm_allocate(struct amm *amm, vm_offset_t *addr, vm_size_t size, int prot);
-
-int amm_deallocate(struct amm *amm, vm_offset_t addr, vm_size_t size);
-
-int amm_reserve(struct amm *amm, vm_offset_t addr, vm_size_t size);
-
-int amm_protect(struct amm *amm, vm_offset_t addr, vm_size_t size, int prot);
-
-int amm_iterate(struct amm *amm,
- int (*ifunc)(struct amm *, struct amm_entry *, void *),
- void *arg);
-
-int amm_split(struct amm *amm, struct amm_entry **pentry,
- struct amm_entry *entry, vm_offset_t addr,
- struct amm_entry **head, struct amm_entry **tail);
-
-int amm_join(struct amm *amm, struct amm_entry **pentry,
- struct amm_entry *head, struct amm_entry *tail,
- struct amm_entry **new_entry);
-
-struct amm_entry *amm_alloc_entry(struct amm *amm, vm_offset_t addr,
- vm_size_t size, int flags);
-
-void amm_free_entry(struct amm *amm, struct amm_entry *entry);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _OSKIT_AMM_H_ */
-
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Default allocation routine for AMM
- */
-#include "amm.h"
-#include <malloc.h>
-
-struct amm_entry *
-amm_alloc_entry(struct amm *amm, vm_offset_t addr, vm_size_t size, int flags)
-{
- if (amm->alloc)
- return (*amm->alloc)(amm, addr, size, flags);
- else
- return (struct amm_entry *)smalloc(sizeof(struct amm_entry));
-}
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Simple address map allocation routine, similar to what POSIX mmap or
- * Mach vm_allocate would require.
- */
-#include <errno.h>
-#include "amm.h"
-
-/*
- * amm_allocate looks for a range with flags AMM_FREE and modifies it to
- * have the attributes AMM_ALLOCATED|flags.
- *
- * On input, *addrp specifies a hint address at which to start searching.
- * On output, *addrp is the address chosen. Size is the amount of the
- * resource desired and flags additional application-specific attributes to
- * associate with the range.
- *
- * Returns zero on success, an error number on failure.
- */
-int
-amm_allocate(struct amm *amm, vm_offset_t *addrp, vm_size_t size, int prot)
-{
- struct amm_entry *entry;
- vm_offset_t addr;
- int rc;
-
- addr = *addrp;
-
-#if 0 /* This path never taken */
- if (addr < AMM_MINADDR || addr >= AMM_MAXADDR)
- addr = AMM_MINADDR;
-#endif
-
- prot &= ~(AMM_ALLOCATED|AMM_RESERVED);
-
- entry = amm_find_gen(amm, &addr, size, AMM_FREE, -1, 0, 0, 0);
- if (entry == 0)
- return ENOMEM;
-
- rc = amm_modify(amm, addr, size, AMM_ALLOCATED|prot, 0);
- if (rc == 0)
- *addrp = addr;
-
- return rc;
-}
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Simple address map deallocation routine, similar to what POSIX munmap or
- * Mach vm_deallocate would require.
- */
-#include <errno.h>
-#include "amm.h"
-
-/*
- * amm_deallocate frees a range of address space.
- * Only AMM_ALLOCATED areas are freed, AMM_RESERVED/FREE regions are skipped.
- *
- * Addr and size define the range.
- *
- * Returns zero on success, error number on failure.
- */
-int
-amm_deallocate(struct amm *amm, vm_offset_t addr, vm_size_t size)
-{
- vm_offset_t saddr, eaddr;
- amm_entry_t *entry;
- int rc;
-
- saddr = addr;
- eaddr = saddr + size;
- while (saddr < eaddr) {
- /*
- * Find the next allocated entry and free the portion
- * covered by our range.
- */
- entry = amm_find_addr(amm, saddr);
- if ((amm_entry_flags(entry) & AMM_ALLOCATED) == AMM_ALLOCATED) {
- if (eaddr < amm_entry_end(entry))
- size = eaddr - saddr;
- else
- size = amm_entry_end(entry) - saddr;
- rc = amm_modify(amm, saddr, size, AMM_FREE, 0);
- if (rc)
- return rc;
- }
- saddr = amm_entry_end(entry);
- }
- return 0;
-}
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Free all the resources associated with an AMM.
- */
-#include "amm.h"
-
-/*
- */
-void
-amm_destroy(struct amm *amm)
-{
- struct amm_entry *entry, *nentry;
-
- for (entry = amm->nodes; entry; entry = nentry) {
- nentry = entry->next;
- amm_free_entry(amm, entry);
- }
- amm->nodes = 0;
-}
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Dump an address map
- */
-#include <stdio.h>
-#include "amm.h"
-
-void
-amm_dump(struct amm *amm)
-{
- struct amm_entry *entry;
-
- printf("AMM: %p\n", amm);
-#ifdef STATS
- printf("\t%d lookups, %d hits, %d scans\n",
- amm->stats.lookups, amm->stats.hits, amm->stats.entriesscanned);
-#endif
- for (entry = amm->nodes; entry; entry = entry->next)
- printf("\t%p: %c[0x"L4_PTR_FMT" - 0x"L4_PTR_FMT
- "]: flags=0x%08x\n",
- entry, *amm->hint == entry ? '*' : ' ',
- entry->start, entry->end, entry->flags);
-}
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Find a range of address space
- */
-#include <errno.h>
-#include "amm.h"
-
-struct amm_entry *
-amm_find_addr(struct amm *amm, vm_offset_t addr)
-{
- struct amm_entry *entry, **pentry;
-#ifdef STATS
- int first = 1;
-
- amm->stats.lookups++;
-#endif
-
- assert(amm);
-
- pentry = amm->hint;
- assert(*pentry);
- if (addr < (*pentry)->start)
- pentry = &amm->nodes;
-
- while (1) {
-#ifdef STATS
- amm->stats.entriesscanned++;
-#endif
- entry = *pentry;
- if (entry->start <= addr && addr < entry->end)
- break;
-#ifdef STATS
- first = 0;
-#endif
-
- if (entry->next)
- pentry = &entry->next;
- else
- pentry = &amm->nodes;
-
- assert(pentry != amm->hint);
- };
-
-#ifdef STATS
- if (first)
- amm->stats.hits++;
-#endif
- amm->hint = pentry;
- return entry;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Find a range of address space meeting certain criteria.
- */
-#include <errno.h>
-#include <panic.h>
-#include "amm.h"
-
-struct amm_entry *
-amm_find_gen(struct amm *amm, vm_offset_t *addrp, vm_size_t size,
- int flags, int flagmask, unsigned int align_bits, vm_offset_t align_off,
- int find_flags)
-{
- struct amm_entry *entry, *sentry, **pentry;
- vm_offset_t addr, eaddr, mask;
-
- assert(amm);
- assert(addrp);
- assert(size);
- assert(align_bits < sizeof(vm_offset_t) * 8);
-
-#if 0
- /*
- * XXX we heavily assume AMM_FORWARD in the following
- */
- if (find_flags & (AMM_BACKWARD|AMM_BESTFIT))
- panic("amm_find_gen: AMM_BACKWARD/AMM_BESTFIT not supported");
-#endif
-
- /*
- * Align hint address
- */
- mask = (1 << align_bits) - 1;
- addr = ((*addrp + mask) & ~mask) + align_off;
- eaddr = addr + size;
- assert(addr < eaddr);
-
- /*
- * Find entry containing the initial address
- */
- sentry = amm_find_addr(amm, addr);
- pentry = amm->hint;
-
- for (entry = sentry; entry; pentry = &entry->next, entry = *pentry) {
- assert(eaddr >= entry->start);
-
- /*
- * Alignment constraints may cause us to skip a few entries.
- */
- if (addr >= entry->end)
- continue;
-
- /*
- * Flags don't match, either look some more or punt
- */
- if (((entry->flags) & flagmask) != flags) {
- if (find_flags & AMM_EXACT_ADDR)
- break;
- addr = ((entry->end + mask) & ~mask) + align_off;
- eaddr = addr + size;
- sentry = entry->next;
- continue;
- }
-
- /*
- * This entry meets the criteria. If it contains our
- * endpoint, then we are all done. Otherwise move on to
- * the next entry.
- */
- if (eaddr <= entry->end) {
- *addrp = addr;
- amm->hint = pentry;
- return sentry;
- }
- }
-
- return 0;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Default deallocation routine for AMM
- */
-#include "amm.h"
-#include <malloc.h>
-
-void
-amm_free_entry(struct amm *amm, struct amm_entry *entry)
-{
- if (*amm->hint == entry)
- amm->hint = &amm->nodes;
-
- if (amm->free)
- (*amm->free)(amm, entry);
- else
- sfree((void *)entry, sizeof *entry);
-}
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-#include <panic.h>
-
-/*
- * One-time initialization for AMM (simple version)
- */
-#include "amm.h"
-
-/*
- * Initialize the given amm structure with the specified range.
- * The indicated range is marked as AMM_FREE and the remaining range as
- * AMM_RESERVED.
- */
-void
-amm_init(struct amm *amm, vm_offset_t lo, vm_offset_t hi)
-{
- amm_init_gen(amm, AMM_FREE, 0, 0, 0, 0, 0);
-
- if (AMM_MINADDR < lo) {
- if (amm_modify(amm, AMM_MINADDR, lo - AMM_MINADDR,
- AMM_RESERVED, 0))
- panic("amm_init: no memory");
- }
- if (hi < AMM_MAXADDR) {
- if (amm_modify(amm, hi, AMM_MAXADDR - hi, AMM_RESERVED, 0))
- panic("amm_init: no memory");
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-
-/*
- * One-time initialization for AMM
- */
-#include "amm.h"
-
-/*
- * Initialize the given amm structure, and associates the specified
- * flags and entry with the entire supported address range 0 through
- * (vm_offset_t)-1.
- *
- * The flags parameter is the address range flags word to associate
- * initially with the entire address space.
- *
- * The entry parameter allows the client to provide the initial amm_entry
- * node which will initially be associated with the entire address space;
- * this way the client can allocate a structure larger than the basic
- * amm_entry and store additional attribute data in the extended structure.
- * If the client supplies the init_entry, it must have initialized any
- * client-private data in that entry, but the amm will initialize the
- * amm-private part (the actual struct amm_entry). If entry is NULL,
- * the amm will call amm_alloc_entry to allocate a struct amm_entry and
- * initialize that.
- *
- * If the client wants to perform allocation or deallocation (or whatever)
- * over only a subset of the full possible (32- or 64-bit) address range,
- * then it can set up the init_entry to represent "invalid"
- * addresses rather than "free" addresses, and then later call
- * amm_modify_range() to create appropriate "free" region(s).
- */
-void
-amm_init_gen(struct amm *amm, int flags, struct amm_entry *entry,
- struct amm_entry *(*af)(struct amm *, vm_offset_t, vm_size_t, int),
- void (*ff)(struct amm *, struct amm_entry *),
- int (*sf)(struct amm *, struct amm_entry *, vm_offset_t,
- struct amm_entry **, struct amm_entry **),
- int (*jf)(struct amm *, struct amm_entry *,
- struct amm_entry *, struct amm_entry **))
-{
- amm->alloc = af;
- amm->free = ff;
- amm->split = sf;
- amm->join = jf;
-
- if (entry == 0) {
- entry = amm_alloc_entry(amm, AMM_MINADDR,
- AMM_MAXADDR - AMM_MINADDR, flags);
- assert(entry); /* XXX */
- }
- entry->start = AMM_MINADDR;
- entry->end = AMM_MAXADDR;
- entry->flags = flags;
- entry->next = 0;
-
- amm->nodes = entry;
- amm->hint = &amm->nodes;
-#ifdef STATS
- amm->stats.lookups = amm->stats.hits = amm->stats.entriesscanned = 0;
-#endif
-}
-
-#if 0
-/*
- * XXX these could just be parameters to the init routine rather than seperate
- * calls but we want to keep the amm_init interface simple.
- *
- * XXX these (at least the alloc function) must be part of the init call
- * since init wants to allocate a node.
- */
-void
-amm_set_alloc_func(struct amm *amm,
-
-{
- amm->alloc = af;
-}
-
-void
-amm_set_free_func(struct amm *amm,
- void (*ff)(struct amm *, struct amm_entry *))
-{
- amm->free = ff;
-}
-
-void
-amm_set_split_func(struct amm *amm,
- int (*sf)(struct amm *, struct amm_entry *, vm_offset_t,
- struct amm_entry **, struct amm_entry **))
-{
- amm->split = sf;
-}
-
-void
-amm_set_join_func(struct amm *amm,
- int (*jf)(struct amm *, struct amm_entry *,
- struct amm_entry *, struct amm_entry **))
-{
- amm->join = jf;
-}
-#endif
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Iterate over all entries of an AMM, calling a function for each entry.
- */
-#include "amm.h"
-
-/*
- * Call a user-provided function for every entry of an AMM.
- *
- * ifunc is the function to call, arg is an opaque argument which is
- * passed to the function (along with the AMM and entry) for every entry.
- *
- * If any call returns a non-zero value, the iteration is stopped and that
- * value is returned. Otherwise zero is returned.
- */
-int
-amm_iterate(struct amm *amm,
- int (*ifunc)(struct amm *, struct amm_entry *, void *), void *arg)
-{
- int rv = 0;
- struct amm_entry *entry;
- vm_offset_t addr;
-
- for (entry = amm->nodes; entry; entry = entry->next) {
- addr = entry->end - 1;
- rv = (*ifunc)(amm, entry, arg);
- if (rv)
- break;
- /*
- * Iteration function may have caused the current
- * entry to be deleted, split or joined with another.
- * So we re-lookup the current entry to get the correct
- * next pointer.
- */
- entry = amm_find_addr(amm, addr);
- }
-
- return rv;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Iterate over all entries of an AMM, calling a function for each entry.
- */
-#include "amm.h"
-
-/*
- * Call a user-provided function for every entry of an AMM.
- * ``ifunc'' is the function to call, ``arg'' is an opaque argument which
- * is passed to the function (along with the AMM and entry) for every entry.
- *
- * If any call returns a non-zero value, the iteration is stopped and that
- * value is returned. Otherwise zero is returned.
- */
-int
-amm_iterate_gen(struct amm *amm,
- int (*ifunc)(struct amm *, struct amm_entry *, void *),
- void *arg, vm_offset_t addr, vm_size_t size,
- int flags, int flagmask)
-{
- int rv = 0;
- struct amm_entry *entry;
- vm_offset_t eaddr = addr + size;
-
- for (entry = amm->nodes; entry; entry = entry->next) {
- /*
- * Skip forward til we find an entry that falls in the range.
- */
- if (addr >= entry->end)
- continue;
- /*
- * If we have past the end of the range, no need to continue.
- */
- if (eaddr <= entry->start)
- break;
- /*
- * Now make sure the flags match
- */
- if ((entry->flags & flagmask) != flags)
- continue;
- /*
- * If we survived all that, call the function
- * bailing if it fails.
- */
- addr = entry->end - 1;
- rv = (*ifunc)(amm, entry, arg);
- if (rv)
- break;
- /*
- * Iteration function may have caused the current
- * entry to be deleted, split or joined with another.
- * So we re-lookup the current entry to get the correct
- * next pointer.
- */
- entry = amm_find_addr(amm, addr);
- }
-
- return rv;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Join adjacent address map entries
- */
-#include "amm.h"
-
-/*
- * Called whenever the AMM thinks that two entries can be joined based on
- * comparison of the flags. Calls the user-set join routine if available.
- * Otherwise performs a simple join here. Should join them and return zero
- * or return non-zero indicating that they cannot be joined. A non-zero
- * return value is propogated on to whoever performed the action which
- * triggered the join request.
- *
- * ``pentry'' is a pointer to the next field of the entry previous to the
- * first entry being joined.
- *
- * ``head'' and ``tail'' are the two entries to join.
- *
- * ``new'' is the joined entry. It may be one of the existing entries
- * or it may be a completely new entry. Any ``left-over'' entries are
- * freed here.
- */
-int
-amm_join(struct amm *amm, struct amm_entry **pentry,
- struct amm_entry *head, struct amm_entry *tail, struct amm_entry **new)
-{
- struct amm_entry *entry;
- int rc;
-
- assert(head->end == tail->start);
- assert(head->flags == tail->flags);
-
- if (amm->join) {
- rc = (*amm->join)(amm, head, tail, &entry);
- if (rc)
- return rc;
- } else {
- entry = head;
- }
- entry->start = head->start;
- entry->end = tail->end;
- entry->flags = tail->flags;
- entry->next = tail->next;
- *pentry = entry;
- if (head != entry)
- amm_free_entry(amm, head);
- if (tail != entry)
- amm_free_entry(amm, tail);
-
- *new = entry;
- return 0;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modify a range of address space
- */
-#include <errno.h>
-#include "amm.h"
-
-/*
- * The big cheese.
- * Modifies an address range to be associated with a new entry and new flags.
- * Any existing entries wholly within the range are deleted, any that partly
- * overlap the range are split as necessary. After adding the new entry,
- * the amm may attempt to join it with adjacent already-existing entries if
- * it appears possible (i.e., if the flags words are the same). The standard
- * amm_join function is called in this case.
- *
- * Function returns zero if successful, non-zero if a split failed (e.g.,
- * due to lack of memory).
- *
- * Parameters addr and size define the range to be modified.
- *
- * nflags is the new flags for the range.
- *
- * Nentry is the new entry to use. nentry may be zero, in which case the amm
- * allocates a new standard entry itself. If nentry is non-zero, the caller
- * must have already allocated any extra attribate data in the entry. In
- * either case, the amm will initialize the private part of the new amm_entry,
- * including setting its address range type flags to the nflags parameter.
- */
-int
-amm_modify(struct amm *amm, vm_offset_t addr, vm_size_t size,
- int nflags, struct amm_entry *nentry)
-{
- struct amm_entry **pentry, *entry, *hentry, *tentry;
- vm_offset_t eaddr;
- int rc;
-
- eaddr = addr + size;
- if (eaddr < addr)
- return EINVAL;
-
- entry = amm_find_addr(amm, addr);
- pentry = amm->hint;
-
- /*
- * If no explicit entry was specified and the indicated range
- * already has the desired attributes, there is nothing to do.
- */
- if (nentry == 0 && addr >= entry->start && eaddr <= entry->end &&
- nflags == entry->flags)
- return 0;
-
- /*
- * Split off anything before the region of interest.
- */
- if (entry->start < addr) {
- rc = amm_split(amm, pentry, entry, addr, &hentry, &tentry);
- if (rc)
- return rc;
- pentry = &hentry->next;
- entry = tentry;
- }
- assert(entry->start == addr);
-
- /*
- * Now traverse entries that are completely covered by the new
- * one and delete them.
- */
- while (entry->end < eaddr) {
- *pentry = entry->next;
- amm_free_entry(amm, entry);
- entry = *pentry;
- }
-
- /*
- * Split off anything after the region of interest
- */
- if (entry->end > eaddr) {
- rc = amm_split(amm, pentry, entry, eaddr, &hentry, &tentry);
- if (rc)
- return rc;
- entry = hentry;
- }
- assert(entry->end == eaddr);
-
- /*
- * Final entry corresponding to end of range.
- * If no explicit new entry was specified or the current entry
- * was specified we just modify the existing entry.
- */
- if (nentry == entry) {
- entry->start = addr;
- entry->flags = nflags;
- nentry = entry;
- } else {
- if (nentry == 0) {
- nentry = amm_alloc_entry(amm, addr, eaddr-addr, nflags);
- if (nentry == 0)
- return ENOMEM;
- }
- *pentry = nentry;
- nentry->next = entry->next;
- nentry->start = addr;
- nentry->end = eaddr;
- nentry->flags = nflags;
- amm_free_entry(amm, entry);
- }
-
- /*
- * Finally, try to merge with previous entry...
- */
- if (pentry != &amm->nodes) {
- hentry = (struct amm_entry *)pentry;
- tentry = nentry;
- assert(hentry->next == tentry);
- if (hentry->flags == tentry->flags) {
- for (pentry = &amm->nodes; *pentry;
- pentry = &(*pentry)->next)
- if (*pentry == hentry)
- break;
- assert(*pentry);
- rc = amm_join(amm, pentry, hentry, tentry, &nentry);
- /* XXX return an error on rc != 0? */
- if (rc)
- pentry = &hentry->next;
- }
- }
- /*
- * ...and next entry.
- */
- if (nentry->next) {
- hentry = nentry;
- tentry = nentry->next;
- if (hentry->flags == tentry->flags) {
- rc = amm_join(amm, pentry, hentry, tentry, &nentry);
- /* XXX return an error on rc != 0? */
- }
-
- }
-
- amm->hint = pentry;
- return 0;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Simple address map protection routine, similar to what POSIX mprotect or
- * Mach vm_protect would require.
- *
- * XXX actually it looks like POSIX says that an mprotect should fail if
- * some part of the specified range is not allocated, so this could not
- * be used for that. Should we implement that?
- */
-#include <errno.h>
-#include "amm.h"
-
-/*
- * amm_protect modifies the flags associated with an AMM_ALLOCATED range.
- * AMM_RESERVED/FREE regions are skipped.
- *
- * Addr and size define the range. Flags is the ``protection'' to set.
- *
- * Returns zero on success, error number on failure.
- */
-int
-amm_protect(struct amm *amm, vm_offset_t addr, vm_size_t size, int prot)
-{
- vm_offset_t saddr, eaddr;
- amm_entry_t *entry;
- int flags, rc;
-
- saddr = addr;
- eaddr = saddr + size;
- prot = (prot & ~AMM_RESERVED) | AMM_ALLOCATED;
- while (saddr < eaddr) {
- /*
- * Find the next allocated entry and modify its protection
- * if necessary.
- */
- entry = amm_find_addr(amm, saddr);
- flags = amm_entry_flags(entry);
- if ((flags & AMM_ALLOCATED) == AMM_ALLOCATED) {
- if (eaddr < amm_entry_end(entry))
- size = eaddr - saddr;
- else
- size = amm_entry_end(entry) - saddr;
- if (flags != prot) {
- rc = amm_modify(amm, saddr, size, prot, 0);
- if (rc)
- return rc;
- }
- }
- saddr = amm_entry_end(entry);
- }
- return 0;
-}
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Simple address map ``reservation'' routine. Reserving address space
- * makes it unavailable for allocation.
- */
-#include <errno.h>
-#include "amm.h"
-
-/*
- * amm_reserve reserves a range of address space.
- * No error checking is made, range could be ALLOCATED, FREE or RESERVED.
- *
- * Addr and size define the range.
- *
- * Returns zero on success, error number on failure.
- */
-int
-amm_reserve(struct amm *amm, vm_offset_t addr, vm_size_t size)
-{
-
- return amm_modify(amm, addr, size, AMM_RESERVED, 0);
-}
+++ /dev/null
-/*
- * Copyright (c) 1996-1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Select (isolate) a range of address space
- */
-#include <errno.h>
-#include "amm.h"
-
-/*
- * Select (isolate) the specified range by splitting off everything before
- * and after as necessary. Result is one or more entries exactly covering
- * the range. Returns a pointer to the first entry for the start of the
- * range or zero if the range could not be isolated. Successive entries
- * can be located using amm_find_addr.
- */
-amm_entry_t *
-amm_select(struct amm *amm, vm_offset_t addr, vm_size_t size)
-{
- struct amm_entry **pentry, *entry, *hentry, *tentry;
- vm_offset_t eaddr;
- int rc;
-
- eaddr = addr + size;
- if (eaddr < addr)
- return 0;
-
- entry = amm_find_addr(amm, addr);
- pentry = amm->hint;
-
- /*
- * Split off anything before the region of interest.
- * Leave hint pointing at the beginning of the region.
- */
- if (entry->start < addr) {
- rc = amm_split(amm, pentry, entry, addr, &hentry, &tentry);
- if (rc)
- return 0;
- pentry = &hentry->next;
- entry = tentry;
- amm->hint = pentry;
- }
- assert(entry->start == addr);
-
- /*
- * Skip over entries that are completely covered by the range.
- */
- while (entry->end < eaddr) {
- pentry = &entry->next;
- entry = *pentry;
- }
-
- /*
- * Split off anything after the region of interest
- */
- if (entry->end > eaddr) {
- rc = amm_split(amm, pentry, entry, eaddr, &hentry, &tentry);
- if (rc)
- return 0;
- entry = hentry;
- }
- assert(entry->end == eaddr);
-
- /*
- * Return the first entry.
- */
- return *amm->hint;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 1996, 1998 University of Utah and the Flux Group.
- * All rights reserved.
- *
- * This file is part of the Flux OSKit. The OSKit is free software, also known
- * as "open source;" you can redistribute it and/or modify it under the terms
- * of the GNU General Public License (GPL), version 2, as published by the Free
- * Software Foundation (FSF). To explore alternate licensing terms, contact
- * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
- *
- * The OSKit 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 GPL for more details. You should have
- * received a copy of the GPL along with the OSKit; see the file COPYING. If
- * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Split an address map entry into two pieces
- */
-#include <errno.h>
-#include "amm.h"
-
-/*
- * Called whenever the AMM needs to split an entry due to conflicting flags.
- * Calls the user-set split routine if available. Otherwise performs a
- * simple split here. Either should split the entries and return zero or
- * return non-zero if the split could not be done. A non-zero return value
- * is propogated on to whoever performed the action which triggered the split
- * request.
- *
- * ``pentry'' is a pointer to the next field of the entry previous to the
- * one being split.
- *
- * ``entry'' is the entry to be split.
- *
- * ``addr'' is the address at which the split should be made. Addr is
- * guarenteed to fall in the range of the entry.
- *
- * ``headp'' and ``tailp'' should be set to everything before addr and
- * everything from addr on respectively. One or both of *headp and *tailp
- * will be a new entry allocated and initialized here or in the user split
- * routine. If both are new entries, we deallocate the original entry.
- *
- * This routine links the new entries into the map list.
- */
-int
-amm_split(struct amm *amm, struct amm_entry **pentry, struct amm_entry *entry,
- vm_offset_t addr, struct amm_entry **headp, struct amm_entry **tailp)
-{
- struct amm_entry *head, *tail;
- int rc;
-
- assert(addr >= entry->start && addr < entry->end);
-
- if (amm->split) {
- rc = (*amm->split)(amm, entry, addr, &head, &tail);
- if (rc)
- return rc;
- } else {
- tail = amm_alloc_entry(amm, addr, entry->end - addr,
- entry->flags);
- if (tail == 0)
- return ENOMEM;
- head = entry;
- }
- head->start = entry->start;
- tail->end = entry->end;
- tail->start = addr;
- head->end = addr;
- head->flags = entry->flags;
- tail->flags = entry->flags;
- tail->next = entry->next;
- head->next = tail;
- *pentry = head;
- if (head != entry && tail != entry)
- amm_free_entry(amm, entry);
-
- *headp = head;
- *tailp = tail;
- return 0;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 1994 The University of Utah and
- * the Computer Systems Laboratory (CSL). All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSL requests users of this software to return to csl-dist@cs.utah.edu any
- * improvements that they make and grant CSL redistribution rights.
- */
-#ifndef _FLUX_MC_MALLOC_H_
-#define _FLUX_MC_MALLOC_H_
-
-#include <cdefs.h>
-#include <stddef.h>
-
-/* The malloc package in the base C library
- is implemented on top of the List Memory Manager,
- and the underlying memory pool can be manipulated
- directly with the LMM primitives using this lmm structure. */
-extern struct lmm malloc_lmm;
-
-__BEGIN_DECLS
-
-/*
- * Don't macro expand protos please.
- */
-#ifndef MALLOC_IS_MACRO
-
-void *malloc(size_t size);
-void *mustmalloc(size_t size);
-void *memalign(size_t alignment, size_t size);
-void *calloc(size_t nelt, size_t eltsize);
-void *mustcalloc(size_t nelt, size_t eltsize);
-void *realloc(void *buf, size_t new_size);
-void free(void *buf);
-
-/* Alternate version of the standard malloc functions that expect the
- caller to keep track of the size of allocated chunks. These
- versions are _much_ more memory-efficient when allocating many
- chunks naturally aligned to their (natural) size (e.g. allocating
- naturally-aligned pages or superpages), because normal memalign
- requires a prefix between each chunk which will create horrendous
- fragmentation and memory loss. Chunks allocated with these
- functions must be freed with sfree() rather than the ordinary
- free(). */
-void *smalloc(size_t size);
-void *smemalign(size_t alignment, size_t size);
-void *scalloc(size_t size);
-void *srealloc(void *buf, size_t old_size, size_t new_size);
-void sfree(void *buf, size_t size);
-
-#endif /* MALLOC_IS_MACRO */
-
-/* malloc() and realloc() call this routine when they're about to fail;
- it should try to scare up more memory and add it to the malloc_lmm.
- Returns nonzero if it succeeds in finding more memory. */
-int morecore(size_t size);
-
-/* in a multithreaded client os, these functions should be overridden
- to protect accesses to the malloc_lmm. */
-void mem_lock(void);
-void mem_unlock(void);
-
-__END_DECLS
-
-#endif /* _FLUX_MC_MALLOC_H_ */
+++ /dev/null
-INTERFACE:
-
-#include <spin_lock.h>
-
-// The anonymous slab allocator. You can specialize this allocator by
-// providing your own initialization functions and your own low-level
-// allocation functions.
-
-class slab;
-
-class slab_cache_anon
-{
-protected:
- friend class slab;
-
- // Low-level allocator functions:
-
- // Allocate/free a block. "size" is always a multiple of PAGE_SIZE.
- virtual void *block_alloc(unsigned long size, unsigned long alignment) = 0;
- virtual void block_free(void *block, unsigned long size) = 0;
-
-private:
- typedef Spin_lock Lock;
-
- Lock lock;
- slab_cache_anon();
- slab_cache_anon(const slab_cache_anon&); // default constructor is undefined
-
- //
- // data declaration follows
- //
-
- // The slabs of this cache are held in a partially-sorted
- // doubly-linked list. First come the fully-active slabs (all
- // elements in use), then the partially active slabs, then empty
- // slabs.
- slab *_first_slab, *_first_available_slab, *_last_slab;
- unsigned long _slab_size;
- unsigned _elem_size, _latest_offset, _alignment;
- char const *_name;
-}; // end declaration of class slab_cache
-
-IMPLEMENTATION:
-
-#include <cassert>
-#include <cstddef>
-#include <cstdlib>
-#include <lock_guard.h>
-
-#ifndef offsetof // should be defined in stddef.h, but isn't
-#define offsetof(TYPE, MEMBER) (((size_t) &((TYPE *)10)->MEMBER) - 10)
-#endif
-
-//
-// class slab
-//
-
-class slab // a slab of the cache
-{
- slab();
- slab(const slab&); // default constructors remain undefined
-
- struct slab_entry
- {
- slab_entry *_next_free;
- char _entry[0];
- };
-
- struct slab_data
- {
- slab_cache_anon *_cache;
- slab_entry *_first_free;
- slab *_next, *_prev;
- unsigned short _in_use, _free;
- };
-
- // slabs for CACHE_ENTRY should contain at least min_cache_items
- // cache entries
- static const unsigned min_cache_items = 4;
-
- //
- // data declaration follows
- //
- slab_data _data;
-}; // end declaration of class slab
-
-//
-// class slab
-//-
-
-// default deallocator must not be called -- must use explicit destruction
-inline NOEXPORT
-void
-slab::operator delete(void* /*block*/)
-{
- assert (!"slab::operator delete called");
-}
-
-
-PUBLIC
-slab::slab(slab_cache_anon *cache)
-{
- _data._cache = cache;
- _data._in_use = 0;
- _data._next = _data._prev = 0;
-
- // Compute offset of first slab_entry in slab, not taking into
- // account the colorization offset. "slab_entry._entry[]" needs to
- // be "cache->_alignment"-aligned
- unsigned long offset_first_elem =
- ((sizeof(slab_data) + sizeof (slab_entry) + cache->_alignment - 1)
- & ~(cache->_alignment - 1))
- - sizeof (slab_entry);
-
- // Compute size of a slab entry, including alignment padding at end
- // of entry
- unsigned entry_size =
- (sizeof(slab_entry) + cache->_elem_size + cache->_alignment - 1)
- & ~(cache->_alignment - 1);
-
- // Compute number of elements fitting into a slab
- unsigned elem_num =
- (cache->_slab_size - offset_first_elem) / entry_size;
-
- // Compute pointer to first data element, now taking into account
- // the latest colorization offset
- char* data =
- reinterpret_cast<char*>(this) + offset_first_elem + cache->_latest_offset;
-
- // Update the colorization offset
- cache->_latest_offset += cache->_alignment;
- if (offset_first_elem + cache->_latest_offset + entry_size * elem_num
- > cache->_slab_size)
- {
- cache->_latest_offset = 0;
- }
-
- // Initialize the cache elements
- slab_entry *e = 0, *e_prev = 0;
-
- for (unsigned i = 0; i < elem_num; i++)
- {
- e = reinterpret_cast<slab_entry *>(data);
-
- e->_next_free = e_prev;
- cache->elem_ctor(& e->_entry[0]);
-
- e_prev = e;
-
- data +=
- (sizeof(slab_entry) + cache->_elem_size + cache->_alignment - 1)
- & ~(cache->_alignment - 1);
- }
-
- _data._first_free = e;
- _data._free = elem_num;
-}
-
-PUBLIC
-void *
-slab::alloc()
-{
- slab_entry *e = _data._first_free;
-
- if (! e)
- return 0;
-
- _data._first_free = e->_next_free;
- _data._in_use ++;
- _data._free --;
-
- return & e->_entry;
-}
-
-PUBLIC
-void
-slab::free(void *entry)
-{
- slab_entry *e = reinterpret_cast<slab_entry *>
- (reinterpret_cast<char*>(entry) - offsetof(slab_entry, _entry));
-
- e->_next_free = _data._first_free;
- _data._first_free = e;
-
- assert(_data._in_use);
- _data._in_use --;
- _data._free ++;
-}
-
-PUBLIC
-inline bool
-slab::is_empty()
-{
- return _data._in_use == 0;
-}
-
-PUBLIC
-inline bool
-slab::is_full()
-{
- return _data._free == 0;
-}
-
-PUBLIC
-inline unsigned
-slab::in_use()
-{
- return _data._in_use;
-}
-
-PUBLIC
-void
-slab::enqueue(slab *prev)
-{
- assert(prev);
-
- if ((_data._next = prev->_data._next))
- _data._next->_data._prev = this;
- _data._prev = prev;
- _data._prev->_data._next = this;
-}
-
-PUBLIC
-void
-slab::dequeue()
-{
- if (_data._prev)
- _data._prev->_data._next = _data._next;
- if (_data._next)
- _data._next->_data._prev = _data._prev;
-
- _data._prev = _data._next = 0;
-}
-
-PUBLIC
-inline slab *
-slab::prev()
-{
- return _data._prev;
-}
-
-PUBLIC
-inline slab *
-slab::next()
-{
- return _data._next;
-}
-
-PUBLIC
-inline void *
-slab::operator new(size_t,
- slab_cache_anon *cache) throw()
-{
- // slabs must be size-aligned so that we can compute their addresses
- // from element addresses
- return cache->block_alloc(cache->_slab_size, cache->_slab_size);
-}
-
-PUBLIC static
-unsigned
-slab::num_elems(unsigned long slab_size,
- unsigned elem_size,
- unsigned alignment)
-{
- // Compute offset of first slab_entry in slab, not taking into
- // account the colorization offset. "slab_entry._entry[]" needs to
- // be "cache->_alignment"-aligned
- unsigned long offset_first_elem =
- ((sizeof(slab::slab_data) + sizeof (slab::slab_entry) + alignment - 1)
- & ~(alignment - 1))
- - sizeof (slab::slab_entry);
-
- // Compute size of a slab entry, including alignment padding at end
- // of entry
- unsigned entry_size =
- (sizeof(slab::slab_entry) + elem_size + alignment - 1)
- & ~(alignment - 1);
-
- // Compute number of elements fitting into a slab
- return (slab_size - offset_first_elem) / entry_size;
-}
-
-PUBLIC static
-unsigned
-slab_cache_anon::num_elems(unsigned long slab_size,
- unsigned elem_size,
- unsigned alignment)
-{ return slab::num_elems(slab_size, elem_size, alignment); }
-
-//
-// slab_cache_anon
-//
-PUBLIC inline
-slab_cache_anon::slab_cache_anon(unsigned elem_size,
- unsigned alignment,
- char const * name,
- unsigned long min_size,
- unsigned long max_size)
- : _first_slab(0), _first_available_slab(0), _last_slab(0),
- _elem_size(elem_size),
- _latest_offset(0), _alignment(alignment),
- _name (name)
-{
- lock.init();
-
- for (
- _slab_size = min_size;
- num_elems(_slab_size, elem_size, alignment) < 8
- && _slab_size < max_size;
- _slab_size <<= 1) ;
-}
-
-//
-// slab_cache_anon
-//
-PUBLIC inline
-slab_cache_anon::slab_cache_anon(unsigned long slab_size,
- unsigned elem_size,
- unsigned alignment,
- char const * name)
- : _first_slab(0), _first_available_slab(0), _last_slab(0),
- _slab_size(slab_size), _elem_size(elem_size),
- _latest_offset(0), _alignment(alignment),
- _name (name)
-{
- lock.init();
-}
-
-PUBLIC
-virtual
-slab_cache_anon::~slab_cache_anon()
-{
- // the derived class should call destroy() before deleting us.
- // assert(_first_slab == 0);
-}
-
-PROTECTED inline
-void
-slab_cache_anon::destroy() // descendant should call this in destructor
-{
-#if 0
- slab *n, *s = _first_slab;
-
- while (s)
- {
- n = s->next();
-
- // explicitly call destructor to delete s;
- s->~slab();
- block_free(s, _slab_size);
-
- s = n;
- }
-
- _first_slab = 0;
-#endif
-}
-
-PUBLIC
-virtual void *
-slab_cache_anon::alloc() // request initialized member from cache
-{
- Lock_guard<Lock> guard(&lock);
-
- if (! _first_available_slab)
- {
- slab *s = new (this) slab(this);
- if (! s)
- return 0;
-
- _first_available_slab = s;
-
- if (_last_slab)
- {
- assert(_last_slab->is_full());
-
- _first_available_slab->enqueue(_last_slab);
- _last_slab = _first_available_slab;
- }
- else // this was the first slab we allocated
- _first_slab = _last_slab = _first_available_slab;
- }
-
- assert(_first_available_slab
- && ! _first_available_slab->is_full());
- assert(! _first_available_slab->prev()
- || _first_available_slab->prev()->is_full());
-
- void *ret = _first_available_slab->alloc();
- assert(ret);
-
- if (_first_available_slab->is_full())
- _first_available_slab = _first_available_slab->next();
-
- return ret;
-}
-
-PUBLIC template< typename Q >
-inline
-void *
-slab_cache_anon::q_alloc(Q *quota)
-{
- if (EXPECT_FALSE(!quota->alloc(_elem_size)))
- return 0;
-
- void *r;
- if (EXPECT_FALSE(!(r=alloc())))
- {
- quota->free(_elem_size);
- return 0;
- }
-
- return r;
-}
-
-PUBLIC
-virtual void
-slab_cache_anon::free(void *cache_entry) // return initialized member to cache
-{
- Lock_guard<Lock> guard(&lock);
-
- slab *s = reinterpret_cast<slab*>
- (reinterpret_cast<unsigned long>(cache_entry) & ~(_slab_size - 1));
-
- bool was_full = s->is_full();
-
- s->free(cache_entry);
-
- if (was_full)
- {
- if (s->next() == 0) // have no right neighbor?
- {
- assert(! _first_available_slab);
- }
- else if (s->next()->is_full()) // right neigbor full?
- {
- // We requeue to become the first non-full slab in the queue
- // so that all full slabs are at the beginning of the queue.
-
- if (s == _first_slab)
- _first_slab = s->next();
- // don't care about _first_available_slab, _last_slab --
- // they cannot point to s because we were full and have a
- // right neighbor
-
- s->dequeue();
-
- if (_first_available_slab)
- {
- // _first_available_slab->prev() is defined because we
- // had a right neighbor which is full, that is,
- // _first_available_slab wasn't our right neighbor and
- // now isn't the first slab in the queue
- assert(_first_available_slab->prev()->is_full());
- s->enqueue(_first_available_slab->prev());
- }
- else
- {
- // all slabs were full
- assert(_last_slab->is_full());
- s->enqueue(_last_slab);
- _last_slab = s;
- }
- }
-
- _first_available_slab = s;
-
- }
- else if (s->is_empty())
- {
- if (s->next() && (! s->next()->is_empty())) // right neighbor not empty?
- {
- // Move to tail of list
-
- if (s == _first_slab)
- _first_slab = s->next();
- if (s == _first_available_slab)
- _first_available_slab = s->next();
- // don't care about _last_slab because we know we have a
- // right neighbor
-
- s->dequeue();
-
- s->enqueue(_last_slab);
- _last_slab = s;
- }
- }
- else
- {
- // We weren't either full or empty; we already had free
- // elements. This changes nothing in the queue, and there
- // already must have been a _first_available_slab.
- }
-
- assert(_first_available_slab);
-}
-
-PUBLIC template< typename Q >
-inline
-void
-slab_cache_anon::q_free(Q *quota, void *obj)
-{
- free(obj);
- quota->free(_elem_size);
-}
-
-PUBLIC
-virtual unsigned long
-slab_cache_anon::reap() // request that cache returns memory to system
-{
- Lock_guard<Lock> guard(&lock);
-
- if (! _first_slab)
- return 0; // haven't allocated anything yet
-
- // never delete first slab, even if it is empty
- if (_last_slab == _first_slab
- || (! _last_slab->is_empty()))
- return 0;
-
- slab *s = _last_slab;
-
- if (_first_available_slab == s)
- _first_available_slab = 0;
-
- _last_slab = s->prev();
- s->dequeue();
-
- // explicitly call destructor to delete s;
- s->~slab();
- block_free(s, _slab_size);
-
- return _slab_size;
-}
-
-// Element initialization/destruction
-PROTECTED
-virtual void
-slab_cache_anon::elem_ctor(void *)
-{}
-
-PROTECTED
-virtual void
-slab_cache_anon::elem_dtor(void *)
-{}
-
-// Debugging output
-
-#include <cstdio>
-
-PUBLIC
-virtual void
-slab_cache_anon::debug_dump ()
-{
- printf ("%s: %lu-KB slabs (",
- _name, _slab_size / 1024);
-
- unsigned count, total = 0, total_elems = 0;
- slab* s = _first_slab;
-
- for (count = 0;
- s && s->is_full();
- s = s->next())
- {
- count++;
- total_elems += s->in_use();
- }
-
- total += count;
-
- printf ("%u full, ", count);
-
- for (count = 0;
- s && ! s->is_empty();
- s = s->next())
- {
- if (s->is_full())
- printf ("\n*** wrongly-enqueued full slab found\n");
- count++;
- total_elems += s->in_use();
- }
-
- total += count;
-
- printf ("%u used, ", count);
-
- for (count = 0;
- s;
- s = s->next())
- {
- if (! s->is_empty())
- printf ("\n*** wrongly-enqueued nonempty slab found\n");
- count++;
- total_elems += s->in_use();
- }
-
- unsigned total_used = total;
- total += count;
-
- printf ("%u empty = %u total) = %lu KB,\n %u elems (size=%u, align=%u)",
- count, total, total * _slab_size / 1024,
- total_elems, _elem_size, _alignment);
-
- if (total_elems)
- printf (", overhead = %lu B (%lu B) = %lu%% (%lu%%) \n",
- total * _slab_size - total_elems * _elem_size,
- total_used * _slab_size - total_elems * _elem_size,
- 100 - total_elems * _elem_size * 100 / (total * _slab_size),
- 100 - total_elems * _elem_size * 100 / (total_used * _slab_size));
- else
- printf ("\n");
-}
+++ /dev/null
-PKGDIR ?= ../..
-L4DIR ?= $(PKGDIR)/../..
-
-TARGET := libmag-input-lxdd.a #libmag-input-lxdd.so
-LINK_INCR := libmag-input-lxdd.a
-SRC_CC := input_lxdd.cc
-LDFLAGS_libmag-input-lxdd.so := -lmag-plugin.o -Bsymbolic
-CPPFLAGS += -fvisibility=hidden
-PC_FILENAME := mag-input-lxdd
-
-include $(L4DIR)/mk/lib.mk
+++ /dev/null
-/*
- * (c) 2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
- * Alexander Warg <warg@os.inf.tu-dresden.de>
- * economic rights: Technische Universität Dresden (Germany)
- *
- * This file is part of TUD:OS and distributed under the terms of the
- * GNU General Public License 2.
- * Please see the COPYING-GPL-2 file for details.
- */
-#include <l4/mag/server/input_driver>
-
-#include <l4/re/namespace>
-#include <l4/re/rm>
-#include <l4/re/env>
-#include <l4/re/error_helper>
-#include <l4/re/util/cap_alloc>
-#include <l4/cxx/exceptions>
-
-#include <cstdio>
-
-namespace Mag_server {
-
-using L4Re::Util::Auto_cap;
-using L4Re::chksys;
-
-
-struct Iter
-{
- L4Re::Event_buffer *_ev;
- L4Re::Event_buffer::Event *e;
-
- explicit Iter() : _ev(0), e(0) {}
- explicit Iter(L4Re::Event_buffer *ev) : _ev(ev), e(_ev->next()) {}
-
- Iter operator ++ ()
- {
- e = _ev->next();
- return *this;
- }
-
- bool operator != (Iter const &o) const
- { return e != o.e; }
-
- L4Re::Event_buffer::Event *operator -> () const { return e; }
- L4Re::Event_buffer::Event &operator * () const { return *e; }
-};
-
-struct Emit
-{
- User_state *u;
- Emit(User_state *u) : u(u) {}
- void operator () (L4Re::Event_buffer::Event const &e) const
- { u->handle_event(e); }
-};
-
-class Input_driver_lxproxy : public Input_driver, public Input_source
-{
-private:
- Auto_cap<L4Re::Dataspace>::Cap _ev_ds;
- Auto_cap<L4::Irq>::Cap _ev_irq;
- L4Re::Rm::Auto_region<void *> _ev_ds_m;
-
- L4Re::Event_buffer _ev;
-
-public:
-
- Input_driver_lxproxy() : Input_driver("L4Linux Proxy") {}
- void start(Core_api *core)
- {
- try
- {
- _ev_ds = L4Re::Util::cap_alloc.alloc<L4Re::Dataspace>();
- _ev_irq = L4Re::Util::cap_alloc.alloc<L4::Irq>();
-
- L4Re::Env const *e = L4Re::Env::env();
- L4::Cap<L4Re::Namespace> input_ns
- = chkcap(e->get_cap<L4Re::Namespace>("ev"), "getting ev namespace", 0);
- chksys(input_ns->query("ev_buf", _ev_ds.get()));
- chksys(input_ns->query("ev_irq", _ev_irq.get()));
- chksys(e->rm()->attach(&_ev_ds_m, _ev_ds->size(), L4Re::Rm::Search_addr,
- _ev_ds.get(), 0, L4_PAGESHIFT));
-
- _ev = L4Re::Event_buffer(_ev_ds_m.get(), _ev_ds->size());
- _core = core;
- core->add_input_source(this);
- printf("LXDD: buffer @%p\n", _ev_ds_m.get());
- }
- catch (...)
- {
- printf("could not find linux proxy input\n");
- }
- }
-
- void poll_events()
- {
- enum { Ax = 10 };
-
- //Motion_merger<Ax> mm;
- Motion_fwd mm;
- mm.process/*<L4Re::Event_buffer::Event>*/(Iter(&_ev), Iter(), Emit(_core->user_state()));
- }
-};
-
-static Input_driver_lxproxy _lxpinput;
-}
+++ /dev/null
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define __FORCE_GLIBC
-#include <features.h>
-#include <netdb.h>
-#include <unistd.h>
-
-
-extern smallint _net_stayopen attribute_hidden;
-
-struct netent *getnetbyaddr (uint32_t net, int type)
-{
- register struct netent *p;
-
- setnetent(_net_stayopen);
- while ((p = getnetent()))
- if (p->n_addrtype == type && p->n_net == net)
- break;
- if (!_net_stayopen)
- endnetent();
- return (p);
-}
+++ /dev/null
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define __FORCE_GLIBC
-#include <features.h>
-#include <netdb.h>
-#include <string.h>
-#include <unistd.h>
-
-
-extern smallint _net_stayopen attribute_hidden;
-
-struct netent *
-getnetbyname(const char *name)
-{
- register struct netent *p;
- register char **cp;
-
- setnetent(_net_stayopen);
- while ((p = getnetent())) {
- if (strcmp(p->n_name, name) == 0)
- break;
- for (cp = p->n_aliases; *cp != 0; cp++)
- if (strcmp(*cp, name) == 0)
- goto found;
- }
-found:
- if (!_net_stayopen)
- endnetent();
- return (p);
-}
+++ /dev/null
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define __FORCE_GLIBC
-#include <features.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-
-
-#include <bits/uClibc_mutex.h>
-__UCLIBC_MUTEX_STATIC(mylock, PTHREAD_MUTEX_INITIALIZER);
-
-
-
-#define MAXALIASES 35
-static const char NETDB[] = _PATH_NETWORKS;
-static FILE *netf = NULL;
-static char *line = NULL;
-static struct netent net;
-static char *net_aliases[MAXALIASES];
-
-smallint _net_stayopen attribute_hidden;
-
-void setnetent(int f)
-{
- __UCLIBC_MUTEX_LOCK(mylock);
- if (netf == NULL)
- netf = fopen(NETDB, "r" );
- else
- rewind(netf);
- if (f) _net_stayopen = 1;
- __UCLIBC_MUTEX_UNLOCK(mylock);
- return;
-}
-libc_hidden_def(setnetent)
-
-void endnetent(void)
-{
- __UCLIBC_MUTEX_LOCK(mylock);
- if (netf) {
- fclose(netf);
- netf = NULL;
- }
- _net_stayopen = 0;
- __UCLIBC_MUTEX_UNLOCK(mylock);
-}
-libc_hidden_def(endnetent)
-
-static char * any(register char *cp, char *match)
-{
- register char *mp, c;
-
- while ((c = *cp)) {
- for (mp = match; *mp; mp++)
- if (*mp == c)
- return (cp);
- cp++;
- }
- return ((char *)0);
-}
-
-struct netent *getnetent(void)
-{
- char *p;
- register char *cp, **q;
- struct netent *rv = NULL;
-
- __UCLIBC_MUTEX_LOCK(mylock);
- if (netf == NULL && (netf = fopen(NETDB, "r" )) == NULL) {
- goto DONE;
- }
-again:
-
- if (!line) {
- line = malloc(BUFSIZ + 1);
- if (!line)
- abort();
- }
-
- p = fgets(line, BUFSIZ, netf);
- if (p == NULL) {
- goto DONE;
- }
- if (*p == '#')
- goto again;
- cp = any(p, "#\n");
- if (cp == NULL)
- goto again;
- *cp = '\0';
- net.n_name = p;
- cp = any(p, " \t");
- if (cp == NULL)
- goto again;
- *cp++ = '\0';
- while (*cp == ' ' || *cp == '\t')
- cp++;
- p = any(cp, " \t");
- if (p != NULL)
- *p++ = '\0';
- net.n_net = inet_network(cp);
- net.n_addrtype = AF_INET;
- q = net.n_aliases = net_aliases;
- if (p != NULL)
- cp = p;
- while (cp && *cp) {
- if (*cp == ' ' || *cp == '\t') {
- cp++;
- continue;
- }
- if (q < &net_aliases[MAXALIASES - 1])
- *q++ = cp;
- cp = any(cp, " \t");
- if (cp != NULL)
- *cp++ = '\0';
- }
- *q = NULL;
- rv = &net;
-DONE:
- __UCLIBC_MUTEX_UNLOCK(mylock);
- return rv;
-}
-libc_hidden_def(getnetent)
+++ /dev/null
-/* The weak pthread functions for Linux.
- Copyright (C) 1996, 1997, 1998 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 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. */
-
-#include <pthread.h>
-#include <bits/uClibc_mutex.h>
-
-void attribute_hidden __uclibc_mutex_unlock (void *arg)
-{
- pthread_mutex_t *__mutex = (pthread_mutex_t *)arg;
- __pthread_mutex_unlock(__mutex);
-}
+++ /dev/null
-/* The weak pthread functions for Linux.
- Copyright (C) 1996, 1997, 1998 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 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. */
-
-#include <libc-internal.h>
-
-/* Weaks for internal library use only.
- *
- * We need to define weaks here to cover all the pthread functions that
- * libc itself will use so that we aren't forced to link libc against
- * libpthread. This file is only used in libc.a and since we have
- * weaks here, they will be automatically overridden by libpthread.a
- * if it gets linked in.
- */
-
-static int __pthread_return_0 (void) { return 0; }
-static void __pthread_return_void (void) { return; }
-
-weak_alias (__pthread_return_0, __pthread_mutex_init)
-weak_alias (__pthread_return_0, __pthread_mutex_lock)
-weak_alias (__pthread_return_0, __pthread_mutex_trylock)
-weak_alias (__pthread_return_0, __pthread_mutex_unlock)
-weak_alias (__pthread_return_void, _pthread_cleanup_push_defer)
-weak_alias (__pthread_return_void, _pthread_cleanup_pop_restore)
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-weak_alias (__pthread_return_0, __pthread_mutexattr_init)
-weak_alias (__pthread_return_0, __pthread_mutexattr_destroy)
-weak_alias (__pthread_return_0, __pthread_mutexattr_settype)
-#endif
+++ /dev/null
-/*
- * libc/sysdeps/linux/microblaze/clinkage.h -- Macros for C symbols in assembler
- *
- * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
- * Copyright (C) 2001 NEC Corporation
- * Copyright (C) 2001 Miles Bader <miles@gnu.org>
- *
- * This file is subject to the terms and conditions of the GNU Lesser
- * General Public License. See the file COPYING.LIB in the main
- * directory of this archive for more details.
- *
- * Written by Miles Bader <miles@gnu.org>
- */
-
-#include <asm/clinkage.h>
+++ /dev/null
-/*
- * libc/sysdeps/linux/microblaze/syscall.c -- generic syscall function for linux/microblaze
- *
- * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
- * Copyright (C) 2002 NEC Corporation
- * Copyright (C) 2002 Miles Bader <miles@gnu.org>
- *
- * This file is subject to the terms and conditions of the GNU Lesser
- * General Public License. See the file COPYING.LIB in the main
- * directory of this archive for more details.
- *
- * Written by Miles Bader <miles@gnu.org>
- */
-
-#include <errno.h>
-#include <sys/syscall.h>
-
-typedef unsigned long arg_t;
-
-/* Invoke `system call' NUM, passing it the remaining arguments.
- This is completely system-dependent, and not often useful. */
-long
-syscall (long num, arg_t a1, arg_t a2, arg_t a3, arg_t a4, arg_t a5, arg_t a6)
-{
- /* We don't know how many arguments are valid, so A5 and A6 are fetched
- off the stack even for (the majority of) system calls with fewer
- arguments; hopefully this won't cause any problems. A1-A4 are in
- registers, so they're OK. */
- register arg_t a __asm__ (SYSCALL_ARG0) = a1;
- register arg_t b __asm__ (SYSCALL_ARG1) = a2;
- register arg_t c __asm__ (SYSCALL_ARG2) = a3;
- register arg_t d __asm__ (SYSCALL_ARG3) = a4;
- register arg_t e __asm__ (SYSCALL_ARG4) = a5;
- register arg_t f __asm__ (SYSCALL_ARG5) = a6;
- register unsigned long syscall __asm__ (SYSCALL_NUM) = num;
- register unsigned long ret __asm__ (SYSCALL_RET);
- unsigned long ret_sav;
-
- *((unsigned long *)0xFFFF4004) = (unsigned int)('+');
- __asm__ ("brlid r17, 08x; nop;"
- : "=r" (ret)
- : "r" (syscall), "r" (a), "r" (b), "r" (c), "r" (d), "r" (e), "r" (f)
- : SYSCALL_CLOBBERS);
-
- ret_sav=ret;
- *((unsigned long *)0xFFFF4004) = (unsigned int)('-');
-
-
-
- __syscall_return (long, ret);
-}
+++ /dev/null
-/* Copyright (C) 1992,1997-2003,2004,2005,2006 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _LINUX_POWERPC_SYSDEP_H
-#define _LINUX_POWERPC_SYSDEP_H 1
-
-#include <sysdeps/unix/powerpc/sysdep.h>
-#include <tls.h>
-
-/* Some systen calls got renamed over time, but retained the same semantics.
- Handle them here so they can be catched by both C and assembler stubs in
- glibc. */
-
-#ifdef __NR_pread64
-# ifdef __NR_pread
-# error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
-#ifdef __NR_pwrite64
-# ifdef __NR_pwrite
-# error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
-/* For Linux we can use the system call table in the header file
- /usr/include/asm/unistd.h
- of the kernel. But these symbols do not follow the SYS_* syntax
- so we have to redefine the `SYS_ify' macro here. */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name) __NR_##syscall_name
-#else
-# define SYS_ify(syscall_name) __NR_/**/syscall_name
-#endif
-
-#ifndef __ASSEMBLER__
-
-# include <errno.h>
-
-# ifdef SHARED
-# define INLINE_VSYSCALL(name, nr, args...) \
- ({ \
- __label__ out; \
- __label__ iserr; \
- INTERNAL_SYSCALL_DECL (sc_err); \
- long int sc_ret; \
- \
- if (__vdso_##name != NULL) \
- { \
- sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args); \
- if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- goto out; \
- if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
- goto iserr; \
- } \
- \
- sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \
- if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- { \
- iserr: \
- __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
- sc_ret = -1L; \
- } \
- out: \
- sc_ret; \
- })
-# else
-# define INLINE_VSYSCALL(name, nr, args...) \
- INLINE_SYSCALL (name, nr, ##args)
-# endif
-
-# ifdef SHARED
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- ({ \
- __label__ out; \
- long int v_ret; \
- \
- if (__vdso_##name != NULL) \
- { \
- v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
- if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
- || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
- goto out; \
- } \
- v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
- out: \
- v_ret; \
- })
-# else
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL (name, err, nr, ##args)
-# endif
-
-# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \
- ({ \
- long int sc_ret = ENOSYS; \
- \
- if (__vdso_##name != NULL) \
- sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
- else \
- err = 1 << 28; \
- sc_ret; \
- })
-
-/* List of system calls which are supported as vsyscalls. */
-# define HAVE_CLOCK_GETRES_VSYSCALL 1
-# define HAVE_CLOCK_GETTIME_VSYSCALL 1
-
-/* Define a macro which expands inline into the wrapper code for a VDSO
- call. This use is for internal calls that do not need to handle errors
- normally. It will never touch errno.
- On powerpc a system call basically clobbers the same registers like a
- function call, with the exception of LR (which is needed for the
- "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
- an error return status). */
-# define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
- ({ \
- register void *r0 __asm__ ("r0"); \
- register long int r3 __asm__ ("r3"); \
- register long int r4 __asm__ ("r4"); \
- register long int r5 __asm__ ("r5"); \
- register long int r6 __asm__ ("r6"); \
- register long int r7 __asm__ ("r7"); \
- register long int r8 __asm__ ("r8"); \
- register long int r9 __asm__ ("r9"); \
- register long int r10 __asm__ ("r10"); \
- register long int r11 __asm__ ("r11"); \
- register long int r12 __asm__ ("r12"); \
- LOADARGS_##nr (funcptr, args); \
- __asm__ __volatile__ \
- ("mtctr %0\n\t" \
- "bctrl\n\t" \
- "mfcr %0" \
- : "=&r" (r0), \
- "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \
- "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \
- : ASM_INPUT_##nr \
- : "cr0", "ctr", "lr", "memory"); \
- err = (long int) r0; \
- (int) r3; \
- })
-
-# undef INLINE_SYSCALL
-# define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- INTERNAL_SYSCALL_DECL (sc_err); \
- long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \
- if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
- sc_ret = -1L; \
- } \
- sc_ret; \
- })
-
-/* Define a macro which expands inline into the wrapper code for a system
- call. This use is for internal calls that do not need to handle errors
- normally. It will never touch errno.
- On powerpc a system call basically clobbers the same registers like a
- function call, with the exception of LR (which is needed for the
- "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
- an error return status). */
-
-# undef INTERNAL_SYSCALL_DECL
-# define INTERNAL_SYSCALL_DECL(err) long int err
-
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- register long int r0 __asm__ ("r0"); \
- register long int r3 __asm__ ("r3"); \
- register long int r4 __asm__ ("r4"); \
- register long int r5 __asm__ ("r5"); \
- register long int r6 __asm__ ("r6"); \
- register long int r7 __asm__ ("r7"); \
- register long int r8 __asm__ ("r8"); \
- register long int r9 __asm__ ("r9"); \
- register long int r10 __asm__ ("r10"); \
- register long int r11 __asm__ ("r11"); \
- register long int r12 __asm__ ("r12"); \
- LOADARGS_##nr(name, args); \
- __asm__ __volatile__ \
- ("sc \n\t" \
- "mfcr %0" \
- : "=&r" (r0), \
- "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \
- "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \
- : ASM_INPUT_##nr \
- : "cr0", "ctr", "memory"); \
- err = r0; \
- (int) r3; \
- })
-# undef INTERNAL_SYSCALL
-# define INTERNAL_SYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
-
-# undef INTERNAL_SYSCALL_ERROR_P
-# define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((void) (val), __builtin_expect ((err) & (1 << 28), 0))
-
-# undef INTERNAL_SYSCALL_ERRNO
-# define INTERNAL_SYSCALL_ERRNO(val, err) (val)
-
-# define LOADARGS_0(name, dummy) \
- r0 = name
-# define LOADARGS_1(name, __arg1) \
- long int arg1 = (long int) (__arg1); \
- LOADARGS_0(name, 0); \
- extern void __illegally_sized_syscall_arg1 (void); \
- if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \
- __illegally_sized_syscall_arg1 (); \
- r3 = arg1
-# define LOADARGS_2(name, __arg1, __arg2) \
- long int arg2 = (long int) (__arg2); \
- LOADARGS_1(name, __arg1); \
- extern void __illegally_sized_syscall_arg2 (void); \
- if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 4) \
- __illegally_sized_syscall_arg2 (); \
- r4 = arg2
-# define LOADARGS_3(name, __arg1, __arg2, __arg3) \
- long int arg3 = (long int) (__arg3); \
- LOADARGS_2(name, __arg1, __arg2); \
- extern void __illegally_sized_syscall_arg3 (void); \
- if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 4) \
- __illegally_sized_syscall_arg3 (); \
- r5 = arg3
-# define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \
- long int arg4 = (long int) (__arg4); \
- LOADARGS_3(name, __arg1, __arg2, __arg3); \
- extern void __illegally_sized_syscall_arg4 (void); \
- if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 4) \
- __illegally_sized_syscall_arg4 (); \
- r6 = arg4
-# define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \
- long int arg5 = (long int) (__arg5); \
- LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \
- extern void __illegally_sized_syscall_arg5 (void); \
- if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 4) \
- __illegally_sized_syscall_arg5 (); \
- r7 = arg5
-# define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \
- long int arg6 = (long int) (__arg6); \
- LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \
- extern void __illegally_sized_syscall_arg6 (void); \
- if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 4) \
- __illegally_sized_syscall_arg6 (); \
- r8 = arg6
-
-# define ASM_INPUT_0 "0" (r0)
-# define ASM_INPUT_1 ASM_INPUT_0, "1" (r3)
-# define ASM_INPUT_2 ASM_INPUT_1, "2" (r4)
-# define ASM_INPUT_3 ASM_INPUT_2, "3" (r5)
-# define ASM_INPUT_4 ASM_INPUT_3, "4" (r6)
-# define ASM_INPUT_5 ASM_INPUT_4, "5" (r7)
-# define ASM_INPUT_6 ASM_INPUT_5, "6" (r8)
-
-#endif /* __ASSEMBLER__ */
-
-
-/* Pointer mangling support. */
-#if defined NOT_IN_libc && defined IS_IN_rtld
-/* We cannot use the thread descriptor because in ld.so we use setjmp
- earlier than the descriptor is initialized. */
-#else
-# ifdef __ASSEMBLER__
-# define PTR_MANGLE(reg, tmpreg) \
- lwz tmpreg,POINTER_GUARD(r2); \
- xor reg,tmpreg,reg
-# define PTR_MANGLE2(reg, tmpreg) \
- xor reg,tmpreg,reg
-# define PTR_MANGLE3(destreg, reg, tmpreg) \
- lwz tmpreg,POINTER_GUARD(r2); \
- xor destreg,tmpreg,reg
-# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
-# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
-# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
-# else
-# define PTR_MANGLE(var) \
- (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
-# define PTR_DEMANGLE(var) PTR_MANGLE (var)
-# endif
-#endif
-
-#endif /* linux/powerpc/powerpc32/sysdep.h */
+++ /dev/null
-# Makefile for uClibc
-#
-# Copyright (c) 2007 STMicroelectronics Ltd
-#
-# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-#
-
-ifeq ($(UCLIBC_HAS_FENV),y)
-libm_ARCH_SRC:=$(wildcard $(libm_ARCH_DIR)/*.c)
-libm_ARCH_OBJ:=$(patsubst $(libm_ARCH_DIR)/%.c,$(libm_ARCH_OUT)/%.o,$(libm_ARCH_SRC))
-endif
-
-libm_ARCH_OBJS:=$(libm_ARCH_OBJ)
-
-ifeq ($(DOPIC),y)
-libm-a-y+=$(libm_ARCH_OBJS:.o=.os)
-else
-libm-a-y+=$(libm_ARCH_OBJS)
-endif
-libm-so-y+=$(libm_ARCH_OBJS:.o=.os)
-
+++ /dev/null
-/*
- *
- * Copyright (c) 2007 STMicroelectronics Ltd
- * Filippo Arcidiacono (filippo.arcidiacono@st.com)
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- *
- * Taken from glibc 2.6
- *
- */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-feholdexcept (fenv_t *envp)
-{
- unsigned long int temp;
-
- /* Store the environment. */
- _FPU_GETCW (temp);
- envp->__fpscr = temp;
-
- /* Now set all exceptions to non-stop. */
- temp &= ~FE_ALL_EXCEPT;
- _FPU_SETCW (temp);
-
- return 1;
-}
+++ /dev/null
-/*
- *
- * Copyright (c) 2007 STMicroelectronics Ltd
- * Filippo Arcidiacono (filippo.arcidiacono@st.com)
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- *
- * Taken from glibc 2.6
- *
- */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-fesetenv (const fenv_t *envp)
-{
- if (envp == FE_DFL_ENV)
- _FPU_SETCW (_FPU_DEFAULT);
- else
- {
- unsigned long int temp = envp->__fpscr;
- _FPU_SETCW (temp);
- }
- return 0;
-}
+++ /dev/null
-/* Copyright (C) 1991, 92, 1995-2008, 2009 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; version 2 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#define PACKAGE "getconf regression test"
-#define VERSION ""
-#ifndef _
-# define _
-#endif
-#define error(status, errnum,...) \
- {fprintf(stderr, __VA_ARGS__); exit(status);}
-
-
-struct conf
- {
- const char *name;
- const int call_name;
- const enum { SYSCONF, CONFSTR, PATHCONF } call;
- };
-
-static const struct conf vars[] =
- {
-#ifdef _PC_LINK_MAX
- { "LINK_MAX", _PC_LINK_MAX, PATHCONF },
-#endif
-#ifdef _PC_LINK_MAX
- { "_POSIX_LINK_MAX", _PC_LINK_MAX, PATHCONF },
-#endif
-#ifdef _PC_MAX_CANON
- { "MAX_CANON", _PC_MAX_CANON, PATHCONF },
-#endif
-#ifdef _PC_MAX_CANON
- { "_POSIX_MAX_CANON", _PC_MAX_CANON, PATHCONF },
-#endif
-#ifdef _PC_MAX_INPUT
- { "MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
-#endif
-#ifdef _PC_MAX_INPUT
- { "_POSIX_MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
-#endif
-#ifdef _PC_NAME_MAX
- { "NAME_MAX", _PC_NAME_MAX, PATHCONF },
-#endif
-#ifdef _PC_NAME_MAX
- { "_POSIX_NAME_MAX", _PC_NAME_MAX, PATHCONF },
-#endif
-#ifdef _PC_PATH_MAX
- { "PATH_MAX", _PC_PATH_MAX, PATHCONF },
-#endif
-#ifdef _PC_PATH_MAX
- { "_POSIX_PATH_MAX", _PC_PATH_MAX, PATHCONF },
-#endif
-#ifdef _PC_PIPE_BUF
- { "PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
-#endif
-#ifdef _PC_PIPE_BUF
- { "_POSIX_PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
-#endif
-#ifdef _PC_SOCK_MAXBUF
- { "SOCK_MAXBUF", _PC_SOCK_MAXBUF, PATHCONF },
-#endif
-#ifdef _PC_ASYNC_IO
- { "_POSIX_ASYNC_IO", _PC_ASYNC_IO, PATHCONF },
-#endif
-#ifdef _PC_CHOWN_RESTRICTED
- { "_POSIX_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED, PATHCONF },
-#endif
-#ifdef _PC_NO_TRUNC
- { "_POSIX_NO_TRUNC", _PC_NO_TRUNC, PATHCONF },
-#endif
-#ifdef _PC_PRIO_IO
- { "_POSIX_PRIO_IO", _PC_PRIO_IO, PATHCONF },
-#endif
-#ifdef _PC_SYNC_IO
- { "_POSIX_SYNC_IO", _PC_SYNC_IO, PATHCONF },
-#endif
-#ifdef _PC_VDISABLE
- { "_POSIX_VDISABLE", _PC_VDISABLE, PATHCONF },
-#endif
-
-#ifdef _SC_ARG_MAX
- { "ARG_MAX", _SC_ARG_MAX, SYSCONF },
-#endif
-#ifdef _SC_ATEXIT_MAX
- { "ATEXIT_MAX", _SC_ATEXIT_MAX, SYSCONF },
-#endif
-#ifdef _SC_CHAR_BIT
- { "CHAR_BIT", _SC_CHAR_BIT, SYSCONF },
-#endif
-#ifdef _SC_CHAR_MAX
- { "CHAR_MAX", _SC_CHAR_MAX, SYSCONF },
-#endif
-#ifdef _SC_CHAR_MIN
- { "CHAR_MIN", _SC_CHAR_MIN, SYSCONF },
-#endif
-#ifdef _SC_CHILD_MAX
- { "CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
-#endif
-#ifdef _SC_CLK_TCK
- { "CLK_TCK", _SC_CLK_TCK, SYSCONF },
-#endif
-#ifdef _SC_INT_MAX
- { "INT_MAX", _SC_INT_MAX, SYSCONF },
-#endif
-#ifdef _SC_INT_MIN
- { "INT_MIN", _SC_INT_MIN, SYSCONF },
-#endif
-#ifdef _SC_UIO_MAXIOV
- { "IOV_MAX", _SC_UIO_MAXIOV, SYSCONF },
-#endif
-#ifdef _SC_LOGIN_NAME_MAX
- { "LOGNAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_LONG_BIT
- { "LONG_BIT", _SC_LONG_BIT, SYSCONF },
-#endif
-#ifdef _SC_MB_LEN_MAX
- { "MB_LEN_MAX", _SC_MB_LEN_MAX, SYSCONF },
-#endif
-#ifdef _SC_NGROUPS_MAX
- { "NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
-#endif
-#ifdef _SC_NL_ARGMAX
- { "NL_ARGMAX", _SC_NL_ARGMAX, SYSCONF },
-#endif
-#ifdef _SC_NL_LANGMAX
- { "NL_LANGMAX", _SC_NL_LANGMAX, SYSCONF },
-#endif
-#ifdef _SC_NL_MSGMAX
- { "NL_MSGMAX", _SC_NL_MSGMAX, SYSCONF },
-#endif
-#ifdef _SC_NL_NMAX
- { "NL_NMAX", _SC_NL_NMAX, SYSCONF },
-#endif
-#ifdef _SC_NL_SETMAX
- { "NL_SETMAX", _SC_NL_SETMAX, SYSCONF },
-#endif
-#ifdef _SC_NL_TEXTMAX
- { "NL_TEXTMAX", _SC_NL_TEXTMAX, SYSCONF },
-#endif
-#ifdef _SC_GETGR_R_SIZE_MAX
- { "NSS_BUFLEN_GROUP", _SC_GETGR_R_SIZE_MAX, SYSCONF },
-#endif
-#ifdef _SC_GETPW_R_SIZE_MAX
- { "NSS_BUFLEN_PASSWD", _SC_GETPW_R_SIZE_MAX, SYSCONF },
-#endif
-#ifdef _SC_NZERO
- { "NZERO", _SC_NZERO, SYSCONF },
-#endif
-#ifdef _SC_OPEN_MAX
- { "OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
-#endif
-#ifdef _SC_PAGESIZE
- { "PAGESIZE", _SC_PAGESIZE, SYSCONF },
-#endif
-#ifdef _SC_PAGESIZE
- { "PAGE_SIZE", _SC_PAGESIZE, SYSCONF },
-#endif
-#ifdef _SC_PASS_MAX
- { "PASS_MAX", _SC_PASS_MAX, SYSCONF },
-#endif
-#ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
- { "PTHREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS, SYSCONF },
-#endif
-#ifdef _SC_THREAD_KEYS_MAX
- { "PTHREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX, SYSCONF },
-#endif
-#ifdef _SC_THREAD_STACK_MIN
- { "PTHREAD_STACK_MIN", _SC_THREAD_STACK_MIN, SYSCONF },
-#endif
-#ifdef _SC_THREAD_THREADS_MAX
- { "PTHREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX, SYSCONF },
-#endif
-#ifdef _SC_SCHAR_MAX
- { "SCHAR_MAX", _SC_SCHAR_MAX, SYSCONF },
-#endif
-#ifdef _SC_SCHAR_MIN
- { "SCHAR_MIN", _SC_SCHAR_MIN, SYSCONF },
-#endif
-#ifdef _SC_SHRT_MAX
- { "SHRT_MAX", _SC_SHRT_MAX, SYSCONF },
-#endif
-#ifdef _SC_SHRT_MIN
- { "SHRT_MIN", _SC_SHRT_MIN, SYSCONF },
-#endif
-#ifdef _SC_SSIZE_MAX
- { "SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
-#endif
-#ifdef _SC_TTY_NAME_MAX
- { "TTY_NAME_MAX", _SC_TTY_NAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_TZNAME_MAX
- { "TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_UCHAR_MAX
- { "UCHAR_MAX", _SC_UCHAR_MAX, SYSCONF },
-#endif
-#ifdef _SC_UINT_MAX
- { "UINT_MAX", _SC_UINT_MAX, SYSCONF },
-#endif
-#ifdef _SC_UIO_MAXIOV
- { "UIO_MAXIOV", _SC_UIO_MAXIOV, SYSCONF },
-#endif
-#ifdef _SC_ULONG_MAX
- { "ULONG_MAX", _SC_ULONG_MAX, SYSCONF },
-#endif
-#ifdef _SC_USHRT_MAX
- { "USHRT_MAX", _SC_USHRT_MAX, SYSCONF },
-#endif
-#ifdef _SC_WORD_BIT
- { "WORD_BIT", _SC_WORD_BIT, SYSCONF },
-#endif
-#ifdef _SC_AVPHYS_PAGES
- { "_AVPHYS_PAGES", _SC_AVPHYS_PAGES, SYSCONF },
-#endif
-#ifdef _SC_NPROCESSORS_CONF
- { "_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF, SYSCONF },
-#endif
-#ifdef _SC_NPROCESSORS_ONLN
- { "_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN, SYSCONF },
-#endif
-#ifdef _SC_PHYS_PAGES
- { "_PHYS_PAGES", _SC_PHYS_PAGES, SYSCONF },
-#endif
-#ifdef _SC_ARG_MAX
- { "_POSIX_ARG_MAX", _SC_ARG_MAX, SYSCONF },
-#endif
-#ifdef _SC_ASYNCHRONOUS_IO
- { "_POSIX_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO, SYSCONF },
-#endif
-#ifdef _SC_CHILD_MAX
- { "_POSIX_CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
-#endif
-#ifdef _SC_FSYNC
- { "_POSIX_FSYNC", _SC_FSYNC, SYSCONF },
-#endif
-#ifdef _SC_JOB_CONTROL
- { "_POSIX_JOB_CONTROL", _SC_JOB_CONTROL, SYSCONF },
-#endif
-#ifdef _SC_MAPPED_FILES
- { "_POSIX_MAPPED_FILES", _SC_MAPPED_FILES, SYSCONF },
-#endif
-#ifdef _SC_MEMLOCK
- { "_POSIX_MEMLOCK", _SC_MEMLOCK, SYSCONF },
-#endif
-#ifdef _SC_MEMLOCK_RANGE
- { "_POSIX_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE, SYSCONF },
-#endif
-#ifdef _SC_MEMORY_PROTECTION
- { "_POSIX_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION, SYSCONF },
-#endif
-#ifdef _SC_MESSAGE_PASSING
- { "_POSIX_MESSAGE_PASSING", _SC_MESSAGE_PASSING, SYSCONF },
-#endif
-#ifdef _SC_NGROUPS_MAX
- { "_POSIX_NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
-#endif
-#ifdef _SC_OPEN_MAX
- { "_POSIX_OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
-#endif
-#ifdef _SC_PII
- { "_POSIX_PII", _SC_PII, SYSCONF },
-#endif
-#ifdef _SC_PII_INTERNET
- { "_POSIX_PII_INTERNET", _SC_PII_INTERNET, SYSCONF },
-#endif
-#ifdef _SC_PII_INTERNET_DGRAM
- { "_POSIX_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM, SYSCONF },
-#endif
-#ifdef _SC_PII_INTERNET_STREAM
- { "_POSIX_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM, SYSCONF },
-#endif
-#ifdef _SC_PII_OSI
- { "_POSIX_PII_OSI", _SC_PII_OSI, SYSCONF },
-#endif
-#ifdef _SC_PII_OSI_CLTS
- { "_POSIX_PII_OSI_CLTS", _SC_PII_OSI_CLTS, SYSCONF },
-#endif
-#ifdef _SC_PII_OSI_COTS
- { "_POSIX_PII_OSI_COTS", _SC_PII_OSI_COTS, SYSCONF },
-#endif
-#ifdef _SC_PII_OSI_M
- { "_POSIX_PII_OSI_M", _SC_PII_OSI_M, SYSCONF },
-#endif
-#ifdef _SC_PII_SOCKET
- { "_POSIX_PII_SOCKET", _SC_PII_SOCKET, SYSCONF },
-#endif
-#ifdef _SC_PII_XTI
- { "_POSIX_PII_XTI", _SC_PII_XTI, SYSCONF },
-#endif
-#ifdef _SC_POLL
- { "_POSIX_POLL", _SC_POLL, SYSCONF },
-#endif
-#ifdef _SC_PRIORITIZED_IO
- { "_POSIX_PRIORITIZED_IO", _SC_PRIORITIZED_IO, SYSCONF },
-#endif
-#ifdef _SC_PRIORITY_SCHEDULING
- { "_POSIX_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING, SYSCONF },
-#endif
-#ifdef _SC_REALTIME_SIGNALS
- { "_POSIX_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS, SYSCONF },
-#endif
-#ifdef _SC_SAVED_IDS
- { "_POSIX_SAVED_IDS", _SC_SAVED_IDS, SYSCONF },
-#endif
-#ifdef _SC_SELECT
- { "_POSIX_SELECT", _SC_SELECT, SYSCONF },
-#endif
-#ifdef _SC_SEMAPHORES
- { "_POSIX_SEMAPHORES", _SC_SEMAPHORES, SYSCONF },
-#endif
-#ifdef _SC_SHARED_MEMORY_OBJECTS
- { "_POSIX_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS, SYSCONF },
-#endif
-#ifdef _SC_SSIZE_MAX
- { "_POSIX_SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
-#endif
-#ifdef _SC_STREAM_MAX
- { "_POSIX_STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
-#endif
-#ifdef _SC_SYNCHRONIZED_IO
- { "_POSIX_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO, SYSCONF },
-#endif
-#ifdef _SC_THREADS
- { "_POSIX_THREADS", _SC_THREADS, SYSCONF },
-#endif
-#ifdef _SC_THREAD_ATTR_STACKADDR
- { "_POSIX_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR, SYSCONF },
-#endif
-#ifdef _SC_THREAD_ATTR_STACKSIZE
- { "_POSIX_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE, SYSCONF },
-#endif
-#ifdef _SC_THREAD_PRIORITY_SCHEDULING
- { "_POSIX_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING, SYSCONF },
-#endif
-#ifdef _SC_THREAD_PRIO_INHERIT
- { "_POSIX_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT, SYSCONF },
-#endif
-#ifdef _SC_THREAD_PRIO_PROTECT
- { "_POSIX_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT, SYSCONF },
-#endif
-#ifdef _SC_THREAD_ROBUST_PRIO_INHERIT
- { "_POSIX_THREAD_ROBUST_PRIO_INHERIT", _SC_THREAD_ROBUST_PRIO_INHERIT,
- SYSCONF },
-#endif
-#ifdef _SC_THREAD_ROBUST_PRIO_PROTECT
- { "_POSIX_THREAD_ROBUST_PRIO_PROTECT", _SC_THREAD_ROBUST_PRIO_PROTECT,
- SYSCONF },
-#endif
-#ifdef _SC_THREAD_PROCESS_SHARED
- { "_POSIX_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED, SYSCONF },
-#endif
-#ifdef _SC_THREAD_SAFE_FUNCTIONS
- { "_POSIX_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS, SYSCONF },
-#endif
-#ifdef _SC_TIMERS
- { "_POSIX_TIMERS", _SC_TIMERS, SYSCONF },
-#endif
-#ifdef _SC_TIMER_MAX
- { "TIMER_MAX", _SC_TIMER_MAX, SYSCONF },
-#endif
-#ifdef _SC_TZNAME_MAX
- { "_POSIX_TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_VERSION
- { "_POSIX_VERSION", _SC_VERSION, SYSCONF },
-#endif
-#ifdef _SC_T_IOV_MAX
- { "_T_IOV_MAX", _SC_T_IOV_MAX, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_CRYPT
- { "_XOPEN_CRYPT", _SC_XOPEN_CRYPT, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_ENH_I18N
- { "_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_LEGACY
- { "_XOPEN_LEGACY", _SC_XOPEN_LEGACY, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_REALTIME
- { "_XOPEN_REALTIME", _SC_XOPEN_REALTIME, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_REALTIME_THREADS
- { "_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_SHM
- { "_XOPEN_SHM", _SC_XOPEN_SHM, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_UNIX
- { "_XOPEN_UNIX", _SC_XOPEN_UNIX, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_VERSION
- { "_XOPEN_VERSION", _SC_XOPEN_VERSION, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_XCU_VERSION
- { "_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_XPG2
- { "_XOPEN_XPG2", _SC_XOPEN_XPG2, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_XPG3
- { "_XOPEN_XPG3", _SC_XOPEN_XPG3, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_XPG4
- { "_XOPEN_XPG4", _SC_XOPEN_XPG4, SYSCONF },
-#endif
- /* POSIX.2 */
-#ifdef _SC_BC_BASE_MAX
- { "BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_DIM_MAX
- { "BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_SCALE_MAX
- { "BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_STRING_MAX
- { "BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
-#endif
- { "CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX, SYSCONF },
-#ifdef _SC_COLL_WEIGHTS_MAX
- { "COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
-#endif
-#ifdef _SC_EQUIV_CLASS_MAX
- { "EQUIV_CLASS_MAX", _SC_EQUIV_CLASS_MAX, SYSCONF },
-#endif
-#ifdef _SC_EXPR_NEST_MAX
- { "EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
-#endif
-#ifdef _SC_LINE_MAX
- { "LINE_MAX", _SC_LINE_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_BASE_MAX
- { "POSIX2_BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_DIM_MAX
- { "POSIX2_BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_SCALE_MAX
- { "POSIX2_BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_STRING_MAX
- { "POSIX2_BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
-#endif
-#ifdef _SC_2_CHAR_TERM
- { "POSIX2_CHAR_TERM", _SC_2_CHAR_TERM, SYSCONF },
-#endif
-#ifdef _SC_COLL_WEIGHTS_MAX
- { "POSIX2_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
-#endif
-#ifdef _SC_2_C_BIND
- { "POSIX2_C_BIND", _SC_2_C_BIND, SYSCONF },
-#endif
-#ifdef _SC_2_C_DEV
- { "POSIX2_C_DEV", _SC_2_C_DEV, SYSCONF },
-#endif
-#ifdef _SC_2_C_VERSION
- { "POSIX2_C_VERSION", _SC_2_C_VERSION, SYSCONF },
-#endif
-#ifdef _SC_EXPR_NEST_MAX
- { "POSIX2_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
-#endif
-#ifdef _SC_2_FORT_DEV
- { "POSIX2_FORT_DEV", _SC_2_FORT_DEV, SYSCONF },
-#endif
-#ifdef _SC_2_FORT_RUN
- { "POSIX2_FORT_RUN", _SC_2_FORT_RUN, SYSCONF },
-#endif
-#ifdef _SC_LINE_MAX
- { "_POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
- { "POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
-#endif
-#ifdef _SC_2_LOCALEDEF
- { "POSIX2_LOCALEDEF", _SC_2_LOCALEDEF, SYSCONF },
-#endif
-#ifdef _SC_RE_DUP_MAX
- { "POSIX2_RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
-#endif
-#ifdef _SC_2_SW_DEV
- { "POSIX2_SW_DEV", _SC_2_SW_DEV, SYSCONF },
-#endif
-#ifdef _SC_2_UPE
- { "POSIX2_UPE", _SC_2_UPE, SYSCONF },
-#endif
-#ifdef _SC_2_VERSION
- { "POSIX2_VERSION", _SC_2_VERSION, SYSCONF },
-#endif
-#ifdef _SC_RE_DUP_MAX
- { "RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
-#endif
-
-#ifdef _CS_PATH
- { "PATH", _CS_PATH, CONFSTR },
- { "CS_PATH", _CS_PATH, CONFSTR },
-#endif
-
- /* LFS */
-#ifdef _CS_LFS_CFLAGS
- { "LFS_CFLAGS", _CS_LFS_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_LFS_LDFLAGS
- { "LFS_LDFLAGS", _CS_LFS_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_LFS_LIBS
- { "LFS_LIBS", _CS_LFS_LIBS, CONFSTR },
-#endif
-#ifdef _CS_LFS_LINTFLAGS
- { "LFS_LINTFLAGS", _CS_LFS_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _CS_LFS64_CFLAGS
- { "LFS64_CFLAGS", _CS_LFS64_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_LFS64_LDFLAGS
- { "LFS64_LDFLAGS", _CS_LFS64_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_LFS64_LIBS
- { "LFS64_LIBS", _CS_LFS64_LIBS, CONFSTR },
-#endif
-#ifdef _CS_LFS64_LINTFLAGS
- { "LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS, CONFSTR },
-#endif
-
- /* Programming environments. */
-#ifdef _CS_V5_WIDTH_RESTRICTED_ENVS
- { "_XBS5_WIDTH_RESTRICTED_ENVS", _CS_V5_WIDTH_RESTRICTED_ENVS, CONFSTR },
- { "XBS5_WIDTH_RESTRICTED_ENVS", _CS_V5_WIDTH_RESTRICTED_ENVS, CONFSTR },
-#endif
-
-#ifdef _SC_XBS5_ILP32_OFF32
- { "_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32, SYSCONF },
-#endif
-#ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
- { "XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
- { "XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFF32_LIBS
- { "XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
- { "XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _SC_XBS5_ILP32_OFFBIG
- { "_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
- { "XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
- { "XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
- { "XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
- { "XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _SC_XBS5_LP64_OFF64
- { "_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64, SYSCONF },
-#endif
-#ifdef _CS_XBS5_LP64_OFF64_CFLAGS
- { "XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
- { "XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LP64_OFF64_LIBS
- { "XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
- { "XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _SC_XBS5_LPBIG_OFFBIG
- { "_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
- { "XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
- { "XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
- { "XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
- { "XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _SC_V6_ILP32_OFF32
- { "_POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
- { "POSIX_V6_ILP32_OFF32_CFLAGS", _CS_POSIX_V6_ILP32_OFF32_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
- { "POSIX_V6_ILP32_OFF32_LDFLAGS", _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
- { "POSIX_V6_ILP32_OFF32_LIBS", _CS_POSIX_V6_ILP32_OFF32_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
- { "POSIX_V6_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
- { "_POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
- { "POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
-#endif
-
-#ifdef _SC_V6_ILP32_OFFBIG
- { "_POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
- { "POSIX_V6_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
- { "POSIX_V6_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
- { "POSIX_V6_ILP32_OFFBIG_LIBS", _CS_POSIX_V6_ILP32_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
- { "POSIX_V6_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _SC_V6_LP64_OFF64
- { "_POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
- { "POSIX_V6_LP64_OFF64_CFLAGS", _CS_POSIX_V6_LP64_OFF64_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
- { "POSIX_V6_LP64_OFF64_LDFLAGS", _CS_POSIX_V6_LP64_OFF64_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
- { "POSIX_V6_LP64_OFF64_LIBS", _CS_POSIX_V6_LP64_OFF64_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
- { "POSIX_V6_LP64_OFF64_LINTFLAGS", _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _SC_V6_LPBIG_OFFBIG
- { "_POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
- { "POSIX_V6_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
- { "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
- { "POSIX_V6_LPBIG_OFFBIG_LIBS", _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
- { "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _SC_V7_ILP32_OFF32
- { "_POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFF32_CFLAGS
- { "POSIX_V7_ILP32_OFF32_CFLAGS", _CS_POSIX_V7_ILP32_OFF32_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
- { "POSIX_V7_ILP32_OFF32_LDFLAGS", _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFF32_LIBS
- { "POSIX_V7_ILP32_OFF32_LIBS", _CS_POSIX_V7_ILP32_OFF32_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS
- { "POSIX_V7_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _CS_V7_WIDTH_RESTRICTED_ENVS
- { "_POSIX_V7_WIDTH_RESTRICTED_ENVS", _CS_V7_WIDTH_RESTRICTED_ENVS, CONFSTR },
- { "POSIX_V7_WIDTH_RESTRICTED_ENVS", _CS_V7_WIDTH_RESTRICTED_ENVS, CONFSTR },
-#endif
-
-#ifdef _SC_V7_ILP32_OFFBIG
- { "_POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
- { "POSIX_V7_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
- { "POSIX_V7_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFFBIG_LIBS
- { "POSIX_V7_ILP32_OFFBIG_LIBS", _CS_POSIX_V7_ILP32_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS
- { "POSIX_V7_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _SC_V7_LP64_OFF64
- { "_POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V7_LP64_OFF64_CFLAGS
- { "POSIX_V7_LP64_OFF64_CFLAGS", _CS_POSIX_V7_LP64_OFF64_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LP64_OFF64_LDFLAGS
- { "POSIX_V7_LP64_OFF64_LDFLAGS", _CS_POSIX_V7_LP64_OFF64_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LP64_OFF64_LIBS
- { "POSIX_V7_LP64_OFF64_LIBS", _CS_POSIX_V7_LP64_OFF64_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LP64_OFF64_LINTFLAGS
- { "POSIX_V7_LP64_OFF64_LINTFLAGS", _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _SC_V7_LPBIG_OFFBIG
- { "_POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
- { "POSIX_V7_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
- { "POSIX_V7_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
- { "POSIX_V7_LPBIG_OFFBIG_LIBS", _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
- { "POSIX_V7_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-
-#ifdef _SC_ADVISORY_INFO
- { "_POSIX_ADVISORY_INFO", _SC_ADVISORY_INFO, SYSCONF },
-#endif
-#ifdef _SC_BARRIERS
- { "_POSIX_BARRIERS", _SC_BARRIERS, SYSCONF },
-#endif
-#ifdef _SC_BASE
- { "_POSIX_BASE", _SC_BASE, SYSCONF },
-#endif
-#ifdef _SC_C_LANG_SUPPORT
- { "_POSIX_C_LANG_SUPPORT", _SC_C_LANG_SUPPORT, SYSCONF },
-#endif
-#ifdef _SC_C_LANG_SUPPORT_R
- { "_POSIX_C_LANG_SUPPORT_R", _SC_C_LANG_SUPPORT_R, SYSCONF },
-#endif
-#ifdef _SC_CLOCK_SELECTION
- { "_POSIX_CLOCK_SELECTION", _SC_CLOCK_SELECTION, SYSCONF },
-#endif
-#ifdef _SC_CPUTIME
- { "_POSIX_CPUTIME", _SC_CPUTIME, SYSCONF },
-#endif
-#ifdef _SC_THREAD_CPUTIME
- { "_POSIX_THREAD_CPUTIME", _SC_THREAD_CPUTIME, SYSCONF },
-#endif
-#ifdef _SC_DEVICE_SPECIFIC
- { "_POSIX_DEVICE_SPECIFIC", _SC_DEVICE_SPECIFIC, SYSCONF },
-#endif
-#ifdef _SC_DEVICE_SPECIFIC_R
- { "_POSIX_DEVICE_SPECIFIC_R", _SC_DEVICE_SPECIFIC_R, SYSCONF },
-#endif
-#ifdef _SC_FD_MGMT
- { "_POSIX_FD_MGMT", _SC_FD_MGMT, SYSCONF },
-#endif
-#ifdef _SC_FIFO
- { "_POSIX_FIFO", _SC_FIFO, SYSCONF },
-#endif
-#ifdef _SC_PIPE
- { "_POSIX_PIPE", _SC_PIPE, SYSCONF },
-#endif
-#ifdef _SC_FILE_ATTRIBUTES
- { "_POSIX_FILE_ATTRIBUTES", _SC_FILE_ATTRIBUTES, SYSCONF },
-#endif
-#ifdef _SC_FILE_LOCKING
- { "_POSIX_FILE_LOCKING", _SC_FILE_LOCKING, SYSCONF },
-#endif
-#ifdef _SC_FILE_SYSTEM
- { "_POSIX_FILE_SYSTEM", _SC_FILE_SYSTEM, SYSCONF },
-#endif
-#ifdef _SC_MONOTONIC_CLOCK
- { "_POSIX_MONOTONIC_CLOCK", _SC_MONOTONIC_CLOCK, SYSCONF },
-#endif
-#ifdef _SC_MULTI_PROCESS
- { "_POSIX_MULTI_PROCESS", _SC_MULTI_PROCESS, SYSCONF },
-#endif
-#ifdef _SC_SINGLE_PROCESS
- { "_POSIX_SINGLE_PROCESS", _SC_SINGLE_PROCESS, SYSCONF },
-#endif
-#ifdef _SC_NETWORKING
- { "_POSIX_NETWORKING", _SC_NETWORKING, SYSCONF },
-#endif
-#ifdef _SC_READER_WRITER_LOCKS
- { "_POSIX_READER_WRITER_LOCKS", _SC_READER_WRITER_LOCKS, SYSCONF },
-#endif
-#ifdef _SC_SPIN_LOCKS
- { "_POSIX_SPIN_LOCKS", _SC_SPIN_LOCKS, SYSCONF },
-#endif
-#ifdef _SC_REGEXP
- { "_POSIX_REGEXP", _SC_REGEXP, SYSCONF },
-#endif
-#ifdef _SC_REGEX_VERSION
- { "_REGEX_VERSION", _SC_REGEX_VERSION, SYSCONF },
-#endif
-#ifdef _SC_SHELL
- { "_POSIX_SHELL", _SC_SHELL, SYSCONF },
-#endif
-#ifdef _SC_SIGNALS
- { "_POSIX_SIGNALS", _SC_SIGNALS, SYSCONF },
-#endif
-#ifdef _SC_SPAWN
- { "_POSIX_SPAWN", _SC_SPAWN, SYSCONF },
-#endif
-#ifdef _SC_SPORADIC_SERVER
- { "_POSIX_SPORADIC_SERVER", _SC_SPORADIC_SERVER, SYSCONF },
-#endif
-#ifdef _SC_THREAD_SPORADIC_SERVER
- { "_POSIX_THREAD_SPORADIC_SERVER", _SC_THREAD_SPORADIC_SERVER, SYSCONF },
-#endif
-#ifdef _SC_SYSTEM_DATABASE
- { "_POSIX_SYSTEM_DATABASE", _SC_SYSTEM_DATABASE, SYSCONF },
-#endif
-#ifdef _SC_SYSTEM_DATABASE_R
- { "_POSIX_SYSTEM_DATABASE_R", _SC_SYSTEM_DATABASE_R, SYSCONF },
-#endif
-#ifdef _SC_TIMEOUTS
- { "_POSIX_TIMEOUTS", _SC_TIMEOUTS, SYSCONF },
-#endif
-#ifdef _SC_TYPED_MEMORY_OBJECTS
- { "_POSIX_TYPED_MEMORY_OBJECTS", _SC_TYPED_MEMORY_OBJECTS, SYSCONF },
-#endif
-#ifdef _SC_USER_GROUPS
- { "_POSIX_USER_GROUPS", _SC_USER_GROUPS, SYSCONF },
-#endif
-#ifdef _SC_USER_GROUPS_R
- { "_POSIX_USER_GROUPS_R", _SC_USER_GROUPS_R, SYSCONF },
-#endif
-#ifdef _SC_2_PBS
- { "POSIX2_PBS", _SC_2_PBS, SYSCONF },
-#endif
-#ifdef _SC_2_PBS_ACCOUNTING
- { "POSIX2_PBS_ACCOUNTING", _SC_2_PBS_ACCOUNTING, SYSCONF },
-#endif
-#ifdef _SC_2_PBS_LOCATE
- { "POSIX2_PBS_LOCATE", _SC_2_PBS_LOCATE, SYSCONF },
-#endif
-#ifdef _SC_2_PBS_TRACK
- { "POSIX2_PBS_TRACK", _SC_2_PBS_TRACK, SYSCONF },
-#endif
-#ifdef _SC_2_PBS_MESSAGE
- { "POSIX2_PBS_MESSAGE", _SC_2_PBS_MESSAGE, SYSCONF },
-#endif
-#ifdef _SC_SYMLOOP_MAX
- { "SYMLOOP_MAX", _SC_SYMLOOP_MAX, SYSCONF },
-#endif
-#ifdef _SC_STREAM_MAX
- { "STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
-#endif
-#ifdef _SC_AIO_LISTIO_MAX
- { "AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX, SYSCONF },
-#endif
-#ifdef _SC_AIO_MAX
- { "AIO_MAX", _SC_AIO_MAX, SYSCONF },
-#endif
-#ifdef _SC_AIO_PRIO_DELTA_MAX
- { "AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX, SYSCONF },
-#endif
-#ifdef _SC_DELAYTIMER_MAX
- { "DELAYTIMER_MAX", _SC_DELAYTIMER_MAX, SYSCONF },
-#endif
-#ifdef _SC_HOST_NAME_MAX
- { "HOST_NAME_MAX", _SC_HOST_NAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_LOGIN_NAME_MAX
- { "LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_MQ_OPEN_MAX
- { "MQ_OPEN_MAX", _SC_MQ_OPEN_MAX, SYSCONF },
-#endif
-#ifdef _SC_MQ_PRIO_MAX
- { "MQ_PRIO_MAX", _SC_MQ_PRIO_MAX, SYSCONF },
-#endif
-#ifdef _SC_DEVICE_IO
- { "_POSIX_DEVICE_IO", _SC_DEVICE_IO, SYSCONF },
-#endif
-#ifdef _SC_TRACE
- { "_POSIX_TRACE", _SC_TRACE, SYSCONF },
-#endif
-#ifdef _SC_TRACE_EVENT_FILTER
- { "_POSIX_TRACE_EVENT_FILTER", _SC_TRACE_EVENT_FILTER, SYSCONF },
-#endif
-#ifdef _SC_TRACE_INHERIT
- { "_POSIX_TRACE_INHERIT", _SC_TRACE_INHERIT, SYSCONF },
-#endif
-#ifdef _SC_TRACE_LOG
- { "_POSIX_TRACE_LOG", _SC_TRACE_LOG, SYSCONF },
-#endif
-#ifdef _SC_RTSIG_MAX
- { "RTSIG_MAX", _SC_RTSIG_MAX, SYSCONF },
-#endif
-#ifdef _SC_SEM_NSEMS_MAX
- { "SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX, SYSCONF },
-#endif
-#ifdef _SC_SEM_VALUE_MAX
- { "SEM_VALUE_MAX", _SC_SEM_VALUE_MAX, SYSCONF },
-#endif
-#ifdef _SC_SIGQUEUE_MAX
- { "SIGQUEUE_MAX", _SC_SIGQUEUE_MAX, SYSCONF },
-#endif
-#ifdef _PC_FILESIZEBITS
- { "FILESIZEBITS", _PC_FILESIZEBITS, PATHCONF },
-#endif
-#ifdef _PC_ALLOC_SIZE_MIN
- { "POSIX_ALLOC_SIZE_MIN", _PC_ALLOC_SIZE_MIN, PATHCONF },
-#endif
-#ifdef _PC_REC_INCR_XFER_SIZE
- { "POSIX_REC_INCR_XFER_SIZE", _PC_REC_INCR_XFER_SIZE, PATHCONF },
-#endif
-#ifdef _PC_REC_MAX_XFER_SIZE
- { "POSIX_REC_MAX_XFER_SIZE", _PC_REC_MAX_XFER_SIZE, PATHCONF },
-#endif
-#ifdef _PC_REC_MIN_XFER_SIZE
- { "POSIX_REC_MIN_XFER_SIZE", _PC_REC_MIN_XFER_SIZE, PATHCONF },
-#endif
-#ifdef _PC_REC_XFER_ALIGN
- { "POSIX_REC_XFER_ALIGN", _PC_REC_XFER_ALIGN, PATHCONF },
-#endif
-#ifdef _PC_SYMLINK_MAX
- { "SYMLINK_MAX", _PC_SYMLINK_MAX, PATHCONF },
-#endif
-#ifdef _CS_GNU_LIBC_VERSION
- { "GNU_LIBC_VERSION", _CS_GNU_LIBC_VERSION, CONFSTR },
-#endif
-#ifdef _CS_GNU_LIBPTHREAD_VERSION
- { "GNU_LIBPTHREAD_VERSION", _CS_GNU_LIBPTHREAD_VERSION, CONFSTR },
-#endif
-#ifdef _PC_2_SYMLINKS
- { "POSIX2_SYMLINKS", _PC_2_SYMLINKS, PATHCONF },
-#endif
-
-#ifdef _SC_LEVEL1_ICACHE_SIZE
- { "LEVEL1_ICACHE_SIZE", _SC_LEVEL1_ICACHE_SIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL1_ICACHE_ASSOC
- { "LEVEL1_ICACHE_ASSOC", _SC_LEVEL1_ICACHE_ASSOC, SYSCONF },
-#endif
-#ifdef _SC_LEVEL1_ICACHE_LINESIZE
- { "LEVEL1_ICACHE_LINESIZE", _SC_LEVEL1_ICACHE_LINESIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL1_DCACHE_SIZE
- { "LEVEL1_DCACHE_SIZE", _SC_LEVEL1_DCACHE_SIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL1_DCACHE_ASSOC
- { "LEVEL1_DCACHE_ASSOC", _SC_LEVEL1_DCACHE_ASSOC, SYSCONF },
-#endif
-#ifdef _SC_LEVEL1_DCACHE_LINESIZE
- { "LEVEL1_DCACHE_LINESIZE", _SC_LEVEL1_DCACHE_LINESIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL2_CACHE_SIZE
- { "LEVEL2_CACHE_SIZE", _SC_LEVEL2_CACHE_SIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL2_CACHE_ASSOC
- { "LEVEL2_CACHE_ASSOC", _SC_LEVEL2_CACHE_ASSOC, SYSCONF },
-#endif
-#ifdef _SC_LEVEL2_CACHE_LINESIZE
- { "LEVEL2_CACHE_LINESIZE", _SC_LEVEL2_CACHE_LINESIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL3_CACHE_SIZE
- { "LEVEL3_CACHE_SIZE", _SC_LEVEL3_CACHE_SIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL3_CACHE_ASSOC
- { "LEVEL3_CACHE_ASSOC", _SC_LEVEL3_CACHE_ASSOC, SYSCONF },
-#endif
-#ifdef _SC_LEVEL3_CACHE_LINESIZE
- { "LEVEL3_CACHE_LINESIZE", _SC_LEVEL3_CACHE_LINESIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL4_CACHE_SIZE
- { "LEVEL4_CACHE_SIZE", _SC_LEVEL4_CACHE_SIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL4_CACHE_ASSOC
- { "LEVEL4_CACHE_ASSOC", _SC_LEVEL4_CACHE_ASSOC, SYSCONF },
-#endif
-#ifdef _SC_LEVEL4_CACHE_LINESIZE
- { "LEVEL4_CACHE_LINESIZE", _SC_LEVEL4_CACHE_LINESIZE, SYSCONF },
-#endif
-
-#ifdef _SC_IPV6
- { "IPV6", _SC_IPV6, SYSCONF },
-#endif
-#ifdef _SC_RAW_SOCKETS
- { "RAW_SOCKETS", _SC_RAW_SOCKETS, SYSCONF },
-#endif
-
- { NULL, 0, SYSCONF }
- };
-
-
-static const struct { const char *name; int num; } specs[] =
- {
- { "XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32 },
- { "XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG },
- { "XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64 },
- { "XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG },
- { "POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32 },
- { "POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG },
- { "POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64 },
- { "POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG },
- { "POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32 },
- { "POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG },
- { "POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64 },
- { "POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG },
- };
-static const int nspecs = sizeof (specs) / sizeof (specs[0]);
-
-#ifdef __UCLIBC_HAS___PROGNAME__
-extern const char *__progname;
-#else
-#define __progname "foo"
-#endif
-
-static void
-usage (void)
-{
- fprintf (stderr,
- _("Usage: %s [-v specification] variable_name [pathname]\n"),
- __progname);
- fprintf (stderr,
- _(" %s -a [pathname]\n"), __progname);
- exit (2);
-}
-
-
-static void
-print_all (const char *path)
-{
- register const struct conf *c;
- size_t clen;
- long int value;
- char *cvalue;
- for (c = vars; c->name != NULL; ++c) {
- printf("%-35s", c->name);
- switch (c->call) {
- case PATHCONF:
- value = pathconf (path, c->call_name);
- if (value != -1) {
- printf("%ld", value);
- }
- printf("\n");
- break;
- case SYSCONF:
- value = sysconf (c->call_name);
- if (value == -1l) {
- if (c->call_name == _SC_UINT_MAX
- || c->call_name == _SC_ULONG_MAX)
- printf ("%lu", value);
- }
- else {
- printf ("%ld", value);
- }
- printf ("\n");
- break;
- case CONFSTR:
- clen = confstr (c->call_name, (char *) NULL, 0);
- cvalue = (char *) malloc (clen);
- if (cvalue == NULL)
- error (3, 0, _("memory exhausted"));
- if (confstr (c->call_name, cvalue, clen) != clen)
- error (3, errno, "confstr");
- printf ("%.*s\n", (int) clen, cvalue);
- free (cvalue);
- break;
- }
- }
- exit (0);
-}
-
-int
-main (int argc, char *argv[])
-{
- register const struct conf *c;
-
- /* Set locale. Do not set LC_ALL because the other categories must
- not be affected (according to POSIX.2). */
-
- /* Initialize the message catalog. */
-
- if (argc > 1 && strcmp (argv[1], "--version") == 0)
- {
- printf ("getconf (GNU %s) %s\n", PACKAGE, VERSION);
- printf ("\
-Copyright (C) %s Free Software Foundation, Inc.\n\
-This is free software; see the source for copying conditions. There is NO\n\
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-", "2009");
- printf ("Written by %s.\n", "Roland McGrath");
- return 0;
- }
-
- if (argc > 1 && strcmp (argv[1], "--help") == 0)
- {
- printf ("\
-Usage: getconf [-v SPEC] VAR\n\
- or: getconf [-v SPEC] PATH_VAR PATH\n\
-\n\
-Get the configuration value for variable VAR, or for variable PATH_VAR\n\
-for path PATH. If SPEC is given, give values for compilation\n\
-environment SPEC.\n\n");
- fputs ("For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n", stdout);
- return 0;
- }
-
- const char *getconf_dir = getenv ("GETCONF_DIR") ?: GETCONF_DIR;
- size_t getconf_dirlen = strlen (getconf_dir);
-
- const char *spec = NULL;
- char buf[sizeof "POSIX_V6_LPBIG_OFFBIG"];
- char *argv0 = argv[0];
- if (argc > 1 && strncmp (argv[1], "-v", 2) == 0)
- {
- if (argv[1][2] == '\0')
- {
- if (argc < 3)
- usage ();
-
- spec = argv[2];
- argv += 2;
- argc -= 2;
- }
- else
- {
- spec = &argv[1][2];
- argv += 1;
- argc += 1;
- }
- }
- else
- {
- char default_name[getconf_dirlen + sizeof "/default"];
- memcpy (mempcpy (default_name, getconf_dir, getconf_dirlen),
- "/default", sizeof "/default");
- int len = readlink (default_name, buf, sizeof buf - 1);
- if (len > 0)
- {
- buf[len] = '\0';
- spec = buf;
- }
- }
-
- /* Check for the specifications we know. */
- if (spec != NULL)
- {
- int i;
- for (i = 0; i < nspecs; ++i)
- if (strcmp (spec, specs[i].name) == 0)
- break;
-
- if (i == nspecs)
- error (2, 0, _("unknown specification \"%s\""), spec);
-
- switch (specs[i].num)
- {
-#ifndef _XBS5_ILP32_OFF32
- case _SC_XBS5_ILP32_OFF32:
-#endif
-#ifndef _XBS5_ILP32_OFFBIG
- case _SC_XBS5_ILP32_OFFBIG:
-#endif
-#ifndef _XBS5_LP64_OFF64
- case _SC_XBS5_LP64_OFF64:
-#endif
-#ifndef _XBS5_LPBIG_OFFBIG
- case _SC_XBS5_LPBIG_OFFBIG:
-#endif
-#ifndef _POSIX_V6_ILP32_OFF32
- case _SC_V6_ILP32_OFF32:
-#endif
-#ifndef _POSIX_V6_ILP32_OFFBIG
- case _SC_V6_ILP32_OFFBIG:
-#endif
-#ifndef _POSIX_V6_LP64_OFF64
- case _SC_V6_LP64_OFF64:
-#endif
-#ifndef _POSIX_V6_LPBIG_OFFBIG
- case _SC_V6_LPBIG_OFFBIG:
-#endif
-#ifndef _POSIX_V7_ILP32_OFF32
- case _SC_V7_ILP32_OFF32:
-#endif
-#ifndef _POSIX_V7_ILP32_OFFBIG
- case _SC_V7_ILP32_OFFBIG:
-#endif
-#ifndef _POSIX_V7_LP64_OFF64
- case _SC_V7_LP64_OFF64:
-#endif
-#ifndef _POSIX_V7_LPBIG_OFFBIG
- case _SC_V7_LPBIG_OFFBIG:
-#endif
- {
- const char *args[argc + 3];
- size_t spec_len = strlen (spec);
- char getconf_name[getconf_dirlen + 1 + spec_len + 1];
- memcpy (mempcpy (mempcpy (getconf_name, getconf_dir,
- getconf_dirlen),
- "/", 1), spec, spec_len + 1);
- args[0] = argv0;
- args[1] = "-v";
- args[2] = spec;
- memcpy (&args[3], &argv[1], argc * sizeof (argv[1]));
- execv (getconf_name, (char * const *) args);
- error (4, errno, _("Couldn't execute %s"), getconf_name);
- }
- default:
- break;
- }
- }
-
- if (argc > 1 && strcmp (argv[1], "-a") == 0)
- {
- if (argc == 2)
- print_all ("/");
- else if (argc == 3)
- print_all (argv[2]);
- else
- usage ();
- }
-
- int ai = 1;
- if (argc > ai && strcmp (argv[ai], "--") == 0)
- ++ai;
-
- if (argc - ai < 1 || argc - ai > 2)
- usage ();
-
- for (c = vars; c->name != NULL; ++c)
- if (strcmp (c->name, argv[ai]) == 0
- || (strncmp (c->name, "_POSIX_", 7) == 0
- && strcmp (c->name + 7, argv[ai]) == 0))
- {
- long int value;
- size_t clen;
- char *cvalue;
- switch (c->call)
- {
- case PATHCONF:
- if (argc - ai < 2)
- usage ();
- errno = 0;
- value = pathconf (argv[ai + 1], c->call_name);
- if (value == -1)
- {
- if (errno) {
- error (3, errno, "pathconf: %s", argv[ai + 1]);
- } else
- puts (_("undefined"));
- }
- else
- printf ("%ld\n", value);
- exit (0);
-
- case SYSCONF:
- if (argc - ai > 1)
- usage ();
- value = sysconf (c->call_name);
- if (value == -1l)
- {
- if (c->call_name == _SC_UINT_MAX
- || c->call_name == _SC_ULONG_MAX)
- printf ("%lu\n", value);
- else
- puts (_("undefined"));
- }
- else
- printf ("%ld\n", value);
- exit (0);
-
- case CONFSTR:
- if (argc - ai > 1)
- usage ();
- clen = confstr (c->call_name, (char *) NULL, 0);
- cvalue = (char *) malloc (clen);
- if (cvalue == NULL)
- error (3, 0, _("memory exhausted"));
-
- if (confstr (c->call_name, cvalue, clen) != clen)
- error (3, errno, "confstr");
-
- printf ("%.*s\n", (int) clen, cvalue);
- exit (0);
- }
- }
-
- error (2, 0, _("Unrecognized variable `%s'"), argv[ai]);
- /* NOTREACHED */
- return 2;
-}
+++ /dev/null
-* Add support for time quanta and periodic threads
-* Fix detached threads / cancelation
-* support for shared libc and shared libpthread
-
-