Andreas Schneider | 2140f1f | 2015-12-19 14:29:21 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 Andreas Schneider <asn@cryptomilk.org> |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "wifiloader" |
| 18 | #define LOG_NDEBUG 0 |
| 19 | |
| 20 | #include <errno.h> |
| 21 | #include <stdio.h> |
| 22 | #include <string.h> |
| 23 | #include <cutils/log.h> |
| 24 | |
| 25 | #define DEFERRED_INITCALLS "/proc/deferred_initcalls" |
| 26 | |
| 27 | int main(void) |
| 28 | { |
| 29 | char buf[8] = { '\0' }; |
| 30 | FILE *fp; |
| 31 | size_t r; |
| 32 | |
| 33 | ALOGD("Trigger initcall of deferred modules\n"); |
| 34 | |
| 35 | fp = fopen(DEFERRED_INITCALLS, "r"); |
| 36 | if (fp == NULL) { |
| 37 | ALOGE("Failed to open %s - error: %s\n", |
| 38 | DEFERRED_INITCALLS, |
| 39 | strerror(errno)); |
| 40 | return -errno; |
| 41 | } |
| 42 | |
| 43 | r = fread(buf, sizeof(buf), 1, fp); |
| 44 | fclose(fp); |
| 45 | |
| 46 | ALOGV("%s=%s\n", DEFERRED_INITCALLS, buf); |
| 47 | |
| 48 | return 0; |
| 49 | } |