The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/kse.h

Version: -  FREEBSD  -  FREEBSD11  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (C) 2001 Julian Elischer <julian@freebsd.org>
    3  * for the FreeBSD Foundation.
    4  *
    5  *  All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice(s), this list of conditions and the following disclaimer as
   12  *    the first lines of this file unmodified other than the possible 
   13  *    addition of one or more copyright notices.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice(s), this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
   19  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   21  * DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
   22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   25  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
   28  * DAMAGE.
   29  *
   30  * $FreeBSD: src/sys/sys/kse.h,v 1.19 2003/08/05 12:00:55 davidxu Exp $
   31  */
   32 
   33 #ifndef _SYS_KSE_H_
   34 #define _SYS_KSE_H_
   35 
   36 #include <machine/kse.h>
   37 #include <sys/ucontext.h>
   38 #include <sys/time.h>
   39 #include <sys/signal.h>
   40 
   41 /*
   42  * This file defines the structures needed for communication between
   43  * the userland and the kernel when running a KSE-based threading system.
   44  * The only programs that should see this file are the user thread
   45  * scheduler (UTS) and the kernel.
   46  */
   47 struct kse_mailbox;
   48 
   49 typedef void    kse_func_t(struct kse_mailbox *);
   50 
   51 /*
   52  * Thread mailbox.
   53  *
   54  * This describes a user thread to the kernel scheduler.
   55  */
   56 struct kse_thr_mailbox {
   57         ucontext_t              tm_context;     /* User and machine context */
   58         unsigned int            tm_flags;       /* Thread flags */
   59         struct kse_thr_mailbox  *tm_next;       /* Next thread in list */
   60         void                    *tm_udata;      /* For use by the UTS */
   61         uint32_t                tm_uticks;
   62         uint32_t                tm_sticks;
   63         siginfo_t               tm_syncsig;
   64         int                     tm_spare[8];
   65 };
   66 
   67 /*
   68  * KSE mailbox.
   69  *
   70  * Communication path between the UTS and the kernel scheduler specific to
   71  * a single KSE.
   72  */
   73 struct kse_mailbox {
   74         int                     km_version;     /* Mailbox version */
   75         struct kse_thr_mailbox  *km_curthread;  /* Currently running thread */
   76         struct kse_thr_mailbox  *km_completed;  /* Threads back from kernel */
   77         sigset_t                km_sigscaught;  /* Caught signals */
   78         uint32_t                km_flags;       /* KSE flags */
   79         kse_func_t              *km_func;       /* UTS function */
   80         stack_t                 km_stack;       /* UTS context */
   81         void                    *km_udata;      /* For use by the UTS */
   82         struct timespec         km_timeofday;   /* Time of day */
   83         int                     km_quantum;     /* Upcall quantum in msecs */
   84         int                     km_spare[8];
   85 };
   86 
   87 #define KSE_VER_0       0
   88 #define KSE_VERSION     KSE_VER_0
   89 
   90 /* These flags are kept in km_flags */
   91 #define KMF_NOUPCALL            0x01
   92 #define KMF_NOCOMPLETED         0x02
   93 #define KMF_DONE                0x04
   94 #define KMF_BOUND               0x08
   95 #define KMF_WAITSIGEVENT        0x10
   96 
   97 /* These flags are kept in tm_flags */
   98 #define TMF_NOUPCALL            0x01
   99 
  100 /* Commands for kse_thr_interrupt */
  101 #define KSE_INTR_INTERRUPT      0x01
  102 #define KSE_INTR_RESTART        0x02
  103 #define KSE_INTR_SENDSIG        0x03
  104 #define KSE_INTR_SIGEXIT        0x04
  105 
  106 #ifndef _KERNEL
  107 int     kse_create(struct kse_mailbox *, int);
  108 int     kse_exit(void);
  109 int     kse_release(struct timespec *);
  110 int     kse_thr_interrupt(struct kse_thr_mailbox *, int, long);
  111 int     kse_wakeup(struct kse_mailbox *);
  112 #endif  /* !_KERNEL */
  113 
  114 #endif  /* !_SYS_KSE_H_ */

Cache object: 2c0486a9888e943e73ad62f4d59c4af7


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.