Skip to content

Commit c4482ba

Browse files
committed
some small changes, such as moving the checking of '1 pid' from os/.../proc.c to reboot.c
1 parent c9543e3 commit c4482ba

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

etcfiles/generic/sysinit.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
# Warning: The script is only support Linux system now!
77

88
# the 'mountfs.sh' is used by no_initramfs defaultly.
9-
if [ -x '/etc/ueld/mountfs.sh' ]; then
10-
. /etc/ueld/mountfs.sh
11-
fi
9+
[ -x '/etc/ueld/mountfs.sh' ] && . /etc/ueld/mountfs.sh
1210

1311
# start udevd daemon process and create device files in /dev.
1412
echo "[sysinit.sh] starting udev..."

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ int ueld_main(int argc, char* argv[])
130130
ueld_closeconfig();
131131

132132
while (1) {
133-
if((pid = wait(&status)) > 0) {
133+
if ((pid = wait(&status)) > 0) {
134134
if (!(WIFEXITED(status)) && !(WIFSIGNALED(status)))
135135
continue;
136136
#ifndef CONFIG_RESPAWN_NO_IGN_FAIL_PROC

os/linux/proc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int ueld_os_next_process(pid_t* pid)
2828
return 0;
2929

3030
pid_t p = atol(dent->d_name);
31-
if (p != 0 && p != 1){
31+
if (p != 0) {
3232
*pid = p;
3333
} else {
3434
goto reread;

reboot.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ static void killproc(int signo)
3434
if (ueld_os_for_each_process() < 0)
3535
return;
3636

37-
while (ueld_os_next_process(&pid))
38-
kill(pid, signo);
37+
while (ueld_os_next_process(&pid)) {
38+
if (pid != 1)
39+
kill(pid, signo);
40+
}
3941

4042
ueld_os_end_each_process();
4143
}

respawn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ void respawn_init()
5353
respawn = mmap(NULL, length, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
5454

5555
if (!respawn) {
56-
close(fd);
57-
return;
56+
close(fd);
57+
return;
5858
}
5959

6060
respawn[length - 1] = 0;

usertool/ueldctl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ for _tag in `seq $#` ; do
4747
esac
4848
done
4949

50-
if [ "$SIGNAL" = '' ]; then
51-
exit 0
52-
fi
50+
[ "$SIGNAL" = '' ] && exit 0
5351

5452
if ! kill $SIGNAL 1 ; then
5553
echo "Failed to call init. Do you use the ueld?" >&2
54+
exit 1
5655
fi
5756

0 commit comments

Comments
 (0)