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

[Minios-devel] [UNIKRAFT PATCH 2/6] lib/nolibc: add sys/param.h header


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Fri, 3 Aug 2018 13:58:33 +0300
  • Cc: florian.schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx
  • Delivery-date: Fri, 03 Aug 2018 10:58:54 +0000
  • Ironport-phdr: 9a23:EssLRx+uFkqU4/9uRHKM819IXTAuvvDOBiVQ1KB20O4cTK2v8tzYMVDF4r011RmVBduds6oMotGVmpioYXYH75eFvSJKW713fDhBt/8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1Ifn+FpLPg8it2O2+55zebx9UiDahfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTFUACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMMvrRr42RDui9b9mRh/2hikaOTA382bZhc5+jK9AvB6tuwZyz5LObY2JKPZzeL7Wc9MARWpGW8ZcTzJMAoSnb4sTDuoBO/tToY/gp1sWsBu1GA6hC//oyj9Tmn/23Ks63/4lEQHbxAwgAskDv2jPrNnvLKcSTPu6wLPSzTXEdv5b3yr25ovQch05vP2BUq98fdDSxEQvDQ/JkEucpI7/Mz6bzugBrmeW4/d6We+si2MrsR99rzahy8s2l4XEiZwZx1bZ/itj2ok1P8e3SEtjbN6hF5tfqj+VOpNtQsMnX2FooCE6yqAauZKjfCgF1pAnxxnHZvyZdoiH+BPjVOKLLThkn3JpYqq/hwup/kS60O38UdG40FdMriVbjtnBrm0B2hPO5sSdSfZw/l2t1SiR2w3R8O1JL1g4la/BJJ4gxr4wmIATsUPGHiLuhEr2i7SWdlkl+uiu8ejnZqjmpoeBN4Jvlg7+Kb4imtSiAesjKAQORW+b9fym1LL/5U35XKlKjvoun6ncsZDaI8UbpqmiAwNMz4ks9Qi/ACmi0NkDmXkHLUlFeA6cj4TzNFDBPvb4Ae24g1S2nzdh3+rGMaH5ApXRMnjDl6/sfbh5605b0gozzMpQ55ROBrEaPP3zWkrxtN3FAR8lKAG0xfjoB8l51owEQm2DGLGWML7Ku1+S+u0vO/WMZJMSuDvlMPgl5vvujXg/mVMHfqmpwIUYaHa5H/t4OUWUenzsjckdHmcOpAUxV/bmh0OfUTRLfXa9Q7o85i0nCIKhFYrCRp2tgKaA3CuhAJ1WYWRGBUyMEXfrcIWERewBaCSMLcB9ljwLT6OuR5U/2hGz50fGzO9iL+zV/TZduZ/92dxd4+zIiQp05TFyScOH3DKjVWZxy0gPXCM32uhbvFRgggOI1rNkgvoeEcFL+ttCSUEiKJSa1essWIO6YR7IYtrcEAXued6hGzxkFt8=
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

In order to use 'howmany' macro from other files which do not need
select, we introduce sys/param.h header where 'howmany' is usually
defined.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 lib/nolibc/include/sys/param.h  | 52 +++++++++++++++++++++++++++++++++++++++++
 lib/nolibc/include/sys/select.h |  7 ++----
 2 files changed, 54 insertions(+), 5 deletions(-)
 create mode 100644 lib/nolibc/include/sys/param.h

diff --git a/lib/nolibc/include/sys/param.h b/lib/nolibc/include/sys/param.h
new file mode 100644
index 0000000..6387569
--- /dev/null
+++ b/lib/nolibc/include/sys/param.h
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Costin Lupu <costin.lupu@xxxxxxxxx>
+ *
+ *
+ * Copyright (c) 2018, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+
+#ifndef __SYS_PARAM_H__
+#define __SYS_PARAM_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef howmany
+#define howmany(x, y)   (((x)+((y)-1))/(y))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SYS_PARAM_H__ */
diff --git a/lib/nolibc/include/sys/select.h b/lib/nolibc/include/sys/select.h
index b5c389b..d21f073 100644
--- a/lib/nolibc/include/sys/select.h
+++ b/lib/nolibc/include/sys/select.h
@@ -32,6 +32,7 @@
 #ifndef __SYS_SELECT_H__
 #define __SYS_SELECT_H__
 
+#include <sys/param.h>
 #include <sys/time.h>
 
 #ifdef __cplusplus
@@ -52,12 +53,8 @@ typedef unsigned long __fd_mask;
 
 #define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */
 
-#ifndef _howmany
-#define _howmany(x, y) (((x) + ((y) - 1)) / (y))
-#endif
-
 typedef struct fd_set {
-       __fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];
+       __fd_mask __fds_bits[howmany(FD_SETSIZE, _NFDBITS)];
 } fd_set;
 
 #ifdef __cplusplus
-- 
2.11.0


_______________________________________________
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®.