/freebsd/usr.bin/renice/tests/ |
H A D | renice_test.sh | 16 local pid=$1 18 local actual="$(ps -o nice= -p $pid)" 27 local pid nice incr 29 pid=$! 30 nice="$(ps -o nice= -p $pid)" 32 _renice $((nice+incr)) $pid 33 atf_check_nice_value $pid $((nice+incr)) 34 kill $pid 42 local pid nice incr 44 pid=$! [all …]
|
/freebsd/usr.sbin/daemon/tests/ |
H A D | daemon_test.sh | 33 daemon -P daemon.pid -p sleep.pid sleep 300 34 atf_check -s exit:0 test -f daemon.pid 35 atf_check -s exit:0 -o match:"daemon: sleep" ps -p `cat daemon.pid` 36 atf_check -s exit:0 test -f sleep.pid 37 atf_check -s exit:0 -o match:"[0-9] sleep 300$" ps -p `cat sleep.pid` 40 if [ -f daemon.pid ]; then 41 daemon_pid=`cat daemon.pid` 44 sleep_pid=`cat sleep.pid` 58 daemon -p ${PWD}/sleep.pid -c bin/sleep 300 59 atf_check -s exit:0 test -f sleep.pid [all …]
|
/freebsd/contrib/netbsd-tests/bin/ps/ |
H A D | t_ps.sh | 94 default_keywords='pid tty stat time command' 95 j_keywords='user pid ppid pgid sess jobc state tt time command' 96 l_keywords='uid pid ppid cpu pri nice vsz rss wchan state tt time command' 97 s_keywords='uid pid ppid cpu lid nlwp pri nice vsz rss wchan lstate tt ltime command' 98 u_keywords='user pid %cpu %mem vsz rss tt state start time command' 99 v_keywords='pid state time sl re pagein vsz rss lim tsiz %cpu %mem command' 209 "$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')" 211 "$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')" 213 "$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')" 227 check_heading_keywords '-o pid,%cpu,%mem' \ [all …]
|
/freebsd/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/ |
H A D | tst.printtype.ksh | 38 pid=$! 41 pid$pid::ff_getgameid:entry 44 print(*(pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)))); 49 pid$pid::ff_getpartysize:entry 52 print(*(pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)))); 57 pid$pid::ff_getsummons:entry 60 print(*(pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)))); 67 kill -9 $pid
|
H A D | tst.chasestrings.ksh | 39 pid=$! 42 pid$pid::has_princess:entry 45 this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); 52 pid$pid::has_dungeons:entry 55 this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); 62 pid$pid::has_villain:entry 65 this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); 74 kill -9 $pid
|
H A D | tst.printtypetarg.ksh | 39 pid=$! 41 $dtrace -p $pid -qs /dev/stdin <<EOF 42 pid\$target::ff_getgameid:entry 45 print(*(pid\`$t *)(copyin(arg0, sizeof (pid\`$t)))); 50 pid\$target::ff_getpartysize:entry 53 print(*(pid\`$t *)(copyin(arg0, sizeof (pid\`$t)))); 58 pid\$target::ff_getsummons:entry 61 print(*(pid\`$t *)(copyin(arg0, sizeof (pid\`$t)))); 68 kill -9 $pid
|
/freebsd/tests/sys/audit/ |
H A D | process-control.c | 51 static pid_t pid; variable 67 pid = getpid(); in ATF_TC_BODY() 68 snprintf(pcregex, sizeof(pcregex), "fork.*%d.*return,success", pid); in ATF_TC_BODY() 72 ATF_REQUIRE((pid = fork()) != -1); in ATF_TC_BODY() 73 if (pid) in ATF_TC_BODY() 100 ATF_REQUIRE((pid = fork()) != -1); in ATF_TC_BODY() 101 if (pid) { in ATF_TC_BODY() 102 snprintf(pcregex, sizeof(pcregex), "exit.*%d.*success", pid); in ATF_TC_BODY() 128 pid = getpid(); in ATF_TC_BODY() 129 snprintf(pcregex, sizeof(pcregex), "rfork.*%d.*return,success", pid); in ATF_TC_BODY() [all …]
|
H A D | administrative.c | 48 static pid_t pid; variable 69 pid = getpid(); in ATF_TC_BODY() 70 snprintf(adregex, sizeof(adregex), "settimeofday.*%d.*success", pid); in ATF_TC_BODY() 97 pid = getpid(); in ATF_TC_BODY() 98 snprintf(adregex, sizeof(adregex), "settimeofday.*%d.*failure", pid); in ATF_TC_BODY() 126 pid = getpid(); in ATF_TC_BODY() 127 snprintf(adregex, sizeof(adregex), "clock_settime.*%d.*success", pid); in ATF_TC_BODY() 153 pid = getpid(); in ATF_TC_BODY() 154 snprintf(adregex, sizeof(adregex), "clock_settime.*%d.*failure", pid); in ATF_TC_BODY() 180 pid = getpid(); in ATF_TC_BODY() [all …]
|
/freebsd/tools/test/ptrace/ |
H A D | scescx.c | 150 get_pathname(pid_t pid) in get_pathname() argument 159 name[3] = pid; in get_pathname() 166 pid, strerror(errno)); in get_pathname() 169 fprintf(stderr, "pid %d exited\n", pid); in get_pathname() 173 fprintf(stderr, "No cached pathname for process %d\n", pid); in get_pathname() 176 printf(TRACE "pid %d path %s\n", pid, pathname); in get_pathname() 180 wait_info(int pid, int status, struct ptrace_lwpinfo *lwpinfo) in wait_info() argument 185 printf(TRACE "pid %d wait %s", pid, in wait_info() 218 trace_sc(int pid) in trace_sc() argument 224 if (ptrace(PT_TO_SCE, pid, (caddr_t)1, 0) < 0) { in trace_sc() [all …]
|
/freebsd/contrib/netbsd-tests/lib/libc/sys/ |
H A D | t_wait.c | 80 pid_t pid; in ATF_TC_BODY() local 82 switch (pid = fork()) { in ATF_TC_BODY() 84 ATF_REQUIRE(pid > 0); in ATF_TC_BODY() 89 ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid); in ATF_TC_BODY() 92 ATF_REQUIRE(si.si_pid == pid); in ATF_TC_BODY() 115 pid_t pid; in ATF_TC_BODY() local 117 switch (pid = fork()) { in ATF_TC_BODY() 122 ATF_REQUIRE(pid > 0); in ATF_TC_BODY() 124 ATF_REQUIRE(kill(pid, SIGTERM) == 0); in ATF_TC_BODY() 125 ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid); in ATF_TC_BODY() [all …]
|
/freebsd/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/ |
H A D | dtest.pl | 123 if (-f "$opt_d/$pid.core") { 124 print README "; see $pid.core\n"; 132 if (-f "$opt_d/$pid.out") { 133 rename("$opt_d/$pid.out", "$opt_d/failure.$n/$pid.out"); 137 if (-f "$opt_d/$pid.err") { 138 rename("$opt_d/$pid.err", "$opt_d/failure.$n/$pid.err"); 142 if (-f "$opt_d/$pid.core") { 143 rename("$opt_d/$pid.core", "$opt_d/failure.$n/$pid.core"); 308 if (($pid = fork()) == -1) { 313 if ($pid == 0) { [all …]
|
/freebsd/sys/compat/linux/ |
H A D | linux_ptrace.c | 122 linux_ptrace_status(struct thread *td, pid_t pid, int status) in linux_ptrace_status() argument 130 error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); in linux_ptrace_status() 160 linux_ptrace_peek(struct thread *td, pid_t pid, void *addr, void *data) in linux_ptrace_peek() argument 164 error = kern_ptrace(td, PT_READ_I, pid, addr, 0); in linux_ptrace_peek() 175 linux_ptrace_setoptions(struct thread *td, pid_t pid, l_ulong data) in linux_ptrace_setoptions() argument 225 return (kern_ptrace(td, PT_SET_EVENT_MASK, pid, &mask, sizeof(mask))); in linux_ptrace_setoptions() 229 linux_ptrace_geteventmsg(struct thread *td, pid_t pid, l_ulong data) in linux_ptrace_geteventmsg() argument 237 linux_ptrace_getsiginfo(struct thread *td, pid_t pid, l_ulong data) in linux_ptrace_getsiginfo() argument 243 error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); in linux_ptrace_getsiginfo() 263 linux_ptrace_getregs(struct thread *td, pid_t pid, void *data) in linux_ptrace_getregs() argument [all …]
|
/freebsd/sys/kern/ |
H A D | kern_tslog.c | 150 tslog_user(pid_t pid, pid_t ppid, const char * execname, const char * namei) in tslog_user() argument 155 if (procs[pid].reused) in tslog_user() 161 if (procs[pid].ppid) { in tslog_user() 162 procs[pid].reused = 1; in tslog_user() 167 procs[pid].ppid = ppid; in tslog_user() 168 procs[pid].tsc_forked = tsc; in tslog_user() 174 if (procs[pid].execname != NULL) in tslog_user() 175 free(procs[pid].execname, M_TSLOGUSER); in tslog_user() 176 procs[pid].execname = strdup(execname, M_TSLOGUSER); in tslog_user() 182 if (procs[pid].namei == NULL) in tslog_user() [all …]
|
/freebsd/bin/pkill/tests/ |
H A D | pkill-j_test.sh | 24 command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount & 27 command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount & 54 [ -f ${PWD}/${base}_1_1.pid ] && kill "$(cat ${PWD}/${base}_1_1.pid)" 55 [ -f ${PWD}/${base}_1_2.pid ] && kill "$(cat ${PWD}/${base}_1_2.pid)" 61 command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount & 64 command=daemon -p ${PWD}/${base}_2_2.pid $sleep $sleep_amount & 70 ! test -f ${PWD}/${base}_2_1.pid && 71 ! test -f ${PWD}/${base}_2_2.pid && kill $chpid3; then 76 [ -f ${PWD}/${base}_2_1.pid ] && kill "$(cat ${PWD}/${base}_2_1.pid)" 77 [ -f ${PWD}/${base}_2_2.pid ] && kill "$(cat ${PWD}/${base}_2_2.pid)" [all …]
|
/freebsd/lib/libc/tests/stdlib/ |
H A D | libc_exit_test.c | 59 pid_t pid; in ATF_TC_BODY() local 62 pid = fork(); in ATF_TC_BODY() 63 if (pid == 0) { in ATF_TC_BODY() 71 ATF_REQUIRE_MSG(pid > 0, in ATF_TC_BODY() 73 ATF_CHECK_EQ_MSG(pid, waitpid(pid, &wstatus, 0), in ATF_TC_BODY() 91 pid_t pid; in ATF_TC_BODY() local 94 pid = fork(); in ATF_TC_BODY() 95 if (pid == 0) { in ATF_TC_BODY() 99 ATF_REQUIRE_MSG(pid > 0, in ATF_TC_BODY() 101 ATF_CHECK_EQ_MSG(pid, waitpid(pid, &wstatus, 0), in ATF_TC_BODY() [all …]
|
/freebsd/usr.sbin/autofs/ |
H A D | popen.c | 58 struct pid { struct 59 SLIST_ENTRY(pid) next; 61 pid_t pid; argument 64 static SLIST_HEAD(, pid) pidlist = SLIST_HEAD_INITIALIZER(pidlist); argument 77 struct pid *cur, *p; in auto_popen() 78 pid_t pid; in auto_popen() local 90 cur = malloc(sizeof(struct pid)); in auto_popen() 112 switch (pid = fork()) { in auto_popen() 131 log_debugx("executing \"%s\" as pid %d", command, pid); in auto_popen() 139 cur->pid = pid; in auto_popen() [all …]
|
/freebsd/tests/sys/file/ |
H A D | flock_helper.c | 111 safe_waitpid(pid_t pid) in safe_waitpid() argument 118 while (waitpid(pid, &status, 0) != pid) { in safe_waitpid() 185 int pid; in test2() local 199 pid = fork(); in test2() 200 if (pid < 0) in test2() 203 if (pid == 0) { in test2() 230 kill(pid, SIGTERM); in test2() 231 safe_waitpid(pid); in test2() 256 int pid; in test3() local 270 pid = fork(); in test3() [all …]
|
/freebsd/tools/test/stress2/misc/ |
H A D | kevent12.sh | 48 pid=$! 53 wait $pid 92 add_watch(pid_t pid) 98 kev.ident = pid; 112 "kevent - add watch for pid %u", pid); 125 pid_t pid; 149 pid = kev[i].ident; 151 add_watch(pid); 152 printf("%u - new process, parent %u\n", pid, 156 printf("%u forked\n", pid); [all …]
|
H A D | ptrace2.sh | 49 pid_t pid; 54 pid = fork(); 55 if (pid == 0) { 67 ptrace(PT_ATTACH, pid, (caddr_t) 0, 0); 71 wait4(pid, &status, 0, NULL); 75 ptrace(PT_DETACH, pid, (caddr_t) 1, 0); 81 kill(pid, SIGINT); 98 pid_t pid; 103 pid = fork(); 104 if (pid == 0) { [all …]
|
/freebsd/usr.bin/mail/ |
H A D | popen.c | 45 pid_t pid; member 51 pid_t pid; member 100 pid_t pid; in Popen() local 117 pid = start_command(value("SHELL"), &nset, fd0, fd1, "-c", cmd, NULL); in Popen() 118 if (pid < 0) { in Popen() 125 register_file(fp, 1, pid); in Popen() 159 register_file(FILE *fp, int pipe, pid_t pid) in register_file() argument 167 fpp->pid = pid; in register_file() 194 return (p->pid); in file_pid() 210 pid_t pid; in start_commandv() local [all …]
|
/freebsd/tests/sys/fifo/ |
H A D | fifo_open.c | 103 pid_t pid; in run_in_process() local 105 pid = fork(); in run_in_process() 106 if (pid < 0) { in run_in_process() 111 if (pid == 0) in run_in_process() 115 *pidp = pid; in run_in_process() 126 wait_and_timeout(pid_t pid, int timeout, int *status, const char *errstr) in wait_and_timeout() argument 136 wpid = waitpid(pid, status, WNOHANG); in wait_and_timeout() 138 warn("%s: wait_and_timeout: waitpid %d", errstr, pid); in wait_and_timeout() 142 if (wpid == pid) in wait_and_timeout() 148 wpid = waitpid(pid, status, WNOHANG); in wait_and_timeout() [all …]
|
/freebsd/contrib/netbsd-tests/lib/libc/stdlib/ |
H A D | t_exit.c | 59 pid_t pid; in ATF_TC_BODY() local 62 pid = fork(); in ATF_TC_BODY() 63 ATF_REQUIRE(pid >= 0); in ATF_TC_BODY() 65 if (pid == 0) { in ATF_TC_BODY() 92 pid_t pid; in ATF_TC_BODY() local 95 pid = fork(); in ATF_TC_BODY() 96 ATF_REQUIRE(pid >= 0); in ATF_TC_BODY() 98 if (pid == 0) { in ATF_TC_BODY() 119 pid_t pid; in ATF_TC_BODY() local 123 pid = fork(); in ATF_TC_BODY() [all …]
|
/freebsd/contrib/blocklist/port/ |
H A D | popenve.c | 67 static struct pid { struct 68 struct pid *next; argument 73 pid_t pid; argument 80 static struct pid * 83 struct pid *cur; in pdes_get() 124 struct pid *old; in pdes_child() 154 pdes_parent(int *pdes, struct pid *cur, pid_t pid, const char *type) in pdes_parent() argument 175 cur->pid = pid; in pdes_parent() 181 pdes_error(int *pdes, struct pid *cur) in pdes_error() 191 struct pid *cur; in popenve() [all …]
|
/freebsd/usr.bin/proccontrol/ |
H A D | proccontrol.c | 108 pid_t pid; in main() local 113 pid = -1; in main() 138 pid = str2pid(optarg); in main() 153 if (pid != -1 || query) in main() 155 pid = getpid(); in main() 156 } else if (pid == -1) { in main() 159 pid = getpid(); in main() 165 error = procctl(P_PID, pid, PROC_ASLR_STATUS, &arg); in main() 168 error = procctl(P_PID, pid, PROC_TRACE_STATUS, &arg); in main() 171 error = procctl(P_PID, pid, PROC_TRAPCAP_STATUS, &arg); in main() [all …]
|
/freebsd/contrib/kyua/utils/logging/ |
H A D | operations_test.cpp | 109 const pid_t pid = ::getpid(); in ATF_TEST_CASE_BODY() local 114 (F("20110221-181000 D %s f1:1: Debug message") % pid).str(), line); in ATF_TEST_CASE_BODY() 117 (F("20110221-181001 E %s f2:2: Error message") % pid).str(), line); in ATF_TEST_CASE_BODY() 120 (F("20110221-181002 I %s f3:3: Info message") % pid).str(), line); in ATF_TEST_CASE_BODY() 123 (F("20110221-181003 W %s f4:4: Warning message") % pid).str(), line); in ATF_TEST_CASE_BODY() 140 const pid_t pid = ::getpid(); in ATF_TEST_CASE_BODY() local 145 (F("20110221-182000 D %s file:123: Debug message") % pid).str(), line); in ATF_TEST_CASE_BODY() 160 const pid_t pid = ::getpid(); in ATF_TEST_CASE_BODY() local 165 (F("20110221-182000 D %s file:123: Debug message") % pid).str(), line); in ATF_TEST_CASE_BODY() 214 const pid_t pid = ::getpid(); in ATF_TEST_CASE_BODY() local [all …]
|