41
41
#include <pthread.h>
42
42
#include <sysexits.h>
43
43
#include <stdbool.h>
44
+ #include <getopt.h>
44
45
45
46
#include "types.h"
46
47
#include "vmm.h"
@@ -546,6 +547,37 @@ sig_handler_term(int signo)
546
547
mevent_notify ();
547
548
}
548
549
550
+ static struct option long_options [] = {
551
+ {"no_x2apic_mode" , no_argument , 0 , 'a' },
552
+ {"acpi" , no_argument , 0 , 'A' },
553
+ {"bvmcons" , no_argument , 0 , 'b' },
554
+ {"pincpu" , required_argument , 0 , 'p' },
555
+ {"ncpus" , required_argument , 0 , 'c' },
556
+ {"memflags_incore" , no_argument , 0 , 'C' },
557
+ {"gdb_port" , required_argument , 0 , 'g' },
558
+ {"lpc" , required_argument , 0 , 'l' },
559
+ {"pci_slot" , required_argument , 0 , 's' },
560
+ {"memflags_wired" , no_argument , 0 , 'S' },
561
+ {"memsize" , required_argument , 0 , 'm' },
562
+ {"ioapic" , no_argument , 0 , 'I' },
563
+ {"vmexit_pause" , no_argument , 0 , 'p' },
564
+ {"strictio" , no_argument , 0 , 'e' },
565
+ {"rtc_localtime" , no_argument , 0 , 'u' },
566
+ {"uuid" , required_argument , 0 , 'U' },
567
+ {"strictmsr" , no_argument , 0 , 'w' },
568
+ {"virtio_msix" , no_argument , 0 , 'W' },
569
+ {"x2apic_mode" , no_argument , 0 , 'x' },
570
+ {"mptgen" , no_argument , 0 , 'Y' },
571
+ {"kernel" , required_argument , 0 , 'k' },
572
+ {"ramdisk" , required_argument , 0 , 'r' },
573
+ {"bootargs" , required_argument , 0 , 'B' },
574
+ {"ptdev_msi" , no_argument , 0 , 'M' },
575
+ {"version" , no_argument , 0 , 'v' },
576
+ {"gvtargs" , required_argument , 0 , 'G' },
577
+ {"help" , no_argument , 0 , 'h' },
578
+ {0 , 0 , 0 , 0 },
579
+ };
580
+
549
581
int
550
582
main (int argc , char * argv [])
551
583
{
@@ -555,6 +587,7 @@ main(int argc, char *argv[])
555
587
struct vmctx * ctx ;
556
588
size_t memsize ;
557
589
char * optstr ;
590
+ int option_idx = 0 ;
558
591
559
592
bvmcons = 0 ;
560
593
progname = basename (argv [0 ]);
@@ -570,7 +603,8 @@ main(int argc, char *argv[])
570
603
fprintf (stderr , "cannot register handler for SIGINT\n" );
571
604
572
605
optstr = "abehuwxACHIMPSWYvk:r:B:p:g:c:s:m:l:U:G:" ;
573
- while ((c = getopt (argc , argv , optstr )) != -1 ) {
606
+ while ((c = getopt_long (argc , argv , optstr , long_options ,
607
+ & option_idx )) != -1 ) {
574
608
switch (c ) {
575
609
case 'a' :
576
610
x2apic_mode = 0 ;
0 commit comments