Remove building with NOCRYPTO option
[minix.git] / lib / libc / rpc / svc_fdset.c
blob08206d6d5e71f70e49bca2b4c3059102961aa437
1 /* $NetBSD: svc_fdset.c,v 1.1 2013/03/05 19:55:23 christos Exp $ */
3 #include <sys/cdefs.h>
4 __RCSID("$NetBSD: svc_fdset.c,v 1.1 2013/03/05 19:55:23 christos Exp $");
6 #include <pthread.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <sys/select.h>
11 #include "svc_fdset.h"
13 static pthread_key_t fdsetkey;
14 static pthread_key_t fdmaxkey;
15 static fd_set thefdset;
16 static int thefdmax;
18 void
19 init_fdsets(void)
22 pthread_key_create(&fdsetkey, NULL);
23 pthread_key_create(&fdmaxkey, NULL);
26 void
27 alloc_fdset(void)
29 fd_set *fdsetti;
30 int *fdmax;
32 fdsetti = malloc(sizeof(*fdsetti));
33 memset(fdsetti, 0, sizeof(*fdsetti));
34 pthread_setspecific(fdsetkey, fdsetti);
36 fdmax = malloc(sizeof(*fdmax));
37 memset(fdmax, 0, sizeof(*fdmax));
38 pthread_setspecific(fdmaxkey, fdmax);
41 fd_set *
42 get_fdset(void)
44 fd_set *rv;
46 rv = pthread_getspecific(fdsetkey);
47 if (rv)
48 return rv;
49 else
50 return &thefdset;
53 int *
54 get_fdsetmax(void)
56 int *rv;
58 rv = pthread_getspecific(fdmaxkey);
59 if (rv)
60 return rv;
61 else
62 return &thefdmax;