Subversion Repositories shark

Rev

Rev 963 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1063 tullio 1
 
2
/*
3
 * This program is free software; you can redistribute it and/or modify
4
 * it under the terms of the GNU General Public License as published by
5
 * the Free Software Foundation; either version 2 of the License, or
6
 * (at your option) any later version.
7
 *
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 * GNU General Public License for more details.
12
 *
13
 * You should have received a copy of the GNU General Public License
14
 * along with this program; if not, write to the Free Software
15
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 *
17
 */
18
 
886 trimarchi 19
//=====================================================================
20
//       FFFFFFIII   RRRRR      SSTTTTTTT
21
//      FF         IIR   RR    SS
22
//     FF           IR        SS
23
//    FFFFFF         RRRR    SSSSST      
24
//   FF       FI       RRR  SS
25
//  FF         II     RRR  SS
26
// FF           IIIIIR    RS 
27
//       
28
// Basic FSF(FIRST Scheduling Framework) contract management
29
// S.Ha.R.K. Implementation
30
//=====================================================================
31
 
32
#include "fsf.h"
33
#include <string.h>
34
 
35
static char *fsf_msg[]={
963 trimarchi 36
 "TOO_MANY_TASKS                 ",
37
 "BAD_ARGUMENT                   ",
38
 "INVALID_SYNCH_OBJ_HANDLE       ",
39
 "NO_RENEGOTIATION_REQUESTED     ",
40
 "CONTRACT_REJECTED              ",
41
 "NOT_SCHEDULED_CALLING_THREAD   ",
42
 "NOT_BOUND_THREAD               ",
43
 "UNKNOWN_SCHEDULED_THREAD       ",
44
 "NOT_CONTRACTED_SERVER          ",
45
 "NOT_SCHEDULED_THREAD           ",
46
 "TOO_MANY_SERVICE_JOBS          ",
47
 "TOO_MANY_SYNCH_OBJS            ",
48
 "TOO_MANY_SERVERS_IN_SYNCH_OBJ  ",
49
 "TOO_MANY_EVENTS_IN_SYNCH_OBJ   ",
50
 "INTERNAL_ERROR                 ",
51
 "TOO_MANY_SERVERS               ",
52
 "INVALID_SCHEDULER_REPLY        ",
53
 "TOO_MANY_PENDING_REPLENISHMENTS",
54
 "SYSTEM_ALREADY_INITIALIZED     ",
55
 "SHARED_OBJ_ALREADY_INITIALIZED ",
56
 "SHARED_OBJ_NOT_INITIALIZED     ",
57
 "SCHED_POLICY_NOT_COMPATIBLE    ",
58
 "SERVER_WORKLOAD_NOT_COMPATIBLE ",
59
 "ALREADY_BOUND                  ",
60
 "WRONG_NETWORK                  ",
61
 "TOO_LARGE                      ",
62
 "BUFFER_FULL                    ",
63
 "NO_SPACE                       ",
64
 "NO_MESSAGES                    ",
65
 "MODULE_NOT_SUPPORTED           ",
66
 "SYSTEM_NOT_INITIALIZED         ",
67
 "TOO_MANY_SHARED_OBJS           ",
886 trimarchi 68
};
69
 
70
int fsf_strerror (int error, char *message, size_t size)
71
{
963 trimarchi 72
  if (message && size>0 && error>FSF_ERR_BASE_VALUE && error<=FSF_ERR_LAST_VALUE) {
73
    strncpy(message,  fsf_msg[error-FSF_ERR_BASE_VALUE-1], size);
74
  } else return FSF_ERR_BAD_ARGUMENT;
886 trimarchi 75
  return 0;
76
}