forked from SoftwareSystemsLaboratory/systems-code-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
George K. Thiruvathukal
committed
Sep 25, 2021
1 parent
6844fcf
commit ef44ac4
Showing
39 changed files
with
51 additions
and
1,006 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
project(OpSystemsCodeExamples) | ||
|
||
cmake_minimum_required(VERSION 2.8.11) | ||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
add_subdirectory(better_gets) | ||
add_subdirectory(bounded-buffer) | ||
add_subdirectory(c_intro) | ||
add_subdirectory(dining-philosophers) | ||
add_subdirectory(dir_list) | ||
add_subdirectory(domain_sock) | ||
add_subdirectory(file_rw) | ||
add_subdirectory(fork) | ||
add_subdirectory(fork_exec) | ||
add_subdirectory(fork_pipe) | ||
add_subdirectory(fork_sigchld) | ||
add_subdirectory(fork_sigchld2) | ||
add_subdirectory(getopt) | ||
add_subdirectory(gnu_pth) | ||
add_subdirectory(llnl_pthreads_examples) | ||
add_subdirectory(malloc) | ||
add_subdirectory(mmap) | ||
add_subdirectory(mmap_locks) | ||
add_subdirectory(monitor) | ||
add_subdirectory(mutex) | ||
add_subdirectory(objects) | ||
add_subdirectory(parity) | ||
add_subdirectory(qsort-demo) | ||
add_subdirectory(read-write-demo) | ||
add_subdirectory(regex-demo) | ||
add_subdirectory(semaphore) | ||
add_subdirectory(simple_adt) | ||
add_subdirectory(spin_lock) | ||
add_subdirectory(std-hsearch) | ||
add_subdirectory(std-queue) | ||
add_subdirectory(std-tsearch) | ||
add_subdirectory(stm) | ||
add_subdirectory(strbuffer_t) | ||
add_subdirectory(strlen) | ||
add_subdirectory(strtok) | ||
add_subdirectory(syscall) | ||
add_subdirectory(vectored_io) | ||
add_subdirectory(wait) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
project(BETTER_GETS_DEMO) | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
message(">> Linux") | ||
add_compile_options(-DWITH_LINUX) | ||
else() | ||
message(">> non-Linux") | ||
add_compile_options(-DWITH_APPLE) | ||
endif() | ||
|
||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
#find_package(GTest REQUIRED) | ||
#include_directories(${GTEST_INCLUDE_DIRS}) | ||
|
||
# Link runTests with what we want to test and the GTest and pthread library | ||
|
||
add_executable(better-gets-demo main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,3 @@ | ||
project("pthreads") | ||
|
||
cmake_minimum_required(VERSION 2.6) | ||
|
||
# https://stackoverflow.com/questions/6594796/how-do-i-make-cmake-output-into-a-bin-dir | ||
# We only need 'bin' here. | ||
|
||
|
||
# Just ignore this. Only needed when using GoogleTest. | ||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
add_executable(bounded-buffer bounded-buffer.c bbuffer.c bbuffer.h bboptions.c bboptions.h millisleep.c millisleep.h) | ||
target_link_libraries(bounded-buffer pthread) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
project(C_INTRO_DEMO) | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
message(">> Linux") | ||
add_compile_options(-DWITH_LINUX) | ||
else() | ||
message(">> non-Linux") | ||
add_compile_options(-DWITH_APPLE) | ||
endif() | ||
|
||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
#find_package(GTest REQUIRED) | ||
#include_directories(${GTEST_INCLUDE_DIRS}) | ||
|
||
# Link runTests with what we want to test and the GTest and pthread library | ||
|
||
add_executable(c-intro-demo main.cc debug.cc list.cc tests.cc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,3 @@ | ||
project("diners") | ||
|
||
cmake_minimum_required(VERSION 2.6) | ||
|
||
# Just ignore this. Only needed when using GoogleTest. | ||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
add_executable(diner-demo diner-demo.c diners.h diners.c millisleep.h millisleep.c) | ||
target_link_libraries(diner-demo pthread) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
project(DIRLIST_DEMO) | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
message(">> Linux") | ||
add_compile_options(-DWITH_LINUX) | ||
else() | ||
message(">> non-Linux") | ||
add_compile_options(-DWITH_APPLE) | ||
endif() | ||
|
||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
#find_package(GTest REQUIRED) | ||
#include_directories(${GTEST_INCLUDE_DIRS}) | ||
|
||
# Link runTests with what we want to test and the GTest and pthread library | ||
|
||
add_executable(dirlist-demo main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,2 @@ | ||
project(CLIENT_SERVER_DEMO) | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
message(">> Linux") | ||
add_compile_options(-DWITH_LINUX) | ||
else() | ||
message(">> non-Linux") | ||
add_compile_options(-DWITH_APPLE) | ||
endif() | ||
|
||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
#find_package(GTest REQUIRED) | ||
#include_directories(${GTEST_INCLUDE_DIRS}) | ||
|
||
# Link runTests with what we want to test and the GTest and pthread library | ||
|
||
add_executable(client client.c) | ||
|
||
add_executable(server server.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
project(FILE_RW__DEMO) | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
message(">> Linux") | ||
add_compile_options(-DWITH_LINUX) | ||
else() | ||
message(">> non-Linux") | ||
add_compile_options(-DWITH_APPLE) | ||
endif() | ||
|
||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
#find_package(GTest REQUIRED) | ||
#include_directories(${GTEST_INCLUDE_DIRS}) | ||
|
||
# Link runTests with what we want to test and the GTest and pthread library | ||
|
||
add_executable(file-rw-demo main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
project(FORK_DEMO) | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
message(">> Linux") | ||
add_compile_options(-DWITH_LINUX) | ||
else() | ||
message(">> non-Linux") | ||
add_compile_options(-DWITH_APPLE) | ||
endif() | ||
|
||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
#find_package(GTest REQUIRED) | ||
#include_directories(${GTEST_INCLUDE_DIRS}) | ||
|
||
# Link runTests with what we want to test and the GTest and pthread library | ||
|
||
add_executable(fork-demo main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
project(FORK_EXEC_DEMO) | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
message(">> Linux") | ||
add_compile_options(-DWITH_LINUX) | ||
else() | ||
message(">> non-Linux") | ||
add_compile_options(-DWITH_APPLE) | ||
endif() | ||
|
||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
#find_package(GTest REQUIRED) | ||
#include_directories(${GTEST_INCLUDE_DIRS}) | ||
|
||
# Link runTests with what we want to test and the GTest and pthread library | ||
|
||
add_executable(fork-exec-demo main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
project(FORK_PIPE_DEMO) | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
message(">> Linux") | ||
add_compile_options(-DWITH_LINUX) | ||
else() | ||
message(">> non-Linux") | ||
add_compile_options(-DWITH_APPLE) | ||
endif() | ||
|
||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
#find_package(GTest REQUIRED) | ||
#include_directories(${GTEST_INCLUDE_DIRS}) | ||
|
||
# Link runTests with what we want to test and the GTest and pthread library | ||
|
||
add_executable(fork-pipe-demo main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
project(FORK_SIGCHLD_DEMO) | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
message(">> Linux") | ||
add_compile_options(-DWITH_LINUX) | ||
else() | ||
message(">> non-Linux") | ||
add_compile_options(-DWITH_APPLE) | ||
endif() | ||
|
||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
#find_package(GTest REQUIRED) | ||
#include_directories(${GTEST_INCLUDE_DIRS}) | ||
|
||
# Link runTests with what we want to test and the GTest and pthread library | ||
|
||
add_executable(fork-sigchld-demo main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
project(FORK_SIGCHLD2_DEMO) | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
if (CMAKE_VERSION VERSION_LESS "3.1") | ||
add_definitions(-std=c++11) | ||
else() | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
message(">> Linux") | ||
add_compile_options(-DWITH_LINUX) | ||
else() | ||
message(">> non-Linux") | ||
add_compile_options(-DWITH_APPLE) | ||
endif() | ||
|
||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
#find_package(GTest REQUIRED) | ||
#include_directories(${GTEST_INCLUDE_DIRS}) | ||
|
||
# Link runTests with what we want to test and the GTest and pthread library | ||
|
||
add_executable(fork-sigchld2-demo main.c) |
Oops, something went wrong.