#include <unistd.h>
#include <string.h>
-extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
- void *newp, size_t newlen);
+#include "sysctl_internal.h"
+
int
-sysctl(name, namelen, oldp, oldlenp, newp, newlen)
- int *name;
- u_int namelen;
- void *oldp, *newp;
- size_t *oldlenp, newlen;
+sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
+__attribute__((disable_tail_calls))
{
if (name[0] != CTL_USER) {
if (namelen == 2 && name[0] == CTL_KERN && name[1] == KERN_EXEC) {
*oldlenp = 2;
return 0;
}
- return (__sysctl(name, namelen, oldp, oldlenp, newp, newlen));
+
+
+ int error = __sysctl(name, namelen, oldp, oldlenp, newp, newlen);
+ if (error < 0) {
+ return error;
+ }
+
+
+ return error;
}
if (newp != NULL) {