PageRenderTime 47ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/sys-apps/ucspi-tcp/files/0.88-protos.patch

https://gitlab.com/kogaion/portage
Patch | 544 lines | 472 code | 72 blank | 0 comment | 0 complexity | d0cd04fbf63ff8759a475103cb4be42e MD5 | raw file
  1. rely on standard POSIX headers to fix globs of warnings
  2. --- a/tcprulescheck.c
  3. +++ b/tcprulescheck.c
  4. @@ -1,3 +1,5 @@
  5. +#include <unistd.h>
  6. +
  7. #include "byte.h"
  8. #include "buffer.h"
  9. #include "strerr.h"
  10. --- a/buffer.c
  11. +++ b/buffer.c
  12. @@ -1,6 +1,6 @@
  13. #include "buffer.h"
  14. -void buffer_init(buffer *s,int (*op)(),int fd,char *buf,unsigned int len)
  15. +void buffer_init(buffer *s,ssize_t (*op)(),int fd,char *buf,unsigned int len)
  16. {
  17. s->x = buf;
  18. s->fd = fd;
  19. --- a/buffer.h
  20. +++ b/buffer.h
  21. @@ -1,6 +1,8 @@
  22. #ifndef BUFFER_H
  23. #define BUFFER_H
  24. +#include <sys/types.h>
  25. +
  26. typedef struct buffer {
  27. char *x;
  28. unsigned int p;
  29. @@ -13,7 +15,7 @@ typedef struct buffer {
  30. #define BUFFER_INSIZE 8192
  31. #define BUFFER_OUTSIZE 8192
  32. -extern void buffer_init(buffer *,int (*)(),int,char *,unsigned int);
  33. +extern void buffer_init(buffer *,ssize_t (*)(),int,char *,unsigned int);
  34. extern int buffer_flush(buffer *);
  35. extern int buffer_put(buffer *,char *,unsigned int);
  36. --- a/exit.h
  37. +++ b/exit.h
  38. @@ -1,6 +1,6 @@
  39. #ifndef EXIT_H
  40. #define EXIT_H
  41. -extern void _exit();
  42. +#include <unistd.h>
  43. #endif
  44. --- a/install.c
  45. +++ b/install.c
  46. @@ -1,3 +1,4 @@
  47. +#include <sys/stat.h>
  48. #include "buffer.h"
  49. #include "strerr.h"
  50. #include "error.h"
  51. --- a/readwrite.h
  52. +++ b/readwrite.h
  53. @@ -1,7 +1,6 @@
  54. #ifndef READWRITE_H
  55. #define READWRITE_H
  56. -extern int read();
  57. -extern int write();
  58. +#include <unistd.h>
  59. #endif
  60. --- a/auto-str.c
  61. +++ b/auto-str.c
  62. @@ -5,6 +5,7 @@
  63. char bspace[256];
  64. buffer b = BUFFER_INIT(write,1,bspace,sizeof bspace);
  65. +#define puts _puts
  66. void puts(char *s)
  67. {
  68. if (buffer_puts(&b,s) == -1) _exit(111);
  69. --- a/buffer.h
  70. +++ b/buffer.h
  71. @@ -8,7 +8,7 @@ typedef struct buffer {
  72. unsigned int p;
  73. unsigned int n;
  74. int fd;
  75. - int (*op)();
  76. + ssize_t (*op)();
  77. } buffer;
  78. #define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) }
  79. --- a/fd_copy.c
  80. +++ b/fd_copy.c
  81. @@ -1,4 +1,5 @@
  82. #include <fcntl.h>
  83. +#include <unistd.h>
  84. #include "fd.h"
  85. int fd_copy(int to,int from)
  86. --- a/fd_move.c
  87. +++ b/fd_move.c
  88. @@ -1,3 +1,4 @@
  89. +#include <unistd.h>
  90. #include "fd.h"
  91. int fd_move(int to,int from)
  92. --- a/socket_tcp.c
  93. +++ b/socket_tcp.c
  94. @@ -1,3 +1,4 @@
  95. +#include <unistd.h>
  96. #include <sys/types.h>
  97. #include <sys/param.h>
  98. #include <sys/socket.h>
  99. --- a/chkshsgr.c
  100. +++ b/chkshsgr.c
  101. @@ -1,8 +1,9 @@
  102. +#include <grp.h>
  103. #include "exit.h"
  104. main()
  105. {
  106. - short x[4];
  107. + gid_t x[4];
  108. x[0] = x[1] = 0;
  109. if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);
  110. --- a/prot.c
  111. +++ b/prot.c
  112. @@ -1,10 +1,10 @@
  113. #include "hasshsgr.h"
  114. #include "prot.h"
  115. -int prot_gid(int gid)
  116. +int prot_gid(gid_t gid)
  117. {
  118. #ifdef HASSHORTSETGROUPS
  119. - short x[2];
  120. + gid_t x[2];
  121. x[0] = gid; x[1] = 73; /* catch errors */
  122. if (setgroups(1,x) == -1) return -1;
  123. #else
  124. @@ -13,7 +13,7 @@ int prot_gid(int gid)
  125. return setgid(gid); /* _should_ be redundant, but on some systems it isn't */
  126. }
  127. -int prot_uid(int uid)
  128. +int prot_uid(uid_t uid)
  129. {
  130. return setuid(uid);
  131. }
  132. --- a/prot.h
  133. +++ b/prot.h
  134. @@ -1,7 +1,10 @@
  135. #ifndef PROT_H
  136. #define PROT_H
  137. -extern int prot_gid(int);
  138. -extern int prot_uid(int);
  139. +#include <unistd.h>
  140. +#include <grp.h>
  141. +
  142. +extern int prot_gid(gid_t);
  143. +extern int prot_uid(uid_t);
  144. #endif
  145. --- a/fixcrio.c
  146. +++ b/fixcrio.c
  147. @@ -6,6 +6,7 @@
  148. #include "exit.h"
  149. #include "iopause.h"
  150. #include "pathexec.h"
  151. +#include "fd.h"
  152. #define FATAL "fixcrio: fatal: "
  153. --- a/hier.c
  154. +++ b/hier.c
  155. @@ -1,5 +1,9 @@
  156. #include "auto_home.h"
  157. +extern void h(char *, int, int, int);
  158. +extern void d(char *, char *, int, int, int);
  159. +extern void c(char *, char *, char *, int, int, int);
  160. +
  161. void hier()
  162. {
  163. h(auto_home,-1,-1,02755);
  164. --- a/mconnect-io.c
  165. +++ b/mconnect-io.c
  166. @@ -1,3 +1,4 @@
  167. +#include <signal.h>
  168. #include "sig.h"
  169. #include "wait.h"
  170. #include "fork.h"
  171. @@ -12,7 +13,7 @@ buffer bout;
  172. char inbuf[512];
  173. buffer bin;
  174. -int myread(int fd,char *buf,int len)
  175. +ssize_t myread(int fd,char *buf,int len)
  176. {
  177. buffer_flush(&bout);
  178. return read(fd,buf,len);
  179. --- a/tcprules.c
  180. +++ b/tcprules.c
  181. @@ -1,3 +1,4 @@
  182. +#include <stdio.h>
  183. #include "strerr.h"
  184. #include "stralloc.h"
  185. #include "getln.h"
  186. @@ -6,6 +7,8 @@
  187. #include "fmt.h"
  188. #include "byte.h"
  189. #include "cdb_make.h"
  190. +#include "open.h"
  191. +#include "scan.h"
  192. #define FATAL "tcprules: fatal: "
  193. --- a/pathexec_run.c
  194. +++ b/pathexec_run.c
  195. @@ -1,3 +1,4 @@
  196. +#include <unistd.h>
  197. #include "error.h"
  198. #include "stralloc.h"
  199. #include "str.h"
  200. --- a/recordio.c
  201. +++ b/recordio.c
  202. @@ -8,6 +8,7 @@
  203. #include "fmt.h"
  204. #include "iopause.h"
  205. #include "pathexec.h"
  206. +#include "fd.h"
  207. #define FATAL "recordio: fatal: "
  208. --- a/seek_set.c
  209. +++ b/seek_set.c
  210. @@ -1,7 +1,6 @@
  211. +#include <unistd.h>
  212. #include <sys/types.h>
  213. #include "seek.h"
  214. -#define SET 0 /* sigh */
  215. -
  216. int seek_set(int fd,seek_pos pos)
  217. -{ if (lseek(fd,(off_t) pos,SET) == -1) return -1; return 0; }
  218. +{ if (lseek(fd,(off_t) pos,SEEK_SET) == -1) return -1; return 0; }
  219. --- a/socket_udp.c
  220. +++ b/socket_udp.c
  221. @@ -2,6 +2,7 @@
  222. #include <sys/param.h>
  223. #include <sys/socket.h>
  224. #include <netinet/in.h>
  225. +#include <unistd.h>
  226. #include "ndelay.h"
  227. #include "socket.h"
  228. --- a/tcprulescheck.c
  229. +++ b/tcprulescheck.c
  230. @@ -5,6 +5,7 @@
  231. #include "strerr.h"
  232. #include "env.h"
  233. #include "rules.h"
  234. +#include "open.h"
  235. void found(char *data,unsigned int datalen)
  236. {
  237. the prototypes are added near the top to avoid conflicts w/ipv6 patch
  238. --- a/socket.h
  239. +++ b/socket.h
  240. @@ -3,6 +3,9 @@
  241. #ifndef SOCKET_H
  242. #define SOCKET_H
  243. +extern int socket_tcpnodelay(int);
  244. +extern int socket_ipoptionskill(int);
  245. +
  246. #include "uint16.h"
  247. extern int socket_tcp(void);
  248. --- a/remoteinfo.c
  249. +++ b/remoteinfo.c
  250. @@ -1,3 +1,4 @@
  251. +#include <unistd.h>
  252. #include "fmt.h"
  253. #include "buffer.h"
  254. #include "socket.h"
  255. @@ -5,11 +6,12 @@
  256. #include "iopause.h"
  257. #include "timeoutconn.h"
  258. #include "remoteinfo.h"
  259. +#include "readwrite.h"
  260. static struct taia now;
  261. static struct taia deadline;
  262. -static int mywrite(int fd,char *buf,int len)
  263. +static ssize_t mywrite(int fd,char *buf,int len)
  264. {
  265. iopause_fd x;
  266. @@ -27,7 +29,7 @@ static int mywrite(int fd,char *buf,int len)
  267. return write(fd,buf,len);
  268. }
  269. -static int myread(int fd,char *buf,int len)
  270. +static ssize_t myread(int fd,char *buf,int len)
  271. {
  272. iopause_fd x;
  273. --- a/alloc.c
  274. +++ b/alloc.c
  275. @@ -1,7 +1,5 @@
  276. #include "alloc.h"
  277. #include "error.h"
  278. -extern char *malloc();
  279. -extern void free();
  280. #define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */
  281. #define SPACE 2048 /* must be multiple of ALIGNMENT */
  282. --- a/alloc.h
  283. +++ b/alloc.h
  284. @@ -1,8 +1,10 @@
  285. #ifndef ALLOC_H
  286. #define ALLOC_H
  287. -extern /*@null@*//*@out@*/char *alloc();
  288. -extern void alloc_free();
  289. +#include <stdlib.h>
  290. +
  291. +extern /*@null@*//*@out@*/char *alloc(unsigned int);
  292. +extern void alloc_free(char *);
  293. extern int alloc_re();
  294. #endif
  295. --- a/buffer_0.c
  296. +++ b/buffer_0.c
  297. @@ -1,7 +1,7 @@
  298. #include "readwrite.h"
  299. #include "buffer.h"
  300. -int buffer_0_read(fd,buf,len) int fd; char *buf; int len;
  301. +ssize_t buffer_0_read(fd,buf,len) int fd; char *buf; int len;
  302. {
  303. if (buffer_flush(buffer_1) == -1) return -1;
  304. return read(fd,buf,len);
  305. --- a/buffer_get.c
  306. +++ b/buffer_get.c
  307. @@ -2,7 +2,7 @@
  308. #include "byte.h"
  309. #include "error.h"
  310. -static int oneread(int (*op)(),int fd,char *buf,unsigned int len)
  311. +static int oneread(ssize_t (*op)(),int fd,char *buf,unsigned int len)
  312. {
  313. int r;
  314. --- a/buffer_put.c
  315. +++ b/buffer_put.c
  316. @@ -3,7 +3,7 @@
  317. #include "byte.h"
  318. #include "error.h"
  319. -static int allwrite(int (*op)(),int fd,char *buf,unsigned int len)
  320. +static int allwrite(ssize_t (*op)(),int fd,char *buf,unsigned int len)
  321. {
  322. int w;
  323. --- a/case.h
  324. +++ b/case.h
  325. @@ -4,7 +4,7 @@
  326. extern void case_lowers(char *);
  327. extern void case_lowerb(char *,unsigned int);
  328. extern int case_diffs(char *,char *);
  329. -extern int case_diffb(char *,unsigned int,char *);
  330. +extern int case_diffb(const char *,unsigned int,const char *);
  331. extern int case_starts(char *,char *);
  332. extern int case_startb(char *,unsigned int,char *);
  333. --- a/case_diffb.c
  334. +++ b/case_diffb.c
  335. @@ -1,6 +1,6 @@
  336. #include "case.h"
  337. -int case_diffb(register char *s,register unsigned int len,register char *t)
  338. +int case_diffb(register const char *s,register unsigned int len,const register char *t)
  339. {
  340. register unsigned char x;
  341. register unsigned char y;
  342. --- a/open.h
  343. +++ b/open.h
  344. @@ -1,10 +1,10 @@
  345. #ifndef OPEN_H
  346. #define OPEN_H
  347. -extern int open_read(char *);
  348. -extern int open_excl(char *);
  349. -extern int open_append(char *);
  350. -extern int open_trunc(char *);
  351. -extern int open_write(char *);
  352. +extern int open_read(const char *);
  353. +extern int open_excl(const char *);
  354. +extern int open_append(const char *);
  355. +extern int open_trunc(const char *);
  356. +extern int open_write(const char *);
  357. #endif
  358. --- a/open_read.c
  359. +++ b/open_read.c
  360. @@ -2,5 +2,5 @@
  361. #include <fcntl.h>
  362. #include "open.h"
  363. -int open_read(char *fn)
  364. +int open_read(const char *fn)
  365. { return open(fn,O_RDONLY | O_NDELAY); }
  366. --- a/open_trunc.c
  367. +++ b/open_trunc.c
  368. @@ -2,5 +2,5 @@
  369. #include <fcntl.h>
  370. #include "open.h"
  371. -int open_trunc(char *fn)
  372. +int open_trunc(const char *fn)
  373. { return open(fn,O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT,0644); }
  374. --- a/open_write.c
  375. +++ b/open_write.c
  376. @@ -2,5 +2,5 @@
  377. #include <fcntl.h>
  378. #include "open.h"
  379. -int open_write(char *fn)
  380. +int open_write(const char *fn)
  381. { return open(fn,O_WRONLY | O_NDELAY); }
  382. --- a/openreadclose.c
  383. +++ b/openreadclose.c
  384. @@ -3,7 +3,7 @@
  385. #include "readclose.h"
  386. #include "openreadclose.h"
  387. -int openreadclose(char *fn,stralloc *sa,unsigned int bufsize)
  388. +int openreadclose(const char *fn,stralloc *sa,unsigned int bufsize)
  389. {
  390. int fd;
  391. fd = open_read(fn);
  392. --- a/openreadclose.h
  393. +++ b/openreadclose.h
  394. @@ -3,6 +3,6 @@
  395. #include "stralloc.h"
  396. -extern int openreadclose(char *,stralloc *,unsigned int);
  397. +extern int openreadclose(const char *,stralloc *,unsigned int);
  398. #endif
  399. --- a/stralloc.h
  400. +++ b/stralloc.h
  401. @@ -7,7 +7,7 @@ GEN_ALLOC_typedef(stralloc,char,s,len,a)
  402. extern int stralloc_ready(stralloc *,unsigned int);
  403. extern int stralloc_readyplus(stralloc *,unsigned int);
  404. -extern int stralloc_copy(stralloc *,stralloc *);
  405. +extern int stralloc_copy(stralloc *,const stralloc *);
  406. extern int stralloc_cat(stralloc *,stralloc *);
  407. extern int stralloc_copys(stralloc *,const char *);
  408. extern int stralloc_cats(stralloc *,const char *);
  409. --- a/stralloc_copy.c
  410. +++ b/stralloc_copy.c
  411. @@ -1,7 +1,7 @@
  412. #include "byte.h"
  413. #include "stralloc.h"
  414. -int stralloc_copy(stralloc *sato,stralloc *safrom)
  415. +int stralloc_copy(stralloc *sato,const stralloc *safrom)
  416. {
  417. return stralloc_copyb(sato,safrom->s,safrom->len);
  418. }
  419. --- a/taia.h
  420. +++ b/taia.h
  421. @@ -19,7 +19,7 @@ extern double taia_frac(struct taia *);
  422. extern void taia_add(struct taia *,struct taia *,struct taia *);
  423. extern void taia_sub(struct taia *,struct taia *,struct taia *);
  424. extern void taia_half(struct taia *,struct taia *);
  425. -extern int taia_less(struct taia *,struct taia *);
  426. +extern int taia_less(const struct taia *,const struct taia *);
  427. #define TAIA_PACK 16
  428. extern void taia_pack(char *,struct taia *);
  429. --- a/taia_less.c
  430. +++ b/taia_less.c
  431. @@ -2,7 +2,7 @@
  432. /* XXX: breaks tai encapsulation */
  433. -int taia_less(struct taia *t,struct taia *u)
  434. +int taia_less(const struct taia *t,const struct taia *u)
  435. {
  436. if (t->sec.x < u->sec.x) return 1;
  437. if (t->sec.x > u->sec.x) return 0;
  438. --- a/uint32.h1
  439. +++ b/uint32.h1
  440. @@ -5,7 +5,7 @@ typedef unsigned int uint32;
  441. extern void uint32_pack(char *,uint32);
  442. extern void uint32_pack_big(char *,uint32);
  443. -extern void uint32_unpack(char *,uint32 *);
  444. -extern void uint32_unpack_big(char *,uint32 *);
  445. +extern void uint32_unpack(const char *,uint32 *);
  446. +extern void uint32_unpack_big(const char *,uint32 *);
  447. #endif
  448. --- a/uint32.h2
  449. +++ b/uint32.h2
  450. @@ -5,7 +5,7 @@ typedef unsigned long uint32;
  451. extern void uint32_pack(char *,uint32);
  452. extern void uint32_pack_big(char *,uint32);
  453. -extern void uint32_unpack(char *,uint32 *);
  454. -extern void uint32_unpack_big(char *,uint32 *);
  455. +extern void uint32_unpack(const char *,uint32 *);
  456. +extern void uint32_unpack_big(const char *,uint32 *);
  457. #endif
  458. --- a/uint32_unpack.c
  459. +++ b/uint32_unpack.c
  460. @@ -1,6 +1,6 @@
  461. #include "uint32.h"
  462. -void uint32_unpack(char s[4],uint32 *u)
  463. +void uint32_unpack(const char s[4],uint32 *u)
  464. {
  465. uint32 result;
  466. @@ -15,7 +15,7 @@ void uint32_unpack(char s[4],uint32 *u)
  467. *u = result;
  468. }
  469. -void uint32_unpack_big(char s[4],uint32 *u)
  470. +void uint32_unpack_big(const char s[4],uint32 *u)
  471. {
  472. uint32 result;