146:. An interrupt automatically puts the CPU into some elevated privilege level and then passes control to the kernel, which determines whether the calling program should be granted the requested service. If the service is granted, the kernel executes a specific set of instructions over which the calling program has no direct control, returns the privilege level to that of the calling program, and then returns control to the calling program.
40:
587:), with the number in the instruction rather than in a register, implements a system call for legacy facilities in most of IBM's own operating systems, and for all system calls in Linux. In later versions of MVS, IBM uses the Program Call (PC) instruction for many newer facilities. In particular, PC is used when the caller might be in
553:. It allows a program to call a kernel function directly using a safe control transfer mechanism, which the operating system sets up in advance. This approach has been unpopular on x86, presumably due to the requirement of a far call (a call to a procedure located in a different segment than the current code segment) which uses
437:
allow a process to execute from start and report all system calls the process invokes, or can attach to an already running process and intercept any system call made by the said process if the operation does not violate the permissions of the user. This special ability of the program is usually also
832:
model: All system calls from any user thread in a process are handled by a single kernel-level thread. This model has a serious drawback – any blocking system call (like awaiting input from the user) can freeze all the other threads. Also, since only one thread can access the kernel
141:
However, many applications need access to these components, so system calls are made available by the operating system to provide well-defined, safe implementations for such operations. The operating system executes at the highest level of privilege, and allows applications to request services via
315:
usage. IBM system calls were therefore not directly executable by high-level language programs, but required a callable assembly language wrapper subroutine. Since then, IBM has added many services that can be called from high level languages in, e.g.,
814:, and processes are an abstraction provided by the operating system. A system call does not generally require a context switch to another process; instead, it is processed in the context of whichever process invoked it.
509:, respectively, but in essence they do the same thing). These are "fast" control transfer instructions that are designed to quickly transfer control to the kernel for a system call without the overhead of an interrupt.
825:. The handling of such calls is dependent on the design of the specific operating system kernel and the application runtime environment. The following list shows typical models followed by operating systems:
454:
Implementing system calls requires a transfer of control from user space to kernel space, which involves some sort of architecture-specific feature. A typical way to implement this is to use a
237:(ISAs)). The actual system call does transfer control to the kernel (and is more implementation-dependent and platform-dependent than the library call abstracting it). For example, in
865:
model: In this model, a pool of user threads is mapped to a pool of kernel threads. All system calls from a user thread pool are handled by the threads in their corresponding kernel
839:
model: Every user thread gets attached to a distinct kernel-level thread during a system call. This model solves the above problem of blocking system calls. It is found in all major
1421:
130:
so that it cannot access or modify other running programs or the operating system itself, and is usually prevented from directly manipulating hardware devices (e.g. the
269:), as well as requiring knowledge of the low-level binary interface for the system call operation, which may be subject to change over time and thus not be part of the
1081:
218:
as well), and also setting a unique system call number for the kernel to call. In this way the library, which exists between the OS and the application, increases
1391:
1588:
1414:
311:, although there are a few services with a call linkage. This reflects their origin at a time when programming in assembly language was more common than
280:
based systems, the library is especially important as an intermediary. On exokernels, libraries shield user applications from the very low level kernel
875:
model: This model implements both many to many and one to one models depending upon the choice made by the kernel. This is found in old versions of
572:(Enter Privileged Code) instruction is used. The first eight system call arguments are passed in registers, and the rest are passed on the stack.
818:
1318:
1407:
1361:
707:
1583:
621:, put the code in the instruction; they generate interrupts to specific addresses, transferring control to the operating system. The
43:
A high-level overview of the Linux kernel's system call interface, which handles communication between its various components and the
1217:
1103:
281:
474:
312:
285:
210:. Here, the primary function of the wrapper is to place all the arguments to be passed to the system call in the appropriate
466:, so software simply needs to set up some register with the system call number needed, and execute the software interrupt.
1430:
270:
234:
126:
model specifies multiple privilege levels under which software may be executed: a program is usually limited to its own
580:
289:
1377:
637:
instructions to make system calls to privileged code at various levels; the code is an argument to the instruction.
1535:
884:
856:
194:
and directly used by some system programs on
Windows. The library's wrapper functions expose an ordinary function
1530:
1499:
931:
810:
context switch does occur. The hardware sees the world in terms of the execution mode according to the processor
703:
463:
418:
has over 500, Windows has close to 2000, divided between win32k (graphical) and ntdll (core) system calls while
1447:
308:
262:
122:
1126:
981:
693:
685:
658:
554:
1269:
1504:
558:
321:
300:
1593:
956:
588:
531:
519:
419:
296:
90:
1355:
1514:
219:
1479:
1462:
1334:
368:
362:
155:
71:
1255:
799:, which is accomplished by changing the processor execution mode to a more privileged one, but no
755:
get/set process, file, or device metadata (including author, opener, creation time and date, etc.)
1557:
1545:
1452:
1346:
1329:
840:
822:
697:
681:
527:
455:
398:
392:
386:
380:
374:
356:
350:
211:
195:
167:
79:
1562:
1223:
1213:
1075:
852:
546:
203:
66:
on which it is executed. This may include hardware-related services (for example, accessing a
1540:
1183:
959:
use the
Diagnose (DIAG) instruction as a Hypervisor CALL (HVC) from a virtual machine to CP.
902:
459:
258:
175:
135:
63:
59:
1283:
82:. System calls provide an essential interface between a process and the operating system.
811:
482:
230:
113:
97:
67:
1340:
1169:
1095:
942:
In many but not all cases, IBM documented, e.g., the SVC number, the parameter registers.
1303:
39:
1550:
1494:
1467:
1000:
803:
752:
get/set total system information (including time, date, computer name, enterprise etc.)
676:
576:
75:
31:
1577:
1484:
1399:
1256:"Discussion of system call implementation at ProgClub including quote from Bach 1986"
127:
1474:
1322:
1052:
598:
434:
403:
328:
and in all later MVS versions, some system call macros generate
Program Call (PC).
131:
116:
of most modern processors, with the exception of some embedded systems, involves a
1360:
Jorrit N. Herder, Herbert Bos, Ben Gras, Philip
Homburg, and Andrew S. Tanenbaum,
1067:
1489:
866:
796:
226:
191:
1312:
178:
for the system calls, often named the same as the system calls they invoke. On
1457:
1384:
1381:
1227:
1212:. Peter B Galvin; Greg Gagne (10th ed.). Hoboken, NJ: Wiley. p. 67.
1146:
670:
667:
215:
207:
199:
183:
179:
1015:
927:
792:
538:
402:. Many modern operating systems have hundreds of system calls. For example,
341:
277:
238:
190:
library; this is an undocumented API used by implementations of the regular
163:
143:
117:
101:
86:
44:
17:
1034:
1068:"Windows WIN32K.SYS System Call Table (NT/2000/XP/2003/Vista/2008/7/8/10)"
261:
is more complicated and may require embedded assembly code to be used (in
249:
are C library functions that in turn execute instructions that invoke the
561:
it causes, and the existence of the faster instructions mentioned above.
206:
level) for using the system call, as well as making the system call more
1308:
897:
542:
415:
407:
304:
1371:
595:
443:
439:
430:
426:
411:
325:
307:
implement most system calls through a library of assembly language
266:
225:
The call to the library function itself does not cause a switch to
1326:
952:
880:
844:
833:
at a time, this model cannot utilize multiple cores of processors.
565:
510:
506:
345:
171:
1141:
1118:
70:
or accessing the device's camera), creation and execution of new
907:
876:
470:
337:
317:
162:
that sits between normal programs and the operating system. On
1403:
645:
System calls can be grouped roughly into six major categories:
848:
622:
550:
514:
502:
478:
166:
systems, that API is usually part of an implementation of the
159:
93:
for example, privileged system code also issues system calls.
523:
instruction, where the system call number was placed in the
233:(using, for example, a "CALL" assembly instruction in some
983:
IBM System/360 Operating System System
Programmer's Guide
273:; the library functions are meant to abstract this away.
1053:"FreeBSD syscalls.c, the list of syscall names and IDs"
348:-compliant operating systems, popular system calls are
1393:
1374: – examples on System Calls under Unix
930:
operating systems, system calls are used only for the
462:. Interrupts transfer control to the operating system
257:
system calls. Making the system call directly in the
1368:
31, no. 2 (April 2006); 19–28, accessed 5 March 2018
501:(these two mechanisms were independently created by
481:
support additional techniques. For example, the x86
85:
In most systems, system calls can only be made from
1523:
1438:
1170:"Sysenter Based System Call Mechanism in Linux 2.6"
613:instructions, which, similar to the IBM System/360
1356:HOWTO for Implementing a System Call on Linux 2.6
1341:Sysenter Based System Call Mechanism in Linux 2.6
821:process, system calls can be made from multiple
625:32-bit successor to the PDP-11 series used the
1415:
469:This is the only technique provided for many
8:
1142:"Linux 2.5 gets vsyscalls, sysenter support"
989:. Third Edition. pp. 32–36. C28-6550-2.
142:system calls, which are often initiated via
1184:"Liberation: x86 Instruction Set Reference"
1080:: CS1 maint: numeric names: authors list (
1066:Mateusz "j00ru" Jurczyk (5 November 2017).
100:, system calls typically do not change the
1422:
1408:
1400:
980:IBM (March 1967). "Writing SVC Routines".
806:is necessary – although a
27:Way for programs to access kernel services
1311:with main API functions and structures,
579:mainframe family, and its successors, a
517:, where available; formerly it used the
38:
1348:Kernel command using Linux system calls
1337:(1996, based on the 1993 0.99.2 kernel)
1304:A list of modern Unix-like system calls
1242:The Design of the UNIX Operating System
972:
919:
763:create, delete communication connection
1372:A simple open Unix Shell in C language
1106:from the original on 8 September 2023,
1073:
438:implemented with system calls such as
1362:Modular system programming on Minix 3
1129:from the original on 8 November 2023.
1035:"System call names (kern/syscalls.c)"
1016:"System call names (kern/syscalls.c)"
58:) is the programmatic way in which a
7:
1321: – system calls for
787:Processor mode and context switching
410:each have over 300 different calls,
1589:Application programming interfaces
1335:How System Calls Work on Linux/i86
1108:the list of syscall names and IDs.
744:logically attach or detach devices
89:processes, while in some systems,
74:, and communication with integral
25:
1001:"syscalls(2) - Linux manual page"
772:attach or detach remote devices
1396:, CodeGuru.com, 8 October 2004
1208:Silberschatz, Abraham (2018).
1140:Anonymous (19 December 2002).
735:request device, release device
150:The library as an intermediary
1:
1014:OpenBSD (14 September 2013).
656:create process (for example,
235:Instruction set architectures
154:Generally, systems provide a
1431:Application binary interface
1309:Interactive Linux kernel map
545:and later, for example, see
513:2.5 began using this on the
442:or system calls on files in
324:. In more recent release of
271:application binary interface
62:requests a service from the
1584:Operating system technology
1244:, Prentice Hall, pp. 15–16.
769:transfer status information
581:Supervisor Call instruction
1610:
1536:Foreign function interface
1033:NetBSD (17 October 2013).
690:get/set process attributes
641:Categories of system calls
557:and the resulting lack of
537:An older mechanism is the
485:contains the instructions
182:, that API is part of the
29:
1531:Binary-code compatibility
1500:Position-independent code
1240:Bach, Maurice J. (1986),
1210:Operating System Concepts
795:systems are processed in
741:get/set device attributes
662:on Unix-like systems, or
54:(commonly abbreviated to
1387:, including system calls
780:get/set file permissions
749:Information maintenance
718:create file, delete file
229:and is usually a normal
30:Not to be confused with
738:read, write, reposition
727:get/set file attributes
724:read, write, reposition
555:x86 memory segmentation
450:Typical implementations
766:send, receive messages
696:for time, wait event,
477:architectures such as
47:
1378:Inside the Native API
1254:Elliot, John (2011).
1100:Plan 9 from Bell Labs
951:The CP components of
791:System calls in most
589:Service Request Block
541:; originally used in
91:OS/360 and successors
42:
1515:Virtual method table
1351:, IBM developerWorks
1480:Memory segmentation
1390:Gulbrandsen, John;
1380: –
1330:calling conventions
1039:BSD Cross Reference
1020:BSD Cross Reference
841:Linux distributions
534:0x80 was executed.
313:high-level language
212:processor registers
120:. For example, the
1453:Calling convention
1319:Linux system calls
1284:"Threading Models"
1168:Manu Garg (2006).
732:Device management
456:software interrupt
414:has close to 500,
332:Examples and tools
214:(and maybe on the
196:calling convention
80:process scheduling
48:
1571:
1570:
1563:Year 2038 problem
1354:Choudhary, Amit;
677:terminate process
176:wrapper functions
16:(Redirected from
1601:
1541:Language binding
1424:
1417:
1410:
1401:
1291:
1290:
1288:
1280:
1274:
1273:
1266:
1260:
1259:
1251:
1245:
1238:
1232:
1231:
1205:
1199:
1198:
1196:
1194:
1180:
1174:
1173:
1165:
1159:
1158:
1156:
1154:
1137:
1131:
1130:
1115:
1109:
1107:
1092:
1086:
1085:
1079:
1071:
1063:
1057:
1056:
1049:
1043:
1042:
1030:
1024:
1023:
1011:
1005:
1004:
997:
991:
990:
988:
977:
960:
949:
943:
940:
934:
924:
903:Linux kernel API
715:File management
665:
661:
653:Process control
636:
632:
628:
620:
616:
612:
608:
604:
586:
571:
526:
522:
500:
496:
492:
488:
473:processors, but
401:
395:
389:
383:
377:
371:
365:
359:
353:
259:application code
256:
252:
248:
244:
189:
174:, that provides
170:(libc), such as
98:embedded systems
64:operating system
60:computer program
50:In computing, a
21:
1609:
1608:
1604:
1603:
1602:
1600:
1599:
1598:
1574:
1573:
1572:
1567:
1519:
1440:
1434:
1428:
1300:
1295:
1294:
1286:
1282:
1281:
1277:
1268:
1267:
1263:
1253:
1252:
1248:
1239:
1235:
1220:
1207:
1206:
1202:
1192:
1190:
1182:
1181:
1177:
1167:
1166:
1162:
1152:
1150:
1139:
1138:
1134:
1117:
1116:
1112:
1094:
1093:
1089:
1072:
1065:
1064:
1060:
1051:
1050:
1046:
1032:
1031:
1027:
1013:
1012:
1008:
999:
998:
994:
986:
979:
978:
974:
969:
964:
963:
950:
946:
941:
937:
925:
921:
916:
894:
812:status register
789:
664:NtCreateProcess
663:
657:
643:
634:
630:
626:
618:
614:
610:
606:
602:
584:
569:
524:
518:
498:
494:
490:
486:
483:instruction set
452:
397:
391:
385:
379:
373:
367:
361:
355:
349:
334:
254:
250:
246:
242:
231:subroutine call
187:
152:
110:
76:kernel services
68:hard disk drive
35:
28:
23:
22:
15:
12:
11:
5:
1607:
1605:
1597:
1596:
1591:
1586:
1576:
1575:
1569:
1568:
1566:
1565:
1560:
1555:
1554:
1553:
1543:
1538:
1533:
1527:
1525:
1524:Related topics
1521:
1520:
1518:
1517:
1512:
1507:
1502:
1497:
1495:Opaque pointer
1492:
1487:
1482:
1477:
1472:
1471:
1470:
1460:
1455:
1450:
1444:
1442:
1436:
1435:
1429:
1427:
1426:
1419:
1412:
1404:
1398:
1397:
1388:
1375:
1369:
1358:
1352:
1344:
1338:
1332:
1316:
1306:
1299:
1298:External links
1296:
1293:
1292:
1275:
1261:
1246:
1233:
1218:
1200:
1188:renejeschke.de
1175:
1160:
1132:
1110:
1087:
1058:
1044:
1025:
1006:
992:
971:
970:
968:
965:
962:
961:
944:
935:
918:
917:
915:
912:
911:
910:
905:
900:
893:
890:
889:
888:
870:
860:
834:
804:context switch
788:
785:
784:
783:
782:
781:
775:
774:
773:
770:
767:
764:
760:Communication
758:
757:
756:
753:
747:
746:
745:
742:
739:
736:
730:
729:
728:
725:
722:
719:
713:
712:
711:
701:
691:
688:
679:
674:
650:
649:
642:
639:
577:IBM System/360
568:architecture,
451:
448:
425:Tools such as
333:
330:
284:, and provide
151:
148:
118:security model
109:
106:
102:privilege mode
32:System command
26:
24:
14:
13:
10:
9:
6:
4:
3:
2:
1606:
1595:
1592:
1590:
1587:
1585:
1582:
1581:
1579:
1564:
1561:
1559:
1556:
1552:
1549:
1548:
1547:
1544:
1542:
1539:
1537:
1534:
1532:
1529:
1528:
1526:
1522:
1516:
1513:
1511:
1508:
1506:
1503:
1501:
1498:
1496:
1493:
1491:
1488:
1486:
1485:Name mangling
1483:
1481:
1478:
1476:
1473:
1469:
1466:
1465:
1464:
1461:
1459:
1456:
1454:
1451:
1449:
1446:
1445:
1443:
1437:
1432:
1425:
1420:
1418:
1413:
1411:
1406:
1405:
1402:
1395:
1394:
1389:
1386:
1383:
1379:
1376:
1373:
1370:
1367:
1363:
1359:
1357:
1353:
1350:
1349:
1345:
1342:
1339:
1336:
1333:
1331:
1328:
1324:
1320:
1317:
1314:
1310:
1307:
1305:
1302:
1301:
1297:
1285:
1279:
1276:
1271:
1265:
1262:
1257:
1250:
1247:
1243:
1237:
1234:
1229:
1225:
1221:
1219:9781119320913
1215:
1211:
1204:
1201:
1189:
1185:
1179:
1176:
1171:
1164:
1161:
1149:
1148:
1143:
1136:
1133:
1128:
1124:
1120:
1114:
1111:
1105:
1101:
1097:
1091:
1088:
1083:
1077:
1069:
1062:
1059:
1054:
1048:
1045:
1040:
1036:
1029:
1026:
1021:
1017:
1010:
1007:
1002:
996:
993:
985:
984:
976:
973:
966:
958:
954:
948:
945:
939:
936:
933:
929:
923:
920:
913:
909:
906:
904:
901:
899:
896:
895:
891:
886:
882:
878:
874:
871:
868:
864:
861:
858:
854:
850:
846:
842:
838:
835:
831:
828:
827:
826:
824:
820:
819:multithreaded
815:
813:
809:
805:
802:
798:
794:
786:
779:
778:
776:
771:
768:
765:
762:
761:
759:
754:
751:
750:
748:
743:
740:
737:
734:
733:
731:
726:
723:
720:
717:
716:
714:
709:
705:
702:
699:
695:
692:
689:
687:
683:
680:
678:
675:
672:
669:
660:
655:
654:
652:
651:
648:
647:
646:
640:
638:
624:
600:
597:
592:
590:
582:
578:
573:
567:
562:
560:
556:
552:
549:on the Intel
548:
544:
540:
535:
533:
529:
521:
516:
512:
508:
504:
484:
480:
476:
472:
467:
465:
461:
457:
449:
447:
445:
441:
436:
432:
428:
423:
421:
417:
413:
409:
405:
400:
394:
388:
382:
376:
370:
364:
358:
352:
347:
343:
339:
331:
329:
327:
323:
319:
314:
310:
306:
302:
298:
293:
291:
287:
283:
279:
274:
272:
268:
264:
260:
240:
236:
232:
228:
223:
221:
217:
213:
209:
205:
201:
197:
193:
185:
181:
177:
173:
169:
165:
161:
157:
149:
147:
145:
139:
137:
133:
129:
128:address space
125:
124:
119:
115:
107:
105:
103:
99:
94:
92:
88:
83:
81:
77:
73:
69:
65:
61:
57:
53:
46:
41:
37:
33:
19:
1594:System calls
1509:
1475:Machine code
1392:
1365:
1347:
1323:Linux kernel
1278:
1264:
1249:
1241:
1236:
1209:
1203:
1191:. Retrieved
1187:
1178:
1163:
1151:. Retrieved
1145:
1135:
1122:
1113:
1099:
1090:
1061:
1047:
1038:
1028:
1019:
1009:
995:
982:
975:
947:
938:
922:
872:
863:Many-to-many
862:
836:
829:
816:
807:
800:
790:
644:
599:minicomputer
593:
591:(SRB) mode.
574:
563:
536:
468:
453:
424:
335:
294:
292:management.
286:abstractions
275:
224:
202:call on the
153:
140:
132:frame buffer
121:
114:architecture
111:
104:of the CPU.
95:
84:
55:
51:
49:
36:
18:System calls
1510:System call
1490:Object code
1441:conventions
867:thread pool
830:Many-to-one
797:kernel mode
777:Protection
721:open, close
559:portability
227:kernel mode
220:portability
192:Windows API
52:system call
1578:Categories
1505:Relocation
1458:Call stack
1385:Native API
1382:Windows NT
1325:2.2, with
1228:1004849022
1147:KernelTrap
1123:OSDev wiki
1119:"SYSENTER"
967:References
837:One-to-one
671:Native API
668:Windows NT
344:and other
216:call stack
200:subroutine
184:Native API
180:Windows NT
144:interrupts
138:devices).
108:Privileges
1448:Alignment
1270:"Threads"
1153:1 January
928:UNIX-like
859:versions.
851:, recent
808:privilege
793:Unix-like
601:used the
547:call gate
539:call gate
532:interrupt
342:Unix-like
278:exokernel
241:systems,
239:Unix-like
188:ntdll.dll
186:, in the
168:C library
164:Unix-like
87:userspace
72:processes
45:userspace
1127:Archived
1104:Archived
1076:cite web
892:See also
704:allocate
617:and x86
528:register
495:SYSENTER
422:has 51.
290:resource
204:assembly
78:such as
1551:dynamic
1463:Library
1366:;login:
1315:version
1096:"sys.h"
898:DOS API
885:Solaris
857:Solaris
853:Windows
823:threads
801:process
686:execute
666:in the
575:In the
543:Multics
530:before
499:SYSEXIT
487:SYSCALL
416:FreeBSD
408:OpenBSD
305:TSS/360
301:DOS/360
208:modular
156:library
136:network
56:syscall
1558:Loader
1546:Linker
1468:static
1439:Parts,
1343:(2006)
1226:
1216:
1193:4 July
932:kernel
873:Hybrid
710:memory
698:signal
633:, and
596:PDP-11
491:SYSRET
464:kernel
444:procfs
440:ptrace
431:ftrace
427:strace
420:Plan 9
412:NetBSD
396:, and
326:MVS/SP
309:macros
297:OS/360
295:IBM's
247:execve
1433:(ABI)
1327:IA-32
1287:(PDF)
987:(PDF)
953:CP-67
914:Notes
881:HP-UX
845:macOS
817:In a
700:event
566:IA-64
511:Linux
507:Intel
435:truss
404:Linux
369:close
363:write
346:POSIX
322:z/VSE
172:glibc
123:rings
1224:OCLC
1214:ISBN
1195:2015
1155:2008
1082:link
955:and
908:vDSO
883:and
877:IRIX
855:and
708:free
706:and
694:wait
682:load
659:fork
635:CHMS
631:CHME
627:CHMK
609:and
607:TRAP
594:The
564:For
505:and
493:and
475:CISC
471:RISC
460:trap
433:and
406:and
399:kill
393:exit
387:fork
381:exec
375:wait
357:read
351:open
338:Unix
320:and
318:z/OS
303:and
288:and
265:and
255:exec
253:and
251:fork
245:and
243:fork
112:The
96:For
1313:PDF
926:In
849:iOS
623:VAX
619:INT
615:SVC
611:IOT
603:EMT
585:SVC
570:EPC
551:x86
525:EAX
520:INT
515:x86
503:AMD
479:x86
458:or
336:On
282:API
276:On
267:C++
198:(a
160:API
158:or
134:or
1580::
1364:,
1222:.
1186:.
1144:.
1125:.
1121:.
1102:.
1098:.
1078:}}
1074:{{
1037:.
1018:.
957:VM
879:,
847:,
843:,
684:,
629:,
605:,
446:.
429:,
390:,
384:,
378:,
372:,
366:,
360:,
354:,
340:,
299:,
222:.
1423:e
1416:t
1409:v
1289:.
1272:.
1258:.
1230:.
1197:.
1172:.
1157:.
1084:)
1070:.
1055:.
1041:.
1022:.
1003:.
887:.
869:.
673:)
583:(
497:/
489:/
263:C
34:.
20:)
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.