--- ./ext/posix/posix.c.orig	2026-06-25 03:28:15.235371288 -0500
+++ ./ext/posix/posix.c	2026-06-25 03:32:57.967264501 -0500
@@ -1220,6 +1220,18 @@
 		RETURN_THROWS();
 	}
 
+	#if defined(_AIX)
+        /*
+        On AIX, when cur > max setrlimit returns 0 and sets softlimit and hardlimit to max,
+        instead of returning -1, so we need to check the values to reproduce the same behavior
+        as setrlimit on Linux.
+        */
+        if (cur > max) {
+              POSIX_G(last_error) = EINVAL;
+              RETURN_FALSE;
+        }
+        #endif
+
 	rl.rlim_cur = cur;
 	rl.rlim_max = max;
 
