|
|
| version 1.1.2.2, 2013/12/05 15:04:20 | version 1.1.2.3, 2013/12/05 15:13:58 |
|---|---|
| Line 26 e_popen(const char *command, const char *type, pid_t * | Line 26 e_popen(const char *command, const char *type, pid_t * |
| int pdes[2], pid, twoway, cloexec; | int pdes[2], pid, twoway, cloexec; |
| char *argv[4]; | char *argv[4]; |
| if (!command || !type) | |
| return NULL; | |
| cloexec = strchr(type, 'e') != NULL; | cloexec = strchr(type, 'e') != NULL; |
| /* | /* |
| * Lite2 introduced two-way popen() pipes using _socketpair(). | * Lite2 introduced two-way popen() pipes using _socketpair(). |
| Line 140 e_pclose(FILE *iop) | Line 143 e_pclose(FILE *iop) |
| int pstat; | int pstat; |
| pid_t pid; | pid_t pid; |
| if (!iop) | |
| return -1; | |
| /* | /* |
| * Find the appropriate file pointer and remove it from the list. | * Find the appropriate file pointer and remove it from the list. |
| */ | */ |
| Line 168 e_pclose(FILE *iop) | Line 174 e_pclose(FILE *iop) |
| e_free(cur); | e_free(cur); |
| return (pid == -1 ? -1 : pstat); | return (pid == -1 ? -1 : pstat); |
| } | |
| /* | |
| * pio_pgetpid() - Get tagPIOPID structure from file handle | |
| * | |
| * @iop = popen handle | |
| * return: NULL error or !=NULL tagPIOPID structure | |
| */ | |
| struct tagPIOPID * | |
| pio_pgetpid(FILE * __restrict iop) | |
| { | |
| struct tagPIOPID *p; | |
| if (!iop) | |
| return NULL; | |
| THREAD_LOCK(); | |
| SLIST_FOREACH(p, &pio_pidlist, next) | |
| if (p->fp == iop) | |
| break; | |
| THREAD_UNLOCK(); | |
| return p; | |
| } | } |