aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-02-10 04:44:20 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:23 -0500
commit73c8f4441f07dd3b9d198ec0e97ce83138a6224c (patch)
tree88af71fd8d091cab9c8f05994202221f9f42e2d4 /arch/um
parent9eae9b132cd2cebf98cc45550049d421302b9aba (diff)
[PATCH] uml: libc-dependent code should call libc directly
We shouldn't be using the os wrappers from os code - we can use libc directly. This patch replaces wrapper calls with libc calls. It turns out that os_sigio_async had only one caller, which was in startup.c, so that function is moved there and its name changed. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/include/os.h1
-rw-r--r--arch/um/os-Linux/file.c19
-rw-r--r--arch/um/os-Linux/start_up.c39
3 files changed, 28 insertions, 31 deletions
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 13a86bd383d3..8f602667296d 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -137,7 +137,6 @@ extern int os_new_tty_pgrp(int fd, int pid);
137extern int os_get_ifname(int fd, char *namebuf); 137extern int os_get_ifname(int fd, char *namebuf);
138extern int os_set_slip(int fd); 138extern int os_set_slip(int fd);
139extern int os_set_owner(int fd, int pid); 139extern int os_set_owner(int fd, int pid);
140extern int os_sigio_async(int master, int slave);
141extern int os_mode_fd(int fd, int mode); 140extern int os_mode_fd(int fd, int mode);
142 141
143extern int os_seek_file(int fd, __u64 offset); 142extern int os_seek_file(int fd, __u64 offset);
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index 189fa677085a..371b4335f46d 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -162,25 +162,6 @@ int os_set_owner(int fd, int pid)
162 return 0; 162 return 0;
163} 163}
164 164
165/* FIXME? moved wholesale from sigio_user.c to get fcntls out of that file */
166int os_sigio_async(int master, int slave)
167{
168 int flags;
169
170 flags = fcntl(master, F_GETFL);
171 if(flags < 0)
172 return -errno;
173
174 if((fcntl(master, F_SETFL, flags | O_NONBLOCK | O_ASYNC) < 0) ||
175 (fcntl(master, F_SETOWN, os_getpid()) < 0))
176 return -errno;
177
178 if((fcntl(slave, F_SETFL, flags | O_NONBLOCK) < 0))
179 return -errno;
180
181 return(0);
182}
183
184int os_mode_fd(int fd, int mode) 165int os_mode_fd(int fd, int mode)
185{ 166{
186 int err; 167 int err;
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 537084fd834f..735d035a7f33 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -54,7 +54,7 @@ static int ptrace_child(void *arg)
54 perror("ptrace"); 54 perror("ptrace");
55 os_kill_process(pid, 0); 55 os_kill_process(pid, 0);
56 } 56 }
57 os_stop_process(pid); 57 kill(pid, SIGSTOP);
58 58
59 /*This syscall will be intercepted by the parent. Don't call more than 59 /*This syscall will be intercepted by the parent. Don't call more than
60 * once, please.*/ 60 * once, please.*/
@@ -417,7 +417,7 @@ static inline void check_skas3_ptrace_ldt(void)
417static inline void check_skas3_proc_mm(void) 417static inline void check_skas3_proc_mm(void)
418{ 418{
419 printf(" - /proc/mm..."); 419 printf(" - /proc/mm...");
420 if (os_access("/proc/mm", OS_ACC_W_OK) < 0) { 420 if (access("/proc/mm", W_OK) < 0) {
421 proc_mm = 0; 421 proc_mm = 0;
422 printf("not found\n"); 422 printf("not found\n");
423 } 423 }
@@ -452,9 +452,9 @@ int can_do_skas(void)
452int __init parse_iomem(char *str, int *add) 452int __init parse_iomem(char *str, int *add)
453{ 453{
454 struct iomem_region *new; 454 struct iomem_region *new;
455 struct uml_stat buf; 455 struct stat64 buf;
456 char *file, *driver; 456 char *file, *driver;
457 int fd, err, size; 457 int fd, size;
458 458
459 driver = str; 459 driver = str;
460 file = strchr(str,','); 460 file = strchr(str,',');
@@ -464,15 +464,14 @@ int __init parse_iomem(char *str, int *add)
464 } 464 }
465 *file = '\0'; 465 *file = '\0';
466 file++; 466 file++;
467 fd = os_open_file(file, of_rdwr(OPENFLAGS()), 0); 467 fd = open(file, O_RDWR, 0);
468 if(fd < 0){ 468 if(fd < 0){
469 os_print_error(fd, "parse_iomem - Couldn't open io file"); 469 os_print_error(fd, "parse_iomem - Couldn't open io file");
470 goto out; 470 goto out;
471 } 471 }
472 472
473 err = os_stat_fd(fd, &buf); 473 if(fstat64(fd, &buf) < 0){
474 if(err < 0){ 474 perror("parse_iomem - cannot stat_fd file");
475 os_print_error(err, "parse_iomem - cannot stat_fd file");
476 goto out_close; 475 goto out_close;
477 } 476 }
478 477
@@ -482,7 +481,7 @@ int __init parse_iomem(char *str, int *add)
482 goto out_close; 481 goto out_close;
483 } 482 }
484 483
485 size = (buf.ust_size + UM_KERN_PAGE_SIZE) & ~(UM_KERN_PAGE_SIZE - 1); 484 size = (buf.st_size + UM_KERN_PAGE_SIZE) & ~(UM_KERN_PAGE_SIZE - 1);
486 485
487 *new = ((struct iomem_region) { .next = iomem_regions, 486 *new = ((struct iomem_region) { .next = iomem_regions,
488 .driver = driver, 487 .driver = driver,
@@ -495,7 +494,7 @@ int __init parse_iomem(char *str, int *add)
495 494
496 return 0; 495 return 0;
497 out_close: 496 out_close:
498 os_close_file(fd); 497 close(fd);
499 out: 498 out:
500 return 1; 499 return 1;
501} 500}
@@ -528,6 +527,24 @@ static void openpty_cb(void *arg)
528 info->err = -errno; 527 info->err = -errno;
529} 528}
530 529
530static int async_pty(int master, int slave)
531{
532 int flags;
533
534 flags = fcntl(master, F_GETFL);
535 if(flags < 0)
536 return -errno;
537
538 if((fcntl(master, F_SETFL, flags | O_NONBLOCK | O_ASYNC) < 0) ||
539 (fcntl(master, F_SETOWN, os_getpid()) < 0))
540 return -errno;
541
542 if((fcntl(slave, F_SETFL, flags | O_NONBLOCK) < 0))
543 return -errno;
544
545 return(0);
546}
547
531static void __init check_one_sigio(void (*proc)(int, int)) 548static void __init check_one_sigio(void (*proc)(int, int))
532{ 549{
533 struct sigaction old, new; 550 struct sigaction old, new;
@@ -553,7 +570,7 @@ static void __init check_one_sigio(void (*proc)(int, int))
553 if (err < 0) 570 if (err < 0)
554 panic("check_sigio : __raw failed, errno = %d\n", -err); 571 panic("check_sigio : __raw failed, errno = %d\n", -err);
555 572
556 err = os_sigio_async(master, slave); 573 err = async_pty(master, slave);
557 if(err < 0) 574 if(err < 0)
558 panic("tty_fds : sigio_async failed, err = %d\n", -err); 575 panic("tty_fds : sigio_async failed, err = %d\n", -err);
559 576