Rizin
unix-like reverse engineering framework and cli tools
system.h
Go to the documentation of this file.
1 /* This file is part of libmspack.
2  * (C) 2003-2018 Stuart Caie.
3  *
4  * libmspack is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License (LGPL) version 2.1
6  *
7  * For further details, see the file COPYING.LIB distributed with libmspack
8  */
9 
10 #ifndef MSPACK_SYSTEM_H
11 #define MSPACK_SYSTEM_H 1
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /* ensure config.h is read before mspack.h */
18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include <mspack.h>
22 #include <macros.h>
23 
24 /* assume <string.h> exists */
25 #ifndef MSPACK_NO_DEFAULT_SYSTEM
26 # include <string.h>
27 #else
28  /* but if no default system wanted, avoid using <string.h> entirely,
29  * to avoid linking to even these standard C library functions */
30 static inline int memcmp(const void *s1, const void *s2, size_t n) {
31  const unsigned char *a = s1, *b = s2;
32  while (n--) if (*a++ != *b++) return a[-1] - b[-1];
33  return 0;
34 }
35 static inline void *memset(void *s, int c, size_t n) {
36  unsigned char *s2 = s, c2 = (unsigned char) c;
37  while (n--) *s2++ = c2;
38  return s;
39 }
40 static inline size_t strlen(const char *s) {
41  size_t c = 0; while (*s++) c++; return c;
42 }
43 #endif
44 
45 /* fix for problem with GCC 4 and glibc (thanks to Ville Skytta)
46  * http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=150429
47  */
48 #ifdef read
49 # undef read
50 #endif
51 
53 
54 /* returns the length of a file opened for reading */
55 extern int mspack_sys_filelen(struct mspack_system *system,
56  struct mspack_file *file, off_t *length);
57 
58 /* validates a system structure */
59 extern int mspack_valid_system(struct mspack_system *sys);
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #endif
lsl lsr asr ror lsl lsr asr ror lsl lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror c2
int mspack_sys_filelen(struct mspack_system *system, struct mspack_file *file, off_t *length)
Definition: system.c:66
struct mspack_system * mspack_default_system
Definition: system.c:238
int mspack_valid_system(struct mspack_system *sys)
Definition: system.c:58
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
Definition: sflib.h:133
return memset(p, 0, total)
int n
Definition: mipsasm.c:19
static RzSocket * s
Definition: rtr.c:28
int off_t
Definition: sftypes.h:41
#define b(i)
Definition: sha256.c:42
#define c(i)
Definition: sha256.c:43
#define a(i)
Definition: sha256.c:41
#define s1(x)
Definition: sha256.c:60
Definition: gzappend.c:170