Adds pthread_attr_{set,get}guardsize
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 12 May 2015 20:41:02 +0000 (16:41 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 13 May 2015 16:08:07 +0000 (12:08 -0400)
We don't actually implement guard pages, but we might one day.  Until
then, we have the interface.  Actual guard pages could be implemented
after we bring in various uthread performance improvements.

user/pthread/pthread.c
user/pthread/pthread.h

index dbae9e0..654a1dc 100644 (file)
@@ -550,6 +550,18 @@ int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
        return 0;
 }
 
+int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
+{
+       attr->guardsize = guardsize;
+       return 0;
+}
+
+int pthread_attr_getguardsize(pthread_attr_t *attr, size_t *guardsize)
+{
+       *guardsize = attr->guardsize;
+       return 0;
+}
+
 int pthread_attr_getstack(const pthread_attr_t *__restrict __attr,
                                                   void **__stackaddr, size_t *__stacksize)
 {
index fec9973..6dcf3f7 100644 (file)
@@ -131,6 +131,7 @@ typedef struct
 {
        void *stackaddr;
        size_t stacksize;
+       size_t guardsize;
        int detachstate;
        int sched_priority;
        int sched_policy;
@@ -160,6 +161,8 @@ int pthread_yield(void);
 int pthread_attr_setdetachstate(pthread_attr_t *__attr,int __detachstate);
 int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
 int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize);
+int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize);
+int pthread_attr_getguardsize(pthread_attr_t *attr, size_t *guardsize);
 
 int pthread_mutex_destroy(pthread_mutex_t *);
 int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);