S
S
Stanislaw112015-09-08 02:16:43
C++ / C#
Stanislaw11, 2015-09-08 02:16:43

Where can I talk about functions like fork, setsid, chdir and others in C (C++)?

Hello. The fact is that I have been studying C ++ for a long time, but I still do not understand how interaction with the system takes place without an API. Let's say I want to write a *nix daemon. But I didn't see anything about it in any of the plus books I studied. I know that there is a fork function that creates a process, there are setsid and chdir, but how to use them and how many more such functions that are not third-party libraries, but are part of the language? How can I find information about these features? And do these functions have anything to do with system calls? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-09-08
@Stanislaw11

I know, that there is such a fork function that creates a process,

It does not just create a process, it clones the process, makes a complete copy of it from the moment it was called (well, not quite right away, as an optimization, all memory pages used by the process calling fork are marked for copy-on-write)
They are not part of the language, they are a system API. Specifically, fork is in the unistd library and is part of the Posix system API. Let's say there are no complete analogues of fork in windows api, everything is a little different there. You have to get by with CreateProcess or threads.
Yes, that's what they are, system call, kernel functions.
in a word, read Tanenbaum

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question