From owner-p4-projects Thu Aug 1 2: 7:26 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6C50C37B401; Thu, 1 Aug 2002 02:05:44 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 097B137B400 for ; Thu, 1 Aug 2002 02:05:44 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1269E43E75 for ; Thu, 1 Aug 2002 02:05:43 -0700 (PDT) (envelope-from mini@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7195hJU063518 for ; Thu, 1 Aug 2002 02:05:43 -0700 (PDT) (envelope-from mini@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7195f4S063515 for perforce@freebsd.org; Thu, 1 Aug 2002 02:05:41 -0700 (PDT) Date: Thu, 1 Aug 2002 02:05:41 -0700 (PDT) Message-Id: <200208010905.g7195f4S063515@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to mini@freebsd.org using -f From: Jonathan Mini Subject: PERFORCE change 15369 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=15369 Change 15369 by mini@mini_stylus on 2002/08/01 02:04:59 - Rip out the old signal logic; sadly, it won't suit our needs. - Remove the scheduler interval timer (_ITIMER_SCHED_TIMER). - Remove the poorly-named "kernel pipe" (_thread_kern_pipe). Affected files ... .. //depot/projects/kse/lib/libc_r/uthread/Makefile.inc#3 edit .. //depot/projects/kse/lib/libc_r/uthread/pthread_private.h#3 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_accept.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_acl_aclcheck_fd.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_acl_delete_fd.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_acl_get_fd.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_acl_set_fd.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_aio_suspend.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_destroy.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getdetachstate.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getguardsize.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getinheritsched.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getschedparam.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getschedpolicy.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getscope.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getstackaddr.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getstacksize.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_init.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setcreatesuspend_np.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setdetachstate.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setguardsize.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setinheritsched.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setschedparam.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setschedpolicy.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setscope.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setstackaddr.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setstacksize.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_autoinit.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_bind.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_cancel.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_clean.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_close.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_cond.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_condattr_destroy.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_condattr_init.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_connect.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_creat.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_create.c#3 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_detach.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_dup.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_dup2.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_equal.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_execve.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_exit.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_fchflags.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_fchmod.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_fchown.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_fcntl.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_fd.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_file.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_find_thread.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_flock.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_fork.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_fpathconf.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_fstat.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_fstatfs.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_fsync.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_gc.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_getdirentries.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_getpeername.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_getprio.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_getschedparam.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_getsockname.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_getsockopt.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_info.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_init.c#3 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_ioctl.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_join.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_kern.c#3 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_kevent.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_kill.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_listen.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_main_np.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_mattr_init.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_mattr_kind_np.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_msync.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_multi_np.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_mutex.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_mutex_prioceiling.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_mutex_protocol.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_mutexattr_destroy.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_once.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_open.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_pause.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_pipe.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_poll.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_priority_queue.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_pselect.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_read.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_readv.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_recvfrom.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_recvmsg.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_resume_np.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_rwlock.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_rwlockattr.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_select.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_self.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_sem.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_sendfile.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_sendmsg.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_sendto.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_seterrno.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_setprio.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_setschedparam.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_setsockopt.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_shutdown.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_sig.c#3 delete .. //depot/projects/kse/lib/libc_r/uthread/uthread_sigaction.c#2 delete .. //depot/projects/kse/lib/libc_r/uthread/uthread_sigmask.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_sigpending.c#2 delete .. //depot/projects/kse/lib/libc_r/uthread/uthread_sigprocmask.c#2 delete .. //depot/projects/kse/lib/libc_r/uthread/uthread_sigsuspend.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_sigwait.c#2 delete .. //depot/projects/kse/lib/libc_r/uthread/uthread_single_np.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_sleep.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_socket.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_socketpair.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_spec.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_spinlock.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_stack.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_suspend_np.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_switch_np.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_system.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_tcdrain.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_vfork.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_wait.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_wait4.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_waitpid.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_write.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_writev.c#2 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_yield.c#2 edit Differences ... ==== //depot/projects/kse/lib/libc_r/uthread/Makefile.inc#3 (text+ko) ==== @@ -109,13 +109,8 @@ uthread_setschedparam.c \ uthread_setsockopt.c \ uthread_shutdown.c \ - uthread_sig.c \ - uthread_sigaction.c \ uthread_sigmask.c \ - uthread_sigpending.c \ - uthread_sigprocmask.c \ uthread_sigsuspend.c \ - uthread_sigwait.c \ uthread_single_np.c \ uthread_sleep.c \ uthread_socket.c \ ==== //depot/projects/kse/lib/libc_r/uthread/pthread_private.h#3 (text+ko) ==== @@ -61,18 +61,6 @@ #include /* - * XXX - Grovelling around in the machine-dependant context only serves - * to get our hands dirty. - */ -#if defined(__i386__) -#define UCP_STACK(ucp) ((unsigned long)((ucp)->uc_mcontext.mc_esp)) -#elif defined(__alpha__) -#define UCP_STACK(ucp) ((ucp)->uc_mcontext.mc_regs[R_SP]) -#else -#error "Don't recognize this architecture!" -#endif - -/* * Kernel fatal error handler macro. */ #define PANIC(string) _thread_exit(__FILE__,__LINE__,string) @@ -184,17 +172,6 @@ #endif /* - * Define the signals to be used for scheduling. - */ -#if defined(_PTHREADS_COMPAT_SCHED) -#define _ITIMER_SCHED_TIMER ITIMER_VIRTUAL -#define _SCHED_SIGNAL SIGVTALRM -#else -#define _ITIMER_SCHED_TIMER ITIMER_PROF -#define _SCHED_SIGNAL SIGPROF -#endif - -/* * Priority queues. * * XXX It'd be nice if these were contained in uthread_priority_queue.[ch]. @@ -534,42 +511,12 @@ */ typedef void (*thread_continuation_t) (void *); -struct pthread_signal_frame; - -struct pthread_state_data { - struct pthread_signal_frame *psd_curframe; - sigset_t psd_sigmask; - struct timespec psd_wakeup_time; - union pthread_wait_data psd_wait_data; - enum pthread_state psd_state; - int psd_flags; - int psd_interrupted; - int psd_longjmp_val; - int psd_sigmask_seqno; - int psd_signo; - int psd_sig_defer_count; - /* XXX - What about thread->timeout and/or thread->error? */ -}; - struct join_status { struct pthread *thread; void *ret; int error; }; -/* - * The frame that is added to the top of a threads stack when setting up - * up the thread to run a signal handler. - */ -struct pthread_signal_frame { - struct pthread_state_data saved_state; /* State before the signal. */ - ucontext_t ctx; /* Thread's return context. */ - int signo; /* Signal, arg 1 to sighandler. */ - int sig_has_args; /* Use signal args if true. */ - ucontext_t uc; /* Pre-signal context. */ - siginfo_t siginfo; -}; - struct pthread_specific_elem { const void *data; int seqno; @@ -609,16 +556,11 @@ struct pthread_attr attr; /* - * Machine context. + * Machine context, including signal state. */ ucontext_t ctx; /* - * Used for tracking delivery of signal handlers. - */ - struct pthread_signal_frame *curframe; - - /* * Cancelability flags - the lower 2 bits are used by cancel * definitions in pthread.h */ @@ -629,14 +571,6 @@ thread_continuation_t continuation; - /* - * Current signal mask and pending signals. - */ - sigset_t sigmask; - sigset_t sigpend; - int sigmask_seqno; - int check_pending; - /* Thread state: */ enum pthread_state state; @@ -726,12 +660,6 @@ */ int sig_defer_count; - /* - * Set to TRUE if this thread should yield after undeferring - * signals. - */ - int yield_on_sig_undefer; - /* Miscellaneous flags; only set with signals deferred. */ int flags; #define PTHREAD_FLAGS_PRIVATE 0x0001 @@ -830,25 +758,6 @@ ; #endif -/* - * Array of kernel pipe file descriptors that are used to ensure that - * no signals are missed in calls to _select. - */ -SCLASS int _thread_kern_pipe[2] -#ifdef GLOBAL_PTHREAD_PRIVATE -= { - -1, - -1 -}; -#else -; -#endif -SCLASS int volatile _queue_signals -#ifdef GLOBAL_PTHREAD_PRIVATE -= 0; -#else -; -#endif SCLASS int _thread_kern_in_sched #ifdef GLOBAL_PTHREAD_PRIVATE = 0; @@ -856,13 +765,6 @@ ; #endif -SCLASS int _sig_in_handler -#ifdef GLOBAL_PTHREAD_PRIVATE -= 0; -#else -; -#endif - /* Time of day at last scheduling timer signal: */ SCLASS struct timeval volatile _sched_tod #ifdef GLOBAL_PTHREAD_PRIVATE @@ -979,28 +881,6 @@ ; /* - * Array of signal actions for this process. - */ -SCLASS struct sigaction _thread_sigact[NSIG]; - -/* - * Array of counts of dummy handlers for SIG_DFL signals. This is used to - * assure that there is always a dummy signal handler installed while there is a - * thread sigwait()ing on the corresponding signal. - */ -SCLASS int _thread_dfl_count[NSIG]; - -/* - * Pending signals and mask for this process: - */ -SCLASS sigset_t _process_sigpending; -SCLASS sigset_t _process_sigmask -#ifdef GLOBAL_PTHREAD_PRIVATE -= { {0, 0, 0, 0} } -#endif -; - -/* * Scheduling queues: */ SCLASS pq_queue_t _readyq; @@ -1018,28 +898,6 @@ #endif ; -/* Used to maintain pending and active signals: */ -struct sigstatus { - int pending; /* Is this a pending signal? */ - int blocked; /* - * A handler is currently active for - * this signal; ignore subsequent - * signals until the handler is done. - */ - int signo; /* arg 1 to signal handler */ - siginfo_t siginfo; /* arg 2 to signal handler */ - ucontext_t uc; /* arg 3 to signal handler */ -}; - -SCLASS struct sigstatus _thread_sigq[NSIG]; - -/* Indicates that the signal queue needs to be checked. */ -SCLASS volatile int _sigq_check_reqd -#ifdef GLOBAL_PTHREAD_PRIVATE -= 0 -#endif -; - /* Thread switch hook. */ SCLASS pthread_switch_routine_t _sched_switch_hook #ifdef GLOBAL_PTHREAD_PRIVATE @@ -1138,23 +996,14 @@ void _thread_cleanupspecific(void); void _thread_dump_info(void); void _thread_init(void); -void _thread_kern_sched(ucontext_t *); +void _thread_kern_sched(void); void _thread_kern_scheduler(void); -void _thread_kern_sched_frame(struct pthread_signal_frame *psf); -void _thread_kern_sched_sig(void); void _thread_kern_sched_state(enum pthread_state, char *fname, int lineno); void _thread_kern_sched_state_unlock(enum pthread_state state, spinlock_t *lock, char *fname, int lineno); void _thread_kern_set_timeout(const struct timespec *); void _thread_kern_sig_defer(void); void _thread_kern_sig_undefer(void); -void _thread_sig_handler(int, siginfo_t *, ucontext_t *); -void _thread_sig_check_pending(struct pthread *pthread); -void _thread_sig_handle_pending(void); -void _thread_sig_send(struct pthread *pthread, int sig); -void _thread_sig_wrapper(void); -void _thread_sigframe_restore(struct pthread *thread, - struct pthread_signal_frame *psf); void _thread_start(void); void _thread_seterrno(pthread_t, int); int _thread_fd_table_init(int fd); ==== //depot/projects/kse/lib/libc_r/uthread/uthread_accept.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_acl_aclcheck_fd.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_acl_delete_fd.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_acl_get_fd.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_acl_set_fd.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_aio_suspend.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_destroy.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getdetachstate.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getguardsize.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getinheritsched.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getschedparam.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getschedpolicy.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getscope.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getstackaddr.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_getstacksize.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_init.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setcreatesuspend_np.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setdetachstate.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setguardsize.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setinheritsched.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setschedparam.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setschedpolicy.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setscope.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setstackaddr.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_attr_setstacksize.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_autoinit.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_bind.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_cancel.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_clean.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_close.c#2 (text+ko) ==== @@ -49,18 +49,11 @@ struct stat sb; struct fd_table_entry *entry; - if ((fd == _thread_kern_pipe[0]) || (fd == _thread_kern_pipe[1])) { - /* - * Don't allow silly programs to close the kernel pipe. - */ - errno = EBADF; - ret = -1; - } /* * Lock the file descriptor while the file is closed and get * the file descriptor status: */ - else if (((ret = _FD_LOCK(fd, FD_RDWR, NULL)) == 0) && + if (((ret = _FD_LOCK(fd, FD_RDWR, NULL)) == 0) && ((ret = __sys_fstat(fd, &sb)) == 0)) { /* * Check if the file should be left as blocking. ==== //depot/projects/kse/lib/libc_r/uthread/uthread_cond.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_condattr_destroy.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_condattr_init.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_connect.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_creat.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_create.c#3 (text+ko) ==== @@ -121,13 +121,6 @@ */ new_thread->magic = PTHREAD_MAGIC; - /* Initialise the thread for signals: */ - new_thread->sigmask = curthread->sigmask; - new_thread->sigmask_seqno = 0; - - /* Initialize the signal frame: */ - new_thread->curframe = NULL; - /* Initialise the machine context: */ getcontext(&new_thread->ctx); new_thread->ctx.uc_stack.ss_sp = new_thread->stack; @@ -216,18 +209,8 @@ /* Return a pointer to the thread structure: */ (*thread) = new_thread; - if (f_gc != 0) { - /* Install the scheduling timer: */ - itimer.it_interval.tv_sec = 0; - itimer.it_interval.tv_usec = _clock_res_usec; - itimer.it_value = itimer.it_interval; - if (setitimer(_ITIMER_SCHED_TIMER, &itimer, - NULL) != 0) - PANIC("Cannot set interval timer"); - } - /* Schedule the new user thread: */ - _thread_kern_sched(NULL); + _thread_kern_sched(); /* * Start a garbage collector thread ==== //depot/projects/kse/lib/libc_r/uthread/uthread_detach.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_dup.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_dup2.c#2 (text+ko) ==== @@ -44,16 +44,8 @@ int ret; int newfd_opened; - /* Check if the file descriptor is out of range: */ - if (newfd < 0 || newfd >= _thread_dtablesize || - newfd == _thread_kern_pipe[0] || newfd == _thread_kern_pipe[1]) { - /* Return a bad file descriptor error: */ - errno = EBADF; - ret = -1; - } - /* Lock the file descriptor: */ - else if ((ret = _FD_LOCK(fd, FD_RDWR, NULL)) == 0) { + if ((ret = _FD_LOCK(fd, FD_RDWR, NULL)) == 0) { /* Lock the file descriptor: */ if (!(newfd_opened = (_thread_fd_table[newfd] != NULL)) || (ret = _FD_LOCK(newfd, FD_RDWR, NULL)) == 0) { ==== //depot/projects/kse/lib/libc_r/uthread/uthread_equal.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_execve.c#2 (text+ko) ==== @@ -48,18 +48,6 @@ int ret; struct sigaction act; struct sigaction oact; - struct itimerval itimer; - - /* Disable the interval timer: */ - itimer.it_interval.tv_sec = 0; - itimer.it_interval.tv_usec = 0; - itimer.it_value.tv_sec = 0; - itimer.it_value.tv_usec = 0; - setitimer(_ITIMER_SCHED_TIMER, &itimer, NULL); - - /* Close the pthread kernel pipe: */ - __sys_close(_thread_kern_pipe[0]); - __sys_close(_thread_kern_pipe[1]); /* * Enter a loop to set all file descriptors to blocking @@ -76,33 +64,6 @@ } } - /* Enter a loop to adopt the signal actions for the running thread: */ - for (i = 1; i < NSIG; i++) { - /* Check for signals which cannot be caught: */ - if (i == SIGKILL || i == SIGSTOP) { - /* Don't do anything with these signals. */ - } else { - /* Check if ignoring this signal: */ - if (_thread_sigact[i - 1].sa_handler == SIG_IGN) { - /* Continue to ignore this signal: */ - act.sa_handler = SIG_IGN; - } else { - /* Use the default handler for this signal: */ - act.sa_handler = SIG_DFL; - } - - /* Copy the mask and flags for this signal: */ - act.sa_mask = _thread_sigact[i - 1].sa_mask; - act.sa_flags = _thread_sigact[i - 1].sa_flags; - - /* Change the signal action for the process: */ - __sys_sigaction(i, &act, &oact); - } - } - - /* Set the signal mask: */ - __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL); - /* Execute the process: */ ret = __sys_execve(name, argv, envp); ==== //depot/projects/kse/lib/libc_r/uthread/uthread_exit.c#2 (text+ko) ==== @@ -49,18 +49,6 @@ { int flags; int i; - struct itimerval itimer; - - /* Disable the interval timer: */ - itimer.it_interval.tv_sec = 0; - itimer.it_interval.tv_usec = 0; - itimer.it_value.tv_sec = 0; - itimer.it_value.tv_usec = 0; - setitimer(_ITIMER_SCHED_TIMER, &itimer, NULL); - - /* Close the pthread kernel pipe: */ - __sys_close(_thread_kern_pipe[0]); - __sys_close(_thread_kern_pipe[1]); /* * Enter a loop to set all file descriptors to blocking ==== //depot/projects/kse/lib/libc_r/uthread/uthread_fchflags.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_fchmod.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_fchown.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_fcntl.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_fd.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_file.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_find_thread.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_flock.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_fork.c#2 (text+ko) ==== @@ -63,44 +63,8 @@ if ((ret = __sys_fork()) != 0) { /* Parent process or error. Nothing to do here. */ } else { - /* Close the pthread kernel pipe: */ - __sys_close(_thread_kern_pipe[0]); - __sys_close(_thread_kern_pipe[1]); - - /* Reset signals pending for the running thread: */ - sigemptyset(&curthread->sigpend); - - /* - * Create a pipe that is written to by the signal handler to - * prevent signals being missed in calls to - * __sys_select: - */ - if (__sys_pipe(_thread_kern_pipe) != 0) { - /* Cannot create pipe, so abort: */ - PANIC("Cannot create pthread kernel pipe for forked process"); - } - /* Get the flags for the read pipe: */ - else if ((flags = __sys_fcntl(_thread_kern_pipe[0], F_GETFL, NULL)) == -1) { - /* Abort this application: */ - abort(); - } - /* Make the read pipe non-blocking: */ - else if (__sys_fcntl(_thread_kern_pipe[0], F_SETFL, flags | O_NONBLOCK) == -1) { - /* Abort this application: */ - abort(); - } - /* Get the flags for the write pipe: */ - else if ((flags = __sys_fcntl(_thread_kern_pipe[1], F_GETFL, NULL)) == -1) { - /* Abort this application: */ - abort(); - } - /* Make the write pipe non-blocking: */ - else if (__sys_fcntl(_thread_kern_pipe[1], F_SETFL, flags | O_NONBLOCK) == -1) { - /* Abort this application: */ - abort(); - } /* Reinitialize the GC mutex: */ - else if (_mutex_reinit(&_gc_mutex) != 0) { + if (_mutex_reinit(&_gc_mutex) != 0) { /* Abort this application: */ PANIC("Cannot initialize GC mutex for forked process"); } @@ -180,9 +144,6 @@ /* No spinlocks yet: */ _spinblock_count = 0; - /* Don't queue signals yet: */ - _queue_signals = 0; - /* Initialize the scheduling switch hook routine: */ _sched_switch_hook = NULL; ==== //depot/projects/kse/lib/libc_r/uthread/uthread_fpathconf.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_fstat.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_fstatfs.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_fsync.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_gc.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_getdirentries.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_getpeername.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_getprio.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_getschedparam.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_getsockname.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_getsockopt.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_info.c#2 (text+ko) ==== @@ -254,15 +254,6 @@ __sys_write(fd, s, strlen(s)); break; case PS_SIGWAIT: - snprintf(s, sizeof(s), "sigmask (hi)"); - __sys_write(fd, s, strlen(s)); - for (i = _SIG_WORDS - 1; i >= 0; i--) { - snprintf(s, sizeof(s), "%08x\n", - pthread->sigmask.__bits[i]); - __sys_write(fd, s, strlen(s)); - } - snprintf(s, sizeof(s), "(lo)\n"); - __sys_write(fd, s, strlen(s)); break; /* * Trap other states that are not explicitly ==== //depot/projects/kse/lib/libc_r/uthread/uthread_init.c#3 (text+ko) ==== @@ -163,7 +163,6 @@ int sched_stack_size; /* Size of scheduler stack. */ struct clockinfo clockinfo; - struct sigaction act; _pthread_page_size = getpagesize(); _pthread_guard_default = getpagesize(); @@ -217,49 +216,9 @@ PANIC("Cannot get stdio flags"); } - /* - * Create a pipe that is written to by the signal handler to prevent - * signals being missed in calls to _select: - */ - if (__sys_pipe(_thread_kern_pipe) != 0) { - /* Cannot create pipe, so abort: */ - PANIC("Cannot create kernel pipe"); - } - - /* - * Make sure the pipe does not get in the way of stdio: - */ - for (i = 0; i < 2; i++) { - if (_thread_kern_pipe[i] < 3) { - fd = __sys_fcntl(_thread_kern_pipe[i], F_DUPFD, 3); - if (fd == -1) - PANIC("Cannot create kernel pipe"); - __sys_close(_thread_kern_pipe[i]); - _thread_kern_pipe[i] = fd; - } - } - /* Get the flags for the read pipe: */ - if ((flags = __sys_fcntl(_thread_kern_pipe[0], F_GETFL, NULL)) == -1) { - /* Abort this application: */ - PANIC("Cannot get kernel read pipe flags"); - } - /* Make the read pipe non-blocking: */ - else if (__sys_fcntl(_thread_kern_pipe[0], F_SETFL, flags | O_NONBLOCK) == -1) { - /* Abort this application: */ - PANIC("Cannot make kernel read pipe non-blocking"); - } - /* Get the flags for the write pipe: */ - else if ((flags = __sys_fcntl(_thread_kern_pipe[1], F_GETFL, NULL)) == -1) { - /* Abort this application: */ - PANIC("Cannot get kernel write pipe flags"); - } - /* Make the write pipe non-blocking: */ - else if (__sys_fcntl(_thread_kern_pipe[1], F_SETFL, flags | O_NONBLOCK) == -1) { - /* Abort this application: */ - PANIC("Cannot get kernel write pipe flags"); - } /* Allocate and initialize the ready queue: */ - else if (_pq_alloc(&_readyq, PTHREAD_MIN_PRIORITY, PTHREAD_LAST_PRIORITY) != 0) { + if (_pq_alloc(&_readyq, PTHREAD_MIN_PRIORITY, PTHREAD_LAST_PRIORITY) != + 0) { /* Abort this application: */ PANIC("Cannot allocate priority ready queue."); } @@ -363,14 +322,10 @@ /* Initialize last active: */ _thread_initial->last_active = (long) _sched_ticks; - /* Initialize the initial context: */ - _thread_initial->curframe = NULL; - /* Initialise the rest of the fields: */ _thread_initial->poll_data.nfds = 0; _thread_initial->poll_data.fds = NULL; _thread_initial->sig_defer_count = 0; - _thread_initial->yield_on_sig_undefer = 0; _thread_initial->specific = NULL; _thread_initial->cleanup = NULL; _thread_initial->flags = 0; @@ -379,57 +334,6 @@ TAILQ_INSERT_HEAD(&_thread_list, _thread_initial, tle); _set_curthread(_thread_initial); - /* Initialise the global signal action structure: */ - sigfillset(&act.sa_mask); - act.sa_handler = (void (*) ()) _thread_sig_handler; - act.sa_flags = SA_SIGINFO | SA_ONSTACK; - - /* Clear pending signals for the process: */ - sigemptyset(&_process_sigpending); - - /* Clear the signal queue: */ - memset(_thread_sigq, 0, sizeof(_thread_sigq)); - - /* Enter a loop to get the existing signal status: */ - for (i = 1; i < NSIG; i++) { - /* Check for signals which cannot be trapped: */ - if (i == SIGKILL || i == SIGSTOP) { - } - - /* Get the signal handler details: */ - else if (__sys_sigaction(i, NULL, - &_thread_sigact[i - 1]) != 0) { - /* - * Abort this process if signal - * initialisation fails: - */ - PANIC("Cannot read signal handler info"); - } - - /* Initialize the SIG_DFL dummy handler count. */ - _thread_dfl_count[i] = 0; - } - - /* - * Install the signal handler for the most important - * signals that the user-thread kernel needs. Actually - * SIGINFO isn't really needed, but it is nice to have. - */ - if (__sys_sigaction(_SCHED_SIGNAL, &act, NULL) != 0 || - __sys_sigaction(SIGINFO, &act, NULL) != 0 || - __sys_sigaction(SIGCHLD, &act, NULL) != 0) { - /* - * Abort this process if signal initialisation fails: - */ - PANIC("Cannot initialise signal handler"); - } - _thread_sigact[_SCHED_SIGNAL - 1].sa_flags = SA_SIGINFO; - _thread_sigact[SIGINFO - 1].sa_flags = SA_SIGINFO; - _thread_sigact[SIGCHLD - 1].sa_flags = SA_SIGINFO; - - /* Get the process signal mask: */ - __sys_sigprocmask(SIG_SETMASK, NULL, &_process_sigmask); - /* Get the kernel clockrate: */ mib[0] = CTL_KERN; mib[1] = KERN_CLOCKRATE; ==== //depot/projects/kse/lib/libc_r/uthread/uthread_ioctl.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_join.c#2 (text+ko) ==== ==== //depot/projects/kse/lib/libc_r/uthread/uthread_kern.c#3 (text+ko) ==== @@ -69,37 +69,9 @@ /* Static variables: */ static int last_tick = 0; -static int called_from_handler = 0; -/* - * This is called when a signal handler finishes and wants to - * return to a previous frame. - */ void -_thread_kern_sched_frame(struct pthread_signal_frame *psf) -{ - struct pthread *curthread = _get_curthread(); - - /* - * Flag the pthread kernel as executing scheduler code - * to avoid a signal from interrupting this execution and - * corrupting the (soon-to-be) current frame. - */ - _thread_kern_in_sched = 1; - - /* Restore the signal frame: */ - _thread_sigframe_restore(curthread, psf); - - /* The signal mask was restored; check for any pending signals: */ - curthread->check_pending = 1; - - /* Switch to the thread scheduler: */ - swapcontext(&curthread->ctx, &_thread_kern_sched_ctx); -} - - -void -_thread_kern_sched(ucontext_t *ucp) +_thread_kern_sched(void) { struct pthread *curthread = _get_curthread(); @@ -110,12 +82,6 @@ >>> TRUNCATED FOR MAIL (1000 lines) <<< To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message