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/compat/mach/makemachservices.sh

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #!/bin/sh
    2 #       $NetBSD: makemachservices.sh,v 1.8 2008/05/04 00:43:55 martin Exp $
    3 #
    4 # Copyright (c) 2003 The NetBSD Foundation, Inc.
    5 # All rights reserved.
    6 # This code is derived from software contributed to The NetBSD Foundation
    7 # by Emmanuel Dreyfus.
    8 #
    9 # Redistribution and use in source and binary forms, with or without
   10 # modification, are permitted provided that the following conditions
   11 # are met:
   12 # 1. Redistributions of source code must retain the above copyright
   13 #    notice, this list of conditions and the following disclaimer.
   14 # 2. Redistributions in binary form must reproduce the above copyright
   15 #    notice, 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   19 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   20 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   21 # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   22 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   23 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   24 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   25 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   26 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   27 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   28 # POSSIBILITY OF SUCH DAMAGE.
   29 
   30 master="mach_services.master"
   31 table="mach_services.c"
   32 headers="mach_services.h"
   33 names="mach_services_names.c"
   34 
   35 sed -e '
   36 :join
   37         /\\$/{a\
   38 
   39         N
   40         s/\\\n//
   41         b join
   42         }
   43 ' $master | awk '
   44 BEGIN{
   45         intable = 0;
   46         table = "'$table'";
   47         headers = "'$headers'";
   48         names = "'$names'";
   49 
   50         printf("/* \$NetBSD\$ *\/\n\n") > table;
   51         printf("/*\n * Mach services table.\n *\n") > table;
   52         printf(" * DO NOT EDIT -- this file is automatically generated.\n") > \
   53             table;
   54 
   55         printf("/* \$NetBSD\$ *\/\n\n") > headers;
   56         printf("/*\n * Mach services prototypes.\n *\n") > headers;
   57         printf(" * DO NOT EDIT -- this file is automatically generated.\n") > \
   58             headers;
   59 
   60         printf("/* \$NetBSD\$ *\/\n\n") > names;
   61         printf("/*\n * Mach services names. This file is not built\n") > names;
   62         printf(" * by the kernel, it is included by kdump sources.\n *\n") > \
   63             names;
   64         printf(" * DO NOT EDIT -- this file is automatically generated.\n") > \
   65             names;
   66 }
   67 (NR == 1) {
   68         gsub(/^[^\$]*\$/, "", $0);
   69         gsub(/\$.*$/, "", $0);
   70         sub(/ $/, "");
   71         printf(" * created from %s\n */\n\n", $0) > table;
   72         printf("#include \<sys/cdefs.h\>\n__KERNEL_RCSID(0, " \
   73             "\"\$NetBSD\$\");\n\n") > table;
   74 
   75         printf(" * created from %s\n */\n\n", $0) > headers;
   76         printf("#include \<sys/cdefs.h\>\n__KERNEL_RCSID(0, " \
   77             "\"\$NetBSD\$\");\n\n") > headers;
   78         printf("#include <compat/mach/mach_types.h>\n") > headers;
   79         printf("#include <compat/mach/mach_message.h>\n") > headers;
   80 
   81         printf(" * created from %s\n */\n\n", $0) > names;
   82         printf("#include \<sys/cdefs.h\>\n__KERNEL_RCSID(0, " \
   83             "\"\$NetBSD\$\");\n\n") > names;
   84         printf("struct mach_service_name {\n") > names;
   85         printf("        int srv_id;\n") > names;
   86         printf("        const char *srv_name;\n") > names;
   87         printf("};\n\n") > names;
   88         next;
   89 }
   90 (NF == 0 || $1 ~ /^;/) {
   91         next;
   92 }
   93 ($0 ~ /^%%$/) {
   94         intable = 1;
   95         printf("\nstruct mach_service mach_services_table[] = {\n") > table;
   96         printf("\n") > headers;
   97         printf("struct mach_service_name mach_services_names[] = {\n") > names;
   98         next;
   99 }
  100 (!intable) {
  101         printf("%s\n", $0) > table;
  102         next;
  103 }
  104 (intable && $2 == "STD") {
  105         printf("        {%d, mach_%s, \"%s\", " \
  106             "sizeof(mach_%s_request_t), sizeof(mach_%s_reply_t)},\n", \
  107             $1, $3, $3, $3, $3) > table;
  108         printf("int mach_%s(struct mach_trap_args *);\n", $3) > headers;
  109         printf("        {%d, \"%s\"},\n", $1, $3) > names;
  110 }
  111 (intable && $2 == "NODEF") {
  112         printf("        {%d, NULL, \"%s\", 0, 0},\n", \
  113             $1, $3, $3, $3, $3) > table;
  114         printf("        {%d, \"%s\"},\n", $1, $3) > names;
  115 }
  116 (intable && $2 == "UNIMPL") {
  117         printf("        {%d, NULL, \"unimpl. %s\", 0, 0},\n", \
  118             $1, $3, $3, $3, $3) > table;
  119         printf("        {%d, \"unimpl. %s\"},\n", $1, $3) > names;
  120 }
  121 (intable && $2 == "OBSOL") {
  122         printf("        {%d, NULL, \"obsolete %s\", 0, 0},\n", \
  123             $1, $3, $3, $3, $3) > table;
  124         printf("        {%d, \"obsolete %s\"},\n", $1, $3) > names;
  125 }
  126 END {
  127         printf("        {0, NULL, NULL, 0, 0}\n") > table;
  128         printf("};\n") > table;
  129 
  130         printf("        {0, NULL}\n") > names;
  131         printf("};\n") > names;
  132 }
  133 '

Cache object: 62b9e839cf5c2fd8f1bf2df1bbae579e


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