4 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 * @desc Entity for working with datausage counter.
32 #include <sys/socket.h>
34 struct counter_arg *init_counter_arg(struct daemon_opts *opts)
36 struct counter_arg *result =
37 (struct counter_arg *)calloc(1, sizeof(struct counter_arg));
39 ret_value_msg_if(result == NULL, NULL, "Not enough memory\n");
40 #ifndef CONFIG_DATAUSAGE_NFACCT
41 result->pid = getpid();
47 void finalize_carg(struct counter_arg *carg)
52 void reschedule_count_timer(const struct counter_arg *carg, const double delay)
54 ret_msg_if(!carg || !carg->ecore_timer,
55 "Invalid counter argument or carg_timer is null\n");
56 ecore_timer_delay(carg->ecore_timer,
57 delay - ecore_timer_pending_get(carg->ecore_timer));