]> Kevux Git Server - fll/commitdiff
Feature: Add F_again and F_again_not status codes.
authorKevin Day <kevin@kevux.org>
Wed, 21 Jun 2023 01:51:05 +0000 (20:51 -0500)
committerKevin Day <kevin@kevux.org>
Wed, 21 Jun 2023 01:51:05 +0000 (20:51 -0500)
The fcntl() function uses two forms of privilege failures.
The EPERM is already translated to F_prohibited.
Therefore, add F_again (and F_again_not) so that EAGAIN can be used for that.

level_0/f_status/c/status.h
level_0/f_status_string/c/status_string.c
level_0/f_status_string/c/status_string.h
level_0/f_status_string/tests/unit/c/test-status_string-to.c
level_1/fl_status_string/c/status_string.c
level_1/fl_status_string/tests/unit/c/test-status_string-from.c

index 6b69422e2f526d83a3dc4e8dee5b331706c7c758..7fa7b55c2d8d4acba9ae5a8bd9f16f3a9d433dac 100644 (file)
@@ -211,6 +211,8 @@ extern "C" {
       F_absolute_not,
       F_address,
       F_address_not,
+      F_again,
+      F_again_not,
       F_ascii,
       F_ascii_not,
       F_atomic,
index 07d197b2dcacd6204a37ffaf7e0b976ed230b07a..370f1fa38cf10ad83a91ef4126228fe5d8b2165d 100644 (file)
@@ -85,6 +85,8 @@ extern "C" {
     const f_string_static_t f_status_absolute_not_s = macro_f_string_static_t_initialize_1(F_status_absolute_not_s, 0, F_status_absolute_not_s_length);
     const f_string_static_t f_status_address_s = macro_f_string_static_t_initialize_1(F_status_address_s, 0, F_status_address_s_length);
     const f_string_static_t f_status_address_not_s = macro_f_string_static_t_initialize_1(F_status_address_not_s, 0, F_status_address_not_s_length);
+    const f_string_static_t f_status_again_s = macro_f_string_static_t_initialize_1(F_status_again_s, 0, F_status_again_s_length);
+    const f_string_static_t f_status_again_not_s = macro_f_string_static_t_initialize_1(F_status_again_not_s, 0, F_status_again_not_s_length);
     const f_string_static_t f_status_ascii_s = macro_f_string_static_t_initialize_1(F_status_ascii_s, 0, F_status_ascii_s_length);
     const f_string_static_t f_status_ascii_not_s = macro_f_string_static_t_initialize_1(F_status_ascii_not_s, 0, F_status_ascii_not_s_length);
     const f_string_static_t f_status_atomic_s = macro_f_string_static_t_initialize_1(F_status_atomic_s, 0, F_status_atomic_s_length);
@@ -1050,6 +1052,16 @@ extern "C" {
 
           break;
 
+        case F_again:
+          *name = f_status_again_s;
+
+          break;
+
+        case F_again_not:
+          *name = f_status_again_not_s;
+
+          break;
+
         case F_ascii:
           *name = f_status_ascii_s;
 
index e6053c50174e7d288d77fc343f56ceeed4d0199d..47a71dea0110671dd5c5648c7f365047f6d192d4 100644 (file)
@@ -238,6 +238,8 @@ extern "C" {
     #define F_status_absolute_not_s      "F_absolute_not"
     #define F_status_address_s           "F_address"
     #define F_status_address_not_s       "F_address_not"
+    #define F_status_again_s             "F_again"
+    #define F_status_again_not_s         "F_again_not"
     #define F_status_ascii_s             "F_ascii"
     #define F_status_ascii_not_s         "F_ascii_not"
     #define F_status_atomic_s            "F_atomic"
@@ -548,6 +550,8 @@ extern "C" {
     #define F_status_absolute_not_s_length      14
     #define F_status_address_s_length           9
     #define F_status_address_not_s_length       13
+    #define F_status_again_s_length             7
+    #define F_status_again_not_s_length         11
     #define F_status_ascii_s_length             7
     #define F_status_ascii_not_s_length         11
     #define F_status_atomic_s_length            8
@@ -858,6 +862,8 @@ extern "C" {
     extern const f_string_static_t f_status_absolute_not_s;
     extern const f_string_static_t f_status_address_s;
     extern const f_string_static_t f_status_address_not_s;
+    extern const f_string_static_t f_status_again_s;
+    extern const f_string_static_t f_status_again_not_s;
     extern const f_string_static_t f_status_ascii_s;
     extern const f_string_static_t f_status_ascii_not_s;
     extern const f_string_static_t f_status_atomic_s;
index 0b2eec0455f08d5e46eca82edaaa673425ece036..4b89db70e6cc9ab4e823558f46c35b374611a48f 100644 (file)
@@ -103,6 +103,8 @@ void test__f_status_string_to__works(void **state) {
     F_absolute_not,
     F_address,
     F_address_not,
+    F_again,
+    F_again_not,
     F_ascii,
     F_ascii_not,
     F_atomic,
@@ -717,6 +719,8 @@ void test__f_status_string_to__works(void **state) {
     f_status_absolute_not_s,
     f_status_address_s,
     f_status_address_not_s,
+    f_status_again_s,
+    f_status_again_not_s,
     f_status_ascii_s,
     f_status_ascii_not_s,
     f_status_atomic_s,
@@ -1257,7 +1261,7 @@ void test__f_status_string_to__works(void **state) {
     f_status_status_code_last_s,
   };
 
-  for (uint16_t i = 0; i < 611; ++i) {
+  for (uint16_t i = 0; i < 613; ++i) {
 
     f_string_static_t result = f_string_static_t_initialize;
 
index 1ea454466d8cfd141108c0a8051d1012e0606d12..95900c9c8b9285e3191bebd757fe39937ead646a 100644 (file)
@@ -461,6 +461,18 @@ extern "C" {
         return F_none;
       }
 
+      if (f_compare_dynamic(name, f_status_again_s) == F_equal_to) {
+        *code = F_again;
+
+        return F_none;
+      }
+
+      if (f_compare_dynamic(name, f_status_again_not_s) == F_equal_to) {
+        *code = F_again_not;
+
+        return F_none;
+      }
+
       if (f_compare_dynamic(name, f_status_ascii_s) == F_equal_to) {
         *code = F_ascii;
 
index 588ff7f342a567d1ddd5dfd75ebc184de23a0dc5..f201747a0ecf39947bed0b6f292385c9acc93502 100644 (file)
@@ -119,6 +119,8 @@ void test__fl_status_string_from__works(void **state) {
     F_absolute_not,
     F_address,
     F_address_not,
+    F_again,
+    F_again_not,
     F_ascii,
     F_ascii_not,
     F_atomic,
@@ -733,6 +735,8 @@ void test__fl_status_string_from__works(void **state) {
     f_status_absolute_not_s,
     f_status_address_s,
     f_status_address_not_s,
+    f_status_again_s,
+    f_status_again_not_s,
     f_status_ascii_s,
     f_status_ascii_not_s,
     f_status_atomic_s,
@@ -1273,7 +1277,7 @@ void test__fl_status_string_from__works(void **state) {
     f_status_status_code_last_s,
   };
 
-  for (uint16_t i = 0; i < 611; ++i) {
+  for (uint16_t i = 0; i < 613; ++i) {
 
     f_status_t result = F_none;