Use O_CLOEXEC in tzfile handling
[glibc.git] / sunrpc / rpc_util.h
blob53316d9516db2f4a42bd31e253a1696955b88d56
1 /* @(#)rpc_util.h 1.5 90/08/29 */
3 /*
4 * Copyright (c) 2010, Oracle America, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following
13 * disclaimer in the documentation and/or other materials
14 * provided with the distribution.
15 * * Neither the name of the "Oracle America, Inc." nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * rpc_util.h, Useful definitions for the RPC protocol compiler
35 #include <stdlib.h>
37 #define alloc(size) malloc((unsigned)(size))
38 #define ALLOC(object) (object *) malloc(sizeof(object))
40 #define s_print (void) sprintf
41 #define f_print (void) fprintf
43 struct list {
44 definition *val;
45 struct list *next;
47 typedef struct list list;
49 struct xdrfunc {
50 char *name;
51 int pointerp;
52 struct xdrfunc *next;
54 typedef struct xdrfunc xdrfunc;
56 #define PUT 1
57 #define GET 2
60 * Global variables
62 #define MAXLINESIZE 1024
63 extern char curline[MAXLINESIZE];
64 extern const char *where;
65 extern int linenum;
67 extern const char *infilename;
68 extern FILE *fout;
69 extern FILE *fin;
71 extern list *defined;
73 extern bas_type *typ_list_h;
74 extern bas_type *typ_list_t;
75 extern xdrfunc *xdrfunc_head, *xdrfunc_tail;
78 * All the option flags
80 extern int inetdflag;
81 extern int pmflag;
82 extern int tblflag;
83 extern int logflag;
84 extern int newstyle;
85 extern int Cflag; /* C++ flag */
86 extern int CCflag; /* C++ flag */
87 extern int tirpcflag; /* flag for generating tirpc code */
88 extern int inlineflag; /* if this is 0, then do not generate inline code */
89 extern int mtflag;
92 * Other flags related with inetd jumpstart.
94 extern int indefinitewait;
95 extern int exitnow;
96 extern int timerflag;
98 extern int nonfatalerrors;
101 * rpc_util routines
103 void storeval(list **lstp, definition *val);
104 #define STOREVAL(list,item) storeval(list,item)
106 definition *findval(list *lst, const char *val,
107 int (*cmp)(const definition *, const char *));
108 #define FINDVAL(list,item,finder) findval(list, item, finder)
110 const char *fixtype(const char *type);
111 const char *stringfix(const char *type);
112 char *locase(const char *str);
113 void pvname_svc(const char *pname, const char *vnum);
114 void pvname(const char *pname, const char *vnum);
115 void ptype(const char *prefix, const char *type, int follow);
116 int isvectordef(const char *type, relation rel);
117 int streq(const char *a, const char *b);
118 void error(const char *msg);
119 void tabify(FILE *f, int tab);
120 void record_open(const char *file);
121 bas_type *find_type(const char *type);
125 * rpc_cout routines
127 void emit(definition *def);
130 * rpc_hout routines
132 void print_datadef(definition *def);
133 void print_funcdef(definition *def);
136 * rpc_svcout routines
138 void write_most(const char *infile, int netflag, int nomain);
139 void write_register(void);
140 void write_rest(void);
141 void write_programs(const char *storage);
142 void write_svc_aux(int nomain);
143 void write_inetd_register(const char *transp);
144 void write_netid_register(const char *);
145 void write_nettype_register(const char *);
147 * rpc_clntout routines
149 void write_stubs(void);
152 * rpc_tblout routines
154 void write_tables(void);