00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include<linux/unistd.h>
00012 #include<linux/linkage.h>
00013 #include<linux/sched.h>
00014 #include<ssdef.h>
00015 #include<starlet.h>
00016 #include<cebdef.h>
00017 #include<pridef.h>
00018 #include<statedef.h>
00019 #include<evtdef.h>
00020 #include<ipldef.h>
00021 #include<descrip.h>
00022 #include <system_data_cells.h>
00023 #include <internals.h>
00024 #include <misc_routines.h>
00025 #include <exe_routines.h>
00026 #include <queue.h>
00027 #include <linux/vmalloc.h>
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 asmlinkage int exe_ascefc(unsigned int efn, void *name, char prot, char perm) {
00043 int sts;
00044 struct _ceb * first=&sch_gq_cebhd;
00045 struct _ceb * tmp=first->ceb_l_cebfl;
00046 struct _ceb * c;
00047 struct _pcb * p;
00048 unsigned long * efcp;
00049 int found=1;
00050
00051 if (efn<64 || efn >127)
00052 return SS__ILLEFC;
00053
00054 if (((struct dsc_descriptor *)name)->dsc$w_length==0)
00055 return SS__IVLOGNAM;
00056 if (((struct dsc_descriptor *)name)->dsc$w_length>15)
00057 return SS__IVLOGNAM;
00058
00059
00060 while (tmp!=first) {
00061
00062
00063
00064 if (((struct dsc_descriptor *)name)->dsc$w_length==tmp->ceb$t_efcnam[0] && strncmp(((struct dsc$descriptor *)name)->dsc$a_pointer,&tmp->ceb$t_efcnam[1],tmp->ceb$t_efcnam[0])==0) goto out;
00065 tmp=tmp->ceb_l_cebfl;
00066
00067 }
00068 found=0;
00069 out:
00070
00071 if (!found) {
00072
00073
00074
00075 int alosize;
00076 sts=exe_std_allocceb(&alosize,&c);
00077 if (sts!=SS__NORMAL)
00078 return sts;
00079 qhead_init(&c->ceb_l_wqfl);
00080 c->ceb_l_state=SCH$C_CEF;
00081 c->ceb_t_efcnam[0]=((struct dsc$descriptor *)name)->dsc$w_length;
00082 memcpy(&c->ceb_t_efcnam[1],((struct dsc$descriptor *)name)->dsc$a_pointer,c->ceb$t_efcnam[0]);
00083
00084 insque(c,first);
00085 tmp=c;
00086 }
00087 tmp->ceb_l_refc++;
00088 p=current;
00089 efcp=getefcp(p,efn);
00090 *efcp=tmp;
00091
00092 return SS__NORMAL;
00093 }
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 asmlinkage int exe_dacefc(unsigned int efn) {
00105 unsigned long * efcp;
00106 struct _pcb * p;
00107 int retval = SS__NORMAL;
00108 struct _ceb * c;
00109
00110 if (efn<64 || efn >127)
00111 return SS__ILLEFC;
00112
00113 p=current;
00114
00115 efcp=getefcp(p,efn);
00116 if (!(*efcp)) {
00117 retval=SS__ILLEFC;
00118 goto end;
00119 }
00120
00121 c=*efcp;
00122 *efcp=0;
00123
00124 c->ceb_l_refc--;
00125
00126 if (!c->ceb_l_refc && aqempty(c->ceb$l_wqfl)) {
00127
00128
00129 remque(c,c);
00130
00131
00132 vfree(c);
00133 }
00134 end:
00135
00136 return retval;
00137 }
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 asmlinkage int exe_dlcefc(void *name) {
00149 struct _ceb * first=((struct _ceb *)sch_gq_cebhd)->ceb$l_cebfl;
00150 struct _ceb * tmp=sch_gq_cebhd;
00151 struct _ceb * c;
00152 int retval;
00153 int found=1;
00154
00155
00156 while (tmp!=first) {
00157 if (((struct dsc_descriptor *)name)->dsc$w_length==tmp->ceb$t_efcnam[0] && !strncmp(((struct dsc$descriptor *)name)->dsc$a_pointer,&tmp->ceb$t_efcnam[1],tmp->ceb$t_efcnam[0])) goto out;
00158 tmp=tmp->ceb_l_cebfl;
00159 }
00160 found=0;
00161 out:
00162
00163 if (!found)
00164 goto end;
00165
00166 c=tmp;
00167
00168
00169
00170
00171
00172
00173
00174 if (!c->ceb_l_refc && aqempty(c->ceb$l_wqfl)) {
00175
00176 remque(c,c);
00177
00178 vfree(c);
00179 }
00180
00181 retval=SS__NORMAL;
00182
00183 end:
00184 {
00185 }
00186
00187 }
00188
00189