3 ms·
> e.g. Systemd will own port 80, and feed it back to Apache who listens over 8080. No, Apache actually listens to port 80, just on a socket created by systemd.
by JoshTriplett 12y ago
> e.g. Systemd will own port 80, and feed it back to Apache who listens over 8080.
No, Apache actually listens to port 80, just on a socket created by systemd. systemd opens the TCP listening socket, spawns Apache (potentially on demand when connected to), and passes along the file descriptor for the socket. Apache then treats that file descriptor as though it had opened it itself. Similar to inetd, except that it isn't limited to stdio.
That said, since netstat -p shows who opened the socket rather than who is using the socket, socket activation does make it less useful. Given that netstat -p already reads all the necessary information from /proc, it'd be nice to teach netstat to show multiple programs listening on a socket, not just the opener.