/[pdpsoft]/trunk/grid-mw-security/ees/src/app/aos_threading_test.c
ViewVC logotype

Contents of /trunk/grid-mw-security/ees/src/app/aos_threading_test.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1583 - (show annotations) (download) (as text)
Fri Mar 19 17:29:41 2010 UTC (12 years, 6 months ago) by aramv
File MIME type: text/x-chdr
File size: 1678 byte(s)
Fixed a read error. Added signature for fork function
1 #define _MULTI_THREADED
2 #define NUM_THREADS 2
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <pthread.h>
7 #include "eef_library.h"
8
9 int main (int argc, char* argv[]){
10 char* config_file;
11 pthread_t threads[NUM_THREADS];
12 long t;
13 int rc;
14 void* status;
15
16 /*sleep(10);*/
17
18 aos_attribute_t* pemstring;
19 aos_context_t* _context;
20 aos_attribute_t *_uid, *_gid;
21
22 char* _uid_str = "1234";
23 char* _gid_str = "1234";
24
25
26
27 if(argc > 1){
28 config_file = argv[1];
29 } else {
30 config_file = "examples/example_1.pdl";
31 }
32
33 printf("Parsing config file %s\n", config_file);
34
35 if(EEF_Init(config_file, NULL, 0, NULL) == EES_FAILURE){
36 eef_log(LOG_ERR, "Failed to parse config file (%s), exiting...", config_file);
37 } else {
38
39 /* fill aos */
40 _uid = createAttribute();
41 _gid = createAttribute();
42
43 setAttributeId(_uid, "posix-uid");
44 setAttributeValue(_uid, _uid_str, strlen(_uid_str)+1);
45 setAttributeId(_gid, "posix-gid");
46 setAttributeValue(_gid, _gid_str, strlen(_gid_str)+1);
47
48 if((_context = createContext(OBLIGATION)) != NULL){
49 setContextObligationId(_context, "uidgid");
50
51 addAttribute(_context, _uid);
52 addAttribute(_context, _gid);
53
54 addContext(_context);
55 }
56 aos_dump_argslist();
57 EEF_Run();
58 /*aos_start_threading();*/
59 /**//* start threading */
60 /*for(t=0; t < NUM_THREADS; t++){*/
61 /*printf("Creating thread %li!\n", t);*/
62 /*rc = pthread_create(&threads[t], NULL, (void*)(void*) EEF_Run, (void*)(t));*/
63 /*rc = pthread_join(threads[t], &status);*/
64 /*}*/
65 }
66 /*sleep(10);*/
67 EEF_Term();
68 printf("terminated!\n");
69
70 /*sleep(10);*/
71
72 /*pthread_exit(NULL);*/
73 return 0;
74 }
75

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28