Unfortunately, there is no portable format specifier for PID's. Furthermore, it is not safe to assume pid_t <= 32 bit in size, see e.g http://unix.derkeiler.com/Mailing-Lists/AIX-L/2010-08/msg00008.html. Right now, it is ok to assume pid_t <= 32 bit in size, but this may change in the future. Also, this patch fixes warning due to lack of an appropriate cast from http://fate.ffmpeg.org/report.cgi?time=20150820233505&slot=x86-opensolaris-gcc4.3. Note that this method of handling pid_t is in line with what nginx does.
Unified · Split
| @@ -1936,7 +1936,7 @@ static void compute_status(HTTPContext *c) · 1935 unmodified lines | ||
| 1936 | 1936 | |
| 1937 | 1937 | avio_printf(pb, "<h2>Feed %s</h2>", stream->filename); |
| 1938 | 1938 | if (stream->pid) { |
| 1939 | − avio_printf(pb, "Running as pid %d.\n", stream->pid); | |
| 1939 | + avio_printf(pb, "Running as pid %"PRId64".\n", (int64_t) stream->pid); | |
| 1940 | 1940 | |
| 1941 | 1941 | #if defined(linux) |
| 1942 | 1942 | { |
| @@ -1945,8 +1945,8 @@ static void compute_status(HTTPContext *c) · 2 unmodified lines | ||
| 1945 | 1945 | |
| 1946 | 1946 | /* This is somewhat linux specific I guess */ |
| 1947 | 1947 | snprintf(ps_cmd, sizeof(ps_cmd), |
| 1948 | − "ps -o \"%%cpu,cputime\" --no-headers %d", | |
| 1949 | − stream->pid); | |
| 1948 | + "ps -o \"%%cpu,cputime\" --no-headers %"PRId64"", | |
| 1949 | + (int64_t) stream->pid); | |
| 1950 | 1950 | |
| 1951 | 1951 | pid_stat = popen(ps_cmd, "r"); |
| 1952 | 1952 | if (pid_stat) { |
| @@ -3778,8 +3778,8 @@ static void handle_child_exit(int sig) · 1825 unmodified lines | ||
| 3778 | 3778 | uptime = time(0) - feed->pid_start; |
| 3779 | 3779 | feed->pid = 0; |
| 3780 | 3780 | fprintf(stderr, |
| 3781 | − "%s: Pid %d exited with status %d after %d seconds\n", | |
| 3782 | − feed->filename, pid, status, uptime); | |
| 3781 | + "%s: Pid %"PRId64" exited with status %d after %d seconds\n", | |
| 3782 | + feed->filename, (int64_t) pid, status, uptime); | |
| 3783 | 3783 | |
| 3784 | 3784 | if (uptime < 30) |
| 3785 | 3785 | /* Turn off any more restarts */ |