proc_alloc: make new process inherit parent's user
[akaros.git] / kern / include / err.h
index b2c5fd0..6b10c40 100644 (file)
@@ -1,28 +1,28 @@
 /* Plan9 style error popping.  For details, read Documentation/plan9.txt */
 
-#ifndef ROS_KERN_ERR_H
-#define ROS_KERN_ERR_H
+#pragma once
 
 #include <setjmp.h>
 #include <kthread.h>
+#include <error.h>
 
 #define ERRSTACK(x) struct errbuf *prev_errbuf; struct errbuf errstack[(x)];   \
                     int curindex = 0;
-#define waserror() (errpush(errstack, ARRAY_SIZE(errstack), &curindex,         \
-                            &prev_errbuf) ||                                   \
-                    setjmp(&(get_cur_errbuf()->jmpbuf)))
-#define error(e, x,...) do {set_errstr(x, ##__VA_ARGS__);                              \
-                                                       set_errno(e);                                                           \
-                                                       longjmp(&get_cur_errbuf()->jmpbuf, 1);} while(0)
-#define nexterror() do {errpop(errstack, ARRAY_SIZE(errstack), &curindex,      \
-                            prev_errbuf);                                      \
-                     longjmp(&(get_cur_errbuf())->jmpbuf, 1);} while (0)
-#define poperror() do {errpop(errstack, ARRAY_SIZE(errstack), &curindex,       \
-                       prev_errbuf);} while (0)
+#define waserror() setjmp(&(errpush(errstack, ARRAY_SIZE(errstack), &curindex, \
+                                                                       &prev_errbuf)->jmpbuf))
+#define error(e, x, ...)                                                                                               \
+       do {                                                                                                                            \
+               set_error(e, x, ##__VA_ARGS__);                                                                 \
+               longjmp(&get_cur_errbuf()->jmpbuf, 1);                                                  \
+       } while(0)
+#define nexterror() longjmp(&(errpop(errstack, ARRAY_SIZE(errstack), &curindex, \
+                                                                        prev_errbuf)->jmpbuf), 1)
+#define poperror() errpop(errstack, ARRAY_SIZE(errstack), &curindex,   \
+                                                 prev_errbuf)
+/* Give Akaros people a hint that we need a real error message. */
+#define ERROR_FIXME "This space in %s@%d needs filling in.", __FILE__, __LINE__
 
-int errpush(struct errbuf *errstack, int stacksize, int *curindex,
-            struct errbuf **prev_errbuf);
-void errpop(struct errbuf *errstack, int stacksize, int *curindex,
-            struct errbuf *prev_errbuf);
-
-#endif /* ROS_KERN_ERR_H */
+struct errbuf *errpush(struct errbuf *errstack, int stacksize, int *curindex,
+                                               struct errbuf **prev_errbuf);
+struct errbuf *errpop(struct errbuf *errstack, int stacksize, int *curindex,
+                                         struct errbuf *prev_errbuf);