/[baselayout]/trunk/src/librc-daemon.c
Gentoo

Diff of /trunk/src/librc-daemon.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2577 Revision 2597
3 Finds PID for given daemon criteria 3 Finds PID for given daemon criteria
4 Copyright 2007 Gentoo Foundation 4 Copyright 2007 Gentoo Foundation
5 Released under the GPLv2 5 Released under the GPLv2
6 */ 6 */
7 7
8#include <sys/types.h>
9#include <sys/stat.h>
10
11#if defined(__DragonFly__) || defined(__FreeBSD__) || \
12 defined(__NetBSD__) || defined (__OpenBSD__)
13#include <sys/param.h>
14#include <sys/user.h>
15#include <sys/sysctl.h>
16#include <kvm.h>
17#include <limits.h>
18#endif
19
20#ifndef __linux__
21#include <libgen.h>
22#endif
23
24#include <dirent.h>
25#include <errno.h>
26#include <fcntl.h>
27#include <stdio.h>
28#include <stdlib.h>
29#include <string.h>
30#include <unistd.h>
31
32#include "einfo.h"
33#include "rc.h" 8#include "librc.h"
34#include "rc-misc.h"
35#include "strlist.h"
36 9
37#if defined(__linux__) 10#if defined(__linux__)
38static bool pid_is_cmd (pid_t pid, const char *cmd) 11static bool pid_is_cmd (pid_t pid, const char *cmd)
39{ 12{
40 char buffer[32]; 13 char buffer[32];
169 if (! foundany) 142 if (! foundany)
170 eerrorx ("nothing in /proc"); 143 eerrorx ("nothing in /proc");
171 144
172 return (pids); 145 return (pids);
173} 146}
147librc_hidden_def(rc_find_pids)
174 148
175#elif defined(__DragonFly__) || defined(__FreeBSD__) || \ 149#elif defined(__DragonFly__) || defined(__FreeBSD__) || \
176 defined(__NetBSD__) || defined(__OpenBSD__) 150 defined(__NetBSD__) || defined(__OpenBSD__)
177 151
178# if defined(__DragonFly__) || defined(__FreeBSD__) 152# if defined(__DragonFly__) || defined(__FreeBSD__)
246 } 220 }
247 kvm_close(kd); 221 kvm_close(kd);
248 222
249 return (pids); 223 return (pids);
250} 224}
225librc_hidden_def(rc_find_pids)
251 226
252#else 227#else
253# error "Platform not supported!" 228# error "Platform not supported!"
254#endif 229#endif
255 230
392 free (mexec); 367 free (mexec);
393 free (mname); 368 free (mname);
394 free (mpidfile); 369 free (mpidfile);
395 free (dirpath); 370 free (dirpath);
396} 371}
372librc_hidden_def(rc_set_service_daemon)
397 373
398bool rc_service_started_daemon (const char *service, const char *exec, 374bool rc_service_started_daemon (const char *service, const char *exec,
399 int indx) 375 int indx)
400{ 376{
401 char *dirpath; 377 char *dirpath;
435 } 411 }
436 412
437 free (mexec); 413 free (mexec);
438 return (retval); 414 return (retval);
439} 415}
416librc_hidden_def(rc_service_started_daemon)
440 417
441bool rc_service_daemons_crashed (const char *service) 418bool rc_service_daemons_crashed (const char *service)
442{ 419{
443 char *dirpath; 420 char *dirpath;
444 char **files; 421 char **files;
558 free (dirpath); 535 free (dirpath);
559 rc_strlist_free (files); 536 rc_strlist_free (files);
560 537
561 return (retval); 538 return (retval);
562} 539}
540librc_hidden_def(rc_service_daemons_crashed)

Legend:
Removed from v.2577  
changed lines
  Added in v.2597

  ViewVC Help
Powered by ViewVC 1.1.20