From 40ad88851bea3bb7fce12e7d23e5a0c1159e9080 Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sun, 14 Jul 2002 17:54:00 +0000 Subject: - TI-RPC is now the default again for code generation. - As before, inetd support support is turned of per default. Code for inetd can be made with -I. - Support for ``transport monitors'' and the NLSPROVIDER env variable is still there , even if their use is not clear in non TLI stream based systems like Free-/NetBSD. It can be activated with -P. - There are a few corrections in rpcgen.1 and usage function to conform to the code. Added and documented -P - I removed the #ifdefs checks for Free-/NetBSD since we are the only ones who use this code. MaxOS X may have the same limitations as we have, so this code will correctly build for them. - Generate correct cflags. Submitted by: mbr, Jean-Luc Richier PR: bin/29175, misc/27816 --- usr.bin/rpcgen/rpc_clntout.c | 2 + usr.bin/rpcgen/rpc_cout.c | 7 ++- usr.bin/rpcgen/rpc_hout.c | 3 ++ usr.bin/rpcgen/rpc_main.c | 111 +++++++++---------------------------------- usr.bin/rpcgen/rpc_parse.c | 14 +----- usr.bin/rpcgen/rpc_parse.h | 5 +- usr.bin/rpcgen/rpc_sample.c | 2 +- usr.bin/rpcgen/rpc_scan.c | 2 + usr.bin/rpcgen/rpc_scan.h | 5 +- usr.bin/rpcgen/rpc_svcout.c | 74 +++++++++++++++++++++-------- usr.bin/rpcgen/rpc_util.h | 5 +- usr.bin/rpcgen/rpcgen.1 | 47 +++++++++++------- 12 files changed, 132 insertions(+), 145 deletions(-) diff --git a/usr.bin/rpcgen/rpc_clntout.c b/usr.bin/rpcgen/rpc_clntout.c index 0378604da687..6104213ea03c 100644 --- a/usr.bin/rpcgen/rpc_clntout.c +++ b/usr.bin/rpcgen/rpc_clntout.c @@ -32,8 +32,10 @@ #ident "@(#)rpc_clntout.c 1.15 94/04/25 SMI" #ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_clntout.c 1.11 89/02/22 (C) 1987 SMI"; #endif +#endif /* * rpc_clntout.c, Client-stub outputter for the RPC protocol compiler diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c index a9d19e93e6af..8f1bcdcbbaab 100644 --- a/usr.bin/rpcgen/rpc_cout.c +++ b/usr.bin/rpcgen/rpc_cout.c @@ -99,6 +99,7 @@ emit(def) break; /* DEF_CONST and DEF_PROGRAM have already been handled */ default: + break; } print_trailer(); } @@ -415,6 +416,7 @@ int flag; char ptemp[256]; int indent = 1; + cur = NULL; if (flag == PUT) f_print(fout, "\n\tif (xdrs->x_op == XDR_ENCODE) {\n"); else @@ -523,7 +525,7 @@ int flag; } } - if (i > 0) + if (i > 0) { if (sizestr == NULL && size < inline){ /* don't expand into inline code if size < inline */ while (cur != dl){ @@ -560,6 +562,7 @@ int flag; } f_print(fout, "\t\t}\n"); } + } } static void @@ -691,7 +694,9 @@ int flag; f_print(fout, "}\n"); tabify(fout, indent); f_print(fout, "}\n"); + break; default: + break; } } diff --git a/usr.bin/rpcgen/rpc_hout.c b/usr.bin/rpcgen/rpc_hout.c index e5d5647f0f7a..4598de6de93f 100644 --- a/usr.bin/rpcgen/rpc_hout.c +++ b/usr.bin/rpcgen/rpc_hout.c @@ -31,8 +31,10 @@ #ident "@(#)rpc_hout.c 1.16 94/04/25 SMI" #ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI"; #endif +#endif /* * rpc_hout.c, Header file outputter for the RPC protocol compiler @@ -113,6 +115,7 @@ print_funcdef(def) pprogramdef(def); break; default: + break; } } diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index cc3b47b7ea60..a4913ca1156a 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -84,11 +84,7 @@ static void s_output(int, char **, char *, char *, int, char *, int, int); #define DONT_EXTEND 0 /* alias for FALSE */ #define SVR4_CPP "/usr/ccs/lib/cpp" -#if defined(__FreeBSD__) || defined(__NetBSD__) #define SUNOS_CPP "/usr/bin/cpp" -#else -#define SUNOS_CPP "/usr/lib/cpp" -#endif static int cppDefined = 0; /* explicit path for C preprocessor */ @@ -123,20 +119,14 @@ static int argcount = FIXEDARGS; int nonfatalerrors; /* errors */ -#if defined(__FreeBSD__) || defined(__NetBSD__) -int inetdflag = 0; /* Support for inetd is now the default */ -#else -int inetdflag; /* Support for inetd is now the default */ -#endif -int pmflag; /* Support for port monitors */ +int inetdflag = 0; /* Support for inetd is disabled by default, use -I */ +int pmflag = 0; /* Support for port monitors is disabled by default */ +int tirpc_socket = 1; /* TI-RPC on socket, no TLI library */ int logflag; /* Use syslog instead of fprintf for errors */ int tblflag; /* Support for dispatch table file */ int mtflag = 0; /* Support for MT */ -#if defined(__FreeBSD__) || defined(__NetBSD__) + #define INLINE 0 -#else -#define INLINE 5 -#endif /* length at which to start doing an inline */ int inline = INLINE; @@ -152,11 +142,7 @@ int newstyle; /* newstyle of passing arguments (by value) */ int Cflag = 0; /* ANSI C syntax */ int CCflag = 0; /* C++ files */ static int allfiles; /* generate all files */ -#if defined(__FreeBSD__) || defined(__NetBSD__) -int tirpcflag = 0; /* generating code for tirpc, by default */ -#else int tirpcflag = 1; /* generating code for tirpc, by default */ -#endif xdrfunc *xdrfunc_head = NULL; /* xdr function list */ xdrfunc *xdrfunc_tail = NULL; /* xdr function list */ pid_t childpid; @@ -246,25 +232,18 @@ main(argc, argv) * add extension to filename */ static char * -#if defined(__FreeBSD__) || defined(__NetBSD__) extendfile(path, ext) char *path; -#else -extendfile(file, ext) - char *file; -#endif char *ext; { char *res; char *p; -#if defined(__FreeBSD__) || defined(__NetBSD__) char *file; if ((file = rindex(path, '/')) == NULL) file = path; else file++; -#endif res = alloc(strlen(file) + strlen(ext) + 1); if (res == NULL) { abort(); @@ -545,14 +524,8 @@ h_output(infile, define, extend, outfile) f_print(fout, "#include \n"); - if (mtflag) { -#if !defined(__FreeBSD__) && !defined(__NetBSD__) - f_print(fout, "#include \n"); - f_print(fout, "#include \n"); -#else + if (mtflag) f_print(fout, "#include \n"); -#endif - }; /* put the C++ support */ if (Cflag && !CCflag){ @@ -684,18 +657,14 @@ s_output(argc, argv, infile, define, extend, outfile, nomain, netflag) f_print(fout, "#include /* getdtablesize, open */\n"); f_print(fout, "#endif /* __cplusplus */\n"); - if (tirpcflag) - f_print(fout, "#include /* setsid */\n"); } - if (tirpcflag) + if (tirpcflag) { + f_print(fout, "#include /* open */\n"); + f_print(fout, "#include /* fork / setsid */\n"); f_print(fout, "#include \n"); + } f_print(fout, "#include \n"); -#if defined(__FreeBSD__) || defined(__NetBSD__) -#else - if (tirpcflag) - f_print(fout, "#include \n"); -#endif if (inetdflag || !tirpcflag) { f_print(fout, "#include \n"); f_print(fout, "#include \n"); @@ -706,7 +675,7 @@ s_output(argc, argv, infile, define, extend, outfile, nomain, netflag) } if (tirpcflag) f_print(fout, "#include /* rlimit */\n"); - if (logflag || inetdflag || pmflag) + if (logflag || inetdflag || pmflag || tirpcflag) f_print(fout, "#include \n"); /* for ANSI-C */ @@ -945,13 +914,8 @@ $(TARGETS_SVC.c:%%.c=%%.o) "); f_print(fout, "\n# Compiler flags \n"); if (mtflag) - f_print(fout, "\nCPPFLAGS += -D_REENTRANT\nCFLAGS += -g \nLDLIBS += -lnsl -lthread\n"); - else -#if defined(__FreeBSD__) || defined(__NetBSD__) - f_print(fout, "\nCFLAGS += -g \nLDLIBS +=\n"); -#else - f_print(fout, "\nCFLAGS += -g \nLDLIBS += -lnsl\n"); -#endif + f_print(fout, "\nCFLAGS += -D_REENTRANT -D_THEAD_SAFE \nLDLIBS += -pthread\n"); + f_print(fout, "RPCGENFLAGS = \n"); f_print(fout, "\n# Targets \n\n"); @@ -965,23 +929,12 @@ $(TARGETS_CLNT.c) \n\n"); f_print(fout, "$(OBJECTS_SVC) : $(SOURCES_SVC.c) $(SOURCES_SVC.h) \ $(TARGETS_SVC.c) \n\n"); f_print(fout, "$(CLIENT) : $(OBJECTS_CLNT) \n"); -#if defined(__FreeBSD__) || defined(__NetBSD__) f_print(fout, "\t$(CC) -o $(CLIENT) $(OBJECTS_CLNT) \ $(LDLIBS) \n\n"); -#else - f_print(fout, "\t$(LINK.c) -o $(CLIENT) $(OBJECTS_CLNT) \ -$(LDLIBS) \n\n"); -#endif f_print(fout, "$(SERVER) : $(OBJECTS_SVC) \n"); -#if defined(__FreeBSD__) || defined(__NetBSD__) f_print(fout, "\t$(CC) -o $(SERVER) $(OBJECTS_SVC) $(LDLIBS)\n\n "); f_print(fout, "clean:\n\t $(RM) -f core $(TARGETS) $(OBJECTS_CLNT) \ $(OBJECTS_SVC) $(CLIENT) $(SERVER)\n\n"); -#else - f_print(fout, "\t$(LINK.c) -o $(SERVER) $(OBJECTS_SVC) $(LDLIBS)\n\n "); - f_print(fout, "clean:\n\t $(RM) core $(TARGETS) $(OBJECTS_CLNT) \ -$(OBJECTS_SVC) $(CLIENT) $(SERVER)\n\n"); -#endif } @@ -1174,11 +1127,7 @@ parseargs(argc, argv, cmd) * generating backward compatible * code */ -#if defined(__FreeBSD__) || defined(__NetBSD__) - tirpcflag = 1; -#else tirpcflag = 0; -#endif break; case 'I': @@ -1190,6 +1139,9 @@ parseargs(argc, argv, cmd) case 'L': logflag = 1; break; + case 'P': + pmflag = 1; + break; case 'K': if (++i == argc) { return (0); @@ -1269,8 +1221,8 @@ parseargs(argc, argv, cmd) cmd->makefileflag = flag['M']; if (tirpcflag) { - pmflag = inetdflag ? 0 : 1; - /* pmflag or inetdflag is always TRUE */ + if (inetdflag) + pmflag = 0; if ((inetdflag && cmd->nflag)) { /* netid not allowed with inetdflag */ warnx("cannot use netid flag with inetd flag"); @@ -1278,9 +1230,6 @@ parseargs(argc, argv, cmd) } } else { /* 4.1 mode */ pmflag = 0; /* set pmflag only in tirpcmode */ -#if !defined(__FreeBSD__) && !defined(__NetBSD__) - inetdflag = 1; /* inetdflag is TRUE by default */ -#endif if (cmd->nflag) { /* netid needs TIRPC */ warnx("cannot use netid flag without TIRPC"); return (0); @@ -1318,7 +1267,7 @@ usage() f_print(stderr, "%s\n%s\n%s\n%s\n%s\n", "usage: rpcgen infile", " rpcgen [-abCLNTM] [-Dname[=value]] [-i size]\ -[-I [-K seconds]] [-Y path] infile", +[-I -P [-K seconds]] [-Y path] infile", " rpcgen [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm]\ [-o outfile] [infile]", " rpcgen [-s nettype]* [-o outfile] [infile]", @@ -1332,16 +1281,15 @@ options_usage() { f_print(stderr, "options:\n"); f_print(stderr, "-a\t\tgenerate all files, including samples\n"); - f_print(stderr, "-b\t\tbackward compatibility mode (generates code\ -for SunOS 4.X)\n"); + f_print(stderr, "-b\t\tbackward compatibility mode (generates code \ +for FreeBSD 4.X)\n"); f_print(stderr, "-c\t\tgenerate XDR routines\n"); f_print(stderr, "-C\t\tANSI C mode\n"); f_print(stderr, "-Dname[=value]\tdefine a symbol (same as #define)\n"); f_print(stderr, "-h\t\tgenerate header file\n"); f_print(stderr, "-i size\t\tsize at which to start generating\ inline code\n"); - f_print(stderr, "-I\t\tgenerate code for inetd support in server\ -(for SunOS 4.X)\n"); + f_print(stderr, "-I\t\tgenerate code for inetd support in server\n"); f_print(stderr, "-K seconds\tserver exits after K seconds of\ inactivity\n"); f_print(stderr, "-l\t\tgenerate client side stubs\n"); @@ -1353,6 +1301,7 @@ named netid\n"); f_print(stderr, "-N\t\tsupports multiple arguments and\ call-by-value\n"); f_print(stderr, "-o outfile\tname of the output file\n"); + f_print(stderr, "-P\t\tgenerate code for port monitoring support in server\n"); f_print(stderr, "-s nettype\tgenerate server code that supports named\ nettype\n"); f_print(stderr, "-Sc\t\tgenerate sample client code that uses remote\ @@ -1366,19 +1315,3 @@ remote procedures\n"); f_print(stderr, "-Y path\t\tpath where cpp is found\n"); exit(1); } - -#if !defined(__FreeBSD__) && !defined(__NetBSD__) -char * -rindex(sp, c) - register char *sp, c; -{ - register char *r; - - r = NULL; - do { - if (*sp == c) - r = sp; - } while (*sp++); - return (r); -} -#endif diff --git a/usr.bin/rpcgen/rpc_parse.c b/usr.bin/rpcgen/rpc_parse.c index 0190dd9781eb..f2321ed24907 100644 --- a/usr.bin/rpcgen/rpc_parse.c +++ b/usr.bin/rpcgen/rpc_parse.c @@ -31,8 +31,10 @@ #ident "@(#)rpc_parse.c 1.12 93/07/05 SMI" #ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI"; #endif +#endif /* * rpc_parse.c, Parser for the RPC protocol compiler @@ -60,10 +62,6 @@ static void get_prog_declaration( declaration *, defkind, int ); static void get_type( char **, char **, defkind ); static void unsigned_dec( char ** ); -#ifndef __FreeBSD__ -extern char *strdup(); -#endif - /* * return the next definition you see */ @@ -594,11 +592,7 @@ get_type(prefixp, typep, dkind) (void) peekscan(TOK_INT, &tok); break; case TOK_HYPER: -#ifdef __FreeBSD__ *typep = "int64_t"; -#else - *typep = "longlong_t"; -#endif (void) peekscan(TOK_INT, &tok); break; @@ -647,11 +641,7 @@ unsigned_dec(typep) break; case TOK_HYPER: get_token(&tok); -#ifdef __FreeBSD__ *typep = "u_int64_t"; -#else - *typep = "longlong_t"; -#endif (void) peekscan(TOK_INT, &tok); break; diff --git a/usr.bin/rpcgen/rpc_parse.h b/usr.bin/rpcgen/rpc_parse.h index b61db9d24402..fdc31d4e37f7 100644 --- a/usr.bin/rpcgen/rpc_parse.h +++ b/usr.bin/rpcgen/rpc_parse.h @@ -1,3 +1,6 @@ +/* + * $FreeBSD$ + */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -26,7 +29,7 @@ * 2550 Garcia Avenue * Mountain View, California 94043 */ -#pragma ident "@(#)rpc_parse.h 1.10 94/05/15 SMI" +/* #pragma ident "@(#)rpc_parse.h 1.10 94/05/15 SMI" */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ diff --git a/usr.bin/rpcgen/rpc_sample.c b/usr.bin/rpcgen/rpc_sample.c index d20348e0d943..1f55797520e2 100644 --- a/usr.bin/rpcgen/rpc_sample.c +++ b/usr.bin/rpcgen/rpc_sample.c @@ -29,7 +29,7 @@ * $FreeBSD$ */ -#pragma ident "@(#)rpc_sample.c 1.9 94/04/25 SMI" +/* #pragma ident "@(#)rpc_sample.c 1.9 94/04/25 SMI" */ /* * rpc_sample.c, Sample client-server code outputter for the RPC protocol compiler diff --git a/usr.bin/rpcgen/rpc_scan.c b/usr.bin/rpcgen/rpc_scan.c index 5d4ce16ea3d7..8c3f9d0e5902 100644 --- a/usr.bin/rpcgen/rpc_scan.c +++ b/usr.bin/rpcgen/rpc_scan.c @@ -32,8 +32,10 @@ #ident "@(#)rpc_scan.c 1.13 93/07/05 SMI" #ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_scan.c 1.11 89/02/22 (C) 1987 SMI"; #endif +#endif /* * rpc_scan.c, Scanner for the RPC protocol compiler diff --git a/usr.bin/rpcgen/rpc_scan.h b/usr.bin/rpcgen/rpc_scan.h index cf042d00b5bd..57a2ed6dea87 100644 --- a/usr.bin/rpcgen/rpc_scan.h +++ b/usr.bin/rpcgen/rpc_scan.h @@ -1,3 +1,6 @@ +/* + * $FreeBSD$ + */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -26,7 +29,7 @@ * 2550 Garcia Avenue * Mountain View, California 94043 */ -#pragma ident "@(#)rpc_scan.h 1.11 94/05/15 SMI" +/* #pragma ident "@(#)rpc_scan.h 1.11 94/05/15 SMI" */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c index 59918b0b873c..0705ef167726 100644 --- a/usr.bin/rpcgen/rpc_svcout.c +++ b/usr.bin/rpcgen/rpc_svcout.c @@ -46,6 +46,8 @@ static const char rcsid[] = #include "rpc_parse.h" #include "rpc_util.h" +extern int tirpc_socket; + static char RQSTP[] = "rqstp"; static char TRANSP[] = "transp"; static char ARG[] = "argument"; @@ -109,7 +111,7 @@ write_most(infile, netflag, nomain) var_type = (nomain? "extern" : "static"); f_print(fout, "%s int _rpcpmstart;", var_type); f_print(fout, "\t\t/* Started by a port monitor ? */\n"); - if (!tirpcflag) { + if (!tirpcflag || tirpc_socket) { f_print(fout, "%s int _rpcfdtype;", var_type); f_print(fout, "\n\t\t /* Whether Stream or \ Datagram ? */\n"); @@ -141,7 +143,8 @@ serviced */\n"); if (nomain) return; - f_print(fout, "\nmain()\n"); + f_print(fout, "\nint\n"); + f_print(fout, "main()\n"); f_print(fout, "{\n"); if (inetdflag) { write_inetmost(infile); @@ -156,15 +159,24 @@ serviced */\n"); } f_print(fout, "\tpid_t pid;\n"); f_print(fout, "\tint i;\n"); - f_print(fout, "\tchar mname[FMNAMESZ + 1];\n\n"); + if (pmflag) { + if (tirpc_socket) { + f_print(fout, "\tstruct sockaddr_storage saddr;\n"); + f_print(fout, "\tint asize = sizeof (saddr);\n\n"); + } else + f_print(fout, "\tchar mname[FMNAMESZ + 1];\n\n"); + } if (mtflag & timerflag) f_print(fout, "\tmutex_init(&_svcstate_lock, USYNC_THREAD, NULL);\n"); + if (pmflag) { + write_pm_most(infile, netflag); + f_print(fout, "\telse {\n"); + write_rpc_svc_fg(infile, "\t\t"); + f_print(fout, "\t}\n"); + } else + write_rpc_svc_fg(infile, "\t\t"); - write_pm_most(infile, netflag); - f_print(fout, "\telse {\n"); - write_rpc_svc_fg(infile, "\t\t"); - f_print(fout, "\t}\n"); } else { f_print(fout, "\tregister SVCXPRT *%s;\n", TRANSP); f_print(fout, "\n"); @@ -858,8 +870,15 @@ write_pm_most(infile, netflag) definition *def; version_list *vp; - f_print(fout, "\tif (!ioctl(0, I_LOOK, mname) &&\n"); - f_print(fout, "\t\t(!strcmp(mname, \"sockmod\") ||"); + if (tirpc_socket) { + f_print(fout, + "\tif (getsockname(0, (struct sockaddr *)&saddr, &asize) == 0) {\n"); + f_print(fout, "\t\tint ssize = sizeof (int);\n"); + } else { + f_print(fout, "\tif (!ioctl(0, I_LOOK, mname) &&\n"); + f_print(fout, "\t\t(!strcmp(mname, \"sockmod\") ||"); + f_print(fout, " !strcmp(mname, \"timod\"))) {\n"); + } f_print(fout, " !strcmp(mname, \"timod\"))) {\n"); f_print(fout, "\t\tchar *netid;\n"); if (!netflag) { /* Not included by -n option */ @@ -873,6 +892,14 @@ write_pm_most(infile, netflag) * f_print(fout, "\t\textern char *getenv();\n"); */ f_print(fout, "\n"); + if (tirpc_socket) { + f_print(fout, "\t\tif (saddr.ss_family != AF_INET &&\n"); + f_print(fout, "\t\t saddr.ss_family != AF_INET6)\n"); + f_print(fout, "\t\t\texit(1);\n"); + f_print(fout, "\t\tif (getsockopt(0, SOL_SOCKET, SO_TYPE,\n"); + f_print(fout, "\t\t\t\t(char *)&_rpcfdtype, &ssize) == -1)\n"); + f_print(fout, "\t\t\texit(1);\n"); + } f_print(fout, "\t\t_rpcpmstart = 1;\n"); open_log_file(infile, "\t\t"); f_print(fout, "\n\t\tif ((netid = \ @@ -887,23 +914,28 @@ getenv(\"NLSPROVIDER\")) == NULL) {\n"); f_print(fout, "\t\t\tif ((nconf = getnetconfigent(netid)) == NULL)\n"); sprintf(_errbuf, "cannot get transport info"); print_err_message("\t\t\t\t"); - if (timerflag) - f_print(fout, "\n\t\t\tpmclose = \ -(t_getstate(0) != T_DATAXFER);\n"); + if (timerflag) { + if (tirpc_socket) + f_print(fout, "\n\t\t\tpmclose = 1;\t/* XXX */\n"); + else + f_print(fout, + "\n\t\t\tpmclose = (t_getstate(0) != T_DATAXFER);\n"); + } f_print(fout, "\t\t}\n"); /* * A kludgy support for inetd services. Inetd only works with * sockmod, and RPC works only with timod, hence all this jugglery */ - f_print(fout, "\t\tif (strcmp(mname, \"sockmod\") == 0) {\n"); - f_print(fout, - "\t\t\tif (ioctl(0, I_POP, 0) || \ -ioctl(0, I_PUSH, \"timod\")) {\n"); - sprintf(_errbuf, "could not get the right module"); - print_err_message("\t\t\t\t"); - f_print(fout, "\t\t\t\texit(1);\n"); - f_print(fout, "\t\t\t}\n"); - f_print(fout, "\t\t}\n"); + if (!tirpc_socket) { + f_print(fout, "\t\tif (strcmp(mname, \"sockmod\") == 0) {\n"); + f_print(fout, "\t\t\tif (ioctl(0, I_POP, 0) || "); + f_print(fout, "ioctl(0, I_PUSH, \"timod\")) {\n"); + sprintf(_errbuf, "could not get the right module"); + print_err_message("\t\t\t\t"); + f_print(fout, "\t\t\t\texit(1);\n"); + f_print(fout, "\t\t\t}\n"); + f_print(fout, "\t\t}\n"); + } f_print(fout, "\t\tif ((%s = svc_tli_create(0, nconf, NULL, 0, 0)) \ == NULL) {\n", diff --git a/usr.bin/rpcgen/rpc_util.h b/usr.bin/rpcgen/rpc_util.h index f465bfcea71d..833b9cf9cb6d 100644 --- a/usr.bin/rpcgen/rpc_util.h +++ b/usr.bin/rpcgen/rpc_util.h @@ -1,3 +1,6 @@ +/* + * $FreeBSD$ + */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -26,7 +29,7 @@ * 2550 Garcia Avenue * Mountain View, California 94043 */ -#pragma ident "@(#)rpc_util.h 1.16 94/05/15 SMI" +/* #pragma ident "@(#)rpc_util.h 1.16 94/05/15 SMI" */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ diff --git a/usr.bin/rpcgen/rpcgen.1 b/usr.bin/rpcgen/rpcgen.1 index 4f4385f425d6..60a92227ae33 100644 --- a/usr.bin/rpcgen/rpcgen.1 +++ b/usr.bin/rpcgen/rpcgen.1 @@ -19,7 +19,7 @@ .Fl D Ns Ar name Ns Op Ar =value .Oc .Op Fl i Ar size -.Op Fl I Op Fl K Ar seconds +.Op Fl I Fl P Op Fl K Ar seconds .Op Fl L .Op Fl M .Op Fl N @@ -112,6 +112,9 @@ the server side sample file to and the sample makefile to .Pa makefile.proto . .Pp +If option +.Fl I +is set, The server created can be started both by the port monitors (for example, .Xr inetd 8 ) @@ -121,9 +124,9 @@ it creates servers only for the transport for which the file descriptor .Em 0 was passed. -The name of the transport must be specified +The name of the transport may be specified by setting up the environment variable -.Ev PM_TRANSPORT . +.Ev NLSPROVIDER . When the server generated by .Nm is executed, @@ -250,15 +253,6 @@ Generate transport specific .Tn RPC code for older versions of the operating system. -.Pp -Note: in -.Fx , -this compatibility flag is turned on by -default since -.Fx -supports only the older -.Tn ONC RPC -library. .It Fl c Compile into .Tn XDR @@ -328,12 +322,12 @@ All the error messages for servers are always logged with .Xr syslog 3 . -.\" .IP -.\" Note: -.\" this option is supported for backward compatibility only. -.\" By default, -.\" .B rpcgen -.\" generates servers that can be invoked through portmonitors. +.Pp +Note: +Contrary to some systems, in +.Fx +this option is needed to generate +servers that can be invoked through portmonitors and inetd. .Pp .It Fl K Ar seconds By default, services created using @@ -422,6 +416,23 @@ standard output is used and .Fl t modes only). +.It Fl P +Compile support for +port monitors +in the server side stubs. +.Pp +Note: +Contrary to some systems, in +.Fx +this option is needed to generate +servers that can be monitored. +.Pp +If the +.Fl I +option has been specified, +.Fl P +is turned off automatically. +.Pp .It Fl s Ar nettype Compile into server-side stubs for all the transports belonging to the class -- cgit v1.2.3