summaryrefslogtreecommitdiffstats
path: root/urunlevel/runlevel/boot_portmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'urunlevel/runlevel/boot_portmap.c')
-rw-r--r--urunlevel/runlevel/boot_portmap.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/urunlevel/runlevel/boot_portmap.c b/urunlevel/runlevel/boot_portmap.c
new file mode 100644
index 0000000..d354b3b
--- /dev/null
+++ b/urunlevel/runlevel/boot_portmap.c
@@ -0,0 +1,78 @@
1/*
2 * Mini portmap boot implementation for busybox.
3 *
4 * Copyright (C) 2005 by David Seikel won_fang@yahoo.com.au
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 * 02111-1307 USA
20 *
21 */
22
23#include <unistd.h>
24
25#include "busybox.h"
26#include "lib_init_d.h"
27
28static int restart(struct init_d_handle_s *init_d, int just_checking);
29
30
31static init_d_handle_t my_commands =
32{
33 NULL,
34 NULL,
35 &restart,
36 NULL,
37 NULL,
38 NULL,
39 NULL,
40 NULL,
41 "boot_portmap",
42 "/sbin/portmap",
43 NULL,
44 NULL,
45 INIT_D_BEGIN \
46 INIT_D_PROV "$portmap" \
47 INIT_D_RSTART "$network" \
48 INIT_D_DSTART "3 4 5" \
49 INIT_D_DSTOP "0 1 2 6" \
50 INIT_D_SDESC "RPC port mapper." \
51 INIT_D_DESC "The RPC port mapper provides SunPRC/ONCRPC portmapping" \
52 INIT_D_CONT "services." \
53 INIT_D_END
54};
55
56
57int boot_portmap_main(int argc, char **argv)
58{
59 return do_init_from_main(argc, argv, &my_commands);
60}
61
62
63static const char *state = "/var/run/portmap.state";
64static int restart(struct init_d_handle_s *init_d, int just_checking)
65{
66 int status = (init_d->status)(init_d, 0);
67
68 if (status == INIT_D_STATUS_OK)
69 {
70 doit(0, "pmap_dump > %s", state);
71 status = default_restart(init_d, 0);
72 doit(0, "pmap_set < %s", state);
73 remove_file(state, FILEUTILS_FORCE);
74 }
75 else
76 status = default_restart(init_d, 0);
77 return status;
78}