aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_os_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_os_lib.h')
-rw-r--r--src/include/gnunet_os_lib.h135
1 files changed, 65 insertions, 70 deletions
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h
index b632ab262..e5bc7146b 100644
--- a/src/include/gnunet_os_lib.h
+++ b/src/include/gnunet_os_lib.h
@@ -11,12 +11,12 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20 20
21/** 21/**
22 * @author Christian Grothoff 22 * @author Christian Grothoff
@@ -65,9 +65,7 @@ extern "C"
65 * Flags that determine which of the standard streams 65 * Flags that determine which of the standard streams
66 * should be inherited by the child process. 66 * should be inherited by the child process.
67 */ 67 */
68enum GNUNET_OS_InheritStdioFlags 68enum GNUNET_OS_InheritStdioFlags {
69{
70
71 /** 69 /**
72 * No standard streams should be inherited. 70 * No standard streams should be inherited.
73 */ 71 */
@@ -114,8 +112,7 @@ struct GNUNET_OS_Process;
114/** 112/**
115 * Possible installation paths to request 113 * Possible installation paths to request
116 */ 114 */
117enum GNUNET_OS_InstallationPathKind 115enum GNUNET_OS_InstallationPathKind {
118{
119 /** 116 /**
120 * Return the "PREFIX" directory given to configure. 117 * Return the "PREFIX" directory given to configure.
121 */ 118 */
@@ -169,8 +166,7 @@ enum GNUNET_OS_InstallationPathKind
169/** 166/**
170 * Process status types 167 * Process status types
171 */ 168 */
172enum GNUNET_OS_ProcessStatusType 169enum GNUNET_OS_ProcessStatusType {
173{
174 /** 170 /**
175 * The process is not known to the OS (or at 171 * The process is not known to the OS (or at
176 * least not one of our children). 172 * least not one of our children).
@@ -203,8 +199,7 @@ enum GNUNET_OS_ProcessStatusType
203 * Project-specific data used to help the OS subsystem 199 * Project-specific data used to help the OS subsystem
204 * find installation paths. 200 * find installation paths.
205 */ 201 */
206struct GNUNET_OS_ProjectData 202struct GNUNET_OS_ProjectData {
207{
208 /** 203 /**
209 * Name of a library that is installed in the "lib/" directory of 204 * Name of a library that is installed in the "lib/" directory of
210 * the project, such as "libgnunetutil". Used to locate the 205 * the project, such as "libgnunetutil". Used to locate the
@@ -295,14 +290,14 @@ struct GNUNET_OS_ProjectData
295 * Return default project data used by 'libgnunetutil' for GNUnet. 290 * Return default project data used by 'libgnunetutil' for GNUnet.
296 */ 291 */
297const struct GNUNET_OS_ProjectData * 292const struct GNUNET_OS_ProjectData *
298GNUNET_OS_project_data_default (void); 293GNUNET_OS_project_data_default(void);
299 294
300 295
301/** 296/**
302 * @return current (actual) project data. 297 * @return current (actual) project data.
303 */ 298 */
304const struct GNUNET_OS_ProjectData * 299const struct GNUNET_OS_ProjectData *
305GNUNET_OS_project_data_get (void); 300GNUNET_OS_project_data_get(void);
306 301
307 302
308/** 303/**
@@ -311,7 +306,7 @@ GNUNET_OS_project_data_get (void);
311 * @param pd project data used to determine paths. 306 * @param pd project data used to determine paths.
312 */ 307 */
313void 308void
314GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd); 309GNUNET_OS_init(const struct GNUNET_OS_ProjectData *pd);
315 310
316 311
317/** 312/**
@@ -323,7 +318,7 @@ GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd);
323 * @return a pointer to the dir path (to be freed by the caller) 318 * @return a pointer to the dir path (to be freed by the caller)
324 */ 319 */
325char * 320char *
326GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind); 321GNUNET_OS_installation_get_path(enum GNUNET_OS_InstallationPathKind dirkind);
327 322
328 323
329/** 324/**
@@ -335,7 +330,7 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind);
335 * @return full path to the binary, if possible, otherwise copy of 'progname' 330 * @return full path to the binary, if possible, otherwise copy of 'progname'
336 */ 331 */
337char * 332char *
338GNUNET_OS_get_libexec_binary_path (const char *progname); 333GNUNET_OS_get_libexec_binary_path(const char *progname);
339 334
340 335
341/** 336/**
@@ -351,8 +346,8 @@ GNUNET_OS_get_libexec_binary_path (const char *progname);
351 * otherwise 346 * otherwise
352 */ 347 */
353char * 348char *
354GNUNET_OS_get_suid_binary_path (const struct GNUNET_CONFIGURATION_Handle *cfg, 349GNUNET_OS_get_suid_binary_path(const struct GNUNET_CONFIGURATION_Handle *cfg,
355 const char *progname); 350 const char *progname);
356 351
357 352
358/** 353/**
@@ -384,8 +379,8 @@ typedef int
384 * @param proc_cls closure for @a proc 379 * @param proc_cls closure for @a proc
385 */ 380 */
386void 381void
387GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc, 382GNUNET_OS_network_interfaces_list(GNUNET_OS_NetworkInterfaceProcessor proc,
388 void *proc_cls); 383 void *proc_cls);
389 384
390/** 385/**
391 * @brief Get maximum string length returned by gethostname() 386 * @brief Get maximum string length returned by gethostname()
@@ -408,7 +403,7 @@ GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc,
408 * @return pointer to the process sturcutre for this process 403 * @return pointer to the process sturcutre for this process
409 */ 404 */
410struct GNUNET_OS_Process * 405struct GNUNET_OS_Process *
411GNUNET_OS_process_current (void); 406GNUNET_OS_process_current(void);
412 407
413 408
414/** 409/**
@@ -419,8 +414,8 @@ GNUNET_OS_process_current (void);
419 * @return 0 on success, -1 on error 414 * @return 0 on success, -1 on error
420 */ 415 */
421int 416int
422GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, 417GNUNET_OS_process_kill(struct GNUNET_OS_Process *proc,
423 int sig); 418 int sig);
424 419
425 420
426/** 421/**
@@ -429,7 +424,7 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc,
429 * @param proc pointer to process structure 424 * @param proc pointer to process structure
430 */ 425 */
431void 426void
432GNUNET_OS_process_destroy (struct GNUNET_OS_Process *proc); 427GNUNET_OS_process_destroy(struct GNUNET_OS_Process *proc);
433 428
434 429
435/** 430/**
@@ -440,7 +435,7 @@ GNUNET_OS_process_destroy (struct GNUNET_OS_Process *proc);
440 * @return the current process id 435 * @return the current process id
441 */ 436 */
442pid_t 437pid_t
443GNUNET_OS_process_get_pid (struct GNUNET_OS_Process *proc); 438GNUNET_OS_process_get_pid(struct GNUNET_OS_Process *proc);
444 439
445 440
446/** 441/**
@@ -456,13 +451,13 @@ GNUNET_OS_process_get_pid (struct GNUNET_OS_Process *proc);
456 * @return pointer to process structure of the new process, NULL on error 451 * @return pointer to process structure of the new process, NULL on error
457 */ 452 */
458struct GNUNET_OS_Process * 453struct GNUNET_OS_Process *
459GNUNET_OS_start_process_vap (int pipe_control, 454GNUNET_OS_start_process_vap(int pipe_control,
460 enum GNUNET_OS_InheritStdioFlags std_inheritance, 455 enum GNUNET_OS_InheritStdioFlags std_inheritance,
461 struct GNUNET_DISK_PipeHandle *pipe_stdin, 456 struct GNUNET_DISK_PipeHandle *pipe_stdin,
462 struct GNUNET_DISK_PipeHandle *pipe_stdout, 457 struct GNUNET_DISK_PipeHandle *pipe_stdout,
463 struct GNUNET_DISK_PipeHandle *pipe_stderr, 458 struct GNUNET_DISK_PipeHandle *pipe_stderr,
464 const char *filename, 459 const char *filename,
465 char *const argv[]); 460 char *const argv[]);
466 461
467 462
468/** 463/**
@@ -478,12 +473,12 @@ GNUNET_OS_start_process_vap (int pipe_control,
478 * @return pointer to process structure of the new process, NULL on error 473 * @return pointer to process structure of the new process, NULL on error
479 */ 474 */
480struct GNUNET_OS_Process * 475struct GNUNET_OS_Process *
481GNUNET_OS_start_process (int pipe_control, 476GNUNET_OS_start_process(int pipe_control,
482 enum GNUNET_OS_InheritStdioFlags std_inheritance, 477 enum GNUNET_OS_InheritStdioFlags std_inheritance,
483 struct GNUNET_DISK_PipeHandle *pipe_stdin, 478 struct GNUNET_DISK_PipeHandle *pipe_stdin,
484 struct GNUNET_DISK_PipeHandle *pipe_stdout, 479 struct GNUNET_DISK_PipeHandle *pipe_stdout,
485 struct GNUNET_DISK_PipeHandle *pipe_stderr, 480 struct GNUNET_DISK_PipeHandle *pipe_stderr,
486 const char *filename, ...); 481 const char *filename, ...);
487 482
488 483
489/** 484/**
@@ -499,12 +494,12 @@ GNUNET_OS_start_process (int pipe_control,
499 * @return pointer to process structure of the new process, NULL on error 494 * @return pointer to process structure of the new process, NULL on error
500 */ 495 */
501struct GNUNET_OS_Process * 496struct GNUNET_OS_Process *
502GNUNET_OS_start_process_va (int pipe_control, 497GNUNET_OS_start_process_va(int pipe_control,
503 enum GNUNET_OS_InheritStdioFlags std_inheritance, 498 enum GNUNET_OS_InheritStdioFlags std_inheritance,
504 struct GNUNET_DISK_PipeHandle *pipe_stdin, 499 struct GNUNET_DISK_PipeHandle *pipe_stdin,
505 struct GNUNET_DISK_PipeHandle *pipe_stdout, 500 struct GNUNET_DISK_PipeHandle *pipe_stdout,
506 struct GNUNET_DISK_PipeHandle *pipe_stderr, 501 struct GNUNET_DISK_PipeHandle *pipe_stderr,
507 const char *filename, va_list va); 502 const char *filename, va_list va);
508 503
509/** 504/**
510 * Start a process. 505 * Start a process.
@@ -519,11 +514,11 @@ GNUNET_OS_start_process_va (int pipe_control,
519 * @return pointer to process structure of the new process, NULL on error 514 * @return pointer to process structure of the new process, NULL on error
520 */ 515 */
521struct GNUNET_OS_Process * 516struct GNUNET_OS_Process *
522GNUNET_OS_start_process_v (int pipe_control, 517GNUNET_OS_start_process_v(int pipe_control,
523 enum GNUNET_OS_InheritStdioFlags std_inheritance, 518 enum GNUNET_OS_InheritStdioFlags std_inheritance,
524 const SOCKTYPE *lsocks, 519 const SOCKTYPE *lsocks,
525 const char *filename, 520 const char *filename,
526 char *const argv[]); 521 char *const argv[]);
527 522
528 523
529/** 524/**
@@ -545,10 +540,10 @@ GNUNET_OS_start_process_v (int pipe_control,
545 * @return pointer to process structure of the new process, NULL on error 540 * @return pointer to process structure of the new process, NULL on error
546 */ 541 */
547struct GNUNET_OS_Process * 542struct GNUNET_OS_Process *
548GNUNET_OS_start_process_s (int pipe_control, 543GNUNET_OS_start_process_s(int pipe_control,
549 unsigned int std_inheritance, 544 unsigned int std_inheritance,
550 const SOCKTYPE * lsocks, 545 const SOCKTYPE * lsocks,
551 const char *filename, ...); 546 const char *filename, ...);
552 547
553 548
554/** 549/**
@@ -573,7 +568,7 @@ typedef void
573 * @param cmd handle to the process 568 * @param cmd handle to the process
574 */ 569 */
575void 570void
576GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd); 571GNUNET_OS_command_stop(struct GNUNET_OS_CommandHandle *cmd);
577 572
578 573
579/** 574/**
@@ -588,11 +583,11 @@ GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd);
588 * @return NULL on error 583 * @return NULL on error
589 */ 584 */
590struct GNUNET_OS_CommandHandle * 585struct GNUNET_OS_CommandHandle *
591GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, 586GNUNET_OS_command_run(GNUNET_OS_LineProcessor proc,
592 void *proc_cls, 587 void *proc_cls,
593 struct GNUNET_TIME_Relative timeout, 588 struct GNUNET_TIME_Relative timeout,
594 const char *binary, 589 const char *binary,
595 ...); 590 ...);
596 591
597 592
598/** 593/**
@@ -605,9 +600,9 @@ GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc,
605 * @return #GNUNET_OK on success, #GNUNET_NO if the process is still running, #GNUNET_SYSERR otherwise 600 * @return #GNUNET_OK on success, #GNUNET_NO if the process is still running, #GNUNET_SYSERR otherwise
606 */ 601 */
607int 602int
608GNUNET_OS_process_status (struct GNUNET_OS_Process *proc, 603GNUNET_OS_process_status(struct GNUNET_OS_Process *proc,
609 enum GNUNET_OS_ProcessStatusType *type, 604 enum GNUNET_OS_ProcessStatusType *type,
610 unsigned long *code); 605 unsigned long *code);
611 606
612 607
613/** 608/**
@@ -621,7 +616,7 @@ GNUNET_OS_process_status (struct GNUNET_OS_Process *proc,
621 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise 616 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
622 */ 617 */
623int 618int
624GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc); 619GNUNET_OS_process_wait(struct GNUNET_OS_Process *proc);
625 620
626 621
627 622
@@ -635,9 +630,9 @@ GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc);
635 * @return #GNUNET_OK on success, #GNUNET_NO if the process is still running, #GNUNET_SYSERR otherwise 630 * @return #GNUNET_OK on success, #GNUNET_NO if the process is still running, #GNUNET_SYSERR otherwise
636 */ 631 */
637int 632int
638GNUNET_OS_process_wait_status (struct GNUNET_OS_Process *proc, 633GNUNET_OS_process_wait_status(struct GNUNET_OS_Process *proc,
639 enum GNUNET_OS_ProcessStatusType *type, 634 enum GNUNET_OS_ProcessStatusType *type,
640 unsigned long *code); 635 unsigned long *code);
641 636
642 637
643/** 638/**
@@ -649,7 +644,7 @@ GNUNET_OS_process_wait_status (struct GNUNET_OS_Process *proc,
649 * @param cls closure (unused) 644 * @param cls closure (unused)
650 */ 645 */
651void 646void
652GNUNET_OS_install_parent_control_handler (void *cls); 647GNUNET_OS_install_parent_control_handler(void *cls);
653 648
654 649
655/** 650/**
@@ -670,9 +665,9 @@ GNUNET_OS_install_parent_control_handler (void *cls);
670 * #GNUNET_SYSERR on error (no such binary or not executable) 665 * #GNUNET_SYSERR on error (no such binary or not executable)
671 */ 666 */
672int 667int
673GNUNET_OS_check_helper_binary (const char *binary, 668GNUNET_OS_check_helper_binary(const char *binary,
674 int check_suid, 669 int check_suid,
675 const char *params); 670 const char *params);
676 671
677 672
678#if 0 /* keep Emacsens' auto-indent happy */ 673#if 0 /* keep Emacsens' auto-indent happy */