SlideShare une entreprise Scribd logo
1  sur  6
Linux project no 1
address: http://www.csie.ncu.edu.tw/~hsufh/COURSES/FALL2008/linux_project1.html




now is 20081208 Mon: I try again to do
implementing system call
http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/

and
rebuild kernel
http://www.cromwell-intl.com/unix/linux-kernel.html


I append today's date as the label, ie. 20081208

folder is in /usr/src/linux*-20081208
name of the new build is also wit *-20081208

I already expand my vmware disk vmdk with this command:

http://blogs.developerfusion.co.uk/blogs/thushan/archive/2007/04/16/2629.aspx


All files modified are backed up using this extension: *.nur

test file is in ~/system-call-examples/20081208/




-------
Old:
---------------
trying this:
http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/
-- twice & not successfull:

rebuild kernel & install kernel give no error
compile test code (testmycall.c) gives the following errors:

Error code for the second trial:

---------------------------------
In file included from testmycall.c:7:
testmycall.h:9: error: expected declaration specifiers or ‘...’ before ‘mycall’
testmycall.h:9: error: expected declaration specifiers or ‘...’ before ‘i’
testmycall.c: In function ‘_syscall1’:
testmycall.c:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’ before ‘{’ token
testmycall.h:9: error: parameter name omitted
testmycall.h:9: error: parameter name omitted
testmycall.c:15: error: expected ‘{’ at end of input



---------------------------------

command to capture out and error:
./cmd 1>out.txt 2>err.txt


I will try another steps from:
http://lwyy.eboler.com/2006/12/3/




How to build a kernel?
http://www.howtoforge.com/kernel_compilation_fedora
http://www.mjmwired.net/resources/mjm-kernel-fc4.html

Already done with Dung and successful:
http://www.cromwell-intl.com/unix/linux-kernel.html


Need to do:

Modify kernel

Compile kernel

Restart using new kernel

Add a new system call:

http://www.ibm.com/developerworks/library/l-system-calls/index.html

simplified system call with interrupt:
========= IMPORTANT =============

Seems more practical resource is: (this is step by step instruction to create a new system call!)

http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/ WORTH READING
[SHOULD BE READ FIRST!]

http://www.cmpe.boun.edu.tr/courses/cmpe322/fall2008/Tutorials/Kernel%20Compile%20and
%20SysCall%20Add%20(Ubuntu%208.04).pdf (Similar to above, but for UBUNTU!)

Detailed steps begin on page 4/6.

========= IMPORTANT =============




http://www.linuxjournal.com/article/3326 --> THIS IS like previous resource, and there IS steps
to compile kernel! [WORTH READING]

But it is obsolete! December 1st, 1999 You will read that we should use a floppy!

Obsolete: http://www.csee.umbc.edu/courses/undergraduate/CMSC421/fall02/burt/projects/howt
o_add_systemcall.html

http://www.csee.umbc.edu/courses/undergraduate/CMSC421/fall02/burt/projects/howto_build_ke
rnel.html

Similar project with detailed instructions:

http://www.cs.duke.edu/courses/spring05/cps210/Lab1.html
http://syn.cs.pdx.edu/~jsnow/ta/timer.html (Not checked)

Other links to check include:

http://lwn.net/Articles/281965/        NOT WORTH READING

Comment:

.... this is new :   May 14, 2008! but let me read first. And unfortunately, this is not a basic article to
read!

Part 1

First we edit the following program (with vim):

#include <stdio.h>
main()
{
while(1)
;
}

save the code as orchid.c


then we compile it with gcc

gcc orchit c -o orchid


then we run it in the background:

./orchid &




(to create another background process, just repeat that command. We need to make 20
background processes.)
to view the process ID we use command

ps

After we found PID, we can see the memory location with this command
(http://www.cyberciti.biz/tips/howto-find-memory-used-by-program.html )

$ pmap PID
$ pmap 3724


And now we will create a C program to find the address of each task_struct data generated by
each our orchid program.

Resources helping us in doing this include:
http://www.informit.com/articles/article.aspx?p=370047

http://linuxgazette.net/133/saha.html

but how to print each address pointing to task_struct data. This may help us:

http://stackoverflow.com/questions/197757/printing-pointers-in-c




We now hope those above will solve our fist part of project 1.

We have unsolved problem when compiling this code:

We try to compile this simple C code (Cobaba.c):

#include </usr/include/linux/kernel.h>

#include </usr/include/linux/sched.h>

#include </usr/include/sepol/module.h>

int main()

{

struct task_struct *task;

for_each_process (task)

{

    printk("%s[%d]n", task->comm, task->pid);

    //printf("hello");

}

return 0;

}

We found compile errors like this:

Cobaba.c: In function ‘main’:

Cobaba.c:9: error: expected ‘;’ before ‘{’ token

What's wrong with our code?

But it seems that we get the answer here:
http://www.linuxquestions.org/linux/articles/Technical/Linux_Kernel_Thread

Part 2

Now we will go to explore and understand second part of project 1. (although part 1 have not
been solved yet)

First question of part 2:

After the above experiment, terminate the execution of the above 20 processes, and then
execute orchid in the background. Then list (1) the PID of the group leader of the process that executes
the above orchid and (2) the PID of the group leader of the shell process that creates the process which
executes the above orchid.

Answer:

To terminate 20 process from part 1, we use kill command.

$ kill PID

How do we know the PID of the process(es) that we want to kill? Use ps command as above.

After we kill all orchid processes, we start one orchid process in the background, then list the PID of
the group leader of the process. What does group leader mean? Does it mean parent of the process?

To list PID

Contenu connexe

Tendances

Making environment for_infrastructure_as_code
Making environment for_infrastructure_as_codeMaking environment for_infrastructure_as_code
Making environment for_infrastructure_as_codeSoshi Nemoto
 
How to run_moses 2
How to run_moses 2How to run_moses 2
How to run_moses 2Mahmoud Eid
 
Installing and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command lineInstalling and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command linedotCloud
 
Install apache on centos
Install apache on centosInstall apache on centos
Install apache on centoshengko
 
Ninja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersNinja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersChang W. Doh
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.jsSu Zin Kyaw
 
Host any project in che with stacks & chefiles
Host any project in che with stacks & chefilesHost any project in che with stacks & chefiles
Host any project in che with stacks & chefilesFlorent BENOIT
 
Managing your Drupal project with Composer
Managing your Drupal project with ComposerManaging your Drupal project with Composer
Managing your Drupal project with ComposerMatt Glaman
 
Creating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantCreating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantArtefactual Systems - AtoM
 
Cyb 225 cyb225 cyb 225 best tutorials guide uopstudy.com
Cyb 225 cyb225 cyb 225 best tutorials guide  uopstudy.comCyb 225 cyb225 cyb 225 best tutorials guide  uopstudy.com
Cyb 225 cyb225 cyb 225 best tutorials guide uopstudy.comUOPCourseHelp
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
 
Create your own composer package
Create your own composer packageCreate your own composer package
Create your own composer packageLattapon Yodsuwan
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101Rami Sayar
 
Getting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyGetting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyAndré Rømcke
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 
Installing Python on Mac
Installing Python on MacInstalling Python on Mac
Installing Python on MacWei-Wen Hsu
 

Tendances (19)

C make tutorial
C make tutorialC make tutorial
C make tutorial
 
Making environment for_infrastructure_as_code
Making environment for_infrastructure_as_codeMaking environment for_infrastructure_as_code
Making environment for_infrastructure_as_code
 
How to run_moses 2
How to run_moses 2How to run_moses 2
How to run_moses 2
 
Installing and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command lineInstalling and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command line
 
Install apache on centos
Install apache on centosInstall apache on centos
Install apache on centos
 
Cmake
CmakeCmake
Cmake
 
Ninja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersNinja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for Beginners
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Host any project in che with stacks & chefiles
Host any project in che with stacks & chefilesHost any project in che with stacks & chefiles
Host any project in che with stacks & chefiles
 
Managing your Drupal project with Composer
Managing your Drupal project with ComposerManaging your Drupal project with Composer
Managing your Drupal project with Composer
 
Creating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantCreating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with Vagrant
 
Cyb 225 cyb225 cyb 225 best tutorials guide uopstudy.com
Cyb 225 cyb225 cyb 225 best tutorials guide  uopstudy.comCyb 225 cyb225 cyb 225 best tutorials guide  uopstudy.com
Cyb 225 cyb225 cyb 225 best tutorials guide uopstudy.com
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Create your own composer package
Create your own composer packageCreate your own composer package
Create your own composer package
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
 
Snaps on open suse
Snaps on open suseSnaps on open suse
Snaps on open suse
 
Getting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyGetting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and Symfony
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
Installing Python on Mac
Installing Python on MacInstalling Python on Mac
Installing Python on Mac
 

En vedette

The NCTUns 5.0 Network Simulator
The NCTUns 5.0 Network SimulatorThe NCTUns 5.0 Network Simulator
The NCTUns 5.0 Network SimulatorHarry Nguyen
 
Obras de Arte _ Patricia goñi 2011
Obras de Arte _ Patricia goñi 2011Obras de Arte _ Patricia goñi 2011
Obras de Arte _ Patricia goñi 2011pgfloresconarte
 

En vedette (18)

Lunch seminar rpi career 24 jan 2012 website
Lunch seminar rpi career 24 jan 2012 websiteLunch seminar rpi career 24 jan 2012 website
Lunch seminar rpi career 24 jan 2012 website
 
Iedereen zijn eigen leefmilieu
Iedereen zijn eigen leefmilieuIedereen zijn eigen leefmilieu
Iedereen zijn eigen leefmilieu
 
Najaar 2011 verpleegkundig vizier william van aalst
Najaar 2011 verpleegkundig vizier william van aalstNajaar 2011 verpleegkundig vizier william van aalst
Najaar 2011 verpleegkundig vizier william van aalst
 
09 arjan broers
09 arjan broers09 arjan broers
09 arjan broers
 
Novio tech - hans hanssen 30062011
Novio tech - hans hanssen 30062011Novio tech - hans hanssen 30062011
Novio tech - hans hanssen 30062011
 
The NCTUns 5.0 Network Simulator
The NCTUns 5.0 Network SimulatorThe NCTUns 5.0 Network Simulator
The NCTUns 5.0 Network Simulator
 
Introductie prof koopmans
Introductie prof koopmansIntroductie prof koopmans
Introductie prof koopmans
 
Voorjaar 2011 verpleegkundig vizier rianne de wit
Voorjaar 2011 verpleegkundig vizier rianne de witVoorjaar 2011 verpleegkundig vizier rianne de wit
Voorjaar 2011 verpleegkundig vizier rianne de wit
 
2012 verpleegkundig vizier raymond koopmans
2012 verpleegkundig vizier raymond koopmans2012 verpleegkundig vizier raymond koopmans
2012 verpleegkundig vizier raymond koopmans
 
06 ben kuiken
06 ben kuiken06 ben kuiken
06 ben kuiken
 
Chiralix - richard blaauw 25112010
Chiralix - richard blaauw 25112010Chiralix - richard blaauw 25112010
Chiralix - richard blaauw 25112010
 
2012 verpleegkundig vizier paul vogelaar
2012 verpleegkundig vizier paul vogelaar2012 verpleegkundig vizier paul vogelaar
2012 verpleegkundig vizier paul vogelaar
 
08 jolanda seinen
08 jolanda seinen08 jolanda seinen
08 jolanda seinen
 
Cassandra勉強会
Cassandra勉強会Cassandra勉強会
Cassandra勉強会
 
HBase at LINE
HBase at LINEHBase at LINE
HBase at LINE
 
~$Iss
~$Iss~$Iss
~$Iss
 
Obras de Arte _ Patricia goñi 2011
Obras de Arte _ Patricia goñi 2011Obras de Arte _ Patricia goñi 2011
Obras de Arte _ Patricia goñi 2011
 
Vanaf diagnose tot één jaar na behandeling van kanker
Vanaf diagnose tot één jaar na behandeling van kankerVanaf diagnose tot één jaar na behandeling van kanker
Vanaf diagnose tot één jaar na behandeling van kanker
 

Similaire à Linux project no 1

Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool boxbpowell29a
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2 Adil Khan
 
Installing Hortonworks Hadoop for Windows
Installing Hortonworks Hadoop for WindowsInstalling Hortonworks Hadoop for Windows
Installing Hortonworks Hadoop for WindowsJonathan Bloom
 
BDM32: AdamCloud Project - Part II
BDM32: AdamCloud Project - Part IIBDM32: AdamCloud Project - Part II
BDM32: AdamCloud Project - Part IIDavid Lauzon
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...Eric Smalling
 
Adding System Call to Kernel
Adding System Call to KernelAdding System Call to Kernel
Adding System Call to KernelMuhammad Bilal
 
CodeIgniter Lab
CodeIgniter LabCodeIgniter Lab
CodeIgniter LabLeo Nguyen
 
Lecture 5 Kernel Development
Lecture 5 Kernel DevelopmentLecture 5 Kernel Development
Lecture 5 Kernel DevelopmentMohammed Farrag
 
Develop and deploy haskell with docker
Develop and deploy haskell with dockerDevelop and deploy haskell with docker
Develop and deploy haskell with dockerChris Biscardi
 
Docker command
Docker commandDocker command
Docker commandEric Ahn
 
Compiling linux kernel and submit first patch
Compiling linux kernel and submit first patchCompiling linux kernel and submit first patch
Compiling linux kernel and submit first patchMayur Patil
 
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docxPart 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docxkarlhennesey
 
k8s practice 2023.pptx
k8s practice 2023.pptxk8s practice 2023.pptx
k8s practice 2023.pptxwonyong hwang
 

Similaire à Linux project no 1 (20)

Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 
Installing Hortonworks Hadoop for Windows
Installing Hortonworks Hadoop for WindowsInstalling Hortonworks Hadoop for Windows
Installing Hortonworks Hadoop for Windows
 
BDM32: AdamCloud Project - Part II
BDM32: AdamCloud Project - Part IIBDM32: AdamCloud Project - Part II
BDM32: AdamCloud Project - Part II
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
 
Adding System Call to Kernel
Adding System Call to KernelAdding System Call to Kernel
Adding System Call to Kernel
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
CodeIgniter Lab
CodeIgniter LabCodeIgniter Lab
CodeIgniter Lab
 
Lecture 5 Kernel Development
Lecture 5 Kernel DevelopmentLecture 5 Kernel Development
Lecture 5 Kernel Development
 
ABCs of docker
ABCs of dockerABCs of docker
ABCs of docker
 
Open Dayligth usando SDN-NFV
Open Dayligth usando SDN-NFVOpen Dayligth usando SDN-NFV
Open Dayligth usando SDN-NFV
 
Develop and deploy haskell with docker
Develop and deploy haskell with dockerDevelop and deploy haskell with docker
Develop and deploy haskell with docker
 
Session11 Ucc Intro
Session11 Ucc IntroSession11 Ucc Intro
Session11 Ucc Intro
 
Docker command
Docker commandDocker command
Docker command
 
Linux
LinuxLinux
Linux
 
Compiling linux kernel and submit first patch
Compiling linux kernel and submit first patchCompiling linux kernel and submit first patch
Compiling linux kernel and submit first patch
 
HPC_MPI_CICD.pptx
HPC_MPI_CICD.pptxHPC_MPI_CICD.pptx
HPC_MPI_CICD.pptx
 
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docxPart 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 
k8s practice 2023.pptx
k8s practice 2023.pptxk8s practice 2023.pptx
k8s practice 2023.pptx
 

Plus de Harry Nguyen

Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled PresentationHarry Nguyen
 
Chinese Course Application Form for Graduate International Studen
Chinese Course Application Form for Graduate International StudenChinese Course Application Form for Graduate International Studen
Chinese Course Application Form for Graduate International StudenHarry Nguyen
 
Important Regulatory Advocacy form Dormitory
Important Regulatory Advocacy form DormitoryImportant Regulatory Advocacy form Dormitory
Important Regulatory Advocacy form DormitoryHarry Nguyen
 
各項球雷錦標賽報名表1
各項球雷錦標賽報名表1各項球雷錦標賽報名表1
各項球雷錦標賽報名表1Harry Nguyen
 
各項球雷錦標賽報名表2
各項球雷錦標賽報名表2各項球雷錦標賽報名表2
各項球雷錦標賽報名表2Harry Nguyen
 

Plus de Harry Nguyen (8)

Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled Presentation
 
Untitled
UntitledUntitled
Untitled
 
Chinese Course Application Form for Graduate International Studen
Chinese Course Application Form for Graduate International StudenChinese Course Application Form for Graduate International Studen
Chinese Course Application Form for Graduate International Studen
 
Important Regulatory Advocacy form Dormitory
Important Regulatory Advocacy form DormitoryImportant Regulatory Advocacy form Dormitory
Important Regulatory Advocacy form Dormitory
 
各項球雷錦標賽報名表1
各項球雷錦標賽報名表1各項球雷錦標賽報名表1
各項球雷錦標賽報名表1
 
Survey_1
Survey_1Survey_1
Survey_1
 
Single_NCU sport
Single_NCU sportSingle_NCU sport
Single_NCU sport
 
各項球雷錦標賽報名表2
各項球雷錦標賽報名表2各項球雷錦標賽報名表2
各項球雷錦標賽報名表2
 

Dernier

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 

Dernier (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

Linux project no 1

  • 1. Linux project no 1 address: http://www.csie.ncu.edu.tw/~hsufh/COURSES/FALL2008/linux_project1.html now is 20081208 Mon: I try again to do implementing system call http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/ and rebuild kernel http://www.cromwell-intl.com/unix/linux-kernel.html I append today's date as the label, ie. 20081208 folder is in /usr/src/linux*-20081208 name of the new build is also wit *-20081208 I already expand my vmware disk vmdk with this command: http://blogs.developerfusion.co.uk/blogs/thushan/archive/2007/04/16/2629.aspx All files modified are backed up using this extension: *.nur test file is in ~/system-call-examples/20081208/ ------- Old: --------------- trying this: http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/ -- twice & not successfull: rebuild kernel & install kernel give no error compile test code (testmycall.c) gives the following errors: Error code for the second trial: --------------------------------- In file included from testmycall.c:7: testmycall.h:9: error: expected declaration specifiers or ‘...’ before ‘mycall’ testmycall.h:9: error: expected declaration specifiers or ‘...’ before ‘i’ testmycall.c: In function ‘_syscall1’: testmycall.c:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
  • 2. testmycall.h:9: error: parameter name omitted testmycall.h:9: error: parameter name omitted testmycall.c:15: error: expected ‘{’ at end of input --------------------------------- command to capture out and error: ./cmd 1>out.txt 2>err.txt I will try another steps from: http://lwyy.eboler.com/2006/12/3/ How to build a kernel? http://www.howtoforge.com/kernel_compilation_fedora http://www.mjmwired.net/resources/mjm-kernel-fc4.html Already done with Dung and successful: http://www.cromwell-intl.com/unix/linux-kernel.html Need to do: Modify kernel Compile kernel Restart using new kernel Add a new system call: http://www.ibm.com/developerworks/library/l-system-calls/index.html simplified system call with interrupt:
  • 3. ========= IMPORTANT ============= Seems more practical resource is: (this is step by step instruction to create a new system call!) http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/ WORTH READING [SHOULD BE READ FIRST!] http://www.cmpe.boun.edu.tr/courses/cmpe322/fall2008/Tutorials/Kernel%20Compile%20and %20SysCall%20Add%20(Ubuntu%208.04).pdf (Similar to above, but for UBUNTU!) Detailed steps begin on page 4/6. ========= IMPORTANT ============= http://www.linuxjournal.com/article/3326 --> THIS IS like previous resource, and there IS steps to compile kernel! [WORTH READING] But it is obsolete! December 1st, 1999 You will read that we should use a floppy! Obsolete: http://www.csee.umbc.edu/courses/undergraduate/CMSC421/fall02/burt/projects/howt o_add_systemcall.html http://www.csee.umbc.edu/courses/undergraduate/CMSC421/fall02/burt/projects/howto_build_ke rnel.html Similar project with detailed instructions: http://www.cs.duke.edu/courses/spring05/cps210/Lab1.html
  • 4. http://syn.cs.pdx.edu/~jsnow/ta/timer.html (Not checked) Other links to check include: http://lwn.net/Articles/281965/ NOT WORTH READING Comment: .... this is new : May 14, 2008! but let me read first. And unfortunately, this is not a basic article to read! Part 1 First we edit the following program (with vim): #include <stdio.h> main() { while(1) ; } save the code as orchid.c then we compile it with gcc gcc orchit c -o orchid then we run it in the background: ./orchid & (to create another background process, just repeat that command. We need to make 20 background processes.) to view the process ID we use command ps After we found PID, we can see the memory location with this command (http://www.cyberciti.biz/tips/howto-find-memory-used-by-program.html ) $ pmap PID $ pmap 3724 And now we will create a C program to find the address of each task_struct data generated by each our orchid program. Resources helping us in doing this include:
  • 5. http://www.informit.com/articles/article.aspx?p=370047 http://linuxgazette.net/133/saha.html but how to print each address pointing to task_struct data. This may help us: http://stackoverflow.com/questions/197757/printing-pointers-in-c We now hope those above will solve our fist part of project 1. We have unsolved problem when compiling this code: We try to compile this simple C code (Cobaba.c): #include </usr/include/linux/kernel.h> #include </usr/include/linux/sched.h> #include </usr/include/sepol/module.h> int main() { struct task_struct *task; for_each_process (task) { printk("%s[%d]n", task->comm, task->pid); //printf("hello"); } return 0; } We found compile errors like this: Cobaba.c: In function ‘main’: Cobaba.c:9: error: expected ‘;’ before ‘{’ token What's wrong with our code? But it seems that we get the answer here:
  • 6. http://www.linuxquestions.org/linux/articles/Technical/Linux_Kernel_Thread Part 2 Now we will go to explore and understand second part of project 1. (although part 1 have not been solved yet) First question of part 2: After the above experiment, terminate the execution of the above 20 processes, and then execute orchid in the background. Then list (1) the PID of the group leader of the process that executes the above orchid and (2) the PID of the group leader of the shell process that creates the process which executes the above orchid. Answer: To terminate 20 process from part 1, we use kill command. $ kill PID How do we know the PID of the process(es) that we want to kill? Use ps command as above. After we kill all orchid processes, we start one orchid process in the background, then list the PID of the group leader of the process. What does group leader mean? Does it mean parent of the process? To list PID