Home | History | Annotate | Line # | Download | only in libpthread
pthread_attr.c revision 1.8.2.1
      1  1.8.2.1  wrstuden /*	$NetBSD: pthread_attr.c,v 1.8.2.1 2008/09/18 04:39:24 wrstuden Exp $	*/
      2      1.1   nathanw 
      3      1.1   nathanw /*-
      4  1.8.2.1  wrstuden  * Copyright (c) 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
      5      1.1   nathanw  * All rights reserved.
      6      1.1   nathanw  *
      7      1.1   nathanw  * This code is derived from software contributed to The NetBSD Foundation
      8      1.1   nathanw  * by Nathan J. Williams.
      9      1.1   nathanw  *
     10      1.1   nathanw  * Redistribution and use in source and binary forms, with or without
     11      1.1   nathanw  * modification, are permitted provided that the following conditions
     12      1.1   nathanw  * are met:
     13      1.1   nathanw  * 1. Redistributions of source code must retain the above copyright
     14      1.1   nathanw  *    notice, this list of conditions and the following disclaimer.
     15      1.1   nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     16      1.1   nathanw  *    notice, this list of conditions and the following disclaimer in the
     17      1.1   nathanw  *    documentation and/or other materials provided with the distribution.
     18      1.1   nathanw  *
     19      1.1   nathanw  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20      1.1   nathanw  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21      1.1   nathanw  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22      1.1   nathanw  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23      1.1   nathanw  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24      1.1   nathanw  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25      1.1   nathanw  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26      1.1   nathanw  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27      1.1   nathanw  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28      1.1   nathanw  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29      1.1   nathanw  * POSSIBILITY OF SUCH DAMAGE.
     30      1.1   nathanw  */
     31      1.1   nathanw 
     32      1.1   nathanw #include <sys/cdefs.h>
     33  1.8.2.1  wrstuden __RCSID("$NetBSD: pthread_attr.c,v 1.8.2.1 2008/09/18 04:39:24 wrstuden Exp $");
     34      1.1   nathanw 
     35      1.1   nathanw #include <errno.h>
     36      1.1   nathanw #include <stdio.h>
     37      1.1   nathanw #include <stdlib.h>
     38      1.1   nathanw #include <string.h>
     39      1.1   nathanw #include <unistd.h>
     40      1.1   nathanw 
     41      1.1   nathanw #include "pthread.h"
     42      1.1   nathanw #include "pthread_int.h"
     43      1.1   nathanw 
     44      1.7  christos static struct pthread_attr_private *pthread__attr_init_private(
     45      1.7  christos     pthread_attr_t *);
     46      1.1   nathanw 
     47      1.1   nathanw static struct pthread_attr_private *
     48      1.1   nathanw pthread__attr_init_private(pthread_attr_t *attr)
     49      1.1   nathanw {
     50      1.1   nathanw 	struct pthread_attr_private *p;
     51      1.1   nathanw 
     52      1.1   nathanw 	if ((p = attr->pta_private) != NULL)
     53      1.1   nathanw 		return p;
     54      1.1   nathanw 
     55      1.1   nathanw 	p = malloc(sizeof(*p));
     56      1.1   nathanw 	if (p != NULL) {
     57      1.1   nathanw 		memset(p, 0, sizeof(*p));
     58      1.1   nathanw 		attr->pta_private = p;
     59  1.8.2.1  wrstuden 		p->ptap_policy = SCHED_OTHER;
     60      1.1   nathanw 	}
     61      1.1   nathanw 	return p;
     62      1.1   nathanw }
     63      1.1   nathanw 
     64      1.1   nathanw 
     65      1.1   nathanw int
     66      1.1   nathanw pthread_attr_init(pthread_attr_t *attr)
     67      1.1   nathanw {
     68      1.1   nathanw 
     69      1.1   nathanw 	attr->pta_magic = PT_ATTR_MAGIC;
     70      1.1   nathanw 	attr->pta_flags = 0;
     71      1.1   nathanw 	attr->pta_private = NULL;
     72      1.1   nathanw 
     73      1.1   nathanw 	return 0;
     74      1.1   nathanw }
     75      1.1   nathanw 
     76      1.1   nathanw 
     77      1.1   nathanw int
     78      1.1   nathanw pthread_attr_destroy(pthread_attr_t *attr)
     79      1.1   nathanw {
     80      1.1   nathanw 	struct pthread_attr_private *p;
     81      1.1   nathanw 
     82      1.1   nathanw 	if ((p = attr->pta_private) != NULL)
     83      1.1   nathanw 		free(p);
     84      1.1   nathanw 
     85      1.1   nathanw 	return 0;
     86      1.1   nathanw }
     87      1.1   nathanw 
     88      1.1   nathanw 
     89      1.1   nathanw int
     90      1.1   nathanw pthread_attr_get_np(pthread_t thread, pthread_attr_t *attr)
     91      1.1   nathanw {
     92      1.1   nathanw 	struct pthread_attr_private *p;
     93      1.1   nathanw 
     94      1.1   nathanw 	p = pthread__attr_init_private(attr);
     95      1.1   nathanw 	if (p == NULL)
     96      1.1   nathanw 		return ENOMEM;
     97      1.1   nathanw 
     98      1.1   nathanw 	attr->pta_flags = thread->pt_flags &
     99      1.1   nathanw 	    (PT_FLAG_DETACHED | PT_FLAG_SCOPE_SYSTEM | PT_FLAG_EXPLICIT_SCHED);
    100      1.1   nathanw 
    101      1.1   nathanw 	p->ptap_namearg = thread->pt_name;
    102      1.1   nathanw 	p->ptap_stackaddr = thread->pt_stack.ss_sp;
    103      1.1   nathanw 	p->ptap_stacksize = thread->pt_stack.ss_size;
    104      1.1   nathanw 	p->ptap_guardsize = (size_t)sysconf(_SC_PAGESIZE);
    105  1.8.2.1  wrstuden 	return pthread_getschedparam(thread, &p->ptap_policy, &p->ptap_sp);
    106      1.1   nathanw }
    107      1.1   nathanw 
    108      1.1   nathanw 
    109      1.1   nathanw int
    110      1.1   nathanw pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
    111      1.1   nathanw {
    112      1.1   nathanw 
    113      1.1   nathanw 	if (attr->pta_flags & PT_FLAG_DETACHED)
    114      1.1   nathanw 		*detachstate = PTHREAD_CREATE_DETACHED;
    115      1.1   nathanw 	else
    116      1.1   nathanw 		*detachstate = PTHREAD_CREATE_JOINABLE;
    117      1.1   nathanw 
    118      1.1   nathanw 	return 0;
    119      1.1   nathanw }
    120      1.1   nathanw 
    121      1.1   nathanw 
    122      1.1   nathanw int
    123      1.1   nathanw pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
    124      1.1   nathanw {
    125      1.1   nathanw 
    126      1.1   nathanw 	switch (detachstate) {
    127      1.1   nathanw 	case PTHREAD_CREATE_JOINABLE:
    128      1.1   nathanw 		attr->pta_flags &= ~PT_FLAG_DETACHED;
    129      1.1   nathanw 		break;
    130      1.1   nathanw 	case PTHREAD_CREATE_DETACHED:
    131      1.1   nathanw 		attr->pta_flags |= PT_FLAG_DETACHED;
    132      1.1   nathanw 		break;
    133      1.1   nathanw 	default:
    134      1.1   nathanw 		return EINVAL;
    135      1.1   nathanw 	}
    136      1.1   nathanw 
    137      1.1   nathanw 	return 0;
    138      1.1   nathanw }
    139      1.1   nathanw 
    140      1.1   nathanw 
    141      1.1   nathanw int
    142      1.1   nathanw pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guard)
    143      1.1   nathanw {
    144      1.1   nathanw 	struct pthread_attr_private *p;
    145      1.1   nathanw 
    146      1.1   nathanw 	if ((p = attr->pta_private) == NULL)
    147      1.1   nathanw 		*guard = (size_t)sysconf(_SC_PAGESIZE);
    148      1.1   nathanw 	else
    149      1.1   nathanw 		*guard = p->ptap_guardsize;
    150      1.1   nathanw 
    151      1.1   nathanw 	return 0;
    152      1.1   nathanw }
    153      1.1   nathanw 
    154      1.1   nathanw 
    155      1.1   nathanw int
    156      1.1   nathanw pthread_attr_setguardsize(pthread_attr_t *attr, size_t guard)
    157      1.1   nathanw {
    158      1.1   nathanw 	struct pthread_attr_private *p;
    159      1.1   nathanw 
    160      1.1   nathanw 	p = pthread__attr_init_private(attr);
    161      1.1   nathanw 	if (p == NULL)
    162      1.1   nathanw 		return ENOMEM;
    163      1.1   nathanw 
    164      1.1   nathanw 	p->ptap_guardsize = guard;
    165      1.1   nathanw 
    166      1.1   nathanw 	return 0;
    167      1.1   nathanw }
    168      1.1   nathanw 
    169      1.1   nathanw 
    170      1.1   nathanw int
    171      1.1   nathanw pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit)
    172      1.1   nathanw {
    173      1.1   nathanw 
    174      1.1   nathanw 	if (attr->pta_flags & PT_FLAG_EXPLICIT_SCHED)
    175      1.1   nathanw 		*inherit = PTHREAD_EXPLICIT_SCHED;
    176      1.1   nathanw 	else
    177      1.1   nathanw 		*inherit = PTHREAD_INHERIT_SCHED;
    178      1.1   nathanw 
    179      1.1   nathanw 	return 0;
    180      1.1   nathanw }
    181      1.1   nathanw 
    182      1.1   nathanw 
    183      1.1   nathanw int
    184      1.1   nathanw pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
    185      1.1   nathanw {
    186      1.1   nathanw 
    187      1.1   nathanw 	switch (inherit) {
    188      1.1   nathanw 	case PTHREAD_INHERIT_SCHED:
    189      1.1   nathanw 		attr->pta_flags &= ~PT_FLAG_EXPLICIT_SCHED;
    190      1.1   nathanw 		break;
    191      1.1   nathanw 	case PTHREAD_EXPLICIT_SCHED:
    192      1.1   nathanw 		attr->pta_flags |= PT_FLAG_EXPLICIT_SCHED;
    193      1.1   nathanw 		break;
    194      1.1   nathanw 	default:
    195      1.1   nathanw 		return EINVAL;
    196      1.1   nathanw 	}
    197      1.1   nathanw 
    198      1.1   nathanw 	return 0;
    199      1.1   nathanw }
    200      1.1   nathanw 
    201      1.1   nathanw 
    202      1.1   nathanw int
    203      1.1   nathanw pthread_attr_getscope(const pthread_attr_t *attr, int *scope)
    204      1.1   nathanw {
    205      1.1   nathanw 
    206      1.1   nathanw 	if (attr->pta_flags & PT_FLAG_SCOPE_SYSTEM)
    207      1.1   nathanw 		*scope = PTHREAD_SCOPE_SYSTEM;
    208      1.1   nathanw 	else
    209      1.1   nathanw 		*scope = PTHREAD_SCOPE_PROCESS;
    210      1.1   nathanw 
    211      1.1   nathanw 	return 0;
    212      1.1   nathanw }
    213      1.1   nathanw 
    214      1.1   nathanw 
    215      1.1   nathanw int
    216      1.1   nathanw pthread_attr_setscope(pthread_attr_t *attr, int scope)
    217      1.1   nathanw {
    218      1.1   nathanw 
    219      1.1   nathanw 	switch (scope) {
    220      1.1   nathanw 	case PTHREAD_SCOPE_PROCESS:
    221      1.1   nathanw 		attr->pta_flags &= ~PT_FLAG_SCOPE_SYSTEM;
    222      1.1   nathanw 		break;
    223      1.1   nathanw 	case PTHREAD_SCOPE_SYSTEM:
    224      1.1   nathanw 		attr->pta_flags |= PT_FLAG_SCOPE_SYSTEM;
    225      1.1   nathanw 		break;
    226      1.1   nathanw 	default:
    227      1.1   nathanw 		return EINVAL;
    228      1.1   nathanw 	}
    229      1.1   nathanw 
    230      1.1   nathanw 	return 0;
    231      1.1   nathanw }
    232      1.1   nathanw 
    233      1.1   nathanw 
    234      1.1   nathanw int
    235      1.1   nathanw pthread_attr_setschedparam(pthread_attr_t *attr,
    236  1.8.2.1  wrstuden 			   const struct sched_param *param)
    237      1.1   nathanw {
    238  1.8.2.1  wrstuden 	struct pthread_attr_private *p;
    239  1.8.2.1  wrstuden 	int error;
    240      1.1   nathanw 
    241      1.1   nathanw 	if (param == NULL)
    242      1.1   nathanw 		return EINVAL;
    243  1.8.2.1  wrstuden 	p = pthread__attr_init_private(attr);
    244  1.8.2.1  wrstuden 	if (p == NULL)
    245  1.8.2.1  wrstuden 		return ENOMEM;
    246  1.8.2.1  wrstuden 	error = pthread__checkpri(param->sched_priority);
    247  1.8.2.1  wrstuden 	if (error == 0)
    248  1.8.2.1  wrstuden 		p->ptap_sp = *param;
    249  1.8.2.1  wrstuden 	return error;
    250      1.1   nathanw }
    251      1.1   nathanw 
    252      1.1   nathanw 
    253      1.1   nathanw int
    254      1.1   nathanw pthread_attr_getschedparam(const pthread_attr_t *attr,
    255  1.8.2.1  wrstuden 			   struct sched_param *param)
    256      1.1   nathanw {
    257  1.8.2.1  wrstuden 	struct pthread_attr_private *p;
    258      1.1   nathanw 
    259      1.1   nathanw 	if (param == NULL)
    260      1.1   nathanw 		return EINVAL;
    261  1.8.2.1  wrstuden 	p = attr->pta_private;
    262  1.8.2.1  wrstuden 	if (p == NULL)
    263  1.8.2.1  wrstuden 		return ENOMEM;
    264  1.8.2.1  wrstuden 	*param = p->ptap_sp;
    265      1.1   nathanw 	return 0;
    266      1.1   nathanw }
    267      1.1   nathanw 
    268      1.1   nathanw 
    269      1.1   nathanw int
    270  1.8.2.1  wrstuden pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
    271      1.4   nathanw {
    272  1.8.2.1  wrstuden 	struct pthread_attr_private *p;
    273      1.4   nathanw 
    274      1.4   nathanw 
    275  1.8.2.1  wrstuden 	switch (policy) {
    276  1.8.2.1  wrstuden 	case SCHED_OTHER:
    277  1.8.2.1  wrstuden 	case SCHED_FIFO:
    278  1.8.2.1  wrstuden 	case SCHED_RR:
    279  1.8.2.1  wrstuden 		p = pthread__attr_init_private(attr);
    280  1.8.2.1  wrstuden 		if (p == NULL)
    281  1.8.2.1  wrstuden 			return ENOMEM;
    282  1.8.2.1  wrstuden 		p->ptap_policy = policy;
    283  1.8.2.1  wrstuden 		return 0;
    284  1.8.2.1  wrstuden 	default:
    285  1.8.2.1  wrstuden 		return ENOTSUP;
    286  1.8.2.1  wrstuden 	}
    287      1.4   nathanw }
    288      1.4   nathanw 
    289      1.4   nathanw 
    290      1.4   nathanw int
    291  1.8.2.1  wrstuden pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
    292      1.4   nathanw {
    293  1.8.2.1  wrstuden 	struct pthread_attr_private *p;
    294      1.4   nathanw 
    295  1.8.2.1  wrstuden 	p = attr->pta_private;
    296  1.8.2.1  wrstuden 	if (p == NULL) {
    297  1.8.2.1  wrstuden 		*policy = SCHED_OTHER;
    298  1.8.2.1  wrstuden 		return 0;
    299  1.8.2.1  wrstuden 	}
    300  1.8.2.1  wrstuden 	*policy = p->ptap_policy;
    301      1.4   nathanw 	return 0;
    302      1.4   nathanw }
    303      1.4   nathanw 
    304      1.4   nathanw 
    305      1.4   nathanw int
    306      1.1   nathanw pthread_attr_getstack(const pthread_attr_t *attr, void **addr, size_t *size)
    307      1.1   nathanw {
    308      1.1   nathanw 	struct pthread_attr_private *p;
    309      1.1   nathanw 
    310      1.1   nathanw 	if ((p = attr->pta_private) == NULL) {
    311      1.1   nathanw 		*addr = NULL;
    312      1.6        ad 		*size = pthread__stacksize;
    313      1.1   nathanw 	} else {
    314      1.1   nathanw 		*addr = p->ptap_stackaddr;
    315      1.1   nathanw 		*size = p->ptap_stacksize;
    316      1.1   nathanw 	}
    317      1.1   nathanw 
    318      1.1   nathanw 	return 0;
    319      1.1   nathanw }
    320      1.1   nathanw 
    321      1.1   nathanw 
    322      1.1   nathanw int
    323      1.1   nathanw pthread_attr_setstack(pthread_attr_t *attr, void *addr, size_t size)
    324      1.1   nathanw {
    325      1.1   nathanw 	struct pthread_attr_private *p;
    326      1.1   nathanw 
    327      1.1   nathanw 	p = pthread__attr_init_private(attr);
    328      1.1   nathanw 	if (p == NULL)
    329      1.1   nathanw 		return ENOMEM;
    330      1.1   nathanw 
    331      1.1   nathanw 	p->ptap_stackaddr = addr;
    332      1.1   nathanw 	p->ptap_stacksize = size;
    333      1.1   nathanw 
    334      1.1   nathanw 	return 0;
    335      1.1   nathanw }
    336      1.1   nathanw 
    337      1.1   nathanw 
    338      1.1   nathanw int
    339      1.1   nathanw pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *size)
    340      1.1   nathanw {
    341      1.1   nathanw 	struct pthread_attr_private *p;
    342      1.1   nathanw 
    343      1.1   nathanw 	if ((p = attr->pta_private) == NULL)
    344      1.6        ad 		*size = pthread__stacksize;
    345      1.1   nathanw 	else
    346      1.1   nathanw 		*size = p->ptap_stacksize;
    347      1.1   nathanw 
    348      1.1   nathanw 	return 0;
    349      1.1   nathanw }
    350      1.1   nathanw 
    351      1.1   nathanw 
    352      1.1   nathanw int
    353      1.1   nathanw pthread_attr_setstacksize(pthread_attr_t *attr, size_t size)
    354      1.1   nathanw {
    355      1.1   nathanw 	struct pthread_attr_private *p;
    356      1.1   nathanw 
    357  1.8.2.1  wrstuden 	if (size < sysconf(_SC_THREAD_STACK_MIN))
    358  1.8.2.1  wrstuden 		return EINVAL;
    359  1.8.2.1  wrstuden 
    360      1.1   nathanw 	p = pthread__attr_init_private(attr);
    361      1.1   nathanw 	if (p == NULL)
    362      1.1   nathanw 		return ENOMEM;
    363      1.1   nathanw 
    364      1.1   nathanw 	p->ptap_stacksize = size;
    365      1.1   nathanw 
    366      1.1   nathanw 	return 0;
    367      1.1   nathanw }
    368      1.1   nathanw 
    369      1.1   nathanw 
    370      1.1   nathanw int
    371      1.1   nathanw pthread_attr_getstackaddr(const pthread_attr_t *attr, void **addr)
    372      1.1   nathanw {
    373      1.1   nathanw 	struct pthread_attr_private *p;
    374      1.1   nathanw 
    375      1.1   nathanw 	if ((p = attr->pta_private) == NULL)
    376      1.1   nathanw 		*addr = NULL;
    377      1.1   nathanw 	else
    378      1.1   nathanw 		*addr = p->ptap_stackaddr;
    379      1.1   nathanw 
    380      1.1   nathanw 	return 0;
    381      1.1   nathanw }
    382      1.1   nathanw 
    383      1.1   nathanw 
    384      1.1   nathanw int
    385      1.1   nathanw pthread_attr_setstackaddr(pthread_attr_t *attr, void *addr)
    386      1.1   nathanw {
    387      1.1   nathanw 	struct pthread_attr_private *p;
    388      1.1   nathanw 
    389      1.1   nathanw 	p = pthread__attr_init_private(attr);
    390      1.1   nathanw 	if (p == NULL)
    391      1.1   nathanw 		return ENOMEM;
    392      1.1   nathanw 
    393      1.1   nathanw 	p->ptap_stackaddr = addr;
    394      1.1   nathanw 
    395      1.1   nathanw 	return 0;
    396      1.1   nathanw }
    397      1.1   nathanw 
    398      1.1   nathanw 
    399      1.1   nathanw int
    400      1.1   nathanw pthread_attr_getname_np(const pthread_attr_t *attr, char *name, size_t len,
    401      1.1   nathanw     void **argp)
    402      1.1   nathanw {
    403      1.1   nathanw 	struct pthread_attr_private *p;
    404      1.1   nathanw 
    405      1.1   nathanw 	if ((p = attr->pta_private) == NULL) {
    406      1.1   nathanw 		name[0] = '\0';
    407      1.1   nathanw 		if (argp != NULL)
    408      1.1   nathanw 			*argp = NULL;
    409      1.1   nathanw 	} else {
    410      1.1   nathanw 		strlcpy(name, p->ptap_name, len);
    411      1.1   nathanw 		if (argp != NULL)
    412      1.1   nathanw 			*argp = p->ptap_namearg;
    413      1.1   nathanw 	}
    414      1.1   nathanw 
    415      1.1   nathanw 	return 0;
    416      1.1   nathanw }
    417      1.1   nathanw 
    418      1.1   nathanw 
    419      1.1   nathanw int
    420      1.1   nathanw pthread_attr_setname_np(pthread_attr_t *attr, const char *name, void *arg)
    421      1.1   nathanw {
    422      1.1   nathanw 	struct pthread_attr_private *p;
    423      1.1   nathanw 	int namelen;
    424      1.1   nathanw 
    425      1.1   nathanw 	p = pthread__attr_init_private(attr);
    426      1.1   nathanw 	if (p == NULL)
    427      1.1   nathanw 		return ENOMEM;
    428      1.1   nathanw 
    429      1.1   nathanw 	namelen = snprintf(p->ptap_name, PTHREAD_MAX_NAMELEN_NP, name, arg);
    430      1.1   nathanw 	if (namelen >= PTHREAD_MAX_NAMELEN_NP) {
    431      1.1   nathanw 		p->ptap_name[0] = '\0';
    432      1.1   nathanw 		return EINVAL;
    433      1.1   nathanw 	}
    434      1.1   nathanw 	p->ptap_namearg = arg;
    435      1.1   nathanw 
    436      1.3  christos 	return 0;
    437      1.3  christos }
    438      1.3  christos 
    439      1.3  christos int
    440      1.3  christos pthread_attr_setcreatesuspend_np(pthread_attr_t *attr)
    441      1.3  christos {
    442      1.3  christos 	attr->pta_flags |= PT_FLAG_SUSPENDED;
    443      1.1   nathanw 	return 0;
    444      1.1   nathanw }
    445