Commit Graph

479 Commits

Author SHA1 Message Date
Bernhard Reutner-Fischer
d818dcc72a - whitespace cleanup and add a possible shrinkage suggestion 2007-02-16 17:17:07 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
4c97863109 assorted fixes for bugs found with randomconfig 2007-02-03 03:31:13 +00:00
Denis Vlasenko
e968fcd562 lineedit: add missing #if/#endif
init: fix warnings
2007-02-03 02:42:47 +00:00
Denis Vlasenko
4921b54f37 Add BB_EXEC[LV]P() which encapsulate FEATURE_EXEC_PREFER_APPLETS
(patch from Gabriel L. Somlo <somlo@cmu.edu>)
2007-02-03 02:17:41 +00:00
Denis Vlasenko
06c0a71d23 preparatory patch for -Wwrite-strings #3 2007-01-29 22:51:44 +00:00
Denis Vlasenko
b6aae0f381 preparatory patch for -Wwrite-strings #2 2007-01-29 22:51:25 +00:00
Denis Vlasenko
2f0c0d0b88 Introduce FEATURE_EXEC_PREFER_APPLETS = "re-execute our own
executable if we asked to exec someting with argv[0] == known_applet"
Use it in init. Also respect PATH in init, remove explicit "/sbin" etc
from exec. Patch by Gabriel L. Somlo <somlo@cmu.edu>
2007-01-21 00:41:04 +00:00
Denis Vlasenko
9b1381fd2f convert calloc to xzalloc
fix sleep-on-die option
2007-01-03 02:56:00 +00:00
Denis Vlasenko
bf0a201008 style fixes
last xcalloc replaced by xzalloc
2006-12-26 10:42:51 +00:00
Denis Vlasenko
bf66fbc8e2 introduce LONE_CHAR (optimized strcmp with one-char string) 2006-12-21 13:23:14 +00:00
Denis Vlasenko
35fb512728 PID should be stored in pid_t, not int or long.
find_pid_by_name() was returning 0 or -1 in last array element,
but -1 was never checked. We can use just 0 intead.
2006-11-01 09:16:49 +00:00
Denis Vlasenko
dca0b707c0 reshuffle libbb.h contents so that order of decls makes sense
Found bad typo in largefile support :)
2006-10-27 09:05:02 +00:00
Denis Vlasenko
e1a0d486e4 message string changes, mostly for consistency, also -32 bytes in .rodata 2006-10-20 13:28:22 +00:00
Denis Vlasenko
ea62077b85 add open_read_close() and similar stuff 2006-10-14 02:23:43 +00:00
Denis Vlasenko
1385899416 attempt to regularize atoi mess. 2006-10-08 12:49:22 +00:00
Denis Vlasenko
7d219aab70 build system overhaul 2006-10-05 10:17:08 +00:00
Denis Vlasenko
8f8f268cfd bb_applet_name -> applet_name 2006-10-03 21:00:43 +00:00
Denis Vlasenko
67b23e6043 getopt_ulflags -> getopt32.
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
2006-10-03 21:00:06 +00:00
Denis Vlasenko
ce97960a6e usage.h: remove ugly tricks. We have USE_FEATURE_xxx now.
Few bugs are now exposed...
2006-09-27 23:31:08 +00:00
Rob Landley
e9a7a6212b Change license statements (and clean up headers) on some of the files that
Erik or I are primary copyright holders on.
2006-09-22 02:52:41 +00:00
Denis Vlasenko
049d6b8c08 Add CONFIG_FEATURE_SYSLOG which controls whether
bb_xx_msg will ever try to send output to syslog.
Add "select CONFIG_FEATURE_SYSLOG" to relevant applets.
This allows to omit syslog code if we do not have
any syslog-capable applets in the build.
2006-09-07 06:02:39 +00:00
Rob Landley
88621d7398 Svn 16007 broke the build under gcc 4.0.3. This fixes up some of the damage
(the e2fsprogs directory is too twisty and evil to easily fix, but I plan
to rewrite it anyway so I'll just bump that up in priority a bit).
2006-08-29 19:41:06 +00:00
Rob Landley
534374755d Cleaup read() and write() variants, plus a couple of new functions like
xlseek and fdlength() for the new mkswap.
2006-07-16 08:14:35 +00:00
Rob Landley
cba1b96735 Patch from Shaun Jackman to set environment variable RUNLEVEL equal to
init's argv[1], so if you append "single" to your kernel command line and
the kernel doesn't parse it, RUNLELEL=single.

Plus a few unrelated header cleanups while I was in the area...
2006-07-09 17:28:17 +00:00
"Robert P. J. Day"
edd9ca5743 More removal of "#if 0" content. 2006-07-01 14:52:12 +00:00
Bernhard Reutner-Fischer
e15d7573a1 - move #include busybox.h to the very top so we pull in the config
and eventual platform specific includes in early.
2006-06-02 20:56:16 +00:00
Bernhard Reutner-Fischer
cf1f2ace39 - fix CONFIG_DEBUG_INIT compile failure 2006-06-02 10:43:17 +00:00
Paul Fox
d112f8fa5e make halt and poweroff messages more accurate (i.e., claim "we're about to",
rather than "it's done", and combine with reboot handler to save space.
2006-06-01 13:17:49 +00:00
Bernhard Reutner-Fischer
9a5686b605 - fix IMA compile error i introduced when adding this untested snippet. 2006-05-31 18:57:56 +00:00
Bernhard Reutner-Fischer
7ae1553980 - consolidate "Sending SIG%s to all processes"; untested..
text    data     bss     dec     hex filename
   5379      32       8    5419    152b init/init.o.oorig
   5358      32       8    5398    1516 init/init.o
2006-05-30 18:17:21 +00:00
Bernhard Reutner-Fischer
c58dbf28e0 - remove useless variable "status" from init_main.
http://www.opengroup.org/onlinepubs/009695399/functions/waitpid.html suggests
that we need not specify a status if we don't want, and we don't.
"If wait() or waitpid() return because the status of a child process is available, these functions shall return a value equal to the process ID of the child process. In this case, if the value of the argument stat_loc is not a null pointer, information shall be stored in the location pointed to by stat_loc.  "
   text    data     bss     dec     hex filename
   5391      32       8    5431    1537 init/init.o.06
   5379      32       8    5419    152b init/init.o
2006-05-30 12:16:54 +00:00
Bernhard Reutner-Fischer
3ab3080bc2 - use config_buffer for message()
- add second argument to waitfor(*action,pid); if action==NULL then use pid tor
  wait for. If an action was given, we wait for the action to finish just as
  before. In run() remove second and third occurance of the same functionality
  the waitfor() call now provides.
  Adjust the former only caller of waitfor accordingly.

PS: Not using waitfor but creating a second function used a few bytes more than
simply extending and reusing waitfor.
   text    data     bss     dec     hex filename
   5426      32       8    5466    155a init/init.o.orig
   5391      32       8    5431    1537 init/init.o
2006-05-30 12:10:29 +00:00
Bernhard Reutner-Fischer
35e1a077d6 - DEBUG_INIT -> config CONFIG_DEBUG_INIT 2006-05-29 13:08:35 +00:00
Bernhard Reutner-Fischer
76bb97c995 - landley, remove this? 2006-05-29 13:01:37 +00:00
Bernhard Reutner-Fischer
49e60b9788 - set_term() doesn't need an argument. (Like r15220 this is just compile-tested)
text    data     bss     dec     hex filename
   5432      32       8    5472    1560 init/init.o.r15220
   5426      32       8    5466    155a init/init.o
2006-05-29 12:57:52 +00:00
Bernhard Reutner-Fischer
0da069d382 - move common code into new open_new_terminal() function;
text    data     bss     dec     hex filename
 864434   10244  645892 1520570  1733ba busybox_old
 864386   10244  645892 1520522  17338a busybox_unstripped

add/remove: 1/0 grow/shrink: 0/2 up/down: 92/-143 (-51)
function                                     old     new   delta
open_new_terminal                              -      92     +92
exec_signal                                  345     276     -69
run                                         1527    1453     -74
Again, 48 != 51 so let's trust the former..
2006-05-29 12:54:16 +00:00
Rob Landley
299a6b4d7b Consolidate #include <sys/time.h> so libbb.h does it. 2006-05-27 21:42:58 +00:00
Bernhard Reutner-Fischer
d765ee5d0f - provide fallback defines for non-linux 2006-05-26 20:34:02 +00:00
Bernhard Reutner-Fischer
b180e5a766 - use portability wrapper define bb_setpgrp. 2006-05-26 14:24:56 +00:00
Bernhard Reutner-Fischer
b1629b1b2a - remove emacs layout block as suggested by Robert P.J. Day
- use shorter boilerplate while at it
2006-05-19 19:29:19 +00:00
Mike Frysinger
39440e520c pull Rules.mak from top_srcdir as pointed out by Robert P. J. Day on the mailing list 2006-05-13 02:33:09 +00:00
Mike Frysinger
2f4d91da75 fix whitespace 2006-05-13 02:27:52 +00:00
Mike Frysinger
706f8f6de5 just include fcntl.h not sys/fcntl.h 2006-04-29 04:43:31 +00:00
Rob Landley
2ec922eed5 Patch from Robert P Day: let menuconfig indent stuff for us, we don't have
to do it in Config.in.
2006-04-13 23:22:16 +00:00
Mike Frysinger
6850017a2f remove some more config code rob missed in rev 13701 cleanup as reported by Robert P. J. Day 2006-03-28 06:11:51 +00:00
Rob Landley
b3ede5abe2 More from Jan Kiszka: this is a port of the latest sysv-init SELinux patch.
It makes busybox invoke the libselinux library function to load the binary
policy right at system start-up. It was successfully tested on a mini-SELinux
system.  Note: requires recent libselinux. I'm using 1.28.
2006-03-27 23:09:12 +00:00
Rob Landley
2dd4279959 Patch from Rogelio Serrano to defer checking whether the tty exists until
we actually need to spawn something on it.
2006-03-22 17:39:13 +00:00
Bernhard Reutner-Fischer
df10094870 - revert back to r14406 2006-03-13 19:04:00 +00:00
Rob Landley
bc68cd14cc Patch from Denis Vlasenko turning static const int (which gets emitted into
the busybox binary) into enums (which don't).
2006-03-10 19:22:06 +00:00
Bernhard Reutner-Fischer
07a79e75f5 - backout using features which are not available with the previous stable
version of make (3.71.1).
2006-03-09 09:03:37 +00:00
Rob Landley
dfba741457 Robert P. Day removed 8 gazillion occurrences of "extern" on function
definitions.  (That should only be on prototypes.)
2006-03-06 20:47:33 +00:00
Bernhard Reutner-Fischer
022eb311d5 - use absolute path for top_builddir and top_srcdir.
Fixes make trying to include the very same file in an endless loop.
2006-03-02 17:33:25 +00:00
Bernhard Reutner-Fischer
5d26126b9e - fixes parallel builds (make -j)
- use less resources for the buildsystem itself
2006-03-01 22:54:48 +00:00
Rob Landley
0a7c8ef6e2 Patch from Denis Vlasenko to constify things and fix a few typos. 2006-02-22 17:01:00 +00:00
Rob Landley
d6e14d8bee Don't build directory libraries unless we're building an applet that needs it.
Cherry-picked from Devin Bayer's big MacOS X patch.
2006-02-21 19:11:35 +00:00
Rob Landley
4926d643ea Missed this in svn 13701. 2006-02-10 21:38:20 +00:00
Mike Frysinger
b38673fb9f make the build system puuuuuuuuuuurty 2006-02-02 01:41:53 +00:00
"Vladimir N. Oleynik"
1f04c9d29c removed anoinig `unused' warnings 2006-02-01 14:47:52 +00:00
Rob Landley
646129163a Re-add initrd support, unify halt/reboot/poweroff, add -n and -f options. 2006-01-30 08:31:37 +00:00
Tim Riker
c1ef7bdd8d just whitespace 2006-01-25 00:08:53 +00:00
Rob Landley
2edf52643d The whole "init is sometimes pid 3" thing is silly. Init is pid 1, anything
else is a kernel bug.  Both 2.4 and 2.6 should get this right now.  This
should fix the bug IraquiGeek is seeing (although killall still needs to
be fixed.)
2006-01-22 02:41:51 +00:00
Bernhard Reutner-Fischer
7ca61b6f33 - shared libbusybox.
- IMA compilation option (aka IPO, IPA,..)
Please holler if i broke something..
2006-01-15 14:04:57 +00:00
"Vladimir N. Oleynik"
6c35c7c976 usage bb_dev_null 2005-10-12 15:34:25 +00:00
"Vladimir N. Oleynik"
ba248206fe change strange depend to libbb.h, but require busybox.h 2005-10-06 15:18:09 +00:00
"Vladimir N. Oleynik"
8e1bd4a05b don't out \r to syslog 2005-09-29 12:55:21 +00:00
Mike Frysinger
f51d2069ff re-order a little for alphabetical 2005-09-24 23:14:11 +00:00
Mike Frysinger
62f18e1f20 use the shorter license header 2005-09-24 07:16:29 +00:00
Mike Frysinger
0d4ee68be5 use brief license line 2005-09-24 06:01:57 +00:00
Rob Landley
c3386a4304 Why have a separate CONFIG_INIT_SWAPON when we already have CONFIG_SWAPONOFF? 2005-08-30 18:50:37 +00:00
Rob Landley
7a8f6792f3 Bug system entry #1 says that when busybox doesn't have swapoff,
init shouldn't call swapoff.
2005-08-30 18:17:05 +00:00
Paul Fox
41a72ecd19 applying patch from bug 24:
0000024 03-16-05 patch: allow init to set controlling tty
2005-08-01 16:43:13 +00:00
Mike Frysinger
4d00896d05 use toplevel ARFLAGS and update default ARFLAGS to be quiet 2005-07-27 01:09:24 +00:00
Mike Frysinger
10427ab528 move var decls around a little to help gcc make smaller code 2005-07-06 05:00:48 +00:00
Mike Frysinger
e548bdff96 2005-07-04 Shaun Jackman <sjackman@gmail.com>
* init/init.c: Do not include sys/mount.h.
        (message): Use O_NONBLOCK instead of O_NDELAY.
        (console_init): Ditto.
2005-07-06 04:46:14 +00:00
Mike Frysinger
95ef16528c 2005-07-05 Shaun Jackman <sjackman@gmail.com>
* init/Config.in (CONFIG_FEATURE_INIT_SWAPON): New option.
        * init/init.c (check_memory): Disable the swapon feature unless
        CONFIG_FEATURE_INIT_SWAPON is defined.
2005-07-06 04:39:08 +00:00
Mike Frysinger
72a4c33568 rename log var to log_console so we dont override internal gcc/glibc log func 2005-07-05 02:19:20 +00:00
Mike Frysinger
a77b4f3970 jfb2 writes in Bug 119:
The init applet will restart (re-exec) itsself when it
receives a SIGHUP. However, just before it enters its
main loop, it resets SIGHUP to either re-load the inittab
(or ignore it if no inittab is used). Thus preventing
the re-exec option from being triggerable.

This patch adds a signal handler for SIGQUIT for init that
always causes init to re-exec itsself (along with killing
anything else that might be still running).
2005-04-16 08:21:34 +00:00
Eric Andersen
82baf63de5 Hiroshi Ito writes:
Hello, all.

Busybox init does not handle removed inittab entry correctly.

# I'm sorry about my poor english, but you can find
# what I would like to say from patch, isn't it?

even if you apply this path,
when yoy try to change a command line option in inittab,
you have to do following steps.
1. remove old line from initrd
2. send HUP signal to init
3. kill old proces which is invoked from init.
4. append new line to inittab
5. send HUP signal to init, again

patch is against current CVS + last patch witch I send it last.
2004-10-08 08:21:54 +00:00
Eric Andersen
2271809d75 Hiroshi Ito writes:
"kill -HUP 1" reloads inittab, and when I append one line to inittab
and send HUP signal two times, It will starts 2 process.

patch against current CVS is attached.
2004-10-08 08:17:39 +00:00
Eric Andersen
7daa076d3e egor duda writes:
Hi!

I've created a patch to busybox' build system to allow building it in
separate tree in a manner similar to kbuild from kernel version 2.6.

That is, one runs command like
'make O=/build/some/where/for/specific/target/and/options'
and everything is built in this exact directory, provided that it exists.

I understand that applyingc such invasive changes during 'release
candidates' stage of development is at best unwise. So, i'm currently
asking for comments about this patch, starting from whether such thing
is needed at all to whether it coded properly.

'make check' should work now, and one make creates Makefile in build
directory, so one can run 'make' in build directory after that.

One possible caveat is that if we build in some directory other than
source one, the source directory should be 'distclean'ed first.

egor
2004-10-08 07:46:08 +00:00
Eric Andersen
785001468d Quiet a few warnings 2004-08-27 19:55:28 +00:00
Eric Andersen
1f50e84283 Do not use vfork, as init is not vfork safe. Do not allow
askfirst when mmuless.
2004-08-16 09:29:42 +00:00
Eric Andersen
36adca81f5 Patch from Bastian Blank:
On Sat, Jun 19, 2004 at 10:57:37PM +0200, Bastian Blank wrote:
> The following patch changes klogd to use openlog/syslog themself
> instead of calling syslog_msg which always calls the triple
> openlog/syslog/closelog.

Updated patch: get rid of syslog_msg entirely. Request from Erik Andersen.

Bastian
2004-06-22 10:07:17 +00:00
Eric Andersen
0dfe4e9956 As discussed, drop minit, which was not being supported in busybox.
People wishing to use minit can obtain it and obtain support from
http://www.fefe.de/minit/
2004-05-26 10:28:32 +00:00
Glenn L McGrath
c6992feee3 Update my email address, document some of my tasks in the AUTHORS file 2004-04-25 05:11:19 +00:00
Eric Andersen
87812dc3b0 Silly me 2004-04-12 19:21:54 +00:00
Eric Andersen
4e19fa9b64 As reported by Quy Tonthat, init has problems with inittab's that
contain only actions sysinit/wait/once. It does not clean up zombies
in that case.
2004-04-12 19:17:13 +00:00
Eric Andersen
e3efc9230c Jamie Guinan writes:
It looks like latest uClibc defines ARCH_HAS_MMU, but a few busybox files
test UCLIBC_HAS_MMU, resulting in vfork() getting called instead of
fork(), etc.

Patch below.   Only tested for lash.

Cheers,
-Jamie
2004-04-12 17:59:24 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Glenn L McGrath
e7f2b2bf31 Thomas Geulig, remove duplicate header 2004-02-22 04:17:26 +00:00
Eric Andersen
88c916bdec Andreas Mohr writes:
the busybox menuconfig triggered my "inacceptable number of spelling mistakes"
upper level, so I decided to make a patch ;-)

I also improved some wording to describe some things in a better way.

Many thanks for an incredible piece of software!

Andreas Mohr, random OSS developer
2003-10-22 09:58:56 +00:00
Glenn L McGrath
e6ba16f830 Patch by Guillaume Morin
Fix two race conditions, as described at.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=212764
2003-09-26 10:45:55 +00:00
Eric Andersen
2205c84de4 comparison was always false due to limited range of data types.
Carefully cast to unsigned long long prior to multiply to get
the expected result.
2003-09-15 08:11:29 +00:00
Eric Andersen
81155f8fa8 Update definition of struct serial_struct, per linux-2.6.0-test5,
to avoid stack corruption problems on some 64bit architectures
when sizeof(void*) != sizeof(int).  Thanks to Atsushi Nemoto
for finding this problem.
2003-09-11 08:52:22 +00:00
Glenn L McGrath
99bd5adf99 more crond+crontab integrating with loginutil libbb functions and deleted
patch from Thomas Gleixner to init.
Viodz last_patch_108
2003-09-03 12:18:42 +00:00
Glenn L McGrath
dc4e75ef7c move all "-/bin/sh" "/bin/sh" and "sh" to libbb/messages.c file as one
constant.
Vodz last_patch_107
2003-09-02 02:36:18 +00:00
Glenn L McGrath
ce6482eace Fix overflow for machines greater than 4GB, return unsigned int to avoid
a cast and for greater accuracy.
2003-08-26 02:14:58 +00:00
Eric Andersen
9cdef5d928 Yang Xiaopeng writes:
>I'm sure that no user process use old root now,  but when run "umount
>/old_root", it says:
>   umount: /old_root: Device or resource busy
>
>I have tried to remount /proc within the new root *after* chroot, but
>get the same result.
>
>
I found the problem, I said that no user process use old root when run
my scripts, but
I'm wrong, actually there is a '3' fd open the file
"/old_root/dev/console". By adding
debug message in init/init.c, I found the problem: when init restart(in
exec_signal()),
before open the new terminal device, there is still a file opened(I
don't know which file it is), so the
terminal device(stdin) get fd '1', and the first dup(0)(stdout) return
'2', the second(stderr) return '3'.

I attach a simple patch to solve this problem.
2003-07-29 06:33:12 +00:00
Eric Andersen
a1ed06b047 Move start_stop_daemon to debianutils.
Cleanup run_parts a bit and add long opts
2003-07-26 09:16:00 +00:00
Eric Andersen
aa820dbc00 cleanup and add long options 2003-07-26 09:10:35 +00:00
Eric Andersen
d5868c1692 Patch from Thomas Gleixner to reap any zombie processes that are
reparented to init...
2003-07-26 06:25:12 +00:00
Eric Andersen
20c9f1e5e7 Several simplifications and indenting changes, per
last_patch97 from vodz
2003-07-22 17:14:10 +00:00
Eric Andersen
4c6c236781 As vodz noticed, I screwed up reboot 2003-07-22 17:04:54 +00:00
Eric Andersen
6fd0e31e87 Patch from Andrew Flegg:
Here's a pretty crude patch to reload /etc/inittab when init receives a
    SIGHUP. The mailing list archives weren't entirely clear on whether or
    not it should already happen, but didn't appear to be.

    The patch:
       * Adds a new function, reload_signal() which just calls
	 parse_inittab() and run_actions(RESPAWN)

       * Before entering the while (1) loop set up SIGHUP to call
	 reload_signal()

       * Modify new_init_action to skip the action if the same command
	 already exists on the same terminal

    This last bit means that changing already running entries is a bit
    hairy as you can end up with, for example, two shells running on the
    same virtual console. However, for solely adding/removing entries this patch
    seems to work quite well.
2003-07-22 09:48:56 +00:00
Eric Andersen
0246222351 Support reboot, halt, and poweroff independent of busybox init.
Simplify and fixup some logic.
 -Erik
2003-07-22 09:41:39 +00:00
Eric Andersen
85e5e72bc1 Remove remaining libc5 support code 2003-07-22 08:56:55 +00:00
Eric Andersen
cb81e6484d Update a bunch of docs. Run a script to update my email addr. 2003-07-14 21:21:08 +00:00
Eric Andersen
e5642119ee Patch from Thomas Cameron:
Hello all,
	    This patch adds more "Help" text to the config system.  Almost
    all applets now have a help entry.  Also, I cleaned up the spacing of
    the existing text so that things are consistent.  This patch is against
    this morning's CVS.

    Thomas Cameron
    CEI Systems, Inc.
2003-07-14 19:37:08 +00:00
Eric Andersen
fb0c6af286 Patch from Lars Kellogg-Stedman:
The attached two patches add config documentation to init/Config.in and
    fileutils/Config.in.
2003-07-14 19:18:43 +00:00
Eric Andersen
d5a2780aa2 oops 2003-07-05 08:39:47 +00:00
Eric Andersen
3c8064ff69 Daniel writes:
I've found a problem with job control when the init process is restarted.

If the system boots for the first time, I get job control on a serial terminal -
no problems. However, when I restart init by issuing "init -q", then the shell
no longer has job control.

I traced this a problem in console_init in the file init.c. What was happening
after the restart is that the first compare

    if (ioctl(0, TIOCGSERIAL, &sr) == 0) {
	...
    } else if (ioctl(0, VT_GETSTATE, &vt) == 0) {
	...
    } else {
	... // assume /dev/console
    }

returned error and subsequently the code assumes /dev/console as the console,
which does not support job control.

Checking the errno after the first call showed that the system was complaining
about the file descriptor. This is probably because the previous init process
had closed all its file descriptors which the new init process had inherited.
2003-07-05 08:29:01 +00:00
Eric Andersen
65e20a33c2 Patch from Kent Robotti adding a bunch of needed docs!
-Erik
2003-07-05 07:52:35 +00:00
Eric Andersen
b01ed65ad2 Apply last_patch93 from vodz:
andersen@busybox.net wrote:
    >Message: 4
    >Modified Files:
    >       init.c
    >Log Message:
    >Remove code for unsupported kernel versions

    Hmm. Current init.c have check >= 2.2.0 kernel one time too.
    Ok. Last patch removed this point and move common init code to new file for
    /init dir
2003-06-27 17:08:15 +00:00
Eric Andersen
0b0d393347 Remove bdflush garbage, which is only relevant to unsupported
kernel versions
2003-06-27 05:46:29 +00:00
Glenn L McGrath
1e11c34be4 minit, a Minimal init system. 2003-05-11 14:52:39 +00:00
Eric Andersen
2c1de61023 There have been many reports of init failing to reboot and/or failing to halt
over the years.  Well I finally took the time to track this down.  It turns out
that inside linux/kernel/sys.c the kernel will call
    machine_halt();
    do_exit(0);
when halting, or will call
    machine_power_off();
    do_exit(0);

during a reboot.  Unlike sysv init, we call reboot from within the init
process, so if the call to machine_halt() or machine_power_off() returns,                                       the call to do_exit(0) will cause the kernel to panic.  Which is a very
bad thing to happen.

So I just added this little patch to fork and call the reboot
syscall from within the forked child process, thereby neatly
avoiding the problem.

But IMHO, both calls to do_exit(0) within linux/kernel/sys.c
are bugs and should be fixed.

 -Erik
2003-04-24 11:41:28 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Eric Andersen
22237017a7 Fix a silly compile error, thanks to a patch from Wen-chien Jesse Sung 2003-01-23 07:08:26 +00:00
Glenn L McGrath
b4a1baa312 Correct some init issues, update email address, last_patch78 by Vladimir
N. Oleynik
2003-01-13 22:09:50 +00:00
Eric Andersen
cf1fee06a5 Odd. I never brought this forward from bb.stable. Should handle
reaping child processes better.
 -Erik
2002-12-17 09:48:16 +00:00
Glenn L McGrath
4e05b9b043 include "busybox" after the libc includes tofix compile errors 2002-12-07 23:14:40 +00:00
Eric Andersen
c9f20d9fb9 Yet another major rework of the BusyBox config system, using the considerably
modified Kbuild system I put into uClibc.  With this, there should be no more
need to modify Rules.mak since I've moved all the interesting options into the
config system.  I think I've got everything updated, but you never know, I may
have made some mistakes, so watch closely.
 -Erik
2002-12-05 08:41:41 +00:00
Glenn L McGrath
efdd0aed23 Use error_msg instead of fprintf(stderr 2002-11-28 09:40:36 +00:00
Glenn L McGrath
8f0722a53b Move readlink, mktemp, run-parts and which to a new debianutils dir. 2002-11-11 03:00:12 +00:00
Eric Andersen
f02c26f1ef I committed the fflush in the wrong spot. I should go to bed
earlier so I don't screw up such easy stuff.
 -Erik
2002-10-22 19:15:43 +00:00
Eric Andersen
5956028f6f Be absurdly careful about flushing stdout. 2002-10-22 11:45:20 +00:00
Eric Andersen
e8a90fb2bc After thinking about it, I think this patch from Matt Kraai is probably the
best way to go.  Sysvinit does not provide a controlling tty since it doesn't
even try to open ttys for apps.  We do.  So we should _try_ to provide a
controlling tty if possible, but we needn't freak out if it doesn't work.  This
way we won't need to use openvt or similar, we'll just have init do the Right
Thing(tm).
2002-10-12 04:05:48 +00:00
Eric Andersen
71ae64bdc6 last_patch61 from vodz:
New complex patch for decrease size devel version. Requires previous patch.
    Also removed small problems from dutmp and tar applets.
Also includes vodz' last_patch61_2:
    Last patch correcting comment for #endif and more integrated
    with libbb (very reduce size if used "cat" applet also).
    Requires last_patch61 for modutils/config.in.
2002-10-10 04:20:21 +00:00
Eric Andersen
6a9799020b Set the close-on-exec flag, just to be saf 2002-09-30 20:08:53 +00:00
Eric Andersen
a920871c3a Ignoring SIGCHLD causes a race leading to the occasional hang of init
when init will wait() on itself in waitfor() when the child exits before
init is scheduled to run.  Letting init hang is very seriously bad.
 -Erik
2002-09-25 15:08:40 +00:00
Eric Andersen
34fd00af5f Patch from David McCullough <davidm@snapgear.com> 2002-09-17 08:40:12 +00:00
Eric Andersen
a9cc8961ed Let people run SHUTDOWN actions prior to killing everything
-Erik
2002-09-16 06:49:06 +00:00
Glenn L McGrath
061c900176 mesg applet by Manuel Novoa III 2002-09-16 04:21:46 +00:00
Eric Andersen
186685d46f Patch from Thomas Gleixner <tglx@linutronix.de> to do
automatic child reaping to avoid zombies
2002-09-12 15:44:53 +00:00
Eric Andersen
1130976f8e Eliminate use of obsolete sys_errlist[]
-Erik
2002-08-26 21:36:32 +00:00
Glenn L McGrath
baf55a85fc Run through indent, fix comments 2002-08-22 18:22:10 +00:00
Eric Andersen
e707806894 Kill a silly warning 2002-07-29 08:00:16 +00:00
Eric Andersen
3bc2b206b0 Patch from Tim Riker to allow tty* in inittab if the tty
actually exists -- serial console is not the issue...
2002-07-29 06:39:58 +00:00
Eric Andersen
0826b6b0b3 This is last_patch48 from vodz. More cleanups, kills a bit
of dead code, fixes one blatent bug.
2002-07-03 23:50:16 +00:00
Eric Andersen
887ca79f04 Scrub pwd.h and grp.h handling so we don't have to play any
silly games.
 -Erik
2002-07-03 23:19:26 +00:00
Eric Andersen
599e3ce163 Apply last_patch47 from vodz to fix several problems, such as the ash "job
control turned off" bug, console_setup() was called with a closed file
descriptor, setsid() inconsistancy, and silly string handling bugs.   I have
modified his patch to allow the askfirst init actions to have a controlling
terminal.
2002-07-03 11:08:10 +00:00
Eric Andersen
796446718d Fix from vodz so that complex init commands actually work 2002-07-03 05:44:18 +00:00
Eric Andersen
5222d31a15 Patch from till busch <buti@gmx.at> -- unblock all signals
in exec_signal() before calling exec()
2002-07-03 05:15:23 +00:00
Eric Andersen
ff7661d9de plug fd leak noticed by Russ Dill
-Erik
2002-06-05 07:11:32 +00:00
Robert Griebl
ea1a63a201 Fix for broken handling off BusyBox's own pwd/grp implementations
[Parts of this patch may overlap with my other two patches]
2002-06-04 20:10:23 +00:00
Eric Andersen
d8636cad4d Doh! Remember to close /etc/inittab 2002-05-15 22:19:09 +00:00
Eric Andersen
1d1d2f9b18 Update some missing copyright notices 2002-04-13 08:31:59 +00:00
Eric Andersen
85208e2ab9 Completely rework the config system so that it no longer annoys me to work on
the busybox development tree.  This eliminates the use of recursive make, and
once again allows us to run 'make' in a subdirectory with the expected result.
And things are now much faster too.  Greatly improved IMHO...
 -Erik
2002-04-12 12:05:57 +00:00
Eric Andersen
c57e42b8f0 Provide a controlling tty to askfirst processes as well
-Erik
2002-03-29 00:59:44 +00:00
Eric Andersen
b0cc0a6ca8 Rewind messages to avoid weird formatting, and fix a bug with
CONFIG_FEATURE_EXTRA_QUIET, which was broken
2002-03-20 14:57:50 +00:00
Eric Andersen
0298be88ae Update init.c per my changes in the stable branch
-Erik
2002-03-05 15:12:19 +00:00
Eric Andersen
53a2299230 Patch from Russ Dill <Russ.Dill@asu.edu>. From the
start-stop-daemon man page:

-b|--background
        Typically used with programs that don't detach on their own.
        This option will force start-stop-daemon to fork before starting
        the process, and force it into the background. WARNING:
        start-stop-daemon cannot check the exit status if the process
        fails to execute for any reason. This is a last resort, and is
        only meant for programs that either make no sense forking on
        their own, or where it's not feasible to add the code for it to
        do this itself.

This is usefull for applets like watchdog
2002-01-26 09:04:45 +00:00
Eric Andersen
467a18b1d9 Teach 'init -q' that init's pid may not equal 1 2002-01-25 23:13:06 +00:00
Eric Andersen
038cbc7442 Oops. 2002-01-06 01:10:25 +00:00
Eric Andersen
c94e89d81f Do not depend on PATH or getopt arg reordering 2002-01-06 01:08:28 +00:00
Matt Kraai
1f0c43668a Remove == TRUE' tests and convert != TRUE' and `== FALSE' tests to use !. 2001-12-20 23:13:26 +00:00
Eric Andersen
fb74a45088 Vodz' last_patch31
Very minimal last corrections:

    1) busybox.c: fix warining
    2) docs/: add applets for list from pwd_grp
    3) usage.h: add -n option for route
    4) run_parts.c: many todo fix for busybox style
    5) addgroup.c: add #ifdef CONFIG_FEATURE_SHADOWPASSWDS, reduce one
    perror_msg
    6) adduser.c: fix bug "variable i not initialize" and
       add #ifdef CONFIG_FEATURE_SHADOWPASSWDS
2001-12-18 14:06:03 +00:00
Eric Andersen
730f826f25 Add in a new restart init target, triggered by SIGHUP. Patch from
Russ Dill, with adjustments by me.
 -Erik
2001-12-17 23:13:08 +00:00
Eric Andersen
b24d65659f If find_pid_by_name() had an error, it was returning -1, but storing
that into a pid_t, which is unsigned on a number archs.  Furthermore,
find_pid_by_name() would _never_ return an error if the intended proces
was "init", but instead would return 1, meaning we would fail to work
on 2.4.x kernels running an initrd...
 -Erik
2001-12-06 14:52:32 +00:00
Eric Andersen
ed8a9be287 Patch from Dan Langlois <dan@somanetworks.com> Support SIGSTOP/SIGCONT
for wierd situations when people want init to actualy stop doing
anything for a while...
2001-11-30 19:10:58 +00:00
Eric Andersen
2480e3a30a Fix dangling comma 2001-11-21 09:05:31 +00:00
Eric Andersen
f435a918fa S390 wierdness 2001-11-20 05:42:57 +00:00
Eric Andersen
fedce06b7f Hide some ifdefs to make it more readible 2001-11-17 07:27:14 +00:00
Eric Andersen
282671bf76 Cleanup some config problems. Add a sane default config that basically
matches the default old Config.h
2001-11-10 12:07:24 +00:00
Eric Andersen
7d6829096d Add the run-parts applet submitted by Emanuele Aina
<emanuele.aina@tiscali.it>
2001-10-31 10:59:29 +00:00
Eric Andersen
6cf47a79ac Run parts applet by Emanuele Aina <faina.mail@tiscalinet.it> 2001-10-31 10:24:36 +00:00
Eric Andersen
950d8b496f patch from vodz:
I reduce 148 bytes from start_stop_daemon.c code. Also reduced
    memory allocated.
2001-10-31 09:55:39 +00:00
Eric Andersen
813d88cf78 As Aaron Lehmann just pointed out, I forgot a line... 2001-10-28 22:49:48 +00:00
Eric Andersen
72f9a4277f Add in some (theoretical) uClinux support. Some init cleanups 2001-10-28 05:12:20 +00:00
Eric Andersen
1a10eec178 Fixup the location of pwd.h and grp.h 2001-10-24 17:19:38 +00:00
Eric Andersen
bdfd0d78bc Major rework of the directory structure and the entire build system.
-Erik
2001-10-24 05:00:29 +00:00
Eric Andersen
c2af1ee036 Commit the start-stop-daemon applet. This was contributed by David
Kimdon <dwhedon@gordian.com> on october 7th -- the day I was fired from
Lineo.  So it seems I totally forgot about this patch until now.
Sorry about that David!
2001-10-18 19:33:06 +00:00
Eric Andersen
74400ccfd0 Scrub up some function prototypes.
-Erik
2001-10-18 04:11:39 +00:00
Eric Andersen
11fdb8a4c7 Fix a nasty bug with variable name shadowing 2001-10-18 04:04:34 +00:00
Eric Andersen
371ca19f53 Look for either "init" or "linuxrc" processes 2001-10-03 21:26:12 +00:00
Eric Andersen
1644db9a2b Two patches from Magick <magick@linux-fan.com>:
1st makes init smaller, and fixes a bug with AskFirst. Reading from
    /dev/null gives EOF.
    2nd makes init run the command's in the order of inittab, as in
    FIFO instead of LIFO.
2001-09-05 20:18:15 +00:00
Matt Kraai
439e3df653 Add support for devfs device names. 2001-07-23 14:52:08 +00:00
Eric Andersen
8d79ce8320 Some patches to make dietlibc work... 2001-07-22 23:00:15 +00:00
Eric Andersen
332394b577 Be extra extra careful about what we dereference. 2001-07-05 16:09:32 +00:00
Matt Kraai
7bd773c9fe Only use a login shell when it will run on a console. 2001-06-12 20:55:02 +00:00
Matt Kraai
67a4640333 Loop forever instead of exiting. 2001-06-03 05:55:52 +00:00
Eric Andersen
77d9268892 Patch from larry to fix some grammar errors. 2001-05-23 20:32:09 +00:00
Matt Kraai
1844770fec Changed snprintf copies to use strncpy at the suggestion of Aaron Lehmann. 2001-05-18 21:24:58 +00:00
Eric Andersen
04095e58fb Move messages.c to libbb. Make each string in messages.c be its own .o file.
This way, we can new get rid of all that tedious #define rubbish we used to
need to enable specific messages.  This way is enormously simpler, and as a
bonus also ends up saving us 96 bytes.
 -Erik
2001-04-25 05:39:18 +00:00
Eric Andersen
d8862928c2 A patch from Marc Karasek and Kanoj (kernel serial.c maintainer)
so init will work on serial consoles with 2.4.3+ kernels, thanks
to Fabrice Gautier <gautier@email.enst.fr> for finding this one.
 -Erik
2001-04-23 15:14:11 +00:00
Matt Kraai
8fc364ebd5 Fix comment. 2001-04-12 20:12:16 +00:00
Eric Andersen
2f2da90fd4 "I will always compile before I commit" x 100 2001-04-09 23:54:15 +00:00
Eric Andersen
b6b519b416 Update how we detect if libc5 is in use.
-Erik
2001-04-09 23:52:18 +00:00
Eric Andersen
e76c3b08e1 A number of cleanups. Now compiles with libc5, glibc, and uClibc. Fix a few
shadowed variables.  Move (almost) all syscalls to libbb/syscalls.c, so I can
handle them sanely and all at once.
 -Erik
2001-04-05 03:14:39 +00:00
Eric Andersen
c97ec34370 A patch from Matt Kraai that adds a new 'shutdown' action to busybox init. Now
you can specify an arbitrary behavior for 'ctrlaltdel' without that behavior
needing to be a reboot.
2001-04-03 18:01:51 +00:00
Eric Andersen
1ca20a7747 A nice patch from Larry Doolittle that adds -Wshadow and
cleans up most of the now-revealed problems.
2001-03-21 07:34:27 +00:00
Eric Andersen
7ef1a5beb2 Fix up command line munging in init. Postpone the askfirst thing till
a bit later in run().
2001-03-20 17:39:08 +00:00
Eric Andersen
7f1978570f A patch from Andreas Neuhaus to be especially careful to not dup
any env variables when spawning child processes.
2001-03-16 01:14:04 +00:00
Eric Andersen
a4edd0e946 A better fix. Read nextPtr before mem gets freed.
-Erik
2001-03-15 21:04:18 +00:00
Eric Andersen
0d4e51d390 Prevent init from potentially using already freed memory when
deleting an initAction, fixing a bug pointed out by Andreas Neuhaus
 -Erik
2001-03-15 19:18:21 +00:00
Eric Andersen
53f5061c7e Fix init so that checking for terminal devices is delayed until the
devices are actually used, thereby allowing devfsd based systems to
work.  This should fix bug #1133
 -Erik
2001-03-14 09:01:11 +00:00
Eric Andersen
3e6ff9017f A cleanup patch from Jeff Garzik to static-ify a number of
namespace polluting things that really should be static.
2001-03-09 21:24:12 +00:00
Eric Andersen
452fd33ffa Patch from Vladimir to make sure PATH is set correctly. 2001-03-04 06:47:33 +00:00
Eric Andersen
41492d6c23 I should be more careful... 2001-02-23 00:05:56 +00:00