File: fork.c

package info (click to toggle)
gcc-sh-elf 8.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 140 kB
  • sloc: ansic: 237; makefile: 93; sh: 54
file content (19 lines) | stat: -rw-r--r-- 404 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* SPDX-FileCopyrightText: 2021 John Scott <jscott@posteo.net>
 * SPDX-License-Identifier: GPL-3.0-or-later */
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(void) {
	for(size_t i = 0; i < 4; i++) {
		if(fork() == -1) {
			perror("Failed to fork");
			abort();
		}
	}
	if(putchar('a') == EOF) {
		perror("Failed to print character");
		abort();
	}
}