void zmq::session_t::process_attach (i_engine *engine_, const blob_t &peer_identity_) { // If we are already terminating, we destroy the engine straight away. // Note that we don't have to unplug it before deleting as it's not // yet plugged to the session. if (state == terminating) { if (engine_) delete engine_; return; } // If some other object (e.g. init) notifies us that the connection failed // without creating an engine we need to start the reconnection process. if (!engine_) { zmq_assert (!engine); detached (); return; } // Trigger the notfication event about the attachment. if (!attached (peer_identity_)) { delete engine_; return; } // Check whether the required pipes already exist. If not so, we'll // create them and bind them to the socket object. if (!pipes_attached) { zmq_assert (!in_pipe && !out_pipe); pipes_attached = true; reader_t *socket_reader = NULL; writer_t *socket_writer = NULL; // Create the pipes, as required. if (options.requires_in) { create_pipe (socket, this, options.hwm, options.swap, &socket_reader, &out_pipe); out_pipe->set_event_sink (this); } if (options.requires_out) { create_pipe (this, socket, options.hwm, options.swap, &in_pipe, &socket_writer); in_pipe->set_event_sink (this); } // Bind the pipes to the socket object. if (socket_reader || socket_writer) send_bind (socket, socket_reader, socket_writer, peer_identity_); } // Plug in the engine. zmq_assert (!engine); engine = engine_; engine->plug (io_thread, this); }
/** * Called by the main function of the game. Intializes the client network component of the game. * Requires 2 pipes as arguments, these will be passed for communication to network router. The * read descriptor of rcv_router_fd will be passed to the update system by the game, while the * write descriptor of the send_router_fd will be passed to the send_system. * * @param[in] send_router_fd Set of pipes created for passing data to the network router. * @param[in] rcv_router_fd Set of pipes created for grabbing data from the network router. * * @return void * * @designer Ramzi Chennafi * @author Ramzi Chennafi */ void init_client_network(int send_router_fd[2], int rcv_router_fd[2], char * ip) { pthread_t thread; PDATA pdata = (PDATA) malloc(sizeof(WTHREAD_DATA)); create_pipe(send_router_fd); create_pipe(rcv_router_fd); pdata->read_pipe = send_router_fd[READ_END]; pdata->write_pipe = rcv_router_fd[WRITE_END]; memcpy(pdata->ip, ip, MAXIP); pthread_create(&thread, NULL, networkRouter, (void *)pdata); pthread_detach(thread); }
void zmq::session_t::process_attach (i_engine *engine_, const blob_t &peer_identity_) { // If some other object (e.g. init) notifies us that the connection failed // we need to start the reconnection process. if (!engine_) { zmq_assert (!engine); detached (); return; } // If we are already terminating, we destroy the engine straight away. if (finalised) { delete engine; return; } // Check whether the required pipes already exist. If not so, we'll // create them and bind them to the socket object. reader_t *socket_reader = NULL; writer_t *socket_writer = NULL; if (options.requires_in && !out_pipe) { create_pipe (socket, this, options.hwm, options.swap, &socket_reader, &out_pipe); out_pipe->set_event_sink (this); } if (options.requires_out && !in_pipe) { create_pipe (this, socket, options.hwm, options.swap, &in_pipe, &socket_writer); in_pipe->set_event_sink (this); } if (socket_reader || socket_writer) send_bind (socket, socket_reader, socket_writer, peer_identity_); // Plug in the engine. zmq_assert (!engine); zmq_assert (engine_); engine = engine_; engine->plug (io_thread, this); attach_processed = true; // Trigger the notfication about the attachment. attached (peer_identity_); }
void fb_hooks(const ALLEGRO_EVENT & event){ switch(event.type){ case ALLEGRO_EVENT_KEY_DOWN: keys[event.keyboard.keycode]=true; switch(event.keyboard.keycode){ case ALLEGRO_KEY_SPACE: if(!has_lost) bird->im.rotation_vel=-(2.0f/3.0f)*(bird->im.rotation+PI/2); break; case ALLEGRO_KEY_R: clear_pipes(); break; case ALLEGRO_KEY_ESCAPE: if(!show_menu){ show_menu=true; menu->active=true; start_button->active=true; quit_button->active=true; has_lost=true; }else quit_at_next_frame(); break; } break; case ALLEGRO_EVENT_KEY_UP: keys[event.keyboard.keycode]=false; break; case ALLEGRO_EVENT_TIMER: if(event.timer.source==fb_timer) create_pipe(); break; } }
void make_loop(int n, int* last_pipe, char* grammar) { /* last_pipe[0] = input of the recently created pipe * * last_pipe[1] = output of the first pipe */ pid_t pid; if (n == 1) { prepare_input(last_pipe); prepare_output(last_pipe); close_pipe(last_pipe); return; } int next_pipe[2]; create_pipe(next_pipe); switch (pid = fork()) { case -1: syserr("Error in fork()\n"); case 0: prepare_input(last_pipe); close_pipe(last_pipe); prepare_output(next_pipe); close_pipe(next_pipe); execl("./worker", "./worker", grammar, NULL); syserr("Error in execl()\n"); default: last_pipe[0] = next_pipe[0]; make_loop(n - 1, last_pipe, grammar); return; } }
int execute_command_line(char *line, char *argv[]) { int num_of_commands = 0; enum cmd_pos pos = unknown; int left_pipe[2] = {-1, -1}; int right_pipe[2] = {-1, -1}; do { // Repeat this loop for each of the commands separated by '|' in // the command pipeline. // Use the next_command() parser to get the position and argument // vector of the next command in the command pipeline. pos = next_command(line, argv); create_pipe(pos, right_pipe); fork_child(pos, left_pipe, right_pipe, argv); // Only the parent will return here!!! num_of_commands++; // The previous rigth pipe now becomes the current left pipe. shift_pipes(left_pipe, right_pipe); } while (pos != single && pos != last); return num_of_commands; }
static int vloopback_open(struct file *f) #endif { struct video_device *loopdev = video_devdata(f); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) priv_ptr ptr = (priv_ptr)dev_get_drvdata(&loopdev->dev); #else priv_ptr ptr = (priv_ptr)loopdev->vd_private_data; #endif int nr = ptr->pipenr; if (debug > LOG_NODEBUG) info("Video loopback %d", nr); /* Only allow a output to be opened if there is someone feeding * the pipe. */ if (!ptr->in) { if (loops[nr]->buffer == NULL) return -EINVAL; loops[nr]->framesread = 0; loops[nr]->ropen = 1; } else { if (loops[nr]->ropen || loops[nr]->wopen) return -EBUSY; loops[nr]->framesdumped = 0; loops[nr]->frameswrite = 0; loops[nr]->wopen = 1; loops[nr]->zerocopy = 0; loops[nr]->ioctlnr = -1; pipesused++; if (nr_o_pipes-pipesused<spares) { if (!create_pipe(nr_o_pipes)) { info("Creating extra spare pipe"); info("Loopback %d registered, input: video%d, output: video%d", nr_o_pipes, loops[nr_o_pipes]->vloopin->minor, loops[nr_o_pipes]->vloopout->minor ); nr_o_pipes++; } } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) loops[nr]->pid = current->pid; #elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30) loops[nr]->pid = find_vpid(current->pid); #else // TODO : Check in stable 2.6.27 loops[nr]->pid = task_pid(find_task_by_vpid(current->pid)); //loops[nr]->pid = task_pid(current); #endif if (debug > LOG_NODEBUG) info("Current pid %d", current->pid); } return 0; }
void WinListener::create_pipe() { _pipe = CreateNamedPipe(_pipename, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, PIPE_BUF_SIZE, PIPE_BUF_SIZE, PIPE_TIMEOUT, NULL); if (_pipe == INVALID_HANDLE_VALUE) { THROW("CreateNamedPipe() failed %u", GetLastError()); } if (ConnectNamedPipe(_pipe, &_overlap)) { THROW("ConnectNamedPipe() is not pending"); } switch (GetLastError()) { case ERROR_IO_PENDING: DBG(0, "Pipe waits for connection"); break; case ERROR_PIPE_CONNECTED: { DBG(0, "Pipe already connected"); WinConnection *con = new WinConnection(_pipe, _process_loop); NamedPipe::ConnectionInterface &con_interface = _listener_interface.create(); con->set_handler(&con_interface); con_interface.bind((NamedPipe::ConnectionRef)con); create_pipe(); break; } default: THROW("ConnectNamedPipe() failed %u", GetLastError()); } }
int check_ops(char *str, t_tree *tree) { if (tree->parent != NULL) { if ((my_strcmp(tree->parent->str, ">") == 0 || my_strcmp(tree->parent->str, ">>") == 0) && tree == tree->parent->right) return (0); if ((my_strcmp(tree->parent->str, "<") == 0) && tree == tree->parent->right) return (0); } if (my_strcmp(str, ";") == 0) return (0); else if (my_strcmp(str, "&&") == 0) return (0); else if (my_strcmp(str, "||") == 0) return (0); else if (my_strcmp(str, "|") == 0) { create_pipe(tree); return (0); } else return (check_ops2(str, tree)); }
int main(int argc, char* argv[]) { int n,i; int last_pipe[2]; struct grammar g; if (argc != 4) { fatal("Usage: %s <workers number> <grammar file> <starting symbol>\n", argv[0]); } n = atoi(argv[1]); if (n <= 0) { fatal("Number of workers should be a positive integer"); } if (strlen(argv[3]) != 1 || !is_upper(argv[3][0])) { fatal("Starting symbol should be a single nonterminal (uppercase)\n"); } create_pipe(last_pipe); make_loop(n, last_pipe, argv[2]); read_grammar(&g, argv[2]); work(&g, argv[3][0]); for (i = 1; i < n; i++) { if (wait(0) == -1) syserr("Error in wait()\n"); } return 0; }
int exec_a_pipe(t_sh *shell, t_grp *grp) { t_fds fd; int ptab[2]; t_cmd *tmpcmd; int i; i = 0; ptab[PIPE_READ] = -1; ptab[PIPE_WRITE] = -1; init_stdfd_t_def_val(&fd, grp->fd.stdin, grp->fd.stdout, grp->fd.stderr); if (grp->cmds == NULL) return (-1); while ((tmpcmd = grp->cmds[i]) != NULL) { if (create_pipe(grp, ptab, &fd, i) == -1) return (-1); cmd_execution(tmpcmd, &fd, shell); if (MEXIT) return (0); group_to_process_group(grp, tmpcmd); init_stdfd_t_def_val(&fd, grp->fd.stdin, grp->fd.stdout, grp->fd.stderr); if (grp->cmds[i + 1] != NULL) fd.stdin = ptab[PIPE_READ]; i++; } return (0); }
void ShZshapeManager::create_shape(const char* content) { if (content == "cube") { create_cube(); } if (content == "cylinder") { create_cylinder(); } if (content == "pipe") { create_pipe(); } if (content == "cone") { create_cone(); } if (content == "circle") { create_circle(); } if (content == "ring") { create_ring(); } if (content == "pyramid") { create_pyramid(); } if (content == "triangle") { create_triangle(); } if (content == "rectangle") { create_rectangle(); } if (content == "polygon") { create_polygon(); } if (content == "multigonalStar") { create_multigonalStar(); } }
// This method creates the named pipes used to communicate with the webservice void create_pipes() { char nomepipe[1024]; // This file will contain the username of the user to be authenticated sprintf(nomepipe, "%s%s", PREFIX, sessionID); write_file(&nomepipe[0], username, 1); // This pipe contains the text of the question to be presented to the user sprintf(nomepipe, "%s%s_testo", PREFIX, sessionID); create_pipe(&nomepipe[0]); // This pipe contains the type of the question to be presented to the user sprintf(nomepipe, "%s%s_tipo", PREFIX, sessionID); create_pipe(&nomepipe[0]); // This pipe is used to collect the response of the user to the question sprintf(nomepipe, "%s%s_risposta", PREFIX, sessionID); create_pipe(&nomepipe[0]); }
void tester_util::redirect(const ProcessPointer &from, const int from_fd, const ProcessPointer &to, const int to_fd) { try { const Pipe pipe = create_pipe(); from->setStream(from_fd, pipe.writeEnd()); to->setStream(to_fd, pipe.readEnd()); } catch (std::exception &) { BOOST_THROW_EXCEPTION(redirect_error() << bunsan::enable_nested_current()); } }
/* creates an array containing all the PIDs of the child processes */ void spawn_sorts(int **in_pipe, int **out_pipe) { //Spawn all the sort processes process_array = malloc(sizeof(pid_t) * num_sorts); pid_t pid; int i; for (i = 0; i < num_sorts; i++){ create_pipe(in_pipe[i]); create_pipe(out_pipe[i]); switch(pid = fork()){ case -1: //Oops case puke_and_exit("Forking error\n"); case 0: //Child case close(STDIN_FILENO); close(STDOUT_FILENO); if (in_pipe[i][0] != STDIN_FILENO) { //Defensive check if (dup2(in_pipe[i][0], STDIN_FILENO) == -1) puke_and_exit("dup2 0"); } /* Bind stdout to out_pipe*/ close_pipe(out_pipe[i][0]); //close read end of output pipe if (out_pipe[i][1] != STDOUT_FILENO) { //Defensive check if (dup2(out_pipe[i][1], STDOUT_FILENO) == -1) puke_and_exit("dup2 1"); } /* Pipes from previously-spawned children are still open in this child Close them and close the duplicate pipes just created by dup2 */ close_pipes_array(in_pipe, i+1); close_pipes_array(out_pipe, i+1); execlp("sort", "sort", (char *)NULL); default: //Parent case process_array[i] = pid; close_pipe(in_pipe[i][0]); close_pipe(out_pipe[i][1]); break; } } }
int main(int argc, char **argv) { //char *pathname = "special_file"; int err; int num = 1000; char *dir = "."; char *dirname = "block_dir"; char *dirname_char = "char_dir"; char *dirname_pipe = "pipe_dir"; char *dirname_regular_file = "file_dir"; char *entries_dir_path; if(argv[1]) num = atoi(argv[1]); printf("%d\n",num); if ( ulimit_unlimited() == -1 ) { fprintf(stderr, "%s:ulimit failed going with default value, Setting %d to 1000\n", strerror(errno),num); num = 1000; } /* Creating 1000 block special files and calculating the time needed for it */ entries_dir_path = getcwd(entries_dir_path,255); mkdir (dirname,0755); strcat(entries_dir_path,dirname); create_block_special_file(dirname,num); rmdir(dirname); /* Creating 1000 cgaracter special files and calculating the time needed for it */ entries_dir_path = getcwd(entries_dir_path,255); mkdir (dirname_char,0755); strcat(entries_dir_path,dirname_char); create_character_special_file(dirname_char,num); rmdir(dirname_char); /*Creating 1000 directories and calculating the time needed for it */ create_directory(dir,num); /* Creating 1000 files and calculating the time needed for it */ entries_dir_path = getcwd(entries_dir_path,255); mkdir (dirname_pipe,0755); strcat(entries_dir_path,dirname_pipe); create_pipe(dirname_pipe,num); rmdir(dirname_pipe); /* Creating 1000 regular files and calculating the time needed for it */ entries_dir_path = getcwd(entries_dir_path,255); mkdir (dirname_regular_file,0755); strcat(entries_dir_path,dirname_regular_file); create_regular_file(dirname_regular_file,num); rmdir(dirname_regular_file); return 0; }
FXbool Signal::create() { #if defined(_WIN32) device=CreateEvent(nullptr,true,false,nullptr); if (device==BadHandle) return false; #elif defined(HAVE_EVENTFD) device=eventfd(0,EFD_CLOEXEC|EFD_NONBLOCK); if (device==BadHandle) return false; #else if (!create_pipe(device,wrptr)) return false; #endif return true; }
void ShZshapeManager::create_shape(const char* content, GLdouble positionX, GLdouble positionY, GLdouble positionZ, GLdouble l_rin, GLdouble h_rout, GLdouble w_h) { if (content == "cube") { create_cube(positionX, positionY, positionZ, l_rin, h_rout, w_h); } if (content == "pipe") { create_pipe(positionX, positionY, positionZ, l_rin, h_rout, w_h); } }
static void test_create(void) { HANDLE hserver; NTSTATUS res; int j, k; FILE_PIPE_LOCAL_INFORMATION info; IO_STATUS_BLOCK iosb; static const DWORD access[] = { 0, GENERIC_READ, GENERIC_WRITE, GENERIC_READ | GENERIC_WRITE}; static const DWORD sharing[] = { FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE }; static const DWORD pipe_config[]= { 1, 0, 2 }; for (j = 0; j < sizeof(sharing) / sizeof(DWORD); j++) { for (k = 0; k < sizeof(access) / sizeof(DWORD); k++) { HANDLE hclient; BOOL should_succeed = TRUE; res = create_pipe(&hserver, sharing[j], FILE_SYNCHRONOUS_IO_NONALERT); if (res) { ok(0, "NtCreateNamedPipeFile returned %x, sharing: %x\n", res, sharing[j]); continue; } res = pNtQueryInformationFile(hserver, &iosb, &info, sizeof(info), (FILE_INFORMATION_CLASS)24); ok(!res, "NtQueryInformationFile for server returned %x, sharing: %x\n", res, sharing[j]); ok(info.NamedPipeConfiguration == pipe_config[j], "wrong duplex status for pipe: %d, expected %d\n", info.NamedPipeConfiguration, pipe_config[j]); hclient = CreateFileW(testpipe, access[k], 0, 0, OPEN_EXISTING, 0, 0); if (hclient != INVALID_HANDLE_VALUE) { res = pNtQueryInformationFile(hclient, &iosb, &info, sizeof(info), (FILE_INFORMATION_CLASS)24); ok(!res, "NtQueryInformationFile for client returned %x, access: %x, sharing: %x\n", res, access[k], sharing[j]); ok(info.NamedPipeConfiguration == pipe_config[j], "wrong duplex status for pipe: %d, expected %d\n", info.NamedPipeConfiguration, pipe_config[j]); CloseHandle(hclient); } if (access[k] & GENERIC_WRITE) should_succeed &= !!(sharing[j] & FILE_SHARE_WRITE); if (access[k] & GENERIC_READ) should_succeed &= !!(sharing[j] & FILE_SHARE_READ); if (should_succeed) ok(hclient != INVALID_HANDLE_VALUE, "CreateFile failed for sharing %x, access: %x, GetLastError: %d\n", sharing[j], access[k], GetLastError()); else ok(hclient == INVALID_HANDLE_VALUE, "CreateFile succeeded for sharing %x, access: %x\n", sharing[j], access[k]); CloseHandle(hserver); } } }
WinListener::WinListener(const char *name, NamedPipe::ListenerInterface &listener_interface, ProcessLoop& process_loop) : _listener_interface (listener_interface) , _pipe (0) , _process_loop (process_loop) { _pipename = new TCHAR[PIPE_MAX_NAME_LEN]; swprintf_s(_pipename, PIPE_MAX_NAME_LEN, L"%s%S", PIPE_PREFIX, name); ZeroMemory(&_overlap, sizeof(_overlap)); _overlap.hEvent = this->get_handle(); _process_loop.add_handle(*this); create_pipe(); }
/* Open a bidirectional pipe. * * write system read * parent -> fd[1] -> STDIN_FILENO -> child * parent <- fd[0] <- STDOUT_FILENO <- child * read system write * */ pid_t create_pipe_bidi (const char *progname, const char *prog_path, char **prog_argv, bool null_stderr, bool slave_process, bool exit_on_error, int fd[2]) { pid_t result = create_pipe (progname, prog_path, prog_argv, true, true, NULL, NULL, null_stderr, slave_process, exit_on_error, fd); return result; }
/** * DataSource_Command Constructor */ DataSource_Command::DataSource_Command(const std::string& prog_and_args, const std::vector<std::string>& paths) : MAX_BLOCK_USECS(100000), KILL_WAIT(10000) { arg_list = split_on(prog_and_args, ' '); if(arg_list.size() == 0) throw Invalid_Argument("DataSource_Command: No command given"); if(arg_list.size() > 5) throw Invalid_Argument("DataSource_Command: Too many args"); pipe = 0; create_pipe(paths); }
/*===========================================================================* * do_pipe * *===========================================================================*/ int do_pipe(message *m_out) { /* Perform the pipe(fil_des[2]) system call. */ int r; int fil_des[2]; /* reply goes here */ r = create_pipe(fil_des, 0 /* no flags */); if (r == OK) { m_out->reply_i1 = fil_des[0]; m_out->reply_i2 = fil_des[1]; } return r; }
void WinListener::on_event() { DWORD bytes; if (!GetOverlappedResult(_pipe, &_overlap, &bytes, FALSE)) { DBG(0, "GetOverlappedResult() failed %u", GetLastError()); return; } DBG(0, "Pipe connected 0x%p", _pipe); WinConnection *con = new WinConnection(_pipe, _process_loop); NamedPipe::ConnectionInterface &con_interface = _listener_interface.create(); con->set_handler(&con_interface); con_interface.bind((NamedPipe::ConnectionRef)con); create_pipe(); }
/*===========================================================================* * do_pipe2 * *===========================================================================*/ int do_pipe2(void) { /* Perform the pipe2(fil_des[2], flags) system call. */ int r, flags; int fil_des[2]; /* reply goes here */ flags = job_m_in.m_lc_vfs_pipe2.flags; r = create_pipe(fil_des, flags); if (r == OK) { job_m_out.m_lc_vfs_pipe2.fd0 = fil_des[0]; job_m_out.m_lc_vfs_pipe2.fd1 = fil_des[1]; } return r; }
/* Open a pipe for output to a child process. * The child's stdout goes to a file. * * write system read * parent -> fd[0] -> STDIN_FILENO -> child * */ pid_t create_pipe_out (const char *progname, const char *prog_path, char **prog_argv, const char *prog_stdout, bool null_stderr, bool slave_process, bool exit_on_error, int fd[1]) { int iofd[2]; pid_t result = create_pipe (progname, prog_path, prog_argv, true, false, NULL, prog_stdout, null_stderr, slave_process, exit_on_error, iofd); if (result != -1) fd[0] = iofd[1]; return result; }
/*===========================================================================* * do_pipe2 * *===========================================================================*/ int do_pipe2(message *m_out) { /* Perform the pipe2(fil_des[2], flags) system call. */ int r, flags; int fil_des[2]; /* reply goes here */ flags = job_m_in.pipe_flags; r = create_pipe(fil_des, flags); if (r == OK) { m_out->reply_i1 = fil_des[0]; m_out->reply_i2 = fil_des[1]; } return r; }
os_process_pipe_t *os_process_pipe_create(const char *cmd_line, const char *type) { os_process_pipe_t *pp = NULL; bool read_pipe; HANDLE process; HANDLE output; HANDLE input; bool success; if (!cmd_line || !type) { return NULL; } if (*type != 'r' && *type != 'w') { return NULL; } if (!create_pipe(&input, &output)) { return NULL; } read_pipe = *type == 'r'; success = !!SetHandleInformation(read_pipe ? input : output, HANDLE_FLAG_INHERIT, false); if (!success) { goto error; } success = create_proccess(cmd_line, read_pipe ? NULL : input, read_pipe ? output : NULL, &process); if (!success) { goto error; } pp = bmalloc(sizeof(*pp)); pp->handle = read_pipe ? input : output; pp->read_pipe = read_pipe; pp->process = process; CloseHandle(read_pipe ? output : input); return pp; error: CloseHandle(output); CloseHandle(input); return NULL; }
static int vloopback_open(struct inode *inod, struct file *f) #endif { struct video_device *loopdev=video_devdata(f); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) priv_ptr ptr=(priv_ptr)video_get_drvdata(loopdev); #else priv_ptr ptr=(priv_ptr)loopdev->priv; #endif int nr=ptr->pipenr; /* Only allow a output to be opened if there is someone feeding * the pipe. */ if (!ptr->in) { if (loops[nr]->buffer==NULL) { return -EINVAL; } loops[nr]->framesread=0; loops[nr]->ropen=1; } else { if (loops[nr]->ropen || loops[nr]->wopen) return -EBUSY; loops[nr]->framesdumped=0; loops[nr]->frameswrite=0; loops[nr]->wopen=1; loops[nr]->zerocopy=0; loops[nr]->ioctlnr=-1; pipesused++; if (nr_o_pipes-pipesused<spares) { if (!create_pipe(nr_o_pipes)) { info("Creating extra spare pipe"); info("Loopback %d registered, input: video%d, output: video%d", nr_o_pipes, loops[nr_o_pipes]->vloopin->minor, loops[nr_o_pipes]->vloopout->minor ); nr_o_pipes++; } } loops[nr]->pid=current->pid; } return 0; }
void main( int argc, char *argv[] ) { #if defined( __NT__ ) _fileinfo = 1; #endif if( argc <= 1 ) { /* we are the spawning process */ create_pipe(); create_child( argv[0] ); fill_pipe(); } else { /* we are the spawned process */ empty_pipe( atoi( argv[1] ) ); } exit( EXIT_SUCCESS ); }