Difference between revisions of "C processes in Linux"
From Teknologisk videncenter
m (→Advance) |
m |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | There are several ways of creating a new process. | |
− | + | *Most used: | |
− | + | **[[fork system call]] family ("clone" a runnning process to two running instances of the same code) | |
− | fork( | + | **[[exec system call]] family (Execute a file) |
− | * | + | *But also: |
− | * | + | **[[clone system call]] (Like [[fork system call|fork]] - but more advanced) |
− | + | **[[system and popen system call]] (Can give security issues) | |
− | + | =Advanced= | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==prctl== | ==prctl== | ||
prctl - operations on a process | prctl - operations on a process | ||
Line 79: | Line 17: | ||
... | ... | ||
</source> | </source> | ||
+ | =Links= | ||
+ | *[http://boron.physics.metu.edu.tr/ozdogan/SystemsProgramming/week4/node8.html Creating processes] | ||
+ | [[Category:Linux]][[Category:C]] |
Latest revision as of 07:59, 17 December 2022
There are several ways of creating a new process.
- Most used:
- fork system call family ("clone" a runnning process to two running instances of the same code)
- exec system call family (Execute a file)
- But also:
- clone system call (Like fork - but more advanced)
- system and popen system call (Can give security issues)
Advanced
prctl
prctl - operations on a process
// Changing the name of running proces
#include <sys/prctl.h>
...
prctl(PR_SET_NAME, "newname");
...