- Set signaled, errflg and rmverbose as static, it is used only inside the ipcrm.c.
- Clean up some extra NEW BLANK LINES.
- Extern some fucntions such like semctl, semget and so on.
- Reorder the parameters of semctl.
- Usage() don't need to use exit(1) as it is a void function with no return.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
usr.bin/ipcs/ipc.h | ||
---|---|---|
70 ↗ | (On Diff #5771) | Instead of putting these prototypes here, would. it be possible to instead put this in the .c files: #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <sys/sem.h> as specified in the semget() and msgget() man pages? Other than that, this patch looks OK. |
usr.bin/ipcrm/ipcrm.c | ||
---|---|---|
63 ↗ | (On Diff #5772) | Why do you need these prototypes here at all? Why not include the necessary header |
usr.bin/ipcrm/ipcrm.c | ||
---|---|---|
63 ↗ | (On Diff #5772) | Because there is a macro _KERNEL to control the visibility of types and prototypes in system headers, specifically for sem.h, shm.h and msg.h. Even include directly the headers as you mention, the prototypes are still not visible and CLANG will report the same warnings, plus some more. |
usr.bin/ipcrm/ipcrm.c | ||
---|---|---|
63 ↗ | (On Diff #5772) | Oh, I see, thanks for the explanation. Instead of copying the prototypes to the .c file though, (1) Modify the src/sys/sys/sem.h header file with this: Index: sys/sys/sem.h
+++ sys/sys/sem.h (working copy) */ void semexit(struct proc *p); -#else /* ! _KERNEL */ +if !defined(_KERNEL) || defined(_WANT_SEM_PROTOTYPES) Then in the .c file, #define _WANT_SEM_PROTOTYPES #define _KERNEL #include <sys/sem.h> #include <sys/shm.h> #include <sys/msg.h> #undef _KERNEL |
usr.bin/ipcrm/ipcrm.c | ||
---|---|---|
63 ↗ | (On Diff #5772) | Oh, I see, thanks for the explanation. Instead of copying the prototypes to the .c file though, (1) Modify the src/sys/sys/sem.h header file with this: Index: sys/sys/sem.h =================================================================== --- sys/sys/sem.h (revision 283641) +++ sys/sys/sem.h (working copy) @@ -137,8 +137,9 @@ */ void semexit(struct proc *p); -#else /* ! _KERNEL */ +#endif /* _KERNEL */ +if !defined(_KERNEL) || defined(_WANT_SEM_PROTOTYPES) __BEGIN_DECLS #if __BSD_VISIBLE int semsys(int, ...); Then in the .c file, #define _WANT_SEM_PROTOTYPES |