[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH v2 01/10] errptr.h: include errno.h



Hey Costin,

On 24.08.2018 10:04, Costin Lupu wrote:
Hi Simon,

On 08/23/2018 02:37 PM, Simon Kuenzer wrote:
Hey Costin,

On 23.08.2018 12:59, Costin Lupu wrote:
Given that definitions from errptr.h are using together
with errno numbers, it would make sense to simply include
errno.h in errptr.h.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
   include/uk/errptr.h | 1 +
   1 file changed, 1 insertion(+)

diff --git a/include/uk/errptr.h b/include/uk/errptr.h
index 5806f73..27aa7d8 100644
--- a/include/uk/errptr.h
+++ b/include/uk/errptr.h
@@ -36,6 +36,7 @@
   #ifndef __UK_ERRPTR_H__
   #define __UK_ERRPTR_H__
   +#include <errno.h>
   #include <uk/arch/types.h>
     #ifndef MAXERRNO


hum, errptr is just a mechanism to return error codes on functions that
only return pointers as data type. This header does itself not depend on
errno, nothing is used from errno. The idea was that you can use this
mechanism even with your own defined error codes. So, I would keep the
inclusion of errno.h separate. Just include errno.h on your libraries
API when these error codes are used there.

Maybe it would have been better to say in the commit message that
errptr.h is *usually* used together with errno.h. But I still believe it
makes sense to include errno.h here, Linux does it too. Otherwise, in
90% of cases we would have two includes instead of one.

This is what I prefer. Another reason is that the headers in the /include folder should not have any dependency to libraries because libraries could be potentially switched off. If there is no errno.h - I know this is an extreme example - but this would break the errptr.h header. An alternative would be to move errptr into an own library where we are able to specify dependencies. So, there we could depend errptr.h to a libc and including errno.h would make sense. But I think this would be too much for this particular case and we rather go for the two includes for the 90% of the cases.


Costin


Cheers,

Simon

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.