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.c70
1 files changed, 34 insertions, 36 deletions
diff --git a/urunlevel/runlevel/boot_portmap.c b/urunlevel/runlevel/boot_portmap.c
index d354b3b..f5ab3ad 100644
--- a/urunlevel/runlevel/boot_portmap.c
+++ b/urunlevel/runlevel/boot_portmap.c
@@ -3,6 +3,8 @@
3 * 3 *
4 * Copyright (C) 2005 by David Seikel won_fang@yahoo.com.au 4 * Copyright (C) 2005 by David Seikel won_fang@yahoo.com.au
5 * 5 *
6 * Based on SuSE's init.d/portmap
7 *
6 * This program is free software; you can redistribute it and/or modify 8 * 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 9 * 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 10 * the Free Software Foundation; either version 2 of the License, or
@@ -28,51 +30,47 @@
28static int restart(struct init_d_handle_s *init_d, int just_checking); 30static int restart(struct init_d_handle_s *init_d, int just_checking);
29 31
30 32
31static init_d_handle_t my_commands = 33static init_d_handle_t my_commands = {
32{ 34 NULL,
33 NULL, 35 NULL,
34 NULL, 36 &restart,
35 &restart, 37 NULL,
36 NULL, 38 NULL,
37 NULL, 39 NULL,
38 NULL, 40 NULL,
39 NULL, 41 NULL,
40 NULL, 42 "portmap",
41 "boot_portmap", 43 "/sbin/portmap",
42 "/sbin/portmap", 44 NULL,
43 NULL, 45 NULL,
44 NULL, 46 INIT_D_BEGIN
45 INIT_D_BEGIN \ 47 INIT_D_PROV "$portmap"
46 INIT_D_PROV "$portmap" \ 48 INIT_D_RSTART "$network"
47 INIT_D_RSTART "$network" \ 49 INIT_D_DSTART "3 4 5"
48 INIT_D_DSTART "3 4 5" \ 50 INIT_D_DSTOP "0 1 2 6"
49 INIT_D_DSTOP "0 1 2 6" \ 51 INIT_D_SDESC "RPC port mapper."
50 INIT_D_SDESC "RPC port mapper." \ 52 INIT_D_DESC "The RPC port mapper provides SunPRC/ONCRPC portmapping"
51 INIT_D_DESC "The RPC port mapper provides SunPRC/ONCRPC portmapping" \ 53 INIT_D_CONT "services." INIT_D_END
52 INIT_D_CONT "services." \
53 INIT_D_END
54}; 54};
55 55
56 56
57int boot_portmap_main(int argc, char **argv) 57int boot_portmap_main(int argc, char **argv)
58{ 58{
59 return do_init_from_main(argc, argv, &my_commands); 59 return do_init_from_main(argc, argv, &my_commands);
60} 60}
61 61
62 62
63static const char *state = "/var/run/portmap.state";
64static int restart(struct init_d_handle_s *init_d, int just_checking) 63static int restart(struct init_d_handle_s *init_d, int just_checking)
65{ 64{
66 int status = (init_d->status)(init_d, 0); 65 int status = (init_d->status) (init_d, 0);
66 const char *state = "/var/run/portmap.state";
67 67
68 if (status == INIT_D_STATUS_OK) 68 if (status == INIT_D_STATUS_OK) {
69 { 69 doit(0, "pmap_dump > %s", state);
70 doit(0, "pmap_dump > %s", state); 70 status = default_restart(init_d, 0);
71 status = default_restart(init_d, 0); 71 doit(0, "pmap_set < %s", state);
72 doit(0, "pmap_set < %s", state); 72 remove_file(state, FILEUTILS_FORCE);
73 remove_file(state, FILEUTILS_FORCE); 73 } else
74 } 74 status = default_restart(init_d, 0);
75 else 75 return status;
76 status = default_restart(init_d, 0);
77 return status;
78} 76}