remove cinit source - archives are available

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-11-15 15:11:00 +01:00
parent b18172d939
commit b8b6c0fecc
17791 changed files with 0 additions and 776233 deletions

View file

@ -1,4 +0,0 @@
To be done before 0.1 (dirty release):
- replace cerr-strings with #defines, so doubled strings are elimenated
- remove all printf()s, as they are debug only
- perhaps remove MAX_DEPS?

View file

@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View file

@ -1,14 +0,0 @@
--------------------------------------------------------------------------------
Credits - People contributed to cinit
Nico Schottelius, 2005-05-17
--------------------------------------------------------------------------------
The following list is sorted chronological, new contributors are
added at the end of the list.
René Nussbaumer
* helping with the general IPC idea
* testing and proof-reading code
Marcus Przyklink
* coding linear lists, making MAX_SVC obsolete

View file

@ -1,8 +0,0 @@
Sun May 8 12:20:35 CEST 2005
*Changelog can now be found in monotone database (monotone log)
Sat Apr 30 15:53:53 CEST 2005
* add socket code
Tue Apr 26 15:29:53 CEST 2005
* removed is_cinit support, initial messaging framework
Mon Apr 18 14:07:50 CEST 2005
* added is_cinit -> recognize if you are cinit or a fork

View file

@ -1,213 +0,0 @@
started up on Linux 2.6.11.10 #2 Tue May 17 11:58:45 CEST 2005 ppc
command line: 'monotone-0.18', 'rename', 'conf/c_shd', 'conf/c_halt'
set locale: LC_CTYPE=C, LC_MESSAGES=C
initial path is /home/user/nico/cinit-0.0.4
converting 13 bytes from ANSI_X3.4-1968 to UTF-8
converting 6 bytes from ANSI_X3.4-1968 to UTF-8
converting 10 bytes from ANSI_X3.4-1968 to UTF-8
converting 11 bytes from ANSI_X3.4-1968 to UTF-8
searching for 'MT' directory with root '/'
search for 'MT' ended at '/home/user/nico/cinit-0.0.4' with '' removed
initializing from directory /home/user/nico/cinit-0.0.4
found working copy directory /home/user/nico/cinit-0.0.4
options path is MT/options
converting 2 bytes from UTF-8 to ANSI_X3.4-1968
converting 7 bytes from UTF-8 to ANSI_X3.4-1968
converting 2 bytes from UTF-8 to ANSI_X3.4-1968
converting 7 bytes from UTF-8 to ANSI_X3.4-1968
local dump path is MT/debug
setting dump path to MT/debug
opening rcfile '/home/user/nico/.monotonerc' ...
'/home/user/nico/.monotonerc' is ok
skipping nonexistent rcfile 'MT/monotonerc'
executing rename command
options path is MT/options
converting 2 bytes from UTF-8 to ANSI_X3.4-1968
converting 7 bytes from UTF-8 to ANSI_X3.4-1968
revision path is MT/revision
converting 2 bytes from UTF-8 to ANSI_X3.4-1968
converting 8 bytes from UTF-8 to ANSI_X3.4-1968
loading revision id from MT/revision
converting 2 bytes from UTF-8 to ANSI_X3.4-1968
converting 8 bytes from UTF-8 to ANSI_X3.4-1968
db.fetch("SELECT id FROM 'revisions' WHERE id = '1f5c45fa438bfd4f2c0f851e985d51e983cffaaa'")
db.fetch("SELECT data FROM revisions WHERE id = '1f5c45fa438bfd4f2c0f851e985d51e983cffaaa'")
old manifest is c6e5abc9fa52a464b3984cae46232bfd43feaabd
db.fetch("SELECT id FROM 'manifest_deltas' WHERE id = 'c6e5abc9fa52a464b3984cae46232bfd43feaabd'")
db.fetch("SELECT id FROM 'manifests' WHERE id = 'c6e5abc9fa52a464b3984cae46232bfd43feaabd'")
db.fetch("SELECT id FROM 'manifests' WHERE id = 'c6e5abc9fa52a464b3984cae46232bfd43feaabd'")
db.fetch("SELECT data FROM 'manifests' WHERE id = 'c6e5abc9fa52a464b3984cae46232bfd43feaabd'")
old manifest has 139 entries
work path is MT/work
converting 2 bytes from UTF-8 to ANSI_X3.4-1968
converting 4 bytes from UTF-8 to ANSI_X3.4-1968
checking for un-committed work file MT/work
converting 2 bytes from UTF-8 to ANSI_X3.4-1968
converting 4 bytes from UTF-8 to ANSI_X3.4-1968
read rearrangement from MT/work
'conf/c_shd' prefixed to 'conf/c_shd'
'conf/c_halt' prefixed to 'conf/c_halt'
analyzing file 1 : '' -> 'BUGS'
analyzing file 2 : '' -> 'CREDITS'
analyzing file 3 : '' -> 'Changelog'
analyzing file 4 : '' -> 'Makefile'
analyzing file 5 : '' -> 'README'
analyzing file 6 : '' -> 'TODO'
analyzing file 8 : '' -> 'bin/cinit.add.dependency'
analyzing file 9 : '' -> 'bin/cinit.add.getty'
analyzing file 10 : '' -> 'bin/cinit.create.cinit_dir'
analyzing file 11 : '' -> 'bin/cinit.create.empty.service'
analyzing file 12 : '' -> 'bin/cinit.do.not.respawn.service'
analyzing file 13 : '' -> 'bin/cinit.mkheader'
analyzing file 14 : '' -> 'bin/cinit.remove.getty'
analyzing file 15 : '' -> 'bin/cinit.respawn.service'
analyzing file 16 : '' -> 'bin/cinit.shutdown'
analyzing file 17 : '' -> 'bin/cinit.read-conf'
analyzing file 18 : '' -> 'cinit.h'
analyzing file 20 : '' -> 'client/begin_msg.c'
analyzing file 21 : '' -> 'client/connect_sock.c'
analyzing file 22 : '' -> 'client/exec_svc.c'
analyzing file 23 : '' -> 'client/kill_svc.c'
analyzing file 24 : '' -> 'client/msg_change_status.c'
analyzing file 25 : '' -> 'client/msg_start_svc.c'
analyzing file 26 : '' -> 'client/respawn_svc.c'
analyzing file 27 : '' -> 'client/run_run_svc.c'
analyzing file 28 : '' -> 'client/run_svc.c'
analyzing file 30 : '' -> 'comm/do_change_status.c'
analyzing file 31 : '' -> 'comm/do_result.c'
analyzing file 32 : '' -> 'comm/do_start_svc.c'
analyzing file 34 : '' -> 'conf/c_env'
analyzing file 35 : '' -> 'conf/c_init'
analyzing file 36 : '' -> 'conf/c_needs'
analyzing file 37 : '' -> 'conf/c_off'
analyzing file 38 : '' -> 'conf/c_on'
analyzing file 39 : '' -> 'conf/c_params'
analyzing file 40 : '' -> 'conf/c_reboot'
analyzing file 41 : '' -> 'conf/c_respawn'
analyzing file 42 : '' -> 'conf/c_shd'
analyzing file 43 : '' -> 'conf/c_sock'
analyzing file 44 : '' -> 'conf/c_tmp'
analyzing file 45 : '' -> 'conf/c_tmpfs'
analyzing file 46 : '' -> 'conf/c_tmpmount'
analyzing file 47 : '' -> 'conf/c_wants'
analyzing file 48 : '' -> 'conf/cinit_dir'
analyzing file 49 : '' -> 'conf/destdir'
analyzing file 50 : '' -> 'conf/getty_dir'
analyzing file 51 : '' -> 'conf/sleep_svc'
analyzing file 52 : '' -> 'conf/sock_group'
analyzing file 53 : '' -> 'conf/sock_mode'
analyzing file 54 : '' -> 'conf/sock_queue'
analyzing file 55 : '' -> 'conf/sock_user'
skipping preserved file 57 : ''
analyzing file 58 : '' -> 'doc/caveats'
analyzing file 59 : '' -> 'doc/cinit.commands'
analyzing file 61 : '' -> 'doc/fun/testing01'
analyzing file 62 : '' -> 'doc/how_it_works_internally'
analyzing file 63 : '' -> 'doc/ipc.thoughts'
analyzing file 64 : '' -> 'doc/ipc.usenet.posting'
analyzing file 65 : '' -> 'doc/posix.aardvark.bug.report'
analyzing file 66 : '' -> 'doc/shutting.down'
analyzing file 67 : '' -> 'doc/thoughts.closed'
analyzing file 68 : '' -> 'doc/thoughts.open'
analyzing file 70 : '' -> 'generic/mini_printf.c'
analyzing file 71 : '' -> 'generic/set_signals.c'
analyzing file 73 : '' -> 'old/cerr.c'
analyzing file 74 : '' -> 'old/cinit.c01'
analyzing file 75 : '' -> 'old/cinit.c02'
analyzing file 76 : '' -> 'old/cinit.c03'
analyzing file 77 : '' -> 'old/cinit.c04'
analyzing file 78 : '' -> 'old/cinit.c05'
analyzing file 79 : '' -> 'old/cinit.c06'
analyzing file 80 : '' -> 'old/cinit.commands.v01'
analyzing file 81 : '' -> 'old/cinit.h01'
analyzing file 82 : '' -> 'old/cnt_digits.c'
analyzing file 83 : '' -> 'old/do_change_status.c01'
analyzing file 84 : '' -> 'old/idea01'
analyzing file 85 : '' -> 'old/idea02'
analyzing file 86 : '' -> 'old/msg_change_status.c01'
analyzing file 87 : '' -> 'old/msg_start_svc.c'
analyzing file 88 : '' -> 'old/run_init_svc.c01'
analyzing file 89 : '' -> 'old/run_svc.c00'
analyzing file 90 : '' -> 'old/run_svc.c01'
analyzing file 91 : '' -> 'old/run_svc.c02'
analyzing file 92 : '' -> 'old/run_svc.c03'
analyzing file 93 : '' -> 'old/run_svc.c04'
analyzing file 94 : '' -> 'old/run_svc.c05'
analyzing file 95 : '' -> 'old/run_svc.c05.2'
analyzing file 96 : '' -> 'old/run_svc.c06'
analyzing file 97 : '' -> 'old/run_svc.c07'
analyzing file 98 : '' -> 'old/run_svc.c08'
analyzing file 99 : '' -> 'old/run_svc.c09'
analyzing file 100 : '' -> 'old/sig_chld.c'
analyzing file 101 : '' -> 'old/sigio.c01'
analyzing file 103 : '' -> 'sbin/cinit'
analyzing file 105 : '' -> 'serv/add_mod_svc.c'
analyzing file 106 : '' -> 'serv/chk_svc.c'
analyzing file 107 : '' -> 'serv/cinit.c'
analyzing file 108 : '' -> 'serv/list.c'
analyzing file 109 : '' -> 'serv/panic.c'
analyzing file 110 : '' -> 'serv/run_init_svc.c'
analyzing file 111 : '' -> 'serv/sig_reboot.c'
analyzing file 112 : '' -> 'serv/sigio.c'
analyzing file 114 : '' -> 'size/2005-04-26-14:54:44'
analyzing file 115 : '' -> 'size/2005-04-26-16:47:50'
analyzing file 116 : '' -> 'size/2005-04-26-16:48:48'
analyzing file 117 : '' -> 'size/2005-04-26-16:50:45'
analyzing file 118 : '' -> 'size/2005-04-26-17:12:48'
analyzing file 119 : '' -> 'size/2005-04-26-17:13:43'
analyzing file 120 : '' -> 'size/2005-04-26-23:05:33'
analyzing file 121 : '' -> 'size/2005-04-27-00:39:24'
analyzing file 122 : '' -> 'size/2005-04-30-15:18:22'
analyzing file 123 : '' -> 'size/2005-04-30-15:20:40'
analyzing file 124 : '' -> 'size/2005-04-30-15:23:25'
analyzing file 125 : '' -> 'size/2005-04-30-15:25:44'
analyzing file 126 : '' -> 'size/2005-04-30-15:32:43'
analyzing file 127 : '' -> 'size/2005-04-30-15:33:37'
analyzing file 128 : '' -> 'size/2005-04-30-15:41:08'
analyzing file 129 : '' -> 'size/2005-04-30-15:41:18'
analyzing file 130 : '' -> 'size/2005-04-30-15:46:09'
analyzing file 131 : '' -> 'size/2005-04-30-16:48:16'
analyzing file 132 : '' -> 'size/2005-04-30-16:50:05'
analyzing file 133 : '' -> 'size/2005-04-30-17:02:27'
analyzing file 134 : '' -> 'size/2005-04-30-17:03:00'
analyzing file 135 : '' -> 'size/2005-04-30-17:05:11'
analyzing file 136 : '' -> 'size/2005-04-30-17:06:15'
analyzing file 137 : '' -> 'size/2005-04-30-17:11:59'
analyzing file 138 : '' -> 'size/2005-04-30-17:13:43'
analyzing file 139 : '' -> 'size/2005-04-30-22:28:13'
analyzing file 140 : '' -> 'size/2005-04-30-22:34:23'
analyzing file 141 : '' -> 'size/2005-05-02-13:27:51'
analyzing file 142 : '' -> 'size/2005-05-02-13:46:31'
analyzing file 143 : '' -> 'size/2005-05-02-13:49:29'
analyzing file 144 : '' -> 'size/2005-05-02-13:49:58'
analyzing file 145 : '' -> 'size/2005-05-02-13:52:20'
analyzing file 146 : '' -> 'size/2005-05-02-13:55:50'
analyzing file 147 : '' -> 'size/2005-05-02-13:58:14'
analyzing file 148 : '' -> 'size/2005-05-02-13:59:53'
analyzing file 149 : '' -> 'size/2005-05-02-14:00:26'
analyzing file 150 : '' -> 'size/2005-05-02-14:04:19'
skipping preserved directory 151 : 'bin'
skipping preserved directory 152 : 'client'
skipping preserved directory 153 : 'comm'
skipping preserved directory 154 : 'conf'
skipping preserved directory 155 : 'doc'
skipping preserved directory 156 : 'doc/fun'
skipping preserved directory 157 : 'generic'
skipping preserved directory 158 : 'old'
skipping preserved directory 159 : 'sbin'
skipping preserved directory 160 : 'serv'
skipping preserved directory 161 : 'size'
analyzing file 168 : '' -> 'bin/cinit.add.shutdown.reboot.poweroff'
analyzing file 169 : '' -> 'bin/cinit.get-confdir'
analyzing file 171 : '' -> 'bin/not-working/cinit.create.service'
analyzing file 173 : '' -> 'conf/.README'
analyzing file 174 : '' -> 'conf/c_halt'
analyzing file 175 : '' -> 'conf/c_poweroff'
analyzing file 176 : '' -> 'conf/sleep_kill'
analyzing file 178 : '' -> 'doc/.buildwarn'
analyzing file 179 : '' -> 'doc/meta.dependencies'
skipping preserved directory 180 : 'bin/not-working'
adding conf/c_shd -> conf/c_halt to working copy rename set
skipping preserved directory 1 : 'conf'
analyzing file 2 : 'conf/c_shd' -> 'conf/c_halt'
change_set.cc:565: invariant 'I(entries.find(p) == entries.end())' violated

View file

@ -1,3 +0,0 @@
branch "info.clinux.cinit"
database "/home/user/nico/monotone.db"
key ""

View file

@ -1 +0,0 @@
81778a4d16c2b27a8e686600dde41795fc5ed6b8

View file

@ -1,83 +0,0 @@
#
# cinit
# Nico Schottelius
#
# Don't edit Makefile, use conf/*.
#
#
# compile/link options
#
# do not use DEBUG and OPTIMIZE at the same time!
#DEBUG=-g -DDEBUG
OPTIMIZE=-Os
LDFLAGS=-static # init should be static per default!
# programs
CC=gcc $(DEBUG) $(OPTIMIZE)
CFLAGS=-pipe -Wall -I.
LD=gcc
STRIP=strip
# monotone
MT=monotone-0.18
# directories and files
DIRS=client bin conf comm generic doc sbin serv
FILES=BUGS Changelog Makefile README TODO cinit.h
# objects
SERV=serv/sigio.o serv/cinit.o serv/list.o \
serv/run_init_svc.o serv/panic.o serv/sig_reboot.o
CLIENT=client/msg_start_svc.o client/msg_change_status.o client/run_svc.o \
client/exec_svc.o client/respawn_svc.o client/run_run_svc.o \
client/connect_sock.o client/begin_msg.o
COMMUNICATION=comm/do_change_status.o comm/do_result.o comm/do_start_svc.o
BOTH=generic/set_signals.o generic/mini_printf.o
OBJ=$(SERV) $(CLIENT) $(BOTH) $(COMMUNICATION)
# DO NOT CHANGE THIS.
SBIN=sbin
CINIT_BIN=$(SBIN)/cinit
# targets
warn:
@cat doc/.buildwarn
all: $(CINIT_BIN) sizecheck
$(CINIT_BIN): $(SBIN) config.h $(OBJ)
$(LD) $(LDFLAGS) $(OBJ) -o $@
$(STRIP) $@
$(SBIN):
mkdir $(SBIN)
sizecheck:
FILE="size/`date +%Y-%m-%d-%T`"; ls -l sbin/cinit > $$FILE; cat $$FILE
clean:
rm -f *.o */*.o sbin/cinit config.h
config.h: conf/*
./bin/cinit.mkheader > config.h
mt-update:
$(MT) add $(DIRS) $(FILES) 2>/dev/null
mt-commit:
$(MT) commit
mt-sync:
$(MT) sync linux.schottelius.org info.clinux.cinit
install:
chmod 0700 ./scripts/install
./bin/cinit.install.binary
# rm /sbin/cinit
# cp sbin/cinit /sbin/cinit
install-conf:
@echo *** Creating very basic configuration. ***
./bin/cinit.install.conf
install-test:
@echo *** Copying testing configuration. ***
./bin/cinit.install.test

View file

@ -1,92 +0,0 @@
--------------------------------------------------------------------------------
cinit, Nico Schottelius, 2005-04-28 [last change: 2005-05-07]
--------------------------------------------------------------------------------
Introduction
============
cinit is a fast init system with dependency features.
It is orientated on the design off Richard Gooch's
need [0] and Felix von Leitner's minit[1]. Minit does not support real
dependencies (you don't know whether the service you depend on really
started) and the need concept is somehow slow (as seen in gentoo).
In addition, minit needs libowfat and dietlibc, which may not be found
on every Unix system.
cinit main features:
- portability: it should run on every POSIX compatible system.
- true dependencies
- parallel execution
- highly customisable (see conf/*)
Getting cinit
=============
This README is part of the source, so you should have it.
If not, goto the homepage [2] and download the tar archive
or get the lastest snapshot via monotone.
Pre-Configuring
===============
If you want to fine tune cinit parameters, add different path names,
change the DESTDIR, ... have a look at conf/*.
Installing
==========
You can install cinit parallel to any other init-system, it won't
kill other init's config nor /sbin/init, if it exists.
You only have to tell your kernel to execute /sbin/cinit instead
of /sbin/init.
Everybody do:
# make all install
If it's the first time you operate with cinit, also do:
# make install-example
This will populate /etc/cinit with some default services for Linux
(mounting root r/w, starting gettys, setting hostname).
This should work on most Linux systems, still you should have a
look at /etc/cinit and see whether services are correct.
Configuring
===========
You'll have to configure /etc/cinit and add your existing services.
Please read doc/configuring.cinit for details.
sampleconfig.tar is the tar-ball I used for testing, beware if you use it:
It loads dvorak at startup!
There are currently no tools to merge your existing init-system
to cinit (like sysvinit-merge, bsd-merge or minit-merge) available.
If someone cares and tries to do that, I would be happy to include
the script(s).
Additionally I would be thankful for tar-balls containing a complete
replacement of $your_unix_init.
Author, Contact, Bug reports, etc.
==================================
Nico Schottelius (nico-linux-cinit<<at>>schottelius [[dot]] org) is the
author. Bug reports should be send to this address.
The homepage of cinit is [2].
References:
===========
[0]: need: http://www.atnf.csiro.au/people/rgooch/linux/boot-scripts/
[1]: minit: http://www.fefe.de/minit/
[2]: cinit: http://linux.schottelius.org/cinit.html

View file

@ -1,66 +0,0 @@
- check return values of most functions!
- check errno!
- check whether headers are ok
- remove printfs!
- write manpages (use doc/* as base for that)
- eventually split cinit code to csvc to minimize binary of cinit?
- cleanup comments
- cleanup headers!
- respawn_svc and exec_svc must return pid_t of executed service / watcher
- exec_svc.c: should we also change environment?
- write install-example for non-Linux systems (think of merge also)
- move messages to cinit.h or message.h or conf/msg-*!
- remove MAX_SVC
- change exec_svc to be much more dumb!
*svc, *svc_param_file, *svc_env_file
- remove stat from exec_svc, do before!
- check for possibilies to save ram, free things
- stat() in run_svc -> don't call exec_svc, respawn_svc, run_run_svc
- close(*>2) before forking / executing
- get CTR-ALT-DEL
- check if we caught every signal, which could kill us
- create coala-socket with correct permissions! (550, root:cinit)
- run_svc_new:
o we have many strcat()s, perhaps save length of pathbuf and strncat at
pathtmp[strlen(pathbuf)] ?
o should we check strcat and strcpy return values or do we expect them to work?
--------------------------------------------------------------------------------
- script merge sysVinit to cinit?
- circulaere abhaengigkeiten?
- script vorher?
--------------------------------------------------------------------------------
- create conversion table:
djbdns <-> name_server
dnscache <-> name_caching
qmail,postfix,... <-> MTA
--------------------------------------------------------------------------------
create_mini_cinit
-> create something which should be runnable
-> mount, fsck, getty
--> for dev in `read /etc/fstab` ...
fsck $dev
--> mount -a
--> mount -n -o remount,rw /
--> getty from /etc/inittab or /sbin/*getty
-> find out, which gettys with which params
-> use it on 'make install'
--------------------------------------------------------------------------------
signal handlers:
sa.sa_handler=sigint; sigaction(SIGINT,&sa,0); /* ctrl-alt-del */
sa.sa_handler=sigwinch; sigaction(SIGWINCH,&sa,0); /* keyboard request */
--------------------------------------------------------------------------------
Add support for 'cinit' group, which may shutdown/reboot/halt with
SO_PASSCRED in sockets
--------------------------------------------------------------------------------
Done
- include '/' in C_RUNS? make double strings? -> no.

View file

@ -1,41 +0,0 @@
#!/bin/sh
# Nico Schottelius
# cinit: create dependency: service a needs or wants service b
set -e
# init variables
. $(dirname $0)/cinit.read-conf
BASEDIR=$DESTDIR/$CINIT_DIR
if [ $# -ne 3 ]; then
echo "`basename $0`: service_A [wants|needs] service_B"
echo ""
echo " Service A needs or needs Service B."
echo " Use relative paths, not absolute."
echo " You must specify whether to use wants or needs."
echo ""
exit 23
fi
SVC_A=$1
DEP=$2
SVC_B=$3
case $DEP in
wants) DEP=$C_WANTS ;;
needs) DEP=$C_NEEDS ;;
*) echo "Did not I say \"want\" or \"need\"? You _must_ use those terms."
esac
# FIXME: could some PLEASE simply that?
SLASHES=$(echo $SVC_A | sed -e 's,/$,,' -e 's,[^/],,g' -e 's,/,../,g' -e 's,^,../../,')
DEST_NAME=$(echo $SVC_B | sed -e 's,/$,,' -e 's,/,-,g')
SOURCE="${SLASHES}${SVC_B}"
DEST="${BASEDIR}/${SVC_A}/${DEP}/${DEST_NAME}"
echo -n "Linking $SOURCE to $DEST ... "
ln -sf "$SOURCE" "$DEST"
echo "finished."

View file

@ -1,60 +0,0 @@
#!/bin/sh
# Nico Schottelius
# cinit: create gettys
# 2005-05-24
set -e
# init variables
. $(dirname $0)/cinit.read-conf
BASEDIR=$DESTDIR/$CINIT_DIR/$GETTY_DIR
LAST_NUMBER=$(cd $BASEDIR && echo * | sed 's/.* //')
NUMBER=$(echo $LAST_NUMBER + 1 | bc)
[ ! "$NUMBER" ] && NUMBER=1
DDIR=$BASEDIR/$NUMBER
echo "Creating getty number $NUMBER in $DDIR ..."
if [ "$USE_THIS_GETTY" ]; then
GETTYS="$USE_THIS_GETTY"
else
GETTYS=`echo /sbin/*getty*`
fi
for getty in $GETTYS; do
case $getty in
*/fgetty|*/mingetty)
mygetty=$getty
params="/dev/tty${NUMBER}"
;;
*/agetty|*/getty)
mygetty=$getty
params="38400 tty${NUMBER} linux"
;;
*)
echo "Unknown Getty type $getty"
echo "Please report standard parameters to me."
esac
[ "$mygetty" ] && break
done
if [ ! "$mygetty" ]; then
echo "No useable getty found, existing."
exit 1
fi
echo -n "Using $mygetty $params ... "
mkdir -p "$DDIR"
ln -s $mygetty "$DDIR/$C_ON"
for param in $params; do
echo $param >> "$DDIR/${C_ON}${C_PARAMS}"
done
touch "$DDIR/$C_RESPAWN"
echo "finished."

View file

@ -1,43 +0,0 @@
#!/bin/sh
# Nico Schottelius
# cinit: create templates
# 2005-05-24
set -e
# init variables
. $(dirname $0)/cinit.read-conf
if [ $# -lt 1 ]; then
echo "`basename $0`: service-name(s)"
echo " I do create templates for your services"
exit 1
fi
BASEDIR=$DESTDIR/$CINIT_DIR
BASEDIR=./testcinit
for svc in $@; do
INSTDIR=${BASEDIR}/${svc}
if [ -e "$INSTDIR" ]; then
echo "$svc already exists, skipping."
continue
fi
echo -n "Creating $svc ..."
# install creates needed parent directories
"$INSTALL_PROG" "$INSTALL_DIRECTORY" "${INSTDIR}/${C_NEEDS}"
echo "The services this services really needs (it will not start if one failed to start)." > "${INSTDIR}/${C_NEEDS}/README"
"$INSTALL_PROG" "$INSTALL_DIRECTORY" "${INSTDIR}/${C_WANTS}"
echo "The services this services wants (it will start if one or more fail)." > "${INSTDIR}/${C_WANTS}/README"
echo '#!/bin/sh' > "${INSTDIR}/${C_ON}"
echo "echo This should be a link to an executable or a script" >> "${INSTDIR}/${C_ON}"
chmod 0700 "${INSTDIR}/${C_ON}"
echo "One paramater on each line." > "${INSTDIR}/${C_ON}${C_PARAMS}"
echo "Delete me, if there are no paramaters." > "${INSTDIR}/${C_ON}${C_PARAMS}"
echo "Environtment: varx=valuex, one variable on each line." > "${INSTDIR}/${C_ON}${C_ENV}"
echo "Delete me, if you do not want to set any variables." > "${INSTDIR}/${C_ON}${C_ENV}"
echo "finished."
done

View file

@ -1,24 +0,0 @@
#!/bin/sh
# Nico Schottelius
# cinit: switch respawning off
# 2005-05-24
set -e
# init variables
. $(dirname $0)/cinit.read-conf
if [ $# -lt 1 ]; then
echo "`basename $0`: service-name(s)"
echo " The respawning mark will be removed from services"
exit 1
fi
BASEDIR=$DESTDIR/$CINIT_DIR
for svc in $@; do
echo -n "Removing respawning mark from $svc ..."
rm -f "${BASEDIR}/${svc}/${C_RESPAWN}"
echo "finished."
done

View file

@ -1,18 +0,0 @@
#!/bin/sh
# Nico Schottelius
# cinit: read configuration into variables
# 2005-05-24
# try environment first
if [ "$CINIT_DIR" ]; then
CONFDIR=$CINIT_DIR
elif [ -d $(dirname $0)/../conf/ ]; then
CONFDIR=$(dirname $0)/../conf/
elif [ -d /etc/cinit ]; then
CONFDIR=/etc/cinit
else
echo Did not find cinit configuration 1>&2
exit 1
fi
echo $CONFDIR

View file

@ -1,10 +0,0 @@
#!/bin/sh
# Nico Schottelius
# cinit: install basic setup
#
. $(dirname $0)/cinit.read-conf
"$INSTALL_PROG" sbin/cinit $DESTDIR/$PREFIX/sbin/cinit
"$INSTALL_PROG" "$INSTALL_DIRECTORY" $DESTDIR/$PREFIX/$CINIT_DIR

View file

@ -1,20 +0,0 @@
#!/bin/sh
# Nico Schottelius
# cinit: create header file
#
CONFS=$($(dirname $0)/cinit.get-confdir)/../conf/*
echo "/* Warning: Autogenerated by $0, do not edit. */"
for conf in $CONFS; do
NAME="$(basename $conf | tr a-z A-Z)"
value=$(head -n 1 $conf)
# check if numeric - no I didn't see an easier way
numeric=$(echo $value | awk '/^((0[xX])[0-9a-fA-F]+)|([0-9]+)$/ { print }')
[ "$numeric" ] || value="\"$value\""
echo "#define" "$NAME" "$value"
done

View file

@ -1,13 +0,0 @@
#!/bin/sh
# Nico Schottelius
# cinit: read configuration into variables
#
CONFS=$($(dirname $0)/cinit.get-confdir)/../conf/*
for conf in $CONFS; do
NAME="$(basename $conf | tr a-z A-Z)"
eval $NAME="$(head -n 1 $conf)"
eval export $NAME
# eval echo $NAME = \$$NAME
done

View file

@ -1,22 +0,0 @@
#!/bin/sh
# Nico Schottelius
# cinit: create gettys
# init variables
. $(dirname $0)/cinit.read-conf
BASEDIR=$DESTDIR/$CINIT_DIR/$GETTY_DIR
NUMBER=$(cd $BASEDIR; echo * | sed 's/.* //')
[ ! "$NUMBER" ] && exit 1
DDIR=$BASEDIR/$NUMBER
echo "Removing getty number $NUMBER located in $DDIR ..."
read -p "Are you sure [y/N]? " yes
if [ "$yes" = "y" ]; then
rm -r $DDIR
else
echo "Aborted."
fi

View file

@ -1,24 +0,0 @@
#!/bin/sh
# Nico Schottelius
# cinit: switch respawning on
# 2005-05-24
set -e
# init variables
. $(dirname $0)/cinit.read-conf
if [ $# -lt 1 ]; then
echo "`basename $0`: service-name(s)"
echo " Services will be marked respawning"
exit 1
fi
BASEDIR=$DESTDIR/$CINIT_DIR
for svc in $@; do
echo -n "Marking $svc respawning ..."
touch "${BASEDIR}/${svc}/${C_RESPAWN}"
echo "finished."
done

View file

@ -1,27 +0,0 @@
#!/bin/sh
# Nico Schottelius
# shutdown system
# 2005-05-24
usage()
{
echo "`basename $0` -[ohr]"
echo " Shutdown the system:"
echo " -o|--off: Power off"
echo " -h|--halt: Halt"
echo " -r|--reboot: Reboot"
echo " "
exit 1
}
if [ $# -ne 1 ]; then
usage
fi
case $1 in
-r|--reboot) kill -HUP 1 ;;
-o|--off) kill -TERM 1 ;;
-h|--halt) kill -USR1 1 ;;
*) usage ;;
esac

View file

@ -1,40 +0,0 @@
#!/bin/sh
# Nico Schottelius
# cinit: create templates
# 2005-05-24
set -e
# init variables
. $(dirname $0)/cinit.read-conf
if [ $# -lt 1 ]; then
echo "`basename $0`: service-name (including category)"
echo " I do create a service for you"
exit 1
fi
BASEDIR=$DESTDIR/$CINIT_DIR
# read input (from gentoo-bug.sh, http://linux.schottelius.org/scripts/#gentoo-bug
reread()
{
_tmp=""
name="$1"
while [ ! "$_tmp" ]; do
read -p "$1 [$_tmp]: " _tmp
done
echo $_tmp
}
for svc in $@; do
echo -n "Creating $svc ..."
mkdir -p "${BASEDIR}/${svc}"
cd ${BASEDIR}/${svc}
mkdir -p "${C_WANTS}" "${C_NEEDS}"
echo "finished."
done

View file

@ -1,129 +0,0 @@
/*
* cinit
* (c) 2005 Nico Schottelius (nico-linux at schottelius.org)
* header of cinit
*/
/* includes */
#include <sys/types.h> /* pid_t */
#include "config.h" /* paths, socket options, etc. */
/* limits: will be obsolete in cinit-1.0 */
#define MAX_SVC 510 /* maximum services - defines size of array - may later be obsoleted */
#define MAX_DEPS 32 /* maximum direct dependencies of a service */
#define BUFSIZE 4096
/* paths */
#define C_ONARG C_ON C_PARAMS
#define C_OFFARG C_OFF C_PARAMS
#define C_ONENV C_ON C_ENV
#define C_OFFENV C_OFF C_ENV
#define SLASH "/"
#define CINIT_INIT CINIT_DIR SLASH C_INIT
#define CINIT_TMNT CINIT_DIR SLASH C_TMP
#define CINIT_SOCK CINIT_TMNT SLASH C_SOCK
/* commands (maximum: 2^8 = 256)*/
#define CMD_START_SVC 0
#define CMD_CHG_STATUS 1
#define CMD_STOP_SVC 2
#define CMD_KILL_SVC 3
#define CMD_RESCUE 251
#define CMD_INIT 252
#define CMD_HALT 253
#define CMD_REBOOT 254
#define CMD_POWEROFF 255
/* status of a service */
#define ST_TMP 1 /* currently working on it */
#define ST_ONCE 2 /* executed once */
#define ST_RESPAWN 3 /* running and respawning */
#define ST_FAIL 4 /* failed to start service */
/* actions for i/o handlers (see comm/do_*) */
#define ACT_SERV 0
#define ACT_CLIENT 1
/* Messages to the outside */
#define MSG_ERR_FORK "fork"
#define MSG_ERR_EXECVE "execve"
#define MSG_ERR_ALLOC "memory allocation"
#define MSG_ERR_UMOUNT "umount"
#define MSG_TERMKILL "sigterm"
#define MSG_KILLBILL "sigkill"
/* array of svc - not needed anymore
struct svc {
char *abs_path; * service identifier *
char status; * tmp, respawn, ran once *
pid_t pid; * pid of the process *
};
struct svcl {
struct svc svca[MAX_SVC];
int process;
};
*/
// extern struct svcl svc_list;
struct listitem {
char *abs_path;
int status;
pid_t pid;
struct listitem *before;
struct listitem *after;
};
/* variables */
extern struct listitem *list;
extern int sock, logfd;
/* functions (used by server and client) */
void cerr(char *string, int status);
int run_svc(char *rpath);
void mini_printf(char *str, int fd);
void set_signals(int action);
#define LOG(s) mini_printf(s,logfd)
int do_start_svc(int sock2, char *svc, int action);
int do_change_status(char *svc, char *status, pid_t *pid, int sock2, int action);
char do_result(int sock2, char *value);
/* server functions */
/* int chk_svc(char *svc);
int add_mod_svc(char *svc, char status, pid_t pid); */
int list_insert(char *path, int status);
struct listitem *list_search(char *path);
int list_delete(char *path);
int run_init_svc(void);
void sigio(int signal);
void sig_reboot(int signal);
void panic(void);
/* client / message functions */
int msg_start_svc(char *svc);
int msg_change_status(char *svc, char status, pid_t pid);
int begin_msg(char cmd);
/* client functions */
int run_run_svcs(char *abspath);
pid_t exec_svc(char *abspath, int on);
pid_t respawn_svc(char *abspath);
int connect_sock(int socke);
char **read_file(char *file);
/* DEBUG */
#ifdef DEBUG
# define D_PRINTF(x) ( printf("[%s:%d]: %s\n",__FILE__,__LINE__,x) )
#else
# define D_PRINTF(x) if(0)
#endif
/* Messages to the outside */

View file

@ -1,2 +0,0 @@
client/
These sources are used by the children which are spawned by cinit.

View file

@ -1,24 +0,0 @@
/*
* (c) 2005 Nico Schottelius (nico-linux at schottelius.org)
* tell cinit that I want to start a service
* part of cinit
*/
#include <unistd.h>
#include <stdio.h>
#include "cinit.h"
int begin_msg(char cmd)
{
sock = connect_sock(sock);
if( sock == -1 ) {
return 0;
}
if(write(sock,&cmd,sizeof(cmd)) == -1) {
perror("i/o: command");
return 0;
}
return 1;
}

View file

@ -1,41 +0,0 @@
/*
* (c) 2005 Nico Schottelius (nico-linux at schottelius.org)
* run_svc
* part of cinit
*/
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <stdio.h>
#include "cinit.h"
/* open socket connection to cinit-serv and close original socket */
int connect_sock(int socke)
{
int nsock;
struct sockaddr_un addr;
D_PRINTF("socket verbinden");
/******************* begin socket *********************/
close(socke);
nsock = socket(PF_UNIX,SOCK_STREAM,0);
if( nsock == -1 ) {
perror("socket");
return -1;
}
socke = sizeof(addr);
memset(&addr,0,socke);
strcpy(addr.sun_path, CINIT_SOCK);
addr.sun_family = AF_UNIX;
if(connect(nsock,(struct sockaddr *)&addr,socke) == -1) {
perror("connect");
return -1;
}
return nsock;
}

View file

@ -1,246 +0,0 @@
/*
* (c) 2005 Nico Schottelius (nico-linux at schottelius.org)
* run_svc
* part of cinit
*/
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include "cinit.h"
/***********************************************************************
* exec_svc: exec service abspath C_ON or C_OFF
*/
pid_t exec_svc(char *abspath, int on)
{
pid_t pid;
int tmp;
char *p, pathtmp[PATH_MAX];
char *sbuf = NULL, **nargv = NULL, **nenv = NULL;
int fd, argc;
struct stat buf;
pid = fork();
if( pid == -1 ) {
perror("fork");
return 0;
}
/***** PARENT ******/
if(pid > 0) {
waitpid(pid,&tmp,0);
if( WIFEXITED(tmp) ) {
D_PRINTF("EXEC SVC ERFOLGREICH");
return pid;
} else {
D_PRINTF("EXEC SVC FEHLGESCHLAGEN");
return 0;
}
}
/*********** CHILD EXECUTION ***********/
strcpy(pathtmp,abspath);
strcat(pathtmp,"/");
if(on) {
strcat(pathtmp,C_ON);
} else {
strcat(pathtmp,C_OFF);
}
D_PRINTF(pathtmp);
/* readlink retrieves real name, if it is a symlink */
if ( (tmp = readlink(pathtmp,pathtmp,PATH_MAX) ) == -1) {
/* nothing there? fine, exit */
if(errno == ENOENT) {
_exit(0);
} else if (errno != EINVAL) {
perror("readlink");
_exit(1);
}
/* restore original name, file is not a link */
strcpy(pathtmp,abspath);
strcat(pathtmp,"/");
if(on) {
strcat(pathtmp,C_ON);
} else {
strcat(pathtmp,C_OFF);
}
tmp = strlen(pathtmp);
} else {
/* add '\0', readlink forgets it */
pathtmp[tmp] = '\0';
}
tmp++; /* add memory for \0 */
/********** build argv0 ********/
nargv = (char **) malloc( sizeof(char *) );
if(nargv == NULL) _exit(1);
*nargv = (char *) malloc( tmp );
if(*nargv == NULL) _exit(1);
strcpy(*nargv,pathtmp);
/********************** read params *********************/
strcpy(pathtmp,abspath);
strcat(pathtmp,"/");
if(on) {
strcat(pathtmp,C_ONARG);
} else {
strcat(pathtmp,C_OFFARG);
}
/* open params file */
if( !stat(pathtmp,&buf) ) {
fd = open(pathtmp,O_RDONLY);