int atexit(void (*func)(void))
Return value: If the function is successfully registered, the function returns zero, otherwise it returns a non-zero value.
Header file: #include<stdlib.h>
Function: When the program terminates normally, call the specified function func. You can register your termination function anywhere, but it will be called when the program terminates.
int setjmp(jmp_buf env);
Note: If it is actively called, it will return 0. If it is called by longjmp, it will return the second parameter value of longjmp.
void longjmp(jmp_buf env,int val);
Parameter description: The first is the env used when calling setjmp, and the second parameter will be the value returned from setjmp.
Header file: #include <setjmp.h>
Function: In the upgraded version of goto, goto can only jump in the same function, but setjmp and longjmp can jump between different functions.
int getrlimit( int resource, struct rlimit *rlptr );
int setrlimit( int resource, const struct rlimit *rlptr );
Header file: #include <sys/resource.h>
Return value: if successful, return 0, if error, return non-zero value
Role: Obtain or set resource usage restrictions.
int nice(int incr);
Header file: #include<unistd.h>
Return value: successfully set the value of output inc, return -1 on error
Function: Change the priority of the current process to: current priority + inc value
int getpriority(int which, int who);
int setpriority(int which, int who, int prio);
Header file: #include <sys/time.h>
#include <sys/resource.h>
Return value: What is actually returned is the nice value of the process, but the nice value is converted, and the 20-nice value is returned. The smaller the nice value of the process, the higher the priority of the process.