Codebergdnkl
foot
master
1#include "xsnprintf.h"
3#include <errno.h>
4#include <limits.h>
5#include <stdio.h>
6#include "debug.h"
7#include "macros.h"
9/*
10 * ISO C doesn't require vsnprintf(3) to set errno on failure, but
11 * POSIX does:
12 *
13 * "If an output error was encountered, these functions shall return
14 * a negative value and set errno to indicate the error."
15 *
16 * The mandated errors of interest are:
17 *
18 * - EILSEQ: A wide-character code does not correspond to a valid character
19 * - EOVERFLOW: The value of n is greater than INT_MAX
20 * - EOVERFLOW: The value to be returned is greater than INT_MAX
21 *
22 * ISO C11 states:
23 *
24 * "The vsnprintf function returns the number of characters that would
25 * have been written had n been sufficiently large, not counting the
26 * terminating null character, or a negative value if an encoding error
27 * occurred. Thus, the null-terminated output has been completely
28 * written if and only if the returned value is nonnegative and less
29 * than n."
30 *
31 * See also:
32 *
33 * - ISO C11 §7.21.6.12p3
34 * - https://pubs.opengroup.org/onlinepubs/9699919799/functions/vsnprintf.html
35 * - https://pubs.opengroup.org/onlinepubs/9699919799/functions/snprintf.html
36 */
37static size_t
38xvsnprintf(char *restrict buf, size_t n, const char *restrict format, va_list ap)
39{
40 int len = vsnprintf(buf, n, format, ap);
41 FATAL_ERROR_ON(len < 0, errno);
42 FATAL_ERROR_ON(len >= (int)n, ENOBUFS);
43 return (size_t)len;
44}
46size_t
47xsnprintf(char *restrict buf, size_t n, const char *restrict format, ...)
48{
49 va_list ap;
50 va_start(ap, format);
51 size_t len = xvsnprintf(buf, n, format, ap);
52 va_end(ap);
53 return len;
54}
Diagnostics5 git calls · 36 ms
CallStatusSizeTime036 ms
discover200178 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=178 git.server.agent=git/2.56.1-Linux git.server.object_format=sha1 git.server.caps=agent ls-refs fetch server-option object-format git.server.fetch=shallow wait-for-done filter git.protocol.version=2 git.pkt.frames=9 git.pkt.data=7 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=178 git.pkt.payload.max=35
ls-refs20010 KiB · hit2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=10322 git.response.cache=HIT git.response.duration_ms=2 git.protocol.version=2 git.pkt.frames=108 git.pkt.data=107 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=10322 git.pkt.payload.max=106 git.ls_refs.count=107 git.ls_refs.head=refs/heads/master
fetchcombine:blob:none+tree:2 · deepen 12008.6 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=8830 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=combine:blob:none+tree:2 git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0 git.fetch.haves.count=0 git.fetch.deepen=1 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=8830 git.pkt.payload.max=8730 git.sideband.band1.bytes=8730 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=14 git.pack.bytes=8730 git.fetch.wide.objects=14 git.fetch.wide.extra_bytes=9909 git.fetch.wide.blobs=0
fetchtree:0 · deepen 102009.3 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=31 git.response.bytes=9489 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=tree:0 git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0 git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=9489 git.pkt.payload.max=9389 git.sideband.band1.bytes=9389 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=10 git.pack.bytes=9389 git.pack.ofs_delta=0 git.pack.ref_delta=0 git.pack.chain.max=0 git.pack.trailer=de930681b6073ba5b599a0f956bfbd114762ad5a git.pack.full=10Open pack map
fetch200808 B · hit31 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=808 git.response.cache=HIT git.response.duration_ms=31 git.fetch.wants=495f45398c4b671fc07798eed017afc1b0cb819e git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=808 git.pkt.payload.max=781 git.sideband.band1.bytes=781 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://codeberg.org/dnkl/foot
- Ref
- refs/heads/master
- Commit
- c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
- cf-ray
- a5e22c501ba32a83
- Request
- 7ba8d20b…
- Protocol
- v2 · sha1
- Agent
- git/2.56.1-Linux
- Filter
- advertised
- Fetch
- shallow wait-for-done filter
- Capabilities
- agent ls-refs fetch server-option object-format