X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Futil.h;h=dcfc16d46083ceac938f38a32f8a7a88bb6be025;hp=7f25788b3f9af2d22f2e1c8f10bd1dff0fd7ff09;hb=bb99a35a873c35e80b0b47fe045081022660374d;hpb=babfc09177c1e71cec6c1ef9602e265ed40cfe4f diff --git a/src/util.h b/src/util.h index 7f25788b3..dcfc16d46 100644 --- a/src/util.h +++ b/src/util.h @@ -67,8 +67,10 @@ typedef struct dual_timestamp { #define FORMAT_TIMESTAMP_MAX 64 #define FORMAT_TIMESTAMP_PRETTY_MAX 256 #define FORMAT_TIMESPAN_MAX 64 +#define FORMAT_BYTES_MAX 8 -#define ANSI_HIGHLIGHT_ON "\x1B[1;31m" +#define ANSI_HIGHLIGHT_ON "\x1B[1;39m" +#define ANSI_HIGHLIGHT_RED_ON "\x1B[1;31m" #define ANSI_HIGHLIGHT_GREEN_ON "\x1B[1;32m" #define ANSI_HIGHLIGHT_OFF "\x1B[0m" @@ -251,6 +253,7 @@ int rmdir_parents(const char *path, const char *stop); int get_process_comm(pid_t pid, char **name); int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char **line); int get_process_exe(pid_t pid, char **name); +int get_process_uid(pid_t pid, uid_t *uid); char hexchar(int x); int unhexchar(char c); @@ -324,7 +327,7 @@ bool fstype_is_network(const char *fstype); int chvt(int vt); -int read_one_char(FILE *f, char *ret, bool *need_nl); +int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl); int ask(char *ret, const char *replies, const char *text, ...); int reset_terminal_fd(int fd); @@ -374,12 +377,16 @@ int pipe_eof(int fd); cpu_set_t* cpu_set_malloc(unsigned *ncpus); -void status_vprintf(const char *format, va_list ap); -void status_printf(const char *format, ...); +void status_vprintf(const char *status, bool ellipse, const char *format, va_list ap); +void status_printf(const char *status, bool ellipse, const char *format, ...); void status_welcome(void); +int fd_columns(int fd); unsigned columns(void); +int fd_lines(int fd); +unsigned lines(void); + int running_in_chroot(void); char *ellipsize(const char *s, size_t length, unsigned percent); @@ -408,6 +415,7 @@ char *fstab_node_to_udev_node(const char *p); void filter_environ(const char *prefix); bool tty_is_vc(const char *tty); +bool tty_is_vc_resolve(const char *tty); int vtnr_from_tty(const char *tty); const char *default_term_for_tty(const char *tty); @@ -473,7 +481,7 @@ bool in_charset(const char *s, const char* charset); int block_get_whole_disk(dev_t d, dev_t *ret); -int file_is_sticky(const char *p); +int file_is_priv_sticky(const char *p); int strdup_or_null(const char *a, char **b); @@ -520,4 +528,15 @@ unsigned long cap_last_cap(void); char *format_bytes(char *buf, size_t l, off_t t); +int fd_wait_for_event(int fd, int event, usec_t timeout); + +void* memdup(const void *p, size_t l); + +int rtc_open(int flags); + +int is_kernel_thread(pid_t pid); + +int fd_inc_sndbuf(int fd, size_t n); +int fd_inc_rcvbuf(int fd, size_t n); + #endif