File: proctool.h

package info (click to toggle)
gtkcookie 0.03-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 208 kB
  • ctags: 102
  • sloc: ansic: 1,557; makefile: 84; sh: 13
file content (60 lines) | stat: -rw-r--r-- 2,036 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef PROCTOOL_H
#define PROCTOOL_H
/*
  proctool.h --> tool for finding processes on the system
  
  Copyright (c) 1998 Manni Wood

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

  Manni Wood: mwood@sig.bsh.com, pq1036@110.net

 */

#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <sys/types.h>  /* defines pid_t, etc */
#include <glib.h>

/* will return the pid of the running process named in procname, or 0 if
   the process wasn't found. If an error message occurred, 
   checkerrno will be TRUE, else FALSE. In the event checkerrno
   is TRUE, strerror(errno) can be used to find the exact nature of the
   error. (strerror(errno) is a part of the standard unix libary, and
   errno is a global variable) */
/* notes:
   a pid_t is a positive integer that uniquely identifies a running process
   a uid_t is a positive integer holding a user id */
pid_t process_is_running(const gchar *procname,
			 uid_t user_id,
			 gboolean *checkerrno);

#endif /* ifndef PROCTOOL_H */

/*
  sprintf(error_msg_gstr, "Can't open /proc directory.\n\"%s\"", strerror(errno));

    if (errno) {
	error_msg_gstr = g_string_new("");
	g_string_sprintf(error_msg_gstr, "Error reading the proc directory.\n\"%s\"", strerror(errno));
	show_error_dialog_box(error_msg_gstr->str);
	g_string_free(error_msg_gstr, TRUE);
	return;
    }

*/