diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-06-02 18:29:41 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska@appnovation.com> | 2025-06-02 18:29:41 +0000 |
| commit | 1f94bad45a8a161410c4564ebe5bbb892556d1bd (patch) | |
| tree | 87ac42a398ea4536344e6ebe0a506f79d9b3564d /src/libstddjb | |
| parent | df513f668cbd03f369bfaffa6743b5f21dbfe355 (diff) | |
| download | skalibs-1f94bad45a8a161410c4564ebe5bbb892556d1bd.tar.gz | |
Add prog.h and prog_pid_fill
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb')
| -rw-r--r-- | src/libstddjb/prog_pid_fill.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstddjb/prog_pid_fill.c b/src/libstddjb/prog_pid_fill.c new file mode 100644 index 0000000..1214b04 --- /dev/null +++ b/src/libstddjb/prog_pid_fill.c @@ -0,0 +1,15 @@ +/* ISC license. */ + +#include <string.h> +#include <unistd.h> + +#include <skalibs/types.h> +#include <skalibs/prog.h> + +void prog_pid_fill (char *s, char const *name, size_t len) +{ + memcpy(s, name, len) ; s += len ; + memcpy(s, ": pid ", 6) ; s += 6 ; + s += pid_fmt(s, pid_fmt(s, getpid())) ; + *s++ = 0 ; +} |
