You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
471 B
32 lines
471 B
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright (c) 2016 Linux Test Project
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
|
|
#include "tst_sig_proc.h"
|
|
|
|
#define TST_NO_DEFAULT_MAIN
|
|
#include "tst_test.h"
|
|
|
|
pid_t create_sig_proc(int sig, int count, unsigned int usec)
|
|
{
|
|
pid_t pid, cpid;
|
|
|
|
pid = getpid();
|
|
cpid = SAFE_FORK();
|
|
|
|
if (cpid == 0) {
|
|
while (count-- > 0) {
|
|
usleep(usec);
|
|
if (kill(pid, sig) == -1)
|
|
break;
|
|
}
|
|
exit(0);
|
|
}
|
|
|
|
return cpid;
|
|
}
|