Low Level System Call Interface
INT 4 to INT 18 are software interrupt handlers. They are used by the user program to access kernel services (e.g. Read from a file, fork a child process etc).
The OS design is fixed such that only the user program can call the software interrupts. They should not be called from inside another interrupt handler or kernel module.
The system call interface is presented below.
System Call | System Call Number | Interrupt Routine Number | Argument 1 | Argument 2 | Argument 3 | Return Value |
---|---|---|---|---|---|---|
Create | 1 | 4 | File Name (String) | Permission (Integer) * | - | 0 - Success / File alredy exists | -1 - No free inode table entry |
Delete | 4 | 4 | File Name (String) | - | - | 0 - Success/File not found | -1 - Permission denied | -2 - File is open |
Seek | 6 | 5 | File Descriptor | Offset | - | 0 - Success | -1 - File Descriptor is invalid | -2 - Offset moves File pointer outside file |
Open | 2 | 5 | File Name | - | - | File Descriptor - Success | -1 - File Not found or file is not data file or root file | -2 - System has reached its limit of open files | -3 - Process has reached its limit of resources |
Close | 3 | 5 | File Descriptor | - | - | 0 - Success | -1 - File Descriptor is invalid |
Read | 7 | 6 | File Descriptor (-1 for terminal read) | Word Address (Buffer) | - | 0 - Success | -1 - File Descriptor given is invalid | -2 - File pointer has reached the end of file |
Write | 5 | 7 | File Descriptor(-2 for terminal write) | Word to write | - | 0 - Success | -1 - File Descriptor given is invalid | -2 - No disk space / File Full | -3 - Permission denied |
Fork | 8 | 8 | - | - | - | PID - Success (in parent process) | 0 - Success (in child process) | -1 - Failure (in parent process), Number of processes has reached maximum limit |
Exec | 9 | 9 | File Name | - | - | -1 - File not found or file is not executable |
Exit | 10 | 10 | - | - | - | - |
Getpid | 11 | 11 | - | - | - | current PID - Success |
Getppid | 12 | 11 | - | - | - | parent PID - Success |
Wait | 13 | 11 | PID | - | - | 0 - Success | -1 - Given PID is invalid or it is PID of invoking process |
Signal | 14 | 11 | - | - | - | 0 - Success |
Semget | 17 | 13 | - | - | - | SEMID - Success | -1 - Process has reached its limit of resources | -2 - Number of semaphores has reached its maximum |
Semrelease | 18 | 13 | SEMID | - | - | 0 - Success | -1 - Invalid SEMID |
SemLock | 19 | 14 | SEMID | - | - | 0 - Success or semaphore is already locked by the current process | -1 - invalid SEMID |
SemUnLock | 20 | 14 | SEMID | - | - | 0 - Success | -1 - Invalid SEMID | -2 - Semaphore was not locked by the calling process |
Shutdown | 21 | 15 | - | - | - | -1 - Permission denied |
Newusr | 22 | 16 | User Name | Password | - | 0 - Success | -1 - User already exists | -2 - Permission denied | -3 - No. of users have reached the system limit. |
Remusr | 23 | 16 | User Name | - | - | 0 - Success | -1 - User does not exist | -2 - Permission denied | -3 - Undeleted files exist for the user |
Setpwd | 24 | 16 | User Name | New password | - | 0 - Success | -1 - Unauthorised attempt to change password | -2 - The user does not exist. |
Getuname | 25 | 16 | User ID | - | - | User Name - Success | -1 - Invalid User ID |
Getuid | 26 | 16 | User Name | - | - | User ID - Success | -1 - Invalid username |
Login | 27 | 17 | User Name | Password | - | 0 - Success | -1 - Invalid username or password | -2 - Permission denied | Logout | 28 | 12 | - | - | - | -1 - permission denied |
Test0 | 96 | 18 | - | - | - | - |
Test1 | 97 | 18 | - | - | - | - |
Test2 | 98 | 18 | - | - | - | - |
Test3 | 99 | 18 | - | - | - | - |
Test4 ** | 100 | 19 | - | - | - | - |
Test5 ** | 101 | 19 | - | - | - | - |
Test6 ** | 102 | 19 | - | - | - | - |
Test7 ** | 103 | 19 | - | - | - | - |
*If the file is created with permission set to EXCLUSIVE, then write and delete system calls will fail when executed by any user other than the owner or the root (see here).
** These System Calls are available only on eXpOS running on NEXSM (a two-core extension of XSM) machine.