Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 183881 Details for
Bug 239604
[RHEL5] console: kobject_add failed
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
test case
vcs_stress.c (text/x-csrc), 2.43 KB, created by
Aristeu Rozanski
on 2007-08-31 20:00:02 UTC
(
hide
)
Description:
test case
Filename:
MIME Type:
Creator:
Aristeu Rozanski
Created:
2007-08-31 20:00:02 UTC
Size:
2.43 KB
patch
obsolete
>#include <stdio.h> >#include <stdlib.h> >#include <unistd.h> >#include <pthread.h> >#include <sys/ioctl.h> >#include <sys/types.h> >#include <fcntl.h> >#include <errno.h> >#include <linux/vt.h> > >#define TTY_FILE "/dev/tty0" >#define DELAY_PRE_RUN_MAX 500 >#define DELAY_OPEN_MAX 1000 >#define DELAY_CLOSE_MAX 1000 >#define NUM_OPEN_THREADS 50 >#define NUM_VTSWITCH_THREADS 20 >#ifndef TERMS >#define TERMS 7 >#endif >#define RUNS 50000 > >struct thread_data { > pthread_cond_t *cond; > pthread_mutex_t *mutex; >}; > >static void *thread_open(void *arg) >{ > struct thread_data *data = arg; > int fd, i = RUNS; > > pthread_mutex_lock(data->mutex); > pthread_cond_wait(data->cond, data->mutex); > pthread_mutex_unlock(data->mutex); > > while(i--) { > usleep(random() % DELAY_PRE_RUN_MAX); > > fd = open(TTY_FILE, O_RDWR); > > usleep(random() % DELAY_OPEN_MAX); > > close(fd); > } > > return NULL; >} > >static void *thread_chvt(void *arg) >{ > struct thread_data *data = arg; > int fd, i = RUNS; > > pthread_mutex_lock(data->mutex); > pthread_cond_wait(data->cond, data->mutex); > pthread_mutex_unlock(data->mutex); > > while(i--) { > usleep(random() % DELAY_PRE_RUN_MAX); > > fd = open(TTY_FILE, O_RDWR); > > usleep(random() % DELAY_OPEN_MAX); > > if (ioctl(fd, VT_ACTIVATE, (random() % TERMS) + 1)) > perror("Error activating tty"); > else > usleep(random() % DELAY_CLOSE_MAX); > close(fd); > } > > return NULL; >} > >static pthread_t open_threads[NUM_OPEN_THREADS]; >static pthread_t vtswitch_threads[NUM_VTSWITCH_THREADS]; >int main(int argc, char *argv[]) >{ > struct thread_data data; > pthread_mutex_t mutex; > pthread_cond_t cond; > int i; > > pthread_mutex_init(&mutex, NULL); > pthread_cond_init(&cond, NULL); > > data.mutex = &mutex; > data.cond = &cond; > > printf("Creating threads...\n"); > fflush(stdout); > > for (i = 0; i < NUM_OPEN_THREADS; i++) > if (pthread_create(&open_threads[i], NULL, thread_open, &data)) { > perror("Error creating thread"); > return 1; > } > > for (i = 0; i < NUM_VTSWITCH_THREADS; i++) > if (pthread_create(&vtswitch_threads[i], NULL, thread_chvt, &data)) { > perror("Error creating thread"); > return 1; > } > > printf("Done. Waiting one second... "); > fflush(stdout); > sleep(1); > printf("starting test\n"); > fflush(stdout); > > pthread_mutex_lock(&mutex); > pthread_cond_broadcast(&cond); > pthread_mutex_unlock(&mutex); > > for (i = 0; i < NUM_OPEN_THREADS; i++) > pthread_join(open_threads[i], NULL); > > for (i = 0; i < NUM_VTSWITCH_THREADS; i++) > pthread_join(vtswitch_threads[i], NULL); > > printf("test done\n"); > > return 0; >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 239604
: 183881