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

[Minios-devel] [UNIKRAFT/PTHREAD-EMBEDDED PATCH 2/2] Implement pthread_condattr_{getclock, setclock}


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Vlad-Andrei BĂDOIU <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Tue, 31 Mar 2020 18:07:19 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stud.acs.upb.ro; dmarc=pass action=none header.from=stud.acs.upb.ro; dkim=pass header.d=stud.acs.upb.ro; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dM9RplDDl6y212ZzpAjj88jtrGls2m70N5xDq6ISxRU=; b=Ot/aWGTTF2cU8FyvQJA/fv92PeqKgkKuoJ6wgE4G912xnD5RihvZtHBhRdPixTe5z8iAiYuQCh7rhfN1WVkVJoj6/mkEjObypDq26IoTnNDnguNbw7U5OOUWQd9yKLupaO573MkPxipyQaJIPAw+4GuHfE/fFD5oo36Wi80SJOKFYLODbW4t5931ycwc/X0XCY40+xXnkSQYuDvUwRRtdND1gK/Ni8R4cqvb2iWqD4rGaOtpKMobR5dkDqQrlxAy1gw/uES+0aHk7ETdgfeblEMFXupjTasjyCkwDhgGy9Mi6pRd99JnyCMCfqSKp2dL1PEen41XlDz1EHDIdmuzJg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XIX38nHdOXK+c2KDibQFFSZLmHRh0lT5lhU/Zf5MVNzU/+IadxCmr2O3Ww++PWjb1edxya75VYy4Hle7klI+7z+DT4OCfCcB8UXN4WiZ3bj8KWDYGYx5YGqc2O2xSDGtzmVdVNRZO5clYRvPDYJws1olUD1xIb60nRQLlTmz7e3cdVaUEWelZYuGV3dE1bAWvVPdP2vVzszPOi/Yf8FtmDHSVAhTKxgRGaL87YerNllllbj1hYaiA/VOsE0iQr6k8bShwHUG2eCPRt2GScI6NkgQO3uNqxzXuQZxleiHUs+9DTBprmXvyYso/Fd0lTvYESBFpCAl8OaEoc6NUq/4aA==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Cc: felipe.huici@xxxxxxxxx, costin.lup@xxxxxxxxx, Vlad-Andrei BĂDOIU <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 31 Mar 2020 15:07:46 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

We adapt the implementation from musl.

Signed-off-by: Vlad-Andrei BĂDOIU <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 pthread_condattr.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/pthread_condattr.c b/pthread_condattr.c
index 53dcc64..0861a53 100644
--- a/pthread_condattr.c
+++ b/pthread_condattr.c
@@ -23,19 +23,20 @@
 #include <errno.h>
 #include <time.h>
 #include <pthread.h>
-
+#include <implement.h>
 
 int pthread_condattr_getclock(const pthread_condattr_t *__restrict attr,
                clockid_t *__restrict clock_id)
 {
-       WARN_STUBBED();
-       errno = ENOTSUP;
-       return -1;
+       *clock_id = (*attr)->clock & 0x7fffffff;
+       return 0;
 }
 
 int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id)
 {
-       WARN_STUBBED();
-       errno = ENOTSUP;
-       return -1;
+       if (clock_id < 0 || clock_id-2U < 2)
+               return EINVAL;
+       (*attr)->clock &= 0x80000000;
+       (*attr)->clock |= clock_id;
+       return 0;
 }
-- 
2.20.1


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