DragonFly submit List (threaded) for 2007-06
DragonFly BSD
DragonFly submit List (threaded) for 2007-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

VKERNEL Pidfile patch


From: Chris Turner <c.turner@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 17 Jun 2007 00:22:54 -0400

Okay.. So heres a quick patch to have the vkernel write out a pidfile.

(WFM-TM)

3 possible 'messies':

  - doing this 'inline' within the getopt processing. Felt this
    was simpleenough a task that that wasn't a big deal, but I
    can see how some might not like it that way.
  - If the pidfile isn't writable, it's considered a warning and not
    an error. Was using inetd as my inspiration, and kept
    things consistent - but perhaps this shouldn't be the case?
  - the vkernel.7 patch was manually edited to remove the signal edits
    from earlier.. hopefully it still applies cleanly to HEAD. Only a
    sentance or two there probably not too much to fix if so.

Comments / Concerns / etc. welcome - didn't edit Nuno's rc script as he
said he'd take care of that and I'm using another mechanism to handle
VKERNEL systems at the  moment.

Thanks,

 - Chris
Index: share/man/man7/vkernel.7
===================================================================
RCS file: /var/local/apps/dcvs/src/share/man/man7/vkernel.7,v
retrieving revision 1.18
diff -r1.18 vkernel.7
53a54
> .Op Fl p Ar file
151a153,155
> .It Fl p Ar file
> Specify a file in which to store the process ID. 
> A warning is issued if this file cannot be opened for writing.
Index: sys/platform/vkernel/platform/init.c
===================================================================
RCS file: /var/local/apps/dcvs/src/sys/platform/vkernel/platform/init.c,v
retrieving revision 1.39
diff -r1.39 init.c
120a121,122
> 	FILE *pf = NULL;
> 	pid_t self;
125a128
> 	char *pidfile;
131a135
> 	
141c145
< 	while ((c = getopt(ac, av, "c:svm:r:e:i:I:U")) != -1) {
---
> 	while ((c = getopt(ac, av, "c:svm:r:e:i:p:I:U")) != -1) {
202a207,218
> 		case 'p':
> 			self = getpid();
> 			pidfile = strdup(optarg);
> 			pf = fopen(pidfile, "w");
> 			if (pf) {
> 				fprintf(pf, "%ld\n", (long)self);
> 				fclose(pf);
> 			}
> 			else {
> 				perror("Warning: couldn't open pidfile");
> 			}
> 			break;


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]