Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/dev/desu

Name: Anonymous 2008-05-08 18:41

i would like to have /dev/desu on leenux, an "infinite" file that only outputs DESUDESUDESUDESUDESU etc. pp.

is it possible to create that via mkfifo ?

Name: Anonymous 2008-05-10 17:21

>>62
better:
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>

int main(){
 int p = fork();
 if(!p){
  int s_local, s_remote, len;
  struct sockaddr local, remote;
  s_local = socket(PF_LOCAL, SOCK_STREAM, 0);
  local.sa_family = AF_UNIX;
  strcpy(local.sa_data, "/dev/desu");
  unlink(local.sa_data);
  len = sizeof(local);
  bind(s_local, &local, len);
  listen(s_local, 5);
  void clean_up(){
   shutdown(s_local, SHUT_RDWR);
   unlink(local.sa_data);
  }
  atexit(&clean_up);
  signal(SIGCHLD, SIG_IGN);
  signal(SIGHUP, SIG_IGN);
  signal(SIGINT, &exit);
  signal(SIGKILL, &exit);
  signal(SIGTERM, &exit);
  for(;;){
   s_remote = accept(s_local, &remote, &len);
   if(!fork()) for(;;) send(s_remote, "DESU", 4, 0);
  }
 }
 printf("%d\n", p);
 return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List