blob: f2a69048d8ede91a34e7bccdf62b115869281310 [file] [log] [blame]
/**
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define _GNU_SOURCE
#include <asm/ioctl.h>
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
void ThreadFun(void);
void trigger(void);
const char *infopath = "/sys/kernel/debug/rmt_storage/info";
void ThreadFun(void) {
int fd = -1;
while (1) {
fd = open(infopath, O_RDWR);
if (fd > 0) {
close(fd);
fd = -1;
}
}
}
#define TC 100
void trigger(void) {
int i, ret;
pthread_t tids[TC];
for (i = 0; i < TC; i++) {
ret = pthread_create((pthread_t *)&tids[i], NULL, (void *)ThreadFun, NULL);
}
for (i = 0; i < TC; i++) pthread_join(tids[i], NULL);
}
int main(int argc, char *argv[]) {
trigger();
return 0;
}