Bug #705 » vkpid.patch
| share/man/man7/vkernel.7 17 Jun 2007 04:05:58 -0000 | ||
|---|---|---|
|
.Op Fl i Ar file
|
||
|
.Op Fl I Ar interface Ns Op Ar :address1 Ns Oo Ar :address2 Oc Ns Oo Ar /netmask Oc
|
||
|
.Op Fl m Ar size
|
||
|
.Op Fl p Ar file
|
||
|
.Op Fl r Ar file
|
||
|
.Sh DESCRIPTION
|
||
|
The
|
||
| ... | ... | |
|
and
|
||
|
.Cm G
|
||
|
are allowed.
|
||
|
.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.
|
||
|
.It Fl r Ar file
|
||
|
Specify a R/W disk image
|
||
|
.Ar file
|
||
| sys/platform/vkernel/platform/init.c 17 Jun 2007 14:00:15 -0000 | ||
|---|---|---|
|
static void init_vkernel(void);
|
||
|
static void init_disk(char *diskExp[], int diskFileNum, enum vkdisk_type type);
|
||
|
static void init_netif(char *netifExp[], int netifFileNum);
|
||
|
static void writepid(char *path);
|
||
|
static void usage(const char *ctl);
|
||
|
static int save_ac;
|
||
| ... | ... | |
|
char *diskFile[VKDISK_MAX];
|
||
|
char *cdFile[VKDISK_MAX];
|
||
|
char *suffix;
|
||
|
char *pidfile = NULL;
|
||
|
int netifFileNum = 0;
|
||
|
int diskFileNum = 0;
|
||
|
int cdFileNum = 0;
|
||
|
int c;
|
||
|
int i;
|
||
|
int n;
|
||
|
|
||
|
save_ac = ac;
|
||
|
save_av = av;
|
||
| ... | ... | |
|
*/
|
||
|
kernel_mem_readonly = 1;
|
||
|
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) {
|
||
|
switch(c) {
|
||
|
case 'e':
|
||
|
/*
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
break;
|
||
|
case 'p':
|
||
|
pidfile = optarg;
|
||
|
break;
|
||
|
case 'U':
|
||
|
kernel_mem_readonly = 0;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
writepid(pidfile);
|
||
|
cpu_disable_intr();
|
||
|
init_sys_memory(memImageFile);
|
||
|
init_kern_memory();
|
||
| ... | ... | |
|
static
|
||
|
void
|
||
|
writepid(char *path)
|
||
|
{
|
||
|
pid_t self = 0;
|
||
|
FILE *pidfile = NULL;
|
||
|
self = getpid();
|
||
|
pidfile = fopen(path, "w");
|
||
|
if (pidfile) {
|
||
|
fprintf(pidfile, "%ld\n", (long)self);
|
||
|
fclose(pidfile);
|
||
|
}
|
||
|
else {
|
||
|
perror("Warning: couldn't open pidfile");
|
||
|
}
|
||
|
}
|
||
|
static
|
||
|
void
|
||
|
usage(const char *ctl)
|
||
|
{
|
||
|
|
||