Changing the process ID (PID) in Linux

前端 未结 2 1354
不思量自难忘°
不思量自难忘° 2021-01-21 15:51

Is it possible to change the PID in Linux? If anyone know, please tell me.

Requirement: actually I want to bring up the back ground process to foreground, which is bein

2条回答
  •  无人及你
    2021-01-21 16:07

    No, it's not possible to do such a thing on Unix. You might be able to use fork to achieve this effect, but you have to tell us what you are trying to achieve.

    pid_t pid;
    
    /* I want a new PID. */
    pid fork();
    if (pid == 0) {
        /* getpid() will show I've got a new PID. */
    else
        _exit(0); /* Parent or check for -1 (tinfoil hat)
    

    Obviously, like I said before, you "might" be able to use this.

提交回复
热议问题