| 1 |
/*=========================================================================== |
| 2 |
Copyright (C) 1995-2009 European Southern Observatory (ESO) |
| 3 |
|
| 4 |
This program is free software; you can redistribute it and/or |
| 5 |
modify it under the terms of the GNU General Public License as |
| 6 |
published by the Free Software Foundation; either version 2 of |
| 7 |
the License, or (at your option) any later version. |
| 8 |
|
| 9 |
This program is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public |
| 15 |
License along with this program; if not, write to the Free |
| 16 |
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, |
| 17 |
MA 02139, USA. |
| 18 |
|
| 19 |
Correspondence concerning ESO-MIDAS should be addressed as follows: |
| 20 |
Internet e-mail: [email protected] |
| 21 |
Postal address: European Southern Observatory |
| 22 |
Data Management Division |
| 23 |
Karl-Schwarzschild-Strasse 2 |
| 24 |
D 85748 Garching bei Muenchen |
| 25 |
GERMANY |
| 26 |
===========================================================================*/ |
| 27 |
|
| 28 |
/*++++++++++++++++++++++++ Module OSY ++++++++++++++++++++++++++ |
| 29 |
.TYPE Module |
| 30 |
.LANGUAGE C |
| 31 |
.IDENTIFICATION OSY routines for Unix |
| 32 |
.AUTHOR Benoit Pirenne, K. Banse [ESO-IPG] |
| 33 |
.KEYWORDS Operating-system interface |
| 34 |
.ENVIRONMENT uses the os interface routines. |
| 35 |
.COMMENTS OSY routines are useful for the implementation |
| 36 |
of a first portable version of Midas. |
| 37 |
holds OSY_ASCTIM, OSY_MESSAGE, OSY_GETSYMB, OSY_TRNLOG, OSY_SPAWN |
| 38 |
OSY_TIMER, OSY_SLEEP, OSY_DASSGN, |
| 39 |
OSY_WVB, OSY_RVB, OSY_WLDB, OSY_RLDB |
| 40 |
|
| 41 |
.VERSION [1.0] 861012: Creation. B. Pirenne |
| 42 |
|
| 43 |
090428 last modif |
| 44 |
----------------------------------------------------------------------------*/ |
| 45 |
|
| 46 |
#include <time.h> |
| 47 |
#include <stdio.h> |
| 48 |
#include <stdlib.h> |
| 49 |
|
| 50 |
#include <osyparms.h> |
| 51 |
#include <fileexts.h> |
| 52 |
#include <osparms.h> |
| 53 |
|
| 54 |
static unsigned int addr; |
| 55 |
|
| 56 |
int osdofwrite(), osdofread(), osftranslate(); |
| 57 |
|
| 58 |
/* this routine can be used for debugging OSY_WVB, OSY_RVB, if needed ... |
| 59 |
|
| 60 |
|
| 61 |
static int osy_read = 0, osy_write = 0; |
| 62 |
|
| 63 |
void OSY_COUNT(rdcount,wrcount) |
| 64 |
int *rdcount, *wrcount; |
| 65 |
|
| 66 |
{ |
| 67 |
*rdcount = osy_read; |
| 68 |
*wrcount = osy_write; |
| 69 |
} |
| 70 |
*/ |
| 71 |
|
| 72 |
/* |
| 73 |
|
| 74 |
*/ |
| 75 |
|
| 76 |
int OSY_ASCTIM(time) |
| 77 |
/*+++++++++++++++++++++++++ Function OSY_ASCTIM +++++++++++++++++++ |
| 78 |
.PURPOSE Gets the time |
| 79 |
.RETURNS Function : always zero |
| 80 |
.RETURNS Parameter : the actual time as a pointer to a 26 |
| 81 |
character string containing the day name, |
| 82 |
complete date and time in day. |
| 83 |
------------------------------------------------------------------*/ |
| 84 |
char *time; /* OUT : pointer to a string of char containing the time */ |
| 85 |
|
| 86 |
{ |
| 87 |
int ret; |
| 88 |
int oshdate(); |
| 89 |
|
| 90 |
struct tm date_struct; |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
ret = oshdate(time,&date_struct); |
| 96 |
if (ret == 0) |
| 97 |
return ERR_NORMAL; |
| 98 |
else |
| 99 |
{ |
| 100 |
MID_ERROR("OSY","OSY_ASCTIM",ret,0); /* `ret' is just dummy */ |
| 101 |
return (ERR_INPINV); |
| 102 |
} |
| 103 |
} |
| 104 |
|
| 105 |
/* |
| 106 |
|
| 107 |
*/ |
| 108 |
|
| 109 |
void OSY_MESSAGE(mstat,errmsg) |
| 110 |
/*+++++++++++++++++++++++ Function OSY_MESSAGE ++++++++++++++++++++++++ |
| 111 |
.PURPOSE Get and print system message. |
| 112 |
.RETURNS Nothing |
| 113 |
.REMARKS Print the system message corresponding to the status received. |
| 114 |
----------------------------------------------------------------------*/ |
| 115 |
|
| 116 |
int mstat; /* IN: System error number */ |
| 117 |
char *errmsg; /* OUT: buffer for message */ |
| 118 |
|
| 119 |
{ |
| 120 |
extern int oshmsg(); |
| 121 |
|
| 122 |
|
| 123 |
if (oshmsg(mstat,errmsg) != 0) |
| 124 |
(void)strcpy(errmsg,"SYS_MSG : No system message returned ... "); |
| 125 |
} |
| 126 |
|
| 127 |
/* |
| 128 |
|
| 129 |
*/ |
| 130 |
|
| 131 |
#ifdef __STDC__ |
| 132 |
int OSY_TIMER(char action , float * time) |
| 133 |
#else |
| 134 |
int OSY_TIMER(action, time) |
| 135 |
/*+++++++++++++++++++++++++ Function OSY_TIMER +++++++++++++++++++++++++++++ |
| 136 |
.PURPOSE Reports the CPU time used. |
| 137 |
.RETURNS Function : 0 if the action requested was correct, -1 if the action |
| 138 |
was not correct. |
| 139 |
.RETURNS Parameter : the actual CPU time passed since the Initialisation (in |
| 140 |
hundreds of seconds). |
| 141 |
.REMARKS If action is 'I' then the initialization is done. |
| 142 |
If it is 'G' then the CPU time is obtained and returned. |
| 143 |
----------------------------------------------------------------------------*/ |
| 144 |
char action; /* IN : action : 'I' to initialize; 'G' to get it */ |
| 145 |
float *time; /* OUT: time passed. */ |
| 146 |
#endif |
| 147 |
|
| 148 |
{ |
| 149 |
int oshcpu(); |
| 150 |
int ret; |
| 151 |
|
| 152 |
float dum; |
| 153 |
|
| 154 |
|
| 155 |
switch (action) |
| 156 |
{ |
| 157 |
case 'I' : |
| 158 |
ret = oshcpu(INIT_CPU_CLOCK,&dum); |
| 159 |
break; |
| 160 |
|
| 161 |
case 'G' : |
| 162 |
ret = oshcpu(GET_CPU_CLOCK,time); |
| 163 |
break; |
| 164 |
|
| 165 |
default : |
| 166 |
ret = -1; |
| 167 |
} |
| 168 |
|
| 169 |
if (ret == 0) |
| 170 |
return ERR_NORMAL; |
| 171 |
else |
| 172 |
{ |
| 173 |
MID_ERROR("OSY","OSY_TIMER",ret,0); /* `ret' is just dummy */ |
| 174 |
return (ERR_INPINV); |
| 175 |
} |
| 176 |
} |
| 177 |
|
| 178 |
/* |
| 179 |
|
| 180 |
*/ |
| 181 |
|
| 182 |
int OSY_DASSGN(entrx,iochan) |
| 183 |
/*+++++++++++++++++++++++++ Function OSY_DASSIGN +++++++++++++++++++++++++++++ |
| 184 |
.PURPOSE Deassign a channel (close a file) |
| 185 |
.RETURNS Function : 0 if the action requested was correct, -1 if the action |
| 186 |
was not correct. |
| 187 |
----------------------------------------------------------------------------*/ |
| 188 |
|
| 189 |
int entrx /* FCT entry, if >= 0 */; |
| 190 |
int iochan /* channel number (file identifier in Unix) */; |
| 191 |
|
| 192 |
{ |
| 193 |
int status, chanl; |
| 194 |
|
| 195 |
|
| 196 |
struct FCT_STRUCT *fctpntr; |
| 197 |
|
| 198 |
|
| 199 |
if (entrx < 0) |
| 200 |
status = close(iochan); |
| 201 |
|
| 202 |
else |
| 203 |
{ |
| 204 |
fctpntr = FCT.ENTRIES + entrx; |
| 205 |
chanl = fctpntr->IOCHAN; |
| 206 |
|
| 207 |
if (chanl < 0) /* it's a memory file */ |
| 208 |
{ |
| 209 |
int idx; |
| 210 |
|
| 211 |
idx = -1 - chanl; /* recalculate VMEM index */ |
| 212 |
(void) MID_VMEM(3,idx,&status); |
| 213 |
return (ERR_NORMAL); |
| 214 |
} |
| 215 |
|
| 216 |
|
| 217 |
status = close(chanl); |
| 218 |
} |
| 219 |
|
| 220 |
if (status == -1) |
| 221 |
{ |
| 222 |
MID_ERROR("OSY","OSY_DASSGN",status,0); /* `status' is just dummy */ |
| 223 |
return (ERR_INPINV); |
| 224 |
} |
| 225 |
else |
| 226 |
return (ERR_NORMAL); |
| 227 |
} |
| 228 |
/* |
| 229 |
|
| 230 |
*/ |
| 231 |
|
| 232 |
int OSY_WVB(iochan,pbuf,nobyt,vbn) |
| 233 |
/*++++++++++++++++++++++++++ Function OSY_WVB +++++++++++++++++++++++++ |
| 234 |
|
| 235 |
.PURPOSE write virtual blocks to disk or memory |
| 236 |
.RETURNS midas error code |
| 237 |
.REMARKS uses the os interface service osdofwrite. |
| 238 |
|
| 239 |
-------------------------------------------------------------------------*/ |
| 240 |
|
| 241 |
int iochan; /* IN : file identifier assigned to disk file */ |
| 242 |
char *pbuf; /* IN : pointer to the buffer to write */ |
| 243 |
unsigned int nobyt; /* IN : number of bytes to be transferred */ |
| 244 |
int vbn; /* IN : starting virtual block for data transfer */ |
| 245 |
|
| 246 |
{ |
| 247 |
int status; |
| 248 |
|
| 249 |
off_t offset; |
| 250 |
|
| 251 |
|
| 252 |
/* osy_write++; */ |
| 253 |
|
| 254 |
|
| 255 |
if (iochan < 0) |
| 256 |
{ |
| 257 |
int idx; |
| 258 |
|
| 259 |
idx = -1 - iochan; /* recalculate VMEM index */ |
| 260 |
status = MID_VMIO(1,idx,pbuf,nobyt,vbn); |
| 261 |
if (status == ERR_NORMAL) return ERR_NORMAL; |
| 262 |
} |
| 263 |
|
| 264 |
else |
| 265 |
{ |
| 266 |
addr = (unsigned int) (vbn - 1); |
| 267 |
addr *= OUR_BLOCK_SIZE; |
| 268 |
|
| 269 |
offset = (off_t) addr; |
| 270 |
status = osdofwrite(iochan,offset,pbuf,nobyt); |
| 271 |
if (status > 0) return (ERR_NORMAL); |
| 272 |
} |
| 273 |
|
| 274 |
MID_ERROR("OSY","OSY_WVB",-1,0); |
| 275 |
return (ERR_INPINV); |
| 276 |
} |
| 277 |
/* |
| 278 |
|
| 279 |
*/ |
| 280 |
|
| 281 |
int OSY_RVB(iochan,pbuf,nobyt,vbn) |
| 282 |
/*++++++++++++++++++++++++++ Function OSY_RVB +++++++++++++++++++++++++ |
| 283 |
.PURPOSE read virtual blocks from disk. |
| 284 |
.RETURNS midas error code |
| 285 |
.REMARKS uses the os interface service osdofread. |
| 286 |
-------------------------------------------------------------------------*/ |
| 287 |
|
| 288 |
int iochan; /* IN : file identifier assigned to disk file */ |
| 289 |
char *pbuf; /* IN : pointer to buffer to fill from disk */ |
| 290 |
unsigned int nobyt; /* IN : number of bytes to be transferred */ |
| 291 |
int vbn; /* IN : starting virtual block for data transfer */ |
| 292 |
|
| 293 |
{ |
| 294 |
int status; |
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
/* osy_read++; */ |
| 299 |
|
| 300 |
|
| 301 |
if (iochan < 0) |
| 302 |
{ |
| 303 |
int idx; |
| 304 |
|
| 305 |
idx = -1 - iochan; /* recalculate VMEM index */ |
| 306 |
status = MID_VMIO(0,idx,pbuf,nobyt,vbn); |
| 307 |
if (status == ERR_NORMAL) return ERR_NORMAL; |
| 308 |
} |
| 309 |
|
| 310 |
else |
| 311 |
{ |
| 312 |
addr = (unsigned int) (vbn - 1); |
| 313 |
addr *= OUR_BLOCK_SIZE; |
| 314 |
|
| 315 |
status = osdofread(iochan,addr,pbuf,nobyt); |
| 316 |
if (status > 0) return (ERR_NORMAL); |
| 317 |
} |
| 318 |
|
| 319 |
MID_ERROR("OSY","OSY_RVB",-1,0); |
| 320 |
return (ERR_INPINV); |
| 321 |
} |
| 322 |
/* |
| 323 |
|
| 324 |
*/ |
| 325 |
|
| 326 |
int OSY_WLDB(iochan,pbuf,vbn) |
| 327 |
/*++++++++++++++++++++++++++ Function OSY_WLDB +++++++++++++++++++++++++ |
| 328 |
|
| 329 |
.PURPOSE write LDB to disk or memory |
| 330 |
.RETURNS midas error code |
| 331 |
.REMARKS uses the os interface service osdofwrite. |
| 332 |
|
| 333 |
-------------------------------------------------------------------------*/ |
| 334 |
|
| 335 |
int iochan; /* IN : file identifier assigned to disk file */ |
| 336 |
char *pbuf; /* IN : pointer to the buffer to write */ |
| 337 |
int vbn; /* IN : starting virtual block for data transfer */ |
| 338 |
|
| 339 |
{ |
| 340 |
int status; |
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
/* osy_write++; */ |
| 345 |
|
| 346 |
|
| 347 |
if (iochan < 0) |
| 348 |
{ |
| 349 |
int idx; |
| 350 |
|
| 351 |
idx = -1 - iochan; /* recalculate VMEM index */ |
| 352 |
status = MID_VMIO(1,idx,pbuf,(unsigned int)LDB_SIZE,vbn); |
| 353 |
if (status == ERR_NORMAL) return ERR_NORMAL; |
| 354 |
} |
| 355 |
|
| 356 |
else |
| 357 |
{ |
| 358 |
addr = (unsigned int) (vbn - 1); |
| 359 |
addr *= OUR_BLOCK_SIZE; |
| 360 |
|
| 361 |
status = osdofwrite(iochan,addr,pbuf,(unsigned int)LDB_SIZE); |
| 362 |
if (status > 0) return (ERR_NORMAL); |
| 363 |
} |
| 364 |
|
| 365 |
MID_ERROR("OSY","OSY_WLDB",-1,0); |
| 366 |
return (ERR_INPINV); |
| 367 |
} |
| 368 |
/* |
| 369 |
|
| 370 |
*/ |
| 371 |
|
| 372 |
int OSY_RLDB(iochan,pbuf,vbn) |
| 373 |
/*++++++++++++++++++++++++++ Function OSY_RLDB +++++++++++++++++++++++++ |
| 374 |
.PURPOSE read LDB from disk. |
| 375 |
.RETURNS midas error code |
| 376 |
.REMARKS uses the os interface service osdofread. |
| 377 |
-------------------------------------------------------------------------*/ |
| 378 |
|
| 379 |
int iochan; /* IN : file identifier assigned to disk file */ |
| 380 |
char *pbuf; /* IN : pointer to buffer to fill from disk */ |
| 381 |
int vbn; /* IN : starting virtual block for data transfer */ |
| 382 |
|
| 383 |
{ |
| 384 |
int status; |
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
/* osy_read++; */ |
| 389 |
|
| 390 |
|
| 391 |
if (iochan < 0) |
| 392 |
{ |
| 393 |
int idx; |
| 394 |
|
| 395 |
idx = -1 - iochan; /* recalculate VMEM index */ |
| 396 |
status = MID_VMIO(0,idx,pbuf,(unsigned int)LDB_SIZE,vbn); |
| 397 |
if (status == ERR_NORMAL) return ERR_NORMAL; |
| 398 |
} |
| 399 |
|
| 400 |
else |
| 401 |
{ |
| 402 |
addr = (unsigned int) (vbn - 1); |
| 403 |
addr *= OUR_BLOCK_SIZE; |
| 404 |
|
| 405 |
status = osdofread(iochan,addr,pbuf,(unsigned int)LDB_SIZE); |
| 406 |
if (status > 0) return (ERR_NORMAL); |
| 407 |
} |
| 408 |
|
| 409 |
MID_ERROR("OSY","OSY_RLDB",-1,0); |
| 410 |
return (ERR_INPINV); |
| 411 |
} |
| 412 |
/* |
| 413 |
|
| 414 |
*/ |
| 415 |
|
| 416 |
int OSY_TRANSLA(name,sysname,lsysout) |
| 417 |
/*++++++++++++++++++++++++++ Function OSY_TRNLOG +++++++++++++++++++++++++ |
| 418 |
.PURPOSE Do logical name translation. |
| 419 |
.REMARKS uses the os interface service osftranslate. |
| 420 |
.RETURNS |
| 421 |
length of translated name (if > lsysout, sysname not filled) |
| 422 |
< 1 if no translation |
| 423 |
-------------------------------------------------------------------------*/ |
| 424 |
char *name; /* IN: logical file name */ |
| 425 |
char *sysname; /* OUT: physical (system dependant) file name */ |
| 426 |
int lsysout; /* OUT: max. length of sysname */ |
| 427 |
|
| 428 |
{ |
| 429 |
int ret; |
| 430 |
|
| 431 |
char tmp[256]; |
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
/* translate first into temp_buf + get length */ |
| 437 |
|
| 438 |
ret = osftranslate(name,tmp); |
| 439 |
if ((ret > 0) && (ret < lsysout)) |
| 440 |
{ /* fits into result */ |
| 441 |
(void) memcpy(sysname,tmp,(size_t)(ret+1)); |
| 442 |
} |
| 443 |
|
| 444 |
return (ret); |
| 445 |
} |
| 446 |
|
| 447 |
/* |
| 448 |
|
| 449 |
*/ |
| 450 |
|
| 451 |
int OSY_TRNLOG(name,sysname,lsysin,lsysout) |
| 452 |
/*++++++++++++++++++++++++++ Function OSY_TRNLOG +++++++++++++++++++++++++ |
| 453 |
.PURPOSE Do logical name translation. |
| 454 |
.REMARKS uses the os interface service osfphname. |
| 455 |
.RETURNS midas error code |
| 456 |
-------------------------------------------------------------------------*/ |
| 457 |
char *name /* IN: logical file name */; |
| 458 |
char *sysname /* OUT: physical (system dependant) file name */; |
| 459 |
int lsysin /* IN: max. length of sysname */; |
| 460 |
int *lsysout /* OUT: length of sysname */; |
| 461 |
|
| 462 |
{ |
| 463 |
int ret; |
| 464 |
|
| 465 |
|
| 466 |
ret = osfphname(name,sysname); |
| 467 |
if (ret != 0) |
| 468 |
*lsysout = CGN_COPY(sysname,name); |
| 469 |
else |
| 470 |
*lsysout = (int)strlen(sysname); |
| 471 |
|
| 472 |
if ((*lsysout) > lsysin) |
| 473 |
return ERR_INPINV; |
| 474 |
else |
| 475 |
return ERR_NORMAL; |
| 476 |
} |
| 477 |
|
| 478 |
/* |
| 479 |
|
| 480 |
*/ |
| 481 |
|
| 482 |
void OSY_GETSYMB(symbol,resbuf,lrb) |
| 483 |
/*++++++++++++++++++++++++++ Function OSY_GETSYMB +++++++++++++++++++++++++ |
| 484 |
.PURPOSE Do logical name translation. |
| 485 |
.RETURNS midas error code |
| 486 |
.REMARKS uses the os interface service osftranslate |
| 487 |
|
| 488 |
.ALGORITHM |
| 489 |
if no symbol with given name exists, the original string |
| 490 |
(symbol) is copied to the result buffer |
| 491 |
this function is limited to symbols containing strings |
| 492 |
of max. 200 chars (incl '\0') |
| 493 |
|
| 494 |
-------------------------------------------------------------------------*/ |
| 495 |
|
| 496 |
char *symbol; /* IN : logical symbol to be translated */ |
| 497 |
char *resbuf; /* OUT: result buffer */ |
| 498 |
int lrb; /* IN : maximum length of result buffer */ |
| 499 |
|
| 500 |
{ |
| 501 |
int ret; |
| 502 |
|
| 503 |
char tmp[200]; |
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
ret = osftranslate(symbol,tmp); /* translate + get length */ |
| 508 |
if (ret > 0) |
| 509 |
{ |
| 510 |
if (ret < lrb) /* fits into result */ |
| 511 |
(void) memcpy(resbuf,tmp,(size_t)(ret+1)); |
| 512 |
else |
| 513 |
{ |
| 514 |
lrb --; |
| 515 |
(void) memcpy(resbuf,tmp,(size_t)lrb); |
| 516 |
resbuf[lrb] = '\0'; |
| 517 |
} |
| 518 |
} |
| 519 |
else |
| 520 |
{ /* copy original string */ |
| 521 |
lrb --; /* given maxsize includes the '\0' */ |
| 522 |
(void) memcpy(resbuf,symbol,(size_t)lrb); |
| 523 |
resbuf[lrb] = '\0'; |
| 524 |
} |
| 525 |
} |
| 526 |
|
| 527 |
/* |
| 528 |
|
| 529 |
*/ |
| 530 |
|
| 531 |
int OSY_SLEEP(ms,flag) |
| 532 |
/*++++++++++++++++++++++++++ Function OSY_SLEEP +++++++++++++++++++++++++ |
| 533 |
.PURPOSE Sleep for the given amount of ms. |
| 534 |
.RETURNS midas error code |
| 535 |
.REMARKS Uses : ospwait() |
| 536 |
-------------------------------------------------------------------------*/ |
| 537 |
unsigned int ms; /* IN: milliseconds to sleep */ |
| 538 |
int flag; /* IN: = 0, use ospwait, = 1 use ospuwait */ |
| 539 |
|
| 540 |
{ |
| 541 |
|
| 542 |
if (flag != 1) |
| 543 |
{ |
| 544 |
ms -- ; |
| 545 |
return (ospwait((ms / 1000) + 1)); |
| 546 |
} |
| 547 |
else |
| 548 |
{ |
| 549 |
return (ospuwait(ms*1000)); |
| 550 |
} |
| 551 |
} |
| 552 |
|
| 553 |
/* |
| 554 |
|
| 555 |
*/ |
| 556 |
|
| 557 |
int OSY_SPAWN(cmd, phname, procname, maxtime, pid) |
| 558 |
/*++++++++++++++++++++++++++ Function OSY_SPAWN +++++++++++++++++++++++++++ |
| 559 |
.PURPOSE Spawn a subprocess. |
| 560 |
.RETURNS midas error code |
| 561 |
.REMARKS Uses : ospcreate. |
| 562 |
-------------------------------------------------------------------------*/ |
| 563 |
|
| 564 |
int cmd; /* IN: 0 = wakeup father on termination (forgr.) |
| 565 |
1 = set event flag on termination (backgr.) */ |
| 566 |
char *phname; /* IN: Physical name of the file to execute */ |
| 567 |
char *procname; /* IN: Name of process */ |
| 568 |
int maxtime; /* IN: max. no. of seconds to wait, |
| 569 |
= 0, for no timeout */ |
| 570 |
int *pid; /* OUT: pid */ |
| 571 |
|
| 572 |
{ |
| 573 |
|
| 574 |
*pid = ospcreate(phname,procname,cmd,0,1,(unsigned int)maxtime); |
| 575 |
|
| 576 |
if (*pid == -1) |
| 577 |
return (ERR_OPSSYS); |
| 578 |
else |
| 579 |
return (ERR_NORMAL); |
| 580 |
|
| 581 |
} |