Home

pSOSystem System Calls

image

Contents

1. Hex Mnemonic and Description System Call s 0x22 ERR_NOSEG No free segment only if RN_NOWAIT rn_getseg attribute used 0x23 ERR_NOTINRN Segment does not belong to this rn_retseg region 0x24 ERR_SEGADDR Incorrect segment starting ad rn_retseg dress 0x25 ERR_SEGFREE Segment is already unallocated rn_retseg 0x26 ERR_RNKILLD Cannot getseg region deleted rn_getseg while waiting 0x27 ERR_TATRNDEL Informative only there were rn_delete tasks waiting 0x28 ERR_PTADDR Starting address not on long word pt_create boundary 0x29 ERR_BUFSIZE Buffer size not power of 2 or less pt_create than 4 bytes Ox2A ERR_TINYPT Length too small to hold PTCB pt_create 0x2B ERR_BUFINUSE Cannot delete one or more buff pt_delete ers still in use Ox2C ERR_NOBUF Cannot allocate partition out of free pt_getbuf pt_sgetbuf buffers Ox2D ERR_BUFADDR Incorrect buffer starting address pt_retbuf Ox2F ERR_BUFFREE Buffer is already unallocated pt_retbuf 0x30 ERR_KISIZE Global queue maxlen too large for q_vbroadcast KI q_vcreate q_vreceive q_vsend q_vurgent 0x31 ERR_MSGSIZ Message too large q_vsend q_vurgent q_vbroadcast 0x32 ERR_BUFSIZ Buffer too small q_vreceive pt_create pSOSystem System Calls B 9 pSOS Error Codes TABLE B 2 pSOS Error Codes Continued Error Codes
2. Hex Mnemonic and Description System Call s 0x5041 EHOSTUNREACH The destination host could not be send sendto reached from this node sendmsg 0x5046 ENIDOWN NI_INIT returned 1 add_ni 0x5047 ENMTU The MTU is invalid add_ni 0x5048 ENHWL The hardware length is invalid add_ni 0x5049 ENNOFIND The route specified cannot be found chng_route 0x504A ECOLL Collision in select call these conditions have select already been selected by another task 0x504B ETID The task ID is invalid ioctl set_id shr_socket Ox5F01 FAT_INSUFFMEM Insufficient memory allocated by This error originates nc_datasize or Region 0 too small increase in pNA initialization nc_datasize of Region 0 or reduce the number of required data structures specified in the pNA Con figuration Table 0x5F02 FAT_NRT The number of initial routing table entries This error originates specified exceeds nc_nroute Increase nc_nroute in pNA initialization 0x5F03 FAT_NNI The number of initial NI table entries This error originates specified exceeds nc_nni Increase nc_nni in pNA initialization Ox5F04 FAT _NIHSIZE Invalid NI address This error originates in pNA initialization 0x5F05 FAT_NIMTU Invalid MTU for NI This error originates in pNA initialization 0x5F06 FAT_PNAMEM pNA memory error This error originates in pNA initialization 0x5F07 FAT_PNATA
3. Hex Mnemonic and Description System Call s 0x33 ERR_NOQCB Can t allocate QCB exceeds node s q_create q_vcreate active queue maximum 0x34 ERR_NOMGB Cannot allocate private buffers too q_asend q_aurgent few available q_create q_send q_urgent q_vcreate errno_addr 0x35 ERR_QFULL Message queue at length limit q_asend q_aurgent q_avsend q_avurgent q send q urgent q_vsend q_vurgent 0x36 ERR_QKILLD Queue deleted while task waiting q_receive q_vreceive 0x37 ERR_NOMSG Queue empty this error returns q_receive q_vreceive only if O_NOWAIT selected 0x38 ERR_TATODEL Informative only tasks were wait q_delete q_vdelete ing at the queue 0x39 ERR_MATODEL Information only messages were q_delete q_vdelete pending in the queue Ox3A ERR_VARQ Queue is variable length q_asend q_aurgent q_broadcast q_delete q_receive q_send q_urgent 0x3B ERR_NOTVARO Queue is not variable length q_vbroadcast q_vdelete q_vreceive q_vsend q_vurgent q_avsend q_avurgent Ox3C ERR_NOEVS Selected events not pending this er ev_receive ror code is returned only if the EV_NOWAIT at tribute was selected Ox3E ERR_NOTINASR Illegal not called from an ASR as_return 0x3F ERR_NOASR Task has no valid ASR as_send B 10 pSOSystem System Calls Error Codes pSOS Error Codes TABLE B 2 pSOS Error Codes Continue
4. Mnemonic E_ID E_MAXLOOP E_EREMOTE _EIO _EACCESS _ESTALE _ENXIO __ENODEV __EAUTH E_ENFS _ETIMEDOUT __ENOAUTHBLK __ECANTSEND E_ECANTRECV E_PROBUNAVAIL E_EPROGVERSMISMATCH __ECANTDECODEARGS __EUNKNOWNHOST _EPROGNOTREGISTERE E_UNKNOWNPROTO _EINTR ERPC pHILE System Calls Description Illegal device name Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors pSOSystem System Calls pHILE System Calls change_dir Notes 1 The pHILE file system manager does not assume a default current directory Therefore if a task uses relative pathnames it must specify the current directory at least once 2 The input pathname for the new current directory can be a relative pathname In this case it is relative to the current directory before the current directory is changed 3 The pHILE file system
5. truncate_f utime_f write_f write_vol 0x2061 E_NCDVOL Not configured for CD ROM vol cdmount_vol umes 0x2062 E_CDMVOL Multi volume CD ROM not sup cdmount_vol ported 0x2063 E_CDBSIZE Volume not made with 2K block cdmount_vol size 0x2064 E_CDFMT CD format not ISO 9660 compatible cdmount_vol B 26 pSOSystem System Calls Error Codes TABLE B 3 pHILE Error Codes Continued pHILE Error Codes Hex Mnemonic and Description System Call s 0x2070 E_EAUTH Authentication error on server access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f Ilstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f 0x2071 E_ENFS NFS error Portmap error on server access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f pSOSystem System Calls B 27 pHILE Error Codes TABLE B 3 pHILE Error Codes Continued Error Codes Hex Mnemonic and Description System Call s 0x2072 _ETIM
6. 0x300b EPRRW Previous read write cannot setvbuf 0x300d ENAN Invalid floating point number Ox3F01 LC_FAT_CONFIG Insufficient memory to hold pREPC data 0x3F03 LC_FAT_STDIO Cannot open standard I O streams Ox3FOE LC_FAT_CHKSUM Corrupted ROM checksum error B 38 pSOSystem System Calls Error Codes pNA Error Codes B 4 pNA Error Codes When the pNA network manager generates an error an error code is loaded into an internal variable that can be read through the macro errno One errno variable exists for each task If the return value of a pNA system call indicates an error your application should examine the errno variable to determine the cause of the error See the description of errno on page 3 27 for more information Table B 8 lists the error codes of the pNA network manager Each listing includes the error code s hexadecimal number its mnemonic and description and the sys tem calls that can return it The error code mnemonics are also defined in the file lt pna h gt l TABLE B 8 pNA Error Codes Hex Mnemonic and Description System Call s 0x5006 ENXIO No such address ioctl 0x5009 EBADS The socket descriptor is invalid accept bind close connect getpeername getsockname getsockopt ioctl recv recvfrom recvmsg select send sendmsg sendto setsockopt shr_socket shutdown 0x500D EACCESS Permission
7. EDOUT NFS call timed out A server did not respond to a request The requested NFS call timed out Network congestion a server that is down or a hardware problem may be the cause access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f 0x2074 E_ENOAUTHBLK No RPC authorization blocks available access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f B 28 pSOSystem System Calls Error Codes TABLE B 3 pHILE Error Codes Continued pHILE Error Codes Hex Mnemonic and Description System Call s 0x2075 ECANTS END Failure in sending call access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f Ilstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f 0x2076
8. _ ECANTR ECV Failure in receiving result access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f pSOSystem System Calls B 29 pHILE Error Codes TABLE B 3 pHILE Error Codes Continued Error Codes Hex Mnemonic and Description System Call s 0x2077 E_PROGUNAVAIL Program not available access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f 0x2078 E_EPROGVERSMISMATCH mismatched access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f B 30 pSOSystem System Calls Error Codes TABLE B 3 pHILE Error Codes Continued pHILE Error Codes Hex Mnemonic and Description System Cal
9. include lt psos h gt unsigned long t_delete unsigned long tid task identifier Description This service call enables a task to delete itself or another task The pSOS kernel halts the task and reclaims its TCB stack segment and any allocated timers The calling task does not have to be the creator parent of the task to be deleted However a task must be deleted from the node on which it was created Arguments tid Specifies the task ID of the task to be deleted Return Value This call returns 0 on success unless the caller does a self delete in which case the call does not return or returns an error on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Task already deleted 0x06 ERR_OBJID tid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x18 ERR_DELFS pHILE resources in use 0x19 ERR_DELLC pREPC resources in use Ox1A ERR_DELNS pNA resources in use 0x53 ERR_ILLRSC Task not created from this node 1 138 pSOSystem System Calls pSOS System Calls t_delete Notes 1 Ifthe call is to delete self suicide via tid equal to 0 there will be no return 2 Task deletion should be carefully planned and considered Indiscriminate use can lead to unpredictable results especially when resources such as allocated memory segments buffers or semaphores have not been correctly returned If
10. preferred volume block size fundamental volume block size total number of blocks total number of free blocks free blocks available to total of file nodes fea0 ty struct statvfs unsigned long f_bsize unsigned long f_frsize unsigned long f_blocks unsigned long f_bfree unsigned long f_bavail unsigned long f_files unsigned long f_ffree unsigned long f_favail fsid_t f_fsid char f_basetype 16 unsigned long f_flag unsigned long f_namemax char f fstr 32 unsigned long fstype unsigned long f_filler 15 This structure cannot be packed Currently the fields f_ffree f_favail f_fsid f_basetype f_flag f_namemax f_fstr and f_filler are reserved and do not have values For all volumes except pHILE format the field f_files is unused The field f_fstype identifies the type of file system format The values in lt phile h gt are given below ESTYPE_PHILE FS YPE_PCDOS ESTYPE_CDRO Y PE_NFS reserved reserved reserved reserved reserved reserved reserved not not not not not not not pHILE files only supported supported supported supported supported supported supported iA af wy AI Ef i file system type number reserved not supported pHILE format volume MS DOS format volume CD ROM format volume Client NFS volume The return value for a
11. write permission group execute search permission group read permission other write permission other execute search permission other This system call returns 0 on success or an error code on failure pSOSystem System Calls 2 105 stat_f Error Codes Hex 0x2003 0x200C 0x200D 0x2025 0x2051 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 2 106 Mnemonic F I __BADVOL E bi bi bi AXLOOP EREMOTE _EIO _ EACCES ETIMEDOUT ENOAUTHBLK ECANTSEND _ ECANTRECV PROBUNAVAIL EPROGVERSMISMATCH _ ECANTDECODEARGS EUNKNOWNHOST EPROGNOTREGISTERED bi UNKNOWNPROTO _EINTR pHILE System Calls Description Inconsistent data on volume volume corrupted Illegal pathname No default directory Illegal device name Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are availabl
12. include lt pna h gt void pna_freeb bp mblk_t bp Description pna_freeb deallocates a specified message block This function decrements the reference to the data buffer It then deallocates the data block and the associated data buffer when no more references to them exist If the data buffer is user supplied see pna_esballoc the user supplied free routine is called when no more references to the data buffer exist Arguments bp Points to the message block to be deallocated Return Value None Error Codes None See Also pna_allocb pna_esballoc pna_freemsg pSOSystem System Calls 4 43 pna_freemsg pNA System Calls pna_freemsg Frees all message blocks associated with a message include lt pna h gt void pna_freemsg bp mblk_t bp Description pna_freeb frees all the message blocks and data blocks associated with the specified message This routine calls the pna_freeb routine to free individual message blocks Arguments bp Points to the message to be freed Return Value None Error Codes None See Also pna_allocb pna_esballoc pna_freeb 4 44 pSOSystem System Calls pNA System Calls recv Receives data from a socket recy include lt pna h gt long recv int s char buf int len int flags Description socket packet packet packet descriptor length attributes The recv system call is used to receive
13. 2 91 read_dir pHILE System Calls Notes Primary Volume Descriptor As a special case on CD ROM volumes the filename _VOLUME Y in the root directory is used to read the primary volume descriptor Therefore _VOLUME Y is returned as one of the entries of the root directory Refer to the description of open_f on page 2 78 for details See Also open_dir close dir 2 92 pSOSystem System Calls pHILE System Calls read _f read_f Reads from a file include lt phile h gt unsigned long read_f unsigned long fid file identifier void buffer input buffer unsigned long bcount byte read count unsigned long tcount read count status Volume Types All volume types Description read_f reads data from a file beginning at the current position of the connection s L_ptr After read_f the file s L_ptr is updated to point to the byte after the last byte that was read Arguments fid Specifies the file identifier associated with the file buffer Points to the memory area to receive the data bcount Specifies the number of bytes to read tcount Points to the variable where read_f stores the number of bytes actually read The tcount value equals bcount unless the end of file was reached or an error occurred Return Value This system call returns 0 on success or an error code on failure pSOSystem System Calls 2 93 read_f Error Codes 2 94 Hex 0x2003
14. Description The intended purpose of this system call is to enable the calling task to obtain the queue ID of an ordinary message queue However since a variable length message queue is just a special type of message queue q_ident and q_vident are functionally identical Both return the queue ID of the first queue encountered with the specified name whether it be ordinary or variable length Most system calls except q_create q_vcreate and q_ident q_vident reference a queue by its queue ID For other tasks one way to obtain the queue ID is to use q_ident q_vident Once obtained the queue ID can then be used in all other operations relating to this queue Arguments name Specifies the name of the message queue node For multiprocessing systems is a search order specifier See Multiprocessor Considerations In a single node system this argument must be 0 qid Points to the variable where q_ident stores the ID of the named message queue Return Value The system call returns 0 on success or an error code on failure pSOSystem System Calls 1 79 q_ident pSOS System Calls Error Codes Hex Mnemonic Description 0x04 ERR_NODENO Node specifier out of range 0x09 ERR_OBJNF Named queue not found Notes 1 Internally the pSOS kernel treats a queue name as a 32 bit integer However when the application calls the kernel through the pSOS C language API it passes the queue name as a four byte
15. See Also db_output 6 4 pROBE and ESp System Calls Description Lost connection to host debugger pSOSystem System Calls pROBE and ESp System Calls db_output db_outp ut Outputs a string to the high level debugger long db_output char str string unsigned long length string length Description This system call sends a character string to the high level debugger HLD to be printed on its output screen Arguments str Points to the string to be output to the HLD length Specifies the length of the string Return Value This call returns 0 on success and an error code on failure Error Codes Hex Mnemonic Description Not set at this time None Lost connection to host debugger See Also db_input pSOSystem System Calls 6 5 log_event pROBE and ESp System Calls log_event Logs an event on ESp s target resident application monitor pMONT unsigned long log_event unsigned long user_event_id user defined event ID unsigned long event_data user defined event data Description This call logs an event in pMONT s trace buffer The log_event call takes effect when the ESp data collection run begins Arguments user_event_id Specifies an ID number for the current call to log_event The maximum allowable ID number is Oxff Providing an ID number for each call to log_event helps you keep track of user events event_data An optional word or words you ca
16. include lt phile h gt unsigned long truncate_ f char name file pathname unsigned long length file size in bytes Volume Types pHILE MS DOS and NFS volumes Description truncate_f causes the file specified by name to have a size in bytes equal to length If the file was previously longer than length the extra bytes are truncated If it was shorter the bytes between the old and new lengths are filled with zeroes Unlike annex_f this system call changes both the logical and the physical file size annex_f changes only the physical file size On pHILE or MS DOS volumes the file must not be open If this is violated the error E_FOPEN is returned Arguments name Points to the null terminated pathname of the file length Specifies the new file size in bytes Return Value This system call returns 0 on success or an error code on failure pSOSystem System Calls 2 117 truncate_f Error Codes 2 118 Hex 0x2001 0x2003 0x200C 0x200D 0x2015 0x201C 0x201D 0x2022 0x2025 0x2051 0x2052 0x2054 0x2055 0x2057 0x2058 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072 0x2074 Mnemonic E_FUNC E_BADVOL E_IFN E_NDD E_RO E_ININFULL E_VFULL E_ LOCKED E_ID E_MAXLOOP E_EREMOTE E IO E_EACCES E_EQUOT E_ESTALE E_ENXIO E_ENODEV E_BADCD E_EAUTH E_ENFS
17. which lists the codes numerically and gives the pSOSystem calls that are associated with each one 6 1 6 2 pROBE and ESp System Calls pSOSystem System Calls pROBE and ESp System Calls db_input db_input Prompts and gets input from the high level debugger long db_input char inbuf user input buffer unsigned long inbuf_len user input buffer length char prompt prompt string unsigned long prompt_len prompt string length unsigned long nbytes number of bytes written Description This system call passes the string prompt to the high level debugger HLD to be printed on the output screen and waits for input back from the HLD Upon receipt of the input it copies up to inbuf_len bytes into inbuf and writes inbuf s length into nbytes Arguments inbuf Points to the buffer in which db_input writes input from the HLD inbuf_len Specifies the number of bytes of input data to be written in inbuf prompt Points to the string to be passed to the HLD as a prompt prompt_len Specifies the number of characters in prompt nbytes Points to the buffer in which db_input writes the actual length of inbuf Target For 68K processors with MRI host tools this system call is not 68K MRI supported Return Value This call returns 0 on success and an error code on failure pSOSystem System Calls 6 3 db_input Error Codes Hex Mnemonic Not set at this time None
18. 1 20 de_write pSOSystem System Calls pSOS System Calls de_write de_write Writes to an I O device include lt psos h gt unsigned long de_write unsigned long dev major minor device number void iopb 1 0 parameter block address void retval return value Description The de_write call is used to write to a device It invokes the device write routine of a pSOS device driver specified by the dev argument This service normally requires the additional parameters contained in the I O parameter block such as the address of the user s output data and the number of data units to write Arguments dev Specifies the major and minor device numbers which are stored in the upper and lower 16 bits respectively iopb Points to an I O parameter block the contents of which are driver specific retval Points to a variable that receives a driver specific value returned by the driver the actual number of data units written for example Return Code This call returns 0 on success or an error code on failure Besides the error codes listed below other driver specific errors can be returned pSOSystem System Calls 1 21 de_write pSOS System Calls Error Codes Hex Mnemonic Description 0x101 ERR_IODN Illegal device major number 0x102 ERR_NODR No driver provided 0x103 ERR_IOOP Illegal I O function number Notes For many interrupt driven devices de_write starts an I O transaction and blo
19. 2 Once restarted a task can actively compete for the CPU and all other system resources Thus it can preempt the calling task if it has a higher priority Multiprocessor Considerations None A task can be restarted from the local node only Callable From m Task See Also t_create t_start t_delete pSOSystem System Calls 1 151 t resume pSOS System Calls t resume Resumes a suspended task include lt psos h gt unsigned long t_resume unsigned long tid task identifier Description This system call removes the suspension of a task If the task was suspended while in the ready state t_resume releases it to be scheduled for execution If the task was both suspended and blocked for example waiting for a message t_resume removes only the suspension This leaves the task in the blocked state Arguments tid Specifies the task ID of the task Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Task already deleted 0x06 ERR_OBJID tid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x15 ERR_NOTSUSP Task not suspended 0x65 ERR_STALEID Object s node has failed Notes The calling task can be preempted as a result of this call 1 152 pSOSystem System Calls pSOS System Calls t_ resume Multiprocessor Considerations If tid
20. 5 When the RN_DEL attribute is specified a region can be deleted while segments are outstanding otherwise the pSOS kernel requires all segments to be returned before the region can be deleted Multiprocessor Considerations Regions are strictly local resources and cannot be exported Therefore any allocation calls must come only from the local node However if a region s memory is reachable from other nodes then any segments allocated from it can be passed between nodes for direct access explicitly by the user s code Callable From a Task See Also rn_ident rn_getseg pSOSystem System Calls 1 109 rn_delete pSOS System Calls rn_delete Deletes a memory region include lt psos h gt unsigned long rn_delete unsigned long rnid region ID Description This system call deletes the memory region with the specified region ID Unless the region was created with the RN_DEL attribute set rn_delete is rejected if any segments allocated from the region have not been returned The calling task does not have to be the creator of the region to be deleted Arguments rnid Specifies the region ID of the region to be deleted Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Region already deleted 0x06 ERR_OBJID rnid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match
21. SIOCGIPFORWARDING SIOCGIPDEFAULTTTL SIOCGIPINRECEIVES SIOCGIPINHDRERRORS SIOCGIPINADDRERRORS SIOCGIPFORWDATAGRAMS SIOCGIPINUNKNOW SIOCGIPINDIS CARDS SIOCGIPINDE sIVERS SIOCGIPOUTRE QUEST SIOCGIPOUTDI SCARD SIOCGIPOUTNO ROUTE PROTOS S S S SIOCGIPREAS SIOCGIPREAS REQDS SIOCGIPREAS SIOCGIPREAS SIOCGIPFRAGO SIOCGIPFRAGE FATLS KS AILS SIOCGIPFRAGC SIOCGIPROUTINGDISCARDS SET Command Defi REATE nitions SIOCSIPFORWARDING SIOCSIPDEFAU LTTTL TIMEOUT S SIOCSIPREASMTIMEOUT pSOSystem System Calls ioctl IP gateway indication variable IP header default time to live value Input datagrams received from interfaces Drops due to format errors Drops due to invalid addresses IP datagrams forwarded IP datagrams discarded due to unknown protocol Input datagrams discarded with no prob lems Datagrams delivered to IP user protocols Datagrams supplied by IP user protocols Outbound datagrams discarded IP datagrams dropped due to no routes IP reassembly queue timeout IP fragments needing reassembly IP fragments reassembled IP fragments reassembly failures IP datagrams successfully fragmented IP datagram fragmentation failures IP fragments created IP Routing entities discarded IP gateway indication variable IP header defa
22. Volume Types pHILE formatted volumes Description lock_f locks or unlocks part or all of an open file Following a lock_f system call only the task that set the lock can access the locked bytes and only through the connection the file identifier used to set the lock A lock_f call replaces any previous locks it set through the same connection with the new lock Thus only one lock per connection can be set lock_f with bcount 0 is used to remove a lock A file can have as many locks as it has connections if the locks do not overlap If a task attempts to lock a region already locked through a different connection an error is returned even if the two connections are from the same task Arguments fid Specifies the file identifier of the file to lock startpos Specifies the starting byte of the locked region bcount Specifies the length of the locked region in bytes Return Value This system call returns 0 on success or an error code on failure 2 56 pSOSystem System Calls pHILE System Calls Error Codes Hex 0x2015 0x201A 0x201B 0x2022 0x2026 0x2050 0x2060 Notes Mnemonic E E FIDBIG FIDOFE BADMS _ BADNFS _ BADCD lock_f Description Requested operation not allowed on this file Invalid FID exceeds maximum Invalid FID file closed Data locked MS DOS volume illegal operation NFS volume illegal operation CD ROM volume illegal ope
23. j Specifies the long integer to be converted Return Value labs returns the absolute value Error Codes None Notes Callable From m Task m ISR See Also labs 3 86 pSOSystem System Calls pREPC System Calls Idiv Idiv Performs a division operation on two specified long integers include lt stdlib h gt ldiv_t ldiv long numer numerator long denom denominator Description The ldiv function computes the quotient and remainder of the division of the numerator numer by the denominator denon If the division is inexact the resulting quotient is the integer of lesser magnitude that is the nearest to the algebraic quotient If the result cannot be represented the behavior is undefined otherwise quot denom remis equal to numer Arguments numer Specifies the numerator denom Specifies the denominator Return Value The ldiv function returns a structure of type 1div_t This structure is defined in stdlib h as follows typedef struct long quot the quotient long rem the remainder ldiv_t Error Codes None pSOSystem System Calls 3 87 Idiv Notes Callable From m Task m ISR See Also div 3 88 pREPC System Calls pSOSystem System Calls pREPC System Calls localeconv localeconv Obtains the current locale settings include lt locale h gt struct lconv localeconv void Description The localeconv function o
24. q_vcreate psOS Creates a variable length message queue 1 91 q_vdelete psOS Deletes a variable length message queue 1 94 q_vident pSOS Obtains the queue ID of a variable length 1 96 message queue q_vreceive psOS Requests a message from a variable length 1 98 message queue q_vsend psOS Posts a message to a specified variable 1 101 length message queue q_vurgent pSOS Posts a message at the head of a variable 1 104 length message queue gsort pREPC Sorts an array in ascending order 3 120 rand pREPC Returns a pseudo random number 3 122 read_dir pHILE Reads directory entries in a file system inde 2 90 pendent format read_f pHILE Reads from a file 2 93 read_link pHILE Reads the value of a symbolic link 2 96 read_vol pHILE Reads directly from a pHILE formatted vol 2 99 ume pSOSystem System Calls A 9 All pSOSystem System Calls Tables of System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page realloc pREPC Allocates memory 3 123 recv pNA Receives data from a socket 4 45 recvfrom pNA Receives data from a socket 4 48 recvmsg pNA Receives data from a socket 4 51 remove pREPC Removes a file 3 125 remove_ f pHILE Deletes a file 2 101 rename pREPC Renames a file 3 126 rewind pREPC Resets the file position indicator 3 128 rn_create psOS Creates a memory region 1 1
25. stores the number of tasks readied by the broadcast This system call returns O on success or an error code on failure Error Codes Hex 0x05 0x06 Os07 1 88 Mnemonic ERR_OBJDEL ERR_OBJID ERR_OBJTYPE Description Queue has been deleted qid is incorrect failed validity check Object type doesn t match object ID failed validity check pSOSystem System Calls pSOS System Calls q_vbroadcast Notes Hex Mnemonic Description 0x30 ERR_KISIZE Message buffer length exceeds max KI packet buffer length 0x31 ERR_MSGSIZ Message is too large 0x3B ERR_NOTVARO Queue is not variable length 0x65 ERR_STALEID Object s node has failed 1 Ifthe caller is a task it may be preempted as a result of this call 2 q_vbroadcast can be intermixed with q_vsend and q_vurgent calls to the same queue 3 The pSOS kernel must copy the message from the caller s buffer to a receiving task s buffer Longer messages take longer to copy Users should account for the copy time in their designs especially when calling from an ISR 4 q_vbroadcast sends messages to a variable length message queue Use q_broadcast to send messages to an ordinary queue Multiprocessor Considerations 1 If gid identifies a global queue residing on another processor node the local kernel will internally make an RSC to that remote node to post the input message to that queue If tasks awakened by this call do
26. struct in_addr sin_addr 32 bit IP address char sin_zero 8 must be 0 This structure cannot be packed Points to an integer equal to 16 which is the size in bytes of the sockaddr_in structure If this call succeeds it returns a non negative integer that is a descriptor for the accepted socket It returns 1 on error Error Codes Hex 0x5009 0x5017 0x5016 0x5023 0x5034 0x5037 0x502D See Also bind Mnemonic EBADS ENE ILE EINVALID EWO ECO ENO EOP connect listen select pSOSystem System Calls ULDBLOCK NABORTED BUFS OTSUPP Description The socket descriptor is invalid An internal table has run out of space An argument is invalid This operation would block and the socket is marked non blocking The connection has been aborted by the peer An internal buffer is required but can not be allocated The requested operation is not valid for this type of socket socket 4 3 add_ni add ni Adds a network interface pNA System Calls include lt pna h gt long add_ni struct ni_init ni network interface Description This system call is used to dynamically add a network interface to the pNA network manager The characteristics of the network interface are specified in the data structure pointed to by ni This routine calls the network interface driver s NI_INIT routine for driver
27. write permission owner S_IXUSR 0000100 execute search permission owner S_IRGRP 0000040 read permission group S_IWGRP 0000020 write permission group S_IXGRP 0000010 execute search permission group S_IROTH 0000004 read permission other S_IWOTH 0000002 write permission other S_IXOTH 0000001 execute search permission other Return Value This system call returns 0 on success or an error code on failure 2 36 pSOSystem System Calls pHILE System Calls Error Codes Hex 0x201A 0x201B 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E pSOSystem System Calls Mnemonic E I FIDBIG Fi E FIDOFF EREMOTE EIO ETIMEDOUT ENOAUTHBLK _ ECANTSEND _ ECANTRECV PROBUNAVAIL EPROGVERSMISMATCH ECANTDECODEARGS EUNKNOWNHOST EPROGNOTREGISTERE UNKNOWNP ROTO EINTR PC fstat_f Description Invalid file ID out of range Invalid file IDE file not open Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device RPC authorization is not availa
28. 0x200E E_FORD Directory file expected 0x2010 E_NODE Null pathname 0x2011 E_FEXIST File already exists 0x2012 E_FLIST Too many files on volume 0x2015 E_RO Operation not allowed on read only system files directories or mounted volumes 0x201C E_ININFULL Index block full 0x201D E_VFULL Volume full 0x2025 E_ID Illegal device name 0x2051 E_MAXLOOP Symbolic links nested too deeply 0x2052 E_EREMOTE Too many levels of remote in path 0x2054 E_EIO A hard error happened at remote site 0x2055 E_EACCES Task does not have access permissions 2 66 pSOSystem System Calls pHILE System Calls Hex 0x2057 0x2058 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E Notes Mnemonic EQUO I _ENXI _ ESTALE O __E NODE V E_BADC _ EAUT _ ENFS D H _ETIM EDOUT _ ENOA UTHBLK __ECAN TSEND __ECAN TRECV PROB za UNAVAIL EPRO GVERSMISMATCH ECAN TDECODEARGS EPRO E_UNKN ERPC EUNKNOWNHOST GNOTREGISTERE OWNPROTO EINTR make_dir Description Quota exceeded Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS c
29. EUNKNOWNHOST EPROGNOTREGISTERED E_UNKNOWNPROTO EINTR ERPC stat_f fstat_f open_f pHILE System Calls Description Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors chown_f fchown_f pSOSystem System Calls pHILE System Calls chown_f chown_f Changes the owner or group of a named file include lt phile h gt unsigned long chown_f char name file pathname int owner new user ID int group new group ID Volume Types NFS formatted volumes Description chown_f changes the owner and group of a file specified by name Arguments name Points to a null terminated pathname of either an ordinary file or a directory file owner Specifies the user ID of the new owner group Specifies the group ID of the new group User ID and group ID are UNIX terms used to identify a user and a file access group on a UNIX system Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2001 E_FUNC pHILE format volume illegal operation 0x200C E_IFN Illegal pathname pSOSystem System Calls 2 19 chown_f Hex 0x200D 0x2015 0x2025 0x2026 0x2051 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072
30. Error Codes None See Also pna_esballoc pna_freeb pna_freemsg 4 40 pNA System Calls pSOSystem System Calls pNA System Calls pna_esballoc pna_esballoc Attaches a message block to the data buffer include lt pna h gt mblk_t pna_esballoc buffer size pri frtn unsigned char buffer int size int pri frtn_t frtn Description pna_esballoc allocates and attaches a message block to the user supplied data buffer it uses a zero sized data block to attach the message block to the data buffer Arguments buffer Points to the user supplied data buffer size Specifies the size of buffer pri Unused by the pNA memory manager frtn Points to the free_rtn structure which specifies a free routine and an argument to the free routine The free routine is called by the pNA memory manager when the user specified data buffer is being freed The free_rtn structure is defined in lt pna h gt as fol lows struct free_rtn void free_func User free routine void free_arg Argument to free routine typedef struct free_rtn frtn_t Return Value This system call returns a pointer to the message block if successful otherwise it returns a null pointer pSOSystem System Calls 4 41 pna_esballoc Error Codes None See Also pna_allocb pna_freeb pna_freemsg 4 42 pNA System Calls pSOSystem System Calls pNA System Calls pna_freeb pna_freeb Frees a message block
31. If a datagram socket is specified connect associates the socket with the socket address supplied This address is used by future send calls to determine the datagram s destination This is the only address from which datagrams can be received If a raw socket is specified connect associates the socket with the socket address supplied This address is used by future send calls to determine the datagram s destination This is the only address from which datagrams can be received Arguments s Specifies the local socket pSOSystem System Calls 4 9 connect addr addrlen Return Value pNA System Calls Points to a sockaddr_in structure that contains the address of the foreign socket The structure sockaddr_in is defined as follows struct sockaddr_in short sin_family unsigned short sin_port struct in_addr sin_addr char sin_zero 8 must be AF_INET 16 bit port number 32 bit IP address must be 0 This structure cannot be packed Specifies the size in bytes of the sockaddr_in structure and must be 16 This system call returns 0 if successful otherwise it returns 1 Error Codes 4 10 Hex 0x5009 0x5016 0x5024 0x5025 0x502F 0x5030 0x5031 0x5037 0x5038 0x503C 0x503D Mnemonic EBADS EADDD EADDR EINVALID EINPROGRESS EALREADY EAFNOSUPPORT RINUSE OTAVAIL EISCO ENOBUE S
32. Notes Callable From a Task m ISR See Also ldiv 3 26 pREPC System Calls pSOSystem System Calls pREPC System Calls errno errno The error number returned by the last failing system call include lt errno h gt int errno Description The errno is a macro which expands to a modifiable 1value that has type int Its value can be set to a positive number by several library or system calls The macro is defined in the header file errno h It returns the error number from the last failing system call or library function If the macro definition is suppressed by using undef pre processor directive or an application defines an identifier with the name errno the behavior is undefined The value of errno is zero at task startup but is never set to zero by any library function or system service Return Value This macro returns the current value of errno for the calling task Error Codes Refer to Appendix B Notes errno generates a call to the pSOS errno_addr system service Callable From a Task pSOSystem System Calls 3 27 exit pREPC System Calls exit Terminates a task include lt stdlib h gt void exit int status termination status Description The exit macro terminates the task that invokes it exit prints an error message on the task s standard error stream if a non zero status is passed to it It then executes the task exit sequence described in t_del
33. POP EAX POP ES POP DS INT 93H PERFORM RETURN On Super Hitachi processors an ISR must restore all CPU registers including the stack pointer to their state prior to the interrupt Below is a sample code fragment for an ISR that internally uses CPU registers rO rl r2 and r3 mov 1 r3 sp mov 1 r2 sp mov 1 rl sp mov 1 r0 sp lt body of ISR gt mov l spt ro mov 1 sp rl mov 1 sp t r2 mov 1 spt r3 trapa 45 pSOSystem System Calls pSOS System Calls i_return Return Value This system call never returns to the caller Notes i_return should not be used anywhere other than to exit an ISR Multiprocessor Considerations None This call can be directed at the local processor node only Callable From m ISR pSOSystem System Calls 1 39 k_fatal pSOS System Calls k_fatal Aborts and enters fatal error handling mode include lt psos h gt void k_fatal unsigned long err_code user s error code unsigned long flags fatal condition attributes Description This system call allows the user application to pass control to the user defined fatal error handler in the event of a nonrecoverable failure k_fatal forces a nonrecoverable shutdown of the pSOS environment and never returns to the caller Arguments err_code Specifies a user defined failure code that is passed to the fatal error handler The failure code must be at least 0x20000000 flags The flags
34. Refer to Appendix B Notes Callable From a Task m ISR See Also isprint pSOSystem System Calls 3 79 islower pREP C System Calls islower Tests for a lowercase letter include lt ctype h gt int islower int c character Description This function tests the value in c converted to an unsigned char to see if it is a lowercase letter Arguments c Specifies the value to be tested Return Value This function returns a nonzero value if the test result is true It returns a O if the result is false Error Codes Refer to Appendix B Notes Callable From m Task ISR See Also isupper isalpha 3 80 pSOSystem System Calls pREPC System Calls isprint Tests for a printable character isprint include lt ctype h gt int isprint int c character Description This function tests the value in c converted to an unsigned char to see if it is an ASCII printable character An ASCII printable character is any character that is not a control character Their values lie between 32 space and 126 tilde inclusive Arguments Specifies the value to be tested Return Value This function returns a nonzero value if the test result is true It returns a O if the result is false Error Codes Refer to Appendix B Notes Callable From a Task a ISR See Also isgraph iscntrl pSOSystem System Calls 3 81 ispunct pREP C System Calls ispunct Te
35. SO_RE US EPORT SO_SNDBUF pSOSystem System Calls Allows broadcast datagrams on a socket Indicates that the outgoing data should not be routed Pack ets directed at unconnected nodes are dropped Maintains a connection by periodically transmitting a packet over socket s Controls the action taken when unsent messages are queued on a socket and a close is executed If the socket is a stream socket and SO_LINGER is set 1_onoff set to 1 the calling task blocks until it is able to transmit the data or until a timeout oc curs If SO_LINGER is disabled 1_onoff set to 0 the socket is deleted immediately SO_LINGER uses the linger structure which is defined in lt pna h gt as follows struct linger int l_onoff on off option int l_linger linger time in seconds This structure cannot be packed Requests that out of band data be placed in the normal data input queue as it is received it becomes accessible through recv calls without the MSG_OOB flag Adjusts the normal allocated input buffer size The buffer size can be increased for high volume connections or de creased to limit the possible backlog of data The pNA net work manager limits this value to 32 Kbytes Indicates that local addresses can be reused in a bind call Indicates that local addresses can be reused in a bind call For more information see section 4 4 3 of the Network Programming chapter in pSOSystem S
36. See Also q_send q_vreceive pSOSystem System Calls 1 83 q_send pSOS System Calls q_send Posts a message to an ordinary message queue include lt psos h gt unsigned long q_send unsigned long qid queue identifier unsigned long msg_buf 4 message buffer Description This system call is used to send a message to a specified ordinary message queue If a task is already waiting at the queue the message is passed to that task which is then unblocked and made ready to run If no task is waiting the input message is copied into a message buffer from the system pool or if the queue has private buffers into a private message buffer which is then put in the message queue behind any messages already posted to the queue Arguments qid Specifies the queue ID of the target queue msg_buf Specifies the message to send Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Queue has been deleted 0x06 ERR_OBJID gid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x34 ERR_NOMGB Out of system message buffers 0x35 ERR_QFULL Message queue at length limit 1 84 pSOSystem System Calls pSOS System Calls q_send Hex Mnemonic Description Ox3A ERR_VARQ Queue is variable length Ox65 ERR_STALEID Object s node has failed Notes 1 If the c
37. Volume is full Data is locked Too many levels of remote in path A hard error happened at remote site Task does not have access permissions Illegal operation on a directory Quota exceeded Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched 2 143 write_f pHILE System Calls Hex Mnemonic Description 0x2079 E_ECANTDECODEARGS Decode arguments error Ox207A E_EUNKNOWNHOST Unknown host name 0x207B E_EPROGNOTREGISTERED Remote program is not registered Ox207C E_UNKNOWNPROTO Unknown protocol 0x207D E_EINTR Call interrupted Ox207E ERPC All other RPC errors Notes On pHILE and MS DOS volumes write_f operations are more efficient if bcount is an integral multiple of the block size and the L_ptr is positioned at a block boundary 2 On pHILE and MS DOS volumes if the requested data includes either entire blocks or a contiguous sequence of blocks and if such blocks are not already in the buffer cache the pHILE file system manager writes these blocks directly from the user s buffer without going through the buffer cache 3 write_f automatically positions the
38. Volume not mounted Filename not found Illegal pathname No default directory Directory file expected Illegal expansion unit Null pathname File already exists Too many files on volume Operation is not allowed on read only system files directories or mounted volumes Index block is full Volume is full Illegal device name Symbolic links are nested too deeply Too many levels of remote in path A hard error occurred at remote site pSOSystem System Calls pHILE System Calls create f Hex Mnemonic Description 0x2055 E_EACCES Task does not have access permissions 0x2057 E_EQUOT Quota exceeded 0x2058 E_ESTALE Stale NFS file handle 0x205B E_ENXIO No such device or address 0x205C E_ENODEV No such device 0x2060 E_BADCD CD ROM volume illegal operation 0x2070 E_EAUTH RPC authorization is not available 0x2071 E_ENFS Portmap failure on the host 0x2072 E_ETIMEDOUT NFS call timed out 0x2074 E_ENOAUTHBLK No RPC authorization blocks available 0x2075 E_ECANTSEND Failure in sending call 0x2076 E_ECANTRECV Failure in receiving result 0x2077 E_PROBUNAVAIL Program not available 0x2078 E_EPROGVERSMISMATCH Program version mismatched 0x2079 E_ECANTDECODEARGS Decode arguments error 0x207A E_EUNKNOWNHOST Unknown host name 0x207B E_EPROGNOTREGISTERED Remot
39. call fails and the node s MC_ASYNCERR routine is present that routine is invoked The following error codes are possible Hex Mnemonic Description 0x05 ERR_OBUDEL Semaphore has been deleted 0x06 ERR_OBJID smid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check If an MC_ASYNCERR routine is not provided the pSOS m kernel generates a fatal error pSOSystem System Calls 1 119 sm_av pSOS System Calls Notes The calling task can be preempted as a result of this call Multiprocessor Considerations 1 If smid identifies a global semaphore residing on another processor node the pSOS kernel internally makes an RSC to that remote node to release the semaphore 2 If the task awakened by this call does not reside on the local node then the pSOS m kernel internally alerts the task s node of residence whose pSOS m kernel will ready the task and give it the acquired semaphore token Thus an sm_v call whether it is to either the local or a remote semaphore may cause pSOS m activities on another processor node Callable From m Task See Also sm_v sm p 1 120 pSOSystem System Calls pSOS System Calls sm_create sm_create Creates a semaphore include lt psos h gt unsigned long sm create char name 4 semaphore name unsigned long count number of tokens unsigned long flags semaphore attributes unsigned long smid sem
40. call is made See Also q_send q_receive q_vbroadcast pSOSystem System Calls 1 73 q_create q_create pSOS System Calls Creates an ordinary message queue include lt psos h gt unsigned long q_create char name 4 queue name unsigned long count queue size unsigned long flags queue attributes unsigned long qid queue identifier Description This system call creates an ordinary message queue by allocating and initializing a Queue Control Block QCB according to the specifications supplied with the call Like all objects a queue has a user assigned name and a pSOS assigned queue ID returned by q_create Several flag bits specify the characteristics of the message queue Tasks can wait for messages either by task priority or strictly FIFO and a limit can be optionally set on the maximum number of messages that can be simultaneously posted at the queue Arguments name count flags 1 74 Specifies the user assigned name of the new message queue If Q_LIMIT is set see flags below then the count argument specifies the maximum number of messages that can be simultaneously posted at the queue If O_PRIBUF is also set then the argument count also specifies the number of buffers set aside from the system wide pool of message buffers for the private use of this queue If Q_NOLIMIT is set count is ignored Specifies the attributes of the queue flags is formed by OR ing the fol
41. functions the same as chown_f except it changes the owner or group of a file by its file identifier instead of its pathname The file identifier is first obtained with open_f Arguments fid Specifies the file identifier associated with the file owner Specifies the user ID of the new owner group Specifies the group ID of the new group Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2001 E_FUNC pHILE format volume illegal operation 0x2015 E_RO Operation not allowed on read only system files directories or mounted volumes 2 32 pSOSystem System Calls pHILE System Calls fchown_f Hex Mnemonic Description 0x201A E_FIDBIG Invalid file ID out of range 0x201B E_FIDOFE Invalid file ID file not open 0x2026 E_BADMS MS DOS volume illegal operation 0x2052 E_EREMOTE Too many levels of remote in path 0x2054 E_EIO A hard error occurred at a remote site 0x2055 E_EACCES Task does not have access permissions 0x2058 E_ESTALE Stale NFS file handle 0x205B E_ENXIO No such device or address 0x205C E_NODEV No such device 0x2060 E_BADCD CD ROM volume illegal operation 0x2070 E_EAUTH RPC authorization is not available 0x2071 E_ENFS Portmap failure on the host 0x2072 E_ETIMEDOUT
42. include lt stdarg h gt include lt stdio h gt int feof FILE stream stream pointer Description The feof function tests the end of file indicator for the stream pointed to by stream Arguments stream Points to an open pREPC stream Return Value This function returns a nonzero number if the end of file indicator is set for stream and zero if it is not set Error Codes Refer to Appendix B Notes Callable From m Task 3 32 pSOSystem System Calls pREPC System Calls ferror ferror Tests a stream s error indicator include lt stdarg h gt include lt stdio h gt int ferror FILE stream stream pointer Description This function tests the error indicator for the stream pointed to by st ream Arguments stream Points to an open pREPC stream Return Value This function returns a nonzero number if the error flag is set and zero if it is not set Error Codes Refer to Appendix B Notes Callable From a Task pSOSystem System Calls 3 33 fflush pREPC System Calls fflush Flushes the buffer associated with an open stream include lt stdarg h gt include lt stdio h gt int fflush FILE stream stream pointer Description The fflush function writes any unwritten buffered data associated with the stream pointed to by stream to the file or I O device An error is returned if the stream has not been opened for write or update If strea
43. 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E pSOSystem System Calls Mnemonic E_IDN E_BADMS E_MAXLOOP EREMOTE EIO _ EACCES EQUOT _ ESTALE _ ENXIO _ ENODEV E_BADCD _ EAUTH _ ENFS TIMEDOUT _ ENOAUTHBLK _ ECANTSEND _ ECANTRECV E_PROBUNAVAIL EPROGVERSMISMATCH ECANTDECODEARGS EUNKNOWNHOST EPROGNOTREGISTERED E_UNKNOWNPROTO EINTR ERPC symlink_f Description Illegal device name MS DOS volume illegal operation Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Quota exceeded Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors 2 113 symlink_f pHILE System Calls See Also read_link link_f remove_f 2 114 pSOSystem System Calls pHILE System Calls sync_vol Sy
44. 0x5006 0x5009 0x5011 0x5016 0x502D 0x504B 0x5037 See Also socket Mnemonic ENXIO EBADS EEXIST EINVALID EOPNOTSUPP ETID ENOBUFS setsockopt getsockopt pSOSystem System Calls Description No such address Invalid socket descriptor Requested to duplicate an existing en try Invalid argument Requested operation not valid for this type of socket Invalid task ID Insufficient resources available to in stall a new route 4 37 listen pNA System Calls listen Listens for connections on a socket include lt pna h gt long listen int s socket descriptor int backlog packet queue depth Description This system call sets up the specified socket to receive connections Connection requests are queued on the socket until they are accepted with the accept call The maximum length of the queue of pending connections must be specified If a connection request arrives while the queue is full the requesting client gets an ECONNREFUSED error Arguments s Specifies the socket backlog Defines the maximum length of the queue of pending con nections Return Value This system call returns 0 if successful otherwise it returns 1 Error Codes Hex Mnemonic Description 0x5016 EINVALID An argument is invalid 0x502D EOPNOTSUPP The requested operation isn t valid for this socket type See Also accept connect socket 4 38 pSOSystem S
45. 1 On pHILE CD ROM and MS DOS formatted volumes read_f operations are more efficient if bcount equals an integral multiple of the block size and the L_ptr is positioned at a block boundary 2 On pHILE CD ROM and MS DOS formatted volumes if the requested data includes entire blocks or a contiguous sequence of blocks and if such blocks are not already in the buffer cache the pHILE file system manager reads these blocks directly into the caller s buffer without going through the buffer cache 3 read_f automatically positions the L_ptr for sequential read operations If random reads are necessary use 1seek_f to reposition the L_ptr See Also lseek_f read_vol pSOSystem System Calls 2 95 read_link pHILE System Calls read_link Reads the value of a symbolic link unsigned long read_link char name a file containing the symbolic link char buf user buffer to hold the returned contents unsigned long bufsize maximum buffer size Volume Types NFS volumes Description read_link reads the contents of the symbolic link of a file The returned data is not null terminated Arguments name Points to the null terminated pathname of the file containing the symbolic link buf Points to the memory area that receives the data bufsize Points to the maximum buffer size before the call and the length of the data returned in buf after the call If successful read_link stores in bufsize the
46. 7 printf s n wday time_str tm_wday 3 112 pSOSystem System Calls pREPC System Calls mktime Notes Callable From a Task a ISR See Also time localtime localtime_r pSOSystem System Calls 3 113 perror pREPC System Calls perror Prints a diagnostic message include lt stdarg h gt include lt stdio h gt void perror const char s error string Description The perror function writes the string pointed to by s followed by a diagnostic message to the standard error device The diagnostic message is a function of the calling task s errno value Arguments Ss Points to the string to write error message Return Value This function does not return a value Error Codes No error codes are returned Notes Callable From m Task See Also errno 3 114 pSOSystem System Calls pREPC System Calls printf printf Prints formatted output to stdout include lt stdarg h gt include lt stdio h gt long printf const char format format control arguments 1 through n Description The printf function is equivalent to fprintf except that the output is directed to the standard output device instead of a file designated by an input parameter Arguments format Points to the format control string For more information see fprintf on page 3 43 Arguments 1 through n to be written according the specifications of the control string Return Value
47. Continued Hex Mnemonic and Description System Call s 0x2201 VF_MAXDEPTH Maximum depth exceeded on verify_vol directory traversal Increase the value of pb_maxdepth If needed supply more memory for pb_dataptr and increase pb_datalen Refer to page 2 127 0x2202 VF_ABORT Verify routine aborted by user verify_vol Ox2F01 FAT NORAM Insufficient data area This error originates in pHILE initialization Ox2FOE FAT_PHCSUM Checksum error in the pHILE file This error originates in system manager pHILE initialization B 2 1 pSOS Errors Related to pHILE When a task is deleted or restarted pSOS may return errors related to pHILE These error codes are listed in Table B 4 TABLE B 4 pSOS Errors Related to pHILE Hex Description System Call s OxOD ERR_RSTFS Possible file system corruption A pSOS t_restart task was restarted while executing pHILE code resulting in a possible inconsistency in the vol ume data structures Following this error use of verify_vol on the volume is recommended 0x18 ERR_DELFS Attempt to delete task using the pSOS t_delete pHILE file system manager A task that has open files or is holding pHILE resources cannot be deleted B 34 pSOSystem System Calls Error Codes B 2 2 Conversions of NFS Error Codes pHILE Error Codes All NFS errors received by pHILE are mapped to pHIL
48. Description This function tests the value in c converted to an unsigned char to see if it is an uppercase letter Arguments c Specifies the value to be tested Return Value This function returns a nonzero value if the test result is true It returns a O if the result is false Error Codes Refer to Appendix B Notes Callable From m Task ISR See Also isalpha islower 3 84 pSOSystem System Calls pREPC System Calls isxdigit isxdigit Tests for a hexadecimal digit include lt ctype h gt int isxdigit int c character Description This function tests the value in c converted to an unsigned char to see if it is a hexadecimal digit The hexadecimal digits are defined as the ASCII representation of digits 0 through 9 lower case letters a through f and uppercase letters A through F Arguments Specifies the value to be tested Return Value This function returns a nonzero value if the test result is true It returns a O if the result is false Error Codes Refer to Appendix B Notes Callable From a Task m ISR See Also isdigit pSOSystem System Calls 3 85 labs pREPC System Calls labs Computes the absolute value of a long integer include lt stdlib h gt long labs long j long integer Description The labs function converts the long integer j into its absolute value If the result cannot be represented the behavior is undefined Arguments
49. Most system calls except pt_create and pt_ident reference a partition by its partition ID pt_create returns the partition ID to the partition creator For other tasks one way to obtain the partition ID is to use pt_ident Arguments name Specifies the name of the partition node For multiprocessing systems is a search order specifier See Multiprocessor Considerations In a single node system this argument must be 0 ptid Points to the variable where pt_ident stores the ID of the named partition Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x04 ERR_NODENO Node specifier out of range 0x09 ERR_OBJNF Named partition not found pSOSystem System Calls 1 55 pt_ident pSOS System Calls Notes 1 Internally the pSOS kernel treats a partition name as a 32 bit integer However when the application calls the kernel through the pSOS C language API it passes the partition name as a four byte character array 2 The pSOS kernel does not check for duplicate partition names If duplicate partition names exist a pt_ident call can return the ID of any partition with the duplicate name Multiprocessor Considerations 1 pt_ident converts a partition s name to its ptid using a search order determined by the node input parameter which is described in pSOSystem System Concepts Because partitions created and exported by different n
50. NEF SMOUNT_VOL_PARAMS params parameters Volume Types NFS volumes Description nfsmount_vol mounts an NFS volume A volume must be mounted before any file operations can be conducted Arguments device Points to a null terminated name of the volume to be mounted Unlike the mount_vol system call the volume name provided does not correspond to a true pSOS device but to a pseudo device A pseudo device does not necessarily correspond to any real device or device driver in the pSOS system Drivers for this device number may or may not exist In either case the pHILE file system manager does not call them while it is accessing the NFS volume params Points to an instance of the nfsmount_vol_params structure which contains parameters used for volume mounting and is defined in lt phile h gt as follows typedef struct nfsmount_vol_params unsigned long ipaddr Internet address of NFS server NOTE network byte order char pathname pathname of filesystem to mount unsigned long flags reserved set to 0 unsigned long reserved 6 reserved set to 0 NFSMOUNT_VOL_PARAMS pSOSystem System Calls 2 73 nfsmount_vol Return Value pHILE System Calls This structure cannot be packed The fields of nfsmount_vol_params are defined as follows ipaddr pathname flags reserved The IP address of the NFS host that contains the file system to mount Since this is in network byte ord
51. Number of free buffers long db_wait No of times tasks waited for buffer long db_drops No of times buffer was unavailable ARP Related Operations The following operations are available for accessing and modifying the ARP table Operation Description SIOCSARP Sets an ARP entry SIOCGARP Gets an ARP entry SIOCDARP Deletes an ARP entry For all ARP related operations arg must point to the following structure pSOSystem System Calls pNA System Calls ioctl struct arpreq struct sockaddr arp_pa protocol address struct sockaddr arp_ha hardware address int arp_flags flags The arp_pa structure is used to specify the host s IP address The address family field in arp_pa must be AF_INET The arp_ha structure is used to specify the host s hardware address The arp_ha address field must be AF_UNSPEC arp_flags must be one of the following symbolic constants defined in pna h Symbolic Constant Description ATF_PERM Permanent entry ATF_PUBL Publish respond for other host ATF_PERM makes the entry permanent if the ioct1 call succeeds ATF_PUBL specifies that the ARP protocol should respond to ARP requests coming from other machines for the indicated host This allows a host to act as an ARP server which might be useful in convincing an ARP only machine to talk to a non ARP machine Routing Related Operations The following operations are available for mani
52. R2 R13 CTR XER and MQ for PowerPC 601 prior to the interrupt also need to be saved into the frame by the ISR i_return will restore all the saved registers and deallocate the frame Below are sample code fragments of the vector code and an ISR Sample vector code stwu sp PS_FRM_SIZE sp Allocate pSOSystem exception frame stw r29 PS_FRM_R29 sp Save r29 stw r30 PS_FRM_R30 sp Save r30 stw r31 PS_FRM_R31 sp Save r31 mfsrr0 r29 stw r29 PS_FRM_SRRO sp Save SRRO mfsrrl r30 stw r30 PS_FRM_SRRI1 sp Save SRR1 mflr PST stw r31 PS_FRM_LR sp Save LR mfcr r29 stw r29 PS_FRM_CR sp Save CR pSOSystem System Calls pSOS System Calls andi mfmsr or LA or mtmsr isync LA lwz mtlr blr Sample ISR LA lwz mtlr LAL zo zz z Z amp ct K xX oO K u3 uZ3unununuunuunununununuunuununaun DS tiht mht otete oct D LA 30 r29 E295 130 129 r29 E29 129 r29 bal r31 Hol ro Bey r3 td LD r6 Eat oe r8 19 rl0 rit DI LSY r4 r4 r5 ID C2 pal like lt body of ISR gt LA lwz mtlr Ls pSOSystem System Calls E31 131 r31 i_return r30 MSR_IR SR_DR SR_IR Get current MSR r29 r30 Restore certain MSR bits MSR_FP MSR_FE1 MSR_EFO 29 E30 Set certai
53. char name 4 task name unsigned long node node number unsigned long tid task ID Description This system call enables the calling task to obtain the task ID of a task it knows only by name This task ID can then be used in all other operations relating to the task Most system calls except t_create and t_ident reference a task by its task ID t_create returns the task ID to a task s creator For other tasks one way to obtain the task ID is to use t_ident Arguments name Specifies the user assigned name of the task node In multiprocessor systems is a search order specifier See Multiprocessor Considerations In a single node system this argument must be 0 tid Points to the variable where t_ident stores the task ID of the named task Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x04 ERR_NODENO Illegal node number 0x09 ERR_OBJNF Named task was not found pSOSystem System Calls 1 143 t_ident Notes pSOS System Calls Internally the pSOS kernel treats a task name as a 32 bit integer However when the application calls the kernel through the pSOS C language API it passes the task name as a four byte character array The pSOS kernel does not check for duplicate task names If duplicate task names exist a t_ident call can return the tid of any task with the duplicate name If name is null
54. followed either by an asterisk described later or by an optional decimal integer if only the period is specified the precision is taken as zero If a precision appears with any other conversion specifier the behavior is undefined An optional modifier h 1 ell or L indicating the size of the re ceiving object For instance the conversion specifier d is pre ceded by h if the corresponding argument is a short int rather than an int the argument will have been promoted according to the rules of integral promotions and its value will be con verted to short int before printing A table of modifiers is pre sented below under the list of conversion specifiers As noted above a field width or precision or both may be indicated by an asterisk In this case an int argument supplies the field width or precision The argument specifying field width or precision or both should appear in that order before the argument if any to be converted A negative field width argument is taken as a flag followed by a positive field width A negative precision argument is taken as if the precision were omitted The flag characters and their meanings are The result of the conversion will be left justified within the field It will be right justified if this flag is not specified The result of a signed conversion will always begin with a plus or minus sign It will begin with a sign only when a negative value is converted if this fl
55. if one or more messages are already posted at the target queue then the new message will be inserted into the message queue in front of all such queued messages Arguments qid Specifies the queue ID of the target queue msg_buf Specifies the message to send Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Queue has been deleted 0x06 ERR_OBJID qid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x34 ERR_NOMGB Out of system message buffers 0x35 ERR_QFULL Message queue at length limit Ox3A ERR_VARO Queue is variable length 0x65 ERR_STALEID Object s node has failed 1 86 pSOSystem System Calls pSOS System Calls q_urgent Notes 1 q_urgent is useful when the message represents an urgent errand and must be serviced ahead of the normally FIFO ordered messages 2 Ifthe caller is a task it may be preempted as a result of this call 3 q_urgent sends a message to an ordinary message queue Use q_vurgent to send a message to a variable length message queue Multiprocessor Considerations 1 If qid identifies a global queue residing on another processor node the local kernel internally makes an RSC to that remote node to post the input message to that queue 2 Ifa task awakened by this call does not reside on the local node the local ker
56. if they are set to O in the included IP header IP identification number and IP source address The fragmentation offset and checksum fields are always computed by pNA The rest of the IP header fields must be set appropriately IP_MULTICAST_IF Specifies the outgoing interface for multicast packets optval is a pointer to struct in_addr If set to INADDR_ANY then the routing table will be used to select an appropriate interface IP_MULTICAST_INTF Specifies the outgoing interface for multicast packets The outgoing interface is defined by its interface number The optval is a pointer to a long If set to 1 then the routing table will be used to select an appropriate interface This op tion is useful for unnumbered links because the IP address of the interface is not enough to iden tify the interface pSOSystem System Calls 4 71 setsockopt IP_MULTICAST_LOOP IP_MULTICAST_TTL Return Value pNA System Calls Specifies whether or not to loopback multicast packets optval is a pointer to an unsigned char By default the packets are looped back IP_DEFAULT_MULTICAST_LOOP A value of 0 disables loopback Specifies the time to live for outgoing IP multicast datagrams optval is a pointer to an unsigned char The default is IP_DEFAULT_MULTICAST_TTL This system call returns 0 if successful otherwise it returns 1 Error Codes Hex Mnemonic 0x5009 EBADS 0x5016 EINVALID 0x502A ENOPROTOOPT 0x5030
57. include lt string h gt char strerror int errnum error number Description The strerror function maps the error number in errnum to an error message string Arguments errnum Specifies the error number Return Value The strerror function returns a pointer to the string The array pointed to must not be modified by the program but may be overwritten by a subsequent call to strerror Error Codes None Notes Callable From a Task m ISR See Also perror errno 3 150 pSOSystem System Calls pREPC System Calls strftime strftime Places formatted time and date information into a string include lt time h gt size t strftime char s string size_t maxsize string length const char format format control string const struct tm timeptr broken down time Description The strftime function places time and date information into the string pointed to by s as controlled by the string pointed to by format format contains conversion specifiers and ordinary multibyte characters All ordinary multibyte characters including the terminating null character are copied unchanged into the array If copying takes place between objects that overlap the behavior is undefined No more than maxsize characters are placed in the array Arguments maxsize format pSOSystem System Calls Points to the string where strftime places the formatted information Specifie
58. initialization Arguments ni Points to an ni_init structure The structure ni_init is defined in the file lt pna h gt and has the following format struct ni_init int entry int ipadd int mtu int hwalen int flags int subnetaddr int dstipaddr int reserved 1 address of NI entry point IP address maximum transmission length length of hardware address interface flags subnet mask Dest address in Point to Point NI reserved for future use This structure cannot be packed The flags element can contain one or more of the following symbolic constants defined in pna h using the syntax IFF_BROADCAST Symbolic Constant IFF_BROADCAST IFF_EXTLOOPBACK IFF_INITDOWN 4 4 I FEF RAWMEM Description NI can broadcast NI uses external loopback NI must be initialized in DOWN state De fault is UP state pSOSystem System Calls pNA System Calls Return Value IFF_MUL IFF_NOA TICAST RP IFF_POI IFF_POLI TTOPOINT IFF_RAW IFF_UNN EM add_ni NI supports multicast NI does not have ARP NI is point to point driver pNA polls NI at regular intervals NI passes packets as mblks NI is an unnumbered link This system call returns the pNA interface number of the new network interface if successful otherwise it returns 1 Error Cod
59. long getsockopt int s int level int optname char optval int optlen Description socket descriptor SOL SOCKET IPPROTO_IP or IPPROTO_ TCP retrieval option return buffer input output buffer size The getsockopt system call obtains the status of options associated with the specified socket Socket level IP protocol level or TCP protocol level options may be retrieved Arguments level optname optval optlen pSOSystem System Calls Specifies the socket Specifies the level of the option to be queried and must be set to SOL_SOCKET for socket level operations IPPROTO_IP for IP protocol level operations or IPPROTO_TCP for TCP protocol level operations Specifies the option to be queried and uses a symbolic constant The symbolic constants available for each level are provided below and in lt pna h gt Points to a buffer where get sockopt stores the value for the requested option For most options an int is returned in the buffer pointed to by optval A nonzero value means the option is set and a O means the option is off An input output parameter On input it should contain the size of the buffer pointed to by optval On output it contains the actual size of the value returned in the optval buffer 4 17 getsockopt pNA System Calls Socket Level Options level must be set to SOL_SOCKET for socket level operations The optname value
60. lt phile h gt unsigned long lstat_ char name struct stat buf Volume Types NFS volumes Description file pathname file status lstat_f is like stat_f except when the named file is a symbolic link For a symbolic link lstat_f returns information about the link file and stat_f returns information about the file to which the link refers Arguments name Points to the null terminated pathname of a file buf Points to a stat structure defined in lt phile h gt as follows struct stat mode_t st_mode ownership protection ino_t st_ino file ID dev_t st_dev dev ID where the volume resides dev_t st_rdev dev ID for character or block special files only nlink_t st_nlink number of hard links to the file uid_t st_uid user ID gid_t st_gid group ID off_t st_size total size of file in bytes time_t st_atime file last access time time_t st_mtime file last modify time time_t st_ctime file last status change time long st_blksize optimal block size for I O ops long st_blocks file size in blocks pSOSystem System Calls 2 61 Istat_f pHILE System Calls This structure cannot be packed No time zone is associated with the time values mode_t ino_t dev_t nlink_t uid_t gid_t off_t and time_t are defined as unsigned long in lt phile h gt The status information word st_mode consists o
61. pSOS System Calls Callable From a Task See Also tm_evafter tm_evevery tm_evwhen pSOSystem System Calls tm_cancel 1 165 tm_evafter pSOS System Calls tm_evafter Sends events to the calling task after a specified interval include lt psos h gt unsigned long tm_evafter unsigned long ticks delay unsigned long events event list unsigned long tmid timer identifier Description This system call enables the calling task to arm a timer so that it expires after the specified interval at which time the pSOS kernel internally calls ev_send to send the designated events to this task Unlike tm_wkafter tm_evafter does not block the caller A task can use multiple tm_evafter calls to arm two or more concurrent timers The timer interval is specified in system clock ticks For example if the system clock frequency is 60 ticks per second and the caller requires a timer to interrupt in 20 seconds the input specification should be 60x20 ticks 1200 A timer interval of n ticks causes the events to be sent on the nth next tick Because tm_evafter can happen anywhere between two ticks the actual interval is between n 1 and n ticks Arguments ticks Specifies the timer interval events Specifies the events to deliver upon expiration of the timer interval The events are encoded into a long word with bits 31 16 reserved for system use and bits 15 O available for application use tmid Poi
62. pemount_vol read_link read_vol remove_f stat_f stat_vfs symlink_f sync_vol truncate_f unmount_vol utime_f verify_vol write_vol pSOSystem System Calls pHILE Error Codes TABLE B 3 pHILE Error Codes Continued Error Codes pathname contains symbolic links nested more than three levels deep Hex Mnemonic and Description System Call s 0x2026 E_BADMS MS DOS volume illegal operation access_f annex_f This function cannot be used with MS DOS vol chmod_f chown_f umes fchmod_f fchown_f link_f lock_f lstat_f read_link symlink_f utime_f 0x2027 E_ILLMSTYP Illegal DOS disk type The pcinit_vol pcinit_vol parameter dktype exceeds the maximum allowable value 0x2029 E_NMSVOL Cannot mount MS DOS volume The pcmount_vol pHILE Configuration Table entry fc_msdos is zero indicating MS DOS volumes cannot be mounted 0x2041 E_BUFSIZE Buffers not available for block size camount_vol 0x2050 E_BADNF S NFS volume illegal operation This annex_f get_fn function cannot be used with NFS volumes lock_f open_fn read_vol sync_vol write_vol 0x2051 E_MAXLOOP Symbolic links nested too deeply A access_f cdmount_vol change_dir chmod_f chown_f create_f link_f lstat_f make_dir move_f nfsmount_vol open_dir open_f pcinit_vol pemount_vol read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol
63. s not including the terminating null character Arguments s Points to the string to be measured Return Value This function returns the computed length Error Codes None Notes Callable From m Task m ISR 3 154 pSOSystem System Calls pREPC System Calls strncat strncat Appends characters to a string include lt string h gt char strncat char sl destination string const char s2 source string size_t n source length Description This function appends up to n characters from one string s2 to the end of another string s1 The first character in the source string overwrites the terminating null character in the destination string A null character and characters that follow it in the source string are not appended The resulting string is always null terminated If the length of the source string is greater than the number of characters specified in the call only the specified number of characters not including the null termination character is appended If copying takes place between objects that overlap the behavior is undefined Arguments sl Points to the destination string s2 Points to the source string n Specifies the number of characters to append Return Value This function returns the value of s1 Error Codes None pSOSystem System Calls 3 155 strncat Notes Callable From a Task ISR 3 156 pREPC System Calls pSOSystem System Calls pREPC Sy
64. setvbuf Changes a stream s buffering characteristics include lt stdarg h gt include lt stdio h gt int setvbuf FILE stream stream pointer char buf I O buffer int mode access mode size_t size buffer size Description The setvbuf function can be used to change either the buffer associated with a stream the size of a stream s buffer or the method employed for buffering the stream s data setvbuf must be called after the specified stream has been opened but prior to reading or writing the file If setbuf is called after a read or write operation it has no effect pREPC allocates a buffer automatically if the buf parameter is NULL and a non zero size is specified Arguments stream Points to an open pREPC stream buf Points to the new buffer to be associated with the stream mode Defines the method employed for buffering data The possible modes are as follows _IO_FBF Input output is fully buffered _IO_LBF Input output is line buffered _IO_NBF Input output is not buffered 3 136 pSOSystem System Calls pREPC System Calls setvbuf If a stream is fully buffered it is flushed only when it is full If it is line buffered the buffer is flushed either when it is full or a when a new line character is detected _IO_NBF eliminates buffering it is functionally equivalent to defining size equal to 0 and buf equal to NULL size Specifies the size of the buffer size ov
65. the headings Notes Usage and See Also Notes contains any important information not specifically related to the call description Usage provides detailed usage information and See Also indicates other calls that have related information Structures described in this chapter are also defined in the file lt phile h gt Structures must be word aligned and must not be packed If you need to look up a system call by its functionality refer to Appendix A Tables of System Calls which lists the calls alphabetically by component and provides a brief description of each call The following table shows the file systems that each pHILE call supports If a call supports a particular file system the table entry is yes Otherwise the table entry is the error message produced when a call is either incorrectly used on a file system or attempted on an unsupported file system Error codes are described in the call descriptions within this chapter and also in Appendix B Error Codes TABLE 2 1 File Systems Supported by pHILE Calls I Syacall pHILE MS DOS NFS CD ROM Filesystem access_f E_ FUNC E_BADMS yes E_BADCD annex_f yes E_BADMS E_BADNFS E_BADCD 2 1 2 2 TABLE 2 1 File Systems Supported by pHILE Calls Continued pHILE System Calls Pn pHILE MS DOS NFS CD ROM cdmou
66. 0x2052 0x2053 0x2054 0x2055 0x2056 0x2058 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 2 102 Mnemonic F Ti F E EE __NDD F E FORD F __NODE FOPEN DNE __RO AXLOOP EREMOTE PERM EIO EACCES _EISDIR _ESTALE _ ENXIO ENODEV _ BADCD EAUTH ENFS ETIMEDOUT ENOAUTHBLK ECANTSEND ECANTRECV __PROBUNAVAIL pHILE System Calls Description Illegal pathname No default directory Directory file expected Null pathname Cannot remove an open file Directory not empty Operation not allowed on read only system files directories or mounted volumes Illegal device name Symbolic links nested too deeply Too many levels of remote in path Task does not have ownership A hard error occurred at remote site Task does not have access permissions Illegal operation on a directory Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available pSOSystem System Calls pHILE System Calls Hex 0x2078 0x2079 0x207A 0x207B 0
67. 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E See Also make_dir 2 72 Mnemonic E_EIO E_EACCES E_EISDIR E_EQUOT E_ESTALE E_ENXIO E_ENODEV E_BADCD E_EAUTH E_ENFS E_ETIMEDOUT E_ENOAUTHBLK E_EPROGVE E_PROBUNAVAIL E_ECANTSEND E_ECANTRECV RSMISMATCH E_EUNKNOW E_EPROGNO E_UNKNOWN E_EINTR Gi W PC HOST E_ECANTDECODEARGS TREGIST PROTO pHILE System Calls Description A hard error happened at remote site Task does not have access permissions Illegal operation on a directory Quota exceeded Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors pSOSystem System Calls pHILE System Calls nfsmount_vol nfsmount_vol Mounts a remote file system include lt pna h gt for htonl include lt phile h gt unsigned long nfsmount_vol char device volume name
68. 0x5009 0x5016 0x5023 0x5036 0x5037 0x5039 See Also recv 4 50 Mnemonic EBADS EINVALID EWOULDBLOCK ECONNRESET ENOBUFS ENOTCONN recvmsg socket Description The socket descriptor is invalid An argument is invalid This operation would block and the socket is marked nonblocking The connection has been reset by the peer An internal buffer is required but can not be allocated The socket is not connected pSOSystem System Calls pNA System Calls recvmsg recvmsg Receives data from a socket include lt pna h gt long recvmsg int s socket descriptor struct msghdr msg packet int flags packet attributes Description The recvmsg system call is used to receive data from a socket This system call is similar to recvfrom but requires fewer input parameters Refer also to recv for more details Note that the MSG_RAWMEM option is not supported by this call Arguments Ss Specifies the socket from which data is received The behavior of the system call depends on the socket type Refer to recv for more in formation msg Points to the structure msghdr which is defined in the file lt pna h gt with the following format struct msghdr char msg_name optional address int msg_namelen size of address struct iovec msg_iov scatter gather array int msg_iovlen elements in msg_iov char msg_accrigh
69. 44 Driver Error Codes The tables below list the error codes returned by pSOSystem drivers Each driver s table lists all the error codes returned by that driver Error code information in cludes hexadecimal numbers mnemonics and descriptions Drivers return error codes through the pSOS Kernel to Driver Interface using the out_retval element of the ioparms structure The contents of out_retval are copied to the variable pointed to by the service call input parameter retval The parameter retval is part of the Application to pSOS Interface For example any driver errors resulting from a de_read service call to a driver are returned at the address pointed to by the retval argument using the following syntax rr_code de_read dev iopb amp retval See the chapter I O System in pSOSystem System Concepts for more information on the pSOS Kernel to Driver Interface and the Application to pSOS Interface pSOSystem System Calls Error Codes Driver Error Codes Aside from the service calls de_init de_open de_close de_read de_write andde_cntrl a system call can return a driver error code directly through the return value of the system call For example the pHILE write_f system call can return the SCSI driver error code SCSI_W_PROTECTED 0x1050001A if a write is attempted on a write protected drive B 6 1 Shared Memory Network Interface Driver Error Codes The error codes listed in Table
70. B 10 are returned by the Shared Memory Network Interface NILSMEM driver TABLE B 10 Shared Memory Network Interface Driver Error Codes Hex Mnemonic and Description 0x10000001 NISMEM_FAT_IPA Invalid IP address B 6 2 Shared Memory Kernel Interface Driver Error Codes The error codes listed in Table B 11 are returned by the Shared Memory Kernel In terface KI_SMEM driver TABLE B 11 Shared Memory Kernel Interface Driver Error Codes Hex Mnemonic and Description 0x10000101 KISMEM_FAT_NOPB No packet buffers 0x10000102 KISMEM_FAT_NOO No queue 0x10000103 KISMEM_FAT_NOTSUPP Service not supported 0x10000104 KISMEM_FAT_BINSTALL Can t install bus error handler 0x10000105 KISMEM_FAT_NOD Number of nodes greater than maximum pSOSystem System Calls B 45 Driver Error Codes Error Codes B 6 3 Terminal Interface Driver Error Codes The error codes listed in Table B 12 are returned by the terminal interface driver TABLE B 12 Terminal Interface Driver Error Codes Hex Mnemonic and Description 0x10010200 TERM_HDWR Hardware error 0x10010201 TERM_MINOR Invalid minor device 0x10010203 TERM_BAUD Invalid baud rate 0x10010204 TERM_NINIT Driver not initialized 0x10010205 TERM_DATA Cannot allocate data
71. EADDRINUSE 0x5031 EADDRNOTAVAIL 0x5037 ENOBUFS 0x503B ETOOMANYREFS See Also getsockopt socket 4 72 Description The socket descriptor is invalid An argument is invalid The optname or level is not valid The multicast address is already in use The multicast address was not available because of one of the following the multicast address was not found the interface could not be determined or the interface does not support multicast An internal buffer is required but cannot be allo cated Too many references can t splice The per socket maximum number of memberships has been ex ceeded See section 3 of the pSOSystem Program mer s Reference pSOSystem System Calls pNA System Calls shr_socket shr_socket Obtains a new socket descriptor for an existing socket include lt pna h gt int shr_socket int s socket descriptor int tid task identity Description This system call is used to obtain a new socket descriptor for an existing socket The new socket descriptor can be used by the task with the specified ID to reference the socket in question This system call is provided for applications that implement UNIX style server programs which normally incorporate the UNIX fork call Arguments s Specifies the existing socket descriptor to be shared tid Specifies the task ID of a task that seeks to access the same socket Return Value This system call returns a socket descriptor
72. E_ETIMEDOUT E_ENOAUTHBLK pHILE System Calls Description Invalid function number Inconsistent data on volume volume corrupted Illegal pathname No default directory Operation not allowed on read only system files directories or mounted volumes Index block full Volume is full This cannot happen on NFS volumes Data is locked Illegal device name Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Quota exceeded Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available pSOSystem System Calls pHILE System Calls Hex 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E See Also Mnemonic _ ECANTSEND _ ECANTRECV E_PROBUNAVAIL EPROGVERSMISMATCH ECANTDECODEARGS EUNKNOWNHOST EPROGNOTREGISTERED E_UNKNOWNPROTO EINTR ERPC ftruncate_f open_f open_fn pSOSystem System Calls truncate_f Description Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered U
73. Hex Mnemonic Description 0x05 ERR_OBJDEL The task was already deleted 0x06 ERR_OBJID tid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 1 154 pSOSystem System Calls pSOS System Calls t_setpri Hex Mnemonic Description 0x16 ERR_SETPRI Cannot change new priority value is out of range 0x65 ERR_STALEID Object s node has failed Notes 1 If the calling task uses t_setpri to lower its own priority it can be preempted by a ready task with higher priority 2 Ifthe calling task uses t_setpri to raise the priority of another task it can be preempted if that task is ready and now possesses higher priority 3 Priority level O is reserved for the pSOS daemon task IDLE Priority levels 240 255 are reserved for a variety of high priority pSOSystem daemon tasks While t_create will allow creation of tasks at these priorities there should never be a need to do so Multiprocessor Considerations If the tid identifies a global task residing on another processor node the local kernel internally makes an RSC to that remote node to change the priority of the task Callable From a Task See Also t_create pSOSystem System Calls 1 155 t setreg pSOS System Calls t_setreg Sets a task s notepad register include lt psos h gt unsigned long t_setreg unsigned long tid task identifier unsigned
74. I O device and any unread buffered data is discarded The stream is disassociated from the file or I O device If the buffer was automatically allocated when the stream was opened it is reclaimed by the system The user is responsible for returning user supplied buffers When invoked with a null stream pointer fclose has a special significance under pREPC It causes pREPC to m Close all streams opened by the calling task m Reclaim all memory allocated by pREPC on behalf of the calling task either implicitly or explicitly by calls to malloc or calloc functions Arguments stream Points to an open pREPC stream Return Value This function returns O if successful or end of file EOF if an error occurs If an error occurs errno is set Error Codes Refer to Appendix B 3 30 pSOSystem System Calls pREPC System Calls fclose Notes 1 pREPC calls the pSOS function de_close if the stream was associated with an I O device 2 PREPC calls the pHILE function close_ f if the stream was associated with a disk file 3 If a task uses any of the pREPC functions it must call fclose 0 to release all pREPC resources prior to deleting itself through a t_delete system call Refer to the t_delete call description on page 1 138 for the complete exit sequence Callable From a Task See Also fopen pSOSystem System Calls 3 31 feof pREPC System Calls feof Tests a stream s end of file indicator
75. ID failed validity check 0x38 ERR_TATQDEL Informative only there were tasks waiting at the queue 0x39 ERR_MATODEL Informative only there were messages pending in the queue pSOSystem System Calls 1 77 q_delete pSOS System Calls Hex Mnemonic Description Ox3A ERR_VARQ Queue is variable length 0x53 ERR_ILLRSC Queue not created from this node Notes 1 Once created a queue is generally used by multiple tasks for communication and synchronization There is rarely a reason for deleting a queue even when it is no longer used except to allow reuse of the QCB 2 The calling task may be preempted after this call if a task that is waiting for a message from the deleted queue has higher priority 3 Any pending messages are lost 4 q delete deletes an ordinary message queue Use q_vdelete to delete a variable length message queue Multiprocessor Considerations If qid identifies a global queue q_delete will notify the master node so that the queue can be removed from its Global Object Table Thus deletion of a global queue always causes activity on the master node Callable From m Task See Also q_create q_vdelete 1 78 pSOSystem System Calls pSOS System Calls q_ident q_ident Obtains the queue ID of an ordinary message queue include lt psos h gt unsigned long q_ ident char name 4 queue name unsigned long node node number unsigned long qid queue identifier
76. ID where the volume resides dev_t st_rdev device ID for character or block special files only nlink_t st_nlink number of hard links to the file uid_t st_uid user ID gid_t st_gid group ID off_t st_size total size of file in bytes time_t st_atime file last access time time_t st_mtime file last modify time time_t st_ctime file last status change time long st_blksize optimal block size for I O ops long st_blocks file size in blocks This structure cannot be packed mode_t ino_t dev_t nlink_t uid_t gid_t off_t and time_t are defined as unsigned long in lt phile h gt pSOSystem System Calls 2 35 fstat_f pHILE System Calls The following differences exist for local file systems pHILE MS DOS and CD ROM rdev dev nlink 1 uid 0 gid 0 atime ctime mtime The status information word st_mode consists of the following bits _IFMT 0170000 type of file _IFIFO 0010000 fifo special _IFCHR 0020000 character special _IFDIR 0040000 directory _IFBLK 0060000 block special _IFREG 0100000 regular file _IFLNK 0120000 symbolic link _IFSOCK 0140000 socket S_ISUID 0004000 set user ID on execution S_ISGID 0002000 set group ID on execution S_ISVTX 0001000 save swapped text even after use S_IRUSR 0000400 read permission owner S_IWUSR 0000200
77. If a directive fails as detailed below fscanf returns Failures are described as input failures due to the unavailability of input characters or matching failures due to inappropriate input A directive composed of white space character s is executed by reading input up to the first non white space character which remains unread or until no more characters can be read A directive that is an ordinary multibyte character is executed by reading the next characters of the stream If one of the characters differs from one comprising the directive the directive fails and the differing and subsequent characters remain unread A directive that is a conversion specification defines a set of matching input sequences as described below for each specifier A conversion specification is executed in the following steps Input white space characters as specified by the isspace function are skipped unless the specification includes a c or n specifier An input item is read from the stream unless the specification includes an n specifier An input item is defined as the longest matching sequence of input characters unless that exceeds a specified field width in which case it is the initial subsequence of that length in the sequence The first character if any after the input item remains unread If the length of the input item is zero the execution of the directive fails this condition is a matching failure unless an error
78. If a meaningful date and time are required this call should be made after each system restart or power on Thereafter the system maintains the date and time based on incoming tm_tick calls and the expected arrival frequency defined in the pSOS Configuration Table Arguments date time ticks pSOSystem System Calls Specifies the clock date date is encoded as follows Field Bits Year A D 31 16 Month 1 12 15 8 Day 1 31 7 0 Specifies the clock time t ime is encoded as follows Field Bits Hour 0 23 31 16 Minute 0 59 15 8 Second 0 59 7 0 Specifies the number of ticks from the last second of the time argument 1 175 tm_set pSOS System Calls Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x48 ERR_ILLDATE Date input out of range 0x49 ERR_ILLTIME Time input out of range Ox4A ERR_ILLTICKS Ticks input out of range Notes 1 This implementation accurately reflects leap years and the current century For example the value 0088 means 88 A D not 1988 A D 2 The pSOS kernel maintains a flag that indicates if the system time has been initialized since the last system reboot Startup clears the flag and tm_set sets the flag 3 If the input values are accurate when this call is made the actual synchronization of the system clock depends on such variables as the execution time of tm_set and the mome
79. NFS call timed out 0x2074 E_ENOAUTHBLK No RPC authorization blocks available 0x2075 E_ECANTSEND Failure in sending call 0x2076 E_ECANTRECV Failure in receiving result 0x2077 E_PROBUNAVAIL Program not available 0x2078 E_EPROGVERSMISMATCH Program version mismatched 0x2079 E_ECANTDECODEARGS Decode arguments error 0x207A E_EUNKNOWNHOST Unknown host name 0x207B E_EPROGNOTREGISTERED Remote program is not registered 0x207C E_UNKNOWNPROTO Unknown protocol 0x207D E_EINTR Call interrupted 0x207E ERPC All other RPC errors pSOSystem System Calls 2 33 fchown_f pHILE System Calls See Also chown_f stat_f fstat_f chmod_f fchmod_f open_f 2 34 pSOSystem System Calls pHILE System Calls fstat_f fstat_f Obtains the status of a file specified by its file identifier include lt phile h gt unsigned long fstat_f unsigned long fid file identifier struct stat buf file status Volume Types All volume types Description fstat_f functions the same as stat_f except that fstat_f obtains information about a file by using the file identifier instead of the name The file identifier is first obtained with either open_ f or open_fn Arguments fid Specifies the file identifier associated with the file buf Points to a stat structure defined in lt phile h gt as follows struct stat mode_t st_mode ownership protection ino_t st_ino file ID dev_t st_dev device
80. This function returns either the number of characters written or EOF if a write error occurs If an error occurs errno is set Error Codes Refer to Appendix B pSOSystem System Calls 3 115 printf Notes Callable From m Task See Also scanf fprintf 3 116 pREPC System Calls pSOSystem System Calls pREPC System Calls putc putc Writes a character to a stream include lt stdarg h gt include lt stdio h gt int putc int c character FILE stream stream pointer Description The putc function writes the character specified by c converted to an unsigned char to the stream pointed to by stream st ream s position indicator if defined is advanced on a successful write Arguments e Specifies the character to write stream Points to an open pREPC stream Return Value The putc function returns c If a write error occurs the error flag for the stream is set EOF is returned and errno is set Error Codes Refer to Appendix B Notes Callable From a Task See Also getc putchar pSOSystem System Calls 3 117 putchar pREPC System Calls putchar Writes a character to stdout include lt stdarg h gt include lt stdio h gt int putchar int c character Description The putchar function writes the character c to the standard output stream after converting it to an unsigned char Arguments Specifies the character to write Retur
81. Value chmod_f This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic 0x2001 E_FUNC 0x200C E_IFN 0x200D E_NDD 0x2015 E_RO 0x2025 E_IDN 0x2026 E_BADMS 0x2051 E_MAXLOOP 0x2052 E_EREMOTE 0x2054 E_EIO 0x2055 E_EACCES 0x2058 E_ESTALE 0x205B E_ENXIO 0x205C E_ENODEV 0x2060 E_BADCD 0x2070 E_EAUTH 0x2071 E_ENFS 0x2072 E_ETIMEDOUT 0x2074 E_ENOAUTHBLK 0x2075 E_ECANTSEND 0x2076 E_ECANTRECV pSOSystem System Calls Description pHILE format volume illegal operation Illegal pathname No default directory Operation not allowed on read only system files directories or mounted volumes Illegal device name MS DOS volume illegal operation Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks available Failure in sending call Failure in receiving result 2 17 chmod_f Hex 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E See Also 2 18 fchmod_f Mnemonic E_PROBUNAVAIL EPROGVERSMISMATCH ECANTDECODEARGS
82. a disk file with read mode r as the first character in mode argument fails if the file does not exist or cannot be read Opening a disk file with append mode a as the first character in mode argument causes all subsequent writes to the then current EOF regardless of intervening calls to the fseek function When a disk file is opened with update mode as the second or third character in mode argument both read and write operations may be performed on the associated stream However output may not be directly followed by input or vice versa without an interviewing call to the fflush function or to a file positioning function via fseek fsetpos and rewind The only exception to the above rule is a read operation that encounters end of file Return Value If the open operation is successful this function returns a pointer to the FILE object that must be used in subsequent calls to specify this opened stream If the operation fails a null pointer is returned and errno is set 3 40 pSOSystem System Calls pREPC System Calls fopen Error Codes Notes Refer to Appendix B 1 The disk files are managed by the pHILE file system manager and are designated by pHILE pathnames for example 0 1 abc The I O devices are identified by pSOS logical device numbers represented as a string of the form M N where M is the major number and N is the minor number of the I O device for example 0 1 When reading or writing disk fil
83. an end of file condition is detected A null character is written immediately after the last character is read into the user buffer If st ream references a disk file its position indicator is advanced Arguments s Points to the user buffer where fgets stores characters n Specifies the number of characters to read plus one for the null terminator stream Points to an open pREPC stream Return Value This function returns s if successful If a read error occurs or an end of file condition is detected before any characters are read a null pointer is returned and errno is set Error Codes Refer to Appendix B pSOSystem System Calls 3 37 fgets Notes Callable From m Task See Also fputs 3 38 pREPC System Calls pSOSystem System Calls pREPC System Calls fopen fopen Opens a file include lt stdarg h gt include lt stdio h gt FILE fopen const char filename file name const char mode access mode Description The fopen function opens a disk file or I O device whose name is specified by the string pointed to by filename and associates a stream with it fopen allocates a FILE structure for the opened stream It contains control information for the opened I O device or disk file fopen returns a pointer to the allocated FILE structure that subsequent calls require to perform various I O operations on the I O device or disk file for example for an fread or fwrite
84. and modification times of a 2 123 file verify_vol pHILE Verifies a volume s control structures 2 126 vfprintf pREPC Writes formatted output to a stream 3 183 vprintf pREPC Writes formatted output to stdout 3 185 vsprintf pREPC Writes formatted output to a buffer 3 187 wcestombs pREPC Converts a wide character string into a 3 189 multibyte character string wctomb pREPC Converts a wide character into its multibyte 3 191 character equivalent write_f pHILE Writes to an open file 2 142 write_vol pHILE Writes data directly to a pHILE formatted 2 145 volume A 14 pSOSystem System Calls Tables of System Calls pS0S System Calls A 2 pSOS System Calls Table A 2 provides an alphabetical listing of all pSOS system calls a summary de scription for each call and a reference to more details about the call TABLE A 2 pSOS System Calls Name Description Page as_catch Specifies an asynchronous signal routine 1 3 as_return Returns from an asynchronous signal routine 1 7 as_send Sends asynchronous signals to a task 1 9 de_close Closes an I O device 1 11 de_cntrl Requests a special I O device service 1 13 de_init Initializes an I O device and its driver 1 15 de_open Opens an I O device 1 17 de_read Reads data from an I O device 1 19 de_write Writes data to an I O device 1 21 errno_addr Obtains the address of the calling t
85. another example consider a task P that is blocked while it waits for an event Another task Q decides that P must not run and therefore Q suspends P When P receives the event it must still wait for a resumption before it can be ready to run On the other hand if Q resumes P while P is still waiting for its event P continues to wait for the event Multiprocessor Considerations If tid identifies a global task residing on another processor node the local kernel internally makes an RSC to the remote node to suspend the task Callable From m Task See Also t_resume pSOSystem System Calls 1 163 tm_cancel pSOS System Calls tm_cancel Cancels an armed timer include lt psos h gt unsigned long tm_cancel unsigned long tmid timer identifier Description This system call enables a task to cancel a timer armed previously by tm_evafter tm_evwhen or tm_evevery The timer must have been armed by the calling task Arguments tmid Specifies the timer to cancel Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description Ox4C ERR_BADTMID The tmid is invalid 0x4D ERR_TMNOTSET Timer not armed or else already expired Notes When a task with armed timers is restarted or deleted its timers are automatically cancelled Multiprocessor Considerations None This call affects only the calling task 1 164 pSOSystem System Calls
86. area 0x10010206 TERM_SEM Semaphore error 0x10010210 TERM_AINIT Console already initialized 0x10010211 TERM_CHARSIZE Bad character size 0x10010212 TERM_BADFLAG Flag not defined 0x10010213 TERM_NHWFC Hardware flow not supported 0x10010214 TERM_BRKINT Terminated by a break character 0x10010215 TERM_DCDINT Terminated by a loss of DCD 0x10010216 TERM_NBUFF No buffers to copy characters allocb failed 0x10010217 TERM_NOPEN Minor device not opened 0x10010218 TERM_AOPEN Channel already opened 0x10010219 TERM_ADOPEN Channel already opened by another driver 0x10010220 TERM_CFGHSUP Hardware does not support channel as con figured 0x10010221 TERM_OUTSYNC Out of sync with DISI 0x10010222 TERM_BADMIN MinChar is greater than RBuffSize 0x10010223 TERM_LDERR Lower driver error may be corrupted structure 0x10010224 TERM_QUE Queue error 0x10010225 TERM_RXERR Data receive error B 46 pSOSystem System Calls Error Codes Driver Error Codes TABLE B 12 Terminal Interface Driver Error Codes Continued Hex Mnemonic and Description 0x10010226 ERM_TIMEOUT Timer expired for read or write 0x10010227 ERM_CANON CANON and MinChar and or MaxTime set can only have CANON or have MinChar and or MaxTime 0x10010228 ERM_ROPER Redirect operation error 0x10010229 ERM_MARK Received a SIOCMARK 0x10
87. argument is ignored in the single processor version of the pSOS kernel In a multiprocessor system the flags argument is used to determine whether the local node should be shut down or a system wide shutdown should occur flags is formed by selecting one of the following symbolic constants which are defined in lt psos h gt see Multiprocessor Considerations K_GLOBAL k_fatal invocation causes global system K_LOCAL shutdown local node shutdown If the value of flags is K_GLOBAL a global shutdown packet is sent to the master which then sends a shutdown packet to every other node in the system Return Value This call never returns to the caller 1 40 pSOSystem System Calls pSOS System Calls k_fatal Notes The shutdown procedure is a procedure whereby pSOS attempts to halt execution in the most orderly manner possible The pSOS kernel first examines the pSOS Configuration Table entry kc_fatal If this entry is nonzero the pSOS kernel jumps to this address If kc_fatal is zero and the PROBE System Debug Analyzer is present then the pSOS kernel passes control to the System Failure entry of the pROBE debugger For a description of the pROBE debugger behavior in this case refer to the pROBE User s Manual Finally if the pROBE debugger is absent the pSOS kernel internally executes an illegal instruction to cause a deliberate illegal instruction exception This passes control to a ROM monitor or othe
88. available The destination network cannot be reached from this node The connection has been reset by the peer An internal buffer is required but can t be allocated The socket is in a connected state The socket is not connected The destination host could not be reached from this node 4 61 sendto sendto Sends data to a socket pNA System Calls include lt pna h gt long sendto int s char buf int len int flags struct sockaddr_in to int tolen socket descriptor packet packet length packet attribute destination socket type size of sockaddr_in Description The sendto system call is used to send data to a foreign datagram socket Although it is possible to use this system call with stream datagram or raw sockets it is intended to be used only with datagram sockets or raw sockets If no buffer space is available at the socket to hold the datagram sendto blocks the calling task unless the socket has been marked non blocking Applications can use this call to pass messages to the pNA network manager in a linked list of mb1ks message blocks by setting the MSG_RAWMEM flag Using mblks eliminates the data copy performed in the pNA network manager during the data transfer between the application and the pNA network manager Arguments s Specifies the local socket buf Points to a buffer that contains the data to send The data pointed to b
89. by a tm_set call if that call changes the date and time If a tm_set advances the time past a scheduled alarm it triggers the ev_send immediately To detect this situation the application can check the time when it awakens and compare it with the expected time 3 A task must explicitly call ev_receive to receive a timer triggered event which is like any event in every other way pSOSystem System Calls 1 171 tm_evwhen pSOS System Calls 4 A task with active timers can be blocked or suspended In either case the designated events are sent when the timer expires 5 When a task with armed timers is restarted or deleted its timers are automatically cancelled 6 The number of simultaneously active timers is fixed and defined by the kc_ntimer entry in the pSOS Configuration Table Multiprocessor Considerations None This call affects the calling task only Callable From m Task See Also v_receive ev_send 1 172 pSOSystem System Calls pSOS System Calls tm_get tm_get Obtains the system s current version of the date and time include lt psos h gt unsigned long tm_get unsigned long date year month day unsigned long time hour minute second unsigned long ticks ticks Description This service call returns the system s current version of the date and time of day If the system has no real time clock the returned values are meaningless Arguments date Po
90. bytes On 960 processors the stack size should be no less than 256 bytes On x86 processors the stack size should be no less than 128 bytes Using the T_FPU Flag If the T_FPU flag is set the size of the task s stack segment is extended to save and restore FPU registers It should be set if the task uses the FPU The extension added varies according to the processor being used 68K CF PPC On 68K processors the stack is extended by 328 bytes On ColdFire processors there is no support for FPU Hence this feature is not supported in pSOS On PowerPC processors the stack is extended by 264 bytes pSOSystem System Calls 1 135 t create Return Value 960 x86 pSOS System Calls On ARM processors the stack is extended by 100 bytes On 960 processors the stack is extended by 48 bytes On 486 processors and on 386 processors used with an 80387 FPU the stack size is extended by 108 bytes This system call returns 0 on success or an error code on failure Error Codes Notes 1 136 Hex 0x08 Ox0E OxOF 0x10 0x11 Mnemonic Description ERR_OBJTFULL Node s object table full ERR_NOTCB Exceeds node s maximum number of tasks The maximum number of tasks that can be simultaneously active is defined by the kc_ntask entry in the pSOS Configuration Table ERR_NOSTK Insufficient space in Region 0 to create stack ERR_TINYSTK Stack size too small ERR_PRIOR Pri
91. call Disk files have position indicators that determine where the next byte is read from or written to in the file Position indicators have no meaning for I O devices Arguments filename Points to the name of the disk file or I O device to be opened mode Points to a string that specifies the mode in which the file is to be opened The mode string must begin with one of the following sequences r Open text file for reading w Truncate to zero length or create text file for writing a Append open or create text file for writing at the end of file rb Open binary file for reading wb Truncate to zero length or create binary file for writing pSOSystem System Calls 3 39 fopen pREPC System Calls ab Append open or create a binary file for writing at the end of file r Open text file for updating reading and writing at the current file position wt Truncate to zero length or create text file for updating reading and writing at the current file position at Append open or create text file for updating reading at the current file position and writing at the end of file r b or rb Open binary file for updating reading and writing at the current file position w b or wb Truncate to zero length or create binary file for updating reading and writing at the current file position a b or ab Append open or create a binary file for updating reading at current file position and writing at the end of file Opening
92. call generates an error an error code is loaded into an in ternal variable that can be read through the macro errno One errno variable exists for each task If the return value of a pREPC system call indicates an error your application should examine the errno variable to determine the cause of the error See the description of errno on page 3 27 for more information Table B 7 lists the error codes of the pREPC library and component Each listing includes the error code s hexadecimal number its mnemonic and a brief descrip tion The error code mnemonics are also defined in lt prepc h gt For practical reasons system calls are not listed because nearly every pREPC er ror code can be returned by all pREPC system calls In addition errors in other pSOSystem components or device drivers can be reported by pREPC system calls TABLE B 7 pREPC Error Codes Hex Mnemonic and Description 0x3001 EMOPEN Maximum number of files are open 0x3002 ERANGE Converted value out of range 0x3003 EBASE Invalid radix base specified 0x3005 EACCESS File access violation 0x3006 EMODE Unrecognized mode specified 0x3007 EINVAL Operation not allowed on this type of file 0x3008 EPHILE Attempted a disk file operation without the pHILE file sys tem manager installed 0x3009 EINVTYPE Invalid buffer type 0x300a EINVSIZE Invalid buffer size
93. can be one of the following SO_BROADCAST Allows broadcast datagrams on a socket SO_DONTROUTE Indicates that the outgoing messages should not be routed Packets directed to unconnected networks are dropped SO_ERROR Returns the pending error and clears the error status SO_KEEPALIVE Keeps the connection alive by periodically transmitting a packet over socket s SO_LINGER Controls the action taken when unsent messages are queued on a socket and a close is executed If the socket is a stream socket and SO_LINGER is set 1_onoff set to 1 the calling task blocks until it can transmit the data or until a timeout period expires If SO_LINGER is disabled 1_onoff set to 0 the socket is deleted immediately SO_LINGER uses the linger structure which is defined as follows struct linger int l_onoff on off option int l_linger linger time in secs This structure cannot be packed SO_OOBINLINE Requests that out of band data go into the normal data in put queue as received it then is accessible with recv calls without the MSG_OOB flag SO_RCVBUF Adjusts the normal buffer size allocated for a socket input buffer SO_REUSEADDR Indicates that local addresses can be reused in a bind call SO_REUSEPORT Indicates that local addresses can be reused in a bind call For more information see section 4 4 3 of the Network Programming chapter in pSOSystem System Conce
94. character array 2 The pSOS kernel does not check for duplicate queue names If duplicate names exist a q_ident call can return the gid of any queue with the duplicate name Multiprocessor Considerations 1 q ident converts a queue s name to its qid using a search order determined by the node input parameter as described in pSOSystem System Concepts Because queues created and exported by different nodes may not have unique names the result of this binding may depend on the order in which the object tables are searched 2 If the master node s Global Object Table must be searched the local kernel makes a q_ident RSC to the master node Callable From m Task See Also q_create q_vident 1 80 pSOSystem System Calls pSOS System Calls q_receive q_receive Requests a message from an ordinary message queue include lt psos h gt unsigned long q_receive unsigned long qid queue identifier unsigned long flags queue attributes unsigned long timeout timeout in clock ticks unsigned long msg_buf 4 message buffer Description This system call enables a task or an ISR to obtain a message from an ordinary message queue Arguments qid Specifies the queue ID of the target queue flags Specifies whether q_receive will block waiting for a message flags should have one of the following values defined in lt psos h gt O_NOWAIT Don t wait for message Q_WAIT Wait for message timeout Sp
95. control string The format string consists of pSOSystem System Calls ordinary characters except the character and conversion specifications The ordinary characters are simply copied to the output stream The conversion specifications determine the form of the arguments output Each argument should have one conversion specification Each conversion specification begins with a character and ends with a conversion specification character One or more of the following can be positioned between the and ending specification character in the order specified below m Zero or more flags in any order that modify the meaning of the conversion specification m An optional minimum field width If the converted value has fewer characters than the field width it will be padded with spaces by default on the left or right if the left adjustment flag described below has been given to the field width The field width takes the form of an asterisk described below or a decimal integer 3 43 fprintf 3 44 pREPC System Calls m An optional precision that gives the minimum number of digits to appear for the d i o u x and X conversions the number of digits to appear after the decimal point character for e E and f conversions the maximum number of significant digits for the g and G conversions or the maximum number of characters to be written from a string in s conversion The precision takes the form of a period
96. error address results The contents of the original registers and stack are platform specific On 960 processors 960 OxDEADDEAD PPC OxDEADDEAD ARM x86 the return address RIP on the stack is On PowerPC and ARM processors the return address in register LR is On x86 processors the return address on the stack is OxXFFFFFFFF A new task can receive up to four long words of input arguments To facilitate retrieval of these arguments they are passed to the task as if it is invoked as a high level language procedure or function For example if a C task nice has three input arguments it can be declared as follows pSOSystem System Calls 1 159 t start pSOS System Calls nice unsigned long a unsigned long b unsigned long c where targs 0 is passed to a targs 1 to b and targs 2 to c In this case targs 3 is irrelevant and does not need the calling task to load it User and Supervisor Modes You use the symbolic constants T_USER and T_SUPV on each processor as follows On 960 and x86 processors a task can execute only in supervisor mode In lt psos h gt for these processors the symbols T_SUPV and ea T_USER are defined as 960 define T_SUPV 0 x86 define T_USER 0 for the sole purpose of compatibility with platforms that support both user and supervisor modes Interrupt Control Interrupt control means that while a task is executin
97. execution of this call 2 The volume s hardware media must have been formatted before this call is executed 3 A mounted volume cannot be initialized 4 An MS DOS volume must be formatted using the MS DOS FORMAT utility or another comparable utility provided by some SCSI Controller Board vendors not pcinit_vol After that pcinit_vol can be used to reinitialize the volume pcinit_vol reads the partition s boot record not the master boot record which was written by FORMAT to get the partition s parameters See Also pemount_vol init_vol pSOSystem System Calls 2 87 pcmount_vol pHILE System Calls pcmount_vol Mounts an MS DOS volume include lt phile h gt unsigned long pcmount_vol char device volume name unsigned long sync_mode synchronization mode Volume Types MS DOS formatted volumes Description pcmount_vol mounts an MS DOS volume A volume must be mounted before file operations can be applied to it Permanent non removable media volumes need mounting only once Removable volumes can be mounted and unmounted as required Arguments device Points to the null terminated name of the volume to be mounted sync_mode Specifies the volume s write synchronization attribute This attribute is defined in lt phile h gt and must be set to one of the following values SM_IMMED_WRITE Immediate write synchronization mode SM_CONTROL_WRITE Control write synchronizat
98. extends the physical size of a file on a pHILE formatted volume by adding a group of contiguous blocks Arguments fid Identifies the file alloc_size Specifies the desired number of blocks to add to the file blkcount Points to the variable where annex_f stores the number of blocks actually allocated This number can be less than alloc_size in which case blkcount represents the largest group of contiguous blocks available on the volume Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2015 E_RO Operation not allowed on read only system files directories or mounted volumes 2 8 pSOSystem System Calls pHILE System Calls annex_f Hex Mnemonic Description 0x201A E_FIDBIG Invalid FID exceeds maximum 0x201B E_FIDOFE Invalid FID file is closed T 0x201C E_ININFULL Index block is full 0x201D E_VFULL Volume is full T 0x2026 bi __BADMS MS DOS volume illegal operation T 0x2050 E_BADNFS NFS volume illegal operation T 0x2060 E_BADCD CD ROM volume illegal operation Notes 1 annex_f expands the physical size of a file but does not change its logical size or the end of file position 2 read_f and lseek_f calls into annexed blocks are not allowed until the logical length of the file is extended by writing data into the annexed blocks 3 Avolume full error occurs if no blocks can be a
99. float p An unsigned hexadecimal number is expected The corresponding argument should be a pointer to a pointer to void s A sequence of non white space characters is expected The corresponding argument should be a pointer to a character array large enough to accept the sequence and an added terminating null character c A sequence of characters is expected The number of characters in the sequence should be equal to the field width If the field width is not specified one character is expected The corresponding argument should be a pointer to a character array large enough to accept the sequence A terminating null character is not added pSOSystem System Calls pREPC System Calls 2 fscanf A sequence of characters is expected Every character must match one of the characters listed after the character and up to and including a character If the first character listed after the initial character is a circumflex character then the characters read must not match the characters given in the list A character list beginning with or is a special case If this occurs the first character does not end the list and a second character is needed The corresponding argument should be a pointer to a character array large enough to accept the sequence and an added terminating null character No input is read The corresponding argument should be a pointer to an integer that is loaded with the number of charac
100. for example char 0 then the tid of the calling task is returned Multiprocessor Considerations 1 t_ident converts a task s name to its tid using a search order determined by the node input parameter as described in pSOSystem System Concepts Because tasks created and exported by different nodes may not have unique names the result of this binding may depend on the order in which the object tables are searched If the master node s Global Object Table must be searched then the pSOS m kernel makes a t_ident RSC to the master node If the task name is null i e char 0 then the node argument is ignored and the t_ident operation returns the tid of the calling task on the local node Callable From See Also Task t_create 1 144 pSOSystem System Calls pSOS System Calls t mode t_ mode Gets or changes the calling task s execution mode include lt psos h gt unsigned long t_mode unsigned long mask attributes to be changed unsigned long new mode new attributes unsigned long old mode prior mode Description This system call enables a task to modify certain execution mode fields These are preemption on off roundrobin on off asynchronous signal handling on off and interrupt control Preemption has precedence over timeslicing Therefore if preemption is off timeslicing does not occur whether or not it is set The calling task can be preempted as a result of
101. for socket The protocol argument is not valid An internal buffer is required but cannot be allocated listen setsockopt getsockopt 4 77 socket pNA System Calls 4 78 pSOSystem System Calls pRPC System Calls This chapter provides information on the system calls in the pRPC component of pSOSystem Each call s section includes its syntax a description its arguments its return value and any error codes that it can return Where applicable the section also includes the headings Notes and See Also Notes provides any important information not specifically related to the call s description and See Also indicates other calls that have related information If you need to look up a system call by its functionality refer to Appendix A Tables of System Calls which lists the calls alphabetically by component and provides a brief description of each call For more information on error codes refer to Appendix B Error Codes which lists the codes numerically and gives the pSOSystem calls that are associated with each one 5 1 5 2 pRPC System Calls pSOSystem System Calls pRPC System Calls pRPC System Calls The following list shows all of the services supported by the pRPC library All routines implement standard ONC RPC XDR services except for those marked with an asterisk The calls mark
102. i tm tm_sec tm_min tm_hour tm_mday tm_mon tm_year tm_wday tm_yday tm_isdst JK JK seconds after the minute 0 61 minutes after the hour 0 59 hours since midnight 0 23 day of the month 1 31 months since January 0 11 years since 1900 days since Sunday 0 6 days since January 1 0 365 Daylight Saving Time flag The range 0 61 for tm_sec allows for up to two leap seconds The value of tm_isdst is positive if Daylight Saving Time is in effect zero if Daylight Saving Time is not in effect and negative if the information is not available pSOSystem System Calls 3 111 mktime pREPC System Calls Return Value The mktime function returns the specified calendar time encoded as a value of type time_t If the calendar time cannot be represented the function returns the value time_t 1 Error Codes None Example What day of the week is July 4 2001 include lt stdio h gt include lt time h gt static const char const wday Sunday Monday Tuesday Wednesday Thursday Friday Saturday unknown struct tm time_str TR ei BH time_str tm_year 2001 1900 time_str tm_mon 7 1 time_str tm_mday 4 time_str tm_hour 0 time_str tm_min 0 time_str tm_sec 1 time_str tm_isdst 1 if mktime amp time_str 1 time_str tm_wday
103. identifies a global task residing on another processor node the local kernel internally makes an RSC to that remote node to resume the task Callable From m Task m ISR if the task is local to the node from which the t_resume call is made m KI if the task is local to the node from which the t_resume call is made m Callout if the task is local to the node from which the t_resume call is made See Also t_suspend pSOSystem System Calls 1 153 t_setpri pSOS System Calls t_setpri Gets and optionally changes a task s priority include lt psos h gt unsigned long t_setpri unsigned long tid task identifier unsigned long newprio new priority unsigned long oldprio previous priority Description This system call enables the calling task to obtain and optionally modify either its own or another task s scheduling software priority The previous priority is returned Arguments tid Specifies the selected task for the priority change If tid equals O the calling task is the target newprio Specifies the task s new priority newprio must be between O and 255 see Note 3 If newprio is 0 the task s priority is not changed This allows a read of a task s priority without changing its priority oldprio Points to the variable where t_setpri stores the task s previous priority Return Value This system call returns 0 on success or an error code on failure Error Codes
104. in lt pna h gt and have the fol lowing format struct sockaddr_in short sin_ family must be AF_INET unsigned short sin_ port 16 bit port number struct in_addr sin_addr 32 bit IP address char sin_zero 8 must be 0 struct sockaddr_intf short sin_ family must be AF_INET unsigned short sin_ port 16 bit port number struct in_addr sin_addr 32 bit IP address long sin_ifno 32 bit interface number char sin_zero 4 must be 0 i The field sin_ifno identifies the interface number of the outgoing packet s output interface The above structures cannot be packed Specifies the size in bytes of either struct sockaddr_in or struct sockaddr_intf and must be 16 4 63 sendto Return Value pNA System Calls This system call returns the number of bytes sent and 1 if an error occurs Error Codes Hex 0x5009 0x500D 0x5016 0x5020 0x5023 0x5027 0x5028 0x5031 0x5033 0x5036 0x5037 0x5038 0x5039 0x5041 See Also send 4 64 Mnemonic EBADS EACCE EPIPE EWOU EINVALID SS DBLOCK EDEST bi MSGS bi ADDRREQ IZE ADDRNOTAVAIL ENETUNREACH ECONNRE EISCO ENOTC ENOBUE N ONN EHOST sendmsg UNREACH select Description The socket descriptor is invalid The broadcast option is not set for this s
105. include lt stdio h gt int remove const char filename file name Description This function removes the file whose name is pointed to by filename Before a file can be removed it must be closed This restriction does not apply to files residing on NFS volumes Arguments filename Points to the string that contains the filename Return Value This function returns zero if the file is removed If the file is not removed or if filename specifies an I O device then a nonzero value is returned and errno is set Error Codes Refer to Appendix B Notes Callable From a Task pSOSystem System Calls 3 125 rename pREPC System Calls rename Renames a file include lt stdarg h gt include lt stdio h gt int rename const char old existing file name const char new new file name Description This function changes the name of a file from old to new It applies only to pHILE managed files If a file new already exists it is deleted Certain error conditions specific to the volume type can result as follows m Ifa file called new exists and is open the call fails except on NFS volumes m If oldis open the call fails DOS volumes only m If oldisa directory file the call fails DOS volumes only Arguments old Points to the string that contains the old filename new Points to the string that contains the new filename Return Value This function returns zero if the file i
106. is a null pointer all input and output is unbuffered This effectively eliminates buffering Otherwise the stream is set to fully buffered mode Return Value This function does not return a value 3 132 pSOSystem System Calls pREPC System Calls setbuf Notes Callable From a Task Error Codes Refer to Appendix B See Also setvbuf pSOSystem System Calls 3 133 setlocale pREPC System Calls setlocale Obtains or changes the program s locale include lt locale h gt char setlocale int category const char locale Description localization category locale The setlocale function allows you to query or set certain parameters that are sensitive to the geo political location where a program is used For example in Europe the comma is sometimes used in place of the decimal point To query the locale or a portion thereof you set locale to point to NULL To change the locale or a portion thereof you set locale to point to a string that specifies the desired value Arguments category Specifies the localization category to be queried or changed and must be one of the following LCAL All categories C_COLLATE Affects the behavior of strcoll and strxfrm LC_CTYPE Affects the behavior of the character handling functions isalnum etc and the multibyte functions C_MONETARY Affects the monetary formatting information returned by localeco
107. it does so pMONT posts a message to a queue The rate at which this occurs depends on the data collection configuration and the application A message is posted to a queue at the end of every user specified Perfmeter update period If the Stack Checking feature is on a message is posted every time a stack warning is generated If the trace buffer overflows because a large number of object creates or deletes occur in a very short time ERR_EV_FULL is generated and pMONT disconnects from the ESp tool The way to prevent trace buffer overflow is to increase the buffer size by increasing the kc_nlocobj entry in the pSOS configuration table However this problem is not likely to occur in a time critical environment pSOSystem System Calls 6 7 log_event pROBE and ESp System Calls 6 8 pSOSystem System Calls Tables of System Calls This appendix is a collection of tables with information on pSOSystem system calls intended to help you locate a specific system call by its function rather than its name The first table lists all pSOSystem system calls alphabetically and provides for each call a one line description the pSOSystem component it belongs to and the page number where you can find more information The remaining tables alpha betically list the system calls for each component i e pSOS pHILE etc and provide for each call a one
108. less than the size of the datagram part of the datagram is discarded The next recv call reads the next datagram received but not the unread part of the previous datagram Unless ioct1 was used to mark the socket non blocking recv blocks the caller until a dat agram is available at the socket If the socket has been marked non blocking recv returns immediately whether or not datagrams are received If s is a raw socket every recv call receives one raw datagram The size of the raw datagram is defined by the sender If the len pa rameter is less than the size of the raw datagram part of the raw da tagram is discarded The next recv call reads the next raw datagram received not the unread part of the previous raw data gram Unless ioct1 was used to mark the socket non blocking recv blocks the caller until a raw datagram is available at the socket If the socket has been marked non blocking recv returns immediately whether or not raw datagrams are received The packet contains an IP header along with the packet body if any buf Points to the user buffer where the data is stored len Specifies the size in bytes of the buffer flags Specifies usage options and is the result of an OR operation per formed on one or more of the following symbolic constants defined in lt pna h gt Can also be set to 0 MSG_OOB Specifies that you want recv to read any out of band data present on the socket rather than the regula
109. line description and the page number where you can find more information A 1 Table of All pSOSystem Calls TABLE A 1 All pSOSystem System Calls Name Component Description Page abort pREPC Aborts a task 3 3 abs pREPC Computes the absolute value of an integer 3 4 accept pNA Accepts a connection on a socket 4 2 access_f pHILE Determines the accessibility of a file 2 5 add_ni pNA Adds a network interface 4 4 annex_f pHILE Allocates contiguous blocks to a file 2 8 as_catch psOS Specifies an asynchronous signal routine 1 3 asctime pREPC Converts the broken down time to a string 3 5 A 1 All pSOSystem System Calls Tables of System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page asctime_r pREPC Reentrant Converts the broken down time 3 6 to a string as_return psOSs Returns from an asynchronous signal rou 1 7 tine as_send psOSs Sends asynchronous signals to a task 1 9 assert pREPC Verifies that a program is operating cor 3 8 rectly atof pREPC Converts a string to a double 3 9 atoi pREPC Converts a string to an integer 3 11 atol pREPC Converts a string to a long integer 3 13 bind pNA Binds an address to a socket 4 6 bsearch pREPC Searches an array 3 15 calloc pREPC Allocates memory 3 17 cdmount_vol pHILE Mounts a CD ROM volume 2 10 cha
110. long regnum register number unsigned long reg_value register value Description This system call enables the caller to modify the contents of a task s notepad register Each task has 16 such software registers held in the task s TCB The purpose of these registers is to furnish every task with a set of named permanent variables Eight of these registers are reserved for system use and eight are free to be used for application specific purposes Arguments tid Specifies the task ID of the task whose notepad register is set If tid equals 0 the calling task sets its own notepad register regnum Specifies the register number Registers 0 through 7 are for application use and registers 8 through 15 are reserved for system use reg_value Specifies the value at which the register s contents are to be set Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Task already deleted 0x06 ERR_OBJID tid incorrect failed validity check 1 156 pSOSystem System Calls pSOS System Calls Hex 0x07 0x17 0x65 Notes Mnemonic ERR_OBJTYPE ERR_R EGN UM ERR_STALI EID t_setreg Description Object type doesn t match object ID failed validity check Register number out of range Object s node has failed The kernel does not deny access to the registers that the system reserves For future compatib
111. lt pna h gt and has the following format struct sockaddr_in short sin_family must be AF_INET unsigned short sin_port 16 bit port number struct in_addr sin_addr 32 bit IP address char sin_zero 8 must be 0 This structure cannot be packed If flags includes the MSG_INTERFACE constant then the struc ture pointed to by from is filled with the structure sockaddr_intf This is supported only for datagram sockets This feature is useful with unnumbered links where it may not be clear which interface the packet arrived on The structure sockaddr_intf is defined in lt pna h gt and has the following format struct sockaddr_intf short sin_family must be AF_INET unsigned short sin_port 16 bit port number struct in_addr sin_addr 32 bit IP address long sin_ifno 32 bit interface number char sin_zero 4 must be 0 The field sin_ifno identifies the interface number of the incom ing message s receiving interface fromlen An input output parameter On input it should point to an integer equal to 16 which is the size in bytes of both struct sockaddr_in and struct sockaddr_intf pSOSystem System Calls 4 49 recvfrom Return Value pNA System Calls This system call returns either the number of bytes received or 1 if an error occurred When the receive is shutdown by either end of the connection a value of 0 is returned Error Codes Hex
112. manager makes no attempt to verify that the current directory corresponds to the intended entities For example if the current directory is deleted or the volume containing the current directory is unmounted the results of operations by tasks using pathnames relative to the invalid current directory are unpredictable See Also get_fn stat_f pSOSystem System Calls 2 15 chmod_f pHILE System Calls chmod f Changes the mode of a named file include lt phile h gt unsigned long chmod_f char name file pathname int mode new file mode Volume Types NFS formatted volumes Description chmod_f changes mode of the named ordinary or directory file Arguments name Points to a null terminated pathname of a file mode Specifies the new file mode mode is the result of an OR operation performed on the following constants defined in lt phile h gt Mnemonic Description S_ISUID Set user ID on execution S_ISGID Set group ID on execution S_ISVTX Save text image after execution sticky bit S_IREAD Read permission owner S_IWRITE Write permission owner S_IEXEC Execute search permission owner S_IRGRP Read permission group S_IWGRP Write permission group S_IXGRP Execute search permission group S_IROTH Read permission other S_IWOTH Write permission other S_IXOTH Execute search permission other 2 16 pSOSystem System Calls pHILE System Calls Return
113. not reside on the local node the local kernel internally passes the message to each task s node of residence whose pSOS kernel will ready the task and give it the relayed message Thus a q_vbroadcast call whether it is on the local or a remote queue may cause pSOS m activities on one or more processor nodes pSOSystem System Calls 1 89 q_vbroadcast pSOS System Calls Callable From m Task m ISR if the target queue is local to the node from which the q_vbroadcast call is made See Also q_broadcast q_vsend q_vreceive 1 90 pSOSystem System Calls pSOS System Calls q_vcreate q_vcreate Creates a variable length message queue include lt psos h gt unsigned long q_vcreate char name 4 queue name unsigned long flags queue characteristics unsigned long maxnum maximum number of messages unsigned long maxlen maximum message length unsigned long qid queue identifier Description This system call creates a queue that supports variable length messages Otherwise it is identical to q_create q_vcreate creates a message queue by allocating and initializing a Queue Control Block QCB according to the specifications supplied with the call Arguments name Specifies the user assigned name of the new message queue flags Specifies the attributes of the queue flags is formed by OR ing the following symbolic constants one from each pair which are defined in lt psos
114. object ID failed validity check Ox1F ERR_SEGINUSE Cannot delete one or more segments still is use 0x27 ERR_TATRNDEL Informative only tasks were waiting 1 110 pSOSystem System Calls pSOS System Calls rn_delete Notes 1 Once created a region generally is used by multiple tasks for storing or passing data Reasons for deleting a region are rare Deleting a region is dangerous except as part of a partial or full system restart 2 The special region with rnid equal to O cannot be deleted Multiprocessor Considerations None since regions are local resources rn_delete can be called only from the local node Callable From a Task See Also rn_create pSOSystem System Calls 1 111 rn_getseg pSOS System Calls rn_getseg Allocates a memory segment to the calling task include lt psos h gt unsigned long rn_getseg unsigned long rnid region identifier unsigned long size requested size in bytes unsigned long flags segment attributes unsigned long timeout timeout in clock ticks void seg_addr allocated segment address Description This system call allocates a memory segment of the specified size from the specified memory region An allocated segment s size is always the nearest multiple of the region s unit size which is an input argument to the rn_create call If the calling task selects the RN_NOWAIT attribute then rn_getseg returns u
115. operations can be performed on the device For example an asynchronous serial device driver can reset communication parameters such as baud rate and parity to a known state for the channel being opened A device driver can also assign specific duties to the open routine that are not directly related to data transfer or device operations For example a device driver can use de_open to enforce exclusive use of the device during several read and or write operations Arguments dev Specifies the major and minor device numbers which are stored in the upper and lower 16 bits respectively iopb Points to an I O parameter block the contents of which are driver specific retval Points to a variable that receives a driver specific value returned by the driver Return Code This call returns O on success or an error code on failure Besides the error codes listed below other driver specific errors may be returned pSOSystem System Calls 1 17 de_open Error Codes Hex Mnemonic 0x101 ERR_IODN 0x102 ERR_NODR 0x103 ERR_IOOP Notes Callable From m Task See Also de_close 1 18 pSOS System Calls Description Illegal device major number No driver provided Illegal I O function number pSOSystem System Calls pSOS System Calls de_read de_read Reads from an I O device include lt psos h gt unsigned long de_read unsigned long dev major minor device number void iopb I O paramete
116. pREPC System Calls strtoul Converts a string to an unsigned long include lt stdlib h gt unsigned long strtoul const char nptr string char endptr string conversion terminator int base conversion base Description This function is equivalent to strtol except that the minus sign is not a valid character to strtoul and the string is converted to an unsigned long representation Arguments nptr Points to the string to be converted endptr An output parameter If endptr is null this function is equivalent to the atol function If endptr is not null it points to a pointer to the character in npt r that terminated the scan base Specifies the base of the number system assumed by the function base must be either 0 or within the range 2 through 36 If it is O the string itself is used to determine its base If nptr begins with the character 0 base eight is assumed if nptr begins with Ox or OX base sixteen is assumed otherwise base ten is assumed Return Value This function returns the converted value If an error occurs this function returns a O and sets errno Error Codes Refer to Appendix B 3 170 pSOSystem System Calls pREPC System Calls Notes Callable From a Task See Also atol pSOSystem System Calls strtoul 3 171 strxfrm pREPC System Calls strxfrm Transforms a string so that it can be used by the strcmp function include lt string h gt si
117. pSOS System Calls Notes Multiprocessor Considerations If the input ptid identifies a global partition residing on another processor node then the pSOS kernel internally makes an RSC to that remote node to return the buffer Callable From m Task m ISR if the partition is local to the node from which the pt_retbuf call is made m KI if the partition is local to the node from which the pt_retbuf call is made m Callout if the partition is local to the node from which the pt_retbuf call is made See Also pt_getbuf 1 58 pSOSystem System Calls pS0S System Calls pt_sgetbuf pt_sgetbuf Gets a buffer from a partition include lt psos h gt unsigned long pt_sgetbuf unsigned long ptid partition identifier void paddr physical address void laddr logical address Description This system call gets a buffer from a partition If the partition is empty an error is returned On MMU based systems both physical and logical addresses are returned to simplify transfer of buffers between supervisor and user mode programs In non MMU systems the logical address is the same as the physical address and this call functions the same as the pt_getbuf call This service is available in the non MMU versions of the pSOS kernel for the sole purpose of enabling software designed for MMU based systems to run unmodified on systems without MMU Arguments ptid Specifies the buffer s partition ID pad
118. partition must be made known to other processor nodes in a multiprocessor configuration If set the partition s name and ptid are sent to the master node for entry in the Global Object Table 2 If the PT_GLOBAL attribute is set and the number of global objects currently exported by the node equals the Multiprocessor Configuration Table entry mc_nglbobjs then the partition is not created and ERR_OBJTFULL is returned Callable From m Task See Also pt_ident pt_getbuf 1 50 pSOSystem System Calls pSOS System Calls pt_delete pt_delete Deletes a memory partition include lt psos h gt unsigned long pt_delete unsigned long ptid partition identifier Description This system call deletes a memory partition specified by its ID Unless the PT_DEL attribute was specified when the partition was created pt_delete returns an error if any buffers allocated from the partition have not been returned The calling task does not have to be the creator parent of the partition to be deleted However a partition must be deleted from the node on which it was created Arguments ptid Specifies the partition identifier Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBUDEL Partition has been deleted 0x06 ERR_OBJID ptid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID
119. pointed to by arg FIOSETOWN Assigns an owner to the socket The parameter arg should point to an integer that provides the task ID tid of the socket s owner This tid is passed as an input parameter to the user signal handler SIOCATMARK Determines whether out of band is available If the data available at the socket is out of band data the integer pointed to by arg is set equal to 1 Otherwise it equals 0 upon return SIOCSSBMAX Upon creation of a socket pNA assigns a maximum total default size of 128 Kbytes for send and receive socket buffer queues This operation changes the maximum total size This may be used to increase end to end throughput for fast networks SIOCGSBMAX Gets the total maximum send and receive socket buffer queue size that pNA assigns to newly created sockets Nl Related Operations The following operations are available to access or modify the characteristics of a Network Interface Operation Description SIOCSIFADDR Sets the interface address SIOCGIFADDR Gets the interface address SIOCSIFBRDADDR Sets the IP broadcast address of the NI SIOCGIFBRDADDR Gets the IP broadcast address of the NI pSOSystem System Calls 4 23 ioctl 4 24 pNA System Calls Operation Description SIOCSIFDSTADDR Sets point to point address for the interface SIOCGIFDSTADDR Gets point to point address for the interface SIOCSIFMTU Sets the maximum transmission unit of
120. position indicator for the stream pointed to by stream to the value of the object pointed to by pos A successful call to fsetpos function clears the EOF indicator for the stream and undoes any effects of the ungetc function on the same stream Arguments stream Points to an open pREPC stream If stream refers to an I O device this function does nothing and returns a 0 pos Points to an object that specifies the new value of the position indicator The object should contain a value previously returned by the fgetpos function on the same stream Return Value This function returns a 0 if successful and a nonzero number if unsuccessful If an error occurs errno is set Error Codes Refer to Appendix B pSOSystem System Calls 3 63 fsetpos Notes Callable From m Task See Also fgetpos pREPC System Calls pSOSystem System Calls pREPC System Calls ftell ftell Gets the file position indicator include lt stdarg h gt include lt stdio h gt long ftell FILE stream stream pointer Description The ftell function obtains the current value of the position indicator for the stream pointed to by stream This value can be passed to fseek as an input parameter For a binary stream the position indicator is the number of characters from the beginning of the file For a text stream the position indicator contains unspecified information usable by fseek function If stream refer
121. preemption turned off you place the symbolic constant T_NOPREEMPT in mode To specify that the task should have preemption turned off and roundrobin by time slicing turned on you place both T_NOPREEMPT and T_TSLICE in mode using the following syntax T_NOPREEMPT T_TSLICE PREEMPT Task is is not preemptible _NOPREEMPT T_TSLICE Task can cannot be time sliced T_NOTSLICE T_ASR Task s ASR is enabled disabled T_NOASR 1 158 pSOSystem System Calls pSOS System Calls _USER T_SUPV T_ISR T_NOISR EVELMASKO through EVELMASKn t start Task runs in user supervisor mode See User and Supervisor Modes under Target Hardware interrupts are enabled disabled while task runs These options are available only on certain processors See Interrupt Control under Target Certain hardware interrupts are disabled while the task runs These options are available only on certain processors See Interrupt Control under Target start_addr Specifies the task s location in memory targs Specifies four startup values passed to the task see Startup Values under Target Target Startup Values At the start of the task the CPU registers and the stack are initialized in such a way that if the outermost function of the task exits by mistake an illegal
122. representation of the file s FN For example if the file has an FN of 29 decimal the filename is set to VFN_0000001D f If faultp so requests verify_vol corrects this fault by setting the FN to zero that frees the entry for reuse verify_vol 2 138 pHILE System Calls Extent Map Faults The faults listed in Table 2 3 involve errors in the extent map of a particular file Recall that the extent map consists of Upto 10 extent descriptors within the file s FD m Within the file s FD an indirect block descriptor that describes an indirect block containing additional extent descriptors m Within the file s FD an index block descriptor that describes an index block containing additional indirect block descriptors verify_vol checks for illegal blocks both within an extent and within an indirect or index block descriptor A block is illegal if its block number is equal to or greater than the number of blocks on the volume For example on a volume containing 1000 blocks any block number greater than 999 is illegal A file can be viewed as a sequence of logical blocks numbered from 0 For example on a volume with 1K blocks a 4 3 Kbyte file would consist of logical blocks 0 through 4 logical block 4 being only partly filled Every FD every indirect block descriptor and every index block descriptor contains a last logical block LLB field that indicates the largest logical block number addressed by the associa
123. s 0x201B E_FIDOFF Invalid file ID file not open The file annex_f close dir ID provided on a pHILE call is not an open file close_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f lock_f lseek_f read_f write_f 0x201C E_ININFULL Index block full The physical size annex_f create_f of a file cannot be increased because the file s ftruncate_ f index block is full so that no more extent de make dir move_f scriptors can be added to the file This error truncate_f write _f code indicates that the file is badly scattered across the device The annex_ f call should be used to produce more contiguity in the file and reduce the number of extents On NFS vol umes this error code is returned if a file is too big 0x201D E_VFULL Volume full No more free blocks of annex_f create_f the required type control or data are available ftruncate_f on the volume This error can occur on a make_dir move_f write_f call whenever the file is extended truncate_f write f onacreate_f make_dir ormove_f if a directory must be extended or on an annex_f call 0x201E E_BADPOS Illegal position parameter to lseek_f lseek_f The LSEEK position parameter must be O 1 or 2 0x201F _EOF Seek past end of file The parameters lseek_f read dir provided to 1seek_ f would position the L_ptr beyond the logical end of the file Since the L_ptr is viewed by the pHILE file system manager as unsigned this error can also occ
124. s amp mask macro which returns a non zero value if s is a member of the set mask and 0 if it is not In addition the macros FD_SET s mask and FD_CLEAR s amp mask are provided for adding and removing socket descriptors to and from a set s is the socket descriptor and mask points to a bit mask data structure The macro FD_ZERO amp mask is provided to clear the set and should be used before the set is used These macros are defined in the file lt pna h gt Example The following example shows how to use select to determine if two sockets have available data fd_set read_mask struct timeval wait for wait tv_sec 1 wait tv_usec 0 FD_ FD_ FD_ nb if pSOSystem System Calls wait for 1 second ZERO amp read_mask SET sl amp read_mask SET s2 amp read_mask select FD_SETSIZE amp read_mask fd_set 0 fd_set 0 amp wait nb lt 0 error occurred or timed out 4 55 select pNA System Calls if FD_ISSET s1 amp read_mask socket 1 has data available if FD_ISSET s2 amp read_mask socket 2 has data available If two tasks attempt to use select on the same socket for the same conditions an error occurs Return Value A 1 is returned if an error occurs and the socket descriptor masks remain unchanged a O is returned if a timeout occurs On s
125. s current version of the date and time 1 173 tm_set Sets or resets the system s version of the date and time 1 175 tm_tick Announces a clock tick to the pSOS kernel 1 178 tm_wkafter Blocks the calling task and wakes it after a specified interval 1 180 tm_wkwhen Blocks the calling task and wakes it at a specified time 1 182 A 3 pHILE System Calls Table A 3 provides an alphabetical listing of all pHILE system calls a summary de scription for each call and a reference to more details about the call TABLE A 3 pHILE System Calls Name Description Page access_f Determines the accessibility of a file 2 5 annex_f Allocates contiguous blocks to a file 2 8 cdmount_vol Mounts a CD ROM volume 2 10 change_dir Changes the current directory 2 13 chmod_f Changes the mode of a named file 2 16 chown_f Changes the owner or group of a named file 2 19 close_dir Closes an open directory file 2 22 A 18 pSOSystem System Calls Tables of System Calls pHILE System Calls TABLE A 3 pHILE System Calls Continued Name Description Page close_f Closes an open file connection 2 22 create_f Creates a data file 2 25 fchmod_f Changes the mode of a file specified by its file identifier 2 29 fchown_f Changes the owner or group of a file specified by its file identi 2 32 fier fstat_f Obtains the statu
126. scription and a reference to more details about the call TABLE A 7 PROBE and ESp System Calls Name Tool Description Page db_input pROBE Prompts and gets input from the high level debug 6 3 ger db_output pROBE Outputs a string to the high level debugger 6 5 log_event ESp Logs an event on ESp s target resident application 6 6 monitor pMONT A 28 pSOSystem System Calls Error Codes This appendix is a collection of tables of pSOSystem error codes intended to help you identify which system call returned a specific error code Each table lists the codes belonging to a single pSOSystem component i e pSOS pHILE etc The table entry for each code includes a hexadecimal number a brief description in cluding the error mnemonic and a list of the system calls that can return the error pSOSystem components return error codes in two ways m pSOS and pHILE return error codes as function return values m pREPC pNA and pRPC load the error code into an internal variable that can be read through the macro errno If the return value of a pREPC pNA or pRPC system call indicates an error your application should examine the errno variable to determine the cause of the error See the description of errno on page 3 27 for more information Table B 1 lists the error code ranges of pSOSystem co
127. seconds the input specification should be 60x20 t icks 1200 Arguments ticks Specifies the number of ticks to elapse during the block An interval of n ticks awakens the calling task on the nth next tick Because tm_wkafter can happen anywhere between two ticks the actual interval is between n 1 and n ticks An interval of 0 ticks has a special function if no ready tasks have the same priority as the calling or running task the calling task continues On the other hand if one or more ready tasks with the same priority as the caller exist the pSOS kernel executes a round robin by placing the caller behind all ready tasks of the same priority and giving the CPU to one of those tasks This provides a manual round robin technique to voluntarily give the CPU to another ready task of the same priority Return Value This call always returns 0 Error Codes 1 180 None pSOSystem System Calls pSOS System Calls tm_wkafter Notes 1 The maximum interval is 232 1 ticks 2 Each successive tm_tick call counts down the specified delay interval If no clock or timer is provided the delay interval does not expire 3 A delayed task can additionally be suspended and countdown continues regardless If not cancelled suspension continues after expiration 4 A paused task can be deleted 5 tm_set calls do not affect a pause established by tm_wkafter because the pause counter is not changed even if the date an
128. str char NULL 10 Arguments nptr Points to the string to be converted Return Value This function returns the converted value If an error occurs errno is set to indicate the condition Error Codes Refer to Appendix B pSOSystem System Calls 3 11 atoi Notes Callable From m Task See Also strtol 3 12 pREPC System Calls pSOSystem System Calls pREPC System Calls atol atol Converts a string to a long integer include lt stdlib h gt long atol const char nptr string Description The atol function converts the initial part of the string pointed to by nptr toa long int representation Leading white spaces are ignored The conversion terminates when a nondigit character is detected If the first non whitespace character is not a digit a value of O is returned Except for the behavior on error this call is equivalent to strtol str char NULL 10 Arguments nptr Points to the string to be converted Return Value This function returns the converted value If an error occurs errno is set to indicate the condition Error Codes Refer to Appendix B pSOSystem System Calls 3 13 atol Notes Callable From m Task See Also strtol pREPC System Calls pSOSystem System Calls pREPC System Calls bsearch Searches an array bsearch include lt stdlib h gt void bsearch const void key const void base size_t nmemb size
129. success or an error code on failure pSOSystem System Calls 2 83 open_fn Error Codes Notes Hex 0x2003 0x200A 0x200C 0x200D 0x2018 0x2019 0x2023 0x2025 0x2050 Mnemonic E_BADVOL E_DMOUNT E_IFN E_NDD OFULL E_NOFCB E_BADF E_IDN E_BADNFS Primary Volume Descriptor pHILE System Calls Description Inconsistent data on volume volume corrupted Volume not mounted Illegal pathname No default directory Too many files open for task Too many files open in system Illegal or unused filename Illegal device name NFS volume illegal operation As a special case on CD ROM volumes the filename _VOLUME Y in the root directory is used to read the primary volume descriptor Refer to the description of open_f on page 2 78 for details See Also 2 84 open_f get_fn close_f pSOSystem System Calls pHILE System Calls pcinit_vol Initializes an MS DOS volume pcinit_vol include lt phile h gt unsigned long pcinit_vol char device volume name void scratch_buf scratch buffer unsigned long dktype type of volume Volume Types MS DOS formatted volumes Description pcinit_vol initializes a volume in MS DOS format pcinit_vol performs a logical format of the volume setting up the necessary control structures and other information needed by the pHILE file system manager for subsequent file opera
130. support compatibility with older drivers and or pSOS application code The pSOS bindings store a value into the variable pointed to by data_area Therefore a dummy variable still must be allocated to prevent memory corruption This call returns O on success or an error code on failure Besides the error codes listed below other driver specific errors may be returned Error Codes Hex 0x101 0x102 0x103 Notes Mnemonic ERR_IODN ERR_NODR ERR_IOOP Description Illegal device major number No driver provided Illegal I O function number 1 The pSOS kernel will automatically call de_init during system initialization if device auto initialization is enabled Refer to the pSOSystem System Concepts manual for further details 2 Normally de_init is called once from the ROOT task for each configured device driver This call is normally made before other driver services are used Callable From m Task See Also de_open 1 16 pSOSystem System Calls pSOS System Calls de_open de_open Opens an I O device include lt psos h gt unsigned long de_open unsigned long dev major minor device number void iopb I O parameter block address void retval return value Description The de_open call invokes the device open routine of a pSOS device driver specified by the dev argument The device open routine can be used to perform functions that need to be done before the I O
131. take care to restore the registers On PowerPC processors an ASR can be written in C and the pSOS kernel restores the registers Processor specific information on restoring registers prior to as_return is provided below On 68K processors an ASR is responsible for saving and restoring all CPU registers it uses including stack pointers The one exception to this rule is the register DO L which is restored by the pSOS kernel On 68K processors an ASR can be written only in assembly language 68K 260 On 960 processors an ASR is responsible for saving and restoring all CPU registers it uses including stack pointers The one exception to this rule is the register g0 which is restored by the pSOS kernel On 960 processors an ASR can be written only in assembly language On x86 processors an ASR is responsible for saving and restoring all CPU registers it uses including stack pointers The one exception to this rule is the register EAX which is restored by the pSOS kernel On x86 processors an ASR can be written only in assembly language pSOSystem System Calls 1 7 as_return pSOS System Calls Return Value If successful this system call never returns An error code is generated on failure Error Codes Hex Mnemonic Description Ox3E ERR_NOTINASR Illegal not called from an ASR Notes Multiprocessor Considerations None The actions performed by as_return are confined entirely to the local node Cal
132. the file to create expand_unit For pHILE formatted volumes only specifies the number of contiguous blocks to add whenever the file is expanded during a write_f system call mode For NFS volumes only specifies the access modes associated with the file and is the result of an OR operation performed on the following constants defined in lt phile h gt Mnemonic Description S_ISUID Set user ID on execution S_ISGID Set group ID on execution S_IRUSR Read permission owner S_IWUSR Write permission owner S_IXUSR Execute search permission owner S_IRGRP Read permission group S_IWGRP Write permission group pSOSystem System Calls 2 25 create _f Return Value S_IXGRP S_IROTH S_IWOTH S_IXOTH pHILE System Calls Execute search permission group Read permission other Write permission other Execute search permission other This system call returns 0 on success or an error code on failure Error Codes Hex 0x2003 0x200A 0x200B 0x200C 0x200D 0x200E 0x200F 0x2010 0x2011 0x2012 0x2015 0x201C 0x201D 0x2025 0x2051 0x2052 0x2054 2 26 Mnemonic E_BADVOL bi _ DMOUNT E_FNAME E_IFN E_NDD E_FORD E_ASIZE E_NODE E_FEXIST E_FLIST bi RO ti H Zz H FULL ti H J 7 D x sO0P E_EREMOTE Description Inconsistent data on volume volume corrupted
133. the task is explicitly resumed by another task in the system Error Codes None Notes Callable From m Task See Also exit pSOSystem System Calls 3 3 abs pREPC System Calls abs Computes the absolute value of an integer include lt stdlib h gt int abs int j long integer Description The abs function converts the integer j into its absolute value If the result cannot be represented the behavior is undefined Arguments j Specifies the integer to be converted Return Value abs returns the absolute value Error Codes None Notes Callable From m Task m ISR See Also labs 3 4 pSOSystem System Calls pREPC System Calls asctime asctime Converts the broken down time to a string include lt time h gt char asctime const struct tm timeptr broken down time Description The function asctime converts the broken down time pointed to by timeptr to an equivalent string representation of the form Sun Jan 1 12 30 13 1995 n 0 Arguments timeptr Points to a tm structure that stores the broken down time The tm structure is defined in the mktime description on page 3 111 Return Value The asctime function returns a pointer to the calendar time string Error Codes Refer to Appendix B Notes This function is non reentrant as it returns a pointer to a statically allocated data area The reentrant version of this function is asctime_r
134. the value of s1 Error Codes None 3 106 pSOSystem System Calls pREPC System Calls Notes Callable From a Task a ISR See Also memmove strcpy strncpy pSOSystem System Calls memcpy 3 107 memmove pREPC System Calls memmove Copies characters in memory include lt string h gt void memmove void s1 destination address const void s2 source address size tn source length Description This function copies a specified number of characters from one object into another memmove copies the data correctly even if the memory areas overlap unlike memcpy Arguments sl Points to the source object s2 Points to the destination object n Specifies the number of characters to be copied Return Value This function returns the value of s1 Error Codes None 3 108 pSOSystem System Calls pREPC System Calls Notes Callable From a Task a ISR See Also memcpy strcpy strncpy pSOSystem System Calls memmove 3 109 memset pREPC System Calls memset Initializes memory with a given value include lt string h gt void memset void s object address int c initialization value size tn number of characters Description The memset function copies the value of c converted to an unsigned char into each of the first n characters in the object pointed to by s Arguments Ss Points to the object where the character is to be cop
135. to start at if rc change_dir directory 0 Error processing Constructing absolute path name starting at the saved directory define REL PATH LEN 8 Length of path below saved directory char path 28 PATH_LEN Absolute path of file txt sprintf path 0x 04x 0x 02x 0x 02x 0x 08x s device gt gt 16 Major device number device gt gt 8 amp OxffU Minor device number device amp OxffU Partition number pSOSystem System Calls 2 107 stat_f pHILE System Calls directory File number to start at file txt Relative path below saved directory See Also fstat_f chmod_f fchmod_f chown_f fchown_f link_f read_f read_link truncate_f ftruncate_f remove_f utime_f write_f 2 108 pSOSystem System Calls pHILE System Calls stat_vfs stat_vfs Gets statistics for a named volume include lt phile h gt unsigned long stat_vfs char name file pathname struct statvfs buf volume statistics Volume Types All volume types Description stat_vfs returns information about a mounted volume Arguments name Points to a null terminated pathname of any file within the mounted volume buf Points to a statvfs structure defined in lt phile h gt as follows typedef struct long val 2 fsid_t struct statvfs unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned long f_bsize long
136. to the format control string For more information see fscanf on page 3 56 Arguments 1 through n point to variables where input is stored Return Value This function returns EOF and sets errno if an input failure occurs before any conversion Otherwise it returns the number of input items assigned which can be fewer than provided even zero in the event of an early matching failure Error Codes Refer to Appendix B 3 130 pSOSystem System Calls pREPC System Calls Notes Callable From m Task See Also printf scanf sscanf pSOSystem System Calls scanf 3 131 setbuf pREPC System Calls setbuf Changes a stream s buffer include lt stdarg h gt include lt stdio h gt void setbuf FILE stream stream pointer char buf I O buffer Description The setbuf function causes a new buffer to be used for a specified stream instead of the buffer that is currently assigned The buffer is assumed to have a size equal to 1c_bufsize which is defined in the PREPC Configuration Table The setbuf function must be called after the specified stream has been opened but prior to performing any read or write operation on the stream If setbuf is called after a read or write operation it has no effect You must use the setvbuf call if you want additional control over buffering options Arguments stream Points to an open pREPC stream buf Points to the new buffer If buf
137. used by pHILE file system manager There are a number of possible strategies for handling bad blocks One strategy is to mask or redirect them at the driver level so that pHILE file system manager never sees them Another method which is described here in detail involves mapping out those blocks in the volume s bitmap so that they are never allocated by pHILE file system manager verify_vol facilitates such modifications to the bitmap Recall that each volume contains a bitmap describing which blocks on the volume are in use and which are free If the corresponding bit in the map is set to 1 the block is considered to be in use otherwise it is considered to be available for allocation by the pHILE file system manager when needed If the bit corresponding to a bad block can be set to 1 before the block is allocated then the pHILE file system manager will never allocate the block and hence will never read or write it To facilitate bad block handling verify_vol accepts as an input parameter a list of bad blocks When examining the volume s bitmap verify_vol expects bits corresponding to these bad blocks to be set to 1 while at the same time expecting the block to be unused If a bad block is in use or its corresponding bit is not set a fault is generated The remainder of this section gives a brief outline of a recommended method for handling bad blocks There are two types of bad blocks Dead Blocks These bl
138. with an exception from an external source See kernel interface A user provided communication layer between nodes in a multi processing environment pSOS m Network file system Network interface See remote service call A service call made from one node to another in a multiprocessing environment pSOS m pSOSystem System Calls Using This Manual Related Publications ROOTBLOCK The root block on a pHILE formatted volume which contains all information needed by pHILE to locate other vital information on the volume socket The endpoint for communication across a network task The smallest unit of execution in a system designed with pSOSystem that can compete on its own for system resources TCP IP Transport Control Protocol Internet Protocol a software protocol UDP for communications between computers User Datagram Protocol Related Publications When using the pSOSystem operating system you might want to have on hand the other manuals included in the basic documentation set pSOSystem Getting Started explains how to create and bring up pSOSystem based applications This manual also contains a number of tutorials pSOSystem System Concepts provides theoretical information about the opera tion of pSOSystem pSOSystem Programmer s Reference is the primary source of information on net work drivers and interfaces system services configuration tables memory us age data and processor specific a
139. 0 ungetc Ungets a character 3 181 vfprintf Writes formatted output to a stream 3 183 vprintf Writes formatted output to stdout 3 185 vsprintf Writes formatted output to a buffer 3 187 wcstombs Converts a wide character string into a multibyte character 3 189 string wctomb Converts a wide character into its multibyte character equiva 3 191 lent pSOSystem System Calls A 25 pNA System Calls Tables of System Calls A 5 pNA System Calls Table A 5 provides an alphabetical listing of all pNA system calls a summary de scription for each call and a reference to more details about the call TABLE A 5 pNA System Calls Name Description Page accept Accepts a connection on a socket 4 2 add_ni Adds a network interface 4 4 bind Binds an address to a socket 4 6 close Closes a socket descriptor 4 8 connect Initiates a connection on a socket 4 9 get_id Gets a task s user ID and group ID 4 12 getpeername Gets the address of a connected peer 4 13 getsockname Gets the address that is bound to a socket 4 15 getsockopt Gets options on a socket 4 17 ioctl Performs control operations on a socket 4 22 listen Listens for connections on a socket 4 38 pna_allocb Allocates a message block 4 39 pna_esballoc Attaches a message block to the data buffer 4 41 pna_freeb Frees a message block 4 43 pna_freemsg Frees all the message blocks associated with a messa
140. 00C E_IE Illegal pathname 0x200D E_NDD No default directory 0x2018 E_OFULL Too many files open for task 0x2019 E_NOFCB Too many files open in system 0x2025 E_ID Illegal device name 0x2051 E_MAXLOOP Symbolic links nested too deeply 2 76 pSOSystem System Calls pHILE System Calls Hex 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E See Also close_dir pSOSystem System Calls Mnemonic EREMOTE EIO _ EACCES _ ESTALE EAUTH ENF S ETIMEDOUT ENOAUTHBLK _ ECANTSEND _ ECANTRECV E_PROBUNAVAIL ECANTDECODEARGS EUNKNOWNHOST EPROGVERSMISMATCH EPROGNOTREGISTE E_UNKNOWNPROTO EINTR ERPC read_dir open_dir Description Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not r
141. 010230 ERM_FRAMING Framing error 0x10010231 ERM_PARITY Parity error 0x10010232 ERM_OVERRUN Overrun error 0x10010233 ERM_NMBLK No buffer headers esballoc failed 0x10010234 ERM_TXQFULL Transmit queue is full is returned only if WNWAIT is set 0x10010235 ERM_NWNCONF MaxWTime and WNWAIT both set 0x10010236 ERM_BADCONSL Bad default console number 0x10010237 ERM_WABORT Write was aborted B 6 4 Tick Timer Driver Error Codes The error codes listed in Table B 13 are returned by the tick timer driver TABLE B 13 Tick Timer Driver Error Codes Hex Mnemonic and Description 0x10020001 TIMR_TICKRATE Unsupported rate for kc_ticks2sec pSOSystem System Calls B 47 Driver Error Codes Error Codes B 6 5 RAM Disk Driver Error Codes The error codes listed in Table B 14 are returned by the RAM disk driver TABLE B 14 RAM Disk Driver Error Codes Hex Mnemonic and Description 0x10040001 RDSK_BLOCK Block number too large 0x10040002 RDSK_SEM Semaphore error 0x10040003 RDSK_MEM Memory error B 6 6 TFTP Driver Error Codes The error codes listed in Table B 15 are returned by the TFTP driver TABLE B 15 TFTP Driver Error Codes Hex Mnemonic and Description 0x 10060001 TF TP_PROTO Protocol error detected such as receipt of a non DATA packet or lack of an expected message acknowledg ment 0x10060002 TF TP_TMOUT T
142. 02 If qid identifies a global queue residing on another processor node the local kernel will internally make an RSC to that remote node to post the input message to that queue If a task awakened by this call does not reside on the local node the local kernel will internally pass the message to the task s node of residence whose psoS m kernel will ready the task and give it the relayed message Thus a q_vsend call whether it is on the local or a remote queue may cause pSOS m activities on another processor node pSOSystem System Calls pSOS System Calls q_vsend Callable From m Task m ISR if the target queue is local to the node from which the q_vsend call is made m KI if the target queue is local to the node from which the q_vsend call is made Callout if the target queue is local to the node from which the q_vsend call is made See Also q_send q_vreceive pSOSystem System Calls 1 103 q_vurgent pSOS System Calls q_vurgent Posts a message at the head of a variable length message queue include lt psos h gt unsigned long q_vurgent unsigned long qid queue identifier void msg_buf message buffer unsigned long msg_len length of message Description This system call is identical in all respects to q_vsend with one and only one exception if one or more messages are already posted at the target queue then the new message will be inserted into the queue s message q
143. 07 rn_delete psOS Deletes a memory region 1 110 rn_getseg psOS Allocates a memory segment to the calling 1 112 task rn_ident pSsost Obtains the region identifier of the named 1 115 region rn_retseg psOSs Returns a memory segment to the region 1 117 from which it was allocated rpc_getcreateerr pRPC Returns the reason for an RPC client handle 5 6 creation failure scanf pREPC Reads formatted input from stdin 3 130 select pNA Checks the status of multiple sockets 4 54 send pNA Sends data to a socket 4 57 sendmsg pNA Sends data to a socket 4 60 sendto pNA Sends data to a socket 4 62 set_id pNA Sets a task s user ID and group ID 4 65 setbuf pREPC Changes a stream s buffer 3 132 setlocale pREPC Obtains or changes the program s locale 3 134 A 10 pSOSystem System Calls Tables of System Calls All pSOSystem System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page setsockopt pNA Sets options on a socket 4 66 setvbuf pREPC Changes a stream s buffering characteris 3 136 tics shr_socket pNA Obtains a new socket descriptor for an ex 4 73 isting socket shut down pNA Terminates all or part of a full duplex con 4 74 nection sm_av psOS pSOS m kernel only Asynchronously re 1 119 leases a semaphore token sm_create psOS Creates a semaphore 1 121 sm_delete psOS Deletes a semaph
144. 0x201A 0x201B 0x2022 0x2052 0x2054 0x2055 0x2056 0x2058 0x205B 0x205C 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D Mnemonic E_BADVOL E_FIDBIG E_FIDOFE ETIMEDOUT ENOAUTHBLK _ ECANTSEND ECANTRECV E_PROBUNAVAIL EPROGVERSMISMATCH ECANTDECODEARGS EUNKNOWNHOST EPROGNOTREGISTERE E_UNKNOWNPROTO EINTR pHILE System Calls Description Inconsistent data on volume volume corrupted Invalid FID exceeds maximum Invalid FID file closed Data locked Too many levels of remote in path A hard error occurred at remote site Task does not have the necessary access permissions Illegal operation on a directory Stale NFS file handle No such device or address No such device RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted pSOSystem System Calls pHILE System Calls read _f Hex Mnemonic Description 0x207E ERPC All other RPC errors Notes
145. 0x2054 0x2055 0x2058 0x205B 0x205C 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 pSOSystem System Calls Mnemonic DMOU E NAME FORD OFULL AXLO E_BADVOL OP EREMO TE EIO EACCE ETIME DOUT ENOAU THBLK ECANT SEND _ ECANT __PROBU RECV NAVAIL EPROG VERSMISMATCH open_f Description Inconsistent data on volume volume corrupted Volume not mounted Filename not found Illegal pathname No default directory Directory file expected Too many files open for task Too many files open in system Illegal device name Symbolic links nested too deeply Too many levels of remote in path A hard error happened at remote site Task does not have access permissions Stale NFS file handle No such device or address No such device RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched 2 79 open_f Notes 2 80 Hex 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E Mnemonic _ ECANTDECODEARGS __EUNKNOWNHOST _ EPROGNOTREGISTE _ 6UNKNOWNPROTO _EINTR PC
146. 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 2 20 Mnemonic E_NDD E_RO E_IDN E_BADMS E_MAXLOOP EREMOTE _ BIO _ EACCES _ ESTALE _ ENXIO _ ENODEV E_BADCD _ EAUTH _ ENFS _ ETIMEDOUT _ ENOAUTHBLK _ ECANTSEND _ ECANTRECV E_PROBUNAVAIL EPROGVERSMISMATCH ECANTDECODEARGS EUNKNOWNHOST EPROGNOTREGISTERED E_UNKNOWNPROTO pHILE System Calls Description No default directory Operation not allowed on read only system files directories or mounted volumes Illegal device name MS DOS volume illegal operation Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol pSOSystem System Calls pHILE System Calls chown_f Hex Mnemonic Description 0x207D E_EINTR
147. 2 There is no notion of segment ownership A segment can be returned by a task other than the one that originally allocated it 3 If there are tasks waiting for memory from this region then such requests will be re examined and allocation granted where possible in the order of the wait queue FIFO or by task priority 4 Note that the calling task may be preempted if a task waiting for memory segment is unblocked as a result of the returned segment and that task has higher priority Multiprocessor Considerations None since regions are strictly local resources rn_retseg can be called only from the local node Callable From m Task See Also rn_getseg 1 118 pSOSystem System Calls pSOS System Calls sm_av sm_av pSOS m kernel only Asynchronously releases a semaphore token include lt psos h gt unsigned long sm_av unsigned long smid semaphore identifier Description This system call is used to asynchronously release a semaphore token It is identical to sm_v except the call is made asynchronously Refer to the description of sm_v for further information This call is only supported by the pSOS m kernel the multiprocessor version Arguments smid Specifies the semaphore ID of the semaphore token to release Return Value When called in a system running the pSOS m kernel this call always returns 0 The pSOS kernel the single processor version returns ERR_SSFN Error Codes If the sm_v
148. 444 LR a a 844404404 8444 4 64 06 04 2 vii Conventions neme mimi eee Eea a E E E E E E E E E n en fe viii Font Conventions 1 0 eee AS viii Symbol Conventions LL ix Format Conventions vii lea nana lea ehh wg alo oat Sasa i ides sabe WLS Se ix Note Caution and Warning Conventions 00 eer xi Revision Bar Convention 0 EEEE EEE EEE ee ee eee xii Commonly Used Terms and Acronyms LL xii Related Publications scc s PE PAP ELSE EE OPPS EROS EPL ERE sf pi SEP ESE SS xiii PULP POLE 4 i iolanda xiv Contacting Integrated Systems Support 0 0 2 00 00008 XV Contents pSOS System Calls pHILE System Calls pREPC System Calls pNA System Calls pRPC System Calls pROBE and ESp System Calls Tables of System Calls A l Table of All pSOSystem Calls 0 0 0 0 0 0 0 0000000000 A 1 A 2 psOS System Calls cess we eee Se Ee ee E aY A 15 A 3 pHILE System Calls A 18 A 4 PREPE System Calls 4 15 pid i 24 04 P4404 048404 MARS AS RG OE DH A 20 A 5 PNA System CallS sss scene eee ee po ee oP EE Oe Pe ee ee gm A 26 A 6 pRPC System Calls i i Giur Re A 27 A 7 pROBE and ESp System Calls A 28 Error Codes B 1 PSOST Error Codes 248 28 o8 0 oS ON 28 oF owe oR ob wee OS we eee B 4 B 2 pHILE Error Codes B 15 B 2 1 pSOS Errors Related to pHILE B 34 B 2 2 Conversions of NFS Error Codes 02 0 5 B 35 pSOSys
149. 65 ERR_STALEID Object s node has failed 0x66 ERR_NDKLD Object s node failed while RSC waiting Notes If it is necessary to block the calling task sm_p will enter the calling task in the semaphore s task wait queue If the semaphore was created with the SM_FIFO attribute then the task is simply entered at the tail of the wait queue If the semaphore was created with the SM_PRIOR attribute then the task is inserted into the wait queue by priority Multiprocessor Considerations If smid identifies a global semaphore residing on another processor node the local kernel will internally make an RSC to that remote node to acquire a semaphore token If the SM_WAIT attribute is used then the pSOS kernel on the target node must use an agent to wait for the semaphore token If that node is temporarily out of agents the call will fail The number of agents on each node is defined by the mc_nagent entry in the node s Multiprocessor Configuration Table pSOSystem System Calls 1 129 sm_p pSOS System Calls Callable From m Task m ISR if SM_NOWAIT is set and the semaphore is local to the node from which the sm_p call is made m KI if SM_NOWAIT is set and the semaphore is local to the node from which the sm_p call is made Callout if SM_NOWAIT is set and the semaphore is local to the node from which the sm_p call is made See Also sm_v 1 130 pSOSystem System Calls pSOS System Calls sm_v sm_V Releases a semaphore token incl
150. 70 pSOSystem System Calls pSOS System Calls q_broadcast q_broadcast Broadcasts identical messages to an ordinary message queue include lt psos h gt unsigned long q broadcast unsigned long qid queue identifier unsigned long msg_buf 4 msg of 4 long words unsigned long count tasks receiving msg Description This system call enables the caller to wake up all tasks that might be waiting at an ordinary message queue If the task queue is empty this call does nothing If one or more tasks are waiting at the queue q_broadcast gives a copy of the input message to each such task and makes it ready to run After a q_broadcast call no tasks will be waiting to receive a message from the specified queue Arguments qid Specifies the queue ID of the target queue msg_buf Specifies the message to send count Points to the variable where q broadcast stores the number of tasks readied by the broadcast Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Queue has been deleted 0x06 ERR_OBJID qid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check Ox3A ERR_VARO Queue is variable length pSOSystem System Calls 1 71 q_broadcast Notes 1 72 Hex pSOS System Calls Mnemonic Description 0x65 ERR_STALEID Object s node has f
151. ABRESETS SIOCGTCPCURRESTAB SIOCGTCPINSEGS SIOCGTCPOUTSEGS SIOCGTCPRETRANSSEGS SIOCGTCPCONNTABLE SIOCGTCPCONNSTATE SIOCGTCPINERRS SIOCGTCPOUTRSTS SET Command Definitions SIOCSTCPCONNSTATE Definitions for UDP MIB Variables GET Command Definitions S IOCGUDP INDATAGRAMS SIOCGUDPNOPORTS TCP retransmission algorithm TCP minimum retransmission timeout TCP maximum retransmission timeout TCP maximum simultaneous connections Number of direct transitions to SYN SENT state from the CLOSED state Number of direct transitions to SYN RCVD state from the LISTEN state Number of failed TCP connection attempts Number of TCP connections reset Number of current TCP connections Number of TCP segments received Number of TCP segments sent Number of TCP segments retransmitted TCP connection table State of this TCP connection Number of TCP segments received in error Number of TCP segments sent with RST flag State of this TCP connection UDP datagrams delivered to UDP users UDP datagrams received for unknown ports pSOSystem System Calls pNA System Calls GET Command Definitions SIOCGUDPINERRORS SIOCGUDPOUTDATAGRAMS SIOCGUDPTABLE Return Value ioctl UDP datagrams received with other errors UDP datagrams sent from this entity pNA UDP listener table This system call returns 0 if successful otherwise it returns 1 Error Codes Hex
152. BJDEL Partition has been deleted 0x06 ERR_OBJID ptid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check Ox2C ERR_NOBUF Cannot allocate partition out of free buffers 0x65 ERR_STALEID Object s node has failed pSOSystem System Calls 1 53 pt_getbuf pS0S System Calls Notes 1 Buffers always start on long word boundaries 2 It is not possible to wait for a buffer pt_getbuf unconditionally returns Multiprocessor Considerations If the input ptid identifies a global partition residing on another processor node then the pSOS kernel internally makes an RSC to that remote node to allocate the buffer Callable From m Task m ISR if the partition is local to the node from which pt_getbuf is made m KI if the partition is local to the node from which pt_getbuf is made m Callout if the partition is local to the node from which pt_getbuf is made See Also pt_retbuf 1 54 pSOSystem System Calls pSOS System Calls pt_ident pt_ident Obtains the identifier of a named partition unsigned long pt_ident char name 4 partition name unsigned long node node number unsigned long ptid partition identifier Description This system call enables the calling task to obtain the partition ID of a memory partition it only knows by name This partition ID can be used in all other operations relating to the memory partition
153. Before accept is called the socket must be set up to receive a connection request by issuing the listen system call accept extracts the first connection request on the queue of pending connections creates a new socket with the same properties as the original socket completes the connection between the foreign socket and the new socket and returns a descriptor for the new socket The new returned socket descriptor is used to read from and write data to the foreign socket It is not used to accept more connections The original socket remains open for accepting further connections If no pending connections exist on the queue and the socket is not marked as non blocking accept blocks the caller until a connection is present If the socket is marked non blocking and no pending connections are present on the queue accept returns an error Upon return accept stores the address of the connected socket in the specified socket address structure Arguments 4 2 Ss Specifies the socket on which to accept a connection re quest pSOSystem System Calls pNA System Calls addr addrlen Return Value accept Points to a structure of type sockaddr_in where accept stores the address of the connected socket The structure sockaddr_in is defined in the file lt pna h gt and has the fol lowing format struct sockaddr_in short sin_family must be AF_INET unsigned short sin_port 16 bit port number
154. Call interrupted 0x207E ERPC All other RPC errors See Also fchown_f stat_f fstat_f chmod_f fchmod_f open_f pSOSystem System Calls 2 21 close_dir pHILE System Calls close_dir Closes an open directory file include lt phile h gt unsigned long close_dir XDIR dir NFS directory handle Volume Types All volume types Description close_dir closes the connection to a directory specified by the directory handle dir Arguments dir Points to an XDIR structure defined in lt phile h gt Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2003 E_BADVOL Inconsistent data on volume 0x201A E_FIDBIG Invalid FID exceeds maximum 0x201B E_FIDOFF Invalid FID file closed 0x2052 E_EREMOTE Too many levels of remote in path 0x2055 E_EACCES Task does not have access permissions See Also open_dir 2 22 pSOSystem System Calls pHILE System Calls close_f close _f Closes an open file connection include lt phile h gt unsigned long close_f unsigned long fid file identifier Volume Types All volume types Description close_f closes the connection designated by the file identifier fid If fid is 0 close_f closes all of the files opened by the calling task If close_f terminates the last connection to a file the file s FCB is deallocated Arguments fid Specifies the fil
155. Callable From a Task See Also asctime_r ctime mktime time pSOSystem System Calls 3 5 asctime_r pREPC System Calls asctime_r Reentrant Converts the broken down time to a string include lt time h gt char asctime_r const struct tm timeptr pointer to broken down time char buf result buffer int buflen result buffer length Description asctime_r is the reentrant version of the ANSI function asctime as defined by POSIX 1003 1c It converts the broken down time pointed to by timeptr to an equivalent string representation of the form Sun Jan 1 12 30 13 1995 n 0 and stores the string in the buffer pointed to by buf which is assumed to have space for at most buflen characters An error may be returned if the converted string contains more than buflen characters Arguments timeptr Points to a structure of type tm that stores the broken down time The tm structure is defined in the mkt ime description on page 3 111 buf Points to the buffer where asctime_r stores the result buflen Specifies the size of buf Return Value Upon success asctime_r returns the value of buf On failure it returns NULL and sets errno Error Codes Refer to Appendix B 3 6 pSOSystem System Calls pREPC System Calls Notes Callable From m Task See Also asctime ctime ctime_r mktime time pSOSystem System Calls asctime_r 3 7 assert pREPC System Calls assert Verifie
156. Calls vsprintf vsprintf Writes formatted output to a buffer include lt stdio h gt include lt stdarg h gt int vsprintf char s target buffer const char format format control va_list char arg argument list Description The vsprintf function is equivalent to sprintf with the variable argument list replaced by arg which should have been initialized by the va_start macro and possibly subsequent va_arg calls The vfprintf function does not invoke the va_end macro Arguments S Points to the buffer where output is directed format Points to the format control string For more information see fprintf on page 3 43 arg A list of arguments to be written according to the specifications of the format control string Return Value This function returns the number of characters written If a write error occurs this function returns a negative number and sets errno Error Codes Refer to Appendix B pSOSystem System Calls 3 187 vsprintf Notes Callable From m Task See Also printf sprintf fprintf 3 188 pREPC System Calls pSOSystem System Calls pREPC System Calls wcstombs wcstombs Converts a wide character string into a multibyte character string include lt stdlib h gt size_t wstombs char s result string const wchar_t pwcs wide string size tn size of result string Description The wcstombs function converts a sequence of codes th
157. Description Detailed Description please attach supporting information pSOSystem System Calls pSOS System Calls This chapter provides detailed information on each system call in the pSOS component of pSOSystem The calls are listed alphabetically with a multipage section of information for each call Each call s section includes its syntax a detailed description its arguments its return value and any error codes that it can return In addition it includes information specific to certain processors if such information is needed Where applicable the section also includes the headings Notes and See Also The Notes entry provides important information not specifically related to the call description In particular it identifies how the pSOS m kernel handles the call if multiple processors are involved see Multiprocessor Considerations and indicates where the call can be made See Also lists other system calls that have related information If you need to look up a system call by its functionality refer to Appendix A Tables of System Calls which lists the calls alphabetically by component and provides a brief description of each call For more information on error codes refer to Appendix B Error Codes which lists the codes numerically and shows which pSOSystem calls are associated with e
158. Display each fault in detail m Indicate if the fault is fixable m And if so ask the user if he wants it fixed m And if so return status 1 to verify_vol Faults that are not fixable may require additional user action For example you may perform the following steps repeatedly 1 Use verify_vol to correct all fixable errors and obtain a list of non fixable errors 2 Examine copy and delete the affected files as required When step 1 produces no more faults you can consider the volume corrected The Fault Descriptor Block FDB The structure fault_desc_block defines the FDB in phile h as follows typedef struct fault_desc_block unsigned long fdb_code fault code unsigned long fdb_fnl file number for file 1 unsigned long fdb_fn2 file number for file 2 char fdb_pathl pathname for file 1 char fdb_path2 pathname for file 2 unsigned long fdb_bn block number unsigned long fdb_fixable fault fixable indicator FAULT_DESC_BLOCK pSOSystem System Calls pHILE System Calls verify_vol This structure cannot be packed The contents of the fault_desc_block fields are as follows fdb_code fdb_fnl fdb_fn2 fdb_pathl fdb_path2 fdb_bn fdb_fixable Fault Types Contains a fault code describing the type of fault Contains the file number of the file For faults involving two files contains the file number of the second file Contains a poin
159. E error codes Table B 5 shows the conversions of these codes If an NFS error not listed below is received it is mapped to the code 1 E_FAIL 0x2002 pHILE failure This should never happen unless a new NFS error code is defined at the server Codes whose second to last digit is not 5 can also represent errors from other file systems TABLE B 5 pHILE Error Codes That Represent NFS Errors on a directory pHILE Hex pHILE Description NFS Hex NFS Description 0x200B E_FNAME Filename not 0x02 No such file or directory found 0x200C E_IFN Illegal pathname Ox3f File name too long 0x200E E_FORD Directory file ex 0x14 Not a directory pected 0x2011 _FEXIST File already ex Ox11 File exists ists 0x2014 _DNE Directory not empty 0x42 Directory not empty 0x2015 E_RO Illegal on system or di Oxle Read only file system rectory file 0x201C E_ININFULL Index block Ox1b File too large full 0x201D E_VFULL Volume is full Oxlc No space left on device 0x2052 __EREMOTE Too many levels 0x47 Too many levels of remote in of remote in path path 0x2053 _PERM Task does not have Ox01 Not owner ownership 0x2054 __EIO Hard error happened 0x05 I O error at remote site 0x2055 _EACCESS Task does not 0x0d Permission denied have access permissions 0x2056 _EISDIR Illegal operation 0
160. E stream stream pointer Description The clearerr function clears the end of file and error indicators for the stream pointed to by stream Arguments stream Points to an open pREPC stream Return Value This function does not return a value If an error occurs errno is set Error Codes Refer to Appendix B Notes Callable From a Task pSOSystem System Calls 3 19 ctime pREPC System Calls ctime Converts the calendar time to a string include lt time h gt char ctime const time_t timer calendar time Description The ctime function converts the calendar time pointed to by timer to a string representation of the form Sun Jan 1 12 30 13 1995 n 0 The time is represented in local time This call is equivalent to asctime localtime timer The calendar time is generally obtained through a call to time The buffer used by ctime to hold the formatted output string is a statically allocated character array and is overwritten each time the function is called To save the contents of the string you need to copy it elsewhere Arguments timer Points to the calendar time Return Value The ctime function returns the pointer to the converted calendar time string Error Codes Refer to Appendix B Notes This function is non reentrant as it returns a pointer to a statically allocated data area The reentrant version of this function is ctime_r 3 20 pSOSystem Sys
161. E _DMOUNT Volume not mounted 0x2015 E_RO Operation not allowed on read only system files directories or mounted volumes 0x2025 E_IDN Illegal device name 0x2050 E_BADNFS NFS volume illegal operation 0x2060 E_BADCD CD ROM volume illegal operation Notes If index is larger than the volume s block size the write begins in a subsequent block For example on a volume with a 1024 byte block size writing block 5 index 1224 is the same as writing block 6 index 200 write_vol does not check for the end of the volume blocks beyond the specified volume size can be written if they physically exist If the requested data includes either entire blocks or a contiguous sequence of blocks and if such blocks are not already in the buffer cache the pHILE file system manager writes the blocks directly to the volume without going through the buffer cache Therefore write_vol operations are more efficient when bcount and index equal integral multiples of blocks write_vol execution on any block is allowed including blocks in system files Therefore use this call cautiously CD ROM volumes are read only See Also read_vol 2 146 pSOSystem System Calls pREPC System Calls This chapter provides detailed information on each system call in the pREPC component of pSOSystem The calls are listed alphabetically with a multipage section of informatio
162. ENODEV _ EAUTH ENFS ETIMEDOUT ENOAUTHBLK ECANTSEND ECANTRECV E_PROBUNAVAIL EPROGVERSMISMATCH ECANTDECODEARGS EUNKNOWNHOST E_EPROGNOTREGISTERED E_UNKNOWNPROTO EINTR ERPC pHILE System Calls Description Illegal device name MS DOS volume illegal operation Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Quota exceeded Stale NFS file handle Can t close link No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors pSOSystem System Calls pHILE System Calls link_f See Also symlink_f remove_f pSOSystem System Calls 2 55 lock_f pHILE System Calls lock_f Locks or unlocks part or all of an open file include lt phile h gt unsigned long lock_f unsigned long fid file identifier unsigned long startpos starting lock position unsigned long bcount number of bytes to lock
163. EPC Searches a string for a character in a second 3 160 string strrchr pREPC Searches a string for a character 3 161 strspn pREPC Calculates specified string length 3 162 strstr pREPC Searches a string for specified characters in 3 163 another string strtod pREPC Converts a string to a double 3 164 strtok pREPC Searches a string for tokens 3 166 strtol pREPC Converts a string to a long integer 3 168 strtoul pREPC Converts a string to an unsigned long 3 170 strxfrm pREPC Transforms a string so that it can be used 3 172 by strcmp symlink_f pHILE Creates a symbolic link to a file 2 112 sync_vol pHILE Synchronizes a volume 2 115 t_create pSOS Creates a task 1 133 t_delete pSOS Deletes a task 1 138 t_getreg pSOS Gets a task s notepad register 1 141 A 12 pSOSystem System Calls Tables of System Calls All pSOSystem System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page t_ident pSOS Obtains the task identifier of the named 1 143 task time pREPC Obtains the current calendar time 3 174 t_mode psOS Gets or changes the calling task s execution 1 145 mode t_restart psOS Forces a task to start over regardless of its 1 149 current state t_resume psOS Resumes a suspended task 1 152 t_setpri psOS Gets and optionally changes a task s prior 1 154 ity t_setreg ps
164. ETIMEDOUT ECON REFUSED Description The socket descriptor is invalid An argument is invalid The socket is non blocking and the connection cannot be completed im mediately The socket is non blocking and a pre vious connection attempt has not yet been completed The sin _ family member of sockaddr_in isn t AF_INET The address specified is already in use The specified address is not available An internal buffer is required but can t be allocated The socket s is already connected Connection timed out The attempt to connect was refused pSOSystem System Calls pNA System Calls connect See Also accept close connect getsockname select socket pSOSystem System Calls 4 11 get_id pNA System Calls get_id Gets a task s user ID and group ID include lt pna h gt long get_id long userid task user ID long groupid task group ID long groups must be zero Description This system call obtains the user ID and group ID of the calling task These IDs are used for accessing NFS servers The user ID and group ID are set by using the set_id call Default values for these IDs are defined in the pNA Configuration Table Arguments userid Points to a long variable where get_id stores the calling task s user ID groupid Points to a long variable where get_id stores the calling task s group ID groups Zero must be passed as a third argument w
165. F reserved for drivers 10 06 00 00 10 06 FF FF TFTP driver lt drv_intf h gt B 48 10 07 00 00 10 07 FF FF SLIP driver 10 08 00 00 10 08 FF FF reserved for drivers 10 09 00 00 10 09 FF FF IDE driver B 49 10 0A 00 00 10 OA FF FF FLP driver B 49 B 2 pSOSystem System Calls Error Codes TABLE B 1 Error Code Origins Continued Error Code Range Origin Defined in Refer to page From To 10 OB 00 00 10 4F FF FF reserved for drivers 10 50 00 00 10 5F FF FF SCSI driver lt drv_intf h gt B 50 10 60 00 00 1F FF FF FF reserved for drivers 20 00 00 00 FF FF FF FF reserved for application use pSOSystem System Calls B 3 pSOS Error Codes Error Codes B 1 pSOS Error Codes All pSOS error codes are returned as function return values rather than an errno variable they have a value between 0 and Oxfff Table B 2 lists all error codes returned by the pSOS component Each listing in cludes the error code s hexadecimal number it s mnemonic and description and the pSOS system calls that can return it The error code mnemonics are also de fined in lt psos h gt The term object represents the applicable service group type task partition queue semaphore and so on l TABLE B 2 pSOS Error Codes Hex Mnemonic and Description System Call s Ox01 ERR_TIMEOUT Timed out returned only if a tim ev_receive eout was requested q_recelve q_vreceive rn
166. FTP server timed out while waiting for a re sponse from the TFTP client 0x 10060003 TETP_SYNC TFTP server out of sync with TFTP client Ox 10060004 TETP_NOSPC No more free socket IDs 0x 10060005 TF TP_INVAL Channel number minor number exceeds the maximum number of channels the driver can open 0x10060006 TETP_NOINIT Call failed because the TFTP driver has not been initialized and must be initialized before the call can be made B 48 pSOSystem System Calls Error Codes B 6 7 B 6 8 IDE Driver Error Codes The error codes listed in Table B 16 are returned by the IDE driver TABLE B 16 IDE Driver Error Codes Driver Error Codes Hex Mnemonic and Description 0x10090001 IDE_HDWR Hardware error 0x10090002 IDE_MINOR Invalid minor device 0x10090003 IDE_CTRL Invalid function code for IDE_Ctr1 0x10090004 IDE_NINIT Device not initialized 0x10090005 IDE_DATA Unable to allocate driver data area 0x10090006 IDE_SEM Semaphore error 0x10090007 IDE_BBLK Bad block 0x10090008 IDE_UCOR Uncorrectable error 0x10090009 IDE_SNF Sector not found 0x1009000a IDE_TONF Track 0 not found 0x1009000b IDE_NDAM Data address mark not found 0x1009000c IDE_RANGE Block range error 0x1009F000 IDE_DRV Drive related error in the last byte FLP Driver Error Codes The error codes listed in Table B 17 are returne
167. For a text stream either offset should be zero or offset should be a value returned by an earlier call to fte11 function on the same stream and base should be SEEK_SET A successful call to fseek clears the stream s end of file indicator and undoes any effect of ungetc function on the same stream If stream refers to an I O device this function does nothing and returns a zero Arguments stream Points to an open pREPC stream offset For a binary stream specifies the offset value which will be added to the position specified by whence to calculate the new value of the position indicator whence Specifies the relative file base whence can have one of the following values Value Description SEEK_SET Beginning of file SEEK_CUR Current position in file SEEK_END End of file pSOSystem System Calls 3 61 fseek pREPC System Calls Return Value This function returns zero if the operation is successful or a nonzero number if unsuccessful If an error occurs errno is set Error Codes Refer to Appendix B Notes Callable From a Task See Also ftell fsetpos fgetpos 3 62 pSOSystem System Calls pREPC System Calls fsetpos fsetpos Sets file position by using the fgetpos result include lt stdarg h gt include lt stdio h gt int fsetpos FILE stream stream pointer const fpos_t pos stream position Description The fsetpos function sets the
168. IB related operations are defined in lt pna h gt MIB related cmd values are defined in lt pna_mib h gt Operation descriptions are provided below arg Points to a data structure that is dependent on the value of cmd and contains additional information needed by ioctl to per form the operation Operations System Related Operations Operation Description FIOASYNC Controls whether or not the user provided signal handler is called when events related to the socket occur for example if the socket receives urgent data If the integer pointed to by arg equals 1 signalling is enabled If the integer pointed by arg equals 0 signalling is disabled FIOGETOWN Identifies the owner of the socket The task ID of the owner task is returned in the integer variable pointed to by arg 4 22 pSOSystem System Calls pNA System Calls ioctl Operation Description FIONBIO Sets the blocking mode of the socket If the integer pointed to by arg equals 1 the socket is set to operate in non blocking mode If the integer pointed to by arg equals 0 the socket is set to operate in blocking default mode Normally socket operations that cannot be immediately completed cause the task that initiated the operation to block If a socket is marked non blocking an operation request that cannot complete without waiting does not execute and an error is returned FIOREAD Returns the number of bytes stored in the socket s input buffer in the integer
169. IE SIOCGIE NU BER DE ABLE SCR FMT YE PE E UNIT EPH FAD SPE ED YSADDRESS INSTATUS OP ERSTATUS FLASTCHANGE OCTETS UCASTPKTS UCASTPKTS DISCARDS ERRORS UNKNOWNPROTOS OCTETS UCASTPKTS NUCASTPKTS 4 TDISCARDS ERRORS QLEN SP ECIFIC SET Command Definitions SIOCSIFADMINSTATUS Total number of interfaces pNA Network Interface table Description of NI NI type NI maximum transmission unit mtu NI speed NI physical address NI administration status NI operational status Last change in status of the NI Number of octets received by the NI Number of unicast packets received by the NI Number of multicast packets received by the NI Number of packets discarded by the NI Number of error packets received by the NI Number of packets discarded by the NI due to un known protocols Number of octets transmitted by the NI Number of unicast packets sent by the NI Number of non unicast packets sent by the NI Number of outbound packets discarded by the NI Number of outbound packets discarded by the NI due to errors Length of output packet queue of the NI NI specific parameter Set interface administration status of the NI pSOSystem System Calls pNA System Calls Definitions for IP Group MIB Variables GET Command Def initions
170. L_ptr for sequential write operations If random writes are needed the 1seek_f call should be used to reposition the L_ptr 4 Writing to system or directory files is not allowed 5 write_f expands a file if space is needed to accommodate the new data 6 CD ROM volumes are read only See Also lseek_f sync_vol write_vol 2 144 pSOSystem System Calls pHILE System Calls write_vol write_vol Writes directly to a pHILE formatted volume include lt phile h gt unsigned long write_vol char device unsigned long block unsigned long index unsigned long bcount void buffer Volume Types volume name base block byte offset number of bytes to write output buffer pHILE and MS DOS formatted volumes Description write_vol writes data directly to a pHILE formatted volume bypassing the file system organization imposed by the pHILE file system manager Arguments device Points to the null terminated name of the volume to read block Specifies the logical block number where writing begins index Specifies where to begin writing within the specified block bcount Specifies the number of bytes to write buffer Points to the memory area containing the data to write Return Value This system call returns 0 on success or an error code on failure pSOSystem System Calls 2 145 write_vol pHILE System Calls Error Codes Hex Mnemonic Description Ox200A F
171. MCB to be reused sm_delete takes care of cleaning up the semaphore If there are tasks waiting they will be unblocked and given an error code The calling task does not have to be the creator parent of the semaphore to be deleted However a semaphore must be deleted from the node on which it was created Arguments smid Specifies the semaphore ID of the semaphore to be deleted Return Value This system call returns O on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBUDEL Semaphore has been deleted 0x06 ERR_OBJID smid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x44 ERR_TATSDEL Informative only there were tasks waiting 0x53 ERR_ILLRSC Semaphore not created from this node 1 124 pSOSystem System Calls pSOS System Calls sm_delete Notes 1 Once created a semaphore is generaly used by multiple tasks for communication and synchronization There is rarely a reason for deleting a semaphore even when it is no longer used except to allow reuse of the SMCB 2 The calling task can be preempted if a task waiting at the deleted semaphore has higher priority Multiprocessor Considerations If smid identifies a global semaphore sm_delete will notify the master node so that the semaphore can be removed from its Global Object Table Thus deletion of a global semaphore always causes activi
172. MISMATCH E_ECANTDECODEARGS pHILE System Calls Description Invalid function number Illegal pathname No default directory Operation not allowed on read only system files directories or mounted volumes Illegal device name MS DOS volume illegal operation Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error pSOSystem System Calls pHILE System Calls Hex 0x207A 0x207B 0x207C 0x207D 0x207E See Also stat_f Mnemonic _ EUNKNOWNHOST _ EPROGNOTREGISTERED E_UNKNOWNPROTO _EINTR ERPC fstat_f pSOSystem System Calls utime_f Description Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors 2 125 verify_vol pHILE System Calls verify_vol Verifies a volume s control structures include lt phile h gt unsigned long verify_vol char device volume name VERIFY_VOL_PARAMS params parameters Volu
173. MS DOS volumes it can also indicate that an incorrect partition number has been specified close_dir close_f create_f ftruncate_f get_fn init_vol make_dir move_f open_dir open_f open_fn pcinit_vol pemount_vol read_dir read_f remove_f stat_f stat_vfs sync_vol truncate_f unmount_vol write_f pSOSystem System Calls B 15 pHILE Error Codes TABLE B 3 pHILE Error Codes Continued Error Codes Hex Mnemonic and Description System Call s 0x2005 E_VINITPAR Illegal parameters to init_vol The parameters specified to an init_vol call are not consistent One of the following problems has been detected by the pHILE file system manager m The specified starting location of the bitmap causes the FLIST to either extend beyond the end of the volume or the end of the con trol block region if the volume has been partitioned into control and data block re gions m The specified starting block for the data block region SODATA is not on a modulo 8 boundary or it is beyond the end of the vol ume m The bitmap begins in blocks 0 3 init_vol 0x2006 E_MNTFULL Attempt to mount too many vol umes Attempt to mount more volumes than specified by the pHILE Configuration Table pa rameter fc_nmount cdmount_vol mount_vol nfsmount_vol pcmount_vol 0x2007 E_VALIEN Wrong volume format The volume to be mounted is not of the correct Either it
174. No such device RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered 2 59 Iseek f Usage pHILE System Calls Hex Mnemonic Description 0x207C E_UNKNOWNPROTO Unknown protocol 0x207D E_EINTR Call interrupted 0x207E ERPC All other RPC errors lseek_f can be used to determine the current logical size of a file as in this example lseek_f fid 2 0 amp oldptr lseek_f fid 0 oldptr amp filesize The first call seeks to the end of file and saves the original position The second call restores the original position and obtains the end of file position The end of file position is also the file s logical size Notes 1 A separate L_ptr is associated with each file connection lseek_f affects only the L_ptr associated with the specified file descriptor fid 2 Because L_ptr is unsigned positioning it before the start of the file results in a seek past end of file error 3 Because L_ptr cannot be moved beyond the end of the file it is not possible to create a file with holes in it See Also 2 60 read_f write_f pSOSystem System Calls pHILE System Calls Istat f Istat_f Gets the status of a symbolically linked file include
175. None Notes Callable From a Task pSOSystem System Calls 3 167 strtol pREPC System Calls strtol Converts a string to a long integer include lt stdlib h gt long strtol const char nptr string char endptr string conversion terminator int base conversion base Description The strtol function converts the initial portion of a string nptr to long int representation according to the radix specified by base This function ignores leading white spaces and the string can contain either a ora Arguments nptr Points to the string to be converted endptr An output parameter If endptr is null this function is equivalent to the atol function If endptr is not null it points to a pointer to the character in str that terminated the scan base Specifies the base of the number system assumed by the function base must be either O or within the range 2 through 36 If it is O the string itself is used to determine its base If nptr begins with the character 0 base eight is assumed if npt r begins with Ox or OX base sixteen is assumed otherwise base ten is assumed Return Value This function returns the converted value If the conversion fails this function returns a O and sets errno Error Codes Refer to Appendix B 3 168 pSOSystem System Calls pREPC System Calls Notes Callable From a Task See Also atoi atof pSOSystem System Calls strtol 3 169 strtoul
176. OBUFS ENOTCONN Description The socket descriptor is invalid The broadcast option is not set for this socket An argument is invalid The connection is broken This operation would block and the socket is marked non blocking Message too long Destination network can t be reached from this node The connection has been reset by the peer An internal buffer is required but can not be allocated The socket is not connected pSOSystem System Calls pNA System Calls Hex Mnemonic 0x5041 EHOSTUNREACH See Also sendto sendmsg pSOSystem System Calls socket Description send The destination host could not be reached from this node 4 59 sendmsg sendmsg Sends data to a socket pNA System Calls include lt pna h gt long sendmsg int s socket descriptor struct msghdr msg packet structure int flags packet attributes Description The sendmsg system call is used to send data to a foreign socket This system call is similar to sendto but it requires fewer input parameters and uses the structure msghdr For a complete description of this system call refer to the sendto call description on page 4 62 Note that the MSG_RAWMEM option is not supported by this call Arguments Ss Specifies the local datagram socket msg Points to a msghdr structure The msghdr structure is described in the recvmsg call description on page 4 51 flag
177. OCGMBSTAT Gets the statistics for mblks memory blocks configured in the system A pointer to the mbstat structure is passed via the arg parameter of the ioct1 call mb stat is defined as follows pSOSystem System Calls 4 25 ioctl 4 26 pNA System Calls struct mbstat long mb_classes Number of buffer classes long mb_mblks Number of mblks configured long mb_free Number of free mblks long mb_wait Number of times task waited for mblk long mb_drops Number of times mblks unavailable SIOCGDBSTAT Gets the statistics for buffers configured in the system A pointer to the dbreq structure is passed as the arg pa rameter The dbs element must point to a buffer that can hold at least size number of bytes The buffer on return contains a sequence of dbstat structures each of which is filled in the statistics of the particular buffer size It is rec ommended that the size of the dbs buffer be large enough to contain all the buffer types configured in the system size is an input output element that contains the size of a buffer on input On output the pNA network manager returns the size of buffer used by the call These struc tures are defined as follows in lt pna h gt struct dbreq long size Size of the buffer struct dbstat dbs Pointer to the buffer struct dbstat long db_size Size of buffer long db_nbuffers Number of buffers configured long db_free
178. OS Sets a task s notepad register 1 156 t_start pSOS Starts a task 1 158 t_suspend psOS Suspends a task until a t_resume call is 1 162 made for the suspended task tm_cancel psOS Cancels an armed timer 1 164 tm_evafter psOS Sends events to the calling task at periodic 1 168 intervals tm_evevery psOS Sends events to the calling task at periodic 1 168 intervals tm_evwhen psOS Sends events to the calling task at the spec 1 170 ified time tm_get psOS Obtains the system s current version of the 1 173 date and time tm_set psOS Sets or resets the system s version of the 1 175 date and time tm_tick psOS Announces a clock tick to the pSOS kernel 1 178 tm_wkafter psOS Blocks the calling task and wakes it after a 1 180 specified interval pSOSystem System Calls A 13 All pSOSystem System Calls Tables of System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page tm_wkwhen psOS Blocks the calling task and wakes it ata 1 182 specified time tmpfile pREPC Creates a temporary file 3 176 tmpname pREPC Generates a temporary filename 3 177 tolower pREPC Converts a character to lowercase 3 179 toupper pREPC Converts a character to uppercase 3 180 truncate_f pHILE Changes the size of a named file 2 117 ungetc pREPC Ungets a character 3 181 unmount_vol pHILE Unmounts a volume 2 120 utime_f pHILE Sets the access
179. PC System Calls strcat strcat Appends one string to another string include lt string h gt char strcat char sl destination string const char s2 source string Description This function appends a copy of one string s2 to the end of another string s1 The first character in the source string overwrites the terminating null character in the destination string If copying takes place between strings that overlap the behavior is undefined Arguments sl Points to the destination string s2 Points to the source string Return Value This function returns the value of s1 Notes Callable From m Task ISR Error Codes None pSOSystem System Calls 3 143 strchr pREPC System Calls strchr Searches a string for a character include lt string h gt char strchr const char s search string int c reference character Description This function searches for the first occurrence of c converted to an unsigned char in the string pointed to by s Arguments Ss Points to the string to be searched c Specifies the reference character Return Value This function returns a pointer to the located character If a character is not found it returns a null pointer Error Codes None Notes Callable From a Task a ISR 3 144 pSOSystem System Calls pREPC System Calls strcmp strcmp Compares two character strings include lt string h gt int strcmp const char
180. PI it passes the semaphore name as a four byte character array The pSOS kernel does not check for duplicate semaphore names If duplicate names exist an sm_ident call can return the smid of any semaphore with the duplicate name The maximum number of semaphores that can be simultaneously active is defined by the kc_nsema4 entry in the pSOS Configuration Table The count argument is unsigned and thus can only be 0 or a positive value The SM_GLOBAL attribute is ignored by the single processor version of the pSOS kernel Multiprocessor Considerations 1 The SM_GLOBAL attribute should be set only if the semaphore must be made known to other processor nodes in a multiprocessor configuration If set the semaphore s name and smid are sent to the master node for entry in its Global Object Table If the SM_GLOBAL attribute is set and the number of global objects currently exported by the node equals the Multiprocessor Configuration Table entry mc_nglbobj then the semaphore is not created and ERR_OBJTFULL is returned pSOSystem System Calls pSOS System Calls Callable From m Task See Also sm_delete sm_ident pSOSystem System Calls sm_create 1 123 sm_delete pSOS System Calls sm_delete Deletes a semaphore include lt psos h gt unsigned long sm_delete unsigned long smid semaphore ID Description This system call deletes the semaphore with the specified semaphore ID and frees the S
181. PowerPC processors On these processors i_enter provides and establishes a standard entrance convention for all interrupt service routines ISRs For efficiency reasons i_enter is different from other system calls in that it uses a separate entry into the pSOS kernel Target Entering the ISR cr On ColdFire processors i_enter must be called at the beginning of an ISR so that pSOS can keep track of nested interrupts and can switch stacks if an interrupt stack is being used i_enter is called via TRAP 12 On PowerPC processors i_enter must be called at the beginning of PPE an ISR before the interrupt is re enabled The i_enter entry point is located at offset Ox60 from the beginning of the pSOS kernel code It s called with a call bl instruction sE On x86 processors i_enter must be used as the first instruction of an ISR so that pSOS can keep track of nested interrupts and can switch stacks if an interrupt stack is being used i_enter is called via INT 92H For more information please refer to the examples given in the i_return call description on page 1 35 Return Value None Notes i_return must be used to exit an ISR pSOSystem System Calls 1 33 i_enter pSOS System Calls Multiprocessor Considerations None This call can only be directed at the local node Callable From m ISR 1 34 pSOSystem System Calls pSOS System Calls i_return i_return Provides an ex
182. Primary Volume Descriptor pHILE System Calls Description Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors As a special case on CD ROM volumes the filename _VOLUME Y in the root directory is used to read the primary volume descriptor which is the starting point for locating all information on the volume When you read _VOLUME Y pHILE omits the fields from it that are unused by your processor and byte swaps the remaining fields to the proper order for the processor Therefore the primary volume descriptor can be read into the structure type that follows pSOSystem System Calls pHILE System Calls open_f CD ROM Primary Volume Descriptor as read from _VOLUME SYS BKK KKK KKK KR a ZI ZE ZZZ ZZZ KK ZIE ZI LE KKK KK kK KK KK KK define CDFS_NAMMAX 32 max node size in bytes CD File System Directory Record internal format typedef struct dir_cdfs USHORT dr_reclen USHORT dr_xarlen ULONG dr_extent ULONG dr_fsize ULONG dr_cdate ULONG dr_ctime USHORT dr_flags USHORT dr_namlen char dr_name CDFS_NAMMAX 1 dir_cdfs_t directory record length extended attribute record length number of first data block in file byte size of file data space date when created pSOS format time when created pSOS format directory flags per iso_dir
183. REPC Reads from a stream 3 51 free pREPC Deallocates memory 3 53 freopen pREPC Reopens a file 3 54 fscanf pREPC Reads formatted input from a stream 3 56 fseek pREPC Sets the file position indicator 3 61 fsetpos pREPC Sets file position by using the fgetpos re 3 63 sult fstat_f pHILE Obtains the status of a file specified by its 2 35 file identifier fstat_vfs pHILE Obtains statistics about a mounted volume 2 39 specified by a file identifier ftell pREPC Gets the file position indicator 3 65 ftruncate_f pHILE Changes the size of a file specified by its file 2 43 identifier A 4 pSOSystem System Calls Tables of System Calls All pSOSystem System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page fwrite pREPC Writes to a stream 3 67 get_fdset pRPC Returns the bit mask that corresponds to 5 5 readable RPC sockets get_fn pHILE Obtains the file number of a file 2 46 get_id pNA Gets a task s user ID and group ID 4 12 getc pREPC Gets a character from a stream 3 69 getchar pREPC Gets a character from stdin 3 70 getpeername pNA Gets the address of a connected peer 4 13 gets pREPC Gets a string from stdin 3 71 getsockname pNA Gets the address that is bound to a socket 4 15 getsockopt pNA Gets options on a socket 4 17 gmtime pREPC Converts the calendar time to bro
184. S Error Codes Continued pSOS Error Codes Hex Mnemonic and Description System Call s OxF04 FAT_OVTCB Region 0 overflow while making task This error originates in structures pSOS initialization OxF05 FAT_OVOCB Region 0 overflow while making This error originates in queue structures pSOS initialization OxFO6 FAT_OVSMCB Region 0 overflow while making This error originates in semaphore structures pSOS initialization OxFO7 FAT_OVTM Region 0 overflow while making timer This error originates in structures pSOS initialization OxF08 FAT_OVPT Region 0 overflow while making parti This error originates in tion structures pSOS initialization OxFO9 FAT_OVRSC Region 0 overflow while making RSC This error originates in structures pSOS initialization OxFOA FAT_OVRN Region 0 overflow while making re This error originates in gion structures pSOS initialization OxFOC FAT_ROOT Cannot create ROOT task This error originates in pSOS initialization OxFOD FAT_IDLE Cannot create IDLE task This error originates in pSOS initialization OxFOE FAT_CHKSUM Checksum error This error originates in pSOS initialization OxFOF FAT_INVCPU Wrong processor type This error originates in pSOS initialization OxF12 FAT_ILLPKT Illegal packet type in the received This error origin
185. SK PNAD task creation error This error originates in pNA initialization 0x5F08 FAT_PNAINIT pNA initialization error This error originates in pNA initialization B 42 pSOSystem System Calls Error Codes TABLE B 8 pNA Error Codes Continued pNA Error Codes Hex Mnemonic and Description System Call s 0x5F09 FAT_NIINIT NI initialization error This error originates in pNA initialization OxSFOA FAT_RTINIT Routing table initialization error This error originates in pNA initialization Ox5FOB FAT ARPINIT ARP table initialization error This error originates in pNA initialization Ox5FOC FAT _TIMERINIT PNAD timer initialization error This error originates in pNA initialization Ox5FOD AT_EVENT PNAD event error This error originates in pNA initialization OxSFOE FAT_CHKSUM pNA checksum error This error originates in pNA initialization OxSFOF EINTERNAL pNA detects an inconsistency in the This error can be de control information for network resources it man tected at several ages In most cases this error is caused by a cor points within pNA ruption of the pNA data area by an errant user task Check pNA data configurations and memory usage by tasks For further advice contact pSOSys tem technical support with information on pNA configuration and a dump of register contents 0x5F10 FAT_NHT The number of ini
186. See Also putchar getc 3 70 pSOSystem System Calls pREPC System Calls gets gets Gets a string from stdin include lt stdarg h gt include lt stdio h gt char gets char s buffer Description The gets function reads characters from the standard input device into a user buffer s It continues to read characters until a new line character is read or an end of file condition is detected Any new line character is discarded and a null character is added after the last character read into the user buffer Arguments s Points to the user buffer Return Value If successful the gets function returns s If a read error occurs or an end of file condition is detected before any characters are read a null pointer is returned If an error occurs errno is set Error Codes Refer to Appendix B Notes Callable From m Task See Also puts fgets pSOSystem System Calls 3 71 gmtime pREPC System Calls gmtime Converts the calendar time to broken down time include lt time h gt struct tm gmtime const time_t timer calendar time Description The gmtime function converts the calendar time pointed to by timer into broken down time expressed as Coordinated Universal Time UTC The calendar time is generally obtained through a call to time Arguments timer Points to the calendar time Return Value The gmtime function always returns NULL since the concept of UTC i
187. TE Too many levels of remote in path 0x2054 E_EIO A hard error occurred at remote site 0x2055 E_EACCES Task does not have permissions 0x2058 E_ESTALE Stale NFS file handle 0x205B E_ENXIO No such device or address 0x205C E_ENODEV No such device 0x2060 E_BADCD CD ROM volume illegal operation 0x2070 E_EAUTH RPC authorization is not available 0x2071 E_ENFS Portmap failure on the host 0x2072 E_ETIMEDOUT NFS call timed out 0x2074 E_ENOAUTHBLK No RPC authorization blocks available 0x2075 E_ECANTSEND Failure in sending call 0x2076 E_ECANTRECV Failure in receiving result 0x2077 E_PROBUNAVAIL Program not available 0x2078 E_EPROGVERSMISMATCH Program version mismatched 0x2079 E_ECANTDECODEARGS Decode arguments error 0x207A E_EUNKNOWNHOST Unknown host name 0x207B E_EPROGNOTREGISTERED Remote program is not registered 0x207C E_UNKNOWNPROTO Unknown protocol 2 6 pSOSystem System Calls pHILE System Calls access_f Hex Mnemonic Description 0x207D E_EINTR Call interrupted 0x207E ERPC All other RPC errors See Also chmod_f stat_f fstat_f pSOSystem System Calls 2 7 annex_f pHILE System Calls annex_f Allocates contiguous blocks to a file include lt phile h gt unsigned long annex_f unsigned long fid file identifier unsigned long alloc_size number of blocks to add unsigned long blkcount number of blocks added Volume Types pHILE formatted volumes Description annex_f
188. Task m ISR if semaphore is local to the node from which the sm_v call is made m KI if the semaphore is local to the node from which the sm_v call is made m Callout if the semaphore is local to the node from which the sm_v call is made See Also sm_p 1 132 pSOSystem System Calls pSOS System Calls t create t_create Creates a task include lt psos h gt unsigned long t_create char name 4 task name unsigned long prio task priority unsigned long sstack task supervisor stack size unsigned long ustack task user stack size unsigned long flags task attributes unsigned long tid task identifier Description This service call enables a task to create a new task t_create allocates to the new task a Task Control Block TCB and a memory segment for its stack s The task stack sizes and scheduling priority are established with this call t_create leaves the new task in a dormant state the t_start call must be used to place the task into the ready state for execution Arguments name prio sstack ustack pSOSystem System Calls Specifies the user assigned name of the task Specifies the task s initial priority within the range 1 239 with 239 the highest and 1 the lowest Priority level O is reserved for the pSOS daemon task IDLE Priority levels 240 255 are reserved for a variety of high priority pSOSystem daemon tasks While t_create will allo
189. Task See Also t_create t_restart t_ident pSOSystem System Calls 1 161 t_suspend pSOS System Calls t_suspend Suspends a task indefinitely include lt psos h gt unsigned long t_suspend unsigned long tid task identifier Description This system call suspends execution of a task until a t_resume call is made for the suspended task The calling task suspends either itself or another task The t_suspend call prevents the specified task from contending for CPU time but does not directly prevent contention for any other resource See Note 4 Arguments tid Specifies the task to suspend If tid equals zero the calling task suspends itself Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Task was already deleted 0x06 ERR_OBJID tid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x14 ERR_SUSP Task was already suspended Notes 1 A task that calls t_suspend on itself always returns 0 2 A suspended task can be deleted 1 162 pSOSystem System Calls pSOS System Calls t suspend 3 t_resume is the only call that reverses a suspension 4 A task can be suspended in addition to being blocked For example if a task is waiting for a message at a queue when suspension is ordered suspension continues after a message has been received For
190. The FLIST as specified in ROOTBLOCK 2105 N extends beyond the end of the volume VE_BMDA The bitmap as specified in ROOTBLOCK 2106 N overlaps the volume s data area VF_FLDA The FLIST as specified in ROOTBLOCK 2107 N overlaps the volume s data area VF_BMEX The extent map in the bitmap FD disagrees 2108 N with ROOTBLOCK VF_FLEX The extent map in the FLIST FD disagrees 2109 N with ROOTBLOCK VE_NDRFD The FD for the ROOT directory does not 210A Y JOA Ayan sje waysks 3 11Hd syle waysks wash sd GET TaBLE 22 Fault Summary Continued Mnemonic Description Hex FN1 PATH1 PATH2 Fixable VF_FDMU A FD is used by more than one file 210B X X X N verify_vol returns the FN and pathname of both files although the FNs are the same VF_FDFRE A FD that is in use is marked free 210C X X VF_FDUSE A FD that is not in use is marked as in use 210D X VF_NSSFD The FD of a non system file indicates the file 2110 X X is a system file VF_SNSFD The FD for a system file ROOTBLOCK 2111 X X Y BITMAP or FLIST does not indicate the file is a system file VF_PARFD The parent FN within a FD does not point to 2112 X X Y the file s parent directory VF_FCFD The file count within a FD for a directory is 2113 X X Y incorrect VF_SIZFD A file s FD indicates that its logical size is 2114 X X
191. WNHOST EPROGNOTREGISTERED E_UNKNOWNPROTO EINTR ERPC unmount_vol Description Symbolic links nested too deeply Too many levels of remote in path A hard error happened at remote site Stale NFS file handle No such device or address No such device RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors 1 Any task can unmount a volume If some security is needed the user must supply the bookkeeping software to keep track of volumes and tasks that perform the mounts 2 Conceptually unmounting a volume is unnecessary unless it is physically removed and a new volume is mounted on the same device However a limit exists to the number of volumes that can be mounted simultaneously and unmounting frees entries in the volume mount table pSOSystem System Calls 2 121 unmount_vol pHILE System Calls 3 unmount_vol fails and returns an error if any open files exist on the volume 4 Once unmounted a volume is inaccessible See Also mount_vol pcmount_vol nfsmount_vol cdmount_vol 2 122 pSOSystem System Calls pHILE System Calls uti
192. XLOOP E_EREMOTE E_E IO E_ EACCES E_ESTALE E_ENXIO E_BADCD E_ENODEV E_BADCD E_EAUTH E_ENFS E_ETIMEDOUT E_ENOAUTHBLK E_ECANTSEND E_ECANTRECV E_PROBUNAVAIL E_EPROGVERSMISMATCH E_ECANTDECODEARGS E_EUNKNOWNHOST Istat_f Description pHILE volume illegal operation Illegal pathname No default directory Illegal device name MS DOS volume illegal operation Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address CD ROM volume illegal operation No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name 2 63 Istat_f Hex 0x207B 0x207C 0x207D 0x207E See Also 2 64 symlink_f Mnemonic E_EPROGNOTREGISTERED E_UNKNOWNPROTO _EINTR ti ERPC stat_f fstat_f pHILE System Calls Description Remote program is not registered Unknown protocol Call interrupted All other RPC errors pSOSystem System Calls pHILE System Calls make_dir make_dir Creates a directory file include lt phile h gt unsigned long make_dir cha
193. Y greater than its physical size VF_ANXFD A file has an annex size of 0 in its FD This 2115 X X Y fault is corrected by setting the annex size to 1 VF_EXTFD See Extent Map Faults on page 2 138 2118 x X N VF_INFD See Extent Map Faults on page 2 138 2119 X X N VE_IXFD See Extent Map Faults on page 2 138 211A X X N VF_TBCFD See Extent Map Faults on page 2 138 211B X X Y y sile waysks 371Hd JOA Ayan 9ET Z syle waysks wash sd TABLE 2 2 Fault Summary Continued Mnemonic Description Hex FM PATH1 PATH2 BN Fixable VE_LLBFD See Extent Map Faults on page 2 138 211C X X Y VF_LLBIN See Extent Map Faults on page 2 138 211D X X Y VF_EXTIN See Extent Map Faults on page 2 138 211E X X X N VF_INIX See Extent Map Faults on page 2 138 211F X X X N VF_LLBIX See Extent Map Faults on page 2 138 2120 X X X Y VF_DBDA See Extent Map Faults on page 2 138 2121 X X X N VF_INDA See Extent Map Faults on page 2 138 2122 X X X N VF_IXDA See Extent Map Faults on page 2 138 2123 X X X N VF_DFDIR A directory contains the same filename more 2124 x X X N than once verify_vol provides the FN and pathname of both files although in this case the pathnames are identical VF_IFDIR A directory entry contains an illegal filename 2125 X X X Y verify_vol provides the FN and
194. Y in which case pNA will decide the interface to join on for example if a route exists for a matching multicast address that specifies the interface The maximum number of groups that can be joined per multicast socket is defined by the constant IP_MAX_MEMBERSHIPS in pna h The structure below is defined in lt pna h gt and used with the IP_ADD_MEMBERSHIP option struct ip_mreq struct in_addr imr_mcastaddr IP multicast address of group struct in_addr imr_interface local IP address of interface hi pSOSystem System Calls 4 69 setsockopt 4 70 IP_ADD_MEMB IP_DROP_M ERSHIP_INTF EMB ERSHIP pNA System Calls Similar to IP_ADD_ MEMBERSHIP above The optval is a pointer to the structure ip_mreq_intf defined in lt pna h gt The only difference is that the interface is defined using the interface number If the interface number is specified as 1 then pNA will select the interface based upon the routing table This option is use ful for unnumbered links because the IP address of the interface is not enough to identify the inter face The structure below is defined in lt pna h gt and used with the IP_ADD_MEMBERSHIP_INTF option struct ip_mreq_intf struct in_addr imrif_mcastaddr IP multicast address of group long imrif_ifno local interface number i Leave a multicast group optval is a poin
195. _getreg t_restart t_resume t_setpri t_setreg t_start t_suspend B 6 pSOSystem System Calls Error Codes TABLE B 2 pSOS Error Codes Continued pSOS Error Codes Hex Mnemonic and Description System Call s 0x07 ERR_OBJTYPE object type doesn t match object ID failed validity check as_send ev_asend ev_send pt_delete pt_getbuf pt_retbuf pt_sgetbuf q asend q_aurgent q_avsend q_avurgent q_broadcast q_delete q_receive q_send q_urgent q_vbroadcast q_vdelete q_vreceive q_vsend q_vurgent rn_delete rn_getseg rn_retseg sm_av sm_delete sm_p sm_v t_delete t_getreg t_restart t_resume t_setpri t_setreg t_start t_suspend 0x08 ERR_OBJTFULL Node s object table full pt_create q_create q_vcreate rn_create sm_create t_create 0x09 ERR_OBJNF Named object not found pt_ident q_ident q_vident rn_ident sm_ident t_ident OxOD ERR_RSTFS Informative files may be corrupted on restart t_restart OxOE ERR_NOTCB Exceeds node s maximum number of tasks t_create OxOF ERR_NOSTK Insufficient space in Region 0 to cre ate stack or task started in user mode with no user stack allocated t_create t_start pSOSystem System Calls B 7 pSOS Error Codes Error Codes TABLE B 2 pSOS Error Codes Continued Hex Mnemonic and D
196. _getseg sm p 0x03 ERR_SSFN Illegal system service function num ev_asend q_asend ber q_aurgent q_avsend q_avurgent sm_av 0x04 ERR_NODENO Node specifier out of range k_terminate pt_ident q_ident q_vident sm _ ident t_ident B 4 pSOSystem System Calls Error Codes TABLE B 2 pSOS Error Codes Continued pSOS Error Codes Hex Mnemonic and Description System Call s 0x05 ERR_OBJDEL object has been deleted as_send ev_asend ev_send pt_delete pt_getbuf pt_retbuf pt_sgetbuf q_asend q_aurgent q_avsend q_avurgent q_broadcast q_delete q_receive q_send q_urgent q_vbroadcast q_vdelete q_vreceive q_vsend q_vurgent rn_delete rn_getseg rn_retseg sm_av sm_delete sm_p sm_v t_delete t_getreg t_restart t_resume t_setpri t_setreg t_start t_suspend pSOSystem System Calls B 5 pSOS Error Codes TABLE B 2 pSOS Error Codes Continued Error Codes Hex Mnemonic and Description System Call s 0x06 ity check ERR_OBJID object_jid is incorrect failed valid as_send ev_asend ev_send pt_delete pt_getbuf pt_retbuf pt_sgetbuf q_asend q_aurgent q_avsend q_avurgent q_broadcast q_delete q_receive q_send q_urgent q_vbroadcast q_vdelete q_vreceive q_vsend q_vurgent rn_delete rn_getseg rn_retseg sm_av sm_delete sm_p sm_v t_delete t
197. _t size search key start point number of members member size int compar const void const void comparison operator Description The bsearch function searches an array of nmemb objects the initial element of which is pointed to by base for an element that matches the object pointed to by key The size of each element of the array is specified by size The array must be sorted in ascending order A user supplied comparison function compar is called by bsearch with two arguments The first argument to compar is a pointer to the key object and the second is a pointer to an array member The compar function must return an integer that is either less than equal to or greater than zero if key object is considered respectively to be less than equal to or greater than the array member Arguments key Points to the object to be matched in the search base Points to the beginning of the array to be searched nmemb Specifies the number of members in the array size Specifies the size of each member in the array Return Value This function returns a pointer to the first matching member detected If no match is found it returns a null pointer In the event of an error errno is set to indicate the condition pSOSystem System Calls 3 15 bsearch pREPC System Calls Error Codes Refer to Appendix B Notes The compar function can call a limited set of pREPC functions These functions con
198. a task holds any resources from the pREPC library the pHILE file system manager or the pNA network manager those resources must be returned before t_delete is called The commands that must be executed for pREPC pHILE and pNA resources are fclose 0 close_f 0 and close 0 respectively Following these commands a free command must be used to return pREPC memory This order of execution is required because the pREPC library calls the pHILE file system manager and the pHILE file system manager calls the pNA network manager if NFS is in use If resources are not returned in the correct order an error occurs See Error Codes The following is an example of the correct sequence of calls for returning re sources This example applies to a case where all three components have allo cated resources fclose 0 return pREPC resources close_f 0 return pHILE resources close 0 return pNA resources free 1 return pREPC memory t_delete 0 and execute self deletion 3 Using t_delete to delete another task does not generally allow that task a chance to perform any cleanup work necessary for the orderly termination of the task In general t_delete should be used for self deletion whereas asynchronous deletion of another task can best be achieved using the t_restart call 4 t_delete calls the optional user supplied callout procedure whose address is defined in th
199. a message to a specified variable length message queue Other than the queue type g_vsend operates just like q_send Arguments qid Specifies the queue ID of the target queue msg_buf Points to the message to send msg_len Specifies the length of the message It must not exceed the queue s maximum message length Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBUDEL Queue has been deleted 0x06 ERR_OBJID qid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x30 ERR_KISIZE Message buffer length exceeds max KI packet buffer length 0x31 ERR_MSGSIZ Message is too large 0x35 ERR_OFULL Message queue at length limit pSOSystem System Calls 1 101 q_vsend Hex pSOS System Calls Mnemonic Description 0x3B ERR_NOTVARO Queue is not variable length 0x65 ERR_STALEID Object s node has failed Notes If the caller is a task it may be preempted as a result of this call The pSOS kernel must copy the message into a queue buffer or the receiving task s buffer Longer messages take longer to copy User s should account for the copy time in their design especially when calling from an ISR q_vsend sends a message to a variable length message queue Use q_send to send a message to an ordinary queue Multiprocessor Considerations 1 1 1
200. ach one 1 1 pSOS System Calls pSOSystem System Calls pSOS System Calls as_catch as_catch Specifies an asynchronous signal routine ASR include lt psos h gt unsigned long as_catch void start_addr ASR address unsigned long mode ASR attributes Description This system call allows a task to specify an asynchronous signal routine ASR to handle asynchronous signals as_catch supplies the starting address of the task s ASR and its initial execution mode If the input ASR address is zero then the caller is deemed to have an invalid ASR and any signals sent to it will be rejected A task s ASR gains control much like an ISR If a task has pending signals sent via as_send then the next time the task is dispatched to run it will be forced to first execute the task s specified ASR A task executes its ASR according to the mode supplied by the as_catch call for example Non preemptible Time slicing enabled etc Upon entry to the ASR all pending signals including all those received since the last ASR invocation are passed as an argument to the ASR In addition a stack frame is built to facilitate the return from the ASR as_catch replaces any previous ASR for the calling task Therefore a task can have only one ASR at any time An ASR must exit using the as_return system call Arguments start_addr Specifies the address of the ASR mode Specifies the ASR s attributes m
201. address unsigned long ifru_flags Flags for the NI int ifru mtu Maximum number of pSOSystem System Calls pNA System Calls ioctl transmission units char ifru_data For private use ifr_ifru define ifr_addr ifr_ifru ifru_addr Address define ifr_dstaddr ifr_ifru ifru_dstaddr Other end of p to p link define ifr_broadaddr ifr_ifru ifru_broadaddr NI broadcast addr define ifr_mtu ifr_ifru ifru_mtu Maximum number of transmission units define ifr_data ifr_ifru ifru_ data NI private data define ifr_flags ifr_ifru ifru_flags Flags ef ifr_flags can contain one or more of the symbolic constants below defined in pna h in the following syntax IFF_BROADCAST IFF_RAWMEM Symbolic Constant Description IFF_BROADCAST NI can broadcast IFF_EXTLOOPBACK NI uses external loopback IFF_INITDOWN Initialize an interface in the DOWN state By default inter faces are installed in the UP state This flag may only be specified when initially adding an interface Note that this is not an attribute of the NI IFF_MULTICAST NI supports multicast IFF_NOARP NI does not have ARP IFF_POINTTOPOINT NI is point to point driver IFF_POLL pNA polls NI at regular intervals IFF_RAWMEM NI passes packets as mblks IFF_UNNUMBERED NI is an unnumbered link IFF_UP NI is UP Memory Related Operations SI
202. ag is not specified space If the first character of a signed conversion is not a sign or if a signed conversion results in no characters a space will be prefixed to the result If the space and flags both appear the space flag will be ignored pSOSystem System Calls pREPC System Calls pSOSystem System Calls fprintf The result is converted to an alternate form For o conversion it increases the precision to force the first digit of the result to be a zero For x or X conversion a nonzero result will have 0x or 0X prefixed to it For e E f g and G conversions the result will always contain a decimal point character even if no digits follow it Normally a decimal point character appears in the result of these conversions only if a digit follows it For g and G conversions trailing zeros will not be removed from the result For other conversions the behavior is undefined For d i 0 u x X e E f g and G conversions leading zeros following any indication of sign or base are used to pad the field width no space padding is performed If the 0 and flags both appear the 0 flag will be ignored For d i o u x and X conversions if a precision is specified the 0 flag will be ignored For other conversions the behavior is undefined The conversion specifiers and their meanings are d i or The argument is assumed to be an int and is converted to signed decimal notation The pre
203. ailed q_broadcast is particularly useful in situations where a single event for example an interrupt must wake up more than one task In such cases q_broadcast is clearly more efficient than multiple q_send calls If the caller is a task it may be preempted as a result of this call q_broadcast can be intermixed with q_send and q_urgent calls to the same queue q_broadcast sends messages to an ordinary message queue Use q_vbroadcast to send messages to a variable length message queue Multiprocessor Considerations 1 If qid identifies a global queue residing on another processor node then the pSOS m kernel will internally make an RSC to that remote node to post the input message to that queue If tasks awakened by this call do not reside on the local node then the psoS m kernel will internally pass the message to each task s node of residence whose pSOS m kernel will ready the task and give it the relayed message Thus a q_broadcast call whether it is on the local or a remote queue may cause pSOS m activities on one or more other processor nodes pSOSystem System Calls pSOS System Calls q_broadcast Callable From m Task m ISR if the targeted queue is local to the node from which the q_broadcast call is made m KI if the targeted queue is local to the node from which the q_broadcast call is made m Callout if the targeted queue is local to the node from which the q_broadcast
204. ailure 2 90 pSOSystem System Calls pHILE System Calls Error Codes Hex 0x2003 0x201F 0x2052 0x2054 0x2055 0x2058 0x205A 0x205B 0x205C 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E Mnemonic E_BADVOL EOE EREMOTE EIO _ EACCES _ESTALE AMETOOLONG ENXIO ENODEV EAUTH ENFS ETIMEDOUT ENOAUTHBLK _ ECANTSEND _ ECANTRECV E_PROBUNAVAIL EPROGVERSMISMATCH ECANTDECODEARGS EUNKNOWNHOST EPROGNOTREGISTERED UNKNOWNPROTO t EINTR ERPC pSOSystem System Calls read_dir Description Inconsistent data on volume volume corrupted Read past end of file Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle Directory filename too long No such device or address No such device RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors
205. ailure in re 4 RPC_CANTRECV Failure in receiv ceiving result ing result 0x2077 E_PROBUNAVAIL Program 8 RPC_PROGUNAVAIL Program not not available available 0x2078 _EPROGVERSMISMATCH 9 RPC_PROGVERSMISMATCH Pro Program version mismatched gram version mismatched 0x2079 __ECANTDECODEARGS De 11 RPC_CANTDECODEARGS Decode code arguments error arguments error B 36 pSOSystem System Calls Error Codes pHILE Error Codes TABLE B 6 pHILE Error Codes That Represent RPC Errors ee RP sal pHILE Hex pHILE Description aa RPC Description 0x207A _EUNKNOWNHOST Unknown 13 RPC_UNKNOWNHOST Unknown host name host name 0x207B E_PROGNOTREGISTERED Re 15 RPC_PROGNOTREGISTERED Re mote program is not regis mote program is not registered tered 0x207C E_UNKNOWNPROTO Unknown 17 RPC_UNKNOWNPROTO Unknown protocol protocol 0x207D __EINTR Call interrupted 18 RPC_INTR Call interrupted Ox207E _ERPC All other RPC errors 1 RPC_CANTENCODEARGS Can t en code arguments 2 RPC_CANTDECODERES Can t de code results 6 RPC_VERSMISMATCH RPC ver sions not compatible 10 RPC_PROCUNAVAIL Procedure unavailable 12 RPC_SYSTEMERROR Generic other problem 16 RPC_FATLED pSOSystem System Calls B 37 pREPC Error Codes Error Codes B 3 pREPC Error Codes When a pREPC system
206. all timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors 1 If the specified filename already exists the new file is not created An existing file must first be deleted by using remove_f before its name can be used for a new file 2 make_dir creates only directory files create_f creates an ordinary file See Also creat pSOSystem System Calls remov _f open_dir 2 67 mount_vol pHILE System Calls mount_vol Mounts a pHILE formatted volume include lt phile h gt unsigned long mount_vol char device volume name unsigned long sync_mode synchronization mode Volume Types pHILE formatted volumes Description mount_vol mounts a pHILE formatted volume A volume must be mounted before any file operations can be applied to it Permanent volumes on non removable media need mounting only once Removable volumes can be mounted and unmounted as required Arguments device Points to the null terminated name of the volume to be mounted sync_mode Specifies the volume s write synchronization attribute The attribute is defined in lt phile h gt and must be set to one of the following values SM_IMMED_WRITE Immediat
207. aller is a task it may be preempted as a result of this call 2 q_send sends a message to an ordinary message queue Use q_vsend to send a message to a variable length message queue Multiprocessor Considerations 1 If qid identifies a global queue residing on another processor node the local kernel will internally make an RSC to that remote node to post the input message to that queue 2 If a task awakened by this call does not reside on the local node the local kernel will internally pass the message to the task s node of residence whose pSOS m kernel will ready the task and give it the relayed message Thus a q_send call whether it is on the local or a remote queue may cause pSOS tm activities on another processor node Callable From a Task m ISR if the target queue is local to the node from which the q_send call is made m KI if the target queue is local to the node from which the q_send call is made Callout if the target queue is local to the node from which the q_send call is made See Also q_broadcast q_receive q_urgent q_vsend pSOSystem System Calls 1 85 q_urgent pSOS System Calls q_u rgent Posts a message at the head of an ordinary message queue include lt psos h gt unsigned long q_urgent unsigned long qid queue identifier unsigned long msg_buf 4 message buffer Description This system call is identical in all respects to g_send with one exception
208. an error code on failure pSOSystem System Calls 2 43 ftruncate_f Error Codes Hex 0x2001 0x2003 0x2015 Ox201A 0x201B 0x201C 0x201D 0x2022 0x2052 0x2054 0x2055 0x2057 0x2058 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 2 44 Mnemonic E_FUNC __BADVOL t __RO t E_FIDBIG E_FIDOFE E_ININFULL E_VFULL E_ LOCKED E REMOTE EIO EACCES EQUOT ESTALE E_ENXIO ENODEV E_BADCD EAUTH ENF S ETIMEDOUT ENOAUTHBLK ECANTSEND ECANTRECV pHILE System Calls Description Invalid function number Inconsistent data on volume volume corrupted Operation not allowed on read only system files directories or mounted volumes Invalid file ID out of range Invalid file ID file not open Index block full Volume is full This cannot happen on NFS formatted volumes Data is locked Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Quota exceeded Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks available Failure in sending call Failure in receiving resul
209. and the calling task specified SM_NOWAIT then sm_p returns with an error code If SM_WAIT is elected the task will be blocked until a semaphore token is released or if the timeout argument is specified until timeout occurs whichever occurs first Arguments smid Specifies the semaphore ID of the semaphore token flags Specifies whether sm_p will block waiting for a token flags should have one of the following values defined in lt psos h gt SM_WAIT Block until semaphore is available SM_NOWAIT Return with error code if semaphore is unavailable timeout Specifies the timeout interval in units of clock ticks If timeout is zero and flags is set to SM_WAIT then sm_p will wait forever timeout will be ignored if flags is set to SM_NOWAIT Return Value This system call returns 0 on success or an error code on failure 1 128 pSOSystem System Calls pSOS System Calls sm_p Error Codes Hex Mnemonic Description Ox01 ERR_TIMEOUT Timed out this error code is returned only if a timeout was requested 0x05 ERR_OBJDEL Semaphore has been deleted 0x06 ERR_OBJID smid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x42 ERR_NOSEM No semaphore this error code is returned only if SM_NOWAIT was selected 0x43 ERR_SKILLD Semaphore deleted while task waiting 0x54 ER_NOAGNT Cannot wait on remote object no free agents at node 0x
210. aphore identifier Description This system call creates a semaphore by allocating and initializing a Semaphore Control Block SMCB according to the specifications supplied with the call Like all objects a semaphore has a user assigned name and a pSOS assigned semaphore ID returned by sm_create Several flag bits specify the characteristics of the semaphore including whether tasks will wait for the semaphore by task priority or strictly FIFO Arguments name Specifies the user assigned name of the new semaphore count Specifies the initial semaphore token count flags Specifies the semaphore s attributes flags is formed by OR ing the following symbolic constants one from each pair defined in lt psos h gt SM_GLOBAL Semaphore can be addressed by other nodes SM_LOCAL local nodes only SM_PRIOR Tasks are queued by priority FIFO order SM_PRIOR smid Points to the variable where sm_create stores the semaphore ID of the named semaphore Return Value This system call returns O on success or an error code on failure pSOSystem System Calls 1 121 sm_create pSOS System Calls Error Codes Notes 1 122 Hex Mnemonic Description 0x08 ERR_OBJTFULL Node s object table is full 0x41 ERR_NOSCB Exceeds node s maximum number of semaphores Internally the pSOS kernel treats a semaphore name as a 32 bit integer However when the application calls the kernel through the pSOS C language A
211. ar time to a string 3 20 ctime_r Reentrant Converts the calendar time to a string 3 22 difftime Computes the difference between two calendar times 3 24 div Performs a division operation on two specified integers 3 25 errno The error number returned by the last failing system call 3 27 exit Terminates a task 3 28 fclose Closes a stream 3 30 feof Tests a stream s end of file indicator 3 32 ferror Tests a stream s error indicator 3 33 fflush Flushes the buffer associated with an open stream 3 34 fgetc Gets a character from a stream 3 35 fgetpos Gets the current file position indicator for fsetpos 3 36 fgets Gets a string from a stream 3 37 fopen Opens a file 3 39 fprintf Prints formatted output to a stream 3 43 fputc Writes a character to a stream 3 48 pSOSystem System Calls A 21 pREPC System Calls Tables of System Calls TABLE A 4 pREPC System Calls Continued Name Description Page fputs Writes a string to a stream 3 50 fread Reads from a stream 3 51 free Deallocates memory 3 53 freopen Reopens a file 3 54 fscanf Reads formatted input from a stream 3 56 fseek Sets the file position indicator 3 61 fsetpos Sets file position by using the fgetpos result 3 63 ftell Gets the file position indicator 3 65 fwrite Writes to a stream 3 67 getc Gets a character from a stream 3 69 getchar Gets a character from stdin 3 70 get
212. arily by the pHILE file system manager during initialization The scratch buffer must be the size of a pHILE block The pHILE Configuration Table parameter fc_logbsize in the sys_conf h file determines this block size This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic 0x2003 E_BADVOL 0x2005 E_VINITPAR 0x2008 E_MNTED 0x2021 E_ILLDEV 0x2025 E_IDN Notes Description Inconsistent data on volume volume corrupted Illegal parameters to init_vol Volume is already mounted Illegal device exceeds maximum Illegal device name 1 All data stored on the volume is lost by execution of this call 2 The volume s media must have been properly hardware formatted before this call is executed 3 A mounted volume cannot be initialized 4 init _vol can be used for the first initialization of a volume It receives all the information it needs in its parameters 5 The pHILE file system manager stores the volume s label and time of initialization in the volume s rootblock but it does not use this information The user decides how to use this information which can be examined by using read_vol to read the rootblock block 2 directly 6 The starting block of the bitmap also determines the starting block of the FLIST since the FLIST immediately follows the bitmap pSOSystem System Calls 2 51 init_vol pHILE System Calls See Also mount_v
213. ask s internal errno vari 1 23 able ev_asend pSOS m kernel only Asynchronously sends events to a task 1 25 ev_receive Allows a task to wait for an event condition 1 27 ev_send Sends events to a task 1 30 i_enter Enters into an interrupt service routine 1 33 i_return Provides an exit from an interrupt service routine 1 35 k_fatal Aborts and enters fatal error handling mode 1 40 k_terminate Terminates a node other than the master node 1 42 m_ext2int Converts an external address into an internal address 1 44 m_int2ext Converts an internal address into an external address 1 46 pt_create Creates a memory partition of fixed size buffers 1 48 pt_delete Deletes a memory partition 1 51 pSOSystem System Calls A 15 pSOS System Calls Tables of System Calls TABLE A 2 pSOS System Calls Continued Name Description Page pt_getbuf Gets a buffer from a partition 1 53 pt_ident Obtains the identifier of the named partition 1 55 pt_retbuf Returns a buffer to the partition from which it came 1 57 pt_sgetbuf Gets a buffer from a partition 1 59 q asend pSOS m kernel only Asynchronously posts a message to an 1 61 ordinary message queue q_aurgent pSOS m kernel only Asynchronously posts a message at the 1 63 head of an ordinary message queue q_avsend pSOS m kernel only Asynchronously posts a message to a 1 65 variable length message queue q_a
214. at correspond to multibyte characters from the array pointed to by pwcs into a sequence of multibyte characters that begins in the initial shift state and stores these multibyte characters in the array pointed to by s stopping if a multibyte character would exceed the limit of n total bytes or if a null character is stored Each call is converted as if by a call to the wctomb function except that the shift state of the wctomb function is not affected No more than n bytes will be modified in the array pointed to by s If copying takes place between objects that overlap the behavior is undefined Arguments s Points to the array where wstombs stores the converted string pwcs Points to the string to be converted n Specifies the size of s Return Value If a code is encountered that does not correspond to a valid multibyte character this function returns size_t 1 Otherwise it returns the number of bytes modified not including a terminating null character if any Error Codes None pSOSystem System Calls 3 189 wcstombs Notes Callable From a Task ISR See Also wctomb mbtowc mbstowcs 3 190 pREPC System Calls pSOSystem System Calls pREPC System Calls wctomb wctomb Converts a wide character into its multibyte character equivalent include lt stdlib h gt int wctomb char s result character wchar_t wchar wide character Description The wctomb function determines t
215. at_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f 0x2059 E_XLINK Can t close link link_f 0x205A _NAMETOOLONG Directory filename too long read_dir 0x205B ENXIO No such device or address on access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f pSOSystem System Calls B 25 pHILE Error Codes Error Codes TABLE B 3 pHILE Error Codes Continued Hex Mnemonic and Description System Call s 0x205C E_ENODEV No such device on server access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f 0x2060 E_BADCD CD ROM volume illegal operation access_f annex_f chmod_f chown_f create_f fchmod_f fchown_f ftruncate_f link_f lock_f lstat_f make_dir move_f read_link remove_f symlink_f sync_vol
216. ata items and stored in variables pointed to by the remaining arguments If insufficient arguments are provided for format the behavior is undefined If format is exhausted while arguments remain the excess arguments are evaluated but are otherwise ignored Arguments 3 56 stream format Points to an open pREPC stream Points to the format control string The format is a multibyte character sequence beginning and ending with its initial shift state It is composed of zero or more directives one or more white space characters an ordinary multibyte character neither nor a white space character or a conversion specification Each conversion specification is introduced by the character After the the following appear in sequence m An optional assignment suppressing character m Anoptional nonzero decimal integer that specifies the maximum field width pSOSystem System Calls pREPC System Calls pSOSystem System Calls fscanf m An optional modifier h or 1 ell indicating the size of the receiv ing object For instance the conversion specifier d is preceded by h if the corresponding argument is a pointer to a short int rather than a pointer to an int A table of modifiers is presented below under the list of conversion specifiers m A character that specifies the type of conversion to be applied The valid conversion specifiers are described below fscanf executes each directive of the format in turn
217. ated events are sent when the timer expires 5 When a task with armed timers is restarted or deleted its timers are automatically cancelled 6 The number of simultaneously active timers is fixed and defined by the kc_ntimer entry in the pSOS Configuration Table Multiprocessor Considerations None This call affects only the calling task Callable From a Task See Also v_receive ev_send pSOSystem System Calls 1 169 tm_evwhen tm_evwhen pSOS System Calls Sends events to the calling task at a specified time include lt psos h gt unsigned long tm_evwhen unsigned long date unsigned long time unsigned long ticks unsigned long events unsigned long tmid Description date of wakeup time of wakeup ticks at wakeup event list timer identifier This system call enables the calling task to arm a timer so that it expires at the appointed date and time whereupon the pSOS kernel internally calls ev_send to send the designated events to the task tm_evwhen does not block the calling task unlike tm_wkwhen A task can use multiple tm_evwhen calls to arm two or more concurrent timers The tm_evwhen call resembles tm_evafter except that tm_evwhen wakes the caller at an appointed time rather than after a specified interval Arguments date time 1 170 Specifies the clock date for event send date is encoded as follows Field Year A D M
218. ates in packet pSOS initialization OxF13 FAT_MIVERIF Multiprocessor configuration This error originates in mismatch at system verify pSOS initialization OxF15 FAT_NODENUM Illegal value for mc_nodenum This error originates in pSOS initialization OxF16 FAT_NNODES Illegal value for mc_nnodes This error originates in pSOS initialization pSOSystem System Calls B 13 pSOS Error Codes Error Codes TABLE B 2 pSOS Error Codes Continued Hex Mnemonic and Description System Call s OxF17 FAT_OVMP Region 0 overflow while making mul This error originates in tiprocessor structures pSOS initialization OxF18 FAT_KIMAXBUF mc_kimaxbuf too small for This error originates in mc_nnodes pSOS initialization OxF19 FAT_ASYNCERR Asynchronous RSC failure This error originates in pSOS initialization OxF1B FAT_DEVINIT Error during auto initialization of This error originates in a device pSOS initialization OxF20 FAT_JN2SOON Join request denied Node al This error originates in ready in system pSOS initialization OxF21 FAT_MAXSEQ Join request denied Sequence This error originates in number at limit pSOS initialization 0xF22 FAT_JROATSLV Join request sent to a slave This error originates in node instead of the Master node pSOS initialization B 14 pSOSystem System Calls Error Codes B 2 pHILE E
219. athname with zero create_f make_dir characters was passed This error code is also move_f remove_f returned when a pathname that does not end with an actual filename has been passed to create_f or make_dir or to the new file name of a move_ f call For example a period would be a legal pathname for open_ f but not for create_ f 0x2011 __FEXIST Filename already exists create_f make_dir move_f 0x2012 FLIST Too many files on volume Attempt to create_f make_dir create a new file when the FLIST is full You pro move_f vide the size of the FLIST when the volume is initialized 0x2013 _FOPEN Cannot remove an open file Attempt remove_ f to remove a file that is still open 0x2014 __DNE Cannot delete directory that has files remove_f Attempt to remove a directory that is not empty B 18 pSOSystem System Calls Error Codes TABLE B 3 pHILE Error Codes Continued pHILE Error Codes Hex Mnemonic and Description System Call s 0x2015 E_RO Requested operation not allowed on this annex_f chmod_f file This error implies one of the following chown_f create_f m An attempt was made to write to or lock Chmod_f Echown_f BITMAP SYS FLIST SYS or a directory ftruncate_f link_f file lock_f make_dir m Attempted to remove a system file move ty PeMevest truncate_f utime_f m Attempted to annex to BITMAP SYS or write
220. ayed to the right of the decimal point for monetary values displayed using international format Number of digits displayed to the right of the decimal point for monetary values 3 89 localeconv he char p_cs_precedes char p_sep_by_space char n_cs_precedes char n_sep_by_space char p_sign_posn char n_sign_posn a negative value 0 symbol follows value L if currency symbol positive value 0 if symbol follows value L if currency symbol separated from value space 0 otherwise L if currency symbol L if currency symbol by a space follows value af pREPC System Calls precedes currency ny is by a precedes if currency ia is separated from a negative value 0 if currency symbol Indicates position of positive value symbol Indicates position of negative value symbol The elements of grouping and mon_grouping are interpreted according to the following CHAR_MAX 0 other No further grouping is to be performed The previous element is to be repeatedly used for the remainder of the digits The integer value is the number of digits that comprise the current group The next element is examined to determine the size of the next group of digits before the current group The value of p_sign_posn and n_sign_posn is interpreted according to the following Ww N Parentheses surround the quantity and currency_symbol The sign st
221. b 1 0 parameter block address void retval return value Description The de_cntrl call invokes the device control routine of a pSOS device driver specified by the dev argument The functionality of a device control routine depends entirely on the device driver implementation It can include anything that cannot be categorized under the other five I O services de_cntrl for a device can be used to perform multiple input and output subfunctions In such cases extra parameters in the I O parameter block can designate the subfunction Arguments dev Specifies the major and minor device numbers which are stored in the upper and lower 16 bits respectively iopb Points to an I O parameter block the contents of which are driver specific retval Points to a variable that receives a driver specific value returned by the driver Return Code This call returns 0 on success or an error code on failure Beside the error codes listed below other driver specific errors may be returned pSOSystem System Calls 1 13 de_cntrl Error Codes Notes Hex 0x101 0x102 0x103 Examples following Mnemonic ERR_IODN ERR_NODR ERR_IOOP pSOS System Calls Description Illegal device major number No driver provided Illegal I O function number of functions that are often performed by de_cntrl include the m For tty drivers functions such as changing the baud rate and line edit characters enabling disabli
222. be read and or written and is therefore unusable by the pHILE file system manager This list is made up of 32 bit entries and is terminated with a 0 entry The entries need not be in any specific order verify_vol can greatly simplify the handling of bad blocks Refer to Bad Blocks on page 2 139 for information on this feature If no bad block list is provided this entry must be 0 verify_vol calls a user supplied function faultp for status checking see page 2 131 For each processor family faultp returns its return value in the register specified below 68K PPC 960 x86 Return Value On 68K processors faultp uses the DO L register On PowerPC processors faultp uses the r3 register On 960 processors faultp uses the gO register On x86 processors faultp uses the eax register This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic 0x2007 E_VALIE N 0x2009 E_MNTOP 2 128 EN Description Wrong volume format Files are open on volume pSOSystem System Calls pHILE System Calls verify_vol Usage Hex Mnemonic Description 0x200A E_DMOUNT Volume not mounted 0x2021 E_ILLDEV Illegal device exceeded maximum 0x2025 E_IDN Illegal device name 0x2051 E_MAXLOOP Symbolic links nested too deeply 0x2200 VF_INSUFF Insufficient working area provided Ox2201 VE_MAXDEPTH Maximu
223. ber out of range 0x67 ERR_MASTER Cannot terminate master node 1 42 pSOSystem System Calls pSOS System Calls k_terminate Notes 1 k_terminate can be used to terminate the node from which it is called In most cases the results are the same as a k_fatal call However it is implemented differently Whereas k_fatal immediately enters the fatal error handler k_terminate causes a packet to be sent to the master node which then sends a shutdown packet to the calling node If the calling node cannot communicate with the master then the KI presumably calls k_fatal anyway It is preferable to use k_fatal when the failed node is known to be the local node 2 A k_fatal call made with the K_GLOBAL flag set should be used to shut down the entire system including the master node Callable From a Task a ISR a KI m Callout See Also k_fatal pSOSystem System Calls 1 43 m_ext2int pSOS System Calls m_ext2int Converts an external address into an internal address include lt psos h gt unsigned long m_ext2int void ext_addr external reference void int_addr local reference Description This system call converts an external address into an internal address corresponding to the calling node A typical use for this conversion is by a node that has received an address from another node that resides in a dual ported memory zone m_ext2int is relevant only to systems with multiple processors conne
224. ble Portmap failure on the host NFS call timed out No RPC authorization blocks available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors 2 37 fstat_f pHILE System Calls See Also stat_f chmod_f fchmod_f chown_f fchown_f link_f read_f read_link truncate_f ftruncate_f remove_f utime_f write_f 2 38 pSOSystem System Calls pHILE System Calls fstat_vfs fstat_vfs Obtains statistics about a mounted volume specified by a file identifier include lt phile h gt unsigned long fstat_vfs unsigned long fid file identifier struct statvfs buf volume statistics Volume Types All volumes Description fstat_vfs functions the same as stat_vfs except that fstat_vfs obtains the statistics about a volume by using the file identifier instead of the pathname The file identifier is first obtained with either an open_f or an open_ fn call to any file in the volume Arguments file Specifies the file identifier of the file which can be any file within the mounted volume pSOSystem System Calls 2 39 fstat_vfs pHILE System Calls buf Points to a statvfs structure defined in lt phile h gt as follows typedef struct long val 2 non superuser
225. btains the current locale settings that relate to numeric values putting them into a statically allocated structure of type lconv It returns a pointer to that structure The members of lconv with type char are pointers to strings any of which except decimal_point can point to to indicate that the value is not available in the current locale or is of zero length The members with type char are nonnegative numbers any of which can be CHAR_MAX to indicate the value is not available in the current locale The lconv structure is defined as follows struct lconv char char char char char char char char char char char char decimal_point SX thousands_sep grouping Vai int_curr_symbol currency_symbol mon_decimal_point mon_thousands_sep mon_grouping pa positive_sign SR negative_sign A int_frac_digits yx frac_digits ee pSOSystem System Calls Decimal point character for non monetary values Thousands separator for non monetary values Specifies grouping for non monetary values International currency symbol The local currency symbol Decimal point character for monetary values Thousands separator for monetary values Specifies grouping for monetary values Positive value indicator for monetary values Negative value indicator for monetary values umber of digits displ
226. ch are important to the procedures or explanations presented CAUTION Cautions indicate actions that may result in possible loss of work performed and associated data An example might be a system crash that results in the loss of data for that given session pSOSystem System Calls xi Commonly Used Terms and Acronyms Revision Bar Convention Using This Manual WARNING Warnings indicate actions or circumstances that may result in file corruption irrecoverable data loss data security risk or damage to hardware A revision bar at left appears in the margin next to any text that has changed since the last release of this manual Commonly Used Terms and Acronyms xii The following terms and acronyms are commonly associated with pSOSystem and appear in this manual ASR asynchronous signal routine callout FD FLIST ISR interrupt service routine KI kernel interface NFS NI RSC remote service call See asynchronous signaloutine A function within an application that executes in response to an asynchronous signal A function that a device driver uses to notify a pSOSystem compo nent of an interrupt event A callout is called from an ISR File descriptor A contiguous sequence of blocks used to hold file descriptors on a pHILE formatted volume See interrupt service routine A function within an application or device driver that takes control of the system when the CPU has been triggered
227. cision specifies the minimum number of digits that appear The argument is assumed to be an unsigned int and is converted to unsigned octal notation The precision specifies the minimum number of digits to appear The argument is assumed to be an unsigned int and is converted to unsigned decimal notation The precision specifies the minimum number of digits to appear The argument is assumed to be an unsigned int and is converted to hexadecimal notation The precision specifies the minimum number of digits to appear The argument is assumed to be a double and is converted to decimal notation in the form ddd ddd The precision specifies the number of digits to appear after the decimal point The default precision is six If the precision is zero no decimal point is printed The value is rounded to the appropriate number of digits 3 45 fprintf 3 46 a or pREPC System Calls The argument is assumed to be a double and is converted to decimal notation in the form d ddde E dd The precision specifies the number of digits to appear after the decimal point The default precision is six If the precision is zero no decimal point is printed The value is rounded to the appropriate number of digits The argument is assumed to be a double and is converted to decimal notation in the form of either e or f This depends on the value of the converted number The f form is used unless the exponent is less than 4 or great
228. cks the calling task Most of the I O transactions can actually be performed in the device s ISR Upon completion of the transaction the ISR unblocks the blocked task Callable From m Task See Also de_read 1 22 pSOSystem System Calls pSOS System Calls errno_addr errno_addr Obtains the address of the calling task s internal errno variable include lt psos h gt unsigned long errno_addr Description This system call returns the address of the calling task s internal errno variable The pSOS kernel maintains an internal errno variable for every task Whenever an error is detected by any pSOSystem component the associated error code is stored into the running task s internal errno variable The error code can then be retrieved by referencing the errno macro defined in the header file lt psos h gt as follows define errno errno_addr For example the following statement expands to include a call to errno_addr if errno ERR_NOMGB Return Value This system call returns the address of the errno variable of the calling task Error Codes None Notes 1 errno_addr provides a unique errno value for each task while maintaining compatibility with industry standard library semantics It should never be necessary to call errno_addr directly from application code 2 All pSOSystem components set a task s internal errno variable However for the pSOS kernel and pHILE file system ma
229. convert the address by calling m_int2ext This call applies to systems with multiple processors that are connected by dual ported memory on a memory bus Arguments int_addr Specifies the internal address ext_addr Points to the variable where m_int2ext stores the resultant external address If the internal address is within a dual ported zone whose p port is tied to the calling node the external address is different In all other cases the internal and external addresses are the same Return Value This call always returns 0 Error Codes None Notes Be careful about structures that straddle the boundary of a dual port zone because the structure s address range could contain a discontinuity 1 46 pSOSystem System Calls pSOS System Calls m_int2ext Multiprocessor Considerations None Although used in multiprocessor systems m_int2ext executes on the local node Callable From a Task a ISR a KI m Callout See Also m_ext2int pSOSystem System Calls 1 47 pt_create pt_create pSOS System Calls Creates a memory partition of fixed size buffers include lt psos h gt unsigned long pt_create char name 4 partition name void paddr partition physical addr void laddr partition logical address unsigned long length partition length in bytes unsigned long bsize buffer size in bytes unsigned long flags buffer attributes unsigned long ptid pa
230. cted by dual ported memory on a memory bus Other users can disregard this call Arguments ext_addr Specifies the external address int_addr Points to the variable where m_ext2int stores the resultant internal address If the external address is within a dual ported zone whose p port is tied to the calling node then the internal address will be different In all other cases the internal and external addresses will be the same Return Value This system call always returns 0 Error Codes None 1 44 pSOSystem System Calls pSOS System Calls m_ext2int Notes 1 For descriptions of internal and external addresses and dual ported memory considerations see the pSOSystem System Concepts manual 2 Be careful about structures that straddle the boundary of a dual port zone because the address range for the structure may contain a discontinuity Multiprocessor Considerations None Although m_ext2int is primarily used in multiprocessor systems its action is restricted to the local node Callable From a Task m ISR m KI m Callout See Also m_int2ext pSOSystem System Calls 1 45 m_int2ext pSOS System Calls m_int2ext Converts an internal address into an external address unsigned long m_int2ext void int_addr local reference void ext_addr external reference Description When a node on a multiprocessor system passes an address that resides within a dual ported zone it first must
231. ction no disconnect 0x10500012 ESDNOTTDIR Incorrect device type for operation 0x10500013 ESDNODEVICE No such device on SCSI bus 0x10500014 ESBLOCKOUTOFRANGE Block given is beyond end of disk 0x10500015 ESODDBLOCK Block size is less than physical 0x10500016 ESNO_CAPACITY Capacity shows 0 floppy not in drive 0x10500017 SCSI_FORMAT_FAILED Format command failed B 50 pSOSystem System Calls Error Codes Driver Error Codes TABLE B 18 SCSI Error Codes Continued Hex Mnemonic and Description 0x10500018 SCSI_PART_NUM_BAD Bad partition number 0x10500019 SCSI_NOT_PARTITION Device not partitioned 0x1050001A SCSI_W_ PROTECTED Device is write protected 0x1050001B SCSI_NO_MEM Need memory to complete command not avail able 0x1050001C SCSI_NOT_OPEN SCSI device not open 0x1050001D ESDALLREADYOPEN SCSI device is already open 0x1050001E SCSI_END_OF_FILE End of tape file encountered 0x10510000 SCSI_ERR General SCSI error code SCSI_ERR will be OR ed with actual SCSI error code 0x10510001 STAT_CHECKCOND Target wants to give some info 0x10510002 STAT_ERR SCSI error that may be retried 0x10510003 STAT_TIMEOUT Target selection timed out 0x10510004 STAT_BUSY Target busy try again 0x10510005 STAT_SEMFAIL Semaph
232. curs and sets errno Error Codes Refer to Appendix B Notes Callable From a Task pSOSystem System Calls 3 47 fputc pREPC System Calls fp utc Writes a character to a stream include lt stdarg h gt include lt stdio h gt int fputc int c character FILE stream stream pointer Description The fputc function writes the character specified by c to the output stream pointed to by stream after converting it to an unsigned char This function operates the same as the putc function If st ream designates a disk file its position indicator is advanced appropriately Arguments c Specifies the character to write stream Points to an open pREPC output stream Return Value This function returns the character written If a write error occurs the stream s error indicator is set EOF is returned and errno is set Error Codes Refer to Appendix B 3 48 pSOSystem System Calls pREPC System Calls Notes Callable From a Task See Also fgetc pSOSystem System Calls fputc 3 49 fputs pREPC System Calls fp uts Writes a string to a stream include lt stdarg h gt include lt stdio h gt int fputs const char s string FILE stream stream pointer Description The fputs function writes the string pointed to by s to the stream pointed to by stream The terminating null character is not written Arguments Ss Points to the string to be wri
233. d Hex Mnemonic and Description System Call s 0x41 ERR_NOSCB Exceeds node s maximum number sm_create of semaphores 0x42 ERR_NOSEM No semaphore this error code re sm_p turns only if SM_NOWAIT was selected 0x43 ERR_SKILLD Semaphore deleted while task sm_p waiting 0x44 ERR_TATSDEL Informative only there were sm delete tasks waiting Ox47 ERR_NOTIME System time and date not yet set tm_evafter tm_evevery tm_evwhen tm_get tm_wkwnen 0x48 ERR_ILLDATE date input out of range tm_evwhen tm_set Cm_wkwnen 0x49 ERR_ILLTIME time input out of range tm_evwhen tm_set tCm_wkwhen Ox4A ERR_ILLTICKS ticks input out of range tm_evwhen tm_set um_wKkwnen 0x4B ERR_NOTIMERS Exceeds maximum number of tm_evafter configured timers tm_evevery tm_evwhen Ox4C ERR_BADTMID tmid invalid tm_cancel 0x4D ERR_TMNOTSET Timer not armed or already ex tm_cancel pired Ox4E ERR_TOOLATE Too late date and time input al tm_evwhen tm_wkwhen ready in the past 0x53 ERR_ILLRSC object not created from this pt_delete q_delete node q_vdelete sm_delete t_delete t_restart t_start 0x54 ERR_NOAGNT Cannot wait the remote node is q_receive q_vreceive out of Agents pSOSystem System Calls B 11 pSOS Error Codes TABLE B 2 pSOS Error Codes Continued Error Codes H
234. d by the FLP driver TABLE B 17 FLP Driver Error Codes Hex Mnemonic and Description 0x100A0001 FLP_MINOR Invalid minor device 0x100A0002 FLP_NINIT Device not initialized 0x100A0003 P_SEM Semaphore error 0x100A0004 FLP_QUEUE Cannot create a message queue pSOSystem System Calls B 49 Driver Error Codes Error Codes TABLE B 17 FLP Driver Error Codes Continued Hex Mnemonic and Description 0x100A0005 FLP_TASK Cannot create the motor control task 0x100A0006 FLP_RD Floppy drive read failure 0x100A0007 FLP_WR Floppy drive write failure 0x100A0008 FLP_DATA Unable to allocate driver data area 0x100AF000 FLP_DRV Drive related error in the last byte B 6 9 SCSI Driver Error Codes The error codes listed in Table B 18 are returned by the SCSI driver TABLE B 18 SCSI Error Codes Hex Mnemonic and Description 0x10500003 SCSI_FSC Failed to send SCSI command 0x10500009 SCSI_CHP Failed to init SCSI chip 0x1050000B SCSI_UKC Unknown de_ctnrl function 0x1050000C SCSI_ID_ERR Bad SCSI ID de_ctnrl 0x1050000D SCSI_NULL_CDB NULL SCSI Control block 0x1050000E SCSI_PTR_CONFLICT Both in and out data length given 0x1050000F SCSI_DATA_PTR_NULL NULL data pointer 0x10500010 SCSI_NOT_INIT SCSI Driver not initialized 0x10500011 SCSI_ILLRECON Bad reconne
235. d just as in fopen The error and end of file indicators for the stream are cleared If the close operation fails filename is still opened and attached to st ream This call can be used to rename stdin stdout and stderr Arguments filename Points to the name of the file to be opened mode Points to the mode string which specifies how to open the file stream Points to an open pREPC stream Return Value This function returns a file pointer if the file specified by filename is opened or it returns a null pointer if it does not open the file If an error occurs errno is set Error Codes Refer to Appendix B 3 54 pSOSystem System Calls pREPC System Calls Notes Callable From a Task See Also fopen fclose pSOSystem System Calls freopen 3 55 fscanf fscanf pREPC System Calls Reads formatted input from a stream include lt stdarg h gt include lt stdio h gt int fscanf FILE stream stream pointer const char format format control string Description arguments 1 through n The fscanf function reads input from the stream specified by st ream As input is read it is divided into input fields An input field is defined as a string of non white space characters It extends either to the next white space character or up to a specified field width The input fields are handled in a manner determined by a format control string The input fields are converted to d
236. d time are changed Multiprocessor Considerations None This call only affects the calling task Callable From m Task See Also tm_tick tm_wkwhen pSOSystem System Calls 1 181 tm_wkwhen pSOS System Calls tm_wkwhen Blocks the calling task and wakes it at a specified time include lt psos h gt unsigned long tm_wkwhen unsigned long date year month day unsigned long time hour minute second unsigned long ticks clock ticks Description This call enables the calling task to block unconditionally until a specified time The tm_wkwhen call resembles a self suspension t_suspend 0 but tm_wkwhen schedules the task to resume at a specified time This call also resembles tm_wkafter which awakens the calling task after a specified interval Arguments date Specifies the clock date date is encoded as follows Field Bits Year A D 31 16 Month 1 12 15 8 Day 1 31 7 0 time Specifies the clock time t ime is encoded as follows Field Bits Hour 0 23 31 16 Minute 0 59 15 8 Second 0 59 7 0 ticks Specifies the number of ticks within the last second of the time argument Return Value This system call returns 0 on success or an error code on failure 1 182 pSOSystem System Calls pSOS System Calls Error Codes Hex Mnemonic 0x47 ERR_NOTIME 0x48 ERR_ILLDATE 0x49 ERR_ILLTI Ox4A ERR_ILLTICKS Ox4E ERR_TOOLATE Notes tm_wkwhen De
237. d to select an appropriate interface Specifies the outgoing interface for multicast packets The outgoing interface is defined by its interface number The optval is a pointer to a long If set to 1 then the routing table will be used to select an appropriate interface which is also the default case Specifies whether or not to loopback multicast packets optval is a pointer to an unsigned char By default the packets are looped back IP_DEFAULT_MULTICAST_LOOP A value of O disables loopback Specifies the time to live for outgoing IP multicast data grams optval is a pointer to an unsigned char The de fault is IP_DEFAULT_MULTICAST_TTL This system call returns 0 if successful otherwise it returns 1 4 20 pSOSystem System Calls pNA System Calls Error Codes Hex Mnemonic 0x5009 EBADS 0x502A ENOPROTOOPT See Also setsockopt socket pSOSystem System Calls getsockopt Description The socket descriptor is invalid The optname or level is not valid 4 21 ioctl pNA System Calls ioctl Performs control operations on a socket include lt pna h gt long ioctl int s socket descriptor int cmd socket operation char arg operation argument Description The ioct1 system call is used to perform control operations on the specified socket Arguments s Specifies the socket cmd Specifies the operation and is a symbolic constant All permissible cmd values except M
238. data from the specified socket The behavior of this system call depends on the socket type as described under Arguments The recv system call returns the number of bytes received and this value should always be checked because this is the only way to detect the actual number of data bytes stored in the user buffer Applications can use this call to receive messages from the pNA network manager in a linked list of mblks message blocks by setting the MSG_RAWMEM flag Using mblks eliminates the data copy performed in the pNA network manager during the data transfer between the application and the pNA network manager Arguments Ss Specifies the socket from which data is received s can be a stream a datagram or a raw socket If s is a stream socket recv copies whatever data is available at the socket to the user buffer and returns recv never copies more than len bytes of data to the user buffer but it can copy less if less than len bytes are available Unless ioct1 was used to mark the socket non blocking recv blocks the caller if no data is available at the socket The caller is unblocked when data is received If the socket has been marked non blocking recv returns immediately whether or not data is received pSOSystem System Calls 4 45 recv pNA System Calls If s is a datagram socket every recv call receives one datagram The sender defines the size of the datagram If the len parameter is
239. dded to the file 4 Unless the blocks are merged into the file s last extent a new extent descriptor is added to the file as a result of an annex_f call 5 On volumes with separate control and data regions the pHILE file system manager automatically determines the type of block to be annexed based on the file type Directory files receive control blocks and ordinary files receive data blocks 6 Annexes to BITMAP SYS and FLIST SYS are not allowed See Also write_f open_f read_f lseek_f pSOSystem System Calls 2 9 cdmount_vol pHILE System Calls cdmount_vol Mounts a CD ROM volume include lt phile h gt unsigned long cdmount_vol char device volume name unsigned long sync_mode synchronization mode Volume Types CD ROM formatted volumes that conform to ISO 9660 specification Multi volume sets and interleaved files are not supported Description cdmount_vol mounts a CD ROM volume A volume must be mounted before file operations can be applied to it Removable volumes can be mounted and unmounted as required CD ROM volumes are read only Arguments device Points to the null terminated name of the volume to be mounted sync_mode Specifies the volume s write synchronization attribute This attribute is defined in lt phile h gt and must be set to the value shown below SM_READ_ONLY Read only synchronization mode Return Value This system call returns 0 on success or an er
240. default interval between the strobes is set to 75 seconds in pNA The timer is in seconds Only valid if the SO_KEEPALIVE option is set above TCP_MSL Maximum Segment Lifetime in TCP This controls the TIME_WAIT or 2MSL timer in TCP which is set to twice the value of the MSL The timer is used to vali date connection termination and transmits remaining data in the send queue It is a safeguard against se quence numbers being overlapped If set to a low value it allows the sockets to be quickly deleted The default in pNA is 30 seconds The timer is in sec onds TCP_NODELAY Disables delay acknowledgment algorithm Data is sent immediately over the network instead of waiting for the window to be full 4 68 pSOSystem System Calls pNA System Calls setsockopt IP Level Options level must be set to IPPROTO_IP for IP protocol level operations The argument optname can have one of the following values defined in lt pna h gt IP_ADD_MEMBERSHIP Join a multicast group For this option optval is a pointer to the ip_mreq structure defined in lt pna h gt The group multicast address must be specified in the field imr_mcastaddr This is a CLASS D IP multicast address The imr_interface parameter may be set to the IP address of a specific interface for which group membership will be enabled The interface must of course support multicasting Optionally the imr_interface parameter may be set to INADDR_AN
241. denied send sendmsg sendto 0x5011 EEXIST Duplicate entry exists ioctl pSOSystem System Calls B 39 pNA Error Codes Error Codes TABLE B 8 pNA Error Codes Continued Hex Mnemonic and Description System Call s 0x5016 EINVALID An argument is invalid accept add_ni bind chng_route close connect ioctl listen recv recvfrom recvmsg send sendmsg sendto setsockopt shutdown socket 0x5017 ENF ILE An internal table has run out of space accept add_ni chng_route shr_socket socket 0x5020 EP IPE The connection is broken send sendmsg sendto 0x5023 EWOULDBLOCK This operation would block but accept recv socket is non blocking recvfrom recvmsg send sendmsg sendto 0x5024 EINPROGRESS The socket is non blocking and the connect connection cannot be completed immediately 0x5025 EALREADY The socket is non blocking and a previ connect ous connection attempt has not yet been completed 0x5027 EDESTADDRREO The destination address is invalid sendmsg sendto 0x5028 EMSGSIZE Message too long recvmsg send sendmsg sendto 0x5029 EPROTOTYPE Wrong protocol type for socket socket 0x502A ENOPROTOOPT Protocol not available getsockopt setsockopt 0x502B EPROTONOSUPPORT Protocol not supported socket B 40 pSOSystem System Calls Error Co
242. der according to the user supplied function pointed to by compar The compar function is called with two arguments that point to the objects being compared The compar function must return an integer that is less than equal to or greater than O if the first argument is considered less than equal to or greater than the second argument respectively The compar function can call all pREPC character handling functions and all pREPC string handling functions except strtok Other pREPC functions cannot be called from compar If two members of the array are equal their order in the sorted array is unspecified Arguments base Points to the beginning of the array nmemb Specifies the length of the array size Specifies the size of each member of the array compar Points to the user supplied comparison function Return Value This function does not return a value 3 120 pSOSystem System Calls pREPC System Calls qsort Error Codes None Notes Callable From m Task m ISR provided the compar function can be called from an ISR See Also bsearch pSOSystem System Calls 3 121 rand pREPC System Calls rand Returns a pseudo random number include lt stdlib h gt int rand void Description The rand function generates a pseudo random integer number in the range O through 32 767 This function works in concert with srand Return Value This function returns the random number generated Error C
243. des TABLE B 8 pNA Error Codes Continued pNA Error Codes Hex Mnemonic and Description System Call s 0x502D EOPNOTSUPP Requested operation not valid for this accept ioctl type of socket listen 0x502F EAFNOSUPPORT Address family not supported connect 0x5030 EADDRINUSE Address is already in use bind 0x5031 EADDRNOTAVAIL Address not available bind connect sendmsg sendto 0x5033 ENETUNREACH Network is unreachable chng_route send sendmsg sendto 0x5035 ECONNABORTED The connection has been aborted accept by the peer 0x5036 ECONNRESET The connection has been reset by the recv recvfrom peer recvmsg send sendmsg sendto 0x5037 ENOBUFS An internal buffer is required but cannot connect be allocated getpeername getsockname ioctl send sendmsg sendto setsockopt socket 0x5038 EISCONN The socket is already connected connect sendmsg sendto 0x5039 ENOTCONN The socket is not connected getpeername recv recvfrom recvmsg send sendmsg sendto shutdown 0x503B ETOOMANYREF S Too many references can t splice setsockopt 0x503C IMEDOUT Connection timed out connect 0x503D ECONNREFUSED The attempt to connect was re connect listen fused pSOSystem System Calls B 41 pNA Error Codes TABLE B 8 pNA Error Codes Continued Error Codes
244. description in Table 1 should in clude the following m The procedure you followed to build the code Include components used by the application A complete record of any error messages as seen on the screen useful for track ing problems by error code A complete test case if applicable Attach all include or startup files as well as a sequence of commands that will reproduce the problem pSOSystem System Calls Using This Manual Support Contacting Integrated Systems Support To contact Integrated Systems Technical Support use one of the following methods m Call 408 980 1500 extension 501 US and international countries m Call 1 800 458 7767 458 pSOS US and international countries with 1 800 support m Send a fax to 408 980 1647 m Send e mail to psos_support isi com Integrated Systems actively seeks suggestions and comments about our software documentation customer support and training Please send your comments by e mail to ideas isi com pSOSystem System Calls Xv Support xvi TABLE1 Problem Report Using This Manual Contact Name Company Name Customer ID very important Street Address City State Country Zip Code Voice Phone Number Fax Phone Number E mail Address Product Name including components Version s Host System Target System Communication Used ethernet serial Customer Impact Brief
245. desired should be supported by the user s own layer of software 4 To enable an application to mount an MS DOS volume you must set the mount flag FC_MSDOS in sys_conf h See Also 2 12 mount_vol nfsmount_vol pcmount_vol unmount_vol pSOSystem System Calls pHILE System Calls change_dir change _dir Changes the current directory include lt phile h gt unsigned long change_dir char name directory path Volume Types All volume types Description change_dir changes the current directory of the calling task After change_dir executes all relative pathnames used by the calling task are relative to the new current directory Arguments name Points to the null terminated pathname of the new current directory Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2003 E_BADVOL Inconsistent data on volume volume corrupted 0x200A E_DMOUNT Volume not mounted 0x200B E_FNAME Filename not found 0x200C E_IFN Illegal pathname 0x200D E_NDD No default directory 0x200E E_FORD Directory file expected pSOSystem System Calls 2 13 change_dir Hex 0x2025 0x2051 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E 2 14
246. dr Points to the variable where pt_sgetbuf stores the physical address of the buffer laddr Points to the variable where pt_sgetbuf stores the logical address of the buffer Return Value This system call returns 0 on success or an error code on failure pSOSystem System Calls 1 59 pt_sgetbuf Error Codes Hex 0x05 0x06 0x07 0x2C 0x65 Notes Mnemonic ERR_OBUDEL RR_OBJID na A bo R_OBUTYPE zal bo R_NOBUF ERR_STALEID pSOS System Calls Description Partition has been deleted ptid is incorrect failed validity check Object type doesn t match object ID failed validity check Cannot allocate partition out of free buffers Object s node has failed 1 Buffers always start on long word boundaries 2 It is not possible to wait for a buffer pt_sgetbuf unconditionally returns Multiprocessor Considerations If the input argument ptid identifies a global partition on another processor node the pSOS kernel internally makes an RSC to that remote node to allocate the buffer Callable From m Task See Also pt_retbuf pt_getbuf 1 60 pSOSystem System Calls pSOS System Calls q_asend q_asend pSOS m kernel only Asynchronously posts a message to an ordinary message queue include lt psos h gt unsigned long q_asend unsigned long qid queue identifier unsigned long msg_buf 4 message buffer Descriptio
247. dy in the buffer cache the pHILE file system manager reads blocks directly into the buffer without going through the buffer cache Therefore read_vol executes more efficiently when bcount and index are equal to integral multiples of blocks write_vol 2 100 pSOSystem System Calls pHILE System Calls remove_f rem ove f Deletes a file include lt phile h gt unsigned long remove_f char name pathname Volume Types All volume types except CD ROM however functional differences exist and are described here Description remove_f deletes a file from a volume The file can be an ordinary file or a directory file All storage used by the file is returned to the system for reuse The file s entry in its parent directory is also deleted System files and non empty directory files cannot be deleted On pHILE and MS DOS formatted volumes an open file cannot be deleted An open file can be deleted on an NFS volume CD ROM volumes are read only Arguments name Points to the null terminated pathname of the file to delete Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2003 E_BADVOL Inconsistent data on volume volume corrupted Ox200A E_DMOUNT Volume not mounted 0x200B E_FNAME Filename not found pSOSystem System Calls 2 101 remove_f Hex 0x200C 0x200D 0x200E 0x2010 0x2013 0x2014 0x2015 0x2025 0x2051
248. e Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted pSOSystem System Calls pHILE System Calls stat f Hex Mnemonic Description 0x207E ERPC All other RPC errors Usage stat_f can be used to determine both the current device and the current directory of local volumes Thus you can use stat_f to return to a device and directory after leaving them or to construct absolute path names starting at the current directory Only the directory file number is available not the full directory path To obtain the full directory path see get_fn Obtaining both the current device and the current directory ULONG rc System call return code struct stat current_stat JE stabi oF tot xy ULONG device Current device ULONG directory Current directory if rc stat_f amp current_stat 0 Error processing device current_stat st_dev directory current_stat st_dev Returning to the above device and directory at a later time char directory 29 To change back sprintf directory 0x 04x 0x 02x 0x 02x 0x 08x device gt gt 16 Major device number device gt gt 8 amp OxffU Minor device number device amp OxffU Partition number directory File number
249. e ID of the file connection to be closed Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2003 E_BADVOL Inconsistent data on volume volume corrupted 0x201A E_FIDBIG Invalid FID exceeds maximum 0x201B E_FIDOFE Invalid FID file closed pSOSystem System Calls 2 23 close_f Notes See Also pHILE System Calls Because the total number of open files is limited for both tasks and the system as a whole close_f should be used whenever a file connection is no longer needed If the pREPC library is in use close_f 0 should be called only after the pREPC call fclose 0 Otherwise files that the pREPC library is using can be unexpectedly closed If the task has opened one or more NFS files close_f 0 must precede any close 0 call to the pNA network manager by the same task open_f open_fn 2 24 pSOSystem System Calls pHILE System Calls create f create f Creates a data file include lt phile h gt unsigned long create f char name pathname unsigned long expand_unit expansion factor unsigned long mode access mode Volume Types All volume types except CD ROM however expand_unit is meaningful only on pHILE formatted volumes and mode is meaningful only on NFS volumes Description create_ f creates a new ordinary file Arguments name Points to the null terminated pathname of
250. e Types volume name base block byte offset number of bytes to read input buffer pHILE MS DOS and CD ROM formatted volumes Description read_vol reads data directly from a volume bypassing the file system organization imposed by the pHILE file system manager Arguments device Points to the null terminated name of the volume to read block Identifies the logical block number to begin reading index Specifies where to begin reading within the specified block bcount Specifies the number of bytes to read buffer Points to the memory area to receive the data Return Value This system call returns O on success or an error code on failure pSOSystem System Calls 2 99 read_vol pHILE System Calls Error Codes Hex Mnemonic Description 0x200AE_DMOUNT Volume not mounted 0x2025 E_IDN Illegal device name 0x2050 E_BADNFS NFS volume illegal operation Notes See Also If index is larger than the volume s block size the read begins in a subsequent block For example on a volume with a 1024 byte block size a read of block 5 index 1224 is the same as a read block 6 index 200 CD ROM volumes generally use a 2K block size read_vol does not check for the end of the volume so blocks beyond the specified volume size can be read if they physically exist If the requested data includes either entire blocks or a contiguous sequence of blocks and if such blocks are not alrea
251. e as get_fn of the directory pSOSystem System Calls 2 47 get_fn pHILE System Calls 6 The answer is the concatenation of all the components found in step 3 d from last to first As stated above get_fn is available for local volumes only not NFS volumes To obtain not only the current directory but also the current device see stat_f See Also open_fn stat_f 2 48 pSOSystem System Calls pHILE System Calls init_vol init_vol Initializes a pHILE formatted volume include lt phile h gt unsigned long init_vol char device volume name struct INIT_VOL_PARAMS params parameters void scratchbuf scratch buffer Volume Types pHILE formatted volumes Description init_vol initializes a pHILE formatted volume with user supplied parameters init_vol performs a logical format of the volume setting up the necessary control structures and other information needed by the pHILE file system manager for subsequent file operations on the volume A volume must be initialized before it can be mounted After a volume has been initialized init_vol can be used to quickly delete all data on the volume init_vol can be used for the first initialization of a volume see Note 4 Arguments device Points to the null terminated volume name pSOSystem System Calls 2 49 init_vol 2 50 params pHILE System Calls Points to an instance of the init_vol_params structure
252. e enclosed information is optional The brackets are generally not typed when the information is entered A vertical bar separating two text items indicates that either item can be entered as a value The centered dot symbol indicates a required space for example in user input The percent sign indicates the UNIX operating system prompt for C shell The dollar sign indicates the UNIX operating system prompt for Bourne and Korn shells The symbol of a processor located to the left of text identifies processor spe SE cific information the example identifies 68K specific information prism Host tool specific information is identified by a host tools icon in this exam ple the text would be specific to the pRISM host tools chain Format Conventions Each reference section in this manual adheres to a standard format The name of the system call a brief description and its C language syntax appear at the top of the first page The remaining information about the call appears below the syntax and is organized under the following headings Volume Types For pHILE system calls only Names the volume types the system call supports Volume types include pHILE NFS MS DOS and CD ROM pSOSystem System Calls ix Conventions Using This Manual Description Provides a description of the call Arguments Provides descriptions of all arguments used in the call Target Where applicable provides proces
253. e it the relayed message Thus a q_aurgent call whether it is on the local or a remote queue may cause pSOS m activities on another processor node Callable From m Task See Also q_urgent q_vurgent q_avurgent q_asend q_receive 1 64 pSOSystem System Calls pSOS System Calls q_avsend q_avsend pSOS m kernel only Asynchronously posts a message to a variable length message queue include lt psos h gt unsigned long q_avsend unsigned long qid queue identifier void msg_buf message buffer unsigned long msg_len length of message Description This system call functions the same as the q_vsend call except that it executes asynchronously Refer to the description of g_vsend for further information Arguments qid Specifies the queue ID of the target queue msg_buf Points to the message to send msg_len Specifies the length of the message It must not exceed the queue s maximum message length Return Value When called in a system running the pSOSt m kernel this call always returns 0 The pSOS kernel the single processor version returns ERR_SSFN Error Codes Should the call fail if present the node s MC_ASYNCERR routine is invoked and the following error codes can be reported Hex Mnemonic Description 0x05 ERR_OBJDEL Queue has been deleted 0x06 ERR_OBJID qid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed val
254. e kc_deleteco entry in the pSOS Configuration Table Multiprocessor Considerations 1 A task can be deleted only from the local node 2 If tid identifies a global task t_delete notifies the master node so that the task can be removed from its Global Object Table Thus deletion of a global task always causes activity on the master node pSOSystem System Calls 1 139 t_delete Callable From m Task See Also t_restart 1 140 pSOS System Calls pSOSystem System Calls pSOS System Calls t_getreg t_getreg Gets a task s notepad register include lt psos h gt unsigned long t_getreg unsigned long tid task identifier unsigned long regnum register number unsigned long reg_value register contents Description This system call enables the caller to obtain the contents of a task s notepad register Each task has 16 such software registers held in the task s TCB The purpose of these registers is to furnish every task with a set of named permanent variables Eight of these registers are reserved for system use Eight are free to be used for application specific purposes Arguments tid Specifies the task ID of the task whose notepad register will be read If tid equals 0 then the calling task reads its own notepad register regnum Specifies the register number Registers numbered 0 through 7 are for application use and registers 8 through 15 are reserved for system purposes reg_va
255. e object tables are searched 2 If the master node s Global Object Table must be searched the local kernel makes an q_vident RSC to the master node Callable From m Task See Also q_ident q_vcreate pSOSystem System Calls 1 97 q_vreceive q_vreceive pSOS System Calls Requests a message from a variable length message queue include lt psos h gt unsigned long q_vreceive unsigned long qid queue identifier unsigned long flags queue attributes unsigned long timeout timeout in clock ticks void msg_buf message buffer unsigned long buf_len length of buffer unsigned long msg_len length of message Description This system call enables a task or an ISR to obtain a message from a variable length message queue Otherwise it is identical to q_receive Arguments qid flags timeout msg_buf buf_len msg_len 1 98 Specifies the queue ID of the target queue Specifies whether q_vreceive will block waiting for a message flags should have one of the following values defined in lt psos h gt O_NOWAIT Don t wait wait for message Q WAIT Specifies the timeout interval in units of clock ticks If timeout is zero and Q_WAIT is selected then q_vreceive will wait forever timeout will be ignored if O_NOWAIT is selected Points to the buffer that receives the message Specifies the length of the buffer msg_buf points to Ifbuf_len is l
256. e program is not registered 0x207C E_UNKNOWNPROTO Unknown protocol 0x207D E_EINTR Call interrupted 0x207E ERPC All other RPC errors Notes 1 If a file by the same name already exists create_f fails An existing file must first be explicitly deleted using remove_ f before the same name can be used for a new file 2 After a create_f call the new file is empty Blocks are allocated as data is written pSOSystem System Calls 2 27 create _f pHILE System Calls 3 create_f creates only data files Use make_dir to create a directory file 4 create_f does not open a file use an explicit open_f 5 For pHILE formatted volumes the input parameter expand_unit should be considered carefully because it can affect the data access efficiency of the file See Also remove_f make_dir open_f 2 28 pSOSystem System Calls pHILE System Calls fchmod_f fchmod f Changes the mode of a file specified by its file identifier include lt phile h gt unsigned long fchmod_f unsigned long fid file identifier int mode new file mode Volume Types NFS formatted volumes Description fchmod_f functions the same as chmod_f except that fchmod_f changes the mode of a file by its file identifier instead of its pathname The file identifier is first obtained with open_f Arguments fid Specifies the file identifier associated with the file mode Specifies the new file mode mode is the
257. e queue names If duplicate names exist a q_ident call can return the qid of any queue with the duplicate name 3 The maximum number of queues that can be simultaneously active is defined by the kc_nqueue entry in the pSOS Configuration Table The count argument is ignored if the Q_NOLIMIT attribute is specified 4 A queue created with Q_NOLIMIT specified is slightly more efficient pSOSystem System Calls 1 75 q_create pSOS System Calls Q_LIMIT and a count equal 0 is a legitimate setting This combination has the interesting property that a q_send will succeed only if there is already a task waiting otherwise q_send will fail Q_LIMIT set with Q_PRIBUF guarantees that enough buffers will be available for messages to be posted at this queue If Q_LIMIT is not set then Q_PRIBUF is ignored If a queue is created without private buffers then messages posted to it will be stored in buffers from the system wide pool on the node where the queue resides The size of this pool is defined by the kc_nmsgbuf entry in the node s pSOS Configuration Table The Q_GLOBAL attribute is ignored by the single processor version of the pSOS kernel q_create creates an ordinary message queue Use q_vcreate to create a variable length message queue Multiprocessor Considerations 1 The Q_GLOBAL attribute should be set only if the queue must be made known to other processor nodes in a multiprocessor configuration If set t
258. e socket is not connected See Also accept bind getsockname socket 4 14 pSOSystem System Calls pNA System Calls getsockname getsockname Gets the address that is bound to a socket include lt pna h gt long getsockname int s socket descriptor struct sockaddr_in addr socket attributes int addrlen size of sockaddr_in Description The getsockname call obtains the address bound to the specified socket Arguments s Specifies the socket addr Points to 0a sockaddr_in structure in which getsockname stores the address bound to the socket The sockaddr_in structure is defined as follows struct sockaddr_in short sin_family must be AF_INET unsigned short sin_port 16 bit port number struct in_addr sin_addr 32 bit IP address char sin_zero 8 must be 0 This structure cannot be packed addrlen Points to an integer equal to 16 which is the size in bytes of the sockaddr_in structure Return Value This system call returns 0 if successful otherwise it returns 1 pSOSystem System Calls 4 15 getsockname pNA System Calls Error Codes Hex Mnemonic Description 0x5009 EBADS The socket descriptor is invalid An internal buffer is required but cannot be allocated 0x5037 ENOBUFS See Also bind getpeername socket 4 16 pSOSystem System Calls pNA System Calls getsockopt getsockopt Gets options on a socket include lt pna h gt
259. e write synchronization mode SM_CONTROL_WRITE Control write synchronization mode SM_DELAYED_WRITE Delay write synchronization mode SM_READ_ONLY Read only synchronization mode Return Value This system call returns 0 on success or an error code on failure 2 68 pSOSystem System Calls pHILE System Calls Error Codes Hex 0x2006 0x2007 0x2008 0x2021 0x2024 0x2025 Notes Mnemonic E_MNTFULL _VALIEN _MNTED ILLDEV E_FMODE mount_vol Description Attempted to mount too many volumes Wrong volume format Volume already mounted Illegal device exceeded maximum Illegal synchronization mode Illegal device name 1 mount_vol proceeds as if the designated pSOS device were mountable A device is mountable if it is a true storage device that has been initialized by init_vol 2 The number of volumes that can be mounted simultaneously in the system cannot exceed the pHILE Configuration Table parameter fc_nmount 3 The pHILE file system manager operates without regard for volume ownership Furthermore any task can perform a mount_vol and a mounted device has no record of the task that mounted it Therefore a volume is not automatically unmounted when the task that mounted it is deleted If these or any security measures need to be addressed the user s own layer of software must do so See Also init_vol pSOSystem System Cal
260. east one event is satisfied you place EV_WAIT and EV_ANY in flags pSOSystem System Calls 1 27 ev_receive pS0S System Calls EV_NOWAIT Return if the event condition is unsatisfied EV_WAIT block until the event condition is satisfied Selecting EV_NOWAIT is a convenient way to reset all or selected pending events For example an ev_receive for events 1 and 2 unconditionally resets events 1 and 2 EV_ANY Wait for ANY ALL of the desired events EV_ALL A successful return with EV_ANY signifies that at least one specified event was captured A successful return with the EV_ALL attribute signifies that all specified events have been captured timeout If EV_WAIT is set the timeout parameter specifies the timeout in units of clock ticks If the value of timeout is 0 ev_receive waits indefinitely If EV_NOWAIT is set the timeout argument is ignored events_r Points to the variable where ev_receive stores the actual events captured Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x01 ERR_TIMEOUT Timed out this error code is returned only if EV_WAIT was used and the timeout argument was nonzero 0x3C ERR_NOEVS Selected events not pending this code is returned only if the EV_NOWAIT attribute was selected Notes 1 Events are not accumulated No matter how many identical events are s
261. ecifies the timeout interval in units of clock ticks msg_buf An output parameter Contains the received message If the queue is non empty this call always returns the first message there If the queue is empty and the caller specified Q_NOWAIT then q_receive returns with an error code If Q_WAIT is elected the caller will be blocked until a message is posted to the queue or if the timeout argument is used until the timeout occurs whichever happens first If timeout is zero and Q_WAIT is selected then q_receive will wait forever The timeout argument is ignored if Q_NOWAIT is selected Return Value This system call returns 0 on success or an error code on failure pSOSystem System Calls 1 81 q_receive pS0S System Calls Error Codes Hex Mnemonic Description Ox01 ERR_TIMEOUT Timed out this error code is returned only if a timeout was requested 0x05 ERR_OBJDEL Queue has been deleted 0x06 ERR_OBJID qid incorrect failed validity checks 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x36 ERR_QKILLD Queue deleted while task waiting 0x37 ERR_NOMSG Queue empty this error code is returned only if Q_NOWAIT was selected 0x54 ERR_NOAGNT Cannot wait the remote node is out of agents Ox3A ERR_VARO Queue is variable length 0x65 ERR_STALEID Object s node has failed 0x66 ERR_NDKLD Object s node failed while RSC waiting Notes 1 If it is necessary to block t
262. ed by the weekday as a decimal number 0 6 where Sunday is 0 SW Replaced by the week of the year where Monday is the first day 0 53 BX Replaced by the locale s appropriate date representation SX Replaced by the locale s appropriate time representation SY Replaced by the year without century as a decimal number 00 99 SY Replaced by the year with century as a decimal number SZ Replaced by the time zone name oe o Replaced by the percent sign If a conversion specifier is not one of the above the behavior is undefined timeptr Points to the tm structure that contains the broken down time The tm structure is defined in the mktime description on page 3 111 3 152 pSOSystem System Calls pREPC System Calls strftime Return Value If the total number of resulting characters including the terminating null character is not more than maxsize strftime returns the number of characters placed into the array pointed to by s not including the terminating null character Otherwise zero is returned and the contents of the array are indeterminate Error Codes Refer to Appendix B Notes Callable From m Task See Also setlocale time mktime localtime localtime_r pSOSystem System Calls 3 153 strlen pREPC System Calls strlen Computes string length include lt string h gt size_t strlen const char s string Description The strlen function determines the length of a string
263. ed to networks 90 0 0 2 and 100 0 0 3 the socket can receive data addressed to lt 90 0 0 2 10 gt or lt 100 0 0 3 10 gt Arguments s Specifies the socket to which the address is bound addr Points to a structure of type sockaddr_in that stores the socket attributes to be bound to the socket The structure sockaddr_in is defined in the file lt pna h gt and has the following format struct sockaddr_in short sin_family must be AF_INET unsigned short sin_port 16 bit port number struct in_addr sin_addr 32 bit IP address char sin_zero 8 must be 0 This structure cannot be packed 4 6 pSOSystem System Calls pNA System Calls bind addrlen Specifies the size in bytes of the sockaddr_in structure and must be 16 Return Value This system call returns 0 if successful otherwise it returns 1 Error Codes Hex Mnemonic Description 0x5009 EBADS The socket descriptor is invalid 0x5016 EINVALID An argument is invalid 0x5030 EADDRINUSE The specified address is already in use 0x5031 EADDRNOTAVAIL The specified address is not available See Also connect getsockname listen socket pSOSystem System Calls 4 7 close pNA System Calls close Closes a socket descriptor include lt pna h gt long close int s socket descriptor Description The close call discards the specified socket descriptor If it is the last descriptor associated with the socket the sock
264. ed with an asterisk are described in detail in this chapter auth_destroy authunix_create_default clnt_call clnt_freeres clnt_perror clnt_control clnt_spcreateerror clnttcp_create pmap_getport pmap_unset svcerr_auth svcerr_noprog svcerr_weakauth svctcp_create svc_fdset svc_getcaller svc_run svc_unregister xdrrec_endofrecord xdrrec_skiprecord xdr_array xdr_bytes xdr_char xar_enum pSOSystem System Calls authnone_create callrpc clnt_create clnt_geterr clnt_sperrno clnt_pcreateerror clnt_udp_bufcreate get_fdset pmap_rmtcall registerrpc svcerr_decode svcerr_progvers svcfd_create svcudp_create svc_freeargs svc_getreq svc_sendreply xdrmem_create xdrrec_eof xdrstdio_create xdr_authunix_parms xdr_callhdr xdr_destroy xdr_float authunix_create clnt_broadcast clnt_destroy clnt_perrno clnt_sperror clntraw_create clntudp_create pmap_getmaps pmap_set rpc_getcreateerr svcerr_noproc svcerr_systemerr svcraw_create svc_destroy svc_getargs svc_getreqset svc_register xdrrec_create xdrrec_readbytes xdr_accepted_reply xdr_bool xdr_callmsg xdr_double xdr_free 5 3 5 4 xdr_getpos xdr_long xdr_pmap xdr_reference xdr_setpos xdr_union xdr_u_long xdr_vector xprt_unregister xdr_inline xdr_opaque xdr_pmaplist xdr_rejected_reply xdr_short xdr_u_char xdr_u_short xdr_wrapstring pRPC System Calls xdr_int xdr_opaque_auth
265. een associated with s through a previous connect system call If s is a raw socket the raw datagram is sent to the raw socket that has been associated with s through a previous connect system call Points to a buffer containing the data to send If s is a datagram socket the data that buf points to is a datagram Specifies the number of bytes in buf 4 57 send flags Return Value pNA System Calls Specifies usage options and is the result of an OR operation per formed on one or more of the following symbolic constants defined in lt pna h gt It can also be set to 0 MSG_OOB MSG_DONTROUTI Gl MSG_RAWMEM Specifies that you want send to send out of band data rather than the regular in band data Specifies that you want send to turn on the socket flag SO_DONTROUTE for the duration of the send operation The SO_DONTROUTE flag prohibits routing of outgoing data from the socket Packets directed at unconnected nodes are dropped Specifies that you have set buf to point to a linked list of mblks and len to the total size of the mes sage This system call returns the number of bytes sent or 1 if an error occurs Error Codes 4 58 Hex 0x5009 0x500D 0x5016 0x5020 0x5023 0x5028 0x5033 0x5036 0x5037 0x5039 Mnemonic EBADS EPIPE EACCESS EINVALID EWOULDB 1OCK EMSGSIZE ENETUN RE ECONNRE EN
266. egistered Unknown protocol Call interrupted All other RPC errors 2 77 open_f pHILE System Calls open_f Opens a file include lt phile h gt unsigned long open_f unsigned long fid file identifier char name pathname unsigned long mode unused set to zero Volume Types All volume types Description open_f creates a connection between a file and the calling task and returns a file identifier The file identifier is used in subsequent operations on the file open_f fails if the system is out of file control blocks or if the task is out of open file table entries open_f does not check for a file type It opens ordinary files directory files or system files However directory files and system files are read only open_f always positions the L_ptr at the first byte in the file For CD ROM volumes open_f can be used to read the primary volume descriptor See Primary Volume Descriptor under Notes Arguments fid Points to the variable where open_f stores the file identifier name Points to the null terminated pathname of the file to open mode Reserved for future use should be set to O for future compatibility Return Value This system call returns 0 on success or an error code on failure 2 78 pSOSystem System Calls pHILE System Calls Error Codes Hex 0x2003 0x200A 0x200B 0x200C 0x200D 0x200E 0x2018 0x2019 0x2025 0x2051 0x2052
267. eived ICMP Time Exceeded messages received ICMP Parameter Problem messages re ceived ICMP Source Quench messages received ICMP Redirect messages received ICMP Echo request messages received ICMP Echo Reply messages received ICMP Timestamp request messages re ceived ICMP Timestamp Reply messages received ICMP Address Mask Request messages re ceived ICMP Address Mask Reply messages re ceived ICMP messages this entity sent ICMP messages not sent due to ICMP prob lems ICMP Destination Unreachable messages sent ICMP Time Exceeded messages sent ICMP Parameter Problem messages sent ICMP Source Quench messages sent ICMP Redirect messages sent ICMP Echo request messages sent ICMP Echo Reply messages sent pSOSystem System Calls pNA System Calls GET Command Definitions SIOCGICMPOUTTIM ESTAMPS SIOCGICMPOUTTIM SIOCGICMPOUTADD SIOCGICMPOUTADD pSOSystem System Calls ESTAMPREPS RMASKS RMASKREPS ioctl ICMP Timestamp request messages sent ICMP Timestamp Reply messages sent ICMP Address Mask Request messages sent ICMP Address Mask Reply messages sent 4 35 ioctl 4 36 pNA System Calls Definitions for TCP Group MIB Variables GET Command Definitions SIOCGTCPRTOALGORITHM SIOCGTICPRTOMI SIOCGTCPRTOMAX SIOCGTCPMAXCONN SIOCGTCPACTIVEOPENS SIOCGTCPPASSIVEOPENS SIOCGTCPATTEMPTFAILS SIOCGTCPEST
268. encountered mostowcs returns size_t 1 Otherwise it returns the number of array elements modified not including a terminating zero code if any Error Codes None 3 98 pSOSystem System Calls pREPC System Calls Notes Callable From a Task a ISR See Also mbtowc wcstombs wctomb pSOSystem System Calls mbstowcs 3 99 mbtowc pREPC System Calls mbtowc Converts a multibyte character into its wide character equivalent include lt stdlib h gt int mbtowc wchar_t pwc result wide character const char s original multibyte character size_t n size of original character Description If s is not a null pointer the mbtowc function determines the number of bytes that are contained in the multibyte character pointed to by s It then determines the code for the value of type wchar_t that corresponds to that multibyte character The value of the code corresponding to the null character is zero If the multibyte character is valid and pwc is not a null pointer the mbtowc function stores the code in the object pointed to by pwc At most n bytes of the array pointed to by s will be examined Arguments pwc Points to the array where mbtowc stores the result character s Points to the multibyte character to be converted n Specifies the size of the multibyte character to be converted Return Value 3 100 If s is a null pointer this function returns a nonzero or zero value if mul
269. ent memchr Searches memory for a character 3 102 memcmp Compares two objects in memory 3 104 memcpy Copies characters in memory 3 106 memmove Copies characters in memory 3 108 memset Initializes a memory area with a given value 3 110 mkt ime Converts the broken down time into calendar time 3 111 perror Prints a diagnostic message 3 114 printf Prints formatted output to stdout 3 115 pute Writes a character to a stream 3 117 putchar Writes a character to stdout 3 118 puts Writes a string to a stream 3 119 gsort Sorts an array in ascending order 3 120 rand Returns a pseudo random number 3 122 pSOSystem System Calls A 23 pREPC System Calls TABLE A 4 pREPC System Calls Continued Tables of System Calls Name Description Page realloc Allocates memory 3 123 remove Removes a file 3 125 rename Renames a file 3 126 rewind Resets the file position indicator 3 128 scanf Reads formatted input from stdin 3 130 setbuf Changes a stream s buffer 3 132 setlocale Obtains or changes the program s locale 3 134 setvbuf Changes a stream s buffering characteristics 3 136 sprintf Writes formatted output to a buffer 3 138 srand Sets the seed for the random number generator rand 3 140 sscanf Reads formatted input from a string 3 141 strcat Appends one string to another string 3 143 strchr Searches a string for a character 3 144 strcmp Com
270. ent to the calling task before it calls ev_receive for receiving the event the result is the same as if one event were pending 1 28 pSOSystem System Calls pSOS System Calls ev_receive 2 The ev_receive call captures only the events that the caller selects It captures each selected event once If a pending event does not match a selected event the pending event remains pending Also if a pending event was sent after an earlier event was used to match a selected event the pending event remains pending Consider the following example sequence a Task P has pending events 1 and 2 b With EV_ALL set P calls ev_receive for events 1 3 and 8 Pending event 1 is cleared c Task A sends events 1 and 8 to P d Event 1 is made pending Event 8 is used to match the wanted event e Task B sends events 2 3 and 5 to P Event 2 has no effect because event 2 is already pending Event 5 is unwanted and made pending Event 3 is used to match a wanted event The event condition is met so P becomes ready to run f Events 1 2 and 5 are left pending g Events 1 3 and 8 are returned in events_r Multiprocessor Considerations None The actions performed by ev_receive take place only on the local node whether or not events come from other nodes Callable From a Task See Also ev_send pSOSystem System Calls 1 29 ev_send pSOS System Calls ev_send Sends events to a task include lt psos h gt u
271. er it should be set as follows params gt ipaddr htonl address Points to the pathname of the filesystem to mount Reserved for future use and must be 0 Reserved for future use and must be 0 This system call returns 0 on success or an error code on failure Error Codes 2 74 Hex 0x2006 0x2008 0x2025 0x2051 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C 0x2070 0x2071 Mnemonic E_MNTFULL NTED E_ID E_MAXLOOP DS EMOTE EIO EACCES ESTALE ENXIO ENODEV EAUTH Description Attempted to mount too many volumes Volume already mounted Illegal device name Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device RPC authorization is not available Portmap failure on the host pSOSystem System Calls pHILE System Calls Hex 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E Notes Mnemonic ETIMEDOUT ENOAUTHBLK ECANTSEND ECANTRECV PROBUNAVAIL ti EPROGVERSMISMATCH ECANTDECODEARGS EUNKNOWNHOST EPROGNOTREGISTERE E_UNKNOWNPROTO EINTR ERPC nfsmount_vol Descr
272. er than or equal to the precision The precision specifies the number of significant digits The decimal point character appears only if a digit follows it The argument is assumed to be an int and is converted to an unsigned char The argument is assumed to be a pointer to a string Characters in the string are printed until a null character is detected or until the number of characters indicated by the precision is exhausted The argument is assumed to be a pointer to a void and the value of the pointer is printed as a hexadecimal number The argument is assumed to be pointer to an integer into which is written the number of characters written by this call so far A character is written Below is a table of modifiers that can precede a conversion specifier If a modifier appears with any conversion specifier not listed the behavior is undefined Modifier Specifier Default Argument Type Modified Argument Type h d i int short int h O u xX X unsigned int unsigned short h n pointer to int pointer to short int 1 d i int long 1 O U X X unsigned int unsigned long 1 n pointer to int pointer to long int L e E f g G double long double pSOSystem System Calls pREPC System Calls forintf Arguments 1 through n are written by fprintf according to the specifications contained in the format control string Return Value This function returns the number of characters written It returns a negative number if a write error oc
273. errides the default buffer size defined in the pREPC Configuration Table Return Value This function returns a 0 if it succeeds and a negative number if it fails Error Codes Refer to Appendix B Notes Callable From a Task See Also setbuf pSOSystem System Calls 3 137 sprintf pREPC System Calls sprintf Writes formatted output to a buffer include lt stdarg h gt include lt stdio h gt int sprintf char s buffer const char format format control bo arguments 1 through n Description The sprintf function is equivalent to fprintf except that sprintf directs the output to a buffer pointed to by s Arguments s Points to the buffer where output is directed format Points to the format control string For more information see fprintf on page 3 43 Arguments 1 through n are written by sprintf according to the specifications of the format control string Return Value This function returns the number of characters written in the buffer not counting the terminating null character Error Codes None 3 138 pSOSystem System Calls pREPC System Calls Notes Callable From m Task See Also fprintf printf vsprintf pSOSystem System Calls sprintf 3 139 srand pREPC System Calls srand Sets the seed for the random number generator rand include lt stdlib h gt void srand unsigned int seed seed value Description This function wor
274. errupt Control under Target You use the symbolic constants T_USER and T_SUPV on each processor as follows PPC 960 x86 1 4 On PowerPC 960 and x86 processors ASRs execute in supervisor mode only Hence the symbolic constants T_USER and T_SUPV are ignored pSOSystem System Calls pSOS System Calls as_catch Interrupt Control Interrupt control means that while an ASR is executing hardware interrupts are disabled On some processors you can disable all interrupts at or below a certain interrupt level and enable all interrupts above that level On other processors you can simply specify that all interrupts are either enabled or disabled Details are provided below How Signals Are Passed to the ASR The method by which signals are passed to the ASR is processor specific ae On 68K processors signals are passed to the ASR in the DO L register lees On 960 processors signals are passed to the ASR in the GO register es On x86 processors signals are passed to the ASR in the EAX register Xi Return Value This system call always returns 0 Error Codes This system call returns no errors Notes 1 An invalid ASR for example start_addr 0 should not be confused with the ASR attribute T_NOASR If a task s ASR is invalid then an as_send call directed to it will be rejected and returned with an error whereas the T_NOASR attribute simply defers the ASR s executio
275. es Hex 0x5016 0x5017 0x5046 0x5047 0x5048 See Also Mnemonic EINVALID ENFILE ENIDOWN ENMTU ENHWL Description An argument is invalid An internal table has run out of space NI_INIT returned 1 The MTU is invalid The hardware length is invalid Network Interfaces and Configuration Tables pSOSystem Programmer s Reference pSOSystem System Calls 4 5 4 bind pNA System Calls bind Binds an address to a socket include lt pna h gt long bind int s socket descriptor struct sockaddr_in addr socket structure int addrlen structure size Description This system call is used to assign or bind an address a 32 bit internet address and a 16 bit port number to a socket A socket is created without an address and cannot be used to receive data until it is assigned one Raw IP sockets are an exception If they are unbound then they receive all packets regardless of the packet s addresses To simplify address binding a wildcard internet address is supported to free the user from needing to know the local internet address It also makes programs more portable When the internet address is specified as the symbolic constant INADDR_ANY pNA interprets it as any valid address This allows the socket to receive data regardless of its node s internet address For example if a socket is bound to lt INADDR_ANY 10 gt and it resides on a node that is attach
276. es the pREPC library calls the pHILE file system manager When reading or writing I O devices the PREPC library calls the pSOS I O Supervisor directly fopen internally makes a call to the pHILE open_f function when it opens a disk file and the pSOS de_open function when it opens an I O device If the volume is an NFS volume two conditions can cause problems related to the file mode The conditions are as follows a A file that did not previously exist is created in an NFS volume by the fopen call with a UNIX like privilege mode automatically set to 0x180 octal 600 rw for the user If for example the mode in the fopen call is manually specified as w a conflict could result The pREPC library allows only file operations that are valid for the specified mode Therefore using the preceding example the pREPC library does not allow a read operation on the following file fopen 0 0 filel dat w b The restrictions placed on file operations depend on the mode extended to files that exist prior to the fopen call For example fopen 0 0 file2 dat r succeeds if file2 dat exists prior to the fopen call A subsequent read operation would fail if that file had an access mode under NFS that did not allow a user read Currently no method exists under the pREPC library to change the access mode of an NFS file 4 Since the underlying mechanism pHILE and pSOS I O device manager do not as of yet sup
277. es yes E_RO write_vol yes yes E_BADNFS E_RO w pSOSystem System Calls 2 2 4 pHILE System Calls pSOSystem System Calls pHILE System Calls access_f access f Determines the accessibility of a file include lt phile h gt unsigned long access_f char name file pathname int mode file mode to check Volume Types NFS formatted volumes Description access_f checks the named file for accessibility according to mode Arguments name Points to a null terminated pathname of a file to be checked mode Specifies the file mode to check mode is the result of an OR operation performed on the following constants defined in lt phile h gt Hex Mnemonic Description 4 R_OK Test for read permission W_OK Test for write permission 1 X_OK Test for execute search permission 0 F_OK Test for presence of file Return Value This system call returns 0 on success or an error code on failure pSOSystem System Calls 2 5 access f pHILE System Calls Error Codes Hex Mnemonic Description 0x2001 E_FUNC pHILE format volume illegal operation 0x200C E_IFN Illegal pathname 0x200D E_NDD No default directory 0x2025 E_IDN Illegal device name 0x2026 E_BADMS MS DOS volume illegal operation 0x2051 E_MAXLOOP Symbolic links nested too deeply 0x2052 _ EREMO
278. escription System Call s 0x10 ERR_TINYSTK Stack too small t_create 0x11 ERR_PRIOR Priority out of range t_create 0x12 ERR_ACTIVE Task already started t_start 0x13 ERR_NACTIVE Cannot restart this task never t_restart was started 0x14 ERR_SUSP Task already suspended t_suspend 0x15 ERR_NOTSUSP The task was not suspended t_resume 0x16 ERR_SETPRI Cannot change priority new prior t_setpri ity out of range 0x17 ERR_REGNUM Register number out of range t_getreg t_setreg 0x18 ERR_DELFS pHILE resources in use t_delete 0x19 ERR_DELLC pREPC resources in use t_delete OxlA ERR_DELNS pNA resources in use t_delete 0x1B ERR_RNADDR Starting address not on long word rn_create boundary Ox1C ERR_UNITSIZE Illegal unit_size unit size rn_create not power of 2 or less than 16 bytes Ox1D ERR_TINYUNIT length too large for given rn_create unit_size Ox1E ERR_TINYRN Cannot create region length too rn_create small to hold RNCB Ox1F ERR_SEGINUSE Cannot delete one or more seg rn_delete ments still in use 0x20 ERR_ZERO Cannot getseg request size of zero is rn_getseg illegal 0x21 ERR_TOOBIG Cannot getseg request size is too rn_getseg big for region B 8 pSOSystem System Calls Error Codes TABLE B 2 pSOS Error Codes Continued pSOS Error Codes
279. esired should be supported by the user s own layer of software For an application to mount an MS DOS volume the mount flag FC_MSDOS in sys_conf h must be set See Also pcinit_vol mount_vol nfsmount_vol cdmount_vol unmount_vol pSOSystem System Calls 2 89 read_dir pHILE System Calls read_dir Reads directory entries in a file system independent format include lt phile h gt unsigned long read dir XDIR dir a directory handle struct dirent buf user structure to hold returned contents Volume Types All volume types Description read_dir reads one directory entry at a time from a directory file in a file system independent format The directory handle is first obtained with open_dir Arguments dir Points to the handle for the directory file which has been returned by open_dir buf Points to the memory area that receives the data The data returned in buf is a dirent structure defined in lt phile h gt as follows struct dirent unsigned long d_filno char d_name MAXNAMLEN 1 This structure cannot be packed d_fileno contains a number that is unique for each distinct file in the file system and d_name contains a null terminated filename where the size is in the range of 1 through MAXNAMLEN 1 MAXNAMLEN is set to 255 When the last entry has been read an end of file error is returned Return Value This system call returns 0 on success or an error code on f
280. ess than the queue s maximum message length ERR_BUFSIZ is returned to the caller Points to the variable where q_receive stores the actual length of the received message pSOSystem System Calls pSOS System Calls q_vreceive Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description Ox01 ERR_TIMEOUT Timed out this error code is returned only if a timeout was requested 0x05 ERR_OBJDEL Queue has been deleted 0x06 ERR_OBJID qid incorrect failed validity checks 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x30 ERR_KISIZE Message buffer length exceeds max KI packet buffer length 0x32 ERR_BUFSIZ Buffer is too small 0x36 ERR_OKILLD Queue deleted while task waiting 0x37 ERR_NOMSG Queue empty this error code is returned only if Q_ NOWAIT was selected 0x3B ERR_NOTVARO Queue is not variable length 0x54 ERR_NOAGNT Cannot wait the remote node is out of agents 0x65 ERR_STALEID Object s node has failed 0x66 ERR_NDKLD Object s node failed while remote service call RSC waiting Notes 1 Ifit is necessary to block the calling task q_vreceive will enter the calling task in the queue s task wait queue If the queue was created with the O_FIFO attribute then the caller is simply entered at the tail of the wait queue If the pSOSystem System Calls 1 99 q_vreceive pSOS System Calls q
281. et as per the rules above The TTL value may be changed for each socket To set or get the IP TTL value the arg parameter must point to an integer The TTL value must be non negative Operation Description SIOCSIPTTL Sets the IP TTL value of the socket SIOCGIPTTL Gets the IP TTL value of the socket UDP Checksum Operations The following operations may be used to access or modify the UDP checksum computation policy By default UDP checksum is not computed for outgoing UDP packets The arg parameter must point to an integer The integer is set to 1 to enable UDP checksum computation or 0 to disable the computation Operation Description SIOCSUDPCHKSUM Sets the UDP checksum computation flag SIOCGUDPCHKSUM Gets the UDP checksum computation flag MIB II Related Operations The ioct1 call is used to access pNA MIB II objects defined in this subsection Refer to pSOSystem System Concepts for more details on set and get operations The operations described in the remainder of the ioct1 call description are defined by symbolic constants in lt pna_mib h gt pSOSystem System Calls 4 29 ioctl 4 30 pNA System Calls Definitions for Interface Group MIB Variables GET Command Definitions SIOCGIE SIOCGIE SIOCGIE SIOCGIE SIOCGI SIOCGIE SIOCGI SIOCGI SIOCGIE SIOCGI SIOCGIE SIOCGIE SIOCGIE SIOCGIE SIOCGIE SIOCGIE SIOCGIE SIOCGIE SIOCGIE SIOCGIE SIOCGIE SIOCG
282. et is deleted and unless the SO_LINGER socket option is set any data queued at the socket is discarded Refer to the setsockopt pNA call for a discussion of the SO_LINGER option As a special case if the specified socket descriptor is equal to 0 close closes all socket descriptors that have been allocated to the calling task Arguments s Specifies the socket to be closed Return Value This system call returns 0 if successful otherwise it returns 1 Error Codes Hex Mnemonic Description 0x5009 EBADS The socket descriptor is invalid 0x5016 EINVALID An argument is invalid See Also socket setsockopt 4 8 pSOSystem System Calls pNA System Calls connect connect Initiates a connection on a socket include lt pna h gt long connect int s socket descriptor struct sockaddr_in addr socket attributes int addrlen attribute size Description This system call is used to establish an association between a local socket and a foreign socket Generally a stream socket connects only once A datagram socket can use connect multiple times to change its association A datagram socket can dissolve the association by connecting to an invalid address such as the null address INADDR_ANY defined in pna h If a stream socket is specified connect initiates a connection request to the foreign socket The caller is blocked until a connection is established unless the socket is non blocking
283. ete on page 1 139 with the exception that it does not automatically invoke close functions for pSOSystem components other than pREPC see Note If the task cannot be deleted successfully exit suspends the task indefinitely Arguments status Contains the termination status printed by the error message Return Value If the task is successfully deleted the exit macro does not return to its caller If the task cannot be deleted successfully exit suspends the task indefinitely and does not return to its caller unless the task is explicitly resumed by another task in the system Error Codes None Notes If you have pSOSystem components other than pREPC configured in your system you need to edit the definition of exit in stdlib h to uncomment the necessary close functions in the task exit sequence The close functions release any task specific resources held by pSOSystem components 3 28 pSOSystem System Calls pREPC System Calls Callable From a Task See Also abort pSOSystem System Calls exit 3 29 fclose pREPC System Calls fclose Closes a stream include lt stdarg h gt include lt stdio h gt int fclose FILE stream stream pointer Description The fclose function first flushes the buffer associated with the stream pointed to by stream and closes the associated file or I O device Any unwritten buffered data is written to the associated file or
284. eturn value for all unsupported fields is 0 This system call returns 0 on success or an error code on failure Error Codes 2 110 Hex 0x2003 0x200C 0x200D 0x2025 0x2051 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C Mnemonic bi _ BADVOL AXLOOP EREMOTE EIO EACCES ESTALE ENXIO ENODEV Description Inconsistent data on volume volume corrupted Illegal pathname No default directory Illegal device name Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device pSOSystem System Calls pHILE System Calls Hex Mnemonic 0x2070 _EAUTH 0x2071 _ENFS 0x2072 _ETIMEDOUT 0x2074 _ENOAUTHBLK 0x2075 _ECANTSEND 0x2076 _ECANTRECV 0x2077 E_PROBUNAVAIL 0x2078 _EPROGVERSMISMATCH 0x2079 _ECANTDECODEARGS 0x207A __ EUNKNOWNHOST 0x207B __ EPROGNOTREGISTERED Ox207C E_UNKNOWNPROTO 0x207D _EINTR 0x207E ERPC See Also fstat_vfs pSOSystem System Calls stat_vfs Description RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result P
285. ex Mnemonic and Description System Call s Ox65 ERR_STALEID object does not exist any more ev_send pt_getbuf pt_retbuf pt_sgetbuf q_asend q_aurgent q_avsend q_avurgent q_broadcast q_receive q_send q_urgent q_vbroadcast q_vreceive q_vsend q_vurgent sm p sm_v t_getreg t_resume t_setpri t_setreg 0x66 ERR_NDKLD Remote node is no longer in service q_receive q_vreceive sm_p Ox67 ERR_MASTER Cannot terminate master node k_terminate 0x101 ERR_IODN Illegal device major number de_close de_cntrl de_init de_open de_read de_write 0x102 ERR_NODR No driver provided de_close de_cntrl de_init de_open de_read de_writ 0x103 ERR_IOOP Illegal I O function number de_close de_cntrl de_init de_open de_read de_write OxF00 FAT_ALIGN Region 0 must be aligned on a long word boundary This error originates in pSOS initialization OxFO1 FAT_OVSDA Region 0 overflow while making sys tem data area This error originates in pSOS initialization 0xF02 object table FAT_OVOBJT Region 0 overflow while making This error originates in pSOS initialization OxF03 FAT_OVDDAT Region 0 overflow while making de vice data area table This error originates in pSOS initialization B 12 pSOSystem System Calls Error Codes TABLE B 2 pSO
286. examples of ISRs are provided in Restoring CPU Registers Prior to Exiting the ISR under Target Method of Executing an i_return The method of executing an i_return is processor specific ma On PowerPC processors i_return s entry point is located at offset 0x58 from the beginning of the pSOS kernel code It is executed by either a branch b or call bl instruction ps On 960 processors i_return is executed by a calls 13 instruction pSOSystem System Calls 1 35 i_return 1 36 pSOS System Calls On x86 processors i_return is executed by an INT 93H call Restoring CPU Registers Prior to Exiting the ISR The examples below illustrate for each processor how an ISR restores CPU registers before exiting via i_return cr PPC On ColdFire processors an ISR must restore all CPU registers including the stack pointer to their state prior to the interrupt Below is a sample code fragment for an ISR that internally uses CPU registers DO D1 D2 AO and A2 TRAP 12 MOVEM L DO D2 A0 A2 SP lt body of ISR gt MOVEM L SP D0 D2 A0 A2 TRAP 13 On PowerPC processors right before i_return the stack pointer must point to the pSOSystem standard exception frame allocated by the interrupt vector code Registers R29 R31 LR CR SRRO amp SRRI and SRR2 amp SRR3 for PowerPC 403 have been saved into the frame by the vector code The values of registers RO
287. f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f B 32 pSOSystem System Calls Error Codes TABLE B 3 pHILE Error Codes Continued pHILE Error Codes Hex Mnemonic and Description System Call s 0x207D __EINTR Call interrupted access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f Ilstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f 0x207E _ERPC All other RPC errors access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f 0x2200 VF_INSUFF Insufficient working area provided Supply more memory for the data area pointed to by pb_dataptr and increase pb_datalen Refer to page 2 127 verify_vol pSOSystem System Calls B 33 pHILE Error Codes Error Codes TABLE B 3 pHILE Error Codes
288. f write vol FLIST SYS m Attempted to write to a volume mounted with sync_mode set to SM_READ_ONLY 0x2016 E_DIFDEV move_ f across volumes The old move_f and new pathnames specified on a move_f call are not on the same device 0x2017 E_NOTREE move_f would destroy directory move_f tree structure Attempted to move a directory file to a location within its own sub tree If allowed the volume s file system hierarchy would no longer be a tree structure 0x2018 E_OFULL Too many files open for task A task open_dir open_f attempted to open more files than specified by open_fn the pHILE Configuration Table parameter fc_ncfile 0x2019 E_NOFCB Too many files open in system An open_dir open_f open_f attempt will exceed the maximum open_fn number of open files allowed in the system as specified by the pHILE Configuration Table pa rameter fc_nfcb Ox201A E_FIDBIG Invalid FID out of range The FID annex_f close_dir provided on a pHILE call has a value that could close_f fchmod_f not have been returned by an open_ f call fchown_f fstat_f close_dir will return this error code only if fstat_vfs dd_fn in the XDIR has been corrupted ftruncate_f lock_f lseek_f read_f write_f pSOSystem System Calls B 19 pHILE Error Codes TABLE B 3 pHILE Error Codes Continued Error Codes Hex Mnemonic and Description System Call
289. f file descriptors specified when the volume was initialized and maxdepth is the maximum depth of the directory tree it should be equal to pb_maxdepth below For example on a volume with usize 5000 blocks nfd 100 entries maxdepth 5 levels a total of 96 4 5000 16 100 38 5 21886 bytes would be required This work area can be statically allocated or it can be dynamically allocated by a pSOS rn_getseg call The size in bytes of the work area pointed to by pb_dataptr The verify_vol call uses this entry to confirm that the work area is large enough The maximum depth of the volume s directory tree If any branch of the directory exceeds this depth verify_vol terminates and returns an error code to the calling task The minimum value allowed is 1 which indicates a flat directory i e one containing no subdirectories Points to a fault descriptor block FDB in the caller s memory area When a fault is detected verify_vol places a detailed description of the fault into the FDB The FDB format is described on page 2 132 Points to the user provided faultp procedure that is called each time verify_vol detects a fault faultp is responsible for processing the fault Refer to faultpQ on page 2 131 for more details 2 127 verify_vol pHILE System Calls pb_badblkptr Points to a user provided list of bad blocks on the Target volume A bad block is a block that cannot
290. f the following bits S_IFMT S_IFIFO S_IFCHR S_IFDIR S_IRGRP S_IWGRP S_IXGRP S_IROTH S_IWOTH S_IXOTH Return Value 2 62 0170000 0010000 0020000 0040000 0060000 0100000 0120000 0140000 0004000 0002000 0001000 0000400 0000200 0000100 0000040 0000020 0000010 0000004 0000002 0000001 type of file fifo special character special directory block special regular file symbolic link socket set user ID on execution set group ID on execution save swapped text even after use read permission owner write permission owner execute search permission owner read permission group write permission group execute search permission group read permission other write permission other execute search permission other This system call returns 0 on success or an error code on failure pSOSystem System Calls pHILE System Calls Error Codes Hex 0x2001 0x200C 0x200D 0x2025 0x2026 0x2051 0x2052 0x2054 0x2055 0x2058 0x205B 0x2060 0x205C 0x2060 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A pSOSystem System Calls Mnemonic E_FUNC E_IF E_NDD E_ID E_BADMS E_MA
291. f_frsize long f_blocks long f_bfree long f_bavail long f_files long f_ffree long f_favail fsid t ffsid char f_basetype 16 unsigned unsigned long f_flag long f_namemax char f_fstr 32 unsigned unsigned pSOSystem System Calls long f_fstype preferred volume block size fundamental volume block size total number of blocks total number of free blocks free blocks available to non superuser total of file nodes long f_filler 15 reserved pHILE files only reserved not supported reserved not supported reserved not supported reserved not supported reserved not supported reserved not supported reserved not supported file system type number not supported 2 109 stat_vfs Return Value pHILE System Calls This structure cannot be packed Currently the fields f_ffree f_favail f_fsid f_basetype f_flag f_namemax f_fstr and f_filler are reserved and do not have values For all volumes except pHILE format the field f_files is unused The field _fstype identifies the type of file system format The values in lt p FS YPE_PHILE FS PE_PCDO FS Y YPE_CDRO Y FS PE_NFS hile h gt are given below pHILE format volume MS DOS format volume CD ROM format volume Client NFS volume The r
292. failed validity check If an MC_ASYNCERR routine is not provided the pSOS m kernel generates a fatal error pSOSystem System Calls 1 25 ev_asend Notes pSOS System Calls 1 This call is supported only by the pSOS m kernel 2 The events sent to a non waiting task or those that do not match the events being waited for are always left pending 3 Ifthe tid input argument identifies a task residing on the local processor node the calling task may be preempted as a result of this call 4 In a multiple event wait situation the ev_send and ev_receive pair of calls depend greatly on the temporal course of events See Note 2 under ev_receive for an example 5 The pSOS m kernel does not prevent the use of bits reserved for system use However for future compatibility these bits should not be used Multiprocessor Considerations If the tid input argument identifies a global task residing on another processor node then the pSOS m kernel will internally make an RSC to that remote node to send the specified events to that task Callable From m Task See Also 1 26 v_send ev_receiv pSOSystem System Calls pSOS System Calls ev_receive ev_receive Enables a task to wait for an event condition include lt psos h gt unsigned long ev_receive unsigned long events bit encoded events unsigned long flags event processing attributes unsigned long timeout timeout delay unsigned lon
293. failed validity check Ox2B ERR_BUFINUSE Cannot delete one or more buffers still in use 0x53 ERR_ILLRSC Partition not created from this node pSOSystem System Calls 1 51 pt_delete pSOS System Calls Notes Once created a partition is generally used by multiple tasks for data buffers which can be passed around between tasks or even between nodes There is rarely a reason for deleting a partition even when it is no longer used except to allow reuse of memory occupied by the partition Multiprocessor Considerations If ptid identifies a global partition pt_delete notifies the master node so the partition can be removed from its Global Object Table Thus deletion of a global partition always causes activity on the master node Callable From m Task See Also pt_create 1 52 pSOSystem System Calls pSOS System Calls pt_getbuf pt_getbuf Gets a buffer from a partition include lt psos h gt unsigned long pt_getbuf unsigned long ptid partition identifier void bufaddr starting address of buffer Description This system call gets a buffer from a partition If the partition is empty an error is returned Arguments ptid Specifies the partition identifier bufaddr Points to the variable where pt_getbuf stores the starting address of the allocated buffer Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_O
294. fier associated with the file Defines how to reposition L_ptr and must have one of the following values Value Meaning 0 Offset from beginning of file 1 Offset from current L_ptr 2 Offset from end of file Specifies the number of bytes to move L_ptr A negative offset moves L_ptr backwards Points to the variable where lseek_f stores the previous value of the L_ptr pSOSystem System Calls pHILE System Calls Return Value Iseek _f This system call returns 0 on success or an error code on failure Error Codes Hex 0x200A Ox201A 0x201B 0x201E 0x201F 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B pSOSystem System Calls Mnemonic E_DMOUNT FIDBIG FIDOFE E_BADPOS EREMOTE ETIMEDOUT E _ ECANTSEND E _ ECANTRECV Pp p PROBUNAVA EPROGVERS ENOAUTHBLK IL ECANTDECO DEARGS EUNKNOWNHOST ISMATCH EPROGNOTR EGISTE Description Volume not mounted Invalid FID exceeds maximum Invalid FID file closed Illegal position parameter Seek past end of file Too many levels of remote in path A hard error happened at remote site Task does not have access permissions Stale NFS file handle No such device or address
295. g events_r events received Description This service call enables a task to wait for an event condition The event condition is a set of user defined events and an ANY ALL waiting condition qualifier Each task can wait on 32 events which are bit encoded in a long word An ALL condition occurs when all of the specified events are received An ANY condition occurs when one or more of the specified events is received If the selected event condition is satisfied by events already pending ev_receive clears those events and returns Otherwise ev_receive can return immediately with an error wait until the requisite events have been received or wait until a timeout occurs depending on the flags argument If successful ev_receive returns the actual events captured by the call in the location pointed to by events_r Arguments events Specifies the set of events An events argument equal to 0 is a special case where ev_receive returns the pending events but leaves them pending In this case the other parameters are ignored flags Specifies the event processing attributes flags is formed by OR ing the following symbolic constants one from each pair which are defined in lt psos h gt For instance to specify that ev_receive blocks until all events are satisfied you place EV_WAIT and EV_ALL in flags using the following syntax EV_WAIT EV_ALL To specify that ev_receive blocks until at l
296. g hardware interrupts are disabled On some processors you can disable all interrupts at or below a certain interrupt level and enable all interrupts above that level On other processors you can simply specify that all interrupts are either enabled or disabled Details are provided below On PowerPC x86 MIPS and ARM processors you can simply enable or fom disable all hardware interrupts You do this by placing either T_ISR or ee T_NOISR in the mode argument MIPS ARM Return Value 1 160 This system call returns O on success or an error code on failure pSOSystem System Calls pSOS System Calls Error Codes Hex 0x05 0x06 0x07 0x12 0x53 OxOF Notes t start Mnemonic Description ERR_OBUDEL Task already deleted ERR_OBJID tid incorrect failed validity check ERR_OBJTYPE Object type doesn t match object ID failed validity check ERR_ACTIVE Task already started ERR_ILLRSC Task not created from this node ERR_NOSTK Task started in user mode with no user mode stack 1 Once started the task can compete for the CPU and all other system resources Thus it can preempt the calling task if it has a higher priority 2 t_start calls the optional user supplied callout procedure whose address is defined by entry kc_startco in the pSOS Configuration Table Multiprocessor Considerations None A task can only be started from the local node only Callable From a
297. ge 4 44 recv Receives data from a socket 4 45 recvfrom Receives data from a socket 4 48 recvmsg Receives data from a socket 4 51 select Checks the status of multiple sockets 4 54 send Sends data to a socket 4 57 sendmsg Sends data to a socket 4 60 A 26 pSOSystem System Calls Tables of System Calls pRPC System Calls TABLE A 5 pNA System Calls Continued Name Description Page sendto Sends data to a socket 4 62 set_id Sets a task s user ID and group ID 4 65 setsockopt Sets options on a socket 4 66 shr_socket Obtains a new socket descriptor for an existing socket 4 73 shutdown Terminates all or part of a full duplex connection 4 74 socket Creates a socket 4 76 A 6 pRPC System Calls Table A 6 provides an alphabetical listing of the pRPC system calls described in this manual a summary description for each call and a reference to more details about the call TABLE A 6 pRPC System Calls Name Description Page get_fdset Returns the bit mask that corresponds to readable RPC 5 5 sockets rpc_getcreateerr Returns the reason for an RPC client handle creation 5 6 failure pSOSystem System Calls A 27 pROBE and ESp System Calls Tables of System Calls A 7 pROBE and ESp System Calls Table A 7 provides an alphabetical listing of the system calls supported by pROBE and ESp Each call listing includes the call name the tool name a summary de
298. gion 0 Notes 1 92 1 Internally the pSOS kernel treats a queue name as a 32 bit integer However when the application calls the kernel through the pSOS C language API it passes the queue name as a four byte character array 2 The pSOS kernel does not check for duplicate queue names If duplicate names exist an q_vident can return the qid of any queue with the duplicate name 3 The maximum number of queues that can be simultaneously active is defined by the entry kc_nqcb in the pSOS Configuration Table It applies to the combined total of both fixed and variable queues 4 The Q_GLOBAL attribute is ignored by the single processor version of the pSOS kernel 5 A special case occurs when maxnum is set to 0 In this case a message can only be successfully sent if a task is already waiting at the queue pSOSystem System Calls pSOS System Calls q_vcreate 6 A special case occurs when maxlen is set to O In this case the queue behaves much like a counting semaphore No memory is allocated by the queue when either maxlen or maxnum is set to 0 The amount of Region 0 memory needed by the queue is given by the formula in the section of this manual called Memory Usage q_vcreate creates a variable length message queue Use q_create to create an ordinary queue Multiprocessor Considerations 1 The Q_GLOBAL attribute should be set only if the queue must be made known to other processor nodes in a multip
299. guments nptr Points to the string to be converted Return Value This function returns the converted value In the event of an error errno is set to indicate the condition Error Codes Refer to Appendix B Notes The pREPC library returns double values including floating point in the CPU register pair designated by the compiler to receive a return value of type double from a function call when a hardware floating point is not selected Please refer to your compiler manual for the register pair Additionally if the FPU bit is set in the processor type entry of the Node Configuration Table the pREPC library also pSOSystem System Calls 3 9 atof pREPC System Calls places the floating point value in the floating point register designated by the compiler to receive a return value of type double when a hardware floating point is selected Callable From m Task See Also strtod 3 10 pSOSystem System Calls pREPC System Calls atoi atoi Converts a string to an integer include lt stdlib h gt int atoi const char nptr string Description The atoi function converts the initial part of the string pointed to by nptr to an int representation Leading white spaces are ignored The conversion terminates when a nondigit character is detected If the first nonwhite space character is not a digit a value of O is returned Except for the behavior on error this call is equivalent to int strtol
300. h gt For instance to specify that the queue is globally addressable you place 0_GLOBAL in flags To specify that the queue is globally addressable and that tasks are queued by FIFO you place Q_GLOBAL and Q_FIFO in flags using the following syntax Q_ GLOBAL Q FIFO Q_GLOBAL Queue is globally addressable by other nodes Q_ LOCAL queue is addressable only by the local node Q PRIOR Tasks are queued by priority FIFO Q FIFO maxnum Specifies the maximum number of messages that can be pending at one time at the queue maxlen Specifies the maximum message size in bytes pSOSystem System Calls 1 91 q_vcreate pSOS System Calls qid Points to the variable where q_vcreate stores the queue s pSOS assigned queue ID Queues created by q_vcreate always have a fixed number of private buffers The pSOS kernel uses maxnum and maxlen to allocate sufficient memory for message storage from region 0 If insufficient memory is available an error is returned Queues created with q_vcreate never allocate or use message buffers from the pSOS message buffer pool Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x08 ERR_OBJTFULL Node s object table full 0x30 ERR_KISIZE Global queue maxlen too large for KI 0x33 ERR_NOQCB Cannot allocate QCB exceeds node s maximum number of active queues 0x34 ERR_NOMGB Not enough memory in re
301. he calling task q_receive will enter the calling task at the message queue s task wait queue If the queue was created with the Q_FIFO attribute then the caller is simply entered at the tail of the wait queue If the queue was created with the Q_PRIOR attribute then the task will be inserted into the wait queue by priority 2 q_receive requests a message from an ordinary message queue Use q_vreceive to request a message from a variable length message queue Multiprocessor Considerations If gid identifies a global queue residing on another processor node the local kernel will internally make an RSC to that remote node to request a message from that queue If the Q_WAIT attribute is elected then the pSOS m kernel on the target node must use an agent to wait for the message An agent is an internal object created by pSOS to simulate a task on a remote node If the node is temporarily 1 82 pSOSystem System Calls pSOS System Calls q_receive out of agents the call will fail The number of agents on each node is defined by the mc_nagent entry in the Multiprocessor Configuration Table Callable From a Task m ISR if Q_NOWAIT is set and the target queue is local to the node from which the q_receive call is made m KI if Q_NOWAIT is set and the target queue is local to the node from which the q_receive call is made m Callout if Q_NOWAIT is set and the target queue is local to the node from which the q_receive call is made
302. he number of bytes needed to represent the multibyte character corresponding to the code whose value is wchar including any change in shift state It stores the multibyte character representation in the array object pointed to by s if s is not a null pointer At most MB_CUR_MAX characters are stored If the value of wchar is zero the wctomb function is left in its initial state Arguments s Points to the array where wctomb stores the converted character wchar Points to the character to be converted Return Value If s is a null pointer this function returns a nonzero or zero value if multibyte character encodings respectively do or do not have state dependent encodings If s is not a null pointer this function returns 1 if the value of wchar does not correspond to a valid multibyte character or returns the number of bytes that are contained in the multibyte character corresponding to the value of wchar In no case will the value returned be greater than the value of the MB_CUR_MAX macro Error Codes None pSOSystem System Calls 3 191 wctomb Notes Callable From a Task ISR See Also mbtowc wcstombs mbstowcs 3 192 pREPC System Calls pSOSystem System Calls pNA System Calls This chapter provides detailed information on each system call in the pNA component of pSOSystem The calls are listed alphabetically with a mu
303. he pSOS kernel dispatches and do not run at the clock interrupt level This improves deterministic system interrupt response 2 The system accumulates announced ticks when necessary so no chance exists for an overrun or missed tick Typically the accumulation never counts past 1 However if a system contains one or more lengthy ISRs that respond to high frequency interrupt sources they can monopolize the CPU enough to prevent the pSOS kernel from processing a tick before the next one arrives In such rare cases the pSOS kernel accumulates the ticks for subsequent accounting Multiprocessor Considerations None This call can only be directed at the local processor node pSOSystem System Calls pSOS System Calls tm_tick Callable From m Task m ISR m KI m Callout See Also tm_get tm_ set pSOSystem System Calls 1 179 tm_wkafter pSOS System Calls tm_wkafter Blocks the calling task and wakes it after a specified interval include lt psos h gt unsigned long tm_wkafter unsigned long ticks clock ticks Description This system call enables the calling task to block unconditionally for a specified interval This call resembles self suspension t_suspend 0 except that tm_wkafter schedules an automatic resumption after the specified time interval has lapsed The interval is in system clock ticks For example if the system clock frequency is 60 ticks per second and the caller requires a pause of 20
304. he queue s name and qid are sent to the master node for entry in its Global Object Table If the Q_GLOBAL attribute is set and the number of global objects currently exported by the node equals the Multiprocessor Configuration Table entry mc_nglbobj then the queue is not created and ERR_OBJTFULL is returned Callable From See Also Task q_ident q delete q_vcreate 1 76 pSOSystem System Calls pSOS System Calls q_delete q_delete Deletes an ordinary message queue include lt psos h gt unsigned long q delete unsigned long qid queue identifier Description This system call deletes the ordinary message queue with the specified queue ID and frees the QCB q_delete takes care of cleaning up the queue If there are tasks waiting they will be unblocked and given an error code If some messages are queued there the message buffers along with any free private buffers are returned to the system wide pool The calling task does not have to be the creator of the queue in order to be deleted However a queue must be deleted from the node on which it was created Arguments qid Specifies the queue ID of the queue to delete Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Queue has been deleted 0x06 ERR_OBJID gid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object
305. he reason for a creation failure Application programs do not require access to this variable the standard routines clnt_pcreateerror and clnt_spcreateerr return a textual description of the failure Return Value None Error Codes None See Also The clnt_pcreateerror and clnt_spcreateerror descriptions in other ONC RPC documentation 5 6 pSOSystem System Calls pROBE and ESp System Calls This chapter provides detailed descriptions of the system calls supported by PROBE and ESp The calls are listed alphabetically with a multipage section of information for each call Each call s section includes its syntax a detailed description its arguments and its return value The ESp cross system visual analyzer graphically displays your embedded application s activity on a host terminal and allows you to analyze the application s performance ESp accepts one system call log_event through its target resident application monitor pMONT pROBE is pSOSystem s target debugger and analyzer prOBE accepts two system calls db_input and db_output If you need to look up a system call by its functionality refer to Appendix A Tables of System Calls which lists the calls alphabetically by component and provides a brief description of each call For more information on error codes refer to Appendix B Error Codes
306. hich is currently ignored Return Value This system call returns 0 if successful otherwise it returns 1 Error Codes None See Also set_id 4 12 pSOSystem System Calls pNA System Calls getpeername getpeername Gets the address of a connected peer include lt pna h gt long getpeername int s socket descriptor struct sockaddr_in addr socket attributes int addrlen socket structure size Description The getpeername call obtains the address of the peer connected to the specified socket The peer is the socket at the other end of the connection Arguments Ss Specifies the original socket addr Points to a sockaddr_in structure in which getpeername stores the address of the peer socket The structure sockaddr_in is defined as follows struct sockaddr_in short sin family must be AF_INET unsigned short sin_port 16 bit port number struct in_addr sin_addr 32 bit IP address char sin_zero 8 must be 0 This structure cannot be packed addrlen Points to an integer equal to 16 which is the size in bytes of the sockaddr_in structure Return Value This system call returns 0 if successful otherwise it returns 1 pSOSystem System Calls 4 13 getpeername pNA System Calls Error Codes Hex Mnemonic Description 0x5009 EBADS The socket descriptor is invalid 0x5037 ENOBUFS An internal buffer is required but cannot be allocated 0x5039 ENOTCONN Th
307. idity check pSOSystem System Calls 1 65 q_avsend Notes 1 66 pSOS System Calls Hex Mnemonic Description 0x31 ERR_MSGSIZ Message too large 0x35 ERR_QFULL Message queue at length limit 0x3B ERR_NOTVARO Queue is not variable length 0x65 ERR_STALEID Object s node has failed If an MC_ASYNCERR routine is not provided the pSOS m kernel generates a fatal error This call is supported only by the pSOS m kernel The calling task can be preempted as a result of this call The pSOS m kernel must copy the message into a queue buffer or the receiving task s buffer Longer messages take longer to copy Users should account for the copy time in their designs q_avsend asynchronously sends a message to a variable length message queue Use q_asend to send a message asynchronously to an ordinary message queue Multiprocessor Considerations 1 If qid identifies a global queue residing on another processor node then the pSOS m kernel will internally make an RSC to that remote node to post the input message to that queue If a task awakened by this call does not reside on the local node the local kernel will internally pass the message to the task s node of residence whose pSOS m kernel will ready the task and give it the relayed message Thus a q_avsend call whether it is on the local or a remote queue may cause pSOS m activities on another processor node pSOSystem System Calls pSOS Sys
308. ied c Specifies the value to be copied n Specifies the number of characters in the object to be initialized Return Value The function returns the value of s Error Codes None Notes Callable From m Task a ISR 3 110 pSOSystem System Calls pREPC System Calls mktime mktime Converts the broken down time into calendar time include lt time h gt time_t mktime struct tm timeptr Description broken down time The mkt ime function converts the broken down time expressed as local time in the structure pointed to by timeptr into calendar time with the same encoding as the time function This function is primarily used to initialize the system time The elements tm_wday and tm_yday are set by the function so they need not be defined prior to the call The original values of the other components are not restricted to the normal ranges see below Upon successful completion the values of tm_wday and tm_yday are set appropriately and the other components are set to represent the specified calendar time but with their values forced to the normal ranges the final value of tm_mday is not set until tm_mon and tm_year are determined Arguments timeptr Points to a structure of type tm that stores the broken down time The tm structure is defined as follows The semantics of the members and their normal ranges are expressed in the comments struct int int int int int int int int int
309. if successful otherwise it returns 1 Error Codes Hex Mnemonic Description 0x5009 EBADS The socket descriptor is invalid 0x5017 ENFILE An internal table has run out of space 0x504B ETID The task ID is not valid pSOSystem System Calls 4 73 shutdown pNA System Calls shutdown Terminates all or part of a full duplex connection include lt pna h gt long shutdown int s socket descriptor int how shutdown mechanism Description This system call is used to terminate all or part of a full duplex connection on a specified socket The socket may be shut down for sending receiving or both Arguments s Specifies the socket to be shut down how Specifies the shutdown mechanism Three options are available as follows 0 No further receives are allowed on the socket 1 No further sends are allowed on the socket 2 No further sends or receives are allowed on the socket Return Value This system call returns 0 if successful otherwise it returns 1 4 74 pSOSystem System Calls pNA System Calls Error Codes Hex 0x5009 0x5016 0x5039 See Also connect pSOSystem System Calls Mnemonic EBADS EINVALID ENOTCONN socket shutdown Description The socket descriptor is not valid An argument is not valid The socket is not connected 4 75 socket pNA System Calls socket Creates a socket include lt pna h gt int socket int domain socket doma
310. ile identifier abstract file identifier bibliographic identifier volume create date pSOS format volume create time pSOS format modification time pSOS format expiration date pSOS format expiration time pSOS format effective date pSOS format file structure version application private 2 81 open_f pHILE System Calls See Also open_fn close_f 2 82 pSOSystem System Calls pHILE System Calls open_fn open_fn Opens a file by its file identifier include lt phile h gt unsigned long open_fn unsigned long fid file identifier char device volume name unsigned long fn file number unsigned long mode unused set to 0 Volume Types pHILE MS DOS and CD ROM formatted volumes Description open_fn functions identically to open_f except that open_fn opens a file associated with a specified file number The file number is first obtained with get_fn open_fn is more efficient than open_f when a particular file is frequently opened since open_fn skips pathname parsing and directory searching Arguments fid device fn mode Return Value Points to the variable where open_fn stores the file identifier Points to the null terminated name of the volume containing the file The file number of the file Reserved for future use should be set to 0 for future compatibility This system call returns 0 on
311. ilities are chmod_f chown_f m File name exceeds 12 characters create_f get_fn link_f lstat_f m Illegal character in a filename ae ra make_dir move_f m Illegal first character in a filename open_dir open_f Incorrect pathname syntax open_fn read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f 0x200D E_NDD No default directory A relative path access_f change_dir name has been entered but the calling task has never done a change_dir call chmod_f chown_f create_f get_fn link_f lstat_f make_dir move_f open_dir open_f open_fn read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f pSOSystem System Calls B 17 pHILE Error Codes TABLE B 3 pHILE Error Codes Continued Error Codes Hex Mnemonic and Description System Call s 0x200E E_FORD Directory file expected An ordinary file change_dir was specified where a directory file was re create_f get_fn quired Either of the following are possible make dir move_f m A file in a pathname except the last file is open_f remove_f not a directory file m The filename specified on a change_dir is not a directory file 0x200F _ASIZE Illegal Expansion Unit An expansion create_f unit of zero is illegal 0x2010 _NODE Null pathname A p
312. ility however avoid using these reserved registers Multiprocessor Considerations If tid identifies a global task residing on another processor node the local kernel internally makes an RSC to that remote node to set the register for the task Callable From m Task m ISR if the task is local to the node from which the t_setreg call is made m KI if the task is local to the node from which the t_setreg call is made m Callout if the task is local to the node from which the t_set reg call is made See Also t_getreg pSOSystem System Calls 1 157 t start pSOS System Calls t start Starts a task include lt psos h gt unsigned long t_start unsigned long tid task identifier unsigned long mode initial task attributes void start_addr task address unsigned long targs 4 startup task arguments Description This system call places a newly created task into the ready state to await scheduling for execution The calling task does not have to be the creator or parent of the task to be started However a task must be started from the node on which it was created Arguments tid Specifies the task to start tid is returned by the t_create and t_ident calls mode Specifies the initial task attributes mode is formed by ORing the following symbolic constants one from each pair which are defined in lt psos h gt For instance to specify that a task should have
313. in int type socket type carrier int protocol socket protocol class Description The socket system call creates a new socket and returns its socket descriptor The socket is an endpoint of communication Arguments domain Specifies the socket domain and must be set to AF_INET type Specifies one of the following types of sockets defined in the lt pna h gt file SOCK_STREAM Defines a stream socket which uses TCP to provide a reliable connection based communi cation service SOCK_DGRAM Defines a datagram socket which uses UDP to provide a datagram service SOCK_RAW Defines a raw socket which uses the protocol specified by protocol for a raw datagram ser vice protocol Specifies the network protocol and can be 0 TCP UDP or any other protocol For raw sockets the protocol can have any value except TCP or UDP A protocol number of zero acts as a wildcard for raw sockets accepting any raw IP packet Return Value This system call returns a socket descriptor or a 1 if an error occurs 4 76 pSOSystem System Calls pNA System Calls Error Codes Hex 0x5016 0x5017 0x5029 0x502C 0x5037 See Also accept Mnemonic EINVA ID ENF ILE EPRO EPRO ENOBU bind pSOSystem System Calls OTYPE E ONOS FS UPPORT close connect socket Description An argument is invalid An internal table has run out of space Wrong protocol type
314. in the pRPC component of pSOSystem Chapter 6 pROBE and ESp System Calls provides detailed information on the system calls supported by the pROBE target debugger analyzer and the ESp cross system visual analyzer Appendix A Tables of System Calls provides a short description of each pSOSys tem system call with a reference to the pages that contain detailed information on the call Appendix B Error Codes provides a listing of all error codes returned by pSOSys tem system calls Conventions This section describes the conventions used in this manual Font Conventions viii Fonts other than the standard text default font are used as follows Courier Courier is used for command and function names file names directory paths environment variables messages and other system output code and program examples system calls and syntax examples bold Courier User input anything you are expected to type in is set in bold Courier pSOSystem System Calls Using This Manual Conventions italic Italic is used in conjunction with the default font for emphasis first instances of terms defined in the glossary and publica tion titles Bold Helvetica narrow Buttons fields and icons in a graphical user interface are set in bold Helvetica narrow type Keyboard keys are also set in this type Symbol Conventions This section describes symbol conventions used in this document Brackets indicate that th
315. ints to the variable where tm_get stores the date date is encoded as follows Field Bits Year A D 31 16 Month 1 12 15 8 Day 1 31 7 0 time Points to the variable where tm_get stores the time time is encoded as follows Field Bits Hour 0 23 31 16 Minute 0 59 15 8 Second 0 59 7 0 ticks Points to the variable where tm_get stores the number of ticks from the last second of the t ime argument Return Value This system call returns 0 on success or an error code on failure pSOSystem System Calls 1 173 tm_get pSOS System Calls Error Codes Hex Mnemonic Description Ox47 ERR_NOTIME System date and time not set Notes 1 The accuracy of the returned date and time depends on the precision of tm_tick activity and the moment that the most recent tm_set call occurred 2 The algorithm for this call accounts for leap years Multiprocessor Considerations None This call can only be directed at the local processor node Callable From m Task m ISR a KI m Callout See Also tm_set tm_tick 1 174 pSOSystem System Calls pSOS System Calls tm_set Sets or resets the system s version of the date and time tm_set include lt psos h gt unsigned long tm_set unsigned long date year month day unsigned long time hour minute second unsigned long ticks clock ticks Description This service call enables a task either to set or reset the system s version of the date and time
316. ion is not available Portmap failure on the host NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered 2 97 read_link pHILE System Calls Contents of symbolic link Room available in contents Null terminate the result Hex Mnemonic Description 0x207C E_UNKNOWNPROTO Unknown protocol 0x207D E_EINTR Call interrupted 0x207E ERPC All other RPC errors Usage The following example is a typical call to read_link with all the code necessary for full error checking define MAX_RESULT 100 Use 1 more than the longest expected result char contents MAX_RESULT 1 unsigned long size Size of contents size MAX_RESULT if read_link 3 2 sym link amp contents 0 size 0 Error processing for failed system call contents size 0 Pia if size MAX_RESULT Possible partial result Error processing for possible partial result See Also lstat_f symlink_f 2 98 pSOSystem System Calls pHILE System Calls read_vo read_vol Reads directly from a pHILE formatted volume include lt phile h gt unsigned long read_vol char device unsigned long block unsigned long index unsigned long bcount void buffer Volum
317. ion mode SM_DELAYED_WRITE Delay write synchronization mode SM_READ_ONLY Read only synchronization mode Return Value This system call returns 0 on success or an error code on failure 2 88 pSOSystem System Calls pHILE System Calls pcmount_vol Error Codes Mnemonic Description 0x2003 E_BADVOL Inconsistent data on volume volume corrupted 0x2006 E_MNTFULL Attempted to mount too many volumes 0x2007 E_VALIE Wrong volume format 0x2008 E_MNTED Volume is already mounted 0x2021 E_ILLDEV Illegal device exceeded maximum 0x2024 E_FMODE Illegal synchronization mode 0x2025 E_ID Illegal device name 0x2029 E_NMSVOL Cannot mount MS DOS volume 0x2051 E_MAXLOOP Symbolic links nested too deeply Notes pcmount_vol proceeds as if the designated pSOS device is mountable A device is mountable if it has been initialized by pcinit_vol or by the MS DOS FORMAT command The number of volumes that can be mounted simultaneously in the system cannot exceed the pHILE Configuration Table parameter fc_nmount from sys_conf h The pHILE file system manager does not attempt verification or any other way of determining volume ownership Any task can perform a pcmount_vol A mounted device does not retain a record of the task that mounted it Therefore a volume is not automatically unmounted when the task that mounted it is deleted This and any other security measures if d
318. ions SIOCGIPNETTOMEDIAIF INDEX Network Interface number of the NI for which the entry is valid SIOCGIPNETTOMEDIAPHYSADDRESS Physical address of this entry SIOCGIPNETTOMEDIANETADDRESS IP address of this entry SIOCGIPNETTOMEDIATYPE Type of this entry SET Command Definitions SIOCSIPNETTOMEDIAPHYSADDRESS Physical address of this entry SIOCSIPNETTOMEDIANETADDRESS IP address of this entry SIOCSIPNETTOMEDIATYPE Type of this entry pSOSystem System Calls 4 33 ioctl 4 34 pNA System Calls Definitions for ICMP Group MIB Variables GET Command Definitions SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC SIOCGIC PINMSGS PINERRORS PINDESTUNREACHS PINTIMEEXCDS PINPARAMPROBS PINSRCQUENCHS PINREDIRECTS PINECHOS PINECHOREPS PINTIMESTAMPS PINTIMESTAMPREPS PINADDRMASKS PINADDRMASKREPS POUTMSGS POUTERRORS POUTDESTUNREACHS POUTTIMEEXCDS POUTPARAMPROBS POUTSRCQUENCHS POUTREDIRECTS POUTECHOS POUTECHOREPS ICMP messages received ICMP messages with format errors ICMP Destination Unreachable messages rec
319. iption NFS call timed out No RPC authorization blocks are available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors 1 The major device number of the volume name can exceed the maximum allowed device number in the pSOS Configuration Table because the device is virtual A virtual device does not correspond to any device driver 2 The number of volumes that can be mounted simultaneously in the system cannot exceed the pHILE Configuration Table parameter fc_nmount See Also mount_vol pSOSystem System Calls pemount_vol cdmount_vol unmount_vol 2 75 open_dir pHILE System Calls open_dir Opens a directory file include lt phile h gt unsigned long open_dir char dirname name of the directory file XDIR dir pointer to buffer to return directory handle Volume Types All volume types Description open_dir opens a designated directory file Arguments dirname Points to a null terminated pathname of a directory file dir Points to an XDIR structure which is defined in lt phile h gt Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2003 E_BADVOL Inconsistent data on volume volume corrupted 0x2
320. is the wrong type i e mounting an MS DOS volume with mount_vol or it has not been formatted by the pHILE file system manager cdmount_vol mount_vol pemount_vol verify_vol 0x2008 E_MNTED Volume already mounted This error condition implies one of the following m An attempt was made to mount a device that is already mounted m An attempt was made to initialize a mounted volume cdmount_vol init_vol mount_vol nfsmount_vol pcinit_vol pcmount_vol 0x2009 E_MNTOPEN Cannot unmount volume files open An attempt was made to unmount a vol ume when one or more of its files are still open AII files must be closed before a volume can be unmounted unmount_vol verify_vol B 16 pSOSystem System Calls Error Codes TABLE B 3 pHILE Error Codes Continued pHILE Error Codes Hex Mnemonic and Description System Call s 0x200A E_DMOUNT Volume not mounted Attempted to change_dir reference an unmounted volume create_f get_fn lseek_f make_dir move_f open_f open_fn read_vol remove_f sync_vol unmount_vol verify_vol write_vol 0x200B E_FNAME Filename not found One or more of change_dir the filenames specified in a pathname cannot be create_f get_fn located make_ dir move_f open_f remove_f 0x200C E_IFN Illegal pathname The pathname as access_f change_dir specified is illegal Possib
321. it from an interrupt service routine This call accepts no parameters and cannot be called from a high level language Description Target This pSOS service entry provides and establishes a standard exit convention for all Interrupt Service Routines ISRs It is available for all processors supported by pSOSystem For efficiency reasons i_return is different from other system calls in that it uses a separate private entry into the pSOS kernel The method of executing an i_return depends on the processor and is explained in Method of Executing an i_return under Target The i_return call is used to integrate ISR level processing within pSOS The i_return call detects when all nested ISRs have exited and control is about to be passed back to task level execution At this transition point it assesses any task execution state changes that may have taken place during ISR processing and then passes control to the appropriate task Any ISR that makes system calls that may affect the ready state of a task must conclude with an i_return system call For those processors which supply an i_enter call i_return should precede the pSOS service calls Any ISR which contains an i_enter must conclude with an i_return i_return does not accept any input parameters and it never returns to the caller Before it exits an ISR must restore CPU registers to their state prior to the interrupt Processor specific code
322. ken down 3 72 time gmtime_r pREPC Reentrant Converts the calendar time to 3 73 broken down time init_vol pHILE Initializes a pHILE formatted volume 2 49 ioctl pNA Performs control operations on a socket 4 22 isalnum pREPC Tests for an alphanumeric character 3 75 isalpha pREPC Tests for an alphabetic character 3 76 iscntrl pREPC Tests for a control character 3 77 isdigit pREPC Tests for a digit 3 78 isgraph pREPC Tests for a graphical character 3 79 islower pREPC Tests for a lowercase letter 3 80 isprint pREPC Tests for a printable character 3 81 ispunct pREPC Tests for a punctuation character 3 82 isspace pREPC Tests for a space 3 83 pSOSystem System Calls A 5 All pSOSystem System Calls Tables of System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page isupper pREPC Tests for an uppercase letter 3 84 isxdigit pREPC Tests for a hexadecimal digit 3 85 k_fatal psOS Aborts and enters fatal error handling mode 1 40 k_terminate psOs Terminates a node other than the master 1 42 node labs pREPC Computes the absolute value of a long inte 3 86 ger ldiv pREPC Performs a division operation on two speci 3 87 fied long integers link_f pHILE Creates a hard link between two files on the 2 53 same volume listen pNA Listens for connections on a socket 4 38 localeconv pREPC Obtains the current loca
323. ks in concert with rand The srand function uses seed as a seed for a new sequence of pseudo random numbers to be returned by subsequent calls to rand For a given seed value the sequence of random numbers generated is the same By default a sequence of random numbers is generated using a seed value of 1 Arguments seed Specifies the seed value Return Value This function does not return a value Error Codes Refer to Appendix B Notes Callable From m Task See Also rand 3 140 pSOSystem System Calls pREPC System Calls sscanf sscanf Reads formatted input from a string include lt stdarg h gt include lt stdio h gt int sscanf const char s string const char format format control F arguments 1 through n Description The sscanf function is equivalent to fscanf except that sscanf takes the input from the string pointed to by s Arguments s Points to the string to be read format Points to the format control string For more information see fscanf on page 3 56 Arguments 1 through n point to variables where input is stored Return Value This function returns the number of variable assignments If an error occurs the function returns EOF and sets errno Error Codes Refer to Appendix B pSOSystem System Calls 3 141 sscanf Notes Callable From m Task See Also scanf fscanf 3 142 pREPC System Calls pSOSystem System Calls pRE
324. l pathname 0x200D E_NDD No default directory 2 46 pSOSystem System Calls pHILE System Calls get fn Hex Mnemonic Description 0x200E E_FORD Directory file expected 0x2025 E_IDN Illegal device name 0x2050 E_BADNFS NFS volume illegal operation Usage One usage of get_fn is to get the current directory In the example below the current directory s FN is returned in dir_fn unsigned long dir_fn current directory if get_fn amp dir_fn 0 Insert some error processing here The pseudocode below shows how to get the current directory s full pathname rather than just the FN 1 Get the directory s FN in dir_fn with get_fn as above 2 Open the parent directory with open_dir 3 Search the parent directory for the directory entry of the current directory a Read a directory entry with read_dir b Compare the directory entry s d_filno with the FN of the current directory c Repeat steps a and b until they match d Remember the matching directory entry s d_name It is the last component of the current directory s pathname 4 Close the open directory with close_dir 5 Repeat steps 1 4 for the parent directory of the current directory the grandparent of the current directory etc until reaching the root directory The root directory is reached when either get_fn of the parent directory is an error or get_fn of the parent directory is the sam
325. l s 0x2079 ECANTDE CODEARGS Decode error arguments access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f Ilstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f 0x207A _EUNKNOWNHOST Unknown host name access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f pSOSystem System Calls pHILE Error Codes TABLE B 3 pHILE Error Codes Continued Error Codes Hex Mnemonic and Description System Call s 0x207B EPROGNOTREGISTE R ED Remote program is not registered access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f 0x207C E_UNKNOWNPROTO Unknown protocol access_f change_dir chmod_f chown_
326. lable From ma ASR See Also as_catch as_send 1 8 pSOSystem System Calls pSOS System Calls as_send as_send Sends asynchronous signals to a task include lt psos h gt unsigned long as_send unsigned long tid target task ID unsigned long signals bit encoded signal list Description This system call sends asynchronous signals to a task The purpose of these signals is to force a task to break from its normal flow of execution and execute its Asynchronous Signal Routine ASR Asynchronous signals are like software interrupts with ASRs taking on the role of ISRs Unlike an interrupt which is serviced almost immediately an asynchronous signal does not immediately affect the state of the task An as_send call is serviced only when the task is next dispatched to run and that depends on the state of the task and its priority Each task has 32 signals These signals are encoded bit wise in a single long word Bits 31 through 16 are reserved for internal system use and bits 15 through O are available for user specific purposes Like events signals are neither queued nor counted For example if three identical signals are sent to a task before its ASR has a chance to execute the three signals have the same effect as one Arguments tid Specifies the task to receive the signals signals Contains the bit encoded signals Return Value This system call returns 0 on success or an error code on fail
327. le settings 3 89 localtime pREPC Converts the calendar time to broken down 3 92 time localtime_r pREPC Reentrant Converts the calendar time to 3 93 broken down time lock_f pHILE Locks or unlocks part or all of an open file 2 56 log_event ESp Logs an event on ESp s target resident ap 6 6 plication monitor pMONT lseek_f pHILE Repositions for read or write within an open 2 58 file lstat_f pHILE Gets the status of a symbolically linked file 2 61 m_ext2int psOst Converts an external address into an inter 1 44 nal address m_int2ext psOst Converts an internal address into an exter 1 46 nal address make_dir pHILE Creates a directory file 2 65 A 6 pSOSystem System Calls Tables of System Calls All pSOSystem System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page malloc pREPC Allocates memory 3 95 mblen pREPC Determines the number of bytes in a multi 3 96 byte character mbstowcs pREPC Converts a multibyte character string into a 3 98 wide character string mbtowc pREPC Converts a multibyte character into its wide 3 100 character equivalent memchr pREPC Searches memory for a character 3 102 memcmp pREPC Compares two objects in memory 3 104 memcpy pREPC Copies characters in memory 3 106 memmove pREPC Copies characters in memory 3 108
328. length of the data stored in buf If this is the same as the maximum buffer size only part of the data may have been returned Return Value This system call returns 0 on success or an error code on failure 2 96 pSOSystem System Calls pHILE System Calls Error Codes Hex 0x2001 0x200C 0x200D 0x2025 0x2026 0x2051 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B pSOSystem System Calls Mnemonic E_FUNC E_IFN E_NDD E_IDN E_BADMS E_MAXLO O EREMO TE EIO EACCE _ESTAL ENXIO __ENODE __BADCD t EAUTH ENFS ENOAU I _ETIMEDOUT ECAN SE ND ECAN RE CV t __PROBU AVA EPROGVE RS HBLK IL ISMATCH ECANT DE CO DEARGS __EPROG EUNKNOWNHOST OTR EGISTERE read_link Description pHILE format volume illegal operation Illegal pathname No default directory Illegal device name MS DOS volume illegal operation Symbolic links nested too deeply Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorizat
329. ll other operations relating to the memory region Most system calls except rn_create and rn_ident reference a region by its region ID rn_create returns the region ID to a region s creator For other tasks one way to obtain the region ID is to use rn_ident Arguments name Specifies the user assigned name of the region rnid Points to the variable where rn_ident stores the region ID of the named region Return Value This call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x09 ERR_OBJNF Named region not found pSOSystem System Calls 1 115 rn_ident pSOS System Calls Notes 1 Internally the pSOS kernel treats a region name as a 32 bit integer However when the application calls the kernel through the pSOS C language API it passes the region name as a four byte character array 2 The pSOS kernel does not check for duplicate region names If duplicate names exist an rn_ident call can return the rnid of any region with the duplicate name 3 The region with rnid equal 0 is special This region is statically specified in the pSOS Configuration Table and is used for pSOS data structures and task stacks Multiprocessor Considerations None since regions are strictly local resources Only the local object table is searched Callable From m Task See Also rn_create 1 116 pSOSystem System Calls pSOS System Calls rn_retseg rn_retseg Retu
330. ll unsupported fields is 0 Return Value This system call returns 0 on success or an error code on failure 2 40 pSOSystem System Calls af pHILE System Calls Error Codes Hex 0x201A 0x201B 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E pSOSystem System Calls Mnemonic E E FIDBIG E E _ FIDOFE EIO REMOTE EDOUT ENOAUTHBLK ECAN SEND ECAN RECV PROBUNAVAIL EPROGVERSMISMATCH ECANT DECODEARGS PC EPROGNOTREGISTERE EUNKNOWNHOST UNKNOWNPROTO EINTR fstat_vfs Description Invalid file ID out of range Invalid file ID file not open Too many levels of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device RPC authorization is not available Portmap failure on the host NFS call timed out No RPC authorization blocks available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC er
331. lls strxfrm 3 173 time pREPC System Calls time Obtains the current calendar time include lt time h gt time_t time time t timer buffer Description The time function determines the current calendar time expressed as the number of seconds since midnight January 1 1970 Arguments timer Points to the buffer where t ime can store the current calendar time Return Value The time function returns the implementation s best approximation of the current calendar time The value time_t 1 is returned if the calendar time is not available If timer is not a null pointer the return value is also assigned to the object it points to Error Codes Refer to Appendix B Notes This function invokes the pSOS service call tm_get to obtain the current time Callable From m Task ISR 3 174 pSOSystem System Calls pREPC System Calls time See Also tm_get mktime localtime localtime_r pSOSystem System Calls 3 175 tmpfile pREPC System Calls tm pfile Creates a temporary file include lt stdarg h gt include lt stdio h gt FILE tmpfile void Description The tmpfile function creates a temporary file that is automatically removed when it is closed or when the creating task calls exit Temporary files are opened in mode wb The name of the temporary file created is obtained by generating an internal call to the pREPC function tmpname Return Val
332. lowing symbolic constants one from each pair which are defined in lt psos h gt For instance to specify that the queue is globally addressable you place O0_GLOBAL in flags To specify that the queue is globally addressable and that tasks are queued by FIFO you place Q_GLOBAL and Q_FIFO in flags using the following syntax Q_ GLOBAL Q FIFO pSOSystem System Calls pSOS System Calls qid Return Value Q_GLOBAL Q_LOCAL Q_PRIOR Q_FIFO Q_ LIMIT Q_NOLIMIT Q_PRIBUF Q_SYSBUF q_create Queue is globally addressable by other nodes queue is addressable only by the local node Tasks are queued by priority FIFO Message queue size is limited to count is unlimited Private system buffers are allocated for message storage Points to the variable where q_create stores the queue ID of the named queue This system call returns 0 on success or an error code on failure Error Codes Hex 0x08 0x33 0x34 Notes Mnemonic ERR_NOOCB ERR_NOMGB ERR_OBJTFULL Description Node s object table full Cannot allocate QCB exceeds node s maximum number of active queues Cannot allocate private buffers too few available 1 Internally the pSOS kernel treats a queue name as a 32 bit integer However when the application calls the kernel through the pSOS C language API it passes the queue name as a four byte character array 2 The pSOS kernel does not check for duplicat
333. ls pemount_vol nfsmount_vol cdmount_vol unmount_vol 2 69 move_f pHILE System Calls move f Moves renames a file include lt phile h gt unsigned long move_f char oldname old pathname char newname new pathname Volume Types All volume types except CD ROM however some behavioral differences exist and are described here Description move_f changes the pathname associated with a file With one exception the pHILE file system manager can move both ordinary and directory files on all volume types The exception is directory files on MS DOS formatted volumes which cannot be moved When a directory is moved the directory and all files in the directory s subtree are moved Conceptually move_f moves a file by changing control structures on the volume but no actual movement of data ever occurs Therefore oldname and newname must be on the same volume Arguments oldname Points to the null terminated old pathname newname Points to the null terminated new pathname 2 70 If oldname and newname are in the same directory move_ f simply renames the file Otherwise move_f has the effect of moving the file to a different location within the volume s directory tree move_f does not change the size or contents of the file move_f fails if newname already exists or if the move operation would create a non tree directory organization for example when a directory file is moved t
334. ltipage section of information for each call Each call s section includes its syntax a detailed description its arguments its return value and any error codes that it can return Where applicable the section also includes the headings Notes Usage and See Also Notes contains any important information not specifically related to the call description Usage provides detailed usage information and See Also indicates other calls that have related information Structures described in this chapter are also defined in the file lt pna h gt Structures must be word aligned and must not be packed If you need to look up a system call by its functionality refer to Appendix A Tables of System Calls which lists the calls alphabetically by component and provides a brief description of each call For more information on error codes refer to Appendix B Error Codes which lists the codes numerically and shows which pSOSystem calls are associated with each one 4 1 accept pNA System Calls accept Accepts a connection on a socket include lt pna h gt long accept int s socket descriptor struct sockaddr_in addr socket structure int addrlen socket structure size Description This call is used to accept a connection request that the specified socket receives from a foreign socket Servers use accept with connection oriented or stream TCP sockets
335. lue Points to the variable where t_getreg stores the register s contents Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBUDEL Task has been deleted 0x06 ERR_OBJID tid is incorrect failed validity check pSOSystem System Calls 1 141 t getreg Notes Hex 0x07 0x17 0x65 Mnemon ERR_OI ic BJTYPE ERR_RE GNUM ERR_S TALEID pSOS System Calls Description Object type doesn t match object ID failed validity check Register number is out of range Object s node has failed The kernel does not deny access to those registers reserved for system use For future compatibility however you should not use them Multiprocessor Considerations If the tid identifies a global task residing on another processor node the local kernel will internally make an RSC to that remote node to obtain the register s content for that task Callable From m Task m ISR if the task is local to the node from which the t_getreg call is made m KI if the task is local to the node from which the t_getreg call is made m Callout if the task is local to the node from which the t_get reg call is made See Also 1 142 t_setreg pSOSystem System Calls pSOS System Calls t_ident t_ident Obtains the task identifier of a named task include lt psos h gt unsigned long t_ident
336. m depth exceeded on directory traversal 0x2202 VF_ABORT Verify routine aborted by user verify_vol can be used to perform the following actions Volume Integrity Verification verify_vol examines all volume control structures to verify their consistency Inconsistencies are reported and described in detail Volume Correction Certain kinds of inconsistencies can be corrected Bad Block Elimination Bad blocks can be marked as in use in the volume bitmap thus excluding them from allocation by pHILE file system manager verify_vol can be used in two ways First it can be used to perform a simple test of correctness for example at each power on or system restart Second it can be integrated into a volume repair utility with a user supplied interface Under normal operating conditions pHILE file system manager always maintains the volume control structures in a correct and consistent state verify_vol is most useful when used following a system error or failure that can corrupt the file system such as one of the following m A power failure or a CPU or disk controller crash In such cases pHILE file system manager can be interrupted in the middle of a critical operation resulting in a corrupted file system m A hard error or data corruption in one or more blocks containing volume control structures m Errors in the user supplied physical disk driver m Restarting a task in pHILE file system
337. m is a null pointer the fflush function performs the flushing action on all the streams open for write or update Arguments stream Points to an open pREPC stream Return Value This function returns O if successful or EOF on error If an error occurs errno is set Error Codes Refer to Appendix B Notes 1 If the write is to an I O device fflush calls the pSOS I O call de_write 2 If the write is to a disk file fflush calls the pHILE call write_f Callable From m Task 3 34 pSOSystem System Calls pREPC System Calls fgetc fgetc Gets a character from a stream include lt stdarg h gt include lt stdio h gt int fgetc FILE stream stream pointer Description The fgetc function reads the next character as an unsigned char converted to an int from the input stream pointed to by stream and advances the associated file position indicator for the stream if defined It is operationally equivalent to the getc function Arguments stream Points to an open pREPC stream Return Value This function returns the character that is read from the stream If the end of file condition is detected the stream s end of file indicator is set and EOF is returned If a read error occurs the stream s error indicator is set EOF is returned and errno is set Error Codes Refer to Appendix B Notes Callable From a Task pSOSystem System Calls 3 35 fgetpos pREPC S
338. manager pSOSystem System Calls 2 129 verify_vol pHILE System Calls Requirements and Restrictions 1 verify_vol suspends all other I O transactions to the designated volume Because of the time required to execute it verify_vol should be called when the volume is idle 2 Executing verify_vol requires that the volume is mounted and no files are open 3 verify_vol cannot be used on an MS DOS CD ROM or NFS volume Functional Description On the specified volume verify_vol examines the volume s control structures and searches for faults A fault is any inconsistency in the control structures For example the volume s bitmap may indicate a particular block is free while in fact it is being used In all there are 42 different kinds of faults detectable by verify_vol 2 130 pSOSystem System Calls pHILE System Calls verify_vol verify_vol examines the following volume control structures m Root block a Bitmap m FLIST m All directories m All file indirect blocks m All file index blocks verify_vol stores a detailed description of the detected fault into a user provided fault descriptor block FDB and then calls the user provided function faultp described below faultp faultp is called by verify_vol without any parameters faultp is responsible for additional processing of the fault verify_vol calls faultp with the following information m The type of fault m A detailed de
339. me gmtime_r mktime 3 92 pSOSystem System Calls pREPC System Calls localtime_r localtime_r Reentrant Converts the calendar time to broken down time include lt time h gt struct tm localtime r const time_t timer pointer to calendar time struct tm resultp pointer to result Description localtime_r is the reentrant version of the ANSI function localtime as defined by POSIX 1003 1c It converts the calendar time pointed to by timep into broken down time and stores it in the structure pointed to by resultp The time is represented in local time The calendar time is generally obtained through a call to time Arguments timer Points to the calendar time resultp Points to the tm structure where localtime_r stores the result The tm structure is defined in the mkt ime description on page 3 111 Return Value Upon success localtime_r returns the value of resultp On failure it returns NULL the only cause of failure is if timer points to a negative value Error Codes No error codes are returned pSOSystem System Calls 3 93 localtime_r Notes Callable From m Task ISR See Also localtime time gmtime gmtime_r mktime pREPC System Calls pSOSystem System Calls pREPC System Calls malloc malloc Allocates memory include lt stdlib h gt void malloc size t size element size Description The malloc function allocates memory for an object who
340. me Types pHILE formatted volumes Description verify_vol examines all control structures on a pHILE formatted volume Inconsistencies are reported to a user supplied callout routine which can relay further instructions The callout routine can then request verify_vol to correct the inconsistency Usage instructions for verify_vol are provided in Usage on page 2 129 Arguments device Points to the null terminated name of the volume to be verified params Points to an instance of the verify_vol_params structure defined in lt phile h gt as follows typedef struct verify_vol_params void pb_dataptr work area pointer unsigned long pb_datalen length of work area unsigned long pb_maxdepth maximum depth of directory tree fault_desc_block pb_fdbptr fault descriptor block pointer unsigned long pb_faultp void faultp function unsigned long pb_badblkptr bad block list VERIFY_VOL_PARAMS This structure cannot be packed 2 126 pSOSystem System Calls pHILE System Calls verify_vol The contents of the verify_vol_params fields are as follows pb_dataptr pb_datalen pb_maxdepth pb_fdbptr pb_faultp pSOSystem System Calls Points to a work area required by verify_vol The size of this work area in bytes is given by the formula 96 4 vsize 16 nfd 38 maxdepth where usize is the size of the volume in blocks nfd is the number o
341. me_f utime_f Sets the access and modification times of a file include lt phile h gt unsigned long utime_f char name file pathname struct utimbuf times file access and modification times Volume Types NFS volumes Description utime_f sets the access and modification times of a file Arguments name Points to the null terminated pathname of the file times If times is NULL the access and modification times are set to the current time Otherwise times is interpreted as a pointer to a utimbuf structure defined in lt phile h gt as follows struct utimbuf time_t actime access time time_t modtime modification time This structure cannot be packed No time zone is associated with the time values Return Value This system call returns 0 on success or an error code on failure pSOSystem System Calls 2 123 utime_f Error Codes 2 124 Hex 0x2001 0x200C 0x200D 0x2015 0x2025 0x2026 0x2051 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 Mnemonic E_FUNC E_IFN E_NDD E_RO E_ID E_BADMS E_MAXLOOP E_EREMOTE E_EIO E_EACCES E_ESTALE E_ENXIO E_ENODEV E_BADCD E_EAUTH E_ENFS E_ETIMEDOUT E_ENOAUTHBLK E_ECANTSEND E_ECANTRECV E_PROBUNAVAIL E_PROGVERS
342. memset pREPC Initializes a memory area with a given value 3 110 mkt ime pREPC Converts the broken down time into calen 3 111 dar time mount_vol pHILE Mounts a pHILE formatted volume 2 68 move_f pHILE Moves renames a file 2 70 nfsmount_vol pHILE Mounts a remote file system 2 73 open_dir pHILE Opens a directory file 2 76 open_f pHILE Opens a file 2 78 open_fn pHILE Opens a file by its file identifier 2 83 pcinit_vol pHILE Initializes an MS DOS volume 2 85 pcmount_vol pHILE Mounts an MS DOS volume 2 88 perror pREPC Prints a diagnostic message 3 114 pna_allocb pNA Allocates a message block 4 39 pna_esballoc pNA Attaches a message block to the data buffer 4 41 pna_freeb pNA Frees a message block 4 43 pSOSystem System Calls A 7 All pSOSystem System Calls Tables of System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page pna_freemsg pNA Frees all the message blocks associated with 4 44 a message printf pREPC Prints formatted output to stdout 3 115 pt_create pSOS Creates a memory partition of fixed size 1 48 buffers pt_delete pSOS Deletes a memory partition 1 51 pt_getbuf pSOS Gets a buffer from a partition 1 53 pt_ident pSOS Obtains the identifier of the named parti 1 55 tion pt_retbuf pSOS Returns a buffer to the partition from which 1 57 it came pt_sgetbuf pSOS Gets a buffer fr
343. ments Specifies the value to be tested Return Value This function returns a nonzero value if the test result is true It returns a O if the result is false Error Codes Refer to Appendix B Notes Callable From a Task m ISR See Also isprint pSOSystem System Calls 3 77 isdigit pREP C System Calls isdigit Tests for a digit include lt ctype h gt int isdigit int c character Description This function tests the value in c converted to an unsigned char to see if it is a decimal digit 0 through 9 Arguments c Specifies the value to be tested Return Value This function returns a nonzero value if the test result is true It returns a O if the result is false Error Codes Refer to Appendix B Notes Callable From m Task ISR 3 78 pSOSystem System Calls pREPC System Calls isgraph isgraph Tests for a graphical character include lt ctype h gt int isgraph int c character Description This function tests the value in c converted to an unsigned char to see if it is an ASCII graphical character ASCII graphical characters are those whose values lie from 33 exclamation point through 126 tilde This includes all of the printable characters except the space Arguments c Specifies the value to be tested Return Value This function returns a nonzero value if the test result is true It returns a O if the result is false Error Codes
344. message asynchronously to a variable length message queue Multiprocessor Considerations 1 If qid identifies a global queue residing on another processor node then the pSOS m kernel will internally make an RSC to that remote node to post the input message to that queue 2 If a task awakened by this call does not reside on the local node then the pSOS m kernel will internally pass the message to the task s node of residence whose pSOS m kernel will ready the task and give it the relayed message Thus a q_asend call whether it is on the local or a remote queue may cause pSOS m activities on another processor node Callable From a Task See Also q_send q_vsend q_avsend q_aurgent q receive 1 62 pSOSystem System Calls pS0S System Calls q_aurgent q_aurgent pSOS m kernel only Asynchronously posts a message at the head of a variable length message queue include lt psos h gt unsigned long q_aurgent unsigned long qid queue identifier unsigned long msg_buf 4 message buffer Description This system call functions the same as the q_urgent call except that it executes asynchronously Refer to the description of q_urgent for further information Arguments qid Specifies the queue ID of the target queue msg_buf Specifies the message to send Return Value When called in a system running the pSOSt m kernel this call always returns 0 The pSOS kernel the single processor version return
345. mponents libraries and driv ers Error code values are in hexadecimal notation with a space inserted every byte for readability l TABLE B 1 Error Code Origins Error Code Range Origin Defined in Refer to page From To 00 00 00 01 00 00 OF FF psOS pSOS m lt psos h gt B 4 00 00 10 00 00 00 1F FF reserved 00 00 20 00 00 00 2F FF pHILE lt phile h gt B 15 B 1 TABLE B 1 Error Code Origins Continued Error Codes Error Code Range Origin Defined in Refer to page From To 00 00 30 00 00 00 3F FF PREPC lt errno h gt B 38 00 00 40 00 00 00 4F FF reserved 00 00 50 00 00 00 5F FF pNA pRPC lt pna h gt B 39 00 00 60 00 00 00 6F FF reserved 00 01 00 00 00 FF FF FF reserved 01 10 00 00 Ol 1F FF FF Networking libraries 01 20 00 00 01 20 00 FF MMUlib lt mmulib h gt 01 20 01 00 01 20 O1 FF Loader 01 20 02 00 OO FF FF FF reserved for pSOSystem libraries 10 00 00 00 10 00 00 FF NI_SMEM driver lt drv_intf h gt B 45 10 00 01 00 10 00 O1 FF KI_SMEM driver lt drv_intf h gt B 45 10 00 02 00 10 00 FF FF reserved for drivers 10 01 00 00 10 O1 FF FF serial driver lt drv_intf h gt B 46 10 02 00 00 10 02 FF FF tick timer driver lt drv_intf h gt B 47 10 03 00 00 10 03 FF FF reserved for drivers 10 04 00 00 10 04 FF FF RAM disk driver lt drv_intf h gt B 48 10 05 00 00 10 05 FF F
346. n This system call functions the same as q_send except that it executes asynchronously Refer to the description of q_send for further information For a detailed description of asynchronous services refer to the pSOSystem Systems Concepts manual Arguments qid Specifies the queue ID of the target queue msg_buf Specifies the message to send Return Value When called in a system running the pSOS m kernel this call always returns 0 The pSOS kernel the single processor version returns ERR_SSFN Error Codes Should the call fail if present the node s MC_ASYNCERR routine is invoked and the following error codes may be reported Hex Mnemonic Description 0x05 ERR_OBUDEL Queue has been deleted 0x06 ERR_OBJID qid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x34 ERR_NOMGB Out of system message buffers pSOSystem System Calls 1 61 q_asend pSOS System Calls Hex Mnemonic Description 0x35 ERR_QFULL Message queue at length limit Ox3A ERR_VARO Queue is variable length 0x65 ERR_STALEID Object s node has failed If an MC_ASYNCERR routine is not provided the pSOS m kernel generates a fatal error Notes 1 This call is supported only by the pSOS m kernel 2 The calling task can be preempted as a result of this call 3 q_asend asynchronously sends a message to an ordinary message queue Use q_avsend to send a
347. n with any intervening signals sent to it left pending 2 A normal task would call as_catch only once and usually as part of its initialization sequence Before the first as_catch call a task is initialized by the pSOS kernel to have an invalid ASR pSOSystem System Calls 1 5 as_catch pS0S System Calls Multiprocessor Considerations None The actions performed by as_catch are entirely confined to the local node although asynchronous signals can be sent from remote nodes Callable From m Task See Also as_send as_return 1 6 pSOSystem System Calls pSOS System Calls as_return as_return Returns from an asynchronous signal routine ASR include lt psos h gt unsigned long as_return Description Target This system call must be used by a task s ASR to exit and return to the original flow of execution of the task The purpose of this call is to enable the pSOS kernel to restore the task to its state before the ASR as_return cannot be called except from an ASR This call is analogous to the i_return call which enables an Interrupt Service Routine ISR to return to the interrupted flow of execution properly Restoring CPU Registers An ASR is responsible for restoring CPU registers to their previous state before exiting via as_return The exact way in which this happens varies from processor to processor On most processors the ASR is written in assembly language so you the programmer must
348. n MSR bits Set new MSR InterruptHandler Get interrupt handler entry 0 r29 Jump to handler pSOSIEnter Get I_ENTER entry 0 r31 Call I_ENTER PS_FRM_RO sp Save RO PS_FRM_R2 sp Save R2 PS_FRM_R3 sp Save R3 PS_FRM_R4 sp Save R4 PS_FRM_R5 sp Save R5 PS_FRM_R6 sp Save R6 PS_FRM_R 7 sp Save R7 PS_FRM_R8 sp Save R8 PS_FRM_R9 sp Save R9 PS_FRM_R10 sp Save R10 PS_FRM_R11 sp Save R11 PS_FRM_R12 sp Save R12 PS_FRM_R13 sp Save R13 Save CTR PS_FRM_CTR sp Save XER PS_FRM_XER sp _SDA2_BASE_ Set up R2 for ISR _SDA_BASE _ Set up R13 for ISR Handle the interrupt pSOSIReturn Get I_RETURN entry 0 r31 Jump to I_RETURN and never return 1 37 i_return 1 38 pSOS System Calls On 960 processors an ISR must restore all global CPU registers including the frame pointer to their state prior to the interrupt Below is a sample code fragment for an ISR that internally uses CPU registers g8 g9 g10 and g11 movq g8 r8 lt body of ISR gt movq r8 98 calls 13 ret On x86 processors an ISR must restore all CPU registers to their state prior to the interrupt Below is a sample code fragment for an ISR that internally uses CPU registers ES EAX ECX and EDX INT 92H PERFORM I_ENTER PUSH DS SAVE SOME REGISTERS PUSH ES PUSH EAX PUSH ECX PUSH EDX lt body of ISR gt HANDLE THE ISR POP EDX RESTORE REGISTERS POP ECX
349. n Value The putchar function returns letter If a write error occurs the error flag for the standard output stream is set EOF is returned and errno is set Error Codes Refer to Appendix B Notes Callable From m Task See Also getchar putc 3 118 pSOSystem System Calls pREPC System Calls puts puts Writes a string to a stream include lt stdarg h gt include lt stdio h gt int puts const char s string Description The puts function writes a string to the standard output stream and appends a new line character to the output The terminating null character is not written Arguments s Points to the string to write Return Value The puts function returns 0 if the operation is successful and EOF if the operation fails If an error occurs the stream s error indicator and errno are set Error Codes Refer to Appendix B Notes Callable From m Task See Also gets fputs pSOSystem System Calls 3 119 qsort pREPC System Calls qsort Sorts an array include lt stdlib h gt void qsort void base array base size_t nmemb array length size t size array element size int compar const void const void comparison function Description The qsort function sorts an array of nmemb objects the initial element of which is pointed to by base The size of each object is specified by size The array is sorted in ascending or
350. n for each call Each call s section includes its syntax a detailed description its arguments and its return value Where applicable the section also includes the headings Notes and See Also Notes provides important information not specifically related to the call s description and See Also indicates other calls that have related information If you need to look up a system call by its functionality refer to Appendix A Tables of System Calls which lists the calls alphabetically by component and provides a brief description of each call pREPC error codes are listed in Appendix B Error Codes For practical reasons they are not listed here because every pREPC system call can return most or all of the pREPC error codes In addition errors in other pSOSystem components or device drivers can be reported by pREPC system calls 3 1 3 2 pREPC System Calls pSOSystem System Calls pREPC System Calls abort abort Aborts a task include lt stdlib h gt void abort void Description The abort macro is used to terminate a task abort simply invokes the exit macro with an argument of zero For further details refer to the exit macro on page 3 28 Return Value If the task is successfully deleted the abort macro does not return to its caller If the task cannot be deleted successfully abort suspends the task indefinitely and does not return to its caller unless
351. n the regular in band data Specifies that you want recvmsg to peek at the data present on the socket the data is re turned but not consumed so that a subse quent receive operation sees the same data This system call returns the number of bytes received or it returns 1 if an error occurs When the receive is shutdown by either end of the connection a value of 0 is returned 4 52 pSOSystem System Calls pNA System Calls Error Codes Hex Mnemonic 0x5009 EBADS 0x5016 EINVALID 0x5023 EWOULDBLOCK 0x5028 EMSGSIZE 0x5036 ECONNRESET 0x5037 ENOBUFS 0x5039 ENOTCONN See Also recv recvfrom socket pSOSystem System Calls recvmsg Description The socket descriptor is invalid An argument is invalid This operation would block and the socket is marked non blocking Message too long The connection has been reset by the peer An internal buffer is required but can not be allocated The socket is not connected 4 53 select pNA System Calls select Checks the status of multiple sockets include lt pna h gt long select int width fd_set readset fd_set writeset fd_set exceptset struct timeval timeout Description largest descriptor list read descriptor list write descriptor list exception list timeout for operation This system call is used to multiplex I O requests among multiple sockets Three set
352. n use to store data associated with the event Return Value This call always returns 0 Error Codes None Notes Because pMONT uses pSOS objects for its functionality some user defined entries in the pSOS configuration table affect pMONT behavior and can even increase the likelihood of error messages For example an insufficient number of message buffers may result in a sudden break in the host target connection The paragraphs that follow explain this pMONT uses the system wide buffer pool to post messages to its queues so you need to consider this when specifying kc_nmsgbuf in the pSOS configuration 6 6 pSOSystem System Calls pROBE and ESp System Calls log_event table How much pMONT affects the specification of kc_nmsgbuf depends on the monitoring demands that you expect pMONT to meet The rate at which the system wide buffer pool is replenished depends on the communication medium used to communicate with the host With a network for example pMONT replenishes the buffer relatively quickly You can estimate the requirements for the application by considering the following ESp behaviors A message is posted to a queue every time an object is created or deleted A message is posted to a queue every time pMONT receives a request A message is posted when data collection ends under any of the buffer man agement options Under the Transmit Buffer Management option pMONT periodically sends data to the host Every time
353. nager which return error values via the function return value use of the errno macro is superfluous 3 A successful system call does not clear the previous errno value errno always contains the error code from the last unsuccessful call pSOSystem System Calls 1 23 errno_addr 1 24 Multiprocessor Considerations None Callable From m Task pSOS System Calls pSOSystem System Calls pSOS System Calls ev_asend ev_asend pSOS m kernel only Asynchronously sends events to a task include lt psos h gt unsigned long ev_asend unsigned long tid target task identifier unsigned long events bit encoded events Description This system call asynchronously sends events to a task It is identical to ev_send except the call is made asynchronously Refer to the description of ev_send for further information Arguments tid Specifies the task ID of the target task events Contains a list of bit encoded events Return Value When called in a system running the pSOS m kernel this call always returns 0 The pSOS kernel the single processor version returns ERR_SSFN Error Codes Should the call fail if present the node s MC_ASYNCERR routine is invoked and the following error codes may be reported Hex Mnemonic Description 0x05 ERR_OBJDEL Task has been deleted 0x06 ERR_OBJID tid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID
354. name char optval int optlen Description socket descriptor SOL_SOCKET IPPROTO_TCP or IPPROTO IP retrieval access modification data sizeof modification data The setsockopt system call sets options associated with the specified socket Socket level IP protocol level or TCP protocol level options can be set Arguments s Specifies the socket whose options are to be set level Specifies the level of the option to be set Must be SOL_SOCKET for socket level operations IPPROTO_TCP for TCP protocol level oper ations or IPPROTO_IP for IP protocol level operations These op tions are defined in lt pna h gt optname Specifies the option to be set and uses a symbolic constant de fined in lt pna h gt The symbolic constants available for each level are described below optval Points to a buffer in which the option s value is specified Most op tions are 32 bit values A nonzero value means the option should be set and a 0 means the option should be turned off optlen Specifies the size of the value pointed to by optval 4 66 pSOSystem System Calls pNA System Calls Socket Level Options setsockopt level must be set to SOL_SOCKET for socket level operations and the optname value can be one of the following defined in lt pna h gt SO_BROADCAST SO_DONTROUTE SO_KE EPALIVE SO_LINGE SO_OOBINLIN GI SO_RCVBUF SO_RE US EADDR
355. nchronizes a volume sync_vol include lt phile h gt unsigned long sync_vol char device Volume Types volume name pHILE and MS DOS formatted volumes Description sync_vol updates a mounted volume by writing all modified volume information to the physical device Updated files descriptors and all cache buffers that contain physical blocks are flushed to the device This call enables manual updating of a volume and is irrelevant in relation to immediate write synchronization mode CD ROM volumes are read only Arguments device Return Value Points to the null terminated name of the volume to synchronize This system call returns 0 on success or an error code on failure Error Codes Hex 0x2003 0x200A 0x2025 0x2050 pSOSystem System Calls Mnemonic E_BADVOL E_DMOUNT E_IDN E_BADNFS Description Inconsistent data on volume corrupted Volume not mounted Illegal device name NFS volume illegal operation volume 2 115 sync_vol pHILE System Calls Mnemonic Description E_BADCD CD ROM volume illegal operation Because no inherent access restrictions exist with respect to a volume any task can call sync_vol sync_vol keeps the volume busy during the update unmount_vol mount_vol pcmount_vol Hex 0x2060 Notes See Also 2 116 pSOSystem System Calls pHILE System Calls truncate_f truncate_f Changes the size of a named file
356. nconditionally whether or not allocation was successful If the calling task elects the RN_WAIT attribute and a subsequent request cannot be satisfied the task is blocked until either a segment is allocated or a timeout occurs if the timeout attribute is elected Arguments rnid Specifies the region ID from which the memory segment is allocated size Specifies the segment size in bytes flags Specifies the segment s attributes The flags argument must assume one of the following values defined in lt psos h gt RN_NOWAIT Don t wait for a segment RN_WAIT Wait for a segment timeout Specifies the timeout in units of clock ticks If timeout is 0 and flags is set to RN_WAIT then rn_getseg will wait forever The timeout argument is ignored if RN_NOWAIT is used seg_addr Points to the variable where rn_getseg stores the starting address of the memory segment 1 112 pSOSystem System Calls pSOS System Calls rn_getseg Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description Ox01 ERR_TIMEOUT Timed out only if timeout requested 0x05 ERR_OBJDEL Region has been deleted 0x06 ERR_OBJID rnid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x20 ERR_ZERO Cannot getseg request size of zero is illegal 0x21 ERR_TOOBIG Request size too big for region 0x22 ERR_NOSEG N
357. nel internally passes the message to the task s node of residence whose pSOS m kernel will ready the task and give it the relayed message Thus a q_urgent call whether it is on the local or a remote queue may cause pSsOS tm activities on another processor node Callable From a Task m ISR if the target queue is local to the node from which the q_urgent call is made m KI if the target queue is local to the node from which the q_urgent call is made m Callout if the target queue is local to the node from which the q_urgent call is made See Also q_receive q_send q_vurgent pSOSystem System Calls 1 87 q_vbroadcast pSOS System Calls q_vbroadcast Broadcasts identical variable length messages to a message queue include lt psos h gt unsigned long q_vbroadcast unsigned long qid void msg_buf unsigned long msg_len unsigned long count queue identifier message buffer length of message number of tasks This system call sends a message to all tasks waiting at a specified variable length queue Otherwise it is identical to q_broadcast Description Arguments qid msg_buf msg_len count Return Value Specifies the queue ID of the target queue Points to the message to send Specifies the length of the message It must not exceed the queue s maximum message length which was specified with q_vcreate Points to the variable where q_vbroadcast
358. ng Return Value The function returns a pointer to the located string or a null pointer if the string is not found If s2 points to a string with zero length the function returns s1 Error Codes Refer to Appendix B Notes Callable From m Task m ISR pSOSystem System Calls 3 163 strtod strtod pREPC System Calls Converts a string to a double include lt stdlib h gt double strtod const char nptr input string char endptr string conversion terminator Description This function converts the initial portion of a string nptr to a double representation Leading white spaces are ignored The string can be in scientific exponential form for example 123 45e 67 123 45E 67 The strtod function stops parsing the string when it detects a character that is inconsistent with a double data type This function sets errno if the converted value is out of the supported range for doubles Arguments nptr Points to the string to be converted endptr An output parameter If nptr is null strtod functions the same as atof If nptr is not null it points to a pointer to the character in str that terminated the scan Return Value Notes 3 164 This function returns either the converted value or 0 if no conversion occurs No conversion occurs if the first nonwhite space in str is neither a digit nor a decimal point If the correct value is outside the range of representable values a plu
359. ng of typed character echo and so on m Reading device status information Callable From a Task See Also 1 14 de_read de_write de_open de_clos pSOSystem System Calls pSOS System Calls de_init de_init Initializes an I O device and its driver include lt psos h gt unsigned long de_init unsigned long dev major minor device number void iopb I O parameter block void retval return value void data_area device data area Description The de_init call invokes the device initialization routine of the pSOS device driver specified by the dev argument The drive init routine can perform one time device initialization functions such as m Resetting the devices m Setting the necessary programmable registers m Allocating and or initializing the driver s data area for pointers counters and so on m Creating the messages queues semaphores and so on that are needed for communication and synchronization m Installing the interrupt vectors if necessary Arguments dev Specifies the major and minor device numbers which are stored in the upper and lower 16 bits respectively iopb Points to an I O parameter block the contents of which are driver specific retval Points to a variable that receives a driver specific value pSOSystem Sys returned by the driver tem Calls 1 15 de_init data_area Return Code pSOS System Calls This argument is no longer used but it remains to
360. nge without notice RESTRICTED RIGHTS LEGEND Use duplication or disclosure by the Government is subject to restrictions as set forth in subparagraph c 1 ii of the Rights in Technical Data and Computer Software clause at DFARS252 227 7013 or its equivalent Unpublished rights reserved under the copyright laws of the United States TRADEMARKS AutoCode MATRIX and pSOS are registered trademarks of Integrated Systems Inc The following are trademarks of Integrated Systems Inc BetterState BetterState Lite BetterState Pro DocumentIt Epilogue ESp HyperBuild NetState OpEN OpTIC pHILE Plug and Sim pNA pREPC pRISM pRISM pROBE pRPC pSET pSOS pSOS m pSOSim pSOSystem pX11 RealSim SpOTLIGHT SystemBuild Xmath ZeroCopy ARM is a trademark of Advanced RISC Machines Limited Diab Data and Diab Data in combination with D AS D C D CC D F77 and D LD are trademarks of Diab Data Inc ELANIX Signal Analysis Module and SAM are trademarks of ELANIX Inc SingleStep is a trademark of Software Development Systems Inc SNiFF is a trademark of TakeFive Software GmbH Austria a wholly owned subsidiary of Integrated Systems Inc All other products mentioned are the trademarks service marks or registered trademarks of their respective holders Contents Contents iii Using This Manual vii Organization sosgige 0046 845464040
361. nge_dir pHILE Changes the current directory 2 13 chmod_f pHILE Changes the mode of a named ordinary or 2 16 directory file chown_f pHILE Changes the owner or group of a named or 2 19 dinary or directory file clearerr pREPC Clears a stream s error indicators 3 19 close pNA Closes a socket descriptor 4 8 close_dir pHILE Closes an open directory file 2 22 close_f pHILE Closes an open file connection 2 22 connect pNA Initiates a connection on a socket 4 9 create_f pHILE Creates a data file 2 25 ctime pREPC Converts the calendar time to a string 3 20 A 2 pSOSystem System Calls Tables of System Calls All pSOSystem System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page ctime_r pREPC Reentrant Converts the calendar time to a 3 22 string db_input pROBE Prompts and gets input from the high level 6 3 debugger db_output pROBE Outputs a string to the high level debugger 6 5 de_close psOS Closes an I O device 1 11 de_cntrl psOS Requests a special I O device service 1 13 de_init pSOS Initializes an I O device and its driver 1 15 de_open psOS Opens an I O device 1 17 de_read pSOS Reads data from an I O device 1 19 de_write pSOS Writes data to an I O device 1 21 difftime pREPC Computes the difference between two calen 3 24 dar times div pREPC Performs a division opera
362. nknown protocol Call interrupted All other RPC errors 2 119 unmount_vol pHILE System Calls unmount_vol unmounts a volume include lt phile h gt unsigned long unmount_ vol char device volume name Volume Types All volume types Description unmount_vol unmounts a previously mounted volume Unmounting a volume causes it to be synchronized Synchronization causes all memory resident volume data to be flushed to the device Arguments device Points to the null terminated name of the volume to unmount Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2003 E_BADVOL Inconsistent data on volume volume corrupted 0x2009 E_MNTOPEN Files are open on volume Ox200A E_DMOUNT Volume not mounted 0x200C E_IFN Illegal pathname 0x200D E_NDD No default directory 0x2025 E_IDN Illegal device name 2 120 pSOSystem System Calls pHILE System Calls Hex 0x2051 0x2052 0x2054 0x2058 0x205B 0x205C 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E Notes Mnemonic E_MAXLOOP EREMOTE EIO _ ESTALE ENODEV EAUTH ENF S ETIMEDOUT ENOAUTHBLK _ ECANTSEND _ ECANTRECV E_PROBUNAVAIL EPROGVERSMISMATCH ECANTDECODEARGS EUNKNO
363. nsigned long ev_send unsigned long tid target task identifier unsigned long events bit encoded events Description This system call sends events to a task If the target task is not waiting for events the newly sent events are simply made pending If the task is waiting for events and the wait condition is fully satisfied as a result of the new events then the task is unblocked and readied for execution Otherwise the task continues to wait In either case any of the events sent that do not match those waited on are always left pending Each task has 32 events which are encoded bit wise in a single long word Bits 31 through 16 are for internal system use and bits 15 through 0 are for user specific purposes ev_send can send up to 32 different events at one time Events are neither queued nor counted For example if three identical events are sent to a task before it issues a wait for that event the three events have the same effect as one event Arguments tid Specifies the task identifier of the target task events Contains a list of bit encoded events Return Value This system call returns 0 on success or an error code on failure 1 30 pSOSystem System Calls pSOS System Calls ev_send Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Task has been deleted 0x06 ERR_OBJID tid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validit
364. nt it arrives between two ticks The accuracy is within one or two ticks 4 tm_set has no effect on tasks that are either timing out or waiting after tm_wkafter or tm_evafter calls because these pause intervals are in clock ticks not clock time Multiprocessor Considerations None This call can only be directed at the local processor node 1 176 pSOSystem System Calls pSOS System Calls Callable From a Task ISR See Also tm_get tm_tick pSOSystem System Calls tm_set 1 177 tm_tick pSOS System Calls tm_tick Announces a clock tick to the pSOS kernel include lt psos h gt unsigned long tm tick Description This system call is used to inform the pSOS kernel of the arrival of a new clock tick The pSOS time manager uses it to update its time and date calendar count down tasks that are timing out and track a running task s time slice for round robin scheduling Normally the user s real time clock ISR calls tm_tick The frequency of tm_tick calls is fixed and defined in the pSOS Configuration Table as kc_ticks2sec Thus if the value is 100 the pSOS time manager interprets 100 tm_tick calls as one real time second Return Value This call always returns 0 Error Codes Notes 1 178 None 1 tm_tick is very fast it just notifies the system of the arrival of another clock tick Most other Time Manager actions that can result from this clock tick are postponed until t
365. nt_vol E_VALIEN E_VALIEN E_MNTED yes change_dir yes yes yes yes chmod_f E_FUNC E_BADMS yes E_RO chown_f E_FUNC E_BADMS yes E_RO close_dir yes yes yes yes close_f yes yes yes yes create_f yes yes yes E_RO fchmod_f E_FUNC E_BADMS yes E_RO fchown_f E_FUNC E_BADMS yes ERO fstat_f yes yes yes yes fstat_vfs yes yes yes yes ftruncate_f yes yes yes E_RO get_fn yes yes E_BADNFS yes init_vol yes yes E_MNTED E_RO link_f E_FUNC E_BADMS yes E_BADCD lock_f yes E_BADMS E_BADNF S E_BADCD lseek_f yes yes yes yes lstat_f E_FUNC E_BADMS yes E_BADCD make_dir yes yes yes E_RO mount_vol yes E_VALIEN E_MNTED E_VALIEN move_f yes yes yes E_RO nfsmount_vol E_MNTED E_MNTED yes E_MNTED open_dir yes yes yes yes open_f yes yes yes yes open_fn yes yes E_BADNFS yes pSOSystem System Calls pHILE System Calls TABLE 2 1 File Systems Supported by pHILE Calls Continued Bios pHILE MS DOS pcinit_vol yes yes pcmount_vol yes read_dir yes yes yes yes read_f yes yes yes yes read_link E_FUNC E_BADMS E_BADCD read_vol yes yes E_BADNFS remove_f yes yes E_RO stat_f yes yes yes yes stat_vfs yes yes yes yes symlink_f E_FUNC E_BADMS E sync_vol yes yes E_BADNFS unmount_vol yes yes yes yes verify_vol yes E_VALIEN E_VALIEN write_f yes y
366. nts to the variable where tm_evafter stores a timer identifier which can be used if the armed timer must be cancelled Return Value This system call returns O on success or an error code on failure 1 166 pSOSystem System Calls pSOS System Calls tm_evafter Error Codes Hex Mnemonic Description 0x4B ERR_NOTIMERS Exceeds the maximum number of configured timers Notes The maximum interval is 222 1 ticks The timer is counted down by successive tm_tick calls If no clock or timer is provided a timer does not expire A task must call ev_receive explicitly to receive any timer triggered events which are like other events in every other way A task with active timers can be blocked or suspended In either case the designated events are sent when the timer expires When a task with armed timers is restarted or deleted its timers are automatically cancelled The number of simultaneously active timers is fixed and defined by the kc_ntimer entry in the pSOS Configuration Table Multiprocessor Considerations None This call only affects the calling task Callable From a Task See Also V_ receive v_send pSOSystem System Calls 1 167 tm_evevery pSOS System Calls tm_evevery Sends events to the calling task at periodic intervals include lt psos h gt unsigned long tm_evevery unsigned long ticks delay unsigned long events event list unsigned long tmid timer iden
367. nv C_NUMERIC Affects the decimal point character for the formatted input output functions and the string conversion functions as well as the non monetary formatting information returned by localeconv LC_TIME Affects the behavior of strftime 3 134 pSOSystem System Calls pREPC System Calls setlocale locale Points to a string specifying the locale in which the program is used Only one value is supported by pREPC G7 Specifies the minimal environment for C translation Return Value If a pointer to a string is given for locale and the selection can be honored setlocale returns a pointer to the string associated with the specified category for the new locale If the selection cannot be honored setlocale returns a null pointer and the program s locale is not changed A null pointer for locale causes setlocale to return a pointer to the string associated with the category for the program s current locale the program s locale is not changed The pointer to string returned by set locale is such that a subsequent call with that string value and its associated category will restore that part of the program s locale The string pointed to will not be modified by the program but may be overwritten by a subsequent call to setlocale Error Codes None Callable From m Task ISR See Also localeconv strcoll strxfrm strftime pSOSystem System Calls 3 135 setvbuf pREPC System Calls
368. o an ordinary queue Multiprocessor Considerations 1 If qid identifies a global queue residing on another processor node the local kernel will internally make an RSC to that remote node to post the input message to that queue 2 Ifa task awakened by this call does not reside on the local node the local kernel will internally pass the message to the task s node of residence whose pSOS m kernel will ready the task and give it the relayed message Thus a q_vurgent call whether it is on the local or a remote queue may cause pSOS m activities on another processor node Callable From a Task m ISR if the target queue is local to the node from which the q_vurgent call is made m KI if the target queue is local to the node from which the q_vurgent call is made pSOSystem System Calls 1 105 q_vurgent pSOS System Calls Callout if the target queue is local to the node from which the q_vurgent call is made See Also q_urgent q_vreceive q_vsend 1 106 pSOSystem System Calls pSOS System Calls rn_create rn_create Creates a memory region include lt psos h gt unsigned long rn_create char name 4 region name void saddr starting address unsigned long length region s size in bytes unsigned long unit_size region s unit of allocation unsigned long flags region attributes unsigned long rnid region ID unsigned long asiz allocatable size Descri
369. o be searched and s2 is passed as a pointer to the string that contains the delimiters The first call searches for the first character in s1 that is not found in the delimiter set If such a character is found it is the start of the first token If the first call fails to find a character that is not a delimiter there are no tokens and a null pointer is returned The function then continues the search of s1 for a character that is contained in the delimiter set If no such character is located the current token extends to the end of sl and subsequent calls to the function return a null pointer If a delimiter is located a null character that terminates the current token overwrites the delimiter The function saves the pointer to the character that follows This is where the next search for a token starts In subsequent calls the first argument should be a null pointer The search for the next token begins from the saved pointer and behaves as described in the preceding paragraph The search string s2 can be changed between calls This allows strtok to continue to parse the string with a different set of delimiters Arguments 3 166 sl Points to the string to be searched s2 Points to the string containing token delimiters pSOSystem System Calls pREPC System Calls strtok Return Value The function returns a pointer to the first character of a token If no token exists the function returns a null pointer Error Codes
370. o free segment is returned only if RN_NOWAIT attribute is used 0x26 ERR_RNKILLD Region deleted while task waiting for segment Notes 1 See pSOSystem System Concepts for a description of the allocation algorithm for regions 2 An allocated segment s size will always be a multiple of the region s unit size It can therefore be greater than size 3 An allocated segment always starts on a long word boundary 4 If the calling task must wait it will either wait by FIFO or priority order depending on the attribute elected when the region was created Multiprocessor Considerations Regions are strictly local resources and cannot be exported Therefore any allocation calls must come only from the local node However if a region s memory pSOSystem System Calls 1 113 rn_getseg pS0S System Calls is reachable from other nodes then any segments allocated from it can be passed between nodes for direct access explicitly by the user s code Callable From m Task See Also rn_create rn_retseg 1 114 pSOSystem System Calls pSOS System Calls rn_ident rn_ident Obtains the region identifier of a named region include lt psos h gt unsigned long rn_ident char name 4 region name unsigned long rnid region identifier Description This system call enables the calling task to obtain the region ID of a memory region for which the caller has only the region name This region ID can then be used in a
371. o its own subtree pSOSystem System Calls pHILE System Calls move_f If oldname is open the file can be moved on pHILE and NFS volumes An open file cannot be moved on MS DOS volumes Furthermore no files can be moved on CD ROM volumes Return Value This system call returns 0 on success or an error code on failure Error Codes Hex 0x2003 0x200A 0x200B 0x200C 0x200D 0x200E 0x2010 0x2011 0x2012 0x2015 0x2016 0x2017 0x201C 0x201D 0x2025 0x2051 0x2052 pSOSystem System Calls Mnemonic E_BADVOL E_DMOUNT E_FNAME E_FORD E_IFN E_NDD __NODE EF E_RO FEXIST IST _DIFDEV _ NOTREE E_ININFULL E_MAXLOOP ER EMOTE Description Inconsistent data on volume volume corrupted Volume not mounted Filename not found Illegal pathname No default directory Directory file expected Null pathname File already exists Too many files on volume Operation not allowed on read only system files directories or mounted volumes Operation must be on the same volume move_f would destroy directory tree structure Index block is full Volume is full Illegal device name Symbolic links are nested too deeply Too many levels of remote in path 2 71 move_f Hex 0x2054 0x2055 0x2056 0x2057 0x2058 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072 0x2074 0x2075
372. ocket An argument is invalid The connection is broken This operation would block and the socket is marked non blocking The destination address is invalid Message too long The specified address is not available The destination network cannot be reached from this node The connection has been reset by the peer An internal buffer is required but can t be allocated The socket is in a connected state The socket is not connected The destination host could not be reached from this node pSOSystem System Calls pNA System Calls set_id set_id Sets a task s user ID and group ID include lt pna h gt long set_id long userid user identity long groupid group identity long groups must be zero Description This system call sets the user ID and group ID of the calling task These IDs are used for accessing NFS servers Default values for the IDs are defined in the pNA Configuration Table Arguments userid Specifies the calling task s user ID groupid Specifies the calling task s group ID groups Zero must be passed as a third argument it is currently ig nored Return Value This system call returns 0 if successful otherwise it returns 1 Error Codes None See Also get_id pSOSystem System Calls 4 65 setsockopt pNA System Calls setsockopt Sets options on a socket include lt pna h gt long setsockopt int s int level int opt
373. ocks are known to be bad prior to volume initialization They are normally the result of manufacturing defects Typically the device pSOSystem System Calls 2 139 verify_vol pHILE System Calls manufacturer provides a list of such blocks with each device They can also be detected by testing the device prior to its initialization Failed Blocks These are blocks that fail some time after the volume has been initialized They are normally detected in the course of reading or writing the affected block Dead blocks are much simpler to handle than failed blocks because they are detected before the pHILE file system manager has allocated them To handle these blocks perform the following steps 1 Initialize the volume taking care not to place the bitmap or FLIST onto any dead blocks Note blocks 2 and 3 must not be dead 2 Mount the volume and call verify_vol providing a bad block list containing all dead blocks 3 Have faultp always return status 1 correct fault and continue for fdb_code VF_BBFRE so that verify_vol will mark the blocks as in use note that the bad block is marked free error is correctable Failed blocks are harder to handle because the block was already allocated by pHILE file system manager before it failed The block may or may not contain valid data depending on exactly when the failure occurred However since the block is allocated its corresponding bit is already set To elimina
374. ode is formed by OR ing the following symbolic constants one from each pair which are defined in lt psos h gt For instance to specify that the ASR should have preemption turned off you place the symbolic constant T_NOPREEMPT in mode To specify that the ASR should have preemption turned off and roundrobin by time slicing turned on you place both T_NOPREEMPT and T_TSLICE in mode using the following syntax T_NOPREEMPT T_TSLICE T pSOSystem System Calls 1 3 as_catch Target PREEMPT OPREEMPT _TSLICE _NOTSLICE T_ASR T_NOASR _USER T_SUPV T_ISR T_NOISR EVELMASKO through EVELMASKn User and Supervisor Modes pSOS System Calls ASR is is not preemptible ASR can cannot be time sliced ASR nesting enabled disabled If T_ASR is set then the ASR should be programmed to be re entrant If T_NOASR is set the ASR is prevented from being re entered as a result of another as_send call made to that task ASR runs in user mode supervisor mode See User and Supervisor Modes under Target Interrupts are enabled disabled while ASR runs These options are available only on certain processors See Interrupt Control under Target Certain interrupts are disabled while ASR runs These options are available only on certain processors See Int
375. odes None Notes Callable From m Task See Also srand 3 122 pSOSystem System Calls pREPC System Calls realloc realloc Allocates memory include lt stdib h gt void realloc void ptr pointer size_t size new size Description The realloc function changes the size of the object pointed to by ptr to the size specified by size The contents of the object remain unchanged up to the lesser of the new or old sizes If the new size is larger the value of the newly allocated portion of the object is indeterminate The caller can be blocked if memory is not available and the wait option is selected in the pREPC Configuration Table Arguments ptr Points to the object whose size is to be changed If ptr is a null pointer realloc behaves like malloc If ptr does not match a segment previously returned by calloc malloc or realloc the result is unpredictable If ptr is not a null pointer and size is O the segment is deallocated size Specifies the new size of the object Return Value This function returns a pointer to the possibly moved allocated memory or a null pointer If an error occurs errno is set Error Codes Refer to Appendix B pSOSystem System Calls 3 123 realloc Notes Callable From m Task See Also calloc malloc realloc 3 124 pREPC System Calls pSOSystem System Calls pREPC System Calls remove remove Removes a file include lt stdarg h gt
376. odes may not have unique names the result of this binding may depend on the order in which the object tables are searched 2 If the master node s Global Object Table must be searched then the pSOS m kernel makes an RSC to the master node Callable From m Task See Also pt_create 1 56 pSOSystem System Calls pSOS System Calls pt_retbuf pt_retbuf Returns a buffer to the partition from which it came include lt psos h gt unsigned long pt_retbuf unsigned long ptid partition identifier void bufaddr starting address of the buffer Description This system call returns a buffer to the partition from which it was allocated Because the pSOS kernel does not keep track of buffer ownership it is possible for one task to get a buffer and another task to return it Arguments ptid Specifies the partition ID of the buffer to return bufaddr Specifies the buffer s starting address Return Value This system call returns O on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBUDEL Partition has been deleted 0x06 ERR_OBJID ptid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x2D ERR_BUFADDR Incorrect buffer starting address 0x2F ERR_BUFFREE Buffer is already unallocated 0x65 ERR_STALEID Object s node has failed pSOSystem System Calls 1 57 pt_retbuf
377. ol pcinit_vol 2 52 pSOSystem System Calls pHILE System Calls link_f link_f Creates a hard link between two files on the same volume unsigned long link_f char namel an existing filename char name2 a new directory entry to be created Volume Types NFS formatted volumes Description link_f makes a hard link from name2 to namel This increments the link count for the file see stat_f After this call namel and name2 are two alternate names for the same file Both files must be on the same volume Arguments namel Points to a null terminated pathname of an existing file Must not refer to a directory name2 Points to a null terminated pathname of a directory entry to be created Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2001 E_FUNC pHILE volume illegal operation 0x200C E_IFN Illegal pathname 0x200D E_NDD No default directory 0x2015 E_RO Requested operation not allowed on this file pSOSystem System Calls 2 53 link f 2 54 Hex 0x2025 0x2026 0x2051 0x2052 0x2054 0x2055 0x2057 0x2058 0x2059 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E Mnemonic E_IDN E_BADMS E_MAXLOOP EREMOTE EIO EACCES EQUOT ESTALE E_XLINK ENXIO E_BADCD _
378. olume 2 109 symlink_f Creates a symbolic link to a file 2 112 sync_vol Synchronizes a volume 2 115 truncate_f Changes the size of a named file 2 117 unmount_vol Unmounts a volume 2 120 utime_f Sets the access and modification times of a file 2 123 verify_vol Verifies a volume s control structures 2 126 write _f Writes to an open file 2 142 write_vol Writes data directly to a pHILE formatted volume 2 145 A 4 pREPC System Calls Table A 4 provides an alphabetical listing of all pREPC system calls a summary description for each call and a reference to more details about the call TABLE A 4 pREPC System Calls Name Description Page abort Aborts a task 3 3 abs Computes the absolute value of an integer 3 4 asctime Converts the broken down time to a string 3 5 A 20 pSOSystem System Calls Tables of System Calls TABLE A 4 pREPC System Calls Continued pREPC System Calls Name Description Page asctime_r Reentrant Converts the broken down time to a string 3 6 assert Verifies that a program is operating correctly 3 8 atof Converts a string to a double 3 9 atoi Converts a string to an integer 3 11 atol Converts a string to a long integer 3 13 bsearch Searches an array 3 15 calloc Allocates memory 3 17 clearerr Clears a stream s error indicators 3 19 ctime Converts the calend
379. om a partition 1 59 putc pREPC Writes a character to a stream 3 117 putchar pREPC Writes a character to stdout 3 118 puts pREPC Writes a string to a file 3 119 q_asend psOS pSOS m kernel only Asynchronously posts 1 61 a message to an ordinary message queue q_aurgent psOSs pSOS m kernel only Asynchronously posts 1 63 a message at the head of an ordinary mes sage queue q_avsend psOSs pSOS m kernel only Asynchronously posts 1 65 a message to a variable length message queue q_avurgent psOSs pSOS m kernel only Asynchronously posts 1 68 a message at the head of a variable length message queue q_broadcast psOSs Broadcasts identical messages to an ordi 1 71 nary message queue q_create psOs Creates an ordinary message queue 1 74 A 8 pSOSystem System Calls Tables of System Calls All pSOSystem System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page q_delete psOS Deletes an ordinary message queue 1 77 q_ident psOS Obtains the queue ID of an ordinary mes 1 79 sage queue q_receive psOS Requests a message from an ordinary mes 1 81 sage queue q_send psOS Posts a message to an ordinary message 1 84 queue q_urgent psOS Posts a message to the head of an ordinary 1 86 message queue q_vbroadcast psOS Broadcasts identical variable length mes 1 88 sages to a variable length message queue
380. on pushes a character c converted to an unsigned char back to the specified stream The character is returned on the next read operation on the stream A call to fseek fsetpos rewind or fflush ignores the character The stream s position indicator is not changed by this call Arguments c Specifies the character to be pushed stream Points to an open pREPC stream Return Value This function returns the contents of c If an error occurs the function returns EOF and sets errno Error Codes Refer to Appendix B pSOSystem System Calls 3 181 ungetc Notes Callable From m Task See Also putc getc 3 182 pREPC System Calls pSOSystem System Calls pREPC System Calls vfprintf vfprintf Writes formatted output to a stream include lt stdarg h gt include lt stdio h gt int vfprintf FILE stream stream pointer const char format format control va_list arg argument list Description The vfprintf function is equivalent to fprintf with the variable argument list replaced by arg which should have been initialized by the va_start macro and possibly subsequent va_arg calls The vfprintf function does not invoke the va_end macro Arguments stream Points to an open pREPC stream format Points to the format control string For more information see fprintf on page 3 43 arg A list of arguments to be written according to the specifications of the forma
381. onic Description 0x31 ERR_MSGSIZ Message too large 0x35 ERR_OFULL Message queue at length limit 0x3B ERR_NOTVARO Queue is not variable length 0x65 ERR_STALEID Object s node has failed If an MC_ASYNCERR routine is not present the pSOS m kernel generates a fatal error Notes 1 This call is supported only by the pSOS m kernel 2 The calling task can be preempted as a result of this call 3 The pSOS m kernel must copy the message into a queue buffer or the receiving task s buffer Longer messages take longer to copy Users should account for the copy time in their designs 4 q_avsend asynchronously sends a message to a variable length message queue Use q_asend to asynchronously send a message to an ordinary message queue Multiprocessor Considerations 1 If qid identifies a global queue residing on another processor node then the pSOS m kernel will internally make an RSC to that remote node to post the input message to that queue 2 Ifa task awakened by this call does not reside on the local node the local kernel internally passes the message to the task s node of residence whose pSOS m kernel readies the task and gives it the relayed message Thus a q_avurgent call whether it is on the local or a remote queue can cause pSOS m activity on another processor node pSOSystem System Calls 1 69 q_avurgent pSOS System Calls Callable From a Task See Also q_urgent q_vurgent q_vreceive q_vsend 1
382. onth 1 12 Day 1 31 Bits 31 16 15 8 7 0 Specifies the clock time for event send t ime is encoded as follows Field Hour 0 23 Minute 0 59 Second 0 59 Bits 31 16 15 8 7 0 pSOSystem System Calls pSOS System Calls ticks events tmid Return Value tm_evwhen An optional count that begins after the last second of time has elapsed This parameter provides a finer resolution of time if needed Specifies the events to deliver upon expiration of the timer The events are encoded into a long word with bits 31 16 reserved for system use and bits 15 0 available for application use Points to the variable where tm_evwhen stores a timer identifier which can be used if the armed timer must be cancelled This system call returns 0 on success or an error code on failure Error Codes Hex 0x47 0x48 0x49 Ox4A 0x4B Ox4E Notes Mnemonic ERR_NOTIM ERR_ILLDATE E ERR_ILLTI ER R_ILLTICKS ER R_NOTIMERS ER R_TOOLATE Description System time and date are not yet set Date input is out of range Time of day input is out of range Ticks input out of range Exceeds maximum number of configured timers Too late input date and time are already past 1 A timer is counted down by successive tm_tick calls If no clock or timer is provided a timer does not expire 2 A timer established by tm_evwhen is affected
383. ore 1 124 sm_ident psOS Obtains a semaphore identifier 1 126 sm_p psOS Acquires a semaphore token 1 128 sm_v psOS Releases a semaphore token 1 131 socket pNA Creates a socket 4 76 sprintf PREPC Writes formatted output to a buffer 3 138 srand pREPC Sets the seed for the random number gener 3 140 ator rand sscanf PREPC Reads formatted input from a string 3 141 stat_f pHILE Gets the status of a named file 2 104 stat_vfs pHILE Gets statistics for a named volume 2 109 strcat pREPC Appends one string to another string 3 143 strchr pREPC Searches a string for a character 3 144 strcmp pREPC Compares two character strings 3 145 strcoll pREPC Compares two character strings 3 146 strcpy pREPC Copies one string to another string 3 148 pSOSystem System Calls A 11 All pSOSystem System Calls Tables of System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page strespn pREPC Calculates the length of a substring 3 149 strerror pREPC Maps an error number to an error message 3 150 string strftime pREPC Places formatted time and date information 3 151 into a string strlen pREPC Computes string length 3 154 strncat pREPC Appends characters to a string 3 155 strncmp pREPC Compares characters in two strings 3 157 strncpy pREPC Copies characters from one string to an 3 159 other strpbrk pR
384. ore call failed 0x10510006 STAT_NOMEM No memory available for request 0x10510007 STAT_RETRYEXC Failed after allotted retries 0x10510008 STAT_RESET SCSI bus reset should retry 0x10510009 STAT_BADSIZE Drive shows no blocks 0x1051000A STAT_NOMEDIA Removable disk not in drive 0x1051000B STAT_BLANK End of recorded data 0x1051000C STAT_BAD_CMD Target reports Illegal Request 0x1051000D STAT_NO_SENSE Request sense returned no sense pSOSystem System Calls Driver Error Codes Error Codes B 52 pSOSystem System Calls
385. ority out of range 1 Internally the pSOS kernel treats a task name as a 32 bit integer However when the application calls the kernel through the pSOS C language API it passes the task name as a four byte character array 2 A null name for example 32 bit binary 0 should not be used because it may be used elsewhere as an alias for the running task 3 The pSOS kernel does not check for duplicate task names If duplicate names exist at_ident call can return the tid of any task with the duplicate name pSOSystem System Calls pSOS System Calls t_create 4 Ifyou have installed any other components from Integrated Systems the pSOS kernel adds an extension for each component to the task s stack segment These extension sizes can be determined from the user manuals for those components Multiprocessor Considerations 1 The T_GLOBAL attribute should be set only if the task must be made known to other processor nodes in a multiprocessor configuration If set the task s name and tid are sent to the master node for entry in its Global Object Table 2 If the T_GLOBAL attribute is set and the number of global objects currently exported by the node equals the Multiprocessor Configuration Table entry mc_nglbobj then the task is not created and ERR_OBJTFULL is returned Callable From m Task See Also t_start t_ident rn_getseg pSOSystem System Calls 1 137 t_delete pSOS System Calls t delete Deletes a task
386. pSOS Product Family pSOSystem System Calls integrated systems 000 5070 004 integrated Copyright 1997 Integrated Systems Inc All rights reserved Printed in U S A Ae Document Title pSOSystem System Calls Part Number 000 5070 004 Revision Date August 1997 Integrated Systems Inc 201 Moffett Park Drive Sunnyvale CA 94089 1322 Corporate pSOS or pRISM Support MATRIX Support Phone 408 542 1500 1 800 458 7767 408 542 1925 1 800 958 8885 408 542 1930 Fax 408 542 1950 408 542 1966 408 542 1951 E mail ideas isi com psos_support isi com mx_support isi com Home Page http www isi com LICENSED SOFTWARE CONFIDENTIAL PROPRIETARY This document and the associated software contain information proprietary to Integrated Systems Inc or its licensors and may be used only in accordance with the Integrated Systems license agreement under which this package is provided No part of this document may be copied reproduced transmitted translated or reduced to any electronic medium or machine readable form without the prior written consent of Integrated Systems Integrated Systems makes no representation with respect to the contents and assumes no responsibility for any errors that might appear in this document Integrated Systems specifically disclaims any implied warranties of merchantability or fitness for a particular purpose This publication and the contents hereof are subject to cha
387. pares two character strings 3 145 strcoll Compares two character strings 3 146 strcpy Copies one string to another string 3 148 strespn Calculates the length of a substring 3 149 strerror Maps an error number to an error message string 3 150 strftime Places formatted time and date information into a string 3 151 strlen Computes string length 3 154 strncat Appends characters to a string 3 155 strncmp Compares characters in two strings 3 157 strncpy Copies characters from one string to another 3 159 strpbrk Searches a string for a character in a second string 3 160 A 24 pSOSystem System Calls Tables of System Calls pREPC System Calls TABLE A 4 pREPC System Calls Continued Name Description Page strrchr Searches a string for a character 3 161 strspn Calculates specified string length 3 162 strstr Searches a string for specified characters in another string 3 163 strtod Converts a string to a double 3 164 strtok Searches a string for tokens 3 166 strtol Converts a string to a long integer 3 168 strtoul Converts a string to an unsigned long 3 170 strxfrm Transforms a string so that it can be used by strcmp 3 172 time Obtains the current calendar time 3 174 tmpfile Creates a temporary file 3 176 tmpname Generates a temporary file name 3 177 tolower Converts a character to lowercase 3 179 toupper Converts a character to uppercase 3 18
388. pathname of the file Note that since the filename is illegal the last filename in the pathname may not be ASCII VF_FNDIR A directory entry contains an illegal FN one 2126 X X X Y that exceeds the allowed maximum In this case fdb_path1 contains the file s pathname while fdb_fn1 contains the illegal FN fdb_fn2 and fdb_path2 describe the directory containing the illegal entry f VF_BKMU A single block is used by more than one file 2128 X X X X N JOA A sje WAS S 37Hd TABLE 2 2 Fault Summary Continued Mnemonic Description Hex PATH1 PATH2 Fixable VF_BBUSE A bad block is in use 2129 X N VF_BKFRE A block that is in use is also marked as free 212A X Y in the volume bitmap VF_BBFRE A bad block is marked as free in the volume 212B Y bitmap VF_BKUSE An unused block is marked as in use in the 212C Y volume bitmap VF_INSUFE Work area too small 2200 Y VF_MAXDEPTH Directory depth exceeds maximum 2201 VEF_ABORT Verify routine aborted by user 2202 a The file descriptor list one of the management blocks described in the pHILE chapter of System Concepts b The root block one of the management blocks described in the pHILE chapter of System Concepts c File descriptor d File number e Iffaultp sorequests verify_vol corrects this fault by changing the filename to VFN_xxxxxxxx where xxxxxxxx is the hexadecimal
389. port the concept of text files pREPC treats text files as binary files However for forward compatibility you must specify the b character in the mode string if the file being opened through fopen contains pSOSystem System Calls 3 41 fopen pREPC System Calls binary data that should be read or written without performing any translations on it 5 Though native MS DOS systems differentiate between text and binary files the pHILE implementation of MS DOS file system does not 6 For I O devices the text streams are treated as binary streams 7 For I O devices the operations of truncating creating and appending are meaningless In modes starting with w or a an error is returned if the device being opened is not configured into the system Also the append mode is treated the same as the write mode for I O devices Callable From a Task See Also fclose fseek 3 42 pSOSystem System Calls pREPC System Calls fprintf fprintf Prints formatted output to a stream include lt stdarg h gt include lt stdio h gt int fprintf FILE stream stream pointer const char format format control F arguments 1 through n Description The fprintf function writes output to the stream pointed to by stream A format control string pointed to by format specifies how the subsequent arguments are converted for output Arguments stream Points to an open pREPC stream format Points to the format
390. prevented input from the stream in which case it is an input failure 3 57 fscanf 3 58 pREPC System Calls Except in the case of a specifier the input item or in the case of a sn directive the count of input characters is converted to a type appropriate to the conversion specifier If the input item is not a matching sequence the execution of the directive fails this condition is a matching failure Unless assignment suppression was indicated by a the result of the conversion is placed in the object pointed to by the first argument following the format argument that has not already received a conversion result If this object does not have an appropriate type or if the result of the conversion cannot be represented in the space provided the behavior is undefined The conversion specifier characters and their definitions are as follows d i An optionally signed decimal integer is expected The corresponding argument should be a pointer to an integer o An optionally signed octal integer is expected The corresponding argument should be a pointer to an integer u An optionally signed octal integer is expected The corresponding argument should be a pointer to an unsigned long integer x An optionally signed hexadecimal integer is expected The corresponding argument should be a pointer to an integer e f g An optionally signed floating point number is expected The corresponding argument should be a pointer to a
391. ption This service call enables a task to create a memory region from which variable sized memory segments can be allocated for use by the application The pSOS kernel takes a portion from the beginning of this region to use as its Region Control Block RNCB All relevant region arguments such as unit size and whether tasks will wait by FIFO or task priority order are established using this call Arguments name Specifies the user assigned name of the new region saddr Specifies the starting address of the region s memory area saddr must be on a long word boundary length Specifies the region s size in bytes unit_size Specifies the region s unit of allocation in bytes unit_size must be a power of 2 and greater than or equal to 16 All allocation will be in multiples of unit_size pSOSystem System Calls 1 107 rn_create flags rnid asiz Return Value pSOS System Calls Specifies the region s attributes flags is formed by OR ing the following symbolic constants one from each pair which are defined in lt psos h gt For instance to specify queuing by task priority you place RN_PRIOR in flags To specify queuing by task priority and to enable deletion of the region even if segments are allocated you place both RN_PRIOR and RN_DEL in flags using the following syntax RN_PRIOR RN_DE RN_PRIOR Tasks are queued by priority FIFO order RN_FIFO RN_DEL Region can cannot be deleted with segment
392. pts SO_SNDBUF Adjusts the normal buffer size allocated for a socket output buffer SO_TYPE Returns the type of socket 4 18 pSOSystem System Calls pNA System Calls getsockopt TCP Level Option level must be set to IPPROTO_TCP for TCP protocol level operations The argument optname can have the following value TCP_KEEPALIVE Number of Keepalive strobes Upon expiration of the Kee CNT palive idle timer TCP will send a number of strobes sepa rated by a fixed interval If the other end fails to respond to the strobes special TCP segments then the TCP connection will be terminated The default number of strobes in pNA is set to 8 Only valid if the SO_KEEPALIVE option is set above TCP_KEEPALIVE Keepalive idle time in TCP If the connection has been idle for IDLI this time the timer will expire causing TCP to send a special segment forcing the other end to respond On demand dial links for example the timer may be set long enough so as not to cause unnecessary traffic The default in pNA is 120 minutes The timer is in seconds Only valid if the SO_KEEPALIVE option is set above GI TCP_KEEPALIVE Keepalive strobe interval The strobes sent out by TCP upon INTVL expiration of the Keepalive idle timer are separated by a fixed time interval The default interval between the strobes is set to 75 seconds in pNA The time interval is in seconds Only valid if
393. pulating the Routing Table Operation Description SIOCADDRT Adds a routing table entry SIOCDELR Deletes a routing table entry SIOCMODRT Modifies a routing table entry For all Routing related operations arg must point to struct rtentry If a subnet mask must be specified with the route the rt_flags field must have the RTF_MASK flag set and the rt_netmask field must be filled with the subnet mask The interface number of the route s output interface can be specified Usually this is computed internally But for unnumbered point point links for instance you could specify an interface The rt_ifno field is ignored unless the RTF_INTF flag is set struct rtentry struct sockaddr rt_dst Specifies the destination IP address of the route struct sockaddr rt_gateway Specifies the gateway pSOSystem System Calls 4 27 ioctl 4 28 pNA System Calls IP address for the route unsigned short rt_flags Specifies the type of route unsigned short reserved Reserved unsigned long rt_netmask netmask of route long rt_ifno interface number unsigned long reserved2 2 Reserved The rt_flags element can contain one or more of the symbolic constants below defined in pna h in the following syntax RTF_MASK RTF_GATEWAY Symbolic Constant Description RTF_HOST Host entry net otherwise RTF_GATEWAY Destination is a gateway RTF_UP Route i
394. q_ident and q_ vident are functionally identical Both return the queue ID of the first variable length or fixed length queue encountered with the specified name Arguments name Specifies the user assigned name of the message queue node For multiprocessor systems is a search order specifier See Multiprocessor Considerations In a single node system this argument must be 0 qid Points to the variable where q_vident stores the queue ID of the named queue Return Value The system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x04 ERR_NODENO Node specifier out of range 0x09 ERR_OBJNF Named queue not found 1 96 pSOSystem System Calls pSOS System Calls q_vident Notes 1 Internally the pSOS kernel treats a queue name as a 32 bit integer However when the application calls the kernel through the pSOS C language API it passes the queue name as a four byte character array 2 The pSOS kernel does not check for duplicate queue names If duplicate names exist a q_vident call can return the qid of any queue with the duplicate name Multiprocessor Considerations 1 q vident converts a queue s name to its qid using a search order determined by the node input parameter as described in pSOSystem System Concepts Because queues created and exported by different nodes may not have unique names the result of this binding may depend on the order in which th
395. r name directory pathname unsigned long mode access permissions Volume Types All volume types except CD ROM however mode is only meaningful for NFS volumes Description make_dir creates a new directory file Arguments name Points to the null terminated pathname of the directory file to create mode For NFS volumes only specifies the access modes associated with the file and is the result of an OR operation performed on the following constants defined in lt phile h gt Mnemonic Description S_ISUID Set user ID on execution S_ISGID Set group ID on execution S_IRUSR Read permission owner S_IWUSR Write permission owner S_IXUSR Execute search permission owner S_IRGRP Read permission group S_IWGRP Write permission group S_IXGRP Execute search permission group S_IROTH Read permission other pSOSystem System Calls 2 65 make_dir pHILE System Calls S_IWOTH Write permission other S_IXOTH Execute search permission other Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2001 E_FUNC Invalid function number 0x2003 E_BADVOL Inconsistent data on volume volume corrupted 0x200A E_DMOUNT Volume not mounted 0x200B E_FNAME Filename not found 0x200C E_IFN Illegal pathname 0x200D E_NDD No default directory
396. r block address void retval return value Description The de_read call is used to read data from a device It invokes the device read routine of a pSOS device driver specified by the dev argument This service normally requires additional parameters contained in the I O parameter block such as the address of a data area to hold the data and the number of data units to read Arguments dev Specifies the major and minor device numbers which are stored in the upper and lower 16 bits respectively iopb Points to an I O parameter block the contents of which are driver specific retval Points to a variable that receives a driver specific value returned by the driver For example it can hold the actual number of data units read Return Code This call returns 0 on success or an error code on failure In addition to the error codes listed below other driver specific errors may be returned pSOSystem System Calls 1 19 de_read Error Codes Hex 0x101 0x102 0x103 Notes Mnemonic ERR_IODN ERR_NODR ERR_IOOP pSOS System Calls Description Illegal device major number No driver provided Illegal I O function number For many interrupt driven devices de_read starts an I O transaction and blocks the calling task Most of the I O transaction can actually be performed in the device s ISR Upon completion of the transaction the ISR unblocks the blocked task Callable From m Task See Also
397. r in band data MSG_PEEK Specifies that you want recv to peek at the data present on the socket the data is returned but not consumed so that a subsequent receive operation sees the same data MSG_RAWMEM Specifies that you have set buf to point to a linked list of mblks and len to the total size of the mes sage Return Value This system call returns either the number of bytes received or 1 if an error occurs When the receive is shutdown by either end of the connection a value of 0 is returned 4 46 pSOSystem System Calls pNA System Calls recy Error Codes Hex Mnemonic Description 0x5009 EBADS The socket descriptor is invalid 0x5016 EINVALID An argument is invalid 0x5023 EWOULDBLOCK This operation would block and the socket is marked non blocking 0x5036 ECONNRESET The connection has been reset by the peer 0x5037 ENOBUFS An internal buffer is required but cannot be allocated 0x5039 ENOTCONN The socket is not connected See Also connect recvfrom recvmsg socket pSOSystem System Calls 4 47 recvfrom pNA System Calls recvfrom Receives data from a socket include lt pna h gt long recvfrom int s socket descriptor char buf packet buffer int len packet buffer length int flags packet attributes struct sockaddr_in from sender attributes int fromlen number of bytes recieved Description The recvfrom system call is
398. r low level debug tool k_fatal is not the only mechanism by which control is passed to the fatal error handler It can also receive control following an internal pSOS fatal error or in multiprocessor systems a shutdown packet from the master node Multiprocessor Considerations In a multiprocessor system k_fatal can be used to implement a system wide abort or shutdown In this case K_GLOBAL should be set This causes a global shutdown packet to go to the master node which sends a shutdown packet to every node in the system Callable From m Task a KI pSOSystem System Calls 1 41 k_terminate pSOS System Calls k_terminate Terminates a node other than the master node unsigned long k_terminate unsigned long node node to terminate unsigned long fcode failure code unsigned long flags unused Description This system call enables the user application to shut down a node that it believes has failed or is operating incorrectly k_terminate causes the specified node to receive a shutdown packet and all other nodes to receive notification of the specified node s failure Arguments node Specifies the node number of the node to shut down It cannot be the master node fcode Specifies a user defined failure code It must be at least 0x20000000 flags Unused Return Value This system returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x04 ERR_NODENO Node num
399. ration 1 lock_f enables the locked region to begin and or end beyond the current logical or physical end of the file In such cases new data that is appended to the file in the locked region becomes locked 2 lock_f does not move the L_ptr 3 When initially opened a file connection has no locks 4 When a connection to a file is closed any lock it has on the file is removed 5 A locked region of a file denies read write and truncate access to it by any other file connection However annex_f which expands a file s physical size without changing its logical size is allowed 6 Directory and system files cannot be locked See Also annex_f pSOSystem System Calls 2 57 Iseek f pHILE System Calls Iseek_f Repositions for read or write within an open file include lt phile h gt unsigned long lseek_f unsigned long unsigned long long offset unsigned long Volume Types All volume types Description fid file identifier position relative seek vector offset old_lptr previous L_ptr lseek_f repositions the L_ptr associated with an open file connection Each file connection has i ts own L_ptr and it points to the next byte to be read or written in the file Repositioning can be specified relative to the beginning of the file the current L_ptr or the end of the file Arguments fid position offset old_lptr 2 58 Specifies the file identi
400. re detailed explanations Notes Provides supplemental information warnings and side effects of a call For pSOS system calls a subsection called Multiprocessor Considerations describes the be havior of the call in a multiprocessing environment if it differs from that in a single processor environment Also the subsection Callable From lists classes of pro gram elements that the system call can be called from The system will deadlock if the call is made from a program element not listed in the Callable From subsec tion There are four possible program elements Task The smallest unit of execution that can compete on its own for system re sources ISR Interrupt Service Routine A function that takes control of the system when the CPU has been triggered with an exception from an external source An ISR is part of a device driver KI Kernel Interface The kernel interface is used by pSOS m to communicate with other pSOS m kernels on other processors Callout A function that a device driver uses to notify a pSOSystem component of an interrupt event A callout is called from an ISR See Also Lists related service calls or the location of other relevant information Note Caution and Warning Conventions Within the text of this manual you may find notes cautions and warnings These statements are used for the purposes described below NOTE Notes provide special considerations or details whi
401. re name as a 32 bit integer However when the application calls the kernel through the pSOS C language API it passes the semaphore name as a four byte character array 2 The pSOS kernel does not check for duplicate semaphore names If duplicate semaphore names exist an sm_ident call can return the smid of any semaphore with the duplicate name Multiprocessor Considerations 1 sm ident converts a semaphore s name to its smid by using a search order determined by the node input parameter as described in pSOSystem System Concepts Because semaphores created and exported by different nodes may not have unique names the result of this binding may depend on the order in which the object tables are searched 2 If the master node s Global Object Table must be searched then the pSOS m kernel makes a sm_ident RSC to the master node Callable From m Task See Also sm_create pSOSystem System Calls 1 127 sm_p pSOS System Calls sm_p Acquires a semaphore token include lt psos h gt unsigned long sm p unsigned long smid semaphore identifier unsigned long flags attributes unsigned long timeout timeout Description This system call enables a task or an ISR to acquire a semaphore token A calling task can specify whether or not it wants to wait for the token If the semaphore token count is positive then this call returns the semaphore token immediately If the semaphore token count is zero
402. rec byte length of name the name CD File System Volume Descriptor template returned to user upon read of _VOLUME SY virtual typedef struct desc_cdfs UCHAR cd_type UCHAR cd_id 5 1 UCHAR cd_vers UCHAR cd_flags UCHAR cd_sysid 32 1 UCHAR cd_volid 32 1 ULONG cd_volsize UCHAR cd_escseq 32 USHORT cd_volsetsize USHORT cd_volseqnum USHORT cd_logblksize ULONG cd_pathtabsize ULONG cd_pathtab ULONG cd_pathtabopt struct dir_cdfs cd_rootdir UCHAR cd_volsetid 128 1 UCHAR cd_pubid 128 1 UCHAR cd_prepid 128 1 UCHAR cd_appid 128 1 UCHAR cd_cpyrid 37 1 UCHAR cd_absfid 37 1 UCHAR cd_bibfid 37 1 ULONG cd_cdate ULONG cd_ctime ULONG cd_mdate ULONG cd_xdate ULONG cd_xtime ULONG cd_edate UCHAR cd_svers UCHAR cd_appdata 512 desc_cdfs_t r pSOSystem System Calls file volume descriptor type standard identifier volume descriptor version volume flags system identifier volume identifier volume space size escape sequences volume set size volume sequence number logical block size path table byte size path table logical block opt path table log block root directory volume set identifier publisher identifier data preparer identifier application identifier copyright f
403. result of an OR operation performed on the following constants defined in lt phile h gt Mnemonic Description S_ISUID Set user ID on execution S_ISGID Set group ID on execution S_ISVTX Save text image after execution sticky bit S_IREAD Read permission owner S_IWRITE Write permission owner S_IEXEC Execute search permission owner S_IRGRP Read permission group S_IWGRP Write permission group S_IXGRP Execute search permission group pSOSystem System Calls 2 29 fchmod_f Return Value pHILE System Calls S_IROTH Read permission other S_IWOTH Write permission other S_IXOTH Execute search permission other This system call returns 0 on success or an error code on failure Error Codes Hex 0x2001 0x2015 0x201A 0x201B 0x2023 0x2025 0x2026 0x2052 0x2054 0x2055 0x2058 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072 2 30 Mnemonic E_FUNC E_RO E_FIDBIG E_FIDOFE E_BADFN E_ID E_BADMS _EREMOT ZETO _EACCES _ESTALE _ENXIO _ ENODEV E_BADCD __ EAUTH _ENF S ETIMEDOUT Description pHILE format volume illegal operation Operation not allowed on read only system files directories or mounted volumes Invalid file ID out of range Invalid file ID file not open Illegal or unused filename Illegal device name MS DOS volume illegal operation Too many level
404. ring precedes the quantity and currency_symbol The sign string succeeds the quantity and currency_symbol The sign string immediately precedes currency_symbol The sign string immediately precedes currency_symbol Return Value 3 90 This function returns a pointer to the filled in 1conv structure This structure must not be changed by your program but it may be overwritten by a subsequent call to pSOSystem System Calls pREPC System Calls localeconv localeconv In addition calls to setlocale with categories LC_ALL LC_MONETARY or LC_NUMERIC may overwrite the contents of the structure Error Codes None Notes Callable From m Task m ISR See Also setlocale pSOSystem System Calls 3 91 localtime pREPC System Calls localtime Converts the calendar time to broken down time include lt time h gt struct tm localtime const time_t timer calendar time Description The localtime function converts the calendar time pointed to by timer into broken down time The time is represented in local time The calendar time is generally obtained through a call to time Arguments timer Points to the calendar time Return Value The localtime function returns a pointer to the tm structure that contains the broken down time The tm structure is defined in the mktime description on page 3 111 Error Codes None Notes Callable From m Task See Also localtime_r time gmti
405. rns a memory segment to the region from which it was allocated include lt psos h gt unsigned long rn_retseg unsigned long rnid region identifier void seg_addr segment address Description This system call returns a memory segment back to the region from which it was allocated The pSOS Region Manager then performs whatever compaction is possible and puts the resulting free memory block in the region s free list for future allocation The segment address specified must be identical to the one returned by the original rn_getseg call Otherwise the pSOS kernel will reject the segment Arguments rnid Specifies the segment s region of origin seg_addr Specifies the starting address of the segment as returned by rn_getseg Return Value This call returns O on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Region has been deleted 0x06 ERR_OBJID rnid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x23 ERR_NOTINR Segment does not belong to this region pSOSystem System Calls 1 117 rn_retseg pSOS System Calls Hex Mnemonic Description 0x24 ERR_SEGADDR Incorrect segment starting address 0x25 ERR_SEGFREE Segment is already unallocated Notes 1 Refer to pSOSystem System Concepts for the algorithms used to merge neighboring free segments
406. rocessor configuration If set the queue s name and qid are sent to the master node for entry in its Global Object Table If the Q_GLOBAL attribute is set and the number of global objects currently exported by the node equals the Multiprocessor Configuration Table entry mc_nglbobj then the queue is not created and ERR_OBJTFULL is returned If the maximum message length as specified by maxlen might require transmission of a packet larger than the KI can transmit as specified in the Multiprocessor Configuration Table entry mc_kimaxbuf then the queue is not created and ERR_KISIZE is returned Callable From a Task See Also q_create q_vident q_vdelete pSOSystem System Calls 1 93 q_vdelete pSOS System Calls q_vdelete Deletes a variable length message queue include lt psos h gt unsigned long q_vdelete unsigned long qid queue identifier Description This system call deletes a variable length message queue Otherwise it is identical to q_delete Arguments qid Specifies the queue ID of the queue to delete Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Queue has been deleted 0x06 ERR_OBJID qid is incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x38 ERR_TATQDEL Informative only tasks were waiting at the queue 0
407. rocessors the return address on the stack is OxFFFFFFFF Xe A restarted task can receive up to four long words of input arguments To facilitate retrieval of these arguments they are passed to the task as if it is invoked as a high level language procedure or function For example if a C task nice has three input arguments it can be declared as follows nice unsigned long a unsigned long b unsigned long c where targs 0 is passed to a targs 1 to b and targs 2 to c In this case targs 3 is irrelevant and does not need the calling task to load it Return Value This system call returns 0 on success or an error code on failure 1 150 pSOSystem System Calls pSOS System Calls Error Codes Hex 0x05 0x06 0x07 OxOD 0x13 0x53 Notes 1 Even though t_restart Mnemonic ERR_OBUDEL ERR_OBJID ERR_OBUTYPE ERR_RSTFS ERR_NACTIVE ERR_ILLRSC t_restart Description Task already deleted tid is incorrect failed validity check Object type doesn t match object ID failed validity check Information only possible file corruption on restart Cannot restart this task never started Task not created on this node resets the task s stacks the stacks contents remain intact The stack frame and any automatic variables it contains for the task s outermost procedure should remain intact despite restart until something is stored into it or it is initialized
408. rogram not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors 2 111 symlink_f pHILE System Calls symlink_f Creates a symbolic link to a file unsigned long symlink_f char namel a string used in creating the symbolic link char name2 the name of the file to be created Volume Types NFS volumes Description symlink_f creates a symbolic link name1 in the file name2 The files do not need to be on the same volume The file to which the symbolic link points is used when an open_ f is performed on the link A stat_f performed on a symbolic link returns the linked to file whereas lstat_f returns information about the link itself read_link can be used to read the contents of a symbolic link Arguments namel Points to the null terminated pathname of the symbolic link name2 Points to the null terminated pathname of the file Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description Ox2001 E_FUNC Invalid function number 0x200C E_IFN Illegal pathname 0x200D E_NDD No default directory 2 112 pSOSystem System Calls pHILE System Calls Hex 0x2025 0x2026 0x2051 0x2052 0x2054 0x2055 0x2057 0x2058 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078
409. rom a Task a ISR See Also setlocale strxfrm pSOSystem System Calls strcoll 3 147 strcpy pREPC System Calls strcpy Copies one string to another string include lt string h gt char strcpy char s1 destination string const char s2 source string Description This function copies one string s2 including the null character into another string s1 strcpy continues to copy characters until it detects a null terminator If the strings overlap the result is unpredictable Arguments sl Points to the destination string s2 Points to the source string Return Value This function returns the value of s1 Error Codes None Notes Callable From a Task a ISR 3 148 pSOSystem System Calls pREPC System Calls strcspn strespn Calculates the length of a substring include lt string h gt size_t strcspn const char s1 candidate string const char s2 reference string Description This function calculates the length of the maximum initial segment of a string s1 which consists entirely of characters not in another string s2 Arguments sl Points to the string to be examined s2 Points to the reference string Return Value This function returns the length of the segment Error Codes None Notes Callable From m Task ISR pSOSystem System Calls 3 149 strerror pREP C System Calls strerror Maps an error number to an error message string
410. ror Codes Refer to Appendix B pSOSystem System Calls 3 51 fread Notes Callable From m Task See Also fwrite fopen 3 52 pREPC System Calls pSOSystem System Calls pREPC System Calls free free Deallocates memory include lt stdlib h gt void free void ptr pointer to memory segment Description This function deallocates a specified memory segment pt r If the memory segment was not previously allocated by calloc malloc or realloc or if the space has been deallocated by a call to free or realloc the results are unpredictable Arguments ptr Points to the memory segment to deallocate Return Value This function does not return a value If an error occurs errno is set Error Codes Refer to Appendix B Notes free calls the pSOS region manager to deallocate the memory Callable From a Task See Also calloc malloc realloc pSOSystem System Calls 3 53 freopen pREPC System Calls freopen Reopens a file include lt stdarg h gt include lt stdio h gt FILE freopen const char filename filename const char mode access mode FILE stream stream pointer Description The freopen function first closes the file specified by st ream Then it opens the file named by the string pointed to by filename and associates it with the stream pointed to by stream The file is opened in the mode specified by mode which is interprete
411. ror code on failure 2 10 pSOSystem System Calls pHILE System Calls Error Codes Hex 0x2006 0x2007 0x2008 0x2021 0x2024 0x2025 0x2041 0x2051 0x2061 0x2062 0x2063 0x2064 pSOSystem System Calls Mnemonic E_MNTFULL _VAL _MAXLOOP E_NCDVOL _CD CD FSIZE BSIZE VOL E Ei __CDE MT cdmount_vol Description Attempted to mount too many volumes Wrong volume format Volume already mounted Illegal device exceeded maximum Illegal synchronization mode Illegal device name Buffers not available for block size Symbolic links nested too deeply Configuration Table shows no CD ROM volume in the system Cannot support multivolume CD ROM set Volume not made with 2K block size Volume format not ISO 9660 compliant 2 11 cdmount_vol pHILE System Calls Notes 1 A CD ROM volume does not need volume initialization 2 The number of volumes that can be mounted simultaneously in the system cannot exceed the pHILE Configuration Table parameter fc_nmount 3 The pHILE file system manager does not attempt verification or any other way of determining volume ownership Any task can perform a cdmount_vol A mounted device does not retain a record of the task that mounted it Therefore a volume is not automatically unmounted when the task that mounted it is deleted This and any other security measures if
412. rors 2 41 fstat_vfs pHILE System Calls See Also stat_vfs 2 42 pSOSystem System Calls pHILE System Calls ftruncate_f ftru ncate_f Changes the size of a file specified by its file identifier include lt phile h gt unsigned long ftruncate_f unsigned long fid file identifier unsigned long length file size in bytes Volume Types pHILE MS DOS and NFS formatted volumes Description ftruncate_f functions the same as truncate_f except that ftruncate_f changes the size of a file by using the file identifier instead of the pathname The file identifier is first obtained with either open_f or open_fn Unlike annex_f this system call changes both the logical and the physical file size annex_f changes only the physical file size On pHILE or MS DOS volumes the file must have been opened only once that is no other task has it open and the calling task has opened it only once If this is violated the error E_FOPEN is returned On pHILE or MS DOS volumes if the file is truncated shorter than its L_ptr the L_ptr is changed to the new end of file Arguments fid Specifies the file identifier associated with the file length Specifies the new file size If the file was previously longer than length the extra bytes are truncated If it was shorter the bytes between the old and new lengths are filled with O s Return Value This system call returns 0 on success or
413. rror Codes pHILE error codes are returned as function return values rather than an errno variable Table B 3 lists all error codes returned by the pHILE component Each listing includes the error code s hexadecimal number it s mnemonic and descrip tion and the pHILE system calls that can return it The error code mnemonics are also defined in lt phile h gt pHILE Error Codes An asterisk next to an error code s description indicates that it can represent an NFS or RPC error Sections B 2 2 and B 2 3 beginning on page B 35 provide tables of the NFS and RPC error codes that are mapped to pHILE error codes TABLE B 3 pHILE Error Codes Hex Mnemonic and Description System Call s 0x2001 E_FUNC Invalid function number The function access_f chmod_f number passed to pHILE in register DO L does chown_f fchmod_f not contain a code corresponding to a valid fchown_f pHILE system call ftruncate_f link_f lstat_f make_dir read_link symlink_f truncate_f utime_f 0x2002 E_FAIL pHILE failure An internal error has Should never happen been detected by the pHILE file system man ager Report this error condition to Integrated Systems 0x2003 E_BADVOL Inconsistent data on volume volume change_dir corrupted The data structures on the volume are inconsistent with each other This is most likely the result of a crash while the pHILE file system manager was writing to the volume On
414. rtition identifier unsigned long nbuf number of buffers created Description This service call enables a task to create a new memory partition from which fixed sized memory buffers can be allocated for use by the application The pSOS kernel takes a portion from the top of this region to use as its Partition Control Block Arguments name paddr laddr length bsize flags 1 48 Specifies the user assigned name for the new partition Specifies the physical memory address of the partition Specifies the logical address of the partition generated after MMU translation laddr is ignored on non MMU systems Specifies the total partition length in bytes Specifies the size of the buffers bsize must be a power of 2 and equal to or greater than 4 Specifies the attributes of the buffer flags is formed by OR ing the following symbolic constants one from each pair which are defined in lt psos h gt For instance to specify that a partition is globally addressable you place the symbolic constant PT_GLOBAL in flags To specify that the partition is globally addressable and that it prohibits deletion with outstanding buffers you place both PT_GLOBAL and PT_NODEL in flags using the following syntax PT_GLOBAL PT_NODEL pSOSystem System Calls pSOS System Calls ptid nbuf Return Value PT_GLOBAL PT_LOCAL PT_DEL PT_NODEL pt_create Partition is globally addre
415. s RN_NODEL outstanding Points to the variable where rn_create stores the region ID of the named region Points to the variable where rn_create stores the actual number of allocatable bytes available in the region This call returns 0 on success or an error code on failure Error Codes 1 108 Hex 0x08 0x1B Ox1C 0x1D Ox1E Mnemonic na RR_OBJTFULL ERR_RNADDR Gl ERR_UNITSIZI ERR_TINYUNIT ERR_TINYRN Description Node s object table full Starting address not on long word boundary Illegal unit_size not a power of 2 or not greater than or equal to 16 Length too large for given unit_size Cannot create region length too small to hold RNCB pSOSystem System Calls pSOS System Calls rn_create Notes 1 Internally the pSOS kernel treats a region name as a 32 bit integer However when the application calls the kernel through the pSOS C language API it passes the region name as a four byte character array 2 The pSOS kernel does not check for duplicate region names If duplicate names exist an rn_ident call can return the rnid of any region with the duplicate name 3 A region must consist of physically contiguous memory locations 4 The maximum input length for a region is 32767 times the region s unit size A length that exceeds this limit for a given unit size is treated as an error the remedy for which is a bigger unit size
416. s 3 67 fwrite Notes Callable From m Task See Also fread 3 68 pREPC System Calls pSOSystem System Calls pREPC System Calls getc getc Gets a character from a stream include lt stdarg h gt include lt stdio h gt int getc FILE stream stream pointer Description This function is equivalent to the fgetc function It reads the next character from a specified stream Arguments stream Points to an open pREPC stream Return Value This function returns the character that is read If an end of file condition is detected the stream s end of file indicator is set If a read error occurs the stream s error flag is set In both cases EOF is returned If an error occurs errno is set Error Codes Refer to Appendix B Notes Callable From a Task See Also putc pSOSystem System Calls 3 69 getchar pREPC System Calls getchar Gets a character from stdin include lt stdarg h gt include lt stdio h gt int getchar void Description The getchar function reads the next character from the standard input device It is equivalent to getc stdin Return Value This function returns the character that is read If EOF is detected the stdin EOF flag is set If a read error occurs stdin s error flag is set In both cases EOF is returned If an error occurs errno is set Error Codes Refer to Appendix B Notes Callable From a Task
417. s ERR_SSFN Error Codes Should the call fail if present the node s MC_ASYNCERR routine is invoked and the following error codes can be reported Hex Mnemonic Description 0x05 ERR_OBJDEL Queue has been deleted 0x06 ERR_OBJID qid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x34 ERR_NOMGB Out of system message buffers 0x35 ERR_QFULL Message queue at length limit pSOSystem System Calls 1 63 q_aurgent pSOS System Calls Hex Mnemonic Description Ox3A ERR_VARQ Queue is variable length Ox65 ERR_STALEID Object s node has failed If an MC_ASYNCERR routine is not provided the pSOS m kernel generates a fatal error Notes 1 This call is supported only by the pSOS m kernel 2 The calling task can be preempted as a result of this call 3 q_aurgent asynchronously sends an urgent message to an ordinary message queue Use q_avurgent to asynchronously send an urgent message to a variable length message queue Multiprocessor Considerations 1 If qid identifies a global queue residing on another processor node then the pSOS m kernel will internally make an RSC to that remote node to post the input message to that queue 2 If a task awakened by this call does not reside on the local node then the pSOS m kernel will internally pass the message to the task s node of residence whose pSOS m kernel will ready the task and giv
418. s Gets a string from stdin 3 71 gmt ime Converts the calendar time to broken down time 3 72 gmtime_r Reentrant Converts the calendar time to broken down time 3 73 isalnum Tests for an alphanumeric character 3 75 isalpha Tests for an alphabetic character 3 76 iscntrl Tests for a control character 3 77 isdigit Tests for a digit 3 78 isgraph Tests for a graphical character 3 79 islower Tests for a lowercase letter 3 80 isprint Tests for a printable character 3 81 ispunct Tests for a punctuation character 3 82 isspace Tests for a space 3 83 isupper Tests for an uppercase letter 3 84 A 22 pSOSystem System Calls Tables of System Calls pREPC System Calls TABLE A 4 pREPC System Calls Continued Name Description Page isxdigit Tests for a hexadecimal digit 3 85 labs Computes the absolute value of a long integer 3 86 ldiv Performs a division operation on two specified long integers 3 87 localeconv Obtains the current locale settings 3 89 localtime Converts the calendar time to broken down time 3 92 localtime_r Reentrant Converts the calendar time to broken down time 3 93 malloc Allocates memory 3 95 mblen Determines the number of bytes in a multibyte character 3 96 mbstowcs Converts a multibyte character string into a wide character 3 98 string mbtowc Converts a multibyte character into its wide character equiva 3 100 l
419. s Specifies usage options and is formed by ORing one or more of the following symbolic constants defined in lt pna h gt It can also be set to 0 MSG_00B Specifies that you want sendmsg to send out of band data rather than the regular in band data MSG_DONTROUTE Specifies that you want sendmsg to turn on the socket flag SO_DONTROUTE for the du ration of the operation The SO_DONTROUTE flag prohibits routing of outgoing data from the socket Packets directed at unconnected nodes are dropped 4 60 pSOSystem System Calls pNA System Calls Return Value sendmsg This system call returns the number of bytes sent or 1 if an error occurred Error Codes Hex 0x5009 0x500D 0x5016 0x5020 0x5023 0x5027 0x5028 0x5031 0x5033 0x5036 0x5037 0x5038 0x5039 0x5041 See Also send Mnemonic EBADS EACCESS EINVALID EPIPE EWOULDBLOCK EDESTADDRREO EMSGSIZE EADDRNOTAVAIL ENETUNREACH ECONNRESET ENOBUFS EISCONN ENOTCONN EHOSTUNREACH sendto socket pSOSystem System Calls Description The socket descriptor is invalid The broadcast option is not set for this socket An argument is invalid The connection is broken This operation would block and the socket is marked non blocking The destination address is invalid The data cannot be transmitted as a unit The specified address is not
420. s are copied into the destination string until the specified number have been written If the length of the source string is greater than or equal to the specified number of characters no null characters are appended to s1 Arguments sl Points to the destination string s2 Points to the source string n Specifies the number of characters write Return Value This function returns the value of s1 Error Codes Refer to Appendix B Notes Callable From a Task ISR pSOSystem System Calls 3 159 strpbrk pREPC System Calls strpbrk Searches a string for a character in a second string include lt string h gt char strpbrk const char s1 search string const char s2 reference string Description This function locates the first occurrence in one string s1 of any character in another string s2 Arguments sl Points to the string to be searched s2 Points to the reference string Return Value The function returns a pointer to the first matching character If no character from s2 is found in s1 the function returns a null pointer Error Codes None Notes Callable From m Task a ISR 3 160 pSOSystem System Calls pREPC System Calls strrchr strrchr Searches a string for a character include lt string h gt char strrchr const char s search string int c reference character Description This function locates the last occurrence of c converted to a char in a s
421. s not supported by pREPC Error Codes None Notes Callable From a Task See Also gmtime_r time localtime localtime_r mktime 3 72 pSOSystem System Calls pREPC System Calls gmtime_r gmtime_r Reentrant Converts the calendar time to broken down time include lt time h gt struct tm gmtime_r const time_t timer calendar time struct tm resultp result Description gmtime_r is the reentrant version of the ANSI function gmt ime as defined by POSIX 1003 1c It converts the calendar time pointed to by t imep into broken down time expressed as Coordinated Universal Time UTC The broken down time is stored in the structure pointed to by resultp The calendar time is generally obtained through a call to time Arguments timer Points to the calendar time resultp Points to the structure of type tm where gmtime_r stores the result The tm structure is defined in the mktime description on page 3 111 Return Value gmt ime_r always returns NULL since the concept of UTC is not supported by PREPC Error Codes No error codes are returned pSOSystem System Calls 3 73 gmtime_r pREPC System Calls Notes Callable From a Task ISR See Also gmtime time localtime localtime_r mktime 3 74 pSOSystem System Calls pREPC System Calls isalnum Tests for an alphanumeric character isalnum include lt ctype h gt int isalnum int c character De
422. s of a file specified by its file identifier 2 35 fstat_vfs Obtains statistics about a mounted volume specified by a file 2 39 identifier ftruncate_f Changes the size of a file specified by its file identifier 2 43 get_fn Obtains the file number of a file 2 46 init_vol Initializes a pHILE formatted volume 2 49 link_f Creates a hard link between two files on the same volume 2 53 lock_f Locks or unlocks part or all of an open file 2 56 lseek_f Repositions for read or write within an open file 2 58 lstat_f Gets the status of a symbolically linked file 2 61 make_dir Creates a directory file 2 65 mount_vol Mounts a pHILE formatted volume 2 68 move_f Moves renames a file 2 70 nfsmount_vol Mounts a remote file system 2 73 open_dir Opens a directory file 2 76 open_f Opens a file 2 78 open_fn Opens a file by its file identifier 2 83 pcinit_vol Initializes an MS DOS volume 2 85 pcmount_vol Mounts an MS DOS volume 2 88 read_dir Reads directory entries in a file system independent format 2 90 pSOSystem System Calls A 19 pREPC System Calls TABLE A 3 pHILE System Calls Continued Tables of System Calls Name Description Page read_f Reads from a file 2 93 read_link Reads the value of a symbolic link 2 96 read_vol Reads directly from a pHILE formatted volume 2 99 remove_f Deletes a file 2 101 stat_f Gets the status of a named file 2 104 stat_vfs Gets statistics for a named v
423. s of remote in path A hard error occurred at a remote site Task does not have access permissions Stale NFS file handle No such device or address No such device CD ROM volume illegal operation RPC authorization is not available Portmap failure on the host NFS call timed out pSOSystem System Calls pHILE System Calls Hex 0x2074 0x2075 0x2076 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E See Also chmod_f pSOSystem System Calls Mnemonic E _ ENOAUTHBLK E _ ECANTSEND E _ ECANTRECV PD ROBUNAVAIL EPROGVERSMISMATCH ECANTDECODEARGS EUNKNOWNHOST EPROGNOTREGISTERED E_UNKNOWNPROTO stat_f EINTR ERPC fstat_f open_f fchmod_f Description No RPC authorization blocks available Failure in sending call Failure in receiving result Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors chown_f fchown_f 2 31 fchown_f pHILE System Calls fchown_f Changes the owner or group of a file specified by its file identifier unsigned long fchown_f unsigned long fid file identifier int owner new user ID int group new group ID Volume Types NFS formatted volumes Description fchown_f
424. s of socket descriptors may be specified a set of sockets from which to read a set to which to write and a set that may have pending exceptional conditions Each set is actually a structure containing an array of long integer bit masks The size of the array is set by the definition of FD_SETSIZE in lt pna h gt The array is long enough to hold one bit for each FD_SETSIZE socket descriptor If select returns successfully the three sets indicate which socket descriptors can be read which can be written to or which have exceptional conditions pending A timeout value may be specified Arguments width Specifies the largest descriptor list given by readset writeset or exceptset readset Points to a set of sockets from which to read writeset Points to a set of sockets to which to write exceptset Points to a set of sockets that may have an exceptional condition pending 4 54 pSOSystem System Calls pNA System Calls timeout Usage Macros select Specifies a timeout option If the fields in timeout are set to 0 select returns immediately If the timeout is a null pointer select blocks until a descriptor is selectable The structure timeval is defined in the file lt pna h gt and has the following for mat struct timeval long tv_sec number of seconds long tv_usec number of microseconds The status of a socket descriptor in a select mask can be tested with the FD_ISSET
425. s or minus HUGE_VAL is returned If the correct value would cause underflow O is returned If either of these two errors occurs errno is set The pREPC library returns double values including floating point in the CPU register pair designated by the compiler to receive a return value of type double from a function call when a hardware floating point is not selected Additionally if pSOSystem System Calls pREPC System Calls strtod the FPU bit is set in the processor type entry of the Node Configuration Table the pREPC library also places the floating point value in the floating point register designated by the compiler to receive a return value of type double when a hardware floating point is selected Callable From a Task Error Codes Refer to Appendix B See Also atoi atol atof pSOSystem System Calls 3 165 strtok strtok pREPC System Calls Searches a string for tokens include lt string h gt char strtok char s1 search string const char s2 delimiter s Description A series of calls to the strtok function breaks a string s1 into a sequence of tokens each of which is delimited by a character in a second string s2 A token is a sequence of one or more characters The first call to strtok has s1 as its first argument and is followed by calls with a null pointer as their first argument On the first call to st rtok s1 is passed as a pointer to the string t
426. s successfully renamed If an error occurs errno is set and a nonzero value is returned Error Codes Refer to Appendix B 3 126 pSOSystem System Calls pREPC System Calls rename Notes Callable From a Task pSOSystem System Calls 3 127 rewind pREPC System Calls rewind Resets the file position indicator include lt stdarg h gt include lt stdio h gt void rewind FILE stream stream pointer Description The rewind function sets the file position indicator for the stream pointed to by stream to the beginning of the file It is equivalent to void fseek stream OL SEEK_SET except that the stream s error indicator is cleared Arguments stream Points to an open pREPC stream If stream refers to an I O device this function does nothing and returns a 0 Return Value This function does not return a value Error Codes Refer to Appendix B 3 128 pSOSystem System Calls pREPC System Calls Notes Callable From m Task See Also ftell fgetpos fsetpos fseek pSOSystem System Calls rewind 3 129 scanf pREPC System Calls scanf Reads formatted input from stdin include lt stdarg h gt include lt stdio h gt int scanf const char format format control arguments 1 through n Description The scanf function is equivalent to fscanf except that scanf takes the input from the standard input device Arguments format Points
427. s that a program is operating correctly include lt assert h gt void assert int expression test expression Description The assert macro defined in the header file assert h writes error information to stderr if the expression expression evaluates to zero The error information includes the text of the argument the name of the source file and the source line number The last two of these are respectively the values of the preprocessing macros _ FILE_ and __LINE If expression does not evaluate to zero assert does nothing Arguments expression Specifies the expression to be evaluated Return Value The assert macro returns no value Error Codes None Notes Callable From a Task 3 8 pSOSystem System Calls pREPC System Calls atof atof Converts a string to a double include lt stdlib h gt double atof const char nptr string Description This function converts the initial part of the string pointed to by nptr to a double representation Leading white spaces are ignored The argument nptr can be in scientific exponential form for example 123 45e 67 123 45E 67 This function stops parsing nptr when it detects a character inconsistent with a double data type If the first nonwhite space character is other than a sign a digit or a decimal point a value of O is returned Except for the behavior on error this call is equivalent to strtod str char NULL Ar
428. s that are contained in the multibyte character if the next n or fewer bytes form a valid multibyte character or returns 1 if they do not form a valid multibyte character Error Codes None 3 96 pSOSystem System Calls pREPC System Calls Notes Callable From a Task m ISR See Also mbtowc pSOSystem System Calls mblen 3 97 mbstowcs pREPC System Calls mbstowcs Converts a multibyte character string into a wide character string include lt stdlib h gt size_t mbstowcs wchar_t pwcs wide string const char s original multibyte string size tn wide string length Description The mbstowcs function converts a sequence of multibyte characters that begins in the initial shift state from the array pointed to by s into a sequence of corresponding codes and stores not more than n codes into the array pointed to by pwcs No multibyte characters that follow a null character which is converted into a code with value zero will be examined or converted Each multibyte character is converted as if by a call to the mbtowc function except that the shift state of the mbtowc function is not affected If copying takes place between objects that overlap the behavior is undefined Arguments pwcs Points to the array where mbstowcs stores the converted string s Points to the string to be converted n Specifies the length of pwcs Return Value If an invalid multibyte character is
429. s the difference between two calendar times include lt time h gt double difftime time t timel finish time time t time0 start time Description The difftime function computes the difference in seconds between two calendar times timel time0 Arguments timel Specifies the finish time time0 Specifies the start time Return Value The difftime function returns the difference expressed in seconds as a double Error Codes None Notes Callable From a Task See Also time 3 24 pSOSystem System Calls pREPC System Calls div div Performs a division operation on two specified integers include lt stdlib h gt div_t div int numer numerator int denom denominator Description The div function computes the quotient and remainder of the division of the numerator numer by the denominator denon If the division is inexact the resulting quotient is the integer of lesser magnitude that is the nearest to the algebraic quotient If the result cannot be represented the behavior is undefined otherwise quot denom remis equal to numer Arguments numer Specifies the numerator denom Specifies the denominator Return Value The div function returns a structure of type div_t This structure is defined in stdlib h as follows typedef struct int quot the quotient int rem the remainder div t Error Codes None pSOSystem System Calls 3 25 div
430. s the length of s Contains zero or more conversion specifiers and ordinary multibyte characters A conversion specifier consists of a character followed by a character that determines the behavior of the conversion specifier Each conversion specifier is replaced by appropriate characters as described in the following list The appropriate characters are determined by the LC_TIME category of the current locale see setlocale on page 3 134 and by the values contained in the structure pointed to by timeptr Sa Replaced by the locale s abbreviated weekday name SA Replaced by the locale s full weekday name sb Replaced by the locale s abbreviated month name B Replaced by the locale s full month name 3 151 strftime pREPC System Calls SC Replaced by the locale s appropriate date and time representation sd Replaced by the day of the month as a decimal number 01 31 SH Replaced by the hour 24 hour clock as a decimal number 00 23 SI Replaced by the hour 12 hour clock as a decimal number 01 12 j Replaced by the day of the year as a decimal 1 366 Sm Replaced by the month as a decimal number 01 12 SM Replaced by the minute as a decimal number 00 59 Sp Replaced by the locale s equivalent of the AM PM designations associated with a 12 hour clock SS Replaced by the second as a decimal number 00 61 SU Replaced by the week of the year where Sunday is the first day of a week 0 52 Sw Replac
431. s to an I O device this function does nothing and returns a zero Arguments stream Points to an open pREPC stream Return Value If successful this function returns the current file position indicator It returns EOF if an error occurs and sets the errno Error Codes Refer to Appendix B pSOSystem System Calls 3 65 ftell Notes Callable From m Task See Also fseek fsetpos fgetpos 3 66 pREPC System Calls pSOSystem System Calls pREPC System Calls fwrite fwrite Writes to a stream include lt stdarg h gt include lt stdio h gt size t fwrite const void ptr output buffer size_t size item size size t nmemb item count FILE stream stream pointer Description The fwrite function writes from the array pointed to by ptr up to nmemb elements whose size is specified by size to the stream pointed to by st ream The file position indicator for the stream if defined is advanced by the number of characters successfully written If an error occurs the resulting value of the file position indicator for the stream is indeterminate Arguments ptr Points to the output buffer size Specifies the size of each item to write nmemb Specifies the number of items to write stream Points to an open pREPC stream Return Value This function returns the number of items written If an error occurs errno is set Error Codes Refer to Appendix B pSOSystem System Call
432. s usable RTF_DYNAMIC Route is added dynamically using the ICMP Redirect mes sage RTF_MODIFIED Route is modified using the ICMP Redirect message RTF_INTF Route includes intf num RTF_MASK Route includes subnet mask Network Node ID Operations The following operations are available for accessing the pNA Network Node ID This is also known as the Router ID The Network Node ID may be equal to any one of the IP addresses assigned to the node To set or get the Network Node ID arg must point to an in_addr structure containing the IP address Operation Description SIOCSNNODEID Sets the Network Node ID SIOCGNNODEID Gets the Network Node ID Setting the IP TTL Each IP packet sent by pNA TCP UDP or Raw IP is assigned a TTL value pNA assigns a default TTL value of 64 for outgoing UDP and TCP packets as per RFC 1700 Note that this system wide default value affects all sockets The system wide pSOSystem System Calls pNA System Calls ioctl default TTL value may be accessed by the IP group MIB commands SIOCGIPDEFAULTTTL and SIOCSIPDEFAULTTTL ICMP and Raw IP packets are assigned a fixed default TTL value for 255 This system wide default TTL value cannot be changed For UDP IP multicast packets the default TTL value is defined to be 1 but may be modified using the setsockopt call The following operations are available to change the TTL value on a per socket connection basis Initially the per socket TTL is s
433. s1 candidate string const char s2 candidate string Description This function compares two character strings and returns a value that reflects whether the first string s1 is greater than equal to or less than the second string s2 Arguments sl Points to the first string s2 Points to the second string Return Value This function returns a value greater than equal to or less than 0 depending on whether the string pointed to by s1 is greater than equal to or less than the string pointed to by s2 Error Codes None Notes Callable From m Task ISR pSOSystem System Calls 3 145 strcoll pREPC System Calls strcoll Compares two character strings include lt string h gt int strcoll const char s1 candidate string const char s2 candidate string Description The strcoll function compares the string pointed to by s1 to the string pointed to by s2 The comparison is performed relative to the current locale You can specify the locale by using the setlocale function See setlocale on page 3 134 Arguments sl Points to the first string s2 Points to the second string Return Value This function returns a value greater than equal to or less than 0 depending on whether the string pointed to by s1 is greater than equal to or less than the string pointed to by s2 Error Codes None 3 146 pSOSystem System Calls pREPC System Calls Notes Callable F
434. scription This function tests the value in c converted to an unsigned char to see if it is an alphanumeric character An alphanumeric character is a character for which either isdigit or isalpha is true Arguments Specifies the value to be tested Return Value This function returns a nonzero value if the test result is true It returns a O if the result is false Error Codes Refer to Appendix B Notes Callable From a Task a ISR See Also isalpha isdigit pSOSystem System Calls 3 75 isalpha pREP C System Calls isalpha Tests for an alphabetic character include lt ctype h gt int isalpha int c character Description This function tests the value in c converted to an unsigned char to see if it is an uppercase or lowercase letter Arguments c Specifies the value to be tested Return Value This function returns a nonzero value if the test result is true It returns a O if the result is false Error Codes Refer to Appendix B Notes Callable From m Task ISR 3 76 pSOSystem System Calls pREPC System Calls iscntrl iscntrl Tests for a control character include lt ctype h gt int iscntrl int c character Description This function tests the value in c converted to an unsigned char to see if it is an ASCII control character ASCII control characters are those whose values lie between O and 31 inclusive and the character 127 DEL Argu
435. scription System time and date not yet set Date input out of range Time input out of range Ticks input out of range Too late input date and time already past 1 Atm_set call which changes the date and time directly affects the wakeup established by tm_wkwhen If tm_set advances the time past a scheduled wakeup it triggers the wakeup immediately If necessary the application can detect this situation by checking the time when the task awakens and comparing that time to the expected time 2 A task can be suspended while it waits for wakeup In this case the wait continues if not cancelled suspension continues after wakeup 3 A task can be deleted while it waits for wakeup Multiprocessor Considerations None This call affects only the calling task Callable From m Task ISR See Also tm_tick tm_wkafter pSOSystem System Calls 1 183 tm_wkwhen pSOS System Calls 1 184 pSOSystem System Calls pHILE System Calls This chapter provides detailed information on each system call in the pHILE component of pSOSystem The calls are listed alphabetically with a multipage section of information for each call Each call s section includes its syntax the volume types it applies to a detailed description its arguments its return value and any error codes that it can return Where applicable the section also includes
436. scription of the fault m An indication of whether or not the fault is correctable faultp performs its own check and returns a status code in the register supported by pHILE which is processor specific The register used on each processor family is specified in Target on page 2 128 The status code faultp returns must be one of the following Code Description 0 Continue volume verification without correcting the fault 1 Correct fault and continue volume verification 2 Terminate volume verification If status 1 is returned verify_vol makes modifications to the volume which correct the fault In most cases the obvious modification is made Less obvious modifications are described in Bad Blocks on page 2 139 Note that status 1 pSOSystem System Calls 2 131 verify_vol 2 132 pHILE System Calls correct fault should be returned only if the FDB indicates the fault is fixable refer to the FDB description below If status 1 is returned for a non fixable fault it is ignored and verification continues If verify_vol is being used simply to verify volume correctness then when called faultp can return a status of 0 which continues the rest of volume verification or a status of 2 which terminates verify_vol and returns an error to the caller verify_vol can also be integrated into a volume repair utility with an operator interface This utility should implement faultp so that it will m
437. se size is specified by size and whose value is indeterminate malloc calls the pSOS region manager to allocate the memory The caller can be blocked if memory is not available and the wait option is selected in the pREPC Configuration Table Memory is allocated from Region 0 Arguments size Specifies the number of bytes to allocate Return Value This function returns either a pointer to the allocated memory or a null pointer if no memory is allocated If an error occurs errno is set Error Codes Refer to Appendix B Notes Callable From a Task pSOSystem System Calls 3 95 mblen pREPC System Calls mblen Determines the number of bytes in a multibyte character include lt stdlib h gt int mblen const char s character size t n size of character Description If s is not a null pointer the mblen function determines the number of bytes contained in the multibyte character pointed to by s Except that the shift state of the mbtowc function is not affected it is equivalent to mbtowc wchar_t 0 s n Arguments s Points to the character to be examined n Specifies the size of s Return Value If s is a null pointer this function returns a nonzero or zero value if multibyte character encodings respectively do or do not have state dependent encodings If s is not a null pointer this function either returns 0 if s points to the null character or returns the number of byte
438. sist of all character handling functions and all string handling functions except strtok Other pREPC functions cannot be called from compar Callable From a Task m ISR See Also qsort 3 16 pSOSystem System Calls pREPC System Calls calloc calloc Allocates memory include lt stdlib h gt void calloc size_t nmemb number of allocation units size_t size size of allocation unit Description The calloc function allocates memory for nmemb data objects each of whose size is specified by size The allocated memory is initialized to 0 Arguments nmemb Specifies the number of data objects for which calloc allocates memory size Specifies the size of each data object Return Value This function returns a pointer to the memory allocated or a null pointer if no memory is allocated If an error occurs errno is set Error Codes Refer to Appendix B Notes 1 calloc calls the pSOS region manager to allocate the memory 2 Memory is always allocated from Region 0 3 The caller can be blocked if memory is not available and the wait option is selected in the pREPC Configuration Table pSOSystem System Calls 3 17 calloc Callable From m Task See Also free malloc realloc 3 18 pREPC System Calls pSOSystem System Calls pREPC System Calls clearerr clearerr Clear s a stream s error indicators include lt stdarg h gt include lt stdio h gt void clearerr FIL
439. sor mode Thus a task can have only a supervisor stack On these processors ustack is added to sstack to create a supervisor stack of the combined sizes Exceptions to this usage are shown below 68K CF PPC On 68K processors a task can execute in either user mode or supervisor mode A user stack is not needed if the task never executes in the user mode in which case ustack should be set to O If the task starts in the user mode then ustack must be greater than 20 bytes The supervisor user mode is set in the t_start system call On ColdFire and PowerPC processors a task can execute in either user mode or supervisor mode but there are not separately defined stacks depending on this mode t_create simply adds sstack and ustack together and allocates a stack of that resultant size pSOSystem System Calls pSOS System Calls T t create On ARM processors a task can execute in either user mode or supervisor mode A user stack is not needed if the task never executes in the user mode in which case ustack is set to O If the task starts in the user mode then ustack must be greater than 80 bytes to accommodate the requirements of the interrupt handler The supervisor user mode is set in the t_start system call Supervisor Stack Size Supervisor stack size is processor dependent PPC ARM 960 x86 On PowerPC and ARM processors the stack size should be no less than 512
440. sor specific information about the call The information appears next to an icon representing the processor in question as below On 68K processors a signal is passed to the ASR in the DO L register 68K If the information is also specific to a set of host tools a host tool icon appears next to the processor icon as below For 68K processors with pRISM host tools the formula is the following SIZE 32 4 VSIZE 16 NFD 42 MAXDEPTH 68K pRISM Return Value Lists the possible return values of the call For example pSOS system calls always return a O to indicate a successful call and pREPC calls can return either a non zero value if the test result is true or O if it is false The Error Codes section lists possible errors returned by each call Error Codes Provides a list of the error codes that the call can generate For pSOS and pHILE system calls an error code returns as a system call return value For other compo nents such as the pREPC component library and the pNA network manager er ror codes are loaded into an internal variable that can be read through the macro errno Appendix B contains a complete list of error codes for each software compo nent X pSOSystem System Calls Using This Manual Conventions Usage Provides detailed usage information for certain system calls For instance the verify_vol call of the pHILE component performs multiple actions that re qui
441. ssable by other nodes partition can be addressed only the by local node The single processor version of the pSOS kernel ignores PT_GLOBAL Deletion of the partition with pt_delete is enabled even if one or more buffers are allocated Deletion of the partition is prohibited unless all buffers have been freed Points to the variable where pt_create stores the partition ID of the named partition Points to the variable where pt_create stores the number of actual buffers in the partition This call returns 0 on success or an error code on failure Error Codes Hex 0x08 0x28 0x29 Ox2A Notes Mnemonic ER ER R_OBJTFULL R_PTADDR ER R_BUFSIZE R_TINYPT Description Node s object table full Starting address not on long word boundary Buffer size not power of 2 or less than 4 bytes Length too small to hold the partition control information 1 Internally the pSOS kernel treats a partition name as a 32 bit integer However when the application calls the kernel through the pSOS C language API it passes the partition name as a four byte character array 2 The pSOS kernel does not check for duplicate partition names If duplicate names exist a pt_ident call can return the ptid of any partition with the duplicate name pSOSystem System Calls 1 49 pt_create pSOS System Calls Multiprocessor Considerations 1 The PT_GLOBAL attribute should be set only if the
442. ssembly languages pROBE User s Manual describes how to use the pROBE target debugger ana lyzer Based on the options you have purchased you might also need to refer to one or more of the following manuals C Support Package User s Guide describes how to implement C applications in a pSOSystem environment SpOTLIGHT Debug Server User s Guide describes how to use the SpOTLIGHT de bugger to debug pSOSystem applications ESp User s Guide documents the ESp front end analyzer which displays appli cation activities and the pMONT component the target resident application monitor pSOSystem System Calls xiii Support Using This Manual m ODpEN User s Guide describes how to install and use pSOSystem s OPEN Open Protocol Embedded Networking product m SNMP User s Guide describes the internal structure and operation of SNMP In tegrated System s Simple Network Management Protocol product This manual also describes how to install and use the SNMP MIB Management Information Base compiler Support xiv Customers in the United States can contact Integrated Systems Technical Support as described below International customers can contact m The local Integrated Systems branch office m The local pSOS distributor m Integrated Systems Technical Support as described below Before contacting Integrated Systems Technical Support please gather the informa tion called for in Table 1 on page xvi The detailed
443. st_atime file last access time time_t st_mtime file last modify time time_t st_ctime file last status change time long st_blksize optimal block size for I O ops long st_blocks file size in blocks 2 104 pSOSystem System Calls pHILE System Calls stat f This structure cannot be packed mode_t ino_t dev_t nlink_t uid_t gid_t off_t and time_t are defined as unsigned long in lt phile h gt The following differences exist for local file systems pHILE MS DOS and CD ROM rdev dev mtime nlink 1 uid 0 gid 0 atime ctime The status information word st_mode contains the following bits IFMT IFIFO IFCHR IFDIR IFBLK IFREG IFLNK IFSOCK S_ISUID S_ISGID S_ISVTX S_IRUSR S_IWUSR S_IXUSR S_IRGRP S_IWGRP S_IXGRP S_IROTH S_IWOTH S_IXOTH Return Value 0170000 0010000 0020000 0040000 0060000 0100000 0120000 0140000 0004000 0002000 0001000 0000400 0000200 0000100 0000040 0000020 0000010 0000004 0000002 0000001 type of file fifo special character special directory block special regular file symbolic link socket set user ID on execution set group ID on execution save swapped text even after use read permission owner write permission owner execute search permission owner read permission group
444. start address and execution mode are reset to the original values established by t_start Any pending events signals or armed timers are cleared The t_restart call accepts a new set of up to four arguments which among other things can be used by the task to distinguish between the initial startup and subsequent restarts Because it can unconditionally unblock a task and alter its flow of execution t_restart is useful for forcing a task to execute cleanup code on its own behalf after which the task can delete itself by executing t_delete The calling task does not have to be the creator or parent of the task it restarts However a task must be restarted from the node on which it was created Arguments tid Specifies the task to restart When tid equals 0 the calling task restarts itself targs Specifies up to four long words of input that are passed to the restarted task pSOSystem System Calls 1 149 t_restart pSOS System Calls Target Startup Values At the start of the task the CPU registers and the stack are initialized in such a way that if the outermost function of the task exits by mistake an illegal error address results The contents of the original registers and stack are platform specific rs On 960 processors the return address RIP on the stack is OxDEADDEAD ie On PowerPC and ARM processors the return address in register LR is OxDEADDEAD ARM On x86 p
445. stem Calls strncmp strncmp Compares characters in two strings include lt string h gt int strncmp const char s1 first string const char s2 second string size tn comparison size Description This function compares up to n characters in two strings and returns a value that reflects whether the characters from the first string s1 are greater than equal to or less than the characters from the second string s2 Characters that follow a null character in the first string are not compared Arguments sl Points to the first string s2 Points to the second string n Specifies the number of characters to compare Return Value This function returns a value greater than equal to or less than O and the value depends on whether the string pointed to by s1 is greater than equal to or less than the string pointed to by s2 Error Codes None pSOSystem System Calls 3 157 strncmp Notes Callable From m Task ISR 3 158 pREPC System Calls pSOSystem System Calls pREPC System Calls strncpy strncpy Copies characters from one string to another include lt string h gt char strncpy char sl destination string const char s2 source string size_t n source length Description This function copies up to n characters from one string s2 to another string s1 If the length of the source string is less than the specified number of characters null character
446. strchr pSOSystem System Calls memchr 3 103 memcmp pREPC System Calls memcmp Compares two objects in memory include lt string h gt int memcmp const void sl1 buffer 1 const void s2 buffer 2 size ton comparison length Description This function compares n characters in the buffers pointed to by s1 and s2 Arguments sl Points to the first buffer s2 Points to the second buffer n Specifies the number of characters to be compared Return Value This function returns a value that is either greater than equal to or less than zero The result depends on whether the object pointed to by s1 is greater than equal to or less than the object pointed to by s2 Error Codes None 3 104 pSOSystem System Calls pREPC System Calls Notes Callable From a Task m ISR See Also strcmp pSOSystem System Calls memcmp 3 105 memcpy pREPC System Calls memcpy Copies characters in memory include lt string h gt void memcpy void s1 destination address const void s2 source address size tn source length Description This function copies n characters from the object pointed to by s2 into the object pointed to by s1 If the memory areas overlap the result is unpredictable Arguments sl Points to the source object s2 Points to the destination object n Specifies the number of characters to be copied Return Value This function returns
447. sts for a punctuation character include lt ctype h gt int ispunct int c character Description This function tests the value in c converted to an unsigned char to see if it is an ASCII punctuation mark character An ASCII punctuation mark character is any printing character that is neither a space nor a character for which isalnum is true Arguments c Specifies the value to be tested Return Value This function returns a nonzero value if the test result is true It returns a O if the result is false Error Codes Refer to Appendix B Notes Callable From m Task ISR See Also isalnum isprint isalpha isdigit 3 82 pSOSystem System Calls pREPC System Calls isspace isspace Tests for a space include lt ctype h gt int isspace int c character Description This function tests the value in c converted to an unsigned char to see if it is a tab t line feed n vertical tab v form feed f carriage return r or space character Arguments Specifies the value to be tested Return Value This function returns a nonzero value if the test result is true It returns a O if the result is false Error Codes Refer to Appendix B Notes Callable From a Task ISR pSOSystem System Calls 3 83 isupper pREPC System Calls isu pper Tests for an uppercase letter include lt ctype h gt int isupper int c character
448. t pSOSystem System Calls pHILE System Calls Hex 0x2077 0x2078 0x2079 0x207A 0x207B 0x207C 0x207D 0x207E See Also truncate_f pSOSystem System Calls Mnemonic E_PROBUNAVAIL EUNKNOWNHOST EPROGVERSMISMATCH ECANTDECODEARGS EPROGNOTREGIST E_UNKNOWNPROTO EINTR ERPC open_f open_fn ftruncate_f Description Program not available Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors 2 45 get_fn pHILE System Calls get fn Obtains the number of a file include lt phile h gt unsigned long get_fn char name filename unsigned long fn file number Volume Types pHILE MS DOS and CD ROM formatted volumes Description get_ fn returns the file number associated with a file The file number can then be used with an open_ fn call or as part of an absolute filename Arguments name Points to the null terminated pathname of the file fn Points to the variable where get_ fn stores the file number Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x2003 E_BADVOL Inconsistent data on volume volume corrupted 0x200A E_DMOUNT Volume not mounted 0x200B E_FNAME Filename not found 0x200C E_IFN Illega
449. t begins at the current position of the connection s L_ptr After write_ f the file s L_ptr is updated to point to the byte after the last byte written This call overwrites the original content of the file If necessary write_f expands the file by allocating space to hold the written data Arguments fid Specifies the file identifier associated with the file buffer Points to the data to write bcount Specifies the number of bytes to write Return Value This system call returns 0 on success or an error code on failure 2 142 pSOSystem System Calls pHILE System Calls Error Codes Hex 0x2003 0x2015 0x201A 0x201B 0x201C 0x201D 0x2022 0x2052 0x2054 0x2055 0x2056 0x2057 0x2058 0x205B 0x205C 0x2060 0x2070 0x2071 0x2072 0x2074 0x2075 0x2076 0x2077 0x2078 Mnemonic E_BADVOL E_RO E_FIDBIG E_FIDOFF E_ININFULL E_VFULL sOCKED EREMOTE EIO _ EACCES _BISDIR _EQUOT _ ESTALE _ ENXIO _ ENODEV E_BADCD _ EAUTH _ ENFS _ ETIMEDOUT _ ENOAUTHBLK _ ECANTSEND _ ECANTRECV E_PROBUNAVAIL E_EPROGVERSMISMATCH pSOSystem System Calls write_f Description Inconsistent data on volume volume corrupted Requested operation not allowed on this file Invalid FID exceeds maximum Invalid FID file closed Index block is full
450. t control string Return Value This function returns the number of characters written If a write error occurs this function returns a negative number and sets errno Error Codes Refer to Appendix B pSOSystem System Calls 3 183 vfprintf Notes Callable From m Task See Also fprintf vprintf vsprintf 3 184 pREPC System Calls pSOSystem System Calls pREPC System Calls vprintf vprintf Writes formatted output to stdout include lt stdarg h gt include lt stdio h gt int vprintf const char format format control va_list char arg argument list Description The vprintf function is equivalent to printf with the variable argument list replaced by arg which should have been initialized by the va_start macro and possibly subsequent va_arg calls The vfprintf function does not invoke the va_end macro Arguments format Points to the format control string For more information see fprintf on page 3 43 arg A list of arguments to be written according to the specifications of the format control string Return Value This function returns the number of characters written If a write error occurs this function returns a negative number and sets errno Error Codes Refer to Appendix B pSOSystem System Calls 3 185 vprintf Notes Callable From m Task See Also printf vfprintf fprintf vsprintf 3 186 pREPC System Calls pSOSystem System Calls pREPC System
451. t_mode stores in old_mode the previous setting of the interrupt control value as stored in the task s TCB called the true mode rather than the value in the task s processor status register called the transient mode These two modes are normally the same The one instance when they can be different is if the task changes the interrupt control value without using t_mode Processor Mode t_mode cannot modify the task s processor mode Most processors only have one processor mode so this is not relevant Exceptions are handled as follows Return Value This system call always returns 0 Error Codes None Notes Multiprocessor Considerations None node Because t_mode affects only the calling task its action stays on the local Callable From a Task pSOSystem System Calls 1 147 t_mode pSOS System Calls See Also t_start 1 148 pSOSystem System Calls pSOS System Calls t_restart t_restart Forces a task to start over regardless of its current state include lt psos h gt unsigned long t_restart unsigned long tid task identifier unsigned long targs 4 startup arguments Description This system call forces a task to resume execution at its original start address regardless of its current state or place of execution If the task was blocked the pSOS kernel forcibly unblocks it The task s priority and stacks are set to the original values that t_create specified Its
452. task does not have the neces sary access permissions The task does not have permission for the requested file operation access_f change_dir chmod_f chown_f close_dir create_ f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f utime_f write_f 0x2056 __EISDIR Illegal operation on a directory If you attempt an operation on a directory as if it were a data file this error is reported move_f read_f remove_f write_f 0x2057 __EQUOT Quota exceeded The server enforces a disk usage quota for each user If this error is reported use the disk less or remove files or have the quota raised create_f ftruncate_f link_f make_dir move_f symlink_f truncate_f write_f B 24 pSOSystem System Calls Error Codes TABLE B 3 pHILE Error Codes Continued pHILE Error Codes server Hex Mnemonic and Description System Call s 0x2058 _ESTALE Stale file handle file handle invalid access_f When a server crashes or there is some other change_dir chmod_f exceptional event file handles no longer are chown_f create_f valid Consider unmounting the file system and fchmod_f fchown_f remounting it fstat_f fst
453. task have preemption turned off and roundrobin by time slicing turned on you place both T_NOPREEMPT and T_TSLICE in new_mode using the following syntax T_NOPREEMPT T_TSLICE The argument mask specifies the bit mask used to permit attribute modifications and as such it must contain both of the symbolic constants from each pair whose attribute is to be modified For instance to enable modification of preemption mode you place both T_PRE EMPT and T_NOPREEMPT in mask To enable modification of both preemption mode and roundrobin mode you place both symbolic constants from both pairs in mask as below T PREEMPT T_NOPREEMPT Interrupt Control T_NOTSLICE T_TSLICE Interrupt control means that while a task is executing hardware interrupts are disabled On some processors you can disable all interrupts at or below a certain interrupt level and enable all interrupts above that level On other processors you pSOSystem System Calls pSOS System Calls t mode can simply specify that all interrupts are either enabled or disabled Details are provided below oe On PowerPC x86 MIPS and ARM processors you can simply enable or disable all hardware interrupts To do this you place both T_ISR and osi T_NOISR in the mask argument and place either T_ISR or T_NOISR in x86 the new_mode argument IMIPS ARM NOTE
454. te such bad blocks perform the following steps 1 Add the failed block to the existing list of bad blocks 2 Invoke verify_vol which will report VF_BBUSE bad block is in use by a particular file 3 By whatever means salvage as much of the file as possible and then delete the file This returns the bad block to the free block pool and clears its corresponding bit 4 Invoke verify_vol again verify_vol now reports VF_BBFRE bad block is marked free Now have faultp use return status 1 to mark the bad block as unavailable for allocation Step 3 may be complicated For example if a bad block occurs within a directory page then the entire directory must be deleted after saving as much of its contents as possible 2 140 pSOSystem System Calls pHILE System Calls verify_vol Note that if verify_vol is to be used to maintain the bitmap in this manner then an updated list of all bad blocks on the volume must be kept Integrated Systems suggests that you store the bad block list itself as a file on the volume See Also mount_vol pSOSystem System Calls 2 141 write_f pHILE System Calls write_f Writes to an open file include lt phile h gt unsigned long write_f unsigned long fid file identifier void buffer output buffer unsigned long bcount output byte count Volume Types All volume types except CD ROM Description write_f writes data into a file I
455. ted structure For example an indirect block descriptor may have LLB 200 meaning that the last block in the last extent in the indirect block is the 200th block in the file verify_vol checks the LLB of every FD indirect block descriptor and index block descriptor and reports any inconsistencies TABLE 2 3 Extent Map Faults VF_EXTFD An FD contains an extent containing an illegal block VF_INFD An FD contains an illegal indirect block number VF_IXFD An FD contains an illegal index block number VF_TBCFD The block count within the FD conflicts with the actual number of blocks in the file VF_LLBFD The LLB in the FD for the first 10 extents is incorrect VF_LLBIN The LLB within an indirect block descriptor within an FD is incorrect pSOSystem System Calls pHILE System Calls verify_vol TABLE 2 3 Extent Map Faults VF_EXTIN An indirect block contains an extent containing an illegal block VF_INIX An index block contains an illegal indirect block number VF_LLBIX Within an index block the LLB associated with an indirect block is incorrect VF_DBDA A directory block resides in the data area of the volume VF_INDA An indirect block resides in the data area of the volume VF_IXDA An index block resides in the data area of the volume Bad Blocks A bad block is a block that cannot be read and or written and therefore cannot be
456. tem Calls pREPC System Calls ctime Callable From m Task See Also asctime asctime_r ctime_r mktime time pSOSystem System Calls 3 21 ctime_r pREPC System Calls ctime_r Reentrant Converts the calendar time to a string include lt time h gt char ctime_r const time_t timer calendar time char buf result buffer int buflen result buffer length Description ctime_r is the reentrant version of the ANSI function ctime as defined by POSIX 1003 1c It converts the calendar time pointed to by timer to a string representation of the form Sun Jan 1 12 30 13 1995 n 0 The time is represented in local time ctime_r stores the string in the buffer pointed to by buf which is assumed to have space for at most buflen characters An error may be returned if the converted string contains more than buflen characters The calendar time is generally obtained through a call to time Arguments timer Points to the calendar time buf Points to the buffer where ctime_r stores the result buflen Specifies the size of buf Return Value Upon success asctime_r returns the value of buf On failure it returns NULL and sets errno Error Codes Refer to Appendix B 3 22 pSOSystem System Calls pREPC System Calls Notes Callable From m Task See Also asctime asctime_r ctime mktime time pSOSystem System Calls ctime_r 3 23 difftime pREPC System Calls difftime Compute
457. tem Calls q_avsend Callable From m Task See Also q_vsend q send q asend q urgent q_vreceive pSOSystem System Calls 1 67 q_avurgent pSOS System Calls q_avurgent pSOS m kernel only Asynchronously posts a message at the head of a variable length message queue include lt psos h gt unsigned long q_avurgent unsigned long qid queue identifier void msg_buf message buffer unsigned long msg_len length of message Description This system call functions the same as q_vurgent except that q_avurgent executes asynchronously Refer to the description of q_vurgent for further information For a more detailed description of asynchronous services refer to the pSOSystem System Concepts manual Arguments qid Specifies the queue identifier msg_buf Points to the message to send msg_len Specifies the length of the message Return Value When called in system running pSOS m this call always returns 0 The pSOS kernel the single processor version returns ERR_SSFN Error Codes The following error codes may be reported if a q_avurgent call fails and the node s MC_ASYNCERR routine if present is invoked Hex Mnemonic Description 0x05 ERR_OBUDEL Queue has been deleted 0x06 ERR_OBJID gid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 1 68 pSOSystem System Calls pSOS System Calls q_avurgent Hex Mnem
458. tem System Calls Contents B 2 3 Conversions of RPC Error Codes B 36 B 3 PREPC Error Codes in ek ip po BIO sso pa See eee ee ees B 38 B 4 PNA ETO COGES e ili iii eli ali ai i B 39 B 5 PRPG Error Codes Pereca regui ree ee eee B 44 B 6 Driver Error Codes un a ae aes ara araa a aaah la B 44 B 6 1 Shared Memory Network Interface Driver Error Codes B 45 B 6 2 Shared Memory Kernel Interface Driver Error Codes B 45 B 6 3 Terminal Interface Driver Error Codes B 46 B 6 4 Tick Timer Driver Error Codes B 47 B 6 5 RAM Disk Driver Error Codes 0 0000 B 48 B 6 6 TFTP Driver Error Codes 0 0 0 2 eo e eee B 48 B 6 7 IDE Driver Error Codes 0 0 00 00002 eee eee B 49 B 6 8 FLP Driver Error Codes 0 0 00 0 0 eee ee eee B 49 B 6 9 SCSI Driver Error Codes 0 000 000 0000 B 50 pSOSystem System Calls V Contents vi pSOSystem System Calls Using This Manual This manual is part of a documentation set that describes pSOSystem the modular high performance real time operating system environment from Integrated Systems Inc This manual is targeted for embedded application developers using the pSOSys tem environment Basic familiarity with UNIX terms and concepts is assumed System Calls contains detailed descriptions of all pSOSystem system calls and error codes For purpose of
459. ter to the ip_mreq structure defined in lt pna h gt The group multicast address to be dropped must be specified in imr_mcastaddr The interface ad dress could be set to INADDR_ANY unless it spec ifies the particular interface for which the group membership must be dropped The structure below is defined in lt pna h gt and used with the IP_DROP_MEMBERSHIP option struct ip_mreq struct in_addr imr_mcastaddr IP multicast address of group struct in_addr imr_interface local IP address of interface pSOSystem System Calls pNA System Calls setsockopt IP_DROP_MEMBERSHIP_INTE Similar to IP_DROP_MEMBERSHIP above The optval is a pointer to the structure ip_mreq_intf defined in lt pna h gt The only difference is that the interface is defined using the interface number If the interface number is specified as 1 then pNA will select the interface based upon the routing table This option is use ful for unnumbered links because the IP address of the interface is not enough to identify the inter face The structure below is defined in lt pna h gt and used with the IP_DROP_MEMBERSHIP_INTF option struct ip_mreq_intf struct in_addr imrif_mcastaddr IP multicast address of group long imrif_ifno local interface number IP_HDRINCL Specifies that the IP header will be included in the output packets The following fields will be set by pNA
460. ter to the files complete pathname This pathname is constructed by verify_vol within the verify_vol work area For faults involving two files contains a pointer to the second file s complete pathname For faults involving a specific block contains the block number of the affected block Indicates whether the fault can be corrected by verify_vol as follows fdb_fixable 0 means fault is not fixable fdb_fixable 1 means fault is fixable Table 2 2 beginning on page 2 134 summarizes for each fault type the contents of each field An X indicates the field is used in describing the fault The last column indicates whether or not the fault is fixable NOTE Footnotes a through f for Table 2 2 are all listed at the end of the table pSOSystem System Calls 2 133 vET 2 syle waysks wash sd TABLE 22 Fault Summary indicate it is a directory Mnemonic Description Hex PATH1 PATH2 Fixable VE_BMOFL The bitmap and FLIST as specified in 2101 N ROOTBLOCK overlap VF_BMSIZ The bitmap size and volume size as specified 2102 N in ROOTBLOCK are inconsistent with one another VF_FLSIZ The FLIST size and number of file 2103 N descriptors as specified in ROOTBLOCK are inconsistent with one another VE_BMOVL The bitmap as specified in ROOTBLOCK 2104 N extends beyond the end of the volume VF_FLOVL
461. ters read so far A character is expected No assignment occurs Below is a table of the modifiers that can precede a conversion specifier If a modifier appears with any conversion specifier not listed the behavior is undefined Modifier h h I E 1 Specifier Default Argument Type Modified Argument Type ap L N pointer to int pointer to short o x u pointer to unsigned int pointer to unsigned short db pointer to int long O x u pointer to unsigned int pointer to unsigned long e f g pointer to float pointer to double The L modifier is not supported by fscanf Arguments 1 through n point to variables where input is stored Return Value This function returns conversion Otherwise EOF and sets errno if an input failure occurs before any it returns the number of input items assigned which can be fewer than provided even zero in the event of an early matching failure Error Codes Refer to Appendix B pSOSystem System Calls 3 59 fscanf Notes Callable From m Task See Also scanf 3 60 pREPC System Calls pSOSystem System Calls pREPC System Calls fseek fseek Sets the file position indicator include lt stdarg h gt include lt stdio h gt int fseek FILE stream stream pointer long offset file offset int whence relative file base Description The fseek function sets the file position indicator for the stream pointed to by stream
462. the NI SIOCGIFMTU Gets the maximum transmission unit of the NI SIOCSIFNETMASK Sets the network mask SIOCGIFNETMASK Gets the network mask SIOCSIFFLAGS Sets the interface flags field If the interface is marked down any packets currently routed through the interface are re routed or dropped resulting in a send error condition IFF_POLL IFF_EXTLOOPBACK and IFF_UP flags can be set by using this call SIOCGIFFLAGS Gets interface flags SIOCGIFCONF Gets the interface configuration list When this command is used arg must point to an ifconf structure see below The ifc_len field initially should be set to the buffer size pointed to by ifc_buf On return ifc_len has the config uration list length in bytes Structure used in SIOCGIFCONF request Used to retrieve interface configuration for machine useful for programs that must know all accessible networks A struct ifconf int ifc_len size of associated buffer union char ifcu_buf struct ifreq ifcu_req ifc_ifcu define ifc_buf ifc_ifcu ifcu_buf buffer address define ifc_req ifc_ifcu ifcu_req array of structures returned For all other NI related operations arg must point to the following structure struct ifreq long ifr_ifno Interface number of the NI union struct sockaddr ifru_addr IP address of the NI struct sockaddr ifru_dstaddr Dest addr p to p link struct sockaddr ifru_broadaddr NI broadcast
463. the SO_KEEPALIVE option is set above TCP_MSL Maximum Segment Lifetime in TCP This controls the TIME_WAIT or 2MSL timer in TCP which is set to twice the value of the MSL The timer is used to validate connection termination and transmits remaining data in the send queue It is a safeguard against sequence numbers being overlapped If set to a low value it allows the sockets to be quickly deleted The default in pNA is 30 seconds The timer is in seconds TCP_NODELAY Disables delay acknowledgment algorithm Data is sent im mediately over the network instead of waiting for the window to be full pSOSystem System Calls 4 19 getsockopt IP Level Options pNA System Calls level must be set to IPPROTO_IP for IP protocol level operations The argument optname can have one of the following values IP_HDRINCL IP_MULTICAST_IF IP_MULTICAST_INTF IP_MULTICAST_LOOP IP_MULTICAST_TTL Return Value Specifies that the IP Header will be included in the output packets The following fields will be set by pNA if they are set to O in the included IP header IP identification num ber and IP source address The fragmentation offset and checksum fields are always computed by pNA The rest of the IP header fields must be set appropriately Specifies the outgoing interface for multicast packets For this option optval is a pointer to struct in_addr If set to INADDR_ANY then the routing table will be use
464. the device close routine of a pSOS device driver specified by the dev argument The functionality of the device close routine is device specific For example an RS 232 device driver close routine may signal a modem to hang up to signify the end of the connection The de_close call when used in conjunction with de_open can also be used to implement mutual exclusion In this case de_close can be used to signal the end of a critical region for the device operation Arguments dev Specifies the major and minor device numbers which are stored in the upper and lower 16 bits respectively iopb Points to an I O parameter block the contents of which are driver specific retval Points to a variable that receives a driver specific value returned by the driver Return Code This call returns 0 on success or an error code on failure Besides the error codes listed below other driver specific errors may be returned pSOSystem System Calls 1 11 de_close Error Codes Hex Mnemonic 0x101 ERR_IODN 0x102 ERR_NODR 0x103 ERR_IOOP Notes Callable From m Task See Also de_open 1 12 pSOS System Calls Description Illegal device major number No driver provided Illegal I O function number pSOSystem System Calls pSOS System Calls de_cntrl de_cntrl Requests a special I O device service include lt psos h gt unsigned long de_cntrl unsigned long dev major minor device number void iop
465. this call if its preemptibility is turned from off to on and a higher priority task is ready to run To obtain a task s current execution mode without changing it use a mask of 0 Arguments mask Specifies all task attributes to be modified new_mode Specifies the new task attributes old_mode Points to the variable where t_mode stores the old value of the task s mode You create the arguments mask and new_mode by ORing symbolic constants from the pairs below These symbolic constants are also defined in lt psos h gt PREEMPT Task is is not preemptible _NOPREEMPT T_TSLICE Task can cannot be time sliced _NOTSLICE T_ASR T_NOASR Task s ASR is enabled disabled pSOSystem System Calls 1 145 t_mode Target 1 146 T_ISR T_NOISR EVELMASKO through EVELMASKn pSOS System Calls Hardware interrupts are enabled disabled while the task runs These options are available only on certain processors See Interrupt Control under Target Certain hardware interrupts are disabled while the task runs These options are available only on certain processors See Interrupt Control under Target To create the argument new_mode you pick symbolic constants from the pairs described above For instance to specify that a task have preemption turned off you place the symbolic constant T_NOPREEMPT in new_mode To specify that the
466. tial host table entries This error originates specified exceeds nc_nhentry Increase in pNA initialization nc_nhentry Ox5F11 FAT_FUNC An invalid system call code was passed This error originates to pNA Check the pNA bindings file in pSOSystem when a system call is made pSOSystem System Calls B 43 pRPC Error Codes Error Codes B 5 pRPC Error Codes When a pRPC system call generates an error an error code is loaded into an inter nal variable that can be read through the macro errno One errno variable ex ists for each task If the return value of a pRPC system call indicates an error your application should examine the errno variable to determine the cause of the error See the description of errno on page 3 27 for more information Table B 9 lists the error codes of the pRPC subcomponent Each listing includes the error code s hexadecimal number its mnemonic and description and the sys tem calls that can return it The error code mnemonics are also defined in lt prpc h gt TABLE B 9 pRPC Error Codes Mnemonic and Description System Call s 0x5101 FAT_PRPC_CHKSUM Corrupted ROM This error originates in pRPC initialization 0x5 102 FAT_PRPC_MEM Insufficient memory to This error originates in pRPC hold pRPC data initialization 0x5104 FAT _PRPC_TASKCREATE Cannot start This error originates in pRPC pmap initialization B 6 B
467. tibyte codings respectively do or do not have state dependent encodings If s is not a null pointer this function either returns 0 if s points to the null character or returns the number of bytes that are contained in the converted multibyte character if the next n or fewer bytes form a valid multibyte character or returns 1 if they do not form a valid multibyte character In no case will the value returned be greater than n or the value of the MB_CUR_MAX macro pSOSystem System Calls pREPC System Calls mbtowc Error Codes None Notes Callable From m Task m ISR See Also mbstowcs wctomb wcstombs pSOSystem System Calls 3 101 memchr pREPC System Calls memchr Searches memory for a character include lt string h gt void memchr const void s target buffer int c character key size ton search length Description This function searches for the first occurrence of the character c converted to an unsigned char in the first n characters of the object pointed to by s Arguments S Points to the buffer to be searched c Specifies the character to be searched for n Specifies the number of characters to search through Return Value This function returns a pointer to the located character or a null pointer if the character is not found Error Codes None 3 102 pSOSystem System Calls pREPC System Calls Notes Callable From a Task m ISR See Also
468. tifier Description This system call is similar to tm_evafter except that the armed timer expires periodically instead of once Events are generated at the specified interval until the timer is cancelled with tm_cancel The tm_evevery call provides a drift free mechanism for performing an operation at periodic intervals Like tm_evafter the interval is specified in system clock ticks Arguments ticks Specifies the periodic interval in system clock ticks events Specifies the events to deliver upon expiration of the timer interval The events are encoded into a long word with bits 31 16 reserved for system use and bits 15 0 available for application use tmid Points to the variable where tm_evevery stores a timer identifier which can be used if the armed timer must be cancelled Return Value This system call returns 0 on success or an error code on failure 1 168 pSOSystem System Calls pSOS System Calls tm_evevery Error Codes Hex Mnemonic Description 0x4B ERR_NOTIMERS Exceeds the maximum number of configured timers Notes 1 The maximum interval is 232 1 ticks 2 A timer is counted down by successive tm_tick calls If no clock or timer is provided a timer does not expire 3 A task must explicitly call ev_receive to receive timer triggered events which are like other events in every other way 4 A task with active timers can be blocked or suspended In either case the design
469. tifier of the named region 1 115 rn_retseg Returns a memory segment to the region from which it was al 1 117 located sm_av pSOS m kernel only Asynchronously releases a semaphore 1 119 token sm_create Creates a semaphore 1 121 sm_delete Deletes a semaphore 1 124 sm_ident Obtains a semaphore identifier 1 126 sm_p Acquires a semaphore token 1 128 sm_v Releases a semaphore token 1 131 t_create Creates a task 1 133 t_delete Deletes a task 1 138 t_getreg Gets a task s notepad register 1 141 t_ident Obtains the task identifier of the named task 1 143 t_mode Gets or changes the calling task s execution mode 1 145 t_restart Forces a task to start over regardless of its current state 1 149 t_resume Resumes a suspended task 1 152 t_setpri Gets and optionally changes a task s priority 1 154 t_setreg Sets a task s notepad register 1 156 t_start Starts a task 1 158 pSOSystem System Calls A 17 pHILE System Calls Tables of System Calls TABLE A 2 pSOS System Calls Continued Name Description Page t_suspend Suspends a task until a t_resume call is made for the sus 1 162 pended task tm_cancel Cancels an armed timer 1 164 tm_evafter Sends events to the calling task after a specified interval 1 166 tm_evevery Sends events to the calling task at periodic intervals 1 168 tm_evwhen Sends events to the calling task at the specified time 1 170 tm_get Obtains the system
470. tion on two speci 3 25 fied integers errno pREPC The error number returned by the last fail 3 27 ing system call errno_addr psOS Obtains the address of the calling task s in 1 23 ternal errno variable ev_asend psOS pSOS m kernel only Asynchronously 1 25 sends events to a task ev_receive pSOS Allows a task to wait for an event condition 1 27 ev_send pSOS Sends events to a task 1 30 exit pREPC Terminates a task 3 28 fchmod_f pHILE Changes the mode of an ordinary or direc 2 29 tory file specified by its file identifier fchown_f pHILE Changes the owner or group of a file speci 2 32 fied by its file identifier pSOSystem System Calls A 3 All pSOSystem System Calls Tables of System Calls TABLE A 1 All pSOSystem System Calls Continued Name Component Description Page fclose pREPC Closes a stream 3 30 feof pREPC Tests a stream s end of file indicator 3 32 ferror pREPC Tests a stream s error indicator 3 33 fflush pREPC Flushes the buffer associated with an open 3 34 stream fgetc pREPC Gets a character from a stream 3 35 fgetpos pREPC Gets the current file position indicator for 3 36 fsetpos fgets pREPC Gets a string from a stream 3 37 fopen pREPC Opens a file 3 39 fprintf pREPC Prints formatted output to a stream 3 43 fputc pREPC Writes a character to a stream 3 48 fputs pREPC Writes a string to a stream 3 50 fread p
471. tions on the volume A volume must be initialized before it can be mounted After a volume has been initialized pcinit_vol can be used to quickly delete all data on the volume pcinit_vol cannot be used for the first initialization of a hard disk partition see Note 4 Arguments device Points to the null terminated name of the volume to initialize scratch_buf Points to a 512 byte working buffer dktype Specifies the MS DOS media format and must have one of the following values Value Mnemonic Meaning 0 DK_HARD Hard disk 1 DK_360 360 Kbyte 5 1 4 double density 2 DK_12 1 2 Mbyte 5 1 4 high density pSOSystem System Calls 2 85 pcinit_vol Return Value NUO oO sa W DK_720 DK_144 DK_288 DK_NEC DK_OPT pHILE System Calls 720 Kbyte 3 1 2 double density 1 44 Mbyte 3 1 2 high density 2 88 Mbyte 3 1 2 high density 1 2 Mbyte 5 1 4 NEC Optical disks 124 4 Mbyte Fuji M2511A OMEM This system call returns 0 on success or an error code on failure Error Codes 2 86 Hex 0x2003 0x2008 0x2025 0x2027 0x2051 Mnemonic E_BADVOL E_MNTED E_IDN E_ILLMSTYP E_MAXLOOP Description Inconsistent data on volume volume corrupted Volume already mounted Illegal device name Illegal DOS disk type Symbolic links nested too deeply pSOSystem System Calls pHILE System Calls pcinit_vol Notes 1 All data stored on the volume is lost by
472. tring s The terminating null character is considered part of the string Arguments s Points to the string to be searched c Specifies the reference character Return Value This function returns a pointer to the character If c is not found the function returns a null pointer Error Codes None Notes Callable From m Task ISR pSOSystem System Calls 3 161 strspn pREPC System Calls strspn Calculates specified string length include lt string h gt size_t strspn const char s1 candidate string const char s2 reference string Description The strspn function computes the length of the maximum initial segment of a string s1 that consists entirely of characters from another string s2 Arguments sl Points to the string to be examined s2 Points to the reference string Return Value This function returns the length of the segment Error Codes None Notes Callable From m Task a ISR 3 162 pSOSystem System Calls pREPC System Calls strstr strstr Searches a string for specified characters in another string include lt string h gt char strstr const char s1 search string const char s2 reference string Description The strstr function locates the first occurrence in a string s1 of the sequence of characters excluding the null terminator in another string s2 Arguments sl Points to the string to be searched s2 Points to the reference stri
473. ts access rights int msg_accrightslen size of access rights buffer This structure cannot be packed The contents of the msghdr fields are described below msg_name If the socket is unconnected can specify the source from which it receives data msg_namelen Specifies the length of the buffer pointed to by msg_name pSOSystem System Calls 4 51 recvmsg flags Return Value msg_iov msg_accrights msg_accrightslen pNA System Calls Points to an array whose members msg_iov 0 msg_iov msglen 1 spec ify the buffers in which the received data is stored The iovec structure has the following format struct iovec char iov_base base address int iov_len buffer length This structure cannot be packed Each iovec entry specifies the base address and length of an area in memory where data is stored recvmsg always fills an area completely before it goes to the next area Points to a buffer that receives the access rights information sent along with a message This applies to messages that a UNIX host sends Specifies the length of the buffer pointed to by msg_accrights Specifies usage options and is the result of an OR operation per formed on one or more of the following symbolic constants defined in lt pna h gt It can also be set to 0 MSG_OOB MSG_PE Specifies that you want recvmsg to read any out of band data present on the socket rather tha
474. tten stream Points to an open pREPC stream Return Value This function returns zero if the operation succeeds and EOF if it fails If an error occurs errno is set Error Codes Refer to Appendix B Notes Callable From m Task See Also fgets 3 50 pSOSystem System Calls pREPC System Calls fread fread Reads from a stream include lt stdarg h gt include lt stdio h gt size_t fread void ptr buffer size t size element size size t nmemb element count FILE stream stream pointer Description This function reads up to nmemb elements whose size is specified by size from the stream pointed to by stream and puts them into the user buffer pointed to by ptr The file position indicator for the stream if defined is advanced by the number of characters successfully read If an error occurs the resulting value of stream s file position indicator is indeterminate If a partial item is read its value is indeterminate Arguments ptr Points to the user buffer where items are stored size Specifies the size of each item nmemb Specifies the number of items to read stream Points to an open pREPC stream Return Value This function returns a count of the number of items successfully read If an error occurs stream s error indicator and errno are set If size or nmemb is zero fread returns 0 and the contents of the array and the state of the stream remain unchanged Er
475. turn Value This function returns a pointer to the generated name Error Codes Refer to Appendix B pSOSystem System Calls 3 177 tmpnam pREPC System Calls Notes Callable From m Task 3 178 pSOSystem System Calls pREPC System Calls tolower tolower Converts a character to lowercase include lt ctype h gt int tolower int c character Description This function converts an uppercase letter to lowercase Arguments Specifies the character to be converted Return Value This function returns the converted character If c is not an uppercase character the function returns the character unchanged Error Codes None Notes Callable From a Task ISR pSOSystem System Calls 3 179 toupper pREPC System Calls toupper Converts a character to uppercase include lt ctype h gt int toupper int c character Description This function converts a lowercase letter to uppercase Arguments e Specifies the character to be converted Return Value This function returns the converted character If c is not a lowercase character it is returned unchanged Error Codes None Notes Callable From a Task a ISR 3 180 pSOSystem System Calls pREPC System Calls ungetc ungetc Ungets a character include lt stdarg h gt include lt stdio h gt int ungetc int c character FILE stream stream pointer Description The ungetc functi
476. ty on the master node Callable From m Task See Also sm create pSOSystem System Calls 1 125 sm_ident pSOS System Calls sm_ident Obtains the semaphore identifier of a named semaphore include lt psos h gt unsigned long sm_ident char name 4 semaphore name unsigned long node node selector unsigned long smid semaphore ID Description This system call enables the calling task to obtain the semaphore ID of a semaphore it only knows by name The semaphore ID can then be used in all other operations relating to this semaphore Most system calls except sm_create and sm_ident reference a semaphore by the semaphore ID sm_create returns the semaphore ID to the semaphore creator For other tasks one way to obtain the semaphore ID is to use sm_ident Arguments name Specifies the user assigned name of the semaphore node In multiprocessor systems is a search order specifier See Multiprocessor Considerations In a single node system this argument must be 0 smid Points to the variable where sm_ident stores the semaphore ID of the named semaphore Return Value This system call returns O on success or an error code on failure Error Codes Hex Mnemonic Description 0x04 ERR_NODENO Node specifier out of range 0x09 ERR_OBJNF Named semaphore not found 1 126 pSOSystem System Calls pSOS System Calls sm_ident Notes 1 Internally the pSOS kernel treats a semapho
477. uccess a nonzero value is returned that indicates the number of descriptors on which events have occurred Error Codes Hex Mnemonic 0x5009 EBADS Ox504A ECOLL See Also accept connect recv send 4 56 Description The socket descriptor is invalid Collision in select these condi tions have already been selected by another task pSOSystem System Calls pNA System Calls send send Sends data to a socket include lt pna h gt long send int s socket descriptor char buf packet int len packet length int flags packet attributes Description The send system call is used to send data to a foreign socket If no buffer space is available at the socket to hold the data to be transmitted send blocks the calling task unless the socket has been marked non blocking Applications can use this call to pass messages to the pNA network manager in a linked list of mblks message blocks by setting the MSG_RAWMEM flag see Arguments below Using mblks eliminates the data copy performed in the pNA network manager during the data transfer between the application and the pNA network manager Arguments buf len pSOSystem System Calls Specifies the local socket which must be in a connected state If s is a stream socket the data is sent to the foreign socket that is connected to s If s is a datagram socket the data is sent to the socket that has b
478. ude lt psos h gt unsigned long sm v unsigned long smid semaphore identifier Description This system call is used to release a semaphore token If a task is already waiting at the semaphore it is unblocked and made ready to run If there is no task waiting then the semaphore token count is simply incremented by 1 Arguments smid Specifies the semaphore ID of the semaphore token to release Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Semaphore has been deleted 0x06 ERR_OBJID smid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x65 ERR_STALEID Object s node has failed Notes If the caller is a task it may be preempted as a result of this call pSOSystem System Calls 1 131 sm_v pSOS System Calls Multiprocessor Considerations 1 If smid identifies a global semaphore residing on another processor node then the pSOS kernel will internally make an RSC to that remote node to release the semaphore 2 If the task awakened by this call does not reside on the local node the local kernel will internally alert the task s node of residence whose pSOS kernel will ready the task and give it the acquired semaphore token Thus an sm_v call whether it is to a local or remote semaphore may cause pSOS activities on another node Callable From m
479. ue This function returns a pointer to the stream of the file or a null pointer if no file is created If an error occurs the function sets errno Error Codes Refer to Appendix B Notes Callable From m Task See Also tmpname 3 176 pSOSystem System Calls pREPC System Calls tmpnam tmpnam Generates a temporary filename include lt stdarg h gt include lt stdio h gt char tmpname char s string root Description The tmpnam function generates a string that is intended to be used as a filename tmpname generates up to 1000 unique names for each task The pREPC library does not maintain a list of tmpnames in use After 1000 names have been generated the sequence starts over A file with a name generated by tmpnam is not necessarily a temporary file To be treated as a temporary file it must be created by tmpfile Arguments s Points to the string where tmpname stores the filename When tmpname is called s should consist of the initial part of a valid pathname tmpname adds a slash followed by a T or G if the creating task is global The T or G is followed by the lower 16 bits of the caller s task ID which is followed by a decimal point and a decimal number within the range 0 through 999 For example assume that s points to the string 0 0 the caller s tid is 00000002 and the caller has previously called tmpname 12 times The generated name is 0 0 T0002 012 Re
480. ueue in front of all such queued messages Arguments qid Specifies the queue ID of the target queue msg_buf Points to the message to send msg_len Specifies the length of the message It must not exceed the queue s maximum message length Return Value This system call returns 0 on success or an error code on failure Error Codes Hex Mnemonic Description 0x05 ERR_OBJDEL Queue has been deleted 0x06 ERR_OBJID qid incorrect failed validity check 0x07 ERR_OBJTYPE Object type doesn t match object ID failed validity check 0x30 ERR_KISIZE Message buffer length exceeds max KI packet buffer length 1 104 pSOSystem System Calls pSOS System Calls q_vurgent Hex Mnemonic Description 0x31 ERR_MSGSIZ Message is too large 0x35 ERR_OFULL Message queue at length limit 0x3B ERR_NOTVARO Queue is not variable length 0x65 ERR_STALEID Object s node has failed Notes 1 q_vurgent is useful when the message represents an urgent errand and must be serviced ahead of the normally FIFO ordered messages 2 If the caller is a task it may be preempted as a result of this call 3 The pSOS kernel must copy the message into a queue buffer or the receiving task s buffer Longer messages take longer to copy User s should account for the copy time in their design especially when calling from an ISR 4 q_vurgent sends an urgent message to a variable length message queue Use q_urgent to send an urgent message t
481. ueue was created with the Q_PRIOR attribute then the task will be inserted into the wait queue by priority 2 The pSOS kernel must copy the message from the queue into the caller s buffer Longer messages take longer to copy User s should account for the copy time in their design especially when calling from an ISR 3 q_vreceive requests a message from a variable length message queue Use q_receive to request a message from an ordinary queue Multiprocessor Considerations If gid identifies a global queue residing on another processor node the local kernel will internally make an RSC to that remote node to request a message from that queue If the Q_WAIT attribute is elected then the pSOS m kernel on the target node must use an agent to wait for the message If that node is temporarily out of agents the call will fail The number of agents on each node is defined by the mc_nagent entry in the Multiprocessor Configuration Table Callable From m Task m ISR if Q_NOWAIT is set m KI if Q_NOWAIT is set a Callout if Q_NOWAIT is set See Also q_receive q_vsend 1 100 pSOSystem System Calls pSOS System Calls q_vsend q_vsend Posts a message to a specified variable length message queue include lt psos h gt unsigned long q_vsend unsigned long qid queue identifier void msg_buf message buffer unsigned long msg_len length of message Description This system call is used to send
482. ult time to live value IP fragmentation reassembly queue timeout 4 31 ioctl 4 32 Definitions for IP NI Address Table GET Command Definitions SIOCGI SIOCGI SIOCGI SIOCGI SIOCGI SIOCGI PA PA PADE PADE PADE PADE DDRTABLE ETMASK N DENTBCASTADDR R EASMMAXSIZE Definitions for IP Route Table GET Command Definitions SIOCGI PROUTETABLE SIOCGIPROU SIOCGIPROU SIOCGIPROU ENEXTHOP SIOCGIPROU SIOCGIPROU EPROTO SIOCGIPROU EMASK SET Command Definitions SIOCSIPROU EDES SIOCSIPROU ENEXTHOP SIOCSIPROU Definitions for IP NET TO MEDIA Table ETYPE GET Command Definitions SIOCGIPNETTOMEDIATABLE pNA System Calls pNA NI IP address table IP address of the NI Interface number of NI Subnet mask of the NI Broadcast address of the NI Maximum reassembly size of IP datagram IP routing table Route destination IP address Interface number of the NI for the route IP address of next hop of this route Type of this route Protocol used by the route Network mask to be ANDed with destina tion address Route destination IP address IP addr of next hop of this route Type of this route IP Net to Media table pSOSystem System Calls pNA System Calls ioctl GET Command Definit
483. ur when an l1seek_ f call positions the L_ptr before the beginning of a file B 20 pSOSystem System Calls Error Codes TABLE B 3 pHILE Error Codes Continued pHILE Error Codes Hex Mnemonic and Description System Call s 0x2021 E_ILLDEV Illegal device The major device num cdmount_vol ber specified in an init_vol or init_vol mount_vol mount_vol is larger than the maximum de pemount_vol vice number specified in the pSOS Configura verify_vol tion Table 0x2022 E_LOCKED Data is locked Attempt to access a ftruncate_f lock_f region of a file that is locked read_f truncate_f write_f 0x2023 E_BADFN Illegal or unused filename The FN open_fn passed to an open_ fn call is not legal Either it is not within the limits of the FLIST or the cor responding FD is not in use 0x2024 E_FMODE Bad synchronization mode to cdmount_vol mount_vol The mount_vol synchroniza mount_vol tion mode must be 0 1 or 2 pcmount_vol 0x2025 E_IDN Illegal device name An illegal device access_f name was passed to a function requiring either a device or pathname as input Either the device number was illegal i e major minor numbers out of bounds or it contained a syntax error camount_vol change_dir chmod_f chown_f create_f get_fn init_vol link_f lstat_f make_dir mount_vol move_f nfsmount_vol open_dir open_f open_fn pcinit_vol
484. ure pSOSystem System Calls 1 9 as_send Error Codes Notes Hex 0x05 0x06 0x07 Ox3F Mnemonic ERR_O ERR_O ERR_O BJDEL BJID BJUTYPE ERR_NOASR pSOS System Calls Description Task has already been deleted tid incorrect validity check failed Object type doesn t match object ID failed validity check Task has no valid ASR 1 When an ASR starts execution all pending asynchronous signals since its last invocation are passed to it as an argument 2 as_send does not trigger the ASR handler if signals is 0 Multiprocessor Considerations If tid identifies a global task that resides on another processor node the pSOS kernel internally makes a remote system call RSC to that remote node to send the asynchronous signal to the task Callable From m Task m ISR if the targeted task is local to the node from which the as_send call is made m KI if the targeted task is local to the node from which the as_send call is made m Callout if the targeted task is local to the node from which the as_send call is made See Also 1 10 as_catch pSOSystem System Calls pSOS System Calls de_close de_close Closes an I O device include lt psos h gt unsigned long de_close unsigned long dev major minor device number void iopb I O parameter block address void retval return value Description The de_close call invokes
485. usability System Calls provides two appendices m Appendix A provides an alphabetical list of all system calls with a summary de scription of each call and a reference to the page where you will find call details This enables you to search for a call by function when you do not have the spe cific call name m Appendix B provides a numerical list of all error codes returned by pSOSystem Each error code is listed with its description and the system calls that can re turn it System Calls and other manuals comprise the basic documentation set for the pSO System operating system These other manuals are the pSOSystem Getting Started pSOSystem System Concepts pSOSystem Programmer s Reference pSOSystem Ad vanced Topics and the pSOSystem Application Examples Organization This manual is organized as follows Chapter 1 pSOS System Calls provides detailed information on each system call in the pSOS pSOS m component of pSOSystem vii Conventions Using This Manual Chapter 2 pHILE System Calls provides detailed information on each system call in the pHILE component of pSOSystem Chapter 3 pREPC System Calls provides detailed information on each system call in the pREPC component of pSOSystem Chapter 4 pNA System Calls provides detailed information on each system call in the pNA component of pSOSystem Chapter 5 pRPC System Calls provides detailed information on each system call
486. used to receive data from a socket This system call is almost identical to recv The difference is recvfrom may also return the address of the sender in the specified parameter Arguments s Specifies the socket from which data is received The behavior of the system call depends on the socket type Refer to recv for more information buf Points to the user buffer where data is stored len Specifies the size of the buffer in bytes flags Specifies usage options and is the result of an OR operation per formed on one or more of the following symbolic constants de fined in lt pna h gt Can also be set to O MSG_OOB Specifies that you want recvfrom to read any out of band data present on the socket rather than the regular in band data MSG_PEEK Specifies that you want recvfrom to peek at the data present on the socket the data is re turned but not consumed so that a subse quent receive operation sees the same data 4 48 pSOSystem System Calls pNA System Calls recvfrom MSG_RAWMEM Specifies that you have set buf to point to a linked list of mblks and len to the total size of the message MSG_INTERFACE Specifies that you want the interface number of the NI on which the packet arrived to be stored in from from If from is not a NULL pointer recvfrom fills in the sockaddr_in structure it points to with the address of the received data s sender The structure sockaddr_in is defined in
487. utime_f verify_vol B 22 pSOSystem System Calls Error Codes TABLE B 3 pHILE Error Codes Continued pHILE Error Codes Hex Mnemonic and Description System Call s 0x2052 R EMOTE Too many levels of remote in path on server access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f Ilstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f 0x2053 P ERM The task does not have the ownership that is needed The task does not have owner ship for the requested file operation remove_f 0x2054 EIO A hard error occurred at a remote site There was some hardware error such as an I O error at the server Abort the operation access_f change_dir chmod_f chown_f create_f fchmod_f fchown_f fstat_f fstat_vfs ftruncate_f link_f lseek_f lstat_f make_dir move_f nfsmount_vol open_dir open_f read_dir read_f read_link remove_f stat_f stat_vfs symlink_f truncate_f unmount_vol utime_f write_f pSOSystem System Calls B 23 pHILE Error Codes TABLE B 3 pHILE Error Codes Continued Error Codes Hex Mnemonic and Description System Call s 0x2055 _EACCES The
488. vurgent pSOS m kernel only Asynchronously posts a message at the 1 68 head of a variable length message queue q_broadcast Broadcasts identical messages to an ordinary message queue 1 71 q_create Creates an ordinary message queue 1 74 q_delete Deletes an ordinary message queue 1 77 q_ident Obtains the queue ID of an ordinary message queue 1 79 q_receive Requests a message from an ordinary message queue 1 81 q_send Posts a message to an ordinary message queue 1 84 q_urgent Posts a message to the head of an ordinary message queue 1 86 q_vbroadcast Broadcasts identical variable length messages to a variable 1 88 length message queue q_vcreate Creates a variable length message queue 1 91 q_vdelete Deletes a variable length message queue 1 94 q_vident Obtains the queue ID of a variable length message queue 1 96 q_vreceive Requests a message from a variable length message queue 1 98 q_vsend Posts a message to a specified variable length message queue 1 101 A 16 pSOSystem System Calls Tables of System Calls pS0S System Calls TABLE A 2 pSOS System Calls Continued Name Description Page q_vurgent Posts a message at the head of a variable length message 1 104 queue rn_create Creates a memory region 1 107 rn_delete Deletes a memory region 1 110 rn_getseg Allocates a memory segment to the calling task 1 112 rn_ident Obtains the region iden
489. w creation of a task at these priorities there should never be a need to do so Specifies the task s supervisor stack size in bytes see Supervisor Stack Size under Target t_create internally calls rn_getseg to allocate a segment from Region O to hold the task s stack and the user stack if any Specifies the task s user stack ustack may be O if the task executes only in supervisor mode see Using sstack and ustack under Target 1 133 t create Target 1 134 flags tid pSOS System Calls Specifies the task s attributes flags is formed by OR ing the following symbolic constants one from each pair which are defined in lt psos h gt For instance to specify that a task is global you place the symbolic constant T_GLOBAL in flags To specify that the task is global and uses the FPU processor you place both T_GLOBAL and T_FPU in flags using the following syntax T_GLOBAL T_FPU T_GLOBAL Makes the task global external tasks on other nodes T_LOCAL can address it restricts the task to the local node The T_GLOBAL attribute is ignored by the single processor kernel T_FPU Informs the pSOS kernel that the task uses does T_NOFPU not use the FPU coprocessor see Using the T_FPU Flag under Target Points to the variable where t_create stores the task ID assigned to the task Using sstack and ustack On most processors a task can execute only in supervi
490. which contains parameters used to initialize the volume This structure is defined in lt phile h gt as follows typedef struct init_vol_params char volume_label 12 volume label unsigned long volume_size number blocks in volume unsigned long num_of_file_descriptors number descriptors in FLIST unsigned long starting_bitmap_block_number first BITMAP block unsigned long start_data_block_number first data block INIT_VOL_PARAMS This structure cannot be packed The fields of the init_vol_params structure are described below volume_label Contains a 12 byte volume label The pHILE file system manager copies the label to the volume s ROOTBLOCK but does not use it The volume label is not the volume name The volume name contains the volume s major and minor device numbers volume_size The number of blocks on the volume For example a value of 5000 indicates the volume contains blocks O 4999 num_of_file_descriptors The number of file descriptors in the volume s FLIST This is the number of files that can be created on the volume starting_bitmap_block_number The starting block for the volume s BITMAP start_data_block_number The starting block for the volume s data blocks The pHILE file system manager requires this parameter to be a multiple of 8 pSOSystem System Calls pHILE System Calls scratchbuf Return Value init_vol Points to a buffer that is used tempor
491. x15 Is a directory pSOSystem System Calls B 35 pHILE Error Codes TABLE B 5 pHILE Error Codes That Represent NFS Errors Error Codes pHILE Hex pHILE Description NFS Hex NFS Description 0x2057 __EQUOT Quota exceeded Ox45 Disc quota exceeded 0x2058 E_ESTALE Stale NFS file 0x46 Stale NFS file handle handle 0x205B _ENXIO No such device or 0x06 No such device or address address 0x205C _ENODEV No such device 0x13 No such device B 2 3 Conversions of RPC Error Codes All RPC errors received by pHILE are mapped to pHILE error codes Table B 6 shows the conversions of these codes If an RPC error code not listed below is re ceived it is mapped to the code E TABLE B 6 pHILE Error Codes That Represent RPC Errors _ERPC 0x207E All other RPC errors rer RP il pHILE Hex pHILE Description la RPC Description 0x2070 _EAUTH RPC Authorization 7 RPC_AUTHERROR Authentication is not available error 0x2071 _ENFS NFS error pmap 14 RPC_PORTMAPFAILURE The failure pmapper failed in its call 0x2072 _ETIMEDOUT NFS call timed 5 RPC_TIMEDOUT Call timed out out 0x2075 _ECANTSEND Failure in 3 RPC_CANTSEND Failure in send sending call ing call 0x2076 _ECANTRECV F
492. x207C 0x207D 0x207E See Also Mnemonic EPROGVERSMISMATCH ECANTDECODEARGS EUNKNOWNHOST EPROGNOTREGISTERED E_UNKNOWNPROTO EINTR ERPC create_f make dir pSOSystem System Calls remove_f Description Program version mismatched Decode arguments error Unknown host name Remote program is not registered Unknown protocol Call interrupted All other RPC errors 2 103 stat_f pHILE System Calls stat f Gets the status of a named file include lt phile h gt unsigned long stat_f char name file pathname struct stat buf file status Volume Types All volumes Description stat_f returns information about the named file This call does not need read write or execute permission of the named file It does need execute search permission of all the directories leading to the named file Arguments name Points to the null terminated pathname of the file buf Points to a stat structure defined in lt phile h gt as follows struct stat mode_t st_mode ownership protection ino_t st_ino F file TD dev_t st_dev device ID where the volume resides dev_t st_rdev device ID for character or block special files only nlink_t st_nlink number of hard links to the file uid_t st_uid user ID gid_t st_gid group ID off_t st_size total size of file in bytes time_t
493. x39 ERR_MATQDEL Informative only messages were pending in the queue 0x3B ERR_NOTVARO Queue is not variable length 0x53 ERR_ILLRSC Queue not created from this node 1 94 pSOSystem System Calls pSOS System Calls q_vdelete Notes 1 Message storage is returned to region 0 Hence the calling task can be preempted by a high priority task waiting for memory 2 The calling task can also be preempted after this call if a task waiting at the deleted queue has higher priority 3 Any pending messages are lost 4 q_vdelete deletes a variable length message queue Use q_delete to delete an ordinary queue Multiprocessor Considerations If qid identifies a global queue q_vdelete will notify the master node so that the queue can be removed from its Global Object Table Thus deletion of a global queue always causes activity on the master node Callable From a Task See Also q_delete q_vcreate pSOSystem System Calls 1 95 q_vident pSOS System Calls q_vident Obtains the queue ID of a variable length message queue include lt psos h gt unsigned long q vident char name 4 queue name unsigned long node node number unsigned long qid queue identifier Description The intended purpose of this system call is to allow the calling task to obtain the queue ID of a variable length message queue However since a variable length message queue is just a special type of message queue
494. xdr_pointer xdr_replymsg xdr_string xdr_u_int xdr_void xprt_register pSOSystem System Calls pRPC System Calls get_fdset get_fdset include lt rpc h gt void get_fdset fd_set read_mask server s read file descriptor bit mask Description This pRPC service call provides access to the task specific equivalent of the ONC RPC svc_fdset global variable Arguments read_mask Points to the location where get_fdset copies the contents of the svc_fdset variable Memory pointed to by read_mask should be preallocated The returned read_mask can serve as the read descriptor list argument to the pNA select service call The value that select returns in place of the input read descriptor list can serve as an input argument to the pRPC svc_getreqset call Return Value None Error Codes None See Also The svc_getreqset description in other ONC RPC documentation pSOSystem System Calls 5 5 rpc_getcreateerr pRPC System Calls rpc_getcreateerr include lt rpc h gt void rpc_getcreateerr struct rpc_createerr err error buffer Description This pRPC service call provides access to the task specific equivalent of the ONC RPC rpc_createerr global variable Arguments rpc_createerr Points to the location where rpc_getcreateerr copies the contents of the rpc_createerr variable The creation routines for the RPC client handle use rpc_createerr to store t
495. y buf is called a datagram len Specifies the number of bytes in buf flags Specifies usage options and is the result of an OR operation per formed on one or more of the following symbolic constants defined in lt pna h gt It can also be set to 0 MSG_OOB 4 62 Specifies that you want sendto to send out of band data rather than the regular in band data pSOSystem System Calls pNA System Calls to tolen pSOSystem System Calls sendto Gl MSG_DONTROUTI Specifies that you want sendto to turn on the socket flag SO_DONTROUTE for the duration of the send operation The SO_DONTROUTE flag prohibits routing of outgoing data from the socket Packets directed at unconnected nodes are dropped MSG_RAWMEM Specifies that you have set buf to point to a linked list of mblks and len to the total size of the message MSG_INTERFACE Specifies the outgoing interface of the message If no route is found to the destination then the interface number is specified in the argument to which is a pointer to the structure sockaddr_intf This is supported only for da tagram or raw sockets This is helpful with un numbered links where there may not be a route to the destination Specifies the destination socket address and is a pointer to either the sockaddr_in structure or the sockaddr_intf structure sockaddr_int f is used only if the MSG_INTERFACE option is set in flags These structures are defined
496. y check 0x65 ERR_STALEID Object s node has failed Notes 1 The events sent to a non waiting task or those that do not match the events being waited for are always simply left pending 2 If the caller is a task it may be preempted as a result of this call 3 In a multiple event wait situation the ev_send and ev_receive pair of calls are highly dependent on the temporal course of events See Note 2 under ev_receive for an example 4 The pSOS kernel does not prevent the use of bits reserved for system use However for future compatibility these bits should not be used Multiprocessor Considerations If the tid input argument identifies a global task residing on another processor node then the pSOS kernel internally makes an RSC to that remote node to send the input events to that task pSOSystem System Calls 1 31 ev_send pSOS System Calls Callable From m Task m ISR if the targeted task is local to the node from which the ev_send call is made m KI if the targeted task is local to the node from which the ev_send call is made Callout if the targeted task is local to the node from which the ev_send call is made See Also 1 32 ev_receive pSOSystem System Calls pSOS System Calls i_enter i_enter Enters into an interrupt service routine This function cannot be called from a high level language Description This pSOS service entry is available only on x86 ColdFire and
497. ystem Calls fgetpos Gets the current file position indicator for fsetpos include lt stdarg h gt include lt stdio h gt int fgetpos FILE stream stream pointer fpos_t pos stream position Description The fgetpos function stores the current value of the file position indicator for the stream pointed to by st ream in the object pointed to by pos This value can be used by the fsetpos function to reposition the file position indicator of the stream to its position at the time of the call to the fgetpos function Arguments stream Points to an open pREPC stream pos Points to the object where fgetpos stores the current file position indicator Return Value If successful this function returns a zero If not successful or if st ream references an I O device this function returns an EOF and sets errno Error Codes Refer to Appendix B Notes Callable From m Task 3 36 pSOSystem System Calls pREPC System Calls fgets fgets Gets a string from a stream include lt stdarg h gt include lt stdio h gt char fgets char s buffer int n length FILE stream stream pointer Description The fgets function reads at most one less than the number of characters specified by n from the stream pointed to by stream The characters go into the user buffer pointed to by s The function stops reading characters when a new line character which is retained or
498. ystem Calls pNA System Calls pna_allocb pna_allocb Allocates a message block include lt pna h gt mblk_t pna_allocb size pri int size int pri Description pna_allocb allocates a message block with a data buffer of a specified size The pNA memory manager searches the buffer list for the size that best fits the requested size If a buffer of that size is not available the call returns NULL pna_allocb uses the following algorithm to find the best fit 1 The pNA memory manager first searches for an exact match 2 If a match is not available the pNA memory manager searches for the smallest size able to contain the requested size 3 If none is available the maximum size configured in the pNA memory manager is used The following example illustrates this algorithm Let buffers of sizes 0 128 1024 and 4096 bytes be configured in pNA If a buffer of size 1024 is requested the pNA memory manager allocates a buffer from the 1024 byte buffer list A request for a 2048 byte buffer results in the pNA memory manager allocating a buffer from the 4096 byte buffer list and a request for a size 8192 buffer results in the allocation of a 4096 byte buffer Arguments size Specifies the size of the data buffer pri Unused by the pNA memory manager Return Value This system call returns a pointer to the message block if successful otherwise it returns a null pointer pSOSystem System Calls 4 39 pna_alloch
499. ystem Concepts Adjusts the normal allocated output buffer size The buffer size can be increased for high volume connections or de creased to limit the possible backlog of data The pNA net work manager limits this value to 32 Kbytes 4 67 setsockopt pNA System Calls TCP Level Option level must be set to IPPROTO_TCP for TCP protocol level operations The argument optname can have the following value defined in lt pna h gt TCP_KEEPALIVE_CNT Number of Keepalive strobes Upon expiry of the Kee palive idle timer TCP will send a number of strobes separated by a fixed interval If the other end fails to respond to the strobes special TCP segments then the TCP connection will be terminated The default number of strobes in pNA are 8 Only valid if the SO_KEEPALIVE option is set above TCP_KEEPALIVE_IDLE Keepalive idle time in TCP If the connection has been idle for this time the timer will expire causing TCP to send a special segment forcing the other end to re spond On demand dial links for example the timer may be set long enough so as not to cause unneces sary traffic The default in pNA is 120 seconds 2 hrs The timer is in seconds Only valid if the SO_KEEPALIVE option is set above TCP_KEEPALIVE_INTVL Keepalive strobe interval The strobes sent out by TCP upon expiration of the Keepalive idle timer are sepa rated by a fixed interval The
500. ze_t strxfrm char sl destination string const char s2 source string size t n destination string length Description The strxfrm function transforms the string pointed to by s2 and places the resulting string into the array pointed to by s1 The transformation is such that if the strcmp function is applied to two transformed strings it returns a value greater than equal to or less than zero corresponding to the result of the strcoll function applied to the same two original strings No more than n characters are placed into the resulting array pointed to by s1 including the terminating null character If n is zero s1 is permitted to be a null pointer If copying takes place between objects that overlap the behavior is undefined The main use for this function is in foreign language environments that do not use the ASCII collating sequence Arguments sl Points to the array where strxfrm places the resulting string s2 Points to the string to be transformed n Specifies the number of characters to be placed in s1 Return Value The strxfrm function returns the length of the transformed string not including the terminating null character If the value is n or more the contents of the array pointed to by s1 are indeterminate Error Codes None 3 172 pSOSystem System Calls pREPC System Calls Notes Callable From a Task a ISR See Also setlocale strcoll strcmp pSOSystem System Ca

Download Pdf Manuals

image

Related Search

Related Contents

une façon amusante de partager vos images et vos videos  lutensol® to 6  isel - PSPCI  (Minna/mama  TE Connectivity 6536502-2 fiber optic cable  取扱説明書  Origin Storage 256GB MLC SATA 2.5"  State Industries SBD71 User's Manual  Samsung Wave M Black Kullanıcı Klavuzu  nCounter™ Digital Analyzer Information  

Copyright © All rights reserved.
Failed to retrieve file