@@ -649,7 +649,8 @@ struct parse_event_rule_res {
649
649
};
650
650
651
651
static
652
- struct parse_event_rule_res parse_event_rule (int *argc, const char ***argv)
652
+ struct parse_event_rule_res parse_event_rule (int *argc, const char ***argv,
653
+ int argc_offset)
653
654
{
654
655
enum lttng_event_rule_type event_rule_type =
655
656
LTTNG_EVENT_RULE_TYPE_UNKNOWN;
@@ -695,8 +696,8 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
695
696
while (true ) {
696
697
enum parse_next_item_status status;
697
698
698
- status = parse_next_item (argpar_iter, &argpar_item, *argv,
699
- false , NULL );
699
+ status = parse_next_item (argpar_iter, &argpar_item,
700
+ argc_offset, *argv, false , NULL );
700
701
if (status == PARSE_NEXT_ITEM_STATUS_ERROR) {
701
702
goto error;
702
703
} else if (status == PARSE_NEXT_ITEM_STATUS_END) {
@@ -1347,13 +1348,14 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
1347
1348
}
1348
1349
1349
1350
static
1350
- struct lttng_condition *handle_condition_event (int *argc, const char ***argv)
1351
+ struct lttng_condition *handle_condition_event (int *argc, const char ***argv,
1352
+ int argc_offset)
1351
1353
{
1352
1354
struct parse_event_rule_res res;
1353
1355
struct lttng_condition *c;
1354
1356
size_t i;
1355
1357
1356
- res = parse_event_rule (argc, argv);
1358
+ res = parse_event_rule (argc, argv, argc_offset );
1357
1359
if (!res.er ) {
1358
1360
c = NULL ;
1359
1361
goto error;
@@ -1403,7 +1405,8 @@ struct lttng_condition *handle_condition_event(int *argc, const char ***argv)
1403
1405
1404
1406
struct condition_descr {
1405
1407
const char *name;
1406
- struct lttng_condition *(*handler) (int *argc, const char ***argv);
1408
+ struct lttng_condition *(*handler) (int *argc, const char ***argv,
1409
+ int argc_offset);
1407
1410
};
1408
1411
1409
1412
static const
@@ -1413,7 +1416,7 @@ struct condition_descr condition_descrs[] = {
1413
1416
1414
1417
static
1415
1418
struct lttng_condition *parse_condition (const char *condition_name, int *argc,
1416
- const char ***argv)
1419
+ const char ***argv, int argc_offset )
1417
1420
{
1418
1421
int i;
1419
1422
struct lttng_condition *cond;
@@ -1431,7 +1434,7 @@ struct lttng_condition *parse_condition(const char *condition_name, int *argc,
1431
1434
goto error;
1432
1435
}
1433
1436
1434
- cond = descr->handler (argc, argv);
1437
+ cond = descr->handler (argc, argv, argc_offset );
1435
1438
if (!cond) {
1436
1439
/* The handler has already printed an error message. */
1437
1440
goto error;
@@ -1524,7 +1527,8 @@ static const struct argpar_opt_descr notify_action_opt_descrs[] = {
1524
1527
};
1525
1528
1526
1529
static
1527
- struct lttng_action *handle_action_notify (int *argc, const char ***argv)
1530
+ struct lttng_action *handle_action_notify (int *argc, const char ***argv,
1531
+ int argc_offset)
1528
1532
{
1529
1533
struct lttng_action *action = NULL ;
1530
1534
struct argpar_iter *argpar_iter = NULL ;
@@ -1540,8 +1544,9 @@ struct lttng_action *handle_action_notify(int *argc, const char ***argv)
1540
1544
while (true ) {
1541
1545
enum parse_next_item_status status;
1542
1546
1543
- status = parse_next_item (argpar_iter, &argpar_item, *argv,
1544
- false , " While parsing `notify` action:" );
1547
+ status = parse_next_item (argpar_iter, &argpar_item,
1548
+ argc_offset, *argv, false ,
1549
+ " While parsing `notify` action:" );
1545
1550
if (status == PARSE_NEXT_ITEM_STATUS_ERROR) {
1546
1551
goto error;
1547
1552
} else if (status == PARSE_NEXT_ITEM_STATUS_END) {
@@ -1612,6 +1617,7 @@ struct lttng_action *handle_action_notify(int *argc, const char ***argv)
1612
1617
1613
1618
static struct lttng_action *handle_action_simple_session_with_policy (int *argc,
1614
1619
const char ***argv,
1620
+ int argc_offset,
1615
1621
struct lttng_action *(*create_action_cb)(void ),
1616
1622
enum lttng_action_status (*set_session_name_cb)(
1617
1623
struct lttng_action *, const char *),
@@ -1644,8 +1650,9 @@ static struct lttng_action *handle_action_simple_session_with_policy(int *argc,
1644
1650
while (true ) {
1645
1651
enum parse_next_item_status status;
1646
1652
1647
- status = parse_next_item (argpar_iter, &argpar_item, *argv,
1648
- false , " While parsing `%s` action:" , action_name);
1653
+ status = parse_next_item (argpar_iter, &argpar_item, argc_offset,
1654
+ *argv, false ,
1655
+ " While parsing `%s` action:" , action_name);
1649
1656
if (status == PARSE_NEXT_ITEM_STATUS_ERROR) {
1650
1657
goto error;
1651
1658
} else if (status == PARSE_NEXT_ITEM_STATUS_END) {
@@ -1730,29 +1737,32 @@ static struct lttng_action *handle_action_simple_session_with_policy(int *argc,
1730
1737
1731
1738
static
1732
1739
struct lttng_action *handle_action_start_session (int *argc,
1733
- const char ***argv)
1740
+ const char ***argv, int argc_offset )
1734
1741
{
1735
1742
return handle_action_simple_session_with_policy (argc, argv,
1743
+ argc_offset,
1736
1744
lttng_action_start_session_create,
1737
1745
lttng_action_start_session_set_session_name,
1738
1746
lttng_action_start_session_set_rate_policy, " start" );
1739
1747
}
1740
1748
1741
1749
static
1742
1750
struct lttng_action *handle_action_stop_session (int *argc,
1743
- const char ***argv)
1751
+ const char ***argv, int argc_offset )
1744
1752
{
1745
1753
return handle_action_simple_session_with_policy (argc, argv,
1754
+ argc_offset,
1746
1755
lttng_action_stop_session_create,
1747
1756
lttng_action_stop_session_set_session_name,
1748
1757
lttng_action_stop_session_set_rate_policy, " stop" );
1749
1758
}
1750
1759
1751
1760
static
1752
1761
struct lttng_action *handle_action_rotate_session (int *argc,
1753
- const char ***argv)
1762
+ const char ***argv, int argc_offset )
1754
1763
{
1755
1764
return handle_action_simple_session_with_policy (argc, argv,
1765
+ argc_offset,
1756
1766
lttng_action_rotate_session_create,
1757
1767
lttng_action_rotate_session_set_session_name,
1758
1768
lttng_action_rotate_session_set_rate_policy,
@@ -1772,7 +1782,7 @@ static const struct argpar_opt_descr snapshot_action_opt_descrs[] = {
1772
1782
1773
1783
static
1774
1784
struct lttng_action *handle_action_snapshot_session (int *argc,
1775
- const char ***argv)
1785
+ const char ***argv, int argc_offset )
1776
1786
{
1777
1787
struct lttng_action *action = NULL ;
1778
1788
struct argpar_iter *argpar_iter = NULL ;
@@ -1800,8 +1810,8 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
1800
1810
while (true ) {
1801
1811
enum parse_next_item_status status;
1802
1812
1803
- status = parse_next_item (argpar_iter, &argpar_item, *argv ,
1804
- false , " While parsing `snapshot` action:" );
1813
+ status = parse_next_item (argpar_iter, &argpar_item, argc_offset ,
1814
+ *argv, false , " While parsing `snapshot` action:" );
1805
1815
if (status == PARSE_NEXT_ITEM_STATUS_ERROR) {
1806
1816
goto error;
1807
1817
} else if (status == PARSE_NEXT_ITEM_STATUS_END) {
@@ -2072,7 +2082,8 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
2072
2082
2073
2083
struct action_descr {
2074
2084
const char *name;
2075
- struct lttng_action *(*handler) (int *argc, const char ***argv);
2085
+ struct lttng_action *(*handler) (int *argc, const char ***argv,
2086
+ int argc_offset);
2076
2087
};
2077
2088
2078
2089
static const
@@ -2085,7 +2096,8 @@ struct action_descr action_descrs[] = {
2085
2096
};
2086
2097
2087
2098
static
2088
- struct lttng_action *parse_action (const char *action_name, int *argc, const char ***argv)
2099
+ struct lttng_action *parse_action (const char *action_name, int *argc,
2100
+ const char ***argv, int argc_offset)
2089
2101
{
2090
2102
int i;
2091
2103
struct lttng_action *action;
@@ -2103,7 +2115,7 @@ struct lttng_action *parse_action(const char *action_name, int *argc, const char
2103
2115
goto error;
2104
2116
}
2105
2117
2106
- action = descr->handler (argc, argv);
2118
+ action = descr->handler (argc, argv, argc_offset );
2107
2119
if (!action) {
2108
2120
/* The handler has already printed an error message. */
2109
2121
goto error;
@@ -2194,8 +2206,8 @@ int cmd_add_trigger(int argc, const char **argv)
2194
2206
goto error;
2195
2207
}
2196
2208
2197
- status = parse_next_item (argpar_iter, &argpar_item, my_argv,
2198
- true , NULL );
2209
+ status = parse_next_item (argpar_iter, &argpar_item,
2210
+ argc - my_argc, my_argv, true , NULL );
2199
2211
if (status == PARSE_NEXT_ITEM_STATUS_ERROR) {
2200
2212
goto error;
2201
2213
} else if (status == PARSE_NEXT_ITEM_STATUS_END) {
@@ -2234,7 +2246,8 @@ int cmd_add_trigger(int argc, const char **argv)
2234
2246
goto error;
2235
2247
}
2236
2248
2237
- condition = parse_condition (arg, &my_argc, &my_argv);
2249
+ condition = parse_condition (arg, &my_argc, &my_argv,
2250
+ argc - my_argc);
2238
2251
if (!condition) {
2239
2252
/*
2240
2253
* An error message was already printed by
@@ -2247,7 +2260,8 @@ int cmd_add_trigger(int argc, const char **argv)
2247
2260
}
2248
2261
case OPT_ACTION:
2249
2262
{
2250
- action = parse_action (arg, &my_argc, &my_argv);
2263
+ action = parse_action (arg, &my_argc, &my_argv,
2264
+ argc - my_argc);
2251
2265
if (!action) {
2252
2266
/*
2253
2267
* An error message was already printed by
0 commit comments