New answers tagged

10

Ksh93 does a lot to avoid forks. I have no idea how it knows how to handle the first case, as a truss shows that it only calls one write(2) call with the final result. It may be that David scans the command in macro.c and knows that he may handle "echo" internally. What I can say is that I rewrote the parser and the interpreter of the "Bourne Shell" last ...


0

There are two philosophies of process creation: fork with inheritance, and create with arguments. Unix uses fork, obviously. (OSE, for example, and VMS use the create method.) Unix has MANY inheritable characteristics, and more get added periodically. Via inheritance, these new characteristics can be added WITHOUT CHANGING EXISTING PROGRAMS! Using a ...


1

This will do what you are expecting for: #!/bin/bash function_ping(){ if ping -c 1 -w 5 $1 &>/dev/null; then echo "UP: $1" else echo "DOWN $1" fi } for ip in {1..254}; do function_ping 192.168.1.$ip & done wait Save it as parallelping, and execute it. It helps you? It can be converted into a big ...


3

The glibc's daemon() function only does a single fork as can be seen in its source code. What you were looking at initially is in the kernel's source code and not referenced from the outside directly. The use of a double-fork depends on the implementation used to actually call the daemon program and is not needed on most designs since the daemons are not ...


1

We appear to be referencing the daemon(3) library call, source code for which may be at #1 https://github.com/lattera/glibc/blob/master/misc/daemon.c or at #2 https://github.com/bmc/daemonize/blob/master/daemon.c. Both versions are documented in this single man page. The source code for #1 shows a single fork(2). The source code for #2 shows a double fork(2)...



Top 50 recent answers are included