• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 990
  • Last Modified:

current->pid

hello ,


 i m  beginner to device drivers . Can any  one show me a code to print current->pid




0
karana
Asked:
karana
  • 3
  • 2
1 Solution
 
koppchaCommented:
echo $$
0
 
TintinCommented:
What language? C?

koppcha - he wouldn't be writing a device driver as a shell script.
0
 
koppchaCommented:
oh ok since i am in linux_programming section i have given that shell command.I am not aware of what you were saying :)
0
 
TintinCommented:
Assuming it is C, then do

man getpid
0
 
koppchaCommented:
This sample program should help you if it is in C

#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>

int main()
{
  pid_t pid;
 
  pid = getpid();
  printf("The pid assigned to the process is %d\n", pid);
 }

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now