lkml.org 
[lkml]   [1999]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject2.2.0-pre9: /proc/self/fd/{pipe fd} (implications for PLP lpd)
People have been complaining about not being able to print using the PLP
print spooler under 2.2.0-pre9. I believe this is why:

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main (int argc, char *argv[])
{
char p[32];
int f;
int fildes[2];

pipe (fildes);
sprintf (p, "/proc/self/fd/%d", fildes[1]);
open (p, O_WRONLY | O_CREAT | O_EXCL, 0666);
open (p, O_WRONLY | O_CREAT, 0666);
f = open (p, O_WRONLY);
close (f);

return 0;
}

execve("./bug", ["./bug"], [/* 22 vars */]) = 0
brk(0) = 0x80496ec
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=0, st_size=0, ...}) = 0
mmap(0, 12203, PROT_READ, MAP_PRIVATE, 3, 0) = 0x4000c000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
mmap(0, 4096, PROT_READ, MAP_PRIVATE, 3, 0) = 0x4000f000
munmap(0x4000f000, 4096) = 0
mmap(0, 673056, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4000f000
mprotect(0x400a1000, 75040, PROT_NONE) = 0
mmap(0x400a1000, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x91000) = 0x400a1000
mmap(0x400a8000, 46368, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x400a8000
close(3) = 0
personality(PER_LINUX) = 0
getpid() = 14631
pipe([3, 4]) = 0
open("/proc/self/fd/4", O_WRONLY|O_CREAT|O_EXCL, 0666) = -1 EEXIST (File exists)
open("/proc/self/fd/4", O_WRONLY|O_CREAT, 0666) = -1 ENOENT (No such file or directory)
open("/proc/self/fd/4", O_WRONLY) = 5
close(5) = 0
_exit(0) = ?

Tim.
*/


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.119 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site