diff options
-rw-r--r-- | libpthread/pthread/pt-internal.h.orig | 282 | ||||
-rw-r--r-- | libpthread/sysdeps/mach/hurd/i386/pt-setup.c.orig | 105 | ||||
-rw-r--r-- | pfinet.old/ethernet.c.orig | 277 | ||||
-rw-r--r-- | pfinet.old/ethernet.c.rej | 87 |
4 files changed, 0 insertions, 751 deletions
diff --git a/libpthread/pthread/pt-internal.h.orig b/libpthread/pthread/pt-internal.h.orig deleted file mode 100644 index e7c85fda..00000000 --- a/libpthread/pthread/pt-internal.h.orig +++ /dev/null @@ -1,282 +0,0 @@ -/* Internal defenitions for pthreads library. - Copyright (C) 2000, 2005, 2006, 2008 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. */ - -#ifndef _PT_INTERNAL_H -#define _PT_INTERNAL_H 1 - -#include <pthread.h> -#include <stddef.h> -#include <sched.h> -#include <signal.h> -#include <assert.h> - -#include <bits/atomic.h> - -#include <pt-key.h> - -#include <pt-sysdep.h> -#include <pt-machdep.h> - -/* Thread state. */ -enum pthread_state -{ - PTHREAD_JOINABLE = 0, - PTHREAD_DETACHED, - PTHREAD_EXITED, - PTHREAD_TERMINATED -}; - -#ifndef PTHREAD_KEY_MEMBERS -# define PTHREAD_KEY_MEMBERS -#endif - -#ifndef PTHREAD_SYSDEP_MEMBERS -# define PTHREAD_SYSDEP_MEMBERS -#endif - -/* This structure describes a POSIX thread. */ -struct __pthread -{ - /* Thread ID. */ - pthread_t thread; - - /* Cancellation. */ - int cancel_state; - int cancel_type; - int cancel_pending; - struct __pthread_cancelation_handler *cancelation_handlers; - - /* Thread stack. */ - void *stackaddr; - size_t stacksize; - size_t guardsize; /* Included in STACKSIZE (i.e. total - stack memory is STACKSIZE, not - STACKSIZE + GUARDSIZE). */ - int stack; /* Nonzero if the stack was allocated. */ - - /* Exit status. */ - void *status; - - /* Thread state. */ - enum pthread_state state; - pthread_mutex_t state_lock; /* Locks the state. */ - pthread_cond_t state_cond; /* Signalled when the state changes. */ - - /* Thread context. */ - struct pthread_mcontext mcontext; - - PTHREAD_KEY_MEMBERS - - PTHREAD_SYSDEP_MEMBERS - - struct __pthread *next, **prevp; -}; - -/* Enqueue an element THREAD on the queue *HEAD. */ -static inline void -__pthread_enqueue (struct __pthread **head, struct __pthread *thread) -{ - assert (thread->prevp == 0); - - thread->next = *head; - thread->prevp = head; - if (*head) - (*head)->prevp = &thread->next; - *head = thread; -} - -/* Dequeue the element THREAD from the queue it is connected to. */ -static inline void -__pthread_dequeue (struct __pthread *thread) -{ - assert (thread); - - if (thread->next) - thread->next->prevp = thread->prevp; - *thread->prevp = thread->next; - thread->prevp = 0; -} - -/* Iterate over QUEUE storing each element in ELEMENT. */ -#define __pthread_queue_iterate(queue, element) \ - for (struct __pthread *__pdi_next = (queue); \ - ((element) = __pdi_next) \ - && ((__pdi_next = __pdi_next->next), \ - 1); \ - ) - -/* Iterate over QUEUE dequeuing each element, storing it in - ELEMENT. */ -#define __pthread_dequeuing_iterate(queue, element) \ - for (struct __pthread *__pdi_next = (queue); \ - ((element) = __pdi_next) \ - && ((__pdi_next = __pdi_next->next), \ - ((element)->prevp = 0), \ - 1); \ - ) - -/* The total number of threads currently active. */ -extern __atomic_t __pthread_total; - -/* The total number of thread IDs currently in use, or on the list of - available thread IDs. */ -extern int __pthread_num_threads; - -/* Concurrency hint. */ -extern int __pthread_concurrency; - -/* Array of __pthread structures and its lock. Indexed by the pthread - id minus one. (Why not just use the pthread id? Because some - brain-dead users of the pthread interface incorrectly assume that 0 - is an invalid pthread id.) */ -extern struct __pthread **__pthread_threads; -extern pthread_rwlock_t __pthread_threads_lock; - -#define __pthread_getid(thread) \ - ({ struct __pthread *__t; \ - pthread_rwlock_rdlock (&__pthread_threads_lock); \ - __t = __pthread_threads[thread - 1]; \ - pthread_rwlock_unlock (&__pthread_threads_lock); \ - __t; }) - -#define __pthread_setid(thread, pthread) \ - pthread_rwlock_wrlock (&__pthread_threads_lock); \ - __pthread_threads[thread - 1] = pthread; \ - pthread_rwlock_unlock (&__pthread_threads_lock); - -/* Similar to pthread_self, but returns the thread descriptor instead - of the thread ID. */ -#ifndef _pthread_self -extern struct __pthread *_pthread_self (void); -#endif - - -/* Initialize the pthreads library. */ -extern void __pthread_initialize (void); - -/* Internal version of pthread_create. Rather than return the new - tid, we return the whole __pthread structure in *PTHREAD. */ -extern int __pthread_create_internal (struct __pthread **__restrict pthread, - const pthread_attr_t *__restrict attr, - void *(*start_routine)(void *), - void *__restrict arg); - -/* Allocate a new thread structure and a pthread thread ID (but not a - kernel thread or a stack). */ -extern int __pthread_alloc (struct __pthread **thread); - -/* Deallocate the thread structure. This is the dual of - __pthread_alloc (N.B. it does not call __pthread_stack_alloc nor - __pthread_thread_halt). */ -extern void __pthread_dealloc (struct __pthread *thread); - - -/* Allocate a stack of size STACKSIZE. The stack base shall be - returned in *STACKADDR. */ -extern int __pthread_stack_alloc (void **stackaddr, size_t stacksize); - -/* Deallocate the stack STACKADDR of size STACKSIZE. */ -extern void __pthread_stack_dealloc (void *stackaddr, size_t stacksize); - - -/* Setup thread THREAD's context. */ -extern int __pthread_setup (struct __pthread *__restrict thread, - void (*entry_point)(void *(*)(void *), - void *), - void *(*start_routine)(void *), - void *__restrict arg); - - -/* Allocate a kernel thread (and any miscellaneous system dependent - resources) for THREAD; it must not be placed on the run queue. */ -extern int __pthread_thread_alloc (struct __pthread *thread); - -/* Deallocate any kernel resources associated with THREAD except don't - halt the thread itself. On return, the thread will be marked as - dead and __pthread_halt will be called. */ -extern void __pthread_thread_dealloc (struct __pthread *thread); - -/* Start THREAD making it eligible to run. */ -extern int __pthread_thread_start (struct __pthread *thread); - -/* Stop the kernel thread associated with THREAD. If NEED_DEALLOC is - true, the function must call __pthread_dealloc on THREAD. - - NB: The thread executing this function may be the thread which is - being halted, thus the last action should be halting the thread - itself. */ -extern void __pthread_thread_halt (struct __pthread *thread, - int need_dealloc); - - -/* Block THREAD. */ -extern void __pthread_block (struct __pthread *thread); - -/* Block THREAD until *ABSTIME is reached. */ -extern error_t __pthread_timedblock (struct __pthread *__restrict thread, - const struct timespec *__restrict abstime); - -/* Wakeup THREAD. */ -extern void __pthread_wakeup (struct __pthread *thread); - - -/* Perform a cancelation. */ -extern int __pthread_do_cancel (struct __pthread *thread); - - -/* Initialize the thread specific data structures. THREAD must be the - calling thread. */ -extern error_t __pthread_init_specific (struct __pthread *thread); - -/* Call the destructors on all of the thread specific data in THREAD. - THREAD must be the calling thread. */ -extern void __pthread_destroy_specific (struct __pthread *thread); - - -/* Initialize newly create thread *THREAD's signal state data - structures. */ -extern error_t __pthread_sigstate_init (struct __pthread *thread); - -/* Destroy the signal state data structures associcated with thread - *THREAD. */ -extern void __pthread_sigstate_destroy (struct __pthread *thread); - -/* Modify thread *THREAD's signal state. */ -extern error_t __pthread_sigstate (struct __pthread *__restrict thread, int how, - const sigset_t *__restrict set, - sigset_t *__restrict oset, - int clear_pending); - - -/* Default thread attributes. */ -extern const struct __pthread_attr __pthread_default_attr; - -/* Default barrier attributes. */ -extern const struct __pthread_barrierattr __pthread_default_barrierattr; - -/* Default mutex attributes. */ -extern const struct __pthread_mutexattr __pthread_default_mutexattr; - -/* Default rdlock attributes. */ -const struct __pthread_rwlockattr __pthread_default_rwlockattr; - -/* Default condition attributes. */ -const struct __pthread_condattr __pthread_default_condattr; - -#endif /* pt-internal.h */ diff --git a/libpthread/sysdeps/mach/hurd/i386/pt-setup.c.orig b/libpthread/sysdeps/mach/hurd/i386/pt-setup.c.orig deleted file mode 100644 index 5abbcfcd..00000000 --- a/libpthread/sysdeps/mach/hurd/i386/pt-setup.c.orig +++ /dev/null @@ -1,105 +0,0 @@ -/* Setup thread stack. Hurd/i386 version. - Copyright (C) 2000, 2002, 2005, 2008 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 <stdint.h> -#include <assert.h> -#include <mach.h> - -#include <pt-internal.h> - -/* The stack layout used on the i386 is: - - ----------------- - | ARG | - ----------------- - | START_ROUTINE | - ----------------- - | 0 | - ----------------- - | | - | Fast TSD | - | | - ----------------- - - We need to reserve __hurd_threadvar_max `unsigned long int's' of - (fast) thread-specific data (TSD) for the Hurd. */ - -/* Set up the stack for THREAD, such that it appears as if - START_ROUTINE and ARG were passed to the new thread's entry-point. - Return the stack pointer for the new thread. */ -static void * -stack_setup (struct __pthread *thread, - void *(*start_routine)(void *), void *arg) -{ - error_t err; - uintptr_t *bottom, *top; - - /* Calculate the top of the new stack. */ - bottom = thread->stackaddr; - top = (uintptr_t *) ((uintptr_t) bottom + thread->stacksize); - - /* Next, make room for the TSDs. */ - top -= __hurd_threadvar_max; - - /* Save the self pointer. */ - top[_HURD_THREADVAR_THREAD] = (void *) thread; - - if (start_routine) - { - /* And then the call frame. */ - top -= 2*sizeof(uintptr_t); - top = (uintptr_t) top & ~0xf; - top[1] = (uintptr_t) arg; /* Argument to START_ROUTINE. */ - top[0] = (uintptr_t) start_routine; - *--top = 0; /* Fake return address. */ - } - - if (thread->guardsize) - { - err = __vm_protect (__mach_task_self (), (vm_address_t) bottom, - thread->guardsize, 0, 0); - assert_perror (err); - } - - return top; -} - -int -__pthread_setup (struct __pthread *thread, - void (*entry_point)(void *(*)(void *), void *), - void *(*start_routine)(void *), void *arg) -{ - error_t err; - mach_port_t ktid; - - thread->mcontext.pc = entry_point; - thread->mcontext.sp = stack_setup (thread, start_routine, arg); - - ktid = __mach_thread_self (); - if (thread->kernel_thread != ktid) - { - err = __thread_set_pcsp (thread->kernel_thread, - 1, thread->mcontext.pc, - 1, thread->mcontext.sp); - assert_perror (err); - } - __mach_port_deallocate (__mach_task_self (), ktid); - - return 0; -} diff --git a/pfinet.old/ethernet.c.orig b/pfinet.old/ethernet.c.orig deleted file mode 100644 index cbb6b40b..00000000 --- a/pfinet.old/ethernet.c.orig +++ /dev/null @@ -1,277 +0,0 @@ -/* - Copyright (C) 1995, 1996, 1998, 1999, 2000, 2002, 2007 - Free Software Foundation, Inc. - - Written by Michael I. Bushnell, p/BSG. - - This file is part of the GNU Hurd. - - The GNU Hurd 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; either version 2, or (at - your option) any later version. - - The GNU Hurd 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, USA. */ - -#include "pfinet.h" - -#include <device/device.h> -#include <device/net_status.h> -#include <netinet/in.h> -#include <string.h> -#include <error.h> - -#include <linux/netdevice.h> -#include <linux/etherdevice.h> -#include <linux/if_arp.h> - - -struct port_class *etherreadclass; - -struct ether_device -{ - struct ether_device *next; - device_t ether_port; - struct port_info *readpt; - mach_port_t readptname; - struct device dev; -}; - -/* Linked list of all ethernet devices. */ -struct ether_device *ether_dev; - -struct enet_statistics retbuf; - - -/* Mach doesn't provide this. DAMN. */ -struct enet_statistics * -ethernet_get_stats (struct device *dev) -{ - return &retbuf; -} - -int -ethernet_stop (struct device *dev) -{ - return 0; -} - -void -ethernet_set_multi (struct device *dev) -{ -} - -static short ether_filter[] = - { -#ifdef NETF_IN - /* We have to tell the packet filtering code that we're interested in - incoming packets. */ - NETF_IN, /* Header. */ -#endif - NETF_PUSHLIT | NETF_NOP, - 1 -}; -static int ether_filter_len = sizeof (ether_filter) / sizeof (short); - -static struct port_bucket *etherport_bucket; - - -static any_t -ethernet_thread (any_t arg) -{ - ports_manage_port_operations_one_thread (etherport_bucket, - ethernet_demuxer, - 0); - return 0; -} - -int -ethernet_demuxer (mach_msg_header_t *inp, - mach_msg_header_t *outp) -{ - struct net_rcv_msg *msg = (struct net_rcv_msg *) inp; - struct sk_buff *skb; - int datalen; - struct ether_device *edev; - struct device *dev = 0; - - if (inp->msgh_id != NET_RCV_MSG_ID) - return 0; - - for (edev = ether_dev; edev; edev = edev->next) - if (inp->msgh_local_port == edev->readptname) - dev = &edev->dev; - - if (! dev) - { - if (inp->msgh_remote_port != MACH_PORT_NULL) - mach_port_deallocate (mach_task_self (), inp->msgh_remote_port); - return 1; - } - - datalen = ETH_HLEN - + msg->packet_type.msgt_number - sizeof (struct packet_header); - - __mutex_lock (&net_bh_lock); - skb = alloc_skb (datalen, GFP_ATOMIC); - skb_put (skb, datalen); - skb->dev = dev; - - /* Copy the two parts of the frame into the buffer. */ - bcopy (msg->header, skb->data, ETH_HLEN); - bcopy (msg->packet + sizeof (struct packet_header), - skb->data + ETH_HLEN, - datalen - ETH_HLEN); - - /* Drop it on the queue. */ - skb->protocol = eth_type_trans (skb, dev); - netif_rx (skb); - __mutex_unlock (&net_bh_lock); - - return 1; -} - - -void -ethernet_initialize (void) -{ - etherport_bucket = ports_create_bucket (); - etherreadclass = ports_create_class (0, 0); - - cthread_detach (cthread_fork (ethernet_thread, 0)); -} - -int -ethernet_open (struct device *dev) -{ - error_t err; - device_t master_device; - struct ether_device *edev = (struct ether_device *) dev->priv; - - assert (edev->ether_port == MACH_PORT_NULL); - - err = ports_create_port (etherreadclass, etherport_bucket, - sizeof (struct port_info), &edev->readpt); - assert_perror (err); - edev->readptname = ports_get_right (edev->readpt); - mach_port_insert_right (mach_task_self (), edev->readptname, edev->readptname, - MACH_MSG_TYPE_MAKE_SEND); - - mach_port_set_qlimit (mach_task_self (), edev->readptname, MACH_PORT_QLIMIT_MAX); - - /* The device name here is the path of a device file. */ - master_device = file_name_lookup (dev->name, 0, 0); - if (master_device == MACH_PORT_NULL) - error (2, errno, "file_name_lookup %s", dev->name); - - err = device_open (master_device, D_WRITE | D_READ, "eth", &edev->ether_port); - mach_port_deallocate (mach_task_self (), master_device); - if (err) - error (2, err, "%s", dev->name); - - err = device_set_filter (edev->ether_port, ports_get_right (edev->readpt), - MACH_MSG_TYPE_MAKE_SEND, 0, - ether_filter, ether_filter_len); - if (err) - error (2, err, "%s", dev->name); - return 0; -} - - -/* Transmit an ethernet frame */ -int -ethernet_xmit (struct sk_buff *skb, struct device *dev) -{ - error_t err; - struct ether_device *edev = (struct ether_device *) dev->priv; - u_int count; - - err = device_write (edev->ether_port, D_NOWAIT, 0, skb->data, skb->len, &count); - assert_perror (err); - assert (count == skb->len); - dev_kfree_skb (skb); - return 0; -} - -void -setup_ethernet_device (char *name, struct device **device) -{ - struct net_status netstat; - size_t count; - int net_address[2]; - error_t err; - struct ether_device *edev; - struct device *dev; - - edev = calloc (1, sizeof (struct ether_device)); - if (!edev) - error (2, ENOMEM, "%s", name); - edev->next = ether_dev; - ether_dev = edev; - - *device = dev = &edev->dev; - - dev->name = strdup (name); - /* Functions. These ones are the true "hardware layer" in Linux. */ - dev->open = 0; /* We set up before calling dev_open. */ - dev->stop = ethernet_stop; - dev->hard_start_xmit = ethernet_xmit; - dev->get_stats = ethernet_get_stats; - dev->set_multicast_list = ethernet_set_multi; - - /* These are the ones set by drivers/net/net_init.c::ether_setup. */ - dev->hard_header = eth_header; - dev->rebuild_header = eth_rebuild_header; - dev->hard_header_cache = eth_header_cache; - dev->header_cache_update = eth_header_cache_update; - dev->hard_header_parse = eth_header_parse; - /* We can't do these two (and we never try anyway). */ - /* dev->change_mtu = eth_change_mtu; */ - /* dev->set_mac_address = eth_mac_addr; */ - - /* Some more fields */ - dev->priv = edev; /* For reverse lookup. */ - dev->type = ARPHRD_ETHER; - dev->hard_header_len = ETH_HLEN; - dev->addr_len = ETH_ALEN; - memset (dev->broadcast, 0xff, ETH_ALEN); - dev->flags = IFF_BROADCAST | IFF_MULTICAST; - dev_init_buffers (dev); - - ethernet_open (dev); - - /* Fetch hardware information */ - count = NET_STATUS_COUNT; - err = device_get_status (edev->ether_port, NET_STATUS, - (dev_status_t) &netstat, &count); - if (err) - error (2, err, "%s: Cannot get device status", name); - dev->mtu = netstat.max_packet_size - dev->hard_header_len; - assert (netstat.header_format == HDR_ETHERNET); - assert (netstat.header_size == ETH_HLEN); - assert (netstat.address_size == ETH_ALEN); - - count = 2; - assert (count * sizeof (int) >= ETH_ALEN); - err = device_get_status (edev->ether_port, NET_ADDRESS, net_address, &count); - if (err) - error (2, err, "%s: Cannot get hardware Ethernet address", name); - net_address[0] = ntohl (net_address[0]); - net_address[1] = ntohl (net_address[1]); - bcopy (net_address, dev->dev_addr, ETH_ALEN); - - /* That should be enough. */ - - /* This call adds the device to the `dev_base' chain, - initializes its `ifindex' member (which matters!), - and tells the protocol stacks about the device. */ - err = - register_netdevice (dev); - assert_perror (err); -} diff --git a/pfinet.old/ethernet.c.rej b/pfinet.old/ethernet.c.rej deleted file mode 100644 index 48bd555e..00000000 --- a/pfinet.old/ethernet.c.rej +++ /dev/null @@ -1,87 +0,0 @@ -*************** -*** 26,36 **** - #include <device/net_status.h> - #include <netinet/in.h> - #include <string.h> - #include <error.h> - - #include <linux/netdevice.h> - #include <linux/etherdevice.h> - #include <linux/if_arp.h> - - - struct port_class *etherreadclass; ---- 26,39 ---- - #include <device/net_status.h> - #include <netinet/in.h> - #include <string.h> -+ #define _HACK_ERRNO_H -+ #include <errno.h> - #include <error.h> - - #include <linux/netdevice.h> - #include <linux/etherdevice.h> - #include <linux/if_arp.h> -+ #include <device/bpf.h> - - - struct port_class *etherreadclass; -*************** -*** 68,82 **** - { - } - -- static short ether_filter[] = - { -- #ifdef NETF_IN -- /* We have to tell the packet filtering code that we're interested in -- incoming packets. */ -- NETF_IN, /* Header. */ -- #endif -- NETF_PUSHLIT | NETF_NOP, -- 1 - }; - static int ether_filter_len = sizeof (ether_filter) / sizeof (short); - ---- 71,85 ---- - { - } - -+ /* The BPF instruction allows IP and ARP packets */ -+ static struct bpf_insn ether_filter[] = - { -+ {NETF_IN|NETF_BPF, /* Header. */ 0, 0, 0}, -+ {40, 0, 0, 12}, -+ {21, 1, 0, 2054}, -+ {21, 0, 1, 2048}, -+ {6, 0, 0, 1500}, -+ {6, 0, 0, 0} - }; - static int ether_filter_len = sizeof (ether_filter) / sizeof (short); - -*************** -*** 166,176 **** - - mach_port_set_qlimit (mach_task_self (), edev->readptname, MACH_PORT_QLIMIT_MAX); - -- err = get_privileged_ports (0, &master_device); -- if (err) -- error (2, err, "cannot get device master port"); - -- err = device_open (master_device, D_WRITE | D_READ, dev->name, &edev->ether_port); - mach_port_deallocate (mach_task_self (), master_device); - if (err) - error (2, err, "%s", dev->name); ---- 169,180 ---- - - mach_port_set_qlimit (mach_task_self (), edev->readptname, MACH_PORT_QLIMIT_MAX); - -+ /* The device name here is the path of a device file. */ -+ master_device = file_name_lookup (dev->name, 0, 0); -+ if (master_device == MACH_PORT_NULL) -+ error (2, errno, "file_name_lookup %s", dev->name); - -+ err = device_open (master_device, D_WRITE | D_READ, "eth", &edev->ether_port); - mach_port_deallocate (mach_task_self (), master_device); - if (err) - error (2, err, "%s", dev->name); |