From owner-p4-projects@FreeBSD.ORG Sun Jan 30 07:44:01 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BB92E16A4D0; Sun, 30 Jan 2005 07:44:00 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9022616A4CE for ; Sun, 30 Jan 2005 07:44:00 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5ED5C43D46 for ; Sun, 30 Jan 2005 07:44:00 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j0U7i0rt096793 for ; Sun, 30 Jan 2005 07:44:00 GMT (envelope-from davidxu@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j0U7i0hr096790 for perforce@freebsd.org; Sun, 30 Jan 2005 07:44:00 GMT (envelope-from davidxu@freebsd.org) Date: Sun, 30 Jan 2005 07:44:00 GMT Message-Id: <200501300744.j0U7i0hr096790@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to davidxu@freebsd.org using -f From: David Xu To: Perforce Change Reviews Subject: PERFORCE change 69958 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2005 07:44:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=69958 Change 69958 by davidxu@davidxu_tiger on 2005/01/30 07:43:19 Add pthread_condattr_setclock, pthread_condattr_getclock. Affected files ... .. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_condattr.c#4 edit Differences ... ==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_condattr.c#4 (text+ko) ==== @@ -39,12 +39,16 @@ __weak_reference(_pthread_condattr_init, pthread_condattr_init); __weak_reference(_pthread_condattr_destroy, pthread_condattr_destroy); +__weak_reference(_pthread_condattr_getclock, pthread_condattr_getclock); +__weak_reference(_pthread_condattr_setclock, pthread_condattr_setclock); +__weak_reference(_pthread_condattr_getpshared, pthread_condattr_getpshared); +__weak_reference(_pthread_condattr_setpshared, pthread_condattr_setpshared); int _pthread_condattr_init(pthread_condattr_t *attr) { + pthread_condattr_t pattr; int ret; - pthread_condattr_t pattr; if ((pattr = (pthread_condattr_t) malloc(sizeof(struct pthread_cond_attr))) == NULL) { @@ -62,6 +66,7 @@ _pthread_condattr_destroy(pthread_condattr_t *attr) { int ret; + if (attr == NULL || *attr == NULL) { ret = EINVAL; } else { @@ -71,3 +76,51 @@ } return(ret); } + +int +_pthread_condattr_getclock(const pthread_condattr_t *attr, + clockid_t *clock_id) +{ + if (attr == NULL || *attr == NULL) + return (EINVAL); + *clock_id = (*attr)->c_clockid; + return (0); +} + +int +_pthread_condattr_setclock(const pthread_condattr_t *attr, + clockid_t clock_id) +{ + if (attr == NULL || *attr == NULL) + return (EINVAL); + if (clock_id != CLOCK_REALTIME && + clock_id != CLOCK_VIRTUAL && + clock_id != CLOCK_PROF && + clock_id != CLOCK_MONOTONIC) { + return (EINVAL); + } + (*attr)->c_clockid = clock_id; + return (0); +} + +int +_pthread_condattr_getpshared(const pthread_condattr_t *attr, + int *pshared) +{ + if (attr == NULL || *attr == NULL) + return (EINVAL); + + pshared = PTHREAD_PROCESS_PRIVATE; + return (0); +} + +int +_pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared) +{ + if (attr == NULL || *attr == NULL) + return (EINVAL); + + if (pshared != PTHREAD_PROCESS_PRIVATE) + return (EINVAL); + return (0); +}