• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 994
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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