summaryrefslogtreecommitdiff
path: root/attr.c
diff options
context:
space:
mode:
authorbje <bje>1998-07-22 09:22:58 +0000
committerbje <bje>1998-07-22 09:22:58 +0000
commitac165ba9bfdfd92f62c65ab0449852eff7bd4d91 (patch)
tree564012b6629bedabd461e59e1c2dd7463de00358 /attr.c
parentc9b8e5d0d1c38c48570be14216112201158503da (diff)
i1998-07-22 Ben Elliston <bje@cygnus.com>
* attr.c (pthread_setstacksize): Update test of attr argument. (pthread_getstacksize): Likewise. (pthread_setstackaddr): Likewise. (pthread_getstackaddr): Likewise. (pthread_attr_init): No need to allocate any storage. (pthread_attr_destroy): No need to free any storage. * mutex.c (is_attr): Not likely to be needed; remove. (remove_attr): Likewise. (insert_attr): Likewise. * pthread.h (pthread_attr_t): Moved here from implement.h. * implement.h (_pthread_mutexattr_t): Moved to a public definition in pthread.h. There was little gain in hiding these details. (_pthread_condattr_t): Likewise.
Diffstat (limited to 'attr.c')
-rw-r--r--attr.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/attr.c b/attr.c
index a99cf53..1b4f348 100644
--- a/attr.c
+++ b/attr.c
@@ -18,13 +18,13 @@ pthread_attr_setstacksize(pthread_attr_t *attr,
return EINVAL;
}
- if (is_attr(attr) != 0)
+ if (attr == NULL)
{
return EINVAL;
}
/* Everything is okay. */
- (_pthread_attr_t *) (attr->ptr)->stacksize = stacksize;
+ attr->stacksize = stacksize;
return 0;
}
@@ -32,13 +32,13 @@ int
pthread_attr_getstacksize(const pthread_attr_t *attr,
size_t *stacksize)
{
- if (is_attr(attr) != 0)
+ if (attr == NULL)
{
return EINVAL;
}
/* Everything is okay. */
- *stacksize = (_pthread_attr_t *) (attr->ptr)->stacksize;
+ *stacksize = attr->stacksize;
return 0;
}
@@ -46,7 +46,7 @@ int
pthread_attr_setstackaddr(pthread_attr_t *attr,
void *stackaddr)
{
- if ((is_attr(attr) != 0))
+ if (attr == NULL)
{
return EINVAL;
}
@@ -59,7 +59,7 @@ int
pthread_attr_getstackaddr(const pthread_attr_t *attr,
void **stackaddr)
{
- if ((is_attr(attr) != 0))
+ if (attr == NULL)
{
return EINVAL;
}
@@ -77,24 +77,20 @@ pthread_attr_init(pthread_attr_t *attr)
return EINVAL;
}
- attr->ptr = malloc(sizeof(_pthread_attr_t));
- if (attr->ptr == NULL)
- {
- return ENOMEM;
- }
-
/* FIXME: Fill out the structure with default values. */
+ attr->stacksize = 0;
+
return 0;
}
int
pthread_attr_destroy(pthread_attr_t *attr)
{
- if (is_attr(attr) != 0)
+ if (attr == NULL)
{
return EINVAL;
}
- free (attr->ptr);
+ /* Nothing to do. */
return 0;
}