├── system call os.pdf ├── OSSP_Individual_Bethelhem_Degsew_BDU 1601067_A_.pdf ├── README.md └── system call iseek().c /system call os.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bethy-de/Bethelhem/HEAD/system call os.pdf -------------------------------------------------------------------------------- /OSSP_Individual_Bethelhem_Degsew_BDU 1601067_A_.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bethy-de/Bethelhem/HEAD/OSSP_Individual_Bethelhem_Degsew_BDU 1601067_A_.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Peppermint OS Installation Guide 2 | 3 | This repository contains a detailed guide for installing Peppermint OS, a lightweight and cloud-integrated Linux distribution designed for speed and efficiency. It covers system requirements, installation steps, supported file systems, virtualization concepts, and troubleshooting tips to ensure a smooth setup experience. 4 | 5 | # lseek System Call Implementation 6 | 7 | This repository provides a C implementation of the `lseek` system call, demonstrating how to manipulate file offsets for efficient read/write operations. The project showcases reading from `start.txt`, writing to `end.txt`, and selecting alternate bytes to process file data effectively. For details, refer to the source code and documentation. 8 | 9 | -------------------------------------------------------------------------------- /system call iseek().c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | void func(char arr[], int n) 7 | { 8 | int f_write = open("start.txt", O_RDONLY); 9 | 10 | int f_read = open("end.txt", O_WRONLY); 11 | 12 | int count = 0; 13 | while (read(f_write, arr, 1)) 14 | { 15 | // to write the 1st byte of the input file in 16 | // the output file 17 | if (count < n) 18 | { 19 | // SEEK_CUR specifies that 20 | // the offset provided is relative to the 21 | // current file position 22 | lseek (f_write, n, SEEK_CUR); 23 | write (f_read, arr, 1); 24 | count = n; 25 | } 26 | 27 | // After the nth byte (now taking the alternate 28 | // nth byte) 29 | else 30 | { 31 | count = (2*n); 32 | lseek(f_write, count, SEEK_CUR); 33 | write(f_read, arr, 1); 34 | } 35 | } 36 | close(f_write); 37 | close(f_read); 38 | } 39 | 40 | int main() 41 | { 42 | char arr[100]; 43 | int n; 44 | n = 5; 45 | // Calling for the function 46 | func(arr, n); 47 | return 0; 48 | } 49 | --------------------------------------------------------------------------------