commit: 11fa035be93b141acf9aff6fe28f0fe1bbc938dd
parent a1fe3661c4ad2c0bd416c3ef9197bec5f68c45de
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 28 Sep 2024 13:09:57 +0200
test-cmd/getpriority: new
Diffstat:
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -25,7 +25,7 @@ all: $(EXE) $(MAN1SO)
selfcheck: selfcheck-cmds selfcheck-libs
.PHONY: selfcheck-cmds
-TEST_CMDS = test-cmd/pathchk-getlimits
+TEST_CMDS = test-cmd/pathchk-getlimits test-cmd/getpriority
selfcheck-cmds: $(EXE) $(TEST_CMDS)
LDSTATIC="$(LDSTATIC)" ./check-cmds.sh
@@ -204,3 +204,6 @@ cmd/sha512sum: cmd/sha512sum.c lib/sha512.c lib/sha512.h lib/bytes2hex.c lib/str
test-cmd/pathchk-getlimits: test-cmd/pathchk-getlimits.c Makefile
$(CC) -std=c99 $(CFLAGS) -o $@ test-cmd/pathchk-getlimits.c $(LDFLAGS) $(LDSTATIC)
+
+test-cmd/getpriority: test-cmd/getpriority.c Makefile
+ $(CC) -std=c99 $(CFLAGS) -o $@ test-cmd/getpriority.c $(LDFLAGS) $(LDSTATIC)
diff --git a/test-cmd/getpriority.c b/test-cmd/getpriority.c
@@ -0,0 +1,17 @@
+// utils-std: Collection of commonly available Unix tools
+// SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
+// SPDX-License-Identifier: MPL-2.0
+
+#define _POSIX_C_SOURCE 202405L
+#include <stdio.h>
+#include <sys/resource.h>
+
+int main(void)
+{
+ int ret = getpriority(PRIO_PROCESS, 0);
+ if(ret == -1) perror("getpriority: error");
+
+ printf("getpriority: %d\n", ret);
+
+ return 0;
+}