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  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  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: releng/6.4/sys/sys/kse.h 139825 2005-01-07 02:29:27Z imp $
   31  */
   32 
   33 #ifndef _SYS_KSE_H_
   34 #define _SYS_KSE_H_
   35 
   36 #include <sys/ucontext.h>
   37 #include <sys/time.h>
   38 #include <sys/signal.h>
   39 
   40 /*
   41  * This file defines the structures needed for communication between
   42  * the userland and the kernel when running a KSE-based threading system.
   43  * The only programs that should see this file are the user thread
   44  * scheduler (UTS) and the kernel.
   45  */
   46 struct kse_mailbox;
   47 
   48 typedef void    kse_func_t(struct kse_mailbox *);
   49 
   50 /*
   51  * Thread mailbox.
   52  *
   53  * This describes a user thread to the kernel scheduler.
   54  */
   55 struct kse_thr_mailbox {
   56         ucontext_t              tm_context;     /* User and machine context */
   57         uint32_t                tm_flags;       /* Thread flags */
   58         struct kse_thr_mailbox  *tm_next;       /* Next thread in list */
   59         void                    *tm_udata;      /* For use by the UTS */
   60         uint32_t                tm_uticks;      /* Time in userland */
   61         uint32_t                tm_sticks;      /* Time in kernel */
   62         siginfo_t               tm_syncsig;
   63         uint32_t                tm_dflags;      /* Debug flags */
   64         lwpid_t                 tm_lwp;         /* kernel thread UTS runs on */
   65         uint32_t                __spare__[6];
   66 };
   67 
   68 /*
   69  * KSE mailbox.
   70  *
   71  * Communication path between the UTS and the kernel scheduler specific to
   72  * a single KSE.
   73  */
   74 struct kse_mailbox {
   75         uint32_t                km_version;     /* Mailbox version */
   76         struct kse_thr_mailbox  *km_curthread;  /* Currently running thread */
   77         struct kse_thr_mailbox  *km_completed;  /* Threads back from kernel */
   78         sigset_t                km_sigscaught;  /* Caught signals */
   79         uint32_t                km_flags;       /* Mailbox flags */
   80         kse_func_t              *km_func;       /* UTS function */
   81         stack_t                 km_stack;       /* UTS stack */
   82         void                    *km_udata;      /* For use by the UTS */
   83         struct timespec         km_timeofday;   /* Time of day */
   84         uint32_t                km_quantum;     /* Upcall quantum in msecs */
   85         lwpid_t                 km_lwp;         /* kernel thread UTS runs on */
   86         uint32_t                __spare2__[7];
   87 };
   88 
   89 #define KSE_VER_0               0
   90 #define KSE_VERSION             KSE_VER_0
   91 
   92 /* These flags are kept in km_flags */
   93 #define KMF_NOUPCALL            0x01
   94 #define KMF_NOCOMPLETED         0x02
   95 #define KMF_DONE                0x04
   96 #define KMF_BOUND               0x08
   97 #define KMF_WAITSIGEVENT        0x10
   98 
   99 /* These flags are kept in tm_flags */
  100 #define TMF_NOUPCALL            0x01
  101 
  102 /* These flags are kept in tm_dlfags */
  103 #define TMDF_SSTEP              0x01
  104 #define TMDF_SUSPEND            0x02
  105 
  106 /* Flags for kse_switchin */
  107 #define KSE_SWITCHIN_SETTMBX    0x01
  108 
  109 /* Commands for kse_thr_interrupt */
  110 #define KSE_INTR_INTERRUPT      1
  111 #define KSE_INTR_RESTART        2
  112 #define KSE_INTR_SENDSIG        3
  113 #define KSE_INTR_SIGEXIT        4
  114 #define KSE_INTR_DBSUSPEND      5
  115 #define KSE_INTR_EXECVE         6
  116 
  117 struct kse_execve_args {
  118         sigset_t        sigmask;
  119         sigset_t        sigpend;
  120         char            *path;
  121         char            **argv;
  122         char            **envp;
  123         void            *reserved;
  124 };
  125 
  126 #ifndef _KERNEL
  127 int     kse_create(struct kse_mailbox *, int);
  128 int     kse_exit(void);
  129 int     kse_release(struct timespec *);
  130 int     kse_thr_interrupt(struct kse_thr_mailbox *, int, long);
  131 int     kse_wakeup(struct kse_mailbox *);
  132 int     kse_switchin(struct kse_thr_mailbox *, int flags);
  133 #endif  /* !_KERNEL */
  134 
  135 #endif  /* !_SYS_KSE_H_ */

Cache object: 84ac212e3193611d2167eab15473f24a


[ 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.